Commit Graph

216655 Commits

Author SHA1 Message Date
est31
580cc89e9c rustc_session: remove huge error imports 2023-02-05 04:01:20 +01:00
est31
394fa192a9 rustc_parse: remove huge error imports 2023-02-05 03:48:17 +01:00
est31
b4a20abc48 rustc_interface: remove huge error imports 2023-02-05 03:48:08 +01:00
est31
a399f0ca84 rustc_passes: remove huge error imports 2023-02-05 03:47:58 +01:00
est31
3478b162f3 rustc_const_eval: remove huge error imports 2023-02-05 03:47:48 +01:00
est31
4442f13b03 rustc_metadata: remove huge error imports 2023-02-05 03:47:38 +01:00
est31
60e82aef64 rustc_expand: remove huge error imports 2023-02-05 03:47:22 +01:00
Camille GILLOT
5c1cb5bbc6 Turn projections into copies in CopyProp. 2023-02-04 23:33:33 +00:00
Lenko Donchev
d9f60052d2 Recover from default value for a lifetime in generic parameters. 2023-02-04 17:04:09 -06:00
bors
50d3ba5bcb Auto merge of #107672 - matthiaskrgr:rollup-7e6dbuk, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #107116 (consolidate bootstrap docs)
 - #107646 (Provide structured suggestion for binding needing type on E0594)
 - #107661 (Remove Esteban from review queues for a while)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-04 21:07:10 +00:00
Matthias Krüger
47fc625a92
Rollup merge of #107661 - oli-obk:breathing_room, r=oli-obk
Remove Esteban from review queues for a while

r? `@estebank`
2023-02-04 20:29:07 +01:00
Matthias Krüger
d381eca5dc
Rollup merge of #107646 - estebank:specific-span, r=compiler-errors
Provide structured suggestion for binding needing type on E0594

Partially address #45405.
2023-02-04 20:29:06 +01:00
Matthias Krüger
3666fa0800
Rollup merge of #107116 - ozkanonur:consolidate-bootstrap-docs, r=jyn514
consolidate bootstrap docs

With this diff, I tried to consolidate bootstrap documentations and remove the duplicated informations.

Coupled with https://github.com/rust-lang/rustc-dev-guide/pull/1563

Resolves #90686

Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-02-04 20:29:06 +01:00
bors
3de7d7fb22 Auto merge of #107549 - Zoxc:rustc-shared, r=jyn514
Move code in `rustc_driver` out to a new `rustc_driver_impl` crate to allow pipelining

That adds a `rustc_shared` library which contains all the rustc library crates in a single dylib. It takes over this role from `rustc_driver`. This is done so that `rustc_driver` can be compiled in parallel with other crates. `rustc_shared` is intentionally left empty so it only does linking.

An alternative could be to move the code currently in `rustc_driver` into a new crate to avoid changing the name of the distributed library.
2023-02-04 18:11:02 +00:00
Roland Strasser
71a147df1f rustdoc: trait bound formatting
rustdoc: fix item-spacer

rustdoc: use proper comment style

rustdoc: change formatting where clauses for traits

rustdoc: remove semicolon from provided methods

update provided methods formatting
2023-02-04 19:10:04 +01:00
CastilloDel
cf0279991d Fix suggestions rendering when the span is multiline 2023-02-04 19:04:04 +01:00
ozkanonur
6558326e7b consolidate bootstrap docs
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-02-04 20:16:57 +03:00
Michael Howell
b1c4911b2a rustdoc: combine duplicate rules in ayu CSS 2023-02-04 10:14:51 -07:00
Camille GILLOT
635ff8e2a8 Support parallel compiler. 2023-02-04 15:56:50 +00:00
Camille GILLOT
128f2224af Remove OnHit callback from query caches.
This is not useful now that query results are `Copy`.
2023-02-04 15:21:21 +00:00
bors
9dee4e4c42 Auto merge of #107267 - cjgillot:keep-aggregate, r=oli-obk
Do not deaggregate MIR

This turns out to simplify a lot of things.
I haven't checked the consequences for miri yet.

cc `@JakobDegen`
r? `@oli-obk`
2023-02-04 15:17:32 +00:00
Matthias Krüger
ed58c01959 don't point at nonexisting code beyond EOF when warning about unused delims
Previously we would show this:
```
warning: unnecessary braces around block return value
 --> /tmp/bad.rs:1:8
  |
1 | fn a(){{{
  |        ^  ^
  |
  = note: `#[warn(unused_braces)]` on by default
help: remove these braces
  |
1 - fn a(){{{
1 + fn a(){{
  |
```

which is now hidden in this case.
We would create a span spanning between the pair of redundant {}s but there is only EOF instead of the `}` so we would previously point at nothing.
This would cause the debug assertion ice to trigger.
I would have loved to just only point at the second delim and say "you can remove that" but I'm not sure how to do that without refactoring the entire diagnostic which seems tricky. :(
But given that this does not seem to regress any other tests we have, I think this edge-casey enough be acceptable.

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

r? @compiler-errors
2023-02-04 13:36:14 +01:00
Oli Scherer
d78fb1a015 Remove Esteban from review queues for a while 2023-02-04 11:48:50 +00:00
bors
4aa6afa7f8 Auto merge of #107618 - chriswailes:linker-arg, r=albertlarsan68
Add a linker argument back to boostrap.py

In https://github.com/rust-lang/rust/pull/101783 I accidentally removed a load-bearing linker argument.  This PR adds it back in.

r? jyn514
2023-02-04 11:22:31 +00:00
bors
91eb6f9acf Auto merge of #107591 - krasimirgg:llvm-17-pgoopts, r=cuviper
llvm-wrapper: adapt for LLVM API changes

Adapts the wrapper for 516e301752, where the constructor of PGOOptions gained a new FileSystem argument. Adapted to use the real file system, similarly to the changes inside of LLVM:
516e301752 (diff-f409934ba27ad86494f3012324e9a3995b56e0743609ded7a387ba62bbf5edb0R236)

Found via our experimental Rust + LLVM at HEAD bot: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/16853#01860e2e-5eba-4f07-8359-0325913ff410/219-517
2023-02-04 03:41:57 +00:00
Jon Gjengset
50e2509a6c Bump rust-installer
Makes generation of `manifest.in` deterministic:
https://github.com/rust-lang/rust-installer/pull/120
2023-02-03 17:59:49 -08:00
Esteban Küber
e6c56cda09 review comments 2023-02-03 23:41:39 +00:00
bors
886b2c3e00 Auto merge of #107650 - compiler-errors:rollup-4pntchf, r=compiler-errors
Rollup of 8 pull requests

Successful merges:

 - #106887 (Make const/fn return params more suggestable)
 - #107519 (Add type alias for raw OS errors)
 - #107551 ( Replace `ConstFnMutClosure` with const closures )
 - #107595 (Retry opening proc-macro DLLs a few times on Windows.)
 - #107615 (Replace nbsp in all rustdoc code blocks)
 - #107621 (Intern external constraints in new solver)
 - #107631 (loudly tell people when they change `Cargo.lock`)
 - #107632 (Clarifying that .map() returns None if None.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-03 22:37:53 +00:00
Michael Goulet
13bd75f425
Rollup merge of #107632 - ameknite:issue-107622-fix, r=jyn514
Clarifying that .map() returns None if None.

Fix #107622
2023-02-03 14:15:24 -08:00
Michael Goulet
ef520bd82a
Rollup merge of #107631 - BoxyUwU:triagebot_cargo_lock, r=compiler-errors
loudly tell people when they change `Cargo.lock`

It keeps happening that people accidentally commit changes to `Cargo.lock` and then have to be told by a reviewer to undo this. I've also seen cases where PRs are merged that accidentally changed `Cargo.lock` during a rebase.. I figure that purposeful changes to `Cargo.lock` are likely rarer than these accidental ones?
2023-02-03 14:15:24 -08:00
Michael Goulet
72599c69b5
Rollup merge of #107621 - compiler-errors:intern-external-constraints, r=lcnr
Intern external constraints in new solver

Makes the query response `Copy`, fixing a few FIXMEs.
2023-02-03 14:15:23 -08:00
Michael Goulet
f7210b3bed
Rollup merge of #107615 - notriddle:notriddle/nbsp, r=GuillaumeGomez
Replace nbsp in all rustdoc code blocks

Based on #106125 by `@dtolnay` — this PR fixes the line wrapping bug.

Fixes #106098. This makes code copyable from rustdoc rendered documentation into a Rust source file.
2023-02-03 14:15:23 -08:00
Michael Goulet
1594b58ce7
Rollup merge of #107595 - michaelwoerister:retry_proc_macro_loading, r=petrochenkov
Retry opening proc-macro DLLs a few times on Windows.

On Windows, the compiler [sometimes](https://users.rust-lang.org/t/error-loadlibraryexw-failed/77603) fails with the message `error: LoadLibraryExW failed` when trying to load a proc-macro crate. The error seems to occur intermittently, similar to https://github.com/rust-lang/rust/issues/86929, however, it seems to be almost impossible to reproduce outside of CI environments and thus very hard to debug. The fact that the error only occurs intermittently makes me think that this is a timing related issue.

This PR is an attempt to mitigate the issue by letting the compiler retry a few times when encountering this specific error (which resolved the issue described in https://github.com/rust-lang/rust/issues/86929).
2023-02-03 14:15:22 -08:00
Michael Goulet
e99e05d135
Rollup merge of #107551 - fee1-dead-contrib:rm_const_fnmut_helper, r=oli-obk
Replace `ConstFnMutClosure` with const closures

Also fixes a parser bug. cc `@oli-obk` for compiler changes
2023-02-03 14:15:22 -08:00
Michael Goulet
beb5cc9cf7
Rollup merge of #107519 - joboet:raw_os_error_ty, r=Amanieu
Add type alias for raw OS errors

Implement rust-lang/libs-team#173.

`@rustbot` label +S-waiting-on-ACP +T-libs-api
2023-02-03 14:15:21 -08:00
Michael Goulet
e7e8b91b74
Rollup merge of #106887 - compiler-errors:suggest-types-more, r=oli-obk
Make const/fn return params more suggestable

Bumps const item type suggestions to MachineApplicable (fixes #106843), also replaces FnDef with FnPtr items in return type suggestions to make more things suggestable.

r? diagnostics
2023-02-03 14:15:21 -08:00
Michael Goulet
0b5941aa11 Make const/fn return params more suggestable 2023-02-03 21:37:41 +00:00
Michael Goulet
41883fd19a intern external constraints 2023-02-03 21:36:59 +00:00
Ame
b384692f4c nit fixed 2023-02-03 13:57:53 -06:00
Ame
c2b65ffe29 Clarifying that .map() returns None if None. 2023-02-03 13:57:53 -06:00
Esteban Küber
da1360d981 Provide structured suggestion for binding needing type on E0594
Partially address #45405.
2023-02-03 18:53:27 +00:00
bors
658fad6c55 Auto merge of #107642 - Dylan-DPC:rollup-edcqhm5, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #107082 (Autotrait bounds on dyn-safe trait methods)
 - #107427 (Add candidates for DiscriminantKind builtin)
 - #107539 (Emit warnings on unused parens in index expressions)
 - #107544 (Improve `TokenCursor`.)
 - #107585 (Don't cause a cycle when formatting query description that references a FnDef)
 - #107633 (Fix suggestion for coercing Option<&String> to Option<&str>)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-02-03 17:53:49 +00:00
Dylan DPC
c9270272df
Rollup merge of #107633 - clubby789:option-string-coerce-fix, r=Nilstrieb
Fix suggestion for coercing Option<&String> to Option<&str>

Fixes #107604

This also makes the diagnostic `MachineApplicable`, and runs `rustfix` to check we're not producing incorrect code.

``@rustbot`` label +A-diagnostics
2023-02-03 23:04:52 +05:30
Dylan DPC
d6f0c51e98
Rollup merge of #107585 - compiler-errors:fndef-sig-cycle, r=oli-obk
Don't cause a cycle when formatting query description that references a FnDef

When a function returns `-> _`, we use typeck to compute what the resulting type of the body _should_ be. If we call another query inside of typeck and hit a cycle error, we attempt to report the cycle error which requires us to compute all of the query descriptions for the stack.

However, if one of the queries in that cycle has a query description that references this function as a FnDef type, we'll cause a *second* cycle error from within the cycle error reporting code, since rendering a FnDef requires us to compute its signature. This causes an unwrap to ICE, since during the *second* cycle reporting code, we try to look for a job that isn't in the active jobs list.

We can avoid this by using `with_no_queries!` when computing these query descriptions.

Fixes #107089

The only drawback is that the rendering of opaque types in cycles regresses a bit :| I'm open to alternate suggestions about how we may handle this...
2023-02-03 23:04:52 +05:30
Dylan DPC
815dc9c480
Rollup merge of #107544 - nnethercote:improve-TokenCursor, r=petrochenkov
Improve `TokenCursor`.

Some small improvements, for things that were bugging me.

Best reviewed one commit at a time.

r? ``@petrochenkov``
2023-02-03 23:04:51 +05:30
Dylan DPC
d9db35785d
Rollup merge of #107539 - PossiblyAShrub:unused-parens-in-index, r=lcnr
Emit warnings on unused parens in index expressions

Fixes: #96606.

I am not sure what the best term for "index expression" is. Is there a better term we could use?
2023-02-03 23:04:51 +05:30
Dylan DPC
e1bf3a1386
Rollup merge of #107427 - detrumi:builtin-impl-candidates, r=compiler-errors
Add candidates for DiscriminantKind builtin

Part of #107379
2023-02-03 23:04:50 +05:30
Dylan DPC
72213832f6
Rollup merge of #107082 - dtolnay:autotraits, r=lcnr
Autotrait bounds on dyn-safe trait methods

This PR is a successor to #106604 implementing the approach encouraged by https://github.com/rust-lang/rust/pull/106604#issuecomment-1387353737.

**I propose making it legal to use autotraits as trait bounds on the `Self` type of trait methods in a trait object.** https://github.com/rust-lang/rust/issues/51443#issuecomment-1374847313 justifies why this use case is particularly important in the context of the async-trait crate.

```rust
#![feature(auto_traits)]
#![deny(where_clauses_object_safety)]

auto trait AutoTrait {}

trait MyTrait {
    fn f(&self) where Self: AutoTrait;
}

fn main() {
    let _: &dyn MyTrait;
}
```

Previously this would fail with:

```console
error: the trait `MyTrait` cannot be made into an object
 --> src/main.rs:7:8
  |
7 |     fn f(&self) where Self: AutoTrait;
  |        ^
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #51443 <https://github.com/rust-lang/rust/issues/51443>
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
 --> src/main.rs:7:8
  |
6 | trait MyTrait {
  |       ------- this trait cannot be made into an object...
7 |     fn f(&self) where Self: AutoTrait;
  |        ^ ...because method `f` references the `Self` type in its `where` clause
  = help: consider moving `f` to another trait
```

In order for this to be sound without hitting #50781, **I further propose that we disallow handwritten autotrait impls that apply to trait objects.** Both of the following were previously allowed (_on nightly_) and no longer allowed in my proposal:

```rust
auto trait AutoTrait {}

trait MyTrait {}
impl AutoTrait for dyn MyTrait {}  // NOT ALLOWED

impl<T: ?Sized> AutoTrait for T {}  // NOT ALLOWED
```

(`impl<T> AutoTrait for T {}` remains allowed.)

After this change, traits with a default impl are implemented for a trait object **if and only if** the autotrait is one of the trait object's trait bounds (or a supertrait of a bound). In other words `dyn Trait + AutoTrait` always implements AutoTrait while `dyn Trait` never implements AutoTrait.

Fixes https://github.com/dtolnay/async-trait/issues/228.

r? `@lcnr`
2023-02-03 23:04:49 +05:30
David Tolnay
4501d3abe1
Autotrait bounds on dyn-safe trait methods 2023-02-03 08:33:40 -08:00
David Tolnay
9e1c600f74
Disallow impl autotrait for trait object 2023-02-03 08:33:40 -08:00