From aedd4c61ea372022e04be183da2f5768953ea2fe Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 5 Mar 2018 10:21:11 +0100 Subject: [PATCH] Regenerate tests --- src/Cargo.lock | 21 +----- src/librustc/ich/impls_ty.rs | 4 +- src/librustc/ty/maps/on_disk_cache.rs | 1 + src/librustc_driver/driver.rs | 2 +- src/librustc_mir/hair/pattern/mod.rs | 22 +++--- src/librustc_mir/monomorphize/collector.rs | 3 +- .../transform/uniform_array_move_out.rs | 2 +- src/librustc_passes/rvalue_promotion.rs | 13 +--- src/test/ui/const-eval-overflow-2.stderr | 2 +- src/test/ui/const-eval-overflow-4.stderr | 8 --- .../conditional_array_execution.stderr | 27 +++---- .../ui/const-eval/index_out_of_bound.stderr | 9 +++ src/test/ui/const-eval/issue-43197.stderr | 30 ++++---- src/test/ui/const-expr-addr-operator.stderr | 15 ---- src/test/ui/const-fn-error.stderr | 47 +++---------- .../const-len-underflow-separate-spans.stderr | 18 ++--- .../const-pattern-not-const-evaluable.stderr | 15 ---- src/test/ui/discrim-overflow-2.stderr | 32 ++++----- src/test/ui/discrim-overflow.stderr | 32 ++++----- src/test/ui/error-codes/E0030-teach.rs | 2 +- src/test/ui/error-codes/E0030.rs | 2 +- src/test/ui/error-codes/E0080.stderr | 22 ++++-- src/test/ui/error-codes/E0081.stderr | 6 +- src/test/ui/error-codes/E0370.stderr | 4 +- .../ui/feature-gate-const-indexing.stderr | 9 --- .../ui/infinite-recursion-const-fn.stderr | 70 ++++++++++++++++++- src/test/ui/issue-15524.stderr | 18 ++--- src/test/ui/issue-23302-1.stderr | 9 ++- src/test/ui/issue-23302-2.stderr | 9 ++- src/test/ui/issue-23302-3.rs | 4 +- src/test/ui/issue-23302-3.stderr | 36 ++++++---- src/test/ui/issue-36163.stderr | 20 ++++-- src/test/ui/issue-38875/issue_38875.stderr | 15 ---- src/test/ui/union/union-const-eval.stderr | 17 ----- 34 files changed, 255 insertions(+), 291 deletions(-) create mode 100644 src/test/ui/const-eval/index_out_of_bound.stderr diff --git a/src/Cargo.lock b/src/Cargo.lock index b70a01ebb3c..34c077a6f7a 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -1858,20 +1858,6 @@ dependencies = [ "syntax_pos 0.0.0", ] -[[package]] -name = "rustc_const_eval" -version = "0.0.0" -dependencies = [ - "arena 0.0.0", - "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", - "rustc_const_math 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", -] - [[package]] name = "rustc_const_math" version = "0.0.0" @@ -1914,7 +1900,6 @@ dependencies = [ "rustc_allocator 0.0.0", "rustc_back 0.0.0", "rustc_borrowck 0.0.0", - "rustc_const_eval 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", "rustc_incremental 0.0.0", @@ -1964,7 +1949,7 @@ version = "0.0.0" dependencies = [ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc_const_eval 0.0.0", + "rustc_mir 0.0.0", "syntax 0.0.0", "syntax_pos 0.0.0", ] @@ -2012,6 +1997,7 @@ dependencies = [ name = "rustc_mir" version = "0.0.0" dependencies = [ + "arena 0.0.0", "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "graphviz 0.0.0", @@ -2020,7 +2006,6 @@ dependencies = [ "rustc 0.0.0", "rustc_apfloat 0.0.0", "rustc_back 0.0.0", - "rustc_const_eval 0.0.0", "rustc_const_math 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", @@ -2046,10 +2031,10 @@ version = "0.0.0" dependencies = [ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", - "rustc_const_eval 0.0.0", "rustc_const_math 0.0.0", "rustc_data_structures 0.0.0", "rustc_errors 0.0.0", + "rustc_mir 0.0.0", "syntax 0.0.0", "syntax_pos 0.0.0", ] diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 874c7c27dea..d927a151610 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -61,10 +61,10 @@ for ty::subst::Kind<'gcx> { } } -impl<'gcx> HashStable> +impl<'a, 'gcx> HashStable> for ty::subst::UnpackedKind<'gcx> { fn hash_stable(&self, - hcx: &mut StableHashingContext<'gcx>, + hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { match self { ty::subst::UnpackedKind::Lifetime(lt) => lt.hash_stable(hcx, hasher), diff --git a/src/librustc/ty/maps/on_disk_cache.rs b/src/librustc/ty/maps/on_disk_cache.rs index 5a24b1067b1..49c4b8bc49d 100644 --- a/src/librustc/ty/maps/on_disk_cache.rs +++ b/src/librustc/ty/maps/on_disk_cache.rs @@ -362,6 +362,7 @@ impl<'sess> OnDiskCache<'sess> { cnum_map: cnum_map.as_ref().unwrap(), file_index_to_file: &self.file_index_to_file, file_index_to_stable_id: &self.file_index_to_stable_id, + synthetic_expansion_infos: &self.synthetic_expansion_infos, interpret_alloc_cache: FxHashMap::default(), }; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 06108a72869..c9cf3f3b81f 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -36,7 +36,7 @@ use rustc_typeck as typeck; use rustc_privacy; use rustc_plugin::registry::Registry; use rustc_plugin as plugin; -use rustc_passes::{self, ast_validation, loops, consts, hir_stats}; +use rustc_passes::{self, ast_validation, loops, rvalue_promotion, hir_stats}; use super::Compilation; use serialize::json; diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 42e095a0b5b..1774c95af0f 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -373,13 +373,17 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Constant { value: hi }) => { use std::cmp::Ordering; match (end, compare_const_vals(&lo.val, &hi.val, ty).unwrap()) { - (RangeEnd::Excluded, Ordering::Less) => {}, - (RangeEnd::Excluded, _) => span_err!( - self.tcx.sess, - lo_expr.span, - E0579, - "lower range bound must be less than upper", - ), + (RangeEnd::Excluded, Ordering::Less) => + PatternKind::Range { lo, hi, end }, + (RangeEnd::Excluded, _) => { + span_err!( + self.tcx.sess, + lo_expr.span, + E0579, + "lower range bound must be less than upper", + ); + PatternKind::Wild + }, (RangeEnd::Included, Ordering::Greater) => { let mut err = struct_span_err!( self.tcx.sess, @@ -399,10 +403,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { to be less than or equal to the end of the range."); } err.emit(); + PatternKind::Wild }, - (RangeEnd::Included, _) => {} + (RangeEnd::Included, _) => PatternKind::Range { lo, hi, end }, } - PatternKind::Range { lo, hi, end } } _ => PatternKind::Wild } diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index a6df0465789..f6b47efca31 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -1090,8 +1090,7 @@ fn collect_miri<'a, 'tcx>( let instance = Instance::mono(tcx, did); if should_monomorphize_locally(tcx, &instance) { trace!("collecting static {:?}", did); - let node_id = tcx.hir.as_local_node_id(did).unwrap(); - output.push(MonoItem::Static(node_id)); + output.push(MonoItem::Static(did)); } } else if let Some(alloc) = tcx.interpret_interner.get_alloc(alloc_id) { trace!("collecting {:?} with {:#?}", alloc_id, alloc); diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 983a44920ea..9cc3ffb3063 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -203,7 +203,7 @@ impl MirPass for RestoreSubsliceArrayMoveOut { let opt_size = opt_src_place.and_then(|src_place| { let src_ty = src_place.ty(mir, tcx).to_ty(tcx); if let ty::TyArray(_, ref size_o) = src_ty.sty { - size_o.val.to_const_int().and_then(|v| v.to_u64()) + size_o.val.to_raw_bits().map(|n| n as u64) } else { None } diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index bda351eed40..16278c37a0c 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -32,7 +32,7 @@ use rustc::middle::expr_use_visitor as euv; use rustc::middle::mem_categorization as mc; use rustc::middle::mem_categorization::Categorization; use rustc::ty::{self, Ty, TyCtxt}; -use rustc::ty::maps::{queries, Providers}; +use rustc::ty::maps::Providers; use rustc::ty::subst::Substs; use rustc::traits::Reveal; use rustc::util::nodemap::{ItemLocalSet, NodeSet}; @@ -325,16 +325,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Expr, node // Don't peek inside trait associated constants. false } else { - queries::const_is_rvalue_promotable_to_static::try_get(v.tcx, e.span, did) - .unwrap_or_else(|mut err| { - // A cycle between constants ought to be reported elsewhere. - err.cancel(); - v.tcx.sess.delay_span_bug( - e.span, - &format!("cycle encountered during const qualification: {:?}", - did)); - false - }) + v.tcx.at(e.span).const_is_rvalue_promotable_to_static(did) }; // Just in case the type is more specific than the definition, diff --git a/src/test/ui/const-eval-overflow-2.stderr b/src/test/ui/const-eval-overflow-2.stderr index 05a286d4e7e..f376de7cc4c 100644 --- a/src/test/ui/const-eval-overflow-2.stderr +++ b/src/test/ui/const-eval-overflow-2.stderr @@ -5,7 +5,7 @@ LL | const NEG_NEG_128: i8 = -NEG_128; | ^^^^^^^^ attempt to negate with overflow | note: for pattern here - --> $DIR/const-eval-overflow-2.rs:27:9 + --> $DIR/const-eval-overflow-2.rs:26:9 | LL | NEG_NEG_128 => println!("A"), | ^^^^^^^^^^^ diff --git a/src/test/ui/const-eval-overflow-4.stderr b/src/test/ui/const-eval-overflow-4.stderr index b907a47afb9..e967f024ae3 100644 --- a/src/test/ui/const-eval-overflow-4.stderr +++ b/src/test/ui/const-eval-overflow-4.stderr @@ -1,11 +1,3 @@ -warning: constant evaluation error: attempt to add with overflow - --> $DIR/const-eval-overflow-4.rs:23:13 - | -LL | : [u32; (i8::MAX as i8 + 1i8) as usize] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: #[warn(const_err)] on by default - error[E0080]: constant evaluation error --> $DIR/const-eval-overflow-4.rs:23:13 | diff --git a/src/test/ui/const-eval/conditional_array_execution.stderr b/src/test/ui/const-eval/conditional_array_execution.stderr index 0e26db7ac08..8d421f401ca 100644 --- a/src/test/ui/const-eval/conditional_array_execution.stderr +++ b/src/test/ui/const-eval/conditional_array_execution.stderr @@ -1,26 +1,15 @@ +error[E0080]: constant evaluation error + --> $DIR/conditional_array_execution.rs:16:20 + | +LL | println!("{}", FOO); //~ E0080 + | ^^^ referenced constant has errors + error[E0080]: constant evaluation error --> $DIR/conditional_array_execution.rs:13:19 | -13 | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; //~ E0080 +LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; //~ E0080 | ^^^^^ attempt to subtract with overflow - | -note: inside call to FOO - --> $DIR/conditional_array_execution.rs:13:1 - | -13 | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize]; //~ E0080 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error[E0080]: constant evaluation error - --> $DIR/conditional_array_execution.rs:16:20 - | -16 | println!("{}", FOO); //~ E0080 - | ^^^ attempt to subtract with overflow - | -note: inside call to main - --> $DIR/conditional_array_execution.rs:16:20 - | -16 | println!("{}", FOO); //~ E0080 - | ^^^ error: aborting due to 2 previous errors +If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/const-eval/index_out_of_bound.stderr b/src/test/ui/const-eval/index_out_of_bound.stderr new file mode 100644 index 00000000000..7651fb257e3 --- /dev/null +++ b/src/test/ui/const-eval/index_out_of_bound.stderr @@ -0,0 +1,9 @@ +error[E0080]: constant evaluation error + --> $DIR/index_out_of_bound.rs:11:19 + | +LL | static FOO: i32 = [][0]; + | ^^^^^ index out of bounds: the len is 0 but the index is 0 at $DIR/index_out_of_bound.rs:11:19: 11:24 + +error: aborting due to previous error + +If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/const-eval/issue-43197.stderr b/src/test/ui/const-eval/issue-43197.stderr index c523b749d37..21b9a282c48 100644 --- a/src/test/ui/const-eval/issue-43197.stderr +++ b/src/test/ui/const-eval/issue-43197.stderr @@ -1,16 +1,20 @@ -warning: constant evaluation error: attempt to subtract with overflow - --> $DIR/issue-43197.rs:18:20 +error[E0080]: constant evaluation error + --> $DIR/issue-43197.rs:20:23 | -LL | const X: u32 = 0-1; //~ ERROR constant evaluation error - | ^^^ - | - = note: #[warn(const_err)] on by default +LL | println!("{} {}", X, Y); + | ^ referenced constant has errors -warning: constant evaluation error: attempt to subtract with overflow - --> $DIR/issue-43197.rs:20:20 +error[E0080]: constant evaluation error + --> $DIR/issue-43197.rs:20:26 + | +LL | println!("{} {}", X, Y); + | ^ referenced constant has errors + +error[E0080]: constant evaluation error + --> $DIR/issue-43197.rs:19:24 | LL | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error - | ^^^^^^^^ + | ^^^ attempt to subtract with overflow error[E0080]: constant evaluation error --> $DIR/issue-43197.rs:18:20 @@ -18,12 +22,6 @@ error[E0080]: constant evaluation error LL | const X: u32 = 0-1; //~ ERROR constant evaluation error | ^^^ attempt to subtract with overflow -error[E0080]: constant evaluation error - --> $DIR/issue-43197.rs:20:24 - | -LL | const Y: u32 = foo(0-1); //~ ERROR constant evaluation error - | ^^^ attempt to subtract with overflow - -error: aborting due to 2 previous errors +error: aborting due to 4 previous errors If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/const-expr-addr-operator.stderr b/src/test/ui/const-expr-addr-operator.stderr index bd86f270f31..e69de29bb2d 100644 --- a/src/test/ui/const-expr-addr-operator.stderr +++ b/src/test/ui/const-expr-addr-operator.stderr @@ -1,15 +0,0 @@ -error[E0080]: constant evaluation error - --> $DIR/const-expr-addr-operator.rs:15:29 - | -LL | const X: &'static u32 = &22; //~ ERROR constant evaluation error - | ^^^ unimplemented constant expression: address operator - | -note: for pattern here - --> $DIR/const-expr-addr-operator.rs:17:9 - | -LL | X => 0, - | ^ - -error: aborting due to previous error - -If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/const-fn-error.stderr b/src/test/ui/const-fn-error.stderr index f7ce0565c85..d57efce0dff 100644 --- a/src/test/ui/const-fn-error.stderr +++ b/src/test/ui/const-fn-error.stderr @@ -1,62 +1,35 @@ -<<<<<<< HEAD -warning: constant evaluation error: non-constant path in constant expression - --> $DIR/const-fn-error.rs:27:19 - | -LL | let a : [i32; f(X)]; - | ^^^^ - | - = note: #[warn(const_err)] on by default - error[E0016]: blocks in constant functions are limited to items and tail expressions --> $DIR/const-fn-error.rs:16:19 | -LL | let mut sum = 0; //~ ERROR blocks in constant functions are limited -======= -error[E0016]: blocks in constant functions are limited to items and tail expressions - --> $DIR/const-fn-error.rs:16:19 - | -16 | let mut sum = 0; ->>>>>>> Produce instead of pointers +LL | let mut sum = 0; | ^ error[E0015]: calls in constant functions are limited to constant functions, struct and enum constructors --> $DIR/const-fn-error.rs:18:14 | -<<<<<<< HEAD -LL | for i in 0..x { //~ ERROR calls in constant functions -======= -18 | for i in 0..x { ->>>>>>> Report errors in statics during collecting instead of translating +LL | for i in 0..x { | ^^^^ error[E0019]: constant function contains unimplemented expression type --> $DIR/const-fn-error.rs:18:14 | -<<<<<<< HEAD -LL | for i in 0..x { //~ ERROR calls in constant functions -======= -18 | for i in 0..x { ->>>>>>> Report errors in statics during collecting instead of translating +LL | for i in 0..x { | ^^^^ error[E0080]: constant evaluation error -<<<<<<< HEAD - --> $DIR/const-fn-error.rs:21:5 + --> $DIR/const-fn-error.rs:18:14 | -LL | sum //~ ERROR E0080 - | ^^^ non-constant path in constant expression +LL | for i in 0..x { + | ^^^^ calling non-const fn `>::into_iter` +... +LL | let a : [i32; f(X)]; + | ---- inside call to `f` | note: for constant expression here - --> $DIR/const-fn-error.rs:27:13 + --> $DIR/const-fn-error.rs:29:13 | LL | let a : [i32; f(X)]; | ^^^^^^^^^^^ -======= - --> $DIR/const-fn-error.rs:28:19 - | -28 | let a : [i32; f(X)]; - | ^^^^ miri failed: machine error: Cannot evaluate within constants: "calling non-const fn `>::into_iter`" ->>>>>>> Produce instead of pointers error: aborting due to 4 previous errors diff --git a/src/test/ui/const-len-underflow-separate-spans.stderr b/src/test/ui/const-len-underflow-separate-spans.stderr index 6391433ebaf..301b063885c 100644 --- a/src/test/ui/const-len-underflow-separate-spans.stderr +++ b/src/test/ui/const-len-underflow-separate-spans.stderr @@ -1,23 +1,15 @@ -warning: constant evaluation error: attempt to subtract with overflow - --> $DIR/const-len-underflow-separate-spans.rs:17:20 - | -LL | const LEN: usize = ONE - TWO; - | ^^^^^^^^^ - | - = note: #[warn(const_err)] on by default - error[E0080]: constant evaluation error --> $DIR/const-len-underflow-separate-spans.rs:17:20 | LL | const LEN: usize = ONE - TWO; | ^^^^^^^^^ attempt to subtract with overflow - | -note: for constant expression here - --> $DIR/const-len-underflow-separate-spans.rs:22:12 + +error[E0080]: constant evaluation error + --> $DIR/const-len-underflow-separate-spans.rs:21:17 | LL | let a: [i8; LEN] = unimplemented!(); - | ^^^^^^^^^ + | ^^^ referenced constant has errors -error: aborting due to previous error +error: aborting due to 2 previous errors If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/const-pattern-not-const-evaluable.stderr b/src/test/ui/const-pattern-not-const-evaluable.stderr index 74677c7f117..e69de29bb2d 100644 --- a/src/test/ui/const-pattern-not-const-evaluable.stderr +++ b/src/test/ui/const-pattern-not-const-evaluable.stderr @@ -1,15 +0,0 @@ -error[E0080]: constant evaluation error - --> $DIR/const-pattern-not-const-evaluable.rs:22:31 - | -LL | const BOO: Pair = Pair(Marmor, BlackForest); - | ^^^^ unimplemented constant expression: tuple struct constructors - | -note: for pattern here - --> $DIR/const-pattern-not-const-evaluable.rs:37:9 - | -LL | FOO => println!("hi"), - | ^^^ - -error: aborting due to previous error - -If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/discrim-overflow-2.stderr b/src/test/ui/discrim-overflow-2.stderr index 1facda94cd6..6162766b587 100644 --- a/src/test/ui/discrim-overflow-2.stderr +++ b/src/test/ui/discrim-overflow-2.stderr @@ -2,65 +2,65 @@ error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:27:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 127i8 + | ^^^^ overflowed on value after 127 | - = note: explicitly set `OhNo = -128i8` if that is desired outcome + = note: explicitly set `OhNo = -128` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:36:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 255u8 + | ^^^^ overflowed on value after 255 | - = note: explicitly set `OhNo = 0u8` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:45:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 32767i16 + | ^^^^ overflowed on value after 32767 | - = note: explicitly set `OhNo = -32768i16` if that is desired outcome + = note: explicitly set `OhNo = -32768` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:54:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 65535u16 + | ^^^^ overflowed on value after 65535 | - = note: explicitly set `OhNo = 0u16` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:63:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 2147483647i32 + | ^^^^ overflowed on value after 2147483647 | - = note: explicitly set `OhNo = -2147483648i32` if that is desired outcome + = note: explicitly set `OhNo = -2147483648` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:72:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 4294967295u32 + | ^^^^ overflowed on value after 4294967295 | - = note: explicitly set `OhNo = 0u32` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:81:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 9223372036854775807i64 + | ^^^^ overflowed on value after 9223372036854775807 | - = note: explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome + = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow-2.rs:90:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 18446744073709551615u64 + | ^^^^ overflowed on value after 18446744073709551615 | - = note: explicitly set `OhNo = 0u64` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error: aborting due to 8 previous errors diff --git a/src/test/ui/discrim-overflow.stderr b/src/test/ui/discrim-overflow.stderr index 43c032b12a6..a713aea1b21 100644 --- a/src/test/ui/discrim-overflow.stderr +++ b/src/test/ui/discrim-overflow.stderr @@ -2,65 +2,65 @@ error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:25:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 127i8 + | ^^^^ overflowed on value after 127 | - = note: explicitly set `OhNo = -128i8` if that is desired outcome + = note: explicitly set `OhNo = -128` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:36:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 255u8 + | ^^^^ overflowed on value after 255 | - = note: explicitly set `OhNo = 0u8` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:47:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 32767i16 + | ^^^^ overflowed on value after 32767 | - = note: explicitly set `OhNo = -32768i16` if that is desired outcome + = note: explicitly set `OhNo = -32768` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:58:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 65535u16 + | ^^^^ overflowed on value after 65535 | - = note: explicitly set `OhNo = 0u16` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:70:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 2147483647i32 + | ^^^^ overflowed on value after 2147483647 | - = note: explicitly set `OhNo = -2147483648i32` if that is desired outcome + = note: explicitly set `OhNo = -2147483648` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:82:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 4294967295u32 + | ^^^^ overflowed on value after 4294967295 | - = note: explicitly set `OhNo = 0u32` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:94:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 9223372036854775807i64 + | ^^^^ overflowed on value after 9223372036854775807 | - = note: explicitly set `OhNo = -9223372036854775808i64` if that is desired outcome + = note: explicitly set `OhNo = -9223372036854775808` if that is desired outcome error[E0370]: enum discriminant overflowed --> $DIR/discrim-overflow.rs:106:9 | LL | OhNo, //~ ERROR enum discriminant overflowed [E0370] - | ^^^^ overflowed on value after 18446744073709551615u64 + | ^^^^ overflowed on value after 18446744073709551615 | - = note: explicitly set `OhNo = 0u64` if that is desired outcome + = note: explicitly set `OhNo = 0` if that is desired outcome error: aborting due to 8 previous errors diff --git a/src/test/ui/error-codes/E0030-teach.rs b/src/test/ui/error-codes/E0030-teach.rs index e49b992139e..2af32eda62b 100644 --- a/src/test/ui/error-codes/E0030-teach.rs +++ b/src/test/ui/error-codes/E0030-teach.rs @@ -11,7 +11,7 @@ // compile-flags: -Z teach fn main() { - match 5u32 { //~ERROR non-exhaustive patterns: `_` not covered + match 5u32 { 1000 ... 5 => {} //~^ ERROR lower range bound must be less than or equal to upper } diff --git a/src/test/ui/error-codes/E0030.rs b/src/test/ui/error-codes/E0030.rs index 896dd2599bf..ef3bded4bef 100644 --- a/src/test/ui/error-codes/E0030.rs +++ b/src/test/ui/error-codes/E0030.rs @@ -10,7 +10,7 @@ fn main() { - match 5u32 { //~ ERROR non-exhaustive patterns + match 5u32 { 1000 ... 5 => {} //~^ ERROR lower range bound must be less than or equal to upper } diff --git a/src/test/ui/error-codes/E0080.stderr b/src/test/ui/error-codes/E0080.stderr index 01cfa0c375b..501051b9fe6 100644 --- a/src/test/ui/error-codes/E0080.stderr +++ b/src/test/ui/error-codes/E0080.stderr @@ -1,10 +1,10 @@ -warning: constant evaluation error: attempt to shift left with overflow +error: bitshift exceeds the type's number of bits --> $DIR/E0080.rs:12:9 | LL | X = (1 << 500), //~ ERROR E0080 | ^^^^^^^^^^ | - = note: #[warn(const_err)] on by default + = note: #[deny(exceeding_bitshifts)] on by default error[E0080]: constant evaluation error --> $DIR/E0080.rs:12:9 @@ -12,18 +12,26 @@ error[E0080]: constant evaluation error LL | X = (1 << 500), //~ ERROR E0080 | ^^^^^^^^^^ attempt to shift left with overflow -warning: constant evaluation error: attempt to divide by zero - --> $DIR/E0080.rs:14:9 +warning: constant evaluation error + --> $DIR/E0080.rs:15:9 | LL | Y = (1 / 0) //~ ERROR E0080 - | ^^^^^^^ + | ^^^^^^^ attempt to divide by zero + | + = note: #[warn(const_err)] on by default + +warning: constant evaluation error + --> $DIR/E0080.rs:15:9 + | +LL | Y = (1 / 0) //~ ERROR E0080 + | ^^^^^^^ attempted to do overflowing math error[E0080]: constant evaluation error - --> $DIR/E0080.rs:14:9 + --> $DIR/E0080.rs:15:9 | LL | Y = (1 / 0) //~ ERROR E0080 | ^^^^^^^ attempt to divide by zero -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/error-codes/E0081.stderr b/src/test/ui/error-codes/E0081.stderr index 42d0769bb57..e1133c1fc58 100644 --- a/src/test/ui/error-codes/E0081.stderr +++ b/src/test/ui/error-codes/E0081.stderr @@ -1,10 +1,10 @@ -error[E0081]: discriminant value `3isize` already exists +error[E0081]: discriminant value `3` already exists --> $DIR/E0081.rs:13:9 | LL | P = 3, - | - first use of `3isize` + | - first use of `3` LL | X = 3, - | ^ enum already has `3isize` + | ^ enum already has `3` error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0370.stderr b/src/test/ui/error-codes/E0370.stderr index 1c7a18bd6d8..60e077e063e 100644 --- a/src/test/ui/error-codes/E0370.stderr +++ b/src/test/ui/error-codes/E0370.stderr @@ -2,9 +2,9 @@ error[E0370]: enum discriminant overflowed --> $DIR/E0370.rs:17:5 | LL | Y, //~ ERROR E0370 - | ^ overflowed on value after 9223372036854775807i64 + | ^ overflowed on value after 9223372036854775807 | - = note: explicitly set `Y = -9223372036854775808i64` if that is desired outcome + = note: explicitly set `Y = -9223372036854775808` if that is desired outcome error: aborting due to previous error diff --git a/src/test/ui/feature-gate-const-indexing.stderr b/src/test/ui/feature-gate-const-indexing.stderr index 419400bb0ac..e69de29bb2d 100644 --- a/src/test/ui/feature-gate-const-indexing.stderr +++ b/src/test/ui/feature-gate-const-indexing.stderr @@ -1,9 +0,0 @@ -error[E0080]: constant evaluation error - --> $DIR/feature-gate-const-indexing.rs:16:24 - | -LL | const BLUB: [i32; (ARR[0] - 41) as usize] = [5]; //~ ERROR constant evaluation error - | ^^^^^^ the index operation on const values is unstable - -error: aborting due to previous error - -If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/infinite-recursion-const-fn.stderr b/src/test/ui/infinite-recursion-const-fn.stderr index ce1b35aac7e..bc062ecce25 100644 --- a/src/test/ui/infinite-recursion-const-fn.stderr +++ b/src/test/ui/infinite-recursion-const-fn.stderr @@ -1,8 +1,72 @@ error[E0080]: constant evaluation error - --> $DIR/infinite-recursion-const-fn.rs:16:18 + --> $DIR/infinite-recursion-const-fn.rs:14:25 | -16 | const ARR: [i32; a()] = [5; 6]; //~ ERROR constant evaluation error - | ^^^ miri failed: reached the configured maximum number of stack frames +LL | const fn a() -> usize { b() } //~ ERROR constant evaluation error + | ^^^ + | | + | reached the configured maximum number of stack frames + | inside call to `b` +LL | const fn b() -> usize { a() } + | --- + | | + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` + | inside call to `a` +LL | const ARR: [i32; a()] = [5; 6]; + | --- inside call to `a` + | +note: for constant expression here + --> $DIR/infinite-recursion-const-fn.rs:16:1 + | +LL | const ARR: [i32; a()] = [5; 6]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error +If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/issue-15524.stderr b/src/test/ui/issue-15524.stderr index 1cb16dfe19a..e26766eca37 100644 --- a/src/test/ui/issue-15524.stderr +++ b/src/test/ui/issue-15524.stderr @@ -1,28 +1,28 @@ -error[E0081]: discriminant value `1isize` already exists +error[E0081]: discriminant value `1` already exists --> $DIR/issue-15524.rs:15:9 | LL | A = 1, - | - first use of `1isize` + | - first use of `1` LL | B = 1, - | ^ enum already has `1isize` + | ^ enum already has `1` -error[E0081]: discriminant value `1isize` already exists +error[E0081]: discriminant value `1` already exists --> $DIR/issue-15524.rs:18:5 | LL | A = 1, - | - first use of `1isize` + | - first use of `1` ... LL | D, - | ^ enum already has `1isize` + | ^ enum already has `1` -error[E0081]: discriminant value `1isize` already exists +error[E0081]: discriminant value `1` already exists --> $DIR/issue-15524.rs:21:9 | LL | A = 1, - | - first use of `1isize` + | - first use of `1` ... LL | E = N, - | ^ enum already has `1isize` + | ^ enum already has `1` error: aborting due to 3 previous errors diff --git a/src/test/ui/issue-23302-1.stderr b/src/test/ui/issue-23302-1.stderr index 13a2a23cc52..087eae43a29 100644 --- a/src/test/ui/issue-23302-1.stderr +++ b/src/test/ui/issue-23302-1.stderr @@ -5,10 +5,15 @@ LL | A = X::A as isize, //~ ERROR E0391 | ^^^^^^^^^^^^^ cyclic reference | note: the cycle begins when const-evaluating `X::A::{{initializer}}`... - --> $DIR/issue-23302-1.rs:14:5 + --> $DIR/issue-23302-1.rs:14:9 | LL | A = X::A as isize, //~ ERROR E0391 - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ +note: ...which then requires computing layout of `X`... + --> $DIR/issue-23302-1.rs:14:9 + | +LL | A = X::A as isize, //~ ERROR E0391 + | ^^^^ = note: ...which then again requires const-evaluating `X::A::{{initializer}}`, completing the cycle. error: aborting due to previous error diff --git a/src/test/ui/issue-23302-2.stderr b/src/test/ui/issue-23302-2.stderr index f303fa7c671..66ba5c32582 100644 --- a/src/test/ui/issue-23302-2.stderr +++ b/src/test/ui/issue-23302-2.stderr @@ -5,10 +5,15 @@ LL | A = Y::B as isize, //~ ERROR E0391 | ^^^^^^^^^^^^^ cyclic reference | note: the cycle begins when const-evaluating `Y::A::{{initializer}}`... - --> $DIR/issue-23302-2.rs:14:5 + --> $DIR/issue-23302-2.rs:14:9 | LL | A = Y::B as isize, //~ ERROR E0391 - | ^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^ +note: ...which then requires computing layout of `Y`... + --> $DIR/issue-23302-2.rs:14:9 + | +LL | A = Y::B as isize, //~ ERROR E0391 + | ^^^^ = note: ...which then again requires const-evaluating `Y::A::{{initializer}}`, completing the cycle. error: aborting due to previous error diff --git a/src/test/ui/issue-23302-3.rs b/src/test/ui/issue-23302-3.rs index 1d750b09025..5903acc8b7a 100644 --- a/src/test/ui/issue-23302-3.rs +++ b/src/test/ui/issue-23302-3.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const A: i32 = B; //~ ERROR E0391 +const A: i32 = B; -const B: i32 = A; +const B: i32 = A; //~ ERROR cyclic dependency detected fn main() { } diff --git a/src/test/ui/issue-23302-3.stderr b/src/test/ui/issue-23302-3.stderr index ec615809749..31168579394 100644 --- a/src/test/ui/issue-23302-3.stderr +++ b/src/test/ui/issue-23302-3.stderr @@ -1,20 +1,30 @@ error[E0391]: cyclic dependency detected - --> $DIR/issue-23302-3.rs:11:16 - | -LL | const A: i32 = B; //~ ERROR E0391 - | ^ cyclic reference - | -note: the cycle begins when processing `B`... - --> $DIR/issue-23302-3.rs:13:1 - | -LL | const B: i32 = A; - | ^^^^^^^^^^^^^^^^^ -note: ...which then requires processing `A`... --> $DIR/issue-23302-3.rs:13:16 | -LL | const B: i32 = A; +LL | const B: i32 = A; //~ ERROR cyclic dependency detected + | ^ cyclic reference + | +note: the cycle begins when const checking if rvalue is promotable to static `A`... + --> $DIR/issue-23302-3.rs:11:1 + | +LL | const A: i32 = B; + | ^^^^^^^^^^^^^^^^^ +note: ...which then requires checking which parts of `A` are promotable to static... + --> $DIR/issue-23302-3.rs:11:1 + | +LL | const A: i32 = B; + | ^^^^^^^^^^^^^^^^^ +note: ...which then requires const checking if rvalue is promotable to static `B`... + --> $DIR/issue-23302-3.rs:11:16 + | +LL | const A: i32 = B; | ^ - = note: ...which then again requires processing `B`, completing the cycle. +note: ...which then requires checking which parts of `B` are promotable to static... + --> $DIR/issue-23302-3.rs:13:1 + | +LL | const B: i32 = A; //~ ERROR cyclic dependency detected + | ^^^^^^^^^^^^^^^^^ + = note: ...which then again requires const checking if rvalue is promotable to static `A`, completing the cycle. error: aborting due to previous error diff --git a/src/test/ui/issue-36163.stderr b/src/test/ui/issue-36163.stderr index c511b576a21..4323eb4858f 100644 --- a/src/test/ui/issue-36163.stderr +++ b/src/test/ui/issue-36163.stderr @@ -5,15 +5,25 @@ LL | B = A, //~ ERROR E0391 | ^ cyclic reference | note: the cycle begins when const-evaluating `Foo::B::{{initializer}}`... - --> $DIR/issue-36163.rs:14:5 - | -LL | B = A, //~ ERROR E0391 - | ^^^^^ -note: ...which then requires const-evaluating `A`... --> $DIR/issue-36163.rs:14:9 | LL | B = A, //~ ERROR E0391 | ^ +note: ...which then requires processing `Foo::B::{{initializer}}`... + --> $DIR/issue-36163.rs:14:9 + | +LL | B = A, //~ ERROR E0391 + | ^ +note: ...which then requires const-evaluating `A`... + --> $DIR/issue-36163.rs:11:1 + | +LL | const A: isize = Foo::B as isize; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which then requires computing layout of `Foo`... + --> $DIR/issue-36163.rs:11:18 + | +LL | const A: isize = Foo::B as isize; + | ^^^^^^ = note: ...which then again requires const-evaluating `Foo::B::{{initializer}}`, completing the cycle. error: aborting due to previous error diff --git a/src/test/ui/issue-38875/issue_38875.stderr b/src/test/ui/issue-38875/issue_38875.stderr index 9a412be6a67..e69de29bb2d 100644 --- a/src/test/ui/issue-38875/issue_38875.stderr +++ b/src/test/ui/issue-38875/issue_38875.stderr @@ -1,15 +0,0 @@ -error[E0080]: constant evaluation error - --> $DIR/auxiliary/issue_38875_b.rs:11:24 - | -LL | pub const FOO: usize = *&0; - | ^^^ unimplemented constant expression: deref operation - | -note: for constant expression here - --> $DIR/issue_38875.rs:16:22 - | -LL | let test_x = [0; issue_38875_b::FOO]; - | ^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - -If you want more information on this error, try using "rustc --explain E0080" diff --git a/src/test/ui/union/union-const-eval.stderr b/src/test/ui/union/union-const-eval.stderr index afd661337c6..e69de29bb2d 100644 --- a/src/test/ui/union/union-const-eval.stderr +++ b/src/test/ui/union/union-const-eval.stderr @@ -1,17 +0,0 @@ -warning: constant evaluation error: nonexistent struct field - --> $DIR/union-const-eval.rs:21:21 - | -LL | let b: [u8; C.b]; //~ ERROR constant evaluation error - | ^^^ - | - = note: #[warn(const_err)] on by default - -error[E0080]: constant evaluation error - --> $DIR/union-const-eval.rs:21:21 - | -LL | let b: [u8; C.b]; //~ ERROR constant evaluation error - | ^^^ nonexistent struct field - -error: aborting due to previous error - -If you want more information on this error, try using "rustc --explain E0080"