-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features, unused_braces)] | ||
|
||
trait Bar<T> {} | ||
impl<T> Bar<T> for [u8; {7}] {} | ||
|
||
struct Foo<const N: usize> {} | ||
impl<const N: usize> Foo<N> | ||
where | ||
[u8; N]: Bar<[(); N]>, | ||
{ | ||
fn foo() {} | ||
} | ||
|
||
fn main() { | ||
Foo::foo(); | ||
//~^ ERROR no function or associated item named `foo` | ||
// FIXME(const_generics): The above should not error | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/ui/const-generics/issues/issue-69654-run-pass.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,15 @@ | ||
error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope | ||
--> $DIR/issue-69654-run-pass.rs:16:10 | ||
| | ||
LL | struct Foo<const N: usize> {} | ||
| -------------------------- function or associated item `foo` not found for this | ||
... | ||
LL | Foo::foo(); | ||
| ^^^ function or associated item not found in `Foo<{_: usize}>` | ||
| | ||
= note: the method `foo` exists but the following trait bounds were not satisfied: | ||
`[u8; _]: Bar<[(); _]>` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0599`. |
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,19 @@ | ||
#![feature(const_generics)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Bar<T> {} | ||
impl<T> Bar<T> for [u8; T] {} | ||
//~^ ERROR expected value, found type parameter `T` | ||
|
||
struct Foo<const N: usize> {} | ||
impl<const N: usize> Foo<N> | ||
where | ||
[u8; N]: Bar<[(); N]>, | ||
{ | ||
fn foo() {} | ||
} | ||
|
||
fn main() { | ||
Foo::foo(); | ||
//~^ ERROR no function or associated item named `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,22 @@ | ||
error[E0423]: expected value, found type parameter `T` | ||
--> $DIR/issue-69654.rs:5:25 | ||
| | ||
LL | impl<T> Bar<T> for [u8; T] {} | ||
| ^ not a value | ||
|
||
error[E0599]: no function or associated item named `foo` found for struct `Foo<{_: usize}>` in the current scope | ||
--> $DIR/issue-69654.rs:17:10 | ||
| | ||
LL | struct Foo<const N: usize> {} | ||
| -------------------------- function or associated item `foo` not found for this | ||
... | ||
LL | Foo::foo(); | ||
| ^^^ function or associated item not found in `Foo<{_: usize}>` | ||
| | ||
= note: the method `foo` exists but the following trait bounds were not satisfied: | ||
`[u8; _]: Bar<[(); _]>` | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0423, E0599. | ||
For more information about an error, try `rustc --explain E0423`. |