Skip to content

Commit d0a9a39

Browse files
committed
Rename found_ast to FoundAst and qualify uses.
This matches contemporary Rust style.
1 parent a530cc9 commit d0a9a39

File tree

4 files changed

+20
-24
lines changed

4 files changed

+20
-24
lines changed

src/librustc/metadata/csearch.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010

1111
// Searching for information from the cstore
1212

13-
#![allow(non_camel_case_types)]
14-
15-
pub use self::found_ast::*;
16-
1713
use metadata::common::*;
1814
use metadata::cstore;
1915
use metadata::decoder;
@@ -101,18 +97,18 @@ pub fn get_item_path(tcx: &ty::ctxt, def: ast::DefId) -> Vec<ast_map::PathElem>
10197
r
10298
}
10399

104-
pub enum found_ast<'ast> {
105-
found(&'ast ast::InlinedItem),
106-
found_parent(ast::DefId, &'ast ast::InlinedItem),
107-
not_found,
100+
pub enum FoundAst<'ast> {
101+
Found(&'ast ast::InlinedItem),
102+
FoundParent(ast::DefId, &'ast ast::InlinedItem),
103+
NotFound,
108104
}
109105

110106
// Finds the AST for this item in the crate metadata, if any. If the item was
111107
// not marked for inlining, then the AST will not be present and hence none
112108
// will be returned.
113109
pub fn maybe_get_item_ast<'tcx>(tcx: &ty::ctxt<'tcx>, def: ast::DefId,
114110
decode_inlined_item: decoder::DecodeInlinedItem)
115-
-> found_ast<'tcx> {
111+
-> FoundAst<'tcx> {
116112
let cstore = &tcx.sess.cstore;
117113
let cdata = cstore.get_crate_data(def.krate);
118114
decoder::maybe_get_item_ast(&*cdata, tcx, def.node, decode_inlined_item)

src/librustc/metadata/decoder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -693,23 +693,23 @@ pub type DecodeInlinedItem<'a> =
693693

694694
pub fn maybe_get_item_ast<'tcx>(cdata: Cmd, tcx: &ty::ctxt<'tcx>, id: ast::NodeId,
695695
mut decode_inlined_item: DecodeInlinedItem)
696-
-> csearch::found_ast<'tcx> {
696+
-> csearch::FoundAst<'tcx> {
697697
debug!("Looking up item: {}", id);
698698
let item_doc = lookup_item(id, cdata.data());
699699
let path = item_path(item_doc).init().to_vec();
700700
match decode_inlined_item(cdata, tcx, path, item_doc) {
701-
Ok(ii) => csearch::found(ii),
701+
Ok(ii) => csearch::FoundAst::Found(ii),
702702
Err(path) => {
703703
match item_parent_item(item_doc) {
704704
Some(did) => {
705705
let did = translate_def_id(cdata, did);
706706
let parent_item = lookup_item(did.node, cdata.data());
707707
match decode_inlined_item(cdata, tcx, path, parent_item) {
708-
Ok(ii) => csearch::found_parent(did, ii),
709-
Err(_) => csearch::not_found
708+
Ok(ii) => csearch::FoundAst::FoundParent(did, ii),
709+
Err(_) => csearch::FoundAst::NotFound
710710
}
711711
}
712-
None => csearch::not_found
712+
None => csearch::FoundAst::NotFound
713713
}
714714
}
715715
}

src/librustc/middle/const_eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt,
133133
}
134134
let expr_id = match csearch::maybe_get_item_ast(tcx, enum_def,
135135
box |a, b, c, d| astencode::decode_inlined_item(a, b, c, d)) {
136-
csearch::found(&ast::IIItem(ref item)) => match item.node {
136+
csearch::FoundAst::Found(&ast::IIItem(ref item)) => match item.node {
137137
ast::ItemEnum(ast::EnumDef { ref variants }, _) => {
138138
// NOTE this doesn't do the right thing, it compares inlined
139139
// NodeId's to the original variant_def's NodeId, but they
@@ -173,7 +173,7 @@ pub fn lookup_const_by_id<'a>(tcx: &'a ty::ctxt, def_id: ast::DefId)
173173
}
174174
let expr_id = match csearch::maybe_get_item_ast(tcx, def_id,
175175
box |a, b, c, d| astencode::decode_inlined_item(a, b, c, d)) {
176-
csearch::found(&ast::IIItem(ref item)) => match item.node {
176+
csearch::FoundAst::Found(&ast::IIItem(ref item)) => match item.node {
177177
ast::ItemConst(_, ref const_expr) => Some(const_expr.id),
178178
_ => None
179179
},

src/librustc_trans/trans/inline.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
4343
box |a,b,c,d| astencode::decode_inlined_item(a, b, c, d));
4444

4545
let inline_def = match csearch_result {
46-
csearch::not_found => {
46+
csearch::FoundAst::NotFound => {
4747
ccx.external().borrow_mut().insert(fn_id, None);
4848
return None;
4949
}
50-
csearch::found(&ast::IIItem(ref item)) => {
50+
csearch::FoundAst::Found(&ast::IIItem(ref item)) => {
5151
ccx.external().borrow_mut().insert(fn_id, Some(item.id));
5252
ccx.external_srcs().borrow_mut().insert(item.id, fn_id);
5353

@@ -90,12 +90,12 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
9090

9191
local_def(item.id)
9292
}
93-
csearch::found(&ast::IIForeign(ref item)) => {
93+
csearch::FoundAst::Found(&ast::IIForeign(ref item)) => {
9494
ccx.external().borrow_mut().insert(fn_id, Some(item.id));
9595
ccx.external_srcs().borrow_mut().insert(item.id, fn_id);
9696
local_def(item.id)
9797
}
98-
csearch::found_parent(parent_id, &ast::IIItem(ref item)) => {
98+
csearch::FoundAst::FoundParent(parent_id, &ast::IIItem(ref item)) => {
9999
ccx.external().borrow_mut().insert(parent_id, Some(item.id));
100100
ccx.external_srcs().borrow_mut().insert(item.id, parent_id);
101101

@@ -124,11 +124,11 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
124124
trans_item(ccx, &**item);
125125
local_def(my_id)
126126
}
127-
csearch::found_parent(_, _) => {
128-
ccx.sess().bug("maybe_get_item_ast returned a found_parent \
127+
csearch::FoundAst::FoundParent(_, _) => {
128+
ccx.sess().bug("maybe_get_item_ast returned a FoundParent \
129129
with a non-item parent");
130130
}
131-
csearch::found(&ast::IITraitItem(_, ref trait_item)) => {
131+
csearch::FoundAst::Found(&ast::IITraitItem(_, ref trait_item)) => {
132132
match *trait_item {
133133
ast::RequiredMethod(_) => ccx.sess().bug("found RequiredMethod IITraitItem"),
134134
ast::ProvidedMethod(ref mth) => {
@@ -147,7 +147,7 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId)
147147
}
148148
}
149149
}
150-
csearch::found(&ast::IIImplItem(impl_did, ref impl_item)) => {
150+
csearch::FoundAst::Found(&ast::IIImplItem(impl_did, ref impl_item)) => {
151151
match *impl_item {
152152
ast::MethodImplItem(ref mth) => {
153153
ccx.external().borrow_mut().insert(fn_id, Some(mth.id));

0 commit comments

Comments
 (0)