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

Remove #[macro_use] extern crate tracing from rustc_codegen_gcc. #129768

Conversation

nnethercote
Copy link
Contributor

So that tracing is treated more like smallvec and tempfile, i.e. explicitly mentioned in the Cargo.toml file.

r? @antoyo

So that `tracing` is treated more like `smallvec` and `tempfile`, i.e.
explicitly mentioned in the `Cargo.toml` file.
@rustbot
Copy link
Collaborator

rustbot commented Aug 30, 2024

Failed to set assignee to antoyo: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 30, 2024
@rustbot
Copy link
Collaborator

rustbot commented Aug 30, 2024

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo, @GuillaumeGomez

@nnethercote
Copy link
Contributor Author

nnethercote commented Aug 30, 2024

Background: I have been removing extern crate tracing for all rustc_* crates, e.g. see #129767. I think it's reasonable to do the same for rustc_codegen_gcc? But I know it's a bit different to other crates (e.g. has its own Cargo.{toml,lock} files) so I'm not 100% sure about it.

@GuillaumeGomez
Copy link
Member

Looks good to me. I'll just wait for @antoyo to confirm before approving it.

Copy link
Contributor

@antoyo antoyo left a comment

Choose a reason for hiding this comment

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

I am against this change as this brings a number of unneeded dependencies.
If there's a way to not bring any new dependency, I would be OK with this.

@nnethercote
Copy link
Contributor Author

There is something going on that I don't understand here.

I tried making a trivial crate with this Cargo.toml:

[package]
name = "tracing-test"
version = "0.1.0"
edition = "2021"

[dependencies]
tracing = "0.1"

and this src/main.rs:

#[macro_use]
extern crate tracing;

fn main() {
    info!("Hello, world!");
}

and the Cargo.lock file gets all those dependencies like tracing, pin-project-lite, quote, etc. If I remove tracing from the Cargo.toml it doesn't compile, unsurprisingly.

How does the #[macro_use] extern crate tracing work in the rustc_codegen_gcc case? How does it let tracing macros be used seemingly without introducing dependencies on tracing and its dependent crates?

@antoyo
Copy link
Contributor

antoyo commented Aug 30, 2024

Maybe this crate is provided the same way as the other rustc crates like rustc_apfloat, rustc_ast, rustc_hir, …?
I don't know how this work, though.

@nnethercote
Copy link
Contributor Author

I asked on Zulip, it comes from the sysroot. Any crate used elsewhere in rustc can be used via extern crate. Which means we can actually use extern crate with more crates and shrink Cargo.lock. I filed #129876 to do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants