Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #98529

Closed
wants to merge 37 commits into from
Closed

Conversation

Dylan-DPC
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

joboet and others added 30 commits May 18, 2022 12:18
Unfortunately, the diagnostic lints are very broken and trigger much
more often than they should. Correct the conditional which checks if the
function call being made is to a diagnostic function so that it returns
in every intended case.

Signed-off-by: David Wood <[email protected]>
The `rustc_lint_diagnostics` attribute is used by the diagnostic
translation/struct migration lints to identify calls where
non-translatable diagnostics or diagnostics outwith impls are being
created. Any function used in creating a diagnostic should be annotated
with this attribute so this commit adds the attribute to many more
functions.

Signed-off-by: David Wood <[email protected]>
Using typed identifiers instead of strings with the Fluent identifier
enables the diagnostic derive to benefit from the compile-time
validation that comes with typed identifiers - use of a non-existent
Fluent identifier will not compile.

Signed-off-by: David Wood <[email protected]>
As in the diagnostic derive, using typed identifiers in the
subdiagnostic derive improves the diagnostics of using the subdiagnostic
derive as Fluent messages will be confirmed to exist at compile-time.

Signed-off-by: David Wood <[email protected]>
Now that typed identifiers are used in both derives, constructors for
the `DiagnosticMessage` and `SubdiagnosticMessage` types are not
required.

Signed-off-by: David Wood <[email protected]>
Add `struct FileTimes` to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add `File::set_file_time` to set the timestamps for a `File`.

Implement the `sys` backends for UNIX, macOS (which needs to fall back
to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
and WASI.
This would otherwise silently ignore the attempt, since 0 serves as a
flag to not set a timestamp.
std: use an event-flag-based thread parker on SOLID

`Mutex` and `Condvar` are being replaced by more efficient implementations, which need thread parking themselves (see rust-lang#93740). Therefore, the generic `Parker` needs to be replaced on all platforms where the new lock implementation will be used, which, after rust-lang#96393, are SOLID, SGX and Hermit (more PRs coming soon).

SOLID, conforming to the [μITRON specification](http://www.ertl.jp/ITRON/SPEC/FILE/mitron-400e.pdf), has event flags, which are a thread parking primitive very similar to `Parker`. However, they do not make any atomic ordering guarantees (even though those can probably be assumed) and necessitate a system call even when the thread token is already available. Hence, this `Parker`, like the Windows parker, uses an extra atomic state variable.

I future-proofed the code by wrapping the event flag in a `WaitFlag` structure, as both SGX and Hermit can share the Parker implementation, they just have slightly different primitives (SGX uses signals and Hermit has a thread blocking API).

`@kawadakk` I assume you are the target maintainer? Could you test this for me?
…ompiler-errors

[rustc_parse] Forbid `let`s in certain places

Currently only forbids in locals to resolve rust-lang#94927 (comment) but feel free to point any other places.
… r=tmiasko

Simplify memory ordering intrinsics

This changes the names of the atomic intrinsics to always fully include their memory ordering arguments.

```diff
- atomic_cxchg
+ atomic_cxchg_seqcst_seqcst

- atomic_cxchg_acqrel
+ atomic_cxchg_acqrel_release

- atomic_cxchg_acqrel_failrelaxed
+ atomic_cxchg_acqrel_relaxed

// And so on.
```

- `seqcst` is no longer implied
- The failure ordering on chxchg is no longer implied in some cases, but now always explicitly part of the name.
- `release` is no longer shortened to just `rel`. That was especially confusing, since `relaxed` also starts with `rel`.
- `acquire` is no longer shortened to just `acq`, such that the names now all match the `std::sync::atomic::Ordering` variants exactly.
- This now allows for more combinations on the compare exchange operations, such as `atomic_cxchg_acquire_release`, which is necessary for rust-lang#68464.
- This PR only exposes the new possibilities through unstable intrinsics, but not yet through the stable API. That's for [a separate PR](rust-lang#98383) that requires an FCP.

Suffixes for operations with a single memory order:

| Order   | Before       | After      |
|---------|--------------|------------|
| Relaxed | `_relaxed`   | `_relaxed` |
| Acquire | `_acq`       | `_acquire` |
| Release | `_rel`       | `_release` |
| AcqRel  | `_acqrel`    | `_acqrel`  |
| SeqCst  | (none)       | `_seqcst`  |

Suffixes for compare-and-exchange operations with two memory orderings:

| Success | Failure | Before                   | After              |
|---------|---------|--------------------------|--------------------|
| Relaxed | Relaxed | `_relaxed`               | `_relaxed_relaxed` |
| Relaxed | Acquire | ❌                      | `_relaxed_acquire` |
| Relaxed | SeqCst  | ❌                      | `_relaxed_seqcst`  |
| Acquire | Relaxed | `_acq_failrelaxed`       | `_acquire_relaxed` |
| Acquire | Acquire | `_acq`                   | `_acquire_acquire` |
| Acquire | SeqCst  | ❌                      | `_acquire_seqcst`  |
| Release | Relaxed | `_rel`                   | `_release_relaxed` |
| Release | Acquire | ❌                      | `_release_acquire` |
| Release | SeqCst  | ❌                      | `_release_seqcst`  |
| AcqRel  | Relaxed | `_acqrel_failrelaxed`    | `_acqrel_relaxed`  |
| AcqRel  | Acquire | `_acqrel`                | `_acqrel_acquire`  |
| AcqRel  | SeqCst  | ❌                      | `_acqrel_seqcst`   |
| SeqCst  | Relaxed | `_failrelaxed`           | `_seqcst_relaxed`  |
| SeqCst  | Acquire | `_failacq`               | `_seqcst_acquire`  |
| SeqCst  | SeqCst  | (none)                   | `_seqcst_seqcst`   |
… r=estebank

make const_err show up in future breakage reports

As tracked in rust-lang#71800, const_err should become a hard error Any Day Now (TM). I'd love to move forward with that sooner rather than later; it has been deny-by-default for many years and a future incompat lint since rust-lang#80394 (landed more than a year ago). Some CTFE errors are already hard errors since rust-lang#86194. But before we truly make it a hard error in all cases, we now have one more intermediate step we can take -- to make it show up in future breakage reports.

Cc `@rust-lang/wg-const-eval`
…_ops_constness, r=scottmcm

Stabilize NonZero* checked operations constness.

Partial stabilization for rust-lang#97547 (continued).
Support setting file accessed/modified timestamps

Add `struct FileTimes` to contain the relevant file timestamps, since
most platforms require setting all of them at once. (This also allows
for future platform-specific extensions such as setting creation time.)

Add `File::set_file_time` to set the timestamps for a `File`.

Implement the `sys` backends for UNIX, macOS (which needs to fall back
to `futimes` before macOS 10.13 because it lacks `futimens`), Windows,
and WASI.
…notriddle

Transform help popup into a pocket menu

Just like we moved the settings menu into a "pocket menu", it's doing the same to the help popup.

You can test it [here](https://rustdoc.crud.net/imperio/help-pocket-menu/doc/foo/index.html) and here is a screenshot:

![Screenshot from 2022-06-20 20-58-29](https://user-images.githubusercontent.com/3050060/174663718-538e9d11-3bf9-48b2-8909-f9bfe75af135.png)

r? ``````@jsha``````
…d-more-migration, r=compiler-errors

translation: lint fix + more migration

- Unfortunately, the diagnostic lints are very broken and trigger much more often than they should. This PR corrects the conditional which checks if the function call being made is to a diagnostic function so that it returns in every intended case.
- The `rustc_lint_diagnostics` attribute is used by the diagnostic translation/struct migration lints to identify calls where non-translatable diagnostics or diagnostics outwith impls are being created. Any function used in creating a diagnostic should be annotated with this attribute so this PR adds the attribute to many more functions.
- Port the diagnostics from the `rustc_privacy` crate and enable the lints for that crate.

r? `@compiler-errors`
…identifiers, r=oli-obk

macros: use typed identifiers in diag and subdiag derive

Using typed identifiers instead of strings with the Fluent identifiers in the diagnostic and subdiagnostic derives - this enables the diagnostic derive to benefit from the compile-time validation that comes with typed identifiers, namely that use of a non-existent Fluent identifier will not compile.

r? `@oli-obk`
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jun 26, 2022
@Dylan-DPC
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jun 26, 2022

📌 Commit 24cde0d has been approved by Dylan-DPC

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 26, 2022
@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_plugin_impl v0.0.0 (/checkout/compiler/rustc_plugin_impl)
    Checking rustc_borrowck v0.0.0 (/checkout/compiler/rustc_borrowck)
    Checking rustc_mir_transform v0.0.0 (/checkout/compiler/rustc_mir_transform)
    Checking rustc_privacy v0.0.0 (/checkout/compiler/rustc_privacy)
error: `#[error(slug = ...)]` is not a valid attribute
 --> compiler/rustc_privacy/src/errors.rs:5:25
  |
5 | #[error(code = "E0451", slug = "privacy-field-is-private")]
  |
  |
  = help: only `code` is a valid nested attributes following the slug

error: diagnostic slug not specified
 --> compiler/rustc_privacy/src/errors.rs:5:1
  |
5 | #[error(code = "E0451", slug = "privacy-field-is-private")]
  |
  |
  = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`

error: `#[label(slug = ...)]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:18:13
   |
18 |     #[label(slug = "privacy-field-is-private-is-update-syntax-label")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: `#[label(slug = ...)]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:24:13
   |
24 |     #[label(slug = "privacy-field-is-private-label")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: `#[error(slug = ...)]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:32:9
   |
32 | #[error(slug = "privacy-item-is-private")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: diagnostic slug not specified
  --> compiler/rustc_privacy/src/errors.rs:32:1
   |
32 | #[error(slug = "privacy-item-is-private")]
   |
   |
   = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`

error: `#[error(slug = ...)]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:42:9
   |
42 | #[error(slug = "privacy-unnamed-item-is-private")]
   |
   |
   = help: first argument of the attribute should be the diagnostic slug

error: diagnostic slug not specified
  --> compiler/rustc_privacy/src/errors.rs:42:1
   |
42 | #[error(slug = "privacy-unnamed-item-is-private")]
   |
   |
   = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`

error: `#[error(slug = ...)]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:51:25
   |
51 | #[error(code = "E0445", slug = "privacy-in-public-interface")]
   |
   |
   = help: only `code` is a valid nested attributes following the slug

error: `#[label = ...]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:59:5
   |
59 |     #[label = "visibility-label"]


error: diagnostic slug not specified
  --> compiler/rustc_privacy/src/errors.rs:51:1
   |
51 | #[error(code = "E0445", slug = "privacy-in-public-interface")]
   |
   |
   = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`

error: `#[error(slug = ...)]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:65:25
   |
65 | #[error(code = "E0446", slug = "privacy-in-public-interface")]
   |
   |
   = help: only `code` is a valid nested attributes following the slug

error: `#[label = ...]` is not a valid attribute
  --> compiler/rustc_privacy/src/errors.rs:73:5
   |
73 |     #[label = "visibility-label"]


error: diagnostic slug not specified
  --> compiler/rustc_privacy/src/errors.rs:65:1
   |
65 | #[error(code = "E0446", slug = "privacy-in-public-interface")]
   |
   |
   = help: specify the slug as the first argument to the attribute, such as `#[error(typeck::example_error)]`

error[E0277]: the trait bound `FieldIsPrivate: SessionDiagnostic<'_>` is not satisfied
   --> compiler/rustc_privacy/src/lib.rs:947:36
    |
947 |               self.tcx.sess.emit_err(FieldIsPrivate {
    |  ___________________________--------_^
    | |                           required by a bound introduced by this call
948 | |                 span,
949 | |                 field_name: field.name,
949 | |                 field_name: field.name,
950 | |                 variant_descr: def.variant_descr(),
956 | |                 },
957 | |             });
957 | |             });
    | |_____________^ the trait `SessionDiagnostic<'_>` is not implemented for `FieldIsPrivate`
    |
note: required by a bound in `Session::emit_err`
    |
    |
461 |     pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
    |                                             ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Session::emit_err`

error[E0277]: the trait bound `ItemIsPrivate<'_>: SessionDiagnostic<'_>` is not satisfied
    --> compiler/rustc_privacy/src/lib.rs:1081:36
     |
1081 |               self.tcx.sess.emit_err(ItemIsPrivate {
     |  ___________________________--------_^
     | |                           required by a bound introduced by this call
1082 | |                 span: self.span,
1083 | |                 kind,
1083 | |                 kind,
1084 | |                 descr: descr.to_string(),
1085 | |             });
     | |_____________^ the trait `SessionDiagnostic<'_>` is not implemented for `ItemIsPrivate<'_>`
     |
note: required by a bound in `Session::emit_err`
     |
     |
461  |     pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
     |                                             ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Session::emit_err`

error[E0277]: the trait bound `ItemIsPrivate<'_>: SessionDiagnostic<'_>` is not satisfied
    --> compiler/rustc_privacy/src/lib.rs:1257:49
     |
1257 |                     Some(name) => sess.emit_err(ItemIsPrivate { span, kind, descr: name }),
     |                                        -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `SessionDiagnostic<'_>` is not implemented for `ItemIsPrivate<'_>`
     |                                        required by a bound introduced by this call
     |
     |
note: required by a bound in `Session::emit_err`
     |
     |
461  |     pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
     |                                             ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Session::emit_err`

error[E0277]: the trait bound `UnnamedItemIsPrivate: SessionDiagnostic<'_>` is not satisfied
    --> compiler/rustc_privacy/src/lib.rs:1258:43
     |
1258 |                     None => sess.emit_err(UnnamedItemIsPrivate { span, kind }),
     |                                  -------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `SessionDiagnostic<'_>` is not implemented for `UnnamedItemIsPrivate`
     |                                  required by a bound introduced by this call
     |
     |
note: required by a bound in `Session::emit_err`
     |
     |
461  |     pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
     |                                             ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Session::emit_err`

error[E0277]: the trait bound `InPublicInterfaceTraits<'_>: SessionDiagnostic<'_>` is not satisfied
    --> compiler/rustc_privacy/src/lib.rs:1765:44
     |
1765 |                       self.tcx.sess.emit_err(InPublicInterfaceTraits {
     |  ___________________________________--------_^
     | |                                   required by a bound introduced by this call
1766 | |                         span,
1767 | |                         vis_descr,
1768 | |                         kind,
1768 | |                         kind,
1769 | |                         descr,
1770 | |                         vis_span,
1771 | |                     });
     | |_____________________^ the trait `SessionDiagnostic<'_>` is not implemented for `InPublicInterfaceTraits<'_>`
     |
note: required by a bound in `Session::emit_err`
     |
     |
461  |     pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
     |                                             ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Session::emit_err`

error[E0277]: the trait bound `InPublicInterface<'_>: SessionDiagnostic<'_>` is not satisfied
    --> compiler/rustc_privacy/src/lib.rs:1773:44
     |
1773 |                       self.tcx.sess.emit_err(InPublicInterface {
     |  ___________________________________--------_^
     | |                                   required by a bound introduced by this call
1774 | |                         span,
1775 | |                         vis_descr,
1776 | |                         kind,
1776 | |                         kind,
1777 | |                         descr,
1778 | |                         vis_span,
1779 | |                     });
     | |_____________________^ the trait `SessionDiagnostic<'_>` is not implemented for `InPublicInterface<'_>`
     |
note: required by a bound in `Session::emit_err`
     |
     |
461  |     pub fn emit_err<'a>(&'a self, err: impl SessionDiagnostic<'a>) -> ErrorGuaranteed {
     |                                             ^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Session::emit_err`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `rustc_privacy` due to 20 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `rustc_privacy` due to 20 previous errors

@Dylan-DPC
Copy link
Member Author

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.