-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check that unnormalized sig is WF, add test
- Loading branch information
1 parent
d535e47
commit 45d1e92
Showing
3 changed files
with
60 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/test/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
trait Project { | ||
type Ty; | ||
} | ||
impl Project for &'_ &'_ () { | ||
type Ty = (); | ||
} | ||
trait Trait { | ||
fn get<'s>(s: &'s str, _: ()) -> &'static str; | ||
} | ||
impl Trait for () { | ||
fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
//~^ ERROR cannot infer an appropriate lifetime for lifetime parameter 's in generic type due to conflicting requirements | ||
s | ||
} | ||
} | ||
fn main() { | ||
let val = <() as Trait>::get(&String::from("blah blah blah"), ()); | ||
println!("{}", val); | ||
} |
28 changes: 28 additions & 0 deletions
28
src/test/ui/implied-bounds/impl-implied-bounds-compatibility-unnormalized.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 's in generic type due to conflicting requirements | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | ||
| | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: first, the lifetime cannot outlive the lifetime `'s` as defined here... | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:12 | ||
| | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^ | ||
note: ...so that the method type is compatible with trait | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | ||
| | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: expected `fn(&'s str, ()) -> &'static str` | ||
found `fn(&str, ()) -> &'static str` | ||
= note: but, the lifetime must be valid for the static lifetime... | ||
note: ...so that the reference type `&'static &()` does not outlive the data it points at | ||
--> $DIR/impl-implied-bounds-compatibility-unnormalized.rs:11:5 | ||
| | ||
LL | fn get<'s>(s: &'s str, _: <&'static &'s () as Project>::Ty) -> &'static str { | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0495`. |