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

Removing absolute path in proc-macro #121842

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion compiler/rustc_session/src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ impl Session {
| CrateType::Rlib
| CrateType::Staticlib
| CrateType::Cdylib => continue,
CrateType::ProcMacro => return false,
CrateType::ProcMacro => return true,
Copy link
Member

@Urgau Urgau Mar 1, 2024

Choose a reason for hiding this comment

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

Well I guess this answer the ambiguity in RFC 3127 trim-paths about what to do with proc-macros.

However, I don't think this is the right fix, this would now always remap paths and not take into account -Zremap-path-scope, we should instead remove the loop.

-        // bail out, if any of the requested crate types aren't:
-        // "compiled executables or libraries"
-        for crate_type in &self.opts.crate_types {
-            match crate_type {
-                CrateType::Executable
-                | CrateType::Dylib
-                | CrateType::Rlib
-                | CrateType::Staticlib
-                | CrateType::Cdylib => continue,
-                CrateType::ProcMacro => return false,
-            }
-        }

Btw, this PR title is a bit misleading, it's about all paths in a proc-macro not just .rustc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed 'PR' subject, and tried a build by removing the 'loop' and build is success. Will you pull this change / I should do anything else?

Copy link
Member

Choose a reason for hiding this comment

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

Great.

Will you pull this change / I should do anything else?

Just push a new commit removing the loop.

}
}

Expand Down
Loading