pub use self::code_stats::{CodeStats, DataTypeKind, FieldInfo};
pub use self::code_stats::{SizeKind, TypeSizeInfo, VariantInfo};
-use dep_graph::{DepGraph, DepNode};
-use hir::def_id::{DefId, CrateNum, DefIndex, CRATE_DEF_INDEX};
+use dep_graph::DepGraph;
+use hir::def_id::{CrateNum, DefIndex};
+
use lint;
use middle::cstore::CrateStore;
use middle::dependency_format;
use syntax::symbol::Symbol;
use syntax::{ast, codemap};
use syntax::feature_gate::AttributeType;
-use syntax_pos::{Span, MultiSpan, FileMap};
+use syntax_pos::{Span, MultiSpan};
use rustc_back::{LinkerFlavor, PanicStrategy};
use rustc_back::target::Target;
use std::rc::Rc;
use std::fmt;
use std::time::Duration;
-use std::sync::Arc;
mod code_stats;
pub mod config;
pub fn struct_span_warn<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str)
- -> DiagnosticBuilder<'a> {
+ -> DiagnosticBuilder<'a> {
self.diagnostic().struct_span_warn(sp, msg)
}
pub fn struct_span_warn_with_code<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str,
code: &str)
- -> DiagnosticBuilder<'a> {
+ -> DiagnosticBuilder<'a> {
self.diagnostic().struct_span_warn_with_code(sp, msg, code)
}
pub fn struct_warn<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
pub fn struct_span_err<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str)
- -> DiagnosticBuilder<'a> {
+ -> DiagnosticBuilder<'a> {
self.diagnostic().struct_span_err(sp, msg)
}
pub fn struct_span_err_with_code<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str,
code: &str)
- -> DiagnosticBuilder<'a> {
+ -> DiagnosticBuilder<'a> {
self.diagnostic().struct_span_err_with_code(sp, msg, code)
}
- pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
+ // FIXME: This method should be removed (every error should have an associated error code).
+ pub fn struct_err<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
self.diagnostic().struct_err(msg)
}
+ pub fn struct_err_with_code<'a>(&'a self, msg: &str, code: &str) -> DiagnosticBuilder<'a> {
+ self.diagnostic().struct_err_with_code(msg, code)
+ }
pub fn struct_span_fatal<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str)
- -> DiagnosticBuilder<'a> {
+ -> DiagnosticBuilder<'a> {
self.diagnostic().struct_span_fatal(sp, msg)
}
pub fn struct_span_fatal_with_code<'a, S: Into<MultiSpan>>(&'a self,
sp: S,
msg: &str,
code: &str)
- -> DiagnosticBuilder<'a> {
+ -> DiagnosticBuilder<'a> {
self.diagnostic().struct_span_fatal_with_code(sp, msg, code)
}
pub fn struct_fatal<'a>(&'a self, msg: &str) -> DiagnosticBuilder<'a> {
};
let target_cfg = config::build_target_config(&sopts, &span_diagnostic);
- // Hook up the codemap with a callback that allows it to register FileMap
- // accesses with the dependency graph.
- let cm_depgraph = dep_graph.clone();
- let codemap_dep_tracking_callback = Box::new(move |filemap: &FileMap| {
- let def_id = DefId {
- krate: CrateNum::from_u32(filemap.crate_of_origin),
- index: CRATE_DEF_INDEX,
- };
- let name = Arc::new(filemap.name.clone());
- let dep_node = DepNode::FileMap(def_id, name);
-
- cm_depgraph.read(dep_node);
- });
- codemap.set_dep_tracking_callback(codemap_dep_tracking_callback);
-
let p_s = parse::ParseSess::with_span_handler(span_diagnostic, codemap);
let default_sysroot = match sopts.maybe_sysroot {
Some(_) => None,