Skip to content
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

Delete 'full type name' notes #213

Merged
merged 1 commit into from Jan 4, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/normalize.rs
Expand Up @@ -48,6 +48,7 @@ normalizations! {
LinesOutsideInputFile,
Unindent,
AndOthers,
StripLongTypeNameFiles,
// 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 @@ -356,6 +357,14 @@ impl<'a> Filter<'a> {
}
}

if self.normalization >= StripLongTypeNameFiles {
let trimmed_line = line.trim_start();
let trimmed_line = trimmed_line.strip_prefix("= note: ").unwrap_or(trimmed_line);
if trimmed_line.starts_with("the full type name has been written to") {
return None;
}
}

line = line.replace(self.context.krate, "$CRATE");
line = replace_case_insensitive(&line, &self.context.source_dir.to_string_lossy(), "$DIR/");
line = replace_case_insensitive(
Expand Down
29 changes: 29 additions & 0 deletions src/tests.rs
Expand Up @@ -396,3 +396,32 @@ error[E0277]: no implementation for `u8 >> &str`
<&'a i128 as Shr<u16>>
and $N others
"}

test_normalize! {test_long_file_names "
error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<...>>>>>>`
--> src/main.rs:18:11
|
18 | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `test` defined here
--> src/main.rs:16:1
|
16 | fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the full type name has been written to `/playground/target/debug/deps/playground-c53df771d95c66fb.c7a39e8d0dd9c781.long-type-16688711729771999621.txt`
the full type name has been written to `/playground/target/debug/deps/playground-c53df771d95c66fb.c7a39e8d0dd9c781.long-type-16688711729771999621.txt`
" "
error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<...>>>>>>`
--> src/main.rs:18:11
|
18 | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: `test` defined here
--> src/main.rs:16:1
|
16 | fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"
}