Skip to content

parse error in #[feature(...)] discards all mentioned features. #80227

Open
@lcnr

Description

@lcnr
#![feature(const_generics, use std::mem)]

pub struct Bar<const N: usize>;

and

#![feature(const_generics, 'other_feature)]

pub struct Bar<const N: usize>;

Both emit both a parse error and

error[E0658]: const generics are unstable
 --> src/lib.rs:3:22
  |
3 | pub struct Bar<const N: usize>;
  |                      ^
  |
  = note: see issue #74878 <https://github.com/rust-lang/rust/issues/74878> for more information
  = help: add `#![feature(min_const_generics)]` to the crate attributes to enable

Ideally we should still accept the features parsed before that error, so it would be nice to only emit the parse error here.

Split out from #80077, thanks @leonardo-m for opening that issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions