Commit Graph

224737 Commits

Author SHA1 Message Date
Dylan DPC
1397827f25
Rollup merge of #111619 - cjgillot:profile-pass, r=WaffleLapkin
Add timings for MIR passes to profiling report

This will help identify which pass is responsible for a regression.
2023-05-20 12:20:59 +05:30
Dylan DPC
fa11c9e8ca
Rollup merge of #111606 - jyn514:nightly-diagnostics, r=lcnr
very minor cleanups

- add `must_use` to `early_error_no_abort`

  this was already being used at its only callsite, but this ensures that new code remembers to use it if it's called in the future. found this while investigating https://github.com/rust-lang/rust/issues/110090.

- remove outdated and incorrect comment in `builder.rs`. `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from an env var instead: b275d2c30b/src/librustdoc/clean/utils.rs (L569-L573)
2023-05-20 12:20:59 +05:30
Dylan DPC
2294d81fb3
Rollup merge of #111491 - compiler-errors:nested-fut-must-use, r=wesleywiser
Dont check `must_use` on nested `impl Future` from fn

Fixes (but does not close, per beta policy) #111484

Also fixes a `FIXME` left in the code about (presumably) false-positives on non-async `#[must_use] fn() -> impl Future` cases, though if that's not desirable to include in the beta backport then I can certainly revert it.

Beta nominating as it fixes a beta ICE.
2023-05-20 12:20:58 +05:30
bors
e86fd62b6b Auto merge of #111524 - scottmcm:escape-using-ascii, r=cuviper
`ascii::Char`-ify the escaping code in `core`

This means that `EscapeIterInner::as_str` no longer needs unsafe code, because the type system ensures the internal buffer is only ASCII, and thus valid UTF-8.

Come to think of it, this also gives it a (non-guaranteed) niche.

cc `@BurntSushi` as potentially interested
`ascii::Char` tracking issue: #110998
2023-05-20 04:43:17 +00:00
bors
940ffdfd1e Auto merge of #10763 - GuillaumeGomez:unique_cfg_condition, r=Jarcho
Add `MINIMAL_CFG_CONDITION` lint

I encountered a few cases where some code had:

```rust
#[cfg(any(unix))]
```

In this case, the `any` is useless. This lint checks this and also for the `all` condition.

```
changelog: [`unique_cfg_condition`]: Add new `UNIQUE_CFG_CONDITION` lint
```
2023-05-20 02:47:51 +00:00
Ximin Luo
0d7d2cae2f
Set the timestamp of downloaded stage0 files ...
... using server-reported timestamp.
This allows us to track changes to the downloaded artifact more easily
and in a more reproducible manner.

Co-authored-by: Zixing Liu <zixing.liu@canonical.com>
2023-05-19 18:49:50 -06:00
bors
7047d97e01 Auto merge of #111453 - scottmcm:constify-as-slice, r=Mark-Simulacrum
constify `slice_as_chunks` (unstable)

Tracking issue: #74985

Nothing complicated required; just adding `const` to the declarations.
2023-05-19 23:12:36 +00:00
Michael Goulet
2b1d4bf44e Add extra debug assertions for equality for Adt/Variant/FieldDef 2023-05-19 22:51:50 +00:00
Guillaume Gomez
dbc76a7663 Add check for empty cfg all condition 2023-05-20 00:37:08 +02:00
bors
521f4dae1b Auto merge of #109773 - beetrees:set-file-time-improvements, r=Amanieu
Add creation time support to `FileTimes` on apple and windows

Adds support for setting file creation times on platforms which support changing it directly (currently only Apple and Windows). Based on top of #110093 (which was split from this PR).

ACP: rust-lang/libs-team#199 (currently still in progress)

Tracking issue: #98245

`@rustbot` label +T-libs-api -T-libs
2023-05-19 19:53:14 +00:00
Badel2
cbb41008fd Fix overflow in error emitter 2023-05-19 20:58:06 +02:00
Maybe Waffle
140cdcbc9d Drive-by-cleanup: Don't emit thir::ExprKind::NeverToAny for ! -> ! 2023-05-19 21:50:01 +04:00
Mu001999
d57383855e Avoid redundant to_string 2023-05-19 23:11:02 +08:00
Guillaume Gomez
c2d3b23bd0 Migrate GUI colors test to original CSS color format 2023-05-19 17:01:22 +02:00
bors
8a281f9c79 Auto merge of #107060 - ibraheemdev:poll-ready, r=joshtriplett
Remove unstable `Poll::ready`

Based on the discussion in https://github.com/rust-lang/rust/issues/89780, this API is problematic and would likely require changes over an edition. Now that `task::ready!` is stabilized, this seems unlikely to happen, so I think we should just go ahead and remove it.

ACP: https://github.com/rust-lang/libs-team/issues/214
2023-05-19 14:50:42 +00:00
Guillaume Gomez
5328852ad7 Update CHANGELOG 2023-05-19 16:16:37 +02:00
Guillaume Gomez
fcf19481aa Add UI test for UNIQUE_CFG_CONDITION 2023-05-19 16:16:37 +02:00
Guillaume Gomez
ab66a86815 Add new UNIQUE_CFG_CONDITION lint 2023-05-19 16:16:37 +02:00
Mu001999
a9528a28f2 Keep only the trait when emitting the error for MyTrait + 'a 2023-05-19 22:11:54 +08:00
bohan
990b2899ad fix: emit error when fragment is MethodReceiverExpr and items is empty 2023-05-19 21:21:05 +08:00
bors
2a1dbbaec5 Auto merge of #10777 - Icxolu:unnecessary_collect, r=xFrednet
Enhance `needless_collect`: lint in method/function arguments that take an `IntoIterator`

Updates `needless_collect` to also lint `collect` calls in method/function arguments that take an `IntoIterator` (for example `Extend::extend`). Every `Iterator` trivially implements `IntoIterator` and collecting it only causes an unnecessary allocation.

---

changelog: Enhancement: [`needless_collect`]: Now also detects function arguments, taking a generic `IntoIterator`
[#10777](https://github.com/rust-lang/rust-clippy/pull/10777)
<!-- changelog_checked -->

fixes #10762
2023-05-19 12:26:43 +00:00
bors
17a681000b Auto merge of #111641 - michaelwoerister:debugger-visualizer-fixes, r=cjgillot
Fix dependency tracking for debugger visualizers

This PR fixes dependency tracking for debugger visualizer files by changing the `debugger_visualizers` query to an `eval_always` query that scans the AST while it is still available. This way the set of visualizer files is already available when dep-info is emitted. Since the query is turned into an `eval_always` query, dependency tracking will now reliably detect changes to the visualizer script files themselves.

TODO:
 - [x] perf.rlo
 - [x] Needs a bit more documentation in some places
 - [x] Needs regression test for the incr. comp. case

Fixes https://github.com/rust-lang/rust/issues/111226
Fixes https://github.com/rust-lang/rust/issues/111227
Fixes https://github.com/rust-lang/rust/issues/111295

r? `@wesleywiser`
cc `@gibbyfree`
2023-05-19 11:30:44 +00:00
Ibraheem Ahmed
4fbca2e1d5 tidy 2023-05-19 12:45:41 +02:00
Ibraheem Ahmed
b997f3ca13 remove unstable Poll::ready 2023-05-19 12:42:58 +02:00
Scott McMurray
62fcebdf7a constify slice_as_chunks (unstable)
Tracking issue: 74985

Nothing complicated required; just adding `const` to the declarations.
2023-05-19 02:32:10 -07:00
Michael Woerister
987655aade Fix run-make/inrcemental-debugger-visualizer test for macOS. 2023-05-19 11:02:16 +02:00
lcnr
c5ec1b8bc5 add test 2023-05-19 10:44:38 +02:00
lcnr
1708ad65a4 update recursion depth in confirm_candidate 2023-05-19 10:33:13 +02:00
bors
2d17294d18 Auto merge of #111590 - dtolnay:panictemporaries, r=bjorn3
Shorten even more panic temporary lifetimes

Followup to #104134. As pointed out by `@bjorn3` in https://github.com/rust-lang/rust/pull/104134#pullrequestreview-1425585948, there are other cases in the panic macros which would also benefit from dropping their non-Send temporaries as soon as possible, avoiding pointlessly holding them across an await point.

For the tests added in this PR, here are the failures you get today on master without the macro changes in this PR:

<details>
<summary>tests/ui/macros/panic-temporaries-2018.rs</summary>

```console
error: future cannot be sent between threads safely
  --> tests/ui/macros/panic-temporaries-2018.rs:52:18
   |
LL |     require_send(panic_display());
   |                  ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send`
   |
   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
  --> tests/ui/macros/panic-temporaries-2018.rs:35:31
   |
LL |     f(panic!("{}", NOT_SEND)).await;
   |                    --------   ^^^^^- `NOT_SEND` is later dropped here
   |                    |          |
   |                    |          await occurs here, with `NOT_SEND` maybe used later
   |                    has type `NotSend` which is not `Send`
note: required by a bound in `require_send`
  --> tests/ui/macros/panic-temporaries-2018.rs:48:25
   |
LL | fn require_send(_: impl Send) {}
   |                         ^^^^ required by this bound in `require_send`

error: future cannot be sent between threads safely
  --> tests/ui/macros/panic-temporaries-2018.rs:52:18
   |
LL |     require_send(panic_display());
   |                  ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send`
   |
   = help: within `NotSend`, the trait `Sync` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
  --> tests/ui/macros/panic-temporaries-2018.rs:35:31
   |
LL |     f(panic!("{}", NOT_SEND)).await;
   |       ----------------------  ^^^^^- the value is later dropped here
   |       |                       |
   |       |                       await occurs here, with the value maybe used later
   |       has type `&NotSend` which is not `Send`
note: required by a bound in `require_send`
  --> tests/ui/macros/panic-temporaries-2018.rs:48:25
   |
LL | fn require_send(_: impl Send) {}
   |                         ^^^^ required by this bound in `require_send`

error: future cannot be sent between threads safely
  --> tests/ui/macros/panic-temporaries-2018.rs:53:18
   |
LL |     require_send(panic_str());
   |                  ^^^^^^^^^^^ future returned by `panic_str` is not `Send`
   |
   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
  --> tests/ui/macros/panic-temporaries-2018.rs:40:36
   |
LL |     f(panic!((NOT_SEND, "...").1)).await;
   |               --------             ^^^^^- `NOT_SEND` is later dropped here
   |               |                    |
   |               |                    await occurs here, with `NOT_SEND` maybe used later
   |               has type `NotSend` which is not `Send`
note: required by a bound in `require_send`
  --> tests/ui/macros/panic-temporaries-2018.rs:48:25
   |
LL | fn require_send(_: impl Send) {}
   |                         ^^^^ required by this bound in `require_send`

error: future cannot be sent between threads safely
  --> tests/ui/macros/panic-temporaries-2018.rs:54:18
   |
LL |     require_send(unreachable_display());
   |                  ^^^^^^^^^^^^^^^^^^^^^ future returned by `unreachable_display` is not `Send`
   |
   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
  --> tests/ui/macros/panic-temporaries-2018.rs:45:31
   |
LL |     f(unreachable!(NOT_SEND)).await;
   |                    --------   ^^^^^- `NOT_SEND` is later dropped here
   |                    |          |
   |                    |          await occurs here, with `NOT_SEND` maybe used later
   |                    has type `NotSend` which is not `Send`
note: required by a bound in `require_send`
  --> tests/ui/macros/panic-temporaries-2018.rs:48:25
   |
LL | fn require_send(_: impl Send) {}
   |                         ^^^^ required by this bound in `require_send`

error: future cannot be sent between threads safely
  --> tests/ui/macros/panic-temporaries-2018.rs:54:18
   |
LL |     require_send(unreachable_display());
   |                  ^^^^^^^^^^^^^^^^^^^^^ future returned by `unreachable_display` is not `Send`
   |
   = help: within `NotSend`, the trait `Sync` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
  --> tests/ui/macros/panic-temporaries-2018.rs:45:31
   |
LL |     f(unreachable!(NOT_SEND)).await;
   |       ----------------------  ^^^^^- the value is later dropped here
   |       |                       |
   |       |                       await occurs here, with the value maybe used later
   |       has type `&NotSend` which is not `Send`
note: required by a bound in `require_send`
  --> tests/ui/macros/panic-temporaries-2018.rs:48:25
   |
LL | fn require_send(_: impl Send) {}
   |                         ^^^^ required by this bound in `require_send`

error: aborting due to 5 previous errors
```
</details>

<details>
<summary>tests/ui/macros/panic-temporaries.rs</summary>

```console
error: future cannot be sent between threads safely
  --> tests/ui/macros/panic-temporaries.rs:42:18
   |
LL |     require_send(panic_display());
   |                  ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send`
   |
   = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
  --> tests/ui/macros/panic-temporaries.rs:35:31
   |
LL |     f(panic!("{}", NOT_SEND)).await;
   |                    --------   ^^^^^- `NOT_SEND` is later dropped here
   |                    |          |
   |                    |          await occurs here, with `NOT_SEND` maybe used later
   |                    has type `NotSend` which is not `Send`
note: required by a bound in `require_send`
  --> tests/ui/macros/panic-temporaries.rs:38:25
   |
LL | fn require_send(_: impl Send) {}
   |                         ^^^^ required by this bound in `require_send`

error: future cannot be sent between threads safely
  --> tests/ui/macros/panic-temporaries.rs:42:18
   |
LL |     require_send(panic_display());
   |                  ^^^^^^^^^^^^^^^ future returned by `panic_display` is not `Send`
   |
   = help: within `NotSend`, the trait `Sync` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
  --> tests/ui/macros/panic-temporaries.rs:35:31
   |
LL |     f(panic!("{}", NOT_SEND)).await;
   |       ----------------------  ^^^^^- the value is later dropped here
   |       |                       |
   |       |                       await occurs here, with the value maybe used later
   |       has type `&NotSend` which is not `Send`
note: required by a bound in `require_send`
  --> tests/ui/macros/panic-temporaries.rs:38:25
   |
LL | fn require_send(_: impl Send) {}
   |                         ^^^^ required by this bound in `require_send`

error: aborting due to 2 previous errors
```
</details>

r? bjorn3
2023-05-19 07:15:38 +00:00
bors
19ca5692f6 Auto merge of #110100 - compiler-errors:no-infer-pred-must-hold, r=jackh726
do not allow inference in `predicate_must_hold` (alternative approach)

See the FCP description for more info, but tl;dr is that we should not return `EvaluatedToOkModuloRegions` if an obligation may hold only with some choice of inference vars being constrained.

Attempts to solve this in the approach laid out by lcnr here: https://github.com/rust-lang/rust/pull/109558#discussion_r1147318134, rather than by eagerly replacing infer vars with placeholders which is a bit too restrictive.

r? `@ghost`
2023-05-19 03:36:37 +00:00
bors
1e8d2c59bc Auto merge of #10478 - Jarcho:block_eq, r=xFrednet
`SpanlessEq` improvements

fixes #9775

Also includes a simplification to `consts::constant`'s interface since I was already touching the code.

At the start of `eq_expr` the check:
```rust
if !self.inner.allow_side_effects && left.span.ctxt() != right.span.ctxt() {
    return false;
}
```
was removed. This was added in 49e2501 to handle `cfg` macros. This is better handled by the newly added `check_ctxt`.

changelog: [various lints]: Don't consider different `cfg!` expansions to be the same unless they are for the same config.
changelog: [various lints]: Don't consider the expansion of two different macros to be equal, even when they expand to the same token sequence.
changelog: [various lints]: Don't consider two blocks to be equal if they contain disabled code or empty macro expansions, unless those section contain the exact same token sequence.
2023-05-19 01:13:08 +00:00
bors
92f5dea0eb Auto merge of #109602 - bvanjoi:fix-issue-109343, r=petrochenkov
fix(resolve): replace bindings to dummy for unresolved imports

close #109343

In #109343, `f` in `pub use f as g` points to:

|namespace| binding|
|-|-|
|type| `external crate f`|
|value| `None` |
|macro| `None` |

When resolve `value_ns` during `resolve_doc_links`, the value of the binding of single_import `pub use f as g` goes to `pub use inner::f`, and since it does not satisfy [!self.is_accessible_from(binding.vis, single_import.parent_scope.module)](https://github.com/rust-lang/rust/blob/master/compiler/rustc_resolve/src/ident.rs#L971) and returns `Err(Undetermined)`, which eventually goes to `PathResult::Indeterminate => unreachable!`.

This PR replace all namespace binding to `dummy_binding` for indeterminate import, so, the bindings of `pub use f as g` had been changed to followings after finalize:

|namespace| binding|
|-|-|
|type| `dummy`|
|value| `dummy` |
|macro| `dummy` |

r?`@petrochenkov`
2023-05-19 00:41:32 +00:00
John Kåre Alsaker
9e755d98cc Merge some query impl modules into one 2023-05-19 01:38:27 +02:00
Nicholas Nethercote
1bb957efc6 Improve CGU partitioning debug output.
- Pass a slice instead of an iterator to `debug_dump`.
- For each CGU set, print: the number of CGUs, the max and min size, and
  the ratio of the max and min size (which indicates how evenly sized
  they are).
- Print a `FINAL` entry, showing the absolute final results.
2023-05-19 08:48:28 +10:00
Nicholas Nethercote
1551495d32 Fix an ICE in CGU dumping code. 2023-05-19 08:48:28 +10:00
bors
c9dc55d05c Auto merge of #111345 - jyn514:cfg-release-caching, r=cjgillot,est31
Only depend on CFG_VERSION in rustc_interface

This avoids having to rebuild the whole compiler on each commit when `omit-git-hash = false`.

cc https://github.com/rust-lang/rust/issues/76720 - this won't fix it, and I'm not suggesting we turn this on by default, but it will make it less painful for people who do have `omit-git-hash` on as a workaround.
2023-05-18 21:45:02 +00:00
Jason Newcomb
58132cb3b0 Improve SpanlessEq
* Don't consider expansions of different macros to be the same, even if they expand to the same tokens
* Don't consider `cfg!` expansions to be equal if they check different configs.
2023-05-18 16:42:13 -04:00
Jason Newcomb
5351170744 Slightly refactor constant evaluation and add detection for empty macro expansion and cfged statements. 2023-05-18 15:43:33 -04:00
Jason Newcomb
0b3c2ed811 Search for inactive cfg attributes and empty macro expansion through
the entire block
2023-05-18 15:43:23 -04:00
bors
392e9551d4 Auto merge of #10798 - Alexendoo:unnameable-ty-suggestions, r=Jarcho
Don't suggest unnameable types in `box_default`, `let_underscore_untyped`

changelog: [`box_default`], [`let_underscore_untyped`]: Don't suggest unnameable types
2023-05-18 18:58:53 +00:00
bors
d3f416dc06 Auto merge of #110493 - bvanjoi:new_disambiguated_key, r=petrochenkov
fix(resolve): only disambiguate binding key during define

- close https://github.com/rust-lang/rust/issues/110164
- discussion: https://github.com/rust-lang/rust/pull/110264#discussion_r1168895468

r? `@petrochenkov`
2023-05-18 18:53:49 +00:00
Alex Macleod
cfa5aa2aad Don't suggest unnameable types in box_default, let_underscore_untyped 2023-05-18 18:51:27 +00:00
Scott McMurray
400866b7ab Also assume wrap-around discriminants in as MIR building
Resolves this FIXME:

8d18c32b61/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs (L231)
2023-05-18 10:28:36 -07:00
Guillaume Gomez
ad5955b891 Migrate GUI colors test to original CSS color format 2023-05-18 17:02:51 +02:00
jyn
04265621f9 very minor cleanups
- add `must_use` to `early_error_no_abort`

  this was already being used at its only callsite, but this ensures
that new code remembers to use it if it's called in the future.

- remove outdated and incorrect comment in `builder.rs`.
  `doc_rust_lang_org_channel` doesn't exist in rustdoc, it gets it from
an env var instead.
2023-05-18 08:06:47 -05:00
lcnr
3e4ed61c09 do not overwrite obligations 2023-05-18 15:00:30 +02:00
bors
fdd030127c Auto merge of #111721 - Dylan-DPC:rollup-9jw6b7k, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #110986 (Delay a bug when overwriting fed value.)
 - #111054 (Do not recover when parsing stmt in cfg-eval.)
 - #111685 (Fix typo in bootstrap command description)
 - #111686 (Retire is_foreign_item query.)
 - #111695 (Exclude inherent projections from some alias type `match`es)
 - #111703 (Merge query property modules into one)
 - #111707 (Remove unused `impl<T> WorkerLocal<Vec<T>>`.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-05-18 12:55:15 +00:00
Marcin S
21517923e1
Document stack-protector option
Only updated `exploit-mitigations.md` to reflect that the option exists. Removed the alternatives
mentioned as they are not actually implemented yet.

As this is an unstable feature, should it be added to `unstable-book` also? I didn't do that because
I couldn't find the tracking issue for it. (There should be one to track stabilization of the
feature.)
2023-05-18 08:44:00 -04:00
Dylan DPC
ad214ac02b
Rollup merge of #111707 - nnethercote:rm-WorkerLocal-Vec, r=compiler-errors
Remove unused `impl<T> WorkerLocal<Vec<T>>`.

cc ``@SparrowLii`` ``@Zoxc``
2023-05-18 17:37:10 +05:30
Dylan DPC
cca0f97985
Rollup merge of #111703 - Zoxc:queries-mod, r=cjgillot
Merge query property modules into one

This merges all the query modules that defines types into a single module per query with a normal naming convention for type aliases.

r? ``@cjgillot``
2023-05-18 17:37:10 +05:30