diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-04-17 17:42:30 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-04-17 17:51:25 +0100 |
commit | 2b7807f0ac8fbf5b79dc45380053a47b7114b12a (patch) | |
tree | 056da82d9f62ec02115e61c8535383c7a246d8ed /gcc | |
parent | 01486c14135646ea011dfa2c3a1dfbf59abbe436 (diff) | |
download | gcc-2b7807f0ac8fbf5b79dc45380053a47b7114b12a.zip gcc-2b7807f0ac8fbf5b79dc45380053a47b7114b12a.tar.gz gcc-2b7807f0ac8fbf5b79dc45380053a47b7114b12a.tar.bz2 |
Enable RichLocations for multiple candidate errors in Path resolution
This means we get a single error for the failure but still see the location
for each dup.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-hir-path-probe.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gcc/rust/typecheck/rust-hir-path-probe.h b/gcc/rust/typecheck/rust-hir-path-probe.h index a838565..5dda90a 100644 --- a/gcc/rust/typecheck/rust-hir-path-probe.h +++ b/gcc/rust/typecheck/rust-hir-path-probe.h @@ -129,31 +129,34 @@ public: static void Report (std::vector<PathProbeCandidate> &candidates, const HIR::PathIdentSegment &query, Location query_locus) { - rust_error_at (query_locus, "multiple applicable items in scope for: %s", - query.as_string ().c_str ()); - - ReportMultipleCandidateError visitor; + RichLocation r (query_locus); + ReportMultipleCandidateError visitor (r); for (auto &c : candidates) c.impl_item->accept_vis (visitor); + + rust_error_at (r, "multiple applicable items in scope for: %s", + query.as_string ().c_str ()); } void visit (HIR::ConstantItem &constant) override { - rust_error_at (constant.get_locus (), "possible candidate"); + r.add_range (constant.get_locus ()); } void visit (HIR::Function &function) override { - rust_error_at (function.get_locus (), "possible candidate"); + r.add_range (function.get_locus ()); } void visit (HIR::Method &method) override { - rust_error_at (method.get_locus (), "possible candidate"); + r.add_range (method.get_locus ()); } private: - ReportMultipleCandidateError () : TypeCheckBase () {} + ReportMultipleCandidateError (RichLocation &r) : TypeCheckBase (), r (r) {} + + RichLocation &r; }; } // namespace Resolver |