mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-01 09:32:15 +00:00
36 lines
519 B
Rust
36 lines
519 B
Rust
#![feature(rustc_attrs, const_trait_impl)]
|
|
|
|
const trait Foo {
|
|
fn foo(&self);
|
|
|
|
fn bar(&self) {}
|
|
}
|
|
|
|
struct Bar;
|
|
|
|
#[rustc_comptime]
|
|
impl Bar {
|
|
fn boo(&self) {}
|
|
}
|
|
|
|
#[rustc_comptime]
|
|
//~^ ERROR: cannot be used on trait impl
|
|
impl Foo for Bar {
|
|
fn foo(&self) {
|
|
comptime_fn();
|
|
}
|
|
}
|
|
|
|
#[rustc_comptime]
|
|
fn comptime_fn() {}
|
|
|
|
const _: () = {
|
|
Bar.boo();
|
|
Bar.foo();
|
|
//~^ ERROR: `Bar: const Foo` is not satisfied
|
|
Bar.bar();
|
|
//~^ ERROR: `Bar: const Foo` is not satisfied
|
|
};
|
|
|
|
fn main() {}
|