diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-02-21 16:45:18 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-08-01 13:12:15 +0200 |
commit | 68ec9f41ae49f14f510720a4e8dafbd49a279c58 (patch) | |
tree | 7e17ab96aeb62d92383873438d249d4f327f3e75 /gcc/rust/checks/errors/rust-ast-validation.cc | |
parent | 240b7c888450868b6c8c6fe7be855432d161c08f (diff) | |
download | gcc-68ec9f41ae49f14f510720a4e8dafbd49a279c58.zip gcc-68ec9f41ae49f14f510720a4e8dafbd49a279c58.tar.gz gcc-68ec9f41ae49f14f510720a4e8dafbd49a279c58.tar.bz2 |
gccrs: Replace reference to unique pointer with reference
Reference to unique pointers are a known anti pattern, only the element
shall be taken by reference instead of the whole wrapper.
gcc/rust/ChangeLog:
* ast/rust-item.h: Change getter function prototype to return a
reference directly instead of a reference to the wrapper type.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Fix
the code to accept references instead.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Change
function implementation to return a reference.
* hir/rust-ast-lower-base.h: Accept a reference instead of a unique
pointer reference.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt the code
to a reference instead of a unique pointer.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc/rust/checks/errors/rust-ast-validation.cc')
-rw-r--r-- | gcc/rust/checks/errors/rust-ast-validation.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc b/gcc/rust/checks/errors/rust-ast-validation.cc index d1edb89..d589208 100644 --- a/gcc/rust/checks/errors/rust-ast-validation.cc +++ b/gcc/rust/checks/errors/rust-ast-validation.cc @@ -100,7 +100,7 @@ ASTValidation::visit (AST::Function &function) && context.back () != Context::INHERENT_IMPL && function.has_self_param ()) rust_error_at ( - function.get_self_param ()->get_locus (), + function.get_self_param ().get_locus (), "%<self%> parameter is only allowed in associated functions"); if (function.is_external ()) |