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: Some macro resolution refactoring #53471

Merged
merged 4 commits into from
Aug 21, 2018
Merged

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Aug 18, 2018

Work towards completing #50911 (comment)

The last commit also fixes #53269 by not using def_id() on Def::Err and also fixes #53512.

@rust-highfive
Copy link
Collaborator

r? @oli-obk

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 18, 2018
LL | use nonexistent_module::mac; //~ ERROR unresolved import `nonexistent_module`
| ^^^^^^^^^^^^^^^^^^^^^^^

error[E0601]: `main` function not found in crate `issue_53269`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the noise by adding a main function

| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | } }
LL | m!();
| ----- in this macro invocation
|
= note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560)
note: `panic` could also refer to the macro imported here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This refers to "here", but there's nothing shown

is_attr: bool,
path_span: Span)
-> Result<MacroBinding<'a>, Determinacy> {
crate fn resolve_lexical_macro_path_segment(&mut self,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to block indent to reduce future churn and return type breakup

…resolution code

Refactor away `fn resolve_invoc_to_def`
`fn resolve_legacy_scope` can now resolve only to `macro_rules!` items,
`fn resolve_lexical_macro_path_segment` is for everything else - modularized macros, preludes
@petrochenkov
Copy link
Contributor Author

Updated.

@oli-obk
Copy link
Contributor

oli-obk commented Aug 21, 2018

@bors r+

@bors
Copy link
Contributor

bors commented Aug 21, 2018

📌 Commit 82619ea has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 21, 2018
@bors
Copy link
Contributor

bors commented Aug 21, 2018

⌛ Testing commit 82619ea with merge d0d81b7...

bors added a commit that referenced this pull request Aug 21, 2018
resolve: Some macro resolution refactoring

Work towards completing #50911 (comment)

The last commit also fixes #53269 by not using `def_id()` on `Def::Err` and also fixes #53512.
@bors
Copy link
Contributor

bors commented Aug 21, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: oli-obk
Pushing d0d81b7 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE when useing macro defined in standard library Panic when trying to use macro
4 participants