about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc/generic-const-items.rs38
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs22
-rw-r--r--tests/rustdoc/inline_cross/generic-const-items.rs26
-rw-r--r--tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs12
-rw-r--r--tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs13
-rw-r--r--tests/ui/diagnostic_namespace/existing_proc_macros.rs24
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs13
-rw-r--r--tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr35
-rw-r--r--tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs13
-rw-r--r--tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr16
-rw-r--r--tests/ui/diagnostic_namespace/requires_path.rs9
-rw-r--r--tests/ui/diagnostic_namespace/requires_path.stderr8
-rw-r--r--tests/ui/generic-const-items/associated-const-equality.rs22
-rw-r--r--tests/ui/generic-const-items/basic.rs61
-rw-r--r--tests/ui/generic-const-items/compare-impl-item.rs30
-rw-r--r--tests/ui/generic-const-items/compare-impl-item.stderr66
-rw-r--r--tests/ui/generic-const-items/const-trait-impl.rs24
-rw-r--r--tests/ui/generic-const-items/duplicate-where-clause.rs27
-rw-r--r--tests/ui/generic-const-items/duplicate-where-clause.stderr27
-rw-r--r--tests/ui/generic-const-items/elided-lifetimes.rs18
-rw-r--r--tests/ui/generic-const-items/elided-lifetimes.stderr35
-rw-r--r--tests/ui/generic-const-items/evaluatable-bounds.rs31
-rw-r--r--tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr10
-rw-r--r--tests/ui/generic-const-items/feature-gate-generic_const_items.rs37
-rw-r--r--tests/ui/generic-const-items/feature-gate-generic_const_items.stderr77
-rw-r--r--tests/ui/generic-const-items/inference-failure.rs15
-rw-r--r--tests/ui/generic-const-items/inference-failure.stderr20
-rw-r--r--tests/ui/generic-const-items/misplaced-where-clause.fixed18
-rw-r--r--tests/ui/generic-const-items/misplaced-where-clause.rs20
-rw-r--r--tests/ui/generic-const-items/misplaced-where-clause.stderr36
-rw-r--r--tests/ui/generic-const-items/parameter-defaults.rs14
-rw-r--r--tests/ui/generic-const-items/parameter-defaults.stderr8
-rw-r--r--tests/ui/generic-const-items/recursive.rs12
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs12
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr18
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs12
-rw-r--r--tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr11
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.rs34
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.stderr62
-rw-r--r--tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs12
-rw-r--r--tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr9
-rw-r--r--tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs17
-rw-r--r--tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr18
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs11
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr33
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs25
-rw-r--r--tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr30
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs18
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr9
-rw-r--r--tests/ui/layout/malformed-unsized-type-in-union.rs8
-rw-r--r--tests/ui/layout/malformed-unsized-type-in-union.stderr9
-rw-r--r--tests/ui/lint/lint-cap-trait-bounds.rs8
-rw-r--r--tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs6
-rw-r--r--tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr15
-rw-r--r--tests/ui/object-safety/assoc_const_bounds.rs9
-rw-r--r--tests/ui/object-safety/assoc_const_bounds.stderr15
-rw-r--r--tests/ui/object-safety/assoc_const_bounds_sized.rs9
-rw-r--r--tests/ui/object-safety/assoc_const_bounds_sized.stderr15
-rw-r--r--tests/ui/parser/generic-statics.rs4
-rw-r--r--tests/ui/parser/generic-statics.stderr8
-rw-r--r--tests/ui/privacy/issue-113860-1.rs16
-rw-r--r--tests/ui/privacy/issue-113860-1.stderr49
-rw-r--r--tests/ui/privacy/issue-113860-2.rs16
-rw-r--r--tests/ui/privacy/issue-113860-2.stderr49
-rw-r--r--tests/ui/privacy/issue-113860.rs16
-rw-r--r--tests/ui/privacy/issue-113860.stderr49
-rw-r--r--tests/ui/proc-macro/derive-helper-shadowed.rs2
-rw-r--r--tests/ui/proc-macro/derive-in-mod.rs2
-rw-r--r--tests/ui/proc-macro/edition-imports-2018.rs2
-rw-r--r--tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs2
-rw-r--r--tests/ui/proc-macro/helper-attr-blocked-by-import.rs2
-rw-r--r--tests/ui/proc-macro/issue-53481.rs2
-rw-r--r--tests/ui/proc-macro/macro-use-attr.rs2
-rw-r--r--tests/ui/proc-macro/macro-use-bang.rs2
-rw-r--r--tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr (renamed from tests/ui/suggestions/missing-lifetime-in-assoc-const-type.stderr)8
-rw-r--r--tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr47
-rw-r--r--tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs4
77 files changed, 1498 insertions, 46 deletions
diff --git a/tests/rustdoc/generic-const-items.rs b/tests/rustdoc/generic-const-items.rs
new file mode 100644
index 00000000000..e2c6a027afa
--- /dev/null
+++ b/tests/rustdoc/generic-const-items.rs
@@ -0,0 +1,38 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// @has 'generic_const_items/constant.K.html'
+// @has - '//*[@class="rust item-decl"]//code' \
+// "pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> \
+// where \
+//     String: From<T>;"
+pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> = None
+where
+    String: From<T>;
+
+// @has generic_const_items/trait.Trait.html
+pub trait Trait<T: ?Sized> {
+    // @has - '//*[@id="associatedconstant.C"]' \
+    // "const C<'a>: &'a T \
+    // where \
+    //     T: 'a + Eq"
+    const C<'a>: &'a T
+    where
+        T: 'a + Eq;
+}
+
+pub struct Implementor;
+
+// @has generic_const_items/struct.Implementor.html
+// @has - '//h3[@class="code-header"]' 'impl Trait<str> for Implementor'
+impl Trait<str> for Implementor {
+    // @has - '//*[@id="associatedconstant.C"]' \
+    // "const C<'a>: &'a str = \"C\" \
+    // where \
+    //     str: 'a"
+    const C<'a>: &'a str = "C"
+    // In real code we could've left off this bound but adding it explicitly allows us to test if
+    // we render where-clauses on associated consts inside impl blocks correctly.
+    where
+        str: 'a;
+}
diff --git a/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs b/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs
new file mode 100644
index 00000000000..0fc7a7aaea2
--- /dev/null
+++ b/tests/rustdoc/inline_cross/auxiliary/generic-const-items.rs
@@ -0,0 +1,22 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> = None
+where
+    String: From<T>;
+
+pub trait Trait<T: ?Sized> {
+    const C<'a>: &'a T
+    where
+        T: 'a + Eq;
+}
+
+pub struct Implementor;
+
+impl Trait<str> for Implementor {
+    const C<'a>: &'a str = "C"
+    // In real code we could've left off this bound but adding it explicitly allows us to test if
+    // we render where-clauses on associated consts inside impl blocks correctly.
+    where
+        str: 'a;
+}
diff --git a/tests/rustdoc/inline_cross/generic-const-items.rs b/tests/rustdoc/inline_cross/generic-const-items.rs
new file mode 100644
index 00000000000..70cf7af888e
--- /dev/null
+++ b/tests/rustdoc/inline_cross/generic-const-items.rs
@@ -0,0 +1,26 @@
+#![crate_name = "user"]
+
+// aux-crate:generic_const_items=generic-const-items.rs
+// edition:2021
+
+// @has 'user/constant.K.html'
+// @has - '//*[@class="rust item-decl"]//code' \
+// "pub const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> \
+// where \
+//     String: From<T>;"
+pub use generic_const_items::K;
+
+// @has user/trait.Trait.html
+// @has - '//*[@id="associatedconstant.C"]' \
+// "const C<'a>: &'a T \
+// where \
+//     T: 'a + Eq"
+pub use generic_const_items::Trait;
+
+// @has user/struct.Implementor.html
+// @has - '//h3[@class="code-header"]' 'impl Trait<str> for Implementor'
+// @has - '//*[@id="associatedconstant.C"]' \
+// "const C<'a>: &'a str = \"C\" \
+// where \
+//     str: 'a"
+pub use generic_const_items::Implementor;
diff --git a/tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs b/tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs
new file mode 100644
index 00000000000..759c32c8453
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/auxiliary/proc-macro-helper.rs
@@ -0,0 +1,12 @@
+// force-host
+// no-prefer-dynamic
+#![crate_type = "proc-macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_attribute]
+pub fn diagnostic(i: TokenStream, _: TokenStream) -> TokenStream {
+    i
+}
diff --git a/tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs b/tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs
new file mode 100644
index 00000000000..08b4d68779c
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/can_use_the_diagnostic_name_in_other_places.rs
@@ -0,0 +1,13 @@
+// check-pass
+
+mod diagnostic {}
+
+macro_rules! diagnostic{
+    () => {}
+}
+
+#[allow(non_upper_case_globals)]
+const diagnostic: () = ();
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/existing_proc_macros.rs b/tests/ui/diagnostic_namespace/existing_proc_macros.rs
new file mode 100644
index 00000000000..d6d1fb01496
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/existing_proc_macros.rs
@@ -0,0 +1,24 @@
+#![feature(diagnostic_namespace)]
+// check-pass
+// aux-build:proc-macro-helper.rs
+
+extern crate proc_macro_helper;
+
+mod test1 {
+    use proc_macro_helper::diagnostic;
+
+    #[diagnostic]
+    struct Foo;
+
+}
+
+mod test2 {
+    mod diagnostic {
+        pub use proc_macro_helper::diagnostic as on_unimplemented;
+    }
+
+    #[diagnostic::on_unimplemented]
+    trait Foo {}
+}
+
+fn main() {}
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
new file mode 100644
index 00000000000..a686ed9c84e
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.rs
@@ -0,0 +1,13 @@
+#[diagnostic::non_existing_attribute]
+//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
+//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+pub trait Bar {
+}
+
+#[diagnostic::non_existing_attribute(with_option = "foo")]
+//~^ERROR `#[diagnostic]` attribute name space is experimental [E0658]
+//~|WARNING unknown diagnostic attribute [unknown_diagnostic_attributes]
+struct Foo;
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
new file mode 100644
index 00000000000..45c95cbb3c7
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/feature-gate-diagnostic_namespace.stderr
@@ -0,0 +1,35 @@
+error[E0658]: `#[diagnostic]` attribute name space is experimental
+  --> $DIR/feature-gate-diagnostic_namespace.rs:1:3
+   |
+LL | #[diagnostic::non_existing_attribute]
+   |   ^^^^^^^^^^
+   |
+   = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+   = help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
+
+error[E0658]: `#[diagnostic]` attribute name space is experimental
+  --> $DIR/feature-gate-diagnostic_namespace.rs:7:3
+   |
+LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
+   |   ^^^^^^^^^^
+   |
+   = note: see issue #94785 <https://github.com/rust-lang/rust/issues/94785> for more information
+   = help: add `#![feature(diagnostic_namespace)]` to the crate attributes to enable
+
+warning: unknown diagnostic attribute
+  --> $DIR/feature-gate-diagnostic_namespace.rs:1:15
+   |
+LL | #[diagnostic::non_existing_attribute]
+   |               ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+
+warning: unknown diagnostic attribute
+  --> $DIR/feature-gate-diagnostic_namespace.rs:7:15
+   |
+LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
+   |               ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors; 2 warnings emitted
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs
new file mode 100644
index 00000000000..677bd5a7343
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.rs
@@ -0,0 +1,13 @@
+#![feature(diagnostic_namespace)]
+// check-pass
+#[diagnostic::non_existing_attribute]
+//~^WARN unknown diagnostic attribute
+pub trait Bar {
+}
+
+#[diagnostic::non_existing_attribute(with_option = "foo")]
+//~^WARN unknown diagnostic attribute
+struct Foo;
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
new file mode 100644
index 00000000000..4f9b7ba2bcf
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/non_existing_attributes_accepted.stderr
@@ -0,0 +1,16 @@
+warning: unknown diagnostic attribute
+  --> $DIR/non_existing_attributes_accepted.rs:3:15
+   |
+LL | #[diagnostic::non_existing_attribute]
+   |               ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(unknown_diagnostic_attributes)]` on by default
+
+warning: unknown diagnostic attribute
+  --> $DIR/non_existing_attributes_accepted.rs:8:15
+   |
+LL | #[diagnostic::non_existing_attribute(with_option = "foo")]
+   |               ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/diagnostic_namespace/requires_path.rs b/tests/ui/diagnostic_namespace/requires_path.rs
new file mode 100644
index 00000000000..e8d6ca73ad0
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/requires_path.rs
@@ -0,0 +1,9 @@
+#![feature(diagnostic_namespace)]
+
+#[diagnostic]
+//~^ERROR cannot find attribute `diagnostic` in this scope
+pub struct Bar;
+
+
+fn main() {
+}
diff --git a/tests/ui/diagnostic_namespace/requires_path.stderr b/tests/ui/diagnostic_namespace/requires_path.stderr
new file mode 100644
index 00000000000..ce867621daa
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/requires_path.stderr
@@ -0,0 +1,8 @@
+error: cannot find attribute `diagnostic` in this scope
+  --> $DIR/requires_path.rs:3:3
+   |
+LL | #[diagnostic]
+   |   ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/generic-const-items/associated-const-equality.rs b/tests/ui/generic-const-items/associated-const-equality.rs
new file mode 100644
index 00000000000..785d3aa5018
--- /dev/null
+++ b/tests/ui/generic-const-items/associated-const-equality.rs
@@ -0,0 +1,22 @@
+// check-pass
+
+#![feature(generic_const_items, associated_const_equality)]
+#![allow(incomplete_features)]
+
+trait Owner {
+    const C<const N: u32>: u32;
+    const K<const N: u32>: u32;
+}
+
+impl Owner for () {
+    const C<const N: u32>: u32 = N;
+    const K<const N: u32>: u32 = N + 1;
+}
+
+fn take0<const N: u32>(_: impl Owner<C<N> = { N }>) {}
+fn take1(_: impl Owner<K<99> = 100>) {}
+
+fn main() {
+    take0::<128>(());
+    take1(());
+}
diff --git a/tests/ui/generic-const-items/basic.rs b/tests/ui/generic-const-items/basic.rs
new file mode 100644
index 00000000000..73bfa803acd
--- /dev/null
+++ b/tests/ui/generic-const-items/basic.rs
@@ -0,0 +1,61 @@
+// check-pass
+
+// Basic usage patterns of free & associated generic const items.
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+fn main() {
+    const NULL<T>: Option<T> = None::<T>;
+    const NOTHING<T>: Option<T> = None; // arg inferred
+
+    let _ = NOTHING::<String>;
+    let _: Option<u8> = NULL; // arg inferred
+
+    const IDENTITY<const X: u64>: u64 = X;
+
+    const COUNT: u64 = IDENTITY::<48>;
+    const AMOUNT: u64 = IDENTITY::<COUNT>;
+    const NUMBER: u64 = IDENTITY::<{ AMOUNT * 2 }>;
+    let _ = NUMBER;
+    let _ = IDENTITY::<0>;
+
+    let _ = match 0 {
+        IDENTITY::<1> => 2,
+        IDENTITY::<{ 1 + 1 }> => 4,
+        _ => 0,
+    };
+
+    const CREATE<I: Inhabited>: I = I::PROOF;
+    let _ = CREATE::<u64>;
+    let _: u64 = CREATE; // arg inferred
+
+    let _ = <() as Main<u64>>::MAKE::<u64>;
+    let _: (u64, u64) = <()>::MAKE; // args inferred
+}
+
+pub fn usage<'any>() {
+    const REGION_POLY<'a>: &'a () = &();
+
+    let _: &'any () = REGION_POLY::<'any>;
+    let _: &'any () = REGION_POLY::<'_>;
+    let _: &'static () = REGION_POLY;
+}
+
+trait Main<O> {
+    type Output<I>;
+    const MAKE<I: Inhabited>: Self::Output<I>;
+}
+
+impl<O: Inhabited> Main<O> for () {
+    type Output<I> = (O, I);
+    const MAKE<I: Inhabited>: Self::Output<I> = (O::PROOF, I::PROOF);
+}
+
+trait Inhabited {
+    const PROOF: Self;
+}
+
+impl Inhabited for u64 {
+    const PROOF: Self = 512;
+}
diff --git a/tests/ui/generic-const-items/compare-impl-item.rs b/tests/ui/generic-const-items/compare-impl-item.rs
new file mode 100644
index 00000000000..01e4477c698
--- /dev/null
+++ b/tests/ui/generic-const-items/compare-impl-item.rs
@@ -0,0 +1,30 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+trait Trait<P> {
+    const A: ();
+    const B<const K: u64, const Q: u64>: u64;
+    const C<T>: T;
+    const D<const N: usize>: usize;
+
+    const E: usize;
+    const F<T: PartialEq>: ();
+}
+
+impl<P> Trait<P> for () {
+    const A<T>: () = ();
+    //~^ ERROR const `A` has 1 type parameter but its trait declaration has 0 type parameters
+    const B<const K: u64>: u64 = 0;
+    //~^ ERROR const `B` has 1 const parameter but its trait declaration has 2 const parameters
+    const C<'a>: &'a str = "";
+    //~^ ERROR const `C` has 0 type parameters but its trait declaration has 1 type parameter
+    const D<const N: u16>: u16 = N;
+    //~^ ERROR const `D` has an incompatible generic parameter for trait `Trait`
+
+    const E: usize = 1024
+    where
+        P: Copy; //~ ERROR impl has stricter requirements than trait
+    const F<T: Eq>: () = (); //~ ERROR impl has stricter requirements than trait
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/compare-impl-item.stderr b/tests/ui/generic-const-items/compare-impl-item.stderr
new file mode 100644
index 00000000000..8610d8cba00
--- /dev/null
+++ b/tests/ui/generic-const-items/compare-impl-item.stderr
@@ -0,0 +1,66 @@
+error[E0049]: const `A` has 1 type parameter but its trait declaration has 0 type parameters
+  --> $DIR/compare-impl-item.rs:15:13
+   |
+LL |     const A: ();
+   |            - expected 0 type parameters
+...
+LL |     const A<T>: () = ();
+   |             ^ found 1 type parameter
+
+error[E0049]: const `B` has 1 const parameter but its trait declaration has 2 const parameters
+  --> $DIR/compare-impl-item.rs:17:13
+   |
+LL |     const B<const K: u64, const Q: u64>: u64;
+   |             ------------  ------------
+   |             |
+   |             expected 2 const parameters
+...
+LL |     const B<const K: u64>: u64 = 0;
+   |             ^^^^^^^^^^^^ found 1 const parameter
+
+error[E0049]: const `C` has 0 type parameters but its trait declaration has 1 type parameter
+  --> $DIR/compare-impl-item.rs:19:13
+   |
+LL |     const C<T>: T;
+   |             - expected 1 type parameter
+...
+LL |     const C<'a>: &'a str = "";
+   |             ^^ found 0 type parameters
+
+error[E0053]: const `D` has an incompatible generic parameter for trait `Trait`
+  --> $DIR/compare-impl-item.rs:21:13
+   |
+LL | trait Trait<P> {
+   |       -----
+...
+LL |     const D<const N: usize>: usize;
+   |             -------------- expected const parameter of type `usize`
+...
+LL | impl<P> Trait<P> for () {
+   | -----------------------
+...
+LL |     const D<const N: u16>: u16 = N;
+   |             ^^^^^^^^^^^^ found const parameter of type `u16`
+
+error[E0276]: impl has stricter requirements than trait
+  --> $DIR/compare-impl-item.rs:26:12
+   |
+LL |     const E: usize;
+   |     -------------- definition of `E` from trait
+...
+LL |         P: Copy;
+   |            ^^^^ impl has extra requirement `P: Copy`
+
+error[E0276]: impl has stricter requirements than trait
+  --> $DIR/compare-impl-item.rs:27:16
+   |
+LL |     const F<T: PartialEq>: ();
+   |     ------------------------- definition of `F` from trait
+...
+LL |     const F<T: Eq>: () = ();
+   |                ^^ impl has extra requirement `T: Eq`
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0049, E0053, E0276.
+For more information about an error, try `rustc --explain E0049`.
diff --git a/tests/ui/generic-const-items/const-trait-impl.rs b/tests/ui/generic-const-items/const-trait-impl.rs
new file mode 100644
index 00000000000..8da1448df4f
--- /dev/null
+++ b/tests/ui/generic-const-items/const-trait-impl.rs
@@ -0,0 +1,24 @@
+// check-pass
+
+// Test that we can call methods from const trait impls inside of generic const items.
+
+#![feature(generic_const_items, const_trait_impl)]
+#![allow(incomplete_features)]
+#![crate_type = "lib"]
+
+// FIXME(generic_const_items): Interpret `~const` as always-const.
+const CREATE<T: ~const Create>: T = T::create();
+
+pub const K0: i32 = CREATE::<i32>;
+pub const K1: i32 = CREATE; // arg inferred
+
+#[const_trait]
+trait Create {
+    fn create() -> Self;
+}
+
+impl const Create for i32 {
+    fn create() -> i32 {
+        4096
+    }
+}
diff --git a/tests/ui/generic-const-items/duplicate-where-clause.rs b/tests/ui/generic-const-items/duplicate-where-clause.rs
new file mode 100644
index 00000000000..68da4073fc1
--- /dev/null
+++ b/tests/ui/generic-const-items/duplicate-where-clause.rs
@@ -0,0 +1,27 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+trait Tr<P> {
+    const K: ()
+    where
+        P: Copy
+    where
+        P: Eq;
+    //~^ ERROR cannot define duplicate `where` clauses on an item
+}
+
+// Test that we error on the first where-clause but also that we don't suggest to swap it with the
+// body as it would conflict with the second where-clause.
+// FIXME(generic_const_items): We should provide a structured sugg to merge the 1st into the 2nd WC.
+
+impl<P> Tr<P> for () {
+    const K: ()
+    where
+        P: Eq
+    = ()
+    where
+        P: Copy;
+    //~^^^^^ ERROR where clauses are not allowed before const item bodies
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/duplicate-where-clause.stderr b/tests/ui/generic-const-items/duplicate-where-clause.stderr
new file mode 100644
index 00000000000..5fa61b01ee9
--- /dev/null
+++ b/tests/ui/generic-const-items/duplicate-where-clause.stderr
@@ -0,0 +1,27 @@
+error: cannot define duplicate `where` clauses on an item
+  --> $DIR/duplicate-where-clause.rs:9:9
+   |
+LL |         P: Copy
+   |         - previous `where` clause starts here
+LL |     where
+LL |         P: Eq;
+   |         ^
+   |
+help: consider joining the two `where` clauses into one
+   |
+LL |         P: Copy,
+   |                ~
+
+error: where clauses are not allowed before const item bodies
+  --> $DIR/duplicate-where-clause.rs:19:5
+   |
+LL |       const K: ()
+   |             - while parsing this const item
+LL | /     where
+LL | |         P: Eq
+   | |_____________^ unexpected where clause
+LL |       = ()
+   |         -- the item body
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generic-const-items/elided-lifetimes.rs b/tests/ui/generic-const-items/elided-lifetimes.rs
new file mode 100644
index 00000000000..cca73e2e81e
--- /dev/null
+++ b/tests/ui/generic-const-items/elided-lifetimes.rs
@@ -0,0 +1,18 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Check that we forbid elided lifetimes inside the generics of const items.
+
+const K<T>: () = ()
+where
+    &T: Copy; //~ ERROR `&` without an explicit lifetime name cannot be used here
+
+const I<const S: &str>: &str = "";
+//~^ ERROR `&` without an explicit lifetime name cannot be used here
+//~| ERROR `&str` is forbidden as the type of a const generic parameter
+
+const B<T: Trait<'_>>: () = (); //~ ERROR `'_` cannot be used here
+
+trait Trait<'a> {}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/elided-lifetimes.stderr b/tests/ui/generic-const-items/elided-lifetimes.stderr
new file mode 100644
index 00000000000..8cd3f9ee7a9
--- /dev/null
+++ b/tests/ui/generic-const-items/elided-lifetimes.stderr
@@ -0,0 +1,35 @@
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+  --> $DIR/elided-lifetimes.rs:8:5
+   |
+LL |     &T: Copy;
+   |     ^ explicit lifetime name needed here
+   |
+help: consider introducing a higher-ranked lifetime here
+   |
+LL |     for<'a> &'a T: Copy;
+   |     +++++++  ++
+
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+  --> $DIR/elided-lifetimes.rs:10:18
+   |
+LL | const I<const S: &str>: &str = "";
+   |                  ^ explicit lifetime name needed here
+
+error[E0637]: `'_` cannot be used here
+  --> $DIR/elided-lifetimes.rs:14:18
+   |
+LL | const B<T: Trait<'_>>: () = ();
+   |                  ^^ `'_` is a reserved lifetime name
+
+error: `&str` is forbidden as the type of a const generic parameter
+  --> $DIR/elided-lifetimes.rs:10:18
+   |
+LL | const I<const S: &str>: &str = "";
+   |                  ^^^^
+   |
+   = note: the only supported types are integers, `bool` and `char`
+   = help: more complex types are supported with `#![feature(adt_const_params)]`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0637`.
diff --git a/tests/ui/generic-const-items/evaluatable-bounds.rs b/tests/ui/generic-const-items/evaluatable-bounds.rs
new file mode 100644
index 00000000000..cdcfcf9188a
--- /dev/null
+++ b/tests/ui/generic-const-items/evaluatable-bounds.rs
@@ -0,0 +1,31 @@
+// This is a regression test for issue #104400.
+
+// revisions: unconstrained constrained
+//[constrained] check-pass
+
+// Test that we can constrain generic const items that appear inside associated consts by
+// adding a (makeshift) "evaluatable"-bound to the item.
+
+#![feature(generic_const_items, generic_const_exprs)]
+#![allow(incomplete_features)]
+
+trait Trait {
+    const LEN: usize;
+
+    #[cfg(unconstrained)]
+    const ARRAY: [i32; Self::LEN]; //[unconstrained]~ ERROR unconstrained generic constant
+
+    #[cfg(constrained)]
+    const ARRAY: [i32; Self::LEN]
+    where
+        [(); Self::LEN]:;
+}
+
+impl Trait for () {
+    const LEN: usize = 2;
+    const ARRAY: [i32; Self::LEN] = [360, 720];
+}
+
+fn main() {
+    let [_, _] = <() as Trait>::ARRAY;
+}
diff --git a/tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr b/tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr
new file mode 100644
index 00000000000..930080f7c37
--- /dev/null
+++ b/tests/ui/generic-const-items/evaluatable-bounds.unconstrained.stderr
@@ -0,0 +1,10 @@
+error: unconstrained generic constant
+  --> $DIR/evaluatable-bounds.rs:16:5
+   |
+LL |     const ARRAY: [i32; Self::LEN];
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: try adding a `where` bound using this expression: `where [(); Self::LEN]:`
+
+error: aborting due to previous error
+
diff --git a/tests/ui/generic-const-items/feature-gate-generic_const_items.rs b/tests/ui/generic-const-items/feature-gate-generic_const_items.rs
new file mode 100644
index 00000000000..5c241f256eb
--- /dev/null
+++ b/tests/ui/generic-const-items/feature-gate-generic_const_items.rs
@@ -0,0 +1,37 @@
+pub trait Trait<A> {
+    const ONE<T>: i32;
+    //~^ ERROR generic const items are experimental
+
+    const TWO: ()
+    where
+        A: Copy;
+    //~^^ ERROR generic const items are experimental
+}
+
+const CONST<T>: i32 = 0;
+//~^ ERROR generic const items are experimental
+
+const EMPTY<>: i32 = 0;
+//~^ ERROR generic const items are experimental
+
+const TRUE: () = ()
+where
+    String: Clone;
+//~^^ ERROR generic const items are experimental
+
+// Ensure that we flag generic const items inside macro calls as well:
+
+macro_rules! discard {
+    ($item:item) => {}
+}
+
+discard! { const FREE<T>: () = (); }
+//~^ ERROR generic const items are experimental
+
+discard! { impl () { const ASSOC<const N: ()>: () = (); } }
+//~^ ERROR generic const items are experimental
+
+discard! { impl () { const ASSOC: i32 = 0 where String: Copy; } }
+//~^ ERROR generic const items are experimental
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/feature-gate-generic_const_items.stderr b/tests/ui/generic-const-items/feature-gate-generic_const_items.stderr
new file mode 100644
index 00000000000..a1fdf5f6ef3
--- /dev/null
+++ b/tests/ui/generic-const-items/feature-gate-generic_const_items.stderr
@@ -0,0 +1,77 @@
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:2:14
+   |
+LL |     const ONE<T>: i32;
+   |              ^^^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:6:5
+   |
+LL | /     where
+LL | |         A: Copy;
+   | |_______________^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:11:12
+   |
+LL | const CONST<T>: i32 = 0;
+   |            ^^^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:14:12
+   |
+LL | const EMPTY<>: i32 = 0;
+   |            ^^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:18:1
+   |
+LL | / where
+LL | |     String: Clone;
+   | |_________________^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:28:22
+   |
+LL | discard! { const FREE<T>: () = (); }
+   |                      ^^^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:31:33
+   |
+LL | discard! { impl () { const ASSOC<const N: ()>: () = (); } }
+   |                                 ^^^^^^^^^^^^^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error[E0658]: generic const items are experimental
+  --> $DIR/feature-gate-generic_const_items.rs:34:43
+   |
+LL | discard! { impl () { const ASSOC: i32 = 0 where String: Copy; } }
+   |                                           ^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
+   = help: add `#![feature(generic_const_items)]` to the crate attributes to enable
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/generic-const-items/inference-failure.rs b/tests/ui/generic-const-items/inference-failure.rs
new file mode 100644
index 00000000000..fd4f424dd97
--- /dev/null
+++ b/tests/ui/generic-const-items/inference-failure.rs
@@ -0,0 +1,15 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+const NONE<T>: Option<T> = None::<T>;
+const IGNORE<T>: () = ();
+
+fn none() {
+    let _ = NONE; //~ ERROR type annotations needed
+}
+
+fn ignore() {
+    let _ = IGNORE; //~ ERROR type annotations needed
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/inference-failure.stderr b/tests/ui/generic-const-items/inference-failure.stderr
new file mode 100644
index 00000000000..22ff1b9ba7f
--- /dev/null
+++ b/tests/ui/generic-const-items/inference-failure.stderr
@@ -0,0 +1,20 @@
+error[E0282]: type annotations needed for `Option<T>`
+  --> $DIR/inference-failure.rs:8:9
+   |
+LL |     let _ = NONE;
+   |         ^
+   |
+help: consider giving this pattern a type, where the type for type parameter `T` is specified
+   |
+LL |     let _: Option<T> = NONE;
+   |          +++++++++++
+
+error[E0282]: type annotations needed
+  --> $DIR/inference-failure.rs:12:13
+   |
+LL |     let _ = IGNORE;
+   |             ^^^^^^ cannot infer type for type parameter `T` declared on the constant `IGNORE`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/generic-const-items/misplaced-where-clause.fixed b/tests/ui/generic-const-items/misplaced-where-clause.fixed
new file mode 100644
index 00000000000..bff470c2883
--- /dev/null
+++ b/tests/ui/generic-const-items/misplaced-where-clause.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+const K<T>: u64
+= T::K where
+    T: Tr<()>;
+//~^^^ ERROR where clauses are not allowed before const item bodies
+
+trait Tr<P> {
+    const K: u64
+    = 0 where
+        P: Copy;
+    //~^^^ ERROR where clauses are not allowed before const item bodies
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/misplaced-where-clause.rs b/tests/ui/generic-const-items/misplaced-where-clause.rs
new file mode 100644
index 00000000000..b14c6d594a5
--- /dev/null
+++ b/tests/ui/generic-const-items/misplaced-where-clause.rs
@@ -0,0 +1,20 @@
+// run-rustfix
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+const K<T>: u64
+where
+    T: Tr<()>
+= T::K;
+//~^^^ ERROR where clauses are not allowed before const item bodies
+
+trait Tr<P> {
+    const K: u64
+    where
+        P: Copy
+    = 0;
+    //~^^^ ERROR where clauses are not allowed before const item bodies
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/misplaced-where-clause.stderr b/tests/ui/generic-const-items/misplaced-where-clause.stderr
new file mode 100644
index 00000000000..431741d8724
--- /dev/null
+++ b/tests/ui/generic-const-items/misplaced-where-clause.stderr
@@ -0,0 +1,36 @@
+error: where clauses are not allowed before const item bodies
+  --> $DIR/misplaced-where-clause.rs:7:1
+   |
+LL |   const K<T>: u64
+   |         - while parsing this const item
+LL | / where
+LL | |     T: Tr<()>
+   | |_____________^ unexpected where clause
+LL |   = T::K;
+   |     ---- the item body
+   |
+help: move the body before the where clause
+   |
+LL ~ = T::K where
+LL ~     T: Tr<()>;
+   |
+
+error: where clauses are not allowed before const item bodies
+  --> $DIR/misplaced-where-clause.rs:14:5
+   |
+LL |       const K: u64
+   |             - while parsing this const item
+LL | /     where
+LL | |         P: Copy
+   | |_______________^ unexpected where clause
+LL |       = 0;
+   |         - the item body
+   |
+help: move the body before the where clause
+   |
+LL ~     = 0 where
+LL ~         P: Copy;
+   |
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/generic-const-items/parameter-defaults.rs b/tests/ui/generic-const-items/parameter-defaults.rs
new file mode 100644
index 00000000000..a6f82c249fe
--- /dev/null
+++ b/tests/ui/generic-const-items/parameter-defaults.rs
@@ -0,0 +1,14 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Check that we emit a *hard* error (not just a lint warning or error for example) for generic
+// parameter defaults on free const items since we are not limited by backward compatibility.
+#![allow(invalid_type_param_default)] // Should have no effect here.
+
+// 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
+
+fn main() {
+    let _ = NONE;
+}
diff --git a/tests/ui/generic-const-items/parameter-defaults.stderr b/tests/ui/generic-const-items/parameter-defaults.stderr
new file mode 100644
index 00000000000..62da45e55d6
--- /dev/null
+++ b/tests/ui/generic-const-items/parameter-defaults.stderr
@@ -0,0 +1,8 @@
+error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
+  --> $DIR/parameter-defaults.rs:10:12
+   |
+LL | const NONE<T = ()>: Option<T> = None::<T>;
+   |            ^^^^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/generic-const-items/recursive.rs b/tests/ui/generic-const-items/recursive.rs
new file mode 100644
index 00000000000..3266b37d380
--- /dev/null
+++ b/tests/ui/generic-const-items/recursive.rs
@@ -0,0 +1,12 @@
+// FIXME(generic_const_items): This leads to a stack overflow in the compiler!
+// known-bug: unknown
+// ignore-test
+
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+const RECUR<T>: () = RECUR::<(T,)>;
+
+fn main() {
+    let _ = RECUR::<()>;
+}
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs
new file mode 100644
index 00000000000..dd00b327d2d
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.rs
@@ -0,0 +1,12 @@
+#![feature(generic_const_items, trivial_bounds)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if trivial bounds on const items hold or not.
+
+const UNUSABLE: () = ()
+where
+    String: Copy;
+
+fn main() {
+    let _ = UNUSABLE; //~ ERROR the trait bound `String: Copy` is not satisfied
+}
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr
new file mode 100644
index 00000000000..c3ef94529a4
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-0.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+  --> $DIR/trivially-unsatisfied-bounds-0.rs:11:13
+   |
+LL |     let _ = UNUSABLE;
+   |             ^^^^^^^^ the trait `Copy` is not implemented for `String`
+   |
+note: required by a bound in `UNUSABLE`
+  --> $DIR/trivially-unsatisfied-bounds-0.rs:8:13
+   |
+LL | const UNUSABLE: () = ()
+   |       -------- required by a bound in this constant
+LL | where
+LL |     String: Copy;
+   |             ^^^^ required by this bound in `UNUSABLE`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs
new file mode 100644
index 00000000000..9243deac870
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.rs
@@ -0,0 +1,12 @@
+#![feature(generic_const_items, trivial_bounds)]
+#![allow(incomplete_features, dead_code, trivial_bounds)]
+
+// FIXME(generic_const_items): This looks like a bug to me. I expected that we wouldn't emit any
+// errors. I thought we'd skip the evaluation of consts whose bounds don't hold.
+
+const UNUSED: () = ()
+where
+    String: Copy;
+//~^^^ ERROR evaluation of constant value failed
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr
new file mode 100644
index 00000000000..a68400798d8
--- /dev/null
+++ b/tests/ui/generic-const-items/trivially-unsatisfied-bounds-1.stderr
@@ -0,0 +1,11 @@
+error[E0080]: evaluation of constant value failed
+  --> $DIR/trivially-unsatisfied-bounds-1.rs:7:1
+   |
+LL | / const UNUSED: () = ()
+LL | | where
+LL | |     String: Copy;
+   | |_________________^ entering unreachable code
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.rs b/tests/ui/generic-const-items/unsatisfied-bounds.rs
new file mode 100644
index 00000000000..05879900172
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.rs
@@ -0,0 +1,34 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if bounds on const items hold or not.
+
+use std::convert::Infallible;
+
+const C<T: Copy>: () = ();
+
+const K<T>: () = ()
+where
+    Infallible: From<T>;
+
+trait Trait<P> {
+    const A: u32
+    where
+        P: Copy;
+
+    const B<T>: u32
+    where
+        Infallible: From<T>;
+}
+
+impl<P> Trait<P> for () {
+    const A: u32 = 0;
+    const B<T>: u32 = 1;
+}
+
+fn main() {
+    let () = C::<String>; //~ ERROR the trait bound `String: Copy` is not satisfied
+    let () = K::<()>; //~ ERROR the trait bound `Infallible: From<()>` is not satisfied
+    let _ = <() as Trait<Vec<u8>>>::A; //~ ERROR the trait bound `Vec<u8>: Copy` is not satisfied
+    let _ = <() as Trait<&'static str>>::B::<()>; //~ ERROR the trait bound `Infallible: From<()>` is not satisfied
+}
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
new file mode 100644
index 00000000000..1fda460372a
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
@@ -0,0 +1,62 @@
+error[E0277]: the trait bound `String: Copy` is not satisfied
+  --> $DIR/unsatisfied-bounds.rs:30:18
+   |
+LL |     let () = C::<String>;
+   |                  ^^^^^^ the trait `Copy` is not implemented for `String`
+   |
+note: required by a bound in `C`
+  --> $DIR/unsatisfied-bounds.rs:8:12
+   |
+LL | const C<T: Copy>: () = ();
+   |            ^^^^ required by this bound in `C`
+
+error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
+  --> $DIR/unsatisfied-bounds.rs:31:18
+   |
+LL |     let () = K::<()>;
+   |                  ^^ the trait `From<()>` is not implemented for `Infallible`
+   |
+   = help: the trait `From<!>` is implemented for `Infallible`
+note: required by a bound in `K`
+  --> $DIR/unsatisfied-bounds.rs:12:17
+   |
+LL | const K<T>: () = ()
+   |       - required by a bound in this constant
+LL | where
+LL |     Infallible: From<T>;
+   |                 ^^^^^^^ required by this bound in `K`
+
+error[E0277]: the trait bound `Vec<u8>: Copy` is not satisfied
+  --> $DIR/unsatisfied-bounds.rs:32:13
+   |
+LL |     let _ = <() as Trait<Vec<u8>>>::A;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<u8>`
+   |
+note: required by a bound in `Trait::A`
+  --> $DIR/unsatisfied-bounds.rs:17:12
+   |
+LL |     const A: u32
+   |           - required by a bound in this associated constant
+LL |     where
+LL |         P: Copy;
+   |            ^^^^ required by this bound in `Trait::A`
+
+error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
+  --> $DIR/unsatisfied-bounds.rs:33:46
+   |
+LL |     let _ = <() as Trait<&'static str>>::B::<()>;
+   |                                              ^^ the trait `From<()>` is not implemented for `Infallible`
+   |
+   = help: the trait `From<!>` is implemented for `Infallible`
+note: required by a bound in `Trait::B`
+  --> $DIR/unsatisfied-bounds.rs:21:21
+   |
+LL |     const B<T>: u32
+   |           - required by a bound in this associated constant
+LL |     where
+LL |         Infallible: From<T>;
+   |                     ^^^^^^^ required by this bound in `Trait::B`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs
new file mode 100644
index 00000000000..961e5b4aeeb
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.rs
@@ -0,0 +1,12 @@
+#![feature(generic_const_items, generic_const_exprs)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if (makeshift) "evaluatable"-bounds on const items hold or not.
+
+const POSITIVE<const N: usize>: usize = N
+where
+    [(); N - 1]:; //~ ERROR evaluation of `POSITIVE::<0>::{constant#0}` failed
+
+fn main() {
+    let _ = POSITIVE::<0>;
+}
diff --git a/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr
new file mode 100644
index 00000000000..bed213b0caa
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-evaluatable-bounds.stderr
@@ -0,0 +1,9 @@
+error[E0080]: evaluation of `POSITIVE::<0>::{constant#0}` failed
+  --> $DIR/unsatisfied-evaluatable-bounds.rs:8:10
+   |
+LL |     [(); N - 1]:;
+   |          ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs
new file mode 100644
index 00000000000..204cf9def36
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.rs
@@ -0,0 +1,17 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features)]
+
+// Ensure that we check if outlives-bounds on const items hold or not.
+
+const C<'a, T: 'a>: () = ();
+const K<'a, 'b: 'a>: () = ();
+
+fn parametrized0<'any>() {
+    let () = C::<'static, &'any ()>; //~ ERROR lifetime may not live long enough
+}
+
+fn parametrized1<'any>() {
+    let () = K::<'static, 'any>; //~ ERROR lifetime may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr
new file mode 100644
index 00000000000..72e4265b3d7
--- /dev/null
+++ b/tests/ui/generic-const-items/unsatisfied-outlives-bounds.stderr
@@ -0,0 +1,18 @@
+error: lifetime may not live long enough
+  --> $DIR/unsatisfied-outlives-bounds.rs:10:14
+   |
+LL | fn parametrized0<'any>() {
+   |                  ---- lifetime `'any` defined here
+LL |     let () = C::<'static, &'any ()>;
+   |              ^^^^^^^^^^^^^^^^^^^^^^ requires that `'any` must outlive `'static`
+
+error: lifetime may not live long enough
+  --> $DIR/unsatisfied-outlives-bounds.rs:14:14
+   |
+LL | fn parametrized1<'any>() {
+   |                  ---- lifetime `'any` defined here
+LL |     let () = K::<'static, 'any>;
+   |              ^^^^^^^^^^^^^^^^^^ requires that `'any` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
new file mode 100644
index 00000000000..3a93dfee57f
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.rs
@@ -0,0 +1,11 @@
+// issue: 114146
+
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Foo {
+    fn bar<'other: 'a>() -> impl Sized + 'a {}
+    //~^ ERROR use of undeclared lifetime name `'a`
+    //~| ERROR use of undeclared lifetime name `'a`
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
new file mode 100644
index 00000000000..3a1f8f90837
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit-2.stderr
@@ -0,0 +1,33 @@
+error[E0261]: use of undeclared lifetime name `'a`
+  --> $DIR/bad-item-bound-within-rpitit-2.rs:6:20
+   |
+LL |     fn bar<'other: 'a>() -> impl Sized + 'a {}
+   |                    ^^ undeclared lifetime
+   |
+help: consider introducing lifetime `'a` here
+   |
+LL |     fn bar<'a, 'other: 'a>() -> impl Sized + 'a {}
+   |            +++
+help: consider introducing lifetime `'a` here
+   |
+LL | trait Foo<'a> {
+   |          ++++
+
+error[E0261]: use of undeclared lifetime name `'a`
+  --> $DIR/bad-item-bound-within-rpitit-2.rs:6:42
+   |
+LL |     fn bar<'other: 'a>() -> impl Sized + 'a {}
+   |                                          ^^ undeclared lifetime
+   |
+help: consider introducing lifetime `'a` here
+   |
+LL |     fn bar<'a, 'other: 'a>() -> impl Sized + 'a {}
+   |            +++
+help: consider introducing lifetime `'a` here
+   |
+LL | trait Foo<'a> {
+   |          ++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
new file mode 100644
index 00000000000..8b97336fe0c
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.rs
@@ -0,0 +1,25 @@
+// issue: 114145
+
+#![feature(return_position_impl_trait_in_trait)]
+
+trait Iterable {
+    type Item<'a>
+    where
+        Self: 'a;
+
+    fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
+}
+
+impl<'a, I: 'a + Iterable> Iterable for &'a I {
+    type Item<'b> = I::Item<'a>
+    where
+        'b: 'a;
+    //~^ ERROR impl has stricter requirements than trait
+
+    fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
+        //~^ ERROR the type `&'a I` does not fulfill the required lifetime
+        (*self).iter()
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
new file mode 100644
index 00000000000..54a08c5b516
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/bad-item-bound-within-rpitit.stderr
@@ -0,0 +1,30 @@
+error[E0276]: impl has stricter requirements than trait
+  --> $DIR/bad-item-bound-within-rpitit.rs:16:13
+   |
+LL |     type Item<'a>
+   |     ------------- definition of `Item` from trait
+...
+LL |         'b: 'a;
+   |             ^^ impl has extra requirement `'b: 'a`
+   |
+help: copy the `where` clause predicates from the trait
+   |
+LL |     where Self: 'b;
+   |     ~~~~~~~~~~~~~~
+
+error[E0477]: the type `&'a I` does not fulfill the required lifetime
+  --> $DIR/bad-item-bound-within-rpitit.rs:19:23
+   |
+LL |     fn iter(&self) -> impl 'a + Iterator<Item = I::Item<'a>> {
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: type must outlive the anonymous lifetime as defined here
+  --> $DIR/bad-item-bound-within-rpitit.rs:10:28
+   |
+LL |     fn iter(&self) -> impl '_ + Iterator<Item = Self::Item<'_>>;
+   |                            ^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0276, E0477.
+For more information about an error, try `rustc --explain E0276`.
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
new file mode 100644
index 00000000000..7682884f879
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.rs
@@ -0,0 +1,18 @@
+// issue: 113903
+
+#![feature(return_position_impl_trait_in_trait)]
+
+use std::ops::Deref;
+
+pub trait Tr {
+    fn w() -> impl Deref<Target = Missing<impl Sized>>;
+    //~^ ERROR cannot find type `Missing` in this scope
+}
+
+impl Tr for () {
+    fn w() -> &'static () {
+        &()
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr
new file mode 100644
index 00000000000..6e4a5bb5df3
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-shadowed-by-missing-adt.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Missing` in this scope
+  --> $DIR/rpitit-shadowed-by-missing-adt.rs:8:35
+   |
+LL |     fn w() -> impl Deref<Target = Missing<impl Sized>>;
+   |                                   ^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/layout/malformed-unsized-type-in-union.rs b/tests/ui/layout/malformed-unsized-type-in-union.rs
new file mode 100644
index 00000000000..5d8ec576cf0
--- /dev/null
+++ b/tests/ui/layout/malformed-unsized-type-in-union.rs
@@ -0,0 +1,8 @@
+// issue: 113760
+
+union W { s: dyn Iterator<Item = Missing> }
+//~^ ERROR cannot find type `Missing` in this scope
+
+static ONCE: W = todo!();
+
+fn main() {}
diff --git a/tests/ui/layout/malformed-unsized-type-in-union.stderr b/tests/ui/layout/malformed-unsized-type-in-union.stderr
new file mode 100644
index 00000000000..cbb8d6af38a
--- /dev/null
+++ b/tests/ui/layout/malformed-unsized-type-in-union.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `Missing` in this scope
+  --> $DIR/malformed-unsized-type-in-union.rs:3:34
+   |
+LL | union W { s: dyn Iterator<Item = Missing> }
+   |                                  ^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/tests/ui/lint/lint-cap-trait-bounds.rs b/tests/ui/lint/lint-cap-trait-bounds.rs
new file mode 100644
index 00000000000..d9c28dd0aa6
--- /dev/null
+++ b/tests/ui/lint/lint-cap-trait-bounds.rs
@@ -0,0 +1,8 @@
+// Regression test for https://github.com/rust-lang/rust/issues/43134
+
+// check-pass
+// compile-flags: --cap-lints allow
+
+type Foo<T: Clone> = Option<T>;
+
+fn main() {}
diff --git a/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs
new file mode 100644
index 00000000000..93b7ddf5e9e
--- /dev/null
+++ b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.rs
@@ -0,0 +1,6 @@
+// issue: 114131
+
+fn main() {
+    let hello = len(vec![]);
+    //~^ ERROR cannot find function `len` in this scope
+}
diff --git a/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr
new file mode 100644
index 00000000000..9694f80ab6d
--- /dev/null
+++ b/tests/ui/methods/suggest-method-on-call-with-macro-rcvr.stderr
@@ -0,0 +1,15 @@
+error[E0425]: cannot find function `len` in this scope
+  --> $DIR/suggest-method-on-call-with-macro-rcvr.rs:4:17
+   |
+LL |     let hello = len(vec![]);
+   |                 ^^^ not found in this scope
+   |
+help: use the `.` operator to call the method `len` on `&Vec<_>`
+   |
+LL -     let hello = len(vec![]);
+LL +     let hello = vec![].len();
+   |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/tests/ui/object-safety/assoc_const_bounds.rs b/tests/ui/object-safety/assoc_const_bounds.rs
index 94b1f63165b..bfa21fd9aea 100644
--- a/tests/ui/object-safety/assoc_const_bounds.rs
+++ b/tests/ui/object-safety/assoc_const_bounds.rs
@@ -1,7 +1,12 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+// check-pass
+
 trait Foo<T> {
     const BAR: bool
-        where //~ ERROR: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
-            Self: Sized;
+    where
+        Self: Sized;
 }
 
 trait Cake {}
diff --git a/tests/ui/object-safety/assoc_const_bounds.stderr b/tests/ui/object-safety/assoc_const_bounds.stderr
deleted file mode 100644
index 09bc11e178a..00000000000
--- a/tests/ui/object-safety/assoc_const_bounds.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
-  --> $DIR/assoc_const_bounds.rs:3:9
-   |
-LL | trait Foo<T> {
-   |              - while parsing this item list starting here
-LL |     const BAR: bool
-   |                    - expected one of 7 possible tokens
-LL |         where
-   |         ^^^^^ unexpected token
-LL |             Self: Sized;
-LL | }
-   | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/tests/ui/object-safety/assoc_const_bounds_sized.rs b/tests/ui/object-safety/assoc_const_bounds_sized.rs
index 2a76e5dce2b..87d1f06f036 100644
--- a/tests/ui/object-safety/assoc_const_bounds_sized.rs
+++ b/tests/ui/object-safety/assoc_const_bounds_sized.rs
@@ -1,7 +1,12 @@
+#![feature(generic_const_items)]
+#![allow(incomplete_features, dead_code)]
+
+// check-pass
+
 trait Foo {
     const BAR: bool
-        where //~ ERROR: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
-            Self: Sized;
+    where
+        Self: Sized;
 }
 
 fn foo(_: &dyn Foo) {}
diff --git a/tests/ui/object-safety/assoc_const_bounds_sized.stderr b/tests/ui/object-safety/assoc_const_bounds_sized.stderr
deleted file mode 100644
index e1f57f67795..00000000000
--- a/tests/ui/object-safety/assoc_const_bounds_sized.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found keyword `where`
-  --> $DIR/assoc_const_bounds_sized.rs:3:9
-   |
-LL | trait Foo {
-   |           - while parsing this item list starting here
-LL |     const BAR: bool
-   |                    - expected one of 7 possible tokens
-LL |         where
-   |         ^^^^^ unexpected token
-LL |             Self: Sized;
-LL | }
-   | - the item list ends here
-
-error: aborting due to previous error
-
diff --git a/tests/ui/parser/generic-statics.rs b/tests/ui/parser/generic-statics.rs
new file mode 100644
index 00000000000..2fb8781fdff
--- /dev/null
+++ b/tests/ui/parser/generic-statics.rs
@@ -0,0 +1,4 @@
+static S<T>: i32 = 0;
+//~^ ERROR static items may not have generic parameters
+
+fn main() {}
diff --git a/tests/ui/parser/generic-statics.stderr b/tests/ui/parser/generic-statics.stderr
new file mode 100644
index 00000000000..c757232b061
--- /dev/null
+++ b/tests/ui/parser/generic-statics.stderr
@@ -0,0 +1,8 @@
+error: static items may not have generic parameters
+  --> $DIR/generic-statics.rs:1:9
+   |
+LL | static S<T>: i32 = 0;
+   |         ^^^
+
+error: aborting due to previous error
+
diff --git a/tests/ui/privacy/issue-113860-1.rs b/tests/ui/privacy/issue-113860-1.rs
new file mode 100644
index 00000000000..86ccca41f37
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-1.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+    //~^ ERROR trait has missing stability attribute
+    fn fun() {}
+    //~^ ERROR associated function has missing stability attribute
+}
+
+impl Trait for u8 {
+    //~^ ERROR implementation has missing stability attribute
+    pub(self) fn fun() {}
+    //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860-1.stderr b/tests/ui/privacy/issue-113860-1.stderr
new file mode 100644
index 00000000000..c33ce26f0f6
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-1.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+  --> $DIR/issue-113860-1.rs:12:5
+   |
+LL |     pub(self) fn fun() {}
+   |     ^^^^^^^^^
+   |
+   = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+  --> $DIR/issue-113860-1.rs:1:1
+   |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+...  |
+LL | |
+LL | | fn main() {}
+   | |____________^
+
+error: trait has missing stability attribute
+  --> $DIR/issue-113860-1.rs:4:1
+   |
+LL | / pub trait Trait {
+LL | |
+LL | |     fn fun() {}
+LL | |
+LL | | }
+   | |_^
+
+error: implementation has missing stability attribute
+  --> $DIR/issue-113860-1.rs:10:1
+   |
+LL | / impl Trait for u8 {
+LL | |
+LL | |     pub(self) fn fun() {}
+LL | |
+LL | | }
+   | |_^
+
+error: associated function has missing stability attribute
+  --> $DIR/issue-113860-1.rs:6:5
+   |
+LL |     fn fun() {}
+   |     ^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/issue-113860-2.rs b/tests/ui/privacy/issue-113860-2.rs
new file mode 100644
index 00000000000..59be19d88a0
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-2.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+    //~^ ERROR trait has missing stability attribute
+    type X;
+    //~^ ERROR associated type has missing stability attribute
+}
+
+impl Trait for u8 {
+    //~^ ERROR implementation has missing stability attribute
+    pub(self) type X = Self;
+    //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860-2.stderr b/tests/ui/privacy/issue-113860-2.stderr
new file mode 100644
index 00000000000..6748bc27668
--- /dev/null
+++ b/tests/ui/privacy/issue-113860-2.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+  --> $DIR/issue-113860-2.rs:12:5
+   |
+LL |     pub(self) type X = Self;
+   |     ^^^^^^^^^
+   |
+   = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+  --> $DIR/issue-113860-2.rs:1:1
+   |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+...  |
+LL | |
+LL | | fn main() {}
+   | |____________^
+
+error: trait has missing stability attribute
+  --> $DIR/issue-113860-2.rs:4:1
+   |
+LL | / pub trait Trait {
+LL | |
+LL | |     type X;
+LL | |
+LL | | }
+   | |_^
+
+error: implementation has missing stability attribute
+  --> $DIR/issue-113860-2.rs:10:1
+   |
+LL | / impl Trait for u8 {
+LL | |
+LL | |     pub(self) type X = Self;
+LL | |
+LL | | }
+   | |_^
+
+error: associated type has missing stability attribute
+  --> $DIR/issue-113860-2.rs:6:5
+   |
+LL |     type X;
+   |     ^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/privacy/issue-113860.rs b/tests/ui/privacy/issue-113860.rs
new file mode 100644
index 00000000000..b94c14fac4e
--- /dev/null
+++ b/tests/ui/privacy/issue-113860.rs
@@ -0,0 +1,16 @@
+#![feature(staged_api)]
+//~^ ERROR module has missing stability attribute
+
+pub trait Trait {
+    //~^ ERROR trait has missing stability attribute
+    const X: u32;
+    //~^ ERROR associated constant has missing stability attribute
+}
+
+impl Trait for u8 {
+    //~^ ERROR implementation has missing stability attribute
+    pub(self) const X: u32 = 3;
+    //~^ ERROR visibility qualifiers are not permitted here [E0449]
+}
+
+fn main() {}
diff --git a/tests/ui/privacy/issue-113860.stderr b/tests/ui/privacy/issue-113860.stderr
new file mode 100644
index 00000000000..3204f4ff916
--- /dev/null
+++ b/tests/ui/privacy/issue-113860.stderr
@@ -0,0 +1,49 @@
+error[E0449]: visibility qualifiers are not permitted here
+  --> $DIR/issue-113860.rs:12:5
+   |
+LL |     pub(self) const X: u32 = 3;
+   |     ^^^^^^^^^
+   |
+   = note: trait items always share the visibility of their trait
+
+error: module has missing stability attribute
+  --> $DIR/issue-113860.rs:1:1
+   |
+LL | / #![feature(staged_api)]
+LL | |
+LL | |
+LL | | pub trait Trait {
+...  |
+LL | |
+LL | | fn main() {}
+   | |____________^
+
+error: trait has missing stability attribute
+  --> $DIR/issue-113860.rs:4:1
+   |
+LL | / pub trait Trait {
+LL | |
+LL | |     const X: u32;
+LL | |
+LL | | }
+   | |_^
+
+error: implementation has missing stability attribute
+  --> $DIR/issue-113860.rs:10:1
+   |
+LL | / impl Trait for u8 {
+LL | |
+LL | |     pub(self) const X: u32 = 3;
+LL | |
+LL | | }
+   | |_^
+
+error: associated constant has missing stability attribute
+  --> $DIR/issue-113860.rs:6:5
+   |
+LL |     const X: u32;
+   |     ^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/tests/ui/proc-macro/derive-helper-shadowed.rs b/tests/ui/proc-macro/derive-helper-shadowed.rs
index e299454e0fc..ac14ece6918 100644
--- a/tests/ui/proc-macro/derive-helper-shadowed.rs
+++ b/tests/ui/proc-macro/derive-helper-shadowed.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // aux-build:test-macros.rs
 // aux-build:derive-helper-shadowed-2.rs
 
diff --git a/tests/ui/proc-macro/derive-in-mod.rs b/tests/ui/proc-macro/derive-in-mod.rs
index 8b5d4e9d09c..96e9d93fe12 100644
--- a/tests/ui/proc-macro/derive-in-mod.rs
+++ b/tests/ui/proc-macro/derive-in-mod.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // aux-build:test-macros.rs
 
 extern crate test_macros;
diff --git a/tests/ui/proc-macro/edition-imports-2018.rs b/tests/ui/proc-macro/edition-imports-2018.rs
index 5a77cd4ef4f..76567353198 100644
--- a/tests/ui/proc-macro/edition-imports-2018.rs
+++ b/tests/ui/proc-macro/edition-imports-2018.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // edition:2018
 // aux-build:edition-imports-2015.rs
 
diff --git a/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs b/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
index a6e64e1b1b1..38f61c36c8c 100644
--- a/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
+++ b/tests/ui/proc-macro/extern-prelude-extern-crate-proc-macro.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // edition:2018
 
 extern crate proc_macro;
diff --git a/tests/ui/proc-macro/helper-attr-blocked-by-import.rs b/tests/ui/proc-macro/helper-attr-blocked-by-import.rs
index 2e20a3de6bf..344323122dc 100644
--- a/tests/ui/proc-macro/helper-attr-blocked-by-import.rs
+++ b/tests/ui/proc-macro/helper-attr-blocked-by-import.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // aux-build:test-macros.rs
 
 #[macro_use(Empty)]
diff --git a/tests/ui/proc-macro/issue-53481.rs b/tests/ui/proc-macro/issue-53481.rs
index ae10a3baa3e..922e60a4c4f 100644
--- a/tests/ui/proc-macro/issue-53481.rs
+++ b/tests/ui/proc-macro/issue-53481.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // aux-build:test-macros.rs
 
 #[macro_use]
diff --git a/tests/ui/proc-macro/macro-use-attr.rs b/tests/ui/proc-macro/macro-use-attr.rs
index b101c09ed54..d275fb6a804 100644
--- a/tests/ui/proc-macro/macro-use-attr.rs
+++ b/tests/ui/proc-macro/macro-use-attr.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // aux-build:test-macros.rs
 
 #[macro_use]
diff --git a/tests/ui/proc-macro/macro-use-bang.rs b/tests/ui/proc-macro/macro-use-bang.rs
index 4a0bf0b2f63..e3174fd446a 100644
--- a/tests/ui/proc-macro/macro-use-bang.rs
+++ b/tests/ui/proc-macro/macro-use-bang.rs
@@ -1,4 +1,4 @@
-// build-pass (FIXME(62277): could be check-pass?)
+// check-pass
 // aux-build:test-macros.rs
 
 #[macro_use]
diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.stderr b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr
index 233f1bc5a86..24e2e0a0f7a 100644
--- a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.stderr
+++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.default.stderr
@@ -1,5 +1,5 @@
 error[E0106]: missing lifetime specifier
-  --> $DIR/missing-lifetime-in-assoc-const-type.rs:2:14
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:14
    |
 LL |     const A: &str = "";
    |              ^ expected named lifetime parameter
@@ -11,7 +11,7 @@ LL ~     const A: &'a str = "";
    |
 
 error[E0106]: missing lifetime specifier
-  --> $DIR/missing-lifetime-in-assoc-const-type.rs:3:14
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:7:14
    |
 LL |     const B: S = S { s: &() };
    |              ^ expected named lifetime parameter
@@ -24,7 +24,7 @@ LL ~     const B: S<'a> = S { s: &() };
    |
 
 error[E0106]: missing lifetime specifier
-  --> $DIR/missing-lifetime-in-assoc-const-type.rs:4:15
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:8:15
    |
 LL |     const C: &'_ str = "";
    |               ^^ expected named lifetime parameter
@@ -38,7 +38,7 @@ LL ~     const C: &'a str = "";
    |
 
 error[E0106]: missing lifetime specifiers
-  --> $DIR/missing-lifetime-in-assoc-const-type.rs:5:14
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:9:14
    |
 LL |     const D: T = T { a: &(), b: &() };
    |              ^ expected 2 lifetime parameters
diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr
new file mode 100644
index 00000000000..a97ffe7da79
--- /dev/null
+++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.generic_const_items.stderr
@@ -0,0 +1,47 @@
+error[E0106]: missing lifetime specifier
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:6:14
+   |
+LL |     const A: &str = "";
+   |              ^ expected named lifetime parameter
+   |
+help: consider introducing a named lifetime parameter
+   |
+LL |     const A<'a>: &'a str = "";
+   |            ++++   ++
+
+error[E0106]: missing lifetime specifier
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:7:14
+   |
+LL |     const B: S = S { s: &() };
+   |              ^ expected named lifetime parameter
+   |
+help: consider introducing a named lifetime parameter
+   |
+LL |     const B<'a>: S<'a> = S { s: &() };
+   |            ++++   ++++
+
+error[E0106]: missing lifetime specifier
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:8:15
+   |
+LL |     const C: &'_ str = "";
+   |               ^^ expected named lifetime parameter
+   |
+help: consider introducing a named lifetime parameter
+   |
+LL |     const C<'a>: &'a str = "";
+   |            ++++   ~~
+
+error[E0106]: missing lifetime specifiers
+  --> $DIR/missing-lifetime-in-assoc-const-type.rs:9:14
+   |
+LL |     const D: T = T { a: &(), b: &() };
+   |              ^ expected 2 lifetime parameters
+   |
+help: consider introducing a named lifetime parameter
+   |
+LL |     const D<'a>: T<'a, 'a> = T { a: &(), b: &() };
+   |            ++++   ++++++++
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs
index 38332627f4c..2a8b4c3c044 100644
--- a/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs
+++ b/tests/ui/suggestions/missing-lifetime-in-assoc-const-type.rs
@@ -1,3 +1,7 @@
+// revisions: default generic_const_items
+
+#![cfg_attr(generic_const_items, feature(generic_const_items), allow(incomplete_features))]
+
 trait ZstAssert: Sized {
     const A: &str = ""; //~ ERROR missing lifetime specifier
     const B: S = S { s: &() }; //~ ERROR missing lifetime specifier