]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoUse bitand when checking for signed integer division overflow
Trevor Spiteri [Sat, 2 Oct 2021 10:16:08 +0000 (12:16 +0200)]
Use bitand when checking for signed integer division overflow

For `self == Self::MIN && rhs == -1`, LLVM does not realize that this is the
same check made by `self / rhs`, so the code generated may have some unnecessary
duplication. For `(self == Self::MIN) & (rhs == -1)`, LLVM realizes it is the
same check.

2 years agoAuto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearth
bors [Fri, 1 Oct 2021 22:47:22 +0000 (22:47 +0000)]
Auto merge of #89449 - Manishearth:rollup-3alb61f, r=Manishearth

Rollup of 7 pull requests

Successful merges:

 - #85223 (rustdoc: Clarified the attribute which prompts the warning)
 - #88847 (platform-support.md: correct ARMv7+MUSL platform triple notes)
 - #88963 (Coerce const FnDefs to implement const Fn traits )
 - #89376 (Fix use after drop in self-profile with llvm events)
 - #89422 (Replace whitespaces in doctests' name with dashes)
 - #89440 (Clarify a sentence in the documentation of Vec (#84488))
 - #89441 (Normalize after substituting via `field.ty()`)

Failed merges:

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

2 years agoRollup merge of #89441 - Nadrieril:fix-89393, r=tmandry
Manish Goregaokar [Fri, 1 Oct 2021 21:46:52 +0000 (14:46 -0700)]
Rollup merge of #89441 - Nadrieril:fix-89393, r=tmandry

Normalize after substituting via `field.ty()`

Back in https://github.com/rust-lang/rust/issues/72476 I hadn't understood where the problem was coming from, and only worked around the issue. What happens is that calling `field.ty()` on a field of a generic struct substitutes the appropriate generics but doesn't normalize the resulting type.
As a consumer of types I'm surprised that one would substitute without normalizing, feels like a footgun, so I added a comment.

Fixes https://github.com/rust-lang/rust/issues/89393.

2 years agoRollup merge of #89440 - chrismit3s:issue-84488-fix, r=steveklabnik
Manish Goregaokar [Fri, 1 Oct 2021 21:46:51 +0000 (14:46 -0700)]
Rollup merge of #89440 - chrismit3s:issue-84488-fix, r=steveklabnik

Clarify a sentence in the documentation of Vec (#84488)

 I literally changed a single word, but this should clear up the confusion of #84488. Can probably be `rollup`ed :) (My first PR, hope I'm doing this right)

fixes #84488

r? `@steveklabnik`

2 years agoRollup merge of #89422 - GuillaumeGomez:doctest-whitespace-name, r=CraftSpider
Manish Goregaokar [Fri, 1 Oct 2021 21:46:50 +0000 (14:46 -0700)]
Rollup merge of #89422 - GuillaumeGomez:doctest-whitespace-name, r=CraftSpider

Replace whitespaces in doctests' name with dashes

Fixes #88263.

Instead of handling white spaces when we filter tests (which would be quite complicated since we split on them!), I propose to instead replace them with dashes.

So for example, this:

```console
test foo.rs - Iter2<T, P>::len (line 13) ... ok
test foo.rs - Iter<T, P>::len (line 4) ... ok
```

becomes:

```console
test foo.rs - Iter<T,-P>::len (line 4) ... ok
test foo.rs - Iter2<T,-P>::len (line 13) ... ok
```

r? `@jyn514`

2 years agoRollup merge of #89376 - andjo403:selfProfileUseAfterDropFix, r=Mark-Simulacrum
Manish Goregaokar [Fri, 1 Oct 2021 21:46:49 +0000 (14:46 -0700)]
Rollup merge of #89376 - andjo403:selfProfileUseAfterDropFix, r=Mark-Simulacrum

Fix use after drop in self-profile with llvm events

self-profile with `-Z self-profile-events=llvm` have failed with a segmentation fault due to this use after drop.
this type of events can be more useful now that the new passmanager is the default.

2 years agoRollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk
Manish Goregaokar [Fri, 1 Oct 2021 21:46:48 +0000 (14:46 -0700)]
Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk

Coerce const FnDefs to implement const Fn traits

You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`.

r? ``@oli-obk``

``@rustbot`` label T-compiler F-const_trait_impl

2 years agoRollup merge of #88847 - oliverbr:master, r=steveklabnik
Manish Goregaokar [Fri, 1 Oct 2021 21:46:47 +0000 (14:46 -0700)]
Rollup merge of #88847 - oliverbr:master, r=steveklabnik

platform-support.md: correct ARMv7+MUSL platform triple notes

This PR fixes two minor inconsistencies in the platform support list.

- use "with MUSL" suffix for "armv7-unknown-linux-musleabi"
- add "hardfloat" suffix for "armv7-unknown-linux-musleabihf"

r? `@steveklabnik`

2 years agoRollup merge of #85223 - simbleau:master, r=steveklabnik
Manish Goregaokar [Fri, 1 Oct 2021 21:46:46 +0000 (14:46 -0700)]
Rollup merge of #85223 - simbleau:master, r=steveklabnik

rustdoc: Clarified the attribute which prompts the warning

The example call was lacking clarification of the  `#![warn(rustdoc::invalid_codeblock_attributes)]` attribute which generates the specified warning.

2 years agoAuto merge of #88880 - cjgillot:no-krate, r=oli-obk
bors [Fri, 1 Oct 2021 20:06:34 +0000 (20:06 +0000)]
Auto merge of #88880 - cjgillot:no-krate, r=oli-obk

Rework HIR API to make invocations of the hir_crate query harder.

`hir_crate` forces the recomputation of queries that depend on it.

This PR aims at avoiding useless invocations of `hir_crate` by making dependent code go through `tcx.hir()`.

2 years agoReplace whitespaces in doctests' name with dashes
Guillaume Gomez [Fri, 1 Oct 2021 09:46:34 +0000 (11:46 +0200)]
Replace whitespaces in doctests' name with dashes

2 years agoNormalize after substituting via `field.ty()`
Nadrieril [Fri, 1 Oct 2021 18:09:43 +0000 (19:09 +0100)]
Normalize after substituting via `field.ty()`

2 years agoClarify a sentence in the documentation of Vec (#84488)
chrismit3s [Fri, 1 Oct 2021 18:07:36 +0000 (20:07 +0200)]
Clarify a sentence in the documentation of Vec (#84488)

2 years agoAuto merge of #89435 - Manishearth:rollup-vh2ih7k, r=Manishearth
bors [Fri, 1 Oct 2021 17:17:43 +0000 (17:17 +0000)]
Auto merge of #89435 - Manishearth:rollup-vh2ih7k, r=Manishearth

Rollup of 6 pull requests

Successful merges:

 - #87868 (Added -Z randomize-layout flag)
 - #88820 (Add `pie` as another `relocation-model` value)
 - #89029 (feat(rustc_parse): recover from pre-RFC-2000 const generics syntax)
 - #89322 (Reapply "Remove optimization_fuel_crate from Session")
 - #89340 (Improve error message for `printf`-style format strings)
 - #89415 (Correct caller/callsite confusion in inliner message)

Failed merges:

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

2 years agoRollup merge of #89415 - wesleywiser:inliner_caller_callsite_message, r=michaelwoerister
Manish Goregaokar [Fri, 1 Oct 2021 16:18:20 +0000 (09:18 -0700)]
Rollup merge of #89415 - wesleywiser:inliner_caller_callsite_message, r=michaelwoerister

Correct caller/callsite confusion in inliner message

`callee_body` is the MIR `Body` for the `callsite.callee` so this message basically says `"Inline {bar span} into bar"` when it should say `"Inline bar into foo"`.

Extracted out of #82280

2 years agoRollup merge of #89340 - FabianWolff:issue-89173, r=petrochenkov
Manish Goregaokar [Fri, 1 Oct 2021 16:18:19 +0000 (09:18 -0700)]
Rollup merge of #89340 - FabianWolff:issue-89173, r=petrochenkov

Improve error message for `printf`-style format strings

Fixes #89173. The following is actually supported today:
```rust
fn main() {
    let num = 5;
    let width = 20;
    print!("%*2$x", num, width);
}
```
```
error: multiple unused formatting arguments
 --> src/main.rs:4:21
  |
4 |     print!("%*2$x", num, width);
  |            -------  ^^^  ^^^^^ argument never used
  |            ||       |
  |            ||       argument never used
  |            |help: format specifiers use curly braces: `{:1$x}`
  |            multiple missing formatting specifiers
  |
  = note: printf formatting not supported; see the documentation for `std::fmt`
```
However, as noted in #89173, something like
```rust
    print!("%0*x", width, num);
```
does not give a helpful suggestion. I think this is partly intended, because there actually _is_ no Rust equivalent to this; you always have to use a positional or named argument to specify the width (instead of just using the "next" argument, as `printf` or even `.*` as a precision specifier in Rust would). Therefore, I have added a note:
```
[...]
note: format specifiers use curly braces, and you have to use a positional or named parameter for the width
 --> t2.rs:4:13
  |
4 |     print!("%0*x", width, num);
  |             ^^^^
  = note: printf formatting not supported; see the documentation for `std::fmt`
```
This is not perfect, but it should at least point the user in the right direction, instead of issuing no explanation at all.

cc ```@lcnr```

2 years agoRollup merge of #89322 - tmiasko:rm-optimization-fuel, r=michaelwoerister
Manish Goregaokar [Fri, 1 Oct 2021 16:18:18 +0000 (09:18 -0700)]
Rollup merge of #89322 - tmiasko:rm-optimization-fuel, r=michaelwoerister

Reapply "Remove optimization_fuel_crate from Session"

2 years agoRollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebank
Manish Goregaokar [Fri, 1 Oct 2021 16:18:17 +0000 (09:18 -0700)]
Rollup merge of #89029 - notriddle:notriddle/issue-89013, r=estebank

feat(rustc_parse): recover from pre-RFC-2000 const generics syntax

Fixes #89013

2 years agoRollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkov
Manish Goregaokar [Fri, 1 Oct 2021 16:18:16 +0000 (09:18 -0700)]
Rollup merge of #88820 - hlopko:add_pie_relocation_model, r=petrochenkov

Add `pie` as another `relocation-model` value

MCP: https://github.com/rust-lang/compiler-team/issues/461

2 years agoRollup merge of #87868 - Kixiron:packing-on-the-pounds, r=eddyb
Manish Goregaokar [Fri, 1 Oct 2021 16:18:16 +0000 (09:18 -0700)]
Rollup merge of #87868 - Kixiron:packing-on-the-pounds, r=eddyb

Added -Z randomize-layout flag

An implementation of #77316, it currently randomly shuffles the fields of `repr(rust)` types based on their `DefPathHash`
r? ``@eddyb``

2 years agoAuto merge of #89403 - camsteffen:fmt-unsafe-private, r=Mark-Simulacrum
bors [Fri, 1 Oct 2021 12:08:35 +0000 (12:08 +0000)]
Auto merge of #89403 - camsteffen:fmt-unsafe-private, r=Mark-Simulacrum

Add private arg to fmt::UnsafeArg

As discussed [here](https://github.com/rust-lang/rust/pull/89139#discussion_r719467357)

r? `@Mark-Simulacrum`

2 years agoAuto merge of #89417 - Manishearth:rollup-j2gdu95, r=Manishearth
bors [Fri, 1 Oct 2021 09:00:42 +0000 (09:00 +0000)]
Auto merge of #89417 - Manishearth:rollup-j2gdu95, r=Manishearth

Rollup of 7 pull requests

Successful merges:

 - #88838 (Do not suggest importing inaccessible items)
 - #89251 (Detect when negative literal indices are used and suggest appropriate code)
 - #89321 (Rebase resume argument projections during state transform)
 - #89327 (Pick one possible lifetime in case there are multiple choices)
 - #89344 (Cleanup lower_generics_mut and make span be the bound itself)
 - #89397 (Update `llvm` submodule to fix function name mangling on x86 Windows)
 - #89412 (Add regression test for issues #88969 and #89119 )

Failed merges:

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

2 years agoRollup merge of #89412 - lqd:zvariant-repro, r=Aaron1011
Manish Goregaokar [Fri, 1 Oct 2021 06:41:11 +0000 (23:41 -0700)]
Rollup merge of #89412 - lqd:zvariant-repro, r=Aaron1011

Add regression test for issues #88969 and #89119

This adds a regression test to complete https://github.com/rust-lang/rust/pull/89125, and thus for issues #88969 and #89119, which needed a test.

Used with multiple crates, [this](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=f665e7e882059157e0f86cfb09c47187) minimized from `zvariant-2.8.0` reproduces the error on `nightly-2021-09-19`.

The test in this PR fails on master if the commit 6dbb9d4eee0a2789a74bb2d4b8228626f7cd741c from #89125 is reverted, and passes otherwise since it's now fixed.

r? `@Aaron1011`

2 years agoRollup merge of #89397 - wesleywiser:update_llvm_submodule, r=cuviper
Manish Goregaokar [Fri, 1 Oct 2021 06:41:10 +0000 (23:41 -0700)]
Rollup merge of #89397 - wesleywiser:update_llvm_submodule, r=cuviper

Update `llvm` submodule to fix function name mangling on x86 Windows

Fixes #89307

2 years agoRollup merge of #89344 - jackh726:maybe-bound-eror, r=cjgillot
Manish Goregaokar [Fri, 1 Oct 2021 06:41:09 +0000 (23:41 -0700)]
Rollup merge of #89344 - jackh726:maybe-bound-eror, r=cjgillot

Cleanup lower_generics_mut and make span be the bound itself

Closes #86298 (supersedes those changes)

r? `@cjgillot` since you reviewed the other PR

(Used wrong branch for #89338)

2 years agoRollup merge of #89327 - oli-obk:nll_diag_infer_vars, r=wesleywiser
Manish Goregaokar [Fri, 1 Oct 2021 06:41:08 +0000 (23:41 -0700)]
Rollup merge of #89327 - oli-obk:nll_diag_infer_vars, r=wesleywiser

Pick one possible lifetime in case there are multiple choices

In case a lifetime variable is created, but doesn't have an obvious lifetime in the list of named lifetimes that it should be inferred to, just pick the first one for the diagnostic.

This happens e.g. in

```rust
fn foo<'a, 'b>(a: Struct<'a>, b: Struct<'b>) -> impl Trait<'a, 'b> {
    if bar() { a } else { b }
}
```

where we get a lifetime variable that combines the lifetimes of `a` and `b` creating a lifetime that is the intersection of both. Right now the type system cannot express this and thus we get an error, but that error also can't express this.

I can also create an entirely new diagnostic that mentions all involved lifetimes, so it would actually mention `'a` and `'b` instead of just `'b`.

2 years agoRollup merge of #89321 - tmiasko:rebase-resume-arg, r=estebank
Manish Goregaokar [Fri, 1 Oct 2021 06:41:07 +0000 (23:41 -0700)]
Rollup merge of #89321 - tmiasko:rebase-resume-arg, r=estebank

Rebase resume argument projections during state transform

When remapping a resume argument with projections rebase them on top of
the new base.

The case where resume argument has projections is unusual, but might
arise with box syntax where the assignment is performed directly into
the box without an intermediate temporary.

Fixes #85635.

2 years agoRollup merge of #89251 - estebank:negative-index-literals, r=davidtwco
Manish Goregaokar [Fri, 1 Oct 2021 06:41:06 +0000 (23:41 -0700)]
Rollup merge of #89251 - estebank:negative-index-literals, r=davidtwco

Detect when negative literal indices are used and suggest appropriate code

2 years agoRollup merge of #88838 - FabianWolff:issue-88472, r=estebank
Manish Goregaokar [Fri, 1 Oct 2021 06:41:05 +0000 (23:41 -0700)]
Rollup merge of #88838 - FabianWolff:issue-88472, r=estebank

Do not suggest importing inaccessible items

Fixes #88472. For this example:
```rust
mod a {
    struct Foo;
}

mod b {
    type Bar = Foo;
}
```
rustc currently emits:
```
error[E0412]: cannot find type `Foo` in this scope
 --> test.rs:6:16
  |
6 |     type Bar = Foo;
  |                ^^^ not found in this scope
  |
help: consider importing this struct
  |
6 |     use a::Foo;
  |
```
this is incorrect, as applying this suggestion leads to
```
error[E0603]: struct `Foo` is private
 --> test.rs:6:12
  |
6 |     use a::Foo;
  |            ^^^ private struct
  |
note: the struct `Foo` is defined here
 --> test.rs:2:5
  |
2 |     struct Foo;
  |     ^^^^^^^^^^^
```
With my changes, I get:
```
error[E0412]: cannot find type `Foo` in this scope
 --> test.rs:6:16
  |
6 |     type Bar = Foo;
  |                ^^^ not found in this scope
  |
  = note: this struct exists but is inaccessible:
          a::Foo
```
As for the wildcard mentioned in #88472, I would argue that the warning is actually correct, since the import _is_ unused. I think the real issue is the wrong suggestion, which I have fixed here.

2 years agoAuto merge of #89395 - In-line:remove_visible_path_from_allowed_deprecated_lint,...
bors [Fri, 1 Oct 2021 06:19:52 +0000 (06:19 +0000)]
Auto merge of #89395 - In-line:remove_visible_path_from_allowed_deprecated_lint, r=jyn514

Remove visible path calculation from allowed deprecation lint

2 years agoAdd `pie` as another `relocation-model` value
Marcel Hlopko [Fri, 10 Sep 2021 13:11:56 +0000 (15:11 +0200)]
Add `pie` as another `relocation-model` value

2 years agoAuto merge of #89414 - Manishearth:rollup-hs11bcq, r=Manishearth
bors [Fri, 1 Oct 2021 03:23:17 +0000 (03:23 +0000)]
Auto merge of #89414 - Manishearth:rollup-hs11bcq, r=Manishearth

Rollup of 8 pull requests

Successful merges:

 - #88782 (Fix ICE when `start` lang item has wrong generics)
 - #89202 (Resolve infered types when complaining about unexpected call type )
 - #89248 (Suggest similarly named associated items in trait impls)
 - #89303 (Add `#[must_not_suspend]` to some types in std)
 - #89306 (thread: implements available_concurrency on haiku)
 - #89314 (fix(lint): don't suggest refutable patterns to "fix" irrefutable bind)
 - #89370 (CTFE: tweak aggregate rvalue handling)
 - #89392 (bootstrap: Update comment in config.library.toml.)

Failed merges:

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

2 years agoCorrect caller/callsite confusion in inliner message
Wesley Wiser [Fri, 1 Oct 2021 01:25:00 +0000 (21:25 -0400)]
Correct caller/callsite confusion in inliner message

2 years agoRollup merge of #89392 - BGR360:master, r=jyn514
Manish Goregaokar [Fri, 1 Oct 2021 01:05:27 +0000 (18:05 -0700)]
Rollup merge of #89392 - BGR360:master, r=jyn514

bootstrap: Update comment in config.library.toml.

Downloading LLVM from CI works for all platforms now.

All other templates in this directory already have the proper comment. Seems this one was neglected.

2 years agoRollup merge of #89370 - RalfJung:ctfe-aggregate-rvalue, r=oli-obk
Manish Goregaokar [Fri, 1 Oct 2021 01:05:26 +0000 (18:05 -0700)]
Rollup merge of #89370 - RalfJung:ctfe-aggregate-rvalue, r=oli-obk

CTFE: tweak aggregate rvalue handling

I have not looked at this code in ages... I think Miri does not even hit it, since (most?) aggregate rvalues are lowered somewhere in the MIR pipeline, but CTFE does hit it.

So this adds some extra sanity assertions, and removes a ZST special case -- ZST should only be special cased fairly late (when the actual memory access happens); e.g. `!` is a ZST and we still want `copy_op` to be called for it since it will perform validation (and raise UB, since `!` is never valid).

2 years agoRollup merge of #89314 - notriddle:notriddle/lint-fix-enum-variant-match, r=davidtwco
Manish Goregaokar [Fri, 1 Oct 2021 01:05:25 +0000 (18:05 -0700)]
Rollup merge of #89314 - notriddle:notriddle/lint-fix-enum-variant-match, r=davidtwco

fix(lint): don't suggest refutable patterns to "fix" irrefutable bind

In function arguments and let bindings, do not suggest changing `C` to `Foo::C` unless `C` is the only variant of `Foo`, because it won't work.

The general warning is still kept, because code like this is confusing.

Fixes #88730

p.s. `src/test/ui/lint/lint-uppercase-variables.rs` already tests the one-variant case.

2 years agoRollup merge of #89306 - devnexen:haiku_ncpus, r=nagisa
Manish Goregaokar [Fri, 1 Oct 2021 01:05:24 +0000 (18:05 -0700)]
Rollup merge of #89306 - devnexen:haiku_ncpus, r=nagisa

thread: implements available_concurrency on haiku

2 years agoRollup merge of #89303 - guswynn:std_suspend, r=dtolnay
Manish Goregaokar [Fri, 1 Oct 2021 01:05:23 +0000 (18:05 -0700)]
Rollup merge of #89303 - guswynn:std_suspend, r=dtolnay

Add `#[must_not_suspend]` to some types in std

I am not sure what else should have it? `Ref`?

2 years agoRollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, r=estebank
Manish Goregaokar [Fri, 1 Oct 2021 01:05:22 +0000 (18:05 -0700)]
Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, r=estebank

Suggest similarly named associated items in trait impls

Fix #85942

Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.

2 years agoRollup merge of #89202 - estebank:infer-call-type, r=oli-obk
Manish Goregaokar [Fri, 1 Oct 2021 01:05:21 +0000 (18:05 -0700)]
Rollup merge of #89202 - estebank:infer-call-type, r=oli-obk

Resolve infered types when complaining about unexpected call type

```
error[E0618]: expected function, found `{integer}`
  --> $DIR/call-block.rs:2:13
   |
LL |     let _ = {42}();
   |             ^^^^--
   |             |
   |             call expression requires function
```
instead of
```
error[E0618]: expected function, found `_`
  --> $DIR/call-block.rs:2:13
   |
LL |     let _ = {42}();
   |             ^^^^--
   |             |
   |             call expression requires function
```

2 years agoRollup merge of #88782 - asquared31415:issue-79559, r=cjgillot
Manish Goregaokar [Fri, 1 Oct 2021 01:05:20 +0000 (18:05 -0700)]
Rollup merge of #88782 - asquared31415:issue-79559, r=cjgillot

Fix ICE when `start` lang item has wrong generics

In my previous pr #87875 I missed the requirements on the `start` lang item due to its relative difficulty to test and opting for more conservative estimates.  This fixes that by updating the requirement to be exactly one generic type.

The `start` lang item should have exactly one generic type for the return type of the `main` fn ptr passed to it.  I believe having zero would previously *sometimes* compile (often with the use of `fn() -> ()` as the fn ptr but it was likely UB to call if the return type of `main` was not `()` as far as I know) however it also sometimes would not for various errors including ICEs and LLVM errors depending on exact situations.  Having more than 1 generic has always failed with an ICE because only the one generic type is expected and provided.

Fixes #79559, fixes #73584, fixes #83117 (all duplicates)
Relevant to #9307

r? ````@cjgillot````

2 years agoAuto merge of #89183 - cjgillot:noenc, r=oli-obk
bors [Fri, 1 Oct 2021 00:35:35 +0000 (00:35 +0000)]
Auto merge of #89183 - cjgillot:noenc, r=oli-obk

Move encode_metadata out of CrateStore.

`rustc_metadata` is already accessible by all client crates. It does not need to be called trough a trait object.

2 years agoadd regression test for issue 89119
Rémy Rakic [Thu, 30 Sep 2021 20:12:06 +0000 (22:12 +0200)]
add regression test for issue 89119

2 years agoAuto merge of #89282 - sexxi-goose:fix-88118, r=nikomatsakis
bors [Thu, 30 Sep 2021 20:23:47 +0000 (20:23 +0000)]
Auto merge of #89282 - sexxi-goose:fix-88118, r=nikomatsakis

2229: Consume IfLet expr

When using the IfLet guard feature, we can ICE when attempting to resolve PlaceBuilders.
For pattern matching, we currently don't consume the IfLet expression when "visiting" the arms leading us to not "read" all variables and hence not being able to resolve them.

r? `@nikomatsakis`
Closes https://github.com/rust-lang/rust/issues/88118

2 years agoImplemented -Z randomize-layout
Chase Wilson [Sun, 29 Aug 2021 15:55:29 +0000 (08:55 -0700)]
Implemented -Z randomize-layout

2 years agoRebase fallout.
Camille GILLOT [Thu, 30 Sep 2021 18:22:42 +0000 (20:22 +0200)]
Rebase fallout.

2 years agoUpdate compiler/rustc_codegen_cranelift/scripts/filter_profile.rs
Camille Gillot [Tue, 28 Sep 2021 18:49:57 +0000 (20:49 +0200)]
Update compiler/rustc_codegen_cranelift/scripts/filter_profile.rs

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2 years agoUpdate run-make-fulldeps.
Camille GILLOT [Fri, 24 Sep 2021 19:06:11 +0000 (21:06 +0200)]
Update run-make-fulldeps.

2 years agoMove EncodedMetadata to rustc_metadata.
Camille GILLOT [Fri, 24 Sep 2021 16:15:36 +0000 (18:15 +0200)]
Move EncodedMetadata to rustc_metadata.

2 years agoMove encode_metadata out of CrateStore.
Camille GILLOT [Sat, 14 Nov 2020 00:59:00 +0000 (01:59 +0100)]
Move encode_metadata out of CrateStore.

2 years agoAdd private arg to fmt::UnsafeArg
Cameron Steffen [Thu, 30 Sep 2021 17:06:30 +0000 (12:06 -0500)]
Add private arg to fmt::UnsafeArg

2 years agobootstrap: Update comment (again) in config.library.toml
Ben Reeves [Thu, 30 Sep 2021 16:25:20 +0000 (11:25 -0500)]
bootstrap: Update comment (again) in config.library.toml

2 years agoApply suggestions from code review
Camille Gillot [Mon, 13 Sep 2021 18:43:43 +0000 (20:43 +0200)]
Apply suggestions from code review

Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2 years agoBless tests.
Camille GILLOT [Sun, 12 Sep 2021 11:19:04 +0000 (13:19 +0200)]
Bless tests.

2 years agoDo not pass hir::Crate to lints.
Camille GILLOT [Sun, 12 Sep 2021 09:58:27 +0000 (11:58 +0200)]
Do not pass hir::Crate to lints.

2 years agoUpdate `llvm` submodule to fix function name mangling on x86 Windows
Wesley Wiser [Thu, 30 Sep 2021 14:03:12 +0000 (10:03 -0400)]
Update `llvm` submodule to fix function name mangling on x86 Windows

Fixes #89307

2 years agoAuto merge of #87998 - nneonneo:master, r=oli-obk
bors [Thu, 30 Sep 2021 13:23:09 +0000 (13:23 +0000)]
Auto merge of #87998 - nneonneo:master, r=oli-obk

Avoid spurious "previous iteration of loop" errors

Only follow backwards edges during `get_moved_indexes` if the move path is definitely initialized at loop entry. Otherwise, the error occurred prior to the loop, so we ignore the backwards edges to avoid generating misleading "value moved here, in previous iteration of loop" errors.

This patch also slightly improves the analysis of inits, including `NonPanicPathOnly` initializations (which are ignored by `drop_flag_effects::for_location_inits`). This is required for the definite initialization analysis, but may also help find certain skipped reinits in rare cases.

Patch passes all non-ignored src/test/ui testcases.

Fixes #72649.

2 years agoRemove visible path calculation from allowed deprecation lint
Alik Aslanyan [Thu, 30 Sep 2021 11:15:10 +0000 (15:15 +0400)]
Remove visible path calculation from allowed deprecation lint

2 years agoAuto merge of #86853 - usbalbin:const_try, r=oli-obk
bors [Thu, 30 Sep 2021 10:35:24 +0000 (10:35 +0000)]
Auto merge of #86853 - usbalbin:const_try, r=oli-obk

Constify ?-operator for Result and Option

Try to make `?`-operator usable in `const fn` with `Result` and `Option`, see #74935 . Note that the try-operator itself was constified in #87237.

TODO
* [x] Add tests for const T -> T conversions
* [x] cleanup commits
* [x] Remove `#![allow(incomplete_features)]`
* [?] Await decision in #86808 - I'm not sure
* [x] Await support for parsing `~const` in bootstrapping compiler
* [x] Tracking issue(s)? - #88674

2 years agoAuto merge of #89250 - Aaron1011:keep-bound-region-names, r=estebank
bors [Thu, 30 Sep 2021 07:33:59 +0000 (07:33 +0000)]
Auto merge of #89250 - Aaron1011:keep-bound-region-names, r=estebank

Don't anonymize bound region names during typeck

Once this anonymization has performed, we have no
way of recovering the original names during NLL
borrow checking. Keeping the original names allows
error messages in full NLL mode to contain the original
bound region names.

As a result, the typeck results may contain types that
differ only in the names used for their bound regions. However,
anonimization of bound regions does not guarantee that
all distinct types are unqual (e.g. not subtypes of each other).
For example, `for<'a> fn(&'a u32, &'a u32)` and
`for<'b, 'c> fn(&'b u32, &'c u32)` are subtypes of each other,
as explained here:

https://github.com/rust-lang/rust/blob/63cc2bb3d07d6c726dfcdc5f95cbe5ed4760641a/compiler/rustc_infer/src/infer/nll_relate/mod.rs#L682-L690

Therefore, any code handling types with higher-ranked regions already
needs to handle the case where two distinct `Ty`s are 'actually'
equal.

2 years agobootstrap: Update comment in config.library.toml.
Ben Reeves [Thu, 30 Sep 2021 07:02:32 +0000 (02:02 -0500)]
bootstrap: Update comment in config.library.toml.

Downloading LLVM from CI works for all platforms now.

2 years agoAuto merge of #89386 - ehuss:rollup-idf4dmj, r=ehuss
bors [Thu, 30 Sep 2021 04:51:41 +0000 (04:51 +0000)]
Auto merge of #89386 - ehuss:rollup-idf4dmj, r=ehuss

Rollup of 13 pull requests

Successful merges:

 - #87428 (Fix union keyword highlighting in rustdoc HTML sources)
 - #88412 (Remove ignore-tidy-undocumented-unsafe from core::slice::sort)
 - #89098 (Fix generics where bounds order)
 - #89232 (Improve help for recursion limit errors)
 - #89294 (:arrow_up: rust-analyzer)
 - #89297 (Remove Never variant from clean::Type enum)
 - #89311 (Add unit assignment to MIR for `asm!()`)
 - #89313 (PassWrapper: handle function rename from upstream D36850)
 - #89315 (Clarify that `CString::from_vec_unchecked` appends 0 byte.)
 - #89335 (Optimize is_sorted for Range and RangeInclusive)
 - #89366 (rustdoc: Remove lazy_static dependency)
 - #89377 (Update cargo)
 - #89378 (Update books)

Failed merges:

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

2 years agoRollup merge of #89378 - ehuss:update-books, r=ehuss
Eric Huss [Thu, 30 Sep 2021 02:33:45 +0000 (19:33 -0700)]
Rollup merge of #89378 - ehuss:update-books, r=ehuss

Update books

## nomicon

1 commits in fe6227eb3c8533200c52dffa42ef1b6f2f02c40e..2747c4bb2cbc0639b733793ddb0bf4e9daa2634e
2021-08-31 05:42:38 +0900 to 2021-09-19 17:33:32 +0900
- Clarify a bit of wording (rust-lang/nomicon#310)

## reference

2 commits in 0e5ed7a4bec065f0cc18c35d1c904639e095314d..13747275bd14c2d2b453100498532f9ae5504769
2021-08-29 17:33:21 +0900 to 2021-09-24 17:44:04 +0900
-  (rust-lang/reference#1087)
- Document RangeFrom patterns (rust-lang/reference#900)

## book

4 commits in fcb5e0ea68112d85a1d29a7a7335978ef2a02181..eb1282ec444db94055fa9531b6f3f803e86bb382
2021-08-31 21:26:19 -0400 to 2021-09-16 21:17:09 -0400
- Rust 1.55 (rust-lang/book#2890)
- Chapter 3.3: Remove unused variable (rust-lang/book#2877)
- Appendix (operators and symbols): remove extra space (rust-lang/book#2876)
- Chapter 17.1: add missing comma (rust-lang/book#2867)

## rust-by-example

2 commits in 9d4132b56c4999cd3ce1aeca5f1b2f2cb0d11c24..28aca4a36962c709bce301c03114b5589381dfb8
2021-09-14 06:56:00 -0300 to 2021-09-25 08:19:51 -0300
- fix formatting (rust-lang/rust-by-example#1463)
- involving === verb, involved === adjective (rust-lang/rust-by-example#1461)

## rustc-dev-guide

7 commits in 9198465b6ca8bed669df0cbb67c0e6d0b140803c..d1f03cbaa39d9164f5fe4b9b93762668142e0dad
2021-09-12 11:50:44 -0500 to 2021-09-24 12:00:29 +0900
- Fix a typo on closure.md (rust-lang/rustc-dev-guide#1218)
- const generics update
- s/--blessed/--bless/
- Make indentation consistent in example vscode config file
- Suggests `--edition=2018` argument when using stage0/bin/rustfmt directly
- `ty::Unevaluated`: dealing with unused substs (rust-lang/rustc-dev-guide#1190)
- Parallel codegen (rust-lang/rustc-dev-guide#1206)

2 years agoRollup merge of #89377 - ehuss:update-cargo, r=ehuss
Eric Huss [Thu, 30 Sep 2021 02:33:44 +0000 (19:33 -0700)]
Rollup merge of #89377 - ehuss:update-cargo, r=ehuss

Update cargo

5 commits in 0121d66aa2ef5ffa9735f86c2b56f5fdc5a837a6..d56b42c549dbb7e7d0f712c51b39400260d114d4
2021-09-22 16:08:27 +0000 to 2021-09-27 13:44:18 +0000
- Allow `cargo update --precise` with metadata. (rust-lang/cargo#9945)
- Support path_in_vcs as part of cargo_vcs_metadata (rust-lang/cargo#9866)
- Doc about InstallTracker files and `install.root` (rust-lang/cargo#9948)
- Add some clarity on the license/license-file warning. (rust-lang/cargo#9941)
- Fix the problem that help cannot be displayed properly (rust-lang/cargo#9933)

2 years agoRollup merge of #89366 - GuillaumeGomez:remove-lazy-static, r=jyn514
Eric Huss [Thu, 30 Sep 2021 02:33:43 +0000 (19:33 -0700)]
Rollup merge of #89366 - GuillaumeGomez:remove-lazy-static, r=jyn514

rustdoc: Remove lazy_static dependency

The macro was used in only one place and there are equivalents in the std, so it seemed weird to keep it around...

I think running a perf check would be a good idea though, just in case.

r? ``@jyn514``

2 years agoRollup merge of #89335 - mbrubeck:range-is-sorted, r=cuviper
Eric Huss [Thu, 30 Sep 2021 02:33:42 +0000 (19:33 -0700)]
Rollup merge of #89335 - mbrubeck:range-is-sorted, r=cuviper

Optimize is_sorted for Range and RangeInclusive

The [`Step`] trait guarantees that `Range<impl Step>` yields items in sorted order.  We can override `Iterator::is_sorted` based on this guarantee, as we already do for `Iterator::min` and `max`.

Thank you to ``@fiveseven-lambda`` who pointed this out [on the Rust Users Forum](https://users.rust-lang.org/t/is-sorted-method-in-impl-iterator-for-range/64717).

[`Step`]: https://doc.rust-lang.org/stable/std/iter/trait.Step.html

2 years agoRollup merge of #89315 - et342:cstr_from_vec_unchecked_doc, r=yaahc
Eric Huss [Thu, 30 Sep 2021 02:33:41 +0000 (19:33 -0700)]
Rollup merge of #89315 - et342:cstr_from_vec_unchecked_doc, r=yaahc

Clarify that `CString::from_vec_unchecked` appends 0 byte.

2 years agoRollup merge of #89313 - durin42:llvm-14-thinLTOResolvePrevailingInModule, r=nikic
Eric Huss [Thu, 30 Sep 2021 02:33:40 +0000 (19:33 -0700)]
Rollup merge of #89313 - durin42:llvm-14-thinLTOResolvePrevailingInModule, r=nikic

PassWrapper: handle function rename from upstream D36850

thinLTOResolvePrevailingInModule became thinLTOFinalizeInModule and
gained the ability to propagate noRecurse and noUnwind function
attributes. I ran codegen tests with it both on and off, as the upstream
patch uses it in both modes, and the tests pass both ways. Given that,
it seemed reasonable to go ahead and let the propagation be enabled in
rustc, and see what happens. See https://reviews.llvm.org/D36850 for
more examples of how the new version of the function gets used.

r? ``@nikic`` cc ``@nagisa``

2 years agoRollup merge of #89311 - FabianWolff:issue-89305, r=oli-obk
Eric Huss [Thu, 30 Sep 2021 02:33:39 +0000 (19:33 -0700)]
Rollup merge of #89311 - FabianWolff:issue-89305, r=oli-obk

Add unit assignment to MIR for `asm!()`

Fixes #89305. `ExprKind::LlvmInlineAsm` gets a `push_assign_unit()` here:
https://github.com/rust-lang/rust/blob/2b6ed3b675475abc01ce7e68bb75b457f0c85684/compiler/rustc_mir_build/src/build/expr/into.rs#L475-L479

The same should probably happen for `ExprKind::InlineAsm`, which fixes the "use of possibly-uninitialized variable" error described in #89305.

2 years agoRollup merge of #89297 - GuillaumeGomez:remove-never-from-type-enum, r=camelid
Eric Huss [Thu, 30 Sep 2021 02:33:38 +0000 (19:33 -0700)]
Rollup merge of #89297 - GuillaumeGomez:remove-never-from-type-enum, r=camelid

Remove Never variant from clean::Type enum

Fixes #89287.

r? ``@camelid``

2 years agoRollup merge of #89294 - lnicola:rust-analyzer-2021-09-27, r=lnicola
Eric Huss [Thu, 30 Sep 2021 02:33:38 +0000 (19:33 -0700)]
Rollup merge of #89294 - lnicola:rust-analyzer-2021-09-27, r=lnicola

:arrow_up: rust-analyzer

2 years agoRollup merge of #89232 - rossmacarthur:fix-76424, r=wesleywiser
Eric Huss [Thu, 30 Sep 2021 02:33:37 +0000 (19:33 -0700)]
Rollup merge of #89232 - rossmacarthur:fix-76424, r=wesleywiser

Improve help for recursion limit errors

- Tweak help message and suggested limit (handle `0` case).
- Add test for #75602 (it was already fixed, maybe can be resolved too).

Fixes #76424

2 years agoRollup merge of #89098 - GuillaumeGomez:where-bounds-order, r=camelid
Eric Huss [Thu, 30 Sep 2021 02:33:36 +0000 (19:33 -0700)]
Rollup merge of #89098 - GuillaumeGomez:where-bounds-order, r=camelid

Fix generics where bounds order

Fixes #88809.

Like said on the above issue, the issue is that we were expecting `Symbol` comparisons to be string-based but they are integer-based (because `Symbol` is an integer), messing up the bounds order. To fix it, I simply stored into a `FxIndexMap` instead.

r? ``@jyn514``

2 years agoRollup merge of #88412 - mdsn:slice-sort-safety, r=dtolnay
Eric Huss [Thu, 30 Sep 2021 02:33:35 +0000 (19:33 -0700)]
Rollup merge of #88412 - mdsn:slice-sort-safety, r=dtolnay

Remove ignore-tidy-undocumented-unsafe from core::slice::sort

Write down the missing safety arguments to be able to remove `ignore-tidy-undocumented-unsafe` from `core::slice::sort`.

Helps with #66219

``@rustbot`` label C-cleanup T-libs

2 years agoRollup merge of #87428 - GuillaumeGomez:union-highlighting, r=notriddle
Eric Huss [Thu, 30 Sep 2021 02:33:34 +0000 (19:33 -0700)]
Rollup merge of #87428 - GuillaumeGomez:union-highlighting, r=notriddle

Fix union keyword highlighting in rustdoc HTML sources

I followed this logic: if I find an ident "union", I check if it followed by another ident or not. If it's the case, then I consider this is a keyword because it's declaring a union type.

To do so I created a new Iterator which allows to peek the next items without moving the current iterator position.

This is part of https://github.com/rust-lang/rust/issues/85016. If the fix makes sense, I'll extend it to other weak keywords (the issue only mentions they exist but https://doc.rust-lang.org/nightly/reference/keywords.html#weak-keywords only talks about `dyn` and `'static` so not sure if there is anything else to be done?).

cc `@notriddle` (you're one of the last ones who worked on this part of rustdoc so here you go :wink: )
r? `@jyn514`

2 years agoAuto merge of #89110 - Aaron1011:adjustment-span, r=estebank
bors [Thu, 30 Sep 2021 01:40:30 +0000 (01:40 +0000)]
Auto merge of #89110 - Aaron1011:adjustment-span, r=estebank

Use larger span for adjustment THIR expressions

Currently, we use a relatively 'small' span for THIR
expressions generated by an 'adjustment' (e.g. an autoderef,
autoborrow, unsizing). As a result, if a borrow generated
by an adustment ends up causing a borrowcheck error, for example:

```rust
let mut my_var = String::new();
let my_ref = &my_var
my_var.push('a');
my_ref;
```

then the span for the mutable borrow may end up referring
to only the base expression (e.g. `my_var`), rather than
the method call which triggered the mutable borrow
(e.g. `my_var.push('a')`)

Due to a quirk of the MIR borrowck implementation,
this doesn't always get exposed in migration mode,
but it does in many cases.

This commit makes THIR building consistently use 'larger'
spans for adjustment expressions. These spans are recoded
when we first create the adjustment during typecheck. For
example, an autoref adjustment triggered by a method call
will record the span of the entire method call.

The intent of this change it make it clearer to users
when it's the specific way in which a variable is
used (for example, in a method call) that produdes
a borrowcheck error. For example, an error message
claiming that a 'mutable borrow occurs here' might
be confusing if it just points at a usage of a variable
(e.g. `my_var`), when no `&mut` is in sight. Pointing
at the entire expression should help to emphasize
that the method call itself is responsible for
the mutable borrow.

In several cases, this makes the `#![feature(nll)]` diagnostic
output match up exactly with the default (migration mode) output.
As a result, several `.nll.stderr` files end up getting removed
entirely.

2 years agoAuto merge of #89380 - ehuss:fix-windows-llvm, r=Mark-Simulacrum
bors [Wed, 29 Sep 2021 22:39:40 +0000 (22:39 +0000)]
Auto merge of #89380 - ehuss:fix-windows-llvm, r=Mark-Simulacrum

Fix Windows LLVM issue.

GitHub image 20210928.2 added LLVM 12.0.1 to the stock image.  However, the `lldb` executable doesn't work, it fails with:

> C:/Program Files/LLVM/bin/lldb.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

We probably don't want to start testing LLDB on windows anyways (at least not without intent).

The hacky solution for now is to just delete the system LLVM.

2 years agoFix Windows LLVM issue.
Eric Huss [Wed, 29 Sep 2021 22:27:44 +0000 (15:27 -0700)]
Fix Windows LLVM issue.

2 years agoUpdate books
Eric Huss [Wed, 29 Sep 2021 21:37:40 +0000 (14:37 -0700)]
Update books

2 years agoMove body_owners to tcx.hir().
Camille GILLOT [Sun, 12 Sep 2021 09:33:16 +0000 (11:33 +0200)]
Move body_owners to tcx.hir().

2 years agoAvoid more invocations of hir_crate query.
Camille GILLOT [Sat, 11 Sep 2021 23:11:22 +0000 (01:11 +0200)]
Avoid more invocations of hir_crate query.

2 years agoUpdate cargo
Eric Huss [Wed, 29 Sep 2021 21:07:04 +0000 (14:07 -0700)]
Update cargo

2 years agoFix use after drop in self-profile with llvm events
Andreas Jonson [Wed, 29 Sep 2021 20:58:33 +0000 (22:58 +0200)]
Fix use after drop in self-profile with llvm events

2 years agoRemove Never variant from clean::Type enum
Guillaume Gomez [Mon, 27 Sep 2021 12:20:52 +0000 (14:20 +0200)]
Remove Never variant from clean::Type enum

2 years agoAuto merge of #89011 - bjorn3:restructure_rt, r=dtolnay
bors [Wed, 29 Sep 2021 17:58:08 +0000 (17:58 +0000)]
Auto merge of #89011 - bjorn3:restructure_rt, r=dtolnay

Restructure std::rt

These changes should reduce binary size slightly while at the same slightly improving performance of startup, thread spawning and `std::thread::current()`. I haven't verified if the compiler is able to optimize some of these cases already, but at least for some others the compiler is unable to do these optimizations as they slightly change behavior in cases where program startup would crash anyway by omitting a backtrace and panic location.

I can remove 6f6bb16 if preferred.

2 years agoCTFE: extra assertions for Aggregate rvalues; remove unnecessarily eager special...
Ralf Jung [Wed, 29 Sep 2021 17:47:41 +0000 (13:47 -0400)]
CTFE: extra assertions for Aggregate rvalues; remove unnecessarily eager special case

2 years agoremove outdated comment
Ralf Jung [Wed, 29 Sep 2021 17:43:22 +0000 (13:43 -0400)]
remove outdated comment

2 years agoCleanup lower_generics_mut and make span be the bound itself, not the type
jackh726 [Tue, 28 Sep 2021 21:15:28 +0000 (17:15 -0400)]
Cleanup lower_generics_mut and make span be the bound itself, not the type

2 years agofix(lint): don't suggest refutable patterns to "fix" irrefutable bind
Michael Howell [Tue, 28 Sep 2021 00:16:04 +0000 (17:16 -0700)]
fix(lint): don't suggest refutable patterns to "fix" irrefutable bind

In function arguments and let bindings, do not suggest changing `C` to `Foo::C`
unless `C` is the only variant of `Foo`, because it won't work.

The general warning is still kept, because code like this is confusing.

Fixes #88730

2 years agoRemove lazy_static dependency
Guillaume Gomez [Wed, 29 Sep 2021 15:20:52 +0000 (17:20 +0200)]
Remove lazy_static dependency

2 years agoAuto merge of #89331 - GuillaumeGomez:rollup-b10unye, r=GuillaumeGomez
bors [Wed, 29 Sep 2021 10:39:41 +0000 (10:39 +0000)]
Auto merge of #89331 - GuillaumeGomez:rollup-b10unye, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #87260 (Libgccjit codegen)
 - #89212 (x.py: run `rustup toolchain link` in setup)
 - #89233 (Hide `<...> defined here` note if the source is not available)
 - #89235 (make junit output more consistent with default format)
 - #89255 (Fix incorrect disambiguation suggestion for associated items)
 - #89276 (Fix the population of the `union.impls` field)
 - #89283 (Add regression test for issue #83564)
 - #89318 (rustc_session: Remove lint store from `Session`)

Failed merges:

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

2 years agoAuto merge of #89328 - flip1995:clippyup, r=Manishearth
bors [Wed, 29 Sep 2021 07:44:23 +0000 (07:44 +0000)]
Auto merge of #89328 - flip1995:clippyup, r=Manishearth

Update Clippy

Delayed Clippy sync

r? `@Manishearth`

2 years agoref/refmut
Gus Wynn [Wed, 29 Sep 2021 00:57:08 +0000 (17:57 -0700)]
ref/refmut

2 years agoAuto merge of #88950 - Nadrieril:deconstruct-pat, r=oli-obk
bors [Wed, 29 Sep 2021 00:16:17 +0000 (00:16 +0000)]
Auto merge of #88950 - Nadrieril:deconstruct-pat, r=oli-obk

Add an intermediate representation to exhaustiveness checking

The exhaustiveness checking algorithm keeps deconstructing patterns into a `Constructor` and some `Fields`, but does so a bit all over the place. This PR introduces a new representation for patterns that already has that information, so we only compute it once at the start.
I find this makes code easier to follow. In particular `DeconstructedPat::specialize` is a lot simpler than what happened before, and more closely matches the description of the algorithm. I'm also hoping this could help for the project of librarifying exhaustiveness for rust_analyzer since it decouples the algorithm from `rustc_middle::Pat`.

2 years agoImprove error message for `printf`-style format strings
Fabian Wolff [Tue, 28 Sep 2021 22:11:55 +0000 (00:11 +0200)]
Improve error message for `printf`-style format strings

2 years agofeat(rustc_typeck): avoid erroring with "wrong number of generics" if there's other...
Michael Howell [Tue, 28 Sep 2021 22:56:45 +0000 (15:56 -0700)]
feat(rustc_typeck): avoid erroring with "wrong number of generics" if there's other problems

As shown in the two test requirements that got updated, if there's other problems,
then those other problems are probably the root cause of the incorrect generics count.

2 years agoImprove help for recursion limit errors
Ross MacArthur [Tue, 28 Sep 2021 20:16:42 +0000 (22:16 +0200)]
Improve help for recursion limit errors

2 years agoImprove error messages for bad type constraints
Michael Howell [Tue, 28 Sep 2021 19:48:58 +0000 (12:48 -0700)]
Improve error messages for bad type constraints

Co-authored-by: Esteban Kuber <esteban@kuber.com.ar>
2 years agoOptimize is_sorted for Range and RangeInclusive
Matt Brubeck [Tue, 28 Sep 2021 19:50:38 +0000 (12:50 -0700)]
Optimize is_sorted for Range and RangeInclusive

The `Step` trait guarantees that `Range<impl Step>` yields items in
sorted order.  We can override the `Iterator::is_sorted` method based on
this guarantee, as we already do for `Iterator::min` and `max`.

2 years agoRollup merge of #89318 - petrochenkov:lstore, r=oli-obk
Guillaume Gomez [Tue, 28 Sep 2021 18:00:18 +0000 (20:00 +0200)]
Rollup merge of #89318 - petrochenkov:lstore, r=oli-obk

rustc_session: Remove lint store from `Session`

It was added in https://github.com/rust-lang/rust/pull/75534, but after the cleanup in https://github.com/rust-lang/rust/pull/87070 it's no longer necessary.