From 35f9cb6eeec95cd94c57c4b0403c227d8673835d Mon Sep 17 00:00:00 2001 From: Folkert de Vries Date: Thu, 19 Mar 2026 14:38:09 +0100 Subject: [PATCH 1/8] add neon load/store assembly test --- .../src/directives/directive_names.rs | 1 + tests/assembly-llvm/aarch64-arm-load-store.rs | 78 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 tests/assembly-llvm/aarch64-arm-load-store.rs diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs index 9af881b5c2f58..77c826fa0b9cd 100644 --- a/src/tools/compiletest/src/directives/directive_names.rs +++ b/src/tools/compiletest/src/directives/directive_names.rs @@ -213,6 +213,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "only-apple", "only-arm", "only-arm64ec", + "only-armv7-unknown-linux-gnueabihf", "only-avr", "only-beta", "only-bpf", diff --git a/tests/assembly-llvm/aarch64-arm-load-store.rs b/tests/assembly-llvm/aarch64-arm-load-store.rs new file mode 100644 index 0000000000000..8296194100d9f --- /dev/null +++ b/tests/assembly-llvm/aarch64-arm-load-store.rs @@ -0,0 +1,78 @@ +//@ assembly-output: emit-asm +// +//@ revisions: AARCH64 +//@[AARCH64] compile-flags: -Copt-level=3 +//@[AARCH64] only-aarch64-unknown-linux-gnu +// +//@ revisions: ARMV7 +//@[ARMV7] compile-flags: -Copt-level=3 +//@[ARMV7] only-armv7-unknown-linux-gnueabihf +//@[ARMV7] ignore-thumb +//@[ARMV7] ignore-android +#![crate_type = "lib"] +#![cfg_attr(target_arch = "arm", feature(arm_target_feature, stdarch_arm_neon_intrinsics))] + +#[cfg(target_arch = "aarch64")] +use std::arch::aarch64::*; +#[cfg(target_arch = "arm")] +use std::arch::arm::*; + +// Loads of 3 are error-prone because a `repr(simd)` type's size is always rounded up to the next +// power of 2. Hence, using `read_unaligned` and `write_unaligned` on such types is invalid, it +// would go out of bounds. +#[unsafe(no_mangle)] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon,v7"))] +fn test_vld3q_f32(ptr: *const f32) -> float32x4x3_t { + // AARCH64-LABEL: test_vld3q_f32 + // AARCH64: ld3 { v0.4s, v1.4s, v2.4s }, [x0] + // AARCH64: stp q0, q1, [x8] + // AARCH64: str q2, [x8, #32] + // AARCH64: ret + // + // ARMV7-LABEL: test_vld3q_f32 + // ARMV7: vld3.32 {d16, d18, d20}, [r1]! + // ARMV7: vld3.32 {d17, d19, d21}, [r1] + // ARMV7: vst1.32 {d16, d17}, [r0]! + // ARMV7: vst1.32 {d18, d19}, [r0]! + // ARMV7: vst1.64 {d20, d21}, [r0] + // ARMV7: bx lr + unsafe { vld3q_f32(ptr) } +} + +#[unsafe(no_mangle)] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon,v7"))] +fn test_vld3q_s32(ptr: *const i32) -> int32x4x3_t { + // AARCH64-LABEL: test_vld3q_s32 + // AARCH64: ld3 { v0.4s, v1.4s, v2.4s }, [x0] + // AARCH64: stp q0, q1, [x8] + // AARCH64: str q2, [x8, #32] + // AARCH64: ret + // + // ARMV7-LABEL: test_vld3q_s32 + // ARMV7: vld3.32 {d16, d18, d20}, [r1]! + // ARMV7: vld3.32 {d17, d19, d21}, [r1] + // ARMV7: vst1.32 {d16, d17}, [r0]! + // ARMV7: vst1.32 {d18, d19}, [r0]! + // ARMV7: vst1.64 {d20, d21}, [r0] + // ARMV7: bx lr + unsafe { vld3q_s32(ptr) } +} + +#[unsafe(no_mangle)] +#[cfg_attr(target_arch = "arm", target_feature(enable = "neon,v7"))] +fn test_vld3q_u32(ptr: *const u32) -> uint32x4x3_t { + // AARCH64-LABEL: test_vld3q_u32 + // AARCH64: ld3 { v0.4s, v1.4s, v2.4s }, [x0] + // AARCH64: stp q0, q1, [x8] + // AARCH64: str q2, [x8, #32] + // AARCH64: ret + // + // ARMV7-LABEL: test_vld3q_u32 + // ARMV7: vld3.32 {d16, d18, d20}, [r1]! + // ARMV7: vld3.32 {d17, d19, d21}, [r1] + // ARMV7: vst1.32 {d16, d17}, [r0]! + // ARMV7: vst1.32 {d18, d19}, [r0]! + // ARMV7: vst1.64 {d20, d21}, [r0] + // ARMV7: bx lr + unsafe { vld3q_u32(ptr) } +} From 7df43d309c2722afdcf336a901f86eae18a19072 Mon Sep 17 00:00:00 2001 From: cyrgani Date: Mon, 23 Mar 2026 20:08:24 +0000 Subject: [PATCH 2/8] allow `incomplete_features` in more tests --- src/tools/compiletest/src/runtest.rs | 5 +--- .../alias_const_param_ty-1.rs | 1 - .../alias_const_param_ty-1.stderr | 11 ------- .../unsized-anon-const-err-2.rs | 1 - .../unsized-anon-const-err-2.stderr | 23 +++++---------- .../defaults/concrete-const-param-type.rs | 2 -- .../defaults/concrete-const-param-type.stderr | 21 ++------------ .../cannot-convert-refree-ice-114463.rs | 2 +- .../cannot-convert-refree-ice-114463.stderr | 11 +------ .../const-block-is-poly.rs | 1 - .../const-block-is-poly.stderr | 13 ++------- .../double-opaque-parent-predicates.rs | 1 - .../double-opaque-parent-predicates.stderr | 11 ------- .../generic_const_exprs/eval-try-unify.rs | 1 - .../generic_const_exprs/eval-try-unify.stderr | 11 ------- .../generic_const_exprs/issue-97047-ice-1.rs | 2 -- .../issue-97047-ice-1.stderr | 19 ------------ .../generic_const_exprs/issue-97047-ice-2.rs | 2 -- .../issue-97047-ice-2.stderr | 19 ------------ .../mismatched-gat-subst-kind.rs | 1 - .../mismatched-gat-subst-kind.stderr | 13 ++------- .../post-analysis-user-facing-param-env.rs | 1 - ...post-analysis-user-facing-param-env.stderr | 17 +++-------- .../specialization-fuzzing-ice-133639.rs | 1 - .../specialization-fuzzing-ice-133639.stderr | 11 ------- .../check-type-in-mir.rs | 2 -- .../check-type-in-mir.stderr | 21 ++------------ .../references-parent-generics.feat.stderr | 15 ++-------- .../references-parent-generics.nofeat.stderr | 2 +- .../references-parent-generics.rs | 1 - .../mgca/struct-ctor-in-array-len.rs | 1 - .../mgca/struct-ctor-in-array-len.stderr | 13 ++------- .../mgca/unexpected-fn-item-in-array.rs | 1 - .../mgca/unexpected-fn-item-in-array.stderr | 13 ++------- .../occurs-check/unify-fixpoint.rs | 3 +- .../occurs-check/unify-fixpoint.stderr | 11 ------- .../const-traits/mismatched_generic_args.rs | 1 - .../mismatched_generic_args.stderr | 21 ++++---------- ...verlap-const-with-nonconst.min_spec.stderr | 2 +- .../overlap-const-with-nonconst.rs | 1 - .../overlap-const-with-nonconst.spec.stderr | 14 ++------- .../negative-impls/negative-default-impls.rs | 1 - .../negative-default-impls.stderr | 14 ++------- .../negative-specializes-negative.rs | 2 +- .../negative-specializes-negative.stderr | 12 -------- .../negative-specializes-positive-item.rs | 2 +- .../negative-specializes-positive-item.stderr | 12 +------- .../negative-specializes-positive.rs | 2 +- .../negative-specializes-positive.stderr | 12 +------- .../positive-specializes-negative.rs | 2 +- .../positive-specializes-negative.stderr | 12 +------- .../coherence/negative-coherence-bounds.rs | 1 - .../negative-coherence-bounds.stderr | 12 -------- .../next-solver/issue-118950-root-region.rs | 1 - .../issue-118950-root-region.stderr | 17 +++-------- ...-type-constrains-trait-args.current.stderr | 11 ------- ...elf-type-constrains-trait-args.next.stderr | 11 ------- ...rmalize-self-type-constrains-trait-args.rs | 1 - .../next-solver/specialization-transmute.rs | 1 - .../specialization-transmute.stderr | 18 +++--------- .../specialization-unconstrained.rs | 1 - .../specialization-unconstrained.stderr | 16 ++-------- ...on-lifetime-via-dyn-builtin.current.stderr | 11 ------- .../non-lifetime-via-dyn-builtin.next.stderr | 11 ------- .../ui/traits/non-lifetime-via-dyn-builtin.rs | 1 - .../non_lifetime_binders/bad-copy-cond.rs | 1 - .../non_lifetime_binders/bad-copy-cond.stderr | 15 ++-------- .../non_lifetime_binders/bad-sized-cond.rs | 1 - .../bad-sized-cond.stderr | 23 +++++---------- .../bad-suggestion-on-missing-assoc.rs | 2 -- .../bad-suggestion-on-missing-assoc.stderr | 25 +++------------- tests/ui/traits/non_lifetime_binders/basic.rs | 1 - .../traits/non_lifetime_binders/basic.stderr | 11 ------- .../binder-defaults-112547.rs | 1 - .../binder-defaults-112547.stderr | 17 +++-------- .../binder-defaults-119489.rs | 2 -- .../binder-defaults-119489.stderr | 25 +++------------- .../diagnostic-hir-wf-check.rs | 1 - .../diagnostic-hir-wf-check.stderr | 29 +++++++------------ .../drop-impl-pred.no.stderr | 15 ++-------- .../non_lifetime_binders/drop-impl-pred.rs | 1 - .../drop-impl-pred.yes.stderr | 11 ------- tests/ui/traits/non_lifetime_binders/fail.rs | 1 - .../traits/non_lifetime_binders/fail.stderr | 21 ++++---------- .../foreach-partial-eq.rs | 1 - .../foreach-partial-eq.stderr | 15 ++-------- .../late-bound-in-anon-ct.rs | 2 -- .../late-bound-in-anon-ct.stderr | 21 ++------------ .../late-const-param-wf.rs | 1 - .../late-const-param-wf.stderr | 13 ++------- .../non_lifetime_binders/method-probe.rs | 1 - .../non_lifetime_binders/method-probe.stderr | 11 ------- .../missing-assoc-item.rs | 1 - .../missing-assoc-item.stderr | 13 ++------- .../nested-apit-mentioning-outer-bound-var.rs | 1 - ...ted-apit-mentioning-outer-bound-var.stderr | 13 ++------- .../object-lifetime-default-for-late.rs | 1 - .../object-lifetime-default-for-late.stderr | 11 ------- .../ui/traits/non_lifetime_binders/on-dyn.rs | 1 - .../traits/non_lifetime_binders/on-dyn.stderr | 13 ++------- .../ui/traits/non_lifetime_binders/on-ptr.rs | 1 - .../traits/non_lifetime_binders/on-ptr.stderr | 13 ++------- .../ui/traits/non_lifetime_binders/on-rpit.rs | 1 - .../non_lifetime_binders/on-rpit.stderr | 11 ------- ...laceholders-dont-outlive-static.bad.stderr | 13 ++------- ...aceholders-dont-outlive-static.good.stderr | 13 ++------- .../placeholders-dont-outlive-static.rs | 1 - .../traits/non_lifetime_binders/shadowed.rs | 1 - .../non_lifetime_binders/shadowed.stderr | 19 ++++-------- .../sized-late-bound-issue-114872.rs | 1 - .../sized-late-bound-issue-114872.stderr | 11 ------- .../supertrait-dyn-compatibility.rs | 1 - .../supertrait-dyn-compatibility.stderr | 15 ++-------- .../type-match-with-late-bound.stderr | 11 +------ ...holders-in-query-response-2.current.stderr | 11 ------- ...aceholders-in-query-response-2.next.stderr | 11 ------- ...ifying-placeholders-in-query-response-2.rs | 1 - ...ceholders-in-query-response.current.stderr | 11 ------- ...placeholders-in-query-response.next.stderr | 11 ------- ...unifying-placeholders-in-query-response.rs | 1 - .../non_lifetime_binders/universe-error1.rs | 1 - .../universe-error1.stderr | 15 ++-------- 122 files changed, 132 insertions(+), 871 deletions(-) delete mode 100644 tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.stderr delete mode 100644 tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.stderr delete mode 100644 tests/ui/const-generics/generic_const_exprs/eval-try-unify.stderr delete mode 100644 tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr delete mode 100644 tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr delete mode 100644 tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.stderr delete mode 100644 tests/ui/const-generics/occurs-check/unify-fixpoint.stderr delete mode 100644 tests/ui/traits/negative-impls/negative-specializes-negative.stderr delete mode 100644 tests/ui/traits/next-solver/coherence/negative-coherence-bounds.stderr delete mode 100644 tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.current.stderr delete mode 100644 tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.next.stderr delete mode 100644 tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr delete mode 100644 tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/basic.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/drop-impl-pred.yes.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/method-probe.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/on-rpit.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.current.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.next.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.current.stderr delete mode 100644 tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.next.stderr diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 40e6c4e593b19..d7b47b38a9431 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1922,10 +1922,7 @@ impl<'test> TestCx<'test> { // Allow tests to use internal and incomplete features. compiler.args(&["-A", "internal_features"]); // FIXME(#154168); temporarily exclude some directories to make the transition easier - if !input_file - .iter() - .any(|p| p == "traits" || p == "specialization" || p == "const-generics") - { + if !input_file.iter().any(|p| p == "specialization") { compiler.args(&["-A", "incomplete_features"]); } diff --git a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs index e90426ec0c762..8825d5384ab91 100644 --- a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs +++ b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.rs @@ -1,6 +1,5 @@ //@ check-pass #![feature(adt_const_params, lazy_type_alias)] -//~^ WARN: the feature `lazy_type_alias` is incomplete pub type Matrix = [usize; 1]; const EMPTY_MATRIX: Matrix = [0; 1]; diff --git a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.stderr b/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.stderr deleted file mode 100644 index 4f5133474c608..0000000000000 --- a/tests/ui/const-generics/adt_const_params/alias_const_param_ty-1.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/alias_const_param_ty-1.rs:2:30 - | -LL | #![feature(adt_const_params, lazy_type_alias)] - | ^^^^^^^^^^^^^^^ - | - = note: see issue #112792 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.rs b/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.rs index 81b1ec6a77196..9e2212bc8097d 100644 --- a/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.rs +++ b/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.rs @@ -2,7 +2,6 @@ #![feature(adt_const_params)] #![feature(unsized_const_params)] -//~^ WARN the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes #[derive(Clone)] struct S; diff --git a/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.stderr b/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.stderr index d538bb0af09aa..8112613f3bf80 100644 --- a/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.stderr +++ b/tests/ui/const-generics/adt_const_params/unsized-anon-const-err-2.stderr @@ -1,22 +1,13 @@ error: free constant item without body - --> $DIR/unsized-anon-const-err-2.rs:10:1 + --> $DIR/unsized-anon-const-err-2.rs:9:1 | LL | const A: [u8]; | ^^^^^^^^^^^^^- | | | help: provide a definition for the constant: `= ;` -warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unsized-anon-const-err-2.rs:4:12 - | -LL | #![feature(unsized_const_params)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #95174 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-anon-const-err-2.rs:10:10 + --> $DIR/unsized-anon-const-err-2.rs:9:10 | LL | const A: [u8]; | ^^^^ doesn't have a size known at compile-time @@ -25,7 +16,7 @@ LL | const A: [u8]; = note: statics and constants must have a statically known size error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-anon-const-err-2.rs:14:31 + --> $DIR/unsized-anon-const-err-2.rs:13:31 | LL | impl Copy for S {} | ^ doesn't have a size known at compile-time @@ -34,7 +25,7 @@ LL | impl Copy for S {} = note: statics and constants must have a statically known size error[E0277]: the size for values of type `[u8]` cannot be known at compilation time - --> $DIR/unsized-anon-const-err-2.rs:17:33 + --> $DIR/unsized-anon-const-err-2.rs:16:33 | LL | impl Copy for S {} | ^ doesn't have a size known at compile-time @@ -43,7 +34,7 @@ LL | impl Copy for S {} = note: statics and constants must have a statically known size error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates - --> $DIR/unsized-anon-const-err-2.rs:14:6 + --> $DIR/unsized-anon-const-err-2.rs:13:6 | LL | impl Copy for S {} | ^^^^^^^^^^^^ unconstrained const parameter @@ -52,7 +43,7 @@ LL | impl Copy for S {} = note: proving the result of expressions other than the parameter are unique is not supported error[E0207]: the const parameter `M` is not constrained by the impl trait, self type, or predicates - --> $DIR/unsized-anon-const-err-2.rs:17:6 + --> $DIR/unsized-anon-const-err-2.rs:16:6 | LL | impl Copy for S {} | ^^^^^^^^^^^^^^ unconstrained const parameter @@ -60,7 +51,7 @@ LL | impl Copy for S {} = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported -error: aborting due to 6 previous errors; 1 warning emitted +error: aborting due to 6 previous errors Some errors have detailed explanations: E0207, E0277. For more information about an error, try `rustc --explain E0207`. diff --git a/tests/ui/const-generics/defaults/concrete-const-param-type.rs b/tests/ui/const-generics/defaults/concrete-const-param-type.rs index c411f81192bd6..a2eb37b535eb5 100644 --- a/tests/ui/const-generics/defaults/concrete-const-param-type.rs +++ b/tests/ui/const-generics/defaults/concrete-const-param-type.rs @@ -1,6 +1,4 @@ #![feature(generic_const_parameter_types, unsized_const_params, adt_const_params)] -//~^ WARN the feature `generic_const_parameter_types` is incomplete -//~| WARN the feature `unsized_const_params` is incomplete // Make sure that we test the const param type of default const parameters // if both the type of the default and the type of the parameter are concrete. diff --git a/tests/ui/const-generics/defaults/concrete-const-param-type.stderr b/tests/ui/const-generics/defaults/concrete-const-param-type.stderr index ad077f87e5dfb..805d5a1e91fb4 100644 --- a/tests/ui/const-generics/defaults/concrete-const-param-type.stderr +++ b/tests/ui/const-generics/defaults/concrete-const-param-type.stderr @@ -1,25 +1,8 @@ -warning: the feature `generic_const_parameter_types` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/concrete-const-param-type.rs:1:12 - | -LL | #![feature(generic_const_parameter_types, unsized_const_params, adt_const_params)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #137626 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/concrete-const-param-type.rs:1:43 - | -LL | #![feature(generic_const_parameter_types, unsized_const_params, adt_const_params)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #95174 for more information - error: the constant `N` is not of type `u64` - --> $DIR/concrete-const-param-type.rs:9:26 + --> $DIR/concrete-const-param-type.rs:7:26 | LL | struct Foo; | ^^^^^^^^^^^^^^^^ expected `u64`, found `u32` -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs index 2ce998e9fd9cf..5008179969783 100644 --- a/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs +++ b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.rs @@ -1,7 +1,7 @@ // issue: rust-lang/rust#114463 // ICE cannot convert `ReFree ..` to a region vid #![feature(generic_const_exprs)] -//~^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes + fn bug<'a>() { [(); (|_: &'a u8| (), 0).1]; //~^ ERROR cannot capture late-bound lifetime in constant diff --git a/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr index e4845405ec816..a468ba6183eaf 100644 --- a/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr +++ b/tests/ui/const-generics/generic_const_exprs/cannot-convert-refree-ice-114463.stderr @@ -1,12 +1,3 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/cannot-convert-refree-ice-114463.rs:3:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - error: cannot capture late-bound lifetime in constant --> $DIR/cannot-convert-refree-ice-114463.rs:6:16 | @@ -15,5 +6,5 @@ LL | fn bug<'a>() { LL | [(); (|_: &'a u8| (), 0).1]; | ^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.rs b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.rs index a6988a492f614..679f6b74bd1df 100644 --- a/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.rs +++ b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.rs @@ -1,5 +1,4 @@ #![feature(generic_const_exprs)] -//~^ WARN the feature `generic_const_exprs` is incomplete fn foo() { let _ = [0u8; { const { std::mem::size_of::() } }]; diff --git a/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.stderr b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.stderr index db547e6a24815..78d1540f25ce9 100644 --- a/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.stderr +++ b/tests/ui/const-generics/generic_const_exprs/const-block-is-poly.stderr @@ -1,14 +1,5 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/const-block-is-poly.rs:1:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - error: overly complex generic constant - --> $DIR/const-block-is-poly.rs:5:19 + --> $DIR/const-block-is-poly.rs:4:19 | LL | let _ = [0u8; { const { std::mem::size_of::() } }]; | ^^----------------------------------^^ @@ -18,5 +9,5 @@ LL | let _ = [0u8; { const { std::mem::size_of::() } }]; = help: consider moving this anonymous constant into a `const` function = note: this operation may be supported in the future -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.rs b/tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.rs index e48d559aa3270..c5f4bbbf4513a 100644 --- a/tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.rs +++ b/tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(generic_const_exprs)] -//~^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use pub fn y<'a, U: 'a>() -> impl IntoIterator + 'a> { [[[1, 2, 3]]] diff --git a/tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.stderr b/tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.stderr deleted file mode 100644 index faaede13e6b64..0000000000000 --- a/tests/ui/const-generics/generic_const_exprs/double-opaque-parent-predicates.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/double-opaque-parent-predicates.rs:3:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/const-generics/generic_const_exprs/eval-try-unify.rs b/tests/ui/const-generics/generic_const_exprs/eval-try-unify.rs index b61d2dc1945a7..d2b8d94c05445 100644 --- a/tests/ui/const-generics/generic_const_exprs/eval-try-unify.rs +++ b/tests/ui/const-generics/generic_const_exprs/eval-try-unify.rs @@ -1,7 +1,6 @@ //@ build-pass #![feature(generic_const_exprs)] -//~^ WARNING the feature `generic_const_exprs` is incomplete trait Generic { const ASSOC: usize; diff --git a/tests/ui/const-generics/generic_const_exprs/eval-try-unify.stderr b/tests/ui/const-generics/generic_const_exprs/eval-try-unify.stderr deleted file mode 100644 index 8eb1fccc5f88e..0000000000000 --- a/tests/ui/const-generics/generic_const_exprs/eval-try-unify.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/eval-try-unify.rs:3:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs b/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs index 443d0a2fe87a2..965e07499e182 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.rs @@ -1,8 +1,6 @@ //@ check-pass #![feature(adt_const_params, unsized_const_params, generic_const_exprs)] -//~^ WARN the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] -//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] pub struct Changes where diff --git a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr b/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr deleted file mode 100644 index b6b297593a255..0000000000000 --- a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-1.stderr +++ /dev/null @@ -1,19 +0,0 @@ -warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-97047-ice-1.rs:3:30 - | -LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #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:52 - | -LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - -warning: 2 warnings emitted - diff --git a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs b/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs index 6a91b52256728..728d132d4bb15 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.rs @@ -1,8 +1,6 @@ //@ check-pass #![feature(adt_const_params, unsized_const_params, generic_const_exprs)] -//~^ WARN the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] -//~^^ WARN the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes [incomplete_features] pub struct Changes where diff --git a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr b/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr deleted file mode 100644 index c0c7dcc79dc42..0000000000000 --- a/tests/ui/const-generics/generic_const_exprs/issue-97047-ice-2.stderr +++ /dev/null @@ -1,19 +0,0 @@ -warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-97047-ice-2.rs:3:30 - | -LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #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:52 - | -LL | #![feature(adt_const_params, unsized_const_params, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - -warning: 2 warnings emitted - diff --git a/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs index 734a37862940f..85af36ebe9a65 100644 --- a/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs +++ b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.rs @@ -1,5 +1,4 @@ #![feature(generic_const_exprs)] -//~^ WARN the feature `generic_const_exprs` is incomplete trait B { type U; diff --git a/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr index 1036b7261f26a..b11eb10599524 100644 --- a/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr +++ b/tests/ui/const-generics/generic_const_exprs/mismatched-gat-subst-kind.stderr @@ -1,18 +1,9 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/mismatched-gat-subst-kind.rs:1:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0747]: constant provided when a type was expected - --> $DIR/mismatched-gat-subst-kind.rs:8:13 + --> $DIR/mismatched-gat-subst-kind.rs:7:13 | LL | fn f = ()>>() {} | ^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs index 9af351ec59f06..6e382de436f4f 100644 --- a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs +++ b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.rs @@ -1,6 +1,5 @@ // Regression test for #133271. #![feature(generic_const_exprs)] -//~^ WARN the feature `generic_const_exprs` is incomplete struct Foo; impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo diff --git a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr index 37eb895f9a8d9..d58bc67232758 100644 --- a/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr +++ b/tests/ui/const-generics/generic_const_exprs/post-analysis-user-facing-param-env.stderr @@ -1,5 +1,5 @@ error[E0407]: method `unimplemented` is not a member of trait `std::ops::Add` - --> $DIR/post-analysis-user-facing-param-env.rs:12:5 + --> $DIR/post-analysis-user-facing-param-env.rs:11:5 | LL | / fn unimplemented(self, _: &Foo) -> Self::Output { LL | | @@ -7,17 +7,8 @@ LL | | loop {} LL | | } | |_____^ not a member of trait `std::ops::Add` -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/post-analysis-user-facing-param-env.rs:2:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0046]: not all trait items implemented, missing: `Output`, `add` - --> $DIR/post-analysis-user-facing-param-env.rs:6:1 + --> $DIR/post-analysis-user-facing-param-env.rs:5:1 | LL | / impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo LL | | @@ -30,7 +21,7 @@ LL | | [(); 1 + 0]: Sized, = help: implement the missing item: `fn add(self, _: &'a Foo) -> >::Output { todo!() }` error[E0207]: the const parameter `NUM` is not constrained by the impl trait, self type, or predicates - --> $DIR/post-analysis-user-facing-param-env.rs:6:10 + --> $DIR/post-analysis-user-facing-param-env.rs:5:10 | LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo | ^^^^^^^^^^^^^^^^ unconstrained const parameter @@ -38,7 +29,7 @@ LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo = note: expressions using a const parameter must map each value to a distinct output value = note: proving the result of expressions other than the parameter are unique is not supported -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors Some errors have detailed explanations: E0046, E0207, E0407. For more information about an error, try `rustc --explain E0046`. diff --git a/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.rs b/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.rs index d3ae863bee968..d605c83239b27 100644 --- a/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.rs +++ b/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.rs @@ -5,7 +5,6 @@ #![feature(with_negative_coherence)] #![feature(min_specialization)] #![feature(generic_const_exprs)] -//~^ WARNING the feature `generic_const_exprs` is incomplete #![crate_type = "lib"] trait Trait {} diff --git a/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.stderr b/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.stderr deleted file mode 100644 index f17b248d856d4..0000000000000 --- a/tests/ui/const-generics/generic_const_exprs/specialization-fuzzing-ice-133639.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/specialization-fuzzing-ice-133639.rs:7:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs index d3bc544ed6c58..4de1616cdee56 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs +++ b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.rs @@ -1,8 +1,6 @@ // Ensure that we actually treat `N`'s type as `&'a u32` in MIR typeck. #![feature(unsized_const_params, adt_const_params, generic_const_parameter_types)] -//~^ WARN the feature `unsized_const_params` is incomplete -//~| WARN the feature `generic_const_parameter_types` is incomplete fn foo<'a, const N: &'a u32>() { let b: &'static u32 = N; diff --git a/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr index 3dc7ce438fa93..0b7a43a391f00 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr +++ b/tests/ui/const-generics/generic_const_parameter_types/check-type-in-mir.stderr @@ -1,27 +1,10 @@ -warning: the feature `unsized_const_params` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/check-type-in-mir.rs:3:12 - | -LL | #![feature(unsized_const_params, adt_const_params, generic_const_parameter_types)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #95174 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: the feature `generic_const_parameter_types` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/check-type-in-mir.rs:3:52 - | -LL | #![feature(unsized_const_params, adt_const_params, generic_const_parameter_types)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #137626 for more information - error: lifetime may not live long enough - --> $DIR/check-type-in-mir.rs:8:12 + --> $DIR/check-type-in-mir.rs:6:12 | LL | fn foo<'a, const N: &'a u32>() { | -- lifetime `'a` defined here LL | let b: &'static u32 = N; | ^^^^^^^^^^^^ type annotation requires that `'a` must outlive `'static` -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr index 2d47797aef284..7e61566aabdd5 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr +++ b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.feat.stderr @@ -1,14 +1,5 @@ -warning: the feature `generic_const_parameter_types` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/references-parent-generics.rs:3:27 - | -LL | #![cfg_attr(feat, feature(generic_const_parameter_types))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #137626 for more information - = note: `#[warn(incomplete_features)]` on by default - error: `Self` is forbidden as the type of a const generic parameter - --> $DIR/references-parent-generics.rs:7:25 + --> $DIR/references-parent-generics.rs:6:25 | LL | type Assoc; | ^^^^ @@ -16,10 +7,10 @@ LL | type Assoc; = note: the only supported types are integers, `bool`, and `char` error: anonymous constants referencing generics are not yet supported - --> $DIR/references-parent-generics.rs:15:21 + --> $DIR/references-parent-generics.rs:14:21 | LL | let x: T::Assoc<3>; | ^ -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr index 68ce17317f69f..ac25a4eae6250 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr +++ b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.nofeat.stderr @@ -1,5 +1,5 @@ error[E0770]: the type of const parameters must not depend on other generic parameters - --> $DIR/references-parent-generics.rs:7:25 + --> $DIR/references-parent-generics.rs:6:25 | LL | type Assoc; | ^^^^ the type must not depend on the parameter `Self` diff --git a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs index b91050d540c90..6eadb605f97ff 100644 --- a/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs +++ b/tests/ui/const-generics/generic_const_parameter_types/references-parent-generics.rs @@ -1,7 +1,6 @@ //@ revisions: feat nofeat #![cfg_attr(feat, feature(generic_const_parameter_types))] -//[feat]~^ WARN the feature `generic_const_parameter_types` is incomplete trait Foo { type Assoc; diff --git a/tests/ui/const-generics/mgca/struct-ctor-in-array-len.rs b/tests/ui/const-generics/mgca/struct-ctor-in-array-len.rs index 715caef38a9a0..c8288431c7ed4 100644 --- a/tests/ui/const-generics/mgca/struct-ctor-in-array-len.rs +++ b/tests/ui/const-generics/mgca/struct-ctor-in-array-len.rs @@ -6,7 +6,6 @@ // It should now produce a proper type error. #![feature(min_generic_const_args)] -//~^ WARN the feature `min_generic_const_args` is incomplete struct S; diff --git a/tests/ui/const-generics/mgca/struct-ctor-in-array-len.stderr b/tests/ui/const-generics/mgca/struct-ctor-in-array-len.stderr index baf587a856bcc..fcf02621ca9d9 100644 --- a/tests/ui/const-generics/mgca/struct-ctor-in-array-len.stderr +++ b/tests/ui/const-generics/mgca/struct-ctor-in-array-len.stderr @@ -1,19 +1,10 @@ -warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/struct-ctor-in-array-len.rs:8:12 - | -LL | #![feature(min_generic_const_args)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #132980 for more information - = note: `#[warn(incomplete_features)]` on by default - error: the constant `S` is not of type `usize` - --> $DIR/struct-ctor-in-array-len.rs:14:14 + --> $DIR/struct-ctor-in-array-len.rs:13:14 | LL | let _b = [0; S]; | ^^^^^^ expected `usize`, found `S` | = note: the length of array `[{integer}; S]` must be type `usize` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs index 1c3274f6a3764..4d96d236cf7fb 100644 --- a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs +++ b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.rs @@ -1,7 +1,6 @@ // Make sure we don't ICE when encountering an fn item during lowering in mGCA. #![feature(min_generic_const_args)] -//~^ WARN the feature `min_generic_const_args` is incomplete trait A {} diff --git a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr index 89fc8270e3e74..de64bf7b74c01 100644 --- a/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr +++ b/tests/ui/const-generics/mgca/unexpected-fn-item-in-array.stderr @@ -1,19 +1,10 @@ -warning: the feature `min_generic_const_args` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unexpected-fn-item-in-array.rs:3:12 - | -LL | #![feature(min_generic_const_args)] - | ^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #132980 for more information - = note: `#[warn(incomplete_features)]` on by default - error: the constant `fn_item` is not of type `usize` - --> $DIR/unexpected-fn-item-in-array.rs:8:6 + --> $DIR/unexpected-fn-item-in-array.rs:7:6 | LL | impl A<[usize; fn_item]> for () {} | ^^^^^^^^^^^^^^^^^^^ expected `usize`, found fn item | = note: the length of array `[usize; fn_item]` must be type `usize` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/const-generics/occurs-check/unify-fixpoint.rs b/tests/ui/const-generics/occurs-check/unify-fixpoint.rs index 02bc90988e2c0..950757efbd42d 100644 --- a/tests/ui/const-generics/occurs-check/unify-fixpoint.rs +++ b/tests/ui/const-generics/occurs-check/unify-fixpoint.rs @@ -4,8 +4,7 @@ //@ compile-flags: -Zunstable-options //@ check-pass -#![feature(generic_const_exprs)] //~ WARN the feature `generic_const_exprs` is incomplete - +#![feature(generic_const_exprs)] fn bind(value: [u8; N + 2]) -> [u8; N * 2] { todo!() diff --git a/tests/ui/const-generics/occurs-check/unify-fixpoint.stderr b/tests/ui/const-generics/occurs-check/unify-fixpoint.stderr deleted file mode 100644 index 8b63e8c55d5c9..0000000000000 --- a/tests/ui/const-generics/occurs-check/unify-fixpoint.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unify-fixpoint.rs:7:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/const-traits/mismatched_generic_args.rs b/tests/ui/traits/const-traits/mismatched_generic_args.rs index 21e91c731b363..409a704456802 100644 --- a/tests/ui/traits/const-traits/mismatched_generic_args.rs +++ b/tests/ui/traits/const-traits/mismatched_generic_args.rs @@ -1,5 +1,4 @@ #![feature(generic_const_exprs)] -//~^ WARN: the feature `generic_const_exprs` is incomplete // Regression test for #125770 which would ICE under the old effects desugaring that // created a const generic parameter for constness on `Add`. diff --git a/tests/ui/traits/const-traits/mismatched_generic_args.stderr b/tests/ui/traits/const-traits/mismatched_generic_args.stderr index e8103313dc4f6..3094cb5013308 100644 --- a/tests/ui/traits/const-traits/mismatched_generic_args.stderr +++ b/tests/ui/traits/const-traits/mismatched_generic_args.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find value `y` in this scope - --> $DIR/mismatched_generic_args.rs:20:9 + --> $DIR/mismatched_generic_args.rs:19:9 | LL | pub fn add(x: Quantity) -> Quantity { | - similarly named const parameter `U` defined here @@ -13,17 +13,8 @@ LL - x + y LL + x + U | -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/mismatched_generic_args.rs:1:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - error: `Dimension` is forbidden as the type of a const generic parameter - --> $DIR/mismatched_generic_args.rs:11:33 + --> $DIR/mismatched_generic_args.rs:10:33 | LL | pub struct Quantity(S); | ^^^^^^^^^ @@ -35,13 +26,13 @@ LL + #![feature(adt_const_params)] | error[E0107]: trait takes at most 1 generic argument but 2 generic arguments were supplied - --> $DIR/mismatched_generic_args.rs:14:36 + --> $DIR/mismatched_generic_args.rs:13:36 | LL | impl Add for Quantity {} | ^^^ expected at most 1 generic argument error: `Dimension` is forbidden as the type of a const generic parameter - --> $DIR/mismatched_generic_args.rs:14:15 + --> $DIR/mismatched_generic_args.rs:13:15 | LL | impl Add for Quantity {} | ^^^^^^^^^ @@ -53,7 +44,7 @@ LL + #![feature(adt_const_params)] | error: `Dimension` is forbidden as the type of a const generic parameter - --> $DIR/mismatched_generic_args.rs:18:21 + --> $DIR/mismatched_generic_args.rs:17:21 | LL | pub fn add(x: Quantity) -> Quantity { | ^^^^^^^^^ @@ -64,7 +55,7 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more LL + #![feature(adt_const_params)] | -error: aborting due to 5 previous errors; 1 warning emitted +error: aborting due to 5 previous errors Some errors have detailed explanations: E0107, E0425. For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/traits/const-traits/overlap-const-with-nonconst.min_spec.stderr b/tests/ui/traits/const-traits/overlap-const-with-nonconst.min_spec.stderr index a6bd8615d36d3..57bb5569c8ebb 100644 --- a/tests/ui/traits/const-traits/overlap-const-with-nonconst.min_spec.stderr +++ b/tests/ui/traits/const-traits/overlap-const-with-nonconst.min_spec.stderr @@ -1,5 +1,5 @@ error[E0119]: conflicting implementations of trait `Foo` for type `(_,)` - --> $DIR/overlap-const-with-nonconst.rs:21:1 + --> $DIR/overlap-const-with-nonconst.rs:20:1 | LL | / impl const Foo for T LL | | where diff --git a/tests/ui/traits/const-traits/overlap-const-with-nonconst.rs b/tests/ui/traits/const-traits/overlap-const-with-nonconst.rs index 10dfb200c6436..0e21d31a426ab 100644 --- a/tests/ui/traits/const-traits/overlap-const-with-nonconst.rs +++ b/tests/ui/traits/const-traits/overlap-const-with-nonconst.rs @@ -2,7 +2,6 @@ #![feature(const_trait_impl)] #![cfg_attr(spec, feature(specialization))] -//[spec]~^ WARN the feature `specialization` is incomplete #![cfg_attr(min_spec, feature(min_specialization))] const trait Bar {} diff --git a/tests/ui/traits/const-traits/overlap-const-with-nonconst.spec.stderr b/tests/ui/traits/const-traits/overlap-const-with-nonconst.spec.stderr index 91628f65fdcdd..57bb5569c8ebb 100644 --- a/tests/ui/traits/const-traits/overlap-const-with-nonconst.spec.stderr +++ b/tests/ui/traits/const-traits/overlap-const-with-nonconst.spec.stderr @@ -1,15 +1,5 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/overlap-const-with-nonconst.rs:4:27 - | -LL | #![cfg_attr(spec, feature(specialization))] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - error[E0119]: conflicting implementations of trait `Foo` for type `(_,)` - --> $DIR/overlap-const-with-nonconst.rs:21:1 + --> $DIR/overlap-const-with-nonconst.rs:20:1 | LL | / impl const Foo for T LL | | where @@ -19,6 +9,6 @@ LL | | T: [const] Bar, LL | impl Foo for (T,) { | ^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/negative-impls/negative-default-impls.rs b/tests/ui/traits/negative-impls/negative-default-impls.rs index c68bca432fa86..2d50bc83ec304 100644 --- a/tests/ui/traits/negative-impls/negative-default-impls.rs +++ b/tests/ui/traits/negative-impls/negative-default-impls.rs @@ -1,6 +1,5 @@ #![feature(negative_impls)] #![feature(specialization)] -//~^ WARN the feature `specialization` is incomplete trait MyTrait { type Foo; diff --git a/tests/ui/traits/negative-impls/negative-default-impls.stderr b/tests/ui/traits/negative-impls/negative-default-impls.stderr index 328e744a1e39b..b321898907d5a 100644 --- a/tests/ui/traits/negative-impls/negative-default-impls.stderr +++ b/tests/ui/traits/negative-impls/negative-default-impls.stderr @@ -1,19 +1,9 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/negative-default-impls.rs:2:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - error[E0750]: negative impls cannot be default impls - --> $DIR/negative-default-impls.rs:9:1 + --> $DIR/negative-default-impls.rs:8:1 | LL | default impl !MyTrait for u32 {} | ^^^^^^^ ^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0750`. diff --git a/tests/ui/traits/negative-impls/negative-specializes-negative.rs b/tests/ui/traits/negative-impls/negative-specializes-negative.rs index bb2856ae7e7ca..fe5165a12d1b6 100644 --- a/tests/ui/traits/negative-impls/negative-specializes-negative.rs +++ b/tests/ui/traits/negative-impls/negative-specializes-negative.rs @@ -1,4 +1,4 @@ -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete +#![feature(specialization)] #![feature(negative_impls)] // Test a negative impl that "specializes" another negative impl. diff --git a/tests/ui/traits/negative-impls/negative-specializes-negative.stderr b/tests/ui/traits/negative-impls/negative-specializes-negative.stderr deleted file mode 100644 index 751e29c3b236f..0000000000000 --- a/tests/ui/traits/negative-impls/negative-specializes-negative.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/negative-specializes-negative.rs:1:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/negative-impls/negative-specializes-positive-item.rs b/tests/ui/traits/negative-impls/negative-specializes-positive-item.rs index 4281eedaf631c..da22e43377f52 100644 --- a/tests/ui/traits/negative-impls/negative-specializes-positive-item.rs +++ b/tests/ui/traits/negative-impls/negative-specializes-positive-item.rs @@ -1,4 +1,4 @@ -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete +#![feature(specialization)] #![feature(negative_impls)] // Negative impl for u32 cannot "specialize" the base impl. diff --git a/tests/ui/traits/negative-impls/negative-specializes-positive-item.stderr b/tests/ui/traits/negative-impls/negative-specializes-positive-item.stderr index 97727da76f26a..e281969ac2e0e 100644 --- a/tests/ui/traits/negative-impls/negative-specializes-positive-item.stderr +++ b/tests/ui/traits/negative-impls/negative-specializes-positive-item.stderr @@ -1,13 +1,3 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/negative-specializes-positive-item.rs:1:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`: --> $DIR/negative-specializes-positive-item.rs:11:1 | @@ -17,6 +7,6 @@ LL | impl MyTrait for T { LL | impl !MyTrait for u32 {} | ^^^^^^^^^^^^^^^^^^^^^ negative implementation here -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0751`. diff --git a/tests/ui/traits/negative-impls/negative-specializes-positive.rs b/tests/ui/traits/negative-impls/negative-specializes-positive.rs index 0e227691e0404..1939a098b50ee 100644 --- a/tests/ui/traits/negative-impls/negative-specializes-positive.rs +++ b/tests/ui/traits/negative-impls/negative-specializes-positive.rs @@ -1,4 +1,4 @@ -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete +#![feature(specialization)] #![feature(negative_impls)] // Negative impl for u32 cannot "specialize" the base impl. diff --git a/tests/ui/traits/negative-impls/negative-specializes-positive.stderr b/tests/ui/traits/negative-impls/negative-specializes-positive.stderr index 100f97aba93c5..6eab4aaf20a50 100644 --- a/tests/ui/traits/negative-impls/negative-specializes-positive.stderr +++ b/tests/ui/traits/negative-impls/negative-specializes-positive.stderr @@ -1,13 +1,3 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/negative-specializes-positive.rs:1:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`: --> $DIR/negative-specializes-positive.rs:7:1 | @@ -16,6 +6,6 @@ LL | impl MyTrait for T {} LL | impl !MyTrait for u32 {} | ^^^^^^^^^^^^^^^^^^^^^ negative implementation here -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0751`. diff --git a/tests/ui/traits/negative-impls/positive-specializes-negative.rs b/tests/ui/traits/negative-impls/positive-specializes-negative.rs index a06b357654068..f2c5f507a4ebb 100644 --- a/tests/ui/traits/negative-impls/positive-specializes-negative.rs +++ b/tests/ui/traits/negative-impls/positive-specializes-negative.rs @@ -1,4 +1,4 @@ -#![feature(specialization)] //~ WARN the feature `specialization` is incomplete +#![feature(specialization)] #![feature(negative_impls)] trait MyTrait {} diff --git a/tests/ui/traits/negative-impls/positive-specializes-negative.stderr b/tests/ui/traits/negative-impls/positive-specializes-negative.stderr index 1655cb05019cc..7c3f5f6ef5c8c 100644 --- a/tests/ui/traits/negative-impls/positive-specializes-negative.stderr +++ b/tests/ui/traits/negative-impls/positive-specializes-negative.stderr @@ -1,13 +1,3 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/positive-specializes-negative.rs:1:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - error[E0751]: found both positive and negative implementation of trait `MyTrait` for type `u32`: --> $DIR/positive-specializes-negative.rs:7:1 | @@ -16,6 +6,6 @@ LL | impl !MyTrait for T {} LL | impl MyTrait for u32 {} | ^^^^^^^^^^^^^^^^^^^^ positive implementation here -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0751`. diff --git a/tests/ui/traits/next-solver/coherence/negative-coherence-bounds.rs b/tests/ui/traits/next-solver/coherence/negative-coherence-bounds.rs index d98cd1147efec..327f731d7e91b 100644 --- a/tests/ui/traits/next-solver/coherence/negative-coherence-bounds.rs +++ b/tests/ui/traits/next-solver/coherence/negative-coherence-bounds.rs @@ -10,7 +10,6 @@ // which is provided by the first impl that it is specializing. #![feature(specialization)] -//~^ WARN the feature `specialization` is incomplete #![feature(with_negative_coherence)] trait BoxIter { diff --git a/tests/ui/traits/next-solver/coherence/negative-coherence-bounds.stderr b/tests/ui/traits/next-solver/coherence/negative-coherence-bounds.stderr deleted file mode 100644 index 4127f51f56da2..0000000000000 --- a/tests/ui/traits/next-solver/coherence/negative-coherence-bounds.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/negative-coherence-bounds.rs:12:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.rs b/tests/ui/traits/next-solver/issue-118950-root-region.rs index 84e2f4c94386d..7a4cd2aaa1f11 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.rs +++ b/tests/ui/traits/next-solver/issue-118950-root-region.rs @@ -3,7 +3,6 @@ // This is a gnarly test but I don't know how to minimize it, frankly. #![feature(lazy_type_alias)] -//~^ WARN the feature `lazy_type_alias` is incomplete trait ToUnit<'a> { type Unit; diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr index 74cbb5be02b37..5516f1e36089a 100644 --- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr +++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr @@ -1,32 +1,23 @@ error[E0425]: cannot find type `Missing` in this scope - --> $DIR/issue-118950-root-region.rs:19:55 + --> $DIR/issue-118950-root-region.rs:18:55 | LL | impl Overlap fn(Assoc<'a, T>)> for T where Missing: Overlap {} | ^^^^^^^ not found in this scope -warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/issue-118950-root-region.rs:5:12 - | -LL | #![feature(lazy_type_alias)] - | ^^^^^^^^^^^^^^^ - | - = note: see issue #112792 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `*const T: ToUnit<'a>` is not satisfied - --> $DIR/issue-118950-root-region.rs:14:1 + --> $DIR/issue-118950-root-region.rs:13:1 | LL | type Assoc<'a, T> = <*const T as ToUnit<'a>>::Unit; | ^^^^^^^^^^^^^^^^^ the trait `ToUnit<'a>` is not implemented for `*const T` | help: this trait has no implementations, consider adding one - --> $DIR/issue-118950-root-region.rs:8:1 + --> $DIR/issue-118950-root-region.rs:7:1 | LL | trait ToUnit<'a> { | ^^^^^^^^^^^^^^^^ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a)), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. } -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors Some errors have detailed explanations: E0277, E0425. For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.current.stderr b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.current.stderr deleted file mode 100644 index ef636811fd57b..0000000000000 --- a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/normalize-self-type-constrains-trait-args.rs:8:12 - | -LL | #![feature(lazy_type_alias)] - | ^^^^^^^^^^^^^^^ - | - = note: see issue #112792 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.next.stderr b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.next.stderr deleted file mode 100644 index ef636811fd57b..0000000000000 --- a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.next.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/normalize-self-type-constrains-trait-args.rs:8:12 - | -LL | #![feature(lazy_type_alias)] - | ^^^^^^^^^^^^^^^ - | - = note: see issue #112792 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs index c2a0167134639..921d753fe2a1e 100644 --- a/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs +++ b/tests/ui/traits/next-solver/normalize/normalize-self-type-constrains-trait-args.rs @@ -6,7 +6,6 @@ // This goal is also possible w/ a GAT, but lazy_type_alias // makes the behavior a bit more readable. #![feature(lazy_type_alias)] -//~^ WARN the feature `lazy_type_alias` is incomplete struct Wr(T); trait Foo {} diff --git a/tests/ui/traits/next-solver/specialization-transmute.rs b/tests/ui/traits/next-solver/specialization-transmute.rs index f1447cd6a9e2e..ba8b49c9c4c26 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.rs +++ b/tests/ui/traits/next-solver/specialization-transmute.rs @@ -1,6 +1,5 @@ //@ compile-flags: -Znext-solver #![feature(specialization)] -//~^ WARN the feature `specialization` is incomplete trait Default { type Id; diff --git a/tests/ui/traits/next-solver/specialization-transmute.stderr b/tests/ui/traits/next-solver/specialization-transmute.stderr index 8bd290ea19707..bdc03e5e1bf9a 100644 --- a/tests/ui/traits/next-solver/specialization-transmute.stderr +++ b/tests/ui/traits/next-solver/specialization-transmute.stderr @@ -1,15 +1,5 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/specialization-transmute.rs:2:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - error[E0308]: mismatched types - --> $DIR/specialization-transmute.rs:14:9 + --> $DIR/specialization-transmute.rs:13:9 | LL | fn intu(&self) -> &Self::Id { | --------- expected `&::Id` because of return type @@ -20,7 +10,7 @@ LL | self found reference `&T` error[E0271]: type mismatch resolving `::Id == Option>` - --> $DIR/specialization-transmute.rs:25:50 + --> $DIR/specialization-transmute.rs:24:50 | LL | let s = transmute::>>(0); | ------------------------------------ ^ types differ @@ -28,12 +18,12 @@ LL | let s = transmute::>>(0); | required by a bound introduced by this call | note: required by a bound in `transmute` - --> $DIR/specialization-transmute.rs:18:25 + --> $DIR/specialization-transmute.rs:17:25 | LL | fn transmute, U: Copy>(t: T) -> U { | ^^^^^^ required by this bound in `transmute` -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors Some errors have detailed explanations: E0271, E0308. For more information about an error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/next-solver/specialization-unconstrained.rs b/tests/ui/traits/next-solver/specialization-unconstrained.rs index 6835c0764d6c8..27f6d00111a9b 100644 --- a/tests/ui/traits/next-solver/specialization-unconstrained.rs +++ b/tests/ui/traits/next-solver/specialization-unconstrained.rs @@ -1,7 +1,6 @@ //@ compile-flags: -Znext-solver #![feature(specialization)] -//~^ WARN the feature `specialization` is incomplete // Do not treat the RHS of a projection-goal as an unconstrained `Certainty::Yes` response // if the impl is still further specializable. diff --git a/tests/ui/traits/next-solver/specialization-unconstrained.stderr b/tests/ui/traits/next-solver/specialization-unconstrained.stderr index 1bcf5eddb5bca..3e3638143873c 100644 --- a/tests/ui/traits/next-solver/specialization-unconstrained.stderr +++ b/tests/ui/traits/next-solver/specialization-unconstrained.stderr @@ -1,25 +1,15 @@ -warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/specialization-unconstrained.rs:3:12 - | -LL | #![feature(specialization)] - | ^^^^^^^^^^^^^^ - | - = note: see issue #31844 for more information - = help: consider using `min_specialization` instead, which is more stable and complete - = note: `#[warn(incomplete_features)]` on by default - error[E0271]: type mismatch resolving `::Id == ()` - --> $DIR/specialization-unconstrained.rs:20:12 + --> $DIR/specialization-unconstrained.rs:19:12 | LL | test::(); | ^^^ types differ | note: required by a bound in `test` - --> $DIR/specialization-unconstrained.rs:17:20 + --> $DIR/specialization-unconstrained.rs:16:20 | LL | fn test, U>() {} | ^^^^^^ required by this bound in `test` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0271`. diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr deleted file mode 100644 index 5393db6b10549..0000000000000 --- a/tests/ui/traits/non-lifetime-via-dyn-builtin.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/non-lifetime-via-dyn-builtin.rs:6:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr b/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr deleted file mode 100644 index 5393db6b10549..0000000000000 --- a/tests/ui/traits/non-lifetime-via-dyn-builtin.next.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/non-lifetime-via-dyn-builtin.rs:6:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non-lifetime-via-dyn-builtin.rs b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs index ac61f8b614c47..00bf23725eb20 100644 --- a/tests/ui/traits/non-lifetime-via-dyn-builtin.rs +++ b/tests/ui/traits/non-lifetime-via-dyn-builtin.rs @@ -4,7 +4,6 @@ //@ check-pass #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete and may not be safe fn trivial() where diff --git a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs index 506cad25f630c..9d792ad575e42 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs +++ b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete fn foo() where for T: Copy {} diff --git a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr index 4694e7da500f3..f77d562dbcf26 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr +++ b/tests/ui/traits/non_lifetime_binders/bad-copy-cond.stderr @@ -1,24 +1,15 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-copy-cond.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `T: Copy` is not satisfied - --> $DIR/bad-copy-cond.rs:7:5 + --> $DIR/bad-copy-cond.rs:6:5 | LL | foo(); | ^^^^^ the trait `Copy` is not implemented for `T` | note: required by a bound in `foo` - --> $DIR/bad-copy-cond.rs:4:26 + --> $DIR/bad-copy-cond.rs:3:26 | LL | fn foo() where for T: Copy {} | ^^^^ required by this bound in `foo` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs index dfc800c8e7e12..244ac2f9c0052 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs +++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN is incomplete and may not be safe pub fn foo() where diff --git a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr index f4deb169516cf..0b3aa5c904f9c 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr +++ b/tests/ui/traits/non_lifetime_binders/bad-sized-cond.stderr @@ -1,21 +1,12 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-sized-cond.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the size for values of type `V` cannot be known at compilation time - --> $DIR/bad-sized-cond.rs:17:5 + --> $DIR/bad-sized-cond.rs:16:5 | LL | foo(); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `V` note: required by a bound in `foo` - --> $DIR/bad-sized-cond.rs:6:15 + --> $DIR/bad-sized-cond.rs:5:15 | LL | pub fn foo() | --- required by a bound in this function @@ -24,7 +15,7 @@ LL | for V: Sized, | ^^^^^ required by this bound in `foo` error[E0277]: `V` is not an iterator - --> $DIR/bad-sized-cond.rs:20:5 + --> $DIR/bad-sized-cond.rs:19:5 | LL | bar(); | ^^^^^ `V` is not an iterator @@ -32,7 +23,7 @@ LL | bar(); = help: the trait `Iterator` is not implemented for `V` = note: required for `V` to implement `IntoIterator` note: required by a bound in `bar` - --> $DIR/bad-sized-cond.rs:12:15 + --> $DIR/bad-sized-cond.rs:11:15 | LL | pub fn bar() | --- required by a bound in this function @@ -41,7 +32,7 @@ LL | for V: IntoIterator, | ^^^^^^^^^^^^ required by this bound in `bar` error[E0277]: the size for values of type `V` cannot be known at compilation time - --> $DIR/bad-sized-cond.rs:20:5 + --> $DIR/bad-sized-cond.rs:19:5 | LL | bar(); | ^^^^^ doesn't have a size known at compile-time @@ -49,7 +40,7 @@ LL | bar(); = help: the trait `Sized` is not implemented for `V` = note: required for `V` to implement `IntoIterator` note: required by a bound in `bar` - --> $DIR/bad-sized-cond.rs:12:15 + --> $DIR/bad-sized-cond.rs:11:15 | LL | pub fn bar() | --- required by a bound in this function @@ -57,6 +48,6 @@ LL | where LL | for V: IntoIterator, | ^^^^^^^^^^^^ required by this bound in `bar` -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.rs b/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.rs index b61a21eab419c..8ad2ecf8271ac 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.rs +++ b/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.rs @@ -1,7 +1,5 @@ #![feature(generic_const_exprs)] -//~^ WARN the feature `generic_const_exprs` is incomplete #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete // Test for , // which originally relied on associated_type_bounds, but was diff --git a/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.stderr b/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.stderr index e891df3f0c092..0f0d2af50ba84 100644 --- a/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.stderr +++ b/tests/ui/traits/non_lifetime_binders/bad-suggestion-on-missing-assoc.stderr @@ -1,40 +1,23 @@ error: late-bound const parameters cannot be used currently - --> $DIR/bad-suggestion-on-missing-assoc.rs:20:15 + --> $DIR/bad-suggestion-on-missing-assoc.rs:18:15 | LL | for T: TraitA>, | ^ -warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-suggestion-on-missing-assoc.rs:1:12 - | -LL | #![feature(generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/bad-suggestion-on-missing-assoc.rs:3:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - error: defaults for generic parameters are not allowed in `for<...>` binders - --> $DIR/bad-suggestion-on-missing-assoc.rs:20:9 + --> $DIR/bad-suggestion-on-missing-assoc.rs:18:9 | LL | for T: TraitA>, | ^^^^^^^^^^^^^^^^^^^^^^ error[E0562]: `impl Trait` is not allowed in bounds - --> $DIR/bad-suggestion-on-missing-assoc.rs:20:49 + --> $DIR/bad-suggestion-on-missing-assoc.rs:18:49 | LL | for T: TraitA>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `impl Trait` is only allowed in arguments and return types of functions and methods -error: aborting due to 3 previous errors; 2 warnings emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0562`. diff --git a/tests/ui/traits/non_lifetime_binders/basic.rs b/tests/ui/traits/non_lifetime_binders/basic.rs index 09c0244ec9540..893bfd87715f0 100644 --- a/tests/ui/traits/non_lifetime_binders/basic.rs +++ b/tests/ui/traits/non_lifetime_binders/basic.rs @@ -3,7 +3,6 @@ #![feature(sized_hierarchy)] #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete use std::marker::PointeeSized; diff --git a/tests/ui/traits/non_lifetime_binders/basic.stderr b/tests/ui/traits/non_lifetime_binders/basic.stderr deleted file mode 100644 index 9f2df2238d15f..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/basic.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/basic.rs:5:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs index 13f9f196970c5..894f11ce5faf2 100644 --- a/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete pub fn bar() where diff --git a/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr index 608e8136d2a82..7383a554bcf3a 100644 --- a/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-112547.stderr @@ -1,5 +1,5 @@ error[E0425]: cannot find type `V` in this scope - --> $DIR/binder-defaults-112547.rs:10:4 + --> $DIR/binder-defaults-112547.rs:9:4 | LL | }> V: IntoIterator | ^ not found in this scope @@ -10,22 +10,13 @@ LL | pub fn bar() | +++ error: late-bound const parameters cannot be used currently - --> $DIR/binder-defaults-112547.rs:6:15 + --> $DIR/binder-defaults-112547.rs:5:15 | LL | for $DIR/binder-defaults-112547.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error: defaults for generic parameters are not allowed in `for<...>` binders - --> $DIR/binder-defaults-112547.rs:6:9 + --> $DIR/binder-defaults-112547.rs:5:9 | LL | for V: IntoIterator | |_^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs index bdfe41ca11b04..509bdfc0821bc 100644 --- a/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.rs @@ -1,6 +1,4 @@ #![feature(non_lifetime_binders, generic_const_exprs)] -//~^ WARN the feature `non_lifetime_binders` is incomplete -//~| WARN the feature `generic_const_exprs` is incomplete fn fun() where diff --git a/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr index 947dd3a73bf12..4fb7c26fc2661 100644 --- a/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr +++ b/tests/ui/traits/non_lifetime_binders/binder-defaults-119489.stderr @@ -1,37 +1,20 @@ error: late-bound const parameters cannot be used currently - --> $DIR/binder-defaults-119489.rs:7:23 + --> $DIR/binder-defaults-119489.rs:5:23 | LL | for ():, | ^ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/binder-defaults-119489.rs:1:12 - | -LL | #![feature(non_lifetime_binders, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 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/binder-defaults-119489.rs:1:34 - | -LL | #![feature(non_lifetime_binders, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - error: defaults for generic parameters are not allowed in `for<...>` binders - --> $DIR/binder-defaults-119489.rs:7:9 + --> $DIR/binder-defaults-119489.rs:5:9 | LL | for ():, | ^^^^^^ error: defaults for generic parameters are not allowed in `for<...>` binders - --> $DIR/binder-defaults-119489.rs:7:17 + --> $DIR/binder-defaults-119489.rs:5:17 | LL | for ():, | ^^^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors; 2 warnings emitted +error: aborting due to 3 previous errors diff --git a/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.rs b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.rs index 22044c2e66279..a2a926e2c27d6 100644 --- a/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.rs +++ b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.rs @@ -3,7 +3,6 @@ #![feature(sized_hierarchy)] #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete use std::marker::PointeeSized; diff --git a/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.stderr b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.stderr index 8270fbeef0f6f..0277abf52d352 100644 --- a/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.stderr +++ b/tests/ui/traits/non_lifetime_binders/diagnostic-hir-wf-check.stderr @@ -1,31 +1,22 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/diagnostic-hir-wf-check.rs:5:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `(): B` is not satisfied - --> $DIR/diagnostic-hir-wf-check.rs:16:12 + --> $DIR/diagnostic-hir-wf-check.rs:15:12 | LL | fn b() -> (W<()>, impl for A) { (W(()), ()) } | ^^^^^ the trait `B` is not implemented for `()` | help: this trait has no implementations, consider adding one - --> $DIR/diagnostic-hir-wf-check.rs:13:1 + --> $DIR/diagnostic-hir-wf-check.rs:12:1 | LL | trait B {} | ^^^^^^^ note: required by a bound in `W` - --> $DIR/diagnostic-hir-wf-check.rs:14:13 + --> $DIR/diagnostic-hir-wf-check.rs:13:13 | LL | struct W(T); | ^ required by this bound in `W` error[E0277]: the trait bound `(): B` is not satisfied - --> $DIR/diagnostic-hir-wf-check.rs:16:42 + --> $DIR/diagnostic-hir-wf-check.rs:15:42 | LL | fn b() -> (W<()>, impl for A) { (W(()), ()) } | - ^^ the trait `B` is not implemented for `()` @@ -33,33 +24,33 @@ LL | fn b() -> (W<()>, impl for A) { (W(()), ()) } | required by a bound introduced by this call | help: this trait has no implementations, consider adding one - --> $DIR/diagnostic-hir-wf-check.rs:13:1 + --> $DIR/diagnostic-hir-wf-check.rs:12:1 | LL | trait B {} | ^^^^^^^ note: required by a bound in `W` - --> $DIR/diagnostic-hir-wf-check.rs:14:13 + --> $DIR/diagnostic-hir-wf-check.rs:13:13 | LL | struct W(T); | ^ required by this bound in `W` error[E0277]: the trait bound `(): B` is not satisfied - --> $DIR/diagnostic-hir-wf-check.rs:16:40 + --> $DIR/diagnostic-hir-wf-check.rs:15:40 | LL | fn b() -> (W<()>, impl for A) { (W(()), ()) } | ^^^^^ the trait `B` is not implemented for `()` | help: this trait has no implementations, consider adding one - --> $DIR/diagnostic-hir-wf-check.rs:13:1 + --> $DIR/diagnostic-hir-wf-check.rs:12:1 | LL | trait B {} | ^^^^^^^ note: required by a bound in `W` - --> $DIR/diagnostic-hir-wf-check.rs:14:13 + --> $DIR/diagnostic-hir-wf-check.rs:13:13 | LL | struct W(T); | ^ required by this bound in `W` -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr b/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr index 1f13207e33ca3..9a4d36a02f312 100644 --- a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr +++ b/tests/ui/traits/non_lifetime_binders/drop-impl-pred.no.stderr @@ -1,24 +1,15 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/drop-impl-pred.rs:6:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0367]: `Drop` impl requires `H: Foo` but the struct it is implemented for does not - --> $DIR/drop-impl-pred.rs:19:15 + --> $DIR/drop-impl-pred.rs:18:15 | LL | for H: Foo, | ^^^ | note: the implementor must specify the same requirement - --> $DIR/drop-impl-pred.rs:12:1 + --> $DIR/drop-impl-pred.rs:11:1 | LL | struct Bar(T) where T: Foo; | ^^^^^^^^^^^^^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0367`. diff --git a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.rs b/tests/ui/traits/non_lifetime_binders/drop-impl-pred.rs index db8f3de2149d4..3444f10672833 100644 --- a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.rs +++ b/tests/ui/traits/non_lifetime_binders/drop-impl-pred.rs @@ -4,7 +4,6 @@ // Issue 110557 #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete pub trait Foo {} diff --git a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.yes.stderr b/tests/ui/traits/non_lifetime_binders/drop-impl-pred.yes.stderr deleted file mode 100644 index 165cf2ee13da8..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/drop-impl-pred.yes.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/drop-impl-pred.rs:6:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/fail.rs b/tests/ui/traits/non_lifetime_binders/fail.rs index 460f68907e889..7d916c422756c 100644 --- a/tests/ui/traits/non_lifetime_binders/fail.rs +++ b/tests/ui/traits/non_lifetime_binders/fail.rs @@ -1,7 +1,6 @@ // Error reporting for where `for T: Trait` doesn't hold #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete trait Trait {} diff --git a/tests/ui/traits/non_lifetime_binders/fail.stderr b/tests/ui/traits/non_lifetime_binders/fail.stderr index 9a324c952931e..38a0eabddd3bb 100644 --- a/tests/ui/traits/non_lifetime_binders/fail.stderr +++ b/tests/ui/traits/non_lifetime_binders/fail.stderr @@ -1,25 +1,16 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/fail.rs:3:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `T: Trait` is not satisfied - --> $DIR/fail.rs:19:5 + --> $DIR/fail.rs:18:5 | LL | fail(); | ^^^^^^ the trait `Trait` is not implemented for `T` | help: this trait has no implementations, consider adding one - --> $DIR/fail.rs:6:1 + --> $DIR/fail.rs:5:1 | LL | trait Trait {} | ^^^^^^^^^^^ note: required by a bound in `fail` - --> $DIR/fail.rs:10:15 + --> $DIR/fail.rs:9:15 | LL | fn fail() | ---- required by a bound in this function @@ -28,14 +19,14 @@ LL | for T: Trait, | ^^^^^ required by this bound in `fail` error[E0277]: `T` cannot be sent between threads safely - --> $DIR/fail.rs:21:5 + --> $DIR/fail.rs:20:5 | LL | auto_trait(); | ^^^^^^^^^^^^ `T` cannot be sent between threads safely | = help: the trait `Send` is not implemented for `T` note: required by a bound in `auto_trait` - --> $DIR/fail.rs:15:15 + --> $DIR/fail.rs:14:15 | LL | fn auto_trait() | ---------- required by a bound in this function @@ -43,6 +34,6 @@ LL | where LL | for T: Send, | ^^^^ required by this bound in `auto_trait` -error: aborting due to 2 previous errors; 1 warning emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.rs b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.rs index 96a7424f0dc9c..0c4347b2e4b31 100644 --- a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.rs +++ b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete fn auto_trait() where diff --git a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr index abbdecf2fe1db..b621f5c612dee 100644 --- a/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr +++ b/tests/ui/traits/non_lifetime_binders/foreach-partial-eq.stderr @@ -1,21 +1,12 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/foreach-partial-eq.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: can't compare `T` with `T` - --> $DIR/foreach-partial-eq.rs:10:5 + --> $DIR/foreach-partial-eq.rs:9:5 | LL | auto_trait(); | ^^^^^^^^^^^^ no implementation for `T < T` and `T > T` | = help: the trait `PartialOrd` is not implemented for `T` note: required by a bound in `auto_trait` - --> $DIR/foreach-partial-eq.rs:6:27 + --> $DIR/foreach-partial-eq.rs:5:27 | LL | fn auto_trait() | ---------- required by a bound in this function @@ -23,6 +14,6 @@ LL | where LL | for T: PartialEq + PartialOrd, | ^^^^^^^^^^ required by this bound in `auto_trait` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs index 94733f88c2dae..e8b7139e82eaa 100644 --- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs +++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.rs @@ -1,6 +1,4 @@ #![feature(non_lifetime_binders, generic_const_exprs)] -//~^ WARN the feature `non_lifetime_binders` is incomplete -//~| WARN the feature `generic_const_exprs` is incomplete fn foo() -> usize where diff --git a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr index cc482887c8144..cd8bc33ec313d 100644 --- a/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr +++ b/tests/ui/traits/non_lifetime_binders/late-bound-in-anon-ct.stderr @@ -1,27 +1,10 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/late-bound-in-anon-ct.rs:1:12 - | -LL | #![feature(non_lifetime_binders, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 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/late-bound-in-anon-ct.rs:1:34 - | -LL | #![feature(non_lifetime_binders, generic_const_exprs)] - | ^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #76560 for more information - error: cannot capture late-bound type parameter in constant - --> $DIR/late-bound-in-anon-ct.rs:7:27 + --> $DIR/late-bound-in-anon-ct.rs:5:27 | LL | for [i32; { let _: T = todo!(); 0 }]:, | - ^ | | | parameter defined here -error: aborting due to 1 previous error; 2 warnings emitted +error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/late-const-param-wf.rs b/tests/ui/traits/non_lifetime_binders/late-const-param-wf.rs index 2d44388f875f9..75117e10bc982 100644 --- a/tests/ui/traits/non_lifetime_binders/late-const-param-wf.rs +++ b/tests/ui/traits/non_lifetime_binders/late-const-param-wf.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete fn b() where diff --git a/tests/ui/traits/non_lifetime_binders/late-const-param-wf.stderr b/tests/ui/traits/non_lifetime_binders/late-const-param-wf.stderr index 136d533a03c40..98558dc74dc24 100644 --- a/tests/ui/traits/non_lifetime_binders/late-const-param-wf.stderr +++ b/tests/ui/traits/non_lifetime_binders/late-const-param-wf.stderr @@ -1,17 +1,8 @@ error: late-bound const parameters cannot be used currently - --> $DIR/late-const-param-wf.rs:6:15 + --> $DIR/late-const-param-wf.rs:5:15 | LL | for [(); C]: Copy, | ^ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/late-const-param-wf.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/method-probe.rs b/tests/ui/traits/non_lifetime_binders/method-probe.rs index 5f8e31446f523..3d162524e9505 100644 --- a/tests/ui/traits/non_lifetime_binders/method-probe.rs +++ b/tests/ui/traits/non_lifetime_binders/method-probe.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete trait Foo: for Bar {} diff --git a/tests/ui/traits/non_lifetime_binders/method-probe.stderr b/tests/ui/traits/non_lifetime_binders/method-probe.stderr deleted file mode 100644 index 8f61792e6ce7f..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/method-probe.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/method-probe.rs:3:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs index 50f0152e904f4..1e645f3e32d2f 100644 --- a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs +++ b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete fn f() where diff --git a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr index 02295307cb22a..4de30e77d46b3 100644 --- a/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr +++ b/tests/ui/traits/non_lifetime_binders/missing-assoc-item.stderr @@ -1,14 +1,5 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/missing-assoc-item.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0223]: ambiguous associated type - --> $DIR/missing-assoc-item.rs:6:12 + --> $DIR/missing-assoc-item.rs:5:12 | LL | for B::Item: Send, | ^^^^^^^ @@ -19,6 +10,6 @@ LL - for B::Item: Send, LL + for ::Item: Send, | -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.rs b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.rs index e9ae00df7a09e..e5ab8d6bc638a 100644 --- a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.rs +++ b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete trait Trait { type Assoc; diff --git a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr index 8304469150911..12eb6c3406c3f 100644 --- a/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr +++ b/tests/ui/traits/non_lifetime_binders/nested-apit-mentioning-outer-bound-var.stderr @@ -1,17 +1,8 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/nested-apit-mentioning-outer-bound-var.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error: `impl Trait` can only mention type parameters from an fn or impl - --> $DIR/nested-apit-mentioning-outer-bound-var.rs:8:52 + --> $DIR/nested-apit-mentioning-outer-bound-var.rs:7:52 | LL | fn uwu(_: impl for Trait<(), Assoc = impl Trait>) {} | - type parameter declared here ^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs b/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs index e776d5f2f21ad..4ccf4dbd20f84 100644 --- a/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs +++ b/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.rs @@ -2,6 +2,5 @@ //@ compile-flags: --crate-type=lib #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete pub fn f() where for (T, U): Copy {} diff --git a/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.stderr b/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.stderr deleted file mode 100644 index 667575b72d4cb..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/object-lifetime-default-for-late.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/object-lifetime-default-for-late.rs:4:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/on-dyn.rs b/tests/ui/traits/non_lifetime_binders/on-dyn.rs index 8fb7dd27605f9..a081974ca8e68 100644 --- a/tests/ui/traits/non_lifetime_binders/on-dyn.rs +++ b/tests/ui/traits/non_lifetime_binders/on-dyn.rs @@ -1,7 +1,6 @@ // Tests to make sure that we reject polymorphic dyn trait. #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete trait Test {} diff --git a/tests/ui/traits/non_lifetime_binders/on-dyn.stderr b/tests/ui/traits/non_lifetime_binders/on-dyn.stderr index 2d330f6b14334..8d7cb51c034c6 100644 --- a/tests/ui/traits/non_lifetime_binders/on-dyn.stderr +++ b/tests/ui/traits/non_lifetime_binders/on-dyn.stderr @@ -1,17 +1,8 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/on-dyn.rs:3:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error: late-bound type parameter not allowed on trait object types - --> $DIR/on-dyn.rs:8:30 + --> $DIR/on-dyn.rs:7:30 | LL | fn foo() -> &'static dyn for Test { | ^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/on-ptr.rs b/tests/ui/traits/non_lifetime_binders/on-ptr.rs index 0aaff52b6d8cd..96c155a13f3bd 100644 --- a/tests/ui/traits/non_lifetime_binders/on-ptr.rs +++ b/tests/ui/traits/non_lifetime_binders/on-ptr.rs @@ -1,7 +1,6 @@ // Tests to make sure that we reject polymorphic fn ptrs. #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete fn foo() -> for fn(T) { //~^ ERROR late-bound type parameter not allowed on function pointer types diff --git a/tests/ui/traits/non_lifetime_binders/on-ptr.stderr b/tests/ui/traits/non_lifetime_binders/on-ptr.stderr index fbd723a1ba6bf..680df6ddd0ae1 100644 --- a/tests/ui/traits/non_lifetime_binders/on-ptr.stderr +++ b/tests/ui/traits/non_lifetime_binders/on-ptr.stderr @@ -1,17 +1,8 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/on-ptr.rs:3:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error: late-bound type parameter not allowed on function pointer types - --> $DIR/on-ptr.rs:6:17 + --> $DIR/on-ptr.rs:5:17 | LL | fn foo() -> for fn(T) { | ^ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.rs b/tests/ui/traits/non_lifetime_binders/on-rpit.rs index 1364f63a37336..092f838945ae1 100644 --- a/tests/ui/traits/non_lifetime_binders/on-rpit.rs +++ b/tests/ui/traits/non_lifetime_binders/on-rpit.rs @@ -2,7 +2,6 @@ #![feature(sized_hierarchy)] #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete use std::marker::PointeeSized; diff --git a/tests/ui/traits/non_lifetime_binders/on-rpit.stderr b/tests/ui/traits/non_lifetime_binders/on-rpit.stderr deleted file mode 100644 index c8396c3854844..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/on-rpit.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/on-rpit.rs:4:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr index d51927aaa3423..f8de7c7d9ebee 100644 --- a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr +++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr @@ -1,14 +1,5 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/placeholders-dont-outlive-static.rs:6:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0310]: the placeholder type `T` may not live long enough - --> $DIR/placeholders-dont-outlive-static.rs:13:5 + --> $DIR/placeholders-dont-outlive-static.rs:12:5 | LL | foo(); | ^^^^^ @@ -21,6 +12,6 @@ help: consider adding an explicit lifetime bound LL | fn bad() where T: 'static { | ++++++++++++++++ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr index bc1a19923997d..cc76a8ea0c5cb 100644 --- a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr +++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr @@ -1,14 +1,5 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/placeholders-dont-outlive-static.rs:6:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0310]: the placeholder type `T` may not live long enough - --> $DIR/placeholders-dont-outlive-static.rs:19:5 + --> $DIR/placeholders-dont-outlive-static.rs:18:5 | LL | foo(); | ^^^^^ @@ -21,6 +12,6 @@ help: consider adding an explicit lifetime bound LL | fn good() where for T: 'static, T: 'static { | ++++++++++++ -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0310`. diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs index 3133d6aeedce5..ca39eb66ed269 100644 --- a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs +++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs @@ -4,7 +4,6 @@ // `for T: 'static` doesn't imply itself when processing outlives obligations #![feature(non_lifetime_binders)] -//[bad]~^ WARN the feature `non_lifetime_binders` is incomplete fn foo() where for T: 'static {} diff --git a/tests/ui/traits/non_lifetime_binders/shadowed.rs b/tests/ui/traits/non_lifetime_binders/shadowed.rs index 1c480e3940b89..ff8d3f7ebb2f3 100644 --- a/tests/ui/traits/non_lifetime_binders/shadowed.rs +++ b/tests/ui/traits/non_lifetime_binders/shadowed.rs @@ -1,5 +1,4 @@ #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete fn function() where for (): Sized {} //~^ ERROR the name `T` is already used for a generic parameter diff --git a/tests/ui/traits/non_lifetime_binders/shadowed.stderr b/tests/ui/traits/non_lifetime_binders/shadowed.stderr index 59a073aefc961..982bd93f5cf12 100644 --- a/tests/ui/traits/non_lifetime_binders/shadowed.stderr +++ b/tests/ui/traits/non_lifetime_binders/shadowed.stderr @@ -1,5 +1,5 @@ error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/shadowed.rs:4:28 + --> $DIR/shadowed.rs:3:28 | LL | fn function() where for (): Sized {} | - ^ already used @@ -7,7 +7,7 @@ LL | fn function() where for (): Sized {} | first use of `T` error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/shadowed.rs:7:31 + --> $DIR/shadowed.rs:6:31 | LL | struct Struct(T) where for (): Sized; | - ^ already used @@ -15,7 +15,7 @@ LL | struct Struct(T) where for (): Sized; | first use of `T` error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/shadowed.rs:11:27 + --> $DIR/shadowed.rs:10:27 | LL | impl Struct { | - first use of `T` @@ -23,22 +23,13 @@ LL | fn method() where for (): Sized {} | ^ already used error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/shadowed.rs:15:28 + --> $DIR/shadowed.rs:14:28 | LL | fn repeated() where for (): Sized {} | - ^ already used | | | first use of `T` -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/shadowed.rs:1:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -error: aborting due to 4 previous errors; 1 warning emitted +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0403`. diff --git a/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs b/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs index e4c3b4d2c7886..981edc722ea5f 100644 --- a/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs +++ b/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.rs @@ -1,7 +1,6 @@ //@ check-pass #![feature(non_lifetime_binders)] -//~^ WARN is incomplete and may not be safe pub fn foo() where diff --git a/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr b/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr deleted file mode 100644 index e75d81270529e..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/sized-late-bound-issue-114872.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/sized-late-bound-issue-114872.rs:3:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.rs b/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.rs index aab5479334e4e..3ef1201b523fc 100644 --- a/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.rs +++ b/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.rs @@ -1,6 +1,5 @@ #![feature(sized_hierarchy)] #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete use std::marker::PointeeSized; diff --git a/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr b/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr index b32915ff549fa..f1182788a6fd8 100644 --- a/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr +++ b/tests/ui/traits/non_lifetime_binders/supertrait-dyn-compatibility.stderr @@ -1,21 +1,12 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/supertrait-dyn-compatibility.rs:2:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0038]: the trait `Foo` is not dyn compatible - --> $DIR/supertrait-dyn-compatibility.rs:22:17 + --> $DIR/supertrait-dyn-compatibility.rs:21:17 | LL | let x: &dyn Foo = &(); | ^^^ `Foo` is not dyn compatible | note: for a trait to be dyn compatible it needs to allow building a vtable for more information, visit - --> $DIR/supertrait-dyn-compatibility.rs:7:12 + --> $DIR/supertrait-dyn-compatibility.rs:6:12 | LL | trait Foo: for Bar {} | --- ^^^^^^^^^^^^^ ...because where clause cannot reference non-lifetime `for<...>` variables @@ -23,6 +14,6 @@ LL | trait Foo: for Bar {} | this trait is not dyn compatible... = help: only type `()` implements `Foo`; consider using it directly instead. -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr index c325718b3033e..e70ff4a89107d 100644 --- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr +++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr @@ -1,12 +1,3 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/type-match-with-late-bound.rs:6:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0309]: the placeholder type `F` may not live long enough --> $DIR/type-match-with-late-bound.rs:8:32 | @@ -54,6 +45,6 @@ help: consider adding an explicit lifetime bound LL | for F: 'a, F: 'a | +++++ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0309`. diff --git a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.current.stderr b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.current.stderr deleted file mode 100644 index 6551253d2e9e8..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unifying-placeholders-in-query-response-2.rs:7:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.next.stderr b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.next.stderr deleted file mode 100644 index 6551253d2e9e8..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.next.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unifying-placeholders-in-query-response-2.rs:7:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.rs b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.rs index d900bd429e6ec..2962a5b4f4ba8 100644 --- a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.rs +++ b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response-2.rs @@ -5,7 +5,6 @@ #![feature(sized_hierarchy)] #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete use std::marker::PointeeSized; diff --git a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.current.stderr b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.current.stderr deleted file mode 100644 index fecdc860f8e7d..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.current.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unifying-placeholders-in-query-response.rs:7:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.next.stderr b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.next.stderr deleted file mode 100644 index fecdc860f8e7d..0000000000000 --- a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.next.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/unifying-placeholders-in-query-response.rs:7:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs index 04e34531f4d78..caad8bf65a90c 100644 --- a/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs +++ b/tests/ui/traits/non_lifetime_binders/unifying-placeholders-in-query-response.rs @@ -5,7 +5,6 @@ #![feature(sized_hierarchy)] #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete use std::marker::PointeeSized; diff --git a/tests/ui/traits/non_lifetime_binders/universe-error1.rs b/tests/ui/traits/non_lifetime_binders/universe-error1.rs index b4e8e3a8aada6..1c99794b6a641 100644 --- a/tests/ui/traits/non_lifetime_binders/universe-error1.rs +++ b/tests/ui/traits/non_lifetime_binders/universe-error1.rs @@ -1,6 +1,5 @@ #![feature(sized_hierarchy)] #![feature(non_lifetime_binders)] -//~^ WARN the feature `non_lifetime_binders` is incomplete use std::marker::PointeeSized; diff --git a/tests/ui/traits/non_lifetime_binders/universe-error1.stderr b/tests/ui/traits/non_lifetime_binders/universe-error1.stderr index b997e7379e25a..899378b2bce4e 100644 --- a/tests/ui/traits/non_lifetime_binders/universe-error1.stderr +++ b/tests/ui/traits/non_lifetime_binders/universe-error1.stderr @@ -1,20 +1,11 @@ -warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes - --> $DIR/universe-error1.rs:2:12 - | -LL | #![feature(non_lifetime_binders)] - | ^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #108185 for more information - = note: `#[warn(incomplete_features)]` on by default - error[E0277]: the trait bound `T: Other<_>` is not satisfied - --> $DIR/universe-error1.rs:17:11 + --> $DIR/universe-error1.rs:16:11 | LL | foo::<_>(); | ^ the trait `Other<_>` is not implemented for `T` | note: required by a bound in `foo` - --> $DIR/universe-error1.rs:14:15 + --> $DIR/universe-error1.rs:13:15 | LL | fn foo() | --- required by a bound in this function @@ -22,6 +13,6 @@ LL | where LL | for T: Other {} | ^^^^^^^^ required by this bound in `foo` -error: aborting due to 1 previous error; 1 warning emitted +error: aborting due to 1 previous error For more information about this error, try `rustc --explain E0277`. From 3f67327de6db63c863b205a6fc8c58f41ade656a Mon Sep 17 00:00:00 2001 From: Alexander Zaitsev Date: Tue, 24 Mar 2026 02:07:07 +0100 Subject: [PATCH 3/8] doc: update list of Rustc and Clang LTO compatibility --- src/doc/rustc/src/linker-plugin-lto.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/doc/rustc/src/linker-plugin-lto.md b/src/doc/rustc/src/linker-plugin-lto.md index 1502e694bba54..1e5822d9c3573 100644 --- a/src/doc/rustc/src/linker-plugin-lto.md +++ b/src/doc/rustc/src/linker-plugin-lto.md @@ -194,7 +194,7 @@ def minor_version(version): INSTALL_TOOLCHAIN = ["rustup", "toolchain", "install", "--profile", "minimal"] subprocess.run(INSTALL_TOOLCHAIN + ["nightly"]) -LOWER_BOUND = 87 +LOWER_BOUND = 91 NIGHTLY_VERSION = minor_version(subprocess.run( ["rustc", "+nightly", "--version"], capture_output=True, @@ -256,6 +256,6 @@ The following table shows known good combinations of toolchain versions. | 1.78 - 1.81 | 18 | | 1.82 - 1.86 | 19 | | 1.87 - 1.90 | 20 | -| 1.91 - 1.93 | 21 | +| 1.91 - 1.94 | 21 | Note that the compatibility policy for this feature might change in the future. From 3df450f5aeb6d5244ed658a6aa8f679019045b8c Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Mon, 23 Mar 2026 22:05:53 -0400 Subject: [PATCH 4/8] Cherry-pick 1.94.1 release notes This also fixes the Cargo rendering bug noted in the pre-release thread. --- RELEASES.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index f180d740a3d17..c396cd8069d6d 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,17 @@ +Version 1.94.1 (2026-03-26) +=========================== + + + +* [Fix `std::thread::spawn` on wasm32-wasip1-threads](https://github.com/rust-lang/rust/pull/153634) +* [Remove new methods added to `std::os::windows::fs::OpenOptionsExt`](https://github.com/rust-lang/rust/pull/153491) + The new methods were unstable, but the trait itself is not sealed and so + cannot be extended with non-default methods. +* [Clippy: fix ICE in `match_same_arms`](https://github.com/rust-lang/rust-clippy/pull/16685) +* [Cargo: update tar to 0.4.45](https://github.com/rust-lang/cargo/pull/16769) + This resolves CVE-2026-33055 and CVE-2026-33056. Users of crates.io are not affected. + See [blog](https://blog.rust-lang.org/2026/03/21/cve-2026-33056/) for more details. + Version 1.94.0 (2026-03-05) ========================== From eba0efd9aaef79149de08d1affe969c5213c0fe7 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 23 Mar 2026 12:11:17 +0100 Subject: [PATCH 5/8] Remove more `BuiltinLintDiag` in `rustc_attr_parsing` --- .../src/attributes/cfg_select.rs | 14 ++++++++++---- compiler/rustc_attr_parsing/src/errors.rs | 17 +++++++++++++++++ compiler/rustc_lint/src/early/diagnostics.rs | 7 ------- compiler/rustc_lint/src/lints.rs | 17 ----------------- compiler/rustc_lint_defs/src/lib.rs | 4 ---- 5 files changed, 27 insertions(+), 32 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs b/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs index f3612afe69e5e..4ff224006ca89 100644 --- a/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs +++ b/compiler/rustc_attr_parsing/src/attributes/cfg_select.rs @@ -2,18 +2,18 @@ use rustc_ast::token::Token; use rustc_ast::tokenstream::TokenStream; use rustc_ast::{AttrStyle, NodeId, token}; use rustc_data_structures::fx::FxHashMap; +use rustc_errors::Diagnostic; use rustc_feature::{AttributeTemplate, Features}; use rustc_hir::attrs::CfgEntry; use rustc_hir::{AttrPath, Target}; use rustc_parse::exp; use rustc_parse::parser::{Parser, Recovery}; use rustc_session::Session; -use rustc_session::lint::BuiltinLintDiag; use rustc_session::lint::builtin::UNREACHABLE_CFG_SELECT_PREDICATES; use rustc_span::{ErrorGuaranteed, Span, Symbol, sym}; use crate::parser::{AllowExprMetavar, MetaItemOrLitParser}; -use crate::{AttributeParser, ParsedDescription, ShouldEmit, parse_cfg_entry}; +use crate::{AttributeParser, ParsedDescription, ShouldEmit, errors, parse_cfg_entry}; #[derive(Clone)] pub enum CfgSelectPredicate { @@ -153,11 +153,17 @@ fn lint_unreachable( let branch_is_unreachable = |predicate: CfgSelectPredicate, wildcard_span| { let span = predicate.span(); - p.psess.buffer_lint( + p.psess.dyn_buffer_lint( UNREACHABLE_CFG_SELECT_PREDICATES, span, lint_node_id, - BuiltinLintDiag::UnreachableCfg { span, wildcard_span }, + move |dcx, level| match wildcard_span { + Some(wildcard_span) => { + errors::UnreachableCfgSelectPredicateWildcard { span, wildcard_span } + .into_diag(dcx, level) + } + None => errors::UnreachableCfgSelectPredicate { span }.into_diag(dcx, level), + }, ); }; diff --git a/compiler/rustc_attr_parsing/src/errors.rs b/compiler/rustc_attr_parsing/src/errors.rs index 4eb9425b34bb0..d4236416dd6aa 100644 --- a/compiler/rustc_attr_parsing/src/errors.rs +++ b/compiler/rustc_attr_parsing/src/errors.rs @@ -26,6 +26,13 @@ pub(crate) struct ItemFollowingInnerAttr { pub span: Span, } +#[derive(Diagnostic)] +#[diag("unreachable configuration predicate")] +pub(crate) struct UnreachableCfgSelectPredicate { + #[label("this configuration predicate is never reached")] + pub span: Span, +} + #[derive(Diagnostic)] #[diag("most attributes are not supported in `where` clauses")] #[help("only `#[cfg]` and `#[cfg_attr]` are supported")] @@ -33,3 +40,13 @@ pub(crate) struct UnsupportedAttributesInWhere { #[primary_span] pub span: MultiSpan, } + +#[derive(Diagnostic)] +#[diag("unreachable configuration predicate")] +pub(crate) struct UnreachableCfgSelectPredicateWildcard { + #[label("this configuration predicate is never reached")] + pub span: Span, + + #[label("always matches")] + pub wildcard_span: Span, +} diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index 43bb3971d7ac4..a6d7f0a11e32e 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -224,13 +224,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateBuiltinLint<'_, '_> { } .into_diag(dcx, level) } - BuiltinLintDiag::UnreachableCfg { span, wildcard_span } => match wildcard_span { - Some(wildcard_span) => { - lints::UnreachableCfgSelectPredicateWildcard { span, wildcard_span } - .into_diag(dcx, level) - } - None => lints::UnreachableCfgSelectPredicate { span }.into_diag(dcx, level), - }, BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => { lints::UnusedCrateDependency { extern_crate, local_crate }.into_diag(dcx, level) diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index c7c92356c3782..f9cc259bdf4ff 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3709,23 +3709,6 @@ pub(crate) struct UnknownCrateTypesSuggestion { pub snippet: Symbol, } -#[derive(Diagnostic)] -#[diag("unreachable configuration predicate")] -pub(crate) struct UnreachableCfgSelectPredicate { - #[label("this configuration predicate is never reached")] - pub span: Span, -} - -#[derive(Diagnostic)] -#[diag("unreachable configuration predicate")] -pub(crate) struct UnreachableCfgSelectPredicateWildcard { - #[label("this configuration predicate is never reached")] - pub span: Span, - - #[label("always matches")] - pub wildcard_span: Span, -} - #[derive(Diagnostic)] #[diag("positional format arguments are not allowed here")] #[help( diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 0faa504429614..6314add5f1aea 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -732,10 +732,6 @@ pub enum BuiltinLintDiag { local_crate: Symbol, }, AttributeLint(AttributeLintKind), - UnreachableCfg { - span: Span, - wildcard_span: Option, - }, } #[derive(Debug, HashStable_Generic)] From 45027f1788fb36818c3e93c759e4b6ffcdb2a6c8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 23 Mar 2026 19:00:34 +0100 Subject: [PATCH 6/8] Remove more `BuiltinLintDiag` in `rustc_middle` --- compiler/rustc_lint/src/early/diagnostics.rs | 17 ---------- compiler/rustc_lint_defs/src/lib.rs | 7 ---- compiler/rustc_middle/src/middle/stability.rs | 34 ++++++++++++------- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index a6d7f0a11e32e..6b145740d5f52 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -5,7 +5,6 @@ use rustc_errors::{ elided_lifetime_in_path_suggestion, }; use rustc_hir::lints::{AttributeLintKind, FormatWarning}; -use rustc_middle::middle::stability; use rustc_middle::ty::TyCtxt; use rustc_session::Session; use rustc_session::lint::BuiltinLintDiag; @@ -100,22 +99,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateBuiltinLint<'_, '_> { .collect(); lints::RedundantImport { subs, ident }.into_diag(dcx, level) } - BuiltinLintDiag::DeprecatedMacro { - suggestion, - suggestion_span, - note, - path, - since_kind, - } => { - let sub = suggestion.map(|suggestion| stability::DeprecationSuggestion { - span: suggestion_span, - kind: "macro".to_owned(), - suggestion, - }); - - stability::Deprecated { sub, kind: "macro".to_owned(), path, note, since_kind } - .into_diag(dcx, level) - } BuiltinLintDiag::SingleUseLifetime { param_span, use_span, diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 6314add5f1aea..f3014ef733661 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -666,13 +666,6 @@ pub enum BuiltinLintDiag { span_snippets: Vec, }, RedundantImport(Vec<(Span, bool)>, Ident), - DeprecatedMacro { - suggestion: Option, - suggestion_span: Span, - note: Option, - path: String, - since_kind: DeprecatedSinceKind, - }, SingleUseLifetime { /// Span of the parameter which declares this lifetime. param_span: Span, diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index e76c9a8c0b5a1..f9821c92df369 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -4,7 +4,7 @@ use std::num::NonZero; use rustc_ast::NodeId; -use rustc_errors::{Applicability, Diag, EmissionGuarantee, LintBuffer, msg}; +use rustc_errors::{Applicability, Diag, Diagnostic, EmissionGuarantee, LintBuffer, msg}; use rustc_feature::GateIssue; use rustc_hir::attrs::{DeprecatedSince, Deprecation}; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -12,7 +12,7 @@ use rustc_hir::{self as hir, ConstStability, DefaultBodyStability, HirId, Stabil use rustc_macros::{Decodable, Encodable, HashStable, Subdiagnostic}; use rustc_session::Session; use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE}; -use rustc_session::lint::{BuiltinLintDiag, DeprecatedSinceKind, Level, Lint}; +use rustc_session::lint::{DeprecatedSinceKind, Level, Lint}; use rustc_session::parse::feature_err_issue; use rustc_span::{Span, Symbol, sym}; use tracing::debug; @@ -187,23 +187,33 @@ fn deprecated_since_kind(is_in_effect: bool, since: DeprecatedSince) -> Deprecat pub fn early_report_macro_deprecation( lint_buffer: &mut LintBuffer, depr: &Deprecation, - span: Span, + suggestion_span: Span, node_id: NodeId, path: String, ) { - if span.in_derive_expansion() { + if suggestion_span.in_derive_expansion() { return; } let is_in_effect = depr.is_in_effect(); - let diag = BuiltinLintDiag::DeprecatedMacro { - suggestion: depr.suggestion, - suggestion_span: span, - note: depr.note.map(|ident| ident.name), - path, - since_kind: deprecated_since_kind(is_in_effect, depr.since), - }; - lint_buffer.buffer_lint(deprecation_lint(is_in_effect), node_id, span, diag); + let suggestion = depr.suggestion; + let note = depr.note.map(|ident| ident.name); + let since_kind = deprecated_since_kind(is_in_effect, depr.since); + lint_buffer.dyn_buffer_lint( + deprecation_lint(is_in_effect), + node_id, + suggestion_span, + move |dcx, level| { + let sub = suggestion.map(|suggestion| DeprecationSuggestion { + span: suggestion_span, + kind: "macro".to_owned(), + suggestion, + }); + + Deprecated { sub, kind: "macro".to_owned(), path, note, since_kind } + .into_diag(dcx, level) + }, + ); } fn late_report_deprecation( From 5d7f89417cf410f4da50ccba3c5a568a760a3cbd Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 23 Mar 2026 21:14:54 +0100 Subject: [PATCH 7/8] Remove more `BuiltinLintDiag` in `rustc_resolve` --- compiler/rustc_lint/src/early/diagnostics.rs | 55 ----------- compiler/rustc_lint/src/lints.rs | 99 +------------------- compiler/rustc_lint_defs/src/lib.rs | 32 +------ compiler/rustc_resolve/src/check_unused.rs | 4 +- compiler/rustc_resolve/src/errors.rs | 96 +++++++++++++++++++ compiler/rustc_resolve/src/imports.rs | 46 ++++++--- compiler/rustc_resolve/src/late.rs | 12 ++- 7 files changed, 143 insertions(+), 201 deletions(-) diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index 6b145740d5f52..9aefef1733b19 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -87,18 +87,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateBuiltinLint<'_, '_> { } .into_diag(dcx, level) } - BuiltinLintDiag::RedundantImport(spans, ident) => { - let subs = spans - .into_iter() - .map(|(span, is_imported)| match (span.is_dummy(), is_imported) { - (false, true) => lints::RedundantImportSub::ImportedHere { span, ident }, - (false, false) => lints::RedundantImportSub::DefinedHere { span, ident }, - (true, true) => lints::RedundantImportSub::ImportedPrelude { span, ident }, - (true, false) => lints::RedundantImportSub::DefinedPrelude { span, ident }, - }) - .collect(); - lints::RedundantImport { subs, ident }.into_diag(dcx, level) - } BuiltinLintDiag::SingleUseLifetime { param_span, use_span, @@ -164,49 +152,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateBuiltinLint<'_, '_> { } .into_diag(dcx, level) } - BuiltinLintDiag::AmbiguousGlobReexports { - name, - namespace, - first_reexport_span, - duplicate_reexport_span, - } => lints::AmbiguousGlobReexports { - first_reexport: first_reexport_span, - duplicate_reexport: duplicate_reexport_span, - name, - namespace, - } - .into_diag(dcx, level), - BuiltinLintDiag::HiddenGlobReexports { - name, - namespace, - glob_reexport_span, - private_item_span, - } => lints::HiddenGlobReexports { - glob_reexport: glob_reexport_span, - private_item: private_item_span, - - name, - namespace, - } - .into_diag(dcx, level), - BuiltinLintDiag::UnusedQualifications { removal_span } => { - lints::UnusedQualifications { removal_span }.into_diag(dcx, level) - } - BuiltinLintDiag::AssociatedConstElidedLifetime { - elided, - span: lt_span, - lifetimes_in_scope, - } => { - let lt_span = if elided { lt_span.shrink_to_hi() } else { lt_span }; - let code = if elided { "'static " } else { "'static" }; - lints::AssociatedConstElidedLifetime { - span: lt_span, - code, - elided, - lifetimes_in_scope, - } - .into_diag(dcx, level) - } BuiltinLintDiag::UnusedCrateDependency { extern_crate, local_crate } => { lints::UnusedCrateDependency { extern_crate, local_crate }.into_diag(dcx, level) diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index f9cc259bdf4ff..b40dcb70d780e 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -6,8 +6,7 @@ use rustc_errors::codes::*; use rustc_errors::formatting::DiagMessageAddArg; use rustc_errors::{ Applicability, Diag, DiagArgValue, DiagCtxtHandle, DiagMessage, DiagStyledString, Diagnostic, - ElidedLifetimeInPathSubdiag, EmissionGuarantee, Level, MultiSpan, Subdiagnostic, - SuggestionStyle, msg, + ElidedLifetimeInPathSubdiag, EmissionGuarantee, Level, Subdiagnostic, SuggestionStyle, msg, }; use rustc_hir as hir; use rustc_hir::def_id::DefId; @@ -3089,42 +3088,6 @@ pub(crate) enum UnusedImportsSugg { }, } -#[derive(Diagnostic)] -#[diag("the item `{$ident}` is imported redundantly")] -pub(crate) struct RedundantImport { - #[subdiagnostic] - pub subs: Vec, - pub ident: Ident, -} - -#[derive(Subdiagnostic)] -pub(crate) enum RedundantImportSub { - #[label("the item `{$ident}` is already imported here")] - ImportedHere { - #[primary_span] - span: Span, - ident: Ident, - }, - #[label("the item `{$ident}` is already defined here")] - DefinedHere { - #[primary_span] - span: Span, - ident: Ident, - }, - #[label("the item `{$ident}` is already imported by the extern prelude")] - ImportedPrelude { - #[primary_span] - span: Span, - ident: Ident, - }, - #[label("the item `{$ident}` is already defined by the extern prelude")] - DefinedPrelude { - #[primary_span] - span: Span, - ident: Ident, - }, -} - #[derive(Diagnostic)] #[diag("lifetime parameter `{$ident}` only used once")] pub(crate) struct SingleUseLifetime { @@ -3168,66 +3131,6 @@ pub(crate) struct NamedArgumentUsedPositionally { pub named_arg_name: String, } -#[derive(Diagnostic)] -#[diag("ambiguous glob re-exports")] -pub(crate) struct AmbiguousGlobReexports { - #[label("the name `{$name}` in the {$namespace} namespace is first re-exported here")] - pub first_reexport: Span, - #[label("but the name `{$name}` in the {$namespace} namespace is also re-exported here")] - pub duplicate_reexport: Span, - - pub name: String, - pub namespace: String, -} - -#[derive(Diagnostic)] -#[diag("private item shadows public glob re-export")] -pub(crate) struct HiddenGlobReexports { - #[note( - "the name `{$name}` in the {$namespace} namespace is supposed to be publicly re-exported here" - )] - pub glob_reexport: Span, - #[note("but the private item here shadows it")] - pub private_item: Span, - - pub name: String, - pub namespace: String, -} - -#[derive(Diagnostic)] -#[diag("unnecessary qualification")] -pub(crate) struct UnusedQualifications { - #[suggestion( - "remove the unnecessary path segments", - style = "verbose", - code = "", - applicability = "machine-applicable" - )] - pub removal_span: Span, -} - -#[derive(Diagnostic)] -#[diag( - "{$elided -> - [true] `&` without an explicit lifetime name cannot be used here - *[false] `'_` cannot be used here - }" -)] -pub(crate) struct AssociatedConstElidedLifetime { - #[suggestion( - "use the `'static` lifetime", - style = "verbose", - code = "{code}", - applicability = "machine-applicable" - )] - pub span: Span, - - pub code: &'static str, - pub elided: bool, - #[note("cannot automatically infer `'static` because of other lifetimes in scope")] - pub lifetimes_in_scope: MultiSpan, -} - #[derive(Diagnostic)] #[diag("creating a {$shared_label}reference to mutable static")] pub(crate) struct RefOfMutStatic<'a> { diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index f3014ef733661..2cd0498f09947 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -7,7 +7,7 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_data_structures::stable_hasher::{ HashStable, StableCompare, StableHasher, ToStableHashKey, }; -use rustc_error_messages::{DiagArgValue, IntoDiagArg, MultiSpan}; +use rustc_error_messages::{DiagArgValue, IntoDiagArg}; use rustc_hir_id::{HashStableContext, HirId, ItemLocalId}; use rustc_macros::{Decodable, Encodable, HashStable_Generic}; use rustc_span::def_id::DefPathHash; @@ -665,7 +665,6 @@ pub enum BuiltinLintDiag { test_module_span: Option, span_snippets: Vec, }, - RedundantImport(Vec<(Span, bool)>, Ident), SingleUseLifetime { /// Span of the parameter which declares this lifetime. param_span: Span, @@ -691,35 +690,6 @@ pub enum BuiltinLintDiag { /// Indicates if the named argument is used as a width/precision for formatting is_formatting_arg: bool, }, - AmbiguousGlobReexports { - /// The name for which collision(s) have occurred. - name: String, - /// The name space for which the collision(s) occurred in. - namespace: String, - /// Span where the name is first re-exported. - first_reexport_span: Span, - /// Span where the same name is also re-exported. - duplicate_reexport_span: Span, - }, - HiddenGlobReexports { - /// The name of the local binding which shadows the glob re-export. - name: String, - /// The namespace for which the shadowing occurred in. - namespace: String, - /// The glob reexport that is shadowed by the local binding. - glob_reexport_span: Span, - /// The local binding that shadows the glob reexport. - private_item_span: Span, - }, - UnusedQualifications { - /// The span of the unnecessarily-qualified path to remove. - removal_span: Span, - }, - AssociatedConstElidedLifetime { - elided: bool, - span: Span, - lifetimes_in_scope: MultiSpan, - }, UnusedCrateDependency { extern_crate: Symbol, local_crate: Symbol, diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index 45fdea82d47bc..8e150b7f3a5dc 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -36,7 +36,7 @@ use rustc_session::lint::builtin::{ use rustc_span::{DUMMY_SP, Ident, Span, kw}; use crate::imports::{Import, ImportKind}; -use crate::{DeclKind, IdentKey, LateDecl, Resolver, module_to_string}; +use crate::{DeclKind, IdentKey, LateDecl, Resolver, errors, module_to_string}; struct UnusedImport { use_tree: ast::UseTree, @@ -554,7 +554,7 @@ impl Resolver<'_, '_> { UNUSED_QUALIFICATIONS, unn_qua.node_id, unn_qua.path_span, - BuiltinLintDiag::UnusedQualifications { removal_span: unn_qua.removal_span }, + errors::UnusedQualifications { removal_span: unn_qua.removal_span }, ); } diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 25c7c625ff93b..c9dad4dcd4a75 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -1592,3 +1592,99 @@ pub(crate) struct UnusedLifetime { pub ident: Ident, } + +#[derive(Diagnostic)] +#[diag("ambiguous glob re-exports")] +pub(crate) struct AmbiguousGlobReexports { + #[label("the name `{$name}` in the {$namespace} namespace is first re-exported here")] + pub first_reexport: Span, + #[label("but the name `{$name}` in the {$namespace} namespace is also re-exported here")] + pub duplicate_reexport: Span, + + pub name: String, + pub namespace: String, +} + +#[derive(Diagnostic)] +#[diag("private item shadows public glob re-export")] +pub(crate) struct HiddenGlobReexports { + #[note( + "the name `{$name}` in the {$namespace} namespace is supposed to be publicly re-exported here" + )] + pub glob_reexport: Span, + #[note("but the private item here shadows it")] + pub private_item: Span, + + pub name: String, + pub namespace: String, +} + +#[derive(Diagnostic)] +#[diag("the item `{$ident}` is imported redundantly")] +pub(crate) struct RedundantImport { + #[subdiagnostic] + pub subs: Vec, + pub ident: Ident, +} + +#[derive(Subdiagnostic)] +pub(crate) enum RedundantImportSub { + #[label("the item `{$ident}` is already imported here")] + ImportedHere { + #[primary_span] + span: Span, + ident: Ident, + }, + #[label("the item `{$ident}` is already defined here")] + DefinedHere { + #[primary_span] + span: Span, + ident: Ident, + }, + #[label("the item `{$ident}` is already imported by the extern prelude")] + ImportedPrelude { + #[primary_span] + span: Span, + ident: Ident, + }, + #[label("the item `{$ident}` is already defined by the extern prelude")] + DefinedPrelude { + #[primary_span] + span: Span, + ident: Ident, + }, +} + +#[derive(Diagnostic)] +#[diag("unnecessary qualification")] +pub(crate) struct UnusedQualifications { + #[suggestion( + "remove the unnecessary path segments", + style = "verbose", + code = "", + applicability = "machine-applicable" + )] + pub removal_span: Span, +} + +#[derive(Diagnostic)] +#[diag( + "{$elided -> + [true] `&` without an explicit lifetime name cannot be used here + *[false] `'_` cannot be used here + }" +)] +pub(crate) struct AssociatedConstElidedLifetime { + #[suggestion( + "use the `'static` lifetime", + style = "verbose", + code = "{code}", + applicability = "machine-applicable" + )] + pub span: Span, + + pub code: &'static str, + pub elided: bool, + #[note("cannot automatically infer `'static` because of other lifetimes in scope")] + pub lifetimes_in_scope: MultiSpan, +} diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 8f534de0f76dd..6507ee3477379 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -6,13 +6,12 @@ use rustc_ast::NodeId; use rustc_data_structures::fx::{FxHashSet, FxIndexSet}; use rustc_data_structures::intern::Interned; use rustc_errors::codes::*; -use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err}; +use rustc_errors::{Applicability, Diagnostic, MultiSpan, pluralize, struct_span_code_err}; use rustc_hir::def::{self, DefKind, PartialRes}; use rustc_hir::def_id::{DefId, LocalDefIdMap}; use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport}; use rustc_middle::span_bug; use rustc_middle::ty::Visibility; -use rustc_session::lint::BuiltinLintDiag; use rustc_session::lint::builtin::{ AMBIGUOUS_GLOB_REEXPORTS, EXPORTED_PRIVATE_DEPENDENCIES, HIDDEN_GLOB_REEXPORTS, PUB_USE_OF_PRIVATE_EXTERN_CRATE, REDUNDANT_IMPORTS, UNUSED_IMPORTS, @@ -26,9 +25,10 @@ use tracing::debug; use crate::Namespace::{self, *}; use crate::diagnostics::{DiagMode, Suggestion, import_candidates}; use crate::errors::{ - CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS, CannotBeReexportedPrivate, - CannotBeReexportedPrivateNS, CannotDetermineImportResolution, CannotGlobImportAllCrates, - ConsiderAddingMacroExport, ConsiderMarkingAsPub, ConsiderMarkingAsPubCrate, + self, CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS, + CannotBeReexportedPrivate, CannotBeReexportedPrivateNS, CannotDetermineImportResolution, + CannotGlobImportAllCrates, ConsiderAddingMacroExport, ConsiderMarkingAsPub, + ConsiderMarkingAsPubCrate, }; use crate::ref_mut::CmCell; use crate::{ @@ -721,11 +721,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { AMBIGUOUS_GLOB_REEXPORTS, import.root_id, import.root_span, - BuiltinLintDiag::AmbiguousGlobReexports { + errors::AmbiguousGlobReexports { name: key.ident.name.to_string(), namespace: key.ns.descr().to_string(), - first_reexport_span: import.root_span, - duplicate_reexport_span: amb_binding.span, + first_reexport: import.root_span, + duplicate_reexport: amb_binding.span, }, ); } @@ -753,11 +753,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { HIDDEN_GLOB_REEXPORTS, binding_id, binding.span, - BuiltinLintDiag::HiddenGlobReexports { + errors::HiddenGlobReexports { name: key.ident.name.to_string(), namespace: key.ns.descr().to_owned(), - glob_reexport_span: glob_decl.span, - private_item_span: binding.span, + glob_reexport: glob_decl.span, + private_item: binding.span, }, ); } @@ -1535,11 +1535,31 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { let mut redundant_spans: Vec<_> = redundant_span.present_items().collect(); redundant_spans.sort(); redundant_spans.dedup(); - self.lint_buffer.buffer_lint( + self.lint_buffer.dyn_buffer_lint( REDUNDANT_IMPORTS, id, import.span, - BuiltinLintDiag::RedundantImport(redundant_spans, source), + move |dcx, level| { + let ident = source; + let subs = redundant_spans + .into_iter() + .map(|(span, is_imported)| match (span.is_dummy(), is_imported) { + (false, true) => { + errors::RedundantImportSub::ImportedHere { span, ident } + } + (false, false) => { + errors::RedundantImportSub::DefinedHere { span, ident } + } + (true, true) => { + errors::RedundantImportSub::ImportedPrelude { span, ident } + } + (true, false) => { + errors::RedundantImportSub::DefinedPrelude { span, ident } + } + }) + .collect(); + errors::RedundantImport { subs, ident }.into_diag(dcx, level) + }, ); return true; } diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index a484a5136db51..c908b6a007aa7 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -1882,13 +1882,21 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { ); return; } else if emit_lint { + let lt_span = if elided { + lifetime.ident.span.shrink_to_hi() + } else { + lifetime.ident.span + }; + let code = if elided { "'static " } else { "'static" }; + self.r.lint_buffer.buffer_lint( lint::builtin::ELIDED_LIFETIMES_IN_ASSOCIATED_CONSTANT, node_id, lifetime.ident.span, - lint::BuiltinLintDiag::AssociatedConstElidedLifetime { + crate::errors::AssociatedConstElidedLifetime { elided, - span: lifetime.ident.span, + code, + span: lt_span, lifetimes_in_scope: lifetimes_in_scope.into(), }, ); From 1d325ce4367f5a3c0bfd68859af8752e9ea61885 Mon Sep 17 00:00:00 2001 From: aerooneqq Date: Tue, 24 Mar 2026 14:16:36 +0300 Subject: [PATCH 8/8] Eliminate usage of AST from generics creation --- compiler/rustc_ast_lowering/src/delegation.rs | 50 +-- .../src/delegation/generics.rs | 394 ++++++------------ compiler/rustc_ast_lowering/src/lib.rs | 4 +- compiler/rustc_hir/src/hir.rs | 40 +- .../src/collect/resolve_bound_vars.rs | 2 +- .../src/hir_ty_lowering/mod.rs | 19 +- .../generics/const-type-ice-153433.rs | 8 + .../generics/const-type-ice-153433.stderr | 9 + .../generics/const-type-ice-153499.rs | 13 + .../generics/const-type-ice-153499.stderr | 30 ++ 10 files changed, 251 insertions(+), 318 deletions(-) create mode 100644 tests/ui/delegation/generics/const-type-ice-153433.rs create mode 100644 tests/ui/delegation/generics/const-type-ice-153433.stderr create mode 100644 tests/ui/delegation/generics/const-type-ice-153499.rs create mode 100644 tests/ui/delegation/generics/const-type-ice-153499.stderr diff --git a/compiler/rustc_ast_lowering/src/delegation.rs b/compiler/rustc_ast_lowering/src/delegation.rs index 0044913721f1f..03acf40ef5fee 100644 --- a/compiler/rustc_ast_lowering/src/delegation.rs +++ b/compiler/rustc_ast_lowering/src/delegation.rs @@ -146,12 +146,10 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { let (param_count, c_variadic) = self.param_count(sig_id); - let mut generics = - self.lower_delegation_generics(delegation, sig_id, item_id, span); + let mut generics = self.uplift_delegation_generics(delegation, sig_id, item_id); let body_id = self.lower_delegation_body( delegation, - item_id, is_method, param_count, &mut generics, @@ -166,10 +164,8 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { let generics = self.arena.alloc(hir::Generics { has_where_clause_predicates: false, - params: self.arena.alloc_from_iter(generics.all_params(item_id, span, self)), - predicates: self - .arena - .alloc_from_iter(generics.all_predicates(item_id, span, self)), + params: self.arena.alloc_from_iter(generics.all_params(span, self)), + predicates: self.arena.alloc_from_iter(generics.all_predicates(span, self)), span, where_clause_span: span, }); @@ -294,19 +290,22 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { let decl_param_count = param_count - c_variadic as usize; let inputs = self.arena.alloc_from_iter((0..decl_param_count).map(|arg| hir::Ty { hir_id: self.next_id(), - kind: hir::TyKind::InferDelegation(sig_id, hir::InferDelegationKind::Input(arg)), + kind: hir::TyKind::InferDelegation(hir::InferDelegation::Sig( + sig_id, + hir::InferDelegationSig::Input(arg), + )), span, })); let output = self.arena.alloc(hir::Ty { hir_id: self.next_id(), - kind: hir::TyKind::InferDelegation( + kind: hir::TyKind::InferDelegation(hir::InferDelegation::Sig( sig_id, - hir::InferDelegationKind::Output(self.arena.alloc(hir::DelegationGenerics { + hir::InferDelegationSig::Output(self.arena.alloc(hir::DelegationGenerics { child_args_segment_id: generics.child.args_segment_id, parent_args_segment_id: generics.parent.args_segment_id, })), - ), + )), span, }); @@ -399,7 +398,6 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { fn lower_delegation_body( &mut self, delegation: &Delegation, - item_id: NodeId, is_method: bool, param_count: usize, generics: &mut GenericsGenerationResults<'hir>, @@ -434,7 +432,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { args.push(arg); } - let final_expr = this.finalize_body_lowering(delegation, item_id, args, generics, span); + let final_expr = this.finalize_body_lowering(delegation, args, generics, span); (this.arena.alloc_from_iter(parameters), final_expr) }) @@ -471,7 +469,6 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { fn finalize_body_lowering( &mut self, delegation: &Delegation, - item_id: NodeId, args: Vec>, generics: &mut GenericsGenerationResults<'hir>, span: Span, @@ -501,7 +498,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { // FIXME(fn_delegation): proper support for parent generics propagation // in method call scenario. - let segment = self.process_segment(item_id, span, &segment, &mut generics.child, false); + let segment = self.process_segment(span, &segment, &mut generics.child, false); let segment = self.arena.alloc(segment); self.arena.alloc(hir::Expr { @@ -528,7 +525,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { new_path.segments = self.arena.alloc_from_iter( new_path.segments.iter().enumerate().map(|(idx, segment)| { let mut process_segment = |result, add_lifetimes| { - self.process_segment(item_id, span, segment, result, add_lifetimes) + self.process_segment(span, segment, result, add_lifetimes) }; if idx + 2 == len { @@ -544,8 +541,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { hir::QPath::Resolved(ty, self.arena.alloc(new_path)) } hir::QPath::TypeRelative(ty, segment) => { - let segment = - self.process_segment(item_id, span, segment, &mut generics.child, false); + let segment = self.process_segment(span, segment, &mut generics.child, false); hir::QPath::TypeRelative(ty, self.arena.alloc(segment)) } @@ -569,7 +565,6 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { fn process_segment( &mut self, - item_id: NodeId, span: Span, segment: &hir::PathSegment<'hir>, result: &mut GenericsGenerationResult<'hir>, @@ -577,15 +572,14 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { ) -> hir::PathSegment<'hir> { let details = result.generics.args_propagation_details(); - // The first condition is needed when there is SelfAndUserSpecified case, - // we don't want to propagate generics params in this situation. - let segment = if details.should_propagate - && let Some(args) = result - .generics - .into_hir_generics(self, item_id, span) - .into_generic_args(self, add_lifetimes, span) - { - hir::PathSegment { args: Some(args), ..segment.clone() } + let segment = if details.should_propagate { + let generics = result.generics.into_hir_generics(self, span); + let args = generics.into_generic_args(self, add_lifetimes, span); + + // Needed for better error messages (`trait-impl-wrong-args-count.rs` test). + let args = if args.is_empty() { None } else { Some(args) }; + + hir::PathSegment { args, ..segment.clone() } } else { segment.clone() }; diff --git a/compiler/rustc_ast_lowering/src/delegation/generics.rs b/compiler/rustc_ast_lowering/src/delegation/generics.rs index d6d8819d8c474..ee1ac9aa5cd8d 100644 --- a/compiler/rustc_ast_lowering/src/delegation/generics.rs +++ b/compiler/rustc_ast_lowering/src/delegation/generics.rs @@ -5,10 +5,8 @@ use rustc_hir as hir; use rustc_hir::def_id::DefId; use rustc_middle::ty::GenericParamDefKind; use rustc_middle::{bug, ty}; -use rustc_span::sym::{self}; use rustc_span::symbol::kw; use rustc_span::{Ident, Span}; -use thin_vec::{ThinVec, thin_vec}; use crate::{LoweringContext, ResolverAstLoweringExt}; @@ -16,34 +14,33 @@ pub(super) enum DelegationGenerics { /// User-specified args are present: `reuse foo::;`. UserSpecified, /// The default case when no user-specified args are present: `reuse Trait::foo;`. - Default(Option), + Default(T), /// In free-to-trait reuse, when user specified args for trait `reuse Trait::::foo;` /// in this case we need to both generate `Self` and process user args. - SelfAndUserSpecified(Option), + SelfAndUserSpecified(T), /// In delegations from trait impl to other entities like free functions or trait functions, /// we want to generate a function whose generics matches generics of signature function /// in trait. - TraitImpl(Option, bool /* Has user-specified args */), + TraitImpl(T, bool /* Has user-specified args */), } -/// Used for storing either AST generics or their lowered HIR version. Firstly we obtain -/// AST generics either from local function from AST index or from external function -/// through `tcx`. Next, at some point of generics processing we need to lower those -/// generics to HIR, for this purpose we use `into_hir_generics` that lowers AST generics -/// and replaces Ast variant with Hir. Such approach is useful as we can call this method -/// at any time knowing that lowering will occur at most only once. Then, in order to obtain generic +/// Used for storing either ty generics or their uplifted HIR version. First we obtain +/// ty generics. Next, at some point of generics processing we need to uplift those +/// generics to HIR, for this purpose we use `into_hir_generics` that uplifts ty generics +/// and replaces Ty variant with Hir. Such approach is useful as we can call this method +/// at any time knowing that uplifting will occur at most only once. Then, in order to obtain generic /// params or args we use `hir_generics_or_empty` or `into_generic_args` functions. -/// There also may be situations when we obtained AST generics but never lowered them to HIR, +/// There also may be situations when we obtained ty generics but never uplifted them to HIR, /// meaning we did not propagate them and thus we do not need to generate generic params /// (i.e., method call scenarios), in such a case this approach helps -/// a lot as if `into_hir_generics` will not be called then lowering will not happen. -pub(super) enum HirOrAstGenerics<'hir> { - Ast(DelegationGenerics), +/// a lot as if `into_hir_generics` will not be called then uplifting will not happen. +pub(super) enum HirOrTyGenerics<'hir> { + Ty(DelegationGenerics<&'hir [ty::GenericParamDef]>), Hir(DelegationGenerics<&'hir hir::Generics<'hir>>), } pub(super) struct GenericsGenerationResult<'hir> { - pub(super) generics: HirOrAstGenerics<'hir>, + pub(super) generics: HirOrTyGenerics<'hir>, pub(super) args_segment_id: Option, } @@ -78,35 +75,31 @@ impl DelegationGenerics { } } -impl<'hir> HirOrAstGenerics<'hir> { +impl<'hir> HirOrTyGenerics<'hir> { pub(super) fn into_hir_generics( &mut self, ctx: &mut LoweringContext<'_, 'hir, impl ResolverAstLoweringExt<'hir>>, - item_id: NodeId, span: Span, - ) -> &mut HirOrAstGenerics<'hir> { - if let HirOrAstGenerics::Ast(generics) = self { - let process_params = |generics: &mut Generics| { - ctx.lower_delegation_generic_params(item_id, span, &mut generics.params) + ) -> &mut HirOrTyGenerics<'hir> { + if let HirOrTyGenerics::Ty(params) = self { + let mut uplift_params = |generics: &'hir [ty::GenericParamDef]| { + ctx.uplift_delegation_generic_params(span, generics) }; - let hir_generics = match generics { + let hir_generics = match params { DelegationGenerics::UserSpecified => DelegationGenerics::UserSpecified, - DelegationGenerics::Default(generics) => { - DelegationGenerics::Default(generics.as_mut().map(process_params)) + DelegationGenerics::Default(params) => { + DelegationGenerics::Default(uplift_params(params)) } - DelegationGenerics::SelfAndUserSpecified(generics) => { - DelegationGenerics::SelfAndUserSpecified(generics.as_mut().map(process_params)) + DelegationGenerics::SelfAndUserSpecified(params) => { + DelegationGenerics::SelfAndUserSpecified(uplift_params(params)) } - DelegationGenerics::TraitImpl(generics, user_specified) => { - DelegationGenerics::TraitImpl( - generics.as_mut().map(process_params), - *user_specified, - ) + DelegationGenerics::TraitImpl(params, user_specified) => { + DelegationGenerics::TraitImpl(uplift_params(params), *user_specified) } }; - *self = HirOrAstGenerics::Hir(hir_generics); + *self = HirOrTyGenerics::Hir(hir_generics); } self @@ -114,14 +107,12 @@ impl<'hir> HirOrAstGenerics<'hir> { fn hir_generics_or_empty(&self) -> &'hir hir::Generics<'hir> { match self { - HirOrAstGenerics::Ast(_) => hir::Generics::empty(), - HirOrAstGenerics::Hir(hir_generics) => match hir_generics { + HirOrTyGenerics::Ty(_) => hir::Generics::empty(), + HirOrTyGenerics::Hir(hir_generics) => match hir_generics { DelegationGenerics::UserSpecified => hir::Generics::empty(), DelegationGenerics::Default(generics) | DelegationGenerics::SelfAndUserSpecified(generics) - | DelegationGenerics::TraitImpl(generics, _) => { - generics.unwrap_or(hir::Generics::empty()) - } + | DelegationGenerics::TraitImpl(generics, _) => generics, }, } } @@ -131,43 +122,41 @@ impl<'hir> HirOrAstGenerics<'hir> { ctx: &mut LoweringContext<'_, 'hir, impl ResolverAstLoweringExt<'hir>>, add_lifetimes: bool, span: Span, - ) -> Option<&'hir hir::GenericArgs<'hir>> { + ) -> &'hir hir::GenericArgs<'hir> { match self { - HirOrAstGenerics::Ast(_) => { - bug!("Attempting to get generic args before lowering to HIR") + HirOrTyGenerics::Ty(_) => { + bug!("Attempting to get generic args before uplifting to HIR") } - HirOrAstGenerics::Hir(hir_generics) => match hir_generics { - DelegationGenerics::UserSpecified => None, + HirOrTyGenerics::Hir(hir_generics) => match hir_generics { + DelegationGenerics::UserSpecified => hir::GenericArgs::NONE, DelegationGenerics::Default(generics) | DelegationGenerics::SelfAndUserSpecified(generics) - | DelegationGenerics::TraitImpl(generics, _) => generics.map(|generics| { + | DelegationGenerics::TraitImpl(generics, _) => { ctx.create_generics_args_from_params(generics.params, add_lifetimes, span) - }), + } }, } } pub(super) fn args_propagation_details(&self) -> GenericArgsPropagationDetails { match self { - HirOrAstGenerics::Ast(ast_generics) => ast_generics.args_propagation_details(), - HirOrAstGenerics::Hir(hir_generics) => hir_generics.args_propagation_details(), + HirOrTyGenerics::Ty(ty_generics) => ty_generics.args_propagation_details(), + HirOrTyGenerics::Hir(hir_generics) => hir_generics.args_propagation_details(), } } } -impl<'a> GenericsGenerationResult<'a> { - fn new(generics: DelegationGenerics) -> GenericsGenerationResult<'a> { - GenericsGenerationResult { - generics: HirOrAstGenerics::Ast(generics), - args_segment_id: None, - } +impl<'hir> GenericsGenerationResult<'hir> { + fn new( + generics: DelegationGenerics<&'hir [ty::GenericParamDef]>, + ) -> GenericsGenerationResult<'hir> { + GenericsGenerationResult { generics: HirOrTyGenerics::Ty(generics), args_segment_id: None } } } impl<'hir> GenericsGenerationResults<'hir> { pub(super) fn all_params( &mut self, - item_id: NodeId, span: Span, ctx: &mut LoweringContext<'_, 'hir, impl ResolverAstLoweringExt<'hir>>, ) -> impl Iterator> { @@ -176,21 +165,14 @@ impl<'hir> GenericsGenerationResults<'hir> { // method call will be supported (if HIR generics were not obtained // then it means that we did not propagated them, thus we do not need // to generate params). - let parent = self - .parent - .generics - .into_hir_generics(ctx, item_id, span) - .hir_generics_or_empty() - .params; - - let child = self - .child - .generics - .into_hir_generics(ctx, item_id, span) - .hir_generics_or_empty() - .params; - - // Order generics, firstly we have parent and child lifetimes, + let mut create_params = |result: &mut GenericsGenerationResult<'hir>| { + result.generics.into_hir_generics(ctx, span).hir_generics_or_empty().params + }; + + let parent = create_params(&mut self.parent); + let child = create_params(&mut self.child); + + // Order generics, first we have parent and child lifetimes, // then parent and child types and consts. // `generics_of` in `rustc_hir_analysis` will order them anyway, // however we want the order to be consistent in HIR too. @@ -203,13 +185,12 @@ impl<'hir> GenericsGenerationResults<'hir> { .copied() } - /// As we add hack predicates(`'a: 'a`) for all lifetimes (see `lower_delegation_generic_params` + /// As we add hack predicates(`'a: 'a`) for all lifetimes (see `uplift_delegation_generic_params` /// and `generate_lifetime_predicate` functions) we need to add them to delegation generics. /// Those predicates will not affect resulting predicate inheritance and folding /// in `rustc_hir_analysis`, as we inherit all predicates from delegation signature. pub(super) fn all_predicates( &mut self, - item_id: NodeId, span: Span, ctx: &mut LoweringContext<'_, 'hir, impl ResolverAstLoweringExt<'hir>>, ) -> impl Iterator> { @@ -218,31 +199,23 @@ impl<'hir> GenericsGenerationResults<'hir> { // method call will be supported (if HIR generics were not obtained // then it means that we did not propagated them, thus we do not need // to generate predicates). - self.parent - .generics - .into_hir_generics(ctx, item_id, span) - .hir_generics_or_empty() - .predicates - .into_iter() - .chain( - self.child - .generics - .into_hir_generics(ctx, item_id, span) - .hir_generics_or_empty() - .predicates - .into_iter(), - ) - .copied() + let mut create_predicates = |result: &mut GenericsGenerationResult<'hir>| { + result.generics.into_hir_generics(ctx, span).hir_generics_or_empty().predicates + }; + + let parent = create_predicates(&mut self.parent); + let child = create_predicates(&mut self.child); + + parent.into_iter().chain(child).copied() } } impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { - pub(super) fn lower_delegation_generics( + pub(super) fn uplift_delegation_generics( &mut self, delegation: &Delegation, sig_id: DefId, item_id: NodeId, - span: Span, ) -> GenericsGenerationResults<'hir> { let delegation_parent_kind = self.tcx.def_kind(self.tcx.local_parent(self.local_def_id(item_id))); @@ -251,15 +224,16 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { let len = segments.len(); let child_user_specified = segments[len - 1].args.is_some(); + let sig_params = &self.tcx.generics_of(sig_id).own_params[..]; + // If we are in trait impl always generate function whose generics matches // those that are defined in trait. if matches!(delegation_parent_kind, DefKind::Impl { of_trait: true }) { // Considering parent generics, during signature inheritance // we will take those args that are in trait impl header trait ref. - let parent = GenericsGenerationResult::new(DelegationGenerics::Default(None)); + let parent = GenericsGenerationResult::new(DelegationGenerics::TraitImpl(&[], true)); - let generics = self.get_external_generics(sig_id, false, span); - let child = DelegationGenerics::TraitImpl(generics, child_user_specified); + let child = DelegationGenerics::TraitImpl(sig_params, child_user_specified); let child = GenericsGenerationResult::new(child); return GenericsGenerationResults { parent, child }; @@ -268,38 +242,37 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { let delegation_in_free_ctx = !matches!(delegation_parent_kind, DefKind::Trait | DefKind::Impl { .. }); - let root_function_in_trait = - matches!(self.tcx.def_kind(self.tcx.parent(sig_id)), DefKind::Trait); - - let generate_self = delegation_in_free_ctx && root_function_in_trait; - - let parent_generics_factory = |this: &mut Self, user_specified: bool| { - this.get_parent_generics(this.tcx.parent(sig_id), generate_self, user_specified, span) - }; + let sig_parent = self.tcx.parent(sig_id); + let sig_in_trait = matches!(self.tcx.def_kind(sig_parent), DefKind::Trait); let can_add_generics_to_parent = len >= 2 && self.get_resolution_id(segments[len - 2].id).is_some_and(|def_id| { matches!(self.tcx.def_kind(def_id), DefKind::Trait | DefKind::TraitAlias) }); + let generate_self = delegation_in_free_ctx && sig_in_trait; let parent_generics = if can_add_generics_to_parent { + let sig_parent_params = &self.tcx.generics_of(sig_parent).own_params[..]; + if segments[len - 2].args.is_some() { if generate_self { - DelegationGenerics::SelfAndUserSpecified(parent_generics_factory(self, true)) + // Take only first Self parameter, it is trait so Self must be present. + DelegationGenerics::SelfAndUserSpecified(&sig_parent_params[..1]) } else { DelegationGenerics::UserSpecified } } else { - DelegationGenerics::Default(parent_generics_factory(self, false)) + let skip_self = usize::from(!generate_self); + DelegationGenerics::Default(&sig_parent_params[skip_self..]) } } else { - DelegationGenerics::Default(None) + DelegationGenerics::<&'hir [ty::GenericParamDef]>::Default(&[]) }; let child_generics = if child_user_specified { DelegationGenerics::UserSpecified } else { - DelegationGenerics::Default(self.get_external_generics(sig_id, false, span)) + DelegationGenerics::Default(sig_params) }; GenericsGenerationResults { @@ -308,59 +281,71 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { } } - fn lower_delegation_generic_params( + fn uplift_delegation_generic_params( &mut self, - item_id: NodeId, span: Span, - params: &mut ThinVec, + params: &'hir [ty::GenericParamDef], ) -> &'hir hir::Generics<'hir> { - for p in params.iter_mut() { - // We want to create completely new params, so we generate - // a new id, otherwise assertions will be triggered. - p.id = self.next_node_id(); - - // Remove default params, as they are not supported on functions - // and there will duplicate DefId when we try to lower them later. - match &mut p.kind { - GenericParamKind::Lifetime => {} - GenericParamKind::Type { default } => *default = None, - GenericParamKind::Const { default, .. } => *default = None, - } + let params = self.arena.alloc_from_iter(params.iter().map(|p| { + let def_kind = match p.kind { + GenericParamDefKind::Lifetime => DefKind::LifetimeParam, + GenericParamDefKind::Type { .. } => DefKind::TyParam, + GenericParamDefKind::Const { .. } => DefKind::ConstParam, + }; - // Note that we use self.disambiguator here, if we will create new every time - // we will get ICE if params have the same name. - self.resolver.insert_new_def_id( - p.id, - self.tcx - .create_def( - self.local_def_id(item_id), - Some(p.ident.name), - match p.kind { - GenericParamKind::Lifetime => DefKind::LifetimeParam, - GenericParamKind::Type { .. } => DefKind::TyParam, - GenericParamKind::Const { .. } => DefKind::ConstParam, - }, - None, - &mut self.disambiguator, - ) - .def_id(), - ); - } + let param_ident = Ident::new(p.name, span); + let def_name = Some(param_ident.name); + let path_data = def_kind.def_path_data(def_name); + let node_id = self.next_node_id(); - // Fallback to default generic param lowering, we modified them in the loop above. - let params = self.arena.alloc_from_iter( - params.iter().map(|p| self.lower_generic_param(p, hir::GenericParamSource::Generics)), - ); + let def_id = self.create_def(node_id, def_name, def_kind, path_data, span); + + let kind = match p.kind { + GenericParamDefKind::Lifetime => { + hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Explicit } + } + GenericParamDefKind::Type { synthetic, .. } => { + hir::GenericParamKind::Type { default: None, synthetic } + } + GenericParamDefKind::Const { .. } => { + let hir_id = self.next_id(); + let kind = hir::TyKind::InferDelegation(hir::InferDelegation::DefId(p.def_id)); + + hir::GenericParamKind::Const { + ty: self.arena.alloc(hir::Ty { kind, hir_id, span }), + default: None, + } + } + }; + + // Important: we don't use `self.next_id()` as we want to execute + // `lower_node_id` routine so param's id is added to `self.children`. + let hir_id = self.lower_node_id(node_id); + + hir::GenericParam { + hir_id, + colon_span: Some(span), + def_id, + kind, + name: hir::ParamName::Plain(param_ident), + pure_wrt_drop: p.pure_wrt_drop, + source: hir::GenericParamSource::Generics, + span, + } + })); // HACK: for now we generate predicates such that all lifetimes are early bound, // we can not not generate early-bound lifetimes, but we can't know which of them // are late-bound at this level of compilation. // FIXME(fn_delegation): proper support for late bound lifetimes. + let predicates = + self.arena.alloc_from_iter(params.iter().filter_map(|p| { + p.is_lifetime().then(|| self.generate_lifetime_predicate(p, span)) + })); + self.arena.alloc(hir::Generics { params, - predicates: self.arena.alloc_from_iter(params.iter().filter_map(|p| { - p.is_lifetime().then(|| self.generate_lifetime_predicate(p, span)) - })), + predicates, has_where_clause_predicates: false, where_clause_span: span, span, @@ -376,11 +361,9 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { this.arena.alloc(hir::Lifetime { hir_id: this.next_id(), ident: p.name.ident(), - kind: rustc_hir::LifetimeKind::Param(p.def_id), - source: rustc_hir::LifetimeSource::Path { - angle_brackets: rustc_hir::AngleBrackets::Full, - }, - syntax: rustc_hir::LifetimeSyntax::ExplicitBound, + kind: hir::LifetimeKind::Param(p.def_id), + source: hir::LifetimeSource::Path { angle_brackets: hir::AngleBrackets::Full }, + syntax: hir::LifetimeSyntax::ExplicitBound, }) }; @@ -472,117 +455,4 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { span_ext: span, }) } - - fn get_external_generics( - &mut self, - id: DefId, - processing_parent: bool, - span: Span, - ) -> Option { - let generics = self.tcx.generics_of(id); - if generics.own_params.is_empty() { - return None; - } - - // Skip first Self parameter if we are in trait, it will be added later. - let to_skip = (processing_parent && generics.has_self) as usize; - - Some(Generics { - params: generics - .own_params - .iter() - .skip(to_skip) - .map(|p| GenericParam { - attrs: Default::default(), - bounds: Default::default(), - colon_span: None, - id: self.next_node_id(), - ident: Ident::new(p.name, span), - is_placeholder: false, - kind: match p.kind { - GenericParamDefKind::Lifetime => GenericParamKind::Lifetime, - GenericParamDefKind::Type { .. } => { - GenericParamKind::Type { default: None } - } - GenericParamDefKind::Const { .. } => self.map_const_kind(p, span), - }, - }) - .collect(), - where_clause: Default::default(), - span, - }) - } - - fn map_const_kind(&mut self, p: &ty::GenericParamDef, span: Span) -> GenericParamKind { - let const_type = self.tcx.type_of(p.def_id).instantiate_identity(); - - let (type_symbol, res) = match const_type.kind() { - ty::Bool => (sym::bool, Res::PrimTy(hir::PrimTy::Bool)), - ty::Uint(uint) => (uint.name(), Res::PrimTy(hir::PrimTy::Uint(*uint))), - ty::Int(int) => (int.name(), Res::PrimTy(hir::PrimTy::Int(*int))), - ty::Char => (sym::char, Res::PrimTy(hir::PrimTy::Char)), - _ => { - self.tcx - .dcx() - .span_delayed_bug(span, format!("Unexpected const type: {}", const_type)); - - (sym::dummy, Res::Err) - } - }; - - let node_id = self.next_node_id(); - - self.resolver.insert_partial_res(node_id, hir::def::PartialRes::new(res)); - - GenericParamKind::Const { - ty: Box::new(Ty { - id: node_id, - kind: TyKind::Path( - None, - Path { - segments: thin_vec![PathSegment { - ident: Ident::new(type_symbol, span), - id: self.next_node_id(), - args: None - }], - span, - tokens: None, - }, - ), - span, - tokens: None, - }), - span, - default: None, - } - } - - fn get_parent_generics( - &mut self, - id: DefId, - add_self: bool, - user_specified: bool, - span: Span, - ) -> Option { - // If args are user-specified we still maybe need to add self. - let mut generics = - if user_specified { None } else { self.get_external_generics(id, true, span) }; - - if add_self { - generics.get_or_insert_default().params.insert( - 0, - GenericParam { - id: self.next_node_id(), - ident: Ident::new(kw::SelfUpper, span), - attrs: Default::default(), - bounds: vec![], - is_placeholder: false, - kind: GenericParamKind::Type { default: None }, - colon_span: None, - }, - ); - } - - generics - } } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a2be51cfa31b4..5fcc8f0161194 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -678,7 +678,7 @@ pub fn lower_delayed_owner(tcx: TyCtxt<'_>, def_id: LocalDefId) { lowerer.lower_node(def_id); - for (&child_def_id, &owner) in &map { + for (child_def_id, owner) in map { tcx.feed_delayed_owner(child_def_id, owner); } } @@ -1265,7 +1265,7 @@ impl<'hir, R: ResolverAstLoweringExt<'hir>> LoweringContext<'_, 'hir, R> { }; gen_args_ctor.into_generic_args(self) } else { - self.arena.alloc(hir::GenericArgs::none()) + hir::GenericArgs::NONE }; let kind = match &constraint.kind { AssocItemConstraintKind::Equality { term } => { diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 9526143fcace5..a5cb654043625 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -397,12 +397,7 @@ impl<'hir> PathSegment<'hir> { } pub fn args(&self) -> &GenericArgs<'hir> { - if let Some(ref args) = self.args { - args - } else { - const DUMMY: &GenericArgs<'_> = &GenericArgs::none(); - DUMMY - } + if let Some(ref args) = self.args { args } else { GenericArgs::NONE } } } @@ -643,14 +638,12 @@ pub struct GenericArgs<'hir> { } impl<'hir> GenericArgs<'hir> { - pub const fn none() -> Self { - Self { - args: &[], - constraints: &[], - parenthesized: GenericArgsParentheses::No, - span_ext: DUMMY_SP, - } - } + pub const NONE: &'hir GenericArgs<'hir> = &GenericArgs { + args: &[], + constraints: &[], + parenthesized: GenericArgsParentheses::No, + span_ext: DUMMY_SP, + }; /// Obtain the list of input types and the output type if the generic arguments are parenthesized. /// @@ -3765,12 +3758,21 @@ pub struct DelegationGenerics { } #[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)] -pub enum InferDelegationKind<'hir> { +pub enum InferDelegationSig<'hir> { Input(usize), // Place generics info here, as we always specify output type for delegations. Output(&'hir DelegationGenerics), } +#[derive(Debug, Clone, Copy, PartialEq, Eq, HashStable_Generic)] +pub enum InferDelegation<'hir> { + /// Infer the type of this `DefId` through `tcx.type_of(def_id).instantiate_identity()`, + /// used for const types propagation. + DefId(DefId), + /// Used during signature inheritance, `DefId` corresponds to the signature function. + Sig(DefId, InferDelegationSig<'hir>), +} + /// The various kinds of types recognized by the compiler. /// /// For an explanation of the `Unambig` generic parameter see the dev-guide: @@ -3780,7 +3782,7 @@ pub enum InferDelegationKind<'hir> { #[derive(Debug, Clone, Copy, HashStable_Generic)] pub enum TyKind<'hir, Unambig = ()> { /// Actual type should be inherited from `DefId` signature - InferDelegation(DefId, InferDelegationKind<'hir>), + InferDelegation(InferDelegation<'hir>), /// A variable length slice (i.e., `[T]`). Slice(&'hir Ty<'hir>), /// A fixed length array (i.e., `[T; n]`). @@ -3931,7 +3933,7 @@ pub struct FnDecl<'hir> { impl<'hir> FnDecl<'hir> { pub fn opt_delegation_sig_id(&self) -> Option { if let FnRetTy::Return(ty) = self.output - && let TyKind::InferDelegation(sig_id, _) = ty.kind + && let TyKind::InferDelegation(InferDelegation::Sig(sig_id, _)) = ty.kind { return Some(sig_id); } @@ -3940,8 +3942,8 @@ impl<'hir> FnDecl<'hir> { pub fn opt_delegation_generics(&self) -> Option<&'hir DelegationGenerics> { if let FnRetTy::Return(ty) = self.output - && let TyKind::InferDelegation(_, kind) = ty.kind - && let InferDelegationKind::Output(generics) = kind + && let TyKind::InferDelegation(InferDelegation::Sig(_, kind)) = ty.kind + && let InferDelegationSig::Output(generics) = kind { return Some(generics); } diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index 18244d62f2ae6..5bb4166bf6cb3 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -925,7 +925,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { hir::FnRetTy::Return(ty) => Some(ty), }; if let Some(ty) = output - && let hir::TyKind::InferDelegation(sig_id, _) = ty.kind + && let hir::TyKind::InferDelegation(hir::InferDelegation::Sig(sig_id, _)) = ty.kind { let bound_vars: Vec<_> = self.tcx.fn_sig(sig_id).skip_binder().bound_vars().iter().collect(); diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 9396bf6352c59..1200f6e9e47ea 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -2959,12 +2959,19 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { } } - fn lower_delegation_ty(&self, idx: hir::InferDelegationKind<'tcx>) -> Ty<'tcx> { - let delegation_sig = self.tcx().inherit_sig_for_delegation_item(self.item_def_id()); + fn lower_delegation_ty(&self, infer: hir::InferDelegation<'tcx>) -> Ty<'tcx> { + match infer { + hir::InferDelegation::DefId(def_id) => { + self.tcx().type_of(def_id).instantiate_identity() + } + rustc_hir::InferDelegation::Sig(_, idx) => { + let delegation_sig = self.tcx().inherit_sig_for_delegation_item(self.item_def_id()); - match idx { - hir::InferDelegationKind::Input(idx) => delegation_sig[idx], - hir::InferDelegationKind::Output { .. } => *delegation_sig.last().unwrap(), + match idx { + hir::InferDelegationSig::Input(idx) => delegation_sig[idx], + hir::InferDelegationSig::Output { .. } => *delegation_sig.last().unwrap(), + } + } } } @@ -2974,7 +2981,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { let tcx = self.tcx(); let result_ty = match &hir_ty.kind { - hir::TyKind::InferDelegation(_, idx) => self.lower_delegation_ty(*idx), + hir::TyKind::InferDelegation(infer) => self.lower_delegation_ty(*infer), hir::TyKind::Slice(ty) => Ty::new_slice(tcx, self.lower_ty(ty)), hir::TyKind::Ptr(mt) => Ty::new_ptr(tcx, self.lower_ty(mt.ty), mt.mutbl), hir::TyKind::Ref(region, mt) => { diff --git a/tests/ui/delegation/generics/const-type-ice-153433.rs b/tests/ui/delegation/generics/const-type-ice-153433.rs new file mode 100644 index 0000000000000..edd6d0542a999 --- /dev/null +++ b/tests/ui/delegation/generics/const-type-ice-153433.rs @@ -0,0 +1,8 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +fn main() { + fn foo Foo>() {} + //~^ ERROR: cannot find trait `Foo` in this scope + reuse foo as bar; +} diff --git a/tests/ui/delegation/generics/const-type-ice-153433.stderr b/tests/ui/delegation/generics/const-type-ice-153433.stderr new file mode 100644 index 0000000000000..3b537e2f8988e --- /dev/null +++ b/tests/ui/delegation/generics/const-type-ice-153433.stderr @@ -0,0 +1,9 @@ +error[E0405]: cannot find trait `Foo` in this scope + --> $DIR/const-type-ice-153433.rs:5:33 + | +LL | fn foo Foo>() {} + | ^^^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0405`. diff --git a/tests/ui/delegation/generics/const-type-ice-153499.rs b/tests/ui/delegation/generics/const-type-ice-153499.rs new file mode 100644 index 0000000000000..debda0d04a18c --- /dev/null +++ b/tests/ui/delegation/generics/const-type-ice-153499.rs @@ -0,0 +1,13 @@ +#![feature(fn_delegation)] +#![allow(incomplete_features)] + +trait Trait<'a, T, const F: fn(&CStr) -> usize> { + //~^ ERROR: cannot find type `CStr` in this scope + //~| ERROR: using function pointers as const generic parameters is forbidden + fn foo<'x: 'x, A, B>(&self) {} +} + +reuse Trait::foo; +//~^ ERROR: using function pointers as const generic parameters is forbidden + +fn main() {} diff --git a/tests/ui/delegation/generics/const-type-ice-153499.stderr b/tests/ui/delegation/generics/const-type-ice-153499.stderr new file mode 100644 index 0000000000000..02fd7197dcdc3 --- /dev/null +++ b/tests/ui/delegation/generics/const-type-ice-153499.stderr @@ -0,0 +1,30 @@ +error[E0425]: cannot find type `CStr` in this scope + --> $DIR/const-type-ice-153499.rs:4:33 + | +LL | trait Trait<'a, T, const F: fn(&CStr) -> usize> { + | ^^^^ not found in this scope + | +help: consider importing this struct + | +LL + use std::ffi::CStr; + | + +error: using function pointers as const generic parameters is forbidden + --> $DIR/const-type-ice-153499.rs:4:29 + | +LL | trait Trait<'a, T, const F: fn(&CStr) -> usize> { + | ^^^^^^^^^^^^^^^^^^ + | + = note: the only supported types are integers, `bool`, and `char` + +error: using function pointers as const generic parameters is forbidden + --> $DIR/const-type-ice-153499.rs:10:14 + | +LL | reuse Trait::foo; + | ^^^ + | + = note: the only supported types are integers, `bool`, and `char` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0425`.