We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13a29b8 commit ad6e250Copy full SHA for ad6e250
compiler/rustc_const_eval/src/const_eval/eval_queries.rs
@@ -334,13 +334,11 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
334
335
let alloc_id = mplace.ptr().provenance.unwrap();
336
337
- // Validation failed, report an error.
338
- if let Err(error) = validation {
339
- Err(ecx.const_report_error(error, alloc_id))
340
- } else {
+ validation
+ // Validation failed, report an error.
+ .map_err(|error| ecx.const_report_error(error, alloc_id))
341
// Convert to raw constant
342
- Ok(ConstAlloc { alloc_id, ty: mplace.layout.ty })
343
- }
+ .map(|()| ConstAlloc { alloc_id, ty: mplace.layout.ty })
344
}
345
346
0 commit comments