1
Fork 0

Rollup merge of #138509 - reddevilmidzy:add-test, r=compiler-errors

Add test to ensure no index out of bounds panic (#135474)

Adds test for #135474
This commit is contained in:
Michael Goulet 2025-03-23 14:59:31 -04:00 committed by GitHub
commit 6756e3da5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 44 additions and 0 deletions

View file

@ -0,0 +1,12 @@
fn retry() -> impl Sized {}
struct Core<T>(T);
impl Core<XXX> { //~ ERROR cannot find type `XXX` in this scope
pub fn spawn(self) {}
}
fn main() {
let core = Core(1);
core.spawn(retry()); //~ ERROR this method takes 0 arguments but 1 argument was supplied
}

View file

@ -0,0 +1,32 @@
error[E0412]: cannot find type `XXX` in this scope
--> $DIR/trait-fn-generic-mismatch.rs:5:11
|
LL | impl Core<XXX> {
| ^^^ not found in this scope
|
help: you might be missing a type parameter
|
LL | impl<XXX> Core<XXX> {
| +++++
error[E0061]: this method takes 0 arguments but 1 argument was supplied
--> $DIR/trait-fn-generic-mismatch.rs:11:10
|
LL | core.spawn(retry());
| ^^^^^ ------- unexpected argument of type `impl Sized`
|
note: method defined here
--> $DIR/trait-fn-generic-mismatch.rs:6:12
|
LL | pub fn spawn(self) {}
| ^^^^^
help: remove the extra argument
|
LL - core.spawn(retry());
LL + core.spawn();
|
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0061, E0412.
For more information about an error, try `rustc --explain E0061`.