renamed mk_nil to mk_unit
This commit is contained in:
parent
6f685ffad4
commit
5c3ba4aa4f
16 changed files with 40 additions and 40 deletions
|
@ -661,7 +661,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
|
|||
{
|
||||
let predicate = trait_predicate.map_bound(|mut trait_pred| {
|
||||
trait_pred.trait_ref.substs = self.tcx.mk_substs_trait(
|
||||
self.tcx.mk_nil(),
|
||||
self.tcx.mk_unit(),
|
||||
&trait_pred.trait_ref.substs[1..],
|
||||
);
|
||||
trait_pred
|
||||
|
|
|
@ -2492,7 +2492,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn mk_nil_ptr(self) -> Ty<'tcx> {
|
||||
self.mk_imm_ptr(self.mk_nil())
|
||||
self.mk_imm_ptr(self.mk_unit())
|
||||
}
|
||||
|
||||
pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> {
|
||||
|
@ -2511,7 +2511,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
|||
iter.intern_with(|ts| self.mk_ty(Tuple(self.intern_type_list(ts))))
|
||||
}
|
||||
|
||||
pub fn mk_nil(self) -> Ty<'tcx> {
|
||||
pub fn mk_unit(self) -> Ty<'tcx> {
|
||||
self.intern_tup(&[])
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ impl PrimitiveExt for Primitive {
|
|||
Int(i, signed) => i.to_ty(tcx, signed),
|
||||
Float(FloatTy::F32) => tcx.types.f32,
|
||||
Float(FloatTy::F64) => tcx.types.f64,
|
||||
Pointer => tcx.mk_mut_ptr(tcx.mk_nil()),
|
||||
Pointer => tcx.mk_mut_ptr(tcx.mk_unit()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1606,7 +1606,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
|
|||
// (which may have no non-DST form), and will work as long
|
||||
// as the `Abi` or `FieldPlacement` is checked by users.
|
||||
if i == 0 {
|
||||
let nil = tcx.mk_nil();
|
||||
let nil = tcx.mk_unit();
|
||||
let ptr_ty = if this.ty.is_unsafe_ptr() {
|
||||
tcx.mk_mut_ptr(nil)
|
||||
} else {
|
||||
|
|
|
@ -968,7 +968,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
|
|||
let i8p = tcx.mk_mut_ptr(tcx.types.i8);
|
||||
let fn_ty = tcx.mk_fn_ptr(ty::Binder::bind(tcx.mk_fn_sig(
|
||||
iter::once(i8p),
|
||||
tcx.mk_nil(),
|
||||
tcx.mk_unit(),
|
||||
false,
|
||||
hir::Unsafety::Unsafe,
|
||||
Abi::Rust
|
||||
|
|
|
@ -309,7 +309,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn t_nil(&self) -> Ty<'tcx> {
|
||||
self.infcx.tcx.mk_nil()
|
||||
self.infcx.tcx.mk_unit()
|
||||
}
|
||||
|
||||
pub fn t_pair(&self, ty1: Ty<'tcx>, ty2: Ty<'tcx>) -> Ty<'tcx> {
|
||||
|
|
|
@ -118,7 +118,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn unit_ty(&mut self) -> Ty<'tcx> {
|
||||
self.tcx.mk_nil()
|
||||
self.tcx.mk_unit()
|
||||
}
|
||||
|
||||
pub fn true_literal(&mut self) -> &'tcx ty::Const<'tcx> {
|
||||
|
|
|
@ -436,7 +436,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
|
|||
layout: self.layout_of(self.tcx.mk_mut_ptr(place.layout.ty))?,
|
||||
};
|
||||
|
||||
let ty = self.tcx.mk_nil(); // return type is ()
|
||||
let ty = self.tcx.mk_unit(); // return type is ()
|
||||
let dest = PlaceTy::null(&self, self.layout_of(ty)?);
|
||||
|
||||
self.eval_fn_call(
|
||||
|
|
|
@ -517,7 +517,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
|
||||
let upvar_len = mir.upvar_decls.len();
|
||||
let dummy_local = LocalDecl::new_internal(tcx.mk_nil(), mir.span);
|
||||
let dummy_local = LocalDecl::new_internal(tcx.mk_unit(), mir.span);
|
||||
|
||||
// Gather live locals and their indices replacing values in mir.local_decls with a dummy
|
||||
// to avoid changing local indices
|
||||
|
@ -655,7 +655,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
|
|||
// Replace the return variable
|
||||
mir.local_decls[RETURN_PLACE] = LocalDecl {
|
||||
mutability: Mutability::Mut,
|
||||
ty: tcx.mk_nil(),
|
||||
ty: tcx.mk_unit(),
|
||||
name: None,
|
||||
source_info,
|
||||
visibility_scope: source_info.scope,
|
||||
|
|
|
@ -529,7 +529,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
|
|||
mutbl: hir::Mutability::MutMutable
|
||||
});
|
||||
let ref_place = self.new_temp(ref_ty);
|
||||
let unit_temp = Place::Local(self.new_temp(tcx.mk_nil()));
|
||||
let unit_temp = Place::Local(self.new_temp(tcx.mk_unit()));
|
||||
|
||||
let result = BasicBlockData {
|
||||
statements: vec![self.assign(
|
||||
|
@ -891,7 +891,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
|
|||
unwind: Unwind
|
||||
) -> BasicBlock {
|
||||
let tcx = self.tcx();
|
||||
let unit_temp = Place::Local(self.new_temp(tcx.mk_nil()));
|
||||
let unit_temp = Place::Local(self.new_temp(tcx.mk_unit()));
|
||||
let free_func = tcx.require_lang_item(lang_items::BoxFreeFnLangItem);
|
||||
let args = adt.variants[0].fields.iter().enumerate().map(|(i, f)| {
|
||||
let field = Field::new(i);
|
||||
|
|
|
@ -1575,7 +1575,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|
|||
|
||||
let output_ty = match decl.output {
|
||||
hir::Return(ref output) => self.ast_ty_to_ty(output),
|
||||
hir::DefaultReturn(..) => tcx.mk_nil(),
|
||||
hir::DefaultReturn(..) => tcx.mk_unit(),
|
||||
};
|
||||
|
||||
debug!("ty_of_fn: output_ty={:?}", output_ty);
|
||||
|
|
|
@ -656,7 +656,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
|
|||
// us to give better error messages (pointing to a usually better
|
||||
// arm for inconsistent arms or to the whole match when a `()` type
|
||||
// is required).
|
||||
Expectation::ExpectHasType(ety) if ety != self.tcx.mk_nil() => ety,
|
||||
Expectation::ExpectHasType(ety) if ety != self.tcx.mk_unit() => ety,
|
||||
_ => self.next_ty_var(TypeVariableOrigin::MiscVariable(expr.span)),
|
||||
};
|
||||
CoerceMany::with_coercion_sites(coerce_first, arms)
|
||||
|
|
|
@ -1077,7 +1077,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
|
|||
self.coerce_inner(fcx,
|
||||
cause,
|
||||
None,
|
||||
fcx.tcx.mk_nil(),
|
||||
fcx.tcx.mk_unit(),
|
||||
Some(augment_error),
|
||||
label_unit_as_expected)
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
"load" => (1, vec![tcx.mk_imm_ptr(param(0))],
|
||||
param(0)),
|
||||
"store" => (1, vec![tcx.mk_mut_ptr(param(0)), param(0)],
|
||||
tcx.mk_nil()),
|
||||
tcx.mk_unit()),
|
||||
|
||||
"xchg" | "xadd" | "xsub" | "and" | "nand" | "or" | "xor" | "max" |
|
||||
"min" | "umax" | "umin" => {
|
||||
|
@ -102,7 +102,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
param(0))
|
||||
}
|
||||
"fence" | "singlethreadfence" => {
|
||||
(0, Vec::new(), tcx.mk_nil())
|
||||
(0, Vec::new(), tcx.mk_unit())
|
||||
}
|
||||
op => {
|
||||
struct_span_err!(tcx.sess, it.span, E0092,
|
||||
|
@ -121,7 +121,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
_ => hir::Unsafety::Unsafe,
|
||||
};
|
||||
let (n_tps, inputs, output) = match &name[..] {
|
||||
"breakpoint" => (0, Vec::new(), tcx.mk_nil()),
|
||||
"breakpoint" => (0, Vec::new(), tcx.mk_unit()),
|
||||
"size_of" |
|
||||
"pref_align_of" | "min_align_of" => (1, Vec::new(), tcx.types.usize),
|
||||
"size_of_val" | "min_align_of_val" => {
|
||||
|
@ -141,7 +141,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
tcx.mk_mut_ptr(param(0)),
|
||||
param(0)
|
||||
],
|
||||
tcx.mk_nil())
|
||||
tcx.mk_unit())
|
||||
}
|
||||
"prefetch_read_data" | "prefetch_write_data" |
|
||||
"prefetch_read_instruction" | "prefetch_write_instruction" => {
|
||||
|
@ -149,10 +149,10 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
ty: param(0),
|
||||
mutbl: hir::MutImmutable
|
||||
}), tcx.types.i32],
|
||||
tcx.mk_nil())
|
||||
tcx.mk_unit())
|
||||
}
|
||||
"drop_in_place" => {
|
||||
(1, vec![tcx.mk_mut_ptr(param(0))], tcx.mk_nil())
|
||||
(1, vec![tcx.mk_mut_ptr(param(0))], tcx.mk_unit())
|
||||
}
|
||||
"needs_drop" => (1, Vec::new(), tcx.types.bool),
|
||||
|
||||
|
@ -185,7 +185,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}),
|
||||
tcx.types.usize,
|
||||
],
|
||||
tcx.mk_nil())
|
||||
tcx.mk_unit())
|
||||
}
|
||||
"volatile_copy_memory" | "volatile_copy_nonoverlapping_memory" => {
|
||||
(1,
|
||||
|
@ -200,7 +200,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}),
|
||||
tcx.types.usize,
|
||||
],
|
||||
tcx.mk_nil())
|
||||
tcx.mk_unit())
|
||||
}
|
||||
"write_bytes" | "volatile_set_memory" => {
|
||||
(1,
|
||||
|
@ -212,7 +212,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
tcx.types.u8,
|
||||
tcx.types.usize,
|
||||
],
|
||||
tcx.mk_nil())
|
||||
tcx.mk_unit())
|
||||
}
|
||||
"sqrtf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
|
||||
"sqrtf64" => (0, vec![ tcx.types.f64 ], tcx.types.f64),
|
||||
|
@ -280,7 +280,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
"volatile_load" | "unaligned_volatile_load" =>
|
||||
(1, vec![ tcx.mk_imm_ptr(param(0)) ], param(0)),
|
||||
"volatile_store" | "unaligned_volatile_store" =>
|
||||
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_nil()),
|
||||
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_unit()),
|
||||
|
||||
"ctpop" | "ctlz" | "ctlz_nonzero" | "cttz" | "cttz_nonzero" |
|
||||
"bswap" | "bitreverse" =>
|
||||
|
@ -300,7 +300,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
"fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" =>
|
||||
(1, vec![param(0), param(0)], param(0)),
|
||||
|
||||
"assume" => (0, vec![tcx.types.bool], tcx.mk_nil()),
|
||||
"assume" => (0, vec![tcx.types.bool], tcx.mk_unit()),
|
||||
"likely" => (0, vec![tcx.types.bool], tcx.types.bool),
|
||||
"unlikely" => (0, vec![tcx.types.bool], tcx.types.bool),
|
||||
|
||||
|
@ -313,7 +313,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
let mut_u8 = tcx.mk_mut_ptr(tcx.types.u8);
|
||||
let fn_ty = ty::Binder::bind(tcx.mk_fn_sig(
|
||||
iter::once(mut_u8),
|
||||
tcx.mk_nil(),
|
||||
tcx.mk_unit(),
|
||||
false,
|
||||
hir::Unsafety::Normal,
|
||||
Abi::Rust,
|
||||
|
@ -322,7 +322,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
|
||||
"nontemporal_store" => {
|
||||
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_nil())
|
||||
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_unit())
|
||||
}
|
||||
|
||||
ref other => {
|
||||
|
@ -376,7 +376,7 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
(3, vec![param(0), param(1), param(2)], param(0))
|
||||
}
|
||||
"simd_scatter" => {
|
||||
(3, vec![param(0), param(1), param(2)], tcx.mk_nil())
|
||||
(3, vec![param(0), param(1), param(2)], tcx.mk_unit())
|
||||
}
|
||||
"simd_insert" => (2, vec![param(0), tcx.types.u32, param(1)], param(0)),
|
||||
"simd_extract" => (2, vec![param(0), tcx.types.u32], param(1)),
|
||||
|
|
|
@ -3918,7 +3918,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
for input in inputs {
|
||||
self.check_expr(input);
|
||||
}
|
||||
tcx.mk_nil()
|
||||
tcx.mk_unit()
|
||||
}
|
||||
hir::ExprKind::Break(destination, ref expr_opt) => {
|
||||
if let Ok(target_id) = destination.target_id {
|
||||
|
@ -3945,7 +3945,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
} else {
|
||||
// Otherwise, this is a break *without* a value. That's
|
||||
// always legal, and is equivalent to `break ()`.
|
||||
e_ty = tcx.mk_nil();
|
||||
e_ty = tcx.mk_unit();
|
||||
cause = self.misc(expr.span);
|
||||
}
|
||||
|
||||
|
@ -4052,7 +4052,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
if lhs_ty.references_error() || rhs_ty.references_error() {
|
||||
tcx.types.err
|
||||
} else {
|
||||
tcx.mk_nil()
|
||||
tcx.mk_unit()
|
||||
}
|
||||
}
|
||||
hir::ExprKind::If(ref cond, ref then_expr, ref opt_else_expr) => {
|
||||
|
@ -4081,7 +4081,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
self.diverges.set(Diverges::Maybe);
|
||||
}
|
||||
|
||||
self.tcx.mk_nil()
|
||||
self.tcx.mk_unit()
|
||||
}
|
||||
hir::ExprKind::Loop(ref body, _, source) => {
|
||||
let coerce = match source {
|
||||
|
@ -4121,7 +4121,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
// [1]
|
||||
self.tcx.sess.delay_span_bug(body.span, "no coercion, but loop may not break");
|
||||
}
|
||||
ctxt.coerce.map(|c| c.complete(self)).unwrap_or(self.tcx.mk_nil())
|
||||
ctxt.coerce.map(|c| c.complete(self)).unwrap_or(self.tcx.mk_unit())
|
||||
}
|
||||
hir::ExprKind::Match(ref discrim, ref arms, match_src) => {
|
||||
self.check_match(expr, &discrim, arms, expected, match_src)
|
||||
|
@ -4352,7 +4352,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
"yield statement outside of generator literal").emit();
|
||||
}
|
||||
}
|
||||
tcx.mk_nil()
|
||||
tcx.mk_unit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4516,7 +4516,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
hir::StmtKind::Expr(ref expr, _) => {
|
||||
// Check with expected type of ()
|
||||
self.check_expr_has_type_or_error(&expr, self.tcx.mk_nil());
|
||||
self.check_expr_has_type_or_error(&expr, self.tcx.mk_unit());
|
||||
}
|
||||
hir::StmtKind::Semi(ref expr, _) => {
|
||||
self.check_expr(&expr);
|
||||
|
@ -4529,7 +4529,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
pub fn check_block_no_value(&self, blk: &'gcx hir::Block) {
|
||||
let unit = self.tcx.mk_nil();
|
||||
let unit = self.tcx.mk_unit();
|
||||
let ty = self.check_block_with_expected(blk, ExpectHasType(unit));
|
||||
|
||||
// if the block produces a `!` value, that can always be
|
||||
|
|
|
@ -35,7 +35,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
|
|||
let ty = if !lhs_ty.is_ty_var() && !rhs_ty.is_ty_var()
|
||||
&& is_builtin_binop(lhs_ty, rhs_ty, op) {
|
||||
self.enforce_builtin_binop_types(lhs_expr, lhs_ty, rhs_expr, rhs_ty, op);
|
||||
self.tcx.mk_nil()
|
||||
self.tcx.mk_unit()
|
||||
} else {
|
||||
return_ty
|
||||
};
|
||||
|
|
|
@ -225,7 +225,7 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
actual.output().skip_binder()
|
||||
} else {
|
||||
// standard () main return type
|
||||
tcx.mk_nil()
|
||||
tcx.mk_unit()
|
||||
};
|
||||
|
||||
let se_ty = tcx.mk_fn_ptr(ty::Binder::bind(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue