Skip to content

Rustfmt librustc resolve #29387

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
523 changes: 267 additions & 256 deletions src/librustc_resolve/build_reduced_graph.rs

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions src/librustc_resolve/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use rustc_front::hir;
use rustc_front::hir::{ViewPathGlob, ViewPathList, ViewPathSimple};
use rustc_front::visit::{self, Visitor};

struct UnusedImportCheckVisitor<'a, 'b:'a, 'tcx:'b> {
resolver: &'a mut Resolver<'b, 'tcx>
struct UnusedImportCheckVisitor<'a, 'b: 'a, 'tcx: 'b> {
resolver: &'a mut Resolver<'b, 'tcx>,
}

// Deref and DerefMut impls allow treating UnusedImportCheckVisitor as Resolver.
Expand All @@ -51,16 +51,16 @@ impl<'a, 'b, 'tcx:'b> DerefMut for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
}

impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
// We have information about whether `use` (import) directives are actually used now.
// If an import is not used at all, we signal a lint error. If an import is only used
// for a single namespace, we remove the other namespace from the recorded privacy
// information. That means in privacy.rs, we will only check imports and namespaces
// which are used. In particular, this means that if an import could name either a
// public or private item, we will check the correct thing, dependent on how the import
// is used.
// We have information about whether `use` (import) directives are actually
// used now. If an import is not used at all, we signal a lint error. If an
// import is only used for a single namespace, we remove the other namespace
// from the recorded privacy information. That means in privacy.rs, we will
// only check imports and namespaces which are used. In particular, this
// means that if an import could name either a public or private item, we
// will check the correct thing, dependent on how the import is used.
fn finalize_import(&mut self, id: ast::NodeId, span: Span) {
debug!("finalizing import uses for {:?}",
self.session.codemap().span_to_snippet(span));
self.session.codemap().span_to_snippet(span));

if !self.used_imports.contains(&(id, TypeNS)) &&
!self.used_imports.contains(&(id, ValueNS)) {
Expand Down Expand Up @@ -99,14 +99,14 @@ impl<'a, 'b, 'tcx> UnusedImportCheckVisitor<'a, 'b, 'tcx> {
// we might have two LastPrivates pointing at the same thing. There is no point
// checking both, so lets not check the value one.
(Some(DependsOn(def_v)), Some(DependsOn(def_t))) if def_v == def_t => v_used = Unused,
_ => {},
_ => {}
}

path_res.last_private = LastImport {
value_priv: v_priv,
value_used: v_used,
type_priv: t_priv,
type_used: t_used
type_used: t_used,
};
}
}
Expand All @@ -132,7 +132,7 @@ impl<'a, 'b, 'v, 'tcx> Visitor<'v> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
"unused extern crate".to_string());
}
}
},
}
hir::ItemUse(ref p) => {
match p.node {
ViewPathSimple(_, _) => {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

#![allow(non_snake_case)]

// Error messages for EXXXX errors.
// Each message should start and end with a new line, and be wrapped to 80 characters.
// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
// Error messages for EXXXX errors. Each message should start and end with a
// new line, and be wrapped to 80 characters. In vim you can `:set tw=80` and
// use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
register_long_diagnostics! {

E0154: r##"
Expand Down
Loading