diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs index 0c8edc565bd03..8dcd445721a1e 100644 --- a/src/librustc_ast_passes/feature_gate.rs +++ b/src/librustc_ast_passes/feature_gate.rs @@ -530,7 +530,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { &self, |x: &Features| x.const_generics || x.min_const_generics, param.ident.span, - sym::const_generics, + sym::min_const_generics, "const generics are unstable" ); } diff --git a/src/librustc_parse/parser/generics.rs b/src/librustc_parse/parser/generics.rs index 47794746126da..be72ed6dffb7c 100644 --- a/src/librustc_parse/parser/generics.rs +++ b/src/librustc_parse/parser/generics.rs @@ -54,7 +54,7 @@ impl<'a> Parser<'a> { self.expect(&token::Colon)?; let ty = self.parse_ty()?; - self.sess.gated_spans.gate(sym::const_generics, const_span.to(self.prev_token.span)); + self.sess.gated_spans.gate(sym::min_const_generics, const_span.to(self.prev_token.span)); Ok(GenericParam { ident, diff --git a/src/librustc_typeck/collect/type_of.rs b/src/librustc_typeck/collect/type_of.rs index 981437c5e846b..17444c6d0ac95 100644 --- a/src/librustc_typeck/collect/type_of.rs +++ b/src/librustc_typeck/collect/type_of.rs @@ -330,6 +330,8 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { let err = if tcx.features().min_const_generics { match ty.kind { ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Error(_) => None, + ty::FnPtr(_) => Some("function pointers"), + ty::RawPtr(_) => Some("raw pointers"), _ => { err_ty_str = format!("`{}`", ty); Some(err_ty_str.as_str()) @@ -352,7 +354,8 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { ); if tcx.features().min_const_generics { - err.note("the only supported types are integers, `bool` and `char`").emit() + err.note("the only supported types are integers, `bool` and `char`") + .note("more complex types are supported with `#[feature(const_generics)]`").emit() } else { err.emit(); } diff --git a/src/test/ui/const-generics/const-param-in-trait-ungated.stderr b/src/test/ui/const-generics/const-param-in-trait-ungated.stderr index bdae6bc362c47..d53a4ac2d4c23 100644 --- a/src/test/ui/const-generics/const-param-in-trait-ungated.stderr +++ b/src/test/ui/const-generics/const-param-in-trait-ungated.stderr @@ -4,8 +4,8 @@ error[E0658]: const generics are unstable LL | trait Trait {} | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr b/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr index 616f0fa8f1af0..5d379ff083ca7 100644 --- a/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr +++ b/src/test/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr @@ -10,8 +10,8 @@ error[E0658]: const generics are unstable LL | struct B(PhantomData<[T; N]>); | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/issues/issue-60263.stderr b/src/test/ui/const-generics/issues/issue-60263.stderr index 7b50c442d2f41..aeef296f38526 100644 --- a/src/test/ui/const-generics/issues/issue-60263.stderr +++ b/src/test/ui/const-generics/issues/issue-60263.stderr @@ -4,8 +4,8 @@ error[E0658]: const generics are unstable LL | struct B; | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/const-generics/min_const_generics/complex-types.stderr b/src/test/ui/const-generics/min_const_generics/complex-types.stderr index 65c7aec36d6b1..835b1f1a3e867 100644 --- a/src/test/ui/const-generics/min_const_generics/complex-types.stderr +++ b/src/test/ui/const-generics/min_const_generics/complex-types.stderr @@ -5,6 +5,7 @@ LL | struct Foo; | ^^^^^^^ | = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` error: using `()` as const generic parameters is forbidden --> $DIR/complex-types.rs:6:21 @@ -13,6 +14,7 @@ LL | struct Bar; | ^^ | = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` error: using `No` as const generic parameters is forbidden --> $DIR/complex-types.rs:12:21 @@ -21,6 +23,7 @@ LL | struct Fez; | ^^ | = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` error: using `&'static u8` as const generic parameters is forbidden --> $DIR/complex-types.rs:15:21 @@ -29,6 +32,7 @@ LL | struct Faz; | ^^^^^^^^^^^ | = note: the only supported types are integers, `bool` and `char` + = note: more complex types are supported with `#[feature(const_generics)]` error: aborting due to 4 previous errors diff --git a/src/test/ui/const-generics/min_const_generics/feature-gate-min_const_generics.stderr b/src/test/ui/const-generics/min_const_generics/feature-gate-min_const_generics.stderr index 80cfdc2d28c45..7f82a960da255 100644 --- a/src/test/ui/const-generics/min_const_generics/feature-gate-min_const_generics.stderr +++ b/src/test/ui/const-generics/min_const_generics/feature-gate-min_const_generics.stderr @@ -4,8 +4,8 @@ error[E0658]: const generics are unstable LL | fn test() {} | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error: aborting due to previous error diff --git a/src/test/ui/feature-gates/feature-gate-const_generics-ptr.stderr b/src/test/ui/feature-gates/feature-gate-const_generics-ptr.stderr index b2c96d3810f98..eef465318a390 100644 --- a/src/test/ui/feature-gates/feature-gate-const_generics-ptr.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_generics-ptr.stderr @@ -4,8 +4,8 @@ error[E0658]: const generics are unstable LL | struct ConstFn; | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error[E0658]: const generics are unstable --> $DIR/feature-gate-const_generics-ptr.rs:5:23 @@ -13,8 +13,8 @@ error[E0658]: const generics are unstable LL | struct ConstPtr; | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error: using function pointers as const generic parameters is forbidden --> $DIR/feature-gate-const_generics-ptr.rs:1:25 diff --git a/src/test/ui/feature-gates/feature-gate-const_generics.stderr b/src/test/ui/feature-gates/feature-gate-const_generics.stderr index 02aa1f5a4d843..f80362252f923 100644 --- a/src/test/ui/feature-gates/feature-gate-const_generics.stderr +++ b/src/test/ui/feature-gates/feature-gate-const_generics.stderr @@ -4,8 +4,8 @@ error[E0658]: const generics are unstable LL | fn foo() {} | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error[E0658]: const generics are unstable --> $DIR/feature-gate-const_generics.rs:3:18 @@ -13,8 +13,8 @@ error[E0658]: const generics are unstable LL | struct Foo([(); X]); | ^ | - = note: see issue #44580 for more information - = help: add `#![feature(const_generics)]` to the crate attributes to enable + = note: see issue #74878 for more information + = help: add `#![feature(min_const_generics)]` to the crate attributes to enable error: aborting due to 2 previous errors