Skip to content

Commit

Permalink
Merge pull request #213 from compiler-errors/long-type-names
Browse files Browse the repository at this point in the history
Delete 'full type name' notes
  • Loading branch information
dtolnay committed Jan 4, 2023
2 parents 03fb0fe + 97bc94e commit e4cf47c
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
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 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"
}

0 comments on commit e4cf47c

Please sign in to comment.