From d02a5ffaed9c395ae62ee12d0f4e04946c62edb1 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 10 Sep 2018 10:31:37 +0900 Subject: [PATCH 01/13] renamed emit_nil to emit_unit --- src/doc/book | 2 +- src/doc/nomicon | 2 +- src/doc/reference | 2 +- src/doc/rust-by-example | 2 +- src/libcompiler_builtins | 2 +- src/liblibc | 2 +- src/librustc/ty/query/on_disk_cache.rs | 2 +- src/librustc_metadata/encoder.rs | 2 +- src/libserialize/json.rs | 10 +++++----- src/libserialize/opaque.rs | 2 +- src/libserialize/serialize.rs | 4 ++-- src/llvm | 2 +- src/stdsimd | 2 +- src/tools/cargo | 2 +- src/tools/clippy | 2 +- src/tools/miri | 2 +- src/tools/rls | 2 +- src/tools/rust-installer | 2 +- src/tools/rustfmt | 2 +- 19 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/doc/book b/src/doc/book index cff0930664b68..f51127530d46b 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit cff0930664b688f1dd22aefb3d16944eb4cdbfd5 +Subproject commit f51127530d46b9acbf4747c859da185e771cfcf3 diff --git a/src/doc/nomicon b/src/doc/nomicon index 7fd493465b7dd..748a5e6742db4 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit 7fd493465b7dd6cf3476f0b834884059bbdd1d93 +Subproject commit 748a5e6742db4a21c4c630a58087f818828e8a0a diff --git a/src/doc/reference b/src/doc/reference index 821355a6fd642..134f419ee6271 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 821355a6fd642b71988a2f88a3162fb358732012 +Subproject commit 134f419ee62714590b04712fe6072253bc2a7822 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index e459fb3f07f2b..eebda16e4b45f 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit e459fb3f07f2b930ccd25d348671b8eae233fd64 +Subproject commit eebda16e4b45f2eed4310cf7b9872cc752278163 diff --git a/src/libcompiler_builtins b/src/libcompiler_builtins index 0703bfa72524e..2a2f6d96c8dc5 160000 --- a/src/libcompiler_builtins +++ b/src/libcompiler_builtins @@ -1 +1 @@ -Subproject commit 0703bfa72524e01e414477657ca9b64794c5c1c3 +Subproject commit 2a2f6d96c8dc578d2474742f14c9bab0b36b0408 diff --git a/src/liblibc b/src/liblibc index 1844a772b6077..a7e78a78e17c8 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit 1844a772b60771d0124a157019f627d60fea4e73 +Subproject commit a7e78a78e17c8776d7780008ccb3ce541ec64ae9 diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 6e16d92ba0c8d..19e235154cbd0 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -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(()) } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index aae45c17c6771..56b38cfbc872a 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -75,7 +75,7 @@ macro_rules! encoder_methods { impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> { type Error = ::Error; - fn emit_nil(&mut self) -> Result<(), Self::Error> { + fn emit_unit(&mut self) -> Result<(), Self::Error> { Ok(()) } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 35ef6327de5fd..9439dc78d3ca4 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -490,7 +490,7 @@ macro_rules! emit_enquoted_if_mapkey { impl<'a> ::Encoder for Encoder<'a> { type Error = EncoderError; - fn emit_nil(&mut self) -> EncodeResult { + fn emit_unit(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } write!(self.writer, "null")?; Ok(()) @@ -648,7 +648,7 @@ impl<'a> ::Encoder for Encoder<'a> { } fn emit_option_none(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } - self.emit_nil() + self.emit_unit() } fn emit_option_some(&mut self, f: F) -> EncodeResult where F: FnOnce(&mut Encoder<'a>) -> EncodeResult, @@ -740,7 +740,7 @@ impl<'a> PrettyEncoder<'a> { impl<'a> ::Encoder for PrettyEncoder<'a> { type Error = EncoderError; - fn emit_nil(&mut self) -> EncodeResult { + fn emit_unit(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } write!(self.writer, "null")?; Ok(()) @@ -923,7 +923,7 @@ impl<'a> ::Encoder for PrettyEncoder<'a> { } fn emit_option_none(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } - self.emit_nil() + self.emit_unit() } fn emit_option_some(&mut self, f: F) -> EncodeResult where F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult, @@ -1016,7 +1016,7 @@ impl Encodable for Json { Json::Boolean(v) => v.encode(e), Json::Array(ref v) => v.encode(e), Json::Object(ref v) => v.encode(e), - Json::Null => e.emit_nil(), + Json::Null => e.emit_unit(), } } } diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index c71f474891131..4ce80bc36a080 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -55,7 +55,7 @@ impl serialize::Encoder for Encoder { type Error = !; #[inline] - fn emit_nil(&mut self) -> EncodeResult { + fn emit_unit(&mut self) -> EncodeResult { Ok(()) } diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index 416be50bfe9ea..f0b49c3d9bc8f 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -25,7 +25,7 @@ pub trait Encoder { type Error; // Primitive types: - fn emit_nil(&mut self) -> Result<(), Self::Error>; + fn emit_unit(&mut self) -> Result<(), Self::Error>; fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>; fn emit_u128(&mut self, v: u128) -> Result<(), Self::Error>; fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>; @@ -537,7 +537,7 @@ impl Decodable for char { impl Encodable for () { fn encode(&self, s: &mut S) -> Result<(), S::Error> { - s.emit_nil() + s.emit_unit() } } diff --git a/src/llvm b/src/llvm index 2a1cdeadd3ea8..7243155b1c3da 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 2a1cdeadd3ea8e1eba9cc681037b83f07332763b +Subproject commit 7243155b1c3da0a980c868a87adebf00e0b33989 diff --git a/src/stdsimd b/src/stdsimd index 05c2f61c384e2..1ea18a5cb431e 160000 --- a/src/stdsimd +++ b/src/stdsimd @@ -1 +1 @@ -Subproject commit 05c2f61c384e2097a3a4c648344114fc4ac983be +Subproject commit 1ea18a5cb431e24aa838b652ac305acc5e394d6b diff --git a/src/tools/cargo b/src/tools/cargo index 2fb77a49b43bf..af3f1cd29bc87 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 2fb77a49b43bf7266793c07a19a06749e6a8ad5a +Subproject commit af3f1cd29bc872b932a13083e531255aab233a7e diff --git a/src/tools/clippy b/src/tools/clippy index fdd830f52c082..e456241f18227 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit fdd830f52c082b83db0dac3e0066c0cf114050d2 +Subproject commit e456241f18227c7eb8d78a45daa66c756a9b65e7 diff --git a/src/tools/miri b/src/tools/miri index e6f1e15676c26..e0e1bd7ff778e 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit e6f1e15676c26fdc7c4713647fe007b26f361a8e +Subproject commit e0e1bd7ff778e5913b566c9e03224faecc0eb486 diff --git a/src/tools/rls b/src/tools/rls index 5b5cd9d457194..1263f1ff25bb3 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 5b5cd9d45719414196e254ec17baa598acc8cd25 +Subproject commit 1263f1ff25bb329b76f74715ad4a7ec0d1f71430 diff --git a/src/tools/rust-installer b/src/tools/rust-installer index 27dec6cae3a81..118e078c5badd 160000 --- a/src/tools/rust-installer +++ b/src/tools/rust-installer @@ -1 +1 @@ -Subproject commit 27dec6cae3a8132d8a073aad6775425c85095c99 +Subproject commit 118e078c5badd520d18b92813fd88789c8d341ab diff --git a/src/tools/rustfmt b/src/tools/rustfmt index 1c408818c8a75..0f8029f251b56 160000 --- a/src/tools/rustfmt +++ b/src/tools/rustfmt @@ -1 +1 @@ -Subproject commit 1c408818c8a752dd584e7858b4afd3ceb011a7da +Subproject commit 0f8029f251b569a010cb5cfc5a8bff8bf3c949ac From 37d0600c23ba1890346078bd7f310e15915417b2 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 10 Sep 2018 10:36:07 +0900 Subject: [PATCH 02/13] renamed read_nil to read_unit --- src/librustc/ty/codec.rs | 2 +- src/libserialize/json.rs | 2 +- src/libserialize/opaque.rs | 2 +- src/libserialize/serialize.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index cc3e8a458a01f..051cca49f7e25 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -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; diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 9439dc78d3ca4..bbb3b73f2fa1d 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2128,7 +2128,7 @@ macro_rules! read_primitive { impl ::Decoder for Decoder { type Error = DecoderError; - fn read_nil(&mut self) -> DecodeResult<()> { + fn read_unit(&mut self) -> DecodeResult<()> { expect!(self.pop(), Null) } diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index 4ce80bc36a080..fee5e59cc4013 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -228,7 +228,7 @@ impl<'a> serialize::Decoder for Decoder<'a> { type Error = String; #[inline] - fn read_nil(&mut self) -> Result<(), Self::Error> { + fn read_unit(&mut self) -> Result<(), Self::Error> { Ok(()) } diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index f0b49c3d9bc8f..64d6dbecea651 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -167,7 +167,7 @@ pub trait Decoder { type Error; // Primitive types: - fn read_nil(&mut self) -> Result<(), Self::Error>; + fn read_unit(&mut self) -> Result<(), Self::Error>; fn read_usize(&mut self) -> Result; fn read_u128(&mut self) -> Result; fn read_u64(&mut self) -> Result; @@ -543,7 +543,7 @@ impl Encodable for () { impl Decodable for () { fn decode(d: &mut D) -> Result<(), D::Error> { - d.read_nil() + d.read_unit() } } From 6f685ffad42a2d12dd1fad5ccb0471e7fa260826 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 10 Sep 2018 10:45:16 +0900 Subject: [PATCH 03/13] renamed is_nil to is_unit --- src/librustc/ty/sty.rs | 2 +- src/librustc/util/ppaux.rs | 2 +- src/librustc_codegen_llvm/debuginfo/type_names.rs | 2 +- src/librustc_codegen_llvm/mir/rvalue.rs | 4 ++-- src/librustc_lint/types.rs | 4 ++-- src/librustc_mir/build/block.rs | 2 +- src/librustc_mir/monomorphize/item.rs | 2 +- src/librustc_typeck/check/_match.rs | 4 ++-- src/librustc_typeck/check/coercion.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 10 +++++----- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 962b115f1877a..ea547c592d048 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -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, diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index ddcc0fa9c9280..3d7117dd46a21 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -234,7 +234,7 @@ impl PrintContext { } } write!(f, ")")?; - if !output.is_nil() { + if !output.is_unit() { print!(f, self, write(" -> "), print_display(output))?; } diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index 95a094bf909e1..f9eb80a1988af 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -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); } diff --git a/src/librustc_codegen_llvm/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs index e301e5ae70be8..c3ec347f60876 100644 --- a/src/librustc_codegen_llvm/mir/rvalue.rs +++ b/src/librustc_codegen_llvm/mir/rvalue.rs @@ -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) @@ -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, diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 33181bd80e937..2bec9203e9ee5 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -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 => {} @@ -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); } } diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index c3637a5abebdc..50d4944d7c242 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -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); diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index dc437ee8510d7..3f5a05f9d0ed8 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -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); } diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 2a8ee4bd8df0e..a712bce2a4c4b 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -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 { diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 763adb007c3a4..4b09e91bdd75f 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -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| { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 9ab269702db1c..9638b6ca6ab2d 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2808,9 +2808,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { // is the missing argument of type `()`? let sugg_unit = if expected_arg_tys.len() == 1 && supplied_arg_count == 0 { - self.resolve_type_vars_if_possible(&expected_arg_tys[0]).is_nil() + self.resolve_type_vars_if_possible(&expected_arg_tys[0]).is_unit() } else if fn_inputs.len() == 1 && supplied_arg_count == 0 { - self.resolve_type_vars_if_possible(&fn_inputs[0]).is_nil() + self.resolve_type_vars_if_possible(&fn_inputs[0]).is_unit() } else { false }; @@ -3958,7 +3958,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(ref e) = *expr_opt { coerce.coerce(self, &cause, e, e_ty); } else { - assert!(e_ty.is_nil()); + assert!(e_ty.is_unit()); coerce.coerce_forced_unit(self, &cause, &mut |_| (), true); } } else { @@ -4752,7 +4752,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expression: &'gcx hir::Expr, expected: Ty<'tcx>, cause_span: Span) { - if expected.is_nil() { + if expected.is_unit() { // `BlockTailExpression` only relevant if the tail expr would be // useful on its own. match expression.node { @@ -4795,7 +4795,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { can_suggest: bool) { // Only suggest changing the return type for methods that // haven't set a return type at all (and aren't `fn main()` or an impl). - match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_nil()) { + match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_unit()) { (&hir::FunctionRetTy::DefaultReturn(span), true, true, true) => { err.span_suggestion_with_applicability( span, From 5c3ba4aa4f0fdd5ca3897d81a324cd1b4c9415e2 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 10 Sep 2018 11:07:13 +0900 Subject: [PATCH 04/13] renamed mk_nil to mk_unit --- src/librustc/traits/error_reporting.rs | 2 +- src/librustc/ty/context.rs | 4 ++-- src/librustc/ty/layout.rs | 4 ++-- src/librustc_codegen_llvm/intrinsic.rs | 2 +- src/librustc_driver/test.rs | 2 +- src/librustc_mir/hair/cx/mod.rs | 2 +- src/librustc_mir/interpret/terminator.rs | 2 +- src/librustc_mir/transform/generator.rs | 4 ++-- src/librustc_mir/util/elaborate_drops.rs | 4 ++-- src/librustc_typeck/astconv.rs | 2 +- src/librustc_typeck/check/_match.rs | 2 +- src/librustc_typeck/check/coercion.rs | 2 +- src/librustc_typeck/check/intrinsic.rs | 28 ++++++++++++------------ src/librustc_typeck/check/mod.rs | 16 +++++++------- src/librustc_typeck/check/op.rs | 2 +- src/librustc_typeck/lib.rs | 2 +- 16 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index a7c697c1cbafd..466d472cca338 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -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 diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index eb6f7140a7db7..ddaa0444cc7f6 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -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(&[]) } diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 17d613a2b181a..a3316c2b8e2e4 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -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 { diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 5d00e0807991e..5ec934ebd0667 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -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 diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 57c00f252ef16..ff35371976aa4 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -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> { diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index b4257a40e38af..4d4a89fca8b83 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -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> { diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index de86810627409..7ce96b1f62626 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -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( diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index dcbf92b57b13a..1ad713b4b7de6 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -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, diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 1c0c98d621c83..50bdc14d50995 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -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); diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index eaf1d03de7d0f..72502cda6e02d 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -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); diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index a712bce2a4c4b..9913b8de7a742 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -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) diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 4b09e91bdd75f..9604eb3420fb3 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -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) } diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index c7db3debf5a0d..8215ae211c0b9 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -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)), diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 9638b6ca6ab2d..3d66beaf2ecab 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -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 diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index edfa62f109538..5004880ce47b8 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -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 }; diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index f465ff4d62163..13ea2fdd89d05 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -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( From 2be5c722dedf50a95479bad0b4558e5e76a73a00 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 10 Sep 2018 11:09:54 +0900 Subject: [PATCH 05/13] renamed mk_nil_ptr to mk_unit_ptr --- src/librustc/ty/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index ddaa0444cc7f6..d0a569f5256bc 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2491,7 +2491,7 @@ 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> { + pub fn mk_unit_ptr(self) -> Ty<'tcx> { self.mk_imm_ptr(self.mk_unit()) } From 69deed9dc17cfd1c3e02d9e662ebc164885321a6 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Mon, 10 Sep 2018 11:21:30 +0900 Subject: [PATCH 06/13] renamed t_nil to t_unit --- src/librustc_driver/test.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index ff35371976aa4..086d2a15c8cf2 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -308,7 +308,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { ))) } - pub fn t_nil(&self) -> Ty<'tcx> { + pub fn t_unit(&self) -> Ty<'tcx> { self.infcx.tcx.mk_unit() } @@ -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()]); @@ -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={:?}", @@ -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()]); @@ -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={:?}", @@ -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()); @@ -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()); }) } @@ -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()]); @@ -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={:?}", From 8c53150b1878647ecabbb70c8432c8d1a0ad7703 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 11 Sep 2018 22:16:04 +0900 Subject: [PATCH 07/13] Revert "renamed t_nil to t_unit" This reverts commit 69deed9dc17cfd1c3e02d9e662ebc164885321a6. --- src/librustc_driver/test.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs index 086d2a15c8cf2..ff35371976aa4 100644 --- a/src/librustc_driver/test.rs +++ b/src/librustc_driver/test.rs @@ -308,7 +308,7 @@ impl<'a, 'gcx, 'tcx> Env<'a, 'gcx, 'tcx> { ))) } - pub fn t_unit(&self) -> Ty<'tcx> { + pub fn t_nil(&self) -> Ty<'tcx> { self.infcx.tcx.mk_unit() } @@ -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_unit()) + env.t_fn(&[t_param], env.t_nil()) }; let substs = env.infcx.tcx.intern_substs(&[t_rptr_bound1.into()]); @@ -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_unit()) + env.t_fn(&[t_ptr_bound2], env.t_nil()) }; debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}", @@ -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_unit())) + env.t_pair(t_param, env.t_fn(&[t_param], env.t_nil())) }; let substs = env.infcx.tcx.intern_substs(&[t_rptr_bound1.into()]); @@ -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_unit())) + env.t_pair(t_rptr_bound1, env.t_fn(&[t_rptr_bound2], env.t_nil())) }; debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}", @@ -559,7 +559,7 @@ fn escaping() { // Theta = [A -> &'a foo] env.create_simple_region_hierarchy(); - assert!(!env.t_unit().has_escaping_regions()); + assert!(!env.t_nil().has_escaping_regions()); let t_rptr_free1 = env.t_rptr_free(1); assert!(!t_rptr_free1.has_escaping_regions()); @@ -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_unit()); + let t_fn = env.t_fn(&[t_param], env.t_nil()); assert!(!t_fn.has_escaping_regions()); }) } @@ -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_unit()) + env.t_fn(&[env.t_rptr(re_early)], env.t_nil()) }; let substs = env.infcx.tcx.intern_substs(&[re_bound1.into()]); @@ -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_unit()) + env.t_fn(&[t_rptr_bound2], env.t_nil()) }; debug!("subst_bound: t_source={:?} substs={:?} t_substituted={:?} t_expected={:?}", From d7ebc20e7783133310a65a1555465292fd5cd84e Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 11 Sep 2018 22:17:43 +0900 Subject: [PATCH 08/13] Revert "renamed mk_nil_ptr to mk_unit_ptr" This reverts commit 2be5c722dedf50a95479bad0b4558e5e76a73a00. --- src/librustc/ty/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index d0a569f5256bc..ddaa0444cc7f6 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2491,7 +2491,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_ptr(TypeAndMut {ty: ty, mutbl: hir::MutImmutable}) } - pub fn mk_unit_ptr(self) -> Ty<'tcx> { + pub fn mk_nil_ptr(self) -> Ty<'tcx> { self.mk_imm_ptr(self.mk_unit()) } From 10b2083a6d3de2dad2a41639bfe5a90c4d87bf31 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 11 Sep 2018 22:18:49 +0900 Subject: [PATCH 09/13] Revert "renamed is_nil to is_unit" This reverts commit 6f685ffad42a2d12dd1fad5ccb0471e7fa260826. --- src/librustc/ty/sty.rs | 2 +- src/librustc/util/ppaux.rs | 2 +- src/librustc_codegen_llvm/debuginfo/type_names.rs | 2 +- src/librustc_codegen_llvm/mir/rvalue.rs | 4 ++-- src/librustc_lint/types.rs | 4 ++-- src/librustc_mir/build/block.rs | 2 +- src/librustc_mir/monomorphize/item.rs | 2 +- src/librustc_typeck/check/_match.rs | 4 ++-- src/librustc_typeck/check/coercion.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 10 +++++----- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index ea547c592d048..962b115f1877a 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1458,7 +1458,7 @@ impl RegionKind { /// Type utilities impl<'a, 'gcx, 'tcx> TyS<'tcx> { - pub fn is_unit(&self) -> bool { + pub fn is_nil(&self) -> bool { match self.sty { Tuple(ref tys) => tys.is_empty(), _ => false, diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 3d7117dd46a21..ddcc0fa9c9280 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -234,7 +234,7 @@ impl PrintContext { } } write!(f, ")")?; - if !output.is_unit() { + if !output.is_nil() { print!(f, self, write(" -> "), print_display(output))?; } diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index f9eb80a1988af..95a094bf909e1 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -160,7 +160,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, output.push(')'); - if !sig.output().is_unit() { + if !sig.output().is_nil() { output.push_str(" -> "); push_debuginfo_type_name(cx, sig.output(), true, output); } diff --git a/src/librustc_codegen_llvm/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs index c3ec347f60876..e301e5ae70be8 100644 --- a/src/librustc_codegen_llvm/mir/rvalue.rs +++ b/src/librustc_codegen_llvm/mir/rvalue.rs @@ -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_unit = input_ty.is_unit(); + let is_nil = input_ty.is_nil(); match op { mir::BinOp::Add => if is_float { bx.fadd(lhs, rhs) @@ -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_unit { + mir::BinOp::Eq | mir::BinOp::Le | mir::BinOp::Ge => if is_nil { 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, diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 2bec9203e9ee5..33181bd80e937 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -691,7 +691,7 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { } let sig = cx.erase_late_bound_regions(&sig); - if !sig.output().is_unit() { + if !sig.output().is_nil() { let r = self.check_type_for_ffi(cache, sig.output()); match r { FfiSafe => {} @@ -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_unit() { + if !ret_ty.is_nil() { self.check_type_for_ffi_and_report_errors(ret_hir.span, ret_ty); } } diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index 50d4944d7c242..c3637a5abebdc 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -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_unit() { + if ty.is_nil() { // 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); diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index 3f5a05f9d0ed8..dc437ee8510d7 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -368,7 +368,7 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { output.push(')'); - if !sig.output().is_unit() { + if !sig.output().is_nil() { output.push_str(" -> "); self.push_type_name(sig.output(), output); } diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 9913b8de7a742..60da6e1d72a88 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -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_unit() + i == arms.len() - 1 && arm_ty.is_nil() } _ => false }; if is_if_let_fallback { let cause = self.cause(expr.span, ObligationCauseCode::IfExpressionWithNoElse); - assert!(arm_ty.is_unit()); + assert!(arm_ty.is_nil()); coercion.coerce_forced_unit(self, &cause, &mut |_| (), true); } else { let cause = self.cause(expr.span, ObligationCauseCode::MatchExpressionArm { diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 9604eb3420fb3..47c3cf4dfa001 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -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_unit()); - assert!(expression_ty.is_unit(), "if let hack without unit type"); + assert!(expression_ty.is_nil()); + assert!(expression_ty.is_nil(), "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| { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 3d66beaf2ecab..f884a3513d121 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2808,9 +2808,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { // is the missing argument of type `()`? let sugg_unit = if expected_arg_tys.len() == 1 && supplied_arg_count == 0 { - self.resolve_type_vars_if_possible(&expected_arg_tys[0]).is_unit() + self.resolve_type_vars_if_possible(&expected_arg_tys[0]).is_nil() } else if fn_inputs.len() == 1 && supplied_arg_count == 0 { - self.resolve_type_vars_if_possible(&fn_inputs[0]).is_unit() + self.resolve_type_vars_if_possible(&fn_inputs[0]).is_nil() } else { false }; @@ -3958,7 +3958,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(ref e) = *expr_opt { coerce.coerce(self, &cause, e, e_ty); } else { - assert!(e_ty.is_unit()); + assert!(e_ty.is_nil()); coerce.coerce_forced_unit(self, &cause, &mut |_| (), true); } } else { @@ -4752,7 +4752,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expression: &'gcx hir::Expr, expected: Ty<'tcx>, cause_span: Span) { - if expected.is_unit() { + if expected.is_nil() { // `BlockTailExpression` only relevant if the tail expr would be // useful on its own. match expression.node { @@ -4795,7 +4795,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { can_suggest: bool) { // Only suggest changing the return type for methods that // haven't set a return type at all (and aren't `fn main()` or an impl). - match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_unit()) { + match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_nil()) { (&hir::FunctionRetTy::DefaultReturn(span), true, true, true) => { err.span_suggestion_with_applicability( span, From fa683ac6563a844327de5e23d2a17bcfb5c328cd Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 11 Sep 2018 22:20:09 +0900 Subject: [PATCH 10/13] Revert "renamed read_nil to read_unit" This reverts commit 37d0600c23ba1890346078bd7f310e15915417b2. --- src/librustc/ty/codec.rs | 2 +- src/libserialize/json.rs | 2 +- src/libserialize/opaque.rs | 2 +- src/libserialize/serialize.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index 051cca49f7e25..cc3e8a458a01f 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -298,7 +298,7 @@ macro_rules! implement_ty_decoder { type Error = String; __impl_decoder_methods! { - read_unit -> (); + read_nil -> (); read_u128 -> u128; read_u64 -> u64; diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index bbb3b73f2fa1d..9439dc78d3ca4 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -2128,7 +2128,7 @@ macro_rules! read_primitive { impl ::Decoder for Decoder { type Error = DecoderError; - fn read_unit(&mut self) -> DecodeResult<()> { + fn read_nil(&mut self) -> DecodeResult<()> { expect!(self.pop(), Null) } diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index fee5e59cc4013..4ce80bc36a080 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -228,7 +228,7 @@ impl<'a> serialize::Decoder for Decoder<'a> { type Error = String; #[inline] - fn read_unit(&mut self) -> Result<(), Self::Error> { + fn read_nil(&mut self) -> Result<(), Self::Error> { Ok(()) } diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index 64d6dbecea651..f0b49c3d9bc8f 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -167,7 +167,7 @@ pub trait Decoder { type Error; // Primitive types: - fn read_unit(&mut self) -> Result<(), Self::Error>; + fn read_nil(&mut self) -> Result<(), Self::Error>; fn read_usize(&mut self) -> Result; fn read_u128(&mut self) -> Result; fn read_u64(&mut self) -> Result; @@ -543,7 +543,7 @@ impl Encodable for () { impl Decodable for () { fn decode(d: &mut D) -> Result<(), D::Error> { - d.read_unit() + d.read_nil() } } From 7f8160409f5bb4490720df21e2c4fbf1a647bae2 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 11 Sep 2018 22:20:22 +0900 Subject: [PATCH 11/13] Revert "renamed emit_nil to emit_unit" This reverts commit d02a5ffaed9c395ae62ee12d0f4e04946c62edb1. --- src/doc/book | 2 +- src/doc/nomicon | 2 +- src/doc/reference | 2 +- src/doc/rust-by-example | 2 +- src/libcompiler_builtins | 2 +- src/liblibc | 2 +- src/librustc/ty/query/on_disk_cache.rs | 2 +- src/librustc_metadata/encoder.rs | 2 +- src/libserialize/json.rs | 10 +++++----- src/libserialize/opaque.rs | 2 +- src/libserialize/serialize.rs | 4 ++-- src/llvm | 2 +- src/stdsimd | 2 +- src/tools/cargo | 2 +- src/tools/clippy | 2 +- src/tools/miri | 2 +- src/tools/rls | 2 +- src/tools/rust-installer | 2 +- src/tools/rustfmt | 2 +- 19 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/doc/book b/src/doc/book index f51127530d46b..cff0930664b68 160000 --- a/src/doc/book +++ b/src/doc/book @@ -1 +1 @@ -Subproject commit f51127530d46b9acbf4747c859da185e771cfcf3 +Subproject commit cff0930664b688f1dd22aefb3d16944eb4cdbfd5 diff --git a/src/doc/nomicon b/src/doc/nomicon index 748a5e6742db4..7fd493465b7dd 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit 748a5e6742db4a21c4c630a58087f818828e8a0a +Subproject commit 7fd493465b7dd6cf3476f0b834884059bbdd1d93 diff --git a/src/doc/reference b/src/doc/reference index 134f419ee6271..821355a6fd642 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 134f419ee62714590b04712fe6072253bc2a7822 +Subproject commit 821355a6fd642b71988a2f88a3162fb358732012 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index eebda16e4b45f..e459fb3f07f2b 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit eebda16e4b45f2eed4310cf7b9872cc752278163 +Subproject commit e459fb3f07f2b930ccd25d348671b8eae233fd64 diff --git a/src/libcompiler_builtins b/src/libcompiler_builtins index 2a2f6d96c8dc5..0703bfa72524e 160000 --- a/src/libcompiler_builtins +++ b/src/libcompiler_builtins @@ -1 +1 @@ -Subproject commit 2a2f6d96c8dc578d2474742f14c9bab0b36b0408 +Subproject commit 0703bfa72524e01e414477657ca9b64794c5c1c3 diff --git a/src/liblibc b/src/liblibc index a7e78a78e17c8..1844a772b6077 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit a7e78a78e17c8776d7780008ccb3ce541ec64ae9 +Subproject commit 1844a772b60771d0124a157019f627d60fea4e73 diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 19e235154cbd0..6e16d92ba0c8d 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -1020,7 +1020,7 @@ impl<'enc, 'a, 'tcx, E> Encoder for CacheEncoder<'enc, 'a, 'tcx, E> { type Error = E::Error; - fn emit_unit(&mut self) -> Result<(), Self::Error> { + fn emit_nil(&mut self) -> Result<(), Self::Error> { Ok(()) } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 56b38cfbc872a..aae45c17c6771 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -75,7 +75,7 @@ macro_rules! encoder_methods { impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> { type Error = ::Error; - fn emit_unit(&mut self) -> Result<(), Self::Error> { + fn emit_nil(&mut self) -> Result<(), Self::Error> { Ok(()) } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 9439dc78d3ca4..35ef6327de5fd 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -490,7 +490,7 @@ macro_rules! emit_enquoted_if_mapkey { impl<'a> ::Encoder for Encoder<'a> { type Error = EncoderError; - fn emit_unit(&mut self) -> EncodeResult { + fn emit_nil(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } write!(self.writer, "null")?; Ok(()) @@ -648,7 +648,7 @@ impl<'a> ::Encoder for Encoder<'a> { } fn emit_option_none(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } - self.emit_unit() + self.emit_nil() } fn emit_option_some(&mut self, f: F) -> EncodeResult where F: FnOnce(&mut Encoder<'a>) -> EncodeResult, @@ -740,7 +740,7 @@ impl<'a> PrettyEncoder<'a> { impl<'a> ::Encoder for PrettyEncoder<'a> { type Error = EncoderError; - fn emit_unit(&mut self) -> EncodeResult { + fn emit_nil(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } write!(self.writer, "null")?; Ok(()) @@ -923,7 +923,7 @@ impl<'a> ::Encoder for PrettyEncoder<'a> { } fn emit_option_none(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } - self.emit_unit() + self.emit_nil() } fn emit_option_some(&mut self, f: F) -> EncodeResult where F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult, @@ -1016,7 +1016,7 @@ impl Encodable for Json { Json::Boolean(v) => v.encode(e), Json::Array(ref v) => v.encode(e), Json::Object(ref v) => v.encode(e), - Json::Null => e.emit_unit(), + Json::Null => e.emit_nil(), } } } diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index 4ce80bc36a080..c71f474891131 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -55,7 +55,7 @@ impl serialize::Encoder for Encoder { type Error = !; #[inline] - fn emit_unit(&mut self) -> EncodeResult { + fn emit_nil(&mut self) -> EncodeResult { Ok(()) } diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index f0b49c3d9bc8f..416be50bfe9ea 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -25,7 +25,7 @@ pub trait Encoder { type Error; // Primitive types: - fn emit_unit(&mut self) -> Result<(), Self::Error>; + fn emit_nil(&mut self) -> Result<(), Self::Error>; fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>; fn emit_u128(&mut self, v: u128) -> Result<(), Self::Error>; fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>; @@ -537,7 +537,7 @@ impl Decodable for char { impl Encodable for () { fn encode(&self, s: &mut S) -> Result<(), S::Error> { - s.emit_unit() + s.emit_nil() } } diff --git a/src/llvm b/src/llvm index 7243155b1c3da..2a1cdeadd3ea8 160000 --- a/src/llvm +++ b/src/llvm @@ -1 +1 @@ -Subproject commit 7243155b1c3da0a980c868a87adebf00e0b33989 +Subproject commit 2a1cdeadd3ea8e1eba9cc681037b83f07332763b diff --git a/src/stdsimd b/src/stdsimd index 1ea18a5cb431e..05c2f61c384e2 160000 --- a/src/stdsimd +++ b/src/stdsimd @@ -1 +1 @@ -Subproject commit 1ea18a5cb431e24aa838b652ac305acc5e394d6b +Subproject commit 05c2f61c384e2097a3a4c648344114fc4ac983be diff --git a/src/tools/cargo b/src/tools/cargo index af3f1cd29bc87..2fb77a49b43bf 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit af3f1cd29bc872b932a13083e531255aab233a7e +Subproject commit 2fb77a49b43bf7266793c07a19a06749e6a8ad5a diff --git a/src/tools/clippy b/src/tools/clippy index e456241f18227..fdd830f52c082 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit e456241f18227c7eb8d78a45daa66c756a9b65e7 +Subproject commit fdd830f52c082b83db0dac3e0066c0cf114050d2 diff --git a/src/tools/miri b/src/tools/miri index e0e1bd7ff778e..e6f1e15676c26 160000 --- a/src/tools/miri +++ b/src/tools/miri @@ -1 +1 @@ -Subproject commit e0e1bd7ff778e5913b566c9e03224faecc0eb486 +Subproject commit e6f1e15676c26fdc7c4713647fe007b26f361a8e diff --git a/src/tools/rls b/src/tools/rls index 1263f1ff25bb3..5b5cd9d457194 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 1263f1ff25bb329b76f74715ad4a7ec0d1f71430 +Subproject commit 5b5cd9d45719414196e254ec17baa598acc8cd25 diff --git a/src/tools/rust-installer b/src/tools/rust-installer index 118e078c5badd..27dec6cae3a81 160000 --- a/src/tools/rust-installer +++ b/src/tools/rust-installer @@ -1 +1 @@ -Subproject commit 118e078c5badd520d18b92813fd88789c8d341ab +Subproject commit 27dec6cae3a8132d8a073aad6775425c85095c99 diff --git a/src/tools/rustfmt b/src/tools/rustfmt index 0f8029f251b56..1c408818c8a75 160000 --- a/src/tools/rustfmt +++ b/src/tools/rustfmt @@ -1 +1 @@ -Subproject commit 0f8029f251b569a010cb5cfc5a8bff8bf3c949ac +Subproject commit 1c408818c8a752dd584e7858b4afd3ceb011a7da From a0e7b6bf6b96e54051aeeede43378b925e2e5201 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 11 Sep 2018 23:17:35 +0900 Subject: [PATCH 12/13] renamed is_nil to is_unit --- src/librustc/ty/sty.rs | 2 +- src/librustc/util/ppaux.rs | 2 +- src/librustc_codegen_llvm/debuginfo/type_names.rs | 2 +- src/librustc_codegen_llvm/mir/rvalue.rs | 4 ++-- src/librustc_lint/types.rs | 4 ++-- src/librustc_mir/build/block.rs | 2 +- src/librustc_mir/monomorphize/item.rs | 2 +- src/librustc_typeck/check/_match.rs | 4 ++-- src/librustc_typeck/check/coercion.rs | 4 ++-- src/librustc_typeck/check/mod.rs | 10 +++++----- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 962b115f1877a..ea547c592d048 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -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, diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index ddcc0fa9c9280..3d7117dd46a21 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -234,7 +234,7 @@ impl PrintContext { } } write!(f, ")")?; - if !output.is_nil() { + if !output.is_unit() { print!(f, self, write(" -> "), print_display(output))?; } diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index 95a094bf909e1..f9eb80a1988af 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -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); } diff --git a/src/librustc_codegen_llvm/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs index e301e5ae70be8..c3ec347f60876 100644 --- a/src/librustc_codegen_llvm/mir/rvalue.rs +++ b/src/librustc_codegen_llvm/mir/rvalue.rs @@ -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) @@ -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, diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 33181bd80e937..2bec9203e9ee5 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -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 => {} @@ -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); } } diff --git a/src/librustc_mir/build/block.rs b/src/librustc_mir/build/block.rs index c3637a5abebdc..50d4944d7c242 100644 --- a/src/librustc_mir/build/block.rs +++ b/src/librustc_mir/build/block.rs @@ -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); diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index dc437ee8510d7..3f5a05f9d0ed8 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -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); } diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index 60da6e1d72a88..9913b8de7a742 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -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 { diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 47c3cf4dfa001..9604eb3420fb3 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -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| { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index f884a3513d121..3d66beaf2ecab 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -2808,9 +2808,9 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } else { // is the missing argument of type `()`? let sugg_unit = if expected_arg_tys.len() == 1 && supplied_arg_count == 0 { - self.resolve_type_vars_if_possible(&expected_arg_tys[0]).is_nil() + self.resolve_type_vars_if_possible(&expected_arg_tys[0]).is_unit() } else if fn_inputs.len() == 1 && supplied_arg_count == 0 { - self.resolve_type_vars_if_possible(&fn_inputs[0]).is_nil() + self.resolve_type_vars_if_possible(&fn_inputs[0]).is_unit() } else { false }; @@ -3958,7 +3958,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if let Some(ref e) = *expr_opt { coerce.coerce(self, &cause, e, e_ty); } else { - assert!(e_ty.is_nil()); + assert!(e_ty.is_unit()); coerce.coerce_forced_unit(self, &cause, &mut |_| (), true); } } else { @@ -4752,7 +4752,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expression: &'gcx hir::Expr, expected: Ty<'tcx>, cause_span: Span) { - if expected.is_nil() { + if expected.is_unit() { // `BlockTailExpression` only relevant if the tail expr would be // useful on its own. match expression.node { @@ -4795,7 +4795,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { can_suggest: bool) { // Only suggest changing the return type for methods that // haven't set a return type at all (and aren't `fn main()` or an impl). - match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_nil()) { + match (&fn_decl.output, found.is_suggestable(), can_suggest, expected.is_unit()) { (&hir::FunctionRetTy::DefaultReturn(span), true, true, true) => { err.span_suggestion_with_applicability( span, From 8134ee25b88df98c79792d60cbf6745b6cb7ffc5 Mon Sep 17 00:00:00 2001 From: kenta7777 Date: Tue, 11 Sep 2018 23:32:41 +0900 Subject: [PATCH 13/13] renamed emit_nil to emit_unit --- src/librustc/ty/query/on_disk_cache.rs | 2 +- src/librustc_metadata/encoder.rs | 2 +- src/libserialize/json.rs | 10 +++++----- src/libserialize/opaque.rs | 2 +- src/libserialize/serialize.rs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 6e16d92ba0c8d..19e235154cbd0 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -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(()) } diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index aae45c17c6771..56b38cfbc872a 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -75,7 +75,7 @@ macro_rules! encoder_methods { impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> { type Error = ::Error; - fn emit_nil(&mut self) -> Result<(), Self::Error> { + fn emit_unit(&mut self) -> Result<(), Self::Error> { Ok(()) } diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index 35ef6327de5fd..9439dc78d3ca4 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -490,7 +490,7 @@ macro_rules! emit_enquoted_if_mapkey { impl<'a> ::Encoder for Encoder<'a> { type Error = EncoderError; - fn emit_nil(&mut self) -> EncodeResult { + fn emit_unit(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } write!(self.writer, "null")?; Ok(()) @@ -648,7 +648,7 @@ impl<'a> ::Encoder for Encoder<'a> { } fn emit_option_none(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } - self.emit_nil() + self.emit_unit() } fn emit_option_some(&mut self, f: F) -> EncodeResult where F: FnOnce(&mut Encoder<'a>) -> EncodeResult, @@ -740,7 +740,7 @@ impl<'a> PrettyEncoder<'a> { impl<'a> ::Encoder for PrettyEncoder<'a> { type Error = EncoderError; - fn emit_nil(&mut self) -> EncodeResult { + fn emit_unit(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } write!(self.writer, "null")?; Ok(()) @@ -923,7 +923,7 @@ impl<'a> ::Encoder for PrettyEncoder<'a> { } fn emit_option_none(&mut self) -> EncodeResult { if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); } - self.emit_nil() + self.emit_unit() } fn emit_option_some(&mut self, f: F) -> EncodeResult where F: FnOnce(&mut PrettyEncoder<'a>) -> EncodeResult, @@ -1016,7 +1016,7 @@ impl Encodable for Json { Json::Boolean(v) => v.encode(e), Json::Array(ref v) => v.encode(e), Json::Object(ref v) => v.encode(e), - Json::Null => e.emit_nil(), + Json::Null => e.emit_unit(), } } } diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index c71f474891131..4ce80bc36a080 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -55,7 +55,7 @@ impl serialize::Encoder for Encoder { type Error = !; #[inline] - fn emit_nil(&mut self) -> EncodeResult { + fn emit_unit(&mut self) -> EncodeResult { Ok(()) } diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs index 416be50bfe9ea..f0b49c3d9bc8f 100644 --- a/src/libserialize/serialize.rs +++ b/src/libserialize/serialize.rs @@ -25,7 +25,7 @@ pub trait Encoder { type Error; // Primitive types: - fn emit_nil(&mut self) -> Result<(), Self::Error>; + fn emit_unit(&mut self) -> Result<(), Self::Error>; fn emit_usize(&mut self, v: usize) -> Result<(), Self::Error>; fn emit_u128(&mut self, v: u128) -> Result<(), Self::Error>; fn emit_u64(&mut self, v: u64) -> Result<(), Self::Error>; @@ -537,7 +537,7 @@ impl Decodable for char { impl Encodable for () { fn encode(&self, s: &mut S) -> Result<(), S::Error> { - s.emit_nil() + s.emit_unit() } }