Skip to content

resolve: Split extern prelude into two scopes #144793

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

petrochenkov
Copy link
Contributor

(Based on #144746.)

One scope for extern crate items and another for --extern options, with the former shadowing the latter.

If in a single scope some things can overwrite other things, especially with ad hoc restrictions like MacroExpandedExternCrateCannotShadowExternArguments, then it's not really a single scope.
So this PR splits Scope::ExternPrelude into two cleaner scopes.

@rustbot
Copy link
Collaborator

rustbot commented Aug 1, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot

This comment was marked as resolved.

@rustbot
Copy link
Collaborator

rustbot commented Aug 1, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@petrochenkov
Copy link
Contributor Author

Blocked on #144746.
@rustbot blocked

@petrochenkov
Copy link
Contributor Author

@bors2 try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors
Copy link

rust-bors bot commented Aug 1, 2025

⌛ Trying commit 4d377d2 with merge 7203fa8

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 1, 2025
resolve: Split extern prelude into two scopes
@rustbot
Copy link
Collaborator

rustbot commented Aug 1, 2025

Unknown labels: S-waiting-on-perf

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Doc-tests core
error[E0152]: found duplicate lang item `contract_build_check_ensures`
##[error]  --> library/core/src/contracts.rs:19:1
   |
19 | / pub const fn build_check_ensures<Ret, C>(cond: C) -> C
20 | | where
21 | |     C: Fn(&Ret) -> bool + Copy + 'static,
...  |
24 | | }
   | |_^
   |
   = note: the lang item is first defined in crate `core` (which `core` depends on)
---
For more information about this error, try `rustc --explain E0152`.
error: doctest failed, to rerun pass `-p core --doc`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustdoc --edition=2024 --crate-type lib --color always --crate-name core --test library/core/src/lib.rs --test-run-directory /checkout/library/core --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/build/compiler_builtins-e43834dc7c3c3c13/out --test-args -Z --test-args unstable-options --test-args --format --test-args json --warn=unexpected_cfgs --check-cfg 'cfg(no_fp_fmt_parse)' --check-cfg 'cfg(feature, values(any()))' --check-cfg 'cfg(target_has_reliable_f16)' --check-cfg 'cfg(target_has_reliable_f16_math)' --check-cfg 'cfg(target_has_reliable_f128)' --check-cfg 'cfg(target_has_reliable_f128_math)' --extern core=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps/libcore-85b2aeac0441a9c6.rlib -C embed-bitcode=no --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("debug_refcell", "optimize_for_size", "panic_immediate_abort"))' -Csymbol-mangling-version=legacy '--check-cfg=cfg(feature,values(any()))' -Zunstable-options -Dwarnings '-Wrustdoc::invalid_codeblock_attributes' --crate-version '1.90.0-nightly (900ef8094 2025-08-01)' '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/nightly/")' '-Zcrate-attr=warn(rust_2018_idioms)' --error-format human` (exit status: 1)
note: test exited abnormally; to see the full output pass --nocapture to the harness.
Build completed unsuccessfully in 0:06:01
  local time: Fri Aug  1 19:50:11 UTC 2025
  network time: Fri, 01 Aug 2025 19:50:11 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@Urgau Urgau added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 1, 2025
@rust-bors
Copy link

rust-bors bot commented Aug 1, 2025

☀️ Try build successful (CI)
Build commit: 7203fa8 (7203fa84a1f9a0aa515efc5f680f761ea01d95fc, parent: 4b55fe199cfe9c710555a5af7f2a49491ad38254)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7203fa8): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.2%] 5
Regressions ❌
(secondary)
0.1% [0.0%, 0.2%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.1%, 0.2%] 5

Max RSS (memory usage)

Results (primary 2.0%, secondary -3.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.0% [2.0%, 2.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.3% [-4.2%, -2.4%] 2
All ❌✅ (primary) 2.0% [2.0%, 2.0%] 1

Cycles

Results (secondary 0.7%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
3.9% [2.9%, 4.4%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.1% [-5.2%, -3.0%] 2
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 467.125s -> 467.279s (0.03%)
Artifact size: 376.83 MiB -> 376.88 MiB (0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Aug 1, 2025
@petrochenkov petrochenkov 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-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
perf-regression Performance regression. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

6 participants