Commit Graph

239120 Commits

Author SHA1 Message Date
Celina G. Val
3f87dac9a2 Fix bug on MIRVisitor
We were not iterating over all local variables due to a typo.
2023-11-16 11:05:36 -08:00
Celina G. Val
e70839ac84 Add more SMIR internal impl and callback return value
In cases like Kani, we will invoke the rustc_internal run command
directly for now. It would be handly to be able to have a callback
that can return a value.

We also need extra methods to convert stable constructs into internal
ones, so we can break down the transition into finer grain commits.
2023-11-16 11:05:36 -08: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
bors
0b6b44f4ca Auto merge of #3166 - devnexen:reallocarray, r=RalfJung
reallocarray shim linux/freebsd support proposal.
2023-11-16 17:52:07 +00:00
bors
37a8790829 Auto merge of #15830 - davidbarsky:davidbarsky/allow-companion-extension-to-call-rust-analyzer, r=davidbarsky
code: expose workspaces to other extensions; remove `addProject` command

This (mostly red) PR does three things:
- Exposes two methods to companion extensions (`setWorkspaces` and `notifyRustAnalyzer`).
    - `setWorkspaces` is needed to update `linkedProjects` _without_ writing workspace/global configuration.
    - `notifyRustAnalyzer` to get the server to pull the new configuration.
- Makes `Ctx` implement `RustAnalyzerExtensionApi` to prevent accidental regressions.
- Remove `rust-analyzer.addProject`, as that will live in a buck2 companion extension. No need for that to be in rust-analyzer!

I can see the utility of combining `notifyRustAnalyzer` and `setWorkspaces` into a single method (`updateWorkspacesAndNotify()`?), but I don't feel strongly about this. My feeling is that this API could be easily changed in the future.
2023-11-16 17:43:14 +00:00
David Barsky
0cd68bfed3 code: expose workspaces to other extensions; remove addProject command 2023-11-16 12:38:15 -05:00
David Carlier
c6acc058c0 reallocarray shim linux/freebsd support proposal. 2023-11-16 17:24:31 +00:00
Esteban Küber
1ee37bf03f let-chain fmt 2023-11-16 17:00:40 +00:00
Esteban Küber
6a2d9b45c4 address review comment 2023-11-16 17:00:24 +00:00
Esteban Küber
4f7dddd4a1 recover primary span label 2023-11-16 17:00:23 +00:00
Esteban Küber
8bd8f3b090 Suggest unwrap() on field not found for Result/Option
When encountering a `Result<T, _>` or `Option<T>` where `T` has a field
that's being accessed, suggest calling `.unwrap()` to get to the field.
2023-11-16 17:00:23 +00:00
Esteban Küber
dfa75391f8 Suggest field typo through derefs
Take into account implicit dereferences when suggesting fields.

```
error[E0609]: no field `longname` on type `Arc<S>`
  --> $DIR/suggest-field-through-deref.rs:10:15
   |
LL |     let _ = x.longname;
   |               ^^^^^^^^ help: a field with a similar name exists: `long_name`
```

CC https://github.com/rust-lang/rust/issues/78374#issuecomment-719564114
2023-11-16 17:00:23 +00: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
Esteban Küber
4e418805da More detail when expecting expression but encountering bad macro argument
Partially address #71039.
2023-11-16 16:19:04 +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
Ali MJ Al-Nasrawy
af79fd109b ignore implied bounds with placeholders 2023-11-16 14:25:35 +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
7df74ebad1 Auto merge of #3168 - RalfJung:set_var, r=RalfJung
get rid of our last uses of set_var

Fixes https://github.com/rust-lang/miri/issues/2783
2023-11-16 10:00:13 +00:00
Ralf Jung
ca67d7fa6a get rid of our last uses of set_var 2023-11-16 10:46:48 +01:00
bors
255d04cd9b Auto merge of #3167 - RalfJung:rustup, r=RalfJung
Rustup
2023-11-16 09:31:29 +00:00
Ralf Jung
13bfe141ff Merge from rustc 2023-11-16 10:26:50 +01:00
Ralf Jung
9c8c2d13b8 Preparing for merge from rustc 2023-11-16 10:26:19 +01: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
Esteban Küber
890ce26213 When using existing fn as module, don't claim it doesn't exist
Tweak wording of module not found in resolve, when the name exists but
belongs to a non-`mod` item.

Fix #81232.
2023-11-16 06:07:33 +00:00
Nicholas Nethercote
8f669f558a Reduce exposure of things. 2023-11-16 16:49:22 +11: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
Zalathar
05322162ab Add test suggestions for mir-opt and coverage 2023-11-16 14:02:51 +11:00
Zalathar
925111c2eb Support multiple globs in static suggestions 2023-11-16 14:02:51 +11:00
Zalathar
3fdd84ab3a Allow trailing commas in static suggestions 2023-11-16 14:02:51 +11: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