Skip to content

Commit 19218ee

Browse files
committed
Fix make tidy
1 parent 1a268f4 commit 19218ee

File tree

6 files changed

+34
-26
lines changed

6 files changed

+34
-26
lines changed

src/librustc/middle/infer/mod.rs

+12-13
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010

1111
//! See the Book for more information.
1212
13-
#![allow(non_camel_case_types)]
14-
1513
pub use self::LateBoundRegionConversionTime::*;
1614
pub use self::RegionVariableOrigin::*;
1715
pub use self::SubregionOrigin::*;
1816
pub use self::TypeOrigin::*;
1917
pub use self::ValuePairs::*;
20-
pub use self::fixup_err::*;
2118
pub use middle::ty::IntVarValue;
2219
pub use self::freshen::TypeFreshener;
2320
pub use self::region_inference::GenericKind;
@@ -65,7 +62,7 @@ pub mod unify_key;
6562

6663
pub type Bound<T> = Option<T>;
6764
pub type UnitResult<'tcx> = RelateResult<'tcx, ()>; // "unify result"
68-
pub type fres<T> = Result<T, fixup_err>; // "fixup result"
65+
pub type FixupResult<T> = Result<T, FixupError>; // "fixup result"
6966

7067
pub struct InferCtxt<'a, 'tcx: 'a> {
7168
pub tcx: &'a ty::ctxt<'tcx>,
@@ -313,23 +310,25 @@ pub enum RegionVariableOrigin {
313310
}
314311

315312
#[derive(Copy, Clone, Debug)]
316-
pub enum fixup_err {
317-
unresolved_int_ty(IntVid),
318-
unresolved_float_ty(FloatVid),
319-
unresolved_ty(TyVid)
313+
pub enum FixupError {
314+
UnresolvedIntTy(IntVid),
315+
UnresolvedFloatTy(FloatVid),
316+
UnresolvedTy(TyVid)
320317
}
321318

322-
pub fn fixup_err_to_string(f: fixup_err) -> String {
319+
pub fn fixup_err_to_string(f: FixupError) -> String {
320+
use self::FixupError::*;
321+
323322
match f {
324-
unresolved_int_ty(_) => {
323+
UnresolvedIntTy(_) => {
325324
"cannot determine the type of this integer; add a suffix to \
326325
specify the type explicitly".to_string()
327326
}
328-
unresolved_float_ty(_) => {
327+
UnresolvedFloatTy(_) => {
329328
"cannot determine the type of this number; add a suffix to specify \
330329
the type explicitly".to_string()
331330
}
332-
unresolved_ty(_) => "unconstrained type".to_string(),
331+
UnresolvedTy(_) => "unconstrained type".to_string(),
333332
}
334333
}
335334

@@ -1169,7 +1168,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
11691168
if ty.has_infer_types() || ty.references_error() { Err(()) } else { Ok(ty) }
11701169
}
11711170

1172-
pub fn fully_resolve<T:TypeFoldable<'tcx>>(&self, value: &T) -> fres<T> {
1171+
pub fn fully_resolve<T:TypeFoldable<'tcx>>(&self, value: &T) -> FixupResult<T> {
11731172
/*!
11741173
* Attempts to resolve all type/region variables in
11751174
* `value`. Region inference must have been run already (e.g.,

src/librustc/middle/infer/resolve.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use super::{InferCtxt, fixup_err, fres, unresolved_ty, unresolved_int_ty, unresolved_float_ty};
11+
use super::{InferCtxt, FixupError, FixupResult};
1212
use middle::ty::{self, Ty, HasTypeFlags};
1313
use middle::ty_fold::{self, TypeFoldable};
1414

@@ -51,7 +51,7 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for OpportunisticTypeResolver<'a, 'tcx>
5151
/// Full type resolution replaces all type and region variables with
5252
/// their concrete results. If any variable cannot be replaced (never unified, etc)
5353
/// then an `Err` result is returned.
54-
pub fn fully_resolve<'a, 'tcx, T>(infcx: &InferCtxt<'a,'tcx>, value: &T) -> fres<T>
54+
pub fn fully_resolve<'a, 'tcx, T>(infcx: &InferCtxt<'a,'tcx>, value: &T) -> FixupResult<T>
5555
where T : TypeFoldable<'tcx>
5656
{
5757
let mut full_resolver = FullTypeResolver { infcx: infcx, err: None };
@@ -66,7 +66,7 @@ pub fn fully_resolve<'a, 'tcx, T>(infcx: &InferCtxt<'a,'tcx>, value: &T) -> fres
6666
// `err` field is not enforcable otherwise.
6767
struct FullTypeResolver<'a, 'tcx:'a> {
6868
infcx: &'a InferCtxt<'a, 'tcx>,
69-
err: Option<fixup_err>,
69+
err: Option<FixupError>,
7070
}
7171

7272
impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
@@ -81,15 +81,15 @@ impl<'a, 'tcx> ty_fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
8181
let t = self.infcx.shallow_resolve(t);
8282
match t.sty {
8383
ty::TyInfer(ty::TyVar(vid)) => {
84-
self.err = Some(unresolved_ty(vid));
84+
self.err = Some(FixupError::UnresolvedTy(vid));
8585
self.tcx().types.err
8686
}
8787
ty::TyInfer(ty::IntVar(vid)) => {
88-
self.err = Some(unresolved_int_ty(vid));
88+
self.err = Some(FixupError::UnresolvedIntTy(vid));
8989
self.tcx().types.err
9090
}
9191
ty::TyInfer(ty::FloatVar(vid)) => {
92-
self.err = Some(unresolved_float_ty(vid));
92+
self.err = Some(FixupError::UnresolvedFloatTy(vid));
9393
self.tcx().types.err
9494
}
9595
ty::TyInfer(_) => {

src/librustc_trans/trans/debuginfo/metadata.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,9 @@ pub fn type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
765765
trait_pointer_metadata(cx, t, None, unique_type_id),
766766
false)
767767
}
768-
ty::TyBox(ty) | ty::TyRawPtr(ty::TypeAndMut{ty, ..}) | ty::TyRef(_, ty::TypeAndMut{ty, ..}) => {
768+
ty::TyBox(ty) |
769+
ty::TyRawPtr(ty::TypeAndMut{ty, ..}) |
770+
ty::TyRef(_, ty::TypeAndMut{ty, ..}) => {
769771
match ty.sty {
770772
ty::TySlice(typ) => {
771773
vec_slice_metadata(cx, t, typ, unique_type_id, usage_site_span)

src/librustc_trans/trans/expr.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,12 @@ fn coerce_unsized<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
440440

441441
match (&source.ty.sty, &target.ty.sty) {
442442
(&ty::TyBox(a), &ty::TyBox(b)) |
443-
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }), &ty::TyRef(_, ty::TypeAndMut { ty: b, .. })) |
444-
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }), &ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) |
445-
(&ty::TyRawPtr(ty::TypeAndMut { ty: a, .. }), &ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) => {
443+
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }),
444+
&ty::TyRef(_, ty::TypeAndMut { ty: b, .. })) |
445+
(&ty::TyRef(_, ty::TypeAndMut { ty: a, .. }),
446+
&ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) |
447+
(&ty::TyRawPtr(ty::TypeAndMut { ty: a, .. }),
448+
&ty::TyRawPtr(ty::TypeAndMut { ty: b, .. })) => {
446449
let (inner_source, inner_target) = (a, b);
447450

448451
let (base, old_info) = if !type_is_sized(bcx.tcx(), inner_source) {

src/librustc_trans/trans/type_of.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ pub fn sizing_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Typ
193193
ty::TyUint(t) => Type::uint_from_ty(cx, t),
194194
ty::TyFloat(t) => Type::float_from_ty(cx, t),
195195

196-
ty::TyBox(ty) | ty::TyRef(_, ty::TypeAndMut{ty, ..}) | ty::TyRawPtr(ty::TypeAndMut{ty, ..}) => {
196+
ty::TyBox(ty) |
197+
ty::TyRef(_, ty::TypeAndMut{ty, ..}) |
198+
ty::TyRawPtr(ty::TypeAndMut{ty, ..}) => {
197199
if type_is_sized(cx.tcx(), ty) {
198200
Type::i8p(cx)
199201
} else {
@@ -352,7 +354,9 @@ pub fn in_memory_type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) ->
352354
adt::incomplete_type_of(cx, &*repr, "closure")
353355
}
354356

355-
ty::TyBox(ty) | ty::TyRef(_, ty::TypeAndMut{ty, ..}) | ty::TyRawPtr(ty::TypeAndMut{ty, ..}) => {
357+
ty::TyBox(ty) |
358+
ty::TyRef(_, ty::TypeAndMut{ty, ..}) |
359+
ty::TyRawPtr(ty::TypeAndMut{ty, ..}) => {
356360
if !type_is_sized(cx.tcx(), ty) {
357361
if let ty::TyStr = ty.sty {
358362
// This means we get a nicer name in the output (str is always

src/librustc_typeck/check/writeback.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
390390
reason: reason }
391391
}
392392

393-
fn report_error(&self, e: infer::fixup_err) {
393+
fn report_error(&self, e: infer::FixupError) {
394394
self.writeback_errors.set(true);
395395
if !self.tcx.sess.has_errors() {
396396
match self.reason {

0 commit comments

Comments
 (0)