Skip to content

Commit 9c0f946

Browse files
authored
Rollup merge of #54095 - kenta7777:kenta7777#53719, r=davidtwco
Rename all mentions of `nil` to `unit` Fixes #53719. Renamed keywords nil to unit.
2 parents 33bc6c3 + 26dbf56 commit 9c0f946

File tree

28 files changed

+68
-68
lines changed

28 files changed

+68
-68
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/ty/query/on_disk_cache.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ impl<'enc, 'a, 'tcx, E> Encoder for CacheEncoder<'enc, 'a, 'tcx, E>
10201020
{
10211021
type Error = E::Error;
10221022

1023-
fn emit_nil(&mut self) -> Result<(), Self::Error> {
1023+
fn emit_unit(&mut self) -> Result<(), Self::Error> {
10241024
Ok(())
10251025
}
10261026

src/librustc/ty/sty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1458,7 +1458,7 @@ impl RegionKind {
14581458

14591459
/// Type utilities
14601460
impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1461-
pub fn is_nil(&self) -> bool {
1461+
pub fn is_unit(&self) -> bool {
14621462
match self.sty {
14631463
Tuple(ref tys) => tys.is_empty(),
14641464
_ => false,

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl PrintContext {
234234
}
235235
}
236236
write!(f, ")")?;
237-
if !output.is_nil() {
237+
if !output.is_unit() {
238238
print!(f, self, write(" -> "), print_display(output))?;
239239
}
240240

src/librustc_codegen_llvm/debuginfo/type_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
160160

161161
output.push(')');
162162

163-
if !sig.output().is_nil() {
163+
if !sig.output().is_unit() {
164164
output.push_str(" -> ");
165165
push_debuginfo_type_name(cx, sig.output(), true, output);
166166
}

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_codegen_llvm/mir/rvalue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
566566
) -> &'ll Value {
567567
let is_float = input_ty.is_fp();
568568
let is_signed = input_ty.is_signed();
569-
let is_nil = input_ty.is_nil();
569+
let is_unit = input_ty.is_unit();
570570
match op {
571571
mir::BinOp::Add => if is_float {
572572
bx.fadd(lhs, rhs)
@@ -604,7 +604,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
604604
mir::BinOp::Shl => common::build_unchecked_lshift(bx, lhs, rhs),
605605
mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
606606
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt |
607-
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_nil {
607+
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit {
608608
C_bool(bx.cx, match op {
609609
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false,
610610
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true,

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> {

0 commit comments

Comments
 (0)