1
1
- Feature Name: ` cfg-target `
2
2
- Start Date: 2020-09-27
3
- - RFC PR: [ rust-lang/rfcs #2991 ] ( https://github.com/rust-lang/rfcs/pull/2991 )
3
+ - RFC PR: [ rust-lang/rfcs #3239 ] ( https://github.com/rust-lang/rfcs/pull/3239 )
4
4
- Rust Issue: [ rust-lang/rust #0000 ] ( https://github.com/rust-lang/rust/issues/0000 )
5
5
6
6
# Summary
@@ -19,9 +19,10 @@ increases compile time and makes a crate incompatible with certain build
19
19
systems.
20
20
21
21
Otherwise, all available components would need to be specified separately:
22
- ` target_arch ` , ` target_vendor ` , ` target_os ` , and ` target_env ` . This can be very
23
- cumbersome. Note that the target ABI cannot currently be ` #[cfg] ` -ed against, so
24
- a ` build.rs ` is still necessary to match all target components.
22
+ ` target_arch ` , ` target_vendor ` , ` target_os ` , ` target_env ` and ` target_abi ` .
23
+ This can be very cumbersome. Note that the target ABI cannot currently be
24
+ ` #[cfg] ` -ed against, so a ` build.rs ` is still necessary to match all target
25
+ components.
25
26
26
27
# Guide-level explanation
27
28
[ guide-level-explanation ] : #guide-level-explanation
@@ -36,6 +37,16 @@ mod mac_catalyst;
36
37
37
38
This includes ` #[cfg_attr(target = "...", attr)] ` .
38
39
40
+ It would also support to specify each ` target_* ` inside a new ` target `
41
+ attribute as follows:
42
+
43
+ ``` rust
44
+ // So we can for example rewrite:
45
+ #[cfg(all(target_os = " linux" , target_arch = " arm" ))]
46
+ // as:
47
+ #[cfg(target(os = " linux" , arch = " arm" ))]
48
+ ```
49
+
39
50
# Reference-level explanation
40
51
[ reference-level-explanation ] : #reference-level-explanation
41
52
0 commit comments