Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
da9bbc4
fix ICE when confirming invalid dyn method receivers
amirHdev Nov 12, 2026
389aedd
Remove outdated clang selection workaround for Clang 18
jieyouxu Nov 15, 2026
118cd80
Add examples to Allocator methods
whiplashvin Nov 18, 2026
62368a0
use delayed bug recovery for invalid object receivers
amirHdev Nov 18, 2026
6e767d1
Point at trait is implemented but private
estebank Nov 13, 2026
f764c8c
Point at method even when available through autoderef
estebank Nov 13, 2026
34409f4
Use note instead of label when pointing at available method
estebank Nov 13, 2026
eb545c5
Point at `impl` where method is available
estebank Nov 13, 2026
4d86056
Remove `#[allow(missing_docs)]` where possible
GuillaumeGomez Nov 18, 2026
fec604a
Fix `x86_64-gnu-parallel-frontend` link
JonathanBrouwer Nov 18, 2026
f0bc5bf
Ignore `cycle-guaranteed-unsized-self-type-116914.rs` on parallel fro…
JonathanBrouwer Nov 18, 2026
4c3b915
Rollup merge of #165943 - estebank:issue-37629, r=mati865
Zalathar Nov 19, 2026
248b441
Rollup merge of #165321 - whiplashvin:allocator-method-examples, r=tg…
Zalathar Nov 19, 2026
acb4529
Rollup merge of #165851 - amirHdev:objectpick-invalid-receiver-recove…
Zalathar Nov 19, 2026
c321edb
Rollup merge of #165991 - jieyouxu:jieyouxu/cleanup/remove-outdated-w…
Zalathar Nov 19, 2026
190fe33
Rollup merge of #166146 - GuillaumeGomez:rm-missing_docs, r=clarfonthey
Zalathar Nov 19, 2026
2b1e311
Rollup merge of #166165 - JonathanBrouwer:parallel-ci, r=jieyouxu
Zalathar Nov 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 41 additions & 27 deletions compiler/rustc_hir_typeck/src/method/confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,27 +333,32 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
return ty::GenericArgs::extend_with_error(self.tcx, trait_def_id, &[]);
}

self.extract_existential_trait_ref(self_ty, |this, object_ty, principal| {
// The object data has no entry for the Self
// Type. For the purposes of this method call, we
// instantiate the object type itself. This
// wouldn't be a sound instantiation in all cases,
// since each instance of the object type is a
// different existential and hence could match
// distinct types (e.g., if `Self` appeared as an
// argument type), but those cases have already
// been ruled out when we deemed the trait to be
// "dyn-compatible".
let original_poly_trait_ref = principal.with_self_ty(this.tcx, object_ty);
let upcast_poly_trait_ref = this.upcast(original_poly_trait_ref, trait_def_id);
let upcast_trait_ref =
this.instantiate_binder_with_fresh_vars(upcast_poly_trait_ref);
debug!(
"original_poly_trait_ref={:?} upcast_trait_ref={:?} target_trait={:?}",
original_poly_trait_ref, upcast_trait_ref, trait_def_id
);
upcast_trait_ref.args
})
self.extract_existential_trait_ref(
self_ty,
trait_def_id,
|this, object_ty, principal| {
// The object data has no entry for the Self
// Type. For the purposes of this method call, we
// instantiate the object type itself. This
// wouldn't be a sound instantiation in all cases,
// since each instance of the object type is a
// different existential and hence could match
// distinct types (e.g., if `Self` appeared as an
// argument type), but those cases have already
// been ruled out when we deemed the trait to be
// "dyn-compatible".
let original_poly_trait_ref = principal.with_self_ty(this.tcx, object_ty);
let upcast_poly_trait_ref =
this.upcast(original_poly_trait_ref, trait_def_id);
let upcast_trait_ref =
this.instantiate_binder_with_fresh_vars(upcast_poly_trait_ref);
debug!(
"original_poly_trait_ref={:?} upcast_trait_ref={:?} target_trait={:?}",
original_poly_trait_ref, upcast_trait_ref, trait_def_id
);
upcast_trait_ref.args
},
)
}

probe::TraitPick { .. } => {
Expand All @@ -375,9 +380,18 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
}
}

fn extract_existential_trait_ref<R, F>(&mut self, self_ty: Ty<'tcx>, mut closure: F) -> R
fn extract_existential_trait_ref<F>(
&mut self,
self_ty: Ty<'tcx>,
trait_def_id: DefId,
mut closure: F,
) -> GenericArgs<'tcx>
where
F: FnMut(&mut ConfirmContext<'a, 'tcx>, Ty<'tcx>, ty::PolyExistentialTraitRef<'tcx>) -> R,
F: FnMut(
&mut ConfirmContext<'a, 'tcx>,
Ty<'tcx>,
ty::PolyExistentialTraitRef<'tcx>,
) -> GenericArgs<'tcx>,
{
// If we specified that this is an object method, then the
// self-type ought to be something that can be dereferenced to
Expand Down Expand Up @@ -407,11 +421,11 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
_ => None,
})
.unwrap_or_else(|| {
span_bug!(
self.dcx().span_delayed_bug(
self.span,
"self-type `{}` for ObjectPick never dereferenced to an object",
self_ty
)
format!("self-type `{self_ty}` for ObjectPick never dereferenced to an object"),
);
ty::GenericArgs::extend_with_error(self.tcx, trait_def_id, &[])
})
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/method/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,7 @@ impl<'tcx> Pick<'tcx> {
// the code from `report_method_error()`.
lint.help(format!(
"call with fully qualified syntax `{}(...)` to keep using the current \
method",
method",
tcx.def_path_str(this.item.def_id),
));
}
Expand Down
Loading
Loading