about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-05 22:47:37 +0000
committerbors <bors@rust-lang.org>2020-12-05 22:47:37 +0000
commitbb0d481b5a9e78145f5644ec46015065fa83b4cc (patch)
tree5df7b8e07dd0109d4500e3b4e07b096a1cff12c7 /compiler/rustc_parse/src/parser
parente792288df31636ca28108516c63a00ce4267063a (diff)
parent19003517cea93d337df071e191ecd57259543cd4 (diff)
downloadrust-bb0d481b5a9e78145f5644ec46015065fa83b4cc.tar.gz
rust-bb0d481b5a9e78145f5644ec46015065fa83b4cc.zip
Auto merge of #79697 - rylev:clearer-const-diagnostic, r=oli-obk
A slightly clearer diagnostic when misusing const

Fixes #79598

This produces the following diagnostic:
"expected one of `>`, a const expression, lifetime, or type, found keyword `const`"

Instead of the previous, more confusing:
"expected one of `>`, const, lifetime, or type, found keyword `const`"

This might not be completely clear as some users might not understand what a const expression is, but I do believe this is an improvement.
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index b746256f5fe..22f308ff36d 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -264,7 +264,7 @@ impl TokenType {
             TokenType::Ident => "identifier".to_string(),
             TokenType::Path => "path".to_string(),
             TokenType::Type => "type".to_string(),
-            TokenType::Const => "const".to_string(),
+            TokenType::Const => "a const expression".to_string(),
         }
     }
 }