gcc/rust/ChangeLog:
* lex/rust-lex.cc
(Lexer::classify_keyword): Check if iterator is valid before dereferencing.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Lexer::classify_keyword (const std::string &str)
{
auto keyword = keywords.find (str);
- auto id = keyword->second;
if (keyword == keywords.end ())
return IDENTIFIER;
+ auto id = keyword->second;
+
// We now have the expected token ID of the reserved keyword. However, some
// keywords are reserved starting in certain editions. For example, `try` is
// only a reserved keyword in editions >=2018. The language might gain new