Skip to content

Commit a63035f

Browse files
committed
Explain that the current impl is only silly, not recursive
1 parent 6ba56d2 commit a63035f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_mir_transform/src/trivial_const.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ where
8383
return None;
8484
}
8585

86+
// The query provider is based on calling the free function trivial_const, which calls mir_built,
87+
// which internally has a fast-path for trivial consts so it too calls trivial_const. This isn't
88+
// recursive, but we are checking if the const is trivial twice. A better design might detect
89+
// trivial consts before getting to MIR, which would hopefully straighten this out.
8690
pub(crate) fn trivial_const_provider<'tcx>(
8791
tcx: TyCtxt<'tcx>,
8892
def: LocalDefId,

0 commit comments

Comments
 (0)