Skip to content

Output columns 1-based. Fixes #10848 #11184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 2, 2014
Merged

Conversation

jhasse
Copy link
Contributor

@jhasse jhasse commented Dec 28, 2013

No description provided.

@alexcrichton
Copy link
Member

I agree that we shouldn't really be diverging from what standard tools like gcc are doing, but I'd like to at least see a test or two when dealing with this. I would also like to try to fix this at the source because anyone inspecting a Span would have to remember that the line numbers start from 1, but the column numbers start from 0. It'd be much nicer if everything either started from 0 or started from 1, and for ease of display it sounds like everything should start from 1.

@jhasse
Copy link
Contributor Author

jhasse commented Dec 30, 2013

As @huonw said in #11183: "storing them 0-based makes indexing/slicing the strings by adding to the start-of-column offset more natural.", so maybe only outputting them 1-based is a good idea?

Tests would definitely be nice, but I'm not familiar enough with Rust to write them. Should I close this PR?

@huonw
Copy link
Member

huonw commented Dec 30, 2013

A perfectly ok test would be:

# //~ ERROR 1:1: 1:2: error: expected item

placed in src/test/compile-fail/column-offset-1-based.rs (you can then check this test passes with make check-stage2-cfail TESTNAME=column-offset).

@brson
Copy link
Contributor

brson commented Dec 31, 2013

I agree that storing them 0 based and only incrementing for display is ok. @jhasse the test @huonw describes will work; just add a followup commit to this PR with the test case.

@jhasse
Copy link
Contributor Author

jhasse commented Jan 2, 2014

Done, thanks!

@jhasse
Copy link
Contributor Author

jhasse commented Jan 2, 2014

Damn I did git commit --amend instead of git commit -a --amend after fixing a typo. The test will fail, sorry! New patch should work.

bors added a commit that referenced this pull request Jan 2, 2014
@bors bors closed this Jan 2, 2014
@bors bors merged commit 86835c9 into rust-lang:master Jan 2, 2014
@jhasse jhasse deleted the patch-col branch January 2, 2014 12:52
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 31, 2023
…ut-async, r=llogiq

Fix async functions handling for `needless_pass_by_ref_mut` lint

Fixes rust-lang/rust-clippy#11179.

The problem with async is that "internals" are actually inside a closure from the `ExprUseVisitor` point of view, meaning we need to actually run the check on the closures' body as well.

changelog: none

r? `@llogiq`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants