Add an ATB test

This commit is contained in:
Michael Goulet 2024-02-21 17:16:35 +00:00
parent 1d447a9946
commit a233b1656e
2 changed files with 27 additions and 0 deletions

View 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() {}

View 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`.