about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/101962.rs11
-rw-r--r--tests/crashes/111699.rs14
-rw-r--r--tests/crashes/120792.rs25
-rw-r--r--tests/crashes/120793-2.rs22
-rw-r--r--tests/crashes/120793.rs21
-rw-r--r--tests/crashes/121063.rs20
-rw-r--r--tests/crashes/121816.rs12
-rw-r--r--tests/crashes/121957-1.rs20
-rw-r--r--tests/crashes/121957-2.rs20
-rw-r--r--tests/crashes/97501.rs22
-rw-r--r--tests/ui/asm/naked-functions.rs2
-rw-r--r--tests/ui/asm/naked-functions.stderr2
-rw-r--r--tests/ui/borrowck/ice-on-non-ref-sig-ty.rs19
-rw-r--r--tests/ui/borrowck/ice-on-non-ref-sig-ty.stderr36
-rw-r--r--tests/ui/lint/negative_literals.rs35
-rw-r--r--tests/ui/lint/negative_literals.stderr179
-rw-r--r--tests/ui/polymorphization/inline-incorrect-early-bound.rs27
-rw-r--r--tests/ui/polymorphization/inline-incorrect-early-bound.stderr15
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.rs32
-rw-r--r--tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.stderr21
20 files changed, 366 insertions, 189 deletions
diff --git a/tests/crashes/101962.rs b/tests/crashes/101962.rs
deleted file mode 100644
index b6a78ce053a..00000000000
--- a/tests/crashes/101962.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ known-bug: #101962
-
-#![feature(core_intrinsics)]
-
-pub fn wrapping<T: Copy>(a: T, b: T) {
-    let _z = core::intrinsics::wrapping_mul(a, b);
-}
-
-fn main() {
-    wrapping(1,2);
-}
diff --git a/tests/crashes/111699.rs b/tests/crashes/111699.rs
deleted file mode 100644
index 5ba17c2aa1a..00000000000
--- a/tests/crashes/111699.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ known-bug: #111699
-//@ edition:2021
-//@ compile-flags: -Copt-level=0
-#![feature(core_intrinsics)]
-use std::intrinsics::offset;
-
-fn main() {
-    let a = [1u8, 2, 3];
-    let ptr: *const u8 = a.as_ptr();
-
-    unsafe {
-        assert_eq!(*offset(ptr, 0), 1);
-    }
-}
diff --git a/tests/crashes/120792.rs b/tests/crashes/120792.rs
deleted file mode 100644
index 51889251787..00000000000
--- a/tests/crashes/120792.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-//@ known-bug: #120792
-//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
-
-impl Trait<()> for () {
-    fn foo<'a, K>(self, _: (), _: K) {
-        todo!();
-    }
-}
-
-trait Foo<T> {}
-
-impl<F, T> Foo<T> for F {
-    fn main() {
-        ().foo((), ());
-    }
-}
-
-trait Trait<T> {
-    fn foo<'a, K>(self, _: T, _: K)
-    where
-        T: 'a,
-        K: 'a;
-}
-
-pub fn main() {}
diff --git a/tests/crashes/120793-2.rs b/tests/crashes/120793-2.rs
deleted file mode 100644
index 0ce5e4df224..00000000000
--- a/tests/crashes/120793-2.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-//@ known-bug: #120793
-// can't use build-fail, because this also fails check-fail, but
-// the ICE from #120787 only reproduces on build-fail.
-//@ compile-flags: --emit=mir
-
-#![feature(effects)]
-
-trait Dim {
-    fn dim() -> usize;
-}
-
-enum Dim3 {}
-
-impl Dim for Dim3 {
-    fn dim(x: impl Sized) -> usize {
-        3
-    }
-}
-
-fn main() {
-    [0; Dim3::dim()];
-}
diff --git a/tests/crashes/120793.rs b/tests/crashes/120793.rs
deleted file mode 100644
index 7e9166a50e5..00000000000
--- a/tests/crashes/120793.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-//@ known-bug: #120793
-#![feature(effects)]
-
-trait Dim {
-    fn dim() -> usize;
-}
-
-enum Dim3 {}
-
-impl Dim for Dim3 {
-    fn dim(mut x: impl Iterator<Item = &'_ ()>) -> usize {
-        3
-    }
-}
-
-fn main() {
-    let array: [usize; Dim3::dim()]
-    //~^ ERROR E0015
-        = [0; Dim3::dim()];
-        //~^ ERROR E0015
-}
diff --git a/tests/crashes/121063.rs b/tests/crashes/121063.rs
deleted file mode 100644
index cb9db2853c2..00000000000
--- a/tests/crashes/121063.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-//@ known-bug: #121063
-//@ compile-flags: -Zpolymorphize=on --edition=2021 -Zinline-mir=yes
-
-use std::{
-    fmt, ops,
-    path::{Component, Path, PathBuf},
-};
-
-pub struct AbsPathBuf(PathBuf);
-
-impl TryFrom<PathBuf> for AbsPathBuf {
-    type Error = PathBuf;
-    fn try_from(path: impl AsRef<Path>) -> Result<AbsPathBuf, PathBuf> {}
-}
-
-impl TryFrom<&str> for AbsPathBuf {
-    fn try_from(path: &str) -> Result<AbsPathBuf, PathBuf> {
-        AbsPathBuf::try_from(PathBuf::from(path))
-    }
-}
diff --git a/tests/crashes/121816.rs b/tests/crashes/121816.rs
deleted file mode 100644
index a5569ea19d3..00000000000
--- a/tests/crashes/121816.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ known-bug: #121816
-fn f<'a, T>(_: &'static &'a (), x: &'a T) -> &'static T {
-    x
-}
-trait W<'a> {
-    fn g<T>(self, x: &'a T) -> &'static T;
-}
-impl<'a> W<'a> for &'static () {
-    fn g<T>(self, x: &'a T) -> &'static T {
-        f(&self, x)
-    }
-}
diff --git a/tests/crashes/121957-1.rs b/tests/crashes/121957-1.rs
deleted file mode 100644
index 74b4649cc9d..00000000000
--- a/tests/crashes/121957-1.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-//@ known-bug: #121957
-#![feature(const_trait_impl, effects)]
-
-#[const_trait]
-trait Main {
-    fn compute<T: ~const Aux>() -> u32;
-}
-
-impl const Main for () {
-    fn compute<'x, 'y, 'z: 'x>() -> u32 {}
-}
-
-#[const_trait]
-trait Aux {}
-
-impl const Aux for () {}
-
-fn main() {
-    const _: u32 = <()>::compute::<()>();
-}
diff --git a/tests/crashes/121957-2.rs b/tests/crashes/121957-2.rs
deleted file mode 100644
index 74b4649cc9d..00000000000
--- a/tests/crashes/121957-2.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-//@ known-bug: #121957
-#![feature(const_trait_impl, effects)]
-
-#[const_trait]
-trait Main {
-    fn compute<T: ~const Aux>() -> u32;
-}
-
-impl const Main for () {
-    fn compute<'x, 'y, 'z: 'x>() -> u32 {}
-}
-
-#[const_trait]
-trait Aux {}
-
-impl const Aux for () {}
-
-fn main() {
-    const _: u32 = <()>::compute::<()>();
-}
diff --git a/tests/crashes/97501.rs b/tests/crashes/97501.rs
deleted file mode 100644
index 51a83d8be16..00000000000
--- a/tests/crashes/97501.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-//@ known-bug: #97501
-
-#![feature(core_intrinsics)]
-use std::intrinsics::wrapping_add;
-
-#[derive(Clone, Copy)]
-struct WrapInt8 {
-    value: u8
-}
-
-impl std::ops::Add for WrapInt8 {
-    type Output = WrapInt8;
-    fn add(self, other: WrapInt8) -> WrapInt8 {
-        wrapping_add(self, other)
-    }
-}
-
-fn main() {
-    let p = WrapInt8 { value: 123 };
-    let q = WrapInt8 { value: 234 };
-    println!("{}", (p + q).value);
-}
diff --git a/tests/ui/asm/naked-functions.rs b/tests/ui/asm/naked-functions.rs
index 1619ebfcf39..6b2d2aea238 100644
--- a/tests/ui/asm/naked-functions.rs
+++ b/tests/ui/asm/naked-functions.rs
@@ -111,7 +111,7 @@ unsafe extern "C" fn invalid_options() {
 unsafe extern "C" fn invalid_options_continued() {
     asm!("", options(readonly, nostack), options(pure));
     //~^ ERROR asm with the `pure` option must have at least one output
-    //~| ERROR asm options unsupported in naked functions: `nostack`, `pure`, `readonly`
+    //~| ERROR asm options unsupported in naked functions: `pure`, `readonly`, `nostack`
     //~| ERROR asm in naked functions must use `noreturn` option
 }
 
diff --git a/tests/ui/asm/naked-functions.stderr b/tests/ui/asm/naked-functions.stderr
index 77bc80a101f..4dd9e29bdc6 100644
--- a/tests/ui/asm/naked-functions.stderr
+++ b/tests/ui/asm/naked-functions.stderr
@@ -212,7 +212,7 @@ error[E0787]: asm options unsupported in naked functions: `nomem`, `preserves_fl
 LL |     asm!("", options(nomem, preserves_flags, noreturn));
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error[E0787]: asm options unsupported in naked functions: `nostack`, `pure`, `readonly`
+error[E0787]: asm options unsupported in naked functions: `pure`, `readonly`, `nostack`
   --> $DIR/naked-functions.rs:112:5
    |
 LL |     asm!("", options(readonly, nostack), options(pure));
diff --git a/tests/ui/borrowck/ice-on-non-ref-sig-ty.rs b/tests/ui/borrowck/ice-on-non-ref-sig-ty.rs
new file mode 100644
index 00000000000..1c867bd2378
--- /dev/null
+++ b/tests/ui/borrowck/ice-on-non-ref-sig-ty.rs
@@ -0,0 +1,19 @@
+// Don't ICE when trying to annotate signature and we see `&()`
+
+fn f<'a, T>(_: &'static &'a (), x: &'a T) -> &'static T {
+    x
+}
+trait W<'a> {
+    fn g<T>(self, x: &'a T) -> &'static T;
+}
+
+// Frankly this error message is impossible to parse, but :shrug:.
+impl<'a> W<'a> for &'static () {
+    fn g<T>(self, x: &'a T) -> &'static T {
+        f(&self, x)
+        //~^ ERROR borrowed data escapes outside of method
+        //~| ERROR `self` does not live long enough
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/ice-on-non-ref-sig-ty.stderr b/tests/ui/borrowck/ice-on-non-ref-sig-ty.stderr
new file mode 100644
index 00000000000..2b900a8e68a
--- /dev/null
+++ b/tests/ui/borrowck/ice-on-non-ref-sig-ty.stderr
@@ -0,0 +1,36 @@
+error[E0521]: borrowed data escapes outside of method
+  --> $DIR/ice-on-non-ref-sig-ty.rs:13:9
+   |
+LL | impl<'a> W<'a> for &'static () {
+   |      -- lifetime `'a` defined here
+LL |     fn g<T>(self, x: &'a T) -> &'static T {
+   |             ----  - `x` is a reference that is only valid in the method body
+   |             |
+   |             `self` declared here, outside of the method body
+LL |         f(&self, x)
+   |         ^^^^^^^^^^^
+   |         |
+   |         `x` escapes the method body here
+   |         argument requires that `'a` must outlive `'static`
+
+error[E0597]: `self` does not live long enough
+  --> $DIR/ice-on-non-ref-sig-ty.rs:13:11
+   |
+LL | impl<'a> W<'a> for &'static () {
+   |                     ------- has lifetime `'static`
+LL |     fn g<T>(self, x: &'a T) -> &'static T {
+   |                                 ------- also has lifetime `'static`
+LL |         f(&self, x)
+   |           ^^^^^ `self` would have to be valid for `'static`...
+...
+LL |     }
+   |      - ...but `self` will be dropped here, when the function `g` returns
+   |
+   = help: use data from the highlighted arguments which match the `'static` lifetime of the return type
+   = note: functions cannot return a borrow to data owned within the function's scope, functions can only return borrows to data passed as arguments
+   = note: to learn more, visit <https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html#dangling-references>
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0521, E0597.
+For more information about an error, try `rustc --explain E0521`.
diff --git a/tests/ui/lint/negative_literals.rs b/tests/ui/lint/negative_literals.rs
new file mode 100644
index 00000000000..048fcd6ff57
--- /dev/null
+++ b/tests/ui/lint/negative_literals.rs
@@ -0,0 +1,35 @@
+//@ check-fail
+
+fn main() {
+    let _ = -1i32.abs();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1f32.abs();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1f64.asin();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1f64.asinh();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1f64.tan();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1f64.tanh();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1.0_f64.cos().cos();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1.0_f64.cos().sin();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1.0_f64.sin().cos();
+    //~^ ERROR `-` has lower precedence than method calls
+    let _ = -1f64.sin().sin();
+    //~^ ERROR `-` has lower precedence than method calls
+
+    dbg!( -1.0_f32.cos() );
+    //~^ ERROR `-` has lower precedence than method calls
+
+    // should not warn
+    let _ = (-1i32).abs();
+    let _ = (-1f32).abs();
+    let _ = -(1i32).abs();
+    let _ = -(1f32).abs();
+    let _ = -(1i32.abs());
+    let _ = -(1f32.abs());
+}
diff --git a/tests/ui/lint/negative_literals.stderr b/tests/ui/lint/negative_literals.stderr
new file mode 100644
index 00000000000..df000a71882
--- /dev/null
+++ b/tests/ui/lint/negative_literals.stderr
@@ -0,0 +1,179 @@
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:4:13
+   |
+LL |     let _ = -1i32.abs();
+   |             ^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+   = note: `#[deny(ambiguous_negative_literals)]` on by default
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1i32).abs();
+   |             +     +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1i32.abs());
+   |              +          +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:6:13
+   |
+LL |     let _ = -1f32.abs();
+   |             ^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1f32).abs();
+   |             +     +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1f32.abs());
+   |              +          +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:8:13
+   |
+LL |     let _ = -1f64.asin();
+   |             ^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1f64).asin();
+   |             +     +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1f64.asin());
+   |              +           +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:10:13
+   |
+LL |     let _ = -1f64.asinh();
+   |             ^^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1f64).asinh();
+   |             +     +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1f64.asinh());
+   |              +            +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:12:13
+   |
+LL |     let _ = -1f64.tan();
+   |             ^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1f64).tan();
+   |             +     +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1f64.tan());
+   |              +          +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:14:13
+   |
+LL |     let _ = -1f64.tanh();
+   |             ^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1f64).tanh();
+   |             +     +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1f64.tanh());
+   |              +           +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:16:13
+   |
+LL |     let _ = -1.0_f64.cos().cos();
+   |             ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1.0_f64).cos().cos();
+   |             +        +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1.0_f64.cos().cos());
+   |              +                   +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:18:13
+   |
+LL |     let _ = -1.0_f64.cos().sin();
+   |             ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1.0_f64).cos().sin();
+   |             +        +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1.0_f64.cos().sin());
+   |              +                   +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:20:13
+   |
+LL |     let _ = -1.0_f64.sin().cos();
+   |             ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1.0_f64).sin().cos();
+   |             +        +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1.0_f64.sin().cos());
+   |              +                   +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:22:13
+   |
+LL |     let _ = -1f64.sin().sin();
+   |             ^^^^^^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     let _ = (-1f64).sin().sin();
+   |             +     +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     let _ = -(1f64.sin().sin());
+   |              +                +
+
+error: `-` has lower precedence than method calls, which might be unexpected
+  --> $DIR/negative_literals.rs:25:11
+   |
+LL |     dbg!( -1.0_f32.cos() );
+   |           ^^^^^^^^^^^^^^
+   |
+   = note: e.g. `-4.abs()` equals `-4`; while `(-4).abs()` equals `4`
+help: add parentheses around the `-` and the literal to call the method on a negative literal
+   |
+LL |     dbg!( (-1.0_f32).cos() );
+   |           +        +
+help: add parentheses around the literal and the method call to keep the current behavior
+   |
+LL |     dbg!( -(1.0_f32.cos()) );
+   |            +             +
+
+error: aborting due to 11 previous errors
+
diff --git a/tests/ui/polymorphization/inline-incorrect-early-bound.rs b/tests/ui/polymorphization/inline-incorrect-early-bound.rs
new file mode 100644
index 00000000000..e69e4a4faa0
--- /dev/null
+++ b/tests/ui/polymorphization/inline-incorrect-early-bound.rs
@@ -0,0 +1,27 @@
+// This test demonstrates an ICE that may occur when we try to resolve the instance
+// of a impl that has different generics than the trait it's implementing. This ensures
+// we first check that the args are compatible before resolving the body, just like
+// we do in projection before substituting a GAT.
+//
+// When polymorphization is enabled, we check the optimized MIR for unused parameters.
+// This will invoke the inliner, leading to this ICE.
+
+//@ compile-flags: -Zpolymorphize=on -Zinline-mir=yes
+
+trait Trait {
+    fn foo<'a, K: 'a>(self, _: K);
+}
+
+impl Trait for () {
+    #[inline]
+    fn foo<K>(self, _: K) {
+        //~^ ERROR lifetime parameters or bounds on method `foo` do not match the trait declaration
+        todo!();
+    }
+}
+
+pub fn qux<T>() {
+    ().foo(());
+}
+
+fn main() {}
diff --git a/tests/ui/polymorphization/inline-incorrect-early-bound.stderr b/tests/ui/polymorphization/inline-incorrect-early-bound.stderr
new file mode 100644
index 00000000000..3a1d05e8a36
--- /dev/null
+++ b/tests/ui/polymorphization/inline-incorrect-early-bound.stderr
@@ -0,0 +1,15 @@
+error[E0195]: lifetime parameters or bounds on method `foo` do not match the trait declaration
+  --> $DIR/inline-incorrect-early-bound.rs:17:11
+   |
+LL |     fn foo<'a, K: 'a>(self, _: K);
+   |           -----------
+   |           |       |
+   |           |       this bound might be missing in the impl
+   |           lifetimes in impl do not match this method in trait
+...
+LL |     fn foo<K>(self, _: K) {
+   |           ^^^ lifetimes do not match method in trait
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0195`.
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.rs
new file mode 100644
index 00000000000..e3adcce17b4
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.rs
@@ -0,0 +1,32 @@
+// This test demonstrates an ICE that may occur when we try to resolve the instance
+// of a impl that has different generics than the trait it's implementing. This ensures
+// we first check that the args are compatible before resolving the body, just like
+// we do in projection before substituting a GAT.
+//
+// Const traits aren't the only way to achieve this ICE, but it's a convenient way
+// to ensure the inliner is called.
+
+//@ compile-flags: -Znext-solver -Zinline-mir=yes
+
+#![feature(const_trait_impl, effects)]
+//~^ WARN the feature `effects` is incomplete
+
+trait Trait {
+    fn foo(self);
+}
+
+impl Trait for () {
+    #[inline]
+    fn foo<T>(self) {
+        //~^ ERROR  method `foo` has 1 type parameter but its trait declaration has 0 type parameters
+        todo!();
+    }
+}
+
+const fn foo() {
+    ().foo();
+}
+
+const UWU: () = foo();
+
+fn main() {}
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.stderr
new file mode 100644
index 00000000000..2e7801c0b8a
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/inline-incorrect-early-bound-in-ctfe.stderr
@@ -0,0 +1,21 @@
+warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
+  --> $DIR/inline-incorrect-early-bound-in-ctfe.rs:11:30
+   |
+LL | #![feature(const_trait_impl, effects)]
+   |                              ^^^^^^^
+   |
+   = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
+   = note: `#[warn(incomplete_features)]` on by default
+
+error[E0049]: method `foo` has 1 type parameter but its trait declaration has 0 type parameters
+  --> $DIR/inline-incorrect-early-bound-in-ctfe.rs:20:12
+   |
+LL |     fn foo(self);
+   |           - expected 0 type parameters
+...
+LL |     fn foo<T>(self) {
+   |            ^ found 1 type parameter
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0049`.