File tree 2 files changed +18
-4
lines changed
2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change
1
+ //! Check that associated items can be marked as lang items, so that they don't have to be looked up
2
+ //! by name or by definition order indirectly.
3
+ //!
4
+ //! This test is not *quite* high-fidelity: it checks that you can use lang items on associated
5
+ //! items by looking at the error message *as a proxy*. That is, the error message is about
6
+ //! undefined lang items and not invalid attribute target, indicating that it has reached lang item
7
+ //! machinery (which is relying on knowing the implementation detail). However, it's annoying to
8
+ //! write a full-fidelity test for this, so I think this is acceptable even though it's not *great*.
9
+ //!
10
+ //! This was implemented in <https://github.com/rust-lang/rust/pull/72559> to help with
11
+ //! <https://github.com/rust-lang/rust/issues/70718>, which is itself relevant for e.g. `Fn::Output`
12
+ //! or `Future::Output` or specific use cases like [Use `T`'s discriminant type in
13
+ //! `mem::Discriminant<T>` instead of `u64`](https://github.com/rust-lang/rust/pull/70705).
14
+
1
15
#![ feature( lang_items) ]
2
16
3
17
trait Foo {
Original file line number Diff line number Diff line change 1
1
error[E0522]: definition of an unknown lang item: `dummy_lang_item_1`
2
- --> $DIR/assoc-lang-items.rs:4 :5
2
+ --> $DIR/assoc-lang-items.rs:18 :5
3
3
|
4
4
LL | #[lang = "dummy_lang_item_1"]
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_1`
6
6
7
7
error[E0522]: definition of an unknown lang item: `dummy_lang_item_2`
8
- --> $DIR/assoc-lang-items.rs:7 :5
8
+ --> $DIR/assoc-lang-items.rs:21 :5
9
9
|
10
10
LL | #[lang = "dummy_lang_item_2"]
11
11
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_2`
12
12
13
13
error[E0522]: definition of an unknown lang item: `dummy_lang_item_3`
14
- --> $DIR/assoc-lang-items.rs:10 :5
14
+ --> $DIR/assoc-lang-items.rs:24 :5
15
15
|
16
16
LL | #[lang = "dummy_lang_item_3"]
17
17
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_3`
18
18
19
19
error[E0522]: definition of an unknown lang item: `dummy_lang_item_4`
20
- --> $DIR/assoc-lang-items.rs:17 :5
20
+ --> $DIR/assoc-lang-items.rs:31 :5
21
21
|
22
22
LL | #[lang = "dummy_lang_item_4"]
23
23
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition of unknown lang item `dummy_lang_item_4`
You can’t perform that action at this time.
0 commit comments