-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Consider:
#![allow(const_err)]
union Trans { i: usize, o: &'static u32 }
const C: () = unsafe { let _val = *Trans { i: 4 }.o; () };
fn main() {
println!("{:?}", C);
}This deref's a dangling pointer, but due to allow(const_err) the only diagnostic we get is
error[E0080]: evaluation of constant expression failed
--> src/main.rs:8:22
|
8 | println!("{:?}", C);
| ^ referenced constant has errors
error: aborting due to previous error
Making this an allowable lint is not very helpful when later follow-on errors are hard errors.
luojia65
Metadata
Metadata
Assignees
Labels
A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)Area: Constant evaluation, covers all const contexts (static, const fn, ...)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.