-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check the self-type of inherent associated constants
- Loading branch information
1 parent
de111e6
commit 283ffcf
Showing
7 changed files
with
74 additions
and
30 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
8 changes: 4 additions & 4 deletions
8
src/test/ui/nll/user-annotations/dump-adt-brace-struct.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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
error: user substs: UserSubsts { substs: [u32], user_self_ty: None } | ||
--> $DIR/dump-adt-brace-struct.rs:18:5 | ||
error: user substs: UserSubsts { substs: [&ReStatic u32], user_self_ty: None } | ||
--> $DIR/dump-adt-brace-struct.rs:20:5 | ||
| | ||
LL | SomeStruct::<u32> { t: 22 }; //~ ERROR [u32] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | SomeStruct::<&'static u32> { t: &22 }; //~ ERROR [&ReStatic u32] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
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
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
17 changes: 17 additions & 0 deletions
17
src/test/ui/nll/user-annotations/inherent-associated-constants.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,17 @@ | ||
#![feature(nll)] | ||
|
||
struct A<'a>(&'a ()); | ||
|
||
impl A<'static> { | ||
const IC: i32 = 10; | ||
} | ||
|
||
fn non_wf_associated_const<'a>(x: i32) { | ||
A::<'a>::IC; //~ ERROR lifetime may not live long enough | ||
} | ||
|
||
fn wf_associated_const<'a>(x: i32) { | ||
A::<'static>::IC; | ||
} | ||
|
||
fn main() {} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/nll/user-annotations/inherent-associated-constants.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/inherent-associated-constants.rs:10:5 | ||
| | ||
LL | fn non_wf_associated_const<'a>(x: i32) { | ||
| -- lifetime `'a` defined here | ||
LL | A::<'a>::IC; //~ ERROR lifetime may not live long enough | ||
| ^^^^^^^^^^^ requires that `'a` must outlive `'static` | ||
|
||
error: aborting due to previous error | ||
|