Add #[diagnostic::do_not_recommend] to blanket impl of HasField#74
Merged
soareschen merged 2 commits intomainfrom Feb 22, 2025
Merged
Add #[diagnostic::do_not_recommend] to blanket impl of HasField#74soareschen merged 2 commits intomainfrom
#[diagnostic::do_not_recommend] to blanket impl of HasField#74soareschen merged 2 commits intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds the new
#[diagnostic::do_not_recommend]attribute from Rust 1.85 to the blanket implementations ofHasFieldandHasFieldMut.With this improvement, users would get much less confusing messages about
Derefnot being implemented, when what really happen is just that the given field accessor is not preset.Other Blanket Implementations
I have also tried applying
#[diagnostic::do_not_recommend]to other CGP blanket implementations, in particular the blanket implementations for the consumer trait and provider trait that useHasProviderandDelegateComponent. However doing so completely remove any relevant information about the unsatisfied constraint. So unfortunately we cannot use#[diagnostic::do_not_recommend]to improve the error messages there.Deferred Upgrade to Rust 1.85
Note that we cannot fully upgrade to Rust 1.85 and the 2024 edition yet, as Wasmer currently support only up to Rust 1.81 due to broken support of Wasm reference types introduced in Rust 1.82. As a result, we can only upgrade after Wasmer and its downstream dependents are fixed.