aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-08-10 23:44:33 +0000
committerGitHub <noreply@github.com>2021-08-10 23:44:33 +0000
commit0c2c4d3f28e732b1f6b24f2b4e9698e66ced3048 (patch)
treef93778aa2162e759079be2a398fae8cfac91b367 /gcc
parente10f3d65566101c774a308f8286e2827455941ed (diff)
parent7e1813b56d8e4bc0f2c0cf3174ed1b07c34c0bee (diff)
downloadgcc-0c2c4d3f28e732b1f6b24f2b4e9698e66ced3048.zip
gcc-0c2c4d3f28e732b1f6b24f2b4e9698e66ced3048.tar.gz
gcc-0c2c4d3f28e732b1f6b24f2b4e9698e66ced3048.tar.bz2
Merge #619
619: Rename CanonicalPath::is_error to is_empty r=philberty a=dkm `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. Co-authored-by: Marc Poulhiès <dkm@kataplop.net>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-implitem.h2
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-type.h4
-rw-r--r--gcc/rust/resolve/rust-name-resolver.h6
3 files changed, 6 insertions, 6 deletions
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<std::pair<NodeId, std::string>> copy (segs);