-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for ice "type mismatching when copying!"
Fixes #112824
- Loading branch information
1 parent
2b57403
commit d7e166d
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
tests/ui/const_prop/ice-type-mismatch-when-copying-112824.rs
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,20 @@ | ||
// test for #112824 ICE type mismatching when copying! | ||
|
||
pub struct Opcode(pub u8); | ||
|
||
pub struct Opcode2(&'a S); | ||
//~^ ERROR use of undeclared lifetime name `'a` | ||
//~^^ ERROR cannot find type `S` in this scope | ||
|
||
impl Opcode2 { | ||
pub const OP2: Opcode2 = Opcode2(Opcode(0x1)); | ||
} | ||
|
||
pub fn example2(msg_type: Opcode2) -> impl FnMut(&[u8]) { | ||
move |i| match msg_type { | ||
Opcode2::OP2 => unimplemented!(), | ||
//~^ ERROR could not evaluate constant pattern | ||
} | ||
} | ||
|
||
pub fn main() {} |
29 changes: 29 additions & 0 deletions
29
tests/ui/const_prop/ice-type-mismatch-when-copying-112824.stderr
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,29 @@ | ||
error[E0261]: use of undeclared lifetime name `'a` | ||
--> $DIR/ice-type-mismatch-when-copying-112824.rs:5:21 | ||
| | ||
LL | pub struct Opcode2(&'a S); | ||
| - ^^ undeclared lifetime | ||
| | | ||
| help: consider introducing lifetime `'a` here: `<'a>` | ||
|
||
error[E0412]: cannot find type `S` in this scope | ||
--> $DIR/ice-type-mismatch-when-copying-112824.rs:5:24 | ||
| | ||
LL | pub struct Opcode2(&'a S); | ||
| ^ not found in this scope | ||
| | ||
help: you might be missing a type parameter | ||
| | ||
LL | pub struct Opcode2<S>(&'a S); | ||
| +++ | ||
|
||
error: could not evaluate constant pattern | ||
--> $DIR/ice-type-mismatch-when-copying-112824.rs:15:9 | ||
| | ||
LL | Opcode2::OP2 => unimplemented!(), | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
Some errors have detailed explanations: E0261, E0412. | ||
For more information about an error, try `rustc --explain E0261`. |