Skip to content

Commit 3d74e85

Browse files
committed
Invert dependency between rustc_error_messages and rustc_ast*.
`rustc_error_messages` currently depends on `rustc_ast`/`rustc_ast_pretty`. This is odd, because `rustc_error_messages` feels like a very low-level module but `rustc_ast`/`rustc_ast_pretty` do not. The reason is that a few AST types impl `IntoDiagArg` via pretty-printing. `rustc_error_messages` can define `IntoDiagArg` and then impl it for the AST types. But if we invert the dependency we hit a problem with the orphan rule: `rustc_ast` must impl `IntoDiagArg` for the AST types, but that requires calling pretty-printing code which is in `rustc_ast_pretty`, a downstream crate. This commit avoids this problem by just removing the `IntoDiagArg` impls for these AST types. There aren't that many of them, and we can just use `String` in the relevant error structs and use the pretty printer in the downstream crates that construct the error structs. There are plenty of existing examples where `String` is used in error structs. There is now no dependency between `rustc_ast*` and `rustc_error_messages`.
1 parent efbbd33 commit 3d74e85

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/intrinsic/simd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
828828
return_error!(InvalidMonomorphization::FloatingPointVector {
829829
span,
830830
name,
831-
f_ty: *f,
831+
f_ty: f.name_str().to_string(),
832832
in_ty
833833
});
834834
}

0 commit comments

Comments
 (0)