Skip to content

Commit 957fb18

Browse files
Make compile_error! message match upstream rustc
It only consists of the argument passed to it
1 parent ec2bdd3 commit 957fb18

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

crates/hir_def/src/body/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn f() {
107107
//^^^^^^^^^^^^^^^ `OUT_DIR` not set, enable "load out dirs from check" to fix
108108
109109
compile_error!("compile_error works");
110-
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `compile_error!` called: compile_error works
110+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ compile_error works
111111
112112
// Lazy:
113113

crates/hir_expand/src/builtin_macro.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,7 @@ fn compile_error_expand(
271271
let text = it.text.as_str();
272272
if text.starts_with('"') && text.ends_with('"') {
273273
// FIXME: does not handle raw strings
274-
mbe::ExpandError::Other(format!(
275-
"`compile_error!` called: {}",
276-
&text[1..text.len() - 1]
277-
))
274+
mbe::ExpandError::Other(text[1..text.len() - 1].to_string())
278275
} else {
279276
mbe::ExpandError::BindingError("`compile_error!` argument must be a string".into())
280277
}

0 commit comments

Comments
 (0)