From f6526512751bfe29a0bf9535bc41db2076ff57ba Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Tue, 11 Oct 2016 14:02:06 -0400 Subject: retool EarlyLint to track a Diagnostic --- src/librustc_errors/diagnostic.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index dab8fb665ac..cb03257a5ee 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -166,6 +166,14 @@ impl Diagnostic { self.level } + /// Used by a lint. Copies over all details *but* the "main + /// message". + pub fn copy_details_not_message(&mut self, from: &Diagnostic) { + self.span = from.span.clone(); + self.code = from.code.clone(); + self.children.extend(from.children.iter().cloned()) + } + /// Convenience function for internal use, clients should use one of the /// public methods above. fn sub(&mut self, -- cgit 1.4.1-3-g733a5