-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Improve error message for an escaping closure #24242
Merged
bors
merged 4 commits into
rust-lang:master
from
nikomatsakis:escaping-closure-error-message
Apr 11, 2015
Merged
Improve error message for an escaping closure #24242
bors
merged 4 commits into
rust-lang:master
from
nikomatsakis:escaping-closure-error-message
Apr 11, 2015
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nikomatsakis
force-pushed
the
escaping-closure-error-message
branch
from
April 9, 2015 19:08
df89b4d
to
c4f7dcd
Compare
Sweet error message. @bors r+ rollup |
📌 Commit c4f7dcd has been approved by |
nikomatsakis
force-pushed
the
escaping-closure-error-message
branch
from
April 9, 2015 19:51
c4f7dcd
to
af593f9
Compare
@bors r=brson rollup af59ef9 |
📌 Commit af593f9 has been approved by |
@bors r- I forgot the test! |
"highlight end" and instead add a variant to `RenderSpan`
columns within a line, not just the line numbers. Also try to clarify and use the term `line_index` when 0-based.
of text (perhaps obtained by span_snippet) and then splice that edited form back into the original file in the form of a suggestion.
from the current fn. Employ the new `span_suggestion` to show how you can use `move`.
nikomatsakis
force-pushed
the
escaping-closure-error-message
branch
2 times, most recently
from
April 10, 2015 10:11
1ac7926
to
e313b33
Compare
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Apr 10, 2015
…-message, r=brson Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions \"in situ\" and does some (minor) cleanups to `CodeMap`. r? @brson
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 10, 2015
…-message, r=brson Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions "in situ" and does some (minor) cleanups to `CodeMap`. r? @brson
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 10, 2015
…-message, r=brson Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions "in situ" and does some (minor) cleanups to `CodeMap`. r? @brson
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 10, 2015
…-message, r=brson Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions "in situ" and does some (minor) cleanups to `CodeMap`. r? @brson
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 10, 2015
…-message, r=brson Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions "in situ" and does some (minor) cleanups to `CodeMap`. r? @brson
steveklabnik
added a commit
to steveklabnik/rust
that referenced
this pull request
Apr 10, 2015
…-message, r=brson Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions "in situ" and does some (minor) cleanups to `CodeMap`. r? @brson
Manishearth
added a commit
to Manishearth/rust
that referenced
this pull request
Apr 11, 2015
…-message, r=brson Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions \"in situ\" and does some (minor) cleanups to `CodeMap`. r? @brson
ftxqxd
added a commit
to ftxqxd/rust
that referenced
this pull request
Apr 22, 2015
PR rust-lang#24242 added the ability to the compiler to directly give suggestions about how to modify code to fix an error. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
bors
added a commit
that referenced
this pull request
Apr 23, 2015
This PR uses the inline error suggestions introduced in #24242 to modify a few existing `help` messages. The new errors look like this: foobar.rs:5:12: 5:25 error: expected a path on the left-hand side of `+`, not `&'static Copy` [E0178] foobar.rs:5 let x: &'static Copy + 'static; ^~~~~~~~~~~~~ foobar.rs:5:12: 5:35 help: try adding parentheses (per RFC 438): foobar.rs: let x: &'static (Copy + 'static); foobar.rs:2:13: 2:23 error: cast to unsized type: `&_` as `core::marker::Copy` foobar.rs:2 let x = &1 as Copy; ^~~~~~~~~~ foobar.rs:2:19: 2:23 help: try casting to a reference instead: foobar.rs: let x = &1 as &Copy; foobar.rs:7:24: 7:25 error: expected expression, found `;` foobar.rs:7 let x = box (1 + 1); ^ foobar.rs:7:13: 7:16 help: try using `box()` instead: foobar.rs: let x = box() (1 + 1); This also modifies compiletest to give the ability to directly test suggestions given by error messages.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Example showing sample inputs, old message, new message:
https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba
Also adds infrastructure for reporting suggestions "in situ" and does some (minor) cleanups to
CodeMap
.r? @brson