Skip to content

Commit

Permalink
Auto merge of #39734 - alexcrichton:beta-next, r=brson
Browse files Browse the repository at this point in the history
[beta] Backporting PRs to beta

This is a backport of the following PRs:

* #39478
* #39509
* #39517
* #39526
* #39599
* #39624
* #39710
  • Loading branch information
bors committed Feb 11, 2017
2 parents 064c2a2 + a37685c commit 9e272fa
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
10 changes: 10 additions & 0 deletions RELEASES.md
@@ -1,3 +1,13 @@
Version 1.15.1 (2017-02-09)
===========================

* [Fix IntoIter::as_mut_slice's signature][39466]
* [Compile compiler builtins with `-fPIC` on 32-bit platforms][39523]

[39466]: https://github.com/rust-lang/rust/pull/39466
[39523]: https://github.com/rust-lang/rust/pull/39523


Version 1.15.0 (2017-02-02)
===========================

Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/dist.rs
Expand Up @@ -381,7 +381,8 @@ pub fn rust_src(build: &Build) {
"README.md",
"RELEASES.md",
"configure",
"Makefile.in"
"Makefile.in",
"x.py",
];
let src_dirs = [
"man",
Expand Down
4 changes: 3 additions & 1 deletion src/libbacktrace/pecoff.c
Expand Up @@ -607,7 +607,9 @@ coff_add (struct backtrace_state *state, int descriptor,
// against the upstream libbacktrace, that's what's going on.
uint32_t str_size;
off_t str_off;
struct backtrace_view syms_view;
// NOTE: upstream doesn't have `{0}`, this is a fix for Rust issue #39468.
// If syms_view is not initialized, then `free(syms_view.base)` may segfault later.
struct backtrace_view syms_view = {0};
off_t syms_off;
size_t syms_size;
int syms_view_valid;
Expand Down
27 changes: 22 additions & 5 deletions src/librustc_const_eval/check_match.rs
Expand Up @@ -273,7 +273,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
let mut seen = Matrix::empty();
let mut catchall = None;
let mut printed_if_let_err = false;
for &(ref pats, guard) in arms {
for (arm_index, &(ref pats, guard)) in arms.iter().enumerate() {
for &(pat, hir_pat) in pats {
let v = vec![pat];

Expand Down Expand Up @@ -302,10 +302,27 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
let &(ref first_arm_pats, _) = &arms[0];
let first_pat = &first_arm_pats[0];
let span = first_pat.0.span;
struct_span_err!(cx.tcx.sess, span, E0165,
"irrefutable while-let pattern")
.span_label(span, &format!("irrefutable pattern"))
.emit();

// check which arm we're on.
match arm_index {
// The arm with the user-specified pattern.
0 => {
let mut diagnostic = Diagnostic::new(Level::Warning,
"unreachable pattern");
diagnostic.set_span(pat.span);
cx.tcx.sess.add_lint_diagnostic(
lint::builtin::UNREACHABLE_PATTERNS,
hir_pat.id, diagnostic);
},
// The arm with the wildcard pattern.
1 => {
struct_span_err!(cx.tcx.sess, span, E0165,
"irrefutable while-let pattern")
.span_label(span, &format!("irrefutable pattern"))
.emit();
},
_ => bug!(),
}
},

hir::MatchSource::ForLoopDesugar |
Expand Down
8 changes: 8 additions & 0 deletions src/test/compile-fail/uninhabited-patterns.rs
Expand Up @@ -24,6 +24,10 @@ struct NotSoSecretlyEmpty {
_priv: !,
}

fn foo() -> Option<NotSoSecretlyEmpty> {
None
}

fn main() {
let x: &[!] = &[];

Expand All @@ -45,5 +49,9 @@ fn main() {
Err(Err(_y)) => (),
Err(Ok(_y)) => (), //~ ERROR unreachable pattern
}

while let Some(_y) = foo() {
//~^ ERROR unreachable pattern
}
}

0 comments on commit 9e272fa

Please sign in to comment.