]> git.lizzy.rs Git - rust.git/blob - tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.rs
Auto merge of #106742 - compiler-errors:new-solver-make-it-not-ice, r=lcnr
[rust.git] / tests / ui / feature-gates / feature-gate-return_position_impl_trait_in_trait.rs
1 // edition:2021
2
3 // async_fn_in_trait is not enough to allow use of RPITIT
4 #![allow(incomplete_features)]
5 #![feature(async_fn_in_trait)]
6
7 trait Foo {
8     fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
9     fn baz() -> Box<impl std::fmt::Display>; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
10 }
11
12 // Both return_position_impl_trait_in_trait and async_fn_in_trait are required for this (see also
13 // feature-gate-async_fn_in_trait.rs)
14 trait AsyncFoo {
15     async fn bar() -> impl Sized; //~ ERROR `impl Trait` only allowed in function and inherent method return types, not in trait method return
16 }
17
18 fn main() {}