Commit Graph

238803 Commits

Author SHA1 Message Date
Takayuki Maeda
3c0f22d99c
Rollup merge of #117889 - epage:docs, r=Mark-Simulacrum
docs(release): Clarify cargo entries

Trying to make these easier to scan and more understandable out of the context of their PR
2023-11-17 12:56:31 +09:00
Takayuki Maeda
3644594cf3
Rollup merge of #117850 - onur-ozkan:fix-116538, r=Mark-Simulacrum
bootstrap: simplify setting unstable-options for tools

Previously, we unconditionally(instead of `if path == "src/tools/clippy" || ..`) set this (to prevent recompiling tools between `x check $tool` and '` check $another_tool` executions) specifically for tools in the `x check` step. This PR relocates that logic to `fn prepare_tool_cargo`, making it step-agnostic.

Fixes #116538
Fixes #117983
2023-11-17 12:56:30 +09:00
Takayuki Maeda
2b2dd2514e
Rollup merge of #117649 - nnethercote:mv-lint_store, r=cjgillot
Move `lint_store`

Some nice cleanups enabled by the removal of compiler plugins.

r? `@cjgillot`
2023-11-17 12:56:30 +09:00
bors
f2f526cafa Auto merge of #117996 - matthiaskrgr:rollup-sp48bl4, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #117892 (Detect more `=>` typos)
 - #117959 (Better handle type errors involving `Self` literals)
 - #117980 (fix: Update CONTRIBUTING.md recommend -> recommended)
 - #117982 (bootstrap: only show PGO warnings when verbose)
 - #117990 (Tweak error and move tests)

Failed merges:

 - #117944 (some additional region refactorings)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-11-17 00:03:54 +00:00
Matthias Krüger
a5d7f8bcf2
Rollup merge of #117990 - estebank:issue-100825-part-deux, r=Nilstrieb
Tweak error and move tests

r? `@Nilstrieb`

Split off #117565.
2023-11-17 00:41:24 +01:00
Matthias Krüger
f82fefd11e
Rollup merge of #117982 - cuviper:quiet-pgo, r=onur-ozkan
bootstrap: only show PGO warnings when verbose

Building rustc with `--rust-profile-use` is currently dumping a lot of
warnings of "no profile data available for function" from `rustc_smir`
and `stable_mir`. These simply aren't exercised by the current profile-
gathering steps, but that's to be expected for new or experimental
functionality. I think for most people, these warnings will be just
noise, so it makes sense to only have them in verbose builds.
2023-11-17 00:41:24 +01:00
Matthias Krüger
7437151212
Rollup merge of #117980 - WhistlingZephyr:patch-1, r=Dylan-DPC
fix: Update CONTRIBUTING.md recommend -> recommended

Redo of https://github.com/rust-lang/rust/pull/116529.
2023-11-17 00:41:24 +01:00
Matthias Krüger
dd49c39e02
Rollup merge of #117959 - estebank:issue-76086, r=compiler-errors
Better handle type errors involving `Self` literals

When encountering a type error involving a `Self` literal, point at the self type of the enclosing `impl` and suggest using the actual type name instead.

```
error[E0308]: mismatched types
  --> $DIR/struct-path-self-type-mismatch.rs:13:9
   |
LL |   impl<T> Foo<T> {
   |        -  ------ this is the type of the `Self` literal
   |        |
   |        found type parameter
LL |       fn new<U>(u: U) -> Foo<U> {
   |              -           ------ expected `Foo<U>` because of return type
   |              |
   |              expected type parameter
LL | /         Self {
LL | |
LL | |             inner: u
LL | |
LL | |         }
   | |_________^ expected `Foo<U>`, found `Foo<T>`
   |
   = note: expected struct `Foo<U>`
              found struct `Foo<T>`
   = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
   = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
help: use the type name directly
   |
LL |         Foo::<U> {
   |         ~~~~~~~~
```
Fix #76086.
2023-11-17 00:41:23 +01:00
Matthias Krüger
92aba63d6b
Rollup merge of #117892 - estebank:fat-arrow-typo, r=compiler-errors
Detect more `=>` typos

Handle and recover `match expr { pat >= { arm } }`.
2023-11-17 00:41:22 +01:00
Nicholas Nethercote
dededd2f8b Remove Compiler::register_lints.
Lint registration now happens early enough that we can run it from
`Config`, before `Compiler` is created.
2023-11-17 10:39:18 +11:00
Nicholas Nethercote
a3b4961d5f Move lint_store from GlobalCtxt to Session.
This was made possible by the removal of plugin support, which
simplified lint store creation.

This simplifies the places in rustc and rustdoc that call
`describe_lints`, which are early on. The lint store is now built before
those places, so they don't have to create their own lint store for
temporary use, they can just use the main one.
2023-11-17 10:39:18 +11:00
Nicholas Nethercote
73c1fc5bc0 Remove dead lint code. 2023-11-17 10:39:18 +11:00
Nicholas Nethercote
5dfe47acd4 Inline and remove create_lint_store. 2023-11-17 10:39:18 +11:00
Esteban Küber
099eb40932 Fix code indentation 2023-11-16 21:54:04 +00:00
Esteban Küber
1e8c0951e9 review comment: move error logic to different method 2023-11-16 21:30:26 +00:00
bors
a57770440f Auto merge of #117979 - flip1995:clippyup, r=matthiaskrgr
Clippy subtree sync

r? `@Manishearth`
2023-11-16 21:09:20 +00:00
bors
820f06b21f Auto merge of #116097 - jackh726:higher-ranked-lifetime-error-backup, r=compiler-errors
Try to use approximate placeholder regions when outputting an AscribeUserType error in borrowck

Fixes #114866

Hi from GOSIM :)
2023-11-16 19:12:35 +00:00
Josh Stone
776146e9eb bootstrap: only show PGO warnings when verbose
Building rustc with `--rust-profile-use` is currently dumping a lot of
warnings of "no profile data available for function" from `rustc_smir`
and `stable_mir`. These simply aren't exercised by the current profile-
gathering steps, but that's to be expected for new or experimental
functionality. I think for most people, these warnings will be just
noise, so it makes sense to only have them in verbose builds.
2023-11-16 10:42:23 -08:00
Zephyr
4e26f9c335
fix: Update CONTRIBUTING.md recommend -> recommended 2023-11-16 23:57:09 +05:30
Philipp Krones
2ac2b26aec
Update Cargo.lock 2023-11-16 19:20:09 +01:00
Philipp Krones
75bdfad8c4
Merge commit 'edb720b199083f4107b858a8761648065bf38d86' into clippyup 2023-11-16 19:13:24 +01:00
bors
edb720b199 Auto merge of #11823 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-11-16 18:08:51 +00:00
Philipp Krones
6f952fbe53
Bump Clippy version -> 0.1.76 2023-11-16 19:02:33 +01:00
Philipp Krones
887f5a5bb4
Bump nightly version -> 2023-11-16 2023-11-16 19:02:15 +01:00
Philipp Krones
6fab1485c3
Merge remote-tracking branch 'upstream/master' into rustup 2023-11-16 19:02:04 +01:00
Esteban Küber
8e7d0702a2 Add test for parens around match arm pattern and condition 2023-11-16 16:58:41 +00:00
Esteban Küber
1c6bd0b12b Smaller span for unnessary mut suggestion 2023-11-16 16:58:41 +00:00
Esteban Küber
ae20897b30 Move tests to subdirectory 2023-11-16 16:58:41 +00:00
Esteban Küber
d8456855f5 Suggest replacing Self with the right type on type error
When encountering a type error caused by the use of `Self`, suggest
using the actual type name instead.

```
error[E0308]: mismatched types
  --> $DIR/struct-path-self-type-mismatch.rs:13:9
   |
LL |   impl<T> Foo<T> {
   |        -  ------ this is the type of the `Self` literal
   |        |
   |        found type parameter
LL |       fn new<U>(u: U) -> Foo<U> {
   |              -           ------ expected `Foo<U>` because of return type
   |              |
   |              expected type parameter
LL | /         Self {
LL | |
LL | |             inner: u
LL | |
LL | |         }
   | |_________^ expected `Foo<U>`, found `Foo<T>`
   |
   = note: expected struct `Foo<U>`
              found struct `Foo<T>`
   = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound
   = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters
help: use the type name directly
   |
LL |         Foo::<U> {
   |         ~~~~~~~~
```

Fix #76086.
2023-11-16 16:19:19 +00:00
Esteban Küber
a7e035ab89 Point at impl self ty on type error involving Self
When encountering a type error involving a `Self` literal, point at the
self type of the enclosing `impl`.

CC #76086.
2023-11-16 16:19:19 +00:00
bors
0ea7ddcc35 Auto merge of #117956 - saethlin:provenance-gc-access, r=RalfJung
Let Miri see the AllocId for all TyCtxt allocations

Per https://github.com/rust-lang/miri/pull/3103#discussion_r1391589896

r? `@RalfJung`
2023-11-16 15:15:54 +00:00
Ben Kimock
d7cecd3db2 Let Miri see the AllocId for all TyCtxt allocations 2023-11-16 08:30:49 -05:00
bors
1be1e84872 Auto merge of #117875 - Mark-Simulacrum:bootstrap-bump, r=clubby789
Bootstrap bump

Bumps bootstrap compiler to just-released beta.

https://forge.rust-lang.org/release/process.html#master-bootstrap-update-t-2-day-tuesday
2023-11-16 12:45:27 +00:00
bors
cd05ffa472 Auto merge of #117955 - notriddle:master, r=GuillaumeGomez
rustdoc-search: simplify the checkTypes fast path

This reduces code size while still matching the common case for plain, concrete types. This should not introduce any user-visible behavior changes.

The perf impact of the change was evaluated using <https://gitlab.com/notriddle/rustdoc-js-profile>. The output of the tool can be found here: http://notriddle.com/rustdoc-html-demo-5/profile-1/index.html

r? `@GuillaumeGomez`
2023-11-16 10:48:45 +00:00
bors
48d8100543 Auto merge of #117930 - thomcc:const_str-unnamed, r=nikic
Ensure strings created with `const_str` get the `unnamed_addr` attribute

This function (`const_str`) is only used when we need to invent a string during codegen -- for example, for a panic message to pass when codegening some of the assert/panic/etc terminators (for stuff like divide by zero).

AFAICT all other consts, such as the user-defined ones from const eval, should already be getting this attribute (things that come from a ConstAllocation do, for example). Which means that the "unnamed" part is even more true than usual here, these aren't strings that even exist as far as the user can tell.

~~Setting this attribute allows LLVM to merge these constants, leading to significant binary size savings (much more than I would expect). On x86_64-unknown-linux-gnu, t takes a build of ripgrep (release without debug info) from 9.7MiB to 6.0MiB (a savings of over 30%!?), and a build of rustc_driver's shared object from 123MiB to 112MiB (less drastic, but still over 10% reduced).~~

~~The effect on ripgrep is substantially reduced on macOS for reasons beyond me (I may have fucked up the test), only saving around 0.2MiB, although rustc_driver is still around 10MB or smaller than it had been previously.~~

~~This raises some questions, such as "does that mean 1/3 of ripgrep was made of division by zero complaints?" I'm not sure, that may be the case. The output of `strings path/to/rg` is \~2MB smaller, so it seems like a lot of it was. Allowing these to be merged presumably also allow functions that contain them to be merged (if the addresses had semantic meaning, then it stands).~~

~~I intend to do some more analysis here, but I got this up as soon as I realized that this attribute was only missing for internal const strings, and all other ones already get it.~~

Edit: The wins are much more marginal, but there's some argument to do this for the sake of consistency.
2023-11-16 08:43:05 +00:00
bors
525c91d096 Auto merge of #117916 - weihanglo:update-cargo, r=weihanglo
Update cargo

19 commits in 6790a5127895debec95c24aefaeb18e059270df3..2c03e0e2dcd05dd064fcf10cc1050d342eaf67e3
2023-11-10 17:09:35 +0000 to 2023-11-16 04:21:44 +0000
- docs(ref): Find a place to comment on --cap-lints (rust-lang/cargo#12976)
- Switch from AtomicU64 to Mutex. (rust-lang/cargo#12981)
- If the only path is a loop then counted as the shortest path. (rust-lang/cargo#12977)
- fix(resolver): Prefer MSRV, rather than ignore incompatible (rust-lang/cargo#12950)
- fix error message for duplicate links (rust-lang/cargo#12973)
- Only filter out target if its in the package root (rust-lang/cargo#12944)
- Ignore changing_spec_relearns_crate_types on windows-gnu (rust-lang/cargo#12972)
- fix: do not panic when failed to parse rustc commit-hash (rust-lang/cargo#12965)
- query{_vec} use IndexSummary (rust-lang/cargo#12970)
- Bump to 0.77.0; update changelog (rust-lang/cargo#12966)
- Improve about information of `cargo search` (rust-lang/cargo#12962)
- Fix --quiet being used with nested subcommands. (rust-lang/cargo#12959)
- make some debug assertion failures more informative (rust-lang/cargo#12963)
- refactor(toml): Consistently lead with 'Toml' prefix (rust-lang/cargo#12960)
- refactor(toml): Remove unused method (rust-lang/cargo#12961)
- Fix non-deterministic behavior in last-use repopulation (rust-lang/cargo#12958)
- Add cache garbage collection (rust-lang/cargo#12634)
- refactor(toml): Improve consistency (rust-lang/cargo#12954)
- Fix typo (rust-lang/cargo#12956)
2023-11-16 05:26:40 +00:00
Weihang Lo
8b2e36008e
Update cargo 2023-11-16 00:23:39 -05:00
bors
6faa181015 Auto merge of #117948 - aeubanks:dibuilder, r=durin42
llvm-wrapper: Pass newly added param to DIBuilder::createStaticMemberType()

This was added in https://github.com/llvm/llvm-project/pull/72234.
DW_TAG_member was the implicit default before.

The LLVM change is quite sinister since due to weakly typed ints and default params, this was still successfully compiling against LLVM but was passing the wrong parameters.
2023-11-16 03:14:51 +00:00
Mark Rousskov
9e8edb6659 Add check-cfg to cranelift 2023-11-15 21:45:48 -05:00
Mark Rousskov
917f6540ed Re-format code with new rustfmt 2023-11-15 21:45:48 -05:00
Mark Rousskov
db3e2bacb6 Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
Mark Rousskov
74cf505e36 Bump stage0 to latest 2023-11-15 19:40:51 -05:00
Mark Rousskov
efe54e24aa Substitute version placeholders 2023-11-15 19:40:51 -05:00
bors
9144d51175 Auto merge of #117954 - aeubanks:dibuilder2, r=durin42
llvm-wrapper: Pass newly added param to DIBuilder::createEnumerationType()

Added in LLVM in https://github.com/llvm/llvm-project/pull/72011.
2023-11-16 00:03:50 +00:00
Arthur Eubanks
7cde2cee35 llvm-wrapper: Pass newly added param to DIBuilder::createEnumerationType()
Added in LLVM in https://github.com/llvm/llvm-project/pull/72011.
2023-11-15 14:42:53 -08:00
Michael Howell
512aa5ed0f rustdoc-search: simplify the checkTypes fast path
This reduces code size while still matching the common case
for plain, concrete types.
2023-11-15 15:20:56 -07:00
Arthur Eubanks
e2c3e94be9 17 -> 18 2023-11-15 13:15:55 -08:00
Arthur Eubanks
984898da17 [llvm-wrapper] Pass newly added param to DIBuilder::createStaticMemberType()
This was added in https://github.com/llvm/llvm-project/pull/72234.
DW_TAG_member was the implicit default before.
2023-11-15 11:29:35 -08:00
bors
6b771f6b5a Auto merge of #117878 - gavinleroy:proper-depth-check, r=lcnr
Fix depth check in ProofTreeVisitor.

The hack to cutoff overflows and cycles in the new trait solver was incorrect. We want to inspect everything with depth [0..10].

This fix exposed a previously unseen bug, which caused the compiler to ICE when invoking `trait_ref` on a non-assoc type projection. I simply added the guard in the `AmbiguityCausesVisitor`, and updated the expected output for the `auto-trait-coherence` test which now includes the extra note:
```text
   |
   = note: upstream crates may add a new impl of trait `std::marker::Send` for type `OpaqueType` in future versions
```

r? `@lcnr`
2023-11-15 18:53:04 +00:00
bors
0b24479638 Auto merge of #116555 - paulmenage:llvm-module-flag, r=wesleywiser
Add -Z llvm_module_flag

Allow adding values to the `!llvm.module.flags` metadata for a generated module.  The syntax is

`-Z llvm_module_flag=<name>:<type>:<value>:<behavior>`

Currently only u32 values are supported but the type is required to be specified for forward compatibility.  The `behavior` element must match one of the named LLVM metadata behaviors.viors.

This flag is expected to be perma-unstable.
2023-11-15 16:54:31 +00:00