forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
124 additions
and
34 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
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
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
35 changes: 35 additions & 0 deletions
35
src/test/ui/generic-associated-types/bugs/hrtb-implied-1.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,35 @@ | ||
// check-fail | ||
// known-bug | ||
|
||
// This gives us problems because `for<'a> I::Item<'a>: Debug` should mean "for | ||
// all 'a where I::Item<'a> is WF", but really means "for all 'a possible" | ||
|
||
use std::fmt::Debug; | ||
|
||
pub trait LendingIterator { | ||
type Item<'this> | ||
where | ||
Self: 'this; | ||
} | ||
|
||
pub struct WindowsMut<'x> { | ||
slice: &'x (), | ||
} | ||
|
||
impl<'y> LendingIterator for WindowsMut<'y> { | ||
type Item<'this> = &'this mut () where 'y: 'this; | ||
} | ||
|
||
fn print_items<I>(_iter: I) | ||
where | ||
I: LendingIterator, | ||
for<'a> I::Item<'a>: Debug, | ||
{ | ||
} | ||
|
||
fn main() { | ||
let slice = &mut (); | ||
//~^ temporary value dropped while borrowed | ||
let windows = WindowsMut { slice }; | ||
print_items::<WindowsMut<'_>>(windows); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/generic-associated-types/bugs/hrtb-implied-1.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,20 @@ | ||
error[E0716]: temporary value dropped while borrowed | ||
--> $DIR/hrtb-implied-1.rs:31:22 | ||
| | ||
LL | let slice = &mut (); | ||
| ^^ creates a temporary which is freed while still in use | ||
... | ||
LL | print_items::<WindowsMut<'_>>(windows); | ||
| -------------------------------------- argument requires that borrow lasts for `'static` | ||
LL | } | ||
| - temporary value is freed at the end of this statement | ||
| | ||
note: due to current limitations in the borrow checker, this implies a `'static` lifetime | ||
--> $DIR/hrtb-implied-1.rs:26:26 | ||
| | ||
LL | for<'a> I::Item<'a>: Debug, | ||
| ^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0716`. |
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