-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Description
This is the tracking issue for the ambiguous_panic_imports
future-compatibility warning and other related errors. The goal of this page is to describe why this change was made and how you can fix code that is affected by it. It also provides a place to ask questions or register a complaint if you feel the change should not be made. For more information on the policy around future-compatibility warnings, see our breaking change policy guidelines.
What is the warning for?
Glob importing the standard library in a no_std
crate can lead to an ambiguous name resolution for the macro panic
which is defined both in core
and std
.
Why was this change made?
The core::panic
resolution after use std::prelude::v1::*
is deemed surprising and should be opted into explicitly. This issue was discovered and became relevant in github.com//pull/139493.
Example
#![no_std]
extern crate std;
use std::prelude::v1::*;
fn xx() {
panic!(); // resolves to core::panic
}
Recommendations
Explicitly import panic
with use core::panic;
to maintain the previous semantics or use std::panic;
if that was the original intention.
When will this warning become a hard error?
This has not yet been decided.
Steps
- Implement the lint
- Raise lint level to deny
- Change the lint to report in dependencies
- Switch to a hard error