-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't treat unnormalized function arguments as well-formed
- Loading branch information
1 parent
7f56b9a
commit a9174cf
Showing
8 changed files
with
52 additions
and
46 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
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
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
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
14 changes: 14 additions & 0 deletions
14
src/test/ui/fn/implied-bounds-unnorm-associated-type.nll.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,14 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/implied-bounds-unnorm-associated-type.rs:14:5 | ||
| | ||
LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { | ||
| -- -- lifetime `'b` defined here | ||
| | | ||
| lifetime `'a` defined here | ||
LL | s | ||
| ^ returning this value requires that `'b` must outlive `'a` | ||
| | ||
= help: consider adding the following bound: `'b: 'a` | ||
|
||
error: aborting due to previous error | ||
|
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,22 @@ | ||
// check-fail | ||
// See issue #91068. Types in the substs of an associated type can't be implied | ||
// to be WF, since they don't actually have to be constructed. | ||
|
||
trait Trait { | ||
type Type; | ||
} | ||
|
||
impl<T> Trait for T { | ||
type Type = (); | ||
} | ||
|
||
fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { | ||
s //~ ERROR lifetime mismatch [E0623] | ||
} | ||
|
||
fn main() { | ||
let x = String::from("Hello World!"); | ||
let y = f(&x, ()); | ||
drop(x); | ||
println!("{}", y); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/fn/implied-bounds-unnorm-associated-type.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,13 @@ | ||
error[E0623]: lifetime mismatch | ||
--> $DIR/implied-bounds-unnorm-associated-type.rs:14:5 | ||
| | ||
LL | fn f<'a, 'b>(s: &'b str, _: <&'a &'b () as Trait>::Type) -> &'a str { | ||
| ------- ---------- | ||
| | | ||
| these two types are declared with different lifetimes... | ||
LL | s | ||
| ^ ...but data from `s` flows here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0623`. |
This file was deleted.
Oops, something went wrong.