Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename all mentions of nil to unit #54095

Merged
merged 14 commits into from
Sep 14, 2018
2 changes: 1 addition & 1 deletion src/doc/book
Submodule book updated 139 files
2 changes: 1 addition & 1 deletion src/doc/nomicon
2 changes: 1 addition & 1 deletion src/doc/reference
2 changes: 1 addition & 1 deletion src/libcompiler_builtins
2 changes: 1 addition & 1 deletion src/liblibc
Submodule liblibc updated 82 files
+8 −15 .travis.yml
+90 −70 Cargo.lock
+1 −2 Cargo.toml
+22 −34 README.md
+6 −6 ci/docker/aarch64-unknown-linux-musl/Dockerfile
+6 −6 ci/docker/arm-unknown-linux-musleabihf/Dockerfile
+6 −7 ci/docker/i686-unknown-linux-musl/Dockerfile
+1 −4 ci/docker/sparc64-unknown-linux-gnu/Dockerfile
+6 −6 ci/docker/x86_64-unknown-linux-musl/Dockerfile
+0 −1 ci/ios/deploy_and_run_on_ios_simulator.rs
+1 −1 ci/linux-sparc64.sh
+2 −10 ci/run.sh
+1 −3 ci/style.rs
+1 −2 libc-test/Cargo.toml
+16 −76 libc-test/build.rs
+5 −63 src/dox.rs
+2 −2 src/fuchsia/aarch64.rs
+68 −93 src/fuchsia/mod.rs
+79 −0 src/fuchsia/powerpc64.rs
+27 −31 src/lib.rs
+2 −19 src/macros.rs
+0 −34 src/redox/mod.rs
+0 −14 src/redox/net.rs
+0 −48 src/switch.rs
+0 −6 src/unix/bsd/apple/b32.rs
+1 −5 src/unix/bsd/apple/b64.rs
+12 −46 src/unix/bsd/apple/mod.rs
+0 −24 src/unix/bsd/freebsdlike/dragonfly/mod.rs
+0 −30 src/unix/bsd/freebsdlike/freebsd/mod.rs
+4 −24 src/unix/bsd/freebsdlike/mod.rs
+0 −1 src/unix/bsd/mod.rs
+4 −14 src/unix/bsd/netbsdlike/mod.rs
+0 −3 src/unix/bsd/netbsdlike/netbsd/aarch64.rs
+0 −3 src/unix/bsd/netbsdlike/netbsd/arm.rs
+3 −49 src/unix/bsd/netbsdlike/netbsd/mod.rs
+0 −1 src/unix/bsd/netbsdlike/netbsd/other/b32/mod.rs
+0 −1 src/unix/bsd/netbsdlike/netbsd/other/b64/mod.rs
+14 −0 src/unix/bsd/netbsdlike/netbsd/other/mod.rs
+0 −3 src/unix/bsd/netbsdlike/netbsd/powerpc.rs
+0 −3 src/unix/bsd/netbsdlike/netbsd/x86_64.rs
+0 −2 src/unix/bsd/netbsdlike/openbsdlike/bitrig/mod.rs
+1 −14 src/unix/bsd/netbsdlike/openbsdlike/mod.rs
+0 −206 src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
+4 −27 src/unix/haiku/mod.rs
+0 −2 src/unix/hermit/aarch64.rs
+0 −736 src/unix/hermit/mod.rs
+0 −2 src/unix/hermit/x86_64.rs
+2 −28 src/unix/mod.rs
+23 −72 src/unix/newlib/mod.rs
+16 −0 src/unix/notbsd/android/b32/mod.rs
+25 −0 src/unix/notbsd/android/b64/mod.rs
+23 −118 src/unix/notbsd/android/mod.rs
+39 −42 src/unix/notbsd/emscripten.rs
+3 −69 src/unix/notbsd/linux/mips/mips32.rs
+0 −68 src/unix/notbsd/linux/mips/mips64.rs
+20 −26 src/unix/notbsd/linux/mips/mod.rs
+88 −280 src/unix/notbsd/linux/mod.rs
+0 −85 src/unix/notbsd/linux/musl/b32/arm.rs
+0 −85 src/unix/notbsd/linux/musl/b32/mips.rs
+15 −9 src/unix/notbsd/linux/musl/b32/mod.rs
+0 −866 src/unix/notbsd/linux/musl/b32/powerpc.rs
+0 −85 src/unix/notbsd/linux/musl/b32/x86.rs
+0 −135 src/unix/notbsd/linux/musl/b64/aarch64.rs
+62 −0 src/unix/notbsd/linux/musl/b64/mod.rs
+12 −143 src/unix/notbsd/linux/musl/b64/powerpc64.rs
+0 −136 src/unix/notbsd/linux/musl/b64/x86_64.rs
+75 −22 src/unix/notbsd/linux/musl/mod.rs
+0 −69 src/unix/notbsd/linux/other/b32/mod.rs
+0 −44 src/unix/notbsd/linux/other/b64/aarch64.rs
+0 −70 src/unix/notbsd/linux/other/b64/not_x32.rs
+0 −68 src/unix/notbsd/linux/other/b64/powerpc64.rs
+0 −78 src/unix/notbsd/linux/other/b64/sparc64.rs
+0 −43 src/unix/notbsd/linux/other/b64/x32.rs
+0 −4 src/unix/notbsd/linux/other/b64/x86_64.rs
+20 −47 src/unix/notbsd/linux/other/mod.rs
+0 −47 src/unix/notbsd/linux/s390x.rs
+2 −200 src/unix/notbsd/mod.rs
+3 −7 src/unix/solaris/mod.rs
+2 −372 src/unix/uclibc/mips/mips32.rs
+0 −5 src/unix/uclibc/mips/mips64.rs
+25 −77 src/unix/uclibc/mod.rs
+11 −67 src/unix/uclibc/x86_64/mod.rs
2 changes: 1 addition & 1 deletion src/librustc/traits/error_reporting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ macro_rules! implement_ty_decoder {
type Error = String;

__impl_decoder_methods! {
read_nil -> ();
read_unit -> ();

read_u128 -> u128;
read_u64 -> u64;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2491,8 +2491,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.mk_ptr(TypeAndMut {ty: ty, mutbl: hir::MutImmutable})
}

pub fn mk_nil_ptr(self) -> Ty<'tcx> {
self.mk_imm_ptr(self.mk_nil())
pub fn mk_unit_ptr(self) -> Ty<'tcx> {
self.mk_imm_ptr(self.mk_unit())
}

pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> {
Expand All @@ -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(&[])
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}
}
}
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/query/on_disk_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ impl<'enc, 'a, 'tcx, E> Encoder for CacheEncoder<'enc, 'a, 'tcx, E>
{
type Error = E::Error;

fn emit_nil(&mut self) -> Result<(), Self::Error> {
fn emit_unit(&mut self) -> Result<(), Self::Error> {
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ impl RegionKind {

/// Type utilities
impl<'a, 'gcx, 'tcx> TyS<'tcx> {
pub fn is_nil(&self) -> bool {
pub fn is_unit(&self) -> bool {
match self.sty {
Tuple(ref tys) => tys.is_empty(),
_ => false,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl PrintContext {
}
}
write!(f, ")")?;
if !output.is_nil() {
if !output.is_unit() {
print!(f, self, write(" -> "), print_display(output))?;
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/debuginfo/type_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,

output.push(')');

if !sig.output().is_nil() {
if !sig.output().is_unit() {
output.push_str(" -> ");
push_debuginfo_type_name(cx, sig.output(), true, output);
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_codegen_llvm/intrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_codegen_llvm/mir/rvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
) -> &'ll Value {
let is_float = input_ty.is_fp();
let is_signed = input_ty.is_signed();
let is_nil = input_ty.is_nil();
let is_unit = input_ty.is_unit();
match op {
mir::BinOp::Add => if is_float {
bx.fadd(lhs, rhs)
Expand Down Expand Up @@ -604,7 +604,7 @@ impl FunctionCx<'a, 'll, 'tcx> {
mir::BinOp::Shl => common::build_unchecked_lshift(bx, lhs, rhs),
mir::BinOp::Shr => common::build_unchecked_rshift(bx, input_ty, lhs, rhs),
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt |
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_nil {
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_unit {
C_bool(bx.cx, match op {
mir::BinOp::Ne | mir::BinOp::Lt | mir::BinOp::Gt => false,
mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => true,
Expand Down
20 changes: 10 additions & 10 deletions src/librustc_driver/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> {
)))
}

pub fn t_nil(&self) -> Ty<'tcx> {
self.infcx.tcx.mk_nil()
pub fn t_unit(&self) -> Ty<'tcx> {
self.infcx.tcx.mk_unit()
}

pub fn t_pair(&self, ty1: Ty<'tcx>, ty2: Ty<'tcx>) -> Ty<'tcx> {
Expand Down Expand Up @@ -491,7 +491,7 @@ fn subst_ty_renumber_bound() {
// t_source = fn(A)
let t_source = {
let t_param = env.t_param(0);
env.t_fn(&[t_param], env.t_nil())
env.t_fn(&[t_param], env.t_unit())
};

let substs = env.infcx.tcx.intern_substs(&[t_rptr_bound1.into()]);
Expand All @@ -500,7 +500,7 @@ fn subst_ty_renumber_bound() {
// t_expected = fn(&'a isize)
let t_expected = {
let t_ptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, d2());
env.t_fn(&[t_ptr_bound2], env.t_nil())
env.t_fn(&[t_ptr_bound2], env.t_unit())
};

debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}",
Expand All @@ -526,7 +526,7 @@ fn subst_ty_renumber_some_bounds() {
// t_source = (A, fn(A))
let t_source = {
let t_param = env.t_param(0);
env.t_pair(t_param, env.t_fn(&[t_param], env.t_nil()))
env.t_pair(t_param, env.t_fn(&[t_param], env.t_unit()))
};

let substs = env.infcx.tcx.intern_substs(&[t_rptr_bound1.into()]);
Expand All @@ -537,7 +537,7 @@ fn subst_ty_renumber_some_bounds() {
// but not that the Debruijn index is different in the different cases.
let t_expected = {
let t_rptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, d2());
env.t_pair(t_rptr_bound1, env.t_fn(&[t_rptr_bound2], env.t_nil()))
env.t_pair(t_rptr_bound1, env.t_fn(&[t_rptr_bound2], env.t_unit()))
};

debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}",
Expand All @@ -559,7 +559,7 @@ fn escaping() {
// Theta = [A -> &'a foo]
env.create_simple_region_hierarchy();

assert!(!env.t_nil().has_escaping_regions());
assert!(!env.t_unit().has_escaping_regions());

let t_rptr_free1 = env.t_rptr_free(1);
assert!(!t_rptr_free1.has_escaping_regions());
Expand All @@ -573,7 +573,7 @@ fn escaping() {
// t_fn = fn(A)
let t_param = env.t_param(0);
assert!(!t_param.has_escaping_regions());
let t_fn = env.t_fn(&[t_param], env.t_nil());
let t_fn = env.t_fn(&[t_param], env.t_unit());
assert!(!t_fn.has_escaping_regions());
})
}
Expand All @@ -588,7 +588,7 @@ fn subst_region_renumber_region() {
// type t_source<'a> = fn(&'a isize)
let t_source = {
let re_early = env.re_early_bound(0, "'a");
env.t_fn(&[env.t_rptr(re_early)], env.t_nil())
env.t_fn(&[env.t_rptr(re_early)], env.t_unit())
};

let substs = env.infcx.tcx.intern_substs(&[re_bound1.into()]);
Expand All @@ -599,7 +599,7 @@ fn subst_region_renumber_region() {
// but not that the Debruijn index is different in the different cases.
let t_expected = {
let t_rptr_bound2 = env.t_rptr_late_bound_with_debruijn(1, d2());
env.t_fn(&[t_rptr_bound2], env.t_nil())
env.t_fn(&[t_rptr_bound2], env.t_unit())
};

debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}",
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_lint/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
}

let sig = cx.erase_late_bound_regions(&sig);
if !sig.output().is_nil() {
if !sig.output().is_unit() {
let r = self.check_type_for_ffi(cache, sig.output());
match r {
FfiSafe => {}
Expand Down Expand Up @@ -767,7 +767,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {

if let hir::Return(ref ret_hir) = decl.output {
let ret_ty = sig.output();
if !ret_ty.is_nil() {
if !ret_ty.is_unit() {
self.check_type_for_ffi_and_report_errors(ret_hir.span, ret_ty);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_metadata/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ macro_rules! encoder_methods {
impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> {
type Error = <opaque::Encoder as Encoder>::Error;

fn emit_nil(&mut self) -> Result<(), Self::Error> {
fn emit_unit(&mut self) -> Result<(), Self::Error> {
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/build/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
// the case of `!`, no return value is required, as the block will never return.
let tcx = this.hir.tcx();
let ty = destination.ty(&this.local_decls, tcx).to_ty(tcx);
if ty.is_nil() {
if ty.is_unit() {
// We only want to assign an implicit `()` as the return value of the block if the
// block does not diverge. (Otherwise, we may try to assign a unit to a `!`-type.)
this.cfg.push_assign_unit(block, source_info, destination);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/hair/cx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/terminator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/monomorphize/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> {

output.push(')');

if !sig.output().is_nil() {
if !sig.output().is_unit() {
output.push_str(" -> ");
self.push_type_name(sig.output(), output);
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/util/elaborate_drops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_typeck/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -677,14 +677,14 @@ https://doc.rust-lang.org/reference/types.html#trait-objects");
// Handle the fallback arm of a desugared if-let like a missing else.
let is_if_let_fallback = match match_src {
hir::MatchSource::IfLetDesugar { contains_else_clause: false } => {
i == arms.len() - 1 && arm_ty.is_nil()
i == arms.len() - 1 && arm_ty.is_unit()
}
_ => false
};

if is_if_let_fallback {
let cause = self.cause(expr.span, ObligationCauseCode::IfExpressionWithNoElse);
assert!(arm_ty.is_nil());
assert!(arm_ty.is_unit());
coercion.coerce_forced_unit(self, &cause, &mut |_| (), true);
} else {
let cause = self.cause(expr.span, ObligationCauseCode::MatchExpressionArm {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_typeck/check/coercion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -1146,8 +1146,8 @@ impl<'gcx, 'tcx, 'exprs, E> CoerceMany<'gcx, 'tcx, 'exprs, E>
// `expression_ty` will be unit).
//
// Another example is `break` with no argument expression.
assert!(expression_ty.is_nil());
assert!(expression_ty.is_nil(), "if let hack without unit type");
assert!(expression_ty.is_unit());
assert!(expression_ty.is_unit(), "if let hack without unit type");
fcx.at(cause, fcx.param_env)
.eq_exp(label_expression_as_expected, expression_ty, self.merged_ty())
.map(|infer_ok| {
Expand Down
Loading