Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/normalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub fn diagnostics(output: Vec<u8>, context: Context) -> Variations {
PathDependencies,
CargoRegistry,
ArrowOtherCrate,
RelativeToDir,
]
.iter()
.map(|normalization| apply(&from_bytes, *normalization, context))
Expand Down Expand Up @@ -91,6 +92,7 @@ enum Normalization {
PathDependencies,
CargoRegistry,
ArrowOtherCrate,
RelativeToDir,
// New normalization steps are to be inserted here at the end so that any
// snapshots saved before your normalization change remain passing.
}
Expand Down Expand Up @@ -136,6 +138,7 @@ impl<'a> Filter<'a> {
}

let trim_start = line.trim_start();
let indent = line.len() - trim_start.len();
let prefix = if trim_start.starts_with("--> ") {
Some("--> ")
} else if trim_start.starts_with("::: ") {
Expand All @@ -162,7 +165,11 @@ impl<'a> Filter<'a> {
.to_ascii_lowercase()
.replace('\\', "/");
if let Some(i) = line_lower.find(&source_dir_pat) {
line.replace_range(i..i + source_dir_pat.len() - 1, "$DIR");
if self.normalization >= RelativeToDir && i == indent + 4 {
line.replace_range(i..i + source_dir_pat.len(), "");
} else {
line.replace_range(i..i + source_dir_pat.len() - 1, "$DIR");
}
return Some(line);
}
let mut other_crate = false;
Expand Down
16 changes: 8 additions & 8 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ macro_rules! test_normalize {

test_normalize! {test_basic "
error: `self` parameter is only allowed in associated functions
--> /git/trybuild/test_suite/ui/error.rs:11:23
--> /git/trybuild/test_suite/tests/ui/error.rs:11:23
|
11 | async fn bad_endpoint(self) -> Result<HttpResponseOkObject<()>, HttpError> {
| ^^^^ not semantically valid as function parameter
Expand All @@ -40,23 +40,23 @@ error: could not compile `trybuild-tests`.
To learn more, run the command again with --verbose.
" "
error: `self` parameter is only allowed in associated functions
--> $DIR/ui/error.rs:11:23
--> tests/ui/error.rs:11:23
|
11 | async fn bad_endpoint(self) -> Result<HttpResponseOkObject<()>, HttpError> {
| ^^^^ not semantically valid as function parameter
"}

test_normalize! {test_dir_backslash "
error[E0277]: the trait bound `QueryParams: serde::de::Deserialize<'de>` is not satisfied
--> \\git\\trybuild\\test_suite\\ui\\error.rs:22:61
--> \\git\\trybuild\\test_suite\\tests\\ui\\error.rs:22:61
" "
error[E0277]: the trait bound `QueryParams: serde::de::Deserialize<'de>` is not satisfied
--> $DIR/ui/error.rs:22:61
--> tests/ui/error.rs:22:61
"}

test_normalize! {test_rust_lib "
error[E0599]: no method named `quote_into_iter` found for struct `std::net::Ipv4Addr` in the current scope
--> /git/trybuild/test_suite/ui/not-repeatable.rs:6:13
--> /git/trybuild/test_suite/tests/ui/not-repeatable.rs:6:13
|
6 | let _ = quote! { #(#ip)* };
| ^^^^^^^^^^^^^^^^^^ method not found in `std::net::Ipv4Addr`
Expand All @@ -70,7 +70,7 @@ error[E0599]: no method named `quote_into_iter` found for struct `std::net::Ipv4
| doesn't satisfy `std::net::Ipv4Addr: quote::to_tokens::ToTokens`
" "
error[E0599]: no method named `quote_into_iter` found for struct `std::net::Ipv4Addr` in the current scope
--> $DIR/ui/not-repeatable.rs:6:13
--> tests/ui/not-repeatable.rs:6:13
|
6 | let _ = quote! { #(#ip)* };
| ^^^^^^^^^^^^^^^^^^ method not found in `std::net::Ipv4Addr`
Expand All @@ -86,7 +86,7 @@ error[E0599]: no method named `quote_into_iter` found for struct `std::net::Ipv4

test_normalize! {test_type_dir_backslash "
error[E0277]: `*mut _` cannot be shared between threads safely
--> /git/trybuild/test_suite/ui/compile-fail-3.rs:7:5
--> /git/trybuild/test_suite/tests/ui/compile-fail-3.rs:7:5
|
7 | thread::spawn(|| {
| ^^^^^^^^^^^^^ `*mut _` cannot be shared between threads safely
Expand All @@ -96,7 +96,7 @@ error[E0277]: `*mut _` cannot be shared between threads safely
= note: required because it appears within the type `[closure@/git/trybuild/test_suite/ui/compile-fail-3.rs:7:19: 9:6 x:&*mut _]`
" "
error[E0277]: `*mut _` cannot be shared between threads safely
--> $DIR/ui/compile-fail-3.rs:7:5
--> tests/ui/compile-fail-3.rs:7:5
|
7 | thread::spawn(|| {
| ^^^^^^^^^^^^^ `*mut _` cannot be shared between threads safely
Expand Down