-
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.
Auto merge of #71664 - Dylan-DPC:rollup-eng60x9, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #71217 (Suggest `;` or assignment to drop borrows in tail exprs) - #71286 (Add regression test for #69654) - #71296 (Change wording on read_vectored docs) - #71654 (Update link to unstable book for llvm_asm macro) - #71657 (Add #24949 assoc constant static recursion test) Failed merges: r? @ghost
- Loading branch information
Showing
22 changed files
with
332 additions
and
39 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
15 changes: 15 additions & 0 deletions
15
src/test/ui/associated-consts/issue-24949-assoc-const-static-recursion-impl.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,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 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 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 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 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 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 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 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 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
Oops, something went wrong.