-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 escaped backslash in windows file not found message #49478
Merged
Merged
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
When a module is declared, but no matching file exists, rustc gives an error like 'help: name the file either foo.rs or foo/mod.rs inside the directory "src/bar"'. However, at on windows, the backslash was double-escaped when naming the directory. It did this because the string was printed in debug mode ( "{:?}" ) to surround it with quotes. However, it should just be printed like any other directory in an error message and surrounded by escaped quotes, rather than relying on the debug print to add quotes ( "\"{}\"" ).
shepmaster
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Mar 30, 2018
@bors r+ rollup |
📌 Commit 19eedf9 has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Mar 31, 2018
bors
added a commit
that referenced
this pull request
Apr 1, 2018
…ochenkov Fix escaped backslash in windows file not found message When a module is declared, but no matching file exists, rustc gives an error like `help: name the file either foo.rs or foo/mod.rs inside the directory "src/bar"`. However, at on windows, the backslash was double-escaped when naming the directory. It did this because the string was printed in debug mode (`"{:?}"`) to surround it with quotes. However, it should just be printed like any other directory in an error message and surrounded by escaped quotes, rather than relying on the debug print to add quotes (`"\"{}\""`). I also checked the test suite to see if this output is being correctly tested. It's not - it only tests up to the word "directory". Presumably this is so that the test is not dependent on its exact position in the source tree. I don't know a better way to test this, unless the test suite supports regex?
☀️ Test successful - status-appveyor, status-travis |
pietroalbini
added a commit
to pietroalbini/rust
that referenced
this pull request
Nov 18, 2018
Clean up some non-mod-rs stuff. This includes the following: - Remove unused `non_modrs_mods` from `ParseSess` which as only used for feature gate diagnostics. - Remove the vestiges of the feature gate tests in `test/ui`, they were only partially removed during stabilization. - Fix the run-pass test, it was accidentally removed during stabilization. - Add a ui test to verify error behavior for missing inline-nested mods. - Add some tests for `#[path]` for inline-nested mods (both mod and non-mod-rs). - Enable the diagnostic tests on windows, they should be fixed by rust-lang#49478. cc @cramertj
kennytm
pushed a commit
to pietroalbini/rust
that referenced
this pull request
Nov 19, 2018
Clean up some non-mod-rs stuff. This includes the following: - Remove unused `non_modrs_mods` from `ParseSess` which as only used for feature gate diagnostics. - Remove the vestiges of the feature gate tests in `test/ui`, they were only partially removed during stabilization. - Fix the run-pass test, it was accidentally removed during stabilization. - Add a ui test to verify error behavior for missing inline-nested mods. - Add some tests for `#[path]` for inline-nested mods (both mod and non-mod-rs). - Enable the diagnostic tests on windows, they should be fixed by rust-lang#49478. cc @cramertj
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
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.
When a module is declared, but no matching file exists, rustc gives
an error like
help: name the file either foo.rs or foo/mod.rs inside the directory "src/bar"
. However, at on windows, the backslash wasdouble-escaped when naming the directory.
It did this because the string was printed in debug mode (
"{:?}"
) tosurround it with quotes. However, it should just be printed like any
other directory in an error message and surrounded by escaped quotes,
rather than relying on the debug print to add quotes (
"\"{}\""
).I also checked the test suite to see if this output is being correctly tested. It's not - it only tests up to the word "directory". Presumably this is so that the test is not dependent on its exact position in the source tree. I don't know a better way to test this, unless the test suite supports regex?