diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-12-03 18:08:17 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-12-03 18:08:17 +0000 |
commit | 070ecef24912910417ca723cb2f1d1b350cc79d8 (patch) | |
tree | 497bb2da8411f77288d4b05360f353898ee7fde1 /crates | |
parent | ec2bdd3c16c326716acd4936845aed16c892c833 (diff) | |
parent | 957fb1879905dc3496992de2241d0847c253e508 (diff) |
Merge #6713
6713: Make `compile_error!` message match upstream rustc r=jonas-schievink a=jonas-schievink
It only consists of the argument passed to it.
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_def/src/body/tests.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/builtin_macro.rs | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/crates/hir_def/src/body/tests.rs b/crates/hir_def/src/body/tests.rs index 7e78340ee..6dba9817d 100644 --- a/crates/hir_def/src/body/tests.rs +++ b/crates/hir_def/src/body/tests.rs | |||
@@ -107,7 +107,7 @@ fn f() { | |||
107 | //^^^^^^^^^^^^^^^ `OUT_DIR` not set, enable "load out dirs from check" to fix | 107 | //^^^^^^^^^^^^^^^ `OUT_DIR` not set, enable "load out dirs from check" to fix |
108 | 108 | ||
109 | compile_error!("compile_error works"); | 109 | compile_error!("compile_error works"); |
110 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `compile_error!` called: compile_error works | 110 | //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ compile_error works |
111 | 111 | ||
112 | // Lazy: | 112 | // Lazy: |
113 | 113 | ||
diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs index 16c3c4d69..44a5556b6 100644 --- a/crates/hir_expand/src/builtin_macro.rs +++ b/crates/hir_expand/src/builtin_macro.rs | |||
@@ -271,10 +271,7 @@ fn compile_error_expand( | |||
271 | let text = it.text.as_str(); | 271 | let text = it.text.as_str(); |
272 | if text.starts_with('"') && text.ends_with('"') { | 272 | if text.starts_with('"') && text.ends_with('"') { |
273 | // FIXME: does not handle raw strings | 273 | // FIXME: does not handle raw strings |
274 | mbe::ExpandError::Other(format!( | 274 | mbe::ExpandError::Other(text[1..text.len() - 1].to_string()) |
275 | "`compile_error!` called: {}", | ||
276 | &text[1..text.len() - 1] | ||
277 | )) | ||
278 | } else { | 275 | } else { |
279 | mbe::ExpandError::BindingError("`compile_error!` argument must be a string".into()) | 276 | mbe::ExpandError::BindingError("`compile_error!` argument must be a string".into()) |
280 | } | 277 | } |