Commit Graph

247550 Commits

Author SHA1 Message Date
León Orell Valerian Liehr
2b8060578a
AST: Refactor type alias where clauses 2024-02-29 17:18:40 +01:00
bors
384d26fc7e Auto merge of #121800 - GuillaumeGomez:rollup-wob2qcz, r=GuillaumeGomez
Rollup of 10 pull requests

Successful merges:

 - #118217 (Document which methods on `f64` are precise)
 - #119748 (Increase visibility of `join_path` and `split_paths`)
 - #121412 (platform docs: clarify hexagon-unknown-none-elf example, add hexagon-unknown-linux-musl)
 - #121654 (Fix `async Fn` confirmation for `FnDef`/`FnPtr`/`Closure` types)
 - #121700 (CFI: Don't compress user-defined builtin types)
 - #121765 (add platform-specific function to get the error number for HermitOS)
 - #121781 (bootstrap/format: send larger batches to rustfmt)
 - #121788 (bootstrap: fix clap deprecated warnings)
 - #121792 (Improve renaming suggestion when item starts with underscore)
 - #121793 (Document which methods on `f32` are precise)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-29 13:35:16 +00:00
Guillaume Gomez
bc23b84386
Rollup merge of #121793 - tbu-:pr_floating_point_32, r=Amanieu
Document which methods on `f32` are precise

Same as #118217 but for `f32`.
2024-02-29 14:33:53 +01:00
Guillaume Gomez
8a74df9c22
Rollup merge of #121792 - GuillaumeGomez:improve-suggestion, r=michaelwoerister
Improve renaming suggestion when item starts with underscore

Fixes https://github.com/rust-lang/rust/issues/121776.

It goes from:

```terminal
error[E0433]: failed to resolve: use of undeclared type `Foo`
 --> src/foo.rs:6:13
  |
6 |     let _ = Foo::Bar;
  |             ^^^ use of undeclared type `Foo`
  |
help: an enum with a similar name exists, consider changing it
  |
1 | enum Foo {
  |      ~~~
```

to:

```terminal
error[E0433]: failed to resolve: use of undeclared type `Foo`
 --> foo.rs:6:13
  |
6 |     let _ = Foo::Bar;
  |             ^^^ use of undeclared type `Foo`
  |
help: an enum with a similar name exists, consider renaming `_Foo` into `Foo`
  |
1 | enum Foo {
  |      ~~~

error: aborting due to 1 previous error
```
2024-02-29 14:33:53 +01:00
Guillaume Gomez
7147112c8c
Rollup merge of #121788 - klensy:clap-deprecated-fix, r=clubby789
bootstrap: fix clap deprecated warnings

Run 'cargo check --features clap/deprecated' and fix warnings
2024-02-29 14:33:52 +01:00
Guillaume Gomez
b52b6997a3
Rollup merge of #121781 - RalfJung:bootstrap-fmt, r=clubby789
bootstrap/format: send larger batches to rustfmt

This helps on systems with low core counts. To benchmark this I made a lot of files be modified:
```
for FILE in $(find compiler/ -name "*.rs"); do echo "// end of the file" >>$FILE; done
```
Then I ran
```
hyperfine "./x.py fmt -j1" -w 1 -r 4
```
Before this patch:
```
Benchmark 1: ./x.py fmt -j1
  Time (mean ± σ):      3.426 s ±  0.032 s    [User: 4.681 s, System: 1.376 s]
  Range (min … max):    3.389 s …  3.462 s    4 runs
```
With this patch:
```
Benchmark 1: ./x.py fmt -j1
  Time (mean ± σ):      2.530 s ±  0.054 s    [User: 4.042 s, System: 0.467 s]
  Range (min … max):    2.452 s …  2.576 s    4 runs
```
2024-02-29 14:33:52 +01:00
Guillaume Gomez
ad74598dbc
Rollup merge of #121765 - hermit-os:errno, r=ChrisDenton
add platform-specific function to get the error number for HermitOS

Extending `std` to get the last error number for HermitOS.

HermitOS is a tier 3 platform and this PR changes only files, wich are related to the tier 3 platform.
2024-02-29 14:33:51 +01:00
Guillaume Gomez
b2c3279984
Rollup merge of #121700 - rcvalle:rust-cfi-dont-compress-user-defined-builtin-types, r=compiler-errors
CFI: Don't compress user-defined builtin types

Doesn't compress user-defined builtin types (see https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-builtin and https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling-compression).
2024-02-29 14:33:51 +01:00
Guillaume Gomez
5978b6ff83
Rollup merge of #121654 - compiler-errors:async-fn-for-fn-def, r=oli-obk
Fix `async Fn` confirmation for `FnDef`/`FnPtr`/`Closure` types

Fixes three issues:
1. The code in `extract_tupled_inputs_and_output_from_async_callable` was accidentally getting the *future* type and the *output* type (returned by the future) messed up for fnptr/fndef/closure types. :/
2. We have a (class of) bug(s) in the old solver where we don't really support higher ranked built-in `Future` goals for generators. This is not possible to hit on stable code, but [can be hit with `unboxed_closures`](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=e935de7181e37e13515ad01720bcb899) (#121653).
    * I'm opting not to fix that in this PR. Instead, I just instantiate placeholders when confirming `async Fn` goals.
4. Fixed a bug when generating `FnPtr` shims for `async Fn` trait goals.

r? oli-obk
2024-02-29 14:33:50 +01:00
Guillaume Gomez
1ee54538a3
Rollup merge of #121412 - androm3da:bcain/update_hex_docs_03, r=Amanieu
platform docs: clarify hexagon-unknown-none-elf example, add hexagon-unknown-linux-musl
2024-02-29 14:33:50 +01:00
Guillaume Gomez
0c2cb39f95
Rollup merge of #118217 - tbu-:pr_floating_point, r=Amanieu
Document which methods on `f64` are precise
2024-02-29 14:33:49 +01:00
Tobias Bucher
7400f22d92 Document which methods on f32 are precise
Same as #118217 but for `f32`.
2024-02-29 12:38:21 +01:00
Guillaume Gomez
451fd98153 Update UI test checking suggestion message to rename type starting with underscore 2024-02-29 12:08:03 +01:00
Guillaume Gomez
3770cf7abf Improve suggestion to rename type starting with underscore to make it more obvious what is actually suggested 2024-02-29 12:07:41 +01:00
Tobias Bucher
b5307f5d95 Document the precision of f64 methods 2024-02-29 11:58:13 +01:00
bors
71a7b66f20 Auto merge of #121790 - jhpratt:rollup-yocg203, r=jhpratt
Rollup of 10 pull requests

Successful merges:

 - #119748 (Increase visibility of `join_path` and `split_paths`)
 - #120291 (Have `String` use `SliceIndex` impls from `str`)
 - #121723 (Two diagnostic things)
 - #121740 (Changing some attributes to only_local.)
 - #121745 (Deeply normalize obligations in `refining_impl_trait`)
 - #121748 (Restore the standard library review rotation to its former glory)
 - #121768 (Implement unwind safety for Condvar on all platforms )
 - #121777 (Fix typo in `rustc_passes/messages.ftl`)
 - #121778 (Document potential memory leak in unbounded channel)
 - #121779 (Remove unused diagnostic struct)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-29 10:28:59 +00:00
Jacob Pratt
698cec8d61
Rollup merge of #121779 - mu001999:clean, r=Nilstrieb
Remove unused diagnostic struct

Detected by #121752
2024-02-29 05:25:30 -05:00
Jacob Pratt
20a1bf6c17
Rollup merge of #121778 - ibraheemdev:patch-19, r=RalfJung
Document potential memory leak in unbounded channel

Follow up on https://github.com/rust-lang/rust/pull/121646.
2024-02-29 05:25:29 -05:00
Jacob Pratt
d6e0f5cb0c
Rollup merge of #121777 - sisungo:master, r=oli-obk
Fix typo in `rustc_passes/messages.ftl`

Line 190 contains unpaired parentheses:

```
passes_doc_cfg_hide_takes_list =
    `#[doc(cfg_hide(...)]` takes a list of attributes
```

The `#[doc(cfg_hide(...)]` contains unpaired parentheses. This PR changes it to `#[doc(cfg_hide(...))]`, which made the parentheses paired.
2024-02-29 05:25:29 -05:00
Jacob Pratt
769eb2cd61
Rollup merge of #121768 - ecton:condvar-unwindsafe, r=m-ou-se
Implement unwind safety for Condvar on all platforms

Closes #118009

This commit adds unwind safety consistency to Condvar. Previously, only select platforms implemented unwind safety through auto traits. Known by this committer: On Linux, `Condvar` implemented `UnwindSafe` but on Mac and Windows, it did not. This change changes the implementation from auto to explicit.

In #118009, it was suggested that the platform differences were a bug and that a simple PR could address this. In trying to determine the best information to put in the `#[stable]` attribute, it [was suggested](https://github.com/rust-lang/rust/issues/121690#issuecomment-1968298470) I copy the stability information from the previous unwind safety implementations.
2024-02-29 05:25:29 -05:00
Jacob Pratt
b55347aa11
Rollup merge of #121748 - Amanieu:restore-libs-rotation, r=Amanieu
Restore the standard library review rotation to its former glory

This adds 7 reviewers to the standard library review rotation, bringing the total back up to 10 people. Specifically:

* On the main rotation: ``@cuviper`` ``@Mark-Simulacrum`` ``@m-ou-se`` ``@Amanieu`` ``@Nilstrieb`` ``@workingjubilee`` ``@joboet`` ``@jhpratt``
* For `core` only: ``@scottmcm``
* For `std` only: ``@ChrisDenton``

For everyone pinged here, please confirm that you are happy to be added to the review rotation.
2024-02-29 05:25:28 -05:00
Jacob Pratt
23351388d0
Rollup merge of #121745 - compiler-errors:refining-impl-trait-deeply-norm, r=lcnr
Deeply normalize obligations in `refining_impl_trait`

We somewhat awkwardly use semantic comparison when checking the `refining_impl_trait` lint. This relies on us being able to normalize bounds eagerly to avoid cases where an unnormalized alias is not considered equal to a normalized alias. Since `normalize` in the new solver is a noop, let's use `deeply_normalize` instead.

r? lcnr

cc ``@tmandry,`` this should fix your bug lol
2024-02-29 05:25:28 -05:00
Jacob Pratt
69716291c3
Rollup merge of #121740 - surechen:change_attribute_to_local_20240228, r=lcnr
Changing some attributes to only_local.

Modified according to https://github.com/rust-lang/compiler-team/issues/505.

r?  ``@lcnr``
2024-02-29 05:25:27 -05:00
Jacob Pratt
b098b17b47
Rollup merge of #121723 - nnethercote:two-diagnostic-things, r=oli-obk
Two diagnostic things

Two minor improvements to diagnostics-related things.

r? ``@RalfJung``
2024-02-29 05:25:27 -05:00
Jacob Pratt
6d865038a5
Rollup merge of #120291 - pitaj:string-sliceindex, r=Amanieu
Have `String` use `SliceIndex` impls from `str`

This PR simplifies the implementation of `Index` and `IndexMut` on `String`, and in the process enables indexing `String` by any user types that implement `SliceIndex<str>`.

Similar to #47832

r? libs

Not sure if this warrants a crater run.
2024-02-29 05:25:26 -05:00
Jacob Pratt
06d487888b
Rollup merge of #119748 - tgross35:suggest-path-split, r=Amanieu
Increase visibility of `join_path` and `split_paths`

Add some crosslinking among `std::env` pages to make it easier to discover `join_paths` and `split_paths`. Also add aliases to help anyone searching for `PATH`.
2024-02-29 05:25:26 -05:00
klensy
f2d9bfb35f fix clap warnings
Run 'cargo check --features clap/deprecated' and fix warnings
2024-02-29 13:05:43 +03:00
Amanieu d'Antras
ad4c932ac4 Restore the standard library review rotation to its former glory 2024-02-29 08:58:58 +00:00
Ralf Jung
c54d92c56e bootstrap/format: send larger batches to rustfmt 2024-02-29 08:01:06 +01:00
sisungo
da37c8f1f2
Fix tests that are affected by this change 2024-02-29 14:59:10 +08:00
Ibraheem Ahmed
7c9fa952c3
fix typos
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-02-29 01:33:02 -05:00
r0cky
1850ba7f54 Remove unused diagnostic struct 2024-02-29 14:14:21 +08:00
Ibraheem Ahmed
9c6a0766be
document potential memory leak in unbounded channel 2024-02-29 00:56:31 -05:00
sisungo
9dfe5ef8b5
Fix typo in rustc_passes/messages.ftl
Line 190 contains unpaired parentheses.
2024-02-29 13:16:24 +08:00
bors
d3d145ea1c Auto merge of #121770 - matthiaskrgr:rollup-wdher8r, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #110543 (Make `ReentrantLock` public)
 - #121689 ([rustdoc] Prevent inclusion of whitespace character after macro_rules ident)
 - #121724 (Use `LitKind::Err` for malformed floats)
 - #121735 (pattern analysis: Don't panic when encountering unexpected constructor)
 - #121743 (Opportunistically resolve regions when processing region outlives obligations)

Failed merges:

 - #121326 (Detect empty leading where clauses on type aliases)
 - #121416 (Improve error messages for generics with default parameters)
 - #121669 (Count stashed errors again)
 - #121723 (Two diagnostic things)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-29 00:53:39 +00:00
Nicholas Nethercote
199be469ec Refactor DiagCtxtInner::flush_delayed.
This commit:
- Moves the ICE file create/open outside the loop. (Redoing it on every
  loop iteration works, but is really weird.)
- Moves the explanatory note emission above the loop, which removes the
  need for the `enumerate` call.
- Introduces a `decorate` local.
2024-02-29 11:07:42 +11:00
Nicholas Nethercote
3fbdec4937 Add a comment about how IntoDiagnostic should be impl'd. 2024-02-29 11:07:08 +11:00
Matthias Krüger
9f9daed889
Rollup merge of #121743 - compiler-errors:opportunistically-resolve-regions, r=jackh726
Opportunistically resolve regions when processing region outlives obligations

Due to the matching in `TypeOutlives` being structural, we should attempt to opportunistically resolve regions before processing region obligations. Thanks ``@lcnr`` for finding this.

r? lcnr
2024-02-29 00:17:01 +01:00
Matthias Krüger
eca6a249a6
Rollup merge of #121735 - Nadrieril:no-panic-on-type-error, r=compiler-errors
pattern analysis: Don't panic when encountering unexpected constructor

Tiny PR to fix https://github.com/rust-lang/rust-analyzer/issues/16656

r? ``@compiler-errors``
2024-02-29 00:17:00 +01:00
Matthias Krüger
686a4b1c17
Rollup merge of #121724 - nnethercote:LitKind-Err-for-floats, r=fmease
Use `LitKind::Err` for malformed floats

#121120 changed `StringReader::cook_lexer_literal` to return `LitKind::Err` for malformed integer literals. This commit does the same for float literals, for consistency.

r? ``@fmease``
2024-02-29 00:17:00 +01:00
Matthias Krüger
843920f0f6
Rollup merge of #121689 - GuillaumeGomez:rustdoc-highlighting-whitespace, r=notriddle
[rustdoc] Prevent inclusion of whitespace character after macro_rules ident

Discovered this bug randomly when looking at:

![image](https://github.com/rust-lang/rust/assets/3050060/dca38047-9085-4377-bfac-f98890224be4)

We were too eagerly trying to merge tokens that shouldn't be merged together (for example if you have a code comment followed by a code comment, we merge them in one attribute to reduce the DOM size).

r? ``@notriddle``
2024-02-29 00:16:59 +01:00
Matthias Krüger
332b9be7a1
Rollup merge of #110543 - joboet:reentrant_lock, r=m-ou-se
Make `ReentrantLock` public

Implements the ACP rust-lang/libs-team#193.

``@rustbot`` label +T-libs-api +S-waiting-on-ACP
2024-02-29 00:16:58 +01:00
Jonathan Johnson
55129453c6
Implement unwind safety for Condvar
Closes #118009

This commit adds unwind safety to Condvar. Previously, only select
platforms implemented unwind safety through auto traits. Known by this
committer: Linux was unwind safe, but Mac and Windows are not before
this change.
2024-02-28 14:56:36 -08:00
Stefan Lankes
3726cbb5fe add platform-specific function to get the error number for HermitOS
Extending `std` to get the last error number for HermitOS.

HermitOS is a tier 3 platform and this PR changes only files,
wich are related to the tier 3 platform.
2024-02-28 23:01:56 +01:00
bors
c475e2303b Auto merge of #121489 - nnethercote:diag-renaming, r=davidtwco
Diagnostic renaming

Renaming various diagnostic types from `Diagnostic*` to `Diag*`. Part of https://github.com/rust-lang/compiler-team/issues/722. There are more to do but this is enough for one PR.

r? `@davidtwco`
2024-02-28 20:39:38 +00:00
Brian Cain
cd47739688 Add a platform doc for hexagon-unknown-linux-musl 2024-02-28 12:06:38 -08:00
Brian Cain
b4a07244a1 Clarify the usage example for hexagon-unknown-none-elf
The C wrapper program represents a typical use case (linking
C libraries with Rust libraries) but it was not made explicit how
this was supposed to work in the usage example.

Also: correct a table alignment error for hexagon-unknown-none-elf on the
general platform support doc.
2024-02-28 12:06:38 -08:00
bors
bf9c7a64ad Auto merge of #121741 - GuillaumeGomez:rollup-msrsrnk, r=GuillaumeGomez
Rollup of 12 pull requests

Successful merges:

 - #120051 (Add `display` method to `OsStr`)
 - #121226 (Fix issues in suggesting importing extern crate paths)
 - #121423 (Remove the `UntranslatableDiagnosticTrivial` lint.)
 - #121527 (unix_sigpipe: Simple fixes and improvements in tests)
 - #121572 (Add test case for primitive links in alias js)
 - #121661 (Changing some attributes to only_local.)
 - #121680 (Fix link generation for foreign macro in jump to definition feature)
 - #121686 (Adjust printing for RPITITs)
 - #121691 (handle unavailable creation time as `io::ErrorKind::Unsupported`)
 - #121695 (Split rustc_type_ir to avoid rustc_ast from depending on it)
 - #121698 (CFI: Fix typo in test file names)
 - #121702 (Process alias-relate obligations in CoerceUnsized loop)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-28 17:30:25 +00:00
Michael Goulet
75e15f7cf4 Deeply normalize obligations in refining_impl_trait 2024-02-28 16:09:29 +00:00
Michael Goulet
5cdbe83af8 Opportunistically resolve regions when processing region outlives obligations 2024-02-28 15:44:04 +00:00