diff options
author | Thomas Schwinge <thomas@codesourcery.com> | 2021-10-28 23:36:37 +0200 |
---|---|---|
committer | Philip Herron <herron.philip@googlemail.com> | 2021-11-05 16:34:22 +0000 |
commit | 864fd885fe89de76a48d8295d4505e5d7a72a6c8 (patch) | |
tree | b1f80026b840eed94e655a724c4fe8fbacfa570f /gcc/rust/backend/rust-compile-item.h | |
parent | 228240f32114fbbc17b73b1e91f245177c5aacc7 (diff) | |
download | gcc-864fd885fe89de76a48d8295d4505e5d7a72a6c8.zip gcc-864fd885fe89de76a48d8295d4505e5d7a72a6c8.tar.gz gcc-864fd885fe89de76a48d8295d4505e5d7a72a6c8.tar.bz2 |
Turn 'rust_error_at' plus always-failing 'rust_assert' into 'rust_internal_error_at'
These three were added in commit cbfc0ee239fafc0dadaae314138410f9119c65fa
"This allows for query based compilation", part of
<https://github.com/Rust-GCC/gccrs/pull/640> "Optional Trait items constants".
Given:
if ([...]
&& [X])
{
rust_error_at ([...]);
rust_assert (![X]);
}
..., this means that the 'rust_assert' always fires, so this is a condition
that is not meant to happen (also, there are no test cases triggering this),
so use 'rust_internal_error_at' instead.
Diffstat (limited to 'gcc/rust/backend/rust-compile-item.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index b64f6f0..6691c2a 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -48,12 +48,9 @@ public: if (is_query_mode && ctx->get_backend ()->is_error_expression (compiler.reference)) - { - rust_error_at (ref_locus, "failed to compile item: %s", - item->as_string ().c_str ()); - rust_assert ( - !ctx->get_backend ()->is_error_expression (compiler.reference)); - } + rust_internal_error_at (ref_locus, "failed to compile item: %s", + item->as_string ().c_str ()); + return compiler.reference; } |