X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_const_eval%2Fsrc%2Finterpret%2Fvalidity.rs;h=19c6449078d5b236d9a6b40b22ad6eae0ad8c098;hb=f639ba634b7f20ef25b5067ef9681e16a2110494;hp=4060bee7e056c1c61554069927610d644a52521e;hpb=e3a1e192960c41acc196b59f0cb1b28f78e712f8;p=rust.git diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index 4060bee7e05..19c6449078d 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -33,7 +33,7 @@ macro_rules! throw_validation_failure { msg.push_str(", but expected "); write!(&mut msg, $($expected_fmt),+).unwrap(); )? - let path = rustc_middle::ty::print::with_no_trimmed_paths(|| { + let path = rustc_middle::ty::print::with_no_trimmed_paths!({ let where_ = &$where; if !where_.is_empty() { let mut path = String::new(); @@ -697,7 +697,7 @@ fn read_discriminant( this.ecx.read_discriminant(op), this.path, err_ub!(InvalidTag(val)) => - { "{}", val } expected { "a valid enum tag" }, + { "{:x}", val } expected { "a valid enum tag" }, err_ub!(InvalidUninitBytes(None)) => { "uninitialized bytes" } expected { "a valid enum tag" }, err_unsup!(ReadPointerAsBytes) => @@ -851,12 +851,9 @@ fn visit_aggregate( // to reject those pointers, we just do not have the machinery to // talk about parts of a pointer. // We also accept uninit, for consistency with the slow path. - let alloc = match self.ecx.memory.get(mplace.ptr, size, mplace.align)? { - Some(a) => a, - None => { - // Size 0, nothing more to check. - return Ok(()); - } + let Some(alloc) = self.ecx.memory.get(mplace.ptr, size, mplace.align)? else { + // Size 0, nothing more to check. + return Ok(()); }; let allow_uninit_and_ptr = !M::enforce_number_validity(self.ecx);