Skip to content

Inconsistent column numbers when using hard tabs #109537

Closed
@pommicket

Description

@pommicket

Code

src/main.rs:

mod m;
fn main() {
	let s = m::S;
	s.method();
}

src/m.rs:

pub struct S;
impl S {
		fn method(&self) {}
}

Current output

error[E0624]: associated function `method` is private
 --> src/main.rs:4:4
  |
4 |     s.method();
  |       ^^^^^^ private associated function
  |
 ::: src/m.rs:3:9
  |
3 |         fn method(&self) {}
  |         ---------------- private associated function defined here

Desired output

error[E0624]: associated function `method` is private
 --> src/main.rs:4:4
  |
4 |     s.method();
  |       ^^^^^^ private associated function
  |
 ::: src/m.rs:3:3
  |
3 |         fn method(&self) {}
  |         ---------------- private associated function defined here

Rationale and extra context

for the error in main.rs, rust gives the column number as a "character index" (i.e. the error is located at the 4th character in the line) which i think is the intended behavior, but for the reference to m.rs, it seems to be treating a tab as 4 columns

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-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