rust/src/test/ui/assoc-lang-items.rs
Aaron Hill a13d4678fe
Implement associated lang items
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.
2020-06-24 19:08:11 -04:00

22 lines
366 B
Rust

#![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() {}