Don't ICE when computing a layout of a generator tainted by errors
This commit is contained in:
@@ -3068,8 +3068,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
self.trait_def(trait_def_id).has_auto_impl
|
||||
}
|
||||
|
||||
pub fn generator_layout(self, def_id: DefId) -> &'tcx GeneratorLayout<'tcx> {
|
||||
self.optimized_mir(def_id).generator_layout.as_ref().unwrap()
|
||||
/// Returns layout of a generator. Layout might be unavailable if the
|
||||
/// generator is tainted by errors.
|
||||
pub fn generator_layout(self, def_id: DefId) -> Option<&'tcx GeneratorLayout<'tcx>> {
|
||||
self.optimized_mir(def_id).generator_layout.as_ref()
|
||||
}
|
||||
|
||||
/// Given the `DefId` of an impl, returns the `DefId` of the trait it implements.
|
||||
|
||||
Reference in New Issue
Block a user