2023-11-26 12:57:31 +00:00
|
|
|
//@ run-pass
|
|
|
|
|
|
|
|
#![feature(fn_delegation)]
|
|
|
|
//~^ WARN the feature `fn_delegation` is incomplete
|
|
|
|
|
|
|
|
mod to_reuse {
|
|
|
|
pub fn foo(x: i32) -> i32 { x }
|
|
|
|
pub mod inner {}
|
|
|
|
}
|
|
|
|
|
|
|
|
reuse to_reuse::foo {{
|
|
|
|
use self::to_reuse::foo;
|
|
|
|
let x = foo(12);
|
|
|
|
x + self
|
|
|
|
}}
|
|
|
|
|
2024-02-07 02:42:01 +00:00
|
|
|
trait Trait { //~ WARN trait `Trait` is never used
|
2023-11-26 12:57:31 +00:00
|
|
|
fn bar(&self, x: i32) -> i32 { x }
|
|
|
|
}
|
|
|
|
|
2024-02-07 02:42:01 +00:00
|
|
|
struct F; //~ WARN struct `F` is never constructed
|
2023-11-26 12:57:31 +00:00
|
|
|
impl Trait for F {}
|
|
|
|
|
2024-02-07 02:42:01 +00:00
|
|
|
struct S(F); //~ WARN struct `S` is never constructed
|
2023-11-26 12:57:31 +00:00
|
|
|
impl Trait for S {
|
|
|
|
reuse <F as Trait>::bar {
|
|
|
|
#[allow(unused_imports)]
|
|
|
|
use self::to_reuse::{foo, inner::self};
|
|
|
|
let x = foo(12);
|
|
|
|
assert_eq!(x, 12);
|
|
|
|
&self.0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(foo(12), 24);
|
|
|
|
}
|