diff options
Diffstat (limited to 'tests/ui/consts')
25 files changed, 66 insertions, 25 deletions
diff --git a/tests/ui/consts/const-eval/issue-85155.stderr b/tests/ui/consts/const-eval/issue-85155.stderr index f7777bfac02..486d2adaf8c 100644 --- a/tests/ui/consts/const-eval/issue-85155.stderr +++ b/tests/ui/consts/const-eval/issue-85155.stderr @@ -12,7 +12,7 @@ LL | static_assert_imm1!(IMM1); | = note: this note originates in the macro `static_assert_imm1` (in Nightly builds, run with -Z macro-backtrace for more info) -note: the above error was encountered while instantiating `fn post_monomorphization_error::stdarch_intrinsic::<2>` +note: the above error was encountered while instantiating `fn stdarch_intrinsic::<2>` --> $DIR/issue-85155.rs:19:5 | LL | post_monomorphization_error::stdarch_intrinsic::<2>(); diff --git a/tests/ui/consts/const-pattern-rewrite-error-32086.rs b/tests/ui/consts/const-pattern-rewrite-error-32086.rs new file mode 100644 index 00000000000..d35dfe57687 --- /dev/null +++ b/tests/ui/consts/const-pattern-rewrite-error-32086.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/32086 +struct S(u8); +const C: S = S(10); + +fn main() { + let C(a) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C` + let C(..) = S(11); //~ ERROR expected tuple struct or tuple variant, found constant `C` +} diff --git a/tests/ui/consts/const-pattern-rewrite-error-32086.stderr b/tests/ui/consts/const-pattern-rewrite-error-32086.stderr new file mode 100644 index 00000000000..47616b06632 --- /dev/null +++ b/tests/ui/consts/const-pattern-rewrite-error-32086.stderr @@ -0,0 +1,21 @@ +error[E0532]: expected tuple struct or tuple variant, found constant `C` + --> $DIR/const-pattern-rewrite-error-32086.rs:6:9 + | +LL | struct S(u8); + | ------------- similarly named tuple struct `S` defined here +... +LL | let C(a) = S(11); + | ^ help: a tuple struct with a similar name exists: `S` + +error[E0532]: expected tuple struct or tuple variant, found constant `C` + --> $DIR/const-pattern-rewrite-error-32086.rs:7:9 + | +LL | struct S(u8); + | ------------- similarly named tuple struct `S` defined here +... +LL | let C(..) = S(11); + | ^ help: a tuple struct with a similar name exists: `S` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0532`. diff --git a/tests/ui/consts/const-typeid-of-rpass.rs b/tests/ui/consts/const-typeid-of-rpass.rs index 15ffdd1e83a..30f41070893 100644 --- a/tests/ui/consts/const-typeid-of-rpass.rs +++ b/tests/ui/consts/const-typeid-of-rpass.rs @@ -1,6 +1,4 @@ //@ run-pass -#![feature(const_type_id)] -#![feature(core_intrinsics)] use std::any::TypeId; diff --git a/tests/ui/consts/const_cmp_type_id.rs b/tests/ui/consts/const_cmp_type_id.rs index 8c21f7b1a5a..ff44876c5c4 100644 --- a/tests/ui/consts/const_cmp_type_id.rs +++ b/tests/ui/consts/const_cmp_type_id.rs @@ -1,6 +1,6 @@ //@ ignore-backends: gcc //@ compile-flags: -Znext-solver -#![feature(const_type_id, const_trait_impl, const_cmp)] +#![feature(const_trait_impl, const_cmp)] use std::any::TypeId; diff --git a/tests/ui/consts/const_transmute_type_id.rs b/tests/ui/consts/const_transmute_type_id.rs index a2d4cf37830..98783ad5b81 100644 --- a/tests/ui/consts/const_transmute_type_id.rs +++ b/tests/ui/consts/const_transmute_type_id.rs @@ -1,4 +1,4 @@ -#![feature(const_type_id, const_trait_impl, const_cmp)] +#![feature(const_trait_impl, const_cmp)] use std::any::TypeId; diff --git a/tests/ui/consts/const_transmute_type_id2.rs b/tests/ui/consts/const_transmute_type_id2.rs index 3ceb2b942b0..7e09947b768 100644 --- a/tests/ui/consts/const_transmute_type_id2.rs +++ b/tests/ui/consts/const_transmute_type_id2.rs @@ -1,6 +1,6 @@ //@ normalize-stderr: "0x(ff)+" -> "<u128::MAX>" -#![feature(const_type_id, const_trait_impl, const_cmp)] +#![feature( const_trait_impl, const_cmp)] use std::any::TypeId; diff --git a/tests/ui/consts/const_transmute_type_id3.rs b/tests/ui/consts/const_transmute_type_id3.rs index f1bb8cddf77..77c469d42f5 100644 --- a/tests/ui/consts/const_transmute_type_id3.rs +++ b/tests/ui/consts/const_transmute_type_id3.rs @@ -1,7 +1,7 @@ //! Test that all bytes of a TypeId must have the //! TypeId marker provenance. -#![feature(const_type_id, const_trait_impl, const_cmp)] +#![feature( const_trait_impl, const_cmp)] use std::any::TypeId; diff --git a/tests/ui/consts/const_transmute_type_id4.rs b/tests/ui/consts/const_transmute_type_id4.rs index 0ea75f2a2f4..bedd6084a16 100644 --- a/tests/ui/consts/const_transmute_type_id4.rs +++ b/tests/ui/consts/const_transmute_type_id4.rs @@ -1,4 +1,4 @@ -#![feature(const_type_id, const_trait_impl, const_cmp)] +#![feature(const_trait_impl, const_cmp)] use std::any::TypeId; diff --git a/tests/ui/consts/const_transmute_type_id5.rs b/tests/ui/consts/const_transmute_type_id5.rs index ae0429f8dbb..7f9a34104a3 100644 --- a/tests/ui/consts/const_transmute_type_id5.rs +++ b/tests/ui/consts/const_transmute_type_id5.rs @@ -1,7 +1,7 @@ //! Test that we require an equal TypeId to have an integer part that properly //! reflects the type id hash. -#![feature(const_type_id, const_trait_impl, const_cmp)] +#![feature(const_trait_impl, const_cmp)] use std::any::TypeId; diff --git a/tests/ui/consts/issue-102117.rs b/tests/ui/consts/issue-102117.rs index 6cb9832bcd8..b7955283a8d 100644 --- a/tests/ui/consts/issue-102117.rs +++ b/tests/ui/consts/issue-102117.rs @@ -1,5 +1,3 @@ -#![feature(const_type_id)] - use std::alloc::Layout; use std::any::TypeId; use std::mem::transmute; diff --git a/tests/ui/consts/issue-102117.stderr b/tests/ui/consts/issue-102117.stderr index da92db87f18..cea355d01d7 100644 --- a/tests/ui/consts/issue-102117.stderr +++ b/tests/ui/consts/issue-102117.stderr @@ -1,5 +1,5 @@ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/issue-102117.rs:19:26 + --> $DIR/issue-102117.rs:17:26 | LL | type_id: TypeId::of::<T>(), | ^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | pub fn new<T: 'static>() -> &'static Self { | +++++++++ error[E0310]: the parameter type `T` may not live long enough - --> $DIR/issue-102117.rs:19:26 + --> $DIR/issue-102117.rs:17:26 | LL | type_id: TypeId::of::<T>(), | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/issue-19244-1.stderr b/tests/ui/consts/issue-19244-1.stderr index 9c1336402e6..98a33817b4c 100644 --- a/tests/ui/consts/issue-19244-1.stderr +++ b/tests/ui/consts/issue-19244-1.stderr @@ -3,6 +3,8 @@ error[E0609]: no field `1` on type `(usize,)` | LL | let a: [isize; TUP.1]; | ^ unknown field + | + = note: available field is: `0` error: aborting due to 1 previous error diff --git a/tests/ui/consts/issue-73976-monomorphic.rs b/tests/ui/consts/issue-73976-monomorphic.rs index f43823fa155..6459150a660 100644 --- a/tests/ui/consts/issue-73976-monomorphic.rs +++ b/tests/ui/consts/issue-73976-monomorphic.rs @@ -6,7 +6,6 @@ // will be properly rejected. This test will ensure that monomorphic use of these // would not be wrongly rejected in patterns. -#![feature(const_type_id)] #![feature(const_type_name)] #![feature(const_trait_impl)] #![feature(const_cmp)] diff --git a/tests/ui/consts/issue-73976-polymorphic.rs b/tests/ui/consts/issue-73976-polymorphic.rs index 98b4005792d..db06706a970 100644 --- a/tests/ui/consts/issue-73976-polymorphic.rs +++ b/tests/ui/consts/issue-73976-polymorphic.rs @@ -5,7 +5,6 @@ // This test case should either run-pass or be rejected at compile time. // Currently we just disallow this usage and require pattern is monomorphic. -#![feature(const_type_id)] #![feature(const_type_name)] use std::any::{self, TypeId}; diff --git a/tests/ui/consts/issue-73976-polymorphic.stderr b/tests/ui/consts/issue-73976-polymorphic.stderr index ec9512a2616..41a5e804c67 100644 --- a/tests/ui/consts/issue-73976-polymorphic.stderr +++ b/tests/ui/consts/issue-73976-polymorphic.stderr @@ -1,5 +1,5 @@ error[E0158]: constant pattern cannot depend on generic parameters - --> $DIR/issue-73976-polymorphic.rs:20:37 + --> $DIR/issue-73976-polymorphic.rs:19:37 | LL | impl<T: 'static> GetTypeId<T> { | ----------------------------- @@ -12,7 +12,7 @@ LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE) | ^^^^^^^^^^^^^^^^^^^^^ `const` depends on a generic parameter error[E0158]: constant pattern cannot depend on generic parameters - --> $DIR/issue-73976-polymorphic.rs:31:42 + --> $DIR/issue-73976-polymorphic.rs:30:42 | LL | impl<T: 'static> GetTypeNameLen<T> { | ---------------------------------- diff --git a/tests/ui/consts/module-const-array-size-13763.rs b/tests/ui/consts/module-const-array-size-13763.rs new file mode 100644 index 00000000000..b1c6879ffd2 --- /dev/null +++ b/tests/ui/consts/module-const-array-size-13763.rs @@ -0,0 +1,16 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/13763 + +//@ run-pass +#![allow(dead_code)] + +mod u8 { + pub const BITS: usize = 8; +} + +const NUM: usize = u8::BITS; + +struct MyStruct { nums: [usize; 8] } + +fn main() { + let _s = MyStruct { nums: [0; NUM] }; +} diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr index 7c6219ccf93..38e169c9701 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn <Fail<i32> as std::ops::Drop>::drop` +note: the above error was encountered while instantiating `fn <Fail<i32> as Drop>::drop` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr index 7c6219ccf93..38e169c9701 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn <Fail<i32> as std::ops::Drop>::drop` +note: the above error was encountered while instantiating `fn <Fail<i32> as Drop>::drop` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr index a480a8c5a39..42a4ca2fd9d 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn m::not_called::<i32>` +note: the above error was encountered while instantiating `fn not_called::<i32>` --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr index a480a8c5a39..42a4ca2fd9d 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn m::not_called::<i32>` +note: the above error was encountered while instantiating `fn not_called::<i32>` --> $SRC_DIR/core/src/ops/function.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr index 6c8edc00260..9f652e26f24 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn <Fail<i32> as std::ops::Drop>::drop` +note: the above error was encountered while instantiating `fn <Fail<i32> as Drop>::drop` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr index 6c8edc00260..9f652e26f24 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn <Fail<i32> as std::ops::Drop>::drop` +note: the above error was encountered while instantiating `fn <Fail<i32> as Drop>::drop` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL error: aborting due to 1 previous error diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr index 4e35beadbf4..0c12c0de197 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn <std::vec::Vec<i32> as MyTrait>::not_called` +note: the above error was encountered while instantiating `fn <Vec<i32> as MyTrait>::not_called` --> $DIR/collect-in-dead-vtable.rs:31:40 | LL | let gen_vtable: &dyn MyTrait = &v; // vtable is "mentioned" here diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr index 4e35beadbf4..0c12c0de197 100644 --- a/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr +++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr @@ -10,7 +10,7 @@ note: erroneous constant encountered LL | let _ = Fail::<T>::C; | ^^^^^^^^^^^^ -note: the above error was encountered while instantiating `fn <std::vec::Vec<i32> as MyTrait>::not_called` +note: the above error was encountered while instantiating `fn <Vec<i32> as MyTrait>::not_called` --> $DIR/collect-in-dead-vtable.rs:31:40 | LL | let gen_vtable: &dyn MyTrait = &v; // vtable is "mentioned" here |
