Commit Graph

248059 Commits

Author SHA1 Message Date
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
The Miri Conjob Bot
1b41d791f9 Merge from rustc 2024-02-29 05:02:18 +00:00
The Miri Conjob Bot
f43c07c037 Preparing for merge from rustc 2024-02-29 04:55:07 +00: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
yukang
e2ce5d74a5 renaming test cases 2024-02-29 08:46:00 +08:00
Veera
cc13f8278f Update item order in test 2024-02-28 19:28:34 -05:00
Veera
3ba50b36e7 Avoid code duplication 2024-02-28 19:28:34 -05:00
Veera
49961947c8 Improve error messages for generics with default parameters
Fixes #120785
2024-02-28 19:28:18 -05:00
yukang
e6f48fa0bb Suggest removing superfluous semicolos when statements used as expressions 2024-02-29 08:24:00 +08: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
许杰友 Jieyou Xu (Joe)
a1dbb61c09
Unify long type name file and note in note_obligation_cause_code 2024-02-28 19:54:05 +00:00
joboet
45ca53f9d8
std: move thread local implementation to sys 2024-02-28 19:12:29 +01:00
Trevor Gross
406790e9d1 Add a basic test for f16 and f128 2024-02-28 12:58:32 -05:00
Trevor Gross
c17a516a3a Add stubs for f16 and f128 to miri 2024-02-28 12:58:32 -05:00
Trevor Gross
ae70502a2e Add stubs for f16 and f128 to clippy 2024-02-28 12:58:32 -05:00
Trevor Gross
98e172832f Add basic support for f16 and f128 to rustdoc 2024-02-28 12:58:32 -05:00
Trevor Gross
e3f63d9375 Add f16 and f128 to rustc_type_ir::FloatTy and rustc_abi::Primitive
Make changes necessary to support these types in the compiler.
2024-02-28 12:58:32 -05: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
Nadrieril
d6332ae79c Separate the bool case from other integers in TestKind 2024-02-28 18:23:26 +01:00
bors
d79a5ed904 Auto merge of #3334 - RalfJung:nullfix, r=RalfJung
remove a wrong bitwise negation

This is a silly mistake I introduced in a1233a721d.
2024-02-28 17:14:31 +00:00
Nadrieril
c918893b63 Rename Skip to PrivateUninhabited 2024-02-28 17:56:01 +01:00
Gil Shoshan
bf8756d2dd
Don't lint snake-case on executable crate name
Co-authored-by: Jieyou Xu <jieyouxu@outlook.com>
2024-02-28 16:55:00 +00:00