-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
delegation: Implement multi-item delegation
```rust reuse prefix::{a, b, c} ```
- Loading branch information
1 parent
99c42d2
commit 886182d
Showing
12 changed files
with
257 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//@ 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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![feature(fn_delegation)] | ||
#![allow(incomplete_features)] | ||
|
||
mod m {} | ||
|
||
reuse m::{}; //~ ERROR empty list delegation is not supported | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: empty list delegation is not supported | ||
--> $DIR/multiple-names-empty.rs:6:1 | ||
| | ||
LL | reuse m::{}; | ||
| ^^^^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|
Oops, something went wrong.