Skip to content

Commit 98cdb82

Browse files
Fast path for register_region_obligation
1 parent bf5a38d commit 98cdb82

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_infer/src/infer/outlives/obligations.rs

+8
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ impl<'tcx> InferCtxt<'tcx> {
9898
sub_region: Region<'tcx>,
9999
cause: &ObligationCause<'tcx>,
100100
) {
101+
// `is_global` means the type has no params, infer, placeholder, or non-`'static`
102+
// free regions. If the type has none of these things, then we can skip registering
103+
// this outlives obligation since it has no components which affect lifetime
104+
// checking in an interesting way.
105+
if sup_type.is_global() {
106+
return;
107+
}
108+
101109
debug!(?sup_type, ?sub_region, ?cause);
102110
let origin = SubregionOrigin::from_obligation_cause(cause, || {
103111
infer::RelateParamBound(

0 commit comments

Comments
 (0)