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.
Rollup merge of rust-lang#58353 - matthewjasper:typeck-pattern-consta…
…nts, r=arielb1 Check the Self-type of inherent associated constants r? @arielb1
- Loading branch information
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 | ||
|