Skip to content

Commit 27209d6

Browse files
committed
Moved crash test to ui test
1 parent ad1f492 commit 27209d6

File tree

3 files changed

+38
-11
lines changed

3 files changed

+38
-11
lines changed

tests/crashes/140823.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/fn/issue-140823.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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() {}

tests/ui/fn/issue-140823.stderr

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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`.

0 commit comments

Comments
 (0)