Skip to content

FP syntax error use std::fmt::self; #23000

Closed

Description

@matthiaskrgr
use std::fmt::self;
fn main () {}

this compiles but ra diagnostics say

at crate ra, file /tmp/ra/src/main.rs: Error SyntaxError from LineCol { line: 0, col: 14 } to LineCol { line: 0, col: 18 }: Syntax Error: The `self` keyword is only allowed as the first segment of a path

Activity

  1. A4-Tacks commented on Aug 2, 2026

    @A4-Tacks
    Member

    this compiles

    This is fake

    error[E0429]: `self` imports are only allowed within a { } list
     --> src/bin/main.rs:1:13
      |
    1 | use std::fmt::self;
      |             ^^^^^^
      |
    
  2. matthiaskrgr commented on Aug 2, 2026

    @matthiaskrgr
    MemberAuthor
  3. A4-Tacks commented on Aug 2, 2026

    @A4-Tacks
    Member

    Build using the Stable version: 1.97.1

    I host use rustc 1.97.0-nightly (36ba2c771 2026-04-23)

    In 1.97.0 release log:

    Allow trailing self in imports in more cases

    Oh, ok

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-parserparser issuesC-bugCategory: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions