aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-08-28 10:54:12 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:04:33 +0100
commit342b071a0fac00d8acf745348c41afcd48cdb4cb (patch)
treef9f33064139d7eddb76bba85020d23896990f651 /gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
parentc8911dde92a98f1c9230a04c62a5287b562bc720 (diff)
downloadgcc-342b071a0fac00d8acf745348c41afcd48cdb4cb.zip
gcc-342b071a0fac00d8acf745348c41afcd48cdb4cb.tar.gz
gcc-342b071a0fac00d8acf745348c41afcd48cdb4cb.tar.bz2
gccrs: resolver: Refactor assertion
Change the condition with rust_unreachable to an assertion. This will keep the code clean and concise. Some styling issues appeared during review, this commit make the code more readable. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Change to assertion. * util/rust-hir-map.cc (Mappings::lookup_derive_proc_macros): Add empty line. (Mappings::lookup_bang_proc_macros): Likewise. (Mappings::lookup_attribute_proc_macros): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc')
-rw-r--r--gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
index 6125298..a09c738 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -75,9 +75,8 @@ void
TopLevel::visit (AST::ExternCrate &crate)
{
CrateNum num;
- if (!Analysis::Mappings::get ()->lookup_crate_name (
- crate.get_referenced_crate (), num))
- rust_unreachable ();
+ rust_assert (Analysis::Mappings::get ()->lookup_crate_name (
+ crate.get_referenced_crate (), num));
auto attribute_macros
= Analysis::Mappings::get ()->lookup_attribute_proc_macros (num);