Skip to content

Commit 6f6550f

Browse files
committed
add known-bug test for unsound issue 100051
1 parent cff6c0e commit 6f6550f

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// check-pass
2+
// known-bug: #100051
3+
4+
// Should fail. Implied bounds from projections in impl headers can create
5+
// improper lifetimes. Variant of issue #98543 which was fixed by #99217.
6+
7+
trait Trait {
8+
type Type;
9+
}
10+
11+
impl<T> Trait for T {
12+
type Type = ();
13+
}
14+
15+
trait Extend<'a, 'b> {
16+
fn extend(self, s: &'a str) -> &'b str;
17+
}
18+
19+
impl<'a, 'b> Extend<'a, 'b> for <&'b &'a () as Trait>::Type
20+
where
21+
for<'what, 'ever> &'what &'ever (): Trait,
22+
{
23+
fn extend(self, s: &'a str) -> &'b str {
24+
s
25+
}
26+
}
27+
28+
fn main() {
29+
let y = <() as Extend<'_, '_>>::extend((), &String::from("Hello World"));
30+
println!("{}", y);
31+
}

0 commit comments

Comments
 (0)