diff options
Diffstat (limited to 'tests/ui/const-generics')
20 files changed, 90 insertions, 61 deletions
diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr index 6fa9b591ad2..c71ec24dda3 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_dyn_compatibility.stderr @@ -11,8 +11,9 @@ note: for a trait to be dyn compatible it needs to allow building a vtable = note: the trait is not dyn compatible because it uses `Self` as a type parameter help: consider using an opaque type instead | -LL | fn foo(a: &impl ConstParamTy_) {} - | ~~~~ +LL - fn foo(a: &dyn ConstParamTy_) {} +LL + fn foo(a: &impl ConstParamTy_) {} + | error[E0038]: the trait `UnsizedConstParamTy` is not dyn compatible --> $DIR/const_param_ty_dyn_compatibility.rs:9:16 @@ -27,8 +28,9 @@ note: for a trait to be dyn compatible it needs to allow building a vtable = note: the trait is not dyn compatible because it uses `Self` as a type parameter help: consider using an opaque type instead | -LL | fn bar(a: &impl UnsizedConstParamTy) {} - | ~~~~ +LL - fn bar(a: &dyn UnsizedConstParamTy) {} +LL + fn bar(a: &impl UnsizedConstParamTy) {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/early/invalid-const-arguments.stderr b/tests/ui/const-generics/early/invalid-const-arguments.stderr index cee34e3b715..86b4d006454 100644 --- a/tests/ui/const-generics/early/invalid-const-arguments.stderr +++ b/tests/ui/const-generics/early/invalid-const-arguments.stderr @@ -9,8 +9,9 @@ LL | impl Foo for A<N> {} | help: a struct with a similar name exists | -LL | impl Foo for A<A> {} - | ~ +LL - impl Foo for A<N> {} +LL + impl Foo for A<A> {} + | help: you might be missing a type parameter | LL | impl<N> Foo for A<N> {} @@ -27,8 +28,9 @@ LL | impl<const N: u8> Foo for C<N, T> {} | help: a struct with a similar name exists | -LL | impl<const N: u8> Foo for C<N, A> {} - | ~ +LL - impl<const N: u8> Foo for C<N, T> {} +LL + impl<const N: u8> Foo for C<N, A> {} + | help: you might be missing a type parameter | LL | impl<const N: u8, T> Foo for C<N, T> {} diff --git a/tests/ui/const-generics/ensure_is_evaluatable.stderr b/tests/ui/const-generics/ensure_is_evaluatable.stderr index 62f8bc34f2e..397902846ec 100644 --- a/tests/ui/const-generics/ensure_is_evaluatable.stderr +++ b/tests/ui/const-generics/ensure_is_evaluatable.stderr @@ -14,8 +14,9 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL | [(); M + 1]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ +LL - [(); M + 1]:, +LL + [(); M + 1]:, [(); N + 1]: + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/fn_with_two_const_inputs.stderr b/tests/ui/const-generics/fn_with_two_const_inputs.stderr index c0a913a21fd..147a2c91fd0 100644 --- a/tests/ui/const-generics/fn_with_two_const_inputs.stderr +++ b/tests/ui/const-generics/fn_with_two_const_inputs.stderr @@ -14,8 +14,9 @@ LL | [(); N + 1]:, | ^^^^^ required by this bound in `bar` help: try adding a `where` bound | -LL | [(); both(N + 1, M + 1)]:, [(); N + 1]: - | ~~~~~~~~~~~~~~ +LL - [(); both(N + 1, M + 1)]:, +LL + [(); both(N + 1, M + 1)]:, [(); N + 1]: + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/forbid-non-structural_match-types.stderr b/tests/ui/const-generics/forbid-non-structural_match-types.stderr index 94afded9469..8ef629329f1 100644 --- a/tests/ui/const-generics/forbid-non-structural_match-types.stderr +++ b/tests/ui/const-generics/forbid-non-structural_match-types.stderr @@ -6,8 +6,8 @@ LL | struct D<const X: C>; | help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct | +LL - struct C; LL + #[derive(ConstParamTy, PartialEq, Eq)] -LL | struct C; | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr index 5999bc18204..12d84268f95 100644 --- a/tests/ui/const-generics/generic_arg_infer/in-signature.stderr +++ b/tests/ui/const-generics/generic_arg_infer/in-signature.stderr @@ -34,8 +34,9 @@ LL | const ARR_CT: [u8; _] = [0; 3]; | help: replace this with a fully-specified type | -LL | const ARR_CT: [u8; 3] = [0; 3]; - | ~~~~~~~ +LL - const ARR_CT: [u8; _] = [0; 3]; +LL + const ARR_CT: [u8; 3] = [0; 3]; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:24:25 @@ -45,8 +46,9 @@ LL | static ARR_STATIC: [u8; _] = [0; 3]; | help: replace this with a fully-specified type | -LL | static ARR_STATIC: [u8; 3] = [0; 3]; - | ~~~~~~~ +LL - static ARR_STATIC: [u8; _] = [0; 3]; +LL + static ARR_STATIC: [u8; 3] = [0; 3]; + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/in-signature.rs:26:23 @@ -56,8 +58,9 @@ LL | const TY_CT: Bar<i32, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | const TY_CT: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - const TY_CT: Bar<i32, _> = Bar::<i32, 3>(0); +LL + const TY_CT: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:28:28 @@ -67,8 +70,9 @@ LL | static TY_STATIC: Bar<i32, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | static TY_STATIC: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - static TY_STATIC: Bar<i32, _> = Bar::<i32, 3>(0); +LL + static TY_STATIC: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants --> $DIR/in-signature.rs:30:24 @@ -80,8 +84,9 @@ LL | const TY_CT_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | const TY_CT_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - const TY_CT_MIXED: Bar<_, _> = Bar::<i32, 3>(0); +LL + const TY_CT_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables --> $DIR/in-signature.rs:32:29 @@ -93,8 +98,9 @@ LL | static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0); | help: replace this with a fully-specified type | -LL | static TY_STATIC_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); - | ~~~~~~~~~~~ +LL - static TY_STATIC_MIXED: Bar<_, _> = Bar::<i32, 3>(0); +LL + static TY_STATIC_MIXED: Bar<i32, 3> = Bar::<i32, 3>(0); + | error[E0121]: the placeholder `_` is not allowed within types on item signatures for associated types --> $DIR/in-signature.rs:51:23 diff --git a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr index 3622ef16a96..9cb71ad8a09 100644 --- a/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/abstract-const-as-cast-3.stderr @@ -16,8 +16,9 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - EvaluatableU128<{N as u128}>:, { +LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:17:5 @@ -51,8 +52,9 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL | EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - EvaluatableU128<{N as u128}>:, { +LL + EvaluatableU128<{N as u128}>:, [(); { O as u128 } as usize]: { + | error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:20:5 @@ -114,8 +116,9 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - EvaluatableU128<{N as _}>:, { +LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:35:5 @@ -149,8 +152,9 @@ LL | fn assert_impl<T: Trait>() {} | ^^^^^ required by this bound in `assert_impl` help: try adding a `where` bound | -LL | EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - EvaluatableU128<{N as _}>:, { +LL + EvaluatableU128<{N as _}>:, [(); { O as u128 } as usize]: { + | error[E0308]: mismatched types --> $DIR/abstract-const-as-cast-3.rs:38:5 diff --git a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr index f3a38fcc005..b43ce5eca43 100644 --- a/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr +++ b/tests/ui/const-generics/generic_const_exprs/assoc_const_unification/doesnt_unify_evaluatable.stderr @@ -6,8 +6,9 @@ LL | bar::<{ T::ASSOC }>(); | help: try adding a `where` bound | -LL | fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { - | ~~~~~~~~~~~~~~~~~~~~~ +LL - fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, { +LL + fn foo<T: Trait, U: Trait>() where [(); U::ASSOC]:, [(); { T::ASSOC }]: { + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr index 4d1fb02b59e..86e35e17a07 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/issue_114151.stderr @@ -26,8 +26,9 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ +LL - [(); (L - 1) + 1 + L]:, +LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | error: unconstrained generic constant --> $DIR/issue_114151.rs:17:17 diff --git a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr index 99eab935a09..c63a79e64ed 100644 --- a/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const_kind_expr/wf_obligation.stderr @@ -15,8 +15,9 @@ LL | foo::<_, L>([(); L + 1 + L]); | help: try adding a `where` bound | -LL | [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: - | ~~~~~~~~~~~~~~~~~~ +LL - [(); (L - 1) + 1 + L]:, +LL + [(); (L - 1) + 1 + L]:, [(); L + 1 + L]: + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr index 80d711ca844..c63beeac367 100644 --- a/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr +++ b/tests/ui/const-generics/generic_const_exprs/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr @@ -9,8 +9,9 @@ LL | let f: F = async { 1 }; | help: a trait with a similar name exists | -LL | let f: Fn = async { 1 }; - | ~~ +LL - let f: F = async { 1 }; +LL + let f: Fn = async { 1 }; + | help: you might be missing a type parameter | LL | fn f<T, F>( @@ -28,8 +29,9 @@ LL | ) -> impl Iterator<Item = dyn SubAssign> { | +++ help: you might have meant to write a bound here | -LL | ) -> impl Iterator<Item: SubAssign> { - | ~ +LL - ) -> impl Iterator<Item = SubAssign> { +LL + ) -> impl Iterator<Item: SubAssign> { + | error[E0782]: expected a type, found a trait --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27 @@ -44,8 +46,9 @@ LL | ) -> impl Iterator<Item = dyn SubAssign> { | +++ help: you might have meant to write a bound here | -LL | ) -> impl Iterator<Item: SubAssign> { - | ~ +LL - ) -> impl Iterator<Item = SubAssign> { +LL + ) -> impl Iterator<Item: SubAssign> { + | error[E0277]: `()` is not an iterator --> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6 diff --git a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr index 4004ad19032..2b4c7f4bcff 100644 --- a/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr +++ b/tests/ui/const-generics/invalid-const-arg-for-type-param.stderr @@ -6,8 +6,9 @@ LL | let _: u32 = 5i32.try_into::<32>().unwrap(); | help: consider moving this generic argument to the `TryInto` trait, which takes up to 1 argument | -LL | let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); - | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LL - let _: u32 = 5i32.try_into::<32>().unwrap(); +LL + let _: u32 = TryInto::<32>::try_into(5i32).unwrap(); + | help: remove the unnecessary generics | LL - let _: u32 = 5i32.try_into::<32>().unwrap(); diff --git a/tests/ui/const-generics/issue-80471.stderr b/tests/ui/const-generics/issue-80471.stderr index a8514c5cc07..8cf3d68e5d6 100644 --- a/tests/ui/const-generics/issue-80471.stderr +++ b/tests/ui/const-generics/issue-80471.stderr @@ -6,8 +6,8 @@ LL | fn foo<const N: Nat>() {} | help: add `#[derive(ConstParamTy)]` to the struct | +LL - enum Nat { LL + #[derive(ConstParamTy)] -LL | enum Nat { | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/issues/issue-87493.stderr b/tests/ui/const-generics/issues/issue-87493.stderr index 73bd6ed73e6..42d32a0ee05 100644 --- a/tests/ui/const-generics/issues/issue-87493.stderr +++ b/tests/ui/const-generics/issues/issue-87493.stderr @@ -6,8 +6,9 @@ LL | T: MyTrait<Assoc == S::Assoc>, | help: if you meant to use an associated type binding, replace `==` with `=` | -LL | T: MyTrait<Assoc = S::Assoc>, - | ~ +LL - T: MyTrait<Assoc == S::Assoc>, +LL + T: MyTrait<Assoc = S::Assoc>, + | error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied --> $DIR/issue-87493.rs:8:8 diff --git a/tests/ui/const-generics/issues/issue-97278.stderr b/tests/ui/const-generics/issues/issue-97278.stderr index 47e6bf1df4d..4894ddb7b8d 100644 --- a/tests/ui/const-generics/issues/issue-97278.stderr +++ b/tests/ui/const-generics/issues/issue-97278.stderr @@ -6,8 +6,8 @@ LL | fn test<const BAR: Bar>() {} | help: add `#[derive(ConstParamTy)]` to the struct | +LL - enum Bar { LL + #[derive(ConstParamTy)] -LL | enum Bar { | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/legacy-const-generics-bad.stderr b/tests/ui/const-generics/legacy-const-generics-bad.stderr index e9ea22e472c..3a5fa417075 100644 --- a/tests/ui/const-generics/legacy-const-generics-bad.stderr +++ b/tests/ui/const-generics/legacy-const-generics-bad.stderr @@ -6,8 +6,9 @@ LL | legacy_const_generics::foo(0, a, 2); | help: consider using `const` instead of `let` | -LL | const a: /* Type */ = 1; - | ~~~~~ ++++++++++++ +LL - let a = 1; +LL + const a: /* Type */ = 1; + | error: generic parameters may not be used in const operations --> $DIR/legacy-const-generics-bad.rs:12:35 diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr index 78cddcc234c..d435af07db2 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013-no-kw.stderr @@ -16,8 +16,9 @@ LL | impl Foo<N = 3> for Bar { | help: to use `3` as a generic argument specify it directly | -LL | impl Foo<3> for Bar { - | ~ +LL - impl Foo<N = 3> for Bar { +LL + impl Foo<3> for Bar { + | error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr index 387eb226e70..f852c14b178 100644 --- a/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr +++ b/tests/ui/const-generics/parser-error-recovery/issue-89013.stderr @@ -28,8 +28,9 @@ LL | impl Foo<N = const 3> for Bar { | help: to use `3` as a generic argument specify it directly | -LL | impl Foo<3> for Bar { - | ~ +LL - impl Foo<N = const 3> for Bar { +LL + impl Foo<3> for Bar { + | error: aborting due to 3 previous errors diff --git a/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr b/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr index 4fce1aede95..95d20de1b43 100644 --- a/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr +++ b/tests/ui/const-generics/type-dependent/type-mismatch.full.stderr @@ -6,8 +6,9 @@ LL | assert_eq!(R.method::<1u16>(), 1); | help: change the type of the numeric literal from `u16` to `u8` | -LL | assert_eq!(R.method::<1u8>(), 1); - | ~~ +LL - assert_eq!(R.method::<1u16>(), 1); +LL + assert_eq!(R.method::<1u8>(), 1); + | error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr b/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr index 4fce1aede95..95d20de1b43 100644 --- a/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr +++ b/tests/ui/const-generics/type-dependent/type-mismatch.min.stderr @@ -6,8 +6,9 @@ LL | assert_eq!(R.method::<1u16>(), 1); | help: change the type of the numeric literal from `u16` to `u8` | -LL | assert_eq!(R.method::<1u8>(), 1); - | ~~ +LL - assert_eq!(R.method::<1u16>(), 1); +LL + assert_eq!(R.method::<1u8>(), 1); + | error: aborting due to 1 previous error |
