Commit Graph

239226 Commits

Author SHA1 Message Date
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
George Bateman
661df4fd55
Remove option_payload_ptr; redundant to offset_of 2023-11-16 22:56:25 +00: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
ee48a3f241 Auto merge of #3171 - saethlin:rustup, r=saethlin
Rustup

For https://github.com/rust-lang/miri/pull/3103
2023-11-16 21:29:49 +00:00
Ben Kimock
a5a039be35 Merge from rustc 2023-11-16 16:24:59 -05:00
Esteban Küber
a16722d221 Handle attempts to have multiple cfgd tail expressions
When encountering code that seems like it might be trying to have
multiple tail expressions depending on `cfg` information, suggest
alternatives that will success to parse.

```rust
fn foo() -> String {
    #[cfg(feature = "validation")]
    [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>()
    #[cfg(not(feature = "validation"))]
    String::new()
}
```

```
error: expected `;`, found `#`
  --> $DIR/multiple-tail-expr-behind-cfg.rs:5:64
   |
LL |     #[cfg(feature = "validation")]
   |     ------------------------------ only `;` terminated statements or tail expressions are allowed after this attribute
LL |     [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>()
   |                                                                ^ expected `;` here
LL |     #[cfg(not(feature = "validation"))]
   |     - unexpected token
   |
help: add `;` here
   |
LL |     [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>();
   |                                                                +
help: alternatively, consider surrounding the expression with a block
   |
LL |     { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() }
   |     +                                                             +
help: it seems like you are trying to provide different expressions depending on `cfg`, consider using `if cfg!(..)`
   |
LL ~     if cfg!(feature = "validation") {
LL ~         [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>()
LL ~     } else if cfg!(not(feature = "validation")) {
LL ~         String::new()
LL +     }
   |
```

Fix #106020.
2023-11-16 21:21:26 +00:00
Ben Kimock
b7c27454db Preparing for merge from rustc 2023-11-16 16:20:16 -05:00
bjorn3
4db95ce3cb Merge commit 'def04540a4e2541b995195c752c751295606a388' into sync_cg_clif-2023-11-16 2023-11-16 21:15:07 +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
bjorn3
def04540a4 Rustup to rustc 1.76.0-nightly (6b771f6b5 2023-11-15) 2023-11-16 21:06:08 +00:00
bjorn3
d9122c7565 Update reference to bjorn3/rustc_codegen_cranelift 2023-11-16 20:55:49 +00:00
bors
3d65927fae Auto merge of #3170 - RalfJung:libc-tests, r=RalfJung
a bit of libc test reorganization
2023-11-16 20:33:22 +00:00
Ralf Jung
8edb0ad33b actually all the 'env' tests work on FreeBSD, as well as posix_memalign 2023-11-16 21:32:04 +01:00
Ralf Jung
70cc639580 move reallocarray test into libc-misc 2023-11-16 21:32:04 +01:00
Ralf Jung
6985431923 make libc-misc pass under FreeBSD 2023-11-16 21:32:04 +01:00
Ralf Jung
7338c55052 split thread test into synchronization primitives and threadname 2023-11-16 21:32:04 +01:00
Laurențiu Nicola
949870c68d Merge commit '141fc695dca1df7cfc3c9803972ec19bb178dcbc' into sync-from-ra 2023-11-16 22:27:35 +02:00
Celina G. Val
8e81fc0087 Fix has_body() and change resolve_drop_in_place() sig
Fixed the `has_body()` function operator. Before that, this function was
returning false for all shims.

Change resolve_drop_in_place() to also return an instance for empty
shims, since they may still be required for vtable construction.
2023-11-16 12:04:25 -08:00
Celina G. Val
4c00aa3d74 Always run builder to evaluate constants
We were previously skipping it for non-generic functions, but this was
leaving some constants unevaluated.
2023-11-16 12:01:18 -08:00
Celina G. Val
08036a8005 Address PR comments 2023-11-16 12:01:18 -08:00
Celina G. Val
6515ac9d3f Add more APIs and fix Instance::body
Add more APIs to retrieve information about types, and add more instance
resolution options.

Make `Instance::body()` return an Option<Body>, since not every instance
might have an available body. For example, foreign instances, virtual
instances, dependencies.
2023-11-16 12:01:10 -08:00
bors
141fc695dc Auto merge of #15913 - lnicola:bump-libc, r=lnicola
internal: Bump libc

CC https://github.com/rust-lang/rust/pull/117981
2023-11-16 19:50:35 +00:00
Laurențiu Nicola
480cb60be3 Bump libc 2023-11-16 21:48:49 +02: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
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