-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Introduce #[diagnostic::on_move(message)] #150935
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
base: main
Are you sure you want to change the base?
Introduce #[diagnostic::on_move(message)] #150935
Conversation
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.
|
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 |
| } | ||
| } | ||
|
|
||
| impl<'tcx> OnMoveDirective { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attribute parsing shouldn't happen here. That's also why you had to make borrowck depend on the AST, right?
Attribute parsing should generally always happen in rustc_attr_parsing. However, it seems that diagnostic attr parsing still happens elsewhere judging by the fact that its validation steps occur in rustc_passes::check_attr (that'll change in the future most likely as part of the ongoing attribute rewrite). Moreover, there used to be a specific module dedicated to diagnostic attrs, I don't know if that still exists or not. In any case, please move all the parsing (incl. validation) bits out of this crate.
No problems to depend on crates like
rustc_astfrom the borrowck ?
It means that anybody modifying rustc_ast also has to rebuild rustc_borrowck (that might already be the case or not if it's a transitive dependency, I can't check rn) hurting compile-edit cycles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's what I was afraid of, I was not sure that all the logic should happen here :)
I am going to do all the required changes, no problems, however currently, that's quiet confusing, diagnostic::on_unimplemented is checked by rustc_passes::check_attr to be sure that it's applied onto a trait definition (same for ::on_const). Then all the attribute parsing is done in compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs (same for diagnostic::on_const it seems, right ?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diagnostic::on_unimplemented is checked by rustc_passes::check_attr
Many of the ported attributes still have a pass in check_attr, your pass should stay there.
Then all the attribute parsing is done in compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs (same for diagnostic::on_const it seems, right ?).
I'm currently working on porting the parsing for diagnostic attributes, that code won't stay there for long.
|
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. |
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 !