]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelid
Matthias Krüger [Sun, 24 Oct 2021 13:48:44 +0000 (15:48 +0200)]
Rollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelid

Fix alignment of method headings for scannability

We sometimes use indentation to indicate something is a heading: The section that comes after is indented by 24px relative to the heading. However, the relationship between the "Implementations" section heading, the `impl` headings it contains, and the `pub fn` subheadings within each impl, is awkward. It goes **Implementations**, 15px indent, `impl`, 5px indent, `pub fn`, 4px indent, docblock.

I line up `impl` and `pub fn` with the `Implementations` heading, give `impl` a larger font size to indicate it is higher in the hierarchy, and indent the docblock a full 24px relative to their parent, matching the indents we use elsewhere to distinguish section headings. By letting the `pub fn` stick out to the left of the docblock, I think this makes methods significantly more scannable.

Related to #59829

r? `````@camelid`````

[Old](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations):

[![image](https://user-images.githubusercontent.com/220205/138380233-9c63a0f2-0f80-40a3-ab3d-a1ee9fb7c5d8.png)](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations)

[New](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations):

[![image](https://user-images.githubusercontent.com/220205/138392479-b45fce3f-bf43-42e0-81ee-c4bb9ac35cda.png)](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations)

2 years agoRollup merge of #90100 - Mark-Simulacrum:speed-macos-ci, r=pietroalbini
Matthias Krüger [Sun, 24 Oct 2021 13:48:43 +0000 (15:48 +0200)]
Rollup merge of #90100 - Mark-Simulacrum:speed-macos-ci, r=pietroalbini

Skip documentation for tier 2 targets on dist-x86_64-apple-darwin

I don't have an easy way to test this locally, but I believe it should work. Based on one log result should shave ~14 minutes off the dist-x86_64-apple builder (doesn't help with aarch64 dist or x86_64 test builder, so not actually decreasing total CI time most likely).

r? ```@pietroalbini```

2 years agoRollup merge of #89558 - lcnr:query-stable-lint, r=estebank
Matthias Krüger [Sun, 24 Oct 2021 13:48:42 +0000 (15:48 +0200)]
Rollup merge of #89558 - lcnr:query-stable-lint, r=estebank

Add rustc lint, warning when iterating over hashmaps

r? rust-lang/wg-incr-comp

2 years agoAuto merge of #90208 - Mark-Simulacrum:hash-bytes-fast, r=oli-obk
bors [Sun, 24 Oct 2021 06:29:41 +0000 (06:29 +0000)]
Auto merge of #90208 - Mark-Simulacrum:hash-bytes-fast, r=oli-obk

Specialize HashStable for [u8] slices

Particularly for ctfe-stress-4, the hashing of byte slices as part of the
MIR Allocation is quite hot. Previously, we were falling back on byte-by-byte
copying of the slice into the SipHash buffer (64 bytes long) before hashing a 64
byte chunk, and then doing that again and again; now we use the dedicated byte-slice write.

2 years agoAuto merge of #89776 - rusticstuff:ci-overflow-checks, r=Mark-Simulacrum
bors [Sun, 24 Oct 2021 01:21:48 +0000 (01:21 +0000)]
Auto merge of #89776 - rusticstuff:ci-overflow-checks, r=Mark-Simulacrum

CI: Enable overflow checks for test (non-dist) builds

They stay disabled for Apple builds though, which take the most time already due to running on slow hw.

2 years agoAuto merge of #90175 - cuviper:min-llvm-12, r=nagisa
bors [Sat, 23 Oct 2021 20:59:29 +0000 (20:59 +0000)]
Auto merge of #90175 - cuviper:min-llvm-12, r=nagisa

Update the minimum external LLVM to 12

With this change, we'll have stable support for LLVM 12 and 13.
For reference, the previous increase to LLVM 10 was #83387,
and this replaces the pending increase to LLVM 11 in #90062.

r? `@nagisa` `@nikic`

2 years agoOutdent method headings so they stand out
Jacob Hoffman-Andrews [Fri, 22 Oct 2021 01:46:47 +0000 (18:46 -0700)]
Outdent method headings so they stand out

The makes the heading / documentation distinction clearer.

2 years agobless the line changes in ui/asm/aarch64/srcloc.rs
Josh Stone [Sat, 23 Oct 2021 17:16:09 +0000 (10:16 -0700)]
bless the line changes in ui/asm/aarch64/srcloc.rs

2 years agoSpecialize HashStable for [u8] slices
Mark Rousskov [Sat, 23 Oct 2021 16:11:05 +0000 (12:11 -0400)]
Specialize HashStable for [u8] slices

Particularly for ctfe-stress-4, the hashing of byte slices as part of the
MIR Allocation is quite hot. Previously, we were falling back on byte-by-byte
copying of the slice into the SipHash buffer (64 bytes long) before hashing a 64
byte chunk, and then doing that again and again.

This should hopefully be an improvement for that code.

2 years agoAuto merge of #90203 - matthiaskrgr:rollup-v215wew, r=matthiaskrgr
bors [Sat, 23 Oct 2021 15:53:50 +0000 (15:53 +0000)]
Auto merge of #90203 - matthiaskrgr:rollup-v215wew, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #85833 (Scrape code examples from examples/ directory for Rustdoc)
 - #88041 (Make all proc-macro back-compat lints deny-by-default)
 - #89829 (Consider types appearing in const expressions to be invariant)
 - #90168 (Reset qualifs when a storage of a local ends)
 - #90198 (Add caveat about changing parallelism and function call overhead)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #90198 - the8472:available-parallelism-runtime, r=joshtriplett
Matthias Krüger [Sat, 23 Oct 2021 12:58:43 +0000 (14:58 +0200)]
Rollup merge of #90198 - the8472:available-parallelism-runtime, r=joshtriplett

Add caveat about changing parallelism and function call overhead

As discussed in https://github.com/rust-lang/rust/pull/89670#discussion_r728179584

r? ``@joshtriplett``

2 years agoRollup merge of #90168 - tmiasko:const-qualif-storage, r=matthewjasper
Matthias Krüger [Sat, 23 Oct 2021 12:58:42 +0000 (14:58 +0200)]
Rollup merge of #90168 - tmiasko:const-qualif-storage, r=matthewjasper

Reset qualifs when a storage of a local ends

Reset qualifs when a storage of a local ends to ensure that the local qualifs
are affected by the state from previous loop iterations only if the local is
kept alive.

The change should be forward compatible with a stricter handling of indirect
assignments, since storage dead invalidates all existing pointers to the local.

2 years agoRollup merge of #89829 - voidc:assoc-const-variance, r=lcnr
Matthias Krüger [Sat, 23 Oct 2021 12:58:41 +0000 (14:58 +0200)]
Rollup merge of #89829 - voidc:assoc-const-variance, r=lcnr

Consider types appearing in const expressions to be invariant

This is an approach to fix #80977.
Currently, a type parameter which is only used in a constant expression is considered bivariant and will trigger error E0392 *"parameter T is never used"*.
Here is a short example:

```rust
pub trait Foo {
    const N: usize;
}

struct Bar<T: Foo>([u8; T::N])
where [(); T::N]:;
```
([playgound](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=b51a272853f75925e72efc1597478aa5))

While it is possible to silence this error by adding a `PhantomData<T>` field, I think the better solution would be to make `T` invariant.
This would be analogous to the invariance constraints added for associated types.
However, I'm quite new to the compiler and unsure whether this is the right approach.

r? ``@varkor`` (since you authored #60058)

2 years agoRollup merge of #88041 - Aaron1011:deny-proc-macro-hack, r=wesleywiser
Matthias Krüger [Sat, 23 Oct 2021 12:58:40 +0000 (14:58 +0200)]
Rollup merge of #88041 - Aaron1011:deny-proc-macro-hack, r=wesleywiser

Make all proc-macro back-compat lints deny-by-default

The affected crates have had plenty of time to update.
By keeping these as lints rather than making them hard errors,
we ensure that downstream crates will still be able to compile,
even if they transitive depend on broken versions of the affected
crates.

This should hopefully discourage anyone from writing any
new code which relies on the backwards-compatibility behavior.

2 years agoRollup merge of #85833 - willcrichton:example-analyzer, r=jyn514
Matthias Krüger [Sat, 23 Oct 2021 12:58:39 +0000 (14:58 +0200)]
Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514

Scrape code examples from examples/ directory for Rustdoc

Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123

Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525

Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and

2 years agoAuto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakis
bors [Sat, 23 Oct 2021 12:51:15 +0000 (12:51 +0000)]
Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakis

Implement coherence checks for negative trait impls

The main purpose of this PR is to be able to [move Error trait to core](https://github.com/rust-lang/project-error-handling/issues/3).

This feature is necessary to handle the following from impl on box.

```rust
impl From<&str> for Box<dyn Error> { ... }
```

Without having negative traits affect coherence moving the error trait into `core` and moving that `From` impl to `alloc` will cause the from impl to no longer compiler because of a potential future incompatibility. The compiler indicates that `&str` _could_ introduce an `Error` impl in the future, and thus prevents the `From` impl in `alloc` that would cause overlap with `From<E: Error> for Box<dyn Error>`. Adding `impl !Error for &str {}` with the negative trait coherence feature will disable this error by encoding a stability guarantee that `&str` will never implement `Error`, making the `From` impl compile.

We would have this in `alloc`:

```rust
impl From<&str> for Box<dyn Error> {} // A
impl<E> From<E> for Box<dyn Error> where E: Error {} // B
```

and this in `core`:

```rust
trait Error {}
impl !Error for &str {}
```

r? `@nikomatsakis`

This PR was built on top of `@yaahc` PR #85764.

Language team proposal: to https://github.com/rust-lang/lang-team/issues/96

2 years agoAvoid code duplication by extracting checks into fns
Santiago Pastorino [Sat, 23 Oct 2021 03:03:33 +0000 (00:03 -0300)]
Avoid code duplication by extracting checks into fns

2 years agoAdd caveat about changing parallelism and function call overhead
The8472 [Sat, 23 Oct 2021 11:01:07 +0000 (13:01 +0200)]
Add caveat about changing parallelism and function call overhead

2 years agoAuto merge of #90065 - cjgillot:novalcache, r=Mark-Simulacrum
bors [Sat, 23 Oct 2021 09:21:45 +0000 (09:21 +0000)]
Auto merge of #90065 - cjgillot:novalcache, r=Mark-Simulacrum

Do not depend on the stored value when trying to cache on disk.

Having different criteria for loading and saving of query results can lead to saved results that may never be loaded.
Since the on-disk cache is discarded as soon as a compilation error is issued, there should not be any need for an exclusion mecanism based on errors.

As a result, the possibility to condition the storage on the value itself does not appear useful.

2 years agoReset qualifs when a storage of a local ends
Tomasz Miąsko [Fri, 22 Oct 2021 00:00:00 +0000 (00:00 +0000)]
Reset qualifs when a storage of a local ends

to ensure that the local qualifs are affected by the state from previous
loop iterations only if the local is kept alive.

The change should be forward compatible with a stricter handling of
indirect assignments, since storage dead invalidates all existing
pointers to the local.

2 years agoAuto merge of #90188 - matthiaskrgr:rollup-74cwv5c, r=matthiaskrgr
bors [Sat, 23 Oct 2021 06:13:18 +0000 (06:13 +0000)]
Auto merge of #90188 - matthiaskrgr:rollup-74cwv5c, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #83233 (Implement split_array and split_array_mut)
 - #88300 (Stabilise unix_process_wait_more, extra ExitStatusExt methods)
 - #89416 (nice_region_error: Include lifetime placeholders in error output)
 - #89468 (Report fatal lexer errors in `--cfg` command line arguments)
 - #89730 (add feature flag for `type_changing_struct_update`)
 - #89920 (Implement -Z location-detail flag)
 - #90070 (Add edition configuration to compiletest)
 - #90087 (Sync rustfmt subtree)
 - #90117 (Make RSplit<T, P>: Clone not require T: Clone)
 - #90122 (CI: make docker cache download and `docker load` time out after 10 minutes)
 - #90166 (Add comment documenting why we can't use a simpler solution)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoRollup merge of #90166 - smmalis37:patch-1, r=joshtriplett
Matthias Krüger [Sat, 23 Oct 2021 03:28:28 +0000 (05:28 +0200)]
Rollup merge of #90166 - smmalis37:patch-1, r=joshtriplett

Add comment documenting why we can't use a simpler solution

See #90144 for context.

r? ```@joshtriplett```

2 years agoRollup merge of #90122 - rusticstuff:ci_curl_max_time, r=Mark-Simulacrum
Matthias Krüger [Sat, 23 Oct 2021 03:28:27 +0000 (05:28 +0200)]
Rollup merge of #90122 - rusticstuff:ci_curl_max_time, r=Mark-Simulacrum

CI: make docker cache download and `docker load` time out after 10 minutes

Might help to prevent timeouts we have been seeing:
* https://github.com/rust-lang-ci/rust/runs/3946294286?check_suite_focus=true#step:25:23
* https://github.com/rust-lang-ci/rust/runs/3956799200?check_suite_focus=true#step:25:22
* https://github.com/rust-lang-ci/rust/runs/3962928502?check_suite_focus=true#step:25:23
* https://github.com/rust-lang-ci/rust/runs/3967892291?check_suite_focus=true
* https://github.com/rust-lang-ci/rust/runs/3971202204?check_suite_focus=true

If the download or loading the images into docker times out the CI will still continue and rebuild the docker image from scratch.

2 years agoRollup merge of #90117 - calebsander:fix/rsplit-clone, r=yaahc
Matthias Krüger [Sat, 23 Oct 2021 03:28:26 +0000 (05:28 +0200)]
Rollup merge of #90117 - calebsander:fix/rsplit-clone, r=yaahc

Make RSplit<T, P>: Clone not require T: Clone

This addresses a TODO comment. The behavior of `#[derive(Clone)]` *does* result in a `T: Clone` requirement. Playground example:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a8b1a9581ff8893baf401d624a53d35b

Add a manual `Clone` implementation, mirroring `Split` and `SplitInclusive`.
`(R)?SplitN(Mut)?` don't have any `Clone` implementations, but I'll leave that for its own pull request.

2 years agoRollup merge of #90087 - calebcartwright:rustfmt-subtree, r=calebcartwright
Matthias Krüger [Sat, 23 Oct 2021 03:28:25 +0000 (05:28 +0200)]
Rollup merge of #90087 - calebcartwright:rustfmt-subtree, r=calebcartwright

Sync rustfmt subtree

There's a large number of small fixes and new features, but nothing too big. Detailed changelog for those interested can be found in https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#1438-2021-10-20

2 years agoRollup merge of #90070 - llogiq:compiletest-config-edition, r=Mark-Simulacrum
Matthias Krüger [Sat, 23 Oct 2021 03:28:24 +0000 (05:28 +0200)]
Rollup merge of #90070 - llogiq:compiletest-config-edition, r=Mark-Simulacrum

Add edition configuration to compiletest

This allows the compiletest configuration to set a default edition that can still be overridden with header annotations. Doing this will make it far easier for clippy to get our tests to the newest edition.

r? ```@Manishearth```

2 years agoRollup merge of #89920 - hudson-ayers:location-detail-control, r=davidtwco
Matthias Krüger [Sat, 23 Oct 2021 03:28:23 +0000 (05:28 +0200)]
Rollup merge of #89920 - hudson-ayers:location-detail-control, r=davidtwco

Implement -Z location-detail flag

This PR implements the `-Z location-detail` flag as described in https://github.com/rust-lang/rfcs/pull/2091 .

`-Z location-detail=val` controls what location details are tracked when using `caller_location`. This allows users to control what location details are printed as part of panic messages, by allowing them to exclude any combination of filenames, line numbers, and column numbers. This option is intended to provide users with a way to mitigate the size impact of `#[track_caller]`.

Some measurements of the savings of this approach on an embedded binary can be found here: https://github.com/rust-lang/rust/issues/70579#issuecomment-942556822 .

Closes #70580 (unless people want to leave that open as a place for discussion of further improvements).

This is my first real PR to rust, so any help correcting mistakes / understanding side effects / improving my tests is appreciated :)

I have one question: RFC 2091 specified this as a debugging option (I think that is what -Z implies?). Does that mean this can never be stabilized without a separate MCP? If so, do I need to submit an MCP now, or is the initial RFC specifying this option sufficient for this to be merged as is, and then an MCP would be needed for eventual stabilization?

2 years agoRollup merge of #89730 - crlf0710:type_changing_feature, r=jackh726
Matthias Krüger [Sat, 23 Oct 2021 03:28:22 +0000 (05:28 +0200)]
Rollup merge of #89730 - crlf0710:type_changing_feature, r=jackh726

add feature flag for `type_changing_struct_update`

This implements the PR0 part of the mentoring notes within #86618.

overrides the previous inactive #86646 pr.

r? ```@nikomatsakis```

2 years agoRollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
Matthias Krüger [Sat, 23 Oct 2021 03:28:22 +0000 (05:28 +0200)]
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726

Report fatal lexer errors in `--cfg` command line arguments

Fixes #89358. The erroneous behavior was apparently introduced by `@Mark-Simulacrum` in https://github.com/rust-lang/rust/commit/a678e3191197f145451c97c6cc884e15cae38186; the idea is to silence individual parser errors and instead emit one catch-all error message after parsing. However, for the example in #89358, a fatal lexer error is created here:
https://github.com/rust-lang/rust/blob/edebf77e0090195bf80c0d8cda821e1bf9d03053/compiler/rustc_parse/src/lexer/mod.rs#L340-L349

This fatal error aborts the compilation, and so the call to `new_parser_from_source_str()` never returns and the catch-all error message is never emitted. I have therefore changed the `SilentEmitter` to silence only non-fatal errors; with my changes, for the rustc invocation described in #89358:
```sh
rustc --cfg "abc\""
```
I get the following output:
```
error[E0765]: unterminated double quote string
  |
  = note: this error occurred on the command line: `--cfg=abc"`
```

2 years agoRollup merge of #89416 - notriddle:notriddle/do-not-elide-lifetimes-in-region-errors...
Matthias Krüger [Sat, 23 Oct 2021 03:28:21 +0000 (05:28 +0200)]
Rollup merge of #89416 - notriddle:notriddle/do-not-elide-lifetimes-in-region-errors, r=jackh726

nice_region_error: Include lifetime placeholders in error output

As you can see in src/test/ui/traits/self-without-lifetime-constraint.stderr
you can get very confusing type names if you don't have this.

Fixes #87763

2 years agoRollup merge of #88300 - ijackson:exitstatusext-methods, r=yaahc
Matthias Krüger [Sat, 23 Oct 2021 03:28:20 +0000 (05:28 +0200)]
Rollup merge of #88300 - ijackson:exitstatusext-methods, r=yaahc

Stabilise unix_process_wait_more, extra ExitStatusExt methods

This stabilises the feature `unix_process_wait_more`.  Tracking issue #80695, FCP needed.

This was implemented in #79982 and merged in January.

2 years agoRollup merge of #83233 - jethrogb:split_array, r=yaahc
Matthias Krüger [Sat, 23 Oct 2021 03:28:19 +0000 (05:28 +0200)]
Rollup merge of #83233 - jethrogb:split_array, r=yaahc

Implement split_array and split_array_mut

This implements `[T]::split_array::<const N>() -> (&[T; N], &[T])` and `[T; N]::split_array::<const M>() -> (&[T; M], &[T])` and their mutable equivalents. These are another few “missing” array implementations now that const generics are a thing, similar to #74373, #75026, etc. Fixes #74674.

This implements `[T; N]::split_array` returning an array and a slice. Ultimately, this is probably not what we want, we would want the second return value to be an array of length N-M, which will likely be possible with future const generics enhancements. We need to implement the array method now though, to immediately shadow the slice method. This way, when the slice methods get stabilized, calling them on an array will not be automatic through coercion, so we won't have trouble stabilizing the array methods later (cf. into_iter debacle).

An unchecked version of `[T]::split_array` could also be added as in #76014. This would not be needed for `[T; N]::split_array` as that can be compile-time checked. Edit: actually, since split_at_unchecked is internal-only it could be changed to be split_array-only.

2 years agoAuto merge of #90054 - michaelwoerister:v0-mangling-in-compiler, r=Mark-Simulacrum
bors [Sat, 23 Oct 2021 03:06:21 +0000 (03:06 +0000)]
Auto merge of #90054 - michaelwoerister:v0-mangling-in-compiler, r=Mark-Simulacrum

Make new symbol mangling scheme default for compiler itself.

As suggest in https://github.com/rust-lang/rust/pull/89917#issuecomment-945888574, this PR enables the new symbol mangling scheme for the compiler itself. The standard library is still compiled using the legacy mangling scheme so that the new symbol format does not show up in user code (yet).

r? `@Mark-Simulacrum`

2 years agonice_region_error: Include lifetime placeholders in error output
Michael Howell [Fri, 1 Oct 2021 05:47:41 +0000 (22:47 -0700)]
nice_region_error: Include lifetime placeholders in error output

As you can see in src/test/ui/traits/self-without-lifetime-constraint.stderr
you can get very confusing type names if you don't have this.

Fixes #87763

2 years agoAuto merge of #90007 - xfix:inline-cstr-from-str, r=kennytm
bors [Fri, 22 Oct 2021 21:01:59 +0000 (21:01 +0000)]
Auto merge of #90007 - xfix:inline-cstr-from-str, r=kennytm

Inline CStr::from_ptr

Inlining this function is valuable, as it allows LLVM to apply `strlen`-specific optimizations without having to enable LTO.

For instance, the following function:

```rust
pub fn f(p: *const c_char) -> Option<u8> {
    unsafe { CStr::from_ptr(p) }.to_bytes().get(0).copied()
}
```

Looks like this if `CStr::from_ptr` is allowed to be inlined.

```asm
before:
        push    rax
        call    qword ptr [rip + std::ffi::c_str::CStr::from_ptr@GOTPCREL]
        mov     rcx, rax
        cmp     rdx, 1
        sete    dl
        test    rax, rax
        sete    al
        or      al, dl
        jne     .LBB1_2
        mov     dl, byte ptr [rcx]
.LBB1_2:
        xor     al, 1
        pop     rcx
        ret

after:
        mov     dl, byte ptr [rdi]
        test    dl, dl
        setne   al
        ret
```

Note that optimization turned this from O(N) to O(1) in terms of performance, as LLVM knows that it doesn't really need to call `strlen` to determine whether a string is empty or not.

2 years agoHide negative coherence checks under negative_impls feature flag
Santiago Pastorino [Fri, 22 Oct 2021 20:54:20 +0000 (17:54 -0300)]
Hide negative coherence checks under negative_impls feature flag

2 years agoMove def_id logic into render_call_locations
Will Crichton [Fri, 22 Oct 2021 20:14:46 +0000 (13:14 -0700)]
Move def_id logic into render_call_locations

2 years agoRevert def_id addition from clean::Function, add test for
Will Crichton [Fri, 22 Oct 2021 19:46:45 +0000 (12:46 -0700)]
Revert def_id addition from clean::Function, add test for
scrape-examples options

2 years agoBe sure that we do not allow too much
Santiago Pastorino [Fri, 22 Oct 2021 18:55:56 +0000 (15:55 -0300)]
Be sure that we do not allow too much

2 years agoAssemple trait alias candidates for negative polarity
Santiago Pastorino [Fri, 22 Oct 2021 18:44:47 +0000 (15:44 -0300)]
Assemple trait alias candidates for negative polarity

This doesn't work properly yet, we would probably need to implement an
`assembly_neg_candidates` and consider things like `T: !AB` as `T: !A`
|| `T: !B`

2 years agoAdd rustc_strict_coherence attribute and use it to check overlap
Santiago Pastorino [Fri, 22 Oct 2021 18:44:28 +0000 (15:44 -0300)]
Add rustc_strict_coherence attribute and use it to check overlap

2 years agoUpdate the minimum external LLVM to 12
Josh Stone [Fri, 22 Oct 2021 17:50:07 +0000 (10:50 -0700)]
Update the minimum external LLVM to 12

2 years agoApply suggestions from code review
Jane Lusby [Fri, 22 Oct 2021 17:47:34 +0000 (10:47 -0700)]
Apply suggestions from code review

2 years agoAuto merge of #89893 - camsteffen:redundant-dump-enabled, r=matthewjasper
bors [Fri, 22 Oct 2021 17:32:20 +0000 (17:32 +0000)]
Auto merge of #89893 - camsteffen:redundant-dump-enabled, r=matthewjasper

Remove redundant dump_enabled check

2 years agollvm-dwp-11 fails on absolute paths
Josh Stone [Tue, 19 Oct 2021 21:49:39 +0000 (14:49 -0700)]
llvm-dwp-11 fails on absolute paths

2 years agoUpdate the minimum external LLVM to 11
Josh Stone [Tue, 19 Oct 2021 17:24:26 +0000 (10:24 -0700)]
Update the minimum external LLVM to 11

2 years agoadd feature flag for `type_changing_struct_update`
Charles Lew [Sun, 10 Oct 2021 06:50:39 +0000 (14:50 +0800)]
add feature flag for `type_changing_struct_update`

2 years agoAuto merge of #90161 - JohnTitor:rollup-1j2qc8m, r=JohnTitor
bors [Fri, 22 Oct 2021 14:25:23 +0000 (14:25 +0000)]
Auto merge of #90161 - JohnTitor:rollup-1j2qc8m, r=JohnTitor

Rollup of 14 pull requests

Successful merges:

 - #87537 (Clarify undefined behaviour in binary heap, btree and hashset docs)
 - #88624 (Stabilize feature `saturating_div` for rust 1.58.0)
 - #89257 (Give better error for `macro_rules name`)
 - #89665 (Ensure that pushing empty path works as before on verbatim paths)
 - #89895 (Don't mark for loop iter expression as desugared)
 - #89922 (Update E0637 description to mention `&` w/o an explicit lifetime name)
 - #89944 (Change `Duration::[try_]from_secs_{f32, f64}` underflow error)
 - #89991 (rustc_ast: Turn `MutVisitor::token_visiting_enabled` into a constant)
 - #90028 (Reject closures in patterns)
 - #90069 (Fix const qualification when executed after promotion)
 - #90078 (Add a regression test for issue-83479)
 - #90114 (Add some tests for const_generics_defaults)
 - #90115 (Add test for issue #78561)
 - #90129 (triagebot: Treat `I-*nominated` like `I-nominated`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAdd comment about the only way to prove NotImplemented here
Santiago Pastorino [Fri, 22 Oct 2021 14:04:30 +0000 (11:04 -0300)]
Add comment about the only way to prove NotImplemented here

2 years agoFix filter_impls comment
Santiago Pastorino [Fri, 22 Oct 2021 13:58:38 +0000 (10:58 -0300)]
Fix filter_impls comment

2 years agoFix debug method name
Santiago Pastorino [Fri, 22 Oct 2021 13:57:10 +0000 (10:57 -0300)]
Fix debug method name

2 years agoMove const filter to filter_impls
Santiago Pastorino [Fri, 22 Oct 2021 13:56:32 +0000 (10:56 -0300)]
Move const filter to filter_impls

2 years agoAdd comment documenting why we can't use a simpler solution
Steven [Fri, 22 Oct 2021 13:55:32 +0000 (09:55 -0400)]
Add comment documenting why we can't use a simpler solution

See #90144 for context.

r? @joshtriplett

2 years agoDocument flip polarity
Santiago Pastorino [Fri, 22 Oct 2021 12:34:36 +0000 (09:34 -0300)]
Document flip polarity

2 years agoDocument overlap check filter
Santiago Pastorino [Fri, 22 Oct 2021 12:22:19 +0000 (09:22 -0300)]
Document overlap check filter

2 years agoRollup merge of #90129 - joshtriplett:triagebot-nominated, r=Mark-Simulacrum
Yuki Okushi [Fri, 22 Oct 2021 10:42:53 +0000 (19:42 +0900)]
Rollup merge of #90129 - joshtriplett:triagebot-nominated, r=Mark-Simulacrum

triagebot: Treat `I-*nominated` like `I-nominated`

rustbot doesn't allow unauthenticated users to set `I-nominated`; apply the same permissions to the new `I-*nominated` labels.

2 years agoRollup merge of #90115 - samlich:test-issue-78561, r=oli-obk
Yuki Okushi [Fri, 22 Oct 2021 10:42:52 +0000 (19:42 +0900)]
Rollup merge of #90115 - samlich:test-issue-78561, r=oli-obk

Add test for issue #78561

Adds test for and closes #78561 which previously crashed compiler.

2 years agoRollup merge of #90114 - BoxyUwU:cg_defaults_tests, r=lcnr
Yuki Okushi [Fri, 22 Oct 2021 10:42:51 +0000 (19:42 +0900)]
Rollup merge of #90114 - BoxyUwU:cg_defaults_tests, r=lcnr

Add some tests for const_generics_defaults

I think this covers some of the stuff required for stabilisation report, some of these tests are probably covering stuff we already have but it can't hurt to have more :)

r? ````@lcnr````

2 years agoRollup merge of #90078 - JohnTitor:test-83479, r=Mark-Simulacrum
Yuki Okushi [Fri, 22 Oct 2021 10:42:50 +0000 (19:42 +0900)]
Rollup merge of #90078 - JohnTitor:test-83479, r=Mark-Simulacrum

Add a regression test for issue-83479

Add a regression test for https://github.com/rust-lang/rust/issues/83479#issue-841147340, but not close the issue, see https://github.com/rust-lang/rust/issues/83479#issuecomment-947255641.

2 years agoRollup merge of #90069 - tmiasko:promoted-const-qualif, r=oli-obk
Yuki Okushi [Fri, 22 Oct 2021 10:42:49 +0000 (19:42 +0900)]
Rollup merge of #90069 - tmiasko:promoted-const-qualif, r=oli-obk

Fix const qualification when executed after promotion

The const qualification was so far performed before the promotion and
the implementation assumed that it will never encounter a promoted.

With `const_precise_live_drops` feature, checking for live drops is
delayed until after drop elaboration, which in turn runs after
promotion. so the assumption is no longer true. When evaluating
`NeedsNonConstDrop` it is now possible to encounter promoteds.

Use type base qualification for the promoted. It is a sound
approximation in general, and in the specific case of promoteds and
`NeedsNonConstDrop` it is precise.

Fixes #89938.

2 years agoRollup merge of #90028 - tmiasko:structural-match-closure, r=spastorino
Yuki Okushi [Fri, 22 Oct 2021 10:42:48 +0000 (19:42 +0900)]
Rollup merge of #90028 - tmiasko:structural-match-closure, r=spastorino

Reject closures in patterns

Fixes #90013.

2 years agoRollup merge of #89991 - petrochenkov:visitok2, r=jackh726
Yuki Okushi [Fri, 22 Oct 2021 10:42:48 +0000 (19:42 +0900)]
Rollup merge of #89991 - petrochenkov:visitok2, r=jackh726

rustc_ast: Turn `MutVisitor::token_visiting_enabled` into a constant

It's a visitor property rather than something that needs to be determined at runtime

2 years agoRollup merge of #89944 - mbartlett21:patch-2, r=Mark-Simulacrum
Yuki Okushi [Fri, 22 Oct 2021 10:42:47 +0000 (19:42 +0900)]
Rollup merge of #89944 - mbartlett21:patch-2, r=Mark-Simulacrum

Change `Duration::[try_]from_secs_{f32, f64}` underflow error

The error message now says that it was a negative value.

Fixes #89913.

2 years agoRollup merge of #89922 - JohnTitor:update-e0637, r=jackh726
Yuki Okushi [Fri, 22 Oct 2021 10:42:46 +0000 (19:42 +0900)]
Rollup merge of #89922 - JohnTitor:update-e0637, r=jackh726

Update E0637 description to mention `&` w/o an explicit lifetime name

Deal with https://github.com/rust-lang/rust/issues/89824#issuecomment-941598647. Another solution would be splitting the error code into two as (I think) it's a bit unclear to users why they have the same error code.

2 years agoRollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwco
Yuki Okushi [Fri, 22 Oct 2021 10:42:45 +0000 (19:42 +0900)]
Rollup merge of #89895 - camsteffen:for-loop-head-span, r=davidtwco

Don't mark for loop iter expression as desugared

We typically don't mark spans of lowered things as desugared. This helps Clippy rightly discern when code is (not) from expansion. This was discovered by ``@flip1995`` at https://github.com/rust-lang/rust-clippy/pull/7789#issuecomment-939289501.

2 years agoRollup merge of #89665 - seanyoung:push-empty, r=m-ou-se
Yuki Okushi [Fri, 22 Oct 2021 10:42:43 +0000 (19:42 +0900)]
Rollup merge of #89665 - seanyoung:push-empty, r=m-ou-se

Ensure that pushing empty path works as before on verbatim paths

Fixes: https://github.com/rust-lang/rust/issues/89658
Signed-off-by: Sean Young <sean@mess.org>
2 years agoRollup merge of #89257 - aDotInTheVoid:macro-error-2, r=estebank
Yuki Okushi [Fri, 22 Oct 2021 10:42:43 +0000 (19:42 +0900)]
Rollup merge of #89257 - aDotInTheVoid:macro-error-2, r=estebank

Give better error for `macro_rules name`

follow up to #89221

r? ``@estebank``

``@rustbot`` modify labels: +A-diagnostics +A-parser

2 years agoRollup merge of #88624 - kellerkindt:master, r=JohnTitor
Yuki Okushi [Fri, 22 Oct 2021 10:42:42 +0000 (19:42 +0900)]
Rollup merge of #88624 - kellerkindt:master, r=JohnTitor

Stabilize feature `saturating_div` for rust 1.58.0

The tracking issue is #89381

This seems like a reasonable simple change(?). The feature `saturating_div` was added as part of the ongoing effort to implement a `Saturating` integer type (see #87921). The implementation has been discussed [here](https://github.com/rust-lang/rust/pull/87921#issuecomment-899357720) and [here](https://github.com/rust-lang/rust/pull/87921#discussion_r691888556). It extends the list of saturating operations on integer types (like `saturating_add`, `saturating_sub`, `saturating_mul`, ...) by the function `fn saturating_div(self, rhs: Self) -> Self`.

The stabilization of the feature `saturating_int_impl` (for the `Saturating` type) needs to have this stabilized first.

Closes #89381

2 years agoRollup merge of #87537 - Wilfred:improve-min-heap-docs, r=Mark-Simulacrum
Yuki Okushi [Fri, 22 Oct 2021 10:42:41 +0000 (19:42 +0900)]
Rollup merge of #87537 - Wilfred:improve-min-heap-docs, r=Mark-Simulacrum

Clarify undefined behaviour in binary heap, btree and hashset docs

Previously, it wasn't clear whether "This could include" was referring to logic errors, or undefined behaviour. Tweak wording to clarify this sentence does not relate to UB.

2 years agoImplement split_array and split_array_mut
Jethro Beekman [Wed, 17 Mar 2021 16:23:09 +0000 (17:23 +0100)]
Implement split_array and split_array_mut

2 years agoMake RSplit<T, P>: Clone not require T: Clone
Caleb Sander [Thu, 21 Oct 2021 00:04:01 +0000 (17:04 -0700)]
Make RSplit<T, P>: Clone not require T: Clone

This addresses a TODO comment. The behavior of #[derive(Clone)]
*does* result in a T: Clone requirement.

Add a manual Clone implementation, matching Split and SplitInclusive.

2 years agoAuto merge of #90126 - flip1995:clippyup, r=Manishearth
bors [Thu, 21 Oct 2021 23:31:13 +0000 (23:31 +0000)]
Auto merge of #90126 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

This adds a new dep to Clippy: [indoc](https://crates.io/crates/indoc)

And transitively: [unindent](https://crates.io/crates/unindent)

2 years agofix doc issue in rustfmt
Caleb Cartwright [Thu, 21 Oct 2021 22:22:54 +0000 (17:22 -0500)]
fix doc issue in rustfmt

2 years agoTime out docker load after 10 minutes, kill after 12 due to CI hangs.
Hans Kratz [Thu, 21 Oct 2021 20:52:00 +0000 (22:52 +0200)]
Time out docker load after 10 minutes, kill after 12 due to CI hangs.

2 years agoignore `potential_query_instability` in rustdoc
lcnr [Thu, 21 Oct 2021 17:48:56 +0000 (19:48 +0200)]
ignore `potential_query_instability` in rustdoc

2 years agoDo not depend on the stored value when trying to cache on disk.
Camille GILLOT [Tue, 19 Oct 2021 18:15:13 +0000 (20:15 +0200)]
Do not depend on the stored value when trying to cache on disk.

2 years agoadd tests for -Zlocation-detail
Hudson Ayers [Fri, 15 Oct 2021 15:58:28 +0000 (08:58 -0700)]
add tests for -Zlocation-detail

2 years agodocument the unstable location-detail flag
Hudson Ayers [Thu, 14 Oct 2021 17:46:07 +0000 (10:46 -0700)]
document the unstable location-detail flag

2 years agoConfigure saved panic locations based on location-detail flag
Hudson Ayers [Thu, 14 Oct 2021 16:20:32 +0000 (09:20 -0700)]
Configure saved panic locations based on location-detail flag

2 years agoStabilize feature saturating_div for rust 1.58
Michael Watzko [Thu, 21 Oct 2021 16:08:03 +0000 (18:08 +0200)]
Stabilize feature saturating_div for rust 1.58

2 years agoAuto merge of #90130 - Mark-Simulacrum:revert-namebinding, r=oli-obk
bors [Thu, 21 Oct 2021 15:45:00 +0000 (15:45 +0000)]
Auto merge of #90130 - Mark-Simulacrum:revert-namebinding, r=oli-obk

Revert "resolve: Use NameBinding for local variables and generic parameters"

This reverts commit 6162529a01473bbb2427fa27354cbafc3c514eee, that is, PR #89100.

Reverting per performance regression noted post-merge on that PR (https://github.com/rust-lang/rust/pull/89100#issuecomment-948065457).

2 years agoClarify undefined behaviour for binary heap, btree and hashset
Wilfred Hughes [Wed, 28 Jul 2021 06:13:42 +0000 (23:13 -0700)]
Clarify undefined behaviour for binary heap, btree and hashset

Previously, it wasn't clear whether "This could include" was referring
to logic errors, or undefined behaviour. Tweak wording to clarify this
sentence does not relate to UB.

2 years agoPrint step timings for try builds
Mark Rousskov [Thu, 21 Oct 2021 13:16:16 +0000 (09:16 -0400)]
Print step timings for try builds

2 years agoRevert "Auto merge of #89100 - petrochenkov:localbind, r=cjgillot"
Mark Rousskov [Thu, 21 Oct 2021 13:09:24 +0000 (09:09 -0400)]
Revert "Auto merge of #89100 - petrochenkov:localbind, r=cjgillot"

This reverts commit 6162529a01473bbb2427fa27354cbafc3c514eee.

2 years agotriagebot: Treat `I-*nominated` like `I-nominated`
Josh Triplett [Thu, 21 Oct 2021 13:07:36 +0000 (15:07 +0200)]
triagebot: Treat `I-*nominated` like `I-nominated`

rustbot doesn't allow unauthenticated users to set `I-nominated`; apply
the same permissions to the new `I-*nominated` labels.

2 years agoUpdate Cargo.lock
flip1995 [Thu, 21 Oct 2021 11:13:17 +0000 (13:13 +0200)]
Update Cargo.lock

2 years agoMerge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyup
flip1995 [Thu, 21 Oct 2021 11:11:36 +0000 (13:11 +0200)]
Merge commit '91496c2ac6abf6454c413bb23e8becf6b6dc20ea' into clippyup

2 years agoCI: Enable overflow checks for test (non-dist) builds
Hans Kratz [Mon, 11 Oct 2021 17:38:15 +0000 (19:38 +0200)]
CI: Enable overflow checks for test (non-dist) builds

2 years agoAuto merge of #7853 - flip1995:rustup, r=flip1995
bors [Thu, 21 Oct 2021 10:23:11 +0000 (10:23 +0000)]
Auto merge of #7853 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

2 years agoBump nightly version -> 2021-10-21
flip1995 [Thu, 21 Oct 2021 10:19:46 +0000 (12:19 +0200)]
Bump nightly version -> 2021-10-21

2 years agoBump Clippy Version -> 0.1.58
flip1995 [Thu, 21 Oct 2021 10:19:32 +0000 (12:19 +0200)]
Bump Clippy Version -> 0.1.58

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 21 Oct 2021 10:18:12 +0000 (12:18 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAdd test for issue #78561
samlich [Wed, 20 Oct 2021 22:51:31 +0000 (22:51 +0000)]
Add test for issue #78561

2 years agoDebug output before loading docker images as that might hang.
Hans Kratz [Thu, 21 Oct 2021 09:11:20 +0000 (11:11 +0200)]
Debug output before loading docker images as that might hang.

2 years agoCI: make cache download attempt time out after 10 minutes
Hans Kratz [Thu, 21 Oct 2021 09:02:47 +0000 (11:02 +0200)]
CI: make cache download attempt time out after 10 minutes

2 years agoVerify that only NeedsNonConstDrop expects promoteds
Tomasz Miąsko [Thu, 21 Oct 2021 00:00:00 +0000 (00:00 +0000)]
Verify that only NeedsNonConstDrop expects promoteds

2 years agoAuto merge of #7852 - surechen:fix_typo, r=xFrednet
bors [Thu, 21 Oct 2021 09:08:22 +0000 (09:08 +0000)]
Auto merge of #7852 - surechen:fix_typo, r=xFrednet

Fix typo for invalid_null_ptr_usage and missing_inline_in_public_items.

Fix typo for invalid_null_ptr_usage and missing_inline_in_public_items.

changelog: none

2 years agoAuto merge of #90119 - JohnTitor:rollup-e5t6khz, r=JohnTitor
bors [Thu, 21 Oct 2021 08:04:19 +0000 (08:04 +0000)]
Auto merge of #90119 - JohnTitor:rollup-e5t6khz, r=JohnTitor

Rollup of 14 pull requests

Successful merges:

 - #86984 (Reject octal zeros in IPv4 addresses)
 - #87440 (Remove unnecessary condition in Barrier::wait())
 - #88644 (`AbstractConst` private fields)
 - #89292 (Stabilize CString::from_vec_with_nul[_unchecked])
 - #90010 (Avoid overflow in `VecDeque::with_capacity_in()`.)
 - #90029 (Add test for debug logging during incremental compilation)
 - #90031 (config: add the option to enable LLVM tests)
 - #90048 (Add test for line-number setting)
 - #90071 (Remove hir::map::blocks and use FnKind instead)
 - #90074 (2229 migrations small cleanup)
 - #90077 (Make `From` impls of NonZero integer const.)
 - #90097 (Add test for duplicated sidebar entries for reexported macro)
 - #90098 (Add test to ensure that the missing_doc_code_examples is not triggered on foreign trait implementations)
 - #90099 (Fix MIRI UB in `Vec::swap_remove`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoFix typo for INVALID_NULL_PTR_USAGE and MISSING_INLINE_IN_PUBLIC_ITEMS.
surechen [Thu, 21 Oct 2021 06:33:43 +0000 (14:33 +0800)]
Fix typo for INVALID_NULL_PTR_USAGE and MISSING_INLINE_IN_PUBLIC_ITEMS.

2 years agoRollup merge of #90099 - SkiFire13:fix-vec-swap-remove, r=dtolnay
Yuki Okushi [Thu, 21 Oct 2021 05:11:13 +0000 (14:11 +0900)]
Rollup merge of #90099 - SkiFire13:fix-vec-swap-remove, r=dtolnay

Fix MIRI UB in `Vec::swap_remove`

Fixes #90055

I find it weird that `Vec::swap_remove` read the last element to the stack just to immediately put it back in the `Vec` in place of the one at index `index`. It seems much more natural to me to just read the element at position `index` and then move the last element in its place. I guess this might also slightly improve codegen.