mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
c30b41012d
```rust reuse prefix::{a, b, c} ```
33 lines
455 B
Rust
33 lines
455 B
Rust
//@ check-pass
|
|
|
|
#![feature(fn_delegation)]
|
|
#![allow(incomplete_features)]
|
|
|
|
trait Trait {
|
|
fn foo(&self) {}
|
|
fn bar(&self) {}
|
|
}
|
|
|
|
impl Trait for u8 {}
|
|
|
|
struct S(u8);
|
|
|
|
mod to_import {
|
|
pub fn check(arg: &u8) -> &u8 { arg }
|
|
}
|
|
|
|
impl Trait for S {
|
|
reuse Trait::{foo, bar} {
|
|
use to_import::check;
|
|
|
|
let _arr = Some(self.0).map(|x| [x * 2; 3]);
|
|
check(&self.0)
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let s = S(0);
|
|
s.foo();
|
|
s.bar();
|
|
}
|