Skip to content

Commit 9e272fa

Browse files
committed
Auto merge of #39734 - alexcrichton:beta-next, r=brson
[beta] Backporting PRs to beta This is a backport of the following PRs: * #39478 * #39509 * #39517 * #39526 * #39599 * #39624 * #39710
2 parents 064c2a2 + a37685c commit 9e272fa

File tree

5 files changed

+45
-7
lines changed

5 files changed

+45
-7
lines changed

RELEASES.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
Version 1.15.1 (2017-02-09)
2+
===========================
3+
4+
* [Fix IntoIter::as_mut_slice's signature][39466]
5+
* [Compile compiler builtins with `-fPIC` on 32-bit platforms][39523]
6+
7+
[39466]: https://github.com/rust-lang/rust/pull/39466
8+
[39523]: https://github.com/rust-lang/rust/pull/39523
9+
10+
111
Version 1.15.0 (2017-02-02)
212
===========================
313

src/bootstrap/dist.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ pub fn rust_src(build: &Build) {
381381
"README.md",
382382
"RELEASES.md",
383383
"configure",
384-
"Makefile.in"
384+
"Makefile.in",
385+
"x.py",
385386
];
386387
let src_dirs = [
387388
"man",

src/libbacktrace/pecoff.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,9 @@ coff_add (struct backtrace_state *state, int descriptor,
607607
// against the upstream libbacktrace, that's what's going on.
608608
uint32_t str_size;
609609
off_t str_off;
610-
struct backtrace_view syms_view;
610+
// NOTE: upstream doesn't have `{0}`, this is a fix for Rust issue #39468.
611+
// If syms_view is not initialized, then `free(syms_view.base)` may segfault later.
612+
struct backtrace_view syms_view = {0};
611613
off_t syms_off;
612614
size_t syms_size;
613615
int syms_view_valid;

src/librustc_const_eval/check_match.rs

+22-5
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
273273
let mut seen = Matrix::empty();
274274
let mut catchall = None;
275275
let mut printed_if_let_err = false;
276-
for &(ref pats, guard) in arms {
276+
for (arm_index, &(ref pats, guard)) in arms.iter().enumerate() {
277277
for &(pat, hir_pat) in pats {
278278
let v = vec![pat];
279279

@@ -302,10 +302,27 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
302302
let &(ref first_arm_pats, _) = &arms[0];
303303
let first_pat = &first_arm_pats[0];
304304
let span = first_pat.0.span;
305-
struct_span_err!(cx.tcx.sess, span, E0165,
306-
"irrefutable while-let pattern")
307-
.span_label(span, &format!("irrefutable pattern"))
308-
.emit();
305+
306+
// check which arm we're on.
307+
match arm_index {
308+
// The arm with the user-specified pattern.
309+
0 => {
310+
let mut diagnostic = Diagnostic::new(Level::Warning,
311+
"unreachable pattern");
312+
diagnostic.set_span(pat.span);
313+
cx.tcx.sess.add_lint_diagnostic(
314+
lint::builtin::UNREACHABLE_PATTERNS,
315+
hir_pat.id, diagnostic);
316+
},
317+
// The arm with the wildcard pattern.
318+
1 => {
319+
struct_span_err!(cx.tcx.sess, span, E0165,
320+
"irrefutable while-let pattern")
321+
.span_label(span, &format!("irrefutable pattern"))
322+
.emit();
323+
},
324+
_ => bug!(),
325+
}
309326
},
310327

311328
hir::MatchSource::ForLoopDesugar |

src/test/compile-fail/uninhabited-patterns.rs

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ struct NotSoSecretlyEmpty {
2424
_priv: !,
2525
}
2626

27+
fn foo() -> Option<NotSoSecretlyEmpty> {
28+
None
29+
}
30+
2731
fn main() {
2832
let x: &[!] = &[];
2933

@@ -45,5 +49,9 @@ fn main() {
4549
Err(Err(_y)) => (),
4650
Err(Ok(_y)) => (), //~ ERROR unreachable pattern
4751
}
52+
53+
while let Some(_y) = foo() {
54+
//~^ ERROR unreachable pattern
55+
}
4856
}
4957

0 commit comments

Comments
 (0)