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.
2 parents b63223c + d032119 commit 7ba34c7Copy full SHA for 7ba34c7
compiler/rustc_type_ir/src/binder.rs
@@ -622,6 +622,17 @@ impl<I: Interner, T: TypeFoldable<I>> ty::EarlyBinder<I, T> {
622
where
623
A: SliceLike<Item = I::GenericArg>,
624
{
625
+ // Nothing to fold, so let's avoid visiting things and possibly re-hashing/equating
626
+ // them when interning. Perf testing found this to be a modest improvement.
627
+ // See: <https://github.com/rust-lang/rust/pull/142317>
628
+ if args.is_empty() {
629
+ assert!(
630
+ !self.value.has_param(),
631
+ "{:?} has parameters, but no args were provided in instantiate",
632
+ self.value,
633
+ );
634
+ return self.value;
635
+ }
636
let mut folder = ArgFolder { cx, args: args.as_slice(), binders_passed: 0 };
637
self.value.fold_with(&mut folder)
638
}
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments