Skip to content

Commit

Permalink
Auto merge of rust-lang#120619 - compiler-errors:param, r=lcnr
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Feb 11, 2024
2 parents 8f00ffc + c8d57e8 commit 70a8dc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
{
Expand Down
3 changes: 1 addition & 2 deletions clippy_lints/src/useless_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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()
Expand Down

0 comments on commit 70a8dc7

Please sign in to comment.