rust/tests/ui/traits/reservation-impl/no-use.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
328 B
Rust
Raw Normal View History

2019-07-13 14:52:57 -05:00
// check that reservation impls can't be used as normal impls in positive reasoning.
#![feature(rustc_attrs)]
trait MyTrait { fn foo(&self); }
2019-07-27 14:18:34 -05:00
#[rustc_reservation_impl = "foo"]
2019-07-13 14:52:57 -05:00
impl MyTrait for () { fn foo(&self) {} }
fn main() {
<() as MyTrait>::foo(&());
//~^ ERROR the trait bound `(): MyTrait` is not satisfied
}