about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/generic-const-items/const-trait-impl.rs4
-rw-r--r--tests/ui/generic-const-items/const-trait-impl.stderr6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr10
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-bound-on-not-const-associated-fn.rs (renamed from tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs)2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-bound-on-not-const-associated-fn.stderr (renamed from tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr)0
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr21
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr21
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.rs9
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr14
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs1
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr16
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr2
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.rs54
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr246
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.rs6
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.stderr8
22 files changed, 396 insertions, 86 deletions
diff --git a/tests/ui/generic-const-items/const-trait-impl.rs b/tests/ui/generic-const-items/const-trait-impl.rs
index d30f7af170d..43cdf818c46 100644
--- a/tests/ui/generic-const-items/const-trait-impl.rs
+++ b/tests/ui/generic-const-items/const-trait-impl.rs
@@ -7,8 +7,8 @@
 #![allow(incomplete_features)]
 #![crate_type = "lib"]
 
-// FIXME(generic_const_items): Interpret `~const` as always-const.
-const CREATE<T: ~const Create>: T = T::create();
+// FIXME(generic_const_items, effects): Introduce `const` bounds to make this work.
+const CREATE<T: Create>: T = T::create();
 
 pub const K0: i32 = CREATE::<i32>;
 pub const K1: i32 = CREATE; // arg inferred
diff --git a/tests/ui/generic-const-items/const-trait-impl.stderr b/tests/ui/generic-const-items/const-trait-impl.stderr
index 34360c581d5..64aa8adf8a7 100644
--- a/tests/ui/generic-const-items/const-trait-impl.stderr
+++ b/tests/ui/generic-const-items/const-trait-impl.stderr
@@ -1,8 +1,8 @@
 error[E0015]: cannot call non-const fn `<T as Create>::create` in constants
-  --> $DIR/const-trait-impl.rs:11:37
+  --> $DIR/const-trait-impl.rs:11:30
    |
-LL | const CREATE<T: ~const Create>: T = T::create();
-   |                                     ^^^^^^^^^^^
+LL | const CREATE<T: Create>: T = T::create();
+   |                              ^^^^^^^^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
index 6d436018bf4..e6b663c47d7 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type-const-bound-usage.stderr
@@ -1,3 +1,11 @@
+error: `~const` is not allowed here
+  --> $DIR/assoc-type-const-bound-usage.rs:7:17
+   |
+LL |     type Assoc: ~const Foo;
+   |                 ^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
 error[E0308]: mismatched types
   --> $DIR/assoc-type-const-bound-usage.rs:12:5
    |
@@ -7,6 +15,6 @@ LL |     <T as Foo>::Assoc::foo();
    = note: expected constant `host`
               found constant `true`
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr
index 0cffae1da8d..7df16ca5a3b 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/assoc-type.stderr
@@ -1,8 +1,16 @@
+error: `~const` is not allowed here
+  --> $DIR/assoc-type.rs:17:15
+   |
+LL |     type Bar: ~const std::ops::Add;
+   |               ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
 error: ~const can only be applied to `#[const_trait]` traits
   --> $DIR/assoc-type.rs:17:22
    |
 LL |     type Bar: ~const std::ops::Add;
    |                      ^^^^^^^^^^^^^
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-bound-on-not-const-associated-fn.rs
index 1e22ddcea8d..0025449c492 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-bound-on-not-const-associated-fn.rs
@@ -1,4 +1,4 @@
-#![feature(const_trait_impl, effects)]
+#![feature(const_trait_impl)]
 
 #[const_trait]
 trait MyTrait {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-bound-on-not-const-associated-fn.stderr
index 9210f642706..9210f642706 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/const-bound-on-not-const-associated-fn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-bound-on-not-const-associated-fn.stderr
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
index 23e36887025..be75e852e0a 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.precise.stderr
@@ -1,19 +1,10 @@
-error[E0493]: destructor of `T` cannot be evaluated at compile-time
-  --> $DIR/const-drop.rs:19:32
+error: `~const` is not allowed here
+  --> $DIR/const-drop.rs:67:38
    |
-LL | const fn a<T: ~const Destruct>(_: T) {}
-   |                                ^      - value is dropped here
-   |                                |
-   |                                the destructor for this type cannot be evaluated in constant functions
-
-error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
-  --> $DIR/const-drop.rs:24:13
+LL |     pub struct ConstDropWithBound<T: ~const SomeTrait>(pub core::marker::PhantomData<T>);
+   |                                      ^^^^^^^^^^^^^^^^
    |
-LL |     let _ = S(&mut c);
-   |             ^^^^^^^^^- value is dropped here
-   |             |
-   |             the destructor for this type cannot be evaluated in constant functions
+   = note: this item cannot have `~const` trait bounds
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs
index 0a9cf638a2d..9da84cdb052 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.rs
@@ -63,6 +63,7 @@ mod t {
         fn foo() {}
     }
 
+    // FIXME(effects): This should be a `const` bound instead of a `~const` one.
     pub struct ConstDropWithBound<T: ~const SomeTrait>(pub core::marker::PhantomData<T>);
 
     impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
index 23e36887025..be75e852e0a 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop.stock.stderr
@@ -1,19 +1,10 @@
-error[E0493]: destructor of `T` cannot be evaluated at compile-time
-  --> $DIR/const-drop.rs:19:32
+error: `~const` is not allowed here
+  --> $DIR/const-drop.rs:67:38
    |
-LL | const fn a<T: ~const Destruct>(_: T) {}
-   |                                ^      - value is dropped here
-   |                                |
-   |                                the destructor for this type cannot be evaluated in constant functions
-
-error[E0493]: destructor of `S<'_>` cannot be evaluated at compile-time
-  --> $DIR/const-drop.rs:24:13
+LL |     pub struct ConstDropWithBound<T: ~const SomeTrait>(pub core::marker::PhantomData<T>);
+   |                                      ^^^^^^^^^^^^^^^^
    |
-LL |     let _ = S(&mut c);
-   |             ^^^^^^^^^- value is dropped here
-   |             |
-   |             the destructor for this type cannot be evaluated in constant functions
+   = note: this item cannot have `~const` trait bounds
 
-error: aborting due to 2 previous errors
+error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.rs
deleted file mode 100644
index 21ddf4ab4e5..00000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-#![feature(const_trait_impl)]
-
-#[const_trait]
-trait Bar {}
-
-fn foo<T>() where T: ~const Bar {}
-//~^ ERROR `~const` is not allowed
-
-fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.stderr
deleted file mode 100644
index b2a9365378b..00000000000
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/issue-90052.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: `~const` is not allowed here
-  --> $DIR/issue-90052.rs:6:22
-   |
-LL | fn foo<T>() where T: ~const Bar {}
-   |                      ^^^^^^^^^^
-   |
-note: this function is not `const`, so it cannot have `~const` trait bounds
-  --> $DIR/issue-90052.rs:6:4
-   |
-LL | fn foo<T>() where T: ~const Bar {}
-   |    ^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs
index 3db59631ef8..234b0dd0063 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs
@@ -18,11 +18,7 @@ trait Bar {
     fn bar();
 }
 
-// bgr360: I was only able to exercise the code path that raises the
-// "missing ~const qualifier" error by making this base impl non-const, even
-// though that doesn't really make sense to do. As seen below, if the base impl
-// is made const, rustc fails earlier with an overlapping impl failure.
-impl<T> Bar for T
+impl<T> const Bar for T
 where
     T: ~const Foo,
 {
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
index b60399c57dc..204f0f9f89f 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr
@@ -1,3 +1,15 @@
+error: `~const` is not allowed here
+  --> $DIR/super-traits-fail-2.rs:11:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/super-traits-fail-2.rs:11:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: ~const can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:19
    |
@@ -12,5 +24,5 @@ LL | trait Bar: ~const Foo {}
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr
index 5d34156a519..06330958b8e 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr
@@ -1,11 +1,14 @@
-error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
-  --> $DIR/super-traits-fail-2.rs:16:7
+error: `~const` is not allowed here
+  --> $DIR/super-traits-fail-2.rs:11:12
    |
-LL |     x.a();
-   |       ^^^
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^^^^^
    |
-   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/super-traits-fail-2.rs:11:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
index eb12a236d8c..77b13a351e2 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr
@@ -1,3 +1,15 @@
+error: `~const` is not allowed here
+  --> $DIR/super-traits-fail-3.rs:13:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/super-traits-fail-3.rs:13:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: ~const can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-3.rs:13:19
    |
@@ -13,10 +25,10 @@ LL | trait Bar: ~const Foo {}
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:17:24
+  --> $DIR/super-traits-fail-3.rs:18:24
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
    |                        ^^^
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs
index 16c592830d7..5994057b2db 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.rs
@@ -13,6 +13,7 @@ trait Foo {
 trait Bar: ~const Foo {}
 //[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
 //[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]`
+//[yn,nn]~^^^ ERROR: `~const` is not allowed here
 
 const fn foo<T: ~const Bar>(x: &T) {
     //[yn,nn]~^ ERROR: ~const can only be applied to `#[const_trait]`
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
index 58225b94591..2e41eb9b4c4 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr
@@ -1,8 +1,20 @@
+error: `~const` is not allowed here
+  --> $DIR/super-traits-fail-3.rs:13:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/super-traits-fail-3.rs:13:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: ~const can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:17:24
+  --> $DIR/super-traits-fail-3.rs:18:24
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
    |                        ^^^
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr
index 6bc643e6871..d81d9aa94da 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/super-traits-fail-3.yy.stderr
@@ -1,5 +1,5 @@
 error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
-  --> $DIR/super-traits-fail-3.rs:19:7
+  --> $DIR/super-traits-fail-3.rs:20:7
    |
 LL |     x.a();
    |       ^^^
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.rs
index 95f7aaba0fc..bbe1194f7a3 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.rs
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.rs
@@ -1,7 +1,55 @@
 #![feature(const_trait_impl)]
-#![feature(associated_type_bounds)]
 
-struct TildeQuestion<T: ~const ?Sized>(std::marker::PhantomData<T>);
-//~^ ERROR `~const` and `?` are mutually exclusive
+#[const_trait]
+trait Trait {}
+
+// Regression test for issue #90052.
+fn non_const_function<T: ~const Trait>() {} //~ ERROR `~const` is not allowed
+
+struct Struct<T: ~const Trait> { field: T } //~ ERROR `~const` is not allowed here
+struct TupleStruct<T: ~const Trait>(T); //~ ERROR `~const` is not allowed here
+struct UnitStruct<T: ~const Trait>; //~ ERROR `~const` is not allowed here
+
+enum Enum<T: ~const Trait> { Variant(T) } //~ ERROR `~const` is not allowed here
+
+union Union<T: ~const Trait> { field: T } //~ ERROR `~const` is not allowed here
+
+type Type<T: ~const Trait> = T; //~ ERROR `~const` is not allowed here
+
+const CONSTANT<T: ~const Trait>: () = (); //~ ERROR `~const` is not allowed here
+//~^ ERROR generic const items are experimental
+
+trait NonConstTrait {
+    type Type<T: ~const Trait>: ~const Trait;
+    //~^ ERROR `~const` is not allowed
+    //~| ERROR `~const` is not allowed
+    fn non_const_function<T: ~const Trait>(); //~ ERROR `~const` is not allowed
+    const CONSTANT<T: ~const Trait>: (); //~ ERROR `~const` is not allowed
+    //~^ ERROR generic const items are experimental
+}
+
+impl NonConstTrait for () {
+    type Type<T: ~const Trait> = (); //~ ERROR `~const` is not allowed
+    fn non_const_function<T: ~const Trait>() {} //~ ERROR `~const` is not allowed
+    const CONSTANT<T: ~const Trait>: () = (); //~ ERROR `~const` is not allowed
+    //~^ ERROR generic const items are experimental
+}
+
+struct Implementor;
+
+impl Implementor {
+    type Type<T: ~const Trait> = (); //~ ERROR `~const` is not allowed
+    //~^ ERROR inherent associated types are unstable
+    fn non_const_function<T: ~const Trait>() {} //~ ERROR `~const` is not allowed
+    const CONSTANT<T: ~const Trait>: () = (); //~ ERROR `~const` is not allowed
+    //~^ ERROR generic const items are experimental
+}
+
+// non-const traits
+trait Child0: ~const Trait {} //~ ERROR `~const` is not allowed
+trait Child1 where Self: ~const Trait {} //~ ERROR `~const` is not allowed
+
+// non-const impl
+impl<T: ~const Trait> Trait for T {} //~ ERROR `~const` is not allowed
 
 fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr
index d20f146df3f..c14f9a99035 100644
--- a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-invalid-places.stderr
@@ -1,8 +1,244 @@
-error: `~const` and `?` are mutually exclusive
-  --> $DIR/tilde-const-invalid-places.rs:4:25
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:7:26
    |
-LL | struct TildeQuestion<T: ~const ?Sized>(std::marker::PhantomData<T>);
-   |                         ^^^^^^^^^^^^^
+LL | fn non_const_function<T: ~const Trait>() {}
+   |                          ^^^^^^^^^^^^
+   |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:7:4
+   |
+LL | fn non_const_function<T: ~const Trait>() {}
+   |    ^^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:9:18
+   |
+LL | struct Struct<T: ~const Trait> { field: T }
+   |                  ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:10:23
+   |
+LL | struct TupleStruct<T: ~const Trait>(T);
+   |                       ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:11:22
+   |
+LL | struct UnitStruct<T: ~const Trait>;
+   |                      ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:13:14
+   |
+LL | enum Enum<T: ~const Trait> { Variant(T) }
+   |              ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:15:16
+   |
+LL | union Union<T: ~const Trait> { field: T }
+   |                ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:17:14
+   |
+LL | type Type<T: ~const Trait> = T;
+   |              ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:19:19
+   |
+LL | const CONSTANT<T: ~const Trait>: () = ();
+   |                   ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:23:18
+   |
+LL |     type Type<T: ~const Trait>: ~const Trait;
+   |                  ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:23:33
+   |
+LL |     type Type<T: ~const Trait>: ~const Trait;
+   |                                 ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:26:30
+   |
+LL |     fn non_const_function<T: ~const Trait>();
+   |                              ^^^^^^^^^^^^
+   |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:26:8
+   |
+LL |     fn non_const_function<T: ~const Trait>();
+   |        ^^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:27:23
+   |
+LL |     const CONSTANT<T: ~const Trait>: ();
+   |                       ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:32:18
+   |
+LL |     type Type<T: ~const Trait> = ();
+   |                  ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:33:30
+   |
+LL |     fn non_const_function<T: ~const Trait>() {}
+   |                              ^^^^^^^^^^^^
+   |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:33:8
+   |
+LL |     fn non_const_function<T: ~const Trait>() {}
+   |        ^^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:34:23
+   |
+LL |     const CONSTANT<T: ~const Trait>: () = ();
+   |                       ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:41:18
+   |
+LL |     type Type<T: ~const Trait> = ();
+   |                  ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:43:30
+   |
+LL |     fn non_const_function<T: ~const Trait>() {}
+   |                              ^^^^^^^^^^^^
+   |
+note: this function is not `const`, so it cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:43:8
+   |
+LL |     fn non_const_function<T: ~const Trait>() {}
+   |        ^^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:44:23
+   |
+LL |     const CONSTANT<T: ~const Trait>: () = ();
+   |                       ^^^^^^^^^^^^
+   |
+   = note: this item cannot have `~const` trait bounds
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:49:15
+   |
+LL | trait Child0: ~const Trait {}
+   |               ^^^^^^^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:49:1
+   |
+LL | trait Child0: ~const Trait {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:50:26
+   |
+LL | trait Child1 where Self: ~const Trait {}
+   |                          ^^^^^^^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:50:1
+   |
+LL | trait Child1 where Self: ~const Trait {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `~const` is not allowed here
+  --> $DIR/tilde-const-invalid-places.rs:53:9
+   |
+LL | impl<T: ~const Trait> Trait for T {}
+   |         ^^^^^^^^^^^^
+   |
+note: this impl is not `const`, so it cannot have `~const` trait bounds
+  --> $DIR/tilde-const-invalid-places.rs:53:1
+   |
+LL | impl<T: ~const Trait> Trait for T {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0658]: generic const items are experimental
+  --> $DIR/tilde-const-invalid-places.rs:19:15
+   |
+LL | const CONSTANT<T: ~const Trait>: () = ();
+   |               ^^^^^^^^^^^^^^^^^
+   |
+   = 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/tilde-const-invalid-places.rs:27:19
+   |
+LL |     const CONSTANT<T: ~const Trait>: ();
+   |                   ^^^^^^^^^^^^^^^^^
+   |
+   = 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/tilde-const-invalid-places.rs:34:19
+   |
+LL |     const CONSTANT<T: ~const Trait>: () = ();
+   |                   ^^^^^^^^^^^^^^^^^
+   |
+   = 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/tilde-const-invalid-places.rs:44:19
+   |
+LL |     const CONSTANT<T: ~const Trait>: () = ();
+   |                   ^^^^^^^^^^^^^^^^^
+   |
+   = 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]: inherent associated types are unstable
+  --> $DIR/tilde-const-invalid-places.rs:41:5
+   |
+LL |     type Type<T: ~const Trait> = ();
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #8995 <https://github.com/rust-lang/rust/issues/8995> for more information
+   = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable
 
-error: aborting due to previous error
+error: aborting due to 26 previous errors
 
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.rs
new file mode 100644
index 00000000000..ed911d965d6
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.rs
@@ -0,0 +1,6 @@
+#![feature(const_trait_impl)]
+
+const fn tilde_question<T: ~const ?Sized>() {}
+//~^ ERROR `~const` and `?` are mutually exclusive
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.stderr
new file mode 100644
index 00000000000..ce74ff8dde7
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/tilde-const-maybe-trait.stderr
@@ -0,0 +1,8 @@
+error: `~const` and `?` are mutually exclusive
+  --> $DIR/tilde-const-maybe-trait.rs:3:28
+   |
+LL | const fn tilde_question<T: ~const ?Sized>() {}
+   |                            ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+