rust/tests/ui/delegation/glob-glob.rs

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

37 lines
552 B
Rust
Raw Normal View History

2024-03-15 11:21:03 +00:00
//@ check-pass
#![feature(fn_delegation)]
#![allow(incomplete_features)]
mod inner {
pub trait TraitFoo {
fn foo(&self) -> u8;
}
pub trait TraitBar {
fn bar(&self) -> u8;
}
impl TraitFoo for u8 {
fn foo(&self) -> u8 { 0 }
}
impl TraitBar for u8 {
fn bar(&self) -> u8 { 1 }
}
}
trait Trait {
fn foo(&self) -> u8;
fn bar(&self) -> u8;
}
impl Trait for u8 {
reuse inner::TraitFoo::*;
reuse inner::TraitBar::*;
}
fn main() {
let u = 0u8;
u.foo();
u.bar();
}