-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Lang item invalid code compiles #32033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It seems this issue comes from here. If the lang_item doesn't already exist, the function won't check it. |
I’m not sure this is a problem per se. Namely, us not failing hard on unknown lang items allows #![no_std] users to maintain some compatibility between Rust versions. I.e. there’s a few language items that did exist in 1.0 but do not exist anymore. Crate authors can still define these language items unconditionally and enjoy support across more versions. |
Hum... At first, I just wanted to check if a local lang item was double defined, but then wondered what was the point to allow them. With this, you can still declare std lang items, but you cannot create new ones. I'm going to wait to have some more opinions before doing anything else. Thanks @nagisa! |
Tagging with T-lang so people won’t miss this. |
The following code compiles whereas it shouldn't:
cc @brson
#31957
The text was updated successfully, but these errors were encountered: