rust/tests/ui/traits/reservation-impl/no-use.rs
2023-01-11 09:32:08 +00:00

13 lines
328 B
Rust

// check that reservation impls can't be used as normal impls in positive reasoning.
#![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
}