-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Only add CFGuard on windows-msvc
targets
#74103
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I think this could do with a couple of // run-pass
// compile-flags: -Z control-flow-guard
// ignore-msvc
fn main() {
println!("Hello, world!");
} and // run-pass
// compile-flags: -Z control-flow-guard
// only-msvc
fn main() {
println!("Hello, world!");
} to make sure we're actually producing working binaries and the warning is printed when it should be. |
e343828
to
04a78c6
Compare
Thanks @ollie27, do the new |
Yep, looks good. |
@bors r+ |
📌 Commit 04a78c6a02db8a70da0fd71f7ad3e878e20c16e7 has been approved by |
@bors r- -- wait, CI looks unhappy? |
Yes, I'm wondering if this is the correct way to test compiler warnings? In the CI, the |
@ajpaverd where is that warning emitted, anyway? I think that with a |
@nikomatsakis these warnings are emitted from librustc_codegen_ssa/back/linker.rs. So it looks like the test passes when run normally (L1509), but fails when run with |
@ajpaverd ah, I see, that's annoying. I guess the question then is whether there is some kind of test mode that only runs normally |
04a78c6
to
da4fb19
Compare
So I think changing this to a |
You can use Emitting hard-coded warnings is never a good idea though, they've been gradually removed from the compiler in favor of lints or hard errors. |
@petrochenkov thanks! I'm actually in favor of removing these warnings to make this cleaner and more in-line with other |
da4fb19
to
1ca7bfe
Compare
@bors r+ |
📌 Commit 1ca7bfe has been approved by |
@bors rollup=iffy |
…atsakis Only add CFGuard on `windows-msvc` targets As @ollie27 pointed out in rust-lang#73893, the `cfguard` module flag causes incorrect behavior on `windows-gnu` targets. This patch restricts rustc to only add this flag for `windows-msvc` targets (this may need to be changed if other linkers gain support for CFGuard).
…atsakis Only add CFGuard on `windows-msvc` targets As @ollie27 pointed out in rust-lang#73893, the `cfguard` module flag causes incorrect behavior on `windows-gnu` targets. This patch restricts rustc to only add this flag for `windows-msvc` targets (this may need to be changed if other linkers gain support for CFGuard).
…atsakis Only add CFGuard on `windows-msvc` targets As @ollie27 pointed out in rust-lang#73893, the `cfguard` module flag causes incorrect behavior on `windows-gnu` targets. This patch restricts rustc to only add this flag for `windows-msvc` targets (this may need to be changed if other linkers gain support for CFGuard).
…arth Rollup of 19 pull requests Successful merges: - rust-lang#71322 (Accept tuple.0.0 as tuple indexing (take 2)) - rust-lang#72303 (Add core::future::{poll_fn, PollFn}) - rust-lang#73862 (Stabilize casts and coercions to `&[T]` in const fn) - rust-lang#73887 (stabilize const mem::forget) - rust-lang#73989 (adjust ub-enum test to be endianess-independent) - rust-lang#74045 (Explain effects of debugging options from config.toml) - rust-lang#74076 (Add `read_exact_at` and `write_all_at` to WASI's `FileExt`) - rust-lang#74099 (Add VecDeque::range* methods) - rust-lang#74100 (Use str::strip* in bootstrap) - rust-lang#74103 (Only add CFGuard on `windows-msvc` targets) - rust-lang#74109 (Only allow `repr(i128/u128)` on enum) - rust-lang#74122 (Start-up clean-up) - rust-lang#74125 (Correctly mark the ending span of a match arm) - rust-lang#74127 (Avoid "whitelist") - rust-lang#74129 (:arrow_up: rust-analyzer) - rust-lang#74135 (Update books) - rust-lang#74145 (Update rust-installer to latest version) - rust-lang#74161 (Fix disabled dockerfiles) - rust-lang#74162 (take self by value in ToPredicate) Failed merges: r? @ghost
did the situation change for non-msvc targets? |
As @ollie27 pointed out in #73893, the
cfguard
module flag causes incorrect behavior onwindows-gnu
targets. This patch restricts rustc to only add this flag forwindows-msvc
targets (this may need to be changed if other linkers gain support for CFGuard).