-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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/metadata: Stop encoding macros as reexports #91795
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
9519fe6
to
1b37371
Compare
This comment has been minimized.
This comment has been minimized.
This was referenced Dec 17, 2021
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Dec 18, 2021
hir: Do not introduce dummy type names for `extern` blocks in def paths Use a separate nameless `DefPathData` variant instead. Extracted from rust-lang#91795.
This was referenced Dec 21, 2021
This comment has been minimized.
This comment has been minimized.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 2, 2022
Remove effect of `#[no_link]` attribute on name resolution Previously it hid all non-macro names from other crates. This has no relation to linking and can change name resolution behavior in some cases (e.g. glob conflicts), in addition to just producing the "unresolved name" errors. I can kind of understand the possible reasoning behind the current behavior - if you can use names from a `no_link` crates then you can use, for example, functions too, but whether it will actually work or produce link-time errors will depend on random factors like inliner behavior. (^^^ This is not the actual reason why the current behavior exist, I've looked through git history and it's mostly accidental.) I think this risk is ok for such an obscure attribute, and we don't need to specifically prevent use of non-macro items from such crates. (I'm not actually sure why would anyone use `#[no_link]` on a crate, even if it's macro only, if you aware of any use cases, please share. IIRC, at some point it was used for crates implementing custom derives - the now removed legacy ones, not the current proc macros.) Extracted from rust-lang#91795.
1b37371
to
3776062
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
8d8eb69
to
e2850ed
Compare
This comment has been minimized.
This comment has been minimized.
e2850ed
to
6f48c76
Compare
For performance it would be optimal to use two structures: // This struct is used during decoding and unifies both proper items and reexports
struct ModChild {
pub ident: Ident,
pub res: Res<!>,
pub vis: ty::Visibility,
pub span: Span,
pub macro_rules: bool,
}
// This structure is used for encoding the reexport table, `macro_rules` is always false by definition
pub struct Reexport {
pub ident: Ident,
pub res: Res<!>,
pub vis: ty::Visibility,
pub span: Span,
} , but I just didn't want to introduce more entities. |
6f48c76
to
63b50ec
Compare
Updated. |
This comment has been minimized.
This comment has been minimized.
63b50ec
to
1f8ebcc
Compare
This comment was marked as resolved.
This comment was marked as resolved.
Sorry for the delay. |
…-in macros Previously it always returned `MacroKind::Bang` while some of those macros are actually attributes and derives
To make the `macro_rules` flag more readily available without decoding everything else
1f8ebcc
to
b91ec30
Compare
@bors r=cjgillot |
📌 Commit b91ec30 has been approved by |
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Feb 24, 2022
Rollup of 9 pull requests Successful merges: - rust-lang#91795 (resolve/metadata: Stop encoding macros as reexports) - rust-lang#93714 (better ObligationCause for normalization errors in `can_type_implement_copy`) - rust-lang#94175 (Improve `--check-cfg` implementation) - rust-lang#94212 (Stop manually SIMDing in `swap_nonoverlapping`) - rust-lang#94242 (properly handle fat pointers to uninhabitable types) - rust-lang#94308 (Normalize main return type during mono item collection & codegen) - rust-lang#94315 (update auto trait lint for `PhantomData`) - rust-lang#94316 (Improve string literal unescaping) - rust-lang#94327 (Avoid emitting full macro body into JSON errors) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Dylan-DPC
added a commit
to Dylan-DPC/rust
that referenced
this pull request
Nov 1, 2022
resolve: Turn the binding from `#[macro_export]` into a proper `Import` Continuation of rust-lang#91795. ```rust #[macro_export] macro_rules! m { /*...*/ } ``` is desugared to something like ```rust macro_rules! m { /*...*/ } // Non-modularized macro_rules item pub use m; // It's modularized reexport ``` This PR adjusts the internal representation to better match this model.
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.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-rustdoc
Relevant to the rustdoc team, which will review and decide on the PR/issue.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #88335.
r? @cjgillot