From 7299e8fc4db506bb5ec3990e22b611c45df2f13d Mon Sep 17 00:00:00 2001 From: tiif Date: Mon, 15 Sep 2025 14:15:29 +0000 Subject: [PATCH] Fix feature gate tests --- .../feature-gate-adt_const_params.rs | 6 +++++- .../feature-gate-adt_const_params.stderr | 12 ++++-------- .../feature-gate-unsized-const-params.rs | 10 ++++------ .../feature-gate-unsized-const-params.stderr | 19 +++++++++++-------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/tests/ui/feature-gates/feature-gate-adt_const_params.rs b/tests/ui/feature-gates/feature-gate-adt_const_params.rs index 8a3bcf25963f..7efa529c5579 100644 --- a/tests/ui/feature-gates/feature-gate-adt_const_params.rs +++ b/tests/ui/feature-gates/feature-gate-adt_const_params.rs @@ -1,2 +1,6 @@ -struct Foo; //~ ERROR `&'static str` is forbidden +struct Bar(u8); + +struct Foo; +//~^ ERROR: `Bar` is forbidden as the type of a const generic parameter + fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr index 18d514f8cb5f..7ea91a8f4c2b 100644 --- a/tests/ui/feature-gates/feature-gate-adt_const_params.stderr +++ b/tests/ui/feature-gates/feature-gate-adt_const_params.stderr @@ -1,18 +1,14 @@ -error: `&'static str` is forbidden as the type of a const generic parameter - --> $DIR/feature-gate-adt_const_params.rs:1:24 +error: `Bar` is forbidden as the type of a const generic parameter + --> $DIR/feature-gate-adt_const_params.rs:3:21 | -LL | struct Foo; - | ^^^^^^^^^^^^ +LL | struct Foo; + | ^^^ | = note: the only supported types are integers, `bool`, and `char` help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | LL + #![feature(adt_const_params)] | -help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait - | -LL + #![feature(unsized_const_params)] - | error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-unsized-const-params.rs b/tests/ui/feature-gates/feature-gate-unsized-const-params.rs index 56eebbd53c91..d088d382377c 100644 --- a/tests/ui/feature-gates/feature-gate-unsized-const-params.rs +++ b/tests/ui/feature-gates/feature-gate-unsized-const-params.rs @@ -1,8 +1,6 @@ -#![feature(adt_const_params)] - -struct Bar(u8); - -struct Foo; -//~^ ERROR: `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter +struct Foo; +//~^ ERROR: `[u8]` is forbidden as the type of a const generic parameter +//~| HELP: add `#![feature(adt_const_params)]` to the crate +//~| HELP: add `#![feature(unsized_const_params)]` to the crate fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr b/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr index d4f7d45ea323..85ca2f59cb63 100644 --- a/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr +++ b/tests/ui/feature-gates/feature-gate-unsized-const-params.stderr @@ -1,15 +1,18 @@ -error[E0741]: `Bar` must implement `ConstParamTy` to be used as the type of a const generic parameter - --> $DIR/feature-gate-unsized-const-params.rs:5:21 +error: `[u8]` is forbidden as the type of a const generic parameter + --> $DIR/feature-gate-unsized-const-params.rs:1:21 | -LL | struct Foo; - | ^^^ +LL | struct Foo; + | ^^^^ | -help: add `#[derive(ConstParamTy, PartialEq, Eq)]` to the struct + = note: the only supported types are integers, `bool`, and `char` +help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | -LL - struct Bar(u8); -LL + #[derive(ConstParamTy, PartialEq, Eq)] +LL + #![feature(adt_const_params)] + | +help: add `#![feature(unsized_const_params)]` to the crate attributes to enable references to implement the `ConstParamTy` trait + | +LL + #![feature(unsized_const_params)] | error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0741`.