-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Merged
Rollup of 5 pull requests #71664
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5d855c4
Add regression test for #69654
Alexendoo 3a40cbb
Change wording on read_vectored docs
ChiefMilesEdgeworth 4b762ec
Update link to unstable book for llvm_asm macro
zachreizner e91c3a1
Add #24949 assoc constant static recursion test
Daniel-Worrall 2c6094e
Suggest `;` or assignment to drop borrows in tail exprs
estebank d0ff229
Rollup merge of #71217 - estebank:tail-borrow-sugg, r=pnkfelix
Dylan-DPC 65527cb
Rollup merge of #71286 - Alexendoo:test-issue-69654, r=Dylan-DPC
Dylan-DPC fb1aa56
Rollup merge of #71296 - ChiefMilesEdgeworth:fix_doc_wording, r=Dylan…
Dylan-DPC 4955c05
Rollup merge of #71654 - zachreizner:patch-1, r=jonas-schievink
Dylan-DPC 878e928
Rollup merge of #71657 - Daniel-Worrall:24949, r=estebank
Dylan-DPC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
15 changes: 15 additions & 0 deletions
15
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.rs
This file contains hidden or 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,15 @@ | ||
// Check for recursion involving references to impl-associated const. | ||
|
||
trait Foo { | ||
const BAR: u32; | ||
} | ||
|
||
const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; //~ ERROR E0391 | ||
|
||
struct GlobalImplRef; | ||
|
||
impl GlobalImplRef { | ||
const BAR: u32 = IMPL_REF_BAR; | ||
} | ||
|
||
fn main() {} |
44 changes: 44 additions & 0 deletions
44
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.stderr
This file contains hidden or 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,44 @@ | ||
error[E0391]: cycle detected when const-evaluating + checking `IMPL_REF_BAR` | ||
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 | ||
| | ||
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: ...which requires const-evaluating + checking `IMPL_REF_BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 | ||
| | ||
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating `IMPL_REF_BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:7:1 | ||
| | ||
LL | const IMPL_REF_BAR: u32 = GlobalImplRef::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...which requires normalizing `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`... | ||
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 | ||
| | ||
LL | const BAR: u32 = IMPL_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 | ||
| | ||
LL | const BAR: u32 = IMPL_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 | ||
| | ||
LL | const BAR: u32 = IMPL_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires processing `<impl at $DIR/issue-24949-assoc-const-static-recursion-impl.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-impl.rs:12:5 | ||
| | ||
LL | const BAR: u32 = IMPL_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...which requires normalizing `IMPL_REF_BAR`... | ||
= note: ...which again requires const-evaluating + checking `IMPL_REF_BAR`, completing the cycle | ||
= note: cycle used when running analysis passes on this crate | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0391`. |
17 changes: 17 additions & 0 deletions
17
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.rs
This file contains hidden or 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 @@ | ||
// Check for recursion involving references to trait-associated const default. | ||
|
||
trait Foo { | ||
const BAR: u32; | ||
} | ||
|
||
trait FooDefault { | ||
const BAR: u32 = DEFAULT_REF_BAR; | ||
} | ||
|
||
const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR; //~ ERROR E0391 | ||
|
||
struct GlobalDefaultRef; | ||
|
||
impl FooDefault for GlobalDefaultRef {} | ||
|
||
fn main() {} |
44 changes: 44 additions & 0 deletions
44
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait-default.stderr
This file contains hidden or 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,44 @@ | ||
error[E0391]: cycle detected when const-evaluating + checking `DEFAULT_REF_BAR` | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 | ||
| | ||
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: ...which requires const-evaluating + checking `DEFAULT_REF_BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 | ||
| | ||
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating `DEFAULT_REF_BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:11:1 | ||
| | ||
LL | const DEFAULT_REF_BAR: u32 = <GlobalDefaultRef>::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...which requires normalizing `<GlobalDefaultRef as FooDefault>::BAR`... | ||
note: ...which requires const-evaluating + checking `FooDefault::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 | ||
| | ||
LL | const BAR: u32 = DEFAULT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating + checking `FooDefault::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 | ||
| | ||
LL | const BAR: u32 = DEFAULT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating `FooDefault::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 | ||
| | ||
LL | const BAR: u32 = DEFAULT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires processing `FooDefault::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait-default.rs:8:5 | ||
| | ||
LL | const BAR: u32 = DEFAULT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...which requires normalizing `DEFAULT_REF_BAR`... | ||
= note: ...which again requires const-evaluating + checking `DEFAULT_REF_BAR`, completing the cycle | ||
= note: cycle used when running analysis passes on this crate | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0391`. |
15 changes: 15 additions & 0 deletions
15
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.rs
This file contains hidden or 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,15 @@ | ||
// Check for recursion involving references to trait-associated const. | ||
|
||
trait Foo { | ||
const BAR: u32; | ||
} | ||
|
||
const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; //~ ERROR E0391 | ||
|
||
struct GlobalTraitRef; | ||
|
||
impl Foo for GlobalTraitRef { | ||
const BAR: u32 = TRAIT_REF_BAR; | ||
} | ||
|
||
fn main() {} |
44 changes: 44 additions & 0 deletions
44
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-trait.stderr
This file contains hidden or 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,44 @@ | ||
error[E0391]: cycle detected when const-evaluating + checking `TRAIT_REF_BAR` | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 | ||
| | ||
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
note: ...which requires const-evaluating + checking `TRAIT_REF_BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 | ||
| | ||
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating `TRAIT_REF_BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:7:1 | ||
| | ||
LL | const TRAIT_REF_BAR: u32 = <GlobalTraitRef>::BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...which requires normalizing `<GlobalTraitRef as Foo>::BAR`... | ||
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 | ||
| | ||
LL | const BAR: u32 = TRAIT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating + checking `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 | ||
| | ||
LL | const BAR: u32 = TRAIT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires const-evaluating `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 | ||
| | ||
LL | const BAR: u32 = TRAIT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
note: ...which requires processing `<impl at $DIR/issue-24949-assoc-const-static-recursion-trait.rs:11:1: 13:2>::BAR`... | ||
--> $DIR/issue-24949-assoc-const-static-recursion-trait.rs:12:5 | ||
| | ||
LL | const BAR: u32 = TRAIT_REF_BAR; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= note: ...which requires normalizing `TRAIT_REF_BAR`... | ||
= note: ...which again requires const-evaluating + checking `TRAIT_REF_BAR`, completing the cycle | ||
= note: cycle used when running analysis passes on this crate | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0391`. |
This file contains hidden or 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,18 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Bar<O> {} | ||
impl<O> Bar<O> for [u8; O] {} | ||
//~^ ERROR expected value, found type parameter `O` | ||
|
||
struct Foo<const O: usize> {} | ||
impl<const O: usize> Foo<O> | ||
where | ||
[u8; O]: Bar<[(); O]>, | ||
{ | ||
fn foo() {} | ||
} | ||
|
||
fn main() { | ||
Foo::foo(); | ||
} |
This file contains hidden or 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[E0423]: expected value, found type parameter `O` | ||
--> $DIR/issue-69654.rs:5:25 | ||
| | ||
LL | impl<O> Bar<O> for [u8; O] {} | ||
| ^ help: a tuple variant with a similar name exists: `Ok` | ||
| | ||
::: $SRC_DIR/libcore/result.rs:LL:COL | ||
| | ||
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T), | ||
| --------------------------------------------------- similarly named tuple variant `Ok` defined here | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0423`. |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rollup of 5 pull requests #71664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account