about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-08-06 23:23:26 +0000
committerbors <bors@rust-lang.org>2025-08-06 23:23:26 +0000
commit6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd (patch)
tree7404b3b99695ca9e1343e7ae067f38a3aae59a2a /tests
parent7d82b83ed57d188ab3f2441a765a6419685a88a3 (diff)
parentd369a1fe5e7fbf17cc3ed74057928b875fe40ce7 (diff)
downloadrust-6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd.tar.gz
rust-6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd.zip
Auto merge of #145020 - GuillaumeGomez:rollup-5prs9kw, r=GuillaumeGomez
Rollup of 15 pull requests

Successful merges:

 - rust-lang/rust#144195 (Parser: Recover from attributes applied to types and generic args)
 - rust-lang/rust#144794 (Port `#[coroutine]` to the new attribute system)
 - rust-lang/rust#144835 (Anonymize binders in tail call sig)
 - rust-lang/rust#144861 (Stabilize `panic_payload_as_str` feature)
 - rust-lang/rust#144917 (Enforce tail call type is related to body return type in borrowck)
 - rust-lang/rust#144948 (we only merge candidates for trait and normalizes-to goals)
 - rust-lang/rust#144956 (Gate const trait syntax)
 - rust-lang/rust#144970 (rustdoc: fix caching of intra-doc links on reexports)
 - rust-lang/rust#144972 (add code example showing that file_prefix treats dotfiles as the name of a file, not an extension)
 - rust-lang/rust#144975 (`File::set_times`: Update documentation and example to support setting timestamps on directories)
 - rust-lang/rust#144977 (Fortify generic param default checks)
 - rust-lang/rust#144996 (simplifycfg: Mark as changed when start is modified in collapse goto chain)
 - rust-lang/rust#144998 (mir: Do not modify NonUse in `super_projection_elem`)
 - rust-lang/rust#145000 (Remove unneeded `stage` parameter when setting up stdlib Cargo)
 - rust-lang/rust#145008 (Fix rustdoc scrape examples crash)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml8
-rw-r--r--tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs3
-rw-r--r--tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs1
-rw-r--r--tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs7
-rw-r--r--tests/run-make/rustdoc-scrape-examples-paths/rmake.rs16
-rw-r--r--tests/rustdoc/intra-doc/macro-caching-144965.rs35
-rw-r--r--tests/ui/attributes/malformed-attrs.stderr15
-rw-r--r--tests/ui/const-generics/defaults/default-on-impl.rs2
-rw-r--r--tests/ui/const-generics/defaults/default-on-impl.stderr2
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-105257.rs6
-rw-r--r--tests/ui/const-generics/generic_const_exprs/issue-105257.stderr4
-rw-r--r--tests/ui/const-generics/min_const_generics/default_function_param.rs2
-rw-r--r--tests/ui/const-generics/min_const_generics/default_function_param.stderr2
-rw-r--r--tests/ui/explicit-tail-calls/higher-ranked-arg.rs13
-rw-r--r--tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.rs16
-rw-r--r--tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.stderr10
-rw-r--r--tests/ui/generic-associated-types/type-param-defaults.rs6
-rw-r--r--tests/ui/generic-associated-types/type-param-defaults.stderr6
-rw-r--r--tests/ui/generic-const-items/parameter-defaults.rs16
-rw-r--r--tests/ui/generic-const-items/parameter-defaults.stderr31
-rw-r--r--tests/ui/generics/generic-extern.rs10
-rw-r--r--tests/ui/generics/generic-extern.stderr23
-rw-r--r--tests/ui/generics/invalid-type-param-default.rs22
-rw-r--r--tests/ui/generics/invalid-type-param-default.stderr70
-rw-r--r--tests/ui/generics/overlapping-errors-span-issue-123861.rs2
-rw-r--r--tests/ui/generics/overlapping-errors-span-issue-123861.stderr4
-rw-r--r--tests/ui/impl-trait/where-allowed.rs12
-rw-r--r--tests/ui/impl-trait/where-allowed.stderr55
-rw-r--r--tests/ui/issues/issue-26812.rs6
-rw-r--r--tests/ui/issues/issue-26812.stderr30
-rw-r--r--tests/ui/lifetimes/unusual-rib-combinations.rs2
-rw-r--r--tests/ui/lifetimes/unusual-rib-combinations.stderr4
-rw-r--r--tests/ui/missing/missing-items/missing-type-parameter2.rs2
-rw-r--r--tests/ui/missing/missing-items/missing-type-parameter2.stderr2
-rw-r--r--tests/ui/parser/attribute-on-empty.rs29
-rw-r--r--tests/ui/parser/attribute-on-empty.stderr52
-rw-r--r--tests/ui/parser/attribute-on-type.fixed58
-rw-r--r--tests/ui/parser/attribute-on-type.rs58
-rw-r--r--tests/ui/parser/attribute-on-type.stderr92
-rw-r--r--tests/ui/parser/issues/issue-103143.rs2
-rw-r--r--tests/ui/parser/issues/issue-103143.stderr11
-rw-r--r--tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed4
-rw-r--r--tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs4
-rw-r--r--tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr10
-rw-r--r--tests/ui/traits/const-traits/feature-gate.rs3
-rw-r--r--tests/ui/traits/const-traits/feature-gate.stock.stderr26
-rw-r--r--tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr2
-rw-r--r--tests/ui/type/default_type_parameter_in_fn_or_impl.rs12
-rw-r--r--tests/ui/type/default_type_parameter_in_fn_or_impl.stderr43
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs2
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr2
51 files changed, 644 insertions, 211 deletions
diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml b/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml
new file mode 100644
index 00000000000..6962028375b
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "foo"
+version = "0.0.1"
+edition = "2024"
+
+[[example]]
+name = "complex"
+doc-scrape-examples = true
diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs
new file mode 100644
index 00000000000..1cda7e098f4
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/complex.rs
@@ -0,0 +1,3 @@
+fn main() {
+    let mut x = foo::X::new();
+}
diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs
new file mode 100644
index 00000000000..fbd1906ec09
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/examples/tester.rs
@@ -0,0 +1 @@
+// This file MUST exist to trigger the original bug.
diff --git a/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs
new file mode 100644
index 00000000000..a9bb0272c78
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-paths/foo/src/lib.rs
@@ -0,0 +1,7 @@
+pub struct X;
+
+impl X {
+    pub fn new() -> Self {
+        X
+    }
+}
diff --git a/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs b/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs
new file mode 100644
index 00000000000..03888f69eab
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-paths/rmake.rs
@@ -0,0 +1,16 @@
+//! Test to ensure that the rustdoc `scrape-examples` feature is not panicking.
+//! Regression test for <https://github.com/rust-lang/rust/issues/144752>.
+
+use run_make_support::{cargo, path, rfs};
+
+fn main() {
+    // We copy the crate to be documented "outside" to prevent documenting
+    // the whole compiler.
+    let tmp = std::env::temp_dir();
+    let test_crate = tmp.join("foo");
+    rfs::copy_dir_all(path("foo"), &test_crate);
+
+    // The `scrape-examples` feature is also implemented in `cargo` so instead of reproducing
+    // what `cargo` does, better to just let `cargo` do it.
+    cargo().current_dir(&test_crate).args(["doc", "-p", "foo", "-Zrustdoc-scrape-examples"]).run();
+}
diff --git a/tests/rustdoc/intra-doc/macro-caching-144965.rs b/tests/rustdoc/intra-doc/macro-caching-144965.rs
new file mode 100644
index 00000000000..e14b465aeea
--- /dev/null
+++ b/tests/rustdoc/intra-doc/macro-caching-144965.rs
@@ -0,0 +1,35 @@
+// regression test for https://github.com/rust-lang/rust/issues/144965
+
+#![crate_name = "foo"]
+#![no_std]
+
+#[doc(hidden)]
+pub struct MyStruct;
+
+macro_rules! my_macro {
+    () => {
+        pub fn my_function() {}
+
+        /// Incorrect: [`my_function()`].
+        #[doc(inline)]
+        pub use $crate::MyStruct;
+
+        /// Correct: [`my_function`].
+        pub struct AnotherStruct;
+    };
+}
+
+
+pub mod one {
+    //@ has 'foo/one/index.html'
+    //@ has - '//dl[@class="item-table"]/dd[1]/a[@href="fn.my_function.html"]/code' 'my_function'
+    //@ has - '//dl[@class="item-table"]/dd[2]/a[@href="fn.my_function.html"]/code' 'my_function()'
+    my_macro!();
+}
+
+pub mod two {
+    //@ has 'foo/two/index.html'
+    //@ has - '//dl[@class="item-table"]/dd[1]/a[@href="fn.my_function.html"]/code' 'my_function'
+    //@ has - '//dl[@class="item-table"]/dd[2]/a[@href="fn.my_function.html"]/code' 'my_function()'
+    my_macro!();
+}
diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr
index 1b51075b4e8..e8ae4715398 100644
--- a/tests/ui/attributes/malformed-attrs.stderr
+++ b/tests/ui/attributes/malformed-attrs.stderr
@@ -55,12 +55,6 @@ error: malformed `patchable_function_entry` attribute input
 LL | #[patchable_function_entry]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
 
-error: malformed `coroutine` attribute input
-  --> $DIR/malformed-attrs.rs:108:5
-   |
-LL |     #[coroutine = 63] || {}
-   |     ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[coroutine]`
-
 error: malformed `must_not_suspend` attribute input
   --> $DIR/malformed-attrs.rs:129:1
    |
@@ -436,6 +430,15 @@ LL | #[proc_macro = 18]
    | |            didn't expect any arguments here
    | help: must be of the form: `#[proc_macro]`
 
+error[E0565]: malformed `coroutine` attribute input
+  --> $DIR/malformed-attrs.rs:108:5
+   |
+LL |     #[coroutine = 63] || {}
+   |     ^^^^^^^^^^^^----^
+   |     |           |
+   |     |           didn't expect any arguments here
+   |     help: must be of the form: `#[coroutine]`
+
 error[E0565]: malformed `proc_macro_attribute` attribute input
   --> $DIR/malformed-attrs.rs:113:1
    |
diff --git a/tests/ui/const-generics/defaults/default-on-impl.rs b/tests/ui/const-generics/defaults/default-on-impl.rs
index 9ce46aa09de..85d0c583965 100644
--- a/tests/ui/const-generics/defaults/default-on-impl.rs
+++ b/tests/ui/const-generics/defaults/default-on-impl.rs
@@ -1,6 +1,6 @@
 struct Foo<const N: usize>;
 
 impl<const N: usize = 1> Foo<N> {}
-//~^ ERROR defaults for const parameters are only allowed
+//~^ ERROR defaults for generic parameters are not allowed here
 
 fn main() {}
diff --git a/tests/ui/const-generics/defaults/default-on-impl.stderr b/tests/ui/const-generics/defaults/default-on-impl.stderr
index 691e0354edd..eb5d57e14bf 100644
--- a/tests/ui/const-generics/defaults/default-on-impl.stderr
+++ b/tests/ui/const-generics/defaults/default-on-impl.stderr
@@ -1,4 +1,4 @@
-error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/default-on-impl.rs:3:6
    |
 LL | impl<const N: usize = 1> Foo<N> {}
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-105257.rs b/tests/ui/const-generics/generic_const_exprs/issue-105257.rs
index a107556fd79..85a28f2b330 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-105257.rs
+++ b/tests/ui/const-generics/generic_const_exprs/issue-105257.rs
@@ -1,10 +1,10 @@
 #![feature(generic_const_exprs)]
-#![allow(incomplete_features)]
+#![expect(incomplete_features)]
 
 trait Trait<T> {
-    fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+    fn fnc<const N: usize = "">(&self) {} //~ERROR defaults for generic parameters are not allowed here
     //~^ ERROR: mismatched types
-    fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+    fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {} //~ERROR defaults for generic parameters are not allowed here
 }
 
 fn main() {}
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr b/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr
index d7ded0f1f74..1d0ab56519c 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-105257.stderr
@@ -1,10 +1,10 @@
-error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/issue-105257.rs:5:12
    |
 LL |     fn fnc<const N: usize = "">(&self) {}
    |            ^^^^^^^^^^^^^^^^^^^
 
-error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/issue-105257.rs:7:12
    |
 LL |     fn foo<const N: usize = { std::mem::size_of::<T>() }>(&self) {}
diff --git a/tests/ui/const-generics/min_const_generics/default_function_param.rs b/tests/ui/const-generics/min_const_generics/default_function_param.rs
index 92d495ef665..153cd94849e 100644
--- a/tests/ui/const-generics/min_const_generics/default_function_param.rs
+++ b/tests/ui/const-generics/min_const_generics/default_function_param.rs
@@ -1,4 +1,4 @@
 #![crate_type = "lib"]
 
 fn foo<const SIZE: usize = 5usize>() {}
-//~^ ERROR defaults for const parameters are
+//~^ ERROR defaults for generic parameters are not allowed here
diff --git a/tests/ui/const-generics/min_const_generics/default_function_param.stderr b/tests/ui/const-generics/min_const_generics/default_function_param.stderr
index 247eea3d989..261298a1c63 100644
--- a/tests/ui/const-generics/min_const_generics/default_function_param.stderr
+++ b/tests/ui/const-generics/min_const_generics/default_function_param.stderr
@@ -1,4 +1,4 @@
-error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/default_function_param.rs:3:8
    |
 LL | fn foo<const SIZE: usize = 5usize>() {}
diff --git a/tests/ui/explicit-tail-calls/higher-ranked-arg.rs b/tests/ui/explicit-tail-calls/higher-ranked-arg.rs
new file mode 100644
index 00000000000..e60686ab511
--- /dev/null
+++ b/tests/ui/explicit-tail-calls/higher-ranked-arg.rs
@@ -0,0 +1,13 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/144826>.
+//@ check-pass
+
+#![feature(explicit_tail_calls)]
+#![expect(incomplete_features)]
+
+fn foo(x: fn(&i32)) {
+    become bar(x);
+}
+
+fn bar(_: fn(&i32)) {}
+
+fn main() {}
diff --git a/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.rs b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.rs
new file mode 100644
index 00000000000..111ae849c0f
--- /dev/null
+++ b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.rs
@@ -0,0 +1,16 @@
+#![feature(explicit_tail_calls)]
+#![expect(incomplete_features)]
+
+fn link(x: &str) -> &'static str {
+    become passthrough(x);
+    //~^ ERROR lifetime may not live long enough
+}
+
+fn passthrough<T>(t: T) -> T { t }
+
+fn main() {
+    let x = String::from("hello, world");
+    let s = link(&x);
+    drop(x);
+    println!("{s}");
+}
diff --git a/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.stderr b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.stderr
new file mode 100644
index 00000000000..26a8e1f0122
--- /dev/null
+++ b/tests/ui/explicit-tail-calls/ret-ty-borrowck-constraints.stderr
@@ -0,0 +1,10 @@
+error: lifetime may not live long enough
+  --> $DIR/ret-ty-borrowck-constraints.rs:5:5
+   |
+LL | fn link(x: &str) -> &'static str {
+   |            - let's call the lifetime of this reference `'1`
+LL |     become passthrough(x);
+   |     ^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'static`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/generic-associated-types/type-param-defaults.rs b/tests/ui/generic-associated-types/type-param-defaults.rs
index eea54c46073..6e9a62b96c4 100644
--- a/tests/ui/generic-associated-types/type-param-defaults.rs
+++ b/tests/ui/generic-associated-types/type-param-defaults.rs
@@ -4,17 +4,17 @@
 
 trait Trait {
     type Assoc<T = u32>;
-    //~^ ERROR defaults for type parameters are only allowed
+    //~^ ERROR defaults for generic parameters are not allowed here
 }
 
 impl Trait for () {
     type Assoc<T = u32> = u64;
-    //~^ ERROR defaults for type parameters are only allowed
+    //~^ ERROR defaults for generic parameters are not allowed here
 }
 
 impl Trait for u32 {
     type Assoc<T = u32> = T;
-    //~^ ERROR defaults for type parameters are only allowed
+    //~^ ERROR defaults for generic parameters are not allowed here
 }
 
 trait Other {}
diff --git a/tests/ui/generic-associated-types/type-param-defaults.stderr b/tests/ui/generic-associated-types/type-param-defaults.stderr
index 3c094d45fff..d9872dadbdb 100644
--- a/tests/ui/generic-associated-types/type-param-defaults.stderr
+++ b/tests/ui/generic-associated-types/type-param-defaults.stderr
@@ -1,16 +1,16 @@
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/type-param-defaults.rs:6:16
    |
 LL |     type Assoc<T = u32>;
    |                ^^^^^^^
 
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/type-param-defaults.rs:11:16
    |
 LL |     type Assoc<T = u32> = u64;
    |                ^^^^^^^
 
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/type-param-defaults.rs:16:16
    |
 LL |     type Assoc<T = u32> = T;
diff --git a/tests/ui/generic-const-items/parameter-defaults.rs b/tests/ui/generic-const-items/parameter-defaults.rs
index c933db17fa2..b52cb0fd002 100644
--- a/tests/ui/generic-const-items/parameter-defaults.rs
+++ b/tests/ui/generic-const-items/parameter-defaults.rs
@@ -7,9 +7,17 @@
 
 // FIXME(default_type_parameter_fallback): Consider reallowing them once they work properly.
 
-const NONE<T = ()>: Option<T> = None::<T>; //~ ERROR defaults for type parameters are only allowed
+const NONE<T = ()>: Option<T> = None::<T>;
+//~^ ERROR defaults for generic parameters are not allowed here
 
-fn main() {
-    let _ = NONE;
-    //~^ ERROR type annotations needed
+impl Host {
+    const NADA<T = ()>: Option<T> = None::<T>;
+    //~^ ERROR defaults for generic parameters are not allowed here
 }
+
+enum Host {}
+
+fn body0() { let _ = NONE; } //~ ERROR type annotations needed
+fn body1() { let _ = Host::NADA; } //~ ERROR type annotations needed
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/parameter-defaults.stderr b/tests/ui/generic-const-items/parameter-defaults.stderr
index 13562c98f6d..9bf1f6412f5 100644
--- a/tests/ui/generic-const-items/parameter-defaults.stderr
+++ b/tests/ui/generic-const-items/parameter-defaults.stderr
@@ -1,20 +1,37 @@
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/parameter-defaults.rs:10:12
    |
 LL | const NONE<T = ()>: Option<T> = None::<T>;
    |            ^^^^^^
 
+error: defaults for generic parameters are not allowed here
+  --> $DIR/parameter-defaults.rs:14:16
+   |
+LL |     const NADA<T = ()>: Option<T> = None::<T>;
+   |                ^^^^^^
+
+error[E0282]: type annotations needed for `Option<_>`
+  --> $DIR/parameter-defaults.rs:20:18
+   |
+LL | fn body0() { let _ = NONE; }
+   |                  ^   ---- type must be known at this point
+   |
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
+   |
+LL | fn body0() { let _: Option<T> = NONE; }
+   |                   +++++++++++
+
 error[E0282]: type annotations needed for `Option<_>`
-  --> $DIR/parameter-defaults.rs:13:9
+  --> $DIR/parameter-defaults.rs:21:18
    |
-LL |     let _ = NONE;
-   |         ^   ---- type must be known at this point
+LL | fn body1() { let _ = Host::NADA; }
+   |                  ^   ---------- type must be known at this point
    |
 help: consider giving this pattern a type, where the type for type parameter `T` is specified
    |
-LL |     let _: Option<T> = NONE;
-   |          +++++++++++
+LL | fn body1() { let _: Option<T> = Host::NADA; }
+   |                   +++++++++++
 
-error: aborting due to 2 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/generics/generic-extern.rs b/tests/ui/generics/generic-extern.rs
index 36fa5eaafd6..b4f00fc1187 100644
--- a/tests/ui/generics/generic-extern.rs
+++ b/tests/ui/generics/generic-extern.rs
@@ -1,7 +1,15 @@
+// Ensure that we reject generic parameters on foreign items.
+
 extern "C" {
     fn foo<T>(); //~ ERROR foreign items may not have type parameters
+
+    // Furthermore, check that type parameter defaults lead to a *hard* error,
+    // not just a lint error, for maximum forward compatibility.
+    #[allow(invalid_type_param_default)] // Should have no effect here.
+    fn bar<T = ()>(); //~ ERROR foreign items may not have type parameters
+    //~^ ERROR defaults for generic parameters are not allowed here
 }
 
 fn main() {
-    foo::<i32>(); //~ ERROR requires unsafe
+    unsafe { foo::<i32>() };
 }
diff --git a/tests/ui/generics/generic-extern.stderr b/tests/ui/generics/generic-extern.stderr
index a3f28825316..6e837156812 100644
--- a/tests/ui/generics/generic-extern.stderr
+++ b/tests/ui/generics/generic-extern.stderr
@@ -1,20 +1,25 @@
 error[E0044]: foreign items may not have type parameters
-  --> $DIR/generic-extern.rs:2:5
+  --> $DIR/generic-extern.rs:4:5
    |
 LL |     fn foo<T>();
    |     ^^^^^^^^^^^^ can't have type parameters
    |
    = help: replace the type parameters with concrete types like `u32`
 
-error[E0133]: call to unsafe function `foo` is unsafe and requires unsafe function or block
-  --> $DIR/generic-extern.rs:6:5
+error: defaults for generic parameters are not allowed here
+  --> $DIR/generic-extern.rs:9:12
    |
-LL |     foo::<i32>();
-   |     ^^^^^^^^^^^^ call to unsafe function
+LL |     fn bar<T = ()>();
+   |            ^^^^^^
+
+error[E0044]: foreign items may not have type parameters
+  --> $DIR/generic-extern.rs:9:5
    |
-   = note: consult the function's documentation for information on how to avoid undefined behavior
+LL |     fn bar<T = ()>();
+   |     ^^^^^^^^^^^^^^^^^ can't have type parameters
+   |
+   = help: replace the type parameters with concrete types like `u32`
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0044, E0133.
-For more information about an error, try `rustc --explain E0044`.
+For more information about this error, try `rustc --explain E0044`.
diff --git a/tests/ui/generics/invalid-type-param-default.rs b/tests/ui/generics/invalid-type-param-default.rs
new file mode 100644
index 00000000000..b47e142605c
--- /dev/null
+++ b/tests/ui/generics/invalid-type-param-default.rs
@@ -0,0 +1,22 @@
+// Ensure that we emit the deny-by-default lint `invalid_type_param_default` in locations where
+// type parameter defaults were accidentally allowed but don't have any effect whatsoever.
+//
+// Tracked in <https://github.com/rust-lang/rust/issues/36887>.
+// FIXME(default_type_parameter_fallback): Consider reallowing them once they work properly.
+
+fn avg<T = i32>(_: T) {}
+//~^ ERROR defaults for generic parameters are not allowed here [invalid_type_param_default]
+//~| WARN this was previously accepted
+
+// issue: <https://github.com/rust-lang/rust/issues/26812>
+fn mdn<T = T::Item>(_: T) {}
+//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
+//~| ERROR defaults for generic parameters are not allowed here [invalid_type_param_default]
+//~| WARN this was previously accepted
+
+struct S<T>(T);
+impl<T = i32> S<T> {}
+//~^ ERROR defaults for generic parameters are not allowed here [invalid_type_param_default]
+//~| WARN this was previously accepted
+
+fn main() {}
diff --git a/tests/ui/generics/invalid-type-param-default.stderr b/tests/ui/generics/invalid-type-param-default.stderr
new file mode 100644
index 00000000000..1c8fdd8ab5c
--- /dev/null
+++ b/tests/ui/generics/invalid-type-param-default.stderr
@@ -0,0 +1,70 @@
+error[E0128]: generic parameter defaults cannot reference parameters before they are declared
+  --> $DIR/invalid-type-param-default.rs:12:12
+   |
+LL | fn mdn<T = T::Item>(_: T) {}
+   |            ^^^^^^^ cannot reference `T` before it is declared
+
+error: defaults for generic parameters are not allowed here
+  --> $DIR/invalid-type-param-default.rs:7:8
+   |
+LL | fn avg<T = i32>(_: T) {}
+   |        ^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
+   = note: `#[deny(invalid_type_param_default)]` on by default
+
+error: defaults for generic parameters are not allowed here
+  --> $DIR/invalid-type-param-default.rs:12:8
+   |
+LL | fn mdn<T = T::Item>(_: T) {}
+   |        ^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
+
+error: defaults for generic parameters are not allowed here
+  --> $DIR/invalid-type-param-default.rs:18:6
+   |
+LL | impl<T = i32> S<T> {}
+   |      ^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0128`.
+Future incompatibility report: Future breakage diagnostic:
+error: defaults for generic parameters are not allowed here
+  --> $DIR/invalid-type-param-default.rs:7:8
+   |
+LL | fn avg<T = i32>(_: T) {}
+   |        ^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
+   = note: `#[deny(invalid_type_param_default)]` on by default
+
+Future breakage diagnostic:
+error: defaults for generic parameters are not allowed here
+  --> $DIR/invalid-type-param-default.rs:12:8
+   |
+LL | fn mdn<T = T::Item>(_: T) {}
+   |        ^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
+   = note: `#[deny(invalid_type_param_default)]` on by default
+
+Future breakage diagnostic:
+error: defaults for generic parameters are not allowed here
+  --> $DIR/invalid-type-param-default.rs:18:6
+   |
+LL | impl<T = i32> S<T> {}
+   |      ^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
+   = note: `#[deny(invalid_type_param_default)]` on by default
+
diff --git a/tests/ui/generics/overlapping-errors-span-issue-123861.rs b/tests/ui/generics/overlapping-errors-span-issue-123861.rs
index e0a27f68748..2549f4b3714 100644
--- a/tests/ui/generics/overlapping-errors-span-issue-123861.rs
+++ b/tests/ui/generics/overlapping-errors-span-issue-123861.rs
@@ -1,7 +1,7 @@
 fn mainIterator<_ = _> {}
 //~^ ERROR expected identifier, found reserved identifier `_`
 //~| ERROR   missing parameters for function definition
-//~| ERROR   defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions [invalid_type_param_default]
+//~| ERROR   defaults for generic parameters are not allowed here [invalid_type_param_default]
 //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 //~| ERROR   the placeholder `_` is not allowed within types on item signatures for functions [E0121]
 
diff --git a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr
index 7d08d8fed9f..44e8b4a01e7 100644
--- a/tests/ui/generics/overlapping-errors-span-issue-123861.stderr
+++ b/tests/ui/generics/overlapping-errors-span-issue-123861.stderr
@@ -15,7 +15,7 @@ help: add a parameter list
 LL | fn mainIterator<_ = _>() {}
    |                       ++
 
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/overlapping-errors-span-issue-123861.rs:1:17
    |
 LL | fn mainIterator<_ = _> {}
@@ -35,7 +35,7 @@ error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0121`.
 Future incompatibility report: Future breakage diagnostic:
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/overlapping-errors-span-issue-123861.rs:1:17
    |
 LL | fn mainIterator<_ = _> {}
diff --git a/tests/ui/impl-trait/where-allowed.rs b/tests/ui/impl-trait/where-allowed.rs
index 1c3c66c537f..04a95f7f6f0 100644
--- a/tests/ui/impl-trait/where-allowed.rs
+++ b/tests/ui/impl-trait/where-allowed.rs
@@ -236,17 +236,15 @@ type InTypeAliasGenericParamDefault<T = impl Debug> = T;
 //~^ ERROR `impl Trait` is not allowed in generic parameter defaults
 
 // Disallowed
-impl <T = impl Debug> T {}
-//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` is not allowed in generic parameter defaults
+#[expect(invalid_type_param_default)]
+impl<T = impl Debug> T {}
+//~^ ERROR `impl Trait` is not allowed in generic parameter defaults
 //~| ERROR no nominal type found
 
 // Disallowed
+#[expect(invalid_type_param_default)]
 fn in_method_generic_param_default<T = impl Debug>(_: T) {}
-//~^ ERROR defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-//~| WARNING this was previously accepted by the compiler but is being phased out
-//~| ERROR `impl Trait` is not allowed in generic parameter defaults
+//~^ ERROR `impl Trait` is not allowed in generic parameter defaults
 
 fn main() {
     let _in_local_variable: impl Fn() = || {};
diff --git a/tests/ui/impl-trait/where-allowed.stderr b/tests/ui/impl-trait/where-allowed.stderr
index 052ae5a9931..08caff326c4 100644
--- a/tests/ui/impl-trait/where-allowed.stderr
+++ b/tests/ui/impl-trait/where-allowed.stderr
@@ -311,10 +311,10 @@ LL | type InTypeAliasGenericParamDefault<T = impl Debug> = T;
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in generic parameter defaults
-  --> $DIR/where-allowed.rs:239:11
+  --> $DIR/where-allowed.rs:240:10
    |
-LL | impl <T = impl Debug> T {}
-   |           ^^^^^^^^^^
+LL | impl<T = impl Debug> T {}
+   |          ^^^^^^^^^^
    |
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
@@ -327,7 +327,7 @@ LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    = note: `impl Trait` is only allowed in arguments and return types of functions and methods
 
 error[E0562]: `impl Trait` is not allowed in the type of variable bindings
-  --> $DIR/where-allowed.rs:252:29
+  --> $DIR/where-allowed.rs:250:29
    |
 LL |     let _in_local_variable: impl Fn() = || {};
    |                             ^^^^^^^^^
@@ -338,7 +338,7 @@ LL |     let _in_local_variable: impl Fn() = || {};
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0562]: `impl Trait` is not allowed in closure return types
-  --> $DIR/where-allowed.rs:254:46
+  --> $DIR/where-allowed.rs:252:46
    |
 LL |     let _in_return_in_local_variable = || -> impl Fn() { || {} };
    |                                              ^^^^^^^^^
@@ -368,25 +368,6 @@ LL -     fn in_trait_impl_return() -> impl Debug { () }
 LL +     fn in_trait_impl_return() -> <() as DummyTrait>::Out { () }
    |
 
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:246:36
-   |
-LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
-   |                                    ^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
-
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:239:7
-   |
-LL | impl <T = impl Debug> T {}
-   |       ^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-
 error[E0283]: type annotations needed
   --> $DIR/where-allowed.rs:46:57
    |
@@ -408,10 +389,10 @@ LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { pani
              where Args: Tuple, F: Fn<Args>, A: Allocator, F: ?Sized;
 
 error[E0118]: no nominal type found for inherent implementation
-  --> $DIR/where-allowed.rs:239:1
+  --> $DIR/where-allowed.rs:240:1
    |
-LL | impl <T = impl Debug> T {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
+LL | impl<T = impl Debug> T {}
+   | ^^^^^^^^^^^^^^^^^^^^^^ impl requires a nominal type
    |
    = note: either implement a trait on it or create a newtype to wrap it instead
 
@@ -431,29 +412,21 @@ LL | type InTypeAlias<R> = impl Debug;
    |
    = note: `InTypeAlias` must be used in combination with a concrete type within the same crate
 
-error: aborting due to 50 previous errors
+error: aborting due to 48 previous errors
 
 Some errors have detailed explanations: E0053, E0118, E0283, E0562, E0658, E0666.
 For more information about an error, try `rustc --explain E0053`.
 Future incompatibility report: Future breakage diagnostic:
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+warning: defaults for generic parameters are not allowed here
   --> $DIR/where-allowed.rs:246:36
    |
 LL | fn in_method_generic_param_default<T = impl Debug>(_: T) {}
    |                                    ^^^^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
 
 Future breakage diagnostic:
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/where-allowed.rs:239:7
-   |
-LL | impl <T = impl Debug> T {}
-   |       ^^^^^^^^^^^^^^
+warning: defaults for generic parameters are not allowed here
+  --> $DIR/where-allowed.rs:240:6
    |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
+LL | impl<T = impl Debug> T {}
+   |      ^^^^^^^^^^^^^^
 
diff --git a/tests/ui/issues/issue-26812.rs b/tests/ui/issues/issue-26812.rs
deleted file mode 100644
index 8eb030a8ec9..00000000000
--- a/tests/ui/issues/issue-26812.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-fn avg<T=T::Item>(_: T) {}
-//~^ ERROR generic parameter defaults cannot reference parameters before they are declared
-//~| ERROR defaults for type parameters
-//~| WARN previously accepted
-
-fn main() {}
diff --git a/tests/ui/issues/issue-26812.stderr b/tests/ui/issues/issue-26812.stderr
deleted file mode 100644
index bb60d67e287..00000000000
--- a/tests/ui/issues/issue-26812.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error[E0128]: generic parameter defaults cannot reference parameters before they are declared
-  --> $DIR/issue-26812.rs:1:10
-   |
-LL | fn avg<T=T::Item>(_: T) {}
-   |          ^^^^^^^ cannot reference `T` before it is declared
-
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/issue-26812.rs:1:8
-   |
-LL | fn avg<T=T::Item>(_: T) {}
-   |        ^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0128`.
-Future incompatibility report: Future breakage diagnostic:
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/issue-26812.rs:1:8
-   |
-LL | fn avg<T=T::Item>(_: T) {}
-   |        ^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
-
diff --git a/tests/ui/lifetimes/unusual-rib-combinations.rs b/tests/ui/lifetimes/unusual-rib-combinations.rs
index 0e92b41ae1e..b3e9642332b 100644
--- a/tests/ui/lifetimes/unusual-rib-combinations.rs
+++ b/tests/ui/lifetimes/unusual-rib-combinations.rs
@@ -14,7 +14,7 @@ fn b<const C: u8()>() {}
 // Paren generic args in AnonymousReportError
 fn c<T = u8()>() {}
 //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait
-//~| ERROR defaults for type parameters are only allowed in
+//~| ERROR defaults for generic parameters are not allowed here
 //~| WARN this was previously accepted
 
 // Elided lifetime in path in ConstGeneric
diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr
index 7373ca8cf84..bd68479c58c 100644
--- a/tests/ui/lifetimes/unusual-rib-combinations.stderr
+++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr
@@ -22,7 +22,7 @@ error[E0214]: parenthesized type parameters may only be used with a `Fn` trait
 LL | fn c<T = u8()>() {}
    |          ^^^^ only `Fn` traits may use parentheses
 
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/unusual-rib-combinations.rs:15:6
    |
 LL | fn c<T = u8()>() {}
@@ -43,7 +43,7 @@ error: aborting due to 6 previous errors
 Some errors have detailed explanations: E0106, E0214, E0308, E0770.
 For more information about an error, try `rustc --explain E0106`.
 Future incompatibility report: Future breakage diagnostic:
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/unusual-rib-combinations.rs:15:6
    |
 LL | fn c<T = u8()>() {}
diff --git a/tests/ui/missing/missing-items/missing-type-parameter2.rs b/tests/ui/missing/missing-items/missing-type-parameter2.rs
index e9b32fb7198..772e60b1376 100644
--- a/tests/ui/missing/missing-items/missing-type-parameter2.rs
+++ b/tests/ui/missing/missing-items/missing-type-parameter2.rs
@@ -5,7 +5,7 @@ impl X<N> {}
 //~| ERROR unresolved item provided when a constant was expected
 impl<T, const A: u8 = 2> X<N> {}
 //~^ ERROR cannot find type `N` in this scope
-//~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+//~| ERROR defaults for generic parameters are not allowed here
 //~| ERROR unresolved item provided when a constant was expected
 
 fn foo(_: T) where T: Send {}
diff --git a/tests/ui/missing/missing-items/missing-type-parameter2.stderr b/tests/ui/missing/missing-items/missing-type-parameter2.stderr
index f6418de20b6..3c132e769ea 100644
--- a/tests/ui/missing/missing-items/missing-type-parameter2.stderr
+++ b/tests/ui/missing/missing-items/missing-type-parameter2.stderr
@@ -103,7 +103,7 @@ help: if this generic argument was intended as a const parameter, surround it wi
 LL | impl X<{ N }> {}
    |        +   +
 
-error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/missing-type-parameter2.rs:6:9
    |
 LL | impl<T, const A: u8 = 2> X<N> {}
diff --git a/tests/ui/parser/attribute-on-empty.rs b/tests/ui/parser/attribute-on-empty.rs
new file mode 100644
index 00000000000..5932377f73e
--- /dev/null
+++ b/tests/ui/parser/attribute-on-empty.rs
@@ -0,0 +1,29 @@
+//! Regression test for: <https://github.com/rust-lang/rust/issues/144132>
+//!                      <https://github.com/rust-lang/rust/issues/135017>
+
+struct Baz<const N: usize>(i32);
+
+fn main() {
+    let _: Baz<#[cfg(any())]> = todo!();
+    //~^ ERROR attributes cannot be applied here
+}
+
+fn f(_param: #[attr]) {}
+//~^ ERROR attributes cannot be applied to a function parameter's type
+//~| ERROR expected type, found `)`
+
+fn g() -> #[attr] { 0 }
+//~^ ERROR attributes cannot be applied here
+
+struct S {
+    field: #[attr],
+    //~^ ERROR attributes cannot be applied here
+    field1: (#[attr], i32),
+    //~^ ERROR attributes cannot be applied here
+}
+
+type Tuple = (#[attr], String);
+//~^ ERROR attributes cannot be applied here
+
+impl #[attr] {}
+//~^ ERROR attributes cannot be applied here
diff --git a/tests/ui/parser/attribute-on-empty.stderr b/tests/ui/parser/attribute-on-empty.stderr
new file mode 100644
index 00000000000..7c4806c8704
--- /dev/null
+++ b/tests/ui/parser/attribute-on-empty.stderr
@@ -0,0 +1,52 @@
+error: attributes cannot be applied here
+  --> $DIR/attribute-on-empty.rs:7:16
+   |
+LL |     let _: Baz<#[cfg(any())]> = todo!();
+   |          -     ^^^^^^^^^^^^^ attributes are not allowed here
+   |          |
+   |          while parsing the type for `_`
+
+error: attributes cannot be applied to a function parameter's type
+  --> $DIR/attribute-on-empty.rs:11:14
+   |
+LL | fn f(_param: #[attr]) {}
+   |              ^^^^^^^ attributes are not allowed here
+
+error: expected type, found `)`
+  --> $DIR/attribute-on-empty.rs:11:21
+   |
+LL | fn f(_param: #[attr]) {}
+   |                     ^ expected type
+
+error: attributes cannot be applied here
+  --> $DIR/attribute-on-empty.rs:15:11
+   |
+LL | fn g() -> #[attr] { 0 }
+   |           ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied here
+  --> $DIR/attribute-on-empty.rs:19:12
+   |
+LL |     field: #[attr],
+   |            ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied here
+  --> $DIR/attribute-on-empty.rs:21:14
+   |
+LL |     field1: (#[attr], i32),
+   |              ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied here
+  --> $DIR/attribute-on-empty.rs:25:15
+   |
+LL | type Tuple = (#[attr], String);
+   |               ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied here
+  --> $DIR/attribute-on-empty.rs:28:6
+   |
+LL | impl #[attr] {}
+   |      ^^^^^^^ attributes are not allowed here
+
+error: aborting due to 8 previous errors
+
diff --git a/tests/ui/parser/attribute-on-type.fixed b/tests/ui/parser/attribute-on-type.fixed
new file mode 100644
index 00000000000..5024bfdc2bc
--- /dev/null
+++ b/tests/ui/parser/attribute-on-type.fixed
@@ -0,0 +1,58 @@
+//! Regression test for: <https://github.com/rust-lang/rust/issues/144132>
+//!                      <https://github.com/rust-lang/rust/issues/135017>
+
+//@ run-rustfix
+
+#![allow(dead_code, unused_variables)]
+
+struct Foo<T>(T);
+struct Bar<'a>(&'a i32);
+struct Baz<const N: usize>(i32);
+
+fn main() {
+    let foo: Foo<i32> = Foo(2i32);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: &'static str = "123";
+    //~^ ERROR attributes cannot be applied to types
+
+    let _: Bar<'static> = Bar(&123);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: Baz<42> = Baz(42);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: Foo<String> = Foo(String::new());
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: Bar<'static> = Bar(&456);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _generic: Box<i32> = Box::new(1);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _assignment: i32 = *Box::new(1);
+    //~^ ERROR attributes cannot be applied to types
+
+    let _complex: Vec<String> = vec![];
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _nested: Box<Vec<u64>> = Box::new(vec![]);
+    //~^ ERROR attributes cannot be applied to generic arguments
+}
+
+fn g() -> i32 { 0 }
+//~^ ERROR attributes cannot be applied to types
+
+struct S {
+    field: i32,
+    //~^ ERROR attributes cannot be applied to types
+    field1: (i32, i32),
+    //~^ ERROR attributes cannot be applied to types
+}
+
+type Tuple = (i32, String);
+//~^ ERROR attributes cannot be applied to types
+
+impl S {}
+//~^ ERROR attributes cannot be applied to types
diff --git a/tests/ui/parser/attribute-on-type.rs b/tests/ui/parser/attribute-on-type.rs
new file mode 100644
index 00000000000..196d322bdf8
--- /dev/null
+++ b/tests/ui/parser/attribute-on-type.rs
@@ -0,0 +1,58 @@
+//! Regression test for: <https://github.com/rust-lang/rust/issues/144132>
+//!                      <https://github.com/rust-lang/rust/issues/135017>
+
+//@ run-rustfix
+
+#![allow(dead_code, unused_variables)]
+
+struct Foo<T>(T);
+struct Bar<'a>(&'a i32);
+struct Baz<const N: usize>(i32);
+
+fn main() {
+    let foo: Foo<#[cfg(not(wrong))] i32> = Foo(2i32);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: #[attr] &'static str = "123";
+    //~^ ERROR attributes cannot be applied to types
+
+    let _: Bar<#[cfg(any())] 'static> = Bar(&123);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: Baz<#[cfg(any())] 42> = Baz(42);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: Foo<#[cfg(not(wrong))]String> = Foo(String::new());
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _: Bar<#[cfg(any())]       'static> = Bar(&456);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _generic: Box<#[attr] i32> = Box::new(1);
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _assignment: #[attr] i32 = *Box::new(1);
+    //~^ ERROR attributes cannot be applied to types
+
+    let _complex: Vec<#[derive(Debug)] String> = vec![];
+    //~^ ERROR attributes cannot be applied to generic arguments
+
+    let _nested: Box<Vec<#[cfg(feature = "test")] u64>> = Box::new(vec![]);
+    //~^ ERROR attributes cannot be applied to generic arguments
+}
+
+fn g() -> #[attr] i32 { 0 }
+//~^ ERROR attributes cannot be applied to types
+
+struct S {
+    field: #[attr] i32,
+    //~^ ERROR attributes cannot be applied to types
+    field1: (#[attr] i32, i32),
+    //~^ ERROR attributes cannot be applied to types
+}
+
+type Tuple = (#[attr] i32, String);
+//~^ ERROR attributes cannot be applied to types
+
+impl #[attr] S {}
+//~^ ERROR attributes cannot be applied to types
diff --git a/tests/ui/parser/attribute-on-type.stderr b/tests/ui/parser/attribute-on-type.stderr
new file mode 100644
index 00000000000..603c7e2be51
--- /dev/null
+++ b/tests/ui/parser/attribute-on-type.stderr
@@ -0,0 +1,92 @@
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:13:18
+   |
+LL |     let foo: Foo<#[cfg(not(wrong))] i32> = Foo(2i32);
+   |                  ^^^^^^^^^^^^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to types
+  --> $DIR/attribute-on-type.rs:16:12
+   |
+LL |     let _: #[attr] &'static str = "123";
+   |            ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:19:16
+   |
+LL |     let _: Bar<#[cfg(any())] 'static> = Bar(&123);
+   |                ^^^^^^^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:22:16
+   |
+LL |     let _: Baz<#[cfg(any())] 42> = Baz(42);
+   |                ^^^^^^^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:25:16
+   |
+LL |     let _: Foo<#[cfg(not(wrong))]String> = Foo(String::new());
+   |                ^^^^^^^^^^^^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:28:16
+   |
+LL |     let _: Bar<#[cfg(any())]       'static> = Bar(&456);
+   |                ^^^^^^^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:31:23
+   |
+LL |     let _generic: Box<#[attr] i32> = Box::new(1);
+   |                       ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to types
+  --> $DIR/attribute-on-type.rs:34:22
+   |
+LL |     let _assignment: #[attr] i32 = *Box::new(1);
+   |                      ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:37:23
+   |
+LL |     let _complex: Vec<#[derive(Debug)] String> = vec![];
+   |                       ^^^^^^^^^^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to generic arguments
+  --> $DIR/attribute-on-type.rs:40:26
+   |
+LL |     let _nested: Box<Vec<#[cfg(feature = "test")] u64>> = Box::new(vec![]);
+   |                          ^^^^^^^^^^^^^^^^^^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to types
+  --> $DIR/attribute-on-type.rs:44:11
+   |
+LL | fn g() -> #[attr] i32 { 0 }
+   |           ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to types
+  --> $DIR/attribute-on-type.rs:48:12
+   |
+LL |     field: #[attr] i32,
+   |            ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to types
+  --> $DIR/attribute-on-type.rs:50:14
+   |
+LL |     field1: (#[attr] i32, i32),
+   |              ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to types
+  --> $DIR/attribute-on-type.rs:54:15
+   |
+LL | type Tuple = (#[attr] i32, String);
+   |               ^^^^^^^ attributes are not allowed here
+
+error: attributes cannot be applied to types
+  --> $DIR/attribute-on-type.rs:57:6
+   |
+LL | impl #[attr] S {}
+   |      ^^^^^^^ attributes are not allowed here
+
+error: aborting due to 15 previous errors
+
diff --git a/tests/ui/parser/issues/issue-103143.rs b/tests/ui/parser/issues/issue-103143.rs
index a584274c405..90f10fc1a08 100644
--- a/tests/ui/parser/issues/issue-103143.rs
+++ b/tests/ui/parser/issues/issue-103143.rs
@@ -1,5 +1,5 @@
 fn main() {
     x::<#[a]y::<z>>
-    //~^ ERROR invalid const generic expression
+    //~^ ERROR attributes cannot be applied to generic arguments
     //~| ERROR cannot find value `x` in this scope
 }
diff --git a/tests/ui/parser/issues/issue-103143.stderr b/tests/ui/parser/issues/issue-103143.stderr
index 4035c69afa7..168a2077396 100644
--- a/tests/ui/parser/issues/issue-103143.stderr
+++ b/tests/ui/parser/issues/issue-103143.stderr
@@ -1,13 +1,8 @@
-error: invalid const generic expression
-  --> $DIR/issue-103143.rs:2:13
+error: attributes cannot be applied to generic arguments
+  --> $DIR/issue-103143.rs:2:9
    |
 LL |     x::<#[a]y::<z>>
-   |             ^^^^^^
-   |
-help: expressions must be enclosed in braces to be used as const generic arguments
-   |
-LL |     x::<#[a]{ y::<z> }>
-   |             +        +
+   |         ^^^^ attributes are not allowed here
 
 error[E0425]: cannot find value `x` in this scope
   --> $DIR/issue-103143.rs:2:5
diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed
index a851300a982..40028307a8c 100644
--- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed
+++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.fixed
@@ -1,7 +1,9 @@
 // Regression test for issues #100790 and #106439.
 //@ run-rustfix
 
-pub struct Example(#[allow(dead_code)] usize)
+#![allow(dead_code)]
+
+pub struct Example(usize)
 where
     (): Sized;
 //~^^^ ERROR where clauses are not allowed before tuple struct bodies
diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs
index 10f435859f1..d8dbb4238d2 100644
--- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs
+++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.rs
@@ -1,10 +1,12 @@
 // Regression test for issues #100790 and #106439.
 //@ run-rustfix
 
+#![allow(dead_code)]
+
 pub struct Example
 where
     (): Sized,
-(#[allow(dead_code)] usize);
+(usize);
 //~^^^ ERROR where clauses are not allowed before tuple struct bodies
 
 struct _Demo
diff --git a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr
index ddbf237e866..66dadd9fd4c 100644
--- a/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr
+++ b/tests/ui/parser/recover/recover-where-clause-before-tuple-struct-body-0.stderr
@@ -1,23 +1,23 @@
 error: where clauses are not allowed before tuple struct bodies
-  --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:5:1
+  --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:7:1
    |
 LL |   pub struct Example
    |              ------- while parsing this tuple struct
 LL | / where
 LL | |     (): Sized,
    | |______________^ unexpected where clause
-LL |   (#[allow(dead_code)] usize);
-   |   --------------------------- the struct body
+LL |   (usize);
+   |   ------- the struct body
    |
 help: move the body before the where clause
    |
-LL ~ pub struct Example(#[allow(dead_code)] usize)
+LL ~ pub struct Example(usize)
 LL | where
 LL ~     (): Sized;
    |
 
 error: where clauses are not allowed before tuple struct bodies
-  --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:11:1
+  --> $DIR/recover-where-clause-before-tuple-struct-body-0.rs:13:1
    |
 LL |   struct _Demo
    |          ----- while parsing this tuple struct
diff --git a/tests/ui/traits/const-traits/feature-gate.rs b/tests/ui/traits/const-traits/feature-gate.rs
index 5ad56ddcd33..c2918f0249b 100644
--- a/tests/ui/traits/const-traits/feature-gate.rs
+++ b/tests/ui/traits/const-traits/feature-gate.rs
@@ -13,6 +13,9 @@ impl const T for S {}
 const fn f<A: [const] T>() {} //[stock]~ ERROR const trait impls are experimental
 fn g<A: const T>() {} //[stock]~ ERROR const trait impls are experimental
 
+const trait Trait {} //[stock]~ ERROR const trait impls are experimental
+#[cfg(false)] const trait Trait {} //[stock]~ ERROR const trait impls are experimental
+
 macro_rules! discard { ($ty:ty) => {} }
 
 discard! { impl [const] T } //[stock]~ ERROR const trait impls are experimental
diff --git a/tests/ui/traits/const-traits/feature-gate.stock.stderr b/tests/ui/traits/const-traits/feature-gate.stock.stderr
index f3ba3039a23..551c7ced7c1 100644
--- a/tests/ui/traits/const-traits/feature-gate.stock.stderr
+++ b/tests/ui/traits/const-traits/feature-gate.stock.stderr
@@ -29,7 +29,27 @@ LL | fn g<A: const T>() {}
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: const trait impls are experimental
-  --> $DIR/feature-gate.rs:18:17
+  --> $DIR/feature-gate.rs:16:1
+   |
+LL | const trait Trait {}
+   | ^^^^^
+   |
+   = note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/feature-gate.rs:17:15
+   |
+LL | #[cfg(false)] const trait Trait {}
+   |               ^^^^^
+   |
+   = note: see issue #143874 <https://github.com/rust-lang/rust/issues/143874> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/feature-gate.rs:21:17
    |
 LL | discard! { impl [const] T }
    |                 ^^^^^^^
@@ -39,7 +59,7 @@ LL | discard! { impl [const] T }
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: const trait impls are experimental
-  --> $DIR/feature-gate.rs:19:17
+  --> $DIR/feature-gate.rs:22:17
    |
 LL | discard! { impl const T }
    |                 ^^^^^
@@ -58,6 +78,6 @@ LL | #[const_trait]
    = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error: aborting due to 6 previous errors
+error: aborting due to 8 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr b/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr
index bf8829c0925..e8bbdaaacbf 100644
--- a/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr
+++ b/tests/ui/type-inference/unbounded-type-param-in-fn-with-assoc-type.stderr
@@ -13,7 +13,7 @@ error: aborting due to 1 previous error
 
 For more information about this error, try `rustc --explain E0282`.
 Future incompatibility report: Future breakage diagnostic:
-warning: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+warning: defaults for generic parameters are not allowed here
   --> $DIR/unbounded-type-param-in-fn-with-assoc-type.rs:3:11
    |
 LL | fn foo<T, U = u64>() -> (T, U) {
diff --git a/tests/ui/type/default_type_parameter_in_fn_or_impl.rs b/tests/ui/type/default_type_parameter_in_fn_or_impl.rs
deleted file mode 100644
index 33038e24bc6..00000000000
--- a/tests/ui/type/default_type_parameter_in_fn_or_impl.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-#![allow(unused)]
-
-fn avg<T=i32>(_: T) {}
-//~^ ERROR defaults for type parameters are only allowed
-//~| WARN this was previously accepted
-
-struct S<T>(T);
-impl<T=i32> S<T> {}
-//~^ ERROR defaults for type parameters are only allowed
-//~| WARN this was previously accepted
-
-fn main() {}
diff --git a/tests/ui/type/default_type_parameter_in_fn_or_impl.stderr b/tests/ui/type/default_type_parameter_in_fn_or_impl.stderr
deleted file mode 100644
index a3205cd3c29..00000000000
--- a/tests/ui/type/default_type_parameter_in_fn_or_impl.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/default_type_parameter_in_fn_or_impl.rs:3:8
-   |
-LL | fn avg<T=i32>(_: T) {}
-   |        ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
-
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/default_type_parameter_in_fn_or_impl.rs:8:6
-   |
-LL | impl<T=i32> S<T> {}
-   |      ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-
-error: aborting due to 2 previous errors
-
-Future incompatibility report: Future breakage diagnostic:
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/default_type_parameter_in_fn_or_impl.rs:3:8
-   |
-LL | fn avg<T=i32>(_: T) {}
-   |        ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
-
-Future breakage diagnostic:
-error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
-  --> $DIR/default_type_parameter_in_fn_or_impl.rs:8:6
-   |
-LL | impl<T=i32> S<T> {}
-   |      ^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
-   = note: `#[deny(invalid_type_param_default)]` on by default
-
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
index ad7d972879f..072a699a6b5 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
@@ -4,7 +4,7 @@ trait Trait<const N: dyn Trait = bar> {
     fn fnc<const N: dyn Trait = u32>(&self) -> dyn Trait {
         //~^ ERROR the name `N` is already used for a generic parameter in this item's generic parameters
         //~| ERROR expected value, found builtin type `u32`
-        //~| ERROR defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+        //~| ERROR defaults for generic parameters are not allowed here
         bar
         //~^ ERROR cannot find value `bar` in this scope
     }
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
index dc5a1cf3485..47f3e83fae2 100644
--- a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
@@ -39,7 +39,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
 
-error: defaults for const parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+error: defaults for generic parameters are not allowed here
   --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:4:12
    |
 LL |     fn fnc<const N: dyn Trait = u32>(&self) -> dyn Trait {