From daf3ed5651f13857e640d183987ea83d007988aa Mon Sep 17 00:00:00 2001 From: Garrett Berg Date: Fri, 29 Sep 2017 17:19:17 -0600 Subject: [PATCH 01/10] Add links to headers in README and CONTRIBUTING and dependencies to CONTRIBUTING --- CONTRIBUTING.md | 18 ++++++++++++++++++ README.md | 12 ++++++++++++ 2 files changed, 30 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3834c54d6c4..3715ad287aa 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,5 @@ # Contributing to Rust +[contributing-to-rust]: #contributing-to-rust Thank you for your interest in contributing to Rust! There are many ways to contribute, and we appreciate all of them. This document is a bit long, so here's @@ -23,6 +24,7 @@ As a reminder, all contributors are expected to follow our [Code of Conduct][coc [coc]: https://www.rust-lang.org/conduct.html ## Feature Requests +[feature-requests]: #feature-requests To request a change to the way that the Rust language works, please open an issue in the [RFCs repository](https://github.com/rust-lang/rfcs/issues/new) @@ -30,6 +32,7 @@ rather than this one. New features and other significant language changes must go through the RFC process. ## Bug Reports +[bug-reports]: #bug-reports While bugs are unfortunate, they're a reality in software. We can't fix what we don't know about, so please report liberally. If you're not sure if something @@ -80,6 +83,7 @@ $ RUST_BACKTRACE=1 rustc ... ``` ## The Build System +[the-build-system]: #the-build-system Rust's build system allows you to bootstrap the compiler, run tests & benchmarks, generate documentation, install a fresh build of Rust, and more. @@ -94,6 +98,7 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals]. [bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/ ### Configuration +[configuration]: #configuration Before you can start building the compiler you need to configure the build for your system. In most cases, that will just mean using the defaults provided @@ -125,6 +130,11 @@ file. If you still have a `config.mk` file in your directory - from `./configure` - you may need to delete it for `config.toml` to work. ### Building +[building]: #building + +Dependencies +- [build dependencies](README.md#building-from-source) +- `gdb` 6.2.0 minimum, 7.1 or later recommended for test builds The build system uses the `x.py` script to control the build process. This script is used to build, test, and document various parts of the compiler. You can @@ -194,6 +204,7 @@ Note: Previously `./configure` and `make` were used to build this project. They are still available, but `x.py` is the recommended build system. ### Useful commands +[useful-commands]: #useful-commands Some common invocations of `x.py` are: @@ -234,6 +245,7 @@ Some common invocations of `x.py` are: code. ### Using your local build +[using-local-build]: #using-local-build If you use Rustup to manage your rust install, it has a feature called ["custom toolchains"][toolchain-link] that you can use to access your newly-built compiler @@ -262,6 +274,7 @@ stage 1. `python x.py build --stage 1 src/libstd src/tools/rustdoc` will build rustdoc and libstd, which will allow rustdoc to be run with that toolchain.) ## Pull Requests +[pull-requests]: #pull-requests Pull requests are the primary mechanism we use to change Rust. GitHub itself has some [great documentation][pull-requests] on using the Pull Request feature. @@ -326,6 +339,7 @@ it can be found [here](https://github.com/rust-lang/rust-wiki-backup/blob/master/Note-testsuite.md). ### External Dependencies +[external-dependencies]: #external-dependencies Currently building Rust will also build the following external projects: @@ -340,6 +354,7 @@ It can also be more convenient during development to set `submodules = false` in the `config.toml` to prevent `x.py` from resetting to the original branch. ## Writing Documentation +[writing-documentation]: #writing-documentation Documentation improvements are very welcome. The source of `doc.rust-lang.org` is located in `src/doc` in the tree, and standard API documentation is generated @@ -370,6 +385,7 @@ reference to `doc/reference.html`. The CSS might be messed up, but you can verify that the HTML is right. ## Issue Triage +[issue-triage]: #issue-triage Sometimes, an issue will stay open, even though the bug has been fixed. And sometimes, the original bug may go stale because something has changed in the @@ -437,6 +453,7 @@ If you're looking for somewhere to start, check out the [E-easy][eeasy] tag. [rfcbot]: https://github.com/dikaiosune/rust-dashboard/blob/master/RFCBOT.md ## Out-of-tree Contributions +[out-of-tree-contributions]: #out-of-tree-contributions There are a number of other ways to contribute to Rust that don't deal with this repository. @@ -456,6 +473,7 @@ valuable! [community-library]: https://github.com/rust-lang/rfcs/labels/A-community-library ## Helpful Links and Information +[helpful-info]: #helpful-info For people new to Rust, and just starting to contribute, or even for more seasoned developers, some useful places to look for information diff --git a/README.md b/README.md index 78a9f509bbc..95d543b8bb3 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ standard library, and documentation. [Rust]: https://www.rust-lang.org ## Quick Start +[quick-start]: #quick-start Read ["Installation"] from [The Book]. @@ -13,6 +14,7 @@ Read ["Installation"] from [The Book]. [The Book]: https://doc.rust-lang.org/book/index.html ## Building from Source +[building-from-source]: #building-from-source 1. Make sure you have installed the dependencies: @@ -52,6 +54,7 @@ Read ["Installation"] from [The Book]. [Cargo]: https://github.com/rust-lang/cargo ### Building on Windows +[building-on-windows]: #building-on-windows There are two prominent ABIs in use on Windows: the native (MSVC) ABI used by Visual Studio, and the GNU ABI used by the GCC toolchain. Which version of Rust @@ -61,6 +64,7 @@ for interop with GNU software built using the MinGW/MSYS2 toolchain use the GNU build. #### MinGW +[windows-mingw]: #windows-mingw [MSYS2][msys2] can be used to easily build Rust on Windows: @@ -101,6 +105,7 @@ build. ``` #### MSVC +[windows-msvc]: #windows-msvc MSVC builds of Rust additionally require an installation of Visual Studio 2013 (or later) so `rustc` can use its linker. Make sure to check the “C++ tools” @@ -124,6 +129,7 @@ python x.py build ``` #### Specifying an ABI +[specifying-an-abi]: #specifying-an-abi Each specific ABI can also be used from either environment (for example, using the GNU ABI in powershell) by using an explicit build triple. The available @@ -141,6 +147,7 @@ in Building From Source), and modifying the `build` option under the `[build]` section. ### Configure and Make +[configure-and-make]: #configure-and-make While it's not the recommended build system, this project also provides a configure script and makefile (the latter of which just invokes `x.py`). @@ -155,6 +162,7 @@ When using the configure script, the generated `config.mk` file may override the `config.mk` file. ## Building Documentation +[building-documentation]: #building-documentation If you’d like to build the documentation, it’s almost the same: @@ -167,6 +175,7 @@ the ABI used. I.e., if the ABI was `x86_64-pc-windows-msvc`, the directory will `build\x86_64-pc-windows-msvc\doc`. ## Notes +[notes]: #notes Since the Rust compiler is written in Rust, it must be built by a precompiled "snapshot" version of itself (made in an earlier state of @@ -192,6 +201,7 @@ There is more advice about hacking on Rust in [CONTRIBUTING.md]. [CONTRIBUTING.md]: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md ## Getting Help +[getting-help]: #getting-help The Rust community congregates in a few places: @@ -204,6 +214,7 @@ The Rust community congregates in a few places: [users.rust-lang.org]: https://users.rust-lang.org/ ## Contributing +[contributing]: #contributing To contribute to Rust, please see [CONTRIBUTING](CONTRIBUTING.md). @@ -217,6 +228,7 @@ Rust. And a good place to ask for help would be [#rust-beginners]. [#rust-beginners]: irc://irc.mozilla.org/rust-beginners ## License +[license]: #license Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various From e6c3c7f2dce7f66ae96c5dbd3a737bd96108ab21 Mon Sep 17 00:00:00 2001 From: Michal Budzynski Date: Mon, 18 Sep 2017 01:24:29 +0200 Subject: [PATCH 02/10] Corrected the CONTRIBUTING.md "External Dependencies" section --- CONTRIBUTING.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3834c54d6c4..ac89462e492 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -333,8 +333,18 @@ Currently building Rust will also build the following external projects: * [miri](https://github.com/solson/miri) If your changes break one of these projects, you need to fix them by opening -a pull request against the broken project. When you have opened a pull request, -you can disable the tool via `src/tools/toolstate.toml`. +a pull request against the broken project asking to put the fix on a branch. +Then you can disable the tool building via `src/tools/toolstate.toml`. +Once the branch containing your fix is likely to be merged, you can point +the affected submodule at this branch. + +Don't forget to also add your changes with + +``` +git add path/to/submodule +``` + +outside the submodule. It can also be more convenient during development to set `submodules = false` in the `config.toml` to prevent `x.py` from resetting to the original branch. From 5517a1ce79757e64ffbaa9c5a6c708b5ddd0102d Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Mon, 2 Oct 2017 05:59:56 -0400 Subject: [PATCH 03/10] fix ItemKind::DefaultImpl doc comment Upgrade comment to doc comment. --- src/libsyntax/ast.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 0504e889ea1..4bf37302c8d 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1927,9 +1927,9 @@ pub enum ItemKind { /// /// E.g. `trait Foo { .. }` or `trait Foo { .. }` Trait(Unsafety, Generics, TyParamBounds, Vec), - // Default trait implementation. + /// Default trait implementation. /// - /// E.g. `impl Trait for .. {}` or `impl Trait for .. {}` + /// E.g. `default impl Trait for .. {}` or `default impl Trait for .. {}` DefaultImpl(Unsafety, TraitRef), /// An implementation. /// From fc5e8dc1b5dd6a81d92e6981d7689f81b108c5c3 Mon Sep 17 00:00:00 2001 From: Alex Burka Date: Mon, 2 Oct 2017 07:30:09 -0400 Subject: [PATCH 04/10] fix comment on DefaultImpl --- src/libsyntax/ast.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 4bf37302c8d..86571f921f0 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1927,9 +1927,9 @@ pub enum ItemKind { /// /// E.g. `trait Foo { .. }` or `trait Foo { .. }` Trait(Unsafety, Generics, TyParamBounds, Vec), - /// Default trait implementation. + /// Auto trait implementation. /// - /// E.g. `default impl Trait for .. {}` or `default impl Trait for .. {}` + /// E.g. `impl Trait for .. {}` or `impl Trait for .. {}` DefaultImpl(Unsafety, TraitRef), /// An implementation. /// From 851b6d4762ba364151d472bbb7cdaaa61e6e5788 Mon Sep 17 00:00:00 2001 From: steveklabnik Date: Mon, 2 Oct 2017 10:21:54 -0400 Subject: [PATCH 05/10] update books for next release Also fixes some stdlib links to the reference which have changed. --- src/doc/book | 2 +- src/doc/nomicon | 2 +- src/doc/reference | 2 +- src/libcore/ops/deref.rs | 4 ++-- src/libcore/ops/mod.rs | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/doc/book b/src/doc/book index d09c9e8144e..08e79609ce8 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit d09c9e8144ed32170b7596abb145ade8b097acaf +Subproject commit 08e79609ce88583fa7286157dfe497486a09fabe diff --git a/src/doc/nomicon b/src/doc/nomicon index a4322ccb289..0ee3f7265e9 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit a4322ccb289a43cc238d4536982f184a3eec9ba7 +Subproject commit 0ee3f7265e9d09746d901cef6f1f300baff1d923 diff --git a/src/doc/reference b/src/doc/reference index 266d429a484..36adc6ae504 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 266d429a48468371d2d90669f6a30dd659bb4bdb +Subproject commit 36adc6ae504c6e0343ab5d7b3871f0a2a71236da diff --git a/src/libcore/ops/deref.rs b/src/libcore/ops/deref.rs index ea8dd820878..4cb6e8405f3 100644 --- a/src/libcore/ops/deref.rs +++ b/src/libcore/ops/deref.rs @@ -40,7 +40,7 @@ /// [book]: ../../book/second-edition/ch15-02-deref.html /// [`DerefMut`]: trait.DerefMut.html /// [more]: #more-on-deref-coercion -/// [ref-deref-op]: ../../reference/expressions.html#the-dereference-operator +/// [ref-deref-op]: ../../reference/expressions/operator-expr.html#the-dereference-operator /// [ref-deref-trait]: ../../reference/the-deref-trait.html /// [type coercions]: ../../reference/type-coercions.html /// @@ -127,7 +127,7 @@ impl<'a, T: ?Sized> Deref for &'a mut T { /// [book]: ../../book/second-edition/ch15-02-deref.html /// [`Deref`]: trait.Deref.html /// [more]: #more-on-deref-coercion -/// [ref-deref-op]: ../../reference/expressions.html#the-dereference-operator +/// [ref-deref-op]: ../../reference/expressions/operator-expr.html#the-dereference-operator /// [ref-deref-trait]: ../../reference/the-deref-trait.html /// [type coercions]: ../../reference/type-coercions.html /// diff --git a/src/libcore/ops/mod.rs b/src/libcore/ops/mod.rs index 8975b680ca7..e0efdbcd4c7 100644 --- a/src/libcore/ops/mod.rs +++ b/src/libcore/ops/mod.rs @@ -150,7 +150,7 @@ //! [`Sub`]: trait.Sub.html //! [`Mul`]: trait.Mul.html //! [`clone`]: ../clone/trait.Clone.html#tymethod.clone -//! [operator precedence]: ../../reference/expressions.html#operator-precedence +//! [operator precedence]: ../../reference/expressions/operator-expr.html#operator-precedence #![stable(feature = "rust1", since = "1.0.0")] From 17f6b6810b4abdbeb4f493e497c13825fb0f6ad4 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 2 Oct 2017 22:40:51 +0200 Subject: [PATCH 06/10] Remove assertion that the argument to every `EndRegion` correspond to some dataflow-tracked borrow-data entry. Fix #44828 (The comment thread on the aforementioned issue discusses why its best to just remove this assertion.) --- src/librustc_mir/dataflow/impls/borrows.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 3f815ec83e3..f1fe6e79dfe 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -122,11 +122,11 @@ impl<'a, 'tcx> BitDenotation for Borrows<'a, 'tcx> { }); match stmt.kind { mir::StatementKind::EndRegion(region_scope) => { - let borrow_indexes = self.region_map.get(&ReScope(region_scope)).unwrap_or_else(|| { - panic!("could not find BorrowIndexs for region scope {:?}", region_scope); - }); - - for idx in borrow_indexes { sets.kill(&idx); } + if let Some(borrow_indexes) = self.region_map.get(&ReScope(region_scope)) { + for idx in borrow_indexes { sets.kill(&idx); } + } else { + // (if there is no entry, then there are no borrows to be tracked) + } } mir::StatementKind::Assign(_, ref rhs) => { From 2d108ec00b7d4bc722f2287d5b0831dc3b74cedd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Suriyaa=20=E2=9C=8C=EF=B8=8F=EF=B8=8F?= Date: Tue, 3 Oct 2017 12:36:16 +0200 Subject: [PATCH 07/10] Use HTTPS protocol for `chat.mibbit.com` --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3834c54d6c4..497e4892f70 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,7 @@ hop on [#rust-internals][pound-rust-internals]. As a reminder, all contributors are expected to follow our [Code of Conduct][coc]. -[pound-rust-internals]: http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals +[pound-rust-internals]: https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-internals [internals]: https://internals.rust-lang.org [coc]: https://www.rust-lang.org/conduct.html From b3d85fc2ddd7e5e7cd7da061c89109e60b03a36a Mon Sep 17 00:00:00 2001 From: Maik Klein Date: Tue, 3 Oct 2017 18:57:52 +0200 Subject: [PATCH 08/10] Typo in `librustc/README.md` --- src/librustc/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/README.md b/src/librustc/README.md index 87de284d011..3ac2949b83e 100644 --- a/src/librustc/README.md +++ b/src/librustc/README.md @@ -153,7 +153,7 @@ take: - LLVM then runs its various optimizations, which produces a number of `.o` files (one for each "codegen unit"). 6. **Linking** - - Finally, those `.o` files are linke together. + - Finally, those `.o` files are linked together. Glossary ======== From e1df72fdababd4f8217762d64c1f066a902b2fe1 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 4 Oct 2017 14:03:23 +0200 Subject: [PATCH 09/10] Add missing urls for Mutex --- src/libstd/sync/mutex.rs | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 62d8de18f4b..1d62853e906 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -19,10 +19,10 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; /// A mutual exclusion primitive useful for protecting shared data /// /// This mutex will block threads waiting for the lock to become available. The -/// mutex can also be statically initialized or created via a `new` +/// mutex can also be statically initialized or created via a [`new`] /// constructor. Each mutex has a type parameter which represents the data that /// it is protecting. The data can only be accessed through the RAII guards -/// returned from `lock` and `try_lock`, which guarantees that the data is only +/// returned from [`lock`] and [`try_lock`], which guarantees that the data is only /// ever accessed when the mutex is locked. /// /// # Poisoning @@ -33,16 +33,24 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult}; /// data by default as it is likely tainted (some invariant is not being /// upheld). /// -/// For a mutex, this means that the `lock` and `try_lock` methods return a -/// `Result` which indicates whether a mutex has been poisoned or not. Most -/// usage of a mutex will simply `unwrap()` these results, propagating panics +/// For a mutex, this means that the [`lock`] and [`try_lock`] methods return a +/// [`Result`] which indicates whether a mutex has been poisoned or not. Most +/// usage of a mutex will simply [`unwrap()`] these results, propagating panics /// among threads to ensure that a possibly invalid invariant is not witnessed. /// /// A poisoned mutex, however, does not prevent all access to the underlying -/// data. The `PoisonError` type has an `into_inner` method which will return +/// data. The [`PoisonError`] type has an [`into_inner`] method which will return /// the guard that would have otherwise been returned on a successful lock. This /// allows access to the data, despite the lock being poisoned. /// +/// [`new`]: #method.new +/// [`lock`]: #method.lock +/// [`try_lock`]: #method.try_lock +/// [`Result`]: ../../std/result/enum.Result.html +/// [`unwrap()`]: ../../std/result/enum.Result.html#method.unwrap +/// [`PoisonError`]: ../../std/sync/struct.PoisonError.html +/// [`into_inner`]: ../../std/sync/struct.PoisonError.html#method.into_inner +/// /// # Examples /// /// ``` @@ -226,7 +234,7 @@ impl Mutex { /// Attempts to acquire this lock. /// - /// If the lock could not be acquired at this time, then `Err` is returned. + /// If the lock could not be acquired at this time, then [`Err`] is returned. /// Otherwise, an RAII guard is returned. The lock will be unlocked when the /// guard is dropped. /// @@ -238,6 +246,8 @@ impl Mutex { /// this call will return failure if the mutex would otherwise be /// acquired. /// + /// [`Err`]: ../../std/result/enum.Result.html#variant.Err + /// /// # Examples /// /// ``` From 2af12b7e4531d9feaaae6f456751ace5d68d0fd4 Mon Sep 17 00:00:00 2001 From: QuietMisdreavus Date: Wed, 4 Oct 2017 10:47:45 -0500 Subject: [PATCH 10/10] add the issue number to doc_masked's feature gate --- src/libsyntax/feature_gate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index e92a7484f33..fe58840c555 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -378,7 +378,7 @@ declare_features! ( // #[doc(cfg(...))] (active, doc_cfg, "1.21.0", Some(43781)), // #[doc(masked)] - (active, doc_masked, "1.21.0", None), + (active, doc_masked, "1.21.0", Some(44027)), // allow `#[must_use]` on functions and comparison operators (RFC 1940) (active, fn_must_use, "1.21.0", Some(43302)),