Add a fast exit to lint_obligations_broken_by_never_type_fallback_change

This commit is contained in:
Waffle Lapkin 2024-05-20 04:07:38 +02:00
parent 83f8f9f85d
commit b88d03b059

View File

@ -8,11 +8,11 @@ use rustc_data_structures::{
use rustc_hir as hir;
use rustc_hir::intravisit::Visitor;
use rustc_hir::HirId;
use rustc_middle::bug;
use rustc_infer::{
infer::{DefineOpaqueTypes, InferOk},
traits::ObligationCause,
};
use rustc_middle::bug;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable};
use rustc_session::lint;
use rustc_span::DUMMY_SP;
@ -483,6 +483,11 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
) {
let DivergingFallbackBehavior::FallbackToUnit = behavior else { return };
// Fallback happens if and only if there are diverging variables
if diverging_vids.is_empty() {
return;
}
// Returns errors which happen if fallback is set to `fallback`
let try_out = |fallback| {
self.probe(|_| {