Skip to content

Commit 5c3ba4a

Browse files
committed
renamed mk_nil to mk_unit
1 parent 6f685ff commit 5c3ba4a

File tree

16 files changed

+40
-40
lines changed

16 files changed

+40
-40
lines changed

src/librustc/traits/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
661661
{
662662
let predicate = trait_predicate.map_bound(|mut trait_pred| {
663663
trait_pred.trait_ref.substs = self.tcx.mk_substs_trait(
664-
self.tcx.mk_nil(),
664+
self.tcx.mk_unit(),
665665
&trait_pred.trait_ref.substs[1..],
666666
);
667667
trait_pred

src/librustc/ty/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,7 +2492,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
24922492
}
24932493

24942494
pub fn mk_nil_ptr(self) -> Ty<'tcx> {
2495-
self.mk_imm_ptr(self.mk_nil())
2495+
self.mk_imm_ptr(self.mk_unit())
24962496
}
24972497

24982498
pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> {
@@ -2511,7 +2511,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
25112511
iter.intern_with(|ts| self.mk_ty(Tuple(self.intern_type_list(ts))))
25122512
}
25132513

2514-
pub fn mk_nil(self) -> Ty<'tcx> {
2514+
pub fn mk_unit(self) -> Ty<'tcx> {
25152515
self.intern_tup(&[])
25162516
}
25172517

src/librustc/ty/layout.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl PrimitiveExt for Primitive {
132132
Int(i, signed) => i.to_ty(tcx, signed),
133133
Float(FloatTy::F32) => tcx.types.f32,
134134
Float(FloatTy::F64) => tcx.types.f64,
135-
Pointer => tcx.mk_mut_ptr(tcx.mk_nil()),
135+
Pointer => tcx.mk_mut_ptr(tcx.mk_unit()),
136136
}
137137
}
138138
}
@@ -1606,7 +1606,7 @@ impl<'a, 'tcx, C> TyLayoutMethods<'tcx, C> for Ty<'tcx>
16061606
// (which may have no non-DST form), and will work as long
16071607
// as the `Abi` or `FieldPlacement` is checked by users.
16081608
if i == 0 {
1609-
let nil = tcx.mk_nil();
1609+
let nil = tcx.mk_unit();
16101610
let ptr_ty = if this.ty.is_unsafe_ptr() {
16111611
tcx.mk_mut_ptr(nil)
16121612
} else {

src/librustc_codegen_llvm/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ fn get_rust_try_fn<'ll, 'tcx>(
968968
let i8p = tcx.mk_mut_ptr(tcx.types.i8);
969969
let fn_ty = tcx.mk_fn_ptr(ty::Binder::bind(tcx.mk_fn_sig(
970970
iter::once(i8p),
971-
tcx.mk_nil(),
971+
tcx.mk_unit(),
972972
false,
973973
hir::Unsafety::Unsafe,
974974
Abi::Rust

src/librustc_driver/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
309309
}
310310

311311
pub fn t_nil(&self) -> Ty<'tcx> {
312-
self.infcx.tcx.mk_nil()
312+
self.infcx.tcx.mk_unit()
313313
}
314314

315315
pub fn t_pair(&self, ty1: Ty<'tcx>, ty2: Ty<'tcx>) -> Ty<'tcx> {

src/librustc_mir/hair/cx/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> {
118118
}
119119

120120
pub fn unit_ty(&mut self) -> Ty<'tcx> {
121-
self.tcx.mk_nil()
121+
self.tcx.mk_unit()
122122
}
123123

124124
pub fn true_literal(&mut self) -> &'tcx ty::Const<'tcx> {

src/librustc_mir/interpret/terminator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
436436
layout: self.layout_of(self.tcx.mk_mut_ptr(place.layout.ty))?,
437437
};
438438

439-
let ty = self.tcx.mk_nil(); // return type is ()
439+
let ty = self.tcx.mk_unit(); // return type is ()
440440
let dest = PlaceTy::null(&self, self.layout_of(ty)?);
441441

442442
self.eval_fn_call(

src/librustc_mir/transform/generator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ fn compute_layout<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
517517
}
518518

519519
let upvar_len = mir.upvar_decls.len();
520-
let dummy_local = LocalDecl::new_internal(tcx.mk_nil(), mir.span);
520+
let dummy_local = LocalDecl::new_internal(tcx.mk_unit(), mir.span);
521521

522522
// Gather live locals and their indices replacing values in mir.local_decls with a dummy
523523
// to avoid changing local indices
@@ -655,7 +655,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
655655
// Replace the return variable
656656
mir.local_decls[RETURN_PLACE] = LocalDecl {
657657
mutability: Mutability::Mut,
658-
ty: tcx.mk_nil(),
658+
ty: tcx.mk_unit(),
659659
name: None,
660660
source_info,
661661
visibility_scope: source_info.scope,

src/librustc_mir/util/elaborate_drops.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
529529
mutbl: hir::Mutability::MutMutable
530530
});
531531
let ref_place = self.new_temp(ref_ty);
532-
let unit_temp = Place::Local(self.new_temp(tcx.mk_nil()));
532+
let unit_temp = Place::Local(self.new_temp(tcx.mk_unit()));
533533

534534
let result = BasicBlockData {
535535
statements: vec![self.assign(
@@ -891,7 +891,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
891891
unwind: Unwind
892892
) -> BasicBlock {
893893
let tcx = self.tcx();
894-
let unit_temp = Place::Local(self.new_temp(tcx.mk_nil()));
894+
let unit_temp = Place::Local(self.new_temp(tcx.mk_unit()));
895895
let free_func = tcx.require_lang_item(lang_items::BoxFreeFnLangItem);
896896
let args = adt.variants[0].fields.iter().enumerate().map(|(i, f)| {
897897
let field = Field::new(i);

src/librustc_typeck/astconv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1575,7 +1575,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
15751575

15761576
let output_ty = match decl.output {
15771577
hir::Return(ref output) => self.ast_ty_to_ty(output),
1578-
hir::DefaultReturn(..) => tcx.mk_nil(),
1578+
hir::DefaultReturn(..) => tcx.mk_unit(),
15791579
};
15801580

15811581
debug!("ty_of_fn: output_ty={:?}", output_ty);

src/librustc_typeck/check/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
656656
// us to give better error messages (pointing to a usually better
657657
// arm for inconsistent arms or to the whole match when a `()` type
658658
// is required).
659-
Expectation::ExpectHasType(ety) if ety != self.tcx.mk_nil() => ety,
659+
Expectation::ExpectHasType(ety) if ety != self.tcx.mk_unit() => ety,
660660
_ => self.next_ty_var(TypeVariableOrigin::MiscVariable(expr.span)),
661661
};
662662
CoerceMany::with_coercion_sites(coerce_first, arms)

src/librustc_typeck/check/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
10771077
self.coerce_inner(fcx,
10781078
cause,
10791079
None,
1080-
fcx.tcx.mk_nil(),
1080+
fcx.tcx.mk_unit(),
10811081
Some(augment_error),
10821082
label_unit_as_expected)
10831083
}

src/librustc_typeck/check/intrinsic.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
9494
"load" => (1, vec![tcx.mk_imm_ptr(param(0))],
9595
param(0)),
9696
"store" => (1, vec![tcx.mk_mut_ptr(param(0)), param(0)],
97-
tcx.mk_nil()),
97+
tcx.mk_unit()),
9898

9999
"xchg" | "xadd" | "xsub" | "and" | "nand" | "or" | "xor" | "max" |
100100
"min" | "umax" | "umin" => {
101101
(1, vec![tcx.mk_mut_ptr(param(0)), param(0)],
102102
param(0))
103103
}
104104
"fence" | "singlethreadfence" => {
105-
(0, Vec::new(), tcx.mk_nil())
105+
(0, Vec::new(), tcx.mk_unit())
106106
}
107107
op => {
108108
struct_span_err!(tcx.sess, it.span, E0092,
@@ -121,7 +121,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
121121
_ => hir::Unsafety::Unsafe,
122122
};
123123
let (n_tps, inputs, output) = match &name[..] {
124-
"breakpoint" => (0, Vec::new(), tcx.mk_nil()),
124+
"breakpoint" => (0, Vec::new(), tcx.mk_unit()),
125125
"size_of" |
126126
"pref_align_of" | "min_align_of" => (1, Vec::new(), tcx.types.usize),
127127
"size_of_val" | "min_align_of_val" => {
@@ -141,18 +141,18 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
141141
tcx.mk_mut_ptr(param(0)),
142142
param(0)
143143
],
144-
tcx.mk_nil())
144+
tcx.mk_unit())
145145
}
146146
"prefetch_read_data" | "prefetch_write_data" |
147147
"prefetch_read_instruction" | "prefetch_write_instruction" => {
148148
(1, vec![tcx.mk_ptr(ty::TypeAndMut {
149149
ty: param(0),
150150
mutbl: hir::MutImmutable
151151
}), tcx.types.i32],
152-
tcx.mk_nil())
152+
tcx.mk_unit())
153153
}
154154
"drop_in_place" => {
155-
(1, vec![tcx.mk_mut_ptr(param(0))], tcx.mk_nil())
155+
(1, vec![tcx.mk_mut_ptr(param(0))], tcx.mk_unit())
156156
}
157157
"needs_drop" => (1, Vec::new(), tcx.types.bool),
158158

@@ -185,7 +185,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
185185
}),
186186
tcx.types.usize,
187187
],
188-
tcx.mk_nil())
188+
tcx.mk_unit())
189189
}
190190
"volatile_copy_memory" | "volatile_copy_nonoverlapping_memory" => {
191191
(1,
@@ -200,7 +200,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
200200
}),
201201
tcx.types.usize,
202202
],
203-
tcx.mk_nil())
203+
tcx.mk_unit())
204204
}
205205
"write_bytes" | "volatile_set_memory" => {
206206
(1,
@@ -212,7 +212,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
212212
tcx.types.u8,
213213
tcx.types.usize,
214214
],
215-
tcx.mk_nil())
215+
tcx.mk_unit())
216216
}
217217
"sqrtf32" => (0, vec![ tcx.types.f32 ], tcx.types.f32),
218218
"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>,
280280
"volatile_load" | "unaligned_volatile_load" =>
281281
(1, vec![ tcx.mk_imm_ptr(param(0)) ], param(0)),
282282
"volatile_store" | "unaligned_volatile_store" =>
283-
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_nil()),
283+
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_unit()),
284284

285285
"ctpop" | "ctlz" | "ctlz_nonzero" | "cttz" | "cttz_nonzero" |
286286
"bswap" | "bitreverse" =>
@@ -300,7 +300,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
300300
"fadd_fast" | "fsub_fast" | "fmul_fast" | "fdiv_fast" | "frem_fast" =>
301301
(1, vec![param(0), param(0)], param(0)),
302302

303-
"assume" => (0, vec![tcx.types.bool], tcx.mk_nil()),
303+
"assume" => (0, vec![tcx.types.bool], tcx.mk_unit()),
304304
"likely" => (0, vec![tcx.types.bool], tcx.types.bool),
305305
"unlikely" => (0, vec![tcx.types.bool], tcx.types.bool),
306306

@@ -313,7 +313,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
313313
let mut_u8 = tcx.mk_mut_ptr(tcx.types.u8);
314314
let fn_ty = ty::Binder::bind(tcx.mk_fn_sig(
315315
iter::once(mut_u8),
316-
tcx.mk_nil(),
316+
tcx.mk_unit(),
317317
false,
318318
hir::Unsafety::Normal,
319319
Abi::Rust,
@@ -322,7 +322,7 @@ pub fn check_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
322322
}
323323

324324
"nontemporal_store" => {
325-
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_nil())
325+
(1, vec![ tcx.mk_mut_ptr(param(0)), param(0) ], tcx.mk_unit())
326326
}
327327

328328
ref other => {
@@ -376,7 +376,7 @@ pub fn check_platform_intrinsic_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
376376
(3, vec![param(0), param(1), param(2)], param(0))
377377
}
378378
"simd_scatter" => {
379-
(3, vec![param(0), param(1), param(2)], tcx.mk_nil())
379+
(3, vec![param(0), param(1), param(2)], tcx.mk_unit())
380380
}
381381
"simd_insert" => (2, vec![param(0), tcx.types.u32, param(1)], param(0)),
382382
"simd_extract" => (2, vec![param(0), tcx.types.u32], param(1)),

src/librustc_typeck/check/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3918,7 +3918,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
39183918
for input in inputs {
39193919
self.check_expr(input);
39203920
}
3921-
tcx.mk_nil()
3921+
tcx.mk_unit()
39223922
}
39233923
hir::ExprKind::Break(destination, ref expr_opt) => {
39243924
if let Ok(target_id) = destination.target_id {
@@ -3945,7 +3945,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
39453945
} else {
39463946
// Otherwise, this is a break *without* a value. That's
39473947
// always legal, and is equivalent to `break ()`.
3948-
e_ty = tcx.mk_nil();
3948+
e_ty = tcx.mk_unit();
39493949
cause = self.misc(expr.span);
39503950
}
39513951

@@ -4052,7 +4052,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
40524052
if lhs_ty.references_error() || rhs_ty.references_error() {
40534053
tcx.types.err
40544054
} else {
4055-
tcx.mk_nil()
4055+
tcx.mk_unit()
40564056
}
40574057
}
40584058
hir::ExprKind::If(ref cond, ref then_expr, ref opt_else_expr) => {
@@ -4081,7 +4081,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
40814081
self.diverges.set(Diverges::Maybe);
40824082
}
40834083

4084-
self.tcx.mk_nil()
4084+
self.tcx.mk_unit()
40854085
}
40864086
hir::ExprKind::Loop(ref body, _, source) => {
40874087
let coerce = match source {
@@ -4121,7 +4121,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
41214121
// [1]
41224122
self.tcx.sess.delay_span_bug(body.span, "no coercion, but loop may not break");
41234123
}
4124-
ctxt.coerce.map(|c| c.complete(self)).unwrap_or(self.tcx.mk_nil())
4124+
ctxt.coerce.map(|c| c.complete(self)).unwrap_or(self.tcx.mk_unit())
41254125
}
41264126
hir::ExprKind::Match(ref discrim, ref arms, match_src) => {
41274127
self.check_match(expr, &discrim, arms, expected, match_src)
@@ -4352,7 +4352,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
43524352
"yield statement outside of generator literal").emit();
43534353
}
43544354
}
4355-
tcx.mk_nil()
4355+
tcx.mk_unit()
43564356
}
43574357
}
43584358
}
@@ -4516,7 +4516,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
45164516
}
45174517
hir::StmtKind::Expr(ref expr, _) => {
45184518
// Check with expected type of ()
4519-
self.check_expr_has_type_or_error(&expr, self.tcx.mk_nil());
4519+
self.check_expr_has_type_or_error(&expr, self.tcx.mk_unit());
45204520
}
45214521
hir::StmtKind::Semi(ref expr, _) => {
45224522
self.check_expr(&expr);
@@ -4529,7 +4529,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
45294529
}
45304530

45314531
pub fn check_block_no_value(&self, blk: &'gcx hir::Block) {
4532-
let unit = self.tcx.mk_nil();
4532+
let unit = self.tcx.mk_unit();
45334533
let ty = self.check_block_with_expected(blk, ExpectHasType(unit));
45344534

45354535
// if the block produces a `!` value, that can always be

src/librustc_typeck/check/op.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3535
let ty = if !lhs_ty.is_ty_var() && !rhs_ty.is_ty_var()
3636
&& is_builtin_binop(lhs_ty, rhs_ty, op) {
3737
self.enforce_builtin_binop_types(lhs_expr, lhs_ty, rhs_expr, rhs_ty, op);
38-
self.tcx.mk_nil()
38+
self.tcx.mk_unit()
3939
} else {
4040
return_ty
4141
};

src/librustc_typeck/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn check_main_fn_ty<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
225225
actual.output().skip_binder()
226226
} else {
227227
// standard () main return type
228-
tcx.mk_nil()
228+
tcx.mk_unit()
229229
};
230230

231231
let se_ty = tcx.mk_fn_ptr(ty::Binder::bind(

0 commit comments

Comments
 (0)