-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fat-ptr-transmutes lint doesn't work #19676
Comments
cc @nick29581 |
Once this is fixed, I will submit a patch I wrote that ICEs when |
@nick29581: Any thoughts on this? I think we should fix this for 1.0 or remove the lint for now, because it never prints anything. |
I think we should fix it :-) Do you know how hard it would be to do another lint pass after trans? |
I think it's worth a shot. It would also eliminate a bunch of hacks for the existing variant size lint in trans. |
If we leave these two lints hardcoded then we don't need a full pass, we just need to go through the session / AST and print out saved lints, which I think could be factored out easily enough. |
Still broken. Updated test: #![deny(fat_ptr_transmutes)]
use std::mem;
fn main() {
let x: [u8; 8] = [0; 8];
let y: [u8; 16] = unsafe {
mem::transmute(&x[..])
};
println!("{:?}", &x[..]);
} |
Triage: no change. |
As far as I can tell, this lint is never invoked today (even in trans); it's previous use was removed by @nikomatsakis in c5edd22. @nikomatsakis, could you comment on what the reasoning there was? I feel like it might've been an accidental removal... Looking into the code seems to suggest that the problem is that with slices, the representation (as I understand it) is |
@Mark-Simulacrum hmm I do think that was an accident, or perhaps a merge failure. |
This lint appears to have been completely removed, and trying to use it emits a "removed lint" warning. Should this issue be closed? |
This lint doesn't exist today since it seems to be... rust/compiler/rustc_lint/src/lib.rs Line 387 in 002da76
Closing. |
compiles and runs with no warnings. The problem is that
trans::intrinsic::check_intrinsics
callsSession::add_lint
but the pass that emits these lints has already run. See this comment inrustc::lint
.Please add a test case when fixing this! :)
The text was updated successfully, but these errors were encountered: