diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3834c54d6c4f7..a86742d7bd4ff 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 @@ -18,11 +19,12 @@ 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 ## 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: @@ -333,13 +347,24 @@ 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. ## 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 +395,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 +463,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 +483,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 78a9f509bbcb4..95d543b8bb33f 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 diff --git a/src/doc/book b/src/doc/book index d09c9e8144ed3..08e79609ce885 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 a4322ccb289a4..0ee3f7265e9d0 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 266d429a48468..36adc6ae504c6 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 ea8dd82087849..4cb6e8405f398 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 8975b680ca7fa..e0efdbcd4c7a0 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")] diff --git a/src/librustc/README.md b/src/librustc/README.md index 87de284d011b3..3ac2949b83e46 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 ======== diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 22ba7479ead62..9321121fe1550 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -145,11 +145,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) => { diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 62d8de18f4b45..1d62853e906a0 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 /// /// ``` diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 0504e889ea10b..86571f921f03a 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1927,7 +1927,7 @@ pub enum ItemKind { /// /// E.g. `trait Foo { .. }` or `trait Foo { .. }` Trait(Unsafety, Generics, TyParamBounds, Vec), - // Default trait implementation. + /// Auto trait implementation. /// /// E.g. `impl Trait for .. {}` or `impl Trait for .. {}` DefaultImpl(Unsafety, TraitRef), diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f6e85ed6725ce..1dac0433f1479 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)),