Skip to content

"Don't know the field number in this context" #64385

Closed

Description

@dtolnay
src/lib.rs:
struct S(#[attr] u8);

Stable, and nightly-2019-09-09:

error[E0658]: the attribute `attr` is currently unknown to the compiler and may have meaning added to it in the future
 --> src/main.rs:1:10
  |
1 | struct S(#[attr] u8);
  |          ^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/29642
  = help: add `#![feature(custom_attribute)]` to the crate attributes to enable

nightly-2019-09-10:

thread 'rustc' panicked at 'don't know the field number in this context', src/librustc/hir/map/def_collector.rs:346:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.39.0-nightly (0b36e9dea 2019-09-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

2b8116d...0b36e9d

Mentioning @c410-f3r @petrochenkov because this is likely from #63468.

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    on Sep 11, 2019
  2. added
    C-bugCategory: This is a bug.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-attributesArea: Attributes (`#[…]`, `#![…]`)
    on Sep 11, 2019
  3. self-assigned this
    on Sep 11, 2019
  4. petrochenkov commented on Sep 11, 2019

    @petrochenkov
    Contributor

    Yeah, this is some known shortcut taken in #63468, sorry.
    Didn't expect people to hit it that fast.
    Will fix ~this weekend.

  5. dtolnay commented on Sep 11, 2019

    @dtolnay
    MemberAuthor

    Thanks. The realistic usage where this appears is if you forget to import a derive macro, which happens commonly.

    //use serde::Deserialize;
    
    #[derive(Deserialize)]
    struct Outer<'a>(#[serde(borrow)] Inner<'a>);
  6. Centril commented on Sep 11, 2019

    @Centril
    Contributor

    Un-nominating since Vadim self-assigned.

  7. pnkfelix commented on Sep 12, 2019

    @pnkfelix
    Contributor

    triage: P-high.

  8. petrochenkov commented on Sep 14, 2019

    @petrochenkov
    Contributor

    Fixed in #64457.

  9. removed their assignment
    on Sep 14, 2019
  10. added a commit that references this issue on Sep 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-attributesArea: Attributes (`#[…]`, `#![…]`)C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions