1
Fork 0

Auto merge of #105525 - matthiaskrgr:rollup-ricyw5s, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #98391 (Reimplement std's thread parker on top of events on SGX)
 - #104019 (Compute generator sizes with `-Zprint_type_sizes`)
 - #104512 (Set `download-ci-llvm = "if-available"` by default when `channel = dev`)
 - #104901 (Implement masking in FileType comparison on Unix)
 - #105082 (Fix Async Generator ABI)
 - #105109 (Add LLVM KCFI support to the Rust compiler)
 - #105505 (Don't warn about unused parens when they are used by yeet expr)
 - #105514 (Introduce `Span::is_visible`)
 - #105516 (Update cargo)
 - #105522 (Remove wrong note for short circuiting operators)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2022-12-10 11:16:18 +00:00
commit b12b83674f
58 changed files with 923 additions and 294 deletions

View file

@ -19,7 +19,7 @@ pub enum SizeKind {
Min,
}
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct FieldInfo {
pub name: Symbol,
pub offset: u64,
@ -33,6 +33,7 @@ pub enum DataTypeKind {
Union,
Enum,
Closure,
Generator,
}
#[derive(PartialEq, Eq, Hash, Debug)]
@ -114,7 +115,7 @@ impl CodeStats {
let struct_like = match kind {
DataTypeKind::Struct | DataTypeKind::Closure => true,
DataTypeKind::Enum | DataTypeKind::Union => false,
DataTypeKind::Enum | DataTypeKind::Union | DataTypeKind::Generator => false,
};
for (i, variant_info) in variants.into_iter().enumerate() {
let VariantInfo { ref name, kind: _, align: _, size, ref fields } = *variant_info;

View file

@ -368,7 +368,7 @@ mod desc {
pub const parse_opt_panic_strategy: &str = parse_panic_strategy;
pub const parse_oom_strategy: &str = "either `panic` or `abort`";
pub const parse_relro_level: &str = "one of: `full`, `partial`, or `off`";
pub const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, `cfi`, `hwaddress`, `leak`, `memory`, `memtag`, `shadow-call-stack`, or `thread`";
pub const parse_sanitizers: &str = "comma separated list of sanitizers: `address`, `cfi`, `hwaddress`, `kcfi`, `leak`, `memory`, `memtag`, `shadow-call-stack`, or `thread`";
pub const parse_sanitizer_memory_track_origins: &str = "0, 1, or 2";
pub const parse_cfguard: &str =
"either a boolean (`yes`, `no`, `on`, `off`, etc), `checks`, or `nochecks`";
@ -675,6 +675,7 @@ mod parse {
*slot |= match s {
"address" => SanitizerSet::ADDRESS,
"cfi" => SanitizerSet::CFI,
"kcfi" => SanitizerSet::KCFI,
"leak" => SanitizerSet::LEAK,
"memory" => SanitizerSet::MEMORY,
"memtag" => SanitizerSet::MEMTAG,

View file

@ -686,6 +686,10 @@ impl Session {
self.opts.unstable_opts.sanitizer.contains(SanitizerSet::CFI)
}
pub fn is_sanitizer_kcfi_enabled(&self) -> bool {
self.opts.unstable_opts.sanitizer.contains(SanitizerSet::KCFI)
}
/// Check whether this compile session and crate type use static crt.
pub fn crt_static(&self, crate_type: Option<CrateType>) -> bool {
if !self.target.crt_static_respected {
@ -1544,6 +1548,14 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
}
}
// LLVM CFI and KCFI are mutually exclusive
if sess.is_sanitizer_cfi_enabled() && sess.is_sanitizer_kcfi_enabled() {
sess.emit_err(CannotMixAndMatchSanitizers {
first: "cfi".to_string(),
second: "kcfi".to_string(),
});
}
if sess.opts.unstable_opts.stack_protector != StackProtector::None {
if !sess.target.options.supports_stack_protector {
sess.emit_warning(StackProtectorNotSupportedForTarget {