Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 12 pull requests #39567

Merged
merged 32 commits into from
Feb 5, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3ccb87a
liballoc_jemalloc: fix linking with system library
ishitatsuyuki Feb 3, 2017
458167e
Add `aarch64-unknown-freebsd` to the supported targets
dumbbell Jan 25, 2017
f6c6b31
`aarch64` CPU type is called `arm64` on FreeBSD
dumbbell Feb 3, 2017
5e41ec2
rename other than copy/remove
king6cong Feb 1, 2017
7de99cd
Merge remote tracking branch 'upstream/master'
ishitatsuyuki Feb 3, 2017
768f6a9
add and use rename_or_copy_remove fn that fallback to copy & remove
king6cong Feb 3, 2017
d14b268
libbacktrace: Fix uninitialized variable
petrochenkov Feb 3, 2017
34f444d
Extract libcore benchmarks to a separate folder
phungleson Feb 3, 2017
efeb42b
Use less syscalls in `FileDesc::set_{nonblocking,cloexec}`
tbu- Feb 4, 2017
3c16139
Don't use "unadjusted" ABI on non windows platforms
est31 Feb 2, 2017
5a21f42
run rustfmt for librustc/util/fs.rs
king6cong Feb 4, 2017
87ace0d
More snap cleanup
nagisa Feb 4, 2017
206ee20
Unignore stage0/1 i128 tests as well
nagisa Feb 4, 2017
a1f42cd
Uninhabited while-let pattern fix
canndrew Feb 4, 2017
768c6c0
Support a debug info API change for LLVM 4.0
Feb 4, 2017
112a5a0
ignore more gdb versions with buggy rust support
TimNN Feb 4, 2017
a884a6c
Slightly optimize slice::sort
Feb 4, 2017
fa457bf
Minor fix in the *_expensive benchmark
Feb 4, 2017
0dbb1e4
Remove use of ptr::eq
canndrew Feb 5, 2017
7135d0a
Fix make tidy
canndrew Feb 5, 2017
388db66
Rollup merge of #39439 - king6cong:move, r=alexcrichton
frewsxcv Feb 5, 2017
ddd01e0
Rollup merge of #39472 - est31:unadjusted_only_for_win, r=nagisa
frewsxcv Feb 5, 2017
d021a3f
Rollup merge of #39481 - ishitatsuyuki:master, r=alexcrichton
frewsxcv Feb 5, 2017
b3518af
Rollup merge of #39491 - dumbbell:support-aarch64-unknown-freebsd, r=…
frewsxcv Feb 5, 2017
ac329cd
Rollup merge of #39501 - phungleson:libcorebench, r=alexcrichton
frewsxcv Feb 5, 2017
ae3aafa
Rollup merge of #39509 - petrochenkov:rb2, r=alexcrichton
frewsxcv Feb 5, 2017
d194688
Rollup merge of #39514 - tbu-:pr_less_syscalls_fd, r=alexcrichton
frewsxcv Feb 5, 2017
13b8e4b
Rollup merge of #39519 - nagisa:more-snap, r=alexcrichton
frewsxcv Feb 5, 2017
4e67bf9
Rollup merge of #39526 - canndrew:uninhabited-while-let-fix, r=arielb1
frewsxcv Feb 5, 2017
3e7ee35
Rollup merge of #39528 - dylanmckay:llvm-4.0-diglobalvar, r=alexcrichton
frewsxcv Feb 5, 2017
70cc1d3
Rollup merge of #39530 - TimNN:more-gdb, r=alexcrichton
frewsxcv Feb 5, 2017
a419dd1
Rollup merge of #39538 - stjepang:slightly-optimize-sort, r=alexcrichton
frewsxcv Feb 5, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Uninhabited while-let pattern fix
  • Loading branch information
canndrew committed Feb 4, 2017
commit a1f42cd8930d465bf616d5b2bc5d7b1b945177ab
19 changes: 15 additions & 4 deletions src/librustc_const_eval/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use std::ptr;
use _match::{MatchCheckCtxt, Matrix, expand_pattern, is_useful};
use _match::Usefulness::*;
use _match::WitnessPreference::*;
Expand Down Expand Up @@ -302,10 +303,20 @@ 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.
if ptr::eq(first_arm_pats, pats) {
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);
} else {
struct_span_err!(cx.tcx.sess, span, E0165,
"irrefutable while-let pattern")
.span_label(span, &format!("irrefutable pattern"))
.emit();
}
},

hir::MatchSource::ForLoopDesugar |
Expand Down
1 change: 1 addition & 0 deletions src/librustc_const_eval/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#![feature(box_syntax)]
#![feature(const_fn)]
#![feature(i128_type)]
#![feature(ptr_eq)]

extern crate arena;
#[macro_use] extern crate syntax;
Expand Down
8 changes: 8 additions & 0 deletions src/test/compile-fail/uninhabited-patterns.rs
Original file line number Diff line number Diff line change
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
}
}