Auto merge of #120980 - matthiaskrgr:rollup-dsjsqql, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - #120765 (Reorder diagnostics API) - #120833 (More internal emit diagnostics cleanups) - #120899 (Gracefully handle non-WF alias in `assemble_alias_bound_candidates_recur`) - #120917 (Remove a bunch of dead parameters in functions) - #120928 (Add test for recently fixed issue) - #120933 (check_consts: fix duplicate errors, make importance consistent) - #120936 (improve `btree_cursors` functions documentation) - #120944 (Check that the ABI of the instance we are inlining is correct) - #120956 (Clean inlined type alias with correct param-env) - #120962 (Add myself to library/std review) - #120972 (fix ICE for deref coercions with type errors) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
b381d3ab27
62 changed files with 805 additions and 790 deletions
|
@ -91,10 +91,6 @@ impl<'a, 'tcx> Iterator for Autoderef<'a, 'tcx> {
|
|||
return None;
|
||||
};
|
||||
|
||||
if new_ty.references_error() {
|
||||
return None;
|
||||
}
|
||||
|
||||
self.state.steps.push((self.state.cur_ty, kind));
|
||||
debug!(
|
||||
"autoderef stage #{:?} is {:?} from {:?}",
|
||||
|
@ -137,6 +133,10 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
|
|||
debug!("overloaded_deref_ty({:?})", ty);
|
||||
let tcx = self.infcx.tcx;
|
||||
|
||||
if ty.references_error() {
|
||||
return None;
|
||||
}
|
||||
|
||||
// <ty as Deref>
|
||||
let trait_ref = ty::TraitRef::new(tcx, tcx.lang_items().deref_trait()?, [ty]);
|
||||
let cause = traits::ObligationCause::misc(self.span, self.body_id);
|
||||
|
|
|
@ -16,7 +16,6 @@ use rustc_index::Idx;
|
|||
use rustc_middle::middle::region::*;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_span::source_map;
|
||||
use rustc_span::Span;
|
||||
|
||||
use super::errs::{maybe_expr_static_mut, maybe_stmt_static_mut};
|
||||
|
||||
|
@ -72,11 +71,7 @@ struct RegionResolutionVisitor<'tcx> {
|
|||
}
|
||||
|
||||
/// Records the lifetime of a local variable as `cx.var_parent`
|
||||
fn record_var_lifetime(
|
||||
visitor: &mut RegionResolutionVisitor<'_>,
|
||||
var_id: hir::ItemLocalId,
|
||||
_sp: Span,
|
||||
) {
|
||||
fn record_var_lifetime(visitor: &mut RegionResolutionVisitor<'_>, var_id: hir::ItemLocalId) {
|
||||
match visitor.cx.var_parent {
|
||||
None => {
|
||||
// this can happen in extern fn declarations like
|
||||
|
@ -210,7 +205,7 @@ fn resolve_pat<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, pat: &'tcx hir
|
|||
|
||||
// If this is a binding then record the lifetime of that binding.
|
||||
if let PatKind::Binding(..) = pat.kind {
|
||||
record_var_lifetime(visitor, pat.hir_id.local_id, pat.span);
|
||||
record_var_lifetime(visitor, pat.hir_id.local_id);
|
||||
}
|
||||
|
||||
debug!("resolve_pat - pre-increment {} pat = {:?}", visitor.expr_and_pat_count, pat);
|
||||
|
|
|
@ -118,9 +118,9 @@ where
|
|||
return Err(err);
|
||||
} else {
|
||||
// HACK(oli-obk): tests/ui/specialization/min_specialization/specialize_on_type_error.rs
|
||||
// causes an error (span_delayed_bug) during normalization, without reporting an error,
|
||||
// so we need to act as if no error happened, in order to let our callers continue and
|
||||
// report an error later in check_impl_items_against_trait.
|
||||
// causes an delayed bug during normalization, without reporting an error, so we need
|
||||
// to act as if no error happened, in order to let our callers continue and report an
|
||||
// error later in check_impl_items_against_trait.
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
@ -1635,6 +1635,12 @@ fn check_method_receiver<'tcx>(
|
|||
let receiver_ty = sig.inputs()[0];
|
||||
let receiver_ty = wfcx.normalize(span, None, receiver_ty);
|
||||
|
||||
// If the receiver already has errors reported, consider it valid to avoid
|
||||
// unnecessary errors (#58712).
|
||||
if receiver_ty.references_error() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if tcx.features().arbitrary_self_types {
|
||||
if !receiver_is_valid(wfcx, span, receiver_ty, self_ty, true) {
|
||||
// Report error; `arbitrary_self_types` was enabled.
|
||||
|
@ -1749,9 +1755,7 @@ fn receiver_is_valid<'tcx>(
|
|||
}
|
||||
} else {
|
||||
debug!("receiver_is_valid: type `{:?}` does not deref to `{:?}`", receiver_ty, self_ty);
|
||||
// If the receiver already has errors reported due to it, consider it valid to avoid
|
||||
// unnecessary errors (#58712).
|
||||
return receiver_ty.references_error();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -425,9 +425,7 @@ fn check_predicates<'tcx>(
|
|||
|
||||
let mut res = Ok(());
|
||||
for (clause, span) in impl1_predicates {
|
||||
if !impl2_predicates
|
||||
.iter()
|
||||
.any(|pred2| trait_predicates_eq(tcx, clause.as_predicate(), *pred2, span))
|
||||
if !impl2_predicates.iter().any(|pred2| trait_predicates_eq(clause.as_predicate(), *pred2))
|
||||
{
|
||||
res = res.and(check_specialization_on(tcx, clause, span))
|
||||
}
|
||||
|
@ -459,10 +457,8 @@ fn check_predicates<'tcx>(
|
|||
///
|
||||
/// So we make that check in this function and try to raise a helpful error message.
|
||||
fn trait_predicates_eq<'tcx>(
|
||||
_tcx: TyCtxt<'tcx>,
|
||||
predicate1: ty::Predicate<'tcx>,
|
||||
predicate2: ty::Predicate<'tcx>,
|
||||
_span: Span,
|
||||
) -> bool {
|
||||
// FIXME(effects)
|
||||
predicate1 == predicate2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue