Auto merge of #105348 - JohnTitor:rollup-q9bichr, r=JohnTitor
Rollup of 10 pull requests Successful merges: - #104967 (Fix UI issues with Rustdoc scrape-examples feature.) - #105207 (interpret: clobber return place when calling function) - #105246 (Fix --pass in compiletest) - #105256 (Add small comment explaining what `method-margins.goml` test is about) - #105289 (Fix dupe word typos) - #105309 (rustdoc: remove no-op mobile CSS `.sidebar { margin: 0; padding: 0 }`) - #105313 (Update books) - #105315 (Normalize inherent associated types after substitution) - #105324 (Point at GAT `where` clause when an obligation is unsatisfied) - #105338 (Tweak "the following other types implement trait") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
c5351ad4dc
52 changed files with 285 additions and 426 deletions
|
@ -240,7 +240,7 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
|
|||
let align = ImmTy::from_uint(target_align, args[1].layout).into();
|
||||
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty())?;
|
||||
|
||||
// We replace the entire entire function call with a "tail call".
|
||||
// We replace the entire function call with a "tail call".
|
||||
// Note that this happens before the frame of the original function
|
||||
// is pushed on the stack.
|
||||
self.eval_fn_call(
|
||||
|
|
|
@ -676,6 +676,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
|||
return_to_block: StackPopCleanup,
|
||||
) -> InterpResult<'tcx> {
|
||||
trace!("body: {:#?}", body);
|
||||
// Clobber previous return place contents, nobody is supposed to be able to see them any more
|
||||
// This also checks dereferenceable, but not align. We rely on all constructed places being
|
||||
// sufficiently aligned (in particular we rely on `deref_operand` checking alignment).
|
||||
self.write_uninit(return_place)?;
|
||||
// first push a stack frame so we have access to the local substs
|
||||
let pre_frame = Frame {
|
||||
body,
|
||||
|
|
|
@ -1930,6 +1930,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
adt_substs,
|
||||
);
|
||||
let ty = tcx.bound_type_of(assoc_ty_did).subst(tcx, item_substs);
|
||||
let ty = self.normalize_ty(span, ty);
|
||||
return Ok((ty, DefKind::AssocTy, assoc_ty_did));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -406,7 +406,7 @@ impl<V: Clone> Clone for StateData<V> {
|
|||
/// The dataflow state for an instance of [`ValueAnalysis`].
|
||||
///
|
||||
/// Every instance specifies a lattice that represents the possible values of a single tracked
|
||||
/// place. If we call this lattice `V` and set set of tracked places `P`, then a [`State`] is an
|
||||
/// place. If we call this lattice `V` and set of tracked places `P`, then a [`State`] is an
|
||||
/// element of `{unreachable} ∪ (P -> V)`. This again forms a lattice, where the bottom element is
|
||||
/// `unreachable` and the top element is the mapping `p ↦ ⊤`. Note that the mapping `p ↦ ⊥` is not
|
||||
/// the bottom element (because joining an unreachable and any other reachable state yields a
|
||||
|
|
|
@ -1927,7 +1927,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
|
|||
// We have a single lifetime => success.
|
||||
elision_lifetime = Elision::Param(res)
|
||||
} else {
|
||||
// We have have multiple lifetimes => error.
|
||||
// We have multiple lifetimes => error.
|
||||
elision_lifetime = Elision::Err;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1810,7 +1810,8 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
&self,
|
||||
trait_pred: ty::PolyTraitPredicate<'tcx>,
|
||||
) -> Vec<ImplCandidate<'tcx>> {
|
||||
self.tcx
|
||||
let mut candidates: Vec<_> = self
|
||||
.tcx
|
||||
.all_impls(trait_pred.def_id())
|
||||
.filter_map(|def_id| {
|
||||
if self.tcx.impl_polarity(def_id) == ty::ImplPolarity::Negative
|
||||
|
@ -1826,7 +1827,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
self.fuzzy_match_tys(trait_pred.skip_binder().self_ty(), imp.self_ty(), false)
|
||||
.map(|similarity| ImplCandidate { trait_ref: imp, similarity })
|
||||
})
|
||||
.collect()
|
||||
.collect();
|
||||
if candidates.iter().any(|c| matches!(c.similarity, CandidateSimilarity::Exact { .. })) {
|
||||
// If any of the candidates is a perfect match, we don't want to show all of them.
|
||||
// This is particularly relevant for the case of numeric types (as they all have the
|
||||
// same cathegory).
|
||||
candidates.retain(|c| matches!(c.similarity, CandidateSimilarity::Exact { .. }));
|
||||
}
|
||||
candidates
|
||||
}
|
||||
|
||||
fn report_similar_impl_candidates(
|
||||
|
|
|
@ -2321,11 +2321,10 @@ fn assoc_ty_own_obligations<'cx, 'tcx>(
|
|||
nested: &mut Vec<PredicateObligation<'tcx>>,
|
||||
) {
|
||||
let tcx = selcx.tcx();
|
||||
for predicate in tcx
|
||||
let own = tcx
|
||||
.predicates_of(obligation.predicate.item_def_id)
|
||||
.instantiate_own(tcx, obligation.predicate.substs)
|
||||
.predicates
|
||||
{
|
||||
.instantiate_own(tcx, obligation.predicate.substs);
|
||||
for (predicate, span) in std::iter::zip(own.predicates, own.spans) {
|
||||
let normalized = normalize_with_depth_to(
|
||||
selcx,
|
||||
obligation.param_env,
|
||||
|
@ -2334,9 +2333,30 @@ fn assoc_ty_own_obligations<'cx, 'tcx>(
|
|||
predicate,
|
||||
nested,
|
||||
);
|
||||
|
||||
let nested_cause = if matches!(
|
||||
obligation.cause.code(),
|
||||
super::CompareImplItemObligation { .. }
|
||||
| super::CheckAssociatedTypeBounds { .. }
|
||||
| super::AscribeUserTypeProvePredicate(..)
|
||||
) {
|
||||
obligation.cause.clone()
|
||||
} else if span.is_dummy() {
|
||||
ObligationCause::new(
|
||||
obligation.cause.span,
|
||||
obligation.cause.body_id,
|
||||
super::ItemObligation(obligation.predicate.item_def_id),
|
||||
)
|
||||
} else {
|
||||
ObligationCause::new(
|
||||
obligation.cause.span,
|
||||
obligation.cause.body_id,
|
||||
super::BindingObligation(obligation.predicate.item_def_id, span),
|
||||
)
|
||||
};
|
||||
nested.push(Obligation::with_depth(
|
||||
tcx,
|
||||
obligation.cause.clone(),
|
||||
nested_cause,
|
||||
obligation.recursion_depth + 1,
|
||||
obligation.param_env,
|
||||
normalized,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue