-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
71 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/test/ui/const-generics/associated-type-bound-fail.full.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[E0277]: the trait bound `u16: Bar<N>` is not satisfied | ||
--> $DIR/associated-type-bound-fail.rs:14:5 | ||
| | ||
LL | type Assoc: Bar<N>; | ||
| ------ required by this bound in `Foo::Assoc` | ||
... | ||
LL | type Assoc = u16; | ||
| ^^^^^^^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `u16` | ||
| | ||
= help: the following implementations were found: | ||
<u16 as Bar<3_usize>> | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
15 changes: 15 additions & 0 deletions
15
src/test/ui/const-generics/associated-type-bound-fail.min.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[E0277]: the trait bound `u16: Bar<N>` is not satisfied | ||
--> $DIR/associated-type-bound-fail.rs:14:5 | ||
| | ||
LL | type Assoc: Bar<N>; | ||
| ------ required by this bound in `Foo::Assoc` | ||
... | ||
LL | type Assoc = u16; | ||
| ^^^^^^^^^^^^^^^^^ the trait `Bar<N>` is not implemented for `u16` | ||
| | ||
= help: the following implementations were found: | ||
<u16 as Bar<3_usize>> | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |
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 @@ | ||
// revisions: full min | ||
#![cfg_attr(full, allow(incomplete_features))] | ||
#![cfg_attr(full, feature(const_generics))] | ||
#![cfg_attr(min, feature(min_const_generics))] | ||
|
||
trait Bar<const N: usize> {} | ||
|
||
trait Foo<const N: usize> { | ||
type Assoc: Bar<N>; | ||
} | ||
|
||
impl Bar<3> for u16 {} | ||
impl<const N: usize> Foo<N> for i16 { | ||
type Assoc = u16; //~ ERROR the trait bound `u16: Bar<N>` | ||
} | ||
|
||
fn main() {} |
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,24 @@ | ||
// run-pass | ||
// revisions: full min | ||
#![cfg_attr(full, allow(incomplete_features))] | ||
#![cfg_attr(full, feature(const_generics))] | ||
#![cfg_attr(min, feature(min_const_generics))] | ||
|
||
trait Bar<const N: usize> {} | ||
|
||
trait Foo<const N: usize> { | ||
type Assoc: Bar<N>; | ||
} | ||
|
||
impl<const N: usize> Bar<N> for u8 {} | ||
impl Bar<3> for u16 {} | ||
|
||
impl<const N: usize> Foo<N> for i8 { | ||
type Assoc = u8; | ||
} | ||
|
||
impl Foo<3> for i16 { | ||
type Assoc = u16; | ||
} | ||
|
||
fn main() {} |