Skip to content

Commit ebb1a48

Browse files
authored
Merge branch 'master' into frewsxcv-dyn
2 parents 033cbfe + 821bad3 commit ebb1a48

File tree

204 files changed

+2034
-1218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+2034
-1218
lines changed

CONTRIBUTING.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -494,16 +494,11 @@ the version in `Cargo.lock`, so the build can no longer continue.
494494
To resolve this, we need to update `Cargo.lock`. Luckily, cargo provides a
495495
command to do this easily.
496496

497-
First, go into the `src/` directory since that is where `Cargo.toml` is in
498-
the rust repository. Then run, `cargo update -p rustfmt-nightly` to solve
499-
the problem.
500-
501497
```
502-
$ cd src
503498
$ cargo update -p rustfmt-nightly
504499
```
505500

506-
This should change the version listed in `src/Cargo.lock` to the new version you updated
501+
This should change the version listed in `Cargo.lock` to the new version you updated
507502
the submodule to. Running `./x.py build` should work now.
508503

509504
## Writing Documentation

src/Cargo.lock renamed to Cargo.lock

+108-68
Large diffs are not rendered by default.
+30-30
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
[workspace]
22
members = [
3-
"bootstrap",
4-
"rustc",
5-
"libstd",
6-
"libtest",
7-
"librustc_codegen_llvm",
8-
"tools/cargotest",
9-
"tools/clippy",
10-
"tools/compiletest",
11-
"tools/error_index_generator",
12-
"tools/linkchecker",
13-
"tools/rustbook",
14-
"tools/unstable-book-gen",
15-
"tools/tidy",
16-
"tools/build-manifest",
17-
"tools/remote-test-client",
18-
"tools/remote-test-server",
19-
"tools/rust-installer",
20-
"tools/cargo",
21-
"tools/rustdoc",
22-
"tools/rls",
23-
"tools/rustfmt",
24-
"tools/miri",
25-
"tools/rustdoc-themes",
3+
"src/bootstrap",
4+
"src/rustc",
5+
"src/libstd",
6+
"src/libtest",
7+
"src/librustc_codegen_llvm",
8+
"src/tools/cargotest",
9+
"src/tools/clippy",
10+
"src/tools/compiletest",
11+
"src/tools/error_index_generator",
12+
"src/tools/linkchecker",
13+
"src/tools/rustbook",
14+
"src/tools/unstable-book-gen",
15+
"src/tools/tidy",
16+
"src/tools/build-manifest",
17+
"src/tools/remote-test-client",
18+
"src/tools/remote-test-server",
19+
"src/tools/rust-installer",
20+
"src/tools/cargo",
21+
"src/tools/rustdoc",
22+
"src/tools/rls",
23+
"src/tools/rustfmt",
24+
"src/tools/miri",
25+
"src/tools/rustdoc-themes",
2626
]
2727
exclude = [
28-
"tools/rls/test_data",
28+
"src/tools/rls/test_data",
2929
]
3030

3131
# Curiously, LLVM 7.0 will segfault if compiled with opt-level=3
@@ -50,18 +50,18 @@ debug-assertions = false
5050
# so we use a `[patch]` here to override the github repository with our local
5151
# vendored copy.
5252
[patch."https://github.com/rust-lang/cargo"]
53-
cargo = { path = "tools/cargo" }
53+
cargo = { path = "src/tools/cargo" }
5454

5555
[patch.crates-io]
5656
# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
5757
# that we're shipping as well (to ensure that the rustfmt in RLS and the
5858
# `rustfmt` executable are the same exact version).
59-
rustfmt-nightly = { path = "tools/rustfmt" }
59+
rustfmt-nightly = { path = "src/tools/rustfmt" }
6060

61-
# See comments in `tools/rustc-workspace-hack/README.md` for what's going on
61+
# See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on
6262
# here
63-
rustc-workspace-hack = { path = 'tools/rustc-workspace-hack' }
63+
rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
6464

6565
[patch."https://github.com/rust-lang-nursery/rust-clippy"]
66-
clippy_lints = { path = "tools/clippy/clippy_lints" }
67-
rustc_tools_util = { path = "tools/clippy/rustc_tools_util" }
66+
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
67+
rustc_tools_util = { path = "src/tools/clippy/rustc_tools_util" }

RELEASES.md

+77
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
1+
Version 1.31.0 (2018-12-06)
2+
==========================
3+
4+
Language
5+
--------
6+
- 🎉 [This version marks the release of the 2018 edition of Rust.][54057] 🎉
7+
- [New lifetime elision rules now allow for eliding lifetimes in functions and
8+
impl headers.][54778] E.g. `impl<'a> Reader for BufReader<'a> {}` can now be
9+
`impl Reader for BufReader<'_> {}`. Lifetimes are still required to be defined
10+
in structs.
11+
- [You can now define and use `const` functions.][54835] These are currently
12+
a strict minimal subset of the [const fn RFC][RFC-911]. Refer to the
13+
[language reference][const-reference] for what exactly is available.
14+
- [You can now use tool lints, which allow you to scope lints from external
15+
tools using attributes.][54870] E.g. `#[allow(clippy::filter_map)]`.
16+
- [`#[no_mangle]` and `#[export_name]` attributes can now be located anywhere in
17+
a crate, not just in exported functions.][54451]
18+
- [You can now use parentheses in pattern matches.][54497]
19+
20+
Compiler
21+
--------
22+
- [Updated musl to 1.1.20][54430]
23+
24+
Libraries
25+
---------
26+
- [You can now convert `num::NonZero*` types to their raw equivalvents using the
27+
`From` trait.][54240] E.g. `u8` now implements `From<NonZeroU8>`.
28+
- [You can now convert a `&Option<T>` into `Option<&T>` and `&mut Option<T>`
29+
into `Option<&mut T>` using the `From` trait.][53218]
30+
- [You can now multiply (`*`) a `time::Duration` by a `u32`.][52813]
31+
32+
33+
Stabilized APIs
34+
---------------
35+
- [`slice::align_to`]
36+
- [`slice::align_to_mut`]
37+
- [`slice::chunks_exact`]
38+
- [`slice::chunks_exact_mut`]
39+
- [`slice::rchunks`]
40+
- [`slice::rchunks_mut`]
41+
- [`slice::rchunks_exact`]
42+
- [`slice::rchunks_exact_mut`]
43+
- [`Option::replace`]
44+
45+
Cargo
46+
-----
47+
- [Cargo will now download crates in parallel using HTTP/2.][cargo/6005]
48+
- [You can now rename packages in your Cargo.toml][cargo/6319] We have a guide
49+
on [how to use the `package` key in your dependencies.][cargo-rename-reference]
50+
51+
[52813]: https://github.com/rust-lang/rust/pull/52813/
52+
[53218]: https://github.com/rust-lang/rust/pull/53218/
53+
[53555]: https://github.com/rust-lang/rust/issues/53555/
54+
[54057]: https://github.com/rust-lang/rust/pull/54057/
55+
[54240]: https://github.com/rust-lang/rust/pull/54240/
56+
[54430]: https://github.com/rust-lang/rust/pull/54430/
57+
[54451]: https://github.com/rust-lang/rust/pull/54451/
58+
[54497]: https://github.com/rust-lang/rust/pull/54497/
59+
[54778]: https://github.com/rust-lang/rust/pull/54778/
60+
[54835]: https://github.com/rust-lang/rust/pull/54835/
61+
[54870]: https://github.com/rust-lang/rust/pull/54870/
62+
[RFC-911]: https://github.com/rust-lang/rfcs/pull/911
63+
[`Option::replace`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.replace
64+
[`slice::align_to_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.align_to_mut
65+
[`slice::align_to`]: https://doc.rust-lang.org/std/primitive.slice.html#method.align_to
66+
[`slice::chunks_exact_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact_mut
67+
[`slice::chunks_exact`]: https://doc.rust-lang.org/std/primitive.slice.html#method.chunks_exact
68+
[`slice::rchunks_exact_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_mut
69+
[`slice::rchunks_exact`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_exact
70+
[`slice::rchunks_mut`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks_mut
71+
[`slice::rchunks`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rchunks
72+
[cargo/6005]: https://github.com/rust-lang/cargo/pull/6005/
73+
[cargo/6319]: https://github.com/rust-lang/cargo/pull/6319/
74+
[cargo-rename-reference]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml
75+
[const-reference]: https://doc.rust-lang.org/reference/items/functions.html#const-functions
76+
77+
178
Version 1.30.0 (2018-10-25)
279
==========================
380

src/bootstrap/bootstrap.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ def bootstrap(help_triggered):
801801
registry = 'https://example.com'
802802
803803
[source.vendored-sources]
804-
directory = '{}/src/vendor'
804+
directory = '{}/vendor'
805805
""".format(build.rust_root))
806806
else:
807807
if os.path.exists('.cargo'):

src/bootstrap/dist.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ impl Step for Src {
851851
t!(fs::create_dir_all(&dst_src));
852852

853853
let src_files = [
854-
"src/Cargo.lock",
854+
"Cargo.lock",
855855
];
856856
// This is the reduced set of paths which will become the rust-src component
857857
// (essentially libstd and all of its path dependencies)
@@ -949,6 +949,8 @@ impl Step for PlainSourceTarball {
949949
"configure",
950950
"x.py",
951951
"config.toml.example",
952+
"Cargo.toml",
953+
"Cargo.lock",
952954
];
953955
let src_dirs = [
954956
"src",
@@ -992,7 +994,7 @@ impl Step for PlainSourceTarball {
992994
// Vendor all Cargo dependencies
993995
let mut cmd = Command::new(&builder.initial_cargo);
994996
cmd.arg("vendor")
995-
.current_dir(&plain_dst_src.join("src"));
997+
.current_dir(&plain_dst_src);
996998
builder.run(&mut cmd);
997999
}
9981000

src/bootstrap/doc.rs

+15-11
Original file line numberDiff line numberDiff line change
@@ -260,22 +260,31 @@ impl Step for TheBook {
260260
let compiler = self.compiler;
261261
let target = self.target;
262262
let name = self.name;
263-
// build book first edition
263+
264+
// build book
264265
builder.ensure(Rustbook {
265266
target,
266-
name: INTERNER.intern_string(format!("{}/first-edition", name)),
267+
name: INTERNER.intern_string(name.to_string()),
267268
});
268269

269-
// build book second edition
270+
// building older edition redirects
271+
272+
let source_name = format!("{}/first-edition", name);
270273
builder.ensure(Rustbook {
271274
target,
272-
name: INTERNER.intern_string(format!("{}/second-edition", name)),
275+
name: INTERNER.intern_string(source_name),
273276
});
274277

275-
// build book 2018 edition
278+
let source_name = format!("{}/second-edition", name);
276279
builder.ensure(Rustbook {
277280
target,
278-
name: INTERNER.intern_string(format!("{}/2018-edition", name)),
281+
name: INTERNER.intern_string(source_name),
282+
});
283+
284+
let source_name = format!("{}/2018-edition", name);
285+
builder.ensure(Rustbook {
286+
target,
287+
name: INTERNER.intern_string(source_name),
279288
});
280289

281290
// build the version info page and CSS
@@ -284,11 +293,6 @@ impl Step for TheBook {
284293
target,
285294
});
286295

287-
// build the index page
288-
let index = format!("{}/index.md", name);
289-
builder.info(&format!("Documenting book index ({})", target));
290-
invoke_rustdoc(builder, compiler, target, &index);
291-
292296
// build the redirect pages
293297
builder.info(&format!("Documenting book redirect pages ({})", target));
294298
for file in t!(fs::read_dir(builder.src.join("src/doc/book/redirects"))) {

src/bootstrap/test.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1934,6 +1934,7 @@ impl Step for Distcheck {
19341934
.arg("generate-lockfile")
19351935
.arg("--manifest-path")
19361936
.arg(&toml)
1937+
.env("__CARGO_TEST_ROOT", &dir)
19371938
.current_dir(&dir),
19381939
);
19391940
}

src/bootstrap/tool.rs

+26-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use util::{exe, add_lib_path};
2222
use compile;
2323
use native;
2424
use channel::GitInfo;
25+
use channel;
2526
use cache::Interned;
2627
use toolstate::ToolState;
2728

@@ -240,6 +241,7 @@ pub fn prepare_tool_cargo(
240241

241242
cargo.env("CFG_RELEASE_CHANNEL", &builder.config.channel);
242243
cargo.env("CFG_VERSION", builder.rust_version());
244+
cargo.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM);
243245

244246
let info = GitInfo::new(&builder.config, &dir);
245247
if let Some(sha) = info.sha() {
@@ -258,8 +260,13 @@ pub fn prepare_tool_cargo(
258260
}
259261

260262
macro_rules! tool {
261-
($($name:ident, $path:expr, $tool_name:expr, $mode:expr
262-
$(,llvm_tools = $llvm:expr)* $(,is_external_tool = $external:expr)*;)+) => {
263+
($(
264+
$name:ident, $path:expr, $tool_name:expr, $mode:expr
265+
$(,llvm_tools = $llvm:expr)*
266+
$(,is_external_tool = $external:expr)*
267+
$(,cargo_test_root = $cargo_test_root:expr)*
268+
;
269+
)+) => {
263270
#[derive(Copy, PartialEq, Eq, Clone)]
264271
pub enum Tool {
265272
$(
@@ -281,6 +288,15 @@ macro_rules! tool {
281288
$(Tool::$name => false $(|| $llvm)*,)+
282289
}
283290
}
291+
292+
/// Whether this tool requires may run Cargo for test crates,
293+
/// which currently needs setting the environment variable
294+
/// `__CARGO_TEST_ROOT` to separate it from the workspace.
295+
pub fn needs_cargo_test_root(&self) -> bool {
296+
match self {
297+
$(Tool::$name => false $(|| $cargo_test_root)*,)+
298+
}
299+
}
284300
}
285301

286302
impl<'a> Builder<'a> {
@@ -356,8 +372,9 @@ tool!(
356372
UnstableBookGen, "src/tools/unstable-book-gen", "unstable-book-gen", Mode::ToolBootstrap;
357373
Tidy, "src/tools/tidy", "tidy", Mode::ToolBootstrap;
358374
Linkchecker, "src/tools/linkchecker", "linkchecker", Mode::ToolBootstrap;
359-
CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap;
360-
Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap, llvm_tools = true;
375+
CargoTest, "src/tools/cargotest", "cargotest", Mode::ToolBootstrap, cargo_test_root = true;
376+
Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolBootstrap,
377+
llvm_tools = true, cargo_test_root = true;
361378
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolBootstrap;
362379
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolBootstrap;
363380
RustInstaller, "src/tools/rust-installer", "fabricate", Mode::ToolBootstrap,
@@ -676,6 +693,11 @@ impl<'a> Builder<'a> {
676693
}
677694
}
678695

696+
// Set `__CARGO_TEST_ROOT` to the build directory if needed.
697+
if tool.needs_cargo_test_root() {
698+
cmd.env("__CARGO_TEST_ROOT", &self.config.out);
699+
}
700+
679701
add_lib_path(lib_paths, cmd);
680702
}
681703

src/doc/book

Submodule book updated 438 files

src/doc/nomicon

src/doc/reference

src/doc/unstable-book/src/language-features/macro-literal-matcher.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ The tracking issue for this feature is: [#35625]
44

55
The RFC is: [rfc#1576].
66

7-
With this feature gate enabled, the [list of fragment specifiers][frags] gains one more entry:
7+
With this feature gate enabled, the [list of designators] gains one more entry:
88

99
* `literal`: a literal. Examples: 2, "string", 'c'
1010

1111
A `literal` may be followed by anything, similarly to the `ident` specifier.
1212

1313
[rfc#1576]: http://rust-lang.github.io/rfcs/1576-macros-literal-matcher.html
1414
[#35625]: https://github.com/rust-lang/rust/issues/35625
15-
[frags]: ../book/first-edition/macros.html#syntactic-requirements
15+
[list of designators]: ../reference/macros-by-example.html
1616

1717
------------------------

src/doc/unstable-book/src/language-features/plugin.md

-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,6 @@ of extensions. See `Registry::register_syntax_extension` and the
137137

138138
## Tips and tricks
139139

140-
Some of the [macro debugging tips](../book/first-edition/macros.html#debugging-macro-code) are applicable.
141-
142140
You can use `syntax::parse` to turn token trees into
143141
higher-level syntax elements like expressions:
144142

0 commit comments

Comments
 (0)