diff options
| author | Matthias Einwag <matthias.einwag@live.com> | 2019-02-12 22:46:14 -0800 |
|---|---|---|
| committer | Matthias Einwag <matthias.einwag@live.com> | 2019-02-12 22:46:14 -0800 |
| commit | 871338c3aed87cb84f02ebd7fd9b447966d5b05d (patch) | |
| tree | a2e1315d7d17d0b9f3463686ed2fbf36f3238ec4 /src/libsyntax/diagnostics | |
| parent | 1ef34a5a39641846e824b6450a705d6031002beb (diff) | |
| parent | 0f949c2fcc696d0260a99196d5e5400c59a26a54 (diff) | |
| download | rust-871338c3aed87cb84f02ebd7fd9b447966d5b05d.tar.gz rust-871338c3aed87cb84f02ebd7fd9b447966d5b05d.zip | |
Merging master
Diffstat (limited to 'src/libsyntax/diagnostics')
| -rw-r--r-- | src/libsyntax/diagnostics/metadata.rs | 13 | ||||
| -rw-r--r-- | src/libsyntax/diagnostics/plugin.rs | 29 |
2 files changed, 22 insertions, 20 deletions
diff --git a/src/libsyntax/diagnostics/metadata.rs b/src/libsyntax/diagnostics/metadata.rs index abde3dca0f6..704135fe1d5 100644 --- a/src/libsyntax/diagnostics/metadata.rs +++ b/src/libsyntax/diagnostics/metadata.rs @@ -12,8 +12,9 @@ use std::error::Error; use rustc_serialize::json::as_json; use syntax_pos::{Span, FileName}; -use ext::base::ExtCtxt; -use diagnostics::plugin::{ErrorMap, ErrorInfo}; + +use crate::ext::base::ExtCtxt; +use crate::diagnostics::plugin::{ErrorMap, ErrorInfo}; /// JSON encodable/decodable version of `ErrorInfo`. #[derive(PartialEq, RustcDecodable, RustcEncodable)] @@ -33,8 +34,8 @@ pub struct ErrorLocation { } impl ErrorLocation { - /// Create an error location from a span. - pub fn from_span(ecx: &ExtCtxt, sp: Span) -> ErrorLocation { + /// Creates an error location from a span. + pub fn from_span(ecx: &ExtCtxt<'_>, sp: Span) -> ErrorLocation { let loc = ecx.source_map().lookup_char_pos_adj(sp.lo()); ErrorLocation { filename: loc.filename, @@ -43,7 +44,7 @@ impl ErrorLocation { } } -/// Get the directory where metadata for a given `prefix` should be stored. +/// Gets the directory where metadata for a given `prefix` should be stored. /// /// See `output_metadata`. pub fn get_metadata_dir(prefix: &str) -> PathBuf { @@ -62,7 +63,7 @@ fn get_metadata_path(directory: PathBuf, name: &str) -> PathBuf { /// /// For our current purposes the prefix is the target architecture and the name is a crate name. /// If an error occurs steps will be taken to ensure that no file is created. -pub fn output_metadata(ecx: &ExtCtxt, prefix: &str, name: &str, err_map: &ErrorMap) +pub fn output_metadata(ecx: &ExtCtxt<'_>, prefix: &str, name: &str, err_map: &ErrorMap) -> Result<(), Box<dyn Error>> { // Create the directory to place the file in. diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index fa6b825f2a2..e79378d93bd 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -1,20 +1,21 @@ use std::collections::BTreeMap; use std::env; -use ast; -use ast::{Ident, Name}; -use source_map; +use crate::ast::{self, Ident, Name}; +use crate::source_map; +use crate::ext::base::{ExtCtxt, MacEager, MacResult}; +use crate::ext::build::AstBuilder; +use crate::parse::token; +use crate::ptr::P; +use crate::symbol::{keywords, Symbol}; +use crate::tokenstream::{TokenTree}; + +use smallvec::smallvec; use syntax_pos::Span; -use ext::base::{ExtCtxt, MacEager, MacResult}; -use ext::build::AstBuilder; -use parse::token; -use ptr::P; -use symbol::{keywords, Symbol}; -use tokenstream::{TokenTree}; -use diagnostics::metadata::output_metadata; +use crate::diagnostics::metadata::output_metadata; -pub use errors::*; +pub use crate::errors::*; // Maximum width of any line in an extended error description (inclusive). const MAX_DESCRIPTION_WIDTH: usize = 80; @@ -28,7 +29,7 @@ pub struct ErrorInfo { /// Mapping from error codes to metadata. pub type ErrorMap = BTreeMap<Name, ErrorInfo>; -pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt, +pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt<'_>, span: Span, token_tree: &[TokenTree]) -> Box<dyn MacResult+'cx> { @@ -61,7 +62,7 @@ pub fn expand_diagnostic_used<'cx>(ecx: &'cx mut ExtCtxt, MacEager::expr(ecx.expr_tuple(span, Vec::new())) } -pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, +pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt<'_>, span: Span, token_tree: &[TokenTree]) -> Box<dyn MacResult+'cx> { @@ -134,7 +135,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, } #[allow(deprecated)] -pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, +pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt<'_>, span: Span, token_tree: &[TokenTree]) -> Box<dyn MacResult+'cx> { |
