diff options
Diffstat (limited to '')
32 files changed, 148 insertions, 83 deletions
diff --git a/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr b/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr index c62f1d1d2..0ed370b83 100644 --- a/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr +++ b/src/test/ui/const-generics/const-generic-default-wont-borrowck.stderr @@ -5,6 +5,11 @@ LL | let s: &'static str; s.len() | - ^^^^^^^ `*s` used here but it isn't initialized | | | binding declared here but left uninitialized + | +help: consider assigning a value + | +LL | let s: &'static str = todo!(); s.len() + | +++++++++ error: aborting due to previous error diff --git a/src/test/ui/const-generics/const_trait_fn-issue-88433.rs b/src/test/ui/const-generics/const_trait_fn-issue-88433.rs index 8724fa698..6e04cfaec 100644 --- a/src/test/ui/const-generics/const_trait_fn-issue-88433.rs +++ b/src/test/ui/const-generics/const_trait_fn-issue-88433.rs @@ -2,6 +2,7 @@ #![feature(const_trait_impl)] +#[const_trait] trait Func<T> { type Output; diff --git a/src/test/ui/const-generics/generic_const_exprs/closures.stderr b/src/test/ui/const-generics/generic_const_exprs/closures.stderr index a15dd2016..a7d891d77 100644 --- a/src/test/ui/const-generics/generic_const_exprs/closures.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/closures.stderr @@ -1,4 +1,4 @@ -error[E0391]: cycle detected when building an abstract representation for test::{constant#0} +error[E0391]: cycle detected when building an abstract representation for `test::{constant#0}` --> $DIR/closures.rs:3:35 | LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {} @@ -14,7 +14,7 @@ note: ...which requires type-checking `test::{constant#0}`... | LL | fn test<const N: usize>() -> [u8; N + (|| 42)()] {} | ^^^^^^^^^^^^^ - = note: ...which again requires building an abstract representation for test::{constant#0}, completing the cycle + = note: ...which again requires building an abstract representation for `test::{constant#0}`, completing the cycle note: cycle used when checking that `test` is well-formed --> $DIR/closures.rs:3:1 | diff --git a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr index 4cd86fecd..d674e3acd 100644 --- a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.full.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/dependence_lint.rs:13:32 + --> $DIR/dependence_lint.rs:14:32 | LL | let _: [u8; size_of::<*mut T>()]; // error on stable, error with gce | ^ cannot perform const operation using `T` @@ -8,7 +8,7 @@ LL | let _: [u8; size_of::<*mut T>()]; // error on stable, error with gce = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/dependence_lint.rs:20:37 + --> $DIR/dependence_lint.rs:21:37 | LL | let _: [u8; if true { size_of::<T>() } else { 3 }]; // error on stable, error with gce | ^ cannot perform const operation using `T` @@ -17,17 +17,17 @@ LL | let _: [u8; if true { size_of::<T>() } else { 3 }]; // error on stable, = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions warning: cannot use constants which depend on generic parameters in types - --> $DIR/dependence_lint.rs:9:9 + --> $DIR/dependence_lint.rs:10:9 | LL | [0; size_of::<*mut T>()]; // lint on stable, error with `generic_const_exprs` | ^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(const_evaluatable_unchecked)]` 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 #76200 <https://github.com/rust-lang/rust/issues/76200> + = note: `#[warn(const_evaluatable_unchecked)]` on by default warning: cannot use constants which depend on generic parameters in types - --> $DIR/dependence_lint.rs:16:9 + --> $DIR/dependence_lint.rs:17:9 | LL | [0; if false { size_of::<T>() } else { 3 }]; // lint on stable, error with gce | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr index b13bcdb2c..74111ef1d 100644 --- a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.gce.stderr @@ -1,5 +1,5 @@ error: overly complex generic constant - --> $DIR/dependence_lint.rs:16:9 + --> $DIR/dependence_lint.rs:17:9 | LL | [0; if false { size_of::<T>() } else { 3 }]; // lint on stable, error with gce | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ control flow is not supported in generic constants @@ -7,7 +7,7 @@ LL | [0; if false { size_of::<T>() } else { 3 }]; // lint on stable, error w = help: consider moving this anonymous constant into a `const` function error: overly complex generic constant - --> $DIR/dependence_lint.rs:20:17 + --> $DIR/dependence_lint.rs:21:17 | LL | let _: [u8; if true { size_of::<T>() } else { 3 }]; // error on stable, error with gce | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ control flow is not supported in generic constants @@ -15,7 +15,7 @@ LL | let _: [u8; if true { size_of::<T>() } else { 3 }]; // error on stable, = help: consider moving this anonymous constant into a `const` function error: unconstrained generic constant - --> $DIR/dependence_lint.rs:13:12 + --> $DIR/dependence_lint.rs:14:12 | LL | let _: [u8; size_of::<*mut T>()]; // error on stable, error with gce | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | let _: [u8; size_of::<*mut T>()]; // error on stable, error with gce = help: try adding a `where` bound using this expression: `where [(); size_of::<*mut T>()]:` error: unconstrained generic constant - --> $DIR/dependence_lint.rs:9:9 + --> $DIR/dependence_lint.rs:10:9 | LL | [0; size_of::<*mut T>()]; // lint on stable, error with `generic_const_exprs` | ^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs index dcdfd75de..b715e07f8 100644 --- a/src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs +++ b/src/test/ui/const-generics/generic_const_exprs/dependence_lint.rs @@ -1,4 +1,5 @@ // revisions: full gce +// compile-flags: -Zdeduplicate-diagnostics=yes #![cfg_attr(gce, feature(generic_const_exprs))] #![allow(incomplete_features)] diff --git a/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr b/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr index b5719b3fe..8eb1fccc5 100644 --- a/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/eval-try-unify.stderr @@ -4,8 +4,8 @@ warning: the feature `generic_const_exprs` is incomplete and may not be safe to LL | #![feature(generic_const_exprs)] | ^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = note: `#[warn(incomplete_features)]` on by default warning: 1 warning emitted diff --git a/src/test/ui/const-generics/generic_const_exprs/function-call.rs b/src/test/ui/const-generics/generic_const_exprs/function-call.rs index b5de66621..3c866333d 100644 --- a/src/test/ui/const-generics/generic_const_exprs/function-call.rs +++ b/src/test/ui/const-generics/generic_const_exprs/function-call.rs @@ -1,4 +1,5 @@ // check-pass +// compile-flags: -Zdeduplicate-diagnostics=yes const fn foo<T>() -> usize { // We might instead branch on `std::mem::size_of::<*mut T>() < 8` here, diff --git a/src/test/ui/const-generics/generic_const_exprs/function-call.stderr b/src/test/ui/const-generics/generic_const_exprs/function-call.stderr index 0d8463714..84abfe578 100644 --- a/src/test/ui/const-generics/generic_const_exprs/function-call.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/function-call.stderr @@ -1,12 +1,12 @@ warning: cannot use constants which depend on generic parameters in types - --> $DIR/function-call.rs:14:17 + --> $DIR/function-call.rs:15:17 | LL | let _ = [0; foo::<T>()]; | ^^^^^^^^^^ | - = note: `#[warn(const_evaluatable_unchecked)]` 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 #76200 <https://github.com/rust-lang/rust/issues/76200> + = note: `#[warn(const_evaluatable_unchecked)]` on by default warning: 1 warning emitted diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102074.rs b/src/test/ui/const-generics/generic_const_exprs/issue-102074.rs new file mode 100644 index 000000000..66d15cf12 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-102074.rs @@ -0,0 +1,23 @@ +// check-pass +// Checks that the NoopMethodCall lint doesn't call Instance::resolve on unresolved consts + +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +#[derive(Debug, Clone)] +pub struct Aes128CipherKey([u8; Aes128Cipher::KEY_LEN]); + +impl Aes128CipherKey { + pub fn new(key: &[u8; Aes128Cipher::KEY_LEN]) -> Self { + Self(key.clone()) + } +} + +#[derive(Debug, Clone)] +pub struct Aes128Cipher; + +impl Aes128Cipher { + const KEY_LEN: usize = 16; +} + +fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs b/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs new file mode 100644 index 000000000..7aea0d30d --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-102768.rs @@ -0,0 +1,14 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +trait X { + type Y<'a>; +} + +const _: () = { + fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + //~^ ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + //~| ERROR this associated type takes 0 generic arguments but 1 generic argument +}; + +fn main() {} diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr new file mode 100644 index 000000000..9deb9b265 --- /dev/null +++ b/src/test/ui/const-generics/generic_const_exprs/issue-102768.stderr @@ -0,0 +1,33 @@ +error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/issue-102768.rs:9:30 + | +LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-102768.rs:5:10 + | +LL | type Y<'a>; + | ^ -- +help: add missing lifetime argument + | +LL | fn f2<'a>(arg: Box<dyn X<Y<'a, 1> = &'a ()>>) {} + | +++ + +error[E0107]: this associated type takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/issue-102768.rs:9:30 + | +LL | fn f2<'a>(arg: Box<dyn X<Y<1> = &'a ()>>) {} + | ^--- help: remove these generics + | | + | expected 0 generic arguments + | +note: associated type defined here, with 0 generic parameters + --> $DIR/issue-102768.rs:5:10 + | +LL | type Y<'a>; + | ^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0107`. diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr index b5b2b0e40..1cceaece7 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr @@ -4,8 +4,8 @@ warning: the feature `adt_const_params` is incomplete and may not be safe to use LL | #![feature(adt_const_params, generic_const_exprs)] | ^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + = note: `#[warn(incomplete_features)]` on by default warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/issue-97047-ice-1.rs:3:30 diff --git a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr index 5dfbd87cc..774e842bc 100644 --- a/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr @@ -4,8 +4,8 @@ warning: the feature `adt_const_params` is incomplete and may not be safe to use LL | #![feature(adt_const_params, generic_const_exprs)] | ^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + = note: `#[warn(incomplete_features)]` on by default warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/issue-97047-ice-2.rs:3:30 diff --git a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr b/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr index 45c7d835f..440cf457e 100644 --- a/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr +++ b/src/test/ui/const-generics/generic_const_exprs/object-safety-err-where-bounds.stderr @@ -4,11 +4,6 @@ error: the trait `Foo` cannot be made into an object LL | fn test(&self) where [u8; bar::<Self>()]: Sized; | ^^^^ | -note: the lint level is defined here - --> $DIR/object-safety-err-where-bounds.rs:3:9 - | -LL | #![deny(where_clauses_object_safety)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ = 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 #51443 <https://github.com/rust-lang/rust/issues/51443> note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> @@ -19,6 +14,11 @@ LL | trait Foo { LL | fn test(&self) where [u8; bar::<Self>()]: Sized; | ^^^^ ...because method `test` references the `Self` type in its `where` clause = help: consider moving `test` to another trait +note: the lint level is defined here + --> $DIR/object-safety-err-where-bounds.rs:3:9 + | +LL | #![deny(where_clauses_object_safety)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/const-generics/invariant.stderr b/src/test/ui/const-generics/invariant.stderr index ce0fad104..aabe4c93b 100644 --- a/src/test/ui/const-generics/invariant.stderr +++ b/src/test/ui/const-generics/invariant.stderr @@ -7,10 +7,10 @@ LL | impl SadBee for for<'a> fn(&'a ()) { LL | impl SadBee for fn(&'static ()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `for<'a> fn(&'a ())` | - = note: `#[warn(coherence_leak_check)]` 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 #56105 <https://github.com/rust-lang/rust/issues/56105> = note: this behavior recently changed as a result of a bug fix; see rust-lang/rust#56105 for details + = note: `#[warn(coherence_leak_check)]` on by default error[E0308]: mismatched types --> $DIR/invariant.rs:27:5 diff --git a/src/test/ui/const-generics/issue-102124.rs b/src/test/ui/const-generics/issue-102124.rs new file mode 100644 index 000000000..a28f198e9 --- /dev/null +++ b/src/test/ui/const-generics/issue-102124.rs @@ -0,0 +1,20 @@ +// run-pass +// compile-flags: -Zmir-opt-level=3 + +// regression test for #102124 + +const L: usize = 4; + +pub trait Print<const N: usize> { + fn print(&self) -> usize { + N + } +} + +pub struct Printer; +impl Print<L> for Printer {} + +fn main() { + let p = Printer; + assert_eq!(p.print(), 4); +} diff --git a/src/test/ui/const-generics/issue-103243.rs b/src/test/ui/const-generics/issue-103243.rs deleted file mode 100644 index 78c73522b..000000000 --- a/src/test/ui/const-generics/issue-103243.rs +++ /dev/null @@ -1,37 +0,0 @@ -// build-pass - -pub trait CSpace<const N: usize>: Sized { - type Traj; -} - -pub trait FullTrajectory<T, S1, const N: usize> {} - -pub struct Const<const R: usize>; - -pub trait Obstacle<CS, const N: usize> -where - CS: CSpace<N>, -{ - fn trajectory_free<FT, S1>(&self, t: &FT) - where - FT: FullTrajectory<CS::Traj, S1, N>; -} - -// ----- - -const N: usize = 4; - -struct ObstacleSpace2df32; - -impl<CS> Obstacle<CS, N> for ObstacleSpace2df32 -where - CS: CSpace<N>, -{ - fn trajectory_free<TF, S1>(&self, t: &TF) - where - TF: FullTrajectory<CS::Traj, S1, N>, - { - } -} - -fn main() {} diff --git a/src/test/ui/const-generics/issue-80471.stderr b/src/test/ui/const-generics/issue-80471.stderr index dbcc0b7b6..b89706710 100644 --- a/src/test/ui/const-generics/issue-80471.stderr +++ b/src/test/ui/const-generics/issue-80471.stderr @@ -4,8 +4,8 @@ warning: the feature `adt_const_params` is incomplete and may not be safe to use LL | #![feature(adt_const_params)] | ^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #95174 <https://github.com/rust-lang/rust/issues/95174> for more information + = note: `#[warn(incomplete_features)]` on by default error[E0741]: `Box<Nat>` must be annotated with `#[derive(PartialEq, Eq)]` to be used as the type of a const parameter --> $DIR/issue-80471.rs:10:17 diff --git a/src/test/ui/const-generics/issue-93647.rs b/src/test/ui/const-generics/issue-93647.rs index c1a6bf6e3..806540e17 100644 --- a/src/test/ui/const-generics/issue-93647.rs +++ b/src/test/ui/const-generics/issue-93647.rs @@ -1,6 +1,6 @@ struct X<const N: usize = { (||1usize)() - //~^ ERROR cannot call + //~^ ERROR cannot call non-const closure }>; fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-83466.stderr b/src/test/ui/const-generics/issues/issue-83466.stderr index a60f71ea6..bcfd70639 100644 --- a/src/test/ui/const-generics/issues/issue-83466.stderr +++ b/src/test/ui/const-generics/issues/issue-83466.stderr @@ -7,9 +7,9 @@ LL | fn func<'a, U>(self) -> U { LL | S.func::<'a, 10_u32>() | ^^ | - = note: `#[warn(late_bound_lifetime_arguments)]` 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 #42868 <https://github.com/rust-lang/rust/issues/42868> + = note: `#[warn(late_bound_lifetime_arguments)]` on by default error[E0747]: constant provided when a type was expected --> $DIR/issue-83466.rs:11:18 diff --git a/src/test/ui/const-generics/issues/issue-83765.stderr b/src/test/ui/const-generics/issues/issue-83765.stderr index d5f914f46..4becf3a36 100644 --- a/src/test/ui/const-generics/issues/issue-83765.stderr +++ b/src/test/ui/const-generics/issues/issue-83765.stderr @@ -1,16 +1,16 @@ -error[E0391]: cycle detected when resolving instance `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>::DIM` +error[E0391]: cycle detected when resolving instance `<LazyUpdim<'_, T, { T::DIM }, DIM> as TensorDimension>::DIM` --> $DIR/issue-83765.rs:5:5 | LL | const DIM: usize; | ^^^^^^^^^^^^^^^^ | -note: ...which requires computing candidate for `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>`... +note: ...which requires computing candidate for `<LazyUpdim<'_, T, { T::DIM }, DIM> as TensorDimension>`... --> $DIR/issue-83765.rs:4:1 | LL | trait TensorDimension { | ^^^^^^^^^^^^^^^^^^^^^ - = note: ...which again requires resolving instance `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>::DIM`, completing the cycle -note: cycle used when computing candidate for `<LazyUpdim<T, { T::DIM }, DIM> as TensorDimension>` + = note: ...which again requires resolving instance `<LazyUpdim<'_, T, { T::DIM }, DIM> as TensorDimension>::DIM`, completing the cycle +note: cycle used when computing candidate for `<LazyUpdim<'_, T, { T::DIM }, DIM> as TensorDimension>` --> $DIR/issue-83765.rs:4:1 | LL | trait TensorDimension { diff --git a/src/test/ui/const-generics/issues/issue-88119.rs b/src/test/ui/const-generics/issues/issue-88119.rs index 70dfa7f70..647b0eea8 100644 --- a/src/test/ui/const-generics/issues/issue-88119.rs +++ b/src/test/ui/const-generics/issues/issue-88119.rs @@ -3,6 +3,7 @@ #![allow(incomplete_features)] #![feature(const_trait_impl, generic_const_exprs)] +#[const_trait] trait ConstName { const NAME_BYTES: &'static [u8]; } diff --git a/src/test/ui/const-generics/issues/issue-98629.rs b/src/test/ui/const-generics/issues/issue-98629.rs index fc8666bbc..1d2d3012a 100644 --- a/src/test/ui/const-generics/issues/issue-98629.rs +++ b/src/test/ui/const-generics/issues/issue-98629.rs @@ -1,5 +1,6 @@ #![feature(const_trait_impl)] +#[const_trait] trait Trait { const N: usize; } diff --git a/src/test/ui/const-generics/issues/issue-98629.stderr b/src/test/ui/const-generics/issues/issue-98629.stderr index 535702208..4a248be76 100644 --- a/src/test/ui/const-generics/issues/issue-98629.stderr +++ b/src/test/ui/const-generics/issues/issue-98629.stderr @@ -1,5 +1,5 @@ error[E0046]: not all trait items implemented, missing: `N` - --> $DIR/issue-98629.rs:7:1 + --> $DIR/issue-98629.rs:8:1 | LL | const N: usize; | -------------- `N` from trait diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.rs b/src/test/ui/const-generics/min_const_generics/complex-expression.rs index 7840989cb..8e667aeba 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.rs +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.rs @@ -1,3 +1,4 @@ +// compile-flags: -Zdeduplicate-diagnostics=yes use std::mem::size_of; fn test<const N: usize>() {} diff --git a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr index bf0d0f352..deabd05a6 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-expression.stderr +++ b/src/test/ui/const-generics/min_const_generics/complex-expression.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:9:38 + --> $DIR/complex-expression.rs:10:38 | LL | struct Break0<const N: usize>([u8; { N + 1 }]); | ^ cannot perform const operation using `N` @@ -8,7 +8,7 @@ LL | struct Break0<const N: usize>([u8; { N + 1 }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:12:40 + --> $DIR/complex-expression.rs:13:40 | LL | struct Break1<const N: usize>([u8; { { N } }]); | ^ cannot perform const operation using `N` @@ -17,7 +17,7 @@ LL | struct Break1<const N: usize>([u8; { { N } }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:16:17 + --> $DIR/complex-expression.rs:17:17 | LL | let _: [u8; N + 1]; | ^ cannot perform const operation using `N` @@ -26,7 +26,7 @@ LL | let _: [u8; N + 1]; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:21:17 + --> $DIR/complex-expression.rs:22:17 | LL | let _ = [0; N + 1]; | ^ cannot perform const operation using `N` @@ -35,7 +35,7 @@ LL | let _ = [0; N + 1]; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:25:45 + --> $DIR/complex-expression.rs:26:45 | LL | struct BreakTy0<T>(T, [u8; { size_of::<*mut T>() }]); | ^ cannot perform const operation using `T` @@ -44,7 +44,7 @@ LL | struct BreakTy0<T>(T, [u8; { size_of::<*mut T>() }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:28:47 + --> $DIR/complex-expression.rs:29:47 | LL | struct BreakTy1<T>(T, [u8; { { size_of::<*mut T>() } }]); | ^ cannot perform const operation using `T` @@ -53,7 +53,7 @@ LL | struct BreakTy1<T>(T, [u8; { { size_of::<*mut T>() } }]); = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/complex-expression.rs:32:32 + --> $DIR/complex-expression.rs:33:32 | LL | let _: [u8; size_of::<*mut T>() + 1]; | ^ cannot perform const operation using `T` @@ -62,14 +62,14 @@ LL | let _: [u8; size_of::<*mut T>() + 1]; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions warning: cannot use constants which depend on generic parameters in types - --> $DIR/complex-expression.rs:37:17 + --> $DIR/complex-expression.rs:38:17 | LL | let _ = [0; size_of::<*mut T>() + 1]; | ^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(const_evaluatable_unchecked)]` 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 #76200 <https://github.com/rust-lang/rust/issues/76200> + = note: `#[warn(const_evaluatable_unchecked)]` on by default error: aborting due to 7 previous errors; 1 warning emitted diff --git a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs index 71d13ca61..e9d868093 100644 --- a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs +++ b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.rs @@ -1,4 +1,5 @@ // check-pass +// compile-flags: -Zdeduplicate-diagnostics=yes #![allow(dead_code)] fn foo<T>() { diff --git a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr index f9f6660f6..8003dfa40 100644 --- a/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr +++ b/src/test/ui/const-generics/min_const_generics/const-evaluatable-unchecked.stderr @@ -1,15 +1,15 @@ warning: cannot use constants which depend on generic parameters in types - --> $DIR/const-evaluatable-unchecked.rs:5:9 + --> $DIR/const-evaluatable-unchecked.rs:6:9 | LL | [0; std::mem::size_of::<*mut T>()]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(const_evaluatable_unchecked)]` 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 #76200 <https://github.com/rust-lang/rust/issues/76200> + = note: `#[warn(const_evaluatable_unchecked)]` on by default warning: cannot use constants which depend on generic parameters in types - --> $DIR/const-evaluatable-unchecked.rs:16:21 + --> $DIR/const-evaluatable-unchecked.rs:17:21 | LL | let _ = [0; Self::ASSOC]; | ^^^^^^^^^^^ @@ -18,7 +18,7 @@ LL | let _ = [0; Self::ASSOC]; = note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200> warning: cannot use constants which depend on generic parameters in types - --> $DIR/const-evaluatable-unchecked.rs:28:21 + --> $DIR/const-evaluatable-unchecked.rs:29:21 | LL | let _ = [0; Self::ASSOC]; | ^^^^^^^^^^^ diff --git a/src/test/ui/const-generics/occurs-check/unify-fixpoint.stderr b/src/test/ui/const-generics/occurs-check/unify-fixpoint.stderr index f9b56bd38..fe3f24a67 100644 --- a/src/test/ui/const-generics/occurs-check/unify-fixpoint.stderr +++ b/src/test/ui/const-generics/occurs-check/unify-fixpoint.stderr @@ -4,8 +4,8 @@ warning: the feature `generic_const_exprs` is incomplete and may not be safe to LL | #![feature(generic_const_exprs)] | ^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(incomplete_features)]` on by default = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information + = note: `#[warn(incomplete_features)]` on by default warning: 1 warning emitted diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-2.rs b/src/test/ui/const-generics/occurs-check/unused-substs-2.rs index 9a73f1a53..9b1212694 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-2.rs +++ b/src/test/ui/const-generics/occurs-check/unused-substs-2.rs @@ -1,7 +1,7 @@ #![feature(generic_const_exprs)] #![allow(incomplete_features)] -// The goal is is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst. +// The goal is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst. // // If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>` we introduced an // artificial inference cycle. diff --git a/src/test/ui/const-generics/occurs-check/unused-substs-3.rs b/src/test/ui/const-generics/occurs-check/unused-substs-3.rs index 0d38bd393..d5aeab47e 100644 --- a/src/test/ui/const-generics/occurs-check/unused-substs-3.rs +++ b/src/test/ui/const-generics/occurs-check/unused-substs-3.rs @@ -1,7 +1,7 @@ #![feature(generic_const_exprs)] #![allow(incomplete_features)] -// The goal is is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst. +// The goal is to get an unevaluated const `ct` with a `Ty::Infer(TyVar(_#1t)` subst. // // If we are then able to infer `ty::Infer(TyVar(_#1t) := Ty<ct>` we introduced an // artificial inference cycle. |