From 9ede5b04d02e973e216be47a82992ec5cb58f7db Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 13 Apr 2020 18:37:06 -0700 Subject: [PATCH 1/5] Remove the last remnant of unsigned Neg It's been gone since #23945, before Rust 1.0. The former wrapping semantics have also been available as inherent methods for a long time now. There's no reason to keep this unused macro around. --- src/libcore/ops/arith.rs | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index e9ec81394e32d..622a138abe9d1 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -617,35 +617,22 @@ pub trait Neg { fn neg(self) -> Self::Output; } -macro_rules! neg_impl_core { - ($id:ident => $body:expr, $($t:ty)*) => ($( +macro_rules! neg_impl { + ($($t:ty)*) => ($( #[stable(feature = "rust1", since = "1.0.0")] impl Neg for $t { type Output = $t; #[inline] #[rustc_inherit_overflow_checks] - fn neg(self) -> $t { let $id = self; $body } + fn neg(self) -> $t { -self } } forward_ref_unop! { impl Neg, neg for $t } )*) } -macro_rules! neg_impl_numeric { - ($($t:ty)*) => { neg_impl_core!{ x => -x, $($t)*} } -} - -#[allow(unused_macros)] -macro_rules! neg_impl_unsigned { - ($($t:ty)*) => { - neg_impl_core!{ x => { - !x.wrapping_add(1) - }, $($t)*} } -} - -// neg_impl_unsigned! { usize u8 u16 u32 u64 } -neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 } +neg_impl! { isize i8 i16 i32 i64 i128 f32 f64 } /// The addition assignment operator `+=`. /// From eed4b219e2431ed3e14f82ddf73de31223fb94e5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 14 Apr 2020 13:26:17 +0200 Subject: [PATCH 2/5] Clean up E0517 explanation --- src/librustc_error_codes/error_codes/E0517.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0517.md b/src/librustc_error_codes/error_codes/E0517.md index f738d33560a02..ae802245bd1d7 100644 --- a/src/librustc_error_codes/error_codes/E0517.md +++ b/src/librustc_error_codes/error_codes/E0517.md @@ -1,5 +1,4 @@ -This error indicates that a `#[repr(..)]` attribute was placed on an -unsupported item. +A `#[repr(..)]` attribute was placed on an unsupported item. Examples of erroneous code: From 15ba31d010c3c4840b57d91ad9d5b0b2c746e315 Mon Sep 17 00:00:00 2001 From: AnthonyMikh Date: Tue, 14 Apr 2020 15:07:57 +0300 Subject: [PATCH 3/5] Fix broken link in documentation for String::from_utf8 --- src/liballoc/string.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 7c89d38caa4e6..708819f1e208b 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -482,6 +482,7 @@ impl String { /// [`String`]: struct.String.html /// [`u8`]: ../../std/primitive.u8.html /// [`Vec`]: ../../std/vec/struct.Vec.html + /// [`&str`]: ../../std/primitive.str.html /// [`str::from_utf8`]: ../../std/str/fn.from_utf8.html /// [`into_bytes`]: struct.String.html#method.into_bytes /// [`FromUtf8Error`]: struct.FromUtf8Error.html From 723def25c8cc978100ffb62cff522ae3734323c6 Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Tue, 14 Apr 2020 14:45:34 +0200 Subject: [PATCH 4/5] update docs --- src/librustc_typeck/check/method/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index 13fc3900e480c..c4f53332cb673 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -171,11 +171,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// /// Given a method call like `foo.bar::(...)`: /// - /// * `fcx`: the surrounding `FnCtxt` (!) - /// * `span`: the span for the method call - /// * `method_name`: the name of the method being called (`bar`) + /// * `self`: the surrounding `FnCtxt` (!) /// * `self_ty`: the (unadjusted) type of the self expression (`foo`) - /// * `supplied_method_types`: the explicit method type parameters, if any (`T1..Tn`) + /// * `segment`: the name and generic arguments of the method (`bar::`) + /// * `span`: the span for the method call + /// * `call_expr`: the complete method call: (`foo.bar::(...)`) /// * `self_expr`: the self expression (`foo`) pub fn lookup_method( &self, From de143312f8c7c137f09418878045a48331463d19 Mon Sep 17 00:00:00 2001 From: Youngsuk Kim Date: Tue, 14 Apr 2020 09:29:39 -0400 Subject: [PATCH 5/5] Add missing comma --- src/libstd/sys/windows/ext/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/sys/windows/ext/fs.rs b/src/libstd/sys/windows/ext/fs.rs index d508a333484ae..f85120d170f73 100644 --- a/src/libstd/sys/windows/ext/fs.rs +++ b/src/libstd/sys/windows/ext/fs.rs @@ -224,7 +224,7 @@ pub trait OpenOptionsExt { /// opening a named pipe, to control to which degree a server process can /// act on behalf of a client process (security impersonation level). /// - /// When `security_qos_flags` is not set a malicious program can gain the + /// When `security_qos_flags` is not set, a malicious program can gain the /// elevated privileges of a privileged Rust process when it allows opening /// user-specified paths, by tricking it into opening a named pipe. So /// arguably `security_qos_flags` should also be set when opening arbitrary