parent
2b5740371c
commit
d7e166d408
20
tests/ui/const_prop/ice-type-mismatch-when-copying-112824.rs
Normal file
20
tests/ui/const_prop/ice-type-mismatch-when-copying-112824.rs
Normal file
@ -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() {}
|
@ -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`.
|
Loading…
x
Reference in New Issue
Block a user