diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 1d2ed735e813..991f2df24789 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -701,7 +701,7 @@ mod impls { // Note: This macro is a temporary hack that can be remove once we are building with a compiler // that supports `!` - macro_rules! argh { + macro_rules! not_stage0 { () => { #[unstable(feature = "bang_type", issue = "35121")] impl PartialEq for ! { @@ -730,7 +730,7 @@ mod impls { } #[cfg(not(stage0))] - argh!(); + not_stage0!(); // & pointers diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 60862334846c..15fb950b143d 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1365,7 +1365,7 @@ fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperEx // Note: This macro is a temporary hack that can be remove once we are building with a compiler // that supports `!` -macro_rules! argh { +macro_rules! not_stage0 { () => { #[unstable(feature = "bang_type", issue = "35121")] impl Debug for ! { @@ -1384,7 +1384,7 @@ macro_rules! argh { } #[cfg(not(stage0))] -argh!(); +not_stage0!(); #[stable(feature = "rust1", since = "1.0.0")] impl Debug for bool { diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 74ef378f23d9..d05036c97a67 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -87,6 +87,8 @@ #![feature(staged_api)] #![feature(unboxed_closures)] #![feature(question_mark)] + +// NOTE: remove the cfg_attr next snapshot #![cfg_attr(not(stage0), feature(bang_type))] #[macro_use] diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 38988affbd06..e9c28f3782b0 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -112,7 +112,7 @@ use self::VarKind::*; use dep_graph::DepNode; use hir::def::*; use hir::pat_util; -use ty::{self, TyCtxt, ParameterEnvironment}; +use ty::{self, Ty, TyCtxt, ParameterEnvironment}; use traits::{self, Reveal}; use ty::subst::Subst; use lint; @@ -1454,7 +1454,7 @@ fn check_fn(_v: &Liveness, } impl<'a, 'tcx> Liveness<'a, 'tcx> { - fn fn_ret(&self, id: NodeId) -> ty::Binder> { + fn fn_ret(&self, id: NodeId) -> ty::Binder> { let fn_ty = self.ir.tcx.node_id_to_type(id); match fn_ty.sty { ty::TyClosure(closure_def_id, substs) => diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index 1bb92d6356c1..dc4bdda0cf09 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -107,7 +107,7 @@ pub struct AutoDerefRef<'tcx> { impl<'tcx> AutoAdjustment<'tcx> { pub fn is_identity(&self) -> bool { match *self { - AdjustEmptyToAny(ref ty) => match ty.sty { + AdjustEmptyToAny(ty) => match ty.sty { TypeVariants::TyEmpty => true, _ => false, }, diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 6babd124665b..206de733606d 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1258,10 +1258,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_ty(TySlice(ty)) } - pub fn mk_empty(&self) -> Ty<'tcx> { - self.mk_ty(TyEmpty) - } - pub fn mk_tup(self, ts: Vec>) -> Ty<'tcx> { self.mk_ty(TyTuple(self.mk_type_list(ts))) } diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 5c6286ae3670..b8044a24cbfc 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -58,8 +58,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { // unreachable block. Don't bother to terminate it and create a new one. if is_call { block.unit() - } - else { + } else { this.cfg.terminate(block, source_info, TerminatorKind::Unreachable); let end_block = this.cfg.start_new_block(); end_block.unit() diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index e4e1c7999a66..86c95db89c8a 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -162,7 +162,7 @@ macro_rules! unpack { pub fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, fn_id: ast::NodeId, arguments: A, - return_ty: ty::Ty<'gcx>, + return_ty: Ty<'gcx>, ast_block: &'gcx hir::Block) -> (Mir<'tcx>, ScopeAuxiliaryVec) where A: Iterator, Option<&'gcx hir::Pat>)> @@ -287,7 +287,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { fn finish(self, upvar_decls: Vec, arg_decls: IndexVec>, - return_ty: ty::Ty<'tcx>) + return_ty: Ty<'tcx>) -> (Mir<'tcx>, ScopeAuxiliaryVec) { for (index, block) in self.cfg.basic_blocks.iter().enumerate() { if block.terminator.is_none() { @@ -309,7 +309,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { fn args_and_body(&mut self, mut block: BasicBlock, - return_ty: ty::Ty<'tcx>, + return_ty: Ty<'tcx>, arguments: A, argument_extent: CodeExtent, ast_block: &'gcx hir::Block) diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs index 7683a572aaad..5da4304abb3b 100644 --- a/src/librustc_trans/common.rs +++ b/src/librustc_trans/common.rs @@ -558,7 +558,7 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> { abi: Abi::C, sig: ty::Binder(ty::FnSig { inputs: vec![tcx.mk_mut_ptr(tcx.types.u8)], - output: tcx.mk_empty(), + output: tcx.types.empty, variadic: false }), })); diff --git a/src/librustc_trans/intrinsic.rs b/src/librustc_trans/intrinsic.rs index 066fe89aee5f..7be173d17b48 100644 --- a/src/librustc_trans/intrinsic.rs +++ b/src/librustc_trans/intrinsic.rs @@ -1221,7 +1221,7 @@ fn trans_gnu_try<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, fn gen_fn<'a, 'tcx>(fcx: &FunctionContext<'a, 'tcx>, name: &str, inputs: Vec>, - output: ty::Ty<'tcx>, + output: Ty<'tcx>, trans: &mut for<'b> FnMut(Block<'b, 'tcx>)) -> ValueRef { let ccx = fcx.ccx; diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 74fe3172b2a0..e342bfb635c2 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1701,7 +1701,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { tcx.mk_ref(tcx.mk_region(r), ty::TypeAndMut {ty: t, mutbl: mt.mutbl}) } hir::TyEmpty => { - tcx.mk_empty() + tcx.types.empty }, hir::TyTup(ref fields) => { let flds = fields.iter() diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 38772470f3ff..d0085a1cc84a 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -30,8 +30,8 @@ fn equate_intrinsic_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, it: &hir::ForeignItem, n_tps: usize, abi: Abi, - inputs: Vec>, - output: ty::Ty<'tcx>) { + inputs: Vec>, + output: Ty<'tcx>) { let tcx = ccx.tcx; let def_id = tcx.map.local_def_id(it.id); let i_ty = tcx.lookup_item_type(def_id); @@ -106,7 +106,7 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &hir::ForeignItem) { }; (n_tps, inputs, output) } else if &name[..] == "abort" || &name[..] == "unreachable" { - (0, Vec::new(), tcx.mk_empty()) + (0, Vec::new(), tcx.types.empty) } else { let (n_tps, inputs, output) = match &name[..] { "breakpoint" => (0, Vec::new(), tcx.mk_nil()), diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 3e8852d63321..cea591a84d6f 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -372,7 +372,7 @@ pub struct FnCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { // expects the types within the function to be consistent. err_count_on_creation: usize, - ret_ty: ty::Ty<'tcx>, + ret_ty: Ty<'tcx>, ps: RefCell, @@ -1457,7 +1457,7 @@ enum TupleArgumentsFlag { impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn new(inh: &'a Inherited<'a, 'gcx, 'tcx>, - rty: ty::Ty<'tcx>, + rty: Ty<'tcx>, body_id: ast::NodeId) -> FnCtxt<'a, 'gcx, 'tcx> { FnCtxt { @@ -1733,7 +1733,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } pub fn write_empty(&self, node_id: ast::NodeId) { - self.write_ty_expr(node_id, self.tcx.mk_empty()); + self.write_ty_expr(node_id, self.tcx.types.empty); } pub fn write_error(&self, node_id: ast::NodeId) { @@ -1977,7 +1977,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if self.type_var_diverges(resolved) { debug!("default_type_parameters: defaulting `{:?}` to `!` because it diverges", resolved); - self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.mk_empty()); + self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.types.empty); } else { match self.type_is_unconstrained_numeric(resolved) { UnconstrainedInt => { @@ -2051,7 +2051,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { for ty in &unsolved_variables { let resolved = self.resolve_type_vars_if_possible(ty); if self.type_var_diverges(resolved) { - self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.mk_empty()); + self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.types.empty); } else { match self.type_is_unconstrained_numeric(resolved) { UnconstrainedInt | UnconstrainedFloat => { @@ -2109,7 +2109,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { let _ = self.commit_if_ok(|_: &infer::CombinedSnapshot| { for ty in &unbound_tyvars { if self.type_var_diverges(ty) { - self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.mk_empty()); + self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.types.empty); } else { match self.type_is_unconstrained_numeric(ty) { UnconstrainedInt => { @@ -2205,7 +2205,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { // reporting for more then one conflict. for ty in &unbound_tyvars { if self.type_var_diverges(ty) { - self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.mk_empty()); + self.demand_eqtype(syntax_pos::DUMMY_SP, *ty, self.tcx.types.empty); } else { match self.type_is_unconstrained_numeric(ty) { UnconstrainedInt => { @@ -2409,7 +2409,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { args_no_rcvr: &'gcx [P], tuple_arguments: TupleArgumentsFlag, expected: Expectation<'tcx>) - -> ty::Ty<'tcx> { + -> Ty<'tcx> { if method_fn_ty.references_error() { let err_inputs = self.err_args(args_no_rcvr.len()); @@ -2680,7 +2680,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn write_call(&self, call_expr: &hir::Expr, - output: ty::Ty<'tcx>) { + output: Ty<'tcx>) { self.write_ty_expr(call_expr.id, output); } @@ -2804,7 +2804,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn expected_types_for_fn_args(&self, call_span: Span, expected_ret: Expectation<'tcx>, - formal_ret: ty::Ty<'tcx>, + formal_ret: Ty<'tcx>, formal_args: &[Ty<'tcx>]) -> Vec> { let expected_args = expected_ret.only_has_type(self).and_then(|ret_ty| { diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 2e629dc4312d..5eca6e21681a 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -51,7 +51,7 @@ impl<'a, 'gcx, 'tcx> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { let id = self.id; let span = self.span; self.inherited.enter(|inh| { - let fcx = FnCtxt::new(&inh, inh.ccx.tcx.mk_empty(), id); + let fcx = FnCtxt::new(&inh, inh.ccx.tcx.types.empty, id); let wf_tys = f(&fcx, &mut CheckTypeWellFormedVisitor { ccx: fcx.ccx, code: code