1
Fork 0
rust/compiler/rustc_middle/src
bors 7daf4cf911 Auto merge of #133138 - azhogin:azhogin/target-modifiers, r=davidtwco,saethlin
Target modifiers (special marked options) are recorded in metainfo

Target modifiers (special marked options) are recorded in metainfo and compared to be equal in different linked crates.

PR for this RFC: https://github.com/rust-lang/rfcs/pull/3716

Option may be marked as `TARGET_MODIFIER`, example: `regparm: Option<u32> = (None, parse_opt_number, [TRACKED TARGET_MODIFIER]`.
If an TARGET_MODIFIER-marked option has non-default value, it will be recorded in crate metainfo as a `Vec<TargetModifier>`:
```
pub struct TargetModifier {
    pub opt: OptionsTargetModifiers,
    pub value_name: String,
}
```

OptionsTargetModifiers is a macro-generated enum.

Option value code (for comparison) is generated using `Debug` trait.

Error example:
```
error: mixing `-Zregparm` will cause an ABI mismatch in crate `incompatible_regparm`
  --> $DIR/incompatible_regparm.rs:10:1
   |
LL | #![crate_type = "lib"]
   | ^
   |
   = help: the `-Zregparm` flag modifies the ABI so Rust crates compiled with different values of this flag cannot be used together safely
   = note: `-Zregparm=1` in this crate is incompatible with `-Zregparm=2` in dependency `wrong_regparm`
   = help: set `-Zregparm=2` in this crate or `-Zregparm=1` in `wrong_regparm`
   = help: if you are sure this will not cause problems, use `-Cunsafe-allow-abi-mismatch=regparm` to silence this error

error: aborting due to 1 previous error
```

`-Cunsafe-allow-abi-mismatch=regparm,reg-struct-return` to disable list of flags.
2025-02-03 07:16:57 +00:00
..
dep_graph Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
hir Auto merge of #134478 - compiler-errors:attr-span, r=oli-obk 2025-01-22 14:46:41 +00:00
hooks Remove the mir_build hook. 2025-01-31 15:15:01 +11:00
infer Move unify_key module. 2025-02-02 17:38:19 +11:00
middle Auto merge of #136332 - jhpratt:rollup-aa69d0e, r=jhpratt 2025-01-31 09:42:28 +00:00
mir Rollup merge of #136394 - saethlin:clean-up-instantiation-mode, r=compiler-errors 2025-02-02 18:05:23 +01:00
query Mark the tcx-ensure wrapper types with #[must_use] 2025-02-01 12:42:41 +11:00
thir Implement MIR, CTFE, and codegen for unsafe binders 2025-01-31 17:19:53 +00:00
traits Don't export the Trivial* macros. 2025-01-31 16:04:13 +11:00
ty Auto merge of #133138 - azhogin:azhogin/target-modifiers, r=davidtwco,saethlin 2025-02-03 07:16:57 +00:00
util Overhaul to_readable_str. 2025-01-31 16:04:13 +11:00
arena.rs upstream rustc_codegen_ssa/rustc_middle changes for enzyme/autodiff 2025-01-29 21:31:13 -05:00
error.rs upstream rustc_codegen_ssa/rustc_middle changes for enzyme/autodiff 2025-01-29 21:31:13 -05:00
lib.rs use fmt::from_fn in more places, instead of using structs that impl formatting traits 2025-01-24 14:45:56 +00:00
lint.rs Convert two rustc_middle::lint functions to Span methods. 2025-02-02 13:57:34 +11:00
macros.rs Don't export the Trivial* macros. 2025-01-31 16:04:13 +11:00
metadata.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
tests.rs Give an item related to issue 27438 a more meaningful name 2024-04-30 22:27:19 +02:00
thir.rs Implement MIR, CTFE, and codegen for unsafe binders 2025-01-31 17:19:53 +00:00
values.rs Split hir TyKind and ConstArgKind in two and update hir::Visitor 2025-01-23 06:01:36 +00:00