cc @RalfJung
|
let err = error_to_const_error(&ecx, error); |
|
match err.struct_error(ecx.tcx, "it is undefined behavior to use this value") { |
|
Ok(mut diag) => { |
|
diag.note("The rules on what exactly is undefined behavior aren't clear, \ |
|
so this check might be overzealous. Please open an issue on the rust compiler \ |
|
repository if you believe it should not be considered undefined behavior", |
|
); |
|
diag.emit(); |
|
ErrorHandled::Reported |
|
} |
|
Err(err) => err, |
|
} |
and
|
let err = crate::const_eval::error_to_const_error(&ecx, error); |
|
match err.struct_error(ecx.tcx, "it is undefined behavior to use this value") { |
|
Ok(mut diag) => { |
|
diag.note("The rules on what exactly is undefined behavior aren't clear, \ |
|
so this check might be overzealous. Please open an issue on the rust \ |
|
compiler repository if you believe it should not be considered \ |
|
undefined behavior", |
|
); |
|
diag.emit(); |
|
} |
|
Err(ErrorHandled::TooGeneric) | |
|
Err(ErrorHandled::Reported) => {}, |
|
} |
could be deduplicated by creating a function in const_eval.rs and calling it from both sites
This issue has been assigned to @chansuke via this comment.
cc @RalfJung
rust/src/librustc_mir/const_eval.rs
Lines 557 to 568 in 3977cc2
and
rust/src/librustc_mir/interpret/intern.rs
Lines 293 to 305 in 3977cc2
could be deduplicated by creating a function in
const_eval.rsand calling it from both sitesThis issue has been assigned to @chansuke via this comment.