Skip to content

Breaking macro name resolution change in 1.29 #54783

Closed
@Diggsey

Description

@Diggsey

Minimal test case: https://github.com/Diggsey/macro_regression_example

This code compiles on 1.28, but fails on 1.29

error[E0433]: failed to resolve. Use of undeclared type or module `TestEnum`
 --> src\main.rs:6:10
  |
6 | #[derive(DbEnum, Debug)]
  |          ^^^^^^ Use of undeclared type or module `TestEnum`

error[E0412]: cannot find type `TestEnum` in this scope
 --> src\main.rs:6:10
  |
6 | #[derive(DbEnum, Debug)]
  |          ^^^^^^ not found in this scope

warning: unused `#[macro_use]` import
 --> src\main.rs:1:1
  |
1 | #[macro_use]
  | ^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

warning: cannot find type `TestEnum` in this scope
 --> src\main.rs:6:10
  |
6 | #[derive(DbEnum, Debug)]
  |          ^^^^^^ names from parent modules are not accessible without an explicit import
  |
  = note: #[warn(proc_macro_derive_resolution_fallback)] on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #50504 <https://github.com/rust-lang/rust/issues/50504>

warning: cannot find type `TestEnum` in this scope
 --> src\main.rs:6:10
  |
6 | #[derive(DbEnum, Debug)]
  |          ^^^^^^ names from parent modules are not accessible without an explicit import
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #50504 <https://github.com/rust-lang/rust/issues/50504>

error: aborting due to 2 previous errors

Some errors occurred: E0412, E0433.
For more information about an error, try `rustc --explain E0412`.
error: Could not compile `macro_regression`.

Note that I do not have #![deny(warnings)] or anything like that enabled. This gives quite a bad impression when stability is advertised so frequently.

Metadata

Metadata

Assignees

Labels

A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions