This repository was archived by the owner on Nov 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Custom warning when rustfix replacing fails #94
Merged
alexcrichton
merged 2 commits into
rust-lang:master
from
killercup:warn-when-rustfix-cant-replace-things
May 6, 2018
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//! Ensure we give good error message when rustfix failes to apply changes | ||
//! | ||
//! TODO: Add rustc shim that outputs wrong suggestions instead of depending on | ||
//! actual rustc bugs! | ||
|
||
use super::project; | ||
|
||
#[test] | ||
fn tell_user_about_broken_lints() { | ||
let p = project() | ||
.file( | ||
"src/lib.rs", | ||
r#" | ||
pub fn foo() { | ||
let mut i = 42; | ||
} | ||
"#, | ||
) | ||
.build(); | ||
|
||
p.expect_cmd("cargo-fix fix") | ||
.stderr_contains(r"warning: error applying suggestions to `src/lib.rs`") | ||
.stderr_contains("The full error message was:") | ||
.stderr_contains("> Could not replace range 56...60 in file -- maybe parts of it were already replaced?") | ||
.stderr_contains("\ | ||
This likely indicates a bug in either rustc or rustfix itself,\n\ | ||
and we would appreciate a bug report! You're likely to see \n\ | ||
a number of compiler warnings after this message which rustfix\n\ | ||
attempted to fix but failed. If you could open an issue at\n\ | ||
https://github.com/rust-lang-nursery/rustfix/issues\n\ | ||
quoting the full output of this command we'd be very appreciative!\n\n\ | ||
") | ||
.status(0) | ||
.run(); | ||
} |
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
#[macro_use] | ||
extern crate log; | ||
#[macro_use] | ||
extern crate failure; | ||
#[cfg(test)] | ||
#[macro_use] | ||
|
This file contains hidden or 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rust-lang/rust#50472 will break the test in this file :)