rust/tests/ui/traits/reservation-impl/no-use.rs
2023-03-21 16:27:25 +01:00

14 lines
394 B
Rust

// check that reservation impls can't be used as normal impls in positive reasoning.
// revisions: old next
//[next] compile-flags: -Ztrait-solver=next
#![feature(rustc_attrs)]
trait MyTrait { fn foo(&self); }
#[rustc_reservation_impl = "foo"]
impl MyTrait for () { fn foo(&self) {} }
fn main() {
<() as MyTrait>::foo(&());
//~^ ERROR the trait bound `(): MyTrait` is not satisfied
}