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

Stabilize the #[diagnostic] namespace and #[diagnostic::on_unimplemented] attribute #119888

Merged
merged 1 commit into from Mar 8, 2024

Conversation

weiznich
Copy link
Contributor

@weiznich weiznich commented Jan 12, 2024

This PR stabilizes the #[diagnostic] attribute namespace and a minimal option of the #[diagnostic::on_unimplemented] attribute.

The #[diagnostic] attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working.

The #[diagnostic::on_unimplemented] attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the #[diagnostic::on_unimplemented] attribute the following options are implemented:

  • message which provides the text for the top level error message
  • label which provides the text for the label shown inline in the broken code in the error message
  • note which provides additional notes.

The note option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated.

All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or Self by name via the {Self} or {NameOfGenericArgument} syntax. For any non-existing argument a lint warning is generated.

This allows to have a trait definition like:

#[diagnostic::on_unimplemented(
    message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`",
    label = "My Label",
    note = "Note 1",
    note = "Note 2"
)]
trait ImportantTrait<A> {}

which then generates for the following code

fn use_my_trait(_: impl ImportantTrait<i32>) {}

fn main() {
    use_my_trait(String::new());
}

this error message:

error[E0277]: My Message for `ImportantTrait<i32>` is not implemented for `String`
  --> src/main.rs:14:18
   |
14 |     use_my_trait(String::new());
   |     ------------ ^^^^^^^^^^^^^ My Label
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `ImportantTrait<i32>` is not implemented for `String`
   = note: Note 1
   = note: Note 2

Playground with the unstable feature

Fixes #111996

@rustbot
Copy link
Collaborator

rustbot commented Jan 12, 2024

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Jan 12, 2024
@ehuss
Copy link
Contributor

ehuss commented Jan 12, 2024

Before stabilization, can we make sure a reference PR is opened and reviewed?

@compiler-errors

This comment was marked as outdated.

@bors
Copy link
Contributor

bors commented Jan 13, 2024

☔ The latest upstream changes (presumably #119088) made this pull request unmergeable. Please resolve the merge conflicts.

@weiznich
Copy link
Contributor Author

Before stabilization, can we make sure a reference PR is opened and reviewed?

Do you have any suggestions where exactly the relevant documentation should be placed in the reference?

@weiznich weiznich force-pushed the stablize_diagnostic_namespace branch from 4353333 to 5433b9d Compare January 16, 2024 19:13
@ehuss
Copy link
Contributor

ehuss commented Jan 16, 2024

There are a few places that need to be updated:

  • Add it to the list of built-in attributes under the diagnostic section.
  • Create a section in the diagnostics chapter that details the syntax and behavior of the attribute. There are templates for the format that attributes use (see deprecated and must_use on that page for examples).

Is this implemented as a Tool attribute? If so, that section should probably be updated. If not, then it might be OK in the diagnostics chapter to have a The `diagnostic` namespace section and then a subsection under that The `diagnostic::on_unimplemented` attribute.

Thanks!

@weiznich
Copy link
Contributor Author

Thanks for the pointers 👍

I've opened a PR here: rust-lang/reference#1449

@weiznich weiznich force-pushed the stablize_diagnostic_namespace branch from 5433b9d to 3ff4359 Compare January 19, 2024 08:56
@bors
Copy link
Contributor

bors commented Jan 25, 2024

☔ The latest upstream changes (presumably #119911) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 25, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 25, 2024

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git rebase -i master
$ # delete any merge commits in the editor that appears
$ git push --force-with-lease

The following commits are merge commits:

@weiznich weiznich force-pushed the stablize_diagnostic_namespace branch from 2528825 to d906c0c Compare January 25, 2024 07:37
@rust-log-analyzer

This comment has been minimized.

@weiznich weiznich force-pushed the stablize_diagnostic_namespace branch from d906c0c to 0ee3efa Compare January 25, 2024 07:41
@weiznich
Copy link
Contributor Author

@rustbot label -S-waiting-on-author -has-merge-commits

@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Jan 25, 2024
@weiznich
Copy link
Contributor Author

@rustbot label +T-lang

(As this was decided in the discussion around the RFC rust-lang/rfcs#3368)

@rustbot rustbot added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Jan 25, 2024
@Nilstrieb Nilstrieb added the I-lang-nominated The issue / PR has been nominated for discussion during a lang team meeting. label Jan 25, 2024
@bors
Copy link
Contributor

bors commented Feb 4, 2024

☔ The latest upstream changes (presumably #120620) made this pull request unmergeable. Please resolve the merge conflicts.

@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 Mar 5, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 6, 2024
…pace, r=compiler-errors

Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute

This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute.

The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working.

The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented:

* `message` which provides the text for the top level error message
* `label` which provides the text for the label shown inline in the broken code in the error message
* `note` which provides additional notes.

The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated.

All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated.

This allows to have a trait definition like:

```rust
#[diagnostic::on_unimplemented(
    message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`",
    label = "My Label",
    note = "Note 1",
    note = "Note 2"
)]
trait ImportantTrait<A> {}

```

which then generates for the following code

```rust
fn use_my_trait(_: impl ImportantTrait<i32>) {}

fn main() {
    use_my_trait(String::new());
}
```

this error message:

```
error[E0277]: My Message for `ImportantTrait<i32>` is not implemented for `String`
  --> src/main.rs:14:18
   |
14 |     use_my_trait(String::new());
   |     ------------ ^^^^^^^^^^^^^ My Label
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `ImportantTrait<i32>` is not implemented for `String`
   = note: Note 1
   = note: Note 2
```

[Playground with the unstable feature](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=05133acce8e1d163d481e97631f17536)

Fixes rust-lang#111996
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 6, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#113518 (bootstrap/libtest: print test name eagerly on failure even with `verbose-tests=false` / `--quiet`)
 - rust-lang#119888 (Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute)
 - rust-lang#121752 (Detect unused struct impls pub trait)
 - rust-lang#121885 (Move generic `NonZero` `rustc_layout_scalar_valid_range_start` attribute to inner type.)
 - rust-lang#121926 (`f16` and `f128` step 3: compiler support & feature gate)
 - rust-lang#121959 (Removing absolute path in proc-macro)
 - rust-lang#122015 (Add better explanation for `rustc_index::IndexVec`)
 - rust-lang#122027 (Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries)
 - rust-lang#122038 (Fix linting paths with qself in `unused_qualifications`)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 6, 2024
…pace, r=compiler-errors

Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute

This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute.

The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working.

The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented:

* `message` which provides the text for the top level error message
* `label` which provides the text for the label shown inline in the broken code in the error message
* `note` which provides additional notes.

The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated.

All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated.

This allows to have a trait definition like:

```rust
#[diagnostic::on_unimplemented(
    message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`",
    label = "My Label",
    note = "Note 1",
    note = "Note 2"
)]
trait ImportantTrait<A> {}

```

which then generates for the following code

```rust
fn use_my_trait(_: impl ImportantTrait<i32>) {}

fn main() {
    use_my_trait(String::new());
}
```

this error message:

```
error[E0277]: My Message for `ImportantTrait<i32>` is not implemented for `String`
  --> src/main.rs:14:18
   |
14 |     use_my_trait(String::new());
   |     ------------ ^^^^^^^^^^^^^ My Label
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `ImportantTrait<i32>` is not implemented for `String`
   = note: Note 1
   = note: Note 2
```

[Playground with the unstable feature](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=05133acce8e1d163d481e97631f17536)

Fixes rust-lang#111996
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 6, 2024
…pace, r=compiler-errors

Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute

This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute.

The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working.

The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented:

* `message` which provides the text for the top level error message
* `label` which provides the text for the label shown inline in the broken code in the error message
* `note` which provides additional notes.

The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated.

All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated.

This allows to have a trait definition like:

```rust
#[diagnostic::on_unimplemented(
    message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`",
    label = "My Label",
    note = "Note 1",
    note = "Note 2"
)]
trait ImportantTrait<A> {}

```

which then generates for the following code

```rust
fn use_my_trait(_: impl ImportantTrait<i32>) {}

fn main() {
    use_my_trait(String::new());
}
```

this error message:

```
error[E0277]: My Message for `ImportantTrait<i32>` is not implemented for `String`
  --> src/main.rs:14:18
   |
14 |     use_my_trait(String::new());
   |     ------------ ^^^^^^^^^^^^^ My Label
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `ImportantTrait<i32>` is not implemented for `String`
   = note: Note 1
   = note: Note 2
```

[Playground with the unstable feature](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=05133acce8e1d163d481e97631f17536)

Fixes rust-lang#111996
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 6, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#113518 (bootstrap/libtest: print test name eagerly on failure even with `verbose-tests=false` / `--quiet`)
 - rust-lang#119888 (Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute)
 - rust-lang#121089 (Remove `feed_local_def_id`)
 - rust-lang#121926 (`f16` and `f128` step 3: compiler support & feature gate)
 - rust-lang#121959 (Removing absolute path in proc-macro)
 - rust-lang#122015 (Add better explanation for `rustc_index::IndexVec`)
 - rust-lang#122027 (Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries)
 - rust-lang#122038 (Fix linting paths with qself in `unused_qualifications`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2024
…llaumeGomez

Rollup of 10 pull requests

Successful merges:

 - rust-lang#119888 (Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute)
 - rust-lang#121089 (Remove `feed_local_def_id`)
 - rust-lang#122004 (AST validation: Improve handling of inherent impls nested within functions and anon consts)
 - rust-lang#122087 (Add missing background color for top-level rust documentation page and increase contrast by setting text color to black)
 - rust-lang#122136 (Include all library files in artifact summary on CI)
 - rust-lang#122137 (Don't pass a break scope to `Builder::break_for_else`)
 - rust-lang#122138 (Record mtime in bootstrap's LLVM linker script)
 - rust-lang#122141 (sync (try_)instantiate_mir_and_normalize_erasing_regions implementation)
 - rust-lang#122142 (cleanup rustc_infer)
 - rust-lang#122147 (Make `std::os::unix::ucred` module private)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b0d7f2b into rust-lang:master Mar 8, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 8, 2024
Rollup merge of rust-lang#119888 - weiznich:stablize_diagnostic_namespace, r=compiler-errors

Stabilize the `#[diagnostic]` namespace and `#[diagnostic::on_unimplemented]` attribute

This PR stabilizes the `#[diagnostic]` attribute namespace and a minimal option of the `#[diagnostic::on_unimplemented]` attribute.

The `#[diagnostic]` attribute namespace is meant to provide a home for attributes that allow users to influence error messages emitted by the compiler. The compiler is not guaranteed to use any of this hints, however it should accept any (non-)existing attribute in this namespace and potentially emit lint-warnings for unused attributes and options. This is meant to allow discarding certain attributes/options in the future to allow fundamental changes to the compiler without the need to keep then non-meaningful options working.

The `#[diagnostic::on_unimplemented]` attribute is allowed to appear on a trait definition. This allows crate authors to hint the compiler to emit a specific error message if a certain trait is not implemented. For the `#[diagnostic::on_unimplemented]` attribute the following options are implemented:

* `message` which provides the text for the top level error message
* `label` which provides the text for the label shown inline in the broken code in the error message
* `note` which provides additional notes.

The `note` option can appear several times, which results in several note messages being emitted. If any of the other options appears several times the first occurrence of the relevant option specifies the actually used value. Any other occurrence generates an lint warning. For any other non-existing option a lint-warning is generated.

All three options accept a text as argument. This text is allowed to contain format parameters referring to generic argument or `Self` by name via the `{Self}` or `{NameOfGenericArgument}` syntax. For any non-existing argument a lint warning is generated.

This allows to have a trait definition like:

```rust
#[diagnostic::on_unimplemented(
    message = "My Message for `ImportantTrait<{A}>` is not implemented for `{Self}`",
    label = "My Label",
    note = "Note 1",
    note = "Note 2"
)]
trait ImportantTrait<A> {}

```

which then generates for the following code

```rust
fn use_my_trait(_: impl ImportantTrait<i32>) {}

fn main() {
    use_my_trait(String::new());
}
```

this error message:

```
error[E0277]: My Message for `ImportantTrait<i32>` is not implemented for `String`
  --> src/main.rs:14:18
   |
14 |     use_my_trait(String::new());
   |     ------------ ^^^^^^^^^^^^^ My Label
   |     |
   |     required by a bound introduced by this call
   |
   = help: the trait `ImportantTrait<i32>` is not implemented for `String`
   = note: Note 1
   = note: Note 2
```

[Playground with the unstable feature](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=05133acce8e1d163d481e97631f17536)

Fixes rust-lang#111996
@fmease fmease added the relnotes Marks issues that should be documented in the release notes of the next release. label Mar 8, 2024
@ehuss
Copy link
Contributor

ehuss commented Mar 12, 2024

Is it intentional that the format parameters support the general syntax of std's format strings? There seems to be a variety of situations that don't seem to be handled like I would expect:

  • Strings such as {} or {1:} generate an error instead of a warning. Doesn't that go against the intention that the diagnostic attributes are flexible in what they accept to support forwards compatibility?
  • Strings such as {A:1} don't generate a warning or an error, even though it includes a nonsense width argument. This is true for all format spec things (precision, ? debug, etc.)
  • Format specifiers allow flexible whitespace, like {A }.
  • Braces are escaped by doubling them with {{ or }}.
  • Incorrect braces seem to be ignored, and simply stop parsing, and are ignored (no warning). For example "foo }"

Is it intended that these format parameters are simple string replacements (like {Self} gets replaced with the type name) or is it intended that it uses the full formatting machinery of std's format strings (allowing things like width specifiers)? In either case, it seems like there are several situations that are not handled as I would expect. Additionally, none of this was documented.

@weiznich
Copy link
Contributor Author

@ehuss I'm not sure I can follow you here. Do you mean that this was not mentioned at all? (In that case, both the Reference PR and the description explicitly mentions it). Or do you mean that it contains more features as described there? Or that these 4 specific cases result in different results than you personally would expect? For the later case I would argue that this is merely a bug that can be fixed independently from stabilization. Given a proper report with an explicit list of test cases I can try working on that.

@ehuss
Copy link
Contributor

ehuss commented Mar 12, 2024

Do you mean that this was not mentioned at all? (In that case, both the Reference PR and the description explicitly mentions it).

The description says "This text is allowed to contain format parameters referring to ..." but doesn't define what a "format parameter" is other than {Self} or {NameOfGenericArgument}. Unless I missed something, I don't see where it says that the entire string is a std::fmt style format string. If the string is to be interpreted using some syntax system, then that needs to be explicitly stated and documented.

Given a proper report with an explicit list of test cases I can try working on that.

Sure, I'll file an issue.
EDIT: Filed #122391

@ehuss
Copy link
Contributor

ehuss commented Mar 12, 2024

To put my concerns in a different way, this now requires that compiler implementers be able to interpret std format strings at runtime, which is not a requirement I think has been made until now. It is very unlikely to be an issue, but seems like a significant requirement that was not stated.

wcampbell0x2a added a commit to sharksforarms/deku that referenced this pull request May 2, 2024
* Add the following diagnostics to hopefully lead people in the right direction
  when seeing trait problems related to ctxs and derives

error[E0277]: the trait bound `FieldF: deku::DekuReader<'_, _>` is not satisfied
  --> examples/example.rs:37:14
   |
37 |     field_f: FieldF,
   |              ^^^^^^ the trait `deku::DekuReader<'_, _>` is not implemented for `FieldF`
   |
   = note: implement by adding #[derive(DekuRead)] to `FieldF`
   = note: make sure the `ctx` sent into the function matches `FieldF`'s `ctx`
   = help: the following other types implement trait `deku::DekuReader<'a, Ctx>`:
             <() as deku::DekuReader<'_, Ctx>>
             <(A, B) as deku::DekuReader<'a, Ctx>>
             <(A, B, C) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E, F) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E, F, G) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E, F, G, H) as deku::DekuReader<'a, Ctx>>
           and 152 others

* Rust Release: https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html
* Rust MR: rust-lang/rust#119888
wip-sync pushed a commit to NetBSD/pkgsrc-wip that referenced this pull request May 4, 2024
Pkgsrc changes:
 * Adapt checksums and patches, some have beene intregrated upstream.

Upstream chnages:

Version 1.78.0 (2024-05-02)
===========================

Language
--------
- [Stabilize `#[cfg(target_abi = ...)]`]
  (rust-lang/rust#119590)
- [Stabilize the `#[diagnostic]` namespace and
  `#[diagnostic::on_unimplemented]` attribute]
  (rust-lang/rust#119888)
- [Make async-fn-in-trait implementable with concrete signatures]
  (rust-lang/rust#120103)
- [Make matching on NaN a hard error, and remove the rest of
  `illegal_floating_point_literal_pattern`]
  (rust-lang/rust#116284)
- [static mut: allow mutable reference to arbitrary types, not just
  slices and arrays]
  (rust-lang/rust#117614)
- [Extend `invalid_reference_casting` to include references casting
  to bigger memory layout]
  (rust-lang/rust#118983)
- [Add `non_contiguous_range_endpoints` lint for singleton gaps
  after exclusive ranges]
  (rust-lang/rust#118879)
- [Add `wasm_c_abi` lint for use of older wasm-bindgen versions]
  (rust-lang/rust#117918)
  This lint currently only works when using Cargo.
- [Update `indirect_structural_match` and `pointer_structural_match`
  lints to match RFC]
  (rust-lang/rust#120423)
- [Make non-`PartialEq`-typed consts as patterns a hard error]
  (rust-lang/rust#120805)
- [Split `refining_impl_trait` lint into `_reachable`, `_internal` variants]
  (rust-lang/rust#121720)
- [Remove unnecessary type inference when using associated types
  inside of higher ranked `where`-bounds]
  (rust-lang/rust#119849)
- [Weaken eager detection of cyclic types during type inference]
  (rust-lang/rust#119989)
- [`trait Trait: Auto {}`: allow upcasting from `dyn Trait` to `dyn Auto`]
  (rust-lang/rust#119338)

Compiler
--------

- [Made `INVALID_DOC_ATTRIBUTES` lint deny by default]
  (rust-lang/rust#111505)
- [Increase accuracy of redundant `use` checking]
  (rust-lang/rust#117772)
- [Suggest moving definition if non-found macro_rules! is defined later]
  (rust-lang/rust#121130)
- [Lower transmutes from int to pointer type as gep on null]
  (rust-lang/rust#121282)

Target changes:

- [Windows tier 1 targets now require at least Windows 10]
  (rust-lang/rust#115141)
 - [Enable CMPXCHG16B, SSE3, SAHF/LAHF and 128-bit Atomics in tier 1 Windows]
  (rust-lang/rust#120820)
- [Add `wasm32-wasip1` tier 2 (without host tools) target]
  (rust-lang/rust#120468)
- [Add `wasm32-wasip2` tier 3 target]
  (rust-lang/rust#119616)
- [Rename `wasm32-wasi-preview1-threads` to `wasm32-wasip1-threads`]
  (rust-lang/rust#122170)
- [Add `arm64ec-pc-windows-msvc` tier 3 target]
  (rust-lang/rust#119199)
- [Add `armv8r-none-eabihf` tier 3 target for the Cortex-R52]
  (rust-lang/rust#110482)
- [Add `loongarch64-unknown-linux-musl` tier 3 target]
  (rust-lang/rust#121832)

Refer to Rust's [platform support page][platform-support-doc]
for more information on Rust's tiered platform support.

Libraries
---------

- [Bump Unicode to version 15.1.0, regenerate tables]
  (rust-lang/rust#120777)
- [Make align_offset, align_to well-behaved in all cases]
  (rust-lang/rust#121201)
- [PartialEq, PartialOrd: document expectations for transitive chains]
  (rust-lang/rust#115386)
- [Optimize away poison guards when std is built with panic=abort]
  (rust-lang/rust#100603)
- [Replace pthread `RwLock` with custom implementation]
  (rust-lang/rust#110211)
- [Implement unwind safety for Condvar on all platforms]
  (rust-lang/rust#121768)
- [Add ASCII fast-path for `char::is_grapheme_extended`]
  (rust-lang/rust#121138)

Stabilized APIs
---------------

- [`impl Read for &Stdin`]
  (https://doc.rust-lang.org/stable/std/io/struct.Stdin.html#impl-Read-for-%26Stdin)
- [Accept non `'static` lifetimes for several `std::error::Error`
  related implementations] (rust-lang/rust#113833)
- [Make `impl<Fd: AsFd>` impl take `?Sized`]
  (rust-lang/rust#114655)
- [`impl From<TryReserveError> for io::Error`]
  (https://doc.rust-lang.org/stable/std/io/struct.Error.html#impl-From%3CTryReserveError%3E-for-Error)

These APIs are now stable in const contexts:

- [`Barrier::new()`]
  (https://doc.rust-lang.org/stable/std/sync/struct.Barrier.html#method.new)

Cargo
-----

- [Stabilize lockfile v4](rust-lang/cargo#12852)
- [Respect `rust-version` when generating lockfile]
  (rust-lang/cargo#12861)
- [Control `--charset` via auto-detecting config value]
  (rust-lang/cargo#13337)
- [Support `target.<triple>.rustdocflags` officially]
  (rust-lang/cargo#13197)
- [Stabilize global cache data tracking]
  (rust-lang/cargo#13492)

Misc
----

- [rustdoc: add `--test-builder-wrapper` arg to support wrappers
  such as RUSTC_WRAPPER when building doctests]
  (rust-lang/rust#114651)

Compatibility Notes
-------------------

- [Many unsafe precondition checks now run for user code with debug
  assertions enabled] (rust-lang/rust#120594)
  This change helps users catch undefined behavior in their code,
  though the details of how much is checked are generally not
  stable.
- [riscv only supports split_debuginfo=off for now]
  (rust-lang/rust#120518)
- [Consistently check bounds on hidden types of `impl Trait`]
  (rust-lang/rust#121679)
- [Change equality of higher ranked types to not rely on subtyping]
  (rust-lang/rust#118247)
- [When called, additionally check bounds on normalized function return type]
  (rust-lang/rust#118882)
- [Expand coverage for `arithmetic_overflow` lint]
  (rust-lang/rust#119432)

Internal Changes
----------------

These changes do not affect any public interfaces of Rust, but they represent
significant improvements to the performance or internals of rustc and related
tools.

- [Update to LLVM 18](rust-lang/rust#120055)
- [Build `rustc` with 1CGU on `x86_64-pc-windows-msvc`]
  (rust-lang/rust#112267)
- [Build `rustc` with 1CGU on `x86_64-apple-darwin`]
  (rust-lang/rust#112268)
- [Introduce `run-make` V2 infrastructure, a `run_make_support`
  library and port over 2 tests as example]
  (rust-lang/rust#113026)
- [Windows: Implement condvar, mutex and rwlock using futex]
  (rust-lang/rust#121956)
wcampbell0x2a added a commit to sharksforarms/deku that referenced this pull request May 14, 2024
* Add the following diagnostics to hopefully lead people in the right direction
  when seeing trait problems related to ctxs and derives

error[E0277]: the trait bound `FieldF: deku::DekuReader<'_, _>` is not satisfied
  --> examples/example.rs:37:14
   |
37 |     field_f: FieldF,
   |              ^^^^^^ the trait `deku::DekuReader<'_, _>` is not implemented for `FieldF`
   |
   = note: implement by adding #[derive(DekuRead)] to `FieldF`
   = note: make sure the `ctx` sent into the function matches `FieldF`'s `ctx`
   = help: the following other types implement trait `deku::DekuReader<'a, Ctx>`:
             <() as deku::DekuReader<'_, Ctx>>
             <(A, B) as deku::DekuReader<'a, Ctx>>
             <(A, B, C) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E, F) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E, F, G) as deku::DekuReader<'a, Ctx>>
             <(A, B, C, D, E, F, G, H) as deku::DekuReader<'a, Ctx>>
           and 152 others

* Rust Release: https://blog.rust-lang.org/2024/05/02/Rust-1.78.0.html
* Rust MR: rust-lang/rust#119888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking Issue for #![feature(diagnostic_namespace)]