1
Fork 0

Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #106347 (More accurate spans for arg removal suggestion)
 - #108057 (Prevent some attributes from being merged with others on reexports)
 - #108090 (`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`)
 - #108092 (note issue for feature(packed_bundled_libs))
 - #108099 (use chars instead of strings where applicable)
 - #108115 (Do not ICE on unmet trait alias bounds)
 - #108125 (Add new people to the compiletest review rotation)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2023-02-16 19:21:02 +00:00
commit 9a7cc6c32f
92 changed files with 677 additions and 558 deletions

View file

@ -82,11 +82,8 @@ impl<'tcx, 'a> GeneratorData<'tcx, 'a> {
upvars.iter().find_map(|(upvar_id, upvar)| {
let upvar_ty = typeck_results.node_type(*upvar_id);
let upvar_ty = infer_context.resolve_vars_if_possible(upvar_ty);
if ty_matches(ty::Binder::dummy(upvar_ty)) {
Some(GeneratorInteriorOrUpvar::Upvar(upvar.span))
} else {
None
}
ty_matches(ty::Binder::dummy(upvar_ty))
.then(|| GeneratorInteriorOrUpvar::Upvar(upvar.span))
})
})
}
@ -770,15 +767,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
obligation.param_env,
real_trait_pred_and_ty,
);
if obligations
let may_hold = obligations
.iter()
.chain([&obligation])
.all(|obligation| self.predicate_may_hold(obligation))
{
Some(steps)
} else {
None
}
.then_some(steps);
may_hold
})
{
if steps > 0 {

View file

@ -523,16 +523,14 @@ fn is_impossible_method(tcx: TyCtxt<'_>, (impl_def_id, trait_item_def_id): (DefI
let mut visitor = ReferencesOnlyParentGenerics { tcx, generics, trait_item_def_id };
let predicates_for_trait = predicates.predicates.iter().filter_map(|(pred, span)| {
if pred.visit_with(&mut visitor).is_continue() {
Some(Obligation::new(
pred.visit_with(&mut visitor).is_continue().then(|| {
Obligation::new(
tcx,
ObligationCause::dummy_with_span(*span),
param_env,
ty::EarlyBinder(*pred).subst(tcx, impl_trait_ref.substs),
))
} else {
None
}
)
})
});
let infcx = tcx.infer_ctxt().ignoring_regions().build();

View file

@ -307,7 +307,7 @@ fn predicate_references_self<'tcx>(
match predicate.kind().skip_binder() {
ty::PredicateKind::Clause(ty::Clause::Trait(ref data)) => {
// In the case of a trait predicate, we can skip the "self" type.
if data.trait_ref.substs[1..].iter().any(has_self_ty) { Some(sp) } else { None }
data.trait_ref.substs[1..].iter().any(has_self_ty).then_some(sp)
}
ty::PredicateKind::Clause(ty::Clause::Projection(ref data)) => {
// And similarly for projections. This should be redundant with
@ -325,7 +325,7 @@ fn predicate_references_self<'tcx>(
//
// This is ALT2 in issue #56288, see that for discussion of the
// possible alternatives.
if data.projection_ty.substs[1..].iter().any(has_self_ty) { Some(sp) } else { None }
data.projection_ty.substs[1..].iter().any(has_self_ty).then_some(sp)
}
ty::PredicateKind::AliasEq(..) => bug!("`AliasEq` not allowed as assumption"),

View file

@ -21,11 +21,7 @@ impl<'tcx> super::QueryTypeOp<'tcx> for DropckOutlives<'tcx> {
tcx: TyCtxt<'tcx>,
key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResponse> {
if trivial_dropck_outlives(tcx, key.value.dropped_ty) {
Some(DropckOutlivesResult::default())
} else {
None
}
trivial_dropck_outlives(tcx, key.value.dropped_ty).then(DropckOutlivesResult::default)
}
fn perform_query(

View file

@ -378,11 +378,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let self_ty = trait_ref.self_ty();
let (trait_desc, self_desc) = with_no_trimmed_paths!({
let trait_desc = trait_ref.print_only_trait_path().to_string();
let self_desc = if self_ty.has_concrete_skeleton() {
Some(self_ty.to_string())
} else {
None
};
let self_desc =
self_ty.has_concrete_skeleton().then(|| self_ty.to_string());
(trait_desc, self_desc)
});
let cause = if let Conflict::Upstream = conflict {

View file

@ -113,7 +113,7 @@ impl<'tcx> ChildrenExt<'tcx> for Children {
// Only report the `Self` type if it has at least
// some outer concrete shell; otherwise, it's
// not adding much information.
self_ty: if self_ty.has_concrete_skeleton() { Some(self_ty) } else { None },
self_ty: self_ty.has_concrete_skeleton().then_some(self_ty),
intercrate_ambiguity_causes: overlap.intercrate_ambiguity_causes,
involves_placeholder: overlap.involves_placeholder,
}