Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 39165e3

Browse files
committedNov 17, 2022
non-fatal overflow
1 parent 36db030 commit 39165e3

File tree

43 files changed

+995
-995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+995
-995
lines changed
 

‎compiler/rustc_codegen_llvm/src/intrinsic.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,19 +1745,23 @@ unsupported {} from `{}` with element `{}` of size `{}` to `{}`"#,
17451745

17461746
match in_elem.kind() {
17471747
ty::RawPtr(p) => {
1748-
let (metadata, check_sized) = p.ty.ptr_metadata_ty(bx.tcx, |ty| {
1749-
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
1750-
});
1748+
let (metadata, check_sized) =
1749+
p.ty.ptr_metadata_ty(bx.tcx, |ty| {
1750+
Ok(bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty))
1751+
})
1752+
.unwrap();
17511753
assert!(!check_sized); // we are in codegen, so we shouldn't see these types
17521754
require!(metadata.is_unit(), "cannot cast fat pointer `{}`", in_elem)
17531755
}
17541756
_ => return_error!("expected pointer, got `{}`", in_elem),
17551757
}
17561758
match out_elem.kind() {
17571759
ty::RawPtr(p) => {
1758-
let (metadata, check_sized) = p.ty.ptr_metadata_ty(bx.tcx, |ty| {
1759-
bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
1760-
});
1760+
let (metadata, check_sized) =
1761+
p.ty.ptr_metadata_ty(bx.tcx, |ty| {
1762+
Ok(bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty))
1763+
})
1764+
.unwrap();
17611765
assert!(!check_sized); // we are in codegen, so we shouldn't see these types
17621766
require!(metadata.is_unit(), "cannot cast to fat pointer `{}`", out_elem)
17631767
}

‎compiler/rustc_const_eval/src/const_eval/valtrees.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,17 @@ fn get_info_on_unsized_field<'tcx>(
177177
tcx: TyCtxt<'tcx>,
178178
) -> (Ty<'tcx>, usize) {
179179
let mut last_valtree = valtree;
180-
let tail = tcx.struct_tail_with_normalize(
181-
ty,
182-
|ty| ty,
183-
|| {
184-
let branches = last_valtree.unwrap_branch();
185-
last_valtree = branches[branches.len() - 1];
186-
debug!(?branches, ?last_valtree);
187-
},
188-
);
180+
let tail = tcx
181+
.struct_tail_with_normalize(
182+
ty,
183+
|ty| Ok(ty),
184+
|| {
185+
let branches = last_valtree.unwrap_branch();
186+
last_valtree = branches[branches.len() - 1];
187+
debug!(?branches, ?last_valtree);
188+
},
189+
)
190+
.unwrap();
189191
let unsized_inner_ty = match tail.kind() {
190192
ty::Slice(t) => *t,
191193
ty::Str => tail,

0 commit comments

Comments
 (0)
Please sign in to comment.