-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use implied bounds compat mode in MIR borrowck
- Loading branch information
Showing
9 changed files
with
81 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Test for normalization of projections that appear in the item bounds | ||
// (versus those that appear directly in the input types). | ||
// | ||
// FIXME(-Zno-implied-bounds-compat): remove this test once this flag is removed, | ||
// duplicate of `normalization-nested.rs`. | ||
// compile-flags: -Zno-implied-bounds-compat | ||
// revisions: param_ty lifetime | ||
// check-pass | ||
|
||
pub trait Iter { | ||
type Item; | ||
} | ||
|
||
#[cfg(param_ty)] | ||
impl<X, I> Iter for I | ||
where | ||
I: IntoIterator<Item = X>, | ||
{ | ||
type Item = X; | ||
} | ||
|
||
#[cfg(lifetime)] | ||
impl<'x, I> Iter for I | ||
where | ||
I: IntoIterator<Item = &'x ()>, | ||
{ | ||
type Item = &'x (); | ||
} | ||
|
||
pub struct Map<I>(I) | ||
where | ||
I: Iter, | ||
I::Item: 'static; | ||
|
||
pub fn test_wfcheck<'x>(_: Map<Vec<&'x ()>>) {} | ||
|
||
pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str { | ||
s | ||
} | ||
|
||
fn main() {} |
10 changes: 10 additions & 0 deletions
10
tests/ui/implied-bounds/normalization-nested.lifetime.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,10 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/normalization-nested.rs:36:5 | ||
| | ||
LL | pub fn test_borrowck<'x>(_: Map<Vec<&'x ()>>, s: &'x str) -> &'static str { | ||
| -- lifetime `'x` defined here | ||
LL | s | ||
| ^ returning this value requires that `'x` must outlive `'static` | ||
|
||
error: aborting due to 1 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
File renamed without changes.
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