Skip to content

Upgrade #![feature(…)] in non-root modules from lint warning unused_attributes to a hard error (requires crater run) #49975

Open
@nelhage

Description

@nelhage

Putting #![feature(…)] in a mod is silently ignored.

I tried this code (minimized version):

https://github.com/nelhage/feature-in-mod

I'm writing some toy Rust code that needs to perform pattern-matching over ASTs (that use Box to reference children), and wanted to use box patterns. On advice of https://doc.rust-lang.org/1.14.0/book/box-syntax-and-patterns.html I added #![feature(box_patterns)] to the top of my .rs file (which is a mod inside the larger executable).

I expected to see this happen: Either:

  • The feature() directive would work and I would get access to the feature
  • The feature() directive would yield an error

Instead, this happened:
The feature() directive had no observable effect at all; cargo build output did not change after adding the line, either to show a new error or to suppress the "box pattern syntax is experimental" error.

Meta

rustc --version --verbose:

rustc 1.25.0 (84203cac6 2018-03-25)
binary: rustc
commit-hash: 84203cac67e65ca8640b8392348411098c856985
commit-date: 2018-03-25
host: x86_64-unknown-linux-gnu
release: 1.25.0
LLVM version: 6.0

Metadata

Metadata

Assignees

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-enhancementCategory: An issue proposing an enhancement or a PR with one.L-unused_attributesLint: unused_attributesT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions