Skip to content
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

resolve: Temporarily make panic available with no_implicit_prelude #61971

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ impl<'a> Resolver<'a> {
}
}
WhereToResolve::MacroUsePrelude => {
if use_prelude || rust_2015 {
// FIXME: Remove `panic` from here once its uses in std/core are hygienized.
if use_prelude || rust_2015 || ident.name.as_str() == "panic" {
match self.macro_use_prelude.get(&ident.name).cloned() {
Some(binding) =>
Ok((binding, Flags::PRELUDE | Flags::MISC_FROM_PRELUDE)),
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/no_implicit_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ mod bar {
}
fn f() {
::foo::m!();
assert_eq!(0, 0); //~ ERROR cannot find macro `panic!` in this scope
assert_eq!(0, 0); // OK, the inner `panic` is available due to compiler special casing
}
}

Expand Down
11 changes: 1 addition & 10 deletions src/test/ui/hygiene/no_implicit_prelude.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ LL | fn f() { ::bar::m!(); }
LL | Vec::new();
| ^^^ use of undeclared type or module `Vec`

error: cannot find macro `panic!` in this scope
--> $DIR/no_implicit_prelude.rs:16:9
|
LL | assert_eq!(0, 0);
| ^^^^^^^^^^^^^^^^^
|
= help: have you added the `#[macro_use]` on the module/import?
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error[E0599]: no method named `clone` found for type `()` in the current scope
--> $DIR/no_implicit_prelude.rs:12:12
|
Expand All @@ -29,7 +20,7 @@ LL | ().clone()
= note: the following trait is implemented but not in scope, perhaps add a `use` for it:
`use std::clone::Clone;`

error: aborting due to 3 previous errors
error: aborting due to 2 previous errors

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.