Commit Graph

240419 Commits

Author SHA1 Message Date
Esteban Küber
4e99db9e54 Tweak unclosed generics errors
Remove unnecessary span label for parse errors that already have a
suggestion.

Provide structured suggestion to close generics in more cases.
2023-12-01 20:01:39 +00:00
bors
9cf18e98f8 Auto merge of #117248 - ChrisDenton:ci-symlink, r=m-ou-se
Error if symlinks are not supported in CI

In CI we want to run as many tests as possible and be alerted if a test isn't run for any reason.
2023-12-01 19:34:40 +00:00
Matthew Jasper
942e93972d Handle recursion limit for subtype and well-formed predicates 2023-12-01 17:25:02 +00:00
Philipp Krones
6ae8003ff5
Merge commit 'f0cdee4a3f094416189261481eae374b76792af1' into clippy-subtree-sync 2023-12-01 18:21:58 +01:00
bors
f0cdee4a3f Auto merge of #11903 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-12-01 17:09:21 +00:00
Philipp Krones
9d36c18198
Bump nightly version -> 2023-12-01 2023-12-01 18:06:16 +01:00
Philipp Krones
a9867e1847
Merge remote-tracking branch 'upstream/master' into rustup 2023-12-01 18:06:03 +01:00
bors
e402c494b7 Auto merge of #15879 - dfireBird:fix-14656, r=Veykril
Implement completion for the callable fields.

Fixes #14656

PR is opened with basic changes. It could be improved by having a new `SymbolKind` for the callable fields and implementing a separate render function similar to the `render_method` for the new `SymbolKind`.
It could also be done without any changes to the `SymbolKind` of course, have the new function called based on the type of field.
I prefer the former method.

Please give any thoughts or changes you think is appropriate for this method. I could start working on that in this same PR.
2023-12-01 16:20:36 +00:00
bors
64d7e0d0b6 Auto merge of #115993 - bvanjoi:fix-115966, r=petrochenkov
vis note for no pub reexports glob import

Fixes #115966

Only trigger the `unused_import` lint when it's not being used.

r? `@petrochenkov`
2023-12-01 15:46:04 +00:00
DianQK
436d4f62e0
Fix link name for extern "C" in msvc 2023-12-01 22:16:51 +08:00
Rémy Rakic
de2b8b13d4 improve NLL/polonius scope equality assertion 2023-12-01 14:04:54 +00:00
Rémy Rakic
b442120a30 add tests from crater for liveness causing scope differences 2023-12-01 14:04:54 +00:00
Rémy Rakic
60d4eb2c1b move and maintain live loans in LivenessValues
Liveness data is pushed from multiple parts of NLL. Instead of changing
the call sites to maintain live loans, move the latter to `LivenessValues` where
this liveness data is pushed to, and maintain live loans there.

This fixes the differences in polonius scopes on some CFGs where a
variable was dead in tracing but as a MIR terminator its regions were marked
live from "constraint generation"
2023-12-01 14:04:54 +00:00
Rémy Rakic
231acddcc3 rename a couple of trivial variables
for consistency with how they're named everywhere else
2023-12-01 14:04:51 +00:00
Rémy Rakic
eddd3a7381 remove useless debug log 2023-12-01 14:02:34 +00:00
bors
6e6a0b0a3d Auto merge of #16000 - HKalbasi:drop-inlay-hint, r=HKalbasi
Initial support for implicit drop inlay hint

cc #15785
2023-12-01 13:36:08 +00:00
bors
63d16b5a98 Auto merge of #117472 - jmillikin:stable-c-str-literals, r=Nilstrieb
Stabilize C string literals

RFC: https://rust-lang.github.io/rfcs/3348-c-str-literal.html

Tracking issue: https://github.com/rust-lang/rust/issues/105723

Documentation PR (reference manual): https://github.com/rust-lang/reference/pull/1423

# Stabilization report

Stabilizes C string and raw C string literals (`c"..."` and `cr#"..."#`), which are expressions of type [`&CStr`](https://doc.rust-lang.org/stable/core/ffi/struct.CStr.html). Both new literals require Rust edition 2021 or later.

```rust
const HELLO: &core::ffi::CStr = c"Hello, world!";
```

C strings may contain any byte other than `NUL` (`b'\x00'`), and their in-memory representation is guaranteed to end with `NUL`.

## Implementation

Originally implemented by PR https://github.com/rust-lang/rust/pull/108801, which was reverted due to unintentional changes to lexer behavior in Rust editions < 2021.

The current implementation landed in PR https://github.com/rust-lang/rust/pull/113476, which restricts C string literals to Rust edition >= 2021.

## Resolutions to open questions from the RFC

* Adding C character literals (`c'.'`) of type `c_char` is not part of this feature.
  * Support for `c"..."` literals does not prevent `c'.'` literals from being added in the future.
* C string literals should not be blocked on making `&CStr` a thin pointer.
  * It's possible to declare constant expressions of type `&'static CStr` in stable Rust (as of v1.59), so C string literals are not adding additional coupling on the internal representation of `CStr`.
* The unstable `concat_bytes!` macro should not accept `c"..."` literals.
  * C strings have two equally valid `&[u8]` representations (with or without terminal `NUL`), so allowing them to be used in `concat_bytes!` would be ambiguous.
* Adding a type to represent C strings containing valid UTF-8 is not part of this feature.
  * Support for a hypothetical `&Utf8CStr` may be explored in the future, should such a type be added to Rust.
2023-12-01 13:33:55 +00:00
dfireBird
b7effe54ee
fix close parens position to move after field access 2023-12-01 18:55:26 +05:30
hkalbasi
4d55cac466 Initial support for implicit drop inlay hint 2023-12-01 16:16:46 +03:30
bors
caf7300432 Auto merge of #118216 - lqd:constraint-generation-non-non, r=matthewjasper
Refactor NLL constraint generation and most of polonius fact generation

As discussed in #118175, NLL "constraint generation" is only about liveness, but currently also contains legacy polonius fact generation. The latter is quite messy, and this PR cleans this up to prepare for its future removal:

- splits polonius fact generation out of NLL constraint generation
- merges NLL constraint generation to its more natural place, liveness
- extracts all of the polonius fact generation from NLLs apart from MIR typeck (as fact generation is somewhat in a single place there already, but should be cleaned up) into its own explicit module, with a single entry point instead of many.

There should be no behavior changes, and tests seem to behave the same as master: without polonius, with legacy polonius, with the in-tree polonius.

I've split everything into smaller logical commits for easier review, as it required quite a bit of code to be split and moved around, but it should all be trivial changes.

r? `@matthewjasper`
2023-12-01 11:33:43 +00:00
bors
c2f133489c Auto merge of #15912 - Sarrus1:master, r=HKalbasi
chore: remove unused `PhantomData`

This PR removes an unused `PhantomData` in `FileItemTreeId`.

*Note:* I am not sure how this should be implemented, maybe as a type instead of a wrapper struct? I'd be happy to do so if needed 👍
2023-12-01 11:07:35 +00:00
bors
57e90240a5 Auto merge of #15961 - ohno418:top-level-let-stmt, r=Veykril
Improve error handling for top-level `let` statements

This commit addresses the issue of excessive and unrelated errors generated by top-level `let` statements. Now, only a single error is produced, indicating that `let` statements are invalid at the top level.

---

Fixes https://github.com/rust-lang/rust-analyzer/issues/14963.

While I'm not really sure if handling a particular case in a special manner is appropriate, it would be good to suppress the excessive number of annoying and unrelated errors.
2023-12-01 10:41:16 +00:00
Guillaume Gomez
06695ea436 Update snapshots of rustdoc tests to take into account the comment highlighting 2023-12-01 11:35:01 +01:00
Guillaume Gomez
768a614380 Add GUI tests for comments highlighting in items declaration 2023-12-01 11:23:38 +01:00
Guillaume Gomez
05bf5b764a Add highlighting for comments in items declaration 2023-12-01 11:23:38 +01:00
Ralf Jung
f2dc18d0a1 update addr docs 2023-12-01 08:35:23 +01:00
bors
9bf30ebdfa Auto merge of #118493 - TaKO8Ki:rollup-jfkdbyo, r=TaKO8Ki
Rollup of 3 pull requests

Successful merges:

 - #118483 (rustdoc: `div.where` instead of fmt-newline class)
 - #118486 (generic_const_exprs: suggest to add the feature, not use it)
 - #118489 (Wesley is on vacation)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-12-01 06:32:25 +00:00
bors
d166fab544 Auto merge of #11898 - clubby789:upper_case_acronyms_variants, r=Manishearth
Allow `allow`ing `upper_case_acronyms` on enum variants

Fixes #7708

changelog: [`upper_case_acronyms`]: allow `allow`ing on enum variants
2023-12-01 05:29:52 +00:00
Takayuki Maeda
65026fae88
Rollup merge of #118489 - wesleywiser:vacation, r=wesleywiser
Wesley is on vacation

OOF until Dec-11 🏖️
2023-12-01 13:47:43 +09:00
Takayuki Maeda
8b6e9cace3
Rollup merge of #118486 - RalfJung:add-feature, r=compiler-errors
generic_const_exprs: suggest to add the feature, not use it

Usually our missing feature messages look something like
```
  = help: add `#![feature(inline_const)]` to the crate attributes to enable
```
However `generic_const_exprs` used a different verb. That's inconsistent and it also means playground won't add that nice hyperlink to add the feature automatically. So let's use the same verb as everywhere else.
2023-12-01 13:47:42 +09:00
Takayuki Maeda
a030add411
Rollup merge of #118483 - notriddle:notriddle/fmt-newline, r=GuillaumeGomez
rustdoc: `div.where` instead of fmt-newline class

This is about equally readable, a lot more terse, and stops special-casing functions and methods.

```console
$ du -hs doc-old/ doc-new/
671M    doc-old/
670M    doc-new/
```
2023-12-01 13:47:42 +09:00
bohan
d0941f92d7 vis note for no pub reexports glob import 2023-12-01 12:10:07 +08:00
bors
a1c65db95c Auto merge of #118482 - RalfJung:interpret-local-type, r=WaffleLapkin
explain a good reason for why LocalValue does not store the type of the local

As found out by `@lcnr` in https://github.com/rust-lang/rust/pull/112307, storing the type here can lead to subtle bugs when it gets out of sync with the MIR body. That's not the reason why the interpreter does it this way I think, but good thing we dodged that bullet. :)
2023-12-01 04:08:22 +00:00
bors
c263ccf185 Auto merge of #118461 - celinval:smir-switch-targets, r=ouz-a
Change `SwitchTarget` representation in StableMIR

The new structure encodes its invariant, which reduces the likelihood of having an inconsistent representation. It is also more intuitive and user friendly.

I encapsulated the structure for now in case we decide to change it back.

### Notes:

1. I had to change the `Successors` type, since there's a conflict on the iterator type. We could potentially implement an iterator here, but I would prefer keeping it simple for now, and add a `successors_iter()` method if needed.
2. I removed `CoroutineDrop` for now since it we never create it. We can add it when we add support to other MIR stages.
2023-12-01 02:08:51 +00:00
Yutaro Ohno
e076192dd8 Improve error handling for top-level let statements
This commit addresses the issue of excessive and unrelated errors
generated by top-level `let` statements. Now, only a single error is
produced, indicating that `let` statements are invalid at the top level.
2023-12-01 10:37:21 +09:00
bors
1d726a2be0 Auto merge of #118472 - nnethercote:rustc_session, r=bjorn3
`rustc_session` cleanups

r? `@bjorn3`
2023-12-01 00:08:04 +00:00
Wesley Wiser
d9c645561d Wesley is on vacation 2023-11-30 16:55:24 -06:00
bors
f45631b10f Auto merge of #116892 - ojeda:rethunk, r=wesleywiser
Add `-Zfunction-return={keep,thunk-extern}` option

This is intended to be used for Linux kernel RETHUNK builds.

With this commit (optionally backported to Rust 1.73.0), plus a patched Linux kernel to pass the flag, I get a RETHUNK build with Rust enabled that is `objtool`-warning-free and is able to boot in QEMU and load a sample Rust kernel module.

Issue: https://github.com/rust-lang/rust/issues/116853.
2023-11-30 22:10:30 +00:00
Ralf Jung
dbea549d80 move exposed-provenance APIs into separate feature gate and explain the relationship of Exposed Provenance and Strict Provenance 2023-11-30 22:49:13 +01:00
Nicholas Nethercote
275b793c33 Clarify the lockfile field in IncrCompSession. 2023-12-01 08:00:56 +11:00
Nicholas Nethercote
e065d96b08 Remove unused field from IncrCompSession. 2023-12-01 08:00:56 +11:00
Nicholas Nethercote
4b90b26fd8 Move WasiExecModel.
All the other option enums are defined in `config.rs`.
2023-12-01 08:00:56 +11:00
Nicholas Nethercote
5f11d19be5 Reduce pub exposure. 2023-12-01 08:00:53 +11:00
bors
87e1447aad Auto merge of #117805 - estebank:arg-fn-mismatch, r=petrochenkov
On Fn arg mismatch for a fn path, suggest a closure

When encountering a fn call that has a path to another fn being passed in, where an `Fn` impl is expected, and the arguments differ, suggest wrapping the argument with a closure with the appropriate arguments.

The last `help` is new:

```
error[E0631]: type mismatch in function arguments
  --> $DIR/E0631.rs:9:9
   |
LL |     fn f(_: u64) {}
   |     ------------ found signature defined here
...
LL |     foo(f);
   |     --- ^ expected due to this
   |     |
   |     required by a bound introduced by this call
   |
   = note: expected function signature `fn(usize) -> _`
              found function signature `fn(u64) -> _`
note: required by a bound in `foo`
  --> $DIR/E0631.rs:3:11
   |
LL | fn foo<F: Fn(usize)>(_: F) {}
   |           ^^^^^^^^^ required by this bound in `foo`
help: consider wrapping the function in a closure
   |
LL |     foo(|arg0: usize| f(/* u64 */));
   |         +++++++++++++  +++++++++++
```
2023-11-30 20:12:53 +00:00
Ralf Jung
1dbfe17f12 generic_const_exprs: suggest to add the feature, not use it 2023-11-30 20:59:51 +01:00
Celina G. Val
9d2c92377d Fix SwitchTarget pretty print
We currently rely on the order of successors to be conditional branches
first, followed by the otherwise target.
2023-11-30 11:45:34 -08:00
Celina G. Val
3e0b2fac5d Change SwitchTarget representation
The new structure encodes its invariant, which reduces the likelihood
of having an inconsistent representation. It is also more intuitive and
user friendly.

I encapsulated the structure for now in case we decide to change it back.
2023-11-30 11:45:34 -08:00
bors
c9d189d137 Auto merge of #15993 - meowtec:fix/workspaces-debug-cwd, r=Veykril
Debug use cargo workspace root as `cwd`

fixes #13022
2023-11-30 19:31:15 +00:00
Miguel Ojeda
2d476222e8 Add -Zfunction-return={keep,thunk-extern} option
This is intended to be used for Linux kernel RETHUNK builds.

With this commit (optionally backported to Rust 1.73.0), plus a
patched Linux kernel to pass the flag, I get a RETHUNK build with
Rust enabled that is `objtool`-warning-free and is able to boot in
QEMU and load a sample Rust kernel module.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2023-11-30 20:21:31 +01:00
bors
00796255c2 Auto merge of #118448 - ZetaNumbers:link_arg_attribute, r=petrochenkov
Enable `link-arg` link kind inside of `#[link]` attribute

https://github.com/rust-lang/rust/issues/99427#issuecomment-1234443468

> ...
> This would help to make `link-arg` usable in `#[link]` attributes and e.g. wrap libc and libgcc into a group (*) in the libc crate like
>
> ```
> #[link(kind = "link-arg", name = "--start-group")]
> #[link(kind = "static", name = "c")]
> #[link(kind = "static", name = "gcc")]
> #[link(kind = "link-arg", name = "--end-group")]
> ```
>
> (*) to address cyclic dependencies between them
>
> This is an analogue of CMake's LINKER: prefix (https://cmake.org/cmake/help/git-stage/command/target_link_options.html#handling-compiler-driver-differences), and was discussed as a possible future extension in the link modifier RFC (https://github.com/rust-lang/rfcs/blob/master/text/2951-native-link-modifiers.md#support-linkarg--string-in-addition-to-the-modifiers).
2023-11-30 18:09:45 +00:00