Add note when inherent impl for a alias type defined outside of the crate#142415
Add note when inherent impl for a alias type defined outside of the crate#142415rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Conversation
tests/ui/incoherent-inherent-impls/insufficient-suggestion-issue-141679.stderr
Show resolved
Hide resolved
tests/ui/incoherent-inherent-impls/insufficient-suggestion-issue-141679.stderr
Show resolved
Hide resolved
|
r? compiler |
|
do you not get TyKind::Alias when you use type_of on the impl? coherence is probably fine to use middle queries |
There was a problem hiding this comment.
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?
|
r? compiler |
|
Only under the experimental feature |
This comment has been minimized.
This comment has been minimized.
|
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. |
|
@estebank I have rebased and fix the nits. CI green. Sorry for late response. |
|
@bors r+ |
Add note when inherent impl for a alias type defined outside of the crate Fixes rust-lang#141679 r? compiler
Add note when inherent impl for a alias type defined outside of the crate Fixes rust-lang#141679 r? compiler
Add note when inherent impl for a alias type defined outside of the crate Fixes rust-lang#141679 r? compiler
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`)
Fixes #141679
r? compiler