This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change
1
+ // test for #112824 ICE type mismatching when copying!
2
+
3
+ pub struct Opcode ( pub u8 ) ;
4
+
5
+ pub struct Opcode2 ( & ' a S ) ;
6
+ //~^ ERROR use of undeclared lifetime name `'a`
7
+ //~^^ ERROR cannot find type `S` in this scope
8
+
9
+ impl Opcode2 {
10
+ pub const OP2 : Opcode2 = Opcode2 ( Opcode ( 0x1 ) ) ;
11
+ }
12
+
13
+ pub fn example2 ( msg_type : Opcode2 ) -> impl FnMut ( & [ u8 ] ) {
14
+ move |i| match msg_type {
15
+ Opcode2 :: OP2 => unimplemented ! ( ) ,
16
+ //~^ ERROR could not evaluate constant pattern
17
+ }
18
+ }
19
+
20
+ pub fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0261]: use of undeclared lifetime name `'a`
2
+ --> $DIR/ice-type-mismatch-when-copying-112824.rs:5:21
3
+ |
4
+ LL | pub struct Opcode2(&'a S);
5
+ | - ^^ undeclared lifetime
6
+ | |
7
+ | help: consider introducing lifetime `'a` here: `<'a>`
8
+
9
+ error[E0412]: cannot find type `S` in this scope
10
+ --> $DIR/ice-type-mismatch-when-copying-112824.rs:5:24
11
+ |
12
+ LL | pub struct Opcode2(&'a S);
13
+ | ^ not found in this scope
14
+ |
15
+ help: you might be missing a type parameter
16
+ |
17
+ LL | pub struct Opcode2<S>(&'a S);
18
+ | +++
19
+
20
+ error: could not evaluate constant pattern
21
+ --> $DIR/ice-type-mismatch-when-copying-112824.rs:15:9
22
+ |
23
+ LL | Opcode2::OP2 => unimplemented!(),
24
+ | ^^^^^^^^^^^^
25
+
26
+ error: aborting due to 3 previous errors
27
+
28
+ Some errors have detailed explanations: E0261, E0412.
29
+ For more information about an error, try `rustc --explain E0261`.
You can’t perform that action at this time.
0 commit comments