mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-02 01:52:51 +00:00
Move ty::print methods to Drop-based scope guards
This commit is contained in:
parent
06bc64df92
commit
7e80bc3c8d
@ -779,29 +779,35 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
|
||||
assert_inhabited | assert_zero_valid | assert_uninit_valid, <T> () {
|
||||
let layout = fx.layout_of(T);
|
||||
if layout.abi.is_uninhabited() {
|
||||
with_no_trimmed_paths(|| crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to instantiate uninhabited type `{}`", T),
|
||||
span,
|
||||
));
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to instantiate uninhabited type `{}`", T),
|
||||
span,
|
||||
)
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if intrinsic == sym::assert_zero_valid && !layout.might_permit_raw_init(fx, /*zero:*/ true) {
|
||||
with_no_trimmed_paths(|| crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to zero-initialize type `{}`, which is invalid", T),
|
||||
span,
|
||||
));
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to zero-initialize type `{}`, which is invalid", T),
|
||||
span,
|
||||
);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if intrinsic == sym::assert_uninit_valid && !layout.might_permit_raw_init(fx, /*zero:*/ false) {
|
||||
with_no_trimmed_paths(|| crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to leave type `{}` uninitialized, which is invalid", T),
|
||||
span,
|
||||
));
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
fx,
|
||||
&format!("attempted to leave type `{}` uninitialized, which is invalid", T),
|
||||
span,
|
||||
)
|
||||
});
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user