File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ // Test for ICE: mir_const_qualif: index out of bounds: the len is 0 but the index is 0
2+ // https://github.com/rust-lang/rust/issues/125837
3+
4+ use std:: fmt:: Debug ;
5+
6+ trait Foo < Item > { }
7+
8+ impl < Item , D : Debug + Clone > Foo for D {
9+ //~^ ERROR missing generics for trait `Foo`
10+ fn foo < ' a > ( & ' a self ) -> impl Debug {
11+ //~^ ERROR method `foo` is not a member of trait `Foo`
12+ const { return }
13+ //~^ ERROR return statement outside of function body
14+ }
15+ }
16+
17+ pub fn main ( ) { }
Original file line number Diff line number Diff line change 1+ error[E0407]: method `foo` is not a member of trait `Foo`
2+ --> $DIR/ice-mir-const-qualif-125837.rs:10:5
3+ |
4+ LL | / fn foo<'a>(&'a self) -> impl Debug {
5+ LL | |
6+ LL | | const { return }
7+ LL | |
8+ LL | | }
9+ | |_____^ not a member of trait `Foo`
10+
11+ error[E0107]: missing generics for trait `Foo`
12+ --> $DIR/ice-mir-const-qualif-125837.rs:8:30
13+ |
14+ LL | impl<Item, D: Debug + Clone> Foo for D {
15+ | ^^^ expected 1 generic argument
16+ |
17+ note: trait defined here, with 1 generic parameter: `Item`
18+ --> $DIR/ice-mir-const-qualif-125837.rs:6:7
19+ |
20+ LL | trait Foo<Item> {}
21+ | ^^^ ----
22+ help: add missing generic argument
23+ |
24+ LL | impl<Item, D: Debug + Clone> Foo<Item> for D {
25+ | ++++++
26+
27+ error[E0572]: return statement outside of function body
28+ --> $DIR/ice-mir-const-qualif-125837.rs:12:17
29+ |
30+ LL | / fn foo<'a>(&'a self) -> impl Debug {
31+ LL | |
32+ LL | | const { return }
33+ | | --^^^^^^-- the return is part of this body...
34+ LL | |
35+ LL | | }
36+ | |_____- ...not the enclosing function body
37+
38+ error: aborting due to 3 previous errors
39+
40+ Some errors have detailed explanations: E0107, E0407, E0572.
41+ For more information about an error, try `rustc --explain E0107`.
You can’t perform that action at this time.
0 commit comments