Feature/Attribute fundamental
I tried this code:
#![feature(fundamental)]
#[fundamental]
#[allow(unused)]
struct Foo {}
I expected to see this happen: No error
Instead, this happened:
<source>:1:12: error: unknown feature 'fundamental'
1 | #![feature(fundamental)]
| ^~~~~~~~~~~
Meta
- I tested it on
godbolt.comGCCRS master, April 3 2023. I can run it locally and obtain a commit hash if necessary.
This changes the rules around coherence to indicate that it is promised that the type or trait marked with #[fundamental] will never get new trait impls mentioning it in any future version of the crate defining this type or trait. Thus allowing downstream crates to add trait impls that may otherwise conflict in future versions.
(Note: This is an informal description. You should lookup the exact coherence rules when implementing this.)
The attribute is used within libcore 1.49 so we'll need to handle it
It only needs to be handled once coherency is implemented.
I think we should keep this issue for properly implementing the fundamental attribute, but as of right now I believe it falls into the category of "only useful for invalid Rust code". I'll open up a separate issue so that we can understand that #[fundamental] is a built-in attribute, and ignore it for now