More cleanup in rustc_attr_parsing#159875
Conversation
|
Some changes occurred to diagnostic attributes. cc @mejrs Some changes occurred in compiler/rustc_attr_parsing |
| cx.emit_err(e); | ||
| } | ||
| } | ||
| (Mode::RustcOnUnimplemented, sym::on) if is_root => { |
There was a problem hiding this comment.
Can you undo the changes in this arm? The reason it doesn't fallthrough is because as part of future work this will need to emit a different error/lint:
(Mode::RustcOnUnimplemented, sym::on)=> {
if is root {
...
} else {
// error about how nested filters are not supported
}
}and I don't feel like having to revert this when I/someone gets to it.
(and, ideally, this will be supported for more modes, so I don't want to duplicate the pattern either...)
| if let Some(sym::local_inner_macros) = | ||
| l.meta_item_no_args().and_then(|i| i.path().word_sym()) | ||
| { | ||
| true | ||
| } else { | ||
| cx.adcx().warn_ill_formed_attribute_input(INVALID_MACRO_EXPORT_ARGUMENTS); | ||
| return None; |
There was a problem hiding this comment.
this can be further simplified with word_is I believe
There was a problem hiding this comment.
Simplified as in?
if l.meta_item_no_args().is_some_and(|m| m.path().word_is(sym::local_inner_macros)) {
true
} else {
cx.adcx().warn_ill_formed_attribute_input(INVALID_MACRO_EXPORT_ARGUMENTS);
return None;
}| if let Ok(val) = u32::try_from(val.get()) { | ||
| return Some(AttributeKind::Unroll(UnrollAttr::Count(val))); | ||
| } else { | ||
| cx.adcx().expected_integer_literal_in_range(l.span(), 0, u32::MAX as isize); | ||
| return None; | ||
| } | ||
| cx.adcx().expected_integer_literal_in_range(l.span(), 0, u32::MAX as isize); | ||
| return None; | ||
| } |
There was a problem hiding this comment.
This seems a little too trivial, can you revert?
remember that there's a cost to making these changes (me reviewing, future people trying to figure out the history of this code etc), so please only do "cleanup" if it's genuinely an improvement.
There was a problem hiding this comment.
Thanks!
This somehow slipped pass my diff check reluctantly, but at least i got my self familiar with rustc_attr_parsing components and things are a bit clearer to me than before(most esp! the Don'ts)
@rustbot ready
|
Reminder, once the PR becomes ready for a review, use |
0859e62 to
b3bcb5b
Compare
|
Thanks, next time please give your commit messages a more meaningful description though (if you have multiple; I probably wouldn't in this case) 🙂 @bors squash "Various cleanups around |
|
Unknown argument ""Various". Did you mean to use |
|
@bors squash message="Various cleanups around rustc_attr_parsing" |
This comment has been minimized.
This comment has been minimized.
|
🔨 13 commits were squashed into 2360529. |
b3bcb5b to
2360529
Compare
More cleanup in `rustc_attr_parsing` Follow up to rust-lang#159508. r? @mejrs
More cleanup in `rustc_attr_parsing` Follow up to rust-lang#159508. r? @mejrs
More cleanup in `rustc_attr_parsing` Follow up to rust-lang#159508. r? @mejrs
Follow up to #159508.
r? @mejrs