We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60493b8 commit da3e736Copy full SHA for da3e736
compiler/rustc_middle/src/ty/inhabitedness/inhabited_predicate.rs
@@ -236,6 +236,11 @@ impl<'tcx> InhabitedPredicate<'tcx> {
236
self.instantiate_opt(tcx, args).unwrap_or(self)
237
}
238
239
+ /// Same as [`Self::instantiate`], but if there is no generics to
240
+ /// instantiate, returns `None`. This is useful because it lets us avoid
241
+ /// allocating a recursive copy of everything when the result is unchanged.
242
+ ///
243
+ /// Only used to implement `instantiate` itself.
244
fn instantiate_opt(self, tcx: TyCtxt<'tcx>, args: ty::GenericArgsRef<'tcx>) -> Option<Self> {
245
match self {
246
Self::ConstIsZero(c) => {
0 commit comments