From 08e35155b42279c33b26512f5ce59734147de8b6 Mon Sep 17 00:00:00 2001 From: Caleb Cartwright Date: Fri, 4 Sep 2020 19:44:11 -0500 Subject: [PATCH 01/11] rustc_expand: remove pub visibility for rustfmt --- compiler/rustc_expand/src/module.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs index 1e123a2e14553..fefc0bdeb7cc2 100644 --- a/compiler/rustc_expand/src/module.rs +++ b/compiler/rustc_expand/src/module.rs @@ -219,8 +219,7 @@ fn error_cannot_declare_mod_here<'a, T>( /// Derive a submodule path from the first found `#[path = "path_string"]`. /// The provided `dir_path` is joined with the `path_string`. -// Public for rustfmt usage. -pub fn submod_path_from_attr( +pub(super) fn submod_path_from_attr( sess: &Session, attrs: &[Attribute], dir_path: &Path, From d80415a3bf0990efa9618273d30bb2c6d23b6f43 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sat, 5 Sep 2020 21:08:35 +0800 Subject: [PATCH 02/11] Improve ayu doc source line number contrast Improve contrast of foreground line number. --- src/librustdoc/html/static/themes/ayu.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/librustdoc/html/static/themes/ayu.css b/src/librustdoc/html/static/themes/ayu.css index b4571018270ac..ba79c16afd292 100644 --- a/src/librustdoc/html/static/themes/ayu.css +++ b/src/librustdoc/html/static/themes/ayu.css @@ -129,9 +129,10 @@ pre { color: #ffb44c; } -.line-numbers span { color: #5c6773ab; } +.line-numbers span { color: #5c6773; } .line-numbers .line-highlighted { - background-color: rgba(255, 236, 164, 0.06) !important; + color: #708090; + background-color: rgba(255, 236, 164, 0.06); padding-right: 4px; border-right: 1px solid #ffb44c; } From 4fff14d3d8fa0f75e745e3d6b68967b1caa3aa97 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 5 Sep 2020 20:33:00 +0300 Subject: [PATCH 03/11] rustbuild: Remove `Mode::Codegen` --- src/bootstrap/builder.rs | 10 +++++----- src/bootstrap/lib.rs | 4 ---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 4708b207156c9..91b28b3bac49e 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -796,7 +796,7 @@ impl<'a> Builder<'a> { if cmd == "doc" || cmd == "rustdoc" { let my_out = match mode { // This is the intended out directory for compiler documentation. - Mode::Rustc | Mode::ToolRustc | Mode::Codegen => self.compiler_doc_out(target), + Mode::Rustc | Mode::ToolRustc => self.compiler_doc_out(target), Mode::Std => out_dir.join(target.triple).join("doc"), _ => panic!("doc mode {:?} not expected", mode), }; @@ -874,7 +874,7 @@ impl<'a> Builder<'a> { match mode { Mode::Std | Mode::ToolBootstrap | Mode::ToolStd => {} - Mode::Rustc | Mode::Codegen | Mode::ToolRustc => { + Mode::Rustc | Mode::ToolRustc => { // Build proc macros both for the host and the target if target != compiler.host && cmd != "check" { cargo.arg("-Zdual-proc-macros"); @@ -1059,7 +1059,7 @@ impl<'a> Builder<'a> { } let debuginfo_level = match mode { - Mode::Rustc | Mode::Codegen => self.config.rust_debuginfo_level_rustc, + Mode::Rustc => self.config.rust_debuginfo_level_rustc, Mode::Std => self.config.rust_debuginfo_level_std, Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustc => { self.config.rust_debuginfo_level_tools @@ -1196,7 +1196,7 @@ impl<'a> Builder<'a> { rustdocflags.arg("-Winvalid_codeblock_attributes"); } - if let Mode::Rustc | Mode::Codegen = mode { + if mode == Mode::Rustc { rustflags.arg("-Zunstable-options"); rustflags.arg("-Wrustc::internal"); } @@ -1359,7 +1359,7 @@ impl<'a> Builder<'a> { // When we build Rust dylibs they're all intended for intermediate // usage, so make sure we pass the -Cprefer-dynamic flag instead of // linking all deps statically into the dylib. - if let Mode::Std | Mode::Rustc | Mode::Codegen = mode { + if matches!(mode, Mode::Std | Mode::Rustc) { rustflags.arg("-Cprefer-dynamic"); } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 54651214363ba..f7e456d2c445a 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -300,9 +300,6 @@ pub enum Mode { /// Build librustc, and compiler libraries, placing output in the "stageN-rustc" directory. Rustc, - /// Build codegen libraries, placing output in the "stageN-codegen" directory - Codegen, - /// Build a tool, placing output in the "stage0-bootstrap-tools" /// directory. This is for miscellaneous sets of tools that are built /// using the bootstrap stage0 compiler in its entirety (target libraries @@ -572,7 +569,6 @@ impl Build { let suffix = match mode { Mode::Std => "-std", Mode::Rustc => "-rustc", - Mode::Codegen => "-codegen", Mode::ToolBootstrap => "-bootstrap-tools", Mode::ToolStd | Mode::ToolRustc => "-tools", }; From 5acd272f5f7d892b73cfbe90bdf266af10ea30ce Mon Sep 17 00:00:00 2001 From: MaulingMonkey Date: Sat, 5 Sep 2020 14:50:03 -0700 Subject: [PATCH 04/11] Fix HashMap visualizers in Visual Studio (Code) CDB doesn't care that you're using static_cast between unrelated types. VS(C) does. These should've been reinterpret_cast or C casts. Cast is from e.g. `u8*` to `tuple<$T1, $T2>*` --- src/etc/natvis/libstd.natvis | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etc/natvis/libstd.natvis b/src/etc/natvis/libstd.natvis index 4e81173d3d0b8..f791979800f19 100644 --- a/src/etc/natvis/libstd.natvis +++ b/src/etc/natvis/libstd.natvis @@ -41,7 +41,7 @@ n-- - static_cast<tuple<$T1, $T2>*>(base.table.ctrl.pointer)[-(i + 1)].__1 + ((tuple<$T1, $T2>*)base.table.ctrl.pointer)[-(i + 1)].__1 i++ @@ -65,7 +65,7 @@ n-- - static_cast<$T1*>(map.base.table.ctrl.pointer)[-(i + 1)] + (($T1*)map.base.table.ctrl.pointer)[-(i + 1)] i++ From b92b0d6ee6ef1aaca1d7b7777eaa431fd29920a3 Mon Sep 17 00:00:00 2001 From: dylni <46035563+dylni@users.noreply.github.com> Date: Sat, 5 Sep 2020 20:12:26 -0400 Subject: [PATCH 05/11] Fix typo in tracking issue template --- .github/ISSUE_TEMPLATE/tracking_issue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/tracking_issue.md b/.github/ISSUE_TEMPLATE/tracking_issue.md index 51bf0c3ee6736..24f4321389713 100644 --- a/.github/ISSUE_TEMPLATE/tracking_issue.md +++ b/.github/ISSUE_TEMPLATE/tracking_issue.md @@ -23,7 +23,7 @@ The feature gate for the issue is `#![feature(FFF)]`. ### About tracking issues Tracking issues are used to record the overall progress of implementation. -They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions. +They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions. A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature. Instead, open a dedicated issue for the specific matter and add the relevant feature gate label. From 9e1403373d948a8e0e3b6e0dc0beec3e31401b28 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Sun, 6 Sep 2020 11:20:53 +0300 Subject: [PATCH 06/11] Update linker-plugin-lto.md to contain up to rust 1.46 --- src/doc/rustc/src/linker-plugin-lto.md | 27 ++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/doc/rustc/src/linker-plugin-lto.md b/src/doc/rustc/src/linker-plugin-lto.md index c0b14352b7d1a..81c9b5774b2f3 100644 --- a/src/doc/rustc/src/linker-plugin-lto.md +++ b/src/doc/rustc/src/linker-plugin-lto.md @@ -100,17 +100,20 @@ LLVM. However, the approximation is usually reliable. The following table shows known good combinations of toolchain versions. -| | Clang 7 | Clang 8 | Clang 9 | -|-----------|-----------|-----------|-----------| -| Rust 1.34 | ✗ | ✓ | ✗ | -| Rust 1.35 | ✗ | ✓ | ✗ | -| Rust 1.36 | ✗ | ✓ | ✗ | -| Rust 1.37 | ✗ | ✓ | ✗ | -| Rust 1.38 | ✗ | ✗ | ✓ | -| Rust 1.39 | ✗ | ✗ | ✓ | -| Rust 1.40 | ✗ | ✗ | ✓ | -| Rust 1.41 | ✗ | ✗ | ✓ | -| Rust 1.42 | ✗ | ✗ | ✓ | -| Rust 1.43 | ✗ | ✗ | ✓ | +| | Clang 7 | Clang 8 | Clang 9 | Clang 10 | +|-----------|-----------|-----------|-----------|-----------| +| Rust 1.34 | ✗ | ✓ | ✗ | ✗ | +| Rust 1.35 | ✗ | ✓ | ✗ | ✗ | +| Rust 1.36 | ✗ | ✓ | ✗ | ✗ | +| Rust 1.37 | ✗ | ✓ | ✗ | ✗ | +| Rust 1.38 | ✗ | ✗ | ✓ | ✗ | +| Rust 1.39 | ✗ | ✗ | ✓ | ✗ | +| Rust 1.40 | ✗ | ✗ | ✓ | ✗ | +| Rust 1.41 | ✗ | ✗ | ✓ | ✗ | +| Rust 1.42 | ✗ | ✗ | ✓ | ✗ | +| Rust 1.43 | ✗ | ✗ | ✓ | ✗ | +| Rust 1.44 | ✗ | ✗ | ✓ | ✗ | +| Rust 1.45 | ✗ | ✗ | ✗ | ✓ | +| Rust 1.46 | ✗ | ✗ | ✗ | ✓ | Note that the compatibility policy for this feature might change in the future. From 84fc6fd2d0005d452ec966a65518948e3eab3f06 Mon Sep 17 00:00:00 2001 From: Sasha Date: Sun, 6 Sep 2020 12:10:46 +0200 Subject: [PATCH 07/11] Fix documentation for TyCtxt::all_impls --- compiler/rustc_middle/src/ty/trait_def.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_middle/src/ty/trait_def.rs b/compiler/rustc_middle/src/ty/trait_def.rs index 86fe3ac3751af..9d5b558234b3a 100644 --- a/compiler/rustc_middle/src/ty/trait_def.rs +++ b/compiler/rustc_middle/src/ty/trait_def.rs @@ -167,7 +167,7 @@ impl<'tcx> TyCtxt<'tcx> { } } - /// Returns a vector containing all impls + /// Returns an iterator containing all impls pub fn all_impls(self, def_id: DefId) -> impl Iterator + 'tcx { let TraitImpls { blanket_impls, non_blanket_impls } = self.trait_impls_of(def_id); From 2e82589741a475185421a481f7a00142725fb609 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Sun, 6 Sep 2020 14:55:27 +0300 Subject: [PATCH 08/11] linker-plugin-lto.md: Convert the rust-clang MxN table to a 2xM table --- src/doc/rustc/src/linker-plugin-lto.md | 30 +++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/doc/rustc/src/linker-plugin-lto.md b/src/doc/rustc/src/linker-plugin-lto.md index 81c9b5774b2f3..f7843abf4d6f2 100644 --- a/src/doc/rustc/src/linker-plugin-lto.md +++ b/src/doc/rustc/src/linker-plugin-lto.md @@ -100,20 +100,20 @@ LLVM. However, the approximation is usually reliable. The following table shows known good combinations of toolchain versions. -| | Clang 7 | Clang 8 | Clang 9 | Clang 10 | -|-----------|-----------|-----------|-----------|-----------| -| Rust 1.34 | ✗ | ✓ | ✗ | ✗ | -| Rust 1.35 | ✗ | ✓ | ✗ | ✗ | -| Rust 1.36 | ✗ | ✓ | ✗ | ✗ | -| Rust 1.37 | ✗ | ✓ | ✗ | ✗ | -| Rust 1.38 | ✗ | ✗ | ✓ | ✗ | -| Rust 1.39 | ✗ | ✗ | ✓ | ✗ | -| Rust 1.40 | ✗ | ✗ | ✓ | ✗ | -| Rust 1.41 | ✗ | ✗ | ✓ | ✗ | -| Rust 1.42 | ✗ | ✗ | ✓ | ✗ | -| Rust 1.43 | ✗ | ✗ | ✓ | ✗ | -| Rust 1.44 | ✗ | ✗ | ✓ | ✗ | -| Rust 1.45 | ✗ | ✗ | ✗ | ✓ | -| Rust 1.46 | ✗ | ✗ | ✗ | ✓ | +| Rust Version | Clang Version | +|--------------|---------------| +| Rust 1.34 | Clang 8 | +| Rust 1.35 | Clang 8 | +| Rust 1.36 | Clang 8 | +| Rust 1.37 | Clang 8 | +| Rust 1.38 | Clang 9 | +| Rust 1.39 | Clang 9 | +| Rust 1.40 | Clang 9 | +| Rust 1.41 | Clang 9 | +| Rust 1.42 | Clang 9 | +| Rust 1.43 | Clang 9 | +| Rust 1.44 | Clang 9 | +| Rust 1.45 | Clang 10 | +| Rust 1.46 | Clang 10 | Note that the compatibility policy for this feature might change in the future. From ee55c1f1d2c427fecedd68e28a7dc4e6c68738b5 Mon Sep 17 00:00:00 2001 From: kadmin Date: Sun, 6 Sep 2020 04:34:20 +0000 Subject: [PATCH 09/11] Add regression test and help note --- compiler/rustc_typeck/src/impl_wf_check.rs | 18 +++++++++++----- .../ui/const-generics/issues/issue-68366.rs | 18 ++++++++++++++++ .../const-generics/issues/issue-68366.stderr | 21 +++++++++++++++++++ 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 src/test/ui/const-generics/issues/issue-68366.rs create mode 100644 src/test/ui/const-generics/issues/issue-68366.stderr diff --git a/compiler/rustc_typeck/src/impl_wf_check.rs b/compiler/rustc_typeck/src/impl_wf_check.rs index 891e482b43133..4901d6041d6f0 100644 --- a/compiler/rustc_typeck/src/impl_wf_check.rs +++ b/compiler/rustc_typeck/src/impl_wf_check.rs @@ -187,7 +187,7 @@ fn enforce_impl_params_are_constrained( } // (*) This is a horrible concession to reality. I think it'd be - // better to just ban unconstrianed lifetimes outright, but in + // better to just ban unconstrained lifetimes outright, but in // practice people do non-hygenic macros like: // // ``` @@ -207,7 +207,7 @@ fn enforce_impl_params_are_constrained( } fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: &str) { - struct_span_err!( + let mut err = struct_span_err!( tcx.sess, span, E0207, @@ -215,9 +215,17 @@ fn report_unused_parameter(tcx: TyCtxt<'_>, span: Span, kind: &str, name: &str) impl trait, self type, or predicates", kind, name - ) - .span_label(span, format!("unconstrained {} parameter", kind)) - .emit(); + ); + err.span_label(span, format!("unconstrained {} parameter", kind)); + if kind == "const" { + err.note( + "expressions using a const parameter must map each value to a distinct output value", + ); + err.note( + "proving the result of expressions other than the parameter are unique is not supported", + ); + } + err.emit(); } /// Enforce that we do not have two items in an impl with the same name. diff --git a/src/test/ui/const-generics/issues/issue-68366.rs b/src/test/ui/const-generics/issues/issue-68366.rs new file mode 100644 index 0000000000000..a06b99d6645ec --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-68366.rs @@ -0,0 +1,18 @@ +// Checks that const expressions have a useful note explaining why they can't be evaluated. +// The note should relate to the fact that it cannot be shown forall N that it maps 1-1 to a new +// type. + +#![feature(const_generics)] +#![allow(incomplete_features)] + +struct Collatz>; + +impl Collatz<{Some(N)}> {} +//~^ ERROR the const parameter + +struct Foo; + +impl Foo {} +//~^ ERROR the const parameter + +fn main() {} diff --git a/src/test/ui/const-generics/issues/issue-68366.stderr b/src/test/ui/const-generics/issues/issue-68366.stderr new file mode 100644 index 0000000000000..bba16f421535a --- /dev/null +++ b/src/test/ui/const-generics/issues/issue-68366.stderr @@ -0,0 +1,21 @@ +error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-68366.rs:10:13 + | +LL | impl Collatz<{Some(N)}> {} + | ^ unconstrained const parameter + | + = note: expressions using a const parameter must map each value to a distinct output value + = note: proving the result of expressions other than the parameter are unique is not supported + +error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates + --> $DIR/issue-68366.rs:15:12 + | +LL | impl Foo {} + | ^ unconstrained const parameter + | + = note: expressions using a const parameter must map each value to a distinct output value + = note: proving the result of expressions other than the parameter are unique is not supported + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0207`. From 98231bfb953406fd7b5dcbdfa7229d44554776a0 Mon Sep 17 00:00:00 2001 From: Alexander Brausch Date: Mon, 31 Aug 2020 16:20:24 +0200 Subject: [PATCH 10/11] Make duration_since documentation more clear --- library/std/src/time.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/std/src/time.rs b/library/std/src/time.rs index c8aee1da39b39..0085136417b7b 100644 --- a/library/std/src/time.rs +++ b/library/std/src/time.rs @@ -457,12 +457,13 @@ impl SystemTime { /// /// # Examples /// - /// ``` + /// ```no_run /// use std::time::SystemTime; /// /// let sys_time = SystemTime::now(); - /// let difference = sys_time.duration_since(sys_time) - /// .expect("Clock may have gone backwards"); + /// let new_sys_time = SystemTime::now(); + /// let difference = new_sys_time.duration_since(sys_time) + /// .expect("Clock may have gone backwards"); /// println!("{:?}", difference); /// ``` #[stable(feature = "time2", since = "1.8.0")] From 8b2106f77a364337675c6d4534681f1d1d18cb91 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 8 Sep 2020 15:10:21 -0700 Subject: [PATCH 11/11] Update cargo --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index 126907a7cfccb..875e0123259b0 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 126907a7cfccbe93778530e6a6bbaa3adb6c515c +Subproject commit 875e0123259b0b6299903fe4aea0a12ecde9324f