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 rustc middle from numerous crates #124914

Merged
merged 11 commits into from
May 13, 2024

Conversation

nnethercote
Copy link
Contributor

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. This PR mops up some cases I didn't get to in #124511.

r? @saethlin

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 8, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 8, 2024

Some changes occurred in rustc_ty_utils::consts.rs

cc @BoxyUwU

HIR ty lowering was modified

cc @fmease

Some changes occurred in match lowering

cc @Nadrieril

changes to the core type system

cc @compiler-errors, @lcnr

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred in need_type_info.rs

cc @lcnr

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occurred in coverage instrumentation.

cc @Zalathar

Some changes occurred in const_evaluatable.rs

cc @BoxyUwU

changes to the core type system

cc @compiler-errors, @lcnr

@nnethercote nnethercote force-pushed the rm-extern-crate-rustc_middle branch from 62e59b4 to 8d18170 Compare May 9, 2024 00:53
@@ -7,6 +7,7 @@ use rustc_middle::mir::AssertKind;
use rustc_middle::query::TyCtxtAt;
use rustc_middle::ty::TyCtxt;
use rustc_middle::ty::{layout::LayoutError, ConstInt};
use rustc_middle::{err_inval, err_machine_stop};
Copy link
Member

@RalfJung RalfJung May 9, 2024

Choose a reason for hiding this comment

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

These are interpreter macros. If we use them from a path, then ideally we use them from the interpret module, i.e as part of the use crate::interpret::... below (based on crate::interpret doing a re-export of rustc_middle::interpret).

Does that work, or is it really needed to get these from the crate root?

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 have added another commit that adds a pub use foo for each of these macros, and then they can be imported with use crate::interpret::foo. I think that's the best way to achieve that.

Copy link
Member

@RalfJung RalfJung May 9, 2024

Choose a reason for hiding this comment

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

Ah, is pub use how one gets an item for a macro_rules in the current module? Nice, TIL.

@nnethercote nnethercote force-pushed the rm-extern-crate-rustc_middle branch from 8d18170 to d740618 Compare May 9, 2024 10:13
@bors
Copy link
Contributor

bors commented May 9, 2024

☔ The latest upstream changes (presumably #124934) made this pull request unmergeable. Please resolve the merge conflicts.

@saethlin
Copy link
Member

saethlin commented May 9, 2024

I've considered submitting PRs like this, but the sheer number of lines changed has always turned me off. I like having this change, glad I didn't have to do it.

r=me when you fix the conflicts

@nnethercote nnethercote force-pushed the rm-extern-crate-rustc_middle branch from d740618 to ad0f595 Compare May 10, 2024 00:54
@nnethercote
Copy link
Contributor Author

The only ones remaining are for extern crate tracing. If you want to remove some/all of those, it's tedious but easy :)

I rebased.

@bors r=saethlin

@bors
Copy link
Contributor

bors commented May 10, 2024

📌 Commit ad0f595 has been approved by saethlin

It is now in the queue for this repository.

@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 May 10, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 10, 2024
…middle, r=saethlin

Remove `#[macro_use] extern crate rustc middle` from numerous crates

Because explicit importing of macros via `use` items is nicer (more standard and readable) than implicit importing via `#[macro_use]`. This PR mops up some cases I didn't get to in rust-lang#124511.

r? `@saethlin`
bors added a commit to rust-lang-ci/rust that referenced this pull request May 10, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#124551 (Add benchmarks for `impl Debug for str`)
 - rust-lang#124914 (Remove `#[macro_use] extern crate rustc middle` from numerous crates)
 - rust-lang#124915 (`rustc_target` cleanups)
 - rust-lang#124918 (Eliminate some `FIXME(lcnr)` comments)
 - rust-lang#124927 (opt-dist: use xz2 instead of xz crate)
 - rust-lang#124936 (analyse visitor: build proof tree in probe)
 - rust-lang#124943 (always use `GenericArgsRef`)

Failed merges:

 - rust-lang#124955 (Use fewer origins when creating type variables.)

r? `@ghost`
`@rustbot` modify labels: rollup
@matthiaskrgr
Copy link
Member

needs rebase already :/
@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 10, 2024
@matthiaskrgr
Copy link
Member

or the problem is that we can't merge this together with other stuff due to conflicts showing up then..
@bors rollup=never

@nnethercote
Copy link
Contributor Author

@bors r=saethlin

@bors
Copy link
Contributor

bors commented May 10, 2024

📌 Commit ad0f595 has been approved by saethlin

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 10, 2024
@bors
Copy link
Contributor

bors commented May 10, 2024

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout rm-extern-crate-rustc_middle (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self rm-extern-crate-rustc_middle --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging compiler/rustc_ty_utils/src/representability.rs
Auto-merging compiler/rustc_ty_utils/src/implied_bounds.rs
Auto-merging compiler/rustc_ty_utils/src/assoc.rs
Auto-merging compiler/rustc_trait_selection/src/traits/vtable.rs
Auto-merging compiler/rustc_trait_selection/src/traits/select/mod.rs
Auto-merging compiler/rustc_trait_selection/src/traits/select/confirmation.rs
Auto-merging compiler/rustc_trait_selection/src/traits/project.rs
Auto-merging compiler/rustc_trait_selection/src/traits/error_reporting/type_err_ctxt_ext.rs
Auto-merging compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Auto-merging compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs
Auto-merging compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs
Auto-merging compiler/rustc_trait_selection/src/solve/eval_ctxt/canonical.rs
Auto-merging compiler/rustc_metadata/src/rmeta/encoder.rs
Auto-merging compiler/rustc_infer/src/infer/relate/generalize.rs
Auto-merging compiler/rustc_infer/src/infer/mod.rs
Auto-merging compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
Auto-merging compiler/rustc_infer/src/infer/error_reporting/mod.rs
Auto-merging compiler/rustc_hir_typeck/src/place_op.rs
Auto-merging compiler/rustc_hir_typeck/src/pat.rs
Auto-merging compiler/rustc_hir_typeck/src/op.rs
Auto-merging compiler/rustc_hir_typeck/src/method/suggest.rs
CONFLICT (content): Merge conflict in compiler/rustc_hir_typeck/src/method/suggest.rs
Auto-merging compiler/rustc_hir_typeck/src/method/probe.rs
Auto-merging compiler/rustc_hir_typeck/src/method/prelude2021.rs
CONFLICT (content): Merge conflict in compiler/rustc_hir_typeck/src/method/prelude2021.rs
Auto-merging compiler/rustc_hir_typeck/src/method/mod.rs
Auto-merging compiler/rustc_hir_typeck/src/method/confirm.rs
Auto-merging compiler/rustc_hir_typeck/src/lib.rs
Auto-merging compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Auto-merging compiler/rustc_hir_typeck/src/expr.rs
Auto-merging compiler/rustc_hir_typeck/src/demand.rs
Auto-merging compiler/rustc_hir_typeck/src/coercion.rs
Auto-merging compiler/rustc_hir_typeck/src/closure.rs
Auto-merging compiler/rustc_hir_typeck/src/callee.rs
Auto-merging compiler/rustc_hir_analysis/src/variance/mod.rs
Auto-merging compiler/rustc_hir_analysis/src/lib.rs
Auto-merging compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs
Auto-merging compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
Auto-merging compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs
Auto-merging compiler/rustc_hir_analysis/src/collect/type_of.rs
Auto-merging compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs
Auto-merging compiler/rustc_hir_analysis/src/collect/predicates_of.rs
Auto-merging compiler/rustc_hir_analysis/src/coherence/orphan.rs
Auto-merging compiler/rustc_hir_analysis/src/check/wfcheck.rs
Auto-merging compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Auto-merging compiler/rustc_hir_analysis/src/check/check.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 10, 2024
@nnethercote nnethercote force-pushed the rm-extern-crate-rustc_middle branch from ad0f595 to c34ebba Compare May 12, 2024 22:32
@nnethercote
Copy link
Contributor Author

I rebased again.

@bors r=saethlin p=1

Priority bump because this is conflict-prone.

@bors
Copy link
Contributor

bors commented May 12, 2024

📌 Commit c34ebba has been approved by saethlin

It is now in the queue for this repository.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 12, 2024
@bors
Copy link
Contributor

bors commented May 13, 2024

⌛ Testing commit c34ebba with merge ba956ef...

@bors
Copy link
Contributor

bors commented May 13, 2024

☀️ Test successful - checks-actions
Approved by: saethlin
Pushing ba956ef to master...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ba956ef): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-4.8% [-4.8%, -4.8%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -4.8% [-4.8%, -4.8%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.7% [5.7%, 5.7%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.1% [-2.1%, -2.1%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 676.356s -> 677.304s (0.14%)
Artifact size: 316.06 MiB -> 316.15 MiB (0.03%)

bors added a commit to rust-lang-ci/rust that referenced this pull request May 23, 2024
…r=jackh726

Remove more `#[macro_use] extern crate tracing`

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via `#[macro_use]`. Continuing the work from rust-lang#124511 and rust-lang#124914.

r? `@jackh726`
bors added a commit to rust-lang/miri that referenced this pull request May 26, 2024
avoid using macro_use

This is the Miri version of rust-lang/rust#124914
RalfJung pushed a commit to RalfJung/rust that referenced this pull request Jun 9, 2024
avoid using macro_use

This is the Miri version of rust-lang#124914
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Aug 31, 2024
…g-4, r=jieyouxu

Remove `#[macro_use] extern crate tracing`, round 4

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from rust-lang#124511, rust-lang#124914, and rust-lang#125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately.

r? `@jieyouxu`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 31, 2024
…g-4, r=jieyouxu

Remove `#[macro_use] extern crate tracing`, round 4

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from rust-lang#124511, rust-lang#124914, and rust-lang#125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately.

r? ``@jieyouxu``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 31, 2024
…g-4, r=jieyouxu

Remove `#[macro_use] extern crate tracing`, round 4

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from rust-lang#124511, rust-lang#124914, and rust-lang#125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately.

r? ```@jieyouxu```
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 31, 2024
Rollup merge of rust-lang#129767 - nnethercote:rm-extern-crate-tracing-4, r=jieyouxu

Remove `#[macro_use] extern crate tracing`, round 4

Because explicit importing of macros via use items is nicer (more standard and readable) than implicit importing via #[macro_use]. Continuing the work from rust-lang#124511, rust-lang#124914, and rust-lang#125434. After this PR no `rustc_*` crates use `#[macro_use] extern crate tracing` except for `rustc_codegen_gcc` which is a special case and I will do separately.

r? ```@jieyouxu```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) merged-by-bors This PR was explicitly merged by bors. 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants