Skip to content

Commit d172ae0

Browse files
committed
add test from modcholesky breakage
1 parent 0f47e8e commit d172ae0

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// This is a test, extracted from `modcholesky`, that used to pass wfcheck because we checked
2+
// well-formedness of where-clauses *after* normalization. We generally want to move to always check
3+
// WF pre-normalization.
4+
5+
pub struct View<A>(A);
6+
pub trait Data {
7+
type Elem;
8+
}
9+
impl<'a, A> Data for View<&'a A> {
10+
type Elem = A;
11+
}
12+
13+
pub fn repro<'a, T>()
14+
where
15+
<View<&'a T> as Data>::Elem: Sized,
16+
//~^ ERROR: the parameter type `T` may not live long enough
17+
{
18+
}
19+
20+
fn main() {}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0309]: the parameter type `T` may not live long enough
2+
--> $DIR/wf-where-clauses-pre-normalization.rs:15:34
3+
|
4+
LL | pub fn repro<'a, T>()
5+
| -- the parameter type `T` must be valid for the lifetime `'a` as defined here...
6+
LL | where
7+
LL | <View<&'a T> as Data>::Elem: Sized,
8+
| ^^^^^ ...so that the reference type `&'a T` does not outlive the data it points at
9+
|
10+
help: consider adding an explicit lifetime bound
11+
|
12+
LL | pub fn repro<'a, T: 'a>()
13+
| ++++
14+
15+
error: aborting due to 1 previous error
16+
17+
For more information about this error, try `rustc --explain E0309`.

0 commit comments

Comments
 (0)