diff options
| author | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-05-15 16:14:37 +0200 |
|---|---|---|
| committer | Bastian Kauschke <bastian_kauschke@hotmail.de> | 2020-05-17 11:06:35 +0200 |
| commit | 443ae838742350a93326ede1f4ad7429238da644 (patch) | |
| tree | bea83b1ba3e29bc9671f1117a3e96b23140a0c50 | |
| parent | 479968b81259ee7bfd3897cb192ff61b59fb8a8f (diff) | |
| download | rust-443ae838742350a93326ede1f4ad7429238da644.tar.gz rust-443ae838742350a93326ede1f4ad7429238da644.zip | |
merge lazy_normalization_consts into const_generics
33 files changed, 70 insertions, 198 deletions
diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs index 894b392f1c0..a1dd7a5ca52 100644 --- a/src/librustc_feature/active.rs +++ b/src/librustc_feature/active.rs @@ -559,9 +559,6 @@ declare_features! ( /// Allow negative trait implementations. (active, negative_impls, "1.44.0", Some(68318), None), - /// Lazily evaluate constants. Which allows constants to depend on type parameters. - (active, lazy_normalization_consts, "1.44.0", Some(60471), None), - /// Allows the use of `#[target_feature]` on safe functions. (active, target_feature_11, "1.45.0", Some(69098), None), @@ -584,5 +581,4 @@ pub const INCOMPLETE_FEATURES: &[Symbol] = &[ sym::raw_dylib, sym::const_trait_impl, sym::const_trait_bound_opt_out, - sym::lazy_normalization_consts, ]; diff --git a/src/librustc_infer/infer/combine.rs b/src/librustc_infer/infer/combine.rs index 415e3262c50..1d3ddd7e2de 100644 --- a/src/librustc_infer/infer/combine.rs +++ b/src/librustc_infer/infer/combine.rs @@ -164,15 +164,11 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> { (_, ty::ConstKind::Infer(InferConst::Var(vid))) => { return self.unify_const_variable(!a_is_expected, vid, a); } - (ty::ConstKind::Unevaluated(..), _) - if self.tcx.features().lazy_normalization_consts => - { + (ty::ConstKind::Unevaluated(..), _) if self.tcx.features().const_generics => { relation.const_equate_obligation(a, b); return Ok(b); } - (_, ty::ConstKind::Unevaluated(..)) - if self.tcx.features().lazy_normalization_consts => - { + (_, ty::ConstKind::Unevaluated(..)) if self.tcx.features().const_generics => { relation.const_equate_obligation(a, b); return Ok(a); } @@ -662,9 +658,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> { } } } - ty::ConstKind::Unevaluated(..) if self.tcx().features().lazy_normalization_consts => { - Ok(c) - } + ty::ConstKind::Unevaluated(..) if self.tcx().features().const_generics => Ok(c), _ => relate::super_relate_consts(self, c, c), } } diff --git a/src/librustc_infer/infer/nll_relate/mod.rs b/src/librustc_infer/infer/nll_relate/mod.rs index e67ea56cf89..e5687db4ff1 100644 --- a/src/librustc_infer/infer/nll_relate/mod.rs +++ b/src/librustc_infer/infer/nll_relate/mod.rs @@ -988,9 +988,7 @@ where } } } - ty::ConstKind::Unevaluated(..) if self.tcx().features().lazy_normalization_consts => { - Ok(a) - } + ty::ConstKind::Unevaluated(..) if self.tcx().features().const_generics => Ok(a), _ => relate::super_relate_consts(self, a, a), } } diff --git a/src/librustc_middle/ty/relate.rs b/src/librustc_middle/ty/relate.rs index 914b6d1d29e..621a4efc6cc 100644 --- a/src/librustc_middle/ty/relate.rs +++ b/src/librustc_middle/ty/relate.rs @@ -432,8 +432,8 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>( match relation.relate(&sz_a, &sz_b) { Ok(sz) => Ok(tcx.mk_ty(ty::Array(t, sz))), // FIXME(lazy_normalization_consts) Implement improved diagnostics for mismatched array - // length? - Err(err) if relation.tcx().features().lazy_normalization_consts => Err(err), + // length? + Err(err) if relation.tcx().features().const_generics => Err(err), Err(err) => { // Check whether the lengths are both concrete/known values, // but are unequal, for better diagnostics. diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index e4318c65050..a61647bfd65 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -411,7 +411,6 @@ symbols! { label_break_value, lang, lang_items, - lazy_normalization_consts, let_chains, lhs, lib, diff --git a/src/librustc_trait_selection/traits/project.rs b/src/librustc_trait_selection/traits/project.rs index 676cb68f60e..983e11622f9 100644 --- a/src/librustc_trait_selection/traits/project.rs +++ b/src/librustc_trait_selection/traits/project.rs @@ -388,7 +388,7 @@ impl<'a, 'b, 'tcx> TypeFolder<'tcx> for AssocTypeNormalizer<'a, 'b, 'tcx> { } fn fold_const(&mut self, constant: &'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx> { - if self.selcx.tcx().features().lazy_normalization_consts { + if self.selcx.tcx().features().const_generics { constant } else { let constant = constant.super_fold_with(self); diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index d16990cb44c..80740651230 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1173,7 +1173,7 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::Generics { // HACK(eddyb) this provides the correct generics when // `feature(const_generics)` is enabled, so that const expressions // used with const generics, e.g. `Foo<{N+1}>`, can work at all. - if tcx.features().const_generics || tcx.features().lazy_normalization_consts { + if tcx.features().const_generics { Some(parent_def_id.to_def_id()) } else { let parent_node = tcx.hir().get(tcx.hir().get_parent_node(hir_id)); diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs index 9e32687787b..c28875f1752 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.rs +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.rs @@ -1,6 +1,11 @@ +<<<<<<< HEAD //~^ WARN the feature `const_generics` is incomplete #![feature(lazy_normalization_consts)] //~^ WARN the feature `lazy_normalization_consts` is incomplete +======= +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash +>>>>>>> merge lazy_normalization_consts into const_generics #[allow(dead_code)] struct ArithArrayLen<const N: usize>([u32; 0 + N]); diff --git a/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr b/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr index 2ebd063af18..14cf64eeb7a 100644 --- a/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr +++ b/src/test/ui/const-generics/array-size-in-generic-struct-param.stderr @@ -7,14 +7,8 @@ LL | #![feature(const_generics)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information -warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash - --> $DIR/array-size-in-generic-struct-param.rs:3:12 - | -LL | #![feature(lazy_normalization_consts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - error: constant expression depends on a generic parameter - --> $DIR/array-size-in-generic-struct-param.rs:7:38 + --> $DIR/array-size-in-generic-struct-param.rs:5:38 | LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]); | ^^^^^^^^^^^^ @@ -22,12 +16,12 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]); = note: this may fail depending on what value the parameter takes error: constant expression depends on a generic parameter - --> $DIR/array-size-in-generic-struct-param.rs:16:5 + --> $DIR/array-size-in-generic-struct-param.rs:14:5 | LL | arr: [u8; CFG.arr_size], | ^^^^^^^^^^^^^^^^^^^^^^^ | = note: this may fail depending on what value the parameter takes -error: aborting due to 2 previous errors; 2 warnings emitted +error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/const-generics/different_byref.stderr b/src/test/ui/const-generics/different_byref.stderr index 001d9852a69..7eb826b8a36 100644 --- a/src/test/ui/const-generics/different_byref.stderr +++ b/src/test/ui/const-generics/different_byref.stderr @@ -13,8 +13,8 @@ error[E0308]: mismatched types LL | x = Const::<{ [4] }> {}; | ^^^^^^^^^^^^^^^^^^^ expected `3usize`, found `4usize` | - = note: expected struct `Const<[3usize]>` - found struct `Const<[4usize]>` + = note: expected type `[3usize]` + found type `[4usize]` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/const-generics/fn-const-param-infer.stderr b/src/test/ui/const-generics/fn-const-param-infer.stderr index 3e07393b9aa..de41d2984a6 100644 --- a/src/test/ui/const-generics/fn-const-param-infer.stderr +++ b/src/test/ui/const-generics/fn-const-param-infer.stderr @@ -11,12 +11,10 @@ error[E0308]: mismatched types --> $DIR/fn-const-param-infer.rs:16:31 | LL | let _: Checked<not_one> = Checked::<not_two>; - | ---------------- ^^^^^^^^^^^^^^^^^^ expected `{not_one as fn(usize) -> bool}`, found `{not_two as fn(usize) -> bool}` - | | - | expected due to this + | ^^^^^^^^^^^^^^^^^^ expected `{not_one as fn(usize) -> bool}`, found `{not_two as fn(usize) -> bool}` | - = note: expected struct `Checked<{not_one as fn(usize) -> bool}>` - found struct `Checked<{not_two as fn(usize) -> bool}>` + = note: expected type `{not_one as fn(usize) -> bool}` + found type `{not_two as fn(usize) -> bool}` error[E0308]: mismatched types --> $DIR/fn-const-param-infer.rs:20:24 @@ -37,12 +35,10 @@ error[E0308]: mismatched types --> $DIR/fn-const-param-infer.rs:25:40 | LL | let _: Checked<{generic::<u32>}> = Checked::<{generic::<u16>}>; - | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{generic::<u32> as fn(usize) -> bool}`, found `{generic::<u16> as fn(usize) -> bool}` - | | - | expected due to this + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{generic::<u32> as fn(usize) -> bool}`, found `{generic::<u16> as fn(usize) -> bool}` | - = note: expected struct `Checked<{generic::<u32> as fn(usize) -> bool}>` - found struct `Checked<{generic::<u16> as fn(usize) -> bool}>` + = note: expected type `{generic::<u32> as fn(usize) -> bool}` + found type `{generic::<u16> as fn(usize) -> bool}` error: aborting due to 4 previous errors; 1 warning emitted diff --git a/src/test/ui/const-generics/issues/issue-61336-1.rs b/src/test/ui/const-generics/issues/issue-61336-1.rs index 915781bc0fc..ee92e1019dd 100644 --- a/src/test/ui/const-generics/issues/issue-61336-1.rs +++ b/src/test/ui/const-generics/issues/issue-61336-1.rs @@ -1,6 +1,7 @@ -//~^ WARN the feature `const_generics` is incomplete #![feature(lazy_normalization_consts)] //~^ WARN the feature `lazy_normalization_consts` is incomplete +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete // build-pass diff --git a/src/test/ui/const-generics/issues/issue-61336-1.stderr b/src/test/ui/const-generics/issues/issue-61336-1.stderr new file mode 100644 index 00000000000..34920d8907f --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-61336-1.stderr @@ -0,0 +1,10 @@ +warning: the feature `const_generics` is incomplete and may cause the compiler to crash + --> $DIR/issue-61336-1.rs:1:12 + | +LL | #![feature(const_generics)] + | ^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + diff --git a/src/test/ui/const-generics/issues/issue-61336-2.rs b/src/test/ui/const-generics/issues/issue-61336-2.rs index 934831f91ad..76ba795b51c 100644 --- a/src/test/ui/const-generics/issues/issue-61336-2.rs +++ b/src/test/ui/const-generics/issues/issue-61336-2.rs @@ -1,6 +1,7 @@ -//~^ WARN the feature `const_generics` is incomplete #![feature(lazy_normalization_consts)] //~^ WARN the feature `lazy_normalization_consts` is incomplete +#![feature(const_generics)] +//~^ WARN the feature `const_generics` is incomplete fn f<T: Copy, const N: usize>(x: T) -> [T; N] { [x; { N }] diff --git a/src/test/ui/const-generics/issues/issue-61336-2.stderr b/src/test/ui/const-generics/issues/issue-61336-2.stderr index c779ac10671..5f3395223f9 100644 --- a/src/test/ui/const-generics/issues/issue-61336-2.stderr +++ b/src/test/ui/const-generics/issues/issue-61336-2.stderr @@ -7,14 +7,8 @@ LL | #![feature(const_generics)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information -warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash - --> $DIR/issue-61336-2.rs:3:12 - | -LL | #![feature(lazy_normalization_consts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/issue-61336-2.rs:11:5 + --> $DIR/issue-61336-2.rs:9:5 | LL | [x; { N }] | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T` @@ -25,6 +19,6 @@ help: consider restricting type parameter `T` LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] { | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error; 2 warnings emitted +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/issues/issue-61336.stderr b/src/test/ui/const-generics/issues/issue-61336.stderr index 7d7cec2c179..0eee37df3dd 100644 --- a/src/test/ui/const-generics/issues/issue-61336.stderr +++ b/src/test/ui/const-generics/issues/issue-61336.stderr @@ -7,14 +7,8 @@ LL | #![feature(const_generics)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information -warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash - --> $DIR/issue-61336.rs:3:12 - | -LL | #![feature(lazy_normalization_consts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied - --> $DIR/issue-61336.rs:11:5 + --> $DIR/issue-61336.rs:9:5 | LL | [x; N] | ^^^^^^ the trait `std::marker::Copy` is not implemented for `T` @@ -25,6 +19,6 @@ help: consider restricting type parameter `T` LL | fn g<T: std::marker::Copy, const N: usize>(x: T) -> [T; N] { | ^^^^^^^^^^^^^^^^^^^ -error: aborting due to previous error; 2 warnings emitted +error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/issues/issue-61747.stderr b/src/test/ui/const-generics/issues/issue-61747.stderr index 5eb468cc272..2e405370dc0 100644 --- a/src/test/ui/const-generics/issues/issue-61747.stderr +++ b/src/test/ui/const-generics/issues/issue-61747.stderr @@ -7,11 +7,5 @@ LL | #![feature(const_generics)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information -warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash - --> $DIR/issue-61747.rs:5:12 - | -LL | #![feature(lazy_normalization_consts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted +warning: 1 warning emitted diff --git a/src/test/ui/const-generics/issues/issue-61935.rs b/src/test/ui/const-generics/issues/issue-61935.rs index 445862cccdd..35fb435b812 100644 --- a/src/test/ui/const-generics/issues/issue-61935.rs +++ b/src/test/ui/const-generics/issues/issue-61935.rs @@ -2,8 +2,6 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -#![feature(lazy_normalization_consts)] -//~^ WARN the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash trait Foo {} diff --git a/src/test/ui/const-generics/issues/issue-61935.stderr b/src/test/ui/const-generics/issues/issue-61935.stderr index ec0db0401b4..a8d9bf6a456 100644 --- a/src/test/ui/const-generics/issues/issue-61935.stderr +++ b/src/test/ui/const-generics/issues/issue-61935.stderr @@ -6,11 +6,5 @@ LL | #![feature(const_generics)] = note: `#[warn(incomplete_features)]` on by default = note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information -warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash - --> $DIR/issue-61935.rs:5:12 - | -LL | #![feature(lazy_normalization_consts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted +warning: 1 warning emitted diff --git a/src/test/ui/const-generics/issues/issue-62504.rs b/src/test/ui/const-generics/issues/issue-62504.rs index 264e693a008..4e05aadd393 100644 --- a/src/test/ui/const-generics/issues/issue-62504.rs +++ b/src/test/ui/const-generics/issues/issue-62504.rs @@ -16,8 +16,7 @@ struct ArrayHolder<const X: usize>([u32; X]); impl<const X: usize> ArrayHolder<X> { pub const fn new() -> Self { ArrayHolder([0; Self::SIZE]) - //~^ ERROR: mismatched types - //~| ERROR constant expression depends on a generic parameter + //~^ ERROR constant expression depends on a generic parameter } } diff --git a/src/test/ui/const-generics/issues/issue-62504.stderr b/src/test/ui/const-generics/issues/issue-62504.stderr index 5d45e302888..f09af76325e 100644 --- a/src/test/ui/const-generics/issues/issue-62504.stderr +++ b/src/test/ui/const-generics/issues/issue-62504.stderr @@ -1,12 +1,3 @@ -error[E0308]: mismatched types - --> $DIR/issue-62504.rs:18:21 - | -LL | ArrayHolder([0; Self::SIZE]) - | ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE` - | - = note: expected array `[u32; X]` - found array `[u32; _]` - error: constant expression depends on a generic parameter --> $DIR/issue-62504.rs:18:25 | @@ -15,6 +6,5 @@ LL | ArrayHolder([0; Self::SIZE]) | = note: this may fail depending on what value the parameter takes -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/issues/issue-67185-1.rs b/src/test/ui/const-generics/issues/issue-67185-1.rs index 664dbaeb067..89e0b7f62da 100644 --- a/src/test/ui/const-generics/issues/issue-67185-1.rs +++ b/src/test/ui/const-generics/issues/issue-67185-1.rs @@ -2,8 +2,6 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -#![feature(lazy_normalization_consts)] -//~^ WARN the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash trait Baz { type Quaks; diff --git a/src/test/ui/const-generics/issues/issue-67185-1.stderr b/src/test/ui/const-generics/issues/issue-67185-1.stderr index 2472693afcb..ba211caf267 100644 --- a/src/test/ui/const-generics/issues/issue-67185-1.stderr +++ b/src/test/ui/const-generics/issues/issue-67185-1.stderr @@ -6,11 +6,5 @@ LL | #![feature(const_generics)] | = note: `#[warn(incomplete_features)]` on by default -warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash - --> $DIR/issue-67185-1.rs:5:12 - | -LL | #![feature(lazy_normalization_consts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - -warning: 2 warnings emitted +warning: 1 warning emitted diff --git a/src/test/ui/const-generics/issues/issue-67185-2.rs b/src/test/ui/const-generics/issues/issue-67185-2.rs index 52c8a5c9de8..2732137f59d 100644 --- a/src/test/ui/const-generics/issues/issue-67185-2.rs +++ b/src/test/ui/const-generics/issues/issue-67185-2.rs @@ -1,7 +1,5 @@ #![feature(const_generics)] //~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -#![feature(lazy_normalization_consts)] -//~^ WARN the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash trait Baz { type Quaks; diff --git a/src/test/ui/const-generics/issues/issue-67185-2.stderr b/src/test/ui/const-generics/issues/issue-67185-2.stderr index 76d2622e9af..2f6b1f1cd47 100644 --- a/src/test/ui/const-generics/issues/issue-67185-2.stderr +++ b/src/test/ui/const-generics/issues/issue-67185-2.stderr @@ -6,14 +6,8 @@ LL | #![feature(const_generics)] | = note: `#[warn(incomplete_features)]` on by default -warning: the feature `lazy_normalization_consts` is incomplete and may cause the compiler to crash - --> $DIR/issue-67185-2.rs:3:12 - | -LL | #![feature(lazy_normalization_consts)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:17:1 + --> $DIR/issue-67185-2.rs:15:1 | LL | / trait Foo LL | | @@ -31,7 +25,7 @@ LL | | } = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:17:1 + --> $DIR/issue-67185-2.rs:15:1 | LL | / trait Foo LL | | @@ -49,7 +43,7 @@ LL | | } = help: add `#![feature(trivial_bounds)]` to the crate attributes to enable error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:27:6 + --> $DIR/issue-67185-2.rs:25:6 | LL | trait Foo | --- required by a bound in this @@ -65,7 +59,7 @@ LL | impl Foo for FooImpl {} <[u16; 4] as Bar> error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:27:6 + --> $DIR/issue-67185-2.rs:25:6 | LL | trait Foo | --- required by a bound in this @@ -81,7 +75,7 @@ LL | impl Foo for FooImpl {} <[u16; 4] as Bar> error[E0277]: the trait bound `[[u16; 3]; 2]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:31:14 + --> $DIR/issue-67185-2.rs:29:14 | LL | trait Foo | --- required by a bound in this @@ -97,7 +91,7 @@ LL | fn f(_: impl Foo) {} <[u16; 4] as Bar> error[E0277]: the trait bound `[u16; 3]: Bar` is not satisfied - --> $DIR/issue-67185-2.rs:31:14 + --> $DIR/issue-67185-2.rs:29:14 | LL | trait Foo | --- required by a bound in this @@ -112,6 +106,6 @@ LL | fn f(_: impl Foo) {} <[[u16; 3]; 3] as Bar> <[u16; 4] as Bar> -error: aborting due to 6 previous errors; 2 warnings emitted +error: aborting due to 6 previous errors; 1 warning emitted For more information about this error, try `rustc --explain E0277`. diff --git a/src/test/ui/const-generics/issues/issue-69654.rs b/src/test/ui/const-generics/issues/issue-69654.rs index 2befbe56d85..0afc1a2617e 100644 --- a/src/test/ui/const-generics/issues/issue-69654.rs +++ b/src/test/ui/const-generics/issues/issue-69654.rs @@ -1,14 +1,14 @@ #![feature(const_generics)] #![allow(incomplete_features)] -trait Bar<O> {} -impl<O> Bar<O> for [u8; O] {} -//~^ ERROR expected value, found type parameter `O` +trait Bar<T> {} +impl<T> Bar<T> for [u8; T] {} +//~^ ERROR expected value, found type parameter `T` -struct Foo<const O: usize> {} -impl<const O: usize> Foo<O> +struct Foo<const T: usize> {} +impl<const T: usize> Foo<T> where - [u8; O]: Bar<[(); O]>, + [u8; T]: Bar<[(); T]>, { fn foo() {} } diff --git a/src/test/ui/const-generics/lazy-normalization/issue-71922.rs b/src/test/ui/const-generics/lazy-normalization/issue-71922.rs index 60597b8be62..36513f94a9e 100644 --- a/src/test/ui/const-generics/lazy-normalization/issue-71922.rs +++ b/src/test/ui/const-generics/lazy-normalization/issue-71922.rs @@ -1,6 +1,5 @@ // run-pass #![feature(const_generics)] -#![feature(lazy_normalization_consts)] #![allow(incomplete_features)] trait Foo {} diff --git a/src/test/ui/const-generics/lazy-normalization/issue-71986.rs b/src/test/ui/const-generics/lazy-normalization/issue-71986.rs index a07bf2a1a54..048ed18c927 100644 --- a/src/test/ui/const-generics/lazy-normalization/issue-71986.rs +++ b/src/test/ui/const-generics/lazy-normalization/issue-71986.rs @@ -1,6 +1,6 @@ // check-pass #![allow(incomplete_features)] -#![feature(const_generics, lazy_normalization_consts)] +#![feature(const_generics)] pub trait Foo<const B: bool> {} pub fn bar<T: Foo<{ true }>>() {} diff --git a/src/test/ui/const-generics/lazy-normalization/lazy-normalization-feature-gate.rs b/src/test/ui/const-generics/lazy-normalization/lazy-normalization-feature-gate.rs deleted file mode 100644 index 2c6fbfe65d6..00000000000 --- a/src/test/ui/const-generics/lazy-normalization/lazy-normalization-feature-gate.rs +++ /dev/null @@ -1,20 +0,0 @@ -// gate-test-lazy_normalization_consts -#![feature(const_generics)] -//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash -trait Foo {} - -impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} -//~^ ERROR cycle detected - -trait FooImpl<const IS_ZERO: bool> {} - -impl FooImpl<{ 0u8 == 0u8 }> for [(); 0] {} - -impl<const N: usize> FooImpl<{ 0u8 != 0u8 }> for [(); N] {} - -fn foo<T: Foo>(_: T) {} - -fn main() { - foo([]); - foo([()]); -} diff --git a/src/test/ui/const-generics/lazy-normalization/lazy-normalization-feature-gate.stderr b/src/test/ui/const-generics/lazy-normalization/lazy-normalization-feature-gate.stderr deleted file mode 100644 index 9a7844f5e8f..00000000000 --- a/src/test/ui/const-generics/lazy-normalization/lazy-normalization-feature-gate.stderr +++ /dev/null @@ -1,44 +0,0 @@ -warning: the feature `const_generics` is incomplete and may cause the compiler to crash - --> $DIR/lazy-normalization-feature-gate.rs:2:12 - | -LL | #![feature(const_generics)] - | ^^^^^^^^^^^^^^ - | - = note: `#[warn(incomplete_features)]` on by default - -error[E0391]: cycle detected when const-evaluating + checking `<impl at $DIR/lazy-normalization-feature-gate.rs:6:1: 6:72>::{{constant}}#0` - --> $DIR/lazy-normalization-feature-gate.rs:6:58 - | -LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} - | ^^^^^^^^^^ - | -note: ...which requires const-evaluating + checking `<impl at $DIR/lazy-normalization-feature-gate.rs:6:1: 6:72>::{{constant}}#0`... - --> $DIR/lazy-normalization-feature-gate.rs:6:58 - | -LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} - | ^^^^^^^^^^ -note: ...which requires const-evaluating `<impl at $DIR/lazy-normalization-feature-gate.rs:6:1: 6:72>::{{constant}}#0`... - --> $DIR/lazy-normalization-feature-gate.rs:6:58 - | -LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} - | ^^^^^^^^^^ -note: ...which requires type-checking `<impl at $DIR/lazy-normalization-feature-gate.rs:6:1: 6:72>::{{constant}}#0`... - --> $DIR/lazy-normalization-feature-gate.rs:6:58 - | -LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} - | ^^^^^^^^^^ -note: ...which requires processing `<impl at $DIR/lazy-normalization-feature-gate.rs:6:1: 6:72>::{{constant}}#0`... - --> $DIR/lazy-normalization-feature-gate.rs:6:58 - | -LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} - | ^^^^^^^^^^ - = note: ...which again requires const-evaluating + checking `<impl at $DIR/lazy-normalization-feature-gate.rs:6:1: 6:72>::{{constant}}#0`, completing the cycle -note: cycle used when processing `<impl at $DIR/lazy-normalization-feature-gate.rs:6:1: 6:72>` - --> $DIR/lazy-normalization-feature-gate.rs:6:1 - | -LL | impl<const N: usize> Foo for [(); N] where Self: FooImpl<{ N == 0 }> {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error; 1 warning emitted - -For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/const-generics/raw-ptr-const-param.stderr b/src/test/ui/const-generics/raw-ptr-const-param.stderr index 6644c72236b..7a665397c12 100644 --- a/src/test/ui/const-generics/raw-ptr-const-param.stderr +++ b/src/test/ui/const-generics/raw-ptr-const-param.stderr @@ -11,12 +11,10 @@ error[E0308]: mismatched types --> $DIR/raw-ptr-const-param.rs:7:40 | LL | let _: Const<{ 15 as *const _ }> = Const::<{ 10 as *const _ }>; - | ------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{0xf as *const u32}`, found `{0xa as *const u32}` - | | - | expected due to this + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `{0xf as *const u32}`, found `{0xa as *const u32}` | - = note: expected struct `Const<{0xf as *const u32}>` - found struct `Const<{0xa as *const u32}>` + = note: expected type `{0xf as *const u32}` + found type `{0xa as *const u32}` error: aborting due to previous error; 1 warning emitted diff --git a/src/test/ui/const-generics/types-mismatch-const-args.stderr b/src/test/ui/const-generics/types-mismatch-const-args.stderr index 2131738554f..53328c2e89b 100644 --- a/src/test/ui/const-generics/types-mismatch-const-args.stderr +++ b/src/test/ui/const-generics/types-mismatch-const-args.stderr @@ -11,12 +11,10 @@ error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:13:41 | LL | let _: A<'a, u32, {2u32}, {3u32}> = A::<'a, u32, {4u32}, {3u32}> { data: PhantomData }; - | -------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2u32`, found `4u32` - | | - | expected due to this + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `2u32`, found `4u32` | - = note: expected struct `A<'_, _, 2u32, _>` - found struct `A<'_, _, 4u32, _>` + = note: expected type `2u32` + found type `4u32` error[E0308]: mismatched types --> $DIR/types-mismatch-const-args.rs:15:41 @@ -26,8 +24,8 @@ LL | let _: A<'a, u16, {2u32}, {3u32}> = A::<'b, u32, {2u32}, {3u32}> { data | | | expected due to this | - = note: expected struct `A<'a, u16, _, _>` - found struct `A<'b, u32, _, _>` + = note: expected struct `A<'a, u16, {2u32}, {3u32}>` + found struct `A<'b, u32, {2u32}, {3u32}>` error: aborting due to 2 previous errors; 1 warning emitted diff --git a/src/test/ui/type-alias-impl-trait/generic_nondefining_use.stderr b/src/test/ui/type-alias-impl-trait/generic_nondefining_use.stderr index b0ffc4a5ef6..88f8dbe1a7d 100644 --- a/src/test/ui/type-alias-impl-trait/generic_nondefining_use.stderr +++ b/src/test/ui/type-alias-impl-trait/generic_nondefining_use.stderr @@ -25,7 +25,7 @@ error: non-defining opaque type use in defining scope LL | fn concrete_const() -> OneConst<{123}> { | ^^^^^^^^^^^^^^^ | -note: used non-generic constant `123usize` for generic parameter +note: used non-generic constant `{123}` for generic parameter --> $DIR/generic_nondefining_use.rs:10:21 | LL | type OneConst<const X: usize> = impl Debug; |
