Commit Graph

247627 Commits

Author SHA1 Message Date
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
Nicholas Nethercote
607bf653c2 Avoid unnecessary color local variable. 2024-02-29 20:12:43 +11: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
a9596fbf2a make mutable_references_err not bitwidth-dependent 2024-02-29 09:34:15 +01:00
Ralf Jung
3cc8c8d44b allow statics pointing to mutable statics 2024-02-29 09:34:15 +01: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
Nicholas Nethercote
58f45059a5 Add a useful comment.
It took me a while to work this out.
2024-02-29 17:50:26 +11:00
Nicholas Nethercote
9ff4487999 Make JsonEmitter more like HumanEmitter.
Use `derive(Setters)` to derive setters, and then change
`JsonEmitter::new` to only have the arguments that are always used.
2024-02-29 17:50:26 +11:00
Nicholas Nethercote
2999d8dc72 Inline and remove JsonEmitter::{basic,stderr}.
They are so similar to `JsonEmitter::new` it's not worth having separate
functions, it makes the code harder to read.
2024-02-29 17:50:26 +11:00
Nicholas Nethercote
067d7c3d00 Inline and remove HumanEmitter::stderr.
Because `HumanEmitter::new` is enough, in conjunction with the (renamed)
`stderr_destination` function.
2024-02-29 17:50:23 +11:00
Ibraheem Ahmed
7c9fa952c3
fix typos
Co-authored-by: Ralf Jung <post@ralfj.de>
2024-02-29 01:33:02 -05:00
Nicholas Nethercote
437325bdd4 Inline and remove HumanReadableErrorType::new_emitter.
And likewise with `ColorConfig::suggests_using_colors`. They both have a
single call site. And note that `BufWriter::supports_color()` always
returns false, which enables a small bit of constant folding along the
way.
2024-02-29 17:16:27 +11: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
Nicholas Nethercote
d3727413ed Merge HumanEmitter::{new,create}.
They have the same signature, and the former just calls the latter.
2024-02-29 16:30:12 +11:00
Nicholas Nethercote
880c1c585f Rename DiagCtxt::with_emitter as DiagCtxt::new.
Because it's now the only constructor.
2024-02-29 16:30:12 +11:00
Nicholas Nethercote
f9eef38e32 Inline and remove DiagCtxt::with_tty_emitter
It only has two call sites, and one of those doesn't set the source map.
2024-02-29 16:30:12 +11:00
Nicholas Nethercote
ca5b79ddf7 Remove unnecessary output local variable. 2024-02-29 16:30:12 +11:00
Nicholas Nethercote
805e50e71b Remove unnecessary diagnostic_width call.
This `HumanEmitter` is only created to test if it supports colour. The
diagnostic width isn't relevant.
2024-02-29 16:30:12 +11:00
Nicholas Nethercote
3c3f15cafe Use Destination more. 2024-02-29 16:30:12 +11:00
Nicholas Nethercote
869bd03a04 Simplify UnusedExterns lifetimes.
In practice, 'a and 'b and 'c are always the same. This change makes
`UnusedExterns` more like `ArtifactNotification`, which uses a single
lifetime 'a in multiple ways.
2024-02-29 16:30:12 +11:00
Nicholas Nethercote
c1f01638af Minor visibility and formatting improvements. 2024-02-29 16:30:09 +11:00
sisungo
9dfe5ef8b5
Fix typo in rustc_passes/messages.ftl
Line 190 contains unpaired parentheses.
2024-02-29 13:16:24 +08:00
r0cky
88b9e7a602 Bless test 2024-02-29 10:55:05 +08:00
r0cky
61fcdf6655 Add proper cfg 2024-02-29 09:25:28 +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
82961c0abc Reinstate emit_stashed_diagnostics in DiagCtxtInner::drop.
I removed it in #121206 because I thought thought it wasn't necessary.
But then I had to add an `emit_stashed_diagnostics` call elsewhere in
rustfmt to avoid the assertion failure (which took two attempts to get
right, #121487 and #121615), and now there's an assertion failure in
clippy as well (https://github.com/rust-lang/rust-clippy/issues/12364).

So this commit just reinstates the call in `DiagCtxtInner::drop`. It
also reverts the rustfmt changes from #121487 and #121615, though it
keeps the tests added for those PRs.
2024-02-29 11:08:29 +11:00
Nicholas Nethercote
9aff357e53 Stop miri if delayed bugs are present.
Seems wise, since it shouldn't proceed in that case.
2024-02-29 11:08:29 +11:00
Nicholas Nethercote
b4e9f93eb4 Mark some once-again-unreachable paths as unreachable.
This undoes the changes from #121482 and #121586, now that stashed errors
will trigger more early aborts.
2024-02-29 11:08:29 +11:00
Nicholas Nethercote
260ae70140 Overhaul how stashed diagnostics work, again.
Stashed errors used to be counted as errors, but could then be
cancelled, leading to `ErrorGuaranteed` soundness holes. #120828 changed
that, closing the soundness hole. But it introduced other difficulties
because you sometimes have to account for pending stashed errors when
making decisions about whether errors have occured/will occur and it's
easy to overlook these.

This commit aims for a middle ground.
- Stashed errors (not warnings) are counted immediately as emitted
  errors, avoiding the possibility of forgetting to consider them.
- The ability to cancel (or downgrade) stashed errors is eliminated, by
  disallowing the use of `steal_diagnostic` with errors, and introducing
  the more restrictive methods `try_steal_{modify,replace}_and_emit_err`
  that can be used instead.

Other things:
- `DiagnosticBuilder::stash` and `DiagCtxt::stash_diagnostic` now both
  return `Option<ErrorGuaranteed>`, which enables the removal of two
  `delayed_bug` calls and one `Ty::new_error_with_message` call. This is
  possible because we store error guarantees in
  `DiagCtxt::stashed_diagnostics`.
- Storing the guarantees also saves us having to maintain a counter.
- Calls to the `stashed_err_count` method are no longer necessary
  alongside calls to `has_errors`, which is a nice simplification, and
  eliminates two more `span_delayed_bug` calls and one FIXME comment.
- Tests are added for three of the four fixed PRs mentioned below.
- `issue-121108.rs`'s output improved slightly, omitting a non-useful
  error message.

Fixes #121451.
Fixes #121477.
Fixes #121504.
Fixes #121508.
2024-02-29 11:08:27 +11: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
Nicholas Nethercote
ec25d6db53 Don't cancel stashed TraitMissingMethod errors.
This gives one extra error message on two tests, but is necessary to fix
bigger problems caused by the cancellation of stashed errors.

(Note: why not just avoid stashing altogether? Because that resulted in
additional output changes.)
2024-02-29 11:05:40 +11:00
Nicholas Nethercote
c4ec196c7e Don't cancel stashed OpaqueHiddenTypeMismatch errors.
This gives one extra error message on one test, but is necessary to fix
bigger problems caused by the cancellation of stashed errors.

(Note: why not just avoid stashing altogether? Because that resulted in
additional output changes.)
2024-02-29 11:05:38 +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
Trevor Gross
406790e9d1 Add a basic test for f16 and f128 2024-02-28 12:58:32 -05:00