]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoInclude `lld` in `rust-dev` package
Aaron Hill [Thu, 25 Nov 2021 17:45:58 +0000 (11:45 -0600)]
Include `lld` in `rust-dev` package

Fixes #88941

This will allow using `download-ci-llvm` while still having LLD
available.

2 years agoAuto merge of #91469 - matthiaskrgr:rollup-xom3j55, r=matthiaskrgr
bors [Thu, 2 Dec 2021 21:58:48 +0000 (21:58 +0000)]
Auto merge of #91469 - matthiaskrgr:rollup-xom3j55, r=matthiaskrgr

Rollup of 12 pull requests

Successful merges:

 - #89954 (Fix legacy_const_generic doc arguments display)
 - #91321 (Handle placeholder regions in NLL type outlive constraints)
 - #91329 (Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives`)
 - #91364 (Improve error message for incorrect field accesses through raw pointers)
 - #91387 (Clarify and tidy up explanation of E0038)
 - #91410 (Move `#![feature(const_precise_live_drops)]` checks earlier in the pipeline)
 - #91435 (Improve diagnostic for missing half of binary operator in `if` condition)
 - #91444 (disable tests in Miri that take too long)
 - #91457 (Add additional test from rust issue number 91068)
 - #91460 (Document how `last_os_error` should be used)
 - #91464 (Document file path case sensitivity)
 - #91466 (Improve the comments in `Symbol::interner`.)

Failed merges:

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

2 years agoRollup merge of #91466 - nnethercote:Symbol-interner-comments, r=Mark-Simulacrum
Matthias Krüger [Thu, 2 Dec 2021 21:16:19 +0000 (22:16 +0100)]
Rollup merge of #91466 - nnethercote:Symbol-interner-comments, r=Mark-Simulacrum

Improve the comments in `Symbol::interner`.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #91464 - ChrisDenton:doc-path-case-sensitivity, r=joshtriplett
Matthias Krüger [Thu, 2 Dec 2021 21:16:18 +0000 (22:16 +0100)]
Rollup merge of #91464 - ChrisDenton:doc-path-case-sensitivity, r=joshtriplett

Document file path case sensitivity

This describes the current behaviour of the standard library's pure path methods.

Fixes #66260.

2 years agoRollup merge of #91460 - ChrisDenton:doc-last-os-error, r=joshtriplett
Matthias Krüger [Thu, 2 Dec 2021 21:16:16 +0000 (22:16 +0100)]
Rollup merge of #91460 - ChrisDenton:doc-last-os-error, r=joshtriplett

Document how `last_os_error` should be used

It should be made clear that the state of the last OS error could change if another function call is made before the call to `Error::last_os_error()`.

Fixes: #53155
2 years agoRollup merge of #91457 - steffahn:additional_test_from_91068, r=jackh726
Matthias Krüger [Thu, 2 Dec 2021 21:16:15 +0000 (22:16 +0100)]
Rollup merge of #91457 - steffahn:additional_test_from_91068, r=jackh726

Add additional test from rust issue number 91068

see rust-lang/rust#91068

r? ``@jackh726``

2 years agoRollup merge of #91444 - RalfJung:miri-tests, r=dtolnay
Matthias Krüger [Thu, 2 Dec 2021 21:16:14 +0000 (22:16 +0100)]
Rollup merge of #91444 - RalfJung:miri-tests, r=dtolnay

disable tests in Miri that take too long

Comparing slices of length `usize::MAX` diverges in Miri. In fact these tests even diverge in rustc unless `-O` is passed. I tried this code to check that:
```rust
#![feature(slice_take)]

const EMPTY_MAX: &'static [()] = &[(); usize::MAX];

fn main() {
    let mut slice: &[_] = &[(); usize::MAX];
    println!("1");
    assert_eq!(Some(&[] as _), slice.take(usize::MAX..));
    println!("2");
    let remaining: &[_] = EMPTY_MAX;
    println!("3");
    assert_eq!(remaining, slice);
    println!("4");
}
```
So, disable these tests in Miri for now.

2 years agoRollup merge of #91435 - FabianWolff:issue-91421-if-then, r=lcnr
Matthias Krüger [Thu, 2 Dec 2021 21:16:13 +0000 (22:16 +0100)]
Rollup merge of #91435 - FabianWolff:issue-91421-if-then, r=lcnr

Improve diagnostic for missing half of binary operator in `if` condition

Fixes #91421. I've also changed it so that it doesn't consume the `else` token in the error case, because it will try to consume it again afterwards, leading to this incorrect error message (where the `else` reported as missing is actually there):
```
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `{`
 --> src/main.rs:4:12
  |
4 |     } else { 4 };
  |            ^ expected one of `.`, `;`, `?`, `else`, or an operator
```

r? `@lcnr`

2 years agoRollup merge of #91410 - ecstatic-morse:const-precise-live-drops-take-2, r=oli-obk
Matthias Krüger [Thu, 2 Dec 2021 21:16:13 +0000 (22:16 +0100)]
Rollup merge of #91410 - ecstatic-morse:const-precise-live-drops-take-2, r=oli-obk

Move `#![feature(const_precise_live_drops)]` checks earlier in the pipeline

Should mitigate the issues found during MCP on #73255.

Once this is done, we should clean up the queries a bit, since I think `mir_drops_elaborated_and_const_checked` can be merged back into `mir_promoted`.

Fixes #90770.

cc ``@rust-lang/wg-const-eval``
r? ``@nikomatsakis`` (since they reviewed #71824)

2 years agoRollup merge of #91387 - graydon:E0038-clarification, r=wesleywiser
Matthias Krüger [Thu, 2 Dec 2021 21:16:12 +0000 (22:16 +0100)]
Rollup merge of #91387 - graydon:E0038-clarification, r=wesleywiser

Clarify and tidy up explanation of E0038

I ran into E0038 (specifically the `Self:Sized` constraint on object-safety) the other day and it seemed to me that the explanations I found floating around the internet were a bit .. wrong. Like they didn't make sense. And then I went and checked the official explanation here and it didn't make sense either.

As far as I can tell (reading through the history of the RFCs), two totally different aspects of object-safety have got tangled up in much of the writing on the subject:
  - Object-safety related to "not even theoretically possible" issues. This includes things like "methods that take or return Self by value", which obviously will never work for an unsized type in a world with fixed-size stack frames (and it'd be an opaque type anyways, which, ugh). This sort of thing was originally decided method-by-method, with non-object-safe methods stripped from objects; but in [RFC 0255](https://rust-lang.github.io/rfcs/0255-object-safety.html) this sort of per-impossible-method reasoning was made into a per-trait safety property (with the escape hatch left in where users could mark methods `where Self:Sized` to have them stripped before the trait's object safety is considered).
  - Object-safety related to "totally possible but ergonomically a little awkward" issues. Specifically in a trait with `Trait:Sized`, there's no a priori reason why this constraint makes the trait impossible to make into an object -- imagine it had nothing but harmless `&self`-taking methods. No problem! Who cares if the Trait requires its implementing types to be sized? As far as I can tell reading the history here, in both RFC 0255 and then later in [RFC 0546](https://rust-lang.github.io/rfcs/0546-Self-not-sized-by-default.html) it seems that the motivation for making `Trait:Sized` be non-object-safe has _nothing to do_ with the impossibility of making objects out of such types, and everything to do with enabling "[a trait object SomeTrait to implement the trait SomeTrait](https://rust-lang.github.io/rfcs/0546-Self-not-sized-by-default.html#motivation)". That is, since `dyn Trait` is unsized, if `Trait:Sized` then you can never have the automatic (and reasonable) ergonomic implicit `impl Trait for dyn Trait`. And the authors of that RFC really wanted that automatic implicit implementation of `Trait` for `dyn Trait`. So they just defined `Trait:Sized` as non-object safe -- no `dyn Trait` can ever exist that the compiler can't synthesize such an impl for. Well enough!

However, I noticed in my reading-and-reconstruction that lots of documentation on the internet, including forum and Q&A site answers and (most worrying) the compiler explanation all kinda grasp at something like the first ("not theoretically possible") explanation, and fail to mention the second ("just an ergonomic constraint") explanation. So I figured I'd clean up the docs to clarify, maybe confuse the next person less (unless of course I'm misreading the history here and misunderstanding motives -- please let me know if so!)

While here I also did some cleanups:

  - Rewrote the preamble, trying to help the user get a little better oriented (I found the existing preamble a bit scattered).
  - Modernized notation (using `dyn Trait`)
  - Changed the section headings to all be written with the same logical sense: to all be written as "conditions that violate object safety" rather than a mix of that and the negated form "conditions that must not happen in order to ensure object safety".

I think there's a fair bit more to clean up in this doc -- the later sections get a bit rambly and I suspect there should be a completely separated-out section covering the `where Self:Sized` escape hatch for instructing the compiler to "do the old thing" and strip methods off traits when turning them into objects (it's a bit buried as a digression in the individual sub-error sections). But I did what I had time for now.

2 years agoRollup merge of #91364 - FabianWolff:issue-91210-ptr-field, r=oli-obk
Matthias Krüger [Thu, 2 Dec 2021 21:16:11 +0000 (22:16 +0100)]
Rollup merge of #91364 - FabianWolff:issue-91210-ptr-field, r=oli-obk

Improve error message for incorrect field accesses through raw pointers

Fixes #91210.

2 years agoRollup merge of #91329 - Aaron1011:modulo-regions-test, r=jackh726
Matthias Krüger [Thu, 2 Dec 2021 21:16:10 +0000 (22:16 +0100)]
Rollup merge of #91329 - Aaron1011:modulo-regions-test, r=jackh726

Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives`

A global predicate is not guarnatenteed to outlive all regions.
If the predicate involves late-bound regions, then it may fail
to outlive other regions (e.g. `for<'b> &'b bool: 'static` does not
hold)

We now only produce `EvaluatedToOk` when a global predicate has no
late-bound regions - in that case, the ony region that can be present
in the type is 'static

2 years agoRollup merge of #91321 - matthewjasper:constaint-placeholders, r=jackh726
Matthias Krüger [Thu, 2 Dec 2021 21:16:09 +0000 (22:16 +0100)]
Rollup merge of #91321 - matthewjasper:constaint-placeholders, r=jackh726

Handle placeholder regions in NLL type outlive constraints

Closes #76168

2 years agoRollup merge of #89954 - GuillaumeGomez:legacy-const-generic-doc, r=Amanieu
Matthias Krüger [Thu, 2 Dec 2021 21:16:08 +0000 (22:16 +0100)]
Rollup merge of #89954 - GuillaumeGomez:legacy-const-generic-doc, r=Amanieu

Fix legacy_const_generic doc arguments display

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

cc ``@Amanieu``

2 years agoImprove the comments in `Symbol::interner`.
Nicholas Nethercote [Thu, 2 Dec 2021 20:12:31 +0000 (07:12 +1100)]
Improve the comments in `Symbol::interner`.

2 years agoDocument file path case sensitivity
Chris Denton [Thu, 2 Dec 2021 19:37:25 +0000 (19:37 +0000)]
Document file path case sensitivity

2 years agoAuto merge of #91318 - eggyal:reduce-boilerplate-around-infallible-folders, r=jackh726
bors [Thu, 2 Dec 2021 19:12:00 +0000 (19:12 +0000)]
Auto merge of #91318 - eggyal:reduce-boilerplate-around-infallible-folders, r=jackh726

Reduce boilerplate around infallible folders

Further to https://github.com/rust-lang/rust/pull/91230#issuecomment-981059666

r? `@jackh726`

2 years agoDocument how `last_os_error` should be used
Chris Denton [Thu, 2 Dec 2021 17:51:44 +0000 (17:51 +0000)]
Document how `last_os_error` should be used

2 years agoChange to check-pass
Jack Huey [Thu, 2 Dec 2021 17:11:31 +0000 (12:11 -0500)]
Change to check-pass

2 years agoAdd additional test from rust issue number 91068
Frank Steffahn [Thu, 2 Dec 2021 16:46:57 +0000 (17:46 +0100)]
Add additional test from rust issue number 91068

2 years agoRename TypeFolderFallible to FallibleTypeFolder
Alan Egerton [Wed, 1 Dec 2021 15:11:24 +0000 (15:11 +0000)]
Rename TypeFolderFallible to FallibleTypeFolder

2 years agoUpdate compiler/rustc_middle/src/ty/fold.rs
eggyal [Wed, 1 Dec 2021 12:48:49 +0000 (12:48 +0000)]
Update compiler/rustc_middle/src/ty/fold.rs

Co-authored-by: lcnr <rust@lcnr.de>
2 years agoReduce boilerplate around infallible folders
Alan Egerton [Wed, 1 Dec 2021 00:55:57 +0000 (00:55 +0000)]
Reduce boilerplate around infallible folders

2 years agoRemove no-longer used `IdFunctor::map_id`
Alan Egerton [Sun, 28 Nov 2021 15:07:25 +0000 (15:07 +0000)]
Remove no-longer used `IdFunctor::map_id`

2 years agoAuto merge of #91455 - matthiaskrgr:rollup-gix2hy6, r=matthiaskrgr
bors [Thu, 2 Dec 2021 14:53:20 +0000 (14:53 +0000)]
Auto merge of #91455 - matthiaskrgr:rollup-gix2hy6, r=matthiaskrgr

Rollup of 4 iffy pull requests

Successful merges:

 - #89234 (Disallow non-c-like but "fieldless" ADTs from being casted to integer if they use arbitrary enum discriminant)
 - #91045 (Issue 90702 fix: Stop treating some crate loading failures as fatal errors)
 - #91394 (Bump stage0 compiler)
 - #91411 (Enable svh tests on msvc)

Failed merges:

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

2 years agoRollup merge of #91411 - ChrisDenton:valid-paths, r=petrochenkov
Matthias Krüger [Thu, 2 Dec 2021 14:52:04 +0000 (15:52 +0100)]
Rollup merge of #91411 - ChrisDenton:valid-paths, r=petrochenkov

Enable svh tests on msvc

These tests were ignored for msvc in #30778 because of additional notes that were being added for some reason. I'm fairly confident this has been fixed in the intervening years so lets try re-enabling these tests.

Fixes #31306

2 years agoRollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbini
Matthias Krüger [Thu, 2 Dec 2021 14:52:03 +0000 (15:52 +0100)]
Rollup merge of #91394 - Mark-Simulacrum:bump-stage0, r=pietroalbini

Bump stage0 compiler

r? `@pietroalbini` (or anyone else)

2 years agoRollup merge of #91045 - mjptree:issue-90702-fix, r=petrochenkov
Matthias Krüger [Thu, 2 Dec 2021 14:52:01 +0000 (15:52 +0100)]
Rollup merge of #91045 - mjptree:issue-90702-fix, r=petrochenkov

Issue 90702 fix: Stop treating some crate loading failures as fatal errors

Surface mulitple `extern crate` resolution errors at a time.

This is achieved by creating a dummy crate, instead of aborting directly after the resolution error. The `ExternCrateError` has been added to allow propagating the resolution error from `rustc_metadata` crate to the `rustc_resolve` with a minimal public surface. The `import_extern_crate` function is a block that was factored out from `build_reduced_graph_for_item` for better organization. The only added functionality made to it where the added error handling in the `process_extern_crate` call. The remaining bits in this function are the same as before.

Resolves #90702

r? `@petrochenkov`

2 years agoRollup merge of #89234 - nbdd0121:discr, r=jackh726
Matthias Krüger [Thu, 2 Dec 2021 14:52:00 +0000 (15:52 +0100)]
Rollup merge of #89234 - nbdd0121:discr, r=jackh726

Disallow non-c-like but "fieldless" ADTs from being casted to integer if they use arbitrary enum discriminant

Code like

```rust
#[repr(u8)]
enum Enum {
    Foo /* = 0 */,
    Bar(),
    Baz{}
}

let x = Enum::Bar() as u8;
```

seems to be unintentionally allowed so we couldn't disallow them now ~~, but we could disallow them if arbitrary enum discriminant is used before 1.56 hits stable~~ (stabilization was reverted).

Related: #88621

`@rustbot` label +T-lang

2 years agoAuto merge of #91354 - fee1-dead:const_env, r=spastorino
bors [Thu, 2 Dec 2021 11:48:58 +0000 (11:48 +0000)]
Auto merge of #91354 - fee1-dead:const_env, r=spastorino

Cleanup: Eliminate ConstnessAnd

This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature.

We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`.

This is a continuation of https://github.com/rust-lang/rust/pull/90274.

r? `@oli-obk`

cc `@spastorino` `@ecstatic-morse`

2 years agoAdd test for legacy-const-generic arguments
Guillaume Gomez [Sat, 16 Oct 2021 15:52:24 +0000 (17:52 +0200)]
Add test for legacy-const-generic arguments

2 years agoTransform const generics if the function uses rustc_legacy_const_generics
Guillaume Gomez [Sat, 16 Oct 2021 15:52:06 +0000 (17:52 +0200)]
Transform const generics if the function uses rustc_legacy_const_generics

2 years agoAuto merge of #91291 - GuillaumeGomez:const-deref-method, r=camelid
bors [Thu, 2 Dec 2021 06:11:05 +0000 (06:11 +0000)]
Auto merge of #91291 - GuillaumeGomez:const-deref-method, r=camelid

Fix const deref methods display

Fixes https://github.com/rust-lang/rust/issues/90855 (more information in the issue).

r? `@camelid`

2 years agodisable tests in Miri that take too long
Ralf Jung [Thu, 2 Dec 2021 03:48:59 +0000 (22:48 -0500)]
disable tests in Miri that take too long

2 years agoAuto merge of #91003 - psumbera:sparc64-abi, r=nagisa
bors [Thu, 2 Dec 2021 02:59:44 +0000 (02:59 +0000)]
Auto merge of #91003 - psumbera:sparc64-abi, r=nagisa

fix sparc64 ABI for aggregates with floating point members

Fixes #86163

2 years agoAuto merge of #90446 - cjgillot:late-elided, r=jackh726
bors [Wed, 1 Dec 2021 23:22:43 +0000 (23:22 +0000)]
Auto merge of #90446 - cjgillot:late-elided, r=jackh726

Lint elided lifetimes in path during lifetime resolution.

The lifetime elision lint is known to be brittle and can be redundant with later lifetime resolution errors. This PR aims to remove the redundancy by performing the lint after lifetime resolution.

This PR proposes to carry the information that an elision should be linted against by using a special `LifetimeName`. I am not certain this is the best solution, but it is certainly the easiest.

Fixes https://github.com/rust-lang/rust/issues/60199
Fixes https://github.com/rust-lang/rust/issues/55768
Fixes https://github.com/rust-lang/rust/issues/63110
Fixes https://github.com/rust-lang/rust/issues/71957

2 years agoImprove suggestion for extern crate self error message
Michael [Fri, 26 Nov 2021 21:39:44 +0000 (21:39 +0000)]
Improve suggestion for extern crate self error message

2 years agoImprove diagnostic for missing half of binary operator in `if` condition
Fabian Wolff [Wed, 1 Dec 2021 21:36:50 +0000 (22:36 +0100)]
Improve diagnostic for missing half of binary operator in `if` condition

2 years agoStop treating extern crate loading failures as fatal errors
Michael [Fri, 26 Nov 2021 20:37:56 +0000 (20:37 +0000)]
Stop treating extern crate loading failures as fatal errors

2 years agoFactor out build reduced graph for extern crate
Michael [Fri, 26 Nov 2021 19:18:51 +0000 (19:18 +0000)]
Factor out build reduced graph for extern crate

2 years agoAuto merge of #91433 - matthiaskrgr:rollup-118ql06, r=matthiaskrgr
bors [Wed, 1 Dec 2021 20:14:07 +0000 (20:14 +0000)]
Auto merge of #91433 - matthiaskrgr:rollup-118ql06, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #88502 (Add slice take methods)
 - #91313 (expand: Turn `ast::Crate` into a first class expansion target)
 - #91424 (Update LLVM with patches for better llvm-cov diagnostics)
 - #91425 (Include lint errors in error count for `-Ztreat-err-as-bug`)
 - #91430 (Add tests for `normalize-docs` overflow errors)

Failed merges:

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

2 years agoDisallow non-c-like but "fieldless" ADTs from being casted to integer...
Gary Guo [Fri, 24 Sep 2021 20:58:25 +0000 (21:58 +0100)]
Disallow non-c-like but "fieldless" ADTs from being casted to integer...

... if they use arbitrary enum discriminant. Code like

```rust
enum Enum {
    Foo = 1,
    Bar(),
    Baz{}
}
```

seems to be unintentionally allowed so we couldn't disallow them now,
but we could disallow them if arbitrary enum discriminant is used before
1.56 hits stable.

2 years agoRollup merge of #91430 - jyn514:normalize-fallible, r=jackh726
Matthias Krüger [Wed, 1 Dec 2021 19:57:48 +0000 (20:57 +0100)]
Rollup merge of #91430 - jyn514:normalize-fallible, r=jackh726

Add tests for `normalize-docs` overflow errors

`@b-naber` do you understand why using `try_normalize_erasing_regions` doesn't silence these cycle errors? Rustdoc isn't emitting them, rustc is aborting before returning an error, even though the function has `try_` in the name.

cc https://github.com/rust-lang/rust/issues/82692, https://github.com/rust-lang/rust/pull/91255

2 years agoRollup merge of #91425 - jyn514:treat-lint-err-as-bug, r=oli-obk
Matthias Krüger [Wed, 1 Dec 2021 19:57:47 +0000 (20:57 +0100)]
Rollup merge of #91425 - jyn514:treat-lint-err-as-bug, r=oli-obk

Include lint errors in error count for `-Ztreat-err-as-bug`

This was a regression from https://github.com/rust-lang/rust/pull/87337;
the `panic_if_treat_err_as_bug` function only checked the number of hard
errors, not the number of lint errors.

r? `@oli-obk`

2 years agoRollup merge of #91424 - richkadel:llvm-patch-instrproferror, r=tmandry
Matthias Krüger [Wed, 1 Dec 2021 19:57:46 +0000 (20:57 +0100)]
Rollup merge of #91424 - richkadel:llvm-patch-instrproferror, r=tmandry

Update LLVM with patches for better llvm-cov diagnostics

Cherry-picks
https://github.com/llvm/llvm-project/commit/ee88b8d63e475a75ae525563edfa95f6fcaac83a
and
https://github.com/llvm/llvm-project/commit/126e7611c70ca41782aa851c2bec132607eb8127

These patches to LLVM were added to help debug occasional errors that
cause coverage reporting to fail. Prior to this patch, the only messaging
was that the coverage data was malformed. Hopefully the improved
messaging will help identify the root cause of these errors, when they
arise, so we can make corrections to coverage output from Rust.

r? `@tmandry`

2 years agoRollup merge of #91313 - petrochenkov:cratexp, r=Aaron1011
Matthias Krüger [Wed, 1 Dec 2021 19:57:43 +0000 (20:57 +0100)]
Rollup merge of #91313 - petrochenkov:cratexp, r=Aaron1011

expand: Turn `ast::Crate` into a first class expansion target

And stop creating a fake `mod` item for the crate root when expanding a crate, thus addressing FIXMEs left in https://github.com/rust-lang/rust/pull/82238, and making a step towards a proper support for crate-level macro attributes (cc #54726).

I haven't added token collection support for the whole crate in this PR, maybe later.
r? `@Aaron1011`

2 years agoRollup merge of #88502 - ibraheemdev:slice-take, r=dtolnay
Matthias Krüger [Wed, 1 Dec 2021 19:57:42 +0000 (20:57 +0100)]
Rollup merge of #88502 - ibraheemdev:slice-take, r=dtolnay

Add slice take methods

Revival of #62282

This PR adds the following slice methods:

- `take`
- `take_mut`
- `take_first`
- `take_first_mut`
- `take_last`
- `take_last_mut`

r? `@LukasKalbertodt`

2 years agoUse `try_normalize_erasing_regions` instead of a custom infer context
Joshua Nelson [Wed, 1 Dec 2021 19:00:27 +0000 (19:00 +0000)]
Use `try_normalize_erasing_regions` instead of a custom infer context

This unfortunately is still giving an unsilenceable overflow error :(

2 years agoAdd regression test for #90770
Dylan MacKenzie [Wed, 1 Dec 2021 18:04:21 +0000 (10:04 -0800)]
Add regression test for #90770

2 years agoAuto merge of #91275 - camelid:deny-test-warnings, r=jyn514
bors [Wed, 1 Dec 2021 16:41:52 +0000 (16:41 +0000)]
Auto merge of #91275 - camelid:deny-test-warnings, r=jyn514

Deny warnings in rustdoc non-UI tests

These warnings were silently ignored since they did not appear in a
`.stderr` file and did not fail the test. With this change, warnings in
tests are denied, causing the tests to fail if they have warnings.

This change has already led me to find a bug in rustdoc (#91274) and a
useless test (`src/test/rustdoc/primitive/primitive-generic-impl.rs`,
though its uselessness is unrelated to its warnings).

r? `@jyn514`

2 years agoInclude lint errors in error count for `-Ztreat-err-as-bug`
Joshua Nelson [Wed, 1 Dec 2021 16:32:55 +0000 (16:32 +0000)]
Include lint errors in error count for `-Ztreat-err-as-bug`

This was a regression from https://github.com/rust-lang/rust/pull/87337;
the `panic_if_treat_err_as_bug` function only checked the number of hard
errors, not the number of lint errors.

2 years agoUpdate LLVM with patches for better llvm-cov diagnostics
Rich Kadel [Tue, 30 Nov 2021 23:40:55 +0000 (15:40 -0800)]
Update LLVM with patches for better llvm-cov diagnostics

Cherry-picks
https://github.com/llvm/llvm-project/commit/ee88b8d63e475a75ae525563edfa95f6fcaac83a
and
https://github.com/llvm/llvm-project/commit/126e7611c70ca41782aa851c2bec132607eb8127

These patches to LLVM were added to help debug occasional errors that
cause coverage reporting to fail. Prior to this patch, the only messaging
was that the coverage data was malformed. Hopefully the improved
messaging will help identify the root cause of these errors, when they
arise, so we can make corrections to coverage output from Rust.

2 years agoFormat
Deadbeef [Wed, 1 Dec 2021 15:33:37 +0000 (23:33 +0800)]
Format

2 years agoTODO => FIXME
Deadbeef [Wed, 1 Dec 2021 15:32:36 +0000 (23:32 +0800)]
TODO => FIXME

2 years agoCache with consistent env and bound
Deadbeef [Wed, 1 Dec 2021 15:22:42 +0000 (23:22 +0800)]
Cache with consistent env and bound

2 years agoAuto merge of #91255 - b-naber:normalization-ice, r=jackh276
bors [Wed, 1 Dec 2021 13:33:33 +0000 (13:33 +0000)]
Auto merge of #91255 - b-naber:normalization-ice, r=jackh276

Implement version of normalize_erasing_regions that allows for normalization failure

Fixes https://github.com/rust-lang/rust/issues/59324
Fixes https://github.com/rust-lang/rust/issues/67684
Fixes https://github.com/rust-lang/rust/issues/69398
Fixes https://github.com/rust-lang/rust/issues/71113
Fixes https://github.com/rust-lang/rust/issues/82079
Fixes #85103
Fixes https://github.com/rust-lang/rust/issues/88856
Fixes #91231
Fixes https://github.com/rust-lang/rust/issues/91234

Previously we called `normalize_erasing_regions` inside `layout_of`. `normalize_erasing_regions` assumes that the normalization succeeds. Since some `layout_of` calls happen before typecheck has finished, we introduce a new variant that allows for returning an error.

2 years agorebase
b-naber [Wed, 1 Dec 2021 12:14:19 +0000 (13:14 +0100)]
rebase

2 years agoaddress review
b-naber [Tue, 30 Nov 2021 23:20:57 +0000 (00:20 +0100)]
address review

2 years agofix query description
b-naber [Fri, 26 Nov 2021 22:41:22 +0000 (23:41 +0100)]
fix query description

2 years agoremove static_assert_size on InterpError
b-naber [Fri, 26 Nov 2021 22:39:48 +0000 (23:39 +0100)]
remove static_assert_size on InterpError

2 years agomore fixed issues
b-naber [Fri, 26 Nov 2021 22:37:24 +0000 (23:37 +0100)]
more fixed issues

2 years agoadd tests and bless existing ones
b-naber [Fri, 26 Nov 2021 17:37:29 +0000 (18:37 +0100)]
add tests and bless existing ones

2 years agoimplement version of normalize_erasing_regions that doesn't assume value is normalizable
b-naber [Fri, 26 Nov 2021 16:41:22 +0000 (17:41 +0100)]
implement version of normalize_erasing_regions that doesn't assume value is normalizable

2 years agoAuto merge of #91418 - matthiaskrgr:rollup-vn9f9w3, r=matthiaskrgr
bors [Wed, 1 Dec 2021 09:51:00 +0000 (09:51 +0000)]
Auto merge of #91418 - matthiaskrgr:rollup-vn9f9w3, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #87160 (When recovering from a `:` in a pattern, use adequate AST pattern)
 - #90985 (Use `get_diagnostic_name` more)
 - #91087 (Remove all migrate.nll.stderr files)
 - #91207 (Add support for LLVM coverage mapping format versions 5 and 6)
 - #91298 (Improve error message for `E0659` if the source is not available)
 - #91346 (Add `Option::inspect` and `Result::{inspect, inspect_err}`)
 - #91404 (Fix bad `NodeId` limit checking.)

Failed merges:

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

2 years agoRollup merge of #91404 - nnethercote:fix-bad-NodeId-limit-checking, r=dtolnay
Matthias Krüger [Wed, 1 Dec 2021 09:50:23 +0000 (10:50 +0100)]
Rollup merge of #91404 - nnethercote:fix-bad-NodeId-limit-checking, r=dtolnay

Fix bad `NodeId` limit checking.

`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!

This commit removes the conversion to/from `usize`.

2 years agoRollup merge of #91346 - ibraheemdev:result-inspect, r=dtolnay
Matthias Krüger [Wed, 1 Dec 2021 09:50:22 +0000 (10:50 +0100)]
Rollup merge of #91346 - ibraheemdev:result-inspect, r=dtolnay

Add `Option::inspect` and `Result::{inspect, inspect_err}`

```rust
// core::result

impl Result<T, E> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
    pub fn inspect_err<F: FnOnce(&E)>(self, f: F) -> Self;
}

// core::option

impl Option<T> {
    pub fn inspect<F: FnOnce(&T)>(self, f: F) -> Self;
}
```

2 years agoRollup merge of #91298 - FabianWolff:issue-91028-source-avail, r=cjgillot
Matthias Krüger [Wed, 1 Dec 2021 09:50:21 +0000 (10:50 +0100)]
Rollup merge of #91298 - FabianWolff:issue-91028-source-avail, r=cjgillot

Improve error message for `E0659` if the source is not available

Fixes #91028. The fix is similar to those in #89233 and #87088. With this change, instead of the dangling
```
note: `Option` could also refer to the enum defined here
```
I get
```
note: `Option` could also refer to an enum from prelude
```
If the standard library source code _is_ available, the output does not change.

2 years agoRollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry
Matthias Krüger [Wed, 1 Dec 2021 09:50:20 +0000 (10:50 +0100)]
Rollup merge of #91207 - richkadel:rk-bump-coverage-version, r=tmandry

Add support for LLVM coverage mapping format versions 5 and 6

This PR cherry-pick's Swatinem's initial commit in unsubmitted PR #90047.

My additional commit augments Swatinem's great starting point, but adds full support for LLVM
Coverage Mapping Format version 6, conditionally, if compiling with LLVM 13.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`

2 years agoRollup merge of #91087 - rukai:fix_test_nll_revisions, r=jackh726
Matthias Krüger [Wed, 1 Dec 2021 09:50:19 +0000 (10:50 +0100)]
Rollup merge of #91087 - rukai:fix_test_nll_revisions, r=jackh726

Remove all migrate.nll.stderr files

There are a few ui tests that setup the revisions like:
```rust
// revisions: migrate nll`
// [nll]compile-flags: -Zborrowck=mir
```

However most of them fail to disable the nll compare mode like this:
```rust
// ignore-compare-mode-nll
```

This ends up generating confusing files ending in `.migrate.nll.stderr` because the nll compare mode is run on top of the migrate revision.

This PR fixes this by adding `ignore-compare-mode-nll` to these tests.

I would have just made these tests use compare modes instead but I assume the reason these tests are messing around with revisions instead of just letting the nll compare mode do its thing is to enforce error annotations for both migrate and nll.
Relying on just compare modes would only have the error annotations for migrate.

2 years agoRollup merge of #90985 - camsteffen:diag-name-usage, r=jackh726
Matthias Krüger [Wed, 1 Dec 2021 09:50:18 +0000 (10:50 +0100)]
Rollup merge of #90985 - camsteffen:diag-name-usage, r=jackh726

Use `get_diagnostic_name` more

2 years agoRollup merge of #87160 - estebank:colon-recovery, r=nagisa
Matthias Krüger [Wed, 1 Dec 2021 09:50:18 +0000 (10:50 +0100)]
Rollup merge of #87160 - estebank:colon-recovery, r=nagisa

When recovering from a `:` in a pattern, use adequate AST pattern

If the suggestion to use `::` instead of `:` in the pattern isn't correct, a second resolution error will be emitted.

2 years agofix sparc64 ABI for aggregates with floating point members
Petr Sumbera [Wed, 1 Dec 2021 09:03:45 +0000 (10:03 +0100)]
fix sparc64 ABI for aggregates with floating point members

2 years agoAuto merge of #91324 - eggyal:avoid-uneccesary-clone-of-annotatable, r=Aaron1011
bors [Wed, 1 Dec 2021 06:18:39 +0000 (06:18 +0000)]
Auto merge of #91324 - eggyal:avoid-uneccesary-clone-of-annotatable, r=Aaron1011

Avoid uneccessary clone of Annotatable

Addresses FIXME comment created in #82608

r? `@Aaron1011`

2 years agoFix bad `NodeId` limit checking.
Nicholas Nethercote [Tue, 30 Nov 2021 20:22:29 +0000 (07:22 +1100)]
Fix bad `NodeId` limit checking.

`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!

This commit removes the conversion to/from `usize`.

2 years agoUpdate MIR opt tests with new name
Dylan MacKenzie [Wed, 1 Dec 2021 02:54:37 +0000 (18:54 -0800)]
Update MIR opt tests with new name

2 years agoAuto merge of #91406 - matthiaskrgr:rollup-a2whn8m, r=matthiaskrgr
bors [Wed, 1 Dec 2021 02:51:15 +0000 (02:51 +0000)]
Auto merge of #91406 - matthiaskrgr:rollup-a2whn8m, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #91294 (Visit type in process_projection_elem.)
 - #91340 (Bump compiler_builtins to 0.1.55 to bring in fixes for targets lackin…)
 - #91366 (Only show notable traits if both types are the same)
 - #91397 (Emit a warning on generic parameters with doc comments)

Failed merges:

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

2 years agoEnable svh tests on msvc
Chris Denton [Wed, 1 Dec 2021 02:05:17 +0000 (02:05 +0000)]
Enable svh tests on msvc

2 years agoMove post-elaboration const-checking earlier in the pipeline
Dylan MacKenzie [Wed, 1 Dec 2021 01:05:40 +0000 (17:05 -0800)]
Move post-elaboration const-checking earlier in the pipeline

Instead we run `RemoveFalseEdges` and `RemoveUninitDrops` at the
appropriate time. The extra `SimplifyCfg` avoids visiting unreachable
blocks during `RemoveUninitDrops`.

2 years agoHandle `DropAndReplace` in const-checking
Dylan MacKenzie [Tue, 30 Nov 2021 23:45:16 +0000 (15:45 -0800)]
Handle `DropAndReplace` in const-checking

It runs before the real drop elaboration pass.

2 years agoAdd rationale for `RemoveUnneededDrops`
Dylan MacKenzie [Tue, 30 Nov 2021 23:03:43 +0000 (15:03 -0800)]
Add rationale for `RemoveUnneededDrops`

...since its name is very close to `RemoveUninitDrops`.

2 years agoAdd `RemoveUninitDrops` MIR pass
Dylan MacKenzie [Tue, 30 Nov 2021 23:04:49 +0000 (15:04 -0800)]
Add `RemoveUninitDrops` MIR pass

2 years agoAdd "is" methods for projections to a given index
Dylan MacKenzie [Tue, 30 Nov 2021 22:56:26 +0000 (14:56 -0800)]
Add "is" methods for projections to a given index

2 years agoSeparate `RemoveFalseEdges` from `SimplifyBranches`
Dylan MacKenzie [Tue, 30 Nov 2021 18:14:50 +0000 (10:14 -0800)]
Separate `RemoveFalseEdges` from `SimplifyBranches`

Otherwise dataflow state will propagate along false edges and cause
things to be marked as maybe init unnecessarily. These should be
separate, since `SimplifyBranches` also makes `if true {} else {}` into
a `goto`, which means we wouldn't lint anything in the `else` block.

2 years agoRollup merge of #91397 - jyn514:generic-param-docs, r=wesleywiser
Matthias Krüger [Tue, 30 Nov 2021 22:43:33 +0000 (23:43 +0100)]
Rollup merge of #91397 - jyn514:generic-param-docs, r=wesleywiser

Emit a warning on generic parameters with doc comments

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

2 years agoRollup merge of #91366 - notriddle:notriddle/only-show-notable-if-types-are-the-same...
Matthias Krüger [Tue, 30 Nov 2021 22:43:32 +0000 (23:43 +0100)]
Rollup merge of #91366 - notriddle:notriddle/only-show-notable-if-types-are-the-same, r=GuillaumeGomez

Only show notable traits if both types are the same

Checking only their DefId doesn't work because all slices have the same
fake DefId.

Fixes #91347

2 years agoRollup merge of #91340 - cr1901:no-atomic, r=Mark-Simulacrum
Matthias Krüger [Tue, 30 Nov 2021 22:43:31 +0000 (23:43 +0100)]
Rollup merge of #91340 - cr1901:no-atomic, r=Mark-Simulacrum

Bump compiler_builtins to 0.1.55 to bring in fixes for targets lackin…

…g atomic support.

This fixes a "Cannot select" LLVM error when compiling `compiler_builtins` for targets lacking atomics, like MSP430. Se https://github.com/rust-lang/compiler-builtins/issues/441 for more info. This PR is a more general version of #91248.

2 years agoRollup merge of #91294 - cjgillot:process-elem, r=jackh726
Matthias Krüger [Tue, 30 Nov 2021 22:43:31 +0000 (23:43 +0100)]
Rollup merge of #91294 - cjgillot:process-elem, r=jackh726

Visit type in process_projection_elem.

Instead of reimplementing it for each visitor.

2 years agoMerge Implicit and ImplicitMissing.
Camille GILLOT [Fri, 26 Nov 2021 22:07:21 +0000 (23:07 +0100)]
Merge Implicit and ImplicitMissing.

2 years agoHandle `allow(elided_lifetimes_in_paths)`.
Camille GILLOT [Sun, 31 Oct 2021 17:39:39 +0000 (18:39 +0100)]
Handle `allow(elided_lifetimes_in_paths)`.

2 years agoComplete test.
Camille GILLOT [Sun, 31 Oct 2021 17:24:55 +0000 (18:24 +0100)]
Complete test.

2 years agoSimplify lowering.
Camille GILLOT [Sun, 31 Oct 2021 16:54:47 +0000 (17:54 +0100)]
Simplify lowering.

2 years agoLint elided lifetimes in path during lifetime resolution.
Camille GILLOT [Sun, 11 Jul 2021 13:04:57 +0000 (15:04 +0200)]
Lint elided lifetimes in path during lifetime resolution.

2 years agoFlatten match.
Camille GILLOT [Sun, 31 Oct 2021 16:21:32 +0000 (17:21 +0100)]
Flatten match.

2 years agoMove report_elision_failure in diagnostics.rs.
Camille GILLOT [Sun, 31 Oct 2021 16:11:28 +0000 (17:11 +0100)]
Move report_elision_failure in diagnostics.rs.

2 years agoAdd conditional support for coverage map version 6
Rich Kadel [Thu, 25 Nov 2021 00:58:49 +0000 (16:58 -0800)]
Add conditional support for coverage map version 6

This commit augments Swatinem's initial commit in uncommitted PR #90047,
which was a great starting point, but did not fully support LLVM
Coverage Mapping Format version 6.

Version 6 requires adding the compilation directory when file paths are
relative, and since Rustc coverage maps use relative paths, we should
add the expected compilation directory entry.

Note, however, that with the compilation directory, coverage reports
from `llvm-cov show` can now report file names (when the report includes
more than one file) with the full absolute path to the file.

This would be a problem for test results, but the workaround (for the
rust coverage tests) is to include an additional `llvm-cov show`
parameter: `--compilation-dir=.`

2 years agoReturn ConstStability instead of &ConstStability in Item::const_stability
Guillaume Gomez [Mon, 29 Nov 2021 09:24:51 +0000 (10:24 +0100)]
Return ConstStability instead of &ConstStability in Item::const_stability

2 years agoImprove code by replacing &str with Symbol in render_stability_since_raw
Guillaume Gomez [Mon, 29 Nov 2021 09:20:11 +0000 (10:20 +0100)]
Improve code by replacing &str with Symbol in render_stability_since_raw

2 years agoAdd test for const deref methods display
Guillaume Gomez [Sat, 27 Nov 2021 13:38:15 +0000 (14:38 +0100)]
Add test for const deref methods display

2 years agoFix display for "const" deref methods in rustdoc
Guillaume Gomez [Sat, 27 Nov 2021 13:37:30 +0000 (14:37 +0100)]
Fix display for "const" deref methods in rustdoc

2 years agoUpdate src/librustdoc/clean/types.rs
Michael Howell [Tue, 30 Nov 2021 21:22:15 +0000 (14:22 -0700)]
Update src/librustdoc/clean/types.rs

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>