Auto merge of #102139 - Dylan-DPC:rollup-ljlipt8, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #101598 (Update rustc's information on Android's sanitizers) - #102036 (Remove use of `io::ErrorKind::Other` in std) - #102037 (Make cycle errors recoverable) - #102069 (Skip `Equate` relation in `handle_opaque_type`) - #102076 (rustc_transmute: fix big-endian discriminants) - #102107 (Add missing space between notable trait tooltip and where clause) - #102119 (Fix a typo “pararmeter” in error message) - #102131 (Added which number is computed in compute_float.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
89e4e1f1b3
26 changed files with 126 additions and 63 deletions
|
@ -4,10 +4,12 @@
|
|||
// general routines.
|
||||
|
||||
use crate::infer::{DefiningAnchor, TyCtxtInferExt};
|
||||
use crate::traits::error_reporting::InferCtxtExt;
|
||||
use crate::traits::{
|
||||
ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngine, TraitEngineExt,
|
||||
Unimplemented,
|
||||
};
|
||||
use rustc_infer::traits::FulfillmentErrorCode;
|
||||
use rustc_middle::traits::CodegenObligationError;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
|
||||
|
@ -62,6 +64,14 @@ pub fn codegen_select_candidate<'tcx>(
|
|||
// optimization to stop iterating early.
|
||||
let errors = fulfill_cx.select_all_or_error(&infcx);
|
||||
if !errors.is_empty() {
|
||||
// `rustc_monomorphize::collector` assumes there are no type errors.
|
||||
// Cycle errors are the only post-monomorphization errors possible; emit them now so
|
||||
// `rustc_ty_utils::resolve_associated_item` doesn't return `None` post-monomorphization.
|
||||
for err in errors {
|
||||
if let FulfillmentErrorCode::CodeCycle(cycle) = err.code {
|
||||
infcx.report_overflow_error_cycle(&cycle);
|
||||
}
|
||||
}
|
||||
return Err(CodegenObligationError::FulfillmentError);
|
||||
}
|
||||
|
||||
|
|
|
@ -1540,6 +1540,9 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
|
|||
}
|
||||
diag.emit();
|
||||
}
|
||||
FulfillmentErrorCode::CodeCycle(ref cycle) => {
|
||||
self.report_overflow_error_cycle(cycle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,10 +25,9 @@ use super::Unimplemented;
|
|||
use super::{FulfillmentError, FulfillmentErrorCode};
|
||||
use super::{ObligationCause, PredicateObligation};
|
||||
|
||||
use crate::traits::error_reporting::InferCtxtExt as _;
|
||||
use crate::traits::project::PolyProjectionObligation;
|
||||
use crate::traits::project::ProjectionCacheKeyExt as _;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
|
||||
use crate::traits::query::evaluate_obligation::InferCtxtExt;
|
||||
|
||||
impl<'tcx> ForestObligation for PendingPredicateObligation<'tcx> {
|
||||
/// Note that we include both the `ParamEnv` and the `Predicate`,
|
||||
|
@ -224,6 +223,7 @@ fn mk_pending(os: Vec<PredicateObligation<'_>>) -> Vec<PendingPredicateObligatio
|
|||
impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
||||
type Obligation = PendingPredicateObligation<'tcx>;
|
||||
type Error = FulfillmentErrorCode<'tcx>;
|
||||
type OUT = Outcome<Self::Obligation, Self::Error>;
|
||||
|
||||
/// Identifies whether a predicate obligation needs processing.
|
||||
///
|
||||
|
@ -594,14 +594,16 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
|
|||
&mut self,
|
||||
cycle: I,
|
||||
_marker: PhantomData<&'c PendingPredicateObligation<'tcx>>,
|
||||
) where
|
||||
) -> Result<(), FulfillmentErrorCode<'tcx>>
|
||||
where
|
||||
I: Clone + Iterator<Item = &'c PendingPredicateObligation<'tcx>>,
|
||||
{
|
||||
if self.selcx.coinductive_match(cycle.clone().map(|s| s.obligation.predicate)) {
|
||||
debug!("process_child_obligations: coinductive match");
|
||||
Ok(())
|
||||
} else {
|
||||
let cycle: Vec<_> = cycle.map(|c| c.obligation.clone()).collect();
|
||||
self.selcx.infcx().report_overflow_error_cycle(&cycle);
|
||||
Err(FulfillmentErrorCode::CodeCycle(cycle))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -226,13 +226,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn intercrate(infcx: &'cx InferCtxt<'cx, 'tcx>) -> SelectionContext<'cx, 'tcx> {
|
||||
SelectionContext {
|
||||
infcx,
|
||||
freshener: infcx.freshener_keep_static(),
|
||||
intercrate: true,
|
||||
intercrate_ambiguity_causes: None,
|
||||
query_mode: TraitQueryMode::Standard,
|
||||
}
|
||||
SelectionContext { intercrate: true, ..SelectionContext::new(infcx) }
|
||||
}
|
||||
|
||||
pub fn with_query_mode(
|
||||
|
@ -240,13 +234,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
query_mode: TraitQueryMode,
|
||||
) -> SelectionContext<'cx, 'tcx> {
|
||||
debug!(?query_mode, "with_query_mode");
|
||||
SelectionContext {
|
||||
infcx,
|
||||
freshener: infcx.freshener_keep_static(),
|
||||
intercrate: false,
|
||||
intercrate_ambiguity_causes: None,
|
||||
query_mode,
|
||||
}
|
||||
SelectionContext { query_mode, ..SelectionContext::new(infcx) }
|
||||
}
|
||||
|
||||
/// Enables tracking of intercrate ambiguity causes. See
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue