Skip to content

Commit 10ef8d9

Browse files
committed
remove dummy UniverseInfo causes from type checker fully_perform_op
This was backfilling causes for new universes that may have been created by an op, when there was no error info to use for improved diagnostics. We don't need to do that anymore: `other()` is the default when there is no registered universe cause.
1 parent ae963b5 commit 10ef8d9

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

compiler/rustc_borrowck/src/type_check/canonical.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::Span;
99
use rustc_trait_selection::traits::query::type_op::{self, TypeOpOutput};
1010
use rustc_trait_selection::traits::ObligationCause;
1111

12-
use crate::diagnostics::{ToUniverseInfo, UniverseInfo};
12+
use crate::diagnostics::ToUniverseInfo;
1313

1414
use super::{Locations, NormalizeLocation, TypeChecker};
1515

@@ -46,13 +46,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
4646
self.push_region_constraints(locations, category, data);
4747
}
4848

49+
// If the query has created new universes and errors are going to be emitted, register the
50+
// cause of these new universes for improved diagnostics.
4951
let universe = self.infcx.universe();
50-
51-
if old_universe != universe {
52-
let universe_info = match error_info {
53-
Some(error_info) => error_info.to_universe_info(old_universe),
54-
None => UniverseInfo::other(),
55-
};
52+
if old_universe != universe && let Some(error_info) = error_info {
53+
let universe_info = error_info.to_universe_info(old_universe);
5654
for u in (old_universe + 1)..=universe {
5755
self.borrowck_context.constraints.universe_causes.insert(u, universe_info.clone());
5856
}

0 commit comments

Comments
 (0)