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

Do not accidentally treat multi-segment meta-items as single-segment #58899

Merged
merged 7 commits into from
Mar 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix rebase
  • Loading branch information
petrochenkov committed Mar 16, 2019
commit 2fd4cbb3f283b903f55444bb585d38a2539f4e8d
2 changes: 1 addition & 1 deletion src/librustc/lint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ pub fn struct_lint_level<'a>(sess: &'a Session,
pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool {
let attrs = tcx.hir().attrs_by_hir_id(id);
for attr in attrs {
if Level::from_str(&attr.name().as_str()).is_some() {
if attr.ident_str().and_then(Level::from_str).is_some() {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ impl UnusedDocComment {

let span = sugared_span.take().unwrap_or_else(|| attr.span);

if attr.name() == "doc" {
if attr.check_name("doc") {
let mut err = cx.struct_span_lint(UNUSED_DOC_COMMENTS, span, "unused doc comment");

err.span_label(
Expand Down
2 changes: 0 additions & 2 deletions src/libsyntax/parse/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,6 @@ impl<'a> Parser<'a> {

/// matches meta_item_inner : (meta_item | UNSUFFIXED_LIT) ;
fn parse_meta_item_inner(&mut self) -> PResult<'a, ast::NestedMetaItem> {
let lo = self.span;

match self.parse_unsuffixed_lit() {
Ok(lit) => {
return Ok(ast::NestedMetaItem::Literal(lit))
Expand Down