Skip to content

Commit 754aaea

Browse files
committed
Remove snake_case names from ty.rs
1 parent 5d53921 commit 754aaea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+277
-285
lines changed

src/librustc/metadata/csearch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub fn get_item_attrs(cstore: &cstore::CStore,
197197

198198
pub fn get_struct_fields(cstore: &cstore::CStore,
199199
def: ast::DefId)
200-
-> Vec<ty::field_ty> {
200+
-> Vec<ty::FieldTy> {
201201
let cdata = cstore.get_crate_data(def.krate);
202202
decoder::get_struct_fields(cstore.intr.clone(), &*cdata, def.node)
203203
}

src/librustc/metadata/decoder.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ fn struct_field_family_to_visibility(family: Family) -> ast::Visibility {
10491049
}
10501050

10511051
pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
1052-
-> Vec<ty::field_ty> {
1052+
-> Vec<ty::FieldTy> {
10531053
let data = cdata.data();
10541054
let item = lookup_item(id, data);
10551055
reader::tagged_docs(item, tag_item_field).filter_map(|an_item| {
@@ -1059,7 +1059,7 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
10591059
let did = item_def_id(an_item, cdata);
10601060
let tagdoc = reader::get_doc(an_item, tag_item_field_origin);
10611061
let origin_id = translated_def_id(cdata, tagdoc);
1062-
Some(ty::field_ty {
1062+
Some(ty::FieldTy {
10631063
name: name,
10641064
id: did,
10651065
vis: struct_field_family_to_visibility(f),
@@ -1073,7 +1073,7 @@ pub fn get_struct_fields(intr: Rc<IdentInterner>, cdata: Cmd, id: ast::NodeId)
10731073
let tagdoc = reader::get_doc(an_item, tag_item_field_origin);
10741074
let f = item_family(an_item);
10751075
let origin_id = translated_def_id(cdata, tagdoc);
1076-
ty::field_ty {
1076+
ty::FieldTy {
10771077
name: special_idents::unnamed_field.name,
10781078
id: did,
10791079
vis: struct_field_family_to_visibility(f),

src/librustc/metadata/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ fn encode_parent_item(rbml_w: &mut Encoder, id: DefId) {
267267
}
268268

269269
fn encode_struct_fields(rbml_w: &mut Encoder,
270-
fields: &[ty::field_ty],
270+
fields: &[ty::FieldTy],
271271
origin: DefId) {
272272
for f in fields {
273273
if f.name == special_idents::unnamed_field.name {
@@ -636,7 +636,7 @@ fn encode_provided_source(rbml_w: &mut Encoder,
636636
/* Returns an index of items in this class */
637637
fn encode_info_for_struct(ecx: &EncodeContext,
638638
rbml_w: &mut Encoder,
639-
fields: &[ty::field_ty],
639+
fields: &[ty::FieldTy],
640640
global_index: &mut Vec<entry<i64>>)
641641
-> Vec<entry<i64>> {
642642
/* Each class has its own index, since different classes

src/librustc/metadata/tydecode.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ fn parse_ty_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> Ty<'tcx> w
525525
assert_eq!(next(st), ':');
526526
let len = parse_hex(st);
527527
assert_eq!(next(st), '#');
528-
let key = ty::creader_cache_key {cnum: st.krate,
528+
let key = ty::CReaderCacheKey {cnum: st.krate,
529529
pos: pos,
530530
len: len };
531531

@@ -587,11 +587,11 @@ fn parse_mutability(st: &mut PState) -> ast::Mutability {
587587
}
588588
}
589589

590-
fn parse_mt_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> ty::mt<'tcx> where
590+
fn parse_mt_<'a, 'tcx, F>(st: &mut PState<'a, 'tcx>, conv: &mut F) -> ty::TypeWithMutability<'tcx> where
591591
F: FnMut(DefIdSource, ast::DefId) -> ast::DefId,
592592
{
593593
let m = parse_mutability(st);
594-
ty::mt { ty: parse_ty_(st, conv), mutbl: m }
594+
ty::TypeWithMutability { ty: parse_ty_(st, conv), mutbl: m }
595595
}
596596

597597
fn parse_def_<F>(st: &mut PState, source: DefIdSource, conv: &mut F) -> ast::DefId where

src/librustc/metadata/tyencode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn enc_mutability(w: &mut Encoder, mt: ast::Mutability) {
183183
}
184184

185185
fn enc_mt<'a, 'tcx>(w: &mut Encoder, cx: &ctxt<'a, 'tcx>,
186-
mt: ty::mt<'tcx>) {
186+
mt: ty::TypeWithMutability<'tcx>) {
187187
enc_mutability(w, mt.mutbl);
188188
enc_ty(w, cx, mt.ty);
189189
}

src/librustc/middle/cast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ pub enum CastTy<'tcx> {
3636
/// Function Pointers
3737
FnPtr,
3838
/// Raw pointers
39-
Ptr(&'tcx ty::mt<'tcx>),
39+
Ptr(&'tcx ty::TypeWithMutability<'tcx>),
4040
/// References
41-
RPtr(&'tcx ty::mt<'tcx>),
41+
RPtr(&'tcx ty::TypeWithMutability<'tcx>),
4242
}
4343

4444
/// Cast Kind. See RFC 401 (or librustc_typeck/check/cast.rs)

src/librustc/middle/check_match.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ fn construct_witness(cx: &MatchCheckCtxt, ctor: &Constructor,
535535
}
536536
}
537537

538-
ty::TyRef(_, ty::mt { ty, mutbl }) => {
538+
ty::TyRef(_, ty::TypeWithMutability { ty, mutbl }) => {
539539
match ty.sty {
540540
ty::TyArray(_, n) => match ctor {
541541
&Single => {
@@ -600,7 +600,7 @@ fn all_constructors(cx: &MatchCheckCtxt, left_ty: Ty,
600600
ty::TyBool =>
601601
[true, false].iter().map(|b| ConstantValue(ConstVal::Bool(*b))).collect(),
602602

603-
ty::TyRef(_, ty::mt { ty, .. }) => match ty.sty {
603+
ty::TyRef(_, ty::TypeWithMutability { ty, .. }) => match ty.sty {
604604
ty::TySlice(_) =>
605605
range_inclusive(0, max_slice_length).map(|length| Slice(length)).collect(),
606606
_ => vec!(Single)
@@ -808,7 +808,7 @@ pub fn constructor_arity(cx: &MatchCheckCtxt, ctor: &Constructor, ty: Ty) -> usi
808808
match ty.sty {
809809
ty::TyTuple(ref fs) => fs.len(),
810810
ty::TyBox(_) => 1,
811-
ty::TyRef(_, ty::mt { ty, .. }) => match ty.sty {
811+
ty::TyRef(_, ty::TypeWithMutability { ty, .. }) => match ty.sty {
812812
ty::TySlice(_) => match *ctor {
813813
Slice(length) => length,
814814
ConstantValue(_) => 0,

src/librustc/middle/expr_use_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
720720
// are properly handled.
721721
self.walk_expr(with_expr);
722722

723-
fn contains_field_named(field: &ty::field,
723+
fn contains_field_named(field: &ty::Field,
724724
fields: &Vec<ast::Field>)
725725
-> bool
726726
{

src/librustc/middle/implicator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl<'a, 'tcx> Implicator<'a, 'tcx> {
115115

116116
ty::TyArray(t, _) |
117117
ty::TySlice(t) |
118-
ty::TyRawPtr(ty::mt { ty: t, .. }) |
118+
ty::TyRawPtr(ty::TypeWithMutability { ty: t, .. }) |
119119
ty::TyBox(t) => {
120120
self.accumulate_from_ty(t)
121121
}

src/librustc/middle/infer/combine.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub fn super_combine_tys<'a,'tcx:'a,R>(infcx: &InferCtxt<'a, 'tcx>,
108108
// All other cases of inference are errors
109109
(&ty::TyInfer(_), _) |
110110
(_, &ty::TyInfer(_)) => {
111-
Err(ty::terr_sorts(ty_relate::expected_found(relation, &a, &b)))
111+
Err(ty::Sorts(ty_relate::expected_found(relation, &a, &b)))
112112
}
113113

114114

@@ -278,7 +278,7 @@ impl<'a, 'tcx> CombineFields<'a, 'tcx> {
278278
};
279279
let u = ty.fold_with(&mut generalize);
280280
if generalize.cycle_detected {
281-
Err(ty::terr_cyclic_ty)
281+
Err(ty::CyclicTy)
282282
} else {
283283
Ok(u)
284284
}
@@ -363,12 +363,12 @@ impl<'cx, 'tcx> ty_fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
363363

364364
pub trait RelateResultCompare<'tcx, T> {
365365
fn compare<F>(&self, t: T, f: F) -> RelateResult<'tcx, T> where
366-
F: FnOnce() -> ty::type_err<'tcx>;
366+
F: FnOnce() -> ty::TypeError<'tcx>;
367367
}
368368

369369
impl<'tcx, T:Clone + PartialEq> RelateResultCompare<'tcx, T> for RelateResult<'tcx, T> {
370370
fn compare<F>(&self, t: T, f: F) -> RelateResult<'tcx, T> where
371-
F: FnOnce() -> ty::type_err<'tcx>,
371+
F: FnOnce() -> ty::TypeError<'tcx>,
372372
{
373373
self.clone().and_then(|s| {
374374
if s == t {
@@ -381,16 +381,16 @@ impl<'tcx, T:Clone + PartialEq> RelateResultCompare<'tcx, T> for RelateResult<'t
381381
}
382382

383383
fn int_unification_error<'tcx>(a_is_expected: bool, v: (ty::IntVarValue, ty::IntVarValue))
384-
-> ty::type_err<'tcx>
384+
-> ty::TypeError<'tcx>
385385
{
386386
let (a, b) = v;
387-
ty::terr_int_mismatch(ty_relate::expected_found_bool(a_is_expected, &a, &b))
387+
ty::IntMismatch(ty_relate::expected_found_bool(a_is_expected, &a, &b))
388388
}
389389

390390
fn float_unification_error<'tcx>(a_is_expected: bool,
391391
v: (ast::FloatTy, ast::FloatTy))
392-
-> ty::type_err<'tcx>
392+
-> ty::TypeError<'tcx>
393393
{
394394
let (a, b) = v;
395-
ty::terr_float_mismatch(ty_relate::expected_found_bool(a_is_expected, &a, &b))
395+
ty::FloatMismatch(ty_relate::expected_found_bool(a_is_expected, &a, &b))
396396
}

src/librustc/middle/infer/error_reporting.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,17 @@ pub trait ErrorReporting<'tcx> {
220220
fn process_errors(&self, errors: &Vec<RegionResolutionError<'tcx>>)
221221
-> Vec<RegionResolutionError<'tcx>>;
222222

223-
fn report_type_error(&self, trace: TypeTrace<'tcx>, terr: &ty::type_err<'tcx>);
223+
fn report_type_error(&self, trace: TypeTrace<'tcx>, terr: &ty::TypeError<'tcx>);
224224

225225
fn report_and_explain_type_error(&self,
226226
trace: TypeTrace<'tcx>,
227-
terr: &ty::type_err<'tcx>);
227+
terr: &ty::TypeError<'tcx>);
228228

229229
fn values_str(&self, values: &ValuePairs<'tcx>) -> Option<String>;
230230

231231
fn expected_found_str<T: fmt::Display + Resolvable<'tcx> + HasTypeFlags>(
232232
&self,
233-
exp_found: &ty::expected_found<T>)
233+
exp_found: &ty::ExpectedFound<T>)
234234
-> Option<String>;
235235

236236
fn report_concrete_failure(&self,
@@ -260,7 +260,7 @@ pub trait ErrorReporting<'tcx> {
260260

261261
fn report_processed_errors(&self,
262262
var_origin: &[RegionVariableOrigin],
263-
trace_origin: &[(TypeTrace<'tcx>, ty::type_err<'tcx>)],
263+
trace_origin: &[(TypeTrace<'tcx>, ty::TypeError<'tcx>)],
264264
same_regions: &[SameRegions]);
265265

266266
fn give_suggestion(&self, same_regions: &[SameRegions]);
@@ -351,7 +351,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
351351
match free_regions_from_same_fn(self.tcx, sub, sup) {
352352
Some(ref same_frs) if trace.is_some() => {
353353
let trace = trace.unwrap();
354-
let terr = ty::terr_regions_does_not_outlive(sup,
354+
let terr = ty::RegionsDoesNotOutlive(sup,
355355
sub);
356356
trace_origins.push((trace, terr));
357357
append_to_same_regions(&mut same_regions, same_frs);
@@ -467,7 +467,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
467467
}
468468
}
469469

470-
fn report_type_error(&self, trace: TypeTrace<'tcx>, terr: &ty::type_err<'tcx>) {
470+
fn report_type_error(&self, trace: TypeTrace<'tcx>, terr: &ty::TypeError<'tcx>) {
471471
let expected_found_str = match self.values_str(&trace.values) {
472472
Some(v) => v,
473473
None => {
@@ -490,7 +490,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
490490

491491
fn report_and_explain_type_error(&self,
492492
trace: TypeTrace<'tcx>,
493-
terr: &ty::type_err<'tcx>) {
493+
terr: &ty::TypeError<'tcx>) {
494494
let span = trace.origin.span();
495495
self.report_type_error(trace, terr);
496496
self.tcx.note_and_explain_type_err(terr, span);
@@ -508,7 +508,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
508508

509509
fn expected_found_str<T: fmt::Display + Resolvable<'tcx> + HasTypeFlags>(
510510
&self,
511-
exp_found: &ty::expected_found<T>)
511+
exp_found: &ty::ExpectedFound<T>)
512512
-> Option<String>
513513
{
514514
let expected = exp_found.expected.resolve(self);
@@ -595,7 +595,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
595595
match origin {
596596
infer::Subtype(trace) |
597597
infer::DefaultExistentialBound(trace) => {
598-
let terr = ty::terr_regions_does_not_outlive(sup, sub);
598+
let terr = ty::RegionsDoesNotOutlive(sup, sub);
599599
self.report_and_explain_type_error(trace, &terr);
600600
}
601601
infer::Reborrow(span) => {
@@ -888,7 +888,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
888888

889889
fn report_processed_errors(&self,
890890
var_origins: &[RegionVariableOrigin],
891-
trace_origins: &[(TypeTrace<'tcx>, ty::type_err<'tcx>)],
891+
trace_origins: &[(TypeTrace<'tcx>, ty::TypeError<'tcx>)],
892892
same_regions: &[SameRegions]) {
893893
for vo in var_origins {
894894
self.report_inference_failure(vo.clone());

src/librustc/middle/infer/higher_ranked/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ impl<'a,'tcx> HigherRankedRelations<'a,'tcx> for CombineFields<'a,'tcx> {
8585
Err((skol_br, tainted_region)) => {
8686
if self.a_is_expected {
8787
debug!("Not as polymorphic!");
88-
return Err(ty::terr_regions_insufficiently_polymorphic(skol_br,
88+
return Err(ty::RegionsInsufficientlyPolymorphic(skol_br,
8989
tainted_region));
9090
} else {
9191
debug!("Overly polymorphic!");
92-
return Err(ty::terr_regions_overly_polymorphic(skol_br,
92+
return Err(ty::RegionsOverlyPolymorphic(skol_br,
9393
tainted_region));
9494
}
9595
}

src/librustc/middle/infer/mod.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ impl fmt::Display for TypeOrigin {
171171
/// See `error_reporting.rs` for more details
172172
#[derive(Clone, Debug)]
173173
pub enum ValuePairs<'tcx> {
174-
Types(ty::expected_found<Ty<'tcx>>),
175-
TraitRefs(ty::expected_found<ty::TraitRef<'tcx>>),
176-
PolyTraitRefs(ty::expected_found<ty::PolyTraitRef<'tcx>>),
174+
Types(ty::ExpectedFound<Ty<'tcx>>),
175+
TraitRefs(ty::ExpectedFound<ty::TraitRef<'tcx>>),
176+
PolyTraitRefs(ty::ExpectedFound<ty::PolyTraitRef<'tcx>>),
177177
}
178178

179179
/// The trace designates the path through inference that we took to
@@ -460,12 +460,12 @@ pub fn mk_sub_poly_trait_refs<'a, 'tcx>(cx: &InferCtxt<'a, 'tcx>,
460460
fn expected_found<T>(a_is_expected: bool,
461461
a: T,
462462
b: T)
463-
-> ty::expected_found<T>
463+
-> ty::ExpectedFound<T>
464464
{
465465
if a_is_expected {
466-
ty::expected_found {expected: a, found: b}
466+
ty::ExpectedFound {expected: a, found: b}
467467
} else {
468-
ty::expected_found {expected: b, found: a}
468+
ty::ExpectedFound {expected: b, found: a}
469469
}
470470
}
471471

@@ -913,7 +913,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
913913

914914
match higher_ranked::leak_check(self, skol_map, snapshot) {
915915
Ok(()) => Ok(()),
916-
Err((br, r)) => Err(ty::terr_regions_insufficiently_polymorphic(br, r))
916+
Err((br, r)) => Err(ty::RegionsInsufficientlyPolymorphic(br, r))
917917
}
918918
}
919919

@@ -1198,7 +1198,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11981198
sp: Span,
11991199
mk_msg: M,
12001200
actual_ty: String,
1201-
err: Option<&ty::type_err<'tcx>>) where
1201+
err: Option<&ty::TypeError<'tcx>>) where
12021202
M: FnOnce(Option<String>, String) -> String,
12031203
{
12041204
self.type_error_message_str_with_expected(sp, mk_msg, None, actual_ty, err)
@@ -1209,7 +1209,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12091209
mk_msg: M,
12101210
expected_ty: Option<Ty<'tcx>>,
12111211
actual_ty: String,
1212-
err: Option<&ty::type_err<'tcx>>) where
1212+
err: Option<&ty::TypeError<'tcx>>) where
12131213
M: FnOnce(Option<String>, String) -> String,
12141214
{
12151215
debug!("hi! expected_ty = {:?}, actual_ty = {}", expected_ty, actual_ty);
@@ -1235,7 +1235,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12351235
sp: Span,
12361236
mk_msg: M,
12371237
actual_ty: Ty<'tcx>,
1238-
err: Option<&ty::type_err<'tcx>>) where
1238+
err: Option<&ty::TypeError<'tcx>>) where
12391239
M: FnOnce(String) -> String,
12401240
{
12411241
let actual_ty = self.resolve_type_vars_if_possible(&actual_ty);
@@ -1254,10 +1254,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
12541254
span: Span,
12551255
expected: Ty<'tcx>,
12561256
actual: Ty<'tcx>,
1257-
err: &ty::type_err<'tcx>) {
1257+
err: &ty::TypeError<'tcx>) {
12581258
let trace = TypeTrace {
12591259
origin: Misc(span),
1260-
values: Types(ty::expected_found {
1260+
values: Types(ty::ExpectedFound {
12611261
expected: expected,
12621262
found: actual
12631263
})
@@ -1431,7 +1431,7 @@ impl<'tcx> TypeTrace<'tcx> {
14311431
pub fn dummy(tcx: &ty::ctxt<'tcx>) -> TypeTrace<'tcx> {
14321432
TypeTrace {
14331433
origin: Misc(codemap::DUMMY_SP),
1434-
values: Types(ty::expected_found {
1434+
values: Types(ty::ExpectedFound {
14351435
expected: tcx.types.err,
14361436
found: tcx.types.err,
14371437
})

0 commit comments

Comments
 (0)