From 7e1813b56d8e4bc0f2c0cf3174ed1b07c34c0bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Date: Fri, 6 Aug 2021 13:13:46 +0200 Subject: Rename CanonicalPath::is_error to is_empty `is_error` connotes that an error has been found or that the object is faulty. It is possible to `create_empty` paths and pass them around. Having to use `is_error` to test for valid emptiness can be misleading. --- gcc/rust/resolve/rust-ast-resolve-implitem.h | 2 +- gcc/rust/resolve/rust-ast-resolve-type.h | 4 ++-- gcc/rust/resolve/rust-name-resolver.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/rust/resolve/rust-ast-resolve-implitem.h b/gcc/rust/resolve/rust-ast-resolve-implitem.h index 6437be2..47cf5be 100644 --- a/gcc/rust/resolve/rust-ast-resolve-implitem.h +++ b/gcc/rust/resolve/rust-ast-resolve-implitem.h @@ -111,7 +111,7 @@ private: ResolveToplevelImplItem (const CanonicalPath &prefix) : ResolverBase (UNKNOWN_NODEID), prefix (prefix) { - rust_assert (!prefix.is_error ()); + rust_assert (!prefix.is_empty ()); } const CanonicalPath &prefix; diff --git a/gcc/rust/resolve/rust-ast-resolve-type.h b/gcc/rust/resolve/rust-ast-resolve-type.h index 46ebdc4..49f1332 100644 --- a/gcc/rust/resolve/rust-ast-resolve-type.h +++ b/gcc/rust/resolve/rust-ast-resolve-type.h @@ -193,7 +193,7 @@ public: = ResolveTypeToCanonicalPath::resolve (path, canonicalize_type_with_generics, true); - if (canonical_path.is_error ()) + if (canonical_path.is_empty ()) { rust_error_at (path.get_locus (), "Failed to resolve canonical path for TypePath"); @@ -201,7 +201,7 @@ public: } CanonicalPath lookup = canonical_path; - if (!prefix.is_error ()) + if (!prefix.is_empty ()) lookup = prefix.append (canonical_path); auto resolver = Resolver::get (); diff --git a/gcc/rust/resolve/rust-name-resolver.h b/gcc/rust/resolve/rust-name-resolver.h index 23e5b65..5f01b94 100644 --- a/gcc/rust/resolve/rust-name-resolver.h +++ b/gcc/rust/resolve/rust-name-resolver.h @@ -80,12 +80,12 @@ public: static CanonicalPath create_empty () { return CanonicalPath ({}); } - bool is_error () const { return segs.size () == 0; } + bool is_empty () const { return segs.size () == 0; } CanonicalPath append (const CanonicalPath &other) const { - rust_assert (!other.is_error ()); - if (is_error ()) + rust_assert (!other.is_empty ()); + if (is_empty ()) return CanonicalPath (other.segs); std::vector> copy (segs); -- cgit v1.1