From f69acabde7fca2903f616da3e04d92ea44c3c32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 11 Apr 2019 20:01:19 -0700 Subject: [PATCH 1/3] Continue evaluating after missing main --- src/librustc/middle/entry.rs | 1 - src/librustc_interface/passes.rs | 8 +++-- src/test/ui/continue-after-missing-main.rs | 32 +++++++++++++++++++ .../ui/continue-after-missing-main.stderr | 17 ++++++++++ 4 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 src/test/ui/continue-after-missing-main.rs create mode 100644 src/test/ui/continue-after-missing-main.stderr diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index c20454a8822cd..df77033ebef3b 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -163,7 +163,6 @@ fn configure_main( err.span_note(span, "here is a function named 'main'"); } err.emit(); - tcx.sess.abort_if_errors(); } else { if let Some(ref filename) = tcx.sess.local_crate_source_file { err.note(&format!("consider adding a `main` function to `{}`", filename.display())); diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 3fd684f5d97e9..2f01254ed5f9b 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -886,10 +886,11 @@ fn analysis<'tcx>( assert_eq!(cnum, LOCAL_CRATE); let sess = tcx.sess; + let mut entry_point = None; time(sess, "misc checking 1", || { parallel!({ - time(sess, "looking for entry point", || { + entry_point = time(sess, "looking for entry point", || { middle::entry::find_entry_point(tcx) }); @@ -937,7 +938,10 @@ fn analysis<'tcx>( // Abort so we don't try to construct MIR with liveness errors. // We also won't want to continue with errors from rvalue promotion - tcx.sess.abort_if_errors(); + // We only do so if the only error found so far *isn't* a missing `fn main()` + if !(entry_point.is_none() && sess.err_count() == 1) { + tcx.sess.abort_if_errors(); + } time(sess, "borrow checking", || { if tcx.use_ast_borrowck() { diff --git a/src/test/ui/continue-after-missing-main.rs b/src/test/ui/continue-after-missing-main.rs new file mode 100644 index 0000000000000..7455c2a431d62 --- /dev/null +++ b/src/test/ui/continue-after-missing-main.rs @@ -0,0 +1,32 @@ +#![allow(dead_code)] + +// error-pattern:`main` function not found in crate + +struct Tableau<'a, MP> { + provider: &'a MP, +} + +impl<'adapted_matrix_provider, 'original_data, MP> + Tableau<'adapted_matrix_provider, AdaptedMatrixProvider<'original_data, MP>> +{ + fn provider(&self) -> &'adapted_matrix_provider AdaptedMatrixProvider { + self.provider + } +} + +struct AdaptedMatrixProvider<'a, T> { + original_problem: &'a T, +} + +impl<'a, T> AdaptedMatrixProvider<'a, T> { + fn clone_with_extra_bound(&self) -> Self { + AdaptedMatrixProvider { original_problem: self.original_problem } + } +} + +fn create_and_solve_subproblems<'data_provider, 'original_data, MP>( + tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>, +) { + let _: AdaptedMatrixProvider<'original_data, MP> = tableau.provider().clone_with_extra_bound(); + //~^ ERROR lifetime mismatch +} diff --git a/src/test/ui/continue-after-missing-main.stderr b/src/test/ui/continue-after-missing-main.stderr new file mode 100644 index 0000000000000..8d64fee8bdaee --- /dev/null +++ b/src/test/ui/continue-after-missing-main.stderr @@ -0,0 +1,17 @@ +error[E0601]: `main` function not found in crate `continue_after_missing_main` + | + = note: consider adding a `main` function to `$DIR/continue-after-missing-main.rs` + +error[E0623]: lifetime mismatch + --> $DIR/continue-after-missing-main.rs:30:56 + | +LL | tableau: Tableau<'data_provider, AdaptedMatrixProvider<'original_data, MP>>, + | ------------------------------------------------------------------ these two types are declared with different lifetimes... +LL | ) { +LL | let _: AdaptedMatrixProvider<'original_data, MP> = tableau.provider().clone_with_extra_bound(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `tableau` flows into `tableau` here + +error: aborting due to 2 previous errors + +Some errors occurred: E0601, E0623. +For more information about an error, try `rustc --explain E0601`. From 8395dbd6dc0dd61c7ebb50a6afebb4d29c450a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 15 Apr 2019 12:54:18 -0700 Subject: [PATCH 2/3] Never stop due to errors before borrow checking --- src/librustc_interface/passes.rs | 7 ----- src/test/ui/consts/const_let_refutable.rs | 2 +- src/test/ui/consts/const_let_refutable.stderr | 13 +++++++-- src/test/ui/error-codes/E0007.rs | 1 + src/test/ui/error-codes/E0007.stderr | 15 +++++++++-- src/test/ui/error-codes/E0030-teach.rs | 1 + src/test/ui/error-codes/E0030-teach.stderr | 8 +++++- src/test/ui/error-codes/E0301.rs | 2 +- src/test/ui/error-codes/E0301.stderr | 13 +++++++-- src/test/ui/error-codes/E0302.rs | 2 +- src/test/ui/error-codes/E0302.stderr | 13 +++++++-- src/test/ui/issues/issue-23302-3.rs | 1 + src/test/ui/issues/issue-23302-3.stderr | 24 ++++++++++++++--- src/test/ui/issues/issue-41255.rs | 2 ++ src/test/ui/issues/issue-41255.stderr | 27 ++++++++++++------- src/test/ui/issues/issue-6804.rs | 2 ++ src/test/ui/issues/issue-6804.stderr | 13 +++++++-- .../ui/match/match-range-fail-dominate.stderr | 9 +++++++ .../ui/rfc-2005-default-binding-mode/for.rs | 1 + .../rfc-2005-default-binding-mode/for.stderr | 14 ++++++++-- .../ui/rfc1445/match-forbidden-without-eq.rs | 2 ++ .../rfc1445/match-forbidden-without-eq.stderr | 9 +++++++ 22 files changed, 146 insertions(+), 35 deletions(-) diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 2f01254ed5f9b..9a0497e861ce2 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -936,13 +936,6 @@ fn analysis<'tcx>( }); }); - // Abort so we don't try to construct MIR with liveness errors. - // We also won't want to continue with errors from rvalue promotion - // We only do so if the only error found so far *isn't* a missing `fn main()` - if !(entry_point.is_none() && sess.err_count() == 1) { - tcx.sess.abort_if_errors(); - } - time(sess, "borrow checking", || { if tcx.use_ast_borrowck() { borrowck::check_crate(tcx); diff --git a/src/test/ui/consts/const_let_refutable.rs b/src/test/ui/consts/const_let_refutable.rs index 345f682868fbc..422b278a6f09a 100644 --- a/src/test/ui/consts/const_let_refutable.rs +++ b/src/test/ui/consts/const_let_refutable.rs @@ -1,5 +1,5 @@ fn main() {} const fn slice([a, b]: &[i32]) -> i32 { //~ ERROR refutable pattern in function argument - a + b + a + b //~ ERROR can only call other `min_const_fn` within a `min_const_fn` } diff --git a/src/test/ui/consts/const_let_refutable.stderr b/src/test/ui/consts/const_let_refutable.stderr index 155c858af37e6..0c86d9405d056 100644 --- a/src/test/ui/consts/const_let_refutable.stderr +++ b/src/test/ui/consts/const_let_refutable.stderr @@ -4,6 +4,15 @@ error[E0005]: refutable pattern in function argument: `&[]` not covered LL | const fn slice([a, b]: &[i32]) -> i32 { | ^^^^^^ pattern `&[]` not covered -error: aborting due to previous error +error[E0723]: can only call other `min_const_fn` within a `min_const_fn` (see issue #57563) + --> $DIR/const_let_refutable.rs:4:5 + | +LL | a + b + | ^^^^^ + | + = help: add #![feature(const_fn)] to the crate attributes to enable + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0005`. +Some errors occurred: E0005, E0723. +For more information about an error, try `rustc --explain E0005`. diff --git a/src/test/ui/error-codes/E0007.rs b/src/test/ui/error-codes/E0007.rs index 8fc6342002bb2..cdda735ba4435 100644 --- a/src/test/ui/error-codes/E0007.rs +++ b/src/test/ui/error-codes/E0007.rs @@ -4,6 +4,7 @@ fn main() { op_string @ Some(s) => {}, //~^ ERROR E0007 //~| ERROR E0303 + //~| ERROR E0382 None => {}, } } diff --git a/src/test/ui/error-codes/E0007.stderr b/src/test/ui/error-codes/E0007.stderr index a5d694976cfbd..92a0ceebb50e7 100644 --- a/src/test/ui/error-codes/E0007.stderr +++ b/src/test/ui/error-codes/E0007.stderr @@ -10,7 +10,18 @@ error[E0303]: pattern bindings are not allowed after an `@` LL | op_string @ Some(s) => {}, | ^ not allowed after `@` -error: aborting due to 2 previous errors +error[E0382]: use of partially moved value: `x` + --> $DIR/E0007.rs:4:9 + | +LL | op_string @ Some(s) => {}, + | ^^^^^^^^^^^^^^^^^-^ + | | | + | | value moved here + | value used here after move + | + = note: move occurs because the value has type `std::string::String`, which does not implement the `Copy` trait + +error: aborting due to 3 previous errors -Some errors occurred: E0007, E0303. +Some errors occurred: E0007, E0303, E0382. For more information about an error, try `rustc --explain E0007`. diff --git a/src/test/ui/error-codes/E0030-teach.rs b/src/test/ui/error-codes/E0030-teach.rs index 388064fb0fae5..8caa4f0931d57 100644 --- a/src/test/ui/error-codes/E0030-teach.rs +++ b/src/test/ui/error-codes/E0030-teach.rs @@ -4,5 +4,6 @@ fn main() { match 5u32 { 1000 ..= 5 => {} //~^ ERROR lower range bound must be less than or equal to upper + //~| ERROR lower range bound must be less than or equal to upper } } diff --git a/src/test/ui/error-codes/E0030-teach.stderr b/src/test/ui/error-codes/E0030-teach.stderr index 3f1ad4af3a94e..800f66416a813 100644 --- a/src/test/ui/error-codes/E0030-teach.stderr +++ b/src/test/ui/error-codes/E0030-teach.stderr @@ -6,6 +6,12 @@ LL | 1000 ..= 5 => {} | = note: When matching against a range, the compiler verifies that the range is non-empty. Range patterns include both end-points, so this is equivalent to requiring the start of the range to be less than or equal to the end of the range. -error: aborting due to previous error +error[E0030]: lower range bound must be less than or equal to upper + --> $DIR/E0030-teach.rs:5:9 + | +LL | 1000 ..= 5 => {} + | ^^^^ lower bound larger than upper bound + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0030`. diff --git a/src/test/ui/error-codes/E0301.rs b/src/test/ui/error-codes/E0301.rs index 54372f8b6b4c5..3b451801c99df 100644 --- a/src/test/ui/error-codes/E0301.rs +++ b/src/test/ui/error-codes/E0301.rs @@ -2,6 +2,6 @@ fn main() { match Some(()) { None => { }, option if option.take().is_none() => {}, //~ ERROR E0301 - Some(_) => { } + Some(_) => { } //~^ ERROR E0596 } } diff --git a/src/test/ui/error-codes/E0301.stderr b/src/test/ui/error-codes/E0301.stderr index 80ee681a51799..beae0c5704a1c 100644 --- a/src/test/ui/error-codes/E0301.stderr +++ b/src/test/ui/error-codes/E0301.stderr @@ -4,6 +4,15 @@ error[E0301]: cannot mutably borrow in a pattern guard LL | option if option.take().is_none() => {}, | ^^^^^^ borrowed mutably in pattern guard -error: aborting due to previous error +error[E0596]: cannot borrow immutable local variable `option` as mutable + --> $DIR/E0301.rs:4:19 + | +LL | option if option.take().is_none() => {}, + | ------ ^^^^^^ cannot borrow mutably + | | + | help: make this binding mutable: `mut option` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0301`. +Some errors occurred: E0301, E0596. +For more information about an error, try `rustc --explain E0301`. diff --git a/src/test/ui/error-codes/E0302.rs b/src/test/ui/error-codes/E0302.rs index 7c76eb30c1d29..d5f0cf618ebc1 100644 --- a/src/test/ui/error-codes/E0302.rs +++ b/src/test/ui/error-codes/E0302.rs @@ -2,6 +2,6 @@ fn main() { match Some(()) { None => { }, option if { option = None; false } => { }, //~ ERROR E0302 - Some(_) => { } + Some(_) => { } //~^ ERROR E0384 } } diff --git a/src/test/ui/error-codes/E0302.stderr b/src/test/ui/error-codes/E0302.stderr index 69ebb6bb9c9fa..a0a375d725b03 100644 --- a/src/test/ui/error-codes/E0302.stderr +++ b/src/test/ui/error-codes/E0302.stderr @@ -4,6 +4,15 @@ error[E0302]: cannot assign in a pattern guard LL | option if { option = None; false } => { }, | ^^^^^^^^^^^^^ assignment in pattern guard -error: aborting due to previous error +error[E0384]: cannot assign twice to immutable variable `option` + --> $DIR/E0302.rs:4:21 + | +LL | option if { option = None; false } => { }, + | ------ ^^^^^^^^^^^^^ cannot assign twice to immutable variable + | | + | first assignment to `option` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0302`. +Some errors occurred: E0302, E0384. +For more information about an error, try `rustc --explain E0302`. diff --git a/src/test/ui/issues/issue-23302-3.rs b/src/test/ui/issues/issue-23302-3.rs index da75f33079886..e17c5eea2a445 100644 --- a/src/test/ui/issues/issue-23302-3.rs +++ b/src/test/ui/issues/issue-23302-3.rs @@ -1,4 +1,5 @@ const A: i32 = B; //~ ERROR cycle detected +//~^ ERROR cycle detected const B: i32 = A; diff --git a/src/test/ui/issues/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr index a7d643987f710..94624640809b7 100644 --- a/src/test/ui/issues/issue-23302-3.stderr +++ b/src/test/ui/issues/issue-23302-3.stderr @@ -10,18 +10,36 @@ note: ...which requires checking which parts of `A` are promotable to static... LL | const A: i32 = B; | ^ note: ...which requires const checking if rvalue is promotable to static `B`... - --> $DIR/issue-23302-3.rs:3:1 + --> $DIR/issue-23302-3.rs:4:1 | LL | const B: i32 = A; | ^^^^^^^^^^^^^^^^^ note: ...which requires checking which parts of `B` are promotable to static... - --> $DIR/issue-23302-3.rs:3:16 + --> $DIR/issue-23302-3.rs:4:16 | LL | const B: i32 = A; | ^ = note: ...which again requires const checking if rvalue is promotable to static `A`, completing the cycle = note: cycle used when running analysis passes on this crate -error: aborting due to previous error +error[E0391]: cycle detected when processing `A` + --> $DIR/issue-23302-3.rs:1:16 + | +LL | const A: i32 = B; + | ^ + | +note: ...which requires processing `B`... + --> $DIR/issue-23302-3.rs:4:16 + | +LL | const B: i32 = A; + | ^ + = note: ...which again requires processing `A`, completing the cycle +note: cycle used when processing `A` + --> $DIR/issue-23302-3.rs:1:1 + | +LL | const A: i32 = B; + | ^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/issues/issue-41255.rs b/src/test/ui/issues/issue-41255.rs index 395ab8601bcc5..60fdf7c3e8a47 100644 --- a/src/test/ui/issues/issue-41255.rs +++ b/src/test/ui/issues/issue-41255.rs @@ -9,6 +9,8 @@ fn main() { match x { 5.0 => {}, //~ ERROR floating-point types cannot be used in patterns //~| WARNING hard error + //~| ERROR floating-point types cannot be used in patterns + //~| WARNING this was previously accepted by the compiler but is being 5.0f32 => {}, //~ ERROR floating-point types cannot be used in patterns //~| WARNING hard error -5.0 => {}, //~ ERROR floating-point types cannot be used in patterns diff --git a/src/test/ui/issues/issue-41255.stderr b/src/test/ui/issues/issue-41255.stderr index 9ccfc9a001605..c334742cfc4a4 100644 --- a/src/test/ui/issues/issue-41255.stderr +++ b/src/test/ui/issues/issue-41255.stderr @@ -13,7 +13,7 @@ LL | #![forbid(illegal_floating_point_literal_pattern)] = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:12:9 + --> $DIR/issue-41255.rs:14:9 | LL | 5.0f32 => {}, | ^^^^^^ @@ -22,7 +22,7 @@ LL | 5.0f32 => {}, = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:14:10 + --> $DIR/issue-41255.rs:16:10 | LL | -5.0 => {}, | ^^^ @@ -31,7 +31,7 @@ LL | -5.0 => {}, = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:16:9 + --> $DIR/issue-41255.rs:18:9 | LL | 1.0 .. 33.0 => {}, | ^^^ @@ -40,7 +40,7 @@ LL | 1.0 .. 33.0 => {}, = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:16:16 + --> $DIR/issue-41255.rs:18:16 | LL | 1.0 .. 33.0 => {}, | ^^^^ @@ -49,7 +49,7 @@ LL | 1.0 .. 33.0 => {}, = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:20:9 + --> $DIR/issue-41255.rs:22:9 | LL | 39.0 ..= 70.0 => {}, | ^^^^ @@ -58,7 +58,7 @@ LL | 39.0 ..= 70.0 => {}, = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:20:18 + --> $DIR/issue-41255.rs:22:18 | LL | 39.0 ..= 70.0 => {}, | ^^^^ @@ -67,7 +67,7 @@ LL | 39.0 ..= 70.0 => {}, = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:29:10 + --> $DIR/issue-41255.rs:31:10 | LL | (3.14, 1) => {}, | ^^^^ @@ -76,7 +76,7 @@ LL | (3.14, 1) => {}, = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-41255.rs:36:18 + --> $DIR/issue-41255.rs:38:18 | LL | Foo { x: 2.0 } => {}, | ^^^ @@ -84,5 +84,14 @@ LL | Foo { x: 2.0 } => {}, = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #41620 -error: aborting due to 9 previous errors +error: floating-point types cannot be used in patterns + --> $DIR/issue-41255.rs:10:9 + | +LL | 5.0 => {}, + | ^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 + +error: aborting due to 10 previous errors diff --git a/src/test/ui/issues/issue-6804.rs b/src/test/ui/issues/issue-6804.rs index da73e2bd397d6..b4af3581a0de0 100644 --- a/src/test/ui/issues/issue-6804.rs +++ b/src/test/ui/issues/issue-6804.rs @@ -10,6 +10,8 @@ fn main() { match x { NAN => {}, //~ ERROR floating-point types cannot be used //~^ WARN this was previously accepted by the compiler but is being phased out + //~| ERROR floating-point types cannot be used in patterns + //~| WARN this was previously accepted by the compiler but is being phased out _ => {}, }; diff --git a/src/test/ui/issues/issue-6804.stderr b/src/test/ui/issues/issue-6804.stderr index 1c251ed8445ff..ab4467e5135ed 100644 --- a/src/test/ui/issues/issue-6804.stderr +++ b/src/test/ui/issues/issue-6804.stderr @@ -13,7 +13,7 @@ LL | #![deny(illegal_floating_point_literal_pattern)] = note: for more information, see issue #41620 error: floating-point types cannot be used in patterns - --> $DIR/issue-6804.rs:17:10 + --> $DIR/issue-6804.rs:19:10 | LL | [NAN, _] => {}, | ^^^ @@ -21,5 +21,14 @@ LL | [NAN, _] => {}, = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #41620 -error: aborting due to 2 previous errors +error: floating-point types cannot be used in patterns + --> $DIR/issue-6804.rs:11:9 + | +LL | NAN => {}, + | ^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 + +error: aborting due to 3 previous errors diff --git a/src/test/ui/match/match-range-fail-dominate.stderr b/src/test/ui/match/match-range-fail-dominate.stderr index d35394aa38ba0..0f5ab7fff3840 100644 --- a/src/test/ui/match/match-range-fail-dominate.stderr +++ b/src/test/ui/match/match-range-fail-dominate.stderr @@ -62,5 +62,14 @@ error: unreachable pattern LL | 0.02f64 => {} | ^^^^^^^ +warning: floating-point types cannot be used in patterns + --> $DIR/match-range-fail-dominate.rs:35:7 + | +LL | 0.01f64 ... 6.5f64 => {} + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 + error: aborting due to 5 previous errors diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.rs b/src/test/ui/rfc-2005-default-binding-mode/for.rs index 2fa7852635c30..919ae62a18256 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.rs +++ b/src/test/ui/rfc-2005-default-binding-mode/for.rs @@ -5,5 +5,6 @@ pub fn main() { // The below desugars to &(ref n, mut m). for (n, mut m) in &tups { //~^ ERROR cannot bind by-move and by-ref in the same pattern + //~| ERROR cannot move out of borrowed content } } diff --git a/src/test/ui/rfc-2005-default-binding-mode/for.stderr b/src/test/ui/rfc-2005-default-binding-mode/for.stderr index 37aaa9cfd70a0..9cccfbe8c09d2 100644 --- a/src/test/ui/rfc-2005-default-binding-mode/for.stderr +++ b/src/test/ui/rfc-2005-default-binding-mode/for.stderr @@ -6,6 +6,16 @@ LL | for (n, mut m) in &tups { | | | both by-ref and by-move used -error: aborting due to previous error +error[E0507]: cannot move out of borrowed content + --> $DIR/for.rs:6:9 + | +LL | for (n, mut m) in &tups { + | ^^^^-----^ + | | | + | | hint: to prevent move, use `ref m` or `ref mut m` + | cannot move out of borrowed content + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0009`. +Some errors occurred: E0009, E0507. +For more information about an error, try `rustc --explain E0009`. diff --git a/src/test/ui/rfc1445/match-forbidden-without-eq.rs b/src/test/ui/rfc1445/match-forbidden-without-eq.rs index 78d799e2b01db..1cca27520618d 100644 --- a/src/test/ui/rfc1445/match-forbidden-without-eq.rs +++ b/src/test/ui/rfc1445/match-forbidden-without-eq.rs @@ -20,6 +20,8 @@ fn main() { f32::INFINITY => { } //~^ WARNING floating-point types cannot be used in patterns //~| WARNING will become a hard error in a future release + //~| WARNING floating-point types cannot be used in patterns + //~| WARNING this was previously accepted by the compiler but is being phased out _ => { } } } diff --git a/src/test/ui/rfc1445/match-forbidden-without-eq.stderr b/src/test/ui/rfc1445/match-forbidden-without-eq.stderr index ebea2f364ec88..4ec1e8ddb9533 100644 --- a/src/test/ui/rfc1445/match-forbidden-without-eq.stderr +++ b/src/test/ui/rfc1445/match-forbidden-without-eq.stderr @@ -14,5 +14,14 @@ LL | f32::INFINITY => { } = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #41620 +warning: floating-point types cannot be used in patterns + --> $DIR/match-forbidden-without-eq.rs:20:9 + | +LL | f32::INFINITY => { } + | ^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #41620 + error: aborting due to previous error From ac9c8c19d90df132a3c8de828a286cdef5383e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 15 Apr 2019 16:20:17 -0700 Subject: [PATCH 3/3] Avoid ICEs --- src/librustc/traits/codegen/mod.rs | 4 ++-- src/librustc_mir/hair/pattern/check_match.rs | 4 +++- src/test/ui/consts/match_ice.rs | 1 + src/test/ui/consts/match_ice.stderr | 12 +++++++++--- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index 9b0a3820c859c..c0cfdb58aaa1e 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -153,8 +153,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { // contains unbound type parameters. It could be a slight // optimization to stop iterating early. if let Err(errors) = fulfill_cx.select_all_or_error(self) { - span_bug!(span, "Encountered errors `{:?}` resolving bounds after type-checking", - errors); + debug!("Encountered errors `{:?}` resolving bounds after type-checking", errors); + self.report_fulfillment_errors(&errors, None, false); } let result = self.resolve_type_vars_if_possible(result); diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 7ded973701edc..3afd00bf52806 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -603,7 +603,9 @@ fn check_legality_of_move_bindings( E0009, "cannot bind by-move and by-ref in the same pattern", ); - err.span_label(by_ref_span.unwrap(), "both by-ref and by-move used"); + if let Some(by_ref_span) = by_ref_span { + err.span_label(by_ref_span, "both by-ref and by-move used"); + } for span in span_vec.iter(){ err.span_label(*span, "by-move pattern here"); } diff --git a/src/test/ui/consts/match_ice.rs b/src/test/ui/consts/match_ice.rs index 53c5782a4c70e..3e8c4d5dd5839 100644 --- a/src/test/ui/consts/match_ice.rs +++ b/src/test/ui/consts/match_ice.rs @@ -1,3 +1,4 @@ +//~ ERROR can't compare `S` with `S` // https://github.com/rust-lang/rust/issues/53708 struct S; diff --git a/src/test/ui/consts/match_ice.stderr b/src/test/ui/consts/match_ice.stderr index e238fad431831..64f0503242459 100644 --- a/src/test/ui/consts/match_ice.stderr +++ b/src/test/ui/consts/match_ice.stderr @@ -1,11 +1,17 @@ error[E0004]: non-exhaustive patterns: `&S` not covered - --> $DIR/match_ice.rs:7:11 + --> $DIR/match_ice.rs:8:11 | LL | match C { | ^ pattern `&S` not covered | = help: ensure that all possible cases are being handled, possibly by adding wildcards or more match arms -error: aborting due to previous error +error[E0277]: can't compare `S` with `S` + | + = help: the trait `std::cmp::PartialEq` is not implemented for `S` + = note: required because of the requirements on the impl of `std::cmp::PartialEq` for `&S` + +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0004`. +Some errors occurred: E0004, E0277. +For more information about an error, try `rustc --explain E0004`.