Skip to content

Commit

Permalink
Add an ATB test
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Feb 21, 2024
1 parent 1d447a9 commit a233b16
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/ui/associated-type-bounds/no-gat-position.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 9 additions & 0 deletions tests/ui/associated-type-bounds/no-gat-position.stderr
Original file line number Diff line number Diff line change
@@ -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`.

0 comments on commit a233b16

Please sign in to comment.