Skip to content

syntax error: extern crate self as foo #1069

Closed
@memoryruins

Description

@memoryruins

#![feature(extern_crate_self)] will be stable in rustc 1.34:

extern crate self as serde; // Adds local crate to extern prelude as `serde`

mod foo { ... }

// Anywhere in this crate
use serde::foo; // OK
::serde::foo; // OK

tracking issue: rust-lang/rust#56409
stabilization report: rust-lang/rust#57407 (comment)


current syntax error in rust-analyzer:

extern crate self as foo;
Syntax Error: expected identifier
SOURCE_FILE@[0; 25)
  EXTERN_CRATE_ITEM@[0; 25)
    EXTERN_KW@[0; 6)
    WHITESPACE@[6; 7)
    CRATE_KW@[7; 12)
    WHITESPACE@[12; 13)
    err: `expected identifier`
    ERROR@[13; 17)
      SELF_KW@[13; 17)
    WHITESPACE@[17; 18)
    ALIAS@[18; 24)
      AS_KW@[18; 20)
      WHITESPACE@[20; 21)
      NAME@[21; 24)
        IDENT@[21; 24) "foo"
    SEMI@[24; 25)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions