Skip to content

Create definitions for promoted constants.#155898

Draft
cjgillot wants to merge 9 commits intorust-lang:mainfrom
cjgillot:feed-promoted
Draft

Create definitions for promoted constants.#155898
cjgillot wants to merge 9 commits intorust-lang:mainfrom
cjgillot:feed-promoted

Conversation

@cjgillot
Copy link
Copy Markdown
Contributor

@cjgillot cjgillot commented Apr 28, 2026

Reopening #111693

The current handling of promoted carries an Option<Promoted> everywhere to disambiguate the normal item from the constant.

This PR replaces the promoted constants by new definitions with new DefKind::Promoted.
This method allows to unify borrow-checking with the code path for inline consts.

Requires #155777 if we want decent perf

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. 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. labels Apr 28, 2026
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[endgroup]
Executing "/scripts/stage_2_test_set1.sh"
+ /scripts/stage_2_test_set1.sh
+ '[' 1 == 1 ']'
+ echo 'PR_CI_JOB set; skipping tidy'
+ SKIP_TIDY='--skip tidy'
+ ../x.py --stage 2 test --skip tidy --skip compiler --skip src
PR_CI_JOB set; skipping tidy
##[group]Building bootstrap
    Finished `dev` profile [unoptimized] target(s) in 0.04s
##[endgroup]
---

---- [incremental] tests/incremental/hashes/for_loops.rs stdout ----
------rustc stdout------------------------------

------rustc stderr------------------------------
{"$message_type":"diagnostic","message":"dep-node label `promoted_mir` not recognized","code":null,"level":"error","spans":[{"file_name":"/checkout/tests/incremental/hashes/for_loops.rs","byte_start":2794,"byte_end":2829,"line_start":107,"line_end":107,"column_start":36,"column_end":71,"is_primary":true,"text":[{"text":"#[rustc_clean(cfg=\"bpass2\", except=\"opt_hir_owner_nodes, promoted_mir\")]","highlight_start":36,"highlight_end":71}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: dep-node label `promoted_mir` not recognized\n  --> /checkout/tests/incremental/hashes/for_loops.rs:107:36\n   |\nLL | #[rustc_clean(cfg=\"bpass2\", except=\"opt_hir_owner_nodes, promoted_mir\")]\n   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
{"$message_type":"diagnostic","message":"aborting due to 1 previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 1 previous error\n\n"}

------------------------------------------

error in revision `bpass2`: compilation failed!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/incremental/hashes/for_loops.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--cfg" "bpass2" "--check-cfg" "cfg(test,FALSE,bpass1,bpass2,bpass3,bpass4,bpass5,bpass6)" "-C" "incremental=/checkout/obj/build/aarch64-unknown-linux-gnu/test/incremental/hashes/for_loops/for_loops.inc" "-Z" "incremental-verify-ich" "-O" "--error-format" "json" "--json" "future-incompat" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/incremental/hashes/for_loops" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-O" "-Zincremental-ignore-spans"
stdout: none
--- stderr -------------------------------
error: dep-node label `promoted_mir` not recognized
##[error]  --> /checkout/tests/incremental/hashes/for_loops.rs:107:36
   |
LL | #[rustc_clean(cfg="bpass2", except="opt_hir_owner_nodes, promoted_mir")]
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error
------------------------------------------

---- [incremental] tests/incremental/hashes/for_loops.rs stdout end ----
---- [incremental] tests/incremental/hashes/inherent_impls.rs stdout ----
------rustc stdout------------------------------

------rustc stderr------------------------------
{"$message_type":"diagnostic","message":"dep-node label `promoted_mir` not recognized","code":null,"level":"error","spans":[{"file_name":"/checkout/tests/incremental/hashes/inherent_impls.rs","byte_start":2004,"byte_end":2064,"line_start":60,"line_end":60,"column_start":39,"column_end":99,"is_primary":true,"text":[{"text":"    #[rustc_clean(cfg=\"bpass2\",except=\"opt_hir_owner_nodes,optimized_mir,promoted_mir,typeck_root\")]","highlight_start":39,"highlight_end":99}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":"error: dep-node label `promoted_mir` not recognized\n  --> /checkout/tests/incremental/hashes/inherent_impls.rs:60:39\n   |\nLL |     #[rustc_clean(cfg=\"bpass2\",except=\"opt_hir_owner_nodes,optimized_mir,promoted_mir,typeck_root\")]\n   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"}
{"$message_type":"diagnostic","message":"aborting due to 1 previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 1 previous error\n\n"}

------------------------------------------

error in revision `bpass2`: compilation failed!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/incremental/hashes/inherent_impls.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--cfg" "bpass2" "--check-cfg" "cfg(test,FALSE,bpass1,bpass2,bpass3,bpass4,bpass5,bpass6)" "-C" "incremental=/checkout/obj/build/aarch64-unknown-linux-gnu/test/incremental/hashes/inherent_impls/inherent_impls.inc" "-Z" "incremental-verify-ich" "-O" "--error-format" "json" "--json" "future-incompat" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/incremental/hashes/inherent_impls" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "incomplete_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024" "-Z" "query-dep-graph" "-O" "-Zincremental-ignore-spans"
stdout: none
--- stderr -------------------------------
error: dep-node label `promoted_mir` not recognized
##[error]  --> /checkout/tests/incremental/hashes/inherent_impls.rs:60:39
   |
LL |     #[rustc_clean(cfg="bpass2",except="opt_hir_owner_nodes,optimized_mir,promoted_mir,typeck_root")]
   |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error
------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants