Skip to content

Commit

Permalink
Remove resolve's xray infrastructure
Browse files Browse the repository at this point in the history
Since the removal of privacy from resolve, this flag is no longer necessary to
get the test runner working. All of the privacy checks are bypassed by a special
item attribute in the privacy visitor.

Closes #4947
  • Loading branch information
alexcrichton committed Nov 11, 2013
1 parent 4d9b95f commit 0cc5e6c
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use syntax::ast::*;
use syntax::ast;
use syntax::ast_util::{def_id_of_def, local_def, mtwt_resolve};
use syntax::ast_util::{path_to_ident, walk_pat, trait_method_to_ty_method};
use syntax::attr;
use syntax::parse::token;
use syntax::parse::token::{ident_interner, interner_get};
use syntax::parse::token::special_idents;
Expand Down Expand Up @@ -254,19 +253,6 @@ enum MethodSort {
Provided(NodeId)
}

// The X-ray flag indicates that a context has the X-ray privilege, which
// allows it to reference private names. Currently, this is used for the test
// runner.
//
// FIXME #4947: The X-ray flag is kind of questionable in the first
// place. It might be better to introduce an expr_xray_path instead.

#[deriving(Eq)]
enum XrayFlag {
NoXray, //< Private items cannot be accessed.
Xray //< Private items can be accessed.
}

enum UseLexicalScopeFlag {
DontUseLexicalScope,
UseLexicalScope
Expand Down Expand Up @@ -831,7 +817,6 @@ fn Resolver(session: Session,
type_ribs: @mut ~[],
label_ribs: @mut ~[],

xray_context: NoXray,
current_trait_refs: None,

self_ident: special_idents::self_,
Expand Down Expand Up @@ -883,10 +868,6 @@ struct Resolver {
// The current set of local scopes, for labels.
label_ribs: @mut ~[@Rib],

// Whether the current context is an X-ray context. An X-ray context is
// allowed to access private names of any module.
xray_context: XrayFlag,

// The trait that the current context can refer to.
current_trait_refs: Option<~[DefId]>,

Expand Down Expand Up @@ -3545,13 +3526,6 @@ impl Resolver {
debug!("(resolving item) resolving {}",
self.session.str_of(item.ident));

// Items with the !resolve_unexported attribute are X-ray contexts.
// This is used to allow the test runner to run unexported tests.
let orig_xray_flag = self.xray_context;
if attr::contains_name(item.attrs, "!resolve_unexported") {
self.xray_context = Xray;
}

match item.node {

// enum item: resolve all the variants' discrs,
Expand Down Expand Up @@ -3715,8 +3689,6 @@ impl Resolver {
fail!("item macros unimplemented")
}
}

self.xray_context = orig_xray_flag;
}

fn with_type_parameter_rib(&mut self,
Expand Down

0 comments on commit 0cc5e6c

Please sign in to comment.