Auto merge of #120619 - compiler-errors:param, r=lcnr
Assert that params with the same *index* have the same *name* Found this bug when trying to build libcore with the new solver, since it will canonicalize two params with the same index into *different* placeholders if those params differ by name.
This commit is contained in:
commit
70a8dc7d39
@ -131,7 +131,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
|
||||
// only when assigning `... = Default::default()`
|
||||
&& is_expr_default(expr, cx)
|
||||
&& let binding_type = cx.typeck_results().node_type(binding_id)
|
||||
&& let Some(adt) = binding_type.ty_adt_def()
|
||||
&& let ty::Adt(adt, args) = *binding_type.kind()
|
||||
&& adt.is_struct()
|
||||
&& let variant = adt.non_enum_variant()
|
||||
&& (adt.did().is_local() || !variant.is_field_list_non_exhaustive())
|
||||
@ -144,7 +144,7 @@ impl<'tcx> LateLintPass<'tcx> for Default {
|
||||
.fields
|
||||
.iter()
|
||||
.all(|field| {
|
||||
is_copy(cx, cx.tcx.type_of(field.did).instantiate_identity())
|
||||
is_copy(cx, cx.tcx.type_of(field.did).instantiate(cx.tcx, args))
|
||||
})
|
||||
&& (!has_drop(cx, binding_type) || all_fields_are_copy)
|
||||
{
|
||||
|
@ -86,7 +86,6 @@ fn into_iter_bound<'tcx>(
|
||||
param_index: u32,
|
||||
node_args: GenericArgsRef<'tcx>,
|
||||
) -> Option<Span> {
|
||||
let param_env = cx.tcx.param_env(fn_did);
|
||||
let mut into_iter_span = None;
|
||||
|
||||
for (pred, span) in cx.tcx.explicit_predicates_of(fn_did).predicates {
|
||||
@ -111,7 +110,7 @@ fn into_iter_bound<'tcx>(
|
||||
}));
|
||||
|
||||
let predicate = EarlyBinder::bind(tr).instantiate(cx.tcx, args);
|
||||
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), param_env, predicate);
|
||||
let obligation = Obligation::new(cx.tcx, ObligationCause::dummy(), cx.param_env, predicate);
|
||||
if !cx
|
||||
.tcx
|
||||
.infer_ctxt()
|
||||
|
Loading…
x
Reference in New Issue
Block a user