Add an ATB test
This commit is contained in:
parent
1d447a9946
commit
a233b1656e
2 changed files with 27 additions and 0 deletions
18
tests/ui/associated-type-bounds/no-gat-position.rs
Normal file
18
tests/ui/associated-type-bounds/no-gat-position.rs
Normal file
|
@ -0,0 +1,18 @@
|
|||
#![feature(associated_type_bounds)]
|
||||
|
||||
// Test for <https://github.com/rust-lang/rust/issues/119857>.
|
||||
|
||||
pub trait Iter {
|
||||
type Item<'a>: 'a where Self: 'a;
|
||||
|
||||
fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>;
|
||||
//~^ ERROR associated type bindings are not allowed here
|
||||
}
|
||||
|
||||
impl Iter for () {
|
||||
type Item<'a> = &'a mut [()];
|
||||
|
||||
fn next<'a>(&'a mut self) -> Option<Self::Item<'a>> { None }
|
||||
}
|
||||
|
||||
fn main() {}
|
9
tests/ui/associated-type-bounds/no-gat-position.stderr
Normal file
9
tests/ui/associated-type-bounds/no-gat-position.stderr
Normal file
|
@ -0,0 +1,9 @@
|
|||
error[E0229]: associated type bindings are not allowed here
|
||||
--> $DIR/no-gat-position.rs:8:56
|
||||
|
|
||||
LL | fn next<'a>(&'a mut self) -> Option<Self::Item<'a, As1: Copy>>;
|
||||
| ^^^^^^^^^ associated type not allowed here
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0229`.
|
Loading…
Add table
Reference in a new issue