-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #70718 This commit allows making associated items (e.g. associated functions and types) into lang items via the `#[lang]` attribute. This allows such items to be accessed directly, rather than by iterating over the parent item's associated items. I've added `FnOnce::Output` as a lang item, and updated one old usage to use the new lang item. The remaining uses can be updated separately.
- Loading branch information
Showing
7 changed files
with
94 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#![feature(lang_items)] | ||
|
||
trait Foo { | ||
#[lang = "dummy_lang_item_1"] //~ ERROR definition | ||
fn foo() {} | ||
|
||
#[lang = "dummy_lang_item_2"] //~ ERROR definition | ||
fn bar(); | ||
|
||
#[lang = "dummy_lang_item_3"] //~ ERROR definition | ||
type MyType; | ||
} | ||
|
||
struct Bar; | ||
|
||
impl Bar { | ||
#[lang = "dummy_lang_item_4"] //~ ERROR definition | ||
fn test() {} | ||
} | ||
|
||
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,27 @@ | ||
error[E0522]: definition of an unknown language item: `dummy_lang_item_1` | ||
--> $DIR/assoc-lang-items.rs:4:5 | ||
| | ||
LL | #[lang = "dummy_lang_item_1"] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_1` | ||
|
||
error[E0522]: definition of an unknown language item: `dummy_lang_item_2` | ||
--> $DIR/assoc-lang-items.rs:7:5 | ||
| | ||
LL | #[lang = "dummy_lang_item_2"] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_2` | ||
|
||
error[E0522]: definition of an unknown language item: `dummy_lang_item_3` | ||
--> $DIR/assoc-lang-items.rs:10:5 | ||
| | ||
LL | #[lang = "dummy_lang_item_3"] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_3` | ||
|
||
error[E0522]: definition of an unknown language item: `dummy_lang_item_4` | ||
--> $DIR/assoc-lang-items.rs:17:5 | ||
| | ||
LL | #[lang = "dummy_lang_item_4"] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown language item `dummy_lang_item_4` | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0522`. |