Commit Graph

137453 Commits

Author SHA1 Message Date
Jonas Schievink
054c29d22c
Rollup merge of #80279 - Yaulendil:str-as-mut, r=m-ou-se
Implement missing `AsMut<str>` for `str`

Allows `&mut str` to be taken by a Generic which requires `T` such that `T: AsMut<str>`. Motivating example:

```rust
impl<'i, T> From<T> for StructImmut<'i> where
    T: AsRef<str> + 'i,
{
    fn from(asref: T) -> Self {
        let string: &str = asref.as_ref();
        //  ...
    }
}

impl<'i, T> From<T> for StructMut<'i> where
    T: AsMut<str> + 'i,
{
    fn from(mut asmut: T) -> Self {
        let string: &mut str = asmut.as_mut();
        //  ...
    }
}
```

The Immutable form of this structure can be constructed by `StructImmut::from(s)` where `s` may be a `&String` or a `&str`, because `AsRef<str>` is implemented for `str`. However, the mutable form of the structure can be constructed in the same way **only** with a `&mut String`, and **not** with a `&mut str`.

This change does have some precedent, because as can be seen in [the Implementors](https://doc.rust-lang.org/std/convert/trait.AsMut.html#implementors), `AsMut<[T]>` is implemented for `[T]` as well as for `Vec<T>`, but `AsMut<str>` is implemented only for `String`. This would complete the symmetry.

As a trait implementation, this should be immediately stable.
2021-01-31 01:47:23 +01:00
Jonas Schievink
b28a1b2951
Rollup merge of #80053 - gilescope:include-ignore, r=m-ou-se
stabilise `cargo test -- --include-ignored`

stabilise `cargo test -- --include-ignored`

On stable there's no way to run ignored tests as well as the normal tests.

An example use case where stabilising this would help:
Exercism has some initial tests and then some additional ignored tests that people run currently with --ignore but currently they can't run all the tests in one go without being on nightly. It would be a little more ergonomic if this flag was stablilised.

( Fixes  #65770 )

I built with ./x.py build -i library/test - but as libtest is a dylib is there an easy way to invoke it manually to check it's working as expected? (I've updated the automated tests.)
2021-01-31 01:47:22 +01:00
Jonas Schievink
ac37c326ae
Rollup merge of #79285 - yoshuawuyts:stabilize-arc_mutate_strong_count, r=m-ou-se
Stabilize Arc::{increment,decrement}_strong_count

Tracking issue: https://github.com/rust-lang/rust/issues/71983

Stabilizes `Arc::{incr,decr}_strong_count`, enabling unsafely incrementing an decrementing the Arc strong count directly with fewer gotchas. This API was first introduced on nightly six months ago, and has not seen any changes since. The initial PR showed two existing pieces of code that would benefit from this API, and included a change inside the stdlib to use this.

Given the small surface area, predictable use, and no changes since introduction, I'd like to propose we stabilize this.

closes https://github.com/rust-lang/rust/issues/71983
r? `@Mark-Simulacrum`

## Links
 * [Initial implementation](https://github.com/rust-lang/rust/pull/70733)
 * [Motivation from #68700](https://github.com/rust-lang/rust/pull/68700#discussion_r396169064)
 * [Real world example in an executor](https://docs.rs/extreme/666.666.666666/src/extreme/lib.rs.html#13)
2021-01-31 01:47:20 +01:00
Jonas Schievink
1bf130519c
Rollup merge of #78044 - oberien:empty-seek, r=m-ou-se
Implement io::Seek for io::Empty

Fix #78029
2021-01-31 01:47:18 +01:00
pierwill
fabb332c1a Edit multiple error code Markdown files
Makes small edits to several error code files. Fixes some
missing punctuation. Changes some wording, grammar, and formatting
for clarity and readability.

Adds a link to the rustup book in E0658.
2021-01-30 15:57:46 -08:00
bors
b3897e3d13 Auto merge of #81560 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`

Biweekly Clippy update (2 days late)
2021-01-30 23:55:16 +00:00
kadmin
6946534d84 Remove const_in_array_rep_expr 2021-01-30 23:20:24 +00:00
b-naber
9946b54823 add suggestion for nested fields 2021-01-30 23:19:41 +01:00
oberien
f1cd17961c impl Seek for Empty
Fix #78029
2021-01-30 23:00:10 +01:00
Mara Bos
bef4ec2fc5
Bump as_mut_str_for_str stable version. 2021-01-30 22:10:25 +01:00
bors
04caa632dd Auto merge of #81565 - nikic:revert, r=nagisa
Revert dist-x86_64-linux update to Clang 11

This reverts commit cb6787ae82, reversing changes made to 0248c6f178.

The change causes errors when linking rustc shared objects with the binutils linker.

Fixes #81554.

r? `@Mark-Simulacrum`
2021-01-30 20:46:58 +00:00
Mara Bos
fe4ac95cb8
Bump stable version of arc_mutate_strong_count 2021-01-30 21:08:30 +01:00
Ömer Sinan Ağacan
8b5187f7ea Fix an old FIXME in redundant paren lint
Referenced bug was fixed a while ago
2021-01-30 22:39:56 +03:00
Ömer Sinan Ağacan
5f1a7aa46d Add a test for #71202
Closes #71202
2021-01-30 21:54:01 +03:00
Mara Bos
db85dac219 Update clippy test output for panic macros. 2021-01-30 19:33:21 +01:00
pierwill
adfb04fc4e Edit rustc_typeck top-level docs
Edit punctuation and wording in note on type variables
vs. type parameters.

Also add missing punctuation and two inter-doc links.
2021-01-30 10:04:19 -08:00
Ivan Tham
131ee07844
Remove extra trailing spaces 2021-01-31 01:36:15 +08:00
Ivan Tham
6d7ef10b46
Fix docblock short code missing end whitespaces 2021-01-31 01:27:21 +08:00
Ivan Tham
d3048eea3c
Improve docblock readability on small screen 2021-01-31 01:19:29 +08:00
The8472
55d6247f52 Clarify that guarantees extend to other advancing iterator methods. 2021-01-30 18:07:48 +01:00
flip1995
21758bf1fb
Merge commit '95c0459217d1661edfa794c8bb122452b92fb485' into clippyup 2021-01-30 18:06:34 +01:00
bors
95c0459217 Auto merge of #6654 - flip1995:no_lazy_static_regex, r=flip1995
No lazy static regex

r? `@llogiq`

#6500

regex is unnecessary for this lint (https://github.com/rust-lang/rust-clippy/pull/6500#discussion_r558555071)
lazy_static is unnecessary. The std lazy feature should be  used instead.

changelog: none
2021-01-30 16:49:45 +00:00
Ivan Tham
4a2a5f0780
Fix ascii art text wrapping in mobile
Fix #81377
2021-01-31 00:45:19 +08:00
Nikita Popov
8c7611caf0 Revert "Auto merge of #81489 - nikic:x86-64-dist-update, r=Mark-Simulacrum"
This reverts commit cb6787ae82, reversing
changes made to 0248c6f178.
2021-01-30 17:44:49 +01:00
flip1995
3874631600
Remove unknown_clippy_lints allow attribute 2021-01-30 17:43:20 +01:00
flip1995
797cf6554d
Get rid of regex and lazy_static dependencies 2021-01-30 17:43:00 +01:00
bors
fd20a8be0d Auto merge of #81453 - jumbatm:clashing-extern-decl-perf, r=nagisa
clashing_extern_declarations: Use symbol interning to avoid string alloc.

Use symbol interning as a hack to avoid allocating a string for every symbol name we store in the seen set. This hopefully addresses the minor perf regression described in https://github.com/rust-lang/rust/pull/80009#issuecomment-763526902.

r? `@nagisa`
2021-01-30 16:41:05 +00:00
bors
4db76a6bcc Auto merge of #6653 - flip1995:rustup, r=flip1995
Rustup

changelog: Deprecate `unknown_clippy_lints` (integrated in `unknown_lints`)

r? `@ghost`
2021-01-30 14:53:30 +00:00
flip1995
60ab57e4eb
Bump nightly version -> 2021-01-30 2021-01-30 15:52:02 +01:00
flip1995
e2859437f9
Merge remote-tracking branch 'upstream/master' into rustup 2021-01-30 15:51:16 +01:00
Steve Heindel
642d27d40a Fix typo in E0759 2021-01-30 09:48:37 -05:00
J. Ryan Stinnett
7e3217845d Balance sidebar Deref cycle check with main content
The `Deref` cycle checks added as part of #80653 were "unbalanced" in the sense
that the main content code path checks for cycles _before_ descending, while the
sidebar checks _after_. Checking _before_ is correct, so this changes the
sidebar path to match the main content path.
2021-01-30 14:23:50 +00:00
Konrad Borowski
56c27360b1 Replace predecessor with range in collections documentation
Fixes #81548.
2021-01-30 14:24:06 +01:00
Ralf Jung
944237f6cd codegen: assume constants cannot fail to evaluate
also don't submit code to LLVM when the session has errors
2021-01-30 12:29:57 +01:00
est31
cddeb5e47b Misc ip documentation fixes 2021-01-30 12:06:06 +01:00
bors
7ce1b3b244 Auto merge of #81545 - JohnTitor:rollup-zlt3tn6, r=JohnTitor
Rollup of 16 pull requests

Successful merges:

 - #79023 (Add `core::stream::Stream`)
 - #80562 (Consider Scalar to be a bool only if its unsigned)
 - #80886 (Stabilize raw ref macros)
 - #80959 (Stabilize `unsigned_abs`)
 - #81291 (Support FRU pattern with `[feature(capture_disjoint_fields)]`)
 - #81409 (Slight simplification of chars().count())
 - #81468 (cfg(version): treat nightlies as complete)
 - #81473 (Warn write-only fields)
 - #81495 (rustdoc: Remove unnecessary optional)
 - #81499 (Updated Vec::splice documentation)
 - #81501 (update rustfmt to v1.4.34)
 - #81505 (`fn cold_path` doesn't need to be pub)
 - #81512 (Add missing variants in match binding)
 - #81515 (Fix typo in pat.rs)
 - #81519 (Don't print error output from rustup when detecting default build triple)
 - #81520 (Don't clone LLVM submodule when download-ci-llvm is set)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-30 10:50:16 +00:00
0yoyoyo
81ed4cfd01 Add a regression test 2021-01-30 18:26:29 +09:00
bors
ebaea9e850 Auto merge of #81521 - nikic:update-dist-various, r=Mark-Simulacrum
Update dist-various to Ubuntu 20.04

This updates the dist-various-1 and dist-various-2 images to Ubuntu
20.04. This requires some adjustments:

 * `DEBIAN_FRONTEND=noninteractive` required for apt install.
 * `team-gcc-argm-embedded` PPA does not support focal. However,
   we can simply use the distro-provided `gcc-arm-none-eabi`. Per
   the comment, the PPA was only used to get a newer version.
 * rumprun has to be updated to avoid a linker error.
 * We need to build rumrun with `NOGCCERROR`, which disables use
   of `-Werror` and allows building with a newer compiler.
 * We need to install `libtinfo5`, which appears to be a dependency
   of the clang used during the fuchsia build.
 * We need to switch to `g++-8` rather than `g++-7`, as at least
   `g++-7-arm-linux-gnueabi` is not available on focal.
 * We need to upgrade to GCC 6.5 for the Solaris build, as GCC 6.4
   does not support the newer libisl version.

r? `@Mark-Simulacrum`
2021-01-30 07:41:19 +00:00
Hirochika Matsumoto
6bc9634de3 Rename function to suggest_accessing_field_where_appropriate 2021-01-30 14:25:43 +09:00
Hirochika Matsumoto
2ce2d145c2 Account for union 2021-01-30 14:18:50 +09:00
Hirochika Matsumoto
08d31e0f09 Remove logging iterator 2021-01-30 13:50:44 +09:00
Hirochika Matsumoto
ad9f707bf5 Fix test to check help message as well 2021-01-30 13:42:01 +09:00
Yuki Okushi
31e7634749
Rollup merge of #81520 - jyn514:rustc2, r=Mark-Simulacrum
Don't clone LLVM submodule when download-ci-llvm is set

Previously, `downloading_llvm` would check `self.build` while it was
still an empty string, and think it was always false. This fixes the
check.

This addresses the worst part of https://github.com/rust-lang/rust/issues/76653. There are still some large submodules being downloaded (in particular, `rustc-by-example` is 146 MB, and all the submodules combined are 311 MB), but this is a lot better than the whopping 1.4 GB before.
2021-01-30 13:37:04 +09:00
Yuki Okushi
e3905aa5af
Rollup merge of #81519 - jyn514:rustup-toolchain, r=Mark-Simulacrum
Don't print error output from rustup when detecting default build triple

Before, it could print this error if no toolchain was configured:

```
error: no default toolchain configured
error: backtrace:
error: stack backtrace:
   0: error_chain::backtrace:👿:InternalBacktrace::new
   1: rustup::config::Cfg::toolchain_for_dir
   2: rustup_init::run_rustup_inner
   3: rustup_init::main
   4: std::rt::lang_start::{{closure}}
   5: main
   6: __libc_start_main
   7: _start
```
2021-01-30 13:37:03 +09:00
Yuki Okushi
5df611c5b1
Rollup merge of #81515 - eltociear:patch-7, r=jonas-schievink
Fix typo in pat.rs

parentesized -> parenthesized
2021-01-30 13:37:01 +09:00
Yuki Okushi
596b394d38
Rollup merge of #81512 - GuillaumeGomez:cleanup-fixme-rustdoc, r=bugadani
Add missing variants in match binding

cc `````@bugadani````` `````@CraftSpider`````
r? `````@camelid`````
2021-01-30 13:37:00 +09:00
Yuki Okushi
ba40cea487
Rollup merge of #81505 - henryboisdequin:cold_path-not-pub, r=sanxiyn
`fn cold_path` doesn't need to be pub

Fixes #81429

Note: this PR also fixes a small typo that I found
2021-01-30 13:36:58 +09:00
Yuki Okushi
6090c57128
Rollup merge of #81501 - calebcartwright:update-rustfmt, r=sanxiyn
update rustfmt to v1.4.34

Short summary: Various formatting fixes (several const generic related) and introduction of `imports_granularity` config option

Long summary copied from changelog:

#### Changed
- `merge_imports` configuration has been deprecated in favor of the new `imports_granularity` option. Any existing usage of `merge_imports` will be automatically mapped to the corresponding value on `imports_granularity` with a warning message printed to encourage users to update their config files.

#### Added
- New `imports_granularity` option has been added which succeeds `merge_imports`. This new option supports several additional variants which allow users to merge imports at different levels (crate or module), and even flatten imports to have a single use statement per item. ([PR rust-lang/rustfmt#4634](https://github.com/rust-lang/rustfmt/pull/4634), [PR rust-lang/rustfmt#4639](https://github.com/rust-lang/rustfmt/pull/4639))

See the section on the configuration site for more information
https://rust-lang.github.io/rustfmt/?version=v1.4.33&search=#imports_granularity

#### Fixed
- Fix erroneous removal of `const` keyword on const trait impl ([rust-lang/rustfmt#4084](https://github.com/rust-lang/rustfmt/issues/4084))
- Fix incorrect span usage wit const generics in supertraits ([rust-lang/rustfmt#4204](https://github.com/rust-lang/rustfmt/issues/4204))
- Use correct span for const generic params ([rust-lang/rustfmt#4263](https://github.com/rust-lang/rustfmt/issues/4263))
- Correct span on const generics to include type bounds ([rust-lang/rustfmt#4310](https://github.com/rust-lang/rustfmt/issues/4310))
- Idempotence issue on blocks containing only empty statements ([rust-lang/rustfmt#4627](https://github.com/rust-lang/rustfmt/issues/4627) and [#3868](https://github.com/rust-lang/rustfmt/issues/3868))
- Fix issue with semicolon placement on required functions that have a trailing comment that ends in a line-style comment before the semicolon ([rust-lang/rustfmt#4646](https://github.com/rust-lang/rustfmt/issues/4646))
- Avoid shared interned cfg_if symbol since rustfmt can re-initialize the rustc_ast globals on multiple inputs ([rust-lang/rustfmt#4656](https://github.com/rust-lang/rustfmt/issues/4656))
- Don't insert trailing comma on (base-less) rest in struct literals within macros ([rust-lang/rustfmt#4675](https://github.com/rust-lang/rustfmt/issues/4675))
2021-01-30 13:36:56 +09:00
Yuki Okushi
0f11a943cc
Rollup merge of #81499 - SOF3:patch-1, r=sanxiyn
Updated Vec::splice documentation

Replacing with equal number of values does not increase the length of the vec.

Reference: https://stackoverflow.com/a/62559271/3990767
2021-01-30 13:36:55 +09:00
Yuki Okushi
b43c1d50b7
Rollup merge of #81495 - camelid:rustdoc-output_format-optional, r=GuillaumeGomez
rustdoc: Remove unnecessary optional

Previously, the HTML output format was represented by both
`Some(OutputFormat::Html)` and `None` so there's no need to have an
optional. Instead, `OutputFormat::Html` is explicitly the default and we
no longer have a "tri-state enum".

r? `````@GuillaumeGomez`````
2021-01-30 13:36:53 +09:00