Skip to content
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

Bad span for self type #27522

Closed
marcusklaas opened this issue Aug 4, 2015 · 3 comments · Fixed by #38606
Closed

Bad span for self type #27522

marcusklaas opened this issue Aug 4, 2015 · 3 comments · Fixed by #38606
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@marcusklaas
Copy link
Contributor

The high end of the span of &SomeType in

trait Foo {
    fn handler(self: &SomeType);
}

is incorrectly set to BytePos(0).

@marcusklaas
Copy link
Contributor Author

It's seems to be caused by this `hack': https://github.com/rust-lang/rust/blob/master/src/libsyntax/ast.rs#L1503-L1521. (Called here: https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser.rs#L4321-L4323)

Weirdly enough, the proper span is shown for diagnostics: play.rust-lang.org

Any pointers, @eddyb?

@steveklabnik steveklabnik added A-trait-system Area: Trait system A-diagnostics Area: Messages for errors, warnings, and lints labels Aug 4, 2015
@eddyb
Copy link
Member

eddyb commented Aug 5, 2015

Since Self works in impls now, it's probably time to retire that hack and always provide the correct type.
SelfExplicit appears to hold the type (with its correct span), instead of the self argument itself, in this case.

@estebank
Copy link
Contributor

This has been fixed. Can this ticket be closed?

@eddyb eddyb added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 23, 2016
estebank added a commit to estebank/rust that referenced this issue Dec 25, 2016
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jan 4, 2017
…nkov

Add test for correct span for type

Adds test for and closes rust-lang#27522.
estebank added a commit to estebank/rust that referenced this issue Jan 4, 2017
frewsxcv pushed a commit to frewsxcv/rust that referenced this issue Jan 9, 2017
sanxiyn added a commit to sanxiyn/rust that referenced this issue Jan 10, 2017
…nkov

Add test for correct span for type

Adds test for and closes rust-lang#27522.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-trait-system Area: Trait system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants