diff --git a/gcc/rust/hir/tree/rust-hir-path.h b/gcc/rust/hir/tree/rust-hir-path.h index f390b43ca0ba..c07448060431 100644 --- a/gcc/rust/hir/tree/rust-hir-path.h +++ b/gcc/rust/hir/tree/rust-hir-path.h @@ -321,7 +321,7 @@ class PathPattern : public Pattern PathExprSegment &get_root_seg () { return segments.at (0); } - PathExprSegment get_final_segment () const { return segments.back (); } + const PathExprSegment &get_final_segment () const { return segments.back (); } PatternType get_pattern_type () const override final {