-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Fix issue #41652 #41668
Fix issue #41652 #41668
Conversation
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
The error happens because imported modules have no associated source code. As I mentioned in #41652, on stable this leads to a span pointing nowhere 👻 note: candidate #1 is defined in the trait `b::Tr`
--> b/src/lib.rs:11:5
|
11 |
| _____^ starting here...
12 | |
| |__________________________^ ...ending here
= help: to disambiguate the method call, write `b::Tr::read(3)` instead and causes ICE after #41245 because of In this PR, the error will be printed as note: candidate #1 is defined in the trait `b::Tr`
--> /full/path/to/b/src/lib.rs:11:5
|
= help: to disambiguate the method call, write `b::Tr::read(3)` instead Note the line number is still printed, but without any source code following it. While this is certainly better than the current situation, I don't know if it is good enough. Alternatively we could ensure FileMap actually contains the source code when reporting error, but I don't see an easy way to do so without heavily modifying libsyntax |
5d326ab
to
1edad2d
Compare
Could you have a UI test for that? |
@arielb1 Added (ce92a54). In that case, should I just remove the compile-fail test? |
Yeah. There's no need for duplicate ui + cfail tests. Just a UI test so we can make sure the output is sane. |
@jonathandturner can you review this change? |
This seems better than what we have, so we may want to approve just based on that. How difficult would it be to have this instead?
Since starting to draw the span but not drawing anything doesn't seem to help the user much. |
Don't print the source code in emit_message_default() and render_source_line() if the source code is None.
@jonathandturner Looks like skipping the whole iteration works. The output is now error: no method named `f` found for type `{integer}` in the current scope
--> $DIR/issue_41652.rs:19:11
|
19 | 3.f()
| ^
|
= note: found the following associated functions; to be used as methods, functions must have a `self` parameter
note: candidate #1 is defined in the trait `issue_41652_b::Tr`
= help: to disambiguate the method call, write `issue_41652_b::Tr::f(3)` instead
error: aborting due to previous error |
@jonathandturner Just checking in here, looks like this PR is ready for another review. |
Great! @bors r+ |
📌 Commit 81bfdc8 has been approved by |
Fix issue #41652 Fix issue #41652. Don't print anything in `render_source_line()` if no source code is given. (cc @jonathandturner #34789)
☀️ Test successful - status-appveyor, status-travis |
Fix issue #41652. Don't print anything in
render_source_line()
if no source code is given.(cc @jonathandturner #34789)