forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#128035 - tiif:issue-125837, r=lcnr Add test for rust-lang#125837 Fixes rust-lang#125837
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,17 @@ | ||
// Test for ICE: mir_const_qualif: index out of bounds: the len is 0 but the index is 0 | ||
// https://github.com/rust-lang/rust/issues/125837 | ||
|
||
use std::fmt::Debug; | ||
|
||
trait Foo<Item> {} | ||
|
||
impl<Item, D: Debug Clone> Foo for D { | ||
//~^ ERROR missing generics for trait `Foo` | ||
fn foo<'a>(&'a self) -> impl Debug { | ||
//~^ ERROR method `foo` is not a member of trait `Foo` | ||
const { return } | ||
//~^ ERROR return statement outside of function body | ||
} | ||
} | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 1,41 @@ | ||
error[E0407]: method `foo` is not a member of trait `Foo` | ||
--> $DIR/ice-mir-const-qualif-125837.rs:10:5 | ||
| | ||
LL | / fn foo<'a>(&'a self) -> impl Debug { | ||
LL | | | ||
LL | | const { return } | ||
LL | | | ||
LL | | } | ||
| |_____^ not a member of trait `Foo` | ||
|
||
error[E0107]: missing generics for trait `Foo` | ||
--> $DIR/ice-mir-const-qualif-125837.rs:8:30 | ||
| | ||
LL | impl<Item, D: Debug Clone> Foo for D { | ||
| ^^^ expected 1 generic argument | ||
| | ||
note: trait defined here, with 1 generic parameter: `Item` | ||
--> $DIR/ice-mir-const-qualif-125837.rs:6:7 | ||
| | ||
LL | trait Foo<Item> {} | ||
| ^^^ ---- | ||
help: add missing generic argument | ||
| | ||
LL | impl<Item, D: Debug Clone> Foo<Item> for D { | ||
| | ||
|
||
error[E0572]: return statement outside of function body | ||
--> $DIR/ice-mir-const-qualif-125837.rs:12:17 | ||
| | ||
LL | / fn foo<'a>(&'a self) -> impl Debug { | ||
LL | | | ||
LL | | const { return } | ||
| | --^^^^^^-- the return is part of this body... | ||
LL | | | ||
LL | | } | ||
| |_____- ...not the enclosing function body | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0107, E0407, E0572. | ||
For more information about an error, try `rustc --explain E0107`. |