Skip to content

Commit bba5a87

Browse files
authored
Merge pull request #1920 from ehuss/windows_subsystem
Update `windows_subsystem` to use the attribute template
2 parents 9b6bf76 + a239b4b commit bba5a87

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

src/runtime.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,36 @@ r[runtime.windows_subsystem]
1313
## The `windows_subsystem` attribute
1414

1515
r[runtime.windows_subsystem.intro]
16-
The *`windows_subsystem` attribute* may be applied at the crate level to set
17-
the [subsystem] when linking on a Windows target.
16+
The *`windows_subsystem` [attribute][attributes]* sets the [subsystem] when linking on a Windows target.
17+
18+
> [!EXAMPLE]
19+
> ```rust
20+
> #![windows_subsystem = "windows"]
21+
> ```
1822
1923
r[runtime.windows_subsystem.syntax]
20-
It uses the [MetaNameValueStr] syntax to specify the subsystem with a value of either
21-
`console` or `windows`.
24+
The `windows_subsystem` attribute uses the [MetaNameValueStr] syntax. Accepted values are `"console"` and `"windows"`.
25+
26+
r[runtime.windows_subsystem.allowed-positions]
27+
The `windows_subsystem` attribute may only be applied to the crate root.
28+
29+
r[runtime.windows_subsystem.duplicates]
30+
Only the first use of `windows_subsystem` is honored.
31+
32+
> [!NOTE]
33+
> `rustc` currently lints against uses following the first. This may become a hard error in the future.
2234
2335
r[runtime.windows_subsystem.ignored]
24-
This attribute is ignored on non-Windows targets, and for non-`bin` [crate types].
36+
The `windows_subsystem` attribute is ignored on non-Windows targets and non-`bin` [crate types].
2537
2638
r[runtime.windows_subsystem.console]
27-
The "console" subsystem is the default. If a console process is run from an
28-
existing console then it will be attached to that console, otherwise a new
29-
console window will be created.
39+
The `"console"` subsystem is the default. If a console process is run from an existing console then it will be attached to that console; otherwise a new console window will be created.
3040
3141
r[runtime.windows_subsystem.windows]
32-
The "windows" subsystem is commonly used by GUI applications that do not want to
33-
display a console window on startup. It will run detached from any existing console.
42+
The `"windows"` subsystem will run detached from any existing console.
3443
35-
```rust
36-
#![windows_subsystem = "windows"]
37-
```
44+
> [!NOTE]
45+
> The `"windows"` subsystem is commonly used by GUI applications that do not want to display a console window on startup.
3846
3947
[`GlobalAlloc`]: alloc::alloc::GlobalAlloc
4048
[crate types]: linkage.md

0 commit comments

Comments
 (0)