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

Use more precise span when reporting semicolon hint #13435

Merged
merged 1 commit into from
Apr 22, 2014

Conversation

edwardw
Copy link
Contributor

@edwardw edwardw commented Apr 9, 2014

When reporting "consider removing this semicolon" hint message, the
offending semicolon may come from macro call site instead of macro
itself. Using the more appropriate span makes the hint more helpful.

Closes #13428.

@edwardw
Copy link
Contributor Author

edwardw commented Apr 9, 2014

run-pass/tcp-stress.rs fails locally. It should be either spurious or unrelated. Reviews will still be appreciated.

@edwardw
Copy link
Contributor Author

edwardw commented Apr 10, 2014

r?


fn foo() -> ~str { //~ ERROR not all control paths return a value
format!("Hello {:s}",
"world");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you put this semicolon on its own line, the test will test that it's exactly the semicolon:

format!("Hello {}",
        "world")
; //~ NOTE consider removing this semcolon

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm? I don't follow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current test will pass if the span points to the ) or to the "world", since it's entirely line-based. By putting the ; on its own line, then you're testing that exactly the semicolon gets the span.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

@edwardw
Copy link
Contributor Author

edwardw commented Apr 16, 2014

Comments addressed. r? @huonw

When reporting "consider removing this semicolon" hint message, the
offending semicolon may come from macro call site instead of macro
itself. Using the more appropriate span makes the hint more helpful.

Closes rust-lang#13428.
bors added a commit that referenced this pull request Apr 22, 2014
When reporting "consider removing this semicolon" hint message, the
offending semicolon may come from macro call site instead of macro
itself. Using the more appropriate span makes the hint more helpful.

Closes #13428.
@bors bors closed this Apr 22, 2014
@bors bors merged commit cc5be28 into rust-lang:master Apr 22, 2014
@edwardw edwardw deleted the span branch April 22, 2014 05:58
notriddle pushed a commit to notriddle/rust that referenced this pull request Nov 10, 2022
…re-pt3, r=Veykril

Migrate assists to format args captures, part 3

Continuation of rust-lang/rust-analyzer#13379

Migrates:

- `inline_call`
- `inline_local_variable`
- `introduce_named_lifetime`
- `merge_match_arms`
- `move_from_mod_rs`
- `move_guard`
- `move_module_to_file`
- `move_to_mod_rs`
- `number_representation`
- `qualify_method_call`
- `qualify_path`
- `raw_string`
- `remove_dbg`
- `replace_derive_with_manual_impl`
- `replace_or_with_or_else`
- `replace_turbofish_with_explicit_type`
- `unwrap_tuple`
- `wrap_return_type_in_result`
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.

span misidentified within format! on "consider removing this semicolon"
4 participants