Skip to content

Commit 9620ab7

Browse files
committed
Auto merge of #60859 - Centril:rollup-x7rcz9c, r=Centril
Rollup of 9 pull requests Successful merges: - #59825 (string: implement From<&String> for String) - #59923 (Fix convert module's documentation links) - #60691 (Include expression to wait for to the span of Await) - #60763 (Move token tree related lexer state to a separate struct) - #60769 (Update rustc book CLI docs.) - #60811 (Bump measureme dependency to 0.3) - #60816 (README.md: Mention MSVC 2017+, not 2013(!)) - #60827 (Use `Symbol` more in lint APIs) - #60851 (Move `box` from the stable keyword to unstable keywords list) Failed merges: r? @ghost
2 parents 7158ed9 + 9ad3d8f commit 9620ab7

File tree

15 files changed

+307
-113
lines changed

15 files changed

+307
-113
lines changed

Cargo.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ dependencies = [
14811481

14821482
[[package]]
14831483
name = "measureme"
1484-
version = "0.2.1"
1484+
version = "0.3.0"
14851485
source = "registry+https://github.com/rust-lang/crates.io-index"
14861486
dependencies = [
14871487
"byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2346,7 +2346,7 @@ dependencies = [
23462346
"jobserver 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
23472347
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
23482348
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
2349-
"measureme 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
2349+
"measureme 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
23502350
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
23512351
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
23522352
"polonius-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4174,7 +4174,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
41744174
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
41754175
"checksum mdbook 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "90b5a8d7e341ceee5db3882a06078d42661ddcfa2b3687319cc5da76ec4e782f"
41764176
"checksum mdbook 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0ba0d44cb4089c741b9a91f3e5218298a40699c2f3a070a85014eed290c60819"
4177-
"checksum measureme 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "36bb2b263a6795d352035024d6b30ce465bb79a5e5280d74c3b5f8464c657bcc"
4177+
"checksum measureme 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d09de7dafa3aa334bc806447c7e4de69419723312f4b88b80b561dea66601ce8"
41784178
"checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39"
41794179
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
41804180
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"

README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,15 @@ build.
128128
#### MSVC
129129
[windows-msvc]: #windows-msvc
130130

131-
MSVC builds of Rust additionally require an installation of Visual Studio 2013
132-
(or later) so `rustc` can use its linker. Make sure to check the “C++ tools”
133-
option.
131+
MSVC builds of Rust additionally require an installation of Visual Studio 2017
132+
(or later) so `rustc` can use its linker. The simplest way is to get the
133+
[Visual Studio Build Tools] and check the “C++ build tools” workload.
134+
135+
[Visual Studio Build Tools]: https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
136+
137+
At last check (cmake 3.14.3 and msvc 16.0.3) using the 2019 tools fails to
138+
build the in-tree LLVM build with a CMake error, so use 2017 instead by
139+
including the “MSVC v141 – VS 2017 C++ x64/x86 build tools (v14.16)” component.
134140

135141
With these dependencies installed, you can build the compiler in a `cmd.exe`
136142
shell with:

src/doc/rustc/src/command-line-arguments.md

+156-11
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,147 @@ to `#[cfg(verbose)]` and `#[cfg(feature = "serde")]` respectively.
1717

1818
## `-L`: add a directory to the library search path
1919

20-
When looking for external crates, a directory passed to this flag will be searched.
20+
When looking for external crates or libraries, a directory passed to this flag
21+
will be searched.
22+
23+
The kind of search path can optionally be specified with the form `-L
24+
KIND=PATH` where `KIND` may be one of:
25+
26+
- `dependency` — Only search for transitive dependencies in this directory.
27+
- `crate` — Only search for this crate's direct dependencies in this
28+
directory.
29+
- `native` — Only search for native libraries in this directory.
30+
- `framework` — Only search for macOS frameworks in this directory.
31+
- `all` — Search for all library kinds in this directory. This is the default
32+
if `KIND` is not specified.
2133

2234
## `-l`: link the generated crate to a native library
2335

2436
This flag allows you to specify linking to a specific native library when building
2537
a crate.
2638

39+
The kind of library can optionally be specified with the form `-l KIND=lib`
40+
where `KIND` may be one of:
41+
42+
- `dylib` — A native dynamic library.
43+
- `static` — A native static library (such as a `.a` archive).
44+
- `framework` — A macOS framework.
45+
46+
The kind of library can be specified in a [`#[link]`
47+
attribute][link-attribute]. If the kind is not specified in the `link`
48+
attribute or on the command-line, it will link a dynamic library if available,
49+
otherwise it will use a static library. If the kind is specified on the
50+
command-line, it will override the kind specified in a `link` attribute.
51+
52+
The name used in a `link` attribute may be overridden using the form `-l
53+
ATTR_NAME:LINK_NAME` where `ATTR_NAME` is the name in the `link` attribute,
54+
and `LINK_NAME` is the name of the actual library that will be linked.
55+
56+
[link-attribute]: ../reference/items/external-blocks.html#the-link-attribute
57+
2758
## `--crate-type`: a list of types of crates for the compiler to emit
2859

29-
This instructs `rustc` on which crate type to build.
60+
This instructs `rustc` on which crate type to build. This flag accepts a
61+
comma-separated list of values, and may be specified multiple times. The valid
62+
crate types are:
63+
64+
- `lib` — Generates a library kind preferred by the compiler, currently
65+
defaults to `rlib`.
66+
- `rlib` — A Rust static library.
67+
- `staticlib` — A native static library.
68+
- `dylib` — A Rust dynamic library.
69+
- `cdylib` — A native dynamic library.
70+
- `bin` — A runnable executable program.
71+
- `proc-macro` — Generates a format suitable for a procedural macro library
72+
that may be loaded by the compiler.
73+
74+
The crate type may be specified with the [`crate_type` attribute][crate_type].
75+
The `--crate-type` command-line value will override the `crate_type`
76+
attribute.
77+
78+
More details may be found in the [linkage chapter] of the reference.
79+
80+
[linkage chapter]: ../reference/linkage.html
81+
[crate_type]: ../reference/linkage.html
3082

3183
## `--crate-name`: specify the name of the crate being built
3284

3385
This informs `rustc` of the name of your crate.
3486

35-
## `--emit`: emit output other than a crate
36-
37-
Instead of producing a crate, this flag can print out things like the assembly or LLVM-IR.
87+
## `--edition`: specify the edition to use
88+
89+
This flag takes a value of `2015` or `2018`. The default is `2015`. More
90+
information about editions may be found in the [edition guide].
91+
92+
[edition guide]: ../edition-guide/introduction.html
93+
94+
## `--emit`: specifies the types of output files to generate
95+
96+
This flag controls the types of output files generated by the compiler. It
97+
accepts a comma-separated list of values, and may be specified multiple times.
98+
The valid emit kinds are:
99+
100+
- `asm` — Generates a file with the crate's assembly code. The default output
101+
filename is `CRATE_NAME.s`.
102+
- `dep-info` — Generates a file with Makefile syntax that indicates all the
103+
source files that were loaded to generate the crate. The default output
104+
filename is `CRATE_NAME.d`.
105+
- `link` — Generates the crates specified by `--crate-type`. The default
106+
output filenames depend on the crate type and platform. This is the default
107+
if `--emit` is not specified.
108+
- `llvm-bc` — Generates a binary file containing the [LLVM bitcode]. The
109+
default output filename is `CRATE_NAME.bc`.
110+
- `llvm-ir` — Generates a file containing [LLVM IR]. The default output
111+
filename is `CRATE_NAME.ll`.
112+
- `metadata` — Generates a file containing metadata about the crate. The
113+
default output filename is `CRATE_NAME.rmeta`.
114+
- `mir` — Generates a file containing rustc's mid-level intermediate
115+
representation. The default output filename is `CRATE_NAME.mir`.
116+
- `obj` — Generates a native object file. The default output filename is
117+
`CRATE_NAME.o`.
118+
119+
The output filename can be set with the `-o` flag. A suffix may be added to
120+
the filename with the `-C extra-filename` flag. The files are written to the
121+
current directory unless the `--out-dir` flag is used. Each emission type may
122+
also specify the output filename with the form `KIND=PATH`, which takes
123+
precedence over the `-o` flag.
124+
125+
[LLVM bitcode]: https://llvm.org/docs/BitCodeFormat.html
126+
[LLVM IR]: https://llvm.org/docs/LangRef.html
38127

39128
## `--print`: print compiler information
40129

41-
This flag prints out various information about the compiler.
130+
This flag prints out various information about the compiler. This flag may be
131+
specified multiple times, and the information is printed in the order the
132+
flags are specified. Specifying a `--print` flag will usually disable the
133+
`--emit` step and will only print the requested information. The valid types
134+
of print values are:
135+
136+
- `crate-name` — The name of the crate.
137+
- `file-names` — The names of the files created by the `link` emit kind.
138+
- `sysroot` — Path to the sysroot.
139+
- `cfg` — List of cfg values. See [conditional compilation] for more
140+
information about cfg values.
141+
- `target-list` — List of known targets. The target may be selected with the
142+
`--target` flag.
143+
- `target-cpus` — List of available CPU values for the current target. The
144+
target CPU may be selected with the `-C target-cpu=val` flag.
145+
- `target-features` — List of available target features for the current
146+
target. Target features may be enabled with the `-C target-feature=val`
147+
flag.
148+
- `relocation-models` — List of relocation models. Relocation models may be
149+
selected with the `-C relocation-model=val` flag.
150+
- `code-models` — List of code models. Code models may be selected with the
151+
`-C code-model=val` flag.
152+
- `tls-models` — List of Thread Local Storage models supported. The model may
153+
be selected with the `-Z tls-model=val` flag.
154+
- `native-static-libs` — This may be used when creating a `staticlib` crate
155+
type. If this is the only flag, it will perform a full compilation and
156+
include a diagnostic note that indicates the linker flags to use when
157+
linking the resulting static library. The note starts with the text
158+
`native-static-libs:` to make it easier to fetch the output.
159+
160+
[conditional compilation]: ../reference/conditional-compilation.html
42161

43162
## `-g`: include debug information
44163

@@ -54,7 +173,8 @@ This flag controls the output filename.
54173

55174
## `--out-dir`: directory to write the output in
56175

57-
The outputted crate will be written to this directory.
176+
The outputted crate will be written to this directory. This flag is ignored if
177+
the `-o` flag is used.
58178

59179
## `--explain`: provide a detailed explanation of an error message
60180

@@ -111,8 +231,9 @@ This flag, when combined with other flags, makes them produce extra output.
111231

112232
## `--extern`: specify where an external library is located
113233

114-
This flag allows you to pass the name and location of an external crate that will
115-
be linked into the crate you're buildling.
234+
This flag allows you to pass the name and location of an external crate that
235+
will be linked into the crate you are building. This flag may be specified
236+
multiple times. The format of the value should be `CRATENAME=PATH`.
116237

117238
## `--sysroot`: Override the system root
118239

@@ -121,8 +242,32 @@ distribution; this flag allows that to be overridden.
121242

122243
## `--error-format`: control how errors are produced
123244

124-
This flag lets you control the format of errors.
245+
This flag lets you control the format of messages. Messages are printed to
246+
stderr. The valid options are:
247+
248+
- `human` — Human-readable output. This is the default.
249+
- `json` — Structured JSON output.
250+
- `short` — Short, one-line messages.
125251

126252
## `--color`: configure coloring of output
127253

128-
This flag lets you control color settings of the output.
254+
This flag lets you control color settings of the output. The valid options
255+
are:
256+
257+
- `auto` — Use colors if output goes to a tty. This is the default.
258+
- `always` — Always use colors.
259+
- `never` — Never colorize output.
260+
261+
## `--remap-path-prefix`: remap source names in output
262+
263+
Remap source path prefixes in all output, including compiler diagnostics,
264+
debug information, macro expansions, etc. It takes a value of the form
265+
`FROM=TO` where a path prefix equal to `FROM` is rewritten to the value `TO`.
266+
The `FROM` may itself contain an `=` symbol, but the `TO` value may not. This
267+
flag may be specified multiple times.
268+
269+
This is useful for normalizing build products, for example by removing the
270+
current directory out of pathnames emitted into the object files. The
271+
replacement is purely textual, with no consideration of the current system's
272+
pathname syntax. For example `--remap-path-prefix foo=bar` will match
273+
`foo/lib.rs` but not `./foo/lib.rs`.

src/liballoc/string.rs

+8
Original file line numberDiff line numberDiff line change
@@ -2189,6 +2189,14 @@ impl From<&str> for String {
21892189
}
21902190
}
21912191

2192+
#[stable(feature = "from_ref_string", since = "1.35.0")]
2193+
impl From<&String> for String {
2194+
#[inline]
2195+
fn from(s: &String) -> String {
2196+
s.clone()
2197+
}
2198+
}
2199+
21922200
// note: test pulls in libstd, which causes errors here
21932201
#[cfg(not(test))]
21942202
#[stable(feature = "string_from_box", since = "1.18.0")]

0 commit comments

Comments
 (0)