Auto merge of #130269 - Zalathar:rollup-coxzt2t, r=Zalathar
Rollup of 8 pull requests Successful merges: - #125060 (Expand documentation of PathBuf, discussing lack of sanitization) - #129367 (Fix default/minimum deployment target for Aarch64 simulator targets) - #130156 (Add test for S_OBJNAME & update test for LF_BUILDINFO cl and cmd) - #130160 (Fix `slice::first_mut` docs) - #130235 (Simplify some nested `if` statements) - #130250 (Fix `clippy::useless_conversion`) - #130252 (Properly report error on `const gen fn`) - #130256 (Re-run coverage tests if `coverage-dump` was modified) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
394c4060d2
90 changed files with 742 additions and 763 deletions
|
@ -1323,23 +1323,21 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
label_or_note(span, terr.to_string(self.tcx));
|
||||
label_or_note(sp, msg);
|
||||
}
|
||||
} else {
|
||||
if let Some(values) = values
|
||||
&& let Some((e, f)) = values.ty()
|
||||
&& let TypeError::ArgumentSorts(..) | TypeError::Sorts(_) = terr
|
||||
{
|
||||
let e = self.tcx.erase_regions(e);
|
||||
let f = self.tcx.erase_regions(f);
|
||||
let expected = with_forced_trimmed_paths!(e.sort_string(self.tcx));
|
||||
let found = with_forced_trimmed_paths!(f.sort_string(self.tcx));
|
||||
if expected == found {
|
||||
label_or_note(span, terr.to_string(self.tcx));
|
||||
} else {
|
||||
label_or_note(span, Cow::from(format!("expected {expected}, found {found}")));
|
||||
}
|
||||
} else {
|
||||
} else if let Some(values) = values
|
||||
&& let Some((e, f)) = values.ty()
|
||||
&& let TypeError::ArgumentSorts(..) | TypeError::Sorts(_) = terr
|
||||
{
|
||||
let e = self.tcx.erase_regions(e);
|
||||
let f = self.tcx.erase_regions(f);
|
||||
let expected = with_forced_trimmed_paths!(e.sort_string(self.tcx));
|
||||
let found = with_forced_trimmed_paths!(f.sort_string(self.tcx));
|
||||
if expected == found {
|
||||
label_or_note(span, terr.to_string(self.tcx));
|
||||
} else {
|
||||
label_or_note(span, Cow::from(format!("expected {expected}, found {found}")));
|
||||
}
|
||||
} else {
|
||||
label_or_note(span, terr.to_string(self.tcx));
|
||||
}
|
||||
|
||||
if let Some((expected, found, path)) = expected_found {
|
||||
|
|
|
@ -3237,16 +3237,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
// then the tuple must be the one containing capture types.
|
||||
let is_upvar_tys_infer_tuple = if !matches!(ty.kind(), ty::Tuple(..)) {
|
||||
false
|
||||
} else if let ObligationCauseCode::BuiltinDerived(data) = &*data.parent_code {
|
||||
let parent_trait_ref = self.resolve_vars_if_possible(data.parent_trait_pred);
|
||||
let nested_ty = parent_trait_ref.skip_binder().self_ty();
|
||||
matches!(nested_ty.kind(), ty::Coroutine(..))
|
||||
|| matches!(nested_ty.kind(), ty::Closure(..))
|
||||
} else {
|
||||
if let ObligationCauseCode::BuiltinDerived(data) = &*data.parent_code {
|
||||
let parent_trait_ref =
|
||||
self.resolve_vars_if_possible(data.parent_trait_pred);
|
||||
let nested_ty = parent_trait_ref.skip_binder().self_ty();
|
||||
matches!(nested_ty.kind(), ty::Coroutine(..))
|
||||
|| matches!(nested_ty.kind(), ty::Closure(..))
|
||||
} else {
|
||||
false
|
||||
}
|
||||
false
|
||||
};
|
||||
|
||||
if !is_upvar_tys_infer_tuple {
|
||||
|
|
|
@ -408,7 +408,7 @@ pub(super) fn opt_normalize_projection_term<'a, 'b, 'tcx>(
|
|||
debug!("opt_normalize_projection_type: found error");
|
||||
let result = normalize_to_error(selcx, param_env, projection_term, cause, depth);
|
||||
obligations.extend(result.obligations);
|
||||
return Ok(Some(result.value.into()));
|
||||
return Ok(Some(result.value));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ pub(super) fn opt_normalize_projection_term<'a, 'b, 'tcx>(
|
|||
}
|
||||
let result = normalize_to_error(selcx, param_env, projection_term, cause, depth);
|
||||
obligations.extend(result.obligations);
|
||||
Ok(Some(result.value.into()))
|
||||
Ok(Some(result.value))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -426,13 +426,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
} else if kind == ty::ClosureKind::FnOnce {
|
||||
candidates.vec.push(ClosureCandidate { is_const });
|
||||
}
|
||||
} else if kind == ty::ClosureKind::FnOnce {
|
||||
candidates.vec.push(ClosureCandidate { is_const });
|
||||
} else {
|
||||
if kind == ty::ClosureKind::FnOnce {
|
||||
candidates.vec.push(ClosureCandidate { is_const });
|
||||
} else {
|
||||
// This stays ambiguous until kind+upvars are determined.
|
||||
candidates.ambiguous = true;
|
||||
}
|
||||
// This stays ambiguous until kind+upvars are determined.
|
||||
candidates.ambiguous = true;
|
||||
}
|
||||
}
|
||||
ty::Infer(ty::TyVar(_)) => {
|
||||
|
@ -513,10 +511,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
// then there's nothing else to check.
|
||||
if let Some(closure_kind) = self_ty.to_opt_closure_kind()
|
||||
&& let Some(goal_kind) = target_kind_ty.to_opt_closure_kind()
|
||||
&& closure_kind.extends(goal_kind)
|
||||
{
|
||||
if closure_kind.extends(goal_kind) {
|
||||
candidates.vec.push(AsyncFnKindHelperCandidate);
|
||||
}
|
||||
candidates.vec.push(AsyncFnKindHelperCandidate);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1334,16 +1334,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
return;
|
||||
}
|
||||
|
||||
if self.can_use_global_caches(param_env) {
|
||||
if !trait_pred.has_infer() {
|
||||
debug!(?trait_pred, ?result, "insert_evaluation_cache global");
|
||||
// This may overwrite the cache with the same value
|
||||
// FIXME: Due to #50507 this overwrites the different values
|
||||
// This should be changed to use HashMapExt::insert_same
|
||||
// when that is fixed
|
||||
self.tcx().evaluation_cache.insert((param_env, trait_pred), dep_node, result);
|
||||
return;
|
||||
}
|
||||
if self.can_use_global_caches(param_env) && !trait_pred.has_infer() {
|
||||
debug!(?trait_pred, ?result, "insert_evaluation_cache global");
|
||||
// This may overwrite the cache with the same value
|
||||
// FIXME: Due to #50507 this overwrites the different values
|
||||
// This should be changed to use HashMapExt::insert_same
|
||||
// when that is fixed
|
||||
self.tcx().evaluation_cache.insert((param_env, trait_pred), dep_node, result);
|
||||
return;
|
||||
}
|
||||
|
||||
debug!(?trait_pred, ?result, "insert_evaluation_cache");
|
||||
|
@ -1584,13 +1582,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
if self.can_use_global_caches(param_env) {
|
||||
if let Err(Overflow(OverflowError::Canonical)) = candidate {
|
||||
// Don't cache overflow globally; we only produce this in certain modes.
|
||||
} else if !pred.has_infer() {
|
||||
if !candidate.has_infer() {
|
||||
debug!(?pred, ?candidate, "insert_candidate_cache global");
|
||||
// This may overwrite the cache with the same value.
|
||||
tcx.selection_cache.insert((param_env, pred), dep_node, candidate);
|
||||
return;
|
||||
}
|
||||
} else if !pred.has_infer() && !candidate.has_infer() {
|
||||
debug!(?pred, ?candidate, "insert_candidate_cache global");
|
||||
// This may overwrite the cache with the same value.
|
||||
tcx.selection_cache.insert((param_env, pred), dep_node, candidate);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1980,10 +1976,10 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
|||
// impls have to be always applicable, meaning that the only allowed
|
||||
// region constraints may be constraints also present on the default impl.
|
||||
let tcx = self.tcx();
|
||||
if other.evaluation.must_apply_modulo_regions() {
|
||||
if tcx.specializes((other_def, victim_def)) {
|
||||
return DropVictim::Yes;
|
||||
}
|
||||
if other.evaluation.must_apply_modulo_regions()
|
||||
&& tcx.specializes((other_def, victim_def))
|
||||
{
|
||||
return DropVictim::Yes;
|
||||
}
|
||||
|
||||
match tcx.impls_are_allowed_to_overlap(other_def, victim_def) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue