1
Fork 0

Deduplicate all the ~~things~~ errors

This commit is contained in:
Oliver Schneider 2018-08-31 10:40:14 +02:00 committed by Oliver Scherer
parent d34232bcaf
commit 0f97048618
26 changed files with 133 additions and 199 deletions

View file

@ -23,6 +23,7 @@ use rustc::mir;
use rustc::ty::{self, Ty, TyCtxt, Instance, query::TyCtxtAt};
use rustc::ty::layout::{self, Size, LayoutOf, TyLayout};
use rustc::ty::subst::Subst;
use rustc::traits::Reveal;
use rustc::util::nodemap::FxHashSet;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc_data_structures::fx::FxHashMap;
@ -576,6 +577,16 @@ pub fn const_eval_provider<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> {
if key.param_env.reveal == Reveal::All {
let mut key = key.clone();
key.param_env.reveal = Reveal::UserFacing;
match tcx.const_eval(key) {
// try again with reveal all as requested
Err(ErrorHandled::TooGeneric) => {},
// dedupliate calls
other => return other,
}
}
tcx.const_eval_raw(key).and_then(|val| {
validate_const(tcx, val, key)
})
@ -585,6 +596,16 @@ pub fn const_eval_raw_provider<'a, 'tcx>(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> {
if key.param_env.reveal == Reveal::All {
let mut key = key.clone();
key.param_env.reveal = Reveal::UserFacing;
match tcx.const_eval_raw(key) {
// try again with reveal all as requested
Err(ErrorHandled::TooGeneric) => {},
// dedupliate calls
other => return other,
}
}
trace!("const eval: {:?}", key);
let cid = key.value;
let def_id = cid.instance.def.def_id();

View file

@ -12,7 +12,6 @@ const A: &'static [i32] = &[];
const B: i32 = (&A)[1];
//~^ index out of bounds: the len is 0 but the index is 1
//~| ERROR any use of this value will cause an error
//~| ERROR any use of this value will cause an error
fn main() {
let _ = B; //~ ERROR erroneous constant used

View file

@ -8,20 +8,12 @@ LL | const B: i32 = (&A)[1];
|
= note: #[deny(const_err)] on by default
error: any use of this value will cause an error
--> $DIR/array_const_index-0.rs:12:1
|
LL | const B: i32 = (&A)[1];
| ^^^^^^^^^^^^^^^-------^
| |
| index out of bounds: the len is 0 but the index is 1
error[E0080]: erroneous constant used
--> $DIR/array_const_index-0.rs:18:13
--> $DIR/array_const_index-0.rs:17:13
|
LL | let _ = B; //~ ERROR erroneous constant used
| ^ referenced constant has errors
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -12,7 +12,6 @@ const A: [i32; 0] = [];
const B: i32 = A[1];
//~^ index out of bounds: the len is 0 but the index is 1
//~| ERROR any use of this value will cause an error
//~| ERROR any use of this value will cause an error
fn main() {
let _ = B; //~ ERROR erroneous constant used

View file

@ -8,20 +8,12 @@ LL | const B: i32 = A[1];
|
= note: #[deny(const_err)] on by default
error: any use of this value will cause an error
--> $DIR/array_const_index-1.rs:12:1
|
LL | const B: i32 = A[1];
| ^^^^^^^^^^^^^^^----^
| |
| index out of bounds: the len is 0 but the index is 1
error[E0080]: erroneous constant used
--> $DIR/array_const_index-1.rs:18:13
--> $DIR/array_const_index-1.rs:17:13
|
LL | let _ = B; //~ ERROR erroneous constant used
| ^ referenced constant has errors
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -11,7 +11,6 @@
#![deny(const_err)]
pub const A: i8 = -std::i8::MIN; //~ ERROR const_err
//~^ ERROR const_err
pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err
pub const C: u8 = 200u8 * 4; //~ ERROR const_err
pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err

View file

@ -13,7 +13,7 @@ LL | #![deny(const_err)]
| ^^^^^^^^^
error: any use of this value will cause an error
--> $DIR/const-err-early.rs:15:1
--> $DIR/const-err-early.rs:14:1
|
LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err
| ^^^^^^^^^^^^^^^^^^-------------^
@ -21,7 +21,7 @@ LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err
| attempt to add with overflow
error: any use of this value will cause an error
--> $DIR/const-err-early.rs:16:1
--> $DIR/const-err-early.rs:15:1
|
LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err
| ^^^^^^^^^^^^^^^^^^---------^
@ -29,7 +29,7 @@ LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err
| attempt to multiply with overflow
error: any use of this value will cause an error
--> $DIR/const-err-early.rs:17:1
--> $DIR/const-err-early.rs:16:1
|
LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err
| ^^^^^^^^^^^^^^^^^^-----------------^
@ -37,57 +37,49 @@ LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err
| attempt to subtract with overflow
error: any use of this value will cause an error
--> $DIR/const-err-early.rs:18:1
--> $DIR/const-err-early.rs:17:1
|
LL | pub const E: u8 = [5u8][1]; //~ ERROR const_err
| ^^^^^^^^^^^^^^^^^^--------^
| |
| index out of bounds: the len is 1 but the index is 1
error: any use of this value will cause an error
--> $DIR/const-err-early.rs:13:1
|
LL | pub const A: i8 = -std::i8::MIN; //~ ERROR const_err
| ^^^^^^^^^^^^^^^^^^-------------^
| |
| attempt to negate with overflow
error[E0080]: erroneous constant used
--> $DIR/const-err-early.rs:21:14
--> $DIR/const-err-early.rs:20:14
|
LL | let _a = A; //~ ERROR erroneous constant used
| ^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-err-early.rs:22:14
--> $DIR/const-err-early.rs:21:14
|
LL | let _b = B; //~ ERROR erroneous constant used
| ^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-err-early.rs:23:14
--> $DIR/const-err-early.rs:22:14
|
LL | let _c = C; //~ ERROR erroneous constant used
| ^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-err-early.rs:24:14
--> $DIR/const-err-early.rs:23:14
|
LL | let _d = D; //~ ERROR erroneous constant used
| ^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-err-early.rs:25:14
--> $DIR/const-err-early.rs:24:14
|
LL | let _e = E; //~ ERROR erroneous constant used
| ^ referenced constant has errors
error: index out of bounds: the len is 1 but the index is 1
--> $DIR/const-err-early.rs:26:14
--> $DIR/const-err-early.rs:25:14
|
LL | let _e = [6u8][1]; //~ ERROR index out of bounds
| ^^^^^^^^
error: aborting due to 12 previous errors
error: aborting due to 11 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -12,7 +12,6 @@
pub const A: i8 = -std::i8::MIN;
//~^ ERROR const_err
//~| ERROR const_err
pub const B: i8 = A;
//~^ ERROR const_err
pub const C: u8 = A as u8;

View file

@ -13,7 +13,7 @@ LL | #![deny(const_err)]
| ^^^^^^^^^
error: any use of this value will cause an error
--> $DIR/const-err-multi.rs:16:1
--> $DIR/const-err-multi.rs:15:1
|
LL | pub const B: i8 = A;
| ^^^^^^^^^^^^^^^^^^-^
@ -21,7 +21,7 @@ LL | pub const B: i8 = A;
| referenced constant has errors
error: any use of this value will cause an error
--> $DIR/const-err-multi.rs:18:1
--> $DIR/const-err-multi.rs:17:1
|
LL | pub const C: u8 = A as u8;
| ^^^^^^^^^^^^^^^^^^-------^
@ -29,27 +29,19 @@ LL | pub const C: u8 = A as u8;
| referenced constant has errors
error: any use of this value will cause an error
--> $DIR/const-err-multi.rs:20:1
--> $DIR/const-err-multi.rs:19:1
|
LL | pub const D: i8 = 50 - A;
| ^^^^^^^^^^^^^^^^^^------^
| |
| referenced constant has errors
error: any use of this value will cause an error
--> $DIR/const-err-multi.rs:13:1
|
LL | pub const A: i8 = -std::i8::MIN;
| ^^^^^^^^^^^^^^^^^^-------------^
| |
| attempt to negate with overflow
error[E0080]: erroneous constant used
--> $DIR/const-err-multi.rs:24:13
--> $DIR/const-err-multi.rs:23:13
|
LL | let _ = (A, B, C, D);
| ^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 6 previous errors
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -19,7 +19,6 @@ fn black_box<T>(_: T) {
const FOO: u8 = [5u8][1];
//~^ WARN any use of this value will cause an error
//~| WARN any use of this value will cause an error
fn main() {
black_box((FOO, FOO));

View file

@ -12,16 +12,8 @@ note: lint level defined here
LL | #![warn(const_err)]
| ^^^^^^^^^
warning: any use of this value will cause an error
--> $DIR/const-err.rs:20:1
|
LL | const FOO: u8 = [5u8][1];
| ^^^^^^^^^^^^^^^^--------^
| |
| index out of bounds: the len is 1 but the index is 1
error[E0080]: erroneous constant used
--> $DIR/const-err.rs:25:15
--> $DIR/const-err.rs:24:15
|
LL | black_box((FOO, FOO));
| ^^^^^^^^^^ referenced constant has errors

View file

@ -22,7 +22,6 @@ use std::{i8, i16, i32, i64, isize};
use std::{u8, u16, u32, u64, usize};
const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
//~^ const_err
(
i8::MIN - 1,
);

View file

@ -2,7 +2,6 @@ error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:24:1
|
LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
LL | | //~^ const_err
LL | | (
LL | | i8::MIN - 1,
| | ----------- attempt to subtract with overflow
@ -16,7 +15,7 @@ LL | #![deny(const_err)]
| ^^^^^^^^^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:30:1
--> $DIR/const-eval-overflow2.rs:29:1
|
LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -26,7 +25,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:35:1
--> $DIR/const-eval-overflow2.rs:34:1
|
LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -36,7 +35,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:40:1
--> $DIR/const-eval-overflow2.rs:39:1
|
LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -46,7 +45,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:45:1
--> $DIR/const-eval-overflow2.rs:44:1
|
LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -56,7 +55,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:50:1
--> $DIR/const-eval-overflow2.rs:49:1
|
LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error
LL | | u16::MIN - 1,
@ -65,7 +64,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:54:1
--> $DIR/const-eval-overflow2.rs:53:1
|
LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error
LL | | u32::MIN - 1,
@ -74,7 +73,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:58:1
--> $DIR/const-eval-overflow2.rs:57:1
|
LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -83,65 +82,54 @@ LL | | u64::MIN - 1,
LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2.rs:24:1
|
LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
LL | | //~^ const_err
LL | | (
LL | | i8::MIN - 1,
| | ----------- attempt to subtract with overflow
LL | | );
| |_______^
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:64:5
--> $DIR/const-eval-overflow2.rs:63:5
|
LL | foo(VALS_I8); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:65:5
--> $DIR/const-eval-overflow2.rs:64:5
|
LL | foo(VALS_I16); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:66:5
--> $DIR/const-eval-overflow2.rs:65:5
|
LL | foo(VALS_I32); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:67:5
--> $DIR/const-eval-overflow2.rs:66:5
|
LL | foo(VALS_I64); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:69:5
--> $DIR/const-eval-overflow2.rs:68:5
|
LL | foo(VALS_U8); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:70:5
--> $DIR/const-eval-overflow2.rs:69:5
|
LL | foo(VALS_U16); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:71:5
--> $DIR/const-eval-overflow2.rs:70:5
|
LL | foo(VALS_U32); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2.rs:72:5
--> $DIR/const-eval-overflow2.rs:71:5
|
LL | foo(VALS_U64); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 17 previous errors
error: aborting due to 16 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -22,7 +22,6 @@ use std::{i8, i16, i32, i64, isize};
use std::{u8, u16, u32, u64, usize};
const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
//~^ const_err
(
i8::MAX + 1,
);

View file

@ -2,7 +2,6 @@ error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:24:1
|
LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
LL | | //~^ const_err
LL | | (
LL | | i8::MAX + 1,
| | ----------- attempt to add with overflow
@ -16,7 +15,7 @@ LL | #![deny(const_err)]
| ^^^^^^^^^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:30:1
--> $DIR/const-eval-overflow2b.rs:29:1
|
LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -26,7 +25,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:35:1
--> $DIR/const-eval-overflow2b.rs:34:1
|
LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -36,7 +35,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:40:1
--> $DIR/const-eval-overflow2b.rs:39:1
|
LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -46,7 +45,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:45:1
--> $DIR/const-eval-overflow2b.rs:44:1
|
LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -56,7 +55,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:50:1
--> $DIR/const-eval-overflow2b.rs:49:1
|
LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error
LL | | u16::MAX + 1,
@ -65,7 +64,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:54:1
--> $DIR/const-eval-overflow2b.rs:53:1
|
LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error
LL | | u32::MAX + 1,
@ -74,7 +73,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:58:1
--> $DIR/const-eval-overflow2b.rs:57:1
|
LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -83,65 +82,54 @@ LL | | u64::MAX + 1,
LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2b.rs:24:1
|
LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
LL | | //~^ const_err
LL | | (
LL | | i8::MAX + 1,
| | ----------- attempt to add with overflow
LL | | );
| |_______^
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:64:5
--> $DIR/const-eval-overflow2b.rs:63:5
|
LL | foo(VALS_I8); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:65:5
--> $DIR/const-eval-overflow2b.rs:64:5
|
LL | foo(VALS_I16); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:66:5
--> $DIR/const-eval-overflow2b.rs:65:5
|
LL | foo(VALS_I32); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:67:5
--> $DIR/const-eval-overflow2b.rs:66:5
|
LL | foo(VALS_I64); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:69:5
--> $DIR/const-eval-overflow2b.rs:68:5
|
LL | foo(VALS_U8); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:70:5
--> $DIR/const-eval-overflow2b.rs:69:5
|
LL | foo(VALS_U16); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:71:5
--> $DIR/const-eval-overflow2b.rs:70:5
|
LL | foo(VALS_U32); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2b.rs:72:5
--> $DIR/const-eval-overflow2b.rs:71:5
|
LL | foo(VALS_U64); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 17 previous errors
error: aborting due to 16 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -22,7 +22,6 @@ use std::{i8, i16, i32, i64, isize};
use std::{u8, u16, u32, u64, usize};
const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
//~^ const_err
(
i8::MIN * 2,
);

View file

@ -2,7 +2,6 @@ error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:24:1
|
LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
LL | | //~^ const_err
LL | | (
LL | | i8::MIN * 2,
| | ----------- attempt to multiply with overflow
@ -16,7 +15,7 @@ LL | #![deny(const_err)]
| ^^^^^^^^^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:30:1
--> $DIR/const-eval-overflow2c.rs:29:1
|
LL | / const VALS_I16: (i16,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -26,7 +25,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:35:1
--> $DIR/const-eval-overflow2c.rs:34:1
|
LL | / const VALS_I32: (i32,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -36,7 +35,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:40:1
--> $DIR/const-eval-overflow2c.rs:39:1
|
LL | / const VALS_I64: (i64,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -46,7 +45,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:45:1
--> $DIR/const-eval-overflow2c.rs:44:1
|
LL | / const VALS_U8: (u8,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -56,7 +55,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:50:1
--> $DIR/const-eval-overflow2c.rs:49:1
|
LL | / const VALS_U16: (u16,) = ( //~ ERROR any use of this value will cause an error
LL | | u16::MAX * 2,
@ -65,7 +64,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:54:1
--> $DIR/const-eval-overflow2c.rs:53:1
|
LL | / const VALS_U32: (u32,) = ( //~ ERROR any use of this value will cause an error
LL | | u32::MAX * 2,
@ -74,7 +73,7 @@ LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:58:1
--> $DIR/const-eval-overflow2c.rs:57:1
|
LL | / const VALS_U64: (u64,) = //~ ERROR any use of this value will cause an error
LL | | (
@ -83,65 +82,54 @@ LL | | u64::MAX * 2,
LL | | );
| |_______^
error: any use of this value will cause an error
--> $DIR/const-eval-overflow2c.rs:24:1
|
LL | / const VALS_I8: (i8,) = //~ ERROR any use of this value will cause an error
LL | | //~^ const_err
LL | | (
LL | | i8::MIN * 2,
| | ----------- attempt to multiply with overflow
LL | | );
| |_______^
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:64:5
--> $DIR/const-eval-overflow2c.rs:63:5
|
LL | foo(VALS_I8); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:65:5
--> $DIR/const-eval-overflow2c.rs:64:5
|
LL | foo(VALS_I16); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:66:5
--> $DIR/const-eval-overflow2c.rs:65:5
|
LL | foo(VALS_I32); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:67:5
--> $DIR/const-eval-overflow2c.rs:66:5
|
LL | foo(VALS_I64); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:69:5
--> $DIR/const-eval-overflow2c.rs:68:5
|
LL | foo(VALS_U8); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:70:5
--> $DIR/const-eval-overflow2c.rs:69:5
|
LL | foo(VALS_U16); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:71:5
--> $DIR/const-eval-overflow2c.rs:70:5
|
LL | foo(VALS_U32); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0080]: erroneous constant used
--> $DIR/const-eval-overflow2c.rs:72:5
--> $DIR/const-eval-overflow2c.rs:71:5
|
LL | foo(VALS_U64); //~ ERROR erroneous constant used
| ^^^^^^^^^^^^^ referenced constant has errors
error: aborting due to 17 previous errors
error: aborting due to 16 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -1,4 +1,4 @@
error[E0080]: this static likely exhibits undefined behavior
error[E0080]: it is undefined behavior to use this value
--> $DIR/transmute-const.rs:15:1
|
LL | static FOO: bool = unsafe { mem::transmute(3u8) };

View file

@ -35,7 +35,6 @@ const fn read_field2() -> Field2 {
const fn read_field3() -> Field3 {
const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR any use of this value
//~^ ERROR any use of this value
FIELD3
//~^ erroneous constant used
}

View file

@ -6,20 +6,14 @@ LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR any use of th
|
= note: #[deny(const_err)] on by default
error: any use of this value will cause an error
--> $DIR/union-const-eval-field.rs:37:5
|
LL | const FIELD3: Field3 = unsafe { UNION.field3 }; //~ ERROR any use of this value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
error[E0080]: erroneous constant used
--> $DIR/union-const-eval-field.rs:39:5
--> $DIR/union-const-eval-field.rs:38:5
|
LL | FIELD3
| ^^^^^^ referenced constant has errors
error[E0080]: evaluation of constant expression failed
--> $DIR/union-const-eval-field.rs:46:5
--> $DIR/union-const-eval-field.rs:45:5
|
LL | FIELD3
| ------ referenced constant has errors
@ -31,6 +25,6 @@ LL | assert_eq!(read_field3(), unsafe { UNION.field3 });
|
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
error: aborting due to 4 previous errors
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -1,22 +1,27 @@
error[E0391]: cycle detected when computing layout of `Foo`
error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
--> $DIR/const-size_of-cycle.rs:16:17
|
LL | bytes: [u8; std::mem::size_of::<Foo>()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
--> $SRC_DIR/libcore/mem.rs:LL:COL
|
LL | unsafe { intrinsics::size_of::<T>() }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires computing layout of `Foo`...
note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
--> $DIR/const-size_of-cycle.rs:16:17
|
LL | bytes: [u8; std::mem::size_of::<Foo>()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
--> $SRC_DIR/libcore/mem.rs:LL:COL
= note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
note: cycle used when processing `Foo`
--> $DIR/const-size_of-cycle.rs:15:1
|
LL | intrinsics::size_of::<T>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing layout of `Foo`, completing the cycle
note: cycle used when const-evaluating `Foo::bytes::{{constant}}`
--> $SRC_DIR/libcore/mem.rs:LL:COL
|
LL | intrinsics::size_of::<T>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | struct Foo {
| ^^^^^^^^^^
error: aborting due to previous error

View file

@ -14,7 +14,6 @@ const FOO: &'static[u32] = &[1, 2, 3];
const BAR: u32 = FOO[5];
//~^ index out of bounds: the len is 3 but the index is 5
//~| ERROR any use of this value will cause an error
//~| ERROR any use of this value will cause an error
fn main() {
let _ = BAR;

View file

@ -8,20 +8,12 @@ LL | const BAR: u32 = FOO[5];
|
= note: #[deny(const_err)] on by default
error: any use of this value will cause an error
--> $DIR/const-slice-oob.rs:14:1
|
LL | const BAR: u32 = FOO[5];
| ^^^^^^^^^^^^^^^^^------^
| |
| index out of bounds: the len is 3 but the index is 5
error[E0080]: erroneous constant used
--> $DIR/const-slice-oob.rs:20:13
--> $DIR/const-slice-oob.rs:19:13
|
LL | let _ = BAR;
| ^^^ referenced constant has errors
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.

View file

@ -8,15 +8,13 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//~^^^^^^^^^^ ERROR cycle detected when computing layout of
#![feature(core_intrinsics)]
use std::intrinsics;
struct Foo {
bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
//~^ ERROR cycle detected when const-evaluating + checking
x: usize,
}

View file

@ -1,22 +1,27 @@
error[E0391]: cycle detected when computing layout of `Foo`
|
note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
--> $DIR/issue-44415.rs:19:17
error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}`
--> $DIR/issue-44415.rs:17:17
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
| ^^^^^^
|
note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
--> $DIR/issue-44415.rs:19:26
--> $DIR/issue-44415.rs:17:26
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing layout of `Foo`, completing the cycle
note: cycle used when const-evaluating `Foo::bytes::{{constant}}`
--> $DIR/issue-44415.rs:19:26
note: ...which requires computing layout of `Foo`...
note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}`...
--> $DIR/issue-44415.rs:17:17
|
LL | bytes: [u8; unsafe { intrinsics::size_of::<Foo>() }],
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^
= note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}`, completing the cycle
note: cycle used when processing `Foo`
--> $DIR/issue-44415.rs:16:1
|
LL | struct Foo {
| ^^^^^^^^^^
error: aborting due to previous error

View file

@ -4,6 +4,11 @@ error[E0391]: cycle detected when const-evaluating `FOO`
LL | pub static FOO: u32 = FOO;
| ^^^
|
note: ...which requires const-evaluating `FOO`...
--> $DIR/recursive-static-definition.rs:11:1
|
LL | pub static FOO: u32 = FOO;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating `FOO`, completing the cycle
note: cycle used when const-evaluating + checking `FOO`
--> $DIR/recursive-static-definition.rs:11:1