From 97519bd2023398c32fa7f966dd9f5356aa6008e9 Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 9 Jun 2022 04:59:05 +0200 Subject: [PATCH 01/10] Grammar fix in the compile_error documentation --- library/core/src/macros/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index dbc3d2923ed5..673a39c298f7 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -795,7 +795,7 @@ pub(crate) mod builtin { /// /// Two such examples are macros and `#[cfg]` environments. /// - /// Emit better compiler error if a macro is passed invalid values. Without the final branch, + /// Emit a better compiler error if a macro is passed invalid values. Without the final branch, /// the compiler would still emit an error, but the error's message would not mention the two /// valid values. /// @@ -812,7 +812,7 @@ pub(crate) mod builtin { /// // ^ will fail at compile time with message "This macro only accepts `foo` or `bar`" /// ``` /// - /// Emit compiler error if one of a number of features isn't available. + /// Emit a compiler error if one of a number of features isn't available. /// /// ```compile_fail /// #[cfg(not(any(feature = "foo", feature = "bar")))] From 5e9e73cc9f9c3f8230af739ec4d234f4d99842b2 Mon Sep 17 00:00:00 2001 From: Warrenren <50134367+Warrenren@users.noreply.github.com> Date: Fri, 10 Jun 2022 19:08:03 +0800 Subject: [PATCH 02/10] line 1352, change self to (*self), other to (*other) The current code will not results bug, but it difficult to understand. These code result to call &f32::partial_cmp(), and the performance will be lower than the changed code. I'm not sure why the current code don't use (*self) (*other), if you have some idea, please let me know. --- library/core/src/cmp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index f281e8429c69..353dd74ba890 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -1349,7 +1349,7 @@ mod impls { impl PartialOrd for $t { #[inline] fn partial_cmp(&self, other: &$t) -> Option { - match (self <= other, self >= other) { + match ((*self) <= (*other), (*self) >= (*other)) { (false, false) => None, (false, true) => Some(Greater), (true, false) => Some(Less), From 6738434de3e4dacedeb330a5cf878e0a196be864 Mon Sep 17 00:00:00 2001 From: Bob Haarman Date: Fri, 10 Jun 2022 11:53:25 -0700 Subject: [PATCH 03/10] Make -Cpasses= only apply to pre-link optimization This change causes passes specified in -Cpasses= to be applied only during pre-link optimization, not during LTO. This avoids such passes running multiple times, which they may not be designed for. Fixes https://github.com/rust-lang/rust/issues/97713 --- compiler/rustc_codegen_llvm/src/back/write.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs index 99e30531c226..f456408ca3a4 100644 --- a/compiler/rustc_codegen_llvm/src/back/write.rs +++ b/compiler/rustc_codegen_llvm/src/back/write.rs @@ -467,7 +467,7 @@ pub(crate) unsafe fn optimize_with_new_llvm_pass_manager( let llvm_selfprofiler = llvm_profiler.as_mut().map(|s| s as *mut _ as *mut c_void).unwrap_or(std::ptr::null_mut()); - let extra_passes = config.passes.join(","); + let extra_passes = if !is_lto { config.passes.join(",") } else { "".to_string() }; let llvm_plugins = config.llvm_plugins.join(","); From 9e1e4761862a875562a87631466e96a8c1ebab83 Mon Sep 17 00:00:00 2001 From: Warrenren <50134367+Warrenren@users.noreply.github.com> Date: Sat, 11 Jun 2022 11:04:27 +0800 Subject: [PATCH 04/10] Update cmp.rs line 1352, delete parentheses for reviewers asking for it. --- library/core/src/cmp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 353dd74ba890..81aed8afd5b5 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -1349,7 +1349,7 @@ mod impls { impl PartialOrd for $t { #[inline] fn partial_cmp(&self, other: &$t) -> Option { - match ((*self) <= (*other), (*self) >= (*other)) { + match (*self <= *other, *self >= *other) { (false, false) => None, (false, true) => Some(Greater), (true, false) => Some(Less), From 64ac29bc1aaea197d08eaaeb9b014ca112ec29c5 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 11 Jun 2022 13:16:23 +0200 Subject: [PATCH 05/10] Add eslint rule "no-lonely-if" --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index 9088e06e5080..1cc5f12b3309 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -84,5 +84,6 @@ module.exports = { "no-implicit-globals": "error", "no-implied-eval": "error", "no-label-var": "error", + "no-lonely-if": "error", } }; From 4a874b0e594c4720f314e80a81e71e86a89ff61e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 11 Jun 2022 13:19:29 +0200 Subject: [PATCH 06/10] Add eslint rule "no-mixed-operator" --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index 1cc5f12b3309..26ca8213ab1c 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -85,5 +85,6 @@ module.exports = { "no-implied-eval": "error", "no-label-var": "error", "no-lonely-if": "error", + "no-mixed-operators": "error", } }; From e3d89dbcdb5cda8724535e9f2da980d8fdaa2b8b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 11 Jun 2022 13:19:51 +0200 Subject: [PATCH 07/10] Add eslint rule "no-multi-assign" --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index 26ca8213ab1c..a5175b1a4b46 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -86,5 +86,6 @@ module.exports = { "no-label-var": "error", "no-lonely-if": "error", "no-mixed-operators": "error", + "no-multi-assign": "error", } }; From fb728c66c625673c6e794d5f4a4e1bffaac4ac6b Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 11 Jun 2022 13:22:12 +0200 Subject: [PATCH 08/10] Add eslint rule "no-return-assign" --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index a5175b1a4b46..f3178a555cfb 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -87,5 +87,6 @@ module.exports = { "no-lonely-if": "error", "no-mixed-operators": "error", "no-multi-assign": "error", + "no-return-assign": "error", } }; From fb68e0bf9be3d5cef1e77fa7496f54160d899868 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 11 Jun 2022 13:23:08 +0200 Subject: [PATCH 09/10] Add eslint rule "no-script-url" --- src/librustdoc/html/static/.eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librustdoc/html/static/.eslintrc.js b/src/librustdoc/html/static/.eslintrc.js index f3178a555cfb..fc8b5678080c 100644 --- a/src/librustdoc/html/static/.eslintrc.js +++ b/src/librustdoc/html/static/.eslintrc.js @@ -88,5 +88,6 @@ module.exports = { "no-mixed-operators": "error", "no-multi-assign": "error", "no-return-assign": "error", + "no-script-url": "error", } }; From 3685a1e9d26e5591fde1a0e80240ad0145068f4c Mon Sep 17 00:00:00 2001 From: kyoto7250 <50972773+kyoto7250@users.noreply.github.com> Date: Sat, 11 Jun 2022 23:19:58 +0900 Subject: [PATCH 10/10] feat(fix): update some links --- compiler/rustc_hir/src/hir.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 2f5f271dc50e..9fce8fac56ff 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1885,7 +1885,7 @@ pub enum ExprKind<'hir> { /// To resolve the called method to a `DefId`, call [`type_dependent_def_id`] with /// the `hir_id` of the `MethodCall` node itself. /// - /// [`type_dependent_def_id`]: ../ty/struct.TypeckResults.html#method.type_dependent_def_id + /// [`type_dependent_def_id`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.type_dependent_def_id MethodCall(&'hir PathSegment<'hir>, &'hir [Expr<'hir>], Span), /// A tuple (e.g., `(a, b, c, d)`). Tup(&'hir [Expr<'hir>]), @@ -1982,7 +1982,7 @@ pub enum ExprKind<'hir> { /// /// To resolve the path to a `DefId`, call [`qpath_res`]. /// -/// [`qpath_res`]: ../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res +/// [`qpath_res`]: ../../rustc_middle/ty/struct.TypeckResults.html#method.qpath_res #[derive(Debug, HashStable_Generic)] pub enum QPath<'hir> { /// Path to a definition, optionally "fully-qualified" with a `Self`