From a233b1656e0311e6a9842546d2f4273a95ebf6d6 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 21 Feb 2024 17:16:35 +0000 Subject: [PATCH] Add an ATB test --- .../associated-type-bounds/no-gat-position.rs | 18 ++++++++++++++++++ .../no-gat-position.stderr | 9 +++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/ui/associated-type-bounds/no-gat-position.rs create mode 100644 tests/ui/associated-type-bounds/no-gat-position.stderr diff --git a/tests/ui/associated-type-bounds/no-gat-position.rs b/tests/ui/associated-type-bounds/no-gat-position.rs new file mode 100644 index 0000000000000..01740e6242e98 --- /dev/null +++ b/tests/ui/associated-type-bounds/no-gat-position.rs @@ -0,0 +1,18 @@ +#![feature(associated_type_bounds)] + +// Test for . + +pub trait Iter { + type Item<'a>: 'a where Self: 'a; + + fn next<'a>(&'a mut self) -> Option>; + //~^ ERROR associated type bindings are not allowed here +} + +impl Iter for () { + type Item<'a> = &'a mut [()]; + + fn next<'a>(&'a mut self) -> Option> { None } +} + +fn main() {} diff --git a/tests/ui/associated-type-bounds/no-gat-position.stderr b/tests/ui/associated-type-bounds/no-gat-position.stderr new file mode 100644 index 0000000000000..5692b2c7d0902 --- /dev/null +++ b/tests/ui/associated-type-bounds/no-gat-position.stderr @@ -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>; + | ^^^^^^^^^ associated type not allowed here + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0229`.