1
Fork 0

normalization change and rebase

This commit is contained in:
b-naber 2022-03-08 15:05:50 +01:00
parent 8a811a1213
commit 26fe550670
49 changed files with 291 additions and 345 deletions

View file

@ -311,7 +311,7 @@ dependencies = [
[[package]] [[package]]
name = "cargo" name = "cargo"
version = "0.61.0" version = "0.62.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"atty", "atty",

View file

@ -164,7 +164,7 @@ pub enum StackPopCleanup {
} }
/// State of a local variable including a memoized layout /// State of a local variable including a memoized layout
#[derive(Clone, PartialEq, Eq, HashStable)] #[derive(Clone, Debug, PartialEq, Eq, HashStable)]
pub struct LocalState<'tcx, Tag: Provenance = AllocId> { pub struct LocalState<'tcx, Tag: Provenance = AllocId> {
pub value: LocalValue<Tag>, pub value: LocalValue<Tag>,
/// Don't modify if `Some`, this is only used to prevent computing the layout twice /// Don't modify if `Some`, this is only used to prevent computing the layout twice
@ -714,6 +714,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.size_and_align_of(&mplace.meta, &mplace.layout) self.size_and_align_of(&mplace.meta, &mplace.layout)
} }
#[instrument(skip(self, body, return_place, return_to_block), level = "debug")]
pub fn push_stack_frame( pub fn push_stack_frame(
&mut self, &mut self,
instance: ty::Instance<'tcx>, instance: ty::Instance<'tcx>,
@ -721,6 +722,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
return_place: Option<&PlaceTy<'tcx, M::PointerTag>>, return_place: Option<&PlaceTy<'tcx, M::PointerTag>>,
return_to_block: StackPopCleanup, return_to_block: StackPopCleanup,
) -> InterpResult<'tcx> { ) -> InterpResult<'tcx> {
debug!("body: {:#?}", body);
// first push a stack frame so we have access to the local substs // first push a stack frame so we have access to the local substs
let pre_frame = Frame { let pre_frame = Frame {
body, body,
@ -824,6 +826,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
/// `Drop` impls for any locals that have been initialized at this point. /// `Drop` impls for any locals that have been initialized at this point.
/// The cleanup block ends with a special `Resume` terminator, which will /// The cleanup block ends with a special `Resume` terminator, which will
/// cause us to continue unwinding. /// cause us to continue unwinding.
#[instrument(skip(self), level = "debug")]
pub(super) fn pop_stack_frame(&mut self, unwinding: bool) -> InterpResult<'tcx> { pub(super) fn pop_stack_frame(&mut self, unwinding: bool) -> InterpResult<'tcx> {
info!( info!(
"popping stack frame ({})", "popping stack frame ({})",
@ -876,6 +879,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
return Ok(()); return Ok(());
} }
debug!("locals: {:#?}", frame.locals);
// Cleanup: deallocate all locals that are backed by an allocation. // Cleanup: deallocate all locals that are backed by an allocation.
for local in &frame.locals { for local in &frame.locals {
self.deallocate_local(local.value)?; self.deallocate_local(local.value)?;
@ -935,6 +940,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
Ok(()) Ok(())
} }
#[instrument(skip(self), level = "debug")]
fn deallocate_local(&mut self, local: LocalValue<M::PointerTag>) -> InterpResult<'tcx> { fn deallocate_local(&mut self, local: LocalValue<M::PointerTag>) -> InterpResult<'tcx> {
if let LocalValue::Live(Operand::Indirect(MemPlace { ptr, .. })) = local { if let LocalValue::Live(Operand::Indirect(MemPlace { ptr, .. })) = local {
// All locals have a backing allocation, even if the allocation is empty // All locals have a backing allocation, even if the allocation is empty

View file

@ -359,6 +359,8 @@ pub fn intern_const_alloc_recursive<
// pointers, ... So we can't intern them according to their type rules // pointers, ... So we can't intern them according to their type rules
let mut todo: Vec<_> = leftover_allocations.iter().cloned().collect(); let mut todo: Vec<_> = leftover_allocations.iter().cloned().collect();
debug!(?todo);
debug!("dead_alloc_map: {:#?}", ecx.memory.dead_alloc_map);
while let Some(alloc_id) = todo.pop() { while let Some(alloc_id) = todo.pop() {
if let Some((_, mut alloc)) = ecx.memory.alloc_map.remove(&alloc_id) { if let Some((_, mut alloc)) = ecx.memory.alloc_map.remove(&alloc_id) {
// We can't call the `intern_shallow` method here, as its logic is tailored to safe // We can't call the `intern_shallow` method here, as its logic is tailored to safe

View file

@ -275,6 +275,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
Ok(new_ptr) Ok(new_ptr)
} }
#[instrument(skip(self), level = "debug")]
pub fn deallocate( pub fn deallocate(
&mut self, &mut self,
ptr: Pointer<Option<M::PointerTag>>, ptr: Pointer<Option<M::PointerTag>>,
@ -305,6 +306,8 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
.into()); .into());
}; };
debug!(?alloc);
if alloc.mutability == Mutability::Not { if alloc.mutability == Mutability::Not {
throw_ub_format!("deallocating immutable allocation {}", alloc_id); throw_ub_format!("deallocating immutable allocation {}", alloc_id);
} }

View file

@ -336,7 +336,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
) -> Result<mir::ConstantKind<'tcx>, Self::Error> { ) -> Result<mir::ConstantKind<'tcx>, Self::Error> {
let constant_kind = match constant { let constant_kind = match constant {
mir::ConstantKind::Ty(c) => { mir::ConstantKind::Ty(c) => {
let const_folded = c.try_super_fold_with(self)?; let const_folded = c.try_fold_with(self)?;
match const_folded.val() { match const_folded.val() {
ty::ConstKind::Value(cv) => { ty::ConstKind::Value(cv) => {
// FIXME With Valtrees we need to convert `cv: ValTree` // FIXME With Valtrees we need to convert `cv: ValTree`

View file

@ -21,44 +21,44 @@ fn main() -> () {
} }
alloc1 (static: FOO, size: 16, align: 8) { alloc1 (static: FOO, size: 16, align: 8) {
alloc22 03 00 00 00 00 00 00 00 ........ alloc28 03 00 00 00 00 00 00 00 ........
} }
alloc22 (size: 72, align: 8) { alloc28 (size: 72, align: 8) {
0x00 00 00 00 00 __ __ __ __ alloc9 .... 0x00 00 00 00 00 __ __ __ __ alloc13 ....
0x10 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ ............ 0x10 00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ ............
0x20 alloc14 02 00 00 00 00 00 00 00 ........ 0x20 alloc18 02 00 00 00 00 00 00 00 ........
0x30 01 00 00 00 2a 00 00 00 alloc20 ....*... 0x30 01 00 00 00 2a 00 00 00 alloc26 ....*...
0x40 03 00 00 00 00 00 00 00 ........ 0x40 03 00 00 00 00 00 00 00 ........
} }
alloc9 (size: 0, align: 8) {} alloc13 (size: 0, align: 8) {}
alloc14 (size: 16, align: 8) { alloc18 (size: 16, align: 8) {
alloc12 alloc13 alloc16 alloc17
} }
alloc12 (size: 1, align: 1) { alloc16 (size: 1, align: 1) {
05 . 05 .
} }
alloc13 (size: 1, align: 1) { alloc17 (size: 1, align: 1) {
06 . 06 .
} }
alloc20 (size: 24, align: 8) { alloc26 (size: 24, align: 8) {
0x00 alloc17+0x3 alloc18 0x00 alloc22+0x3 alloc23
0x10 alloc19+0x2 0x10 alloc25+0x2
} }
alloc17 (size: 4, align: 1) { alloc22 (size: 4, align: 1) {
2a 45 15 6f *E.o 2a 45 15 6f *E.o
} }
alloc18 (size: 1, align: 1) { alloc23 (size: 1, align: 1) {
2a * 2a *
} }
alloc19 (size: 4, align: 1) { alloc25 (size: 4, align: 1) {
2a 45 15 6f *E.o 2a 45 15 6f *E.o
} }

View file

@ -26,7 +26,7 @@
- _2 = transmute::<&str, &[u8]>(move _8) -> bb14; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL - _2 = transmute::<&str, &[u8]>(move _8) -> bb14; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL
+ _2 = transmute::<&str, &[u8]>(move _8) -> bb12; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL + _2 = transmute::<&str, &[u8]>(move _8) -> bb12; // scope 2 at $SRC_DIR/core/src/str/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $DIR/deduplicate_blocks.rs:3:11: 3:23 // + span: $SRC_DIR/core/src/str/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&str) -> &[u8] {transmute::<&str, &[u8]>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&str) -> &[u8] {transmute::<&str, &[u8]>}, val: Value(Scalar(<ZST>)) }
} }

View file

@ -39,7 +39,7 @@
// mir::Constant // mir::Constant
- // + span: $DIR/inline-diverging.rs:16:9: 16:14 - // + span: $DIR/inline-diverging.rs:16:9: 16:14
- // + literal: Const { ty: fn() -> ! {panic}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: fn() -> ! {panic}, val: Value(Scalar(<ZST>)) }
+ // + span: $DIR/inline-diverging.rs:16:9: 16:16 + // + span: $SRC_DIR/std/src/panic.rs:LL:COL
+ // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(Scalar(<ZST>)) } + // + literal: Const { ty: fn(&str) -> ! {begin_panic::<&str>}, val: Value(Scalar(<ZST>)) }
+ // mir::Constant + // mir::Constant
+ // + span: $SRC_DIR/std/src/panic.rs:LL:COL + // + span: $SRC_DIR/std/src/panic.rs:LL:COL

View file

@ -50,11 +50,7 @@
- // mir::Constant - // mir::Constant
- // + span: $DIR/inline-generator.rs:9:14: 9:22 - // + span: $DIR/inline-generator.rs:9:14: 9:22
- // + user_ty: UserType(0) - // + user_ty: UserType(0)
<<<<<<< HEAD
- // + literal: Const { ty: fn(&mut impl Generator<bool>) -> Pin<&mut impl Generator<bool>> {Pin::<&mut impl Generator<bool>>::new}, val: Value(Scalar(<ZST>)) }
=======
- // + literal: Const { ty: fn(&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]) -> Pin<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]> {Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: fn(&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]) -> Pin<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]> {Pin::<&mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>::new}, val: Value(Scalar(<ZST>)) }
>>>>>>> a4feb9af018 (bless tests)
- } - }
- -
- bb2: { - bb2: {
@ -69,11 +65,7 @@
- _1 = <[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 - _1 = <[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
- // mir::Constant - // mir::Constant
- // + span: $DIR/inline-generator.rs:9:33: 9:39 - // + span: $DIR/inline-generator.rs:9:33: 9:39
<<<<<<< HEAD
- // + literal: Const { ty: for<'r> fn(Pin<&'r mut impl Generator<bool>>, bool) -> GeneratorState<<impl Generator<bool> as Generator<bool>>::Yield, <impl Generator<bool> as Generator<bool>>::Return> {<impl Generator<bool> as Generator<bool>>::resume}, val: Value(Scalar(<ZST>)) }
=======
- // + literal: Const { ty: for<'r> fn(Pin<&'r mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>, bool) -> GeneratorState<<[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::Yield, <[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::Return> {<[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::resume}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: for<'r> fn(Pin<&'r mut [generator@$DIR/inline-generator.rs:15:5: 15:41]>, bool) -> GeneratorState<<[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::Yield, <[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::Return> {<[generator@$DIR/inline-generator.rs:15:5: 15:41] as Generator<bool>>::resume}, val: Value(Scalar(<ZST>)) }
>>>>>>> a4feb9af018 (bless tests)
+ StorageLive(_7); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 + StorageLive(_7); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
+ _7 = const false; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 + _7 = const false; // scope 0 at $DIR/inline-generator.rs:9:14: 9:46
+ StorageLive(_10); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46 + StorageLive(_10); // scope 0 at $DIR/inline-generator.rs:9:14: 9:46

View file

@ -34,14 +34,7 @@
- (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 - (*_5) = Vec::<u32>::new() -> [return: bb2, unwind: bb5]; // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + StorageLive(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + _7 = &mut (*_5); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
<<<<<<< HEAD
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32> { ptr: Unique::<u32> { pointer: {0x4 as *const u32}, _marker: PhantomData::<u32> }, cap: 0_usize, alloc: std::alloc::Global }; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
=======
+ ((*_7).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32>::NEW; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
+ // ty::Const
+ // + ty: alloc::raw_vec::RawVec<u32>
+ // + val: Unevaluated(alloc::raw_vec::RawVec::<T>::NEW, [u32], None)
>>>>>>> a4feb9af018 (bless tests)
// mir::Constant // mir::Constant
- // + span: $DIR/inline-into-box-place.rs:8:33: 8:41 - // + span: $DIR/inline-into-box-place.rs:8:33: 8:41
- // + user_ty: UserType(1) - // + user_ty: UserType(1)
@ -51,13 +44,8 @@
- bb2: { - bb2: {
+ // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + // + span: $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+ // + user_ty: UserType(0) + // + user_ty: UserType(0)
<<<<<<< HEAD
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [65535], len: Size { raw: 16 } }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) } + // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Value(ByRef { alloc: Allocation { bytes: [4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], relocations: Relocations(SortedMap { data: [] }), init_mask: InitMask { blocks: [65535], len: Size { raw: 16 } }, align: Align { pow2: 3 }, mutability: Not, extra: () }, offset: Size { raw: 0 } }) }
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL + ((*_7).1: usize) = const 0_usize; // scope 3 at $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
=======
+ // + literal: Const { ty: alloc::raw_vec::RawVec<u32>, val: Unevaluated(Unevaluated { def: WithOptConstParam { did: DefId(5:77 ~ alloc[bd09]::raw_vec::{impl#0}::NEW), const_param_did: None }, substs: [u32], promoted: None }) }
+ ((*_7).1: usize) = const 0_usize; // scope 3 at $DIR/inline-into-box-place.rs:8:33: 8:43
>>>>>>> a4feb9af018 (bless tests)
+ StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43 + StorageDead(_7); // scope 0 at $DIR/inline-into-box-place.rs:8:33: 8:43
_1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43 _1 = move _5; // scope 0 at $DIR/inline-into-box-place.rs:8:29: 8:43
StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43 StorageDead(_5); // scope 0 at $DIR/inline-into-box-place.rs:8:42: 8:43

View file

@ -29,7 +29,7 @@
- // mir::Constant - // mir::Constant
- // + span: $DIR/issue-78442.rs:11:5: 11:15 - // + span: $DIR/issue-78442.rs:11:5: 11:15
- // + literal: Const { ty: for<'r> extern "rust-call" fn(&'r fn() {foo}, ()) -> <fn() {foo} as FnOnce<()>>::Output {<fn() {foo} as Fn<()>>::call}, val: Value(Scalar(<ZST>)) } - // + literal: Const { ty: for<'r> extern "rust-call" fn(&'r fn() {foo}, ()) -> <fn() {foo} as FnOnce<()>>::Output {<fn() {foo} as Fn<()>>::call}, val: Value(Scalar(<ZST>)) }
+ _2 = move (*_3)() -> [return: bb5, unwind: bb3]; // scope 1 at $DIR/issue-78442.rs:11:5: 11:17 + _2 = move (*_3)() -> [return: bb5, unwind: bb3]; // scope 1 at $SRC_DIR/core/src/ops/function.rs:LL:COL
} }
bb2: { bb2: {

View file

@ -38,7 +38,7 @@ fn num_to_digit(_1: char) -> u32 {
_8 = _2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL _8 = _2; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
_7 = char::methods::<impl char>::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL _7 = char::methods::<impl char>::to_digit(move _8, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $DIR/issue-59352.rs:14:8: 14:23 // + span: $SRC_DIR/core/src/char/methods.rs:LL:COL
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(Scalar(<ZST>)) }
} }

View file

@ -58,7 +58,7 @@
_14 = &mut (*_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL _14 = &mut (*_8); // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
_7 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _14) -> bb4; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL _7 = <std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next(move _14) -> bb4; // scope 5 at $SRC_DIR/core/src/iter/range.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $DIR/remove_storage_markers.rs:8:14: 8:19 // + span: $SRC_DIR/core/src/iter/range.rs:LL:COL
// + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> Option<<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: for<'r> fn(&'r mut std::ops::Range<i32>) -> Option<<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::Item> {<std::ops::Range<i32> as iter::range::RangeIteratorImpl>::spec_next}, val: Value(Scalar(<ZST>)) }
} }

View file

@ -1,9 +1,9 @@
// build-fail // build-fail
//~^ cycle detected when normalizing `<() as Tr>::A` [E0391]
// Cyclic assoc. const defaults don't error unless *used* // Cyclic assoc. const defaults don't error unless *used*
trait Tr { trait Tr {
const A: u8 = Self::B; const A: u8 = Self::B;
//~^ ERROR cycle detected when const-evaluating + checking `Tr::A`
const B: u8 = Self::A; const B: u8 = Self::A;
} }

View file

@ -1,15 +1,37 @@
error[E0391]: cycle detected when const-evaluating + checking `Tr::A` error[E0391]: cycle detected when normalizing `<() as Tr>::A`
--> $DIR/defaults-cyclic-fail.rs:5:5 |
note: ...which requires simplifying constant for the type system `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:6:5
| |
LL | const A: u8 = Self::B; LL | const A: u8 = Self::B;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:6:5
| |
LL | const A: u8 = Self::B;
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Tr::A`...
--> $DIR/defaults-cyclic-fail.rs:6:5
|
LL | const A: u8 = Self::B;
| ^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `<() as Tr>::B`...
note: ...which requires simplifying constant for the type system `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:5
|
LL | const B: u8 = Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:5
|
LL | const B: u8 = Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Tr::B`... note: ...which requires const-evaluating + checking `Tr::B`...
--> $DIR/defaults-cyclic-fail.rs:8:5 --> $DIR/defaults-cyclic-fail.rs:8:5
| |
LL | const B: u8 = Self::A; LL | const B: u8 = Self::A;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating + checking `Tr::A`, completing the cycle = note: ...which again requires normalizing `<() as Tr>::A`, completing the cycle
note: cycle used when const-evaluating + checking `main::promoted[1]` note: cycle used when const-evaluating + checking `main::promoted[1]`
--> $DIR/defaults-cyclic-fail.rs:14:1 --> $DIR/defaults-cyclic-fail.rs:14:1
| |

View file

@ -1,9 +1,30 @@
error[E0391]: cycle detected when const-evaluating + checking `IMPL_REF_BAR` error[E0391]: cycle detected when simplifying constant for the type system `IMPL_REF_BAR`
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
| |
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: ...which requires simplifying constant for the type system `IMPL_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
|
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `IMPL_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
|
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
|
LL | const BAR: u32 = IMPL_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
|
LL | const BAR: u32 = IMPL_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`... note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 --> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5
| |
@ -14,17 +35,9 @@ note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-st
| |
LL | const BAR: u32 = IMPL_REF_BAR; LL | const BAR: u32 = IMPL_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `IMPL_REF_BAR`... = note: ...which requires normalizing `IMPL_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 = note: ...which again requires simplifying constant for the type system `IMPL_REF_BAR`, completing the cycle
| = note: cycle used when running analysis passes on this crate
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating + checking `IMPL_REF_BAR`, completing the cycle
note: cycle used when simplifying constant for the type system `IMPL_REF_BAR`
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1
|
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,9 +1,30 @@
error[E0391]: cycle detected when const-evaluating + checking `DEFAULT_REF_BAR` error[E0391]: cycle detected when simplifying constant for the type system `DEFAULT_REF_BAR`
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
| |
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR; LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: ...which requires simplifying constant for the type system `DEFAULT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
|
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
|
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `<GlobalDefaultRef as FooDefault>::BAR`...
note: ...which requires simplifying constant for the type system `FooDefault::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
|
LL | const BAR: u32 = DEFAULT_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `FooDefault::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
|
LL | const BAR: u32 = DEFAULT_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `FooDefault::BAR`... note: ...which requires const-evaluating + checking `FooDefault::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 --> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5
| |
@ -14,17 +35,9 @@ note: ...which requires caching mir of `FooDefault::BAR` for CTFE...
| |
LL | const BAR: u32 = DEFAULT_REF_BAR; LL | const BAR: u32 = DEFAULT_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`... = note: ...which requires normalizing `DEFAULT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 = note: ...which again requires simplifying constant for the type system `DEFAULT_REF_BAR`, completing the cycle
| = note: cycle used when running analysis passes on this crate
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating + checking `DEFAULT_REF_BAR`, completing the cycle
note: cycle used when simplifying constant for the type system `DEFAULT_REF_BAR`
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1
|
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,9 +1,30 @@
error[E0391]: cycle detected when const-evaluating + checking `TRAIT_REF_BAR` error[E0391]: cycle detected when simplifying constant for the type system `TRAIT_REF_BAR`
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
| |
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
note: ...which requires simplifying constant for the type system `TRAIT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `<GlobalTraitRef as Foo>::BAR`...
note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
|
LL | const BAR: u32 = TRAIT_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
|
LL | const BAR: u32 = TRAIT_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`... note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 --> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5
| |
@ -14,17 +35,9 @@ note: ...which requires caching mir of `<impl at $DIR/issue-24949-assoc-const-st
| |
LL | const BAR: u32 = TRAIT_REF_BAR; LL | const BAR: u32 = TRAIT_REF_BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`... = note: ...which requires normalizing `TRAIT_REF_BAR`...
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 = note: ...which again requires simplifying constant for the type system `TRAIT_REF_BAR`, completing the cycle
| = note: cycle used when running analysis passes on this crate
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating + checking `TRAIT_REF_BAR`, completing the cycle
note: cycle used when simplifying constant for the type system `TRAIT_REF_BAR`
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1
|
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,8 +1,6 @@
// Regression test related to issue 88434 // Regression test related to issue 88434
const _CONST: &() = &f(&|_| {}); const _CONST: &() = &f(&|_| {});
//~^ ERROR any use of this value will cause an error
//~| WARNING this was previously accepted by the compiler but is being phased out
const fn f<F>(_: &F) const fn f<F>(_: &F)
where where

View file

@ -1,9 +1,5 @@
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
<<<<<<< HEAD
--> $DIR/issue-88434-minimal-example.rs:9:5 --> $DIR/issue-88434-minimal-example.rs:9:5
=======
--> $DIR/issue-88434-minimal-example.rs:12:5
>>>>>>> a4feb9af018 (bless tests)
| |
LL | const _CONST: &() = &f(&|_| {}); LL | const _CONST: &() = &f(&|_| {});
| ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22 | ---------- inside `_CONST` at $DIR/issue-88434-minimal-example.rs:3:22
@ -11,28 +7,11 @@ LL | const _CONST: &() = &f(&|_| {});
LL | panic!() LL | panic!()
| ^^^^^^^^ | ^^^^^^^^
| | | |
<<<<<<< HEAD
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:9:5 | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:9:5
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL | inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:3:25: 3:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
=======
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-minimal-example.rs:12:5
| inside `f::<[closure@$DIR/issue-88434-minimal-example.rs:4:25: 4:31]>` at $SRC_DIR/std/src/panic.rs:LL:COL
>>>>>>> a4feb9af018 (bless tests)
| |
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error error: aborting due to previous error
--> $DIR/issue-88434-minimal-example.rs:4:21
|
LL | const _CONST: &() = &f(&|_| {});
| --------------------^^^^^^^^^^^-
| |
| referenced constant has errors
|
= note: `#[deny(const_err)]` on by default
= 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 #71800 <https://github.com/rust-lang/rust/issues/71800>
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`. For more information about this error, try `rustc --explain E0080`.

View file

@ -1,8 +1,6 @@
// Regression test for issue 88434 // Regression test for issue 88434
const _CONST: &[u8] = &f(&[], |_| {}); const _CONST: &[u8] = &f(&[], |_| {});
//~^ ERROR any use of this value will cause an error
//~| WARNING this was previously
const fn f<F>(_: &[u8], _: F) -> &[u8] const fn f<F>(_: &[u8], _: F) -> &[u8]
where where

View file

@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-removal-index-should-be-less.rs:12:5 --> $DIR/issue-88434-removal-index-should-be-less.rs:9:5
| |
LL | const _CONST: &[u8] = &f(&[], |_| {}); LL | const _CONST: &[u8] = &f(&[], |_| {});
| -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | -------------- inside `_CONST` at $DIR/issue-88434-removal-index-should-be-less.rs:3:24
@ -7,23 +7,11 @@ LL | const _CONST: &[u8] = &f(&[], |_| {});
LL | panic!() LL | panic!()
| ^^^^^^^^ | ^^^^^^^^
| | | |
| the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:12:5 | the evaluated program panicked at 'explicit panic', $DIR/issue-88434-removal-index-should-be-less.rs:9:5
| inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:4:31: 4:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL | inside `f::<[closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:37]>` at $SRC_DIR/std/src/panic.rs:LL:COL
| |
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
error: any use of this value will cause an error error: aborting due to previous error
--> $DIR/issue-88434-removal-index-should-be-less.rs:4:23
|
LL | const _CONST: &[u8] = &f(&[], |_| {});
| ----------------------^^^^^^^^^^^^^^^-
| |
| referenced constant has errors
|
= note: `#[deny(const_err)]` on by default
= 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 #71800 <https://github.com/rust-lang/rust/issues/71800>
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`. For more information about this error, try `rustc --explain E0080`.

View file

@ -4,7 +4,7 @@ error[E0080]: evaluation of constant value failed
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | | |
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
| |
::: $DIR/out_of_bounds_read.rs:13:33 ::: $DIR/out_of_bounds_read.rs:13:33
@ -18,7 +18,7 @@ error[E0080]: evaluation of constant value failed
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | | |
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
| |
::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
@ -37,7 +37,7 @@ error[E0080]: evaluation of constant value failed
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1); LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| | | |
| memory access failed: alloc5 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds | memory access failed: alloc7 has size 4, so pointer to 4 bytes starting at offset 4 is out-of-bounds
| inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
| |
::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL ::: $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL

View file

@ -1,4 +1,5 @@
// compile-flags: -Ztreat-err-as-bug=2 // compile-flags: -Ztreat-err-as-bug=2
//~^ ERROR 1:1: 1:1: ty::ConstKind::Error constructed but no error reported
// build-fail // build-fail
// failure-status: 101 // failure-status: 101
// rustc-env:RUST_BACKTRACE=1 // rustc-env:RUST_BACKTRACE=1
@ -15,6 +16,7 @@
#![allow(unconditional_panic)] #![allow(unconditional_panic)]
#[warn(const_err)] #[warn(const_err)]
const X: i32 = 1 / 0; //~WARN any use of this value will cause an error const X: i32 = 1 / 0; //~WARN any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out //~| WARN this was previously accepted by the compiler but is being phased out
@ -22,7 +24,5 @@ const X: i32 = 1 / 0; //~WARN any use of this value will cause an error
fn main() { fn main() {
let x: &'static i32 = &X; let x: &'static i32 = &X;
//~^ ERROR evaluation of constant value failed //~^ ERROR evaluation of constant value failed
//~| ERROR erroneous constant used
//~| WARNING this was previously accepted by the compiler
println!("x={}", x); println!("x={}", x);
} }

View file

@ -1,5 +1,5 @@
warning: any use of this value will cause an error warning: any use of this value will cause an error
--> $DIR/const-eval-query-stack.rs:19:16 --> $DIR/const-eval-query-stack.rs:21:16
| |
LL | const X: i32 = 1 / 0; LL | const X: i32 = 1 / 0;
| ---------------^^^^^- | ---------------^^^^^-
@ -7,7 +7,7 @@ LL | const X: i32 = 1 / 0;
| attempt to divide `1_i32` by zero | attempt to divide `1_i32` by zero
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/const-eval-query-stack.rs:18:8 --> $DIR/const-eval-query-stack.rs:20:8
| |
LL | #[warn(const_err)] LL | #[warn(const_err)]
| ^^^^^^^^^ | ^^^^^^^^^
@ -15,22 +15,12 @@ LL | #[warn(const_err)]
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800>
error[E0080]: evaluation of constant value failed error[E0080]: evaluation of constant value failed
--> $DIR/const-eval-query-stack.rs:23:28 --> $DIR/const-eval-query-stack.rs:25:28
| |
LL | let x: &'static i32 = &X; LL | let x: &'static i32 = &X;
| ^ referenced constant has errors | ^ referenced constant has errors
error: erroneous constant used
--> $DIR/const-eval-query-stack.rs:23:27
|
LL | let x: &'static i32 = &X;
| ^^ referenced constant has errors
|
= note: `#[deny(const_err)]` on by default
= 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 #71800 <https://github.com/rust-lang/rust/issues/71800>
query stack during panic: query stack during panic:
#0 [optimized_mir] optimizing MIR for `main` #0 [try_normalize_mir_const_after_erasing_regions] normalizing `main::promoted[1]`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items #1 [optimized_mir] optimizing MIR for `main`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack end of query stack

View file

@ -6,7 +6,6 @@ const X: usize = 42 && 39;
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARR: [i32; X] = [99; 34]; const ARR: [i32; X] = [99; 34];
//~^ ERROR evaluation of constant value failed
const X1: usize = 42 || 39; const X1: usize = 42 || 39;
//~^ ERROR mismatched types //~^ ERROR mismatched types
@ -16,7 +15,6 @@ const X1: usize = 42 || 39;
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARR1: [i32; X1] = [99; 47]; const ARR1: [i32; X1] = [99; 47];
//~^ ERROR evaluation of constant value failed
const X2: usize = -42 || -39; const X2: usize = -42 || -39;
//~^ ERROR mismatched types //~^ ERROR mismatched types
@ -26,7 +24,6 @@ const X2: usize = -42 || -39;
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARR2: [i32; X2] = [99; 18446744073709551607]; const ARR2: [i32; X2] = [99; 18446744073709551607];
//~^ ERROR evaluation of constant value failed
const X3: usize = -42 && -39; const X3: usize = -42 && -39;
//~^ ERROR mismatched types //~^ ERROR mismatched types
@ -36,43 +33,36 @@ const X3: usize = -42 && -39;
//~| ERROR mismatched types //~| ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARR3: [i32; X3] = [99; 6]; const ARR3: [i32; X3] = [99; 6];
//~^ ERROR evaluation of constant value failed
const Y: usize = 42.0 == 42.0; const Y: usize = 42.0 == 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARRR: [i32; Y] = [99; 1]; const ARRR: [i32; Y] = [99; 1];
//~^ ERROR evaluation of constant value failed
const Y1: usize = 42.0 >= 42.0; const Y1: usize = 42.0 >= 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARRR1: [i32; Y1] = [99; 1]; const ARRR1: [i32; Y1] = [99; 1];
//~^ ERROR evaluation of constant value failed
const Y2: usize = 42.0 <= 42.0; const Y2: usize = 42.0 <= 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARRR2: [i32; Y2] = [99; 1]; const ARRR2: [i32; Y2] = [99; 1];
//~^ ERROR evaluation of constant value failed
const Y3: usize = 42.0 > 42.0; const Y3: usize = 42.0 > 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARRR3: [i32; Y3] = [99; 0]; const ARRR3: [i32; Y3] = [99; 0];
//~^ ERROR evaluation of constant value failed
const Y4: usize = 42.0 < 42.0; const Y4: usize = 42.0 < 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARRR4: [i32; Y4] = [99; 0]; const ARRR4: [i32; Y4] = [99; 0];
//~^ ERROR evaluation of constant value failed
const Y5: usize = 42.0 != 42.0; const Y5: usize = 42.0 != 42.0;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected `usize`, found `bool` //~| expected `usize`, found `bool`
const ARRR5: [i32; Y5] = [99; 0]; const ARRR5: [i32; Y5] = [99; 0];
//~^ ERROR evaluation of constant value failed
fn main() { fn main() {
let _ = ARR; let _ = ARR;

View file

@ -16,157 +16,96 @@ error[E0308]: mismatched types
LL | const X: usize = 42 && 39; LL | const X: usize = 42 && 39;
| ^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:8:18
|
LL | const ARR: [i32; X] = [99; 34];
| ^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:19 --> $DIR/const-integer-bool-ops.rs:10:19
| |
LL | const X1: usize = 42 || 39; LL | const X1: usize = 42 || 39;
| ^^ expected `bool`, found integer | ^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:25 --> $DIR/const-integer-bool-ops.rs:10:25
| |
LL | const X1: usize = 42 || 39; LL | const X1: usize = 42 || 39;
| ^^ expected `bool`, found integer | ^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:19 --> $DIR/const-integer-bool-ops.rs:10:19
| |
LL | const X1: usize = 42 || 39; LL | const X1: usize = 42 || 39;
| ^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:18:19
|
LL | const ARR1: [i32; X1] = [99; 47];
| ^^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:19 --> $DIR/const-integer-bool-ops.rs:19:19
| |
LL | const X2: usize = -42 || -39; LL | const X2: usize = -42 || -39;
| ^^^ expected `bool`, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:26 --> $DIR/const-integer-bool-ops.rs:19:26
| |
LL | const X2: usize = -42 || -39; LL | const X2: usize = -42 || -39;
| ^^^ expected `bool`, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:19 --> $DIR/const-integer-bool-ops.rs:19:19
| |
LL | const X2: usize = -42 || -39; LL | const X2: usize = -42 || -39;
| ^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:28:19 --> $DIR/const-integer-bool-ops.rs:28:19
| |
LL | const ARR2: [i32; X2] = [99; 18446744073709551607];
| ^^ referenced constant has errors
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:19
|
LL | const X3: usize = -42 && -39; LL | const X3: usize = -42 && -39;
| ^^^ expected `bool`, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:26 --> $DIR/const-integer-bool-ops.rs:28:26
| |
LL | const X3: usize = -42 && -39; LL | const X3: usize = -42 && -39;
| ^^^ expected `bool`, found integer | ^^^ expected `bool`, found integer
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:19 --> $DIR/const-integer-bool-ops.rs:28:19
| |
LL | const X3: usize = -42 && -39; LL | const X3: usize = -42 && -39;
| ^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:38:19
|
LL | const ARR3: [i32; X3] = [99; 6];
| ^^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:41:18 --> $DIR/const-integer-bool-ops.rs:37:18
| |
LL | const Y: usize = 42.0 == 42.0; LL | const Y: usize = 42.0 == 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:44:19
|
LL | const ARRR: [i32; Y] = [99; 1];
| ^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:47:19 --> $DIR/const-integer-bool-ops.rs:42:19
| |
LL | const Y1: usize = 42.0 >= 42.0; LL | const Y1: usize = 42.0 >= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:50:20
|
LL | const ARRR1: [i32; Y1] = [99; 1];
| ^^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:53:19 --> $DIR/const-integer-bool-ops.rs:47:19
| |
LL | const Y2: usize = 42.0 <= 42.0; LL | const Y2: usize = 42.0 <= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:56:20
|
LL | const ARRR2: [i32; Y2] = [99; 1];
| ^^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:59:19 --> $DIR/const-integer-bool-ops.rs:52:19
| |
LL | const Y3: usize = 42.0 > 42.0; LL | const Y3: usize = 42.0 > 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:62:20
|
LL | const ARRR3: [i32; Y3] = [99; 0];
| ^^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:65:19 --> $DIR/const-integer-bool-ops.rs:57:19
| |
LL | const Y4: usize = 42.0 < 42.0; LL | const Y4: usize = 42.0 < 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed
--> $DIR/const-integer-bool-ops.rs:68:20
|
LL | const ARRR4: [i32; Y4] = [99; 0];
| ^^ referenced constant has errors
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:71:19 --> $DIR/const-integer-bool-ops.rs:62:19
| |
LL | const Y5: usize = 42.0 != 42.0; LL | const Y5: usize = 42.0 != 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool` | ^^^^^^^^^^^^ expected `usize`, found `bool`
error[E0080]: evaluation of constant value failed error: aborting due to 18 previous errors
--> $DIR/const-integer-bool-ops.rs:74:20
|
LL | const ARRR5: [i32; Y5] = [99; 0];
| ^^ referenced constant has errors
error: aborting due to 28 previous errors For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0080, E0308.
For more information about an error, try `rustc --explain E0080`.

View file

@ -19,13 +19,7 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
LL | const S: &'static mut str = &mut " hello "; LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^ cannot borrow as mutable | ^^^^^^^^^^^^^^ cannot borrow as mutable
error[E0080]: evaluation of constant value failed error: aborting due to 3 previous errors
--> $DIR/issue-76510.rs:11:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
| ^ referenced constant has errors
error: aborting due to 4 previous errors Some errors have detailed explanations: E0596, E0658, E0764.
For more information about an error, try `rustc --explain E0596`.
Some errors have detailed explanations: E0080, E0596, E0658, E0764.
For more information about an error, try `rustc --explain E0080`.

View file

@ -9,7 +9,6 @@ const S: &'static mut str = &mut " hello ";
const fn trigger() -> [(); unsafe { const fn trigger() -> [(); unsafe {
let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3)); let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
//~^ ERROR evaluation of constant value failed
0 0
}] { }] {
[(); 0] [(); 0]

View file

@ -4,7 +4,6 @@ const TUP: (usize,) = 5usize << 64;
//~^ ERROR mismatched types //~^ ERROR mismatched types
//~| expected tuple, found `usize` //~| expected tuple, found `usize`
const ARR: [i32; TUP.0] = []; const ARR: [i32; TUP.0] = [];
//~^ ERROR evaluation of constant value failed
fn main() { fn main() {
} }

View file

@ -11,13 +11,6 @@ help: use a trailing comma to create a tuple with one element
LL | const TUP: (usize,) = (5usize << 64,); LL | const TUP: (usize,) = (5usize << 64,);
| + ++ | + ++
error[E0080]: evaluation of constant value failed error: aborting due to previous error
--> $DIR/const-tup-index-span.rs:6:18
|
LL | const ARR: [i32; TUP.0] = [];
| ^^^ referenced constant has errors
error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`.
Some errors have detailed explanations: E0080, E0308.
For more information about an error, try `rustc --explain E0080`.

View file

@ -6,7 +6,7 @@ LL | fn main() {
| |
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior. = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: 8, align: 8) { = note: the raw bytes of the constant (size: 8, align: 8) {
╾───────alloc6────────╼ │ ╾──────╼ ╾───────alloc7────────╼ │ ╾──────╼
} }
error: erroneous constant used error: erroneous constant used

View file

@ -1,20 +1,48 @@
error[E0391]: cycle detected when const-evaluating + checking `Foo::B::{constant#0}` error[E0391]: cycle detected when simplifying constant for the type system `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9 --> $DIR/issue-36163.rs:4:9
| |
LL | B = A, LL | B = A,
| ^ | ^
| |
note: ...which requires simplifying constant for the type system `Foo::B::{constant#0}`...
--> $DIR/issue-36163.rs:4:9
|
LL | B = A,
| ^
note: ...which requires const-evaluating + checking `Foo::B::{constant#0}`...
--> $DIR/issue-36163.rs:4:9
|
LL | B = A,
| ^
= note: ...which requires normalizing `A`...
note: ...which requires simplifying constant for the type system `A`...
--> $DIR/issue-36163.rs:1:1
|
LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `A`...
--> $DIR/issue-36163.rs:1:1
|
LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `A`... note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-36163.rs:1:1 --> $DIR/issue-36163.rs:1:1
| |
LL | const A: isize = Foo::B as isize; LL | const A: isize = Foo::B as isize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating + checking `Foo::B::{constant#0}`, completing the cycle = note: ...which requires normalizing `A`...
note: cycle used when simplifying constant for the type system `Foo::B::{constant#0}` = note: ...which again requires simplifying constant for the type system `Foo::B::{constant#0}`, completing the cycle
--> $DIR/issue-36163.rs:4:9 note: cycle used when collecting item types in top-level module
--> $DIR/issue-36163.rs:1:1
| |
LL | B = A, LL | / const A: isize = Foo::B as isize;
| ^ LL | |
LL | | enum Foo {
LL | | B = A,
LL | | }
LL | |
LL | | fn main() {}
| |____________^
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,10 +1,21 @@
error[E0391]: cycle detected when const-evaluating + checking `FOO` error[E0391]: cycle detected when normalizing `FOO`
|
note: ...which requires simplifying constant for the type system `FOO`...
--> $DIR/issue-17252.rs:1:1 --> $DIR/issue-17252.rs:1:1
| |
LL | const FOO: usize = FOO; LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `FOO`...
--> $DIR/issue-17252.rs:1:1
| |
= note: ...which immediately requires const-evaluating + checking `FOO` again LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `FOO`...
--> $DIR/issue-17252.rs:1:1
|
LL | const FOO: usize = FOO;
| ^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires normalizing `FOO`, completing the cycle
note: cycle used when const-evaluating + checking `main::{constant#0}` note: cycle used when const-evaluating + checking `main::{constant#0}`
--> $DIR/issue-17252.rs:4:18 --> $DIR/issue-17252.rs:4:18
| |

View file

@ -1,15 +1,26 @@
error[E0391]: cycle detected when const-evaluating + checking `X::A::{constant#0}` error[E0391]: cycle detected when simplifying constant for the type system `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9 --> $DIR/issue-23302-1.rs:4:9
| |
LL | A = X::A as isize, LL | A = X::A as isize,
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
= note: ...which immediately requires const-evaluating + checking `X::A::{constant#0}` again note: ...which requires simplifying constant for the type system `X::A::{constant#0}`...
note: cycle used when simplifying constant for the type system `X::A::{constant#0}`
--> $DIR/issue-23302-1.rs:4:9 --> $DIR/issue-23302-1.rs:4:9
| |
LL | A = X::A as isize, LL | A = X::A as isize,
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `X::A::{constant#0}`...
--> $DIR/issue-23302-1.rs:4:9
|
LL | A = X::A as isize,
| ^^^^^^^^^^^^^
= note: ...which requires normalizing `X::A as isize`...
= note: ...which again requires simplifying constant for the type system `X::A::{constant#0}`, completing the cycle
note: cycle used when collecting item types in top-level module
--> $DIR/issue-23302-1.rs:3:1
|
LL | enum X {
| ^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,15 +1,26 @@
error[E0391]: cycle detected when const-evaluating + checking `Y::A::{constant#0}` error[E0391]: cycle detected when simplifying constant for the type system `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9 --> $DIR/issue-23302-2.rs:4:9
| |
LL | A = Y::B as isize, LL | A = Y::B as isize,
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
| |
= note: ...which immediately requires const-evaluating + checking `Y::A::{constant#0}` again note: ...which requires simplifying constant for the type system `Y::A::{constant#0}`...
note: cycle used when simplifying constant for the type system `Y::A::{constant#0}`
--> $DIR/issue-23302-2.rs:4:9 --> $DIR/issue-23302-2.rs:4:9
| |
LL | A = Y::B as isize, LL | A = Y::B as isize,
| ^^^^^^^^^^^^^ | ^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `Y::A::{constant#0}`...
--> $DIR/issue-23302-2.rs:4:9
|
LL | A = Y::B as isize,
| ^^^^^^^^^^^^^
= note: ...which requires normalizing `Y::B as isize`...
= note: ...which again requires simplifying constant for the type system `Y::A::{constant#0}`, completing the cycle
note: cycle used when collecting item types in top-level module
--> $DIR/issue-23302-2.rs:3:1
|
LL | enum Y {
| ^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,20 +1,38 @@
error[E0391]: cycle detected when const-evaluating + checking `A` error[E0391]: cycle detected when simplifying constant for the type system `A`
--> $DIR/issue-23302-3.rs:1:1 --> $DIR/issue-23302-3.rs:1:1
| |
LL | const A: i32 = B; LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
| |
note: ...which requires simplifying constant for the type system `A`...
--> $DIR/issue-23302-3.rs:1:1
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `A`...
--> $DIR/issue-23302-3.rs:1:1
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^
= note: ...which requires normalizing `B`...
note: ...which requires simplifying constant for the type system `B`...
--> $DIR/issue-23302-3.rs:3:1
|
LL | const B: i32 = A;
| ^^^^^^^^^^^^^^^^^
note: ...which requires simplifying constant for the type system `B`...
--> $DIR/issue-23302-3.rs:3:1
|
LL | const B: i32 = A;
| ^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `B`... note: ...which requires const-evaluating + checking `B`...
--> $DIR/issue-23302-3.rs:3:1 --> $DIR/issue-23302-3.rs:3:1
| |
LL | const B: i32 = A; LL | const B: i32 = A;
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating + checking `A`, completing the cycle = note: ...which requires normalizing `A`...
note: cycle used when simplifying constant for the type system `A` = note: ...which again requires simplifying constant for the type system `A`, completing the cycle
--> $DIR/issue-23302-3.rs:1:1 = note: cycle used when running analysis passes on this crate
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error error: aborting due to previous error

View file

@ -5,7 +5,6 @@ enum Foo {
enum Bar { enum Bar {
A = Foo::A as isize A = Foo::A as isize
//~^ ERROR evaluation of constant value failed
} }
fn main() {} fn main() {}

View file

@ -6,13 +6,6 @@ LL | A = "" + 1
| | | |
| &str | &str
error[E0080]: evaluation of constant value failed error: aborting due to previous error
--> $DIR/issue-41394.rs:7:9
|
LL | A = Foo::A as isize
| ^^^^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0369`.
Some errors have detailed explanations: E0080, E0369.
For more information about an error, try `rustc --explain E0080`.

View file

@ -9,8 +9,6 @@ trait Tt {
} }
fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] { fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
//~^ ERROR evaluation of constant value failed
//~| ERROR evaluation of constant value failed
z z
} }

View file

@ -12,19 +12,7 @@ LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
| |
= note: cannot satisfy `_: Tt` = note: cannot satisfy `_: Tt`
error[E0080]: evaluation of constant value failed error: aborting due to 2 previous errors
--> $DIR/issue-54954.rs:11:15
|
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
| ^^^^^^^ referenced constant has errors
error[E0080]: evaluation of constant value failed Some errors have detailed explanations: E0283, E0379.
--> $DIR/issue-54954.rs:11:34 For more information about an error, try `rustc --explain E0283`.
|
LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
| ^^^^^^^ referenced constant has errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0080, E0283, E0379.
For more information about an error, try `rustc --explain E0080`.

View file

@ -19,5 +19,4 @@ impl TraitB for B { //~ ERROR not all trait items implemented, missing: `MyA`
fn main() { fn main() {
let _ = [0; B::VALUE]; let _ = [0; B::VALUE];
//~^ ERROR evaluation of constant value failed
} }

View file

@ -13,13 +13,7 @@ LL | type MyA: TraitA;
LL | impl TraitB for B { LL | impl TraitB for B {
| ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation | ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation
error[E0080]: evaluation of constant value failed error: aborting due to 2 previous errors
--> $DIR/issue-69602-type-err-during-codegen-ice.rs:21:17
|
LL | let _ = [0; B::VALUE];
| ^^^^^^^^ referenced constant has errors
error: aborting due to 3 previous errors Some errors have detailed explanations: E0046, E0437.
Some errors have detailed explanations: E0046, E0080, E0437.
For more information about an error, try `rustc --explain E0046`. For more information about an error, try `rustc --explain E0046`.

View file

@ -1,6 +1,5 @@
fn main() { fn main() {
[1; <Multiply<Five, Five>>::VAL]; [1; <Multiply<Five, Five>>::VAL];
//~^ ERROR evaluation of constant value failed
} }
trait TypeVal<T> { trait TypeVal<T> {
const VAL: T; const VAL: T;

View file

@ -1,5 +1,5 @@
error[E0412]: cannot find type `PhantomData` in this scope error[E0412]: cannot find type `PhantomData` in this scope
--> $DIR/issue-77919.rs:10:9 --> $DIR/issue-77919.rs:9:9
| |
LL | _n: PhantomData, LL | _n: PhantomData,
| ^^^^^^^^^^^ not found in this scope | ^^^^^^^^^^^ not found in this scope
@ -10,7 +10,7 @@ LL | use std::marker::PhantomData;
| |
error[E0412]: cannot find type `VAL` in this scope error[E0412]: cannot find type `VAL` in this scope
--> $DIR/issue-77919.rs:12:63 --> $DIR/issue-77919.rs:11:63
| |
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| - ^^^ not found in this scope | - ^^^ not found in this scope
@ -18,7 +18,7 @@ LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| help: you might be missing a type parameter: `, VAL` | help: you might be missing a type parameter: `, VAL`
error[E0046]: not all trait items implemented, missing: `VAL` error[E0046]: not all trait items implemented, missing: `VAL`
--> $DIR/issue-77919.rs:12:1 --> $DIR/issue-77919.rs:11:1
| |
LL | const VAL: T; LL | const VAL: T;
| ------------- `VAL` from trait | ------------- `VAL` from trait
@ -26,13 +26,7 @@ LL | const VAL: T;
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {} LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
error[E0080]: evaluation of constant value failed error: aborting due to 3 previous errors
--> $DIR/issue-77919.rs:2:9
|
LL | [1; <Multiply<Five, Five>>::VAL];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 4 previous errors Some errors have detailed explanations: E0046, E0412.
Some errors have detailed explanations: E0046, E0080, E0412.
For more information about an error, try `rustc --explain E0046`. For more information about an error, try `rustc --explain E0046`.

View file

@ -2,5 +2,4 @@ fn main() {
const N: u32 = 1_000; const N: u32 = 1_000;
const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize; //~ ERROR cannot find value
let mut digits = [0u32; M]; let mut digits = [0u32; M];
//~^ ERROR evaluation of constant value failed
} }

View file

@ -11,13 +11,6 @@ LL | use std::f32::consts::LOG10_2;
LL | use std::f64::consts::LOG10_2; LL | use std::f64::consts::LOG10_2;
| |
error[E0080]: evaluation of constant value failed error: aborting due to previous error
--> $DIR/issue-50599.rs:4:29
|
LL | let mut digits = [0u32; M];
| ^ referenced constant has errors
error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0425`.
Some errors have detailed explanations: E0080, E0425.
For more information about an error, try `rustc --explain E0080`.

View file

@ -2,5 +2,4 @@ fn main() {
let v = vec![0]; let v = vec![0];
const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant const l: usize = v.count(); //~ ERROR attempt to use a non-constant value in a constant
let s: [u32; l] = v.into_iter().collect(); let s: [u32; l] = v.into_iter().collect();
//~^ ERROR evaluation of constant value failed
} }

View file

@ -6,13 +6,6 @@ LL | const l: usize = v.count();
| | | |
| help: consider using `let` instead of `const`: `let l` | help: consider using `let` instead of `const`: `let l`
error[E0080]: evaluation of constant value failed error: aborting due to previous error
--> $DIR/type-dependent-def-issue-49241.rs:4:18
|
LL | let s: [u32; l] = v.into_iter().collect();
| ^ referenced constant has errors
error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0435`.
Some errors have detailed explanations: E0080, E0435.
For more information about an error, try `rustc --explain E0080`.