Introduce #[diagnostic::on_move(message)]#150935
Introduce #[diagnostic::on_move(message)]#150935rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Conversation
|
These commits modify the If this was unintentional then you should revert the changes before this PR is merged. Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
|
rustbot has assigned @JonathanBrouwer. Use |
|
r? @estebank |
|
I'm currently working on migrating the existing diagnostic attribute infrastructure, can you do this PR after that? It's going to be quite a mess to resolve that conflict. Is this meant to be only used by the standard library or also by users? If only by std, I think you should forego the attribute and instead check whether T implements |
|
Yeah I can completly wait until you finished your work and do my PR after that, It was my intention to be honest . Resolving conflicts or rebasing is not an issue for me. |
9a0162d to
8071a7d
Compare
|
Some changes occurred in compiler/rustc_attr_parsing cc @jdonszelmann, @JonathanBrouwer Changes to the size of AST and/or HIR nodes. cc @nnethercote Some changes occurred in compiler/rustc_hir/src/attrs |
This comment has been minimized.
This comment has been minimized.
|
I have reworked my code and moved everything to
|
8071a7d to
09506a4
Compare
This comment has been minimized.
This comment has been minimized.
09506a4 to
829651a
Compare
This comment has been minimized.
This comment has been minimized.
|
Rebased onto main, I have also fixed the size of |
tests/ui/diagnostic_namespace/on_move/report_warning_on_malformed_options_without_delimiters.rs
Show resolved
Hide resolved
829651a to
b12aa8b
Compare
This comment has been minimized.
This comment has been minimized.
|
Rebased onto main. I have covered changes related to #151516 .
If I can help for this (by proposing a patch for a generic lint, for example), feel free to ask. |
This comment has been minimized.
This comment has been minimized.
b12aa8b to
1efb939
Compare
This comment has been minimized.
This comment has been minimized.
|
Reminder, once the PR becomes ready for a review, use |
compiler/rustc_attr_parsing/src/attributes/diagnostic/on_move.rs
Outdated
Show resolved
Hide resolved
|
I will look into it this week. Thanks for your time and your feedbacks. |
I don't see the point in adding a test case for this. In a case like that either the type passed as argument does not impl the EDIT: we should already have non regression testing for Copy no ? I think a case like this one is probably already covered. |
This might be helpful for smart pointers to explains why they aren't Copy and what to do instead or just to let the user know that .clone() is very cheap and can be called without a performance penalty.
81f1be4 to
965f1e7
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Except my last remark regarding the @rustbot ready |
|
I'm on holidays atm, will take a look in a few days :) |
No problem, have nice holidays then 😉 |
There was a problem hiding this comment.
I think this PR is fine the way it currently is :)
I checked that all previous conversations are resolved, and fully went through the changes one more time.
Thanks for all the hard work!
@bors r+ rollup
|
Thanks for your time and your feedbacks ! Next step is perhaps update the documentation regarding this diagnostic attribute, what do you think ? |
Rollup of 15 pull requests Successful merges: - #152909 (sess: `-Zbranch-protection` is a target modifier) - #153556 (`impl` restriction lowering) - #154048 (Don't emit rustdoc `missing_doc_code_examples` lint on impl items) - #150935 (Introduce #[diagnostic::on_move(message)]) - #152973 (remove -Csoft-float) - #153862 (Rename `cycle_check` to `find_cycle`) - #153992 (bootstrap: Optionally print a backtrace if a command fails) - #154019 (two smaller feature cleanups) - #154059 (tests: Activate `must_not_suspend` test for `MutexGuard` dropped before `await`) - #154075 (Rewrite `query_ensure_result`.) - #154082 (Updates derive_where and removes workaround) - #154084 (Preserve braces around `self` in use tree pretty printing) - #154086 (Insert space after float literal ending with `.` in pretty printer) - #154087 (Fix whitespace after fragment specifiers in macro pretty printing) - #154109 (tests: Add regression test for async closures involving HRTBs)
|
Adding it to the reference would be lovely |
There was a problem hiding this comment.
Thanks for your time and your feedbacks ! Next step is perhaps update the documentation regarding this diagnostic attribute, what do you think ?
Adding it to the reference would be lovely https://doc.rust-lang.org/reference/attributes/diagnostics.html#the-diagnostic-tool-attribute-namespace
This is unstable, so it should be in the unstable book, not the reference. See https://doc.rust-lang.org/nightly/unstable-book/language-features/diagnostic-on-const.html for example. It's up to you whether you do this or how much effort you put into this. It'd be nice if it's written in a "referencey" way; that'll be nice for when it gets stabilized.
@JonathanBrouwer #149862 can be closed now.
| /// Allows giving non-const impls custom diagnostic messages if attempted to be used as const | ||
| (unstable, diagnostic_on_const, "1.93.0", Some(143874)), | ||
| /// Allows giving on-move borrowck custom diagnostic messages for a type | ||
| (unstable, diagnostic_on_move, "CURRENT_RUSTC_VERSION", Some(150935)), |
There was a problem hiding this comment.
This should be pointing to a tracking issue (please make one!), not this PR.
View all comments
cc #149862
This is a first proposal. I have deliberately kept it simpler than
diagnostic::on_unimplemented.Few questions/remarks:
rustc_astfrom the borrowck ?Suggestions are welcomed !