diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index fcc794fd0d1..92ef0c281f2 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -28,21 +28,12 @@ pub enum ExponentFormat { /// Use exponential notation with the exponent having a base of 10 and the /// exponent sign being `e` or `E`. For example, 1000 would be printed /// 1e3. - ExpDec, - /// Use exponential notation with the exponent having a base of 2 and the - /// exponent sign being `p` or `P`. For example, 8 would be printed 1p3. - ExpBin, + ExpDec } /// The number of digits used for emitting the fractional part of a number, if /// any. pub enum SignificantDigits { - /// All calculable digits will be printed. - /// - /// Note that bignums or fractions may cause a surprisingly large number - /// of digits to be printed. - DigAll, - /// At most the given number of digits will be printed, truncating any /// trailing zeroes. DigMax(uint), @@ -53,17 +44,11 @@ pub enum SignificantDigits { /// How to emit the sign of a number. pub enum SignFormat { - /// No sign will be printed. The exponent sign will also be emitted. - SignNone, /// `-` will be printed for negative values, but no sign will be emitted /// for positive numbers. - SignNeg, - /// `+` will be printed for positive values, and `-` will be printed for - /// negative values. - SignAll, + SignNeg } -static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u; static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u; /** @@ -111,9 +96,6 @@ pub fn float_to_str_bytes_common( ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e' => fail!("float_to_str_bytes_common: radix {} incompatible with \ use of 'e' as decimal exponent", radix), - ExpBin if radix >= DIGIT_P_RADIX // binary exponent 'p' - => fail!("float_to_str_bytes_common: radix {} incompatible with \ - use of 'p' as binary exponent", radix), _ => () } @@ -123,16 +105,10 @@ pub fn float_to_str_bytes_common( match num.classify() { FPNaN => return f("NaN".as_bytes()), FPInfinite if num > _0 => { - return match sign { - SignAll => return f("+inf".as_bytes()), - _ => return f("inf".as_bytes()), - }; + return f("inf".as_bytes()); } FPInfinite if num < _0 => { - return match sign { - SignNone => return f("inf".as_bytes()), - _ => return f("-inf".as_bytes()), - }; + return f("-inf".as_bytes()); } _ => {} } @@ -147,11 +123,10 @@ pub fn float_to_str_bytes_common( let (num, exp) = match exp_format { ExpNone => (num, 0i32), - ExpDec | ExpBin if num == _0 => (num, 0i32), - ExpDec | ExpBin => { + ExpDec if num == _0 => (num, 0i32), + ExpDec => { let (exp, exp_base) = match exp_format { ExpDec => (num.abs().log10().floor(), cast::(10.0f64).unwrap()), - ExpBin => (num.abs().log2().floor(), cast::(2.0f64).unwrap()), ExpNone => fail!("unreachable"), }; @@ -185,21 +160,16 @@ pub fn float_to_str_bytes_common( // If limited digits, calculate one digit more for rounding. let (limit_digits, digit_count, exact) = match digits { - DigAll => (false, 0u, false), - DigMax(count) => (true, count+1, false), - DigExact(count) => (true, count+1, true) + DigMax(count) => (true, count + 1, false), + DigExact(count) => (true, count + 1, true) }; // Decide what sign to put in front match sign { - SignNeg | SignAll if neg => { + SignNeg if neg => { buf[end] = b'-'; end += 1; } - SignAll => { - buf[end] = b'+'; - end += 1; - } _ => () } @@ -329,8 +299,6 @@ pub fn float_to_str_bytes_common( buf[end] = match exp_format { ExpDec if exp_upper => 'E', ExpDec if !exp_upper => 'e', - ExpBin if exp_upper => 'P', - ExpBin if !exp_upper => 'p', _ => fail!("unreachable"), } as u8; end += 1; @@ -356,11 +324,6 @@ pub fn float_to_str_bytes_common( fmt::write(&mut filler, args) }, "{:-}", exp); } - SignNone | SignAll => { - let _ = format_args!(|args| { - fmt::write(&mut filler, args) - }, "{}", exp); - } } } } diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index b4685ce456a..3919bf6bb94 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -1269,11 +1269,6 @@ impl LintPass for UnusedMut { } } -enum Allocation { - VectorAllocation, - BoxAllocation -} - declare_lint!(UNNECESSARY_ALLOCATION, Warn, "detects unnecessary allocations that can be eliminated") @@ -1285,30 +1280,21 @@ impl LintPass for UnnecessaryAllocation { } fn check_expr(&mut self, cx: &Context, e: &ast::Expr) { - // Warn if boxing expressions are immediately borrowed. - let allocation = match e.node { - ast::ExprUnary(ast::UnUniq, _) | - ast::ExprUnary(ast::UnBox, _) => BoxAllocation, - + match e.node { + ast::ExprUnary(ast::UnUniq, _) | ast::ExprUnary(ast::UnBox, _) => (), _ => return - }; + } match cx.tcx.adjustments.borrow().find(&e.id) { Some(adjustment) => { match *adjustment { ty::AdjustDerefRef(ty::AutoDerefRef { ref autoref, .. }) => { - match (allocation, autoref) { - (VectorAllocation, &Some(ty::AutoPtr(_, _, None))) => { - cx.span_lint(UNNECESSARY_ALLOCATION, e.span, - "unnecessary allocation, the sigil can be removed"); - } - (BoxAllocation, - &Some(ty::AutoPtr(_, ast::MutImmutable, None))) => { + match autoref { + &Some(ty::AutoPtr(_, ast::MutImmutable, None)) => { cx.span_lint(UNNECESSARY_ALLOCATION, e.span, "unnecessary allocation, use & instead"); } - (BoxAllocation, - &Some(ty::AutoPtr(_, ast::MutMutable, None))) => { + &Some(ty::AutoPtr(_, ast::MutMutable, None)) => { cx.span_lint(UNNECESSARY_ALLOCATION, e.span, "unnecessary allocation, use &mut instead"); } diff --git a/src/librustc/middle/borrowck/mod.rs b/src/librustc/middle/borrowck/mod.rs index 7d734323ee8..4f18d00070a 100644 --- a/src/librustc/middle/borrowck/mod.rs +++ b/src/librustc/middle/borrowck/mod.rs @@ -243,12 +243,6 @@ struct BorrowStats { pub type BckResult = Result; -#[deriving(PartialEq)] -pub enum PartialTotal { - Partial, // Loan affects some portion - Total // Loan affects entire path -} - /////////////////////////////////////////////////////////////////////////// // Loans and loan paths diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs index cf80d91595e..7d88ba57ad7 100644 --- a/src/librustc/middle/resolve.rs +++ b/src/librustc/middle/resolve.rs @@ -488,7 +488,6 @@ enum ParentLink { #[deriving(PartialEq)] enum ModuleKind { NormalModuleKind, - ExternModuleKind, TraitModuleKind, ImplModuleKind, AnonymousModuleKind, @@ -3348,7 +3347,6 @@ impl<'a> Resolver<'a> { parents"); return Failed(None); } - ExternModuleKind | TraitModuleKind | ImplModuleKind | AnonymousModuleKind => { @@ -3446,7 +3444,6 @@ impl<'a> Resolver<'a> { let new_module = new_module.upgrade().unwrap(); match new_module.kind.get() { NormalModuleKind => return Some(new_module), - ExternModuleKind | TraitModuleKind | ImplModuleKind | AnonymousModuleKind => module_ = new_module, @@ -3462,7 +3459,6 @@ impl<'a> Resolver<'a> { -> Rc { match module_.kind.get() { NormalModuleKind => return module_, - ExternModuleKind | TraitModuleKind | ImplModuleKind | AnonymousModuleKind => { diff --git a/src/librustc/middle/typeck/check/writeback.rs b/src/librustc/middle/typeck/check/writeback.rs index e2a04116f90..5f76c748417 100644 --- a/src/librustc/middle/typeck/check/writeback.rs +++ b/src/librustc/middle/typeck/check/writeback.rs @@ -361,7 +361,6 @@ enum ResolveReason { ResolvingLocal(Span), ResolvingPattern(Span), ResolvingUpvar(ty::UpvarId), - ResolvingImplRes(Span), ResolvingUnboxedClosure(ast::DefId), } @@ -374,7 +373,6 @@ impl ResolveReason { ResolvingUpvar(upvar_id) => { ty::expr_span(tcx, upvar_id.closure_expr_id) } - ResolvingImplRes(s) => s, ResolvingUnboxedClosure(did) => { if did.krate == ast::LOCAL_CRATE { ty::expr_span(tcx, did.node) @@ -462,11 +460,6 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> { infer::fixup_err_to_string(e)); } - ResolvingImplRes(span) => { - span_err!(self.tcx.sess, span, E0105, - "cannot determine a type for impl supertrait"); - } - ResolvingUnboxedClosure(_) => { let span = self.reason.span(self.tcx); self.tcx.sess.span_err(span, diff --git a/src/librustc/middle/typeck/infer/mod.rs b/src/librustc/middle/typeck/infer/mod.rs index db90593b5b3..3af744824ff 100644 --- a/src/librustc/middle/typeck/infer/mod.rs +++ b/src/librustc/middle/typeck/infer/mod.rs @@ -271,9 +271,7 @@ pub enum RegionVariableOrigin { pub enum fixup_err { unresolved_int_ty(IntVid), unresolved_float_ty(FloatVid), - unresolved_ty(TyVid), - unresolved_region(RegionVid), - region_var_bound_by_region_var(RegionVid, RegionVid) + unresolved_ty(TyVid) } pub fn fixup_err_to_string(f: fixup_err) -> String { @@ -287,11 +285,6 @@ pub fn fixup_err_to_string(f: fixup_err) -> String { the type explicitly".to_string() } unresolved_ty(_) => "unconstrained type".to_string(), - unresolved_region(_) => "unconstrained region".to_string(), - region_var_bound_by_region_var(r1, r2) => { - format!("region var {:?} bound by another region var {:?}; \ - this is a bug in rustc", r1, r2) - } } } diff --git a/src/libsyntax/ext/format.rs b/src/libsyntax/ext/format.rs index b760c893a10..1ed41e6870d 100644 --- a/src/libsyntax/ext/format.rs +++ b/src/libsyntax/ext/format.rs @@ -24,8 +24,7 @@ use std::string; #[deriving(PartialEq)] enum ArgumentType { Known(string::String), - Unsigned, - String, + Unsigned } enum Position { @@ -691,12 +690,6 @@ impl<'a, 'b> Context<'a, 'b> { } } } - String => { - return ecx.expr_call_global(sp, vec![ - ecx.ident_of("std"), - ecx.ident_of("fmt"), - ecx.ident_of("argumentstr")], vec![arg]) - } Unsigned => { return ecx.expr_call_global(sp, vec![ ecx.ident_of("std"),