Skip to content

Conversation

@xizheyin
Copy link
Member

@xizheyin xizheyin commented Jun 12, 2025

Fixes #141679

r? compiler

@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 Jun 12, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Jun 23, 2025

r? compiler

@rustbot rustbot assigned lcnr and unassigned BoxyUwU Jun 23, 2025
@rustbot rustbot 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 Jul 16, 2025
Copy link
Member Author

@xizheyin xizheyin left a comment

Choose a reason for hiding this comment

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

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 20, 2025
@fee1-dead
Copy link
Member

do you not get TyKind::Alias when you use type_of on the impl? coherence is probably fine to use middle queries

Copy link
Member Author

@xizheyin xizheyin left a comment

Choose a reason for hiding this comment

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

I've tried using type_of before, but I don't seem to be getting the information I'm looking for. When I try this code

            let ty = self.tcx.type_of(impl_def_id).skip_binder();
            if let ty::Adt(def, _) = ty.kind() {
                let def_id = def.did();
                let ty_name = self.tcx.def_path_str(def_id);
                let alias_ty_name = self.tcx.type_of(def_id).skip_binder().to_string();
                println!("ty_name: {:?}", ty_name);
                println!("alias_ty_name: {:?}", alias_ty_name);
            }

it prints:

ty_name: "Rc"
alias_ty_name: "Rc<T, A>"

It should be:

ty_name: "Function"
alias_ty_name: "Rc<Foo>"

Local variable ty is a adt of type Rc. Maybe the information we need only exists in HIR? Or am I using it wrong?

@compiler-errors
Copy link
Contributor

r? compiler

@fmease
Copy link
Member

fmease commented Aug 16, 2025

Only under the experimental feature lazy_type_alias do we represent aliases in middle::ty IR, that's why type_of returns the expanded form (it gets expanded during HIR ty lowering for eager type aliases).

@fmease fmease self-assigned this Oct 22, 2025
Copy link
Contributor

@estebank estebank left a comment

Choose a reason for hiding this comment

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

Let's deal with the structured suggestion later.

r=me after addressing nitpicks

View changes since this review

@fmease fmease assigned estebank and unassigned fmease Dec 12, 2025
@rust-bors

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Feb 9, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@xizheyin
Copy link
Member Author

xizheyin commented Feb 9, 2026

@estebank I have rebased and fix the nits. CI green. Sorry for late response.

@estebank
Copy link
Contributor

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 10, 2026

📌 Commit ed90b35 has been approved by estebank

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 10, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 11, 2026
Add note when inherent impl for a alias type defined outside of the crate

Fixes rust-lang#141679

r? compiler
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 11, 2026
Add note when inherent impl for a alias type defined outside of the crate

Fixes rust-lang#141679

r? compiler
Zalathar added a commit to Zalathar/rust that referenced this pull request Feb 12, 2026
Add note when inherent impl for a alias type defined outside of the crate

Fixes rust-lang#141679

r? compiler
rust-bors bot pushed a commit that referenced this pull request Feb 12, 2026
Rollup of 17 pull requests

Successful merges:

 - #142415 (Add note when inherent impl for a alias type defined outside of the crate)
 - #142680 (Fix passing/returning structs with the 64-bit SPARC ABI)
 - #150768 (Don't compute FnAbi for LLVM intrinsics in backends)
 - #151152 (Add FCW for derive helper attributes that will conflict with built-in attributes)
 - #151814 (layout: handle rigid aliases without params)
 - #151863 (Borrowck: simplify diagnostics for placeholders)
 - #152159 (Add note for `?Sized` params in int-ptr casts diag)
 - #152434 (Clarify names of `QueryVTable` functions for "executing" a query)
 - #152478 (Remove tm_factory field from CodegenContext)
 - #152498 (Partially revert "resolve: Update `NameBindingData::vis` in place")
 - #152316 (fix: add continue)
 - #152394 (Correctly check if a macro call is actually a macro call in rustdoc highlighter)
 - #152425 (Port #![test_runner] to the attribute parser)
 - #152481 (Use cg_ssa's produce_final_output_artifacts in cg_clif)
 - #152485 (fix issue#152482)
 - #152495 (Clean up some subdiagnostics)
 - #152502 (Implement `BinaryHeap::from_raw_vec`)
@rust-bors rust-bors bot merged commit c509454 into rust-lang:main Feb 12, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Feb 12, 2026
Rollup merge of #142415 - xizheyin:141679, r=estebank

Add note when inherent impl for a alias type defined outside of the crate

Fixes #141679

r? compiler
@xizheyin xizheyin deleted the 141679 branch February 12, 2026 10:37
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.

error message for inherent impl on type that is external could be more explanatory

9 participants