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

Import resolution regression when test has the same name as extern macro #53144

Closed
dtolnay opened this issue Aug 7, 2018 · 1 comment · Fixed by #53270
Closed

Import resolution regression when test has the same name as extern macro #53144

dtolnay opened this issue Aug 7, 2018 · 1 comment · Fixed by #53270
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-1.2 Area: Declarative macros 1.2 A-resolve Area: Name/path resolution done by `rustc_resolve` specifically P-high High priority

Comments

@dtolnay
Copy link
Member

dtolnay commented Aug 7, 2018

I am seeing some breakage in indoc from #52890. It minimizes to:

#![feature(use_extern_macros)]

#[test]
fn unimplemented() {}

fn main() {
    unimplemented!();
}
$ cargo +nightly-2018-08-02 test
   Compiling repro v0.0.0
    Finished dev [unoptimized + debuginfo] target(s) in 0.56s
     Running target/debug/deps/repro-1d729be478cd3ccf

running 1 test
test unimplemented ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
$ cargo +nightly-2018-08-03 test
   Compiling repro v0.0.0
error: cannot determine resolution for the macro `unimplemented`
 --> src/main.rs:7:5
  |
7 |     unimplemented!();
  |     ^^^^^^^^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: aborting due to previous error

error: Could not compile `repro`.

To learn more, run the command again with --verbose.

@djrenren @petrochenkov

@petrochenkov
Copy link
Contributor

This is more of a consequence of #52234 than #[test] infra changes.
It caused pretty bad fallout in general, but it should be fixable, I hope to send a PR in a few days.

@petrochenkov petrochenkov added A-resolve Area: Name/path resolution done by `rustc_resolve` specifically A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-1.2 Area: Declarative macros 1.2 labels Aug 8, 2018
@petrochenkov petrochenkov added the P-high High priority label Aug 8, 2018
bors added a commit that referenced this issue Aug 13, 2018
Fix a few regressions from enabling macro modularization

The first commit restores the old behavior for some minor unstable stuff (`rustc_*` and `derive_*` attributes) and adds a new feature gate for arbitrary tokens in non-macro attributes.

The second commit fixes #53205

The third commit fixes #53144.
Same technique is used as for other things blocking expansion progress - if something causes indeterminacy too often, then prohibit it.
In this case referring to crate-local macro-expanded `#[macro_export]` macros via module-relative paths is prohibited, see comments in code for more details.

cc #50911
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) A-macros-1.2 Area: Declarative macros 1.2 A-resolve Area: Name/path resolution done by `rustc_resolve` specifically P-high High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants