add test for https://github.com/rust-lang/rust/issues/122098 ICE: index out of bounds, snapshot_vec.rs
Fixes #122098
This commit is contained in:
parent
7d01878bd0
commit
35a78459aa
@ -0,0 +1,25 @@
|
||||
// test for #122098 ICE snapshot_vec.rs: index out of bounds: the len is 4 but the index is 4
|
||||
|
||||
trait LendingIterator {
|
||||
type Item<'q>: 'a;
|
||||
//~^ ERROR use of undeclared lifetime name `'a`
|
||||
|
||||
fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
|
||||
//~^ ERROR the size for values of type `Self` cannot be known at compilation time
|
||||
}
|
||||
|
||||
struct Query<'q> {}
|
||||
//~^ ERROR lifetime parameter `'q` is never used
|
||||
|
||||
impl<'static> Query<'q> {
|
||||
//~^ ERROR invalid lifetime parameter name: `'static`
|
||||
//~^^ ERROR use of undeclared lifetime name `'q`
|
||||
pub fn new() -> Self {}
|
||||
}
|
||||
|
||||
fn data() {
|
||||
LendingIterator::for_each(Query::new(&data), Box::new);
|
||||
//~^ ERROR this function takes 0 arguments but 1 argument was supplied
|
||||
}
|
||||
|
||||
pub fn main() {}
|
@ -0,0 +1,72 @@
|
||||
error[E0261]: use of undeclared lifetime name `'a`
|
||||
--> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:4:20
|
||||
|
|
||||
LL | type Item<'q>: 'a;
|
||||
| ^^ undeclared lifetime
|
||||
|
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | type Item<'a, 'q>: 'a;
|
||||
| +++
|
||||
help: consider introducing lifetime `'a` here
|
||||
|
|
||||
LL | trait LendingIterator<'a> {
|
||||
| ++++
|
||||
|
||||
error[E0262]: invalid lifetime parameter name: `'static`
|
||||
--> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:14:6
|
||||
|
|
||||
LL | impl<'static> Query<'q> {
|
||||
| ^^^^^^^ 'static is a reserved lifetime name
|
||||
|
||||
error[E0261]: use of undeclared lifetime name `'q`
|
||||
--> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:14:21
|
||||
|
|
||||
LL | impl<'static> Query<'q> {
|
||||
| - ^^ undeclared lifetime
|
||||
| |
|
||||
| help: consider introducing lifetime `'q` here: `'q,`
|
||||
|
||||
error[E0392]: lifetime parameter `'q` is never used
|
||||
--> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:11:14
|
||||
|
|
||||
LL | struct Query<'q> {}
|
||||
| ^^ unused lifetime parameter
|
||||
|
|
||||
= help: consider removing `'q`, referring to it in a field, or using a marker such as `PhantomData`
|
||||
|
||||
error[E0277]: the size for values of type `Self` cannot be known at compilation time
|
||||
--> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:7:17
|
||||
|
|
||||
LL | fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
|
||||
| ^^^^^^^^ doesn't have a size known at compile-time
|
||||
|
|
||||
= help: unsized fn params are gated as an unstable feature
|
||||
help: consider further restricting `Self`
|
||||
|
|
||||
LL | fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) where Self: Sized {}
|
||||
| +++++++++++++++++
|
||||
help: function arguments must have a statically known size, borrowed types always have a known size
|
||||
|
|
||||
LL | fn for_each(mut &self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
|
||||
| +
|
||||
|
||||
error[E0061]: this function takes 0 arguments but 1 argument was supplied
|
||||
--> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:21:31
|
||||
|
|
||||
LL | LendingIterator::for_each(Query::new(&data), Box::new);
|
||||
| ^^^^^^^^^^ -----
|
||||
| |
|
||||
| unexpected argument of type `&fn() {data}`
|
||||
| help: remove the extra argument
|
||||
|
|
||||
note: associated function defined here
|
||||
--> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:17:12
|
||||
|
|
||||
LL | pub fn new() -> Self {}
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0061, E0261, E0262, E0277, E0392.
|
||||
For more information about an error, try `rustc --explain E0061`.
|
Loading…
Reference in New Issue
Block a user