rust icon indicating copy to clipboard operation
rust copied to clipboard

deny(unsafe_code) should prevent `global_asm!` usage.

Open Lokathor opened this issue 3 years ago • 4 comments

Similar to how deny(unsafe_code) prevents #[no_mangle] from being used, it should also prevent global_asm! blocks from being allowed. If misused, they can do any number of strange and horrible thing simply by being within the crate.

Lokathor avatar Oct 15 '22 05:10 Lokathor

@rustbot claim

gimbling-away avatar Oct 16 '22 13:10 gimbling-away

@rustbot label +C-bug +T-compiler

Rageking8 avatar Oct 16 '22 16:10 Rageking8

I suppose it's probably too late to actually make it require unsafe {}?

asquared31415 avatar Oct 16 '22 21:10 asquared31415

that isn't even currently possible from a syntax perspective because unsafe blocks only work as expressions, you can't just put them around a top level item. It would take a whole RFC thing, even separately from global_asm already being stable.

Lokathor avatar Oct 17 '22 02:10 Lokathor