Skip to content

Handle ReEarlyParam in type_name. #145700

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

Merged
merged 1 commit into from
Aug 22, 2025
Merged

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Aug 21, 2025

Fixes #145696.

r? @lcnr

@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 21, 2025
@rustbot
Copy link
Collaborator

rustbot commented Aug 21, 2025

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@rustbot
Copy link
Collaborator

rustbot commented Aug 21, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@nnethercote
Copy link
Contributor Author

Not printing the '_ in this case seems best, because having '_ in type_name_basic::main::Wrap<&'_ ()>::get::Info doesn't seem useful.

@lcnr
Copy link
Contributor

lcnr commented Aug 21, 2025

I really dislike that we're printing the path with generic arguments in typenum/during symbol mangling :<

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Aug 21, 2025

📌 Commit 95b3b61 has been approved by lcnr

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 Aug 21, 2025
@nnethercote
Copy link
Contributor Author

I really dislike that we're printing the path with generic arguments in typenum/during symbol mangling :<

What output would you prefer for the new example?

@lcnr
Copy link
Contributor

lcnr commented Aug 21, 2025

What output would you prefer for the new example?

I don't have a strong opinion about the output. I would like printing type names (and more importantly symbol mangling), to not support generic parameters. This may allow us to accidentally print/mangle generic symbols which is very :<

We do this only for items defined in impls, and i feel like just printing module_name::{impl#n}::Info would be better. We already do this for closures i think?

use std::any::Any;
use std::any::type_name_of_val;

fn main() {
    struct Wrap<T>(T);
    impl Wrap<&()> {
        fn get(&self) -> impl Any {
            let c_0 = || {
                struct Info;
                Info
            };
            let c_1 = || {
                struct Info;
                Info
            };
            (c_0(), c_1())
        }
    }
    let a = Wrap(&()).get();
    println!("{}", type_name_of_val(&a));
}

I feel like ideally this would print

(main::{impl#0}::get::{{closure#0}}::Info, main::{impl#0}::get::{{closure#1}}::Info)

bors added a commit that referenced this pull request Aug 21, 2025
Rollup of 16 pull requests

Successful merges:

 - #137494 (libstd: init(): dup() subsequent /dev/nulls instead of opening them again)
 - #144541 (c-variadic: multiple ABIs in the same program for arm)
 - #144613 (aarch64-nintendo-switch-freestanding - Enable CPU features that are always available in a live system (crypto instructions, plus explicit NEON).)
 - #144780 (Add a method to dump MIR in the middle of MIR building)
 - #145137 (Consolidate panicking functions in `slice/index.rs`)
 - #145507 (Refactor attribute parsing to improve ergonomics and some diagnostics)
 - #145604 (Gate static closures behind a parser feature)
 - #145648 (Add two tidy dependency checks)
 - #145661 (update some s390x codegen tests)
 - #145672 (Instantiate higher-ranked binder with erased when checking `IntoIterator` predicate for query instability)
 - #145689 (Migrate `panic_unwind` to use `cfg_select!`)
 - #145700 (Handle `ReEarlyParam` in `type_name`.)
 - #145703 (Remove MIPS targets from CI LLVM platforms)
 - #145704 (ci: don't cleanup windows disk)
 - #145705 (remove an `as` cast in prefetch codegen)
 - #145712 (Update outdated link in bound region comments)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cc98a84 into rust-lang:master Aug 22, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Aug 22, 2025
rust-timer added a commit that referenced this pull request Aug 22, 2025
Rollup merge of #145700 - nnethercote:fix-145696, r=lcnr

Handle `ReEarlyParam` in `type_name`.

Fixes #145696.

r? `@lcnr`
@nnethercote nnethercote deleted the fix-145696 branch August 22, 2025 02:48
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 22, 2025
Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#137494 (libstd: init(): dup() subsequent /dev/nulls instead of opening them again)
 - rust-lang/rust#144541 (c-variadic: multiple ABIs in the same program for arm)
 - rust-lang/rust#144613 (aarch64-nintendo-switch-freestanding - Enable CPU features that are always available in a live system (crypto instructions, plus explicit NEON).)
 - rust-lang/rust#144780 (Add a method to dump MIR in the middle of MIR building)
 - rust-lang/rust#145137 (Consolidate panicking functions in `slice/index.rs`)
 - rust-lang/rust#145507 (Refactor attribute parsing to improve ergonomics and some diagnostics)
 - rust-lang/rust#145604 (Gate static closures behind a parser feature)
 - rust-lang/rust#145648 (Add two tidy dependency checks)
 - rust-lang/rust#145661 (update some s390x codegen tests)
 - rust-lang/rust#145672 (Instantiate higher-ranked binder with erased when checking `IntoIterator` predicate for query instability)
 - rust-lang/rust#145689 (Migrate `panic_unwind` to use `cfg_select!`)
 - rust-lang/rust#145700 (Handle `ReEarlyParam` in `type_name`.)
 - rust-lang/rust#145703 (Remove MIPS targets from CI LLVM platforms)
 - rust-lang/rust#145704 (ci: don't cleanup windows disk)
 - rust-lang/rust#145705 (remove an `as` cast in prefetch codegen)
 - rust-lang/rust#145712 (Update outdated link in bound region comments)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE (nightly): panicked at compiler/rustc_const_eval/src/util/type_name.rs:145:18: entered unreachable code
4 participants