File tree Expand file tree Collapse file tree 3 files changed +38
-11
lines changed Expand file tree Collapse file tree 3 files changed +38
-11
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ //! Functions with a mismatch between the expected and found type where the difference is a reference
2
+ //! may trigger analysis for additional help. In this test the expected type will be
3
+ //! &'a Container<&'a u8> and the found type will be Container<&'?0 u8>.
4
+ //!
5
+ //! This test exercises a scenario where the found type being analyzed contains an inference region
6
+ //! variable ('?0). This cannot be used in comparisons because the variable no longer exists by the
7
+ //! time the later analysis is performed.
8
+ //!
9
+ //! This is a regression test of #140823
10
+
11
+ trait MyFn < P > { }
12
+
13
+ struct Container < T > {
14
+ data : T ,
15
+ }
16
+
17
+ struct Desugared {
18
+ callback : Box < dyn for < ' a > MyFn < & ' a Container < & ' a u8 > > > ,
19
+ }
20
+
21
+ fn test ( callback : Box < dyn for < ' a > MyFn < Container < & ' a u8 > > > ) -> Desugared {
22
+ Desugared { callback }
23
+ //~^ ERROR mismatched types
24
+ }
25
+
26
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0308]: mismatched types
2
+ --> $DIR/issue-140823.rs:22:17
3
+ |
4
+ LL | Desugared { callback }
5
+ | ^^^^^^^^ expected `Box<dyn MyFn<&Container<&u8>>>`, found `Box<dyn MyFn<Container<&u8>>>`
6
+ |
7
+ = note: expected struct `Box<(dyn for<'a> MyFn<&'a Container<&'a u8>> + 'static)>`
8
+ found struct `Box<(dyn for<'a> MyFn<Container<&'a u8>> + 'static)>`
9
+
10
+ error: aborting due to 1 previous error
11
+
12
+ For more information about this error, try `rustc --explain E0308`.
You can’t perform that action at this time.
0 commit comments