You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Instantiates a generic value `v`(like `Vec<T>`), substituting its generic arguments and turning it into a concrete one(like `i32`, or `Vec<f32>`).
637
+
/// If a value is not generic, this will do nothing.
638
+
/// This function does not erase lifetimes, so a value like `&'a i32` will remain unchanged.
639
+
/// For monomorphizing generics while also erasing lifetimes, try using [`instantiate_mir_and_normalize_erasing_regions`].
637
640
pubfninstantiate_mir<T>(&self,tcx:TyCtxt<'tcx>,v:EarlyBinder<&T>) -> T
638
641
where
639
642
T:TypeFoldable<TyCtxt<'tcx>> + Copy,
@@ -645,7 +648,11 @@ impl<'tcx> Instance<'tcx> {
645
648
v.instantiate_identity()
646
649
}
647
650
}
648
-
651
+
/// Instantiates a generic value `v`(like `Vec<T>`), substituting its generic arguments and turning it into a concrete one(like `i32`, or `Vec<f32>`).
652
+
/// This function erases lifetimes, so a value like `&'a i32` will become `&ReErased i32`.
653
+
/// If a value is not generic and has no lifetime info, this will do nothing.
654
+
/// For monomorphizing generics while preserving lifetimes, use [`instantiate_mir`].
655
+
/// This function will panic if normalization fails. If you want to handle normalization errors, use [`try_instantiate_mir_and_normalize_erasing_regions`]
/// A version of [`instantiate_mir_and_normalize_erasing_regions`] which will returns a [`NormalizationError`] on normalization failure instead of panicking.
0 commit comments