-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Point at invalid utf-8 span on user's source code #135557
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,8 @@ pub fn load_errors(testfile: &Path, revision: Option<&str>) -> Vec<Error> { | |
|
||
rdr.lines() | ||
.enumerate() | ||
// We want to ignore utf-8 failures in tests during collection of annotations. | ||
.filter(|(_, line)| line.is_ok()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This... |
||
.filter_map(|(line_num, line)| { | ||
parse_expected(last_nonfollow_error, line_num + 1, &line.unwrap(), revision).map( | ||
|(which, error)| { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) { | |
|
||
let mut expected_revisions = BTreeSet::new(); | ||
|
||
let contents = std::fs::read_to_string(test).unwrap(); | ||
let Ok(contents) = std::fs::read_to_string(test) else { continue }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ...this, and another line in I ended up removing a test of " |
||
|
||
// Collect directives. | ||
iter_header(&contents, &mut |HeaderLine { revision, directive, .. }| { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
//@ reference: input.encoding.invalid | ||
|
||
fn foo() { | ||
include!("not-utf8.bin") | ||
include!("not-utf8.bin"); | ||
} |
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.
maybe worth looking into unifying the logic here and the
rustc_parse
logic somehow?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.
I moved the logic to a separate function and called it from both places.