aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/util/rust-hir-map.cc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-03-01 17:26:07 +0000
committerGitHub <noreply@github.com>2022-03-01 17:26:07 +0000
commit6cf9f8c99c5813a23d7cec473fedf00683f409e4 (patch)
treecd590bc5f7b266c043499899e0529ff4c16cc5ec /gcc/rust/util/rust-hir-map.cc
parente82b59dfc9319d72f891bac099bfa0f46d8b8c99 (diff)
parentf7ff6020f8c68e4fb54c17c4460aa7f8a31f85bd (diff)
downloadgcc-6cf9f8c99c5813a23d7cec473fedf00683f409e4.zip
gcc-6cf9f8c99c5813a23d7cec473fedf00683f409e4.tar.gz
gcc-6cf9f8c99c5813a23d7cec473fedf00683f409e4.tar.bz2
Merge #983
983: Parse proper cfg values r=CohenArthur a=CohenArthur Closes #936 Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
Diffstat (limited to 'gcc/rust/util/rust-hir-map.cc')
-rw-r--r--gcc/rust/util/rust-hir-map.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/rust/util/rust-hir-map.cc b/gcc/rust/util/rust-hir-map.cc
index d154a8a..9190bd9 100644
--- a/gcc/rust/util/rust-hir-map.cc
+++ b/gcc/rust/util/rust-hir-map.cc
@@ -139,7 +139,10 @@ NodeId
Mappings::get_next_node_id (CrateNum crateNum)
{
auto it = nodeIdIter.find (crateNum);
- rust_assert (it != nodeIdIter.end ());
+ // We're probably *not* parsing actual rust code... but mostly reusing
+ // the parser in another way. Return 0
+ if (it == nodeIdIter.end ())
+ return 0;
auto id = it->second + 1;
nodeIdIter[crateNum] = id;