diff options
Diffstat (limited to 'components/style/error_reporting.rs')
-rw-r--r-- | components/style/error_reporting.rs | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/components/style/error_reporting.rs b/components/style/error_reporting.rs index e815d0bf29e..ca62212fdaf 100644 --- a/components/style/error_reporting.rs +++ b/components/style/error_reporting.rs @@ -11,16 +11,16 @@ use log; use servo_url::ServoUrl; /// A generic trait for an error reporter. -pub trait ParseErrorReporter { +pub trait ParseErrorReporter : Sync + Send { /// Called the style engine detects an error. /// /// Returns the current input being parsed, the source position it was /// reported from, and a message. - fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str, url: &ServoUrl); - /// Clone this error reporter. - /// - /// TODO(emilio): I'm pretty sure all the box shenanigans can go away. - fn clone(&self) -> Box<ParseErrorReporter + Send + Sync>; + fn report_error(&self, + input: &mut Parser, + position: SourcePosition, + message: &str, + url: &ServoUrl); } /// An error reporter that reports the errors to the `info` log channel. @@ -28,15 +28,14 @@ pub trait ParseErrorReporter { /// TODO(emilio): The name of this reporter is a lie, and should be renamed! pub struct StdoutErrorReporter; impl ParseErrorReporter for StdoutErrorReporter { - fn report_error(&self, input: &mut Parser, position: SourcePosition, message: &str, - url: &ServoUrl) { + fn report_error(&self, + input: &mut Parser, + position: SourcePosition, + message: &str, + url: &ServoUrl) { if log_enabled!(log::LogLevel::Info) { let location = input.source_location(position); info!("Url:\t{}\n{}:{} {}", url.as_str(), location.line, location.column, message) } } - - fn clone(&self) -> Box<ParseErrorReporter + Send + Sync> { - Box::new(StdoutErrorReporter) - } } |