From bd135674814d74ca6fca3ab79d778ecaaeb02cf5 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Fri, 9 Oct 2020 23:41:57 -0400 Subject: [PATCH 01/22] Allow setting up git hooks from other worktrees --- src/bootstrap/setup.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs index dcfb9fd673421..9eb2dc84e0830 100644 --- a/src/bootstrap/setup.rs +++ b/src/bootstrap/setup.rs @@ -1,5 +1,6 @@ use crate::t; use std::path::{Path, PathBuf}; +use std::process::Command; use std::str::FromStr; use std::{ env, fmt, fs, @@ -155,10 +156,17 @@ simply delete the `pre-commit` file from .git/hooks." Ok(if should_install { let src = src_path.join("src").join("etc").join("pre-commit.sh"); - let dst = src_path.join(".git").join("hooks").join("pre-commit"); - match fs::hard_link(src, dst) { + let git = t!(Command::new("git").args(&["rev-parse", "--git-common-dir"]).output().map( + |output| { + assert!(output.status.success(), "failed to run `git`"); + PathBuf::from(t!(String::from_utf8(output.stdout)).trim()) + } + )); + let dst = git.join("hooks").join("pre-commit"); + match fs::hard_link(src, &dst) { Err(e) => println!( - "x.py encountered an error -- do you already have the git hook installed?\n{}", + "error: could not create hook {}: do you already have the git hook installed?\n{}", + dst.display(), e ), Ok(_) => println!("Linked `src/etc/pre-commit.sh` to `.git/hooks/pre-commit`"), From 0ec3ea9e697ea9c2ce225ba0b9f3715434fc773e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 12 Oct 2020 00:10:37 +0200 Subject: [PATCH 02/22] const keyword: brief paragraph on 'const fn' --- library/std/src/keyword_docs.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 54ce0e7b831f4..c76f9b923cd0f 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -102,7 +102,9 @@ mod break_keyword {} #[doc(keyword = "const")] // -/// Compile-time constants and deterministic functions. +/// Compile-time constants and compile-time evaluable functions. +/// +/// ## Compile-time constants /// /// Sometimes a certain value is used many times throughout a program, and it can become /// inconvenient to copy it over and over. What's more, it's not always possible or desirable to @@ -145,15 +147,28 @@ mod break_keyword {} /// /// Constants, like statics, should always be in `SCREAMING_SNAKE_CASE`. /// +/// For more detail on `const`, see the [Rust Book] or the [Reference]. +/// +/// ## Compile-time evaluable functions +/// +/// The other main use of the `const` keyword is in `const fn`. This marks a function as being +/// callable in the body of a `const` or `static` item and in array initializers (commonly called +/// "const contexts"). `const fn` are restricted in the set of operations they can perform, to +/// ensure that they can be evaluated at compile-time. See the [Reference][const-eval] for more +/// detail. +/// +/// Turning a `fn` into a `const fn` has no effect on run-time uses of that function. +/// +/// ## Other uses of `const` +/// /// The `const` keyword is also used in raw pointers in combination with `mut`, as seen in `*const /// T` and `*mut T`. More about `const` as used in raw pointers can be read at the Rust docs for the [pointer primitive]. /// -/// For more detail on `const`, see the [Rust Book] or the [Reference]. -/// /// [pointer primitive]: primitive.pointer.html /// [Rust Book]: /// ../book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants /// [Reference]: ../reference/items/constant-items.html +/// [cosnt-eval]: ./reference/const_eval.html mod const_keyword {} #[doc(keyword = "continue")] From c8405d2251ce78651f591ed8a2189c41593f5110 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 12 Oct 2020 09:18:15 +0200 Subject: [PATCH 03/22] fix markdown reference Co-authored-by: Dariusz Niedoba --- library/std/src/keyword_docs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index c76f9b923cd0f..a4bbb18da5983 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -168,7 +168,7 @@ mod break_keyword {} /// [Rust Book]: /// ../book/ch03-01-variables-and-mutability.html#differences-between-variables-and-constants /// [Reference]: ../reference/items/constant-items.html -/// [cosnt-eval]: ./reference/const_eval.html +/// [const-eval]: ../reference/const_eval.html mod const_keyword {} #[doc(keyword = "continue")] From 058699d0a2fca02127761f014d0ecfce1c5541ec Mon Sep 17 00:00:00 2001 From: wcampbell Date: Tue, 13 Oct 2020 17:58:29 -0400 Subject: [PATCH 04/22] [net] clippy: needless_update warning: struct update has no effect, all the fields in the struct have already been specified --> library/std/src/net/addr.rs:367:19 | 367 | ..unsafe { mem::zeroed() } | ^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(clippy::needless_update)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_update --- library/std/src/net/addr.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/library/std/src/net/addr.rs b/library/std/src/net/addr.rs index 63de87128340f..549192c9d30fc 100644 --- a/library/std/src/net/addr.rs +++ b/library/std/src/net/addr.rs @@ -364,7 +364,6 @@ impl SocketAddrV6 { sin6_addr: *ip.as_inner(), sin6_flowinfo: flowinfo, sin6_scope_id: scope_id, - ..unsafe { mem::zeroed() } }, } } From e6dc604e8b184b1224ae7acf58f06fa021ece82c Mon Sep 17 00:00:00 2001 From: wcampbell Date: Tue, 13 Oct 2020 18:00:59 -0400 Subject: [PATCH 05/22] [net] clippy: match_like_matches_macro warning: match expression looks like `matches!` macro --> library/std/src/net/ip.rs:459:9 | 459 | / match self.octets() { 460 | | [169, 254, ..] => true, 461 | | _ => false, 462 | | } | |_________^ help: try this: `matches!(self.octets(), [169, 254, ..])` | = note: `#[warn(clippy::match_like_matches_macro)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro Signed-off-by: wcampbell --- library/std/src/net/ip.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index f01a7b72a6559..4ff12da883236 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -456,10 +456,7 @@ impl Ipv4Addr { #[rustc_const_unstable(feature = "const_ipv4", issue = "76205")] #[stable(since = "1.7.0", feature = "ip_17")] pub const fn is_link_local(&self) -> bool { - match self.octets() { - [169, 254, ..] => true, - _ => false, - } + matches!(self.octets(), [169, 254, ..]) } /// Returns [`true`] if the address appears to be globally routable. From 7a75f4418313da0173192ed4d2f198e505e11428 Mon Sep 17 00:00:00 2001 From: wcampbell Date: Tue, 13 Oct 2020 18:03:27 -0400 Subject: [PATCH 06/22] [net] clippy: identity_op warning: the operation is ineffective. Consider reducing it to `self.segments()[0]` --> library/std/src/net/ip.rs:1265:9 | 1265 | (self.segments()[0] & 0xffff) == 0xfe80 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `#[warn(clippy::identity_op)]` on by default = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `self.segments()[1]` --> library/std/src/net/ip.rs:1266:16 | 1266 | && (self.segments()[1] & 0xffff) == 0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `self.segments()[2]` --> library/std/src/net/ip.rs:1267:16 | 1267 | && (self.segments()[2] & 0xffff) == 0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op warning: the operation is ineffective. Consider reducing it to `self.segments()[3]` --> library/std/src/net/ip.rs:1268:16 | 1268 | && (self.segments()[3] & 0xffff) == 0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op Signed-off-by: wcampbell --- library/std/src/net/ip.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index 4ff12da883236..6bf71d28bb666 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -1259,10 +1259,10 @@ impl Ipv6Addr { /// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406 #[rustc_const_unstable(feature = "const_ipv6", issue = "76205")] pub const fn is_unicast_link_local_strict(&self) -> bool { - (self.segments()[0] & 0xffff) == 0xfe80 - && (self.segments()[1] & 0xffff) == 0 - && (self.segments()[2] & 0xffff) == 0 - && (self.segments()[3] & 0xffff) == 0 + (self.segments()[0]) == 0xfe80 + && self.segments()[1] == 0 + && self.segments()[2] == 0 + && self.segments()[3] == 0 } /// Returns [`true`] if the address is a unicast link-local address (`fe80::/10`). From 39867f3c9fea0e01b5b199d8c2b6b0889284cc85 Mon Sep 17 00:00:00 2001 From: aticu <15schnic@gmail.com> Date: Wed, 14 Oct 2020 01:13:48 +0200 Subject: [PATCH 07/22] Fixed false positive for `unused_parens` lint --- compiler/rustc_lint/src/unused.rs | 11 +++++++++-- src/test/ui/lint/lint-unnecessary-parens.fixed | 2 ++ src/test/ui/lint/lint-unnecessary-parens.rs | 2 ++ src/test/ui/lint/lint-unnecessary-parens.stderr | 8 ++++---- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 3abd9a6325d6e..51ec599493399 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -751,13 +751,20 @@ impl UnusedDelimLint for UnusedParens { if !Self::is_expr_delims_necessary(inner, followed_by_block) && value.attrs.is_empty() && !value.span.from_expansion() + && (ctx != UnusedDelimsCtx::LetScrutineeExpr + || match inner.kind { + ast::ExprKind::Binary( + rustc_span::source_map::Spanned { node, .. }, + _, + _, + ) if node.lazy() => false, + _ => true, + }) { self.emit_unused_delims_expr(cx, value, ctx, left_pos, right_pos) } } ast::ExprKind::Let(_, ref expr) => { - // FIXME(#60336): Properly handle `let true = (false && true)` - // actually needing the parenthesis. self.check_unused_delims_expr( cx, expr, diff --git a/src/test/ui/lint/lint-unnecessary-parens.fixed b/src/test/ui/lint/lint-unnecessary-parens.fixed index c9dec395580f1..9c144324f2f7e 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.fixed +++ b/src/test/ui/lint/lint-unnecessary-parens.fixed @@ -60,6 +60,8 @@ fn main() { if (v == X { y: true }) {} if (X { y: true } == v) {} if (X { y: false }.y) {} + // this shouldn't warn, because the parens are necessary to disambiguate let chains + if let true = (true && false) {} while (X { y: false }.foo(true)) {} while (true | X { y: false }.y) {} diff --git a/src/test/ui/lint/lint-unnecessary-parens.rs b/src/test/ui/lint/lint-unnecessary-parens.rs index 884bb4d2e99b6..4fd9cabb3b0b2 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.rs +++ b/src/test/ui/lint/lint-unnecessary-parens.rs @@ -60,6 +60,8 @@ fn main() { if (v == X { y: true }) {} if (X { y: true } == v) {} if (X { y: false }.y) {} + // this shouldn't warn, because the parens are necessary to disambiguate let chains + if let true = (true && false) {} while (X { y: false }.foo(true)) {} while (true | X { y: false }.y) {} diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr index 1abf47c8af521..9eae7da90047e 100644 --- a/src/test/ui/lint/lint-unnecessary-parens.stderr +++ b/src/test/ui/lint/lint-unnecessary-parens.stderr @@ -83,25 +83,25 @@ LL | while let 1 = (2) {} | ^^^ help: remove these parentheses error: unnecessary parentheses around method argument - --> $DIR/lint-unnecessary-parens.rs:71:24 + --> $DIR/lint-unnecessary-parens.rs:73:24 | LL | X { y: false }.foo((true)); | ^^^^^^ help: remove these parentheses error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:73:18 + --> $DIR/lint-unnecessary-parens.rs:75:18 | LL | let mut _a = (0); | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:74:10 + --> $DIR/lint-unnecessary-parens.rs:76:10 | LL | _a = (0); | ^^^ help: remove these parentheses error: unnecessary parentheses around assigned value - --> $DIR/lint-unnecessary-parens.rs:75:11 + --> $DIR/lint-unnecessary-parens.rs:77:11 | LL | _a += (1); | ^^^ help: remove these parentheses From 7da0e58da4f1a4a7f102eb5478dbd4e7fa7edbaf Mon Sep 17 00:00:00 2001 From: wcampbell Date: Tue, 13 Oct 2020 19:33:39 -0400 Subject: [PATCH 08/22] use matches! in library/std/src/net/ip.rs Apply suggestion from review Co-authored-by: LingMan --- library/std/src/net/ip.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index 6bf71d28bb666..eb054b081175d 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -1259,10 +1259,7 @@ impl Ipv6Addr { /// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406 #[rustc_const_unstable(feature = "const_ipv6", issue = "76205")] pub const fn is_unicast_link_local_strict(&self) -> bool { - (self.segments()[0]) == 0xfe80 - && self.segments()[1] == 0 - && self.segments()[2] == 0 - && self.segments()[3] == 0 + matches!(self.segments(), [0xfe80, 0, 0, 0, ..]) } /// Returns [`true`] if the address is a unicast link-local address (`fe80::/10`). From ce04836327e6aebab6a834d89e7305d1b1be958b Mon Sep 17 00:00:00 2001 From: wcampbell Date: Tue, 13 Oct 2020 20:11:29 -0400 Subject: [PATCH 09/22] fmt Signed-off-by: wcampbell --- library/std/src/net/ip.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs index eb054b081175d..8089d7a8ba6f1 100644 --- a/library/std/src/net/ip.rs +++ b/library/std/src/net/ip.rs @@ -1259,7 +1259,7 @@ impl Ipv6Addr { /// [RFC 4291 errata 4406]: https://www.rfc-editor.org/errata/eid4406 #[rustc_const_unstable(feature = "const_ipv6", issue = "76205")] pub const fn is_unicast_link_local_strict(&self) -> bool { - matches!(self.segments(), [0xfe80, 0, 0, 0, ..]) + matches!(self.segments(), [0xfe80, 0, 0, 0, ..]) } /// Returns [`true`] if the address is a unicast link-local address (`fe80::/10`). From 608f2600de26a37000e5ba0c76891d7cef13a3c5 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 15 Oct 2020 10:21:45 +0900 Subject: [PATCH 10/22] Rename some RFC dirs to be sorted alphabetically --- .../allow-hide-behind-direct-unsafe-ptr-embedded.rs | 0 .../allow-hide-behind-direct-unsafe-ptr-param.rs | 0 .../allow-hide-behind-indirect-unsafe-ptr-embedded.rs | 0 .../allow-hide-behind-indirect-unsafe-ptr-param.rs | 0 .../allow-use-behind-cousin-variant.rs | 0 .../cant-hide-behind-direct-struct-embedded.rs | 0 .../cant-hide-behind-direct-struct-embedded.stderr | 0 .../cant-hide-behind-direct-struct-param.rs | 0 .../cant-hide-behind-direct-struct-param.stderr | 0 .../cant-hide-behind-doubly-indirect-embedded.rs | 0 .../cant-hide-behind-doubly-indirect-embedded.stderr | 0 .../cant-hide-behind-doubly-indirect-param.rs | 0 .../cant-hide-behind-doubly-indirect-param.stderr | 0 .../cant-hide-behind-indirect-struct-embedded.rs | 0 .../cant-hide-behind-indirect-struct-embedded.stderr | 0 .../cant-hide-behind-indirect-struct-param.rs | 0 .../cant-hide-behind-indirect-struct-param.stderr | 0 .../feature-gate.no_gate.stderr | 0 .../feature-gate.rs | 0 .../feature-gate.with_gate.stderr | 0 .../fn-ptr-is-structurally-matchable.rs | 0 .../issue-61188-match-slice-forbidden-without-eq.rs | 0 .../issue-61188-match-slice-forbidden-without-eq.stderr | 0 .../issue-62307-match-ref-ref-forbidden-without-eq.rs | 0 .../issue-62307-match-ref-ref-forbidden-without-eq.stderr | 0 .../issue-63479-match-fnptr.rs | 0 .../issue-63479-match-fnptr.stderr | 0 .../match-empty-array-allowed-without-eq-issue-62336.rs | 0 .../match-forbidden-without-eq.rs | 0 .../match-forbidden-without-eq.stderr | 0 .../match-nonempty-array-forbidden-without-eq.rs | 0 .../match-nonempty-array-forbidden-without-eq.stderr | 0 .../match-requires-both-partialeq-and-eq.rs | 0 .../match-requires-both-partialeq-and-eq.stderr | 0 .../phantom-data-is-structurally-matchable.rs | 0 src/test/ui/{rfc1717 => rfc-1717-dllimport}/missing-link-attr.rs | 0 .../ui/{rfc1717 => rfc-1717-dllimport}/missing-link-attr.stderr | 0 src/test/ui/{rfc1717 => rfc-1717-dllimport}/multiple-renames.rs | 0 .../ui/{rfc1717 => rfc-1717-dllimport}/multiple-renames.stderr | 0 src/test/ui/{rfc1717 => rfc-1717-dllimport}/rename-to-empty.rs | 0 .../ui/{rfc1717 => rfc-1717-dllimport}/rename-to-empty.stderr | 0 41 files changed, 0 insertions(+), 0 deletions(-) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/allow-hide-behind-direct-unsafe-ptr-embedded.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/allow-hide-behind-direct-unsafe-ptr-param.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/allow-hide-behind-indirect-unsafe-ptr-embedded.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/allow-hide-behind-indirect-unsafe-ptr-param.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/allow-use-behind-cousin-variant.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-direct-struct-embedded.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-direct-struct-embedded.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-direct-struct-param.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-direct-struct-param.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-doubly-indirect-embedded.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-doubly-indirect-embedded.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-doubly-indirect-param.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-doubly-indirect-param.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-indirect-struct-embedded.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-indirect-struct-embedded.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-indirect-struct-param.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/cant-hide-behind-indirect-struct-param.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/feature-gate.no_gate.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/feature-gate.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/feature-gate.with_gate.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/fn-ptr-is-structurally-matchable.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/issue-61188-match-slice-forbidden-without-eq.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/issue-61188-match-slice-forbidden-without-eq.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/issue-62307-match-ref-ref-forbidden-without-eq.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/issue-62307-match-ref-ref-forbidden-without-eq.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/issue-63479-match-fnptr.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/issue-63479-match-fnptr.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/match-empty-array-allowed-without-eq-issue-62336.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/match-forbidden-without-eq.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/match-forbidden-without-eq.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/match-nonempty-array-forbidden-without-eq.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/match-nonempty-array-forbidden-without-eq.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/match-requires-both-partialeq-and-eq.rs (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/match-requires-both-partialeq-and-eq.stderr (100%) rename src/test/ui/{rfc1445 => rfc-1445-restrict-constants-in-patterns}/phantom-data-is-structurally-matchable.rs (100%) rename src/test/ui/{rfc1717 => rfc-1717-dllimport}/missing-link-attr.rs (100%) rename src/test/ui/{rfc1717 => rfc-1717-dllimport}/missing-link-attr.stderr (100%) rename src/test/ui/{rfc1717 => rfc-1717-dllimport}/multiple-renames.rs (100%) rename src/test/ui/{rfc1717 => rfc-1717-dllimport}/multiple-renames.stderr (100%) rename src/test/ui/{rfc1717 => rfc-1717-dllimport}/rename-to-empty.rs (100%) rename src/test/ui/{rfc1717 => rfc-1717-dllimport}/rename-to-empty.stderr (100%) diff --git a/src/test/ui/rfc1445/allow-hide-behind-direct-unsafe-ptr-embedded.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-direct-unsafe-ptr-embedded.rs similarity index 100% rename from src/test/ui/rfc1445/allow-hide-behind-direct-unsafe-ptr-embedded.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-direct-unsafe-ptr-embedded.rs diff --git a/src/test/ui/rfc1445/allow-hide-behind-direct-unsafe-ptr-param.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-direct-unsafe-ptr-param.rs similarity index 100% rename from src/test/ui/rfc1445/allow-hide-behind-direct-unsafe-ptr-param.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-direct-unsafe-ptr-param.rs diff --git a/src/test/ui/rfc1445/allow-hide-behind-indirect-unsafe-ptr-embedded.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-indirect-unsafe-ptr-embedded.rs similarity index 100% rename from src/test/ui/rfc1445/allow-hide-behind-indirect-unsafe-ptr-embedded.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-indirect-unsafe-ptr-embedded.rs diff --git a/src/test/ui/rfc1445/allow-hide-behind-indirect-unsafe-ptr-param.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-indirect-unsafe-ptr-param.rs similarity index 100% rename from src/test/ui/rfc1445/allow-hide-behind-indirect-unsafe-ptr-param.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-hide-behind-indirect-unsafe-ptr-param.rs diff --git a/src/test/ui/rfc1445/allow-use-behind-cousin-variant.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-use-behind-cousin-variant.rs similarity index 100% rename from src/test/ui/rfc1445/allow-use-behind-cousin-variant.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/allow-use-behind-cousin-variant.rs diff --git a/src/test/ui/rfc1445/cant-hide-behind-direct-struct-embedded.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.rs similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-direct-struct-embedded.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.rs diff --git a/src/test/ui/rfc1445/cant-hide-behind-direct-struct-embedded.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.stderr similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-direct-struct-embedded.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-embedded.stderr diff --git a/src/test/ui/rfc1445/cant-hide-behind-direct-struct-param.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.rs similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-direct-struct-param.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.rs diff --git a/src/test/ui/rfc1445/cant-hide-behind-direct-struct-param.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.stderr similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-direct-struct-param.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-direct-struct-param.stderr diff --git a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.rs similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.rs diff --git a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.stderr similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-embedded.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-embedded.stderr diff --git a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.rs similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.rs diff --git a/src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.stderr similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-doubly-indirect-param.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-doubly-indirect-param.stderr diff --git a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.rs similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.rs diff --git a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.stderr similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-indirect-struct-embedded.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-embedded.stderr diff --git a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.rs similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.rs diff --git a/src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.stderr similarity index 100% rename from src/test/ui/rfc1445/cant-hide-behind-indirect-struct-param.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/cant-hide-behind-indirect-struct-param.stderr diff --git a/src/test/ui/rfc1445/feature-gate.no_gate.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr similarity index 100% rename from src/test/ui/rfc1445/feature-gate.no_gate.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/feature-gate.no_gate.stderr diff --git a/src/test/ui/rfc1445/feature-gate.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/feature-gate.rs similarity index 100% rename from src/test/ui/rfc1445/feature-gate.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/feature-gate.rs diff --git a/src/test/ui/rfc1445/feature-gate.with_gate.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/feature-gate.with_gate.stderr similarity index 100% rename from src/test/ui/rfc1445/feature-gate.with_gate.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/feature-gate.with_gate.stderr diff --git a/src/test/ui/rfc1445/fn-ptr-is-structurally-matchable.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs similarity index 100% rename from src/test/ui/rfc1445/fn-ptr-is-structurally-matchable.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/fn-ptr-is-structurally-matchable.rs diff --git a/src/test/ui/rfc1445/issue-61188-match-slice-forbidden-without-eq.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.rs similarity index 100% rename from src/test/ui/rfc1445/issue-61188-match-slice-forbidden-without-eq.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.rs diff --git a/src/test/ui/rfc1445/issue-61188-match-slice-forbidden-without-eq.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.stderr similarity index 100% rename from src/test/ui/rfc1445/issue-61188-match-slice-forbidden-without-eq.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-61188-match-slice-forbidden-without-eq.stderr diff --git a/src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.rs similarity index 100% rename from src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.rs diff --git a/src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.stderr similarity index 100% rename from src/test/ui/rfc1445/issue-62307-match-ref-ref-forbidden-without-eq.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-62307-match-ref-ref-forbidden-without-eq.stderr diff --git a/src/test/ui/rfc1445/issue-63479-match-fnptr.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs similarity index 100% rename from src/test/ui/rfc1445/issue-63479-match-fnptr.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.rs diff --git a/src/test/ui/rfc1445/issue-63479-match-fnptr.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr similarity index 100% rename from src/test/ui/rfc1445/issue-63479-match-fnptr.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/issue-63479-match-fnptr.stderr diff --git a/src/test/ui/rfc1445/match-empty-array-allowed-without-eq-issue-62336.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-empty-array-allowed-without-eq-issue-62336.rs similarity index 100% rename from src/test/ui/rfc1445/match-empty-array-allowed-without-eq-issue-62336.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/match-empty-array-allowed-without-eq-issue-62336.rs diff --git a/src/test/ui/rfc1445/match-forbidden-without-eq.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs similarity index 100% rename from src/test/ui/rfc1445/match-forbidden-without-eq.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.rs diff --git a/src/test/ui/rfc1445/match-forbidden-without-eq.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr similarity index 100% rename from src/test/ui/rfc1445/match-forbidden-without-eq.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/match-forbidden-without-eq.stderr diff --git a/src/test/ui/rfc1445/match-nonempty-array-forbidden-without-eq.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.rs similarity index 100% rename from src/test/ui/rfc1445/match-nonempty-array-forbidden-without-eq.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.rs diff --git a/src/test/ui/rfc1445/match-nonempty-array-forbidden-without-eq.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.stderr similarity index 100% rename from src/test/ui/rfc1445/match-nonempty-array-forbidden-without-eq.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/match-nonempty-array-forbidden-without-eq.stderr diff --git a/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.rs similarity index 100% rename from src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.rs diff --git a/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr b/src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.stderr similarity index 100% rename from src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.stderr diff --git a/src/test/ui/rfc1445/phantom-data-is-structurally-matchable.rs b/src/test/ui/rfc-1445-restrict-constants-in-patterns/phantom-data-is-structurally-matchable.rs similarity index 100% rename from src/test/ui/rfc1445/phantom-data-is-structurally-matchable.rs rename to src/test/ui/rfc-1445-restrict-constants-in-patterns/phantom-data-is-structurally-matchable.rs diff --git a/src/test/ui/rfc1717/missing-link-attr.rs b/src/test/ui/rfc-1717-dllimport/missing-link-attr.rs similarity index 100% rename from src/test/ui/rfc1717/missing-link-attr.rs rename to src/test/ui/rfc-1717-dllimport/missing-link-attr.rs diff --git a/src/test/ui/rfc1717/missing-link-attr.stderr b/src/test/ui/rfc-1717-dllimport/missing-link-attr.stderr similarity index 100% rename from src/test/ui/rfc1717/missing-link-attr.stderr rename to src/test/ui/rfc-1717-dllimport/missing-link-attr.stderr diff --git a/src/test/ui/rfc1717/multiple-renames.rs b/src/test/ui/rfc-1717-dllimport/multiple-renames.rs similarity index 100% rename from src/test/ui/rfc1717/multiple-renames.rs rename to src/test/ui/rfc-1717-dllimport/multiple-renames.rs diff --git a/src/test/ui/rfc1717/multiple-renames.stderr b/src/test/ui/rfc-1717-dllimport/multiple-renames.stderr similarity index 100% rename from src/test/ui/rfc1717/multiple-renames.stderr rename to src/test/ui/rfc-1717-dllimport/multiple-renames.stderr diff --git a/src/test/ui/rfc1717/rename-to-empty.rs b/src/test/ui/rfc-1717-dllimport/rename-to-empty.rs similarity index 100% rename from src/test/ui/rfc1717/rename-to-empty.rs rename to src/test/ui/rfc-1717-dllimport/rename-to-empty.rs diff --git a/src/test/ui/rfc1717/rename-to-empty.stderr b/src/test/ui/rfc-1717-dllimport/rename-to-empty.stderr similarity index 100% rename from src/test/ui/rfc1717/rename-to-empty.stderr rename to src/test/ui/rfc-1717-dllimport/rename-to-empty.stderr From d87c17d22f6e5dce477dbd5d26e35847682f3a9c Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 15 Oct 2020 10:24:32 +0900 Subject: [PATCH 11/22] Migrate from `associated-const` to `associated-consts` --- .../associated-const-ambiguity-report.rs | 0 .../associated-const-ambiguity-report.stderr | 0 .../associated-const-array-len.rs | 0 .../associated-const-array-len.stderr | 0 .../associated-const-dead-code.rs | 0 .../associated-const-dead-code.stderr | 0 .../associated-const-generic-obligations.rs | 0 .../associated-const-generic-obligations.stderr | 0 .../associated-const-impl-wrong-lifetime.rs | 0 .../associated-const-impl-wrong-lifetime.stderr | 0 .../associated-const-impl-wrong-type.rs | 0 .../associated-const-impl-wrong-type.stderr | 0 .../associated-const-in-trait.rs | 0 .../associated-const-in-trait.stderr | 0 .../associated-const-no-item.rs | 0 .../associated-const-no-item.stderr | 0 .../associated-const-private-impl.rs | 0 .../associated-const-private-impl.stderr | 0 .../associated-const-trait-bound.rs | 0 .../associated-const-type-parameter-arms.rs | 0 .../associated-const-type-parameter-arms.stderr | 0 .../associated-const-type-parameter-arrays-2.rs | 0 .../associated-const-type-parameter-arrays-2.stderr | 0 .../associated-const-type-parameter-arrays.rs | 0 .../associated-const-type-parameter-arrays.stderr | 0 .../defaults-cyclic-fail.rs | 0 .../defaults-cyclic-fail.stderr | 0 .../defaults-cyclic-pass.rs | 0 .../defaults-not-assumed-fail.rs | 0 .../defaults-not-assumed-fail.stderr | 0 .../defaults-not-assumed-pass.rs | 0 .../ui/{associated-const => associated-consts}/issue-63496.rs | 0 .../ui/{associated-const => associated-consts}/issue-63496.stderr | 0 .../issue-69020-assoc-const-arith-overflow.noopt.stderr | 0 .../issue-69020-assoc-const-arith-overflow.opt.stderr | 0 ...020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr | 0 .../issue-69020-assoc-const-arith-overflow.rs | 0 37 files changed, 0 insertions(+), 0 deletions(-) rename src/test/ui/{associated-const => associated-consts}/associated-const-ambiguity-report.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-ambiguity-report.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-array-len.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-array-len.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-dead-code.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-dead-code.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-generic-obligations.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-generic-obligations.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-impl-wrong-lifetime.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-impl-wrong-lifetime.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-impl-wrong-type.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-impl-wrong-type.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-in-trait.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-in-trait.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-no-item.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-no-item.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-private-impl.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-private-impl.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-trait-bound.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-type-parameter-arms.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-type-parameter-arms.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-type-parameter-arrays-2.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-type-parameter-arrays-2.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-type-parameter-arrays.rs (100%) rename src/test/ui/{associated-const => associated-consts}/associated-const-type-parameter-arrays.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/defaults-cyclic-fail.rs (100%) rename src/test/ui/{associated-const => associated-consts}/defaults-cyclic-fail.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/defaults-cyclic-pass.rs (100%) rename src/test/ui/{associated-const => associated-consts}/defaults-not-assumed-fail.rs (100%) rename src/test/ui/{associated-const => associated-consts}/defaults-not-assumed-fail.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/defaults-not-assumed-pass.rs (100%) rename src/test/ui/{associated-const => associated-consts}/issue-63496.rs (100%) rename src/test/ui/{associated-const => associated-consts}/issue-63496.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/issue-69020-assoc-const-arith-overflow.noopt.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/issue-69020-assoc-const-arith-overflow.opt.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr (100%) rename src/test/ui/{associated-const => associated-consts}/issue-69020-assoc-const-arith-overflow.rs (100%) diff --git a/src/test/ui/associated-const/associated-const-ambiguity-report.rs b/src/test/ui/associated-consts/associated-const-ambiguity-report.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-ambiguity-report.rs rename to src/test/ui/associated-consts/associated-const-ambiguity-report.rs diff --git a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr b/src/test/ui/associated-consts/associated-const-ambiguity-report.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-ambiguity-report.stderr rename to src/test/ui/associated-consts/associated-const-ambiguity-report.stderr diff --git a/src/test/ui/associated-const/associated-const-array-len.rs b/src/test/ui/associated-consts/associated-const-array-len.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-array-len.rs rename to src/test/ui/associated-consts/associated-const-array-len.rs diff --git a/src/test/ui/associated-const/associated-const-array-len.stderr b/src/test/ui/associated-consts/associated-const-array-len.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-array-len.stderr rename to src/test/ui/associated-consts/associated-const-array-len.stderr diff --git a/src/test/ui/associated-const/associated-const-dead-code.rs b/src/test/ui/associated-consts/associated-const-dead-code.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-dead-code.rs rename to src/test/ui/associated-consts/associated-const-dead-code.rs diff --git a/src/test/ui/associated-const/associated-const-dead-code.stderr b/src/test/ui/associated-consts/associated-const-dead-code.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-dead-code.stderr rename to src/test/ui/associated-consts/associated-const-dead-code.stderr diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.rs b/src/test/ui/associated-consts/associated-const-generic-obligations.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-generic-obligations.rs rename to src/test/ui/associated-consts/associated-const-generic-obligations.rs diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.stderr b/src/test/ui/associated-consts/associated-const-generic-obligations.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-generic-obligations.stderr rename to src/test/ui/associated-consts/associated-const-generic-obligations.stderr diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs rename to src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.rs diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr rename to src/test/ui/associated-consts/associated-const-impl-wrong-lifetime.stderr diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-type.rs b/src/test/ui/associated-consts/associated-const-impl-wrong-type.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-impl-wrong-type.rs rename to src/test/ui/associated-consts/associated-const-impl-wrong-type.rs diff --git a/src/test/ui/associated-const/associated-const-impl-wrong-type.stderr b/src/test/ui/associated-consts/associated-const-impl-wrong-type.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-impl-wrong-type.stderr rename to src/test/ui/associated-consts/associated-const-impl-wrong-type.stderr diff --git a/src/test/ui/associated-const/associated-const-in-trait.rs b/src/test/ui/associated-consts/associated-const-in-trait.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-in-trait.rs rename to src/test/ui/associated-consts/associated-const-in-trait.rs diff --git a/src/test/ui/associated-const/associated-const-in-trait.stderr b/src/test/ui/associated-consts/associated-const-in-trait.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-in-trait.stderr rename to src/test/ui/associated-consts/associated-const-in-trait.stderr diff --git a/src/test/ui/associated-const/associated-const-no-item.rs b/src/test/ui/associated-consts/associated-const-no-item.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-no-item.rs rename to src/test/ui/associated-consts/associated-const-no-item.rs diff --git a/src/test/ui/associated-const/associated-const-no-item.stderr b/src/test/ui/associated-consts/associated-const-no-item.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-no-item.stderr rename to src/test/ui/associated-consts/associated-const-no-item.stderr diff --git a/src/test/ui/associated-const/associated-const-private-impl.rs b/src/test/ui/associated-consts/associated-const-private-impl.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-private-impl.rs rename to src/test/ui/associated-consts/associated-const-private-impl.rs diff --git a/src/test/ui/associated-const/associated-const-private-impl.stderr b/src/test/ui/associated-consts/associated-const-private-impl.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-private-impl.stderr rename to src/test/ui/associated-consts/associated-const-private-impl.stderr diff --git a/src/test/ui/associated-const/associated-const-trait-bound.rs b/src/test/ui/associated-consts/associated-const-trait-bound.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-trait-bound.rs rename to src/test/ui/associated-consts/associated-const-trait-bound.rs diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arms.rs b/src/test/ui/associated-consts/associated-const-type-parameter-arms.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-type-parameter-arms.rs rename to src/test/ui/associated-consts/associated-const-type-parameter-arms.rs diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr b/src/test/ui/associated-consts/associated-const-type-parameter-arms.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-type-parameter-arms.stderr rename to src/test/ui/associated-consts/associated-const-type-parameter-arms.stderr diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs b/src/test/ui/associated-consts/associated-const-type-parameter-arrays-2.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs rename to src/test/ui/associated-consts/associated-const-type-parameter-arrays-2.rs diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr b/src/test/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr rename to src/test/ui/associated-consts/associated-const-type-parameter-arrays-2.stderr diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays.rs b/src/test/ui/associated-consts/associated-const-type-parameter-arrays.rs similarity index 100% rename from src/test/ui/associated-const/associated-const-type-parameter-arrays.rs rename to src/test/ui/associated-consts/associated-const-type-parameter-arrays.rs diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr b/src/test/ui/associated-consts/associated-const-type-parameter-arrays.stderr similarity index 100% rename from src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr rename to src/test/ui/associated-consts/associated-const-type-parameter-arrays.stderr diff --git a/src/test/ui/associated-const/defaults-cyclic-fail.rs b/src/test/ui/associated-consts/defaults-cyclic-fail.rs similarity index 100% rename from src/test/ui/associated-const/defaults-cyclic-fail.rs rename to src/test/ui/associated-consts/defaults-cyclic-fail.rs diff --git a/src/test/ui/associated-const/defaults-cyclic-fail.stderr b/src/test/ui/associated-consts/defaults-cyclic-fail.stderr similarity index 100% rename from src/test/ui/associated-const/defaults-cyclic-fail.stderr rename to src/test/ui/associated-consts/defaults-cyclic-fail.stderr diff --git a/src/test/ui/associated-const/defaults-cyclic-pass.rs b/src/test/ui/associated-consts/defaults-cyclic-pass.rs similarity index 100% rename from src/test/ui/associated-const/defaults-cyclic-pass.rs rename to src/test/ui/associated-consts/defaults-cyclic-pass.rs diff --git a/src/test/ui/associated-const/defaults-not-assumed-fail.rs b/src/test/ui/associated-consts/defaults-not-assumed-fail.rs similarity index 100% rename from src/test/ui/associated-const/defaults-not-assumed-fail.rs rename to src/test/ui/associated-consts/defaults-not-assumed-fail.rs diff --git a/src/test/ui/associated-const/defaults-not-assumed-fail.stderr b/src/test/ui/associated-consts/defaults-not-assumed-fail.stderr similarity index 100% rename from src/test/ui/associated-const/defaults-not-assumed-fail.stderr rename to src/test/ui/associated-consts/defaults-not-assumed-fail.stderr diff --git a/src/test/ui/associated-const/defaults-not-assumed-pass.rs b/src/test/ui/associated-consts/defaults-not-assumed-pass.rs similarity index 100% rename from src/test/ui/associated-const/defaults-not-assumed-pass.rs rename to src/test/ui/associated-consts/defaults-not-assumed-pass.rs diff --git a/src/test/ui/associated-const/issue-63496.rs b/src/test/ui/associated-consts/issue-63496.rs similarity index 100% rename from src/test/ui/associated-const/issue-63496.rs rename to src/test/ui/associated-consts/issue-63496.rs diff --git a/src/test/ui/associated-const/issue-63496.stderr b/src/test/ui/associated-consts/issue-63496.stderr similarity index 100% rename from src/test/ui/associated-const/issue-63496.stderr rename to src/test/ui/associated-consts/issue-63496.stderr diff --git a/src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.noopt.stderr b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt.stderr similarity index 100% rename from src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.noopt.stderr rename to src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.noopt.stderr diff --git a/src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.opt.stderr b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt.stderr similarity index 100% rename from src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.opt.stderr rename to src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt.stderr diff --git a/src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr similarity index 100% rename from src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr rename to src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.opt_with_overflow_checks.stderr diff --git a/src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.rs b/src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs similarity index 100% rename from src/test/ui/associated-const/issue-69020-assoc-const-arith-overflow.rs rename to src/test/ui/associated-consts/issue-69020-assoc-const-arith-overflow.rs From 3113c077c042cdcbc0a071c11452118e7711a1c4 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 15 Oct 2020 10:25:23 +0900 Subject: [PATCH 12/22] Migrate from `associated-type` to `associated-types` --- ...ciated-type-projection-ambig-between-bound-and-where-clause.rs | 0 ...ed-type-projection-ambig-between-bound-and-where-clause.stderr | 0 .../associated-type-projection-from-multiple-supertraits.rs | 0 .../associated-type-projection-from-multiple-supertraits.stderr | 0 .../associated-type-projection-from-supertrait.rs | 0 .../associated-type-projection-from-supertrait.stderr | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename src/test/ui/{associated-type => associated-types}/associated-type-projection-ambig-between-bound-and-where-clause.rs (100%) rename src/test/ui/{associated-type => associated-types}/associated-type-projection-ambig-between-bound-and-where-clause.stderr (100%) rename src/test/ui/{associated-type => associated-types}/associated-type-projection-from-multiple-supertraits.rs (100%) rename src/test/ui/{associated-type => associated-types}/associated-type-projection-from-multiple-supertraits.stderr (100%) rename src/test/ui/{associated-type => associated-types}/associated-type-projection-from-supertrait.rs (100%) rename src/test/ui/{associated-type => associated-types}/associated-type-projection-from-supertrait.stderr (100%) diff --git a/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs b/src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.rs similarity index 100% rename from src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs rename to src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.rs diff --git a/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr similarity index 100% rename from src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr rename to src/test/ui/associated-types/associated-type-projection-ambig-between-bound-and-where-clause.stderr diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.rs similarity index 100% rename from src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs rename to src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.rs diff --git a/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr similarity index 100% rename from src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr rename to src/test/ui/associated-types/associated-type-projection-from-multiple-supertraits.stderr diff --git a/src/test/ui/associated-type/associated-type-projection-from-supertrait.rs b/src/test/ui/associated-types/associated-type-projection-from-supertrait.rs similarity index 100% rename from src/test/ui/associated-type/associated-type-projection-from-supertrait.rs rename to src/test/ui/associated-types/associated-type-projection-from-supertrait.rs diff --git a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr similarity index 100% rename from src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr rename to src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr From 72b3807a09fd46a8650915dd4118eee4369ae6b8 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 15 Oct 2020 10:49:43 +0900 Subject: [PATCH 13/22] Clarify the `mod` dir name not to make confusion with the `modules` --- src/test/ui/{mod => modules_and_files_visibility}/mod_file_aux.rs | 0 .../mod_file_correct_spans.rs | 0 .../mod_file_correct_spans.stderr | 0 .../ui/{mod => modules_and_files_visibility}/mod_file_disambig.rs | 0 .../mod_file_disambig.stderr | 0 .../mod_file_disambig_aux.rs | 0 .../mod_file_disambig_aux/mod.rs | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename src/test/ui/{mod => modules_and_files_visibility}/mod_file_aux.rs (100%) rename src/test/ui/{mod => modules_and_files_visibility}/mod_file_correct_spans.rs (100%) rename src/test/ui/{mod => modules_and_files_visibility}/mod_file_correct_spans.stderr (100%) rename src/test/ui/{mod => modules_and_files_visibility}/mod_file_disambig.rs (100%) rename src/test/ui/{mod => modules_and_files_visibility}/mod_file_disambig.stderr (100%) rename src/test/ui/{mod => modules_and_files_visibility}/mod_file_disambig_aux.rs (100%) rename src/test/ui/{mod => modules_and_files_visibility}/mod_file_disambig_aux/mod.rs (100%) diff --git a/src/test/ui/mod/mod_file_aux.rs b/src/test/ui/modules_and_files_visibility/mod_file_aux.rs similarity index 100% rename from src/test/ui/mod/mod_file_aux.rs rename to src/test/ui/modules_and_files_visibility/mod_file_aux.rs diff --git a/src/test/ui/mod/mod_file_correct_spans.rs b/src/test/ui/modules_and_files_visibility/mod_file_correct_spans.rs similarity index 100% rename from src/test/ui/mod/mod_file_correct_spans.rs rename to src/test/ui/modules_and_files_visibility/mod_file_correct_spans.rs diff --git a/src/test/ui/mod/mod_file_correct_spans.stderr b/src/test/ui/modules_and_files_visibility/mod_file_correct_spans.stderr similarity index 100% rename from src/test/ui/mod/mod_file_correct_spans.stderr rename to src/test/ui/modules_and_files_visibility/mod_file_correct_spans.stderr diff --git a/src/test/ui/mod/mod_file_disambig.rs b/src/test/ui/modules_and_files_visibility/mod_file_disambig.rs similarity index 100% rename from src/test/ui/mod/mod_file_disambig.rs rename to src/test/ui/modules_and_files_visibility/mod_file_disambig.rs diff --git a/src/test/ui/mod/mod_file_disambig.stderr b/src/test/ui/modules_and_files_visibility/mod_file_disambig.stderr similarity index 100% rename from src/test/ui/mod/mod_file_disambig.stderr rename to src/test/ui/modules_and_files_visibility/mod_file_disambig.stderr diff --git a/src/test/ui/mod/mod_file_disambig_aux.rs b/src/test/ui/modules_and_files_visibility/mod_file_disambig_aux.rs similarity index 100% rename from src/test/ui/mod/mod_file_disambig_aux.rs rename to src/test/ui/modules_and_files_visibility/mod_file_disambig_aux.rs diff --git a/src/test/ui/mod/mod_file_disambig_aux/mod.rs b/src/test/ui/modules_and_files_visibility/mod_file_disambig_aux/mod.rs similarity index 100% rename from src/test/ui/mod/mod_file_disambig_aux/mod.rs rename to src/test/ui/modules_and_files_visibility/mod_file_disambig_aux/mod.rs From 3156310eb342bfe441d49bad5249b18ead651cdc Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Thu, 15 Oct 2020 10:53:09 +0900 Subject: [PATCH 14/22] Migrate from `generic` to `generics` --- src/test/ui/{generic => generics}/generic-arg-mismatch-recover.rs | 0 .../ui/{generic => generics}/generic-arg-mismatch-recover.stderr | 0 src/test/ui/{generic => generics}/generic-extern-lifetime.rs | 0 src/test/ui/{generic => generics}/generic-extern-lifetime.stderr | 0 src/test/ui/{generic => generics}/generic-extern.rs | 0 src/test/ui/{generic => generics}/generic-extern.stderr | 0 .../generic-impl-less-params-with-defaults.rs | 0 .../generic-impl-less-params-with-defaults.stderr | 0 .../generic-impl-more-params-with-defaults.rs | 0 .../generic-impl-more-params-with-defaults.stderr | 0 src/test/ui/{generic => generics}/generic-lifetime-trait-impl.rs | 0 .../ui/{generic => generics}/generic-lifetime-trait-impl.stderr | 0 src/test/ui/{generic => generics}/generic-no-mangle.fixed | 0 src/test/ui/{generic => generics}/generic-no-mangle.rs | 0 src/test/ui/{generic => generics}/generic-no-mangle.stderr | 0 .../ui/{generic => generics}/generic-non-trailing-defaults.rs | 0 .../ui/{generic => generics}/generic-non-trailing-defaults.stderr | 0 src/test/ui/{generic => generics}/generic-param-attrs.rs | 0 .../generic-type-less-params-with-defaults.rs | 0 .../generic-type-less-params-with-defaults.stderr | 0 .../generic-type-more-params-with-defaults.rs | 0 .../generic-type-more-params-with-defaults.stderr | 0 .../{generic => generics}/generic-type-params-forward-mention.rs | 0 .../generic-type-params-forward-mention.stderr | 0 .../ui/{generic => generics}/generic-type-params-name-repr.rs | 0 .../ui/{generic => generics}/generic-type-params-name-repr.stderr | 0 .../ui/{generic => generics}/param-in-ct-in-ty-param-default.rs | 0 .../{generic => generics}/param-in-ct-in-ty-param-default.stderr | 0 28 files changed, 0 insertions(+), 0 deletions(-) rename src/test/ui/{generic => generics}/generic-arg-mismatch-recover.rs (100%) rename src/test/ui/{generic => generics}/generic-arg-mismatch-recover.stderr (100%) rename src/test/ui/{generic => generics}/generic-extern-lifetime.rs (100%) rename src/test/ui/{generic => generics}/generic-extern-lifetime.stderr (100%) rename src/test/ui/{generic => generics}/generic-extern.rs (100%) rename src/test/ui/{generic => generics}/generic-extern.stderr (100%) rename src/test/ui/{generic => generics}/generic-impl-less-params-with-defaults.rs (100%) rename src/test/ui/{generic => generics}/generic-impl-less-params-with-defaults.stderr (100%) rename src/test/ui/{generic => generics}/generic-impl-more-params-with-defaults.rs (100%) rename src/test/ui/{generic => generics}/generic-impl-more-params-with-defaults.stderr (100%) rename src/test/ui/{generic => generics}/generic-lifetime-trait-impl.rs (100%) rename src/test/ui/{generic => generics}/generic-lifetime-trait-impl.stderr (100%) rename src/test/ui/{generic => generics}/generic-no-mangle.fixed (100%) rename src/test/ui/{generic => generics}/generic-no-mangle.rs (100%) rename src/test/ui/{generic => generics}/generic-no-mangle.stderr (100%) rename src/test/ui/{generic => generics}/generic-non-trailing-defaults.rs (100%) rename src/test/ui/{generic => generics}/generic-non-trailing-defaults.stderr (100%) rename src/test/ui/{generic => generics}/generic-param-attrs.rs (100%) rename src/test/ui/{generic => generics}/generic-type-less-params-with-defaults.rs (100%) rename src/test/ui/{generic => generics}/generic-type-less-params-with-defaults.stderr (100%) rename src/test/ui/{generic => generics}/generic-type-more-params-with-defaults.rs (100%) rename src/test/ui/{generic => generics}/generic-type-more-params-with-defaults.stderr (100%) rename src/test/ui/{generic => generics}/generic-type-params-forward-mention.rs (100%) rename src/test/ui/{generic => generics}/generic-type-params-forward-mention.stderr (100%) rename src/test/ui/{generic => generics}/generic-type-params-name-repr.rs (100%) rename src/test/ui/{generic => generics}/generic-type-params-name-repr.stderr (100%) rename src/test/ui/{generic => generics}/param-in-ct-in-ty-param-default.rs (100%) rename src/test/ui/{generic => generics}/param-in-ct-in-ty-param-default.stderr (100%) diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.rs b/src/test/ui/generics/generic-arg-mismatch-recover.rs similarity index 100% rename from src/test/ui/generic/generic-arg-mismatch-recover.rs rename to src/test/ui/generics/generic-arg-mismatch-recover.rs diff --git a/src/test/ui/generic/generic-arg-mismatch-recover.stderr b/src/test/ui/generics/generic-arg-mismatch-recover.stderr similarity index 100% rename from src/test/ui/generic/generic-arg-mismatch-recover.stderr rename to src/test/ui/generics/generic-arg-mismatch-recover.stderr diff --git a/src/test/ui/generic/generic-extern-lifetime.rs b/src/test/ui/generics/generic-extern-lifetime.rs similarity index 100% rename from src/test/ui/generic/generic-extern-lifetime.rs rename to src/test/ui/generics/generic-extern-lifetime.rs diff --git a/src/test/ui/generic/generic-extern-lifetime.stderr b/src/test/ui/generics/generic-extern-lifetime.stderr similarity index 100% rename from src/test/ui/generic/generic-extern-lifetime.stderr rename to src/test/ui/generics/generic-extern-lifetime.stderr diff --git a/src/test/ui/generic/generic-extern.rs b/src/test/ui/generics/generic-extern.rs similarity index 100% rename from src/test/ui/generic/generic-extern.rs rename to src/test/ui/generics/generic-extern.rs diff --git a/src/test/ui/generic/generic-extern.stderr b/src/test/ui/generics/generic-extern.stderr similarity index 100% rename from src/test/ui/generic/generic-extern.stderr rename to src/test/ui/generics/generic-extern.stderr diff --git a/src/test/ui/generic/generic-impl-less-params-with-defaults.rs b/src/test/ui/generics/generic-impl-less-params-with-defaults.rs similarity index 100% rename from src/test/ui/generic/generic-impl-less-params-with-defaults.rs rename to src/test/ui/generics/generic-impl-less-params-with-defaults.rs diff --git a/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr b/src/test/ui/generics/generic-impl-less-params-with-defaults.stderr similarity index 100% rename from src/test/ui/generic/generic-impl-less-params-with-defaults.stderr rename to src/test/ui/generics/generic-impl-less-params-with-defaults.stderr diff --git a/src/test/ui/generic/generic-impl-more-params-with-defaults.rs b/src/test/ui/generics/generic-impl-more-params-with-defaults.rs similarity index 100% rename from src/test/ui/generic/generic-impl-more-params-with-defaults.rs rename to src/test/ui/generics/generic-impl-more-params-with-defaults.rs diff --git a/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr b/src/test/ui/generics/generic-impl-more-params-with-defaults.stderr similarity index 100% rename from src/test/ui/generic/generic-impl-more-params-with-defaults.stderr rename to src/test/ui/generics/generic-impl-more-params-with-defaults.stderr diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.rs b/src/test/ui/generics/generic-lifetime-trait-impl.rs similarity index 100% rename from src/test/ui/generic/generic-lifetime-trait-impl.rs rename to src/test/ui/generics/generic-lifetime-trait-impl.rs diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.stderr b/src/test/ui/generics/generic-lifetime-trait-impl.stderr similarity index 100% rename from src/test/ui/generic/generic-lifetime-trait-impl.stderr rename to src/test/ui/generics/generic-lifetime-trait-impl.stderr diff --git a/src/test/ui/generic/generic-no-mangle.fixed b/src/test/ui/generics/generic-no-mangle.fixed similarity index 100% rename from src/test/ui/generic/generic-no-mangle.fixed rename to src/test/ui/generics/generic-no-mangle.fixed diff --git a/src/test/ui/generic/generic-no-mangle.rs b/src/test/ui/generics/generic-no-mangle.rs similarity index 100% rename from src/test/ui/generic/generic-no-mangle.rs rename to src/test/ui/generics/generic-no-mangle.rs diff --git a/src/test/ui/generic/generic-no-mangle.stderr b/src/test/ui/generics/generic-no-mangle.stderr similarity index 100% rename from src/test/ui/generic/generic-no-mangle.stderr rename to src/test/ui/generics/generic-no-mangle.stderr diff --git a/src/test/ui/generic/generic-non-trailing-defaults.rs b/src/test/ui/generics/generic-non-trailing-defaults.rs similarity index 100% rename from src/test/ui/generic/generic-non-trailing-defaults.rs rename to src/test/ui/generics/generic-non-trailing-defaults.rs diff --git a/src/test/ui/generic/generic-non-trailing-defaults.stderr b/src/test/ui/generics/generic-non-trailing-defaults.stderr similarity index 100% rename from src/test/ui/generic/generic-non-trailing-defaults.stderr rename to src/test/ui/generics/generic-non-trailing-defaults.stderr diff --git a/src/test/ui/generic/generic-param-attrs.rs b/src/test/ui/generics/generic-param-attrs.rs similarity index 100% rename from src/test/ui/generic/generic-param-attrs.rs rename to src/test/ui/generics/generic-param-attrs.rs diff --git a/src/test/ui/generic/generic-type-less-params-with-defaults.rs b/src/test/ui/generics/generic-type-less-params-with-defaults.rs similarity index 100% rename from src/test/ui/generic/generic-type-less-params-with-defaults.rs rename to src/test/ui/generics/generic-type-less-params-with-defaults.rs diff --git a/src/test/ui/generic/generic-type-less-params-with-defaults.stderr b/src/test/ui/generics/generic-type-less-params-with-defaults.stderr similarity index 100% rename from src/test/ui/generic/generic-type-less-params-with-defaults.stderr rename to src/test/ui/generics/generic-type-less-params-with-defaults.stderr diff --git a/src/test/ui/generic/generic-type-more-params-with-defaults.rs b/src/test/ui/generics/generic-type-more-params-with-defaults.rs similarity index 100% rename from src/test/ui/generic/generic-type-more-params-with-defaults.rs rename to src/test/ui/generics/generic-type-more-params-with-defaults.rs diff --git a/src/test/ui/generic/generic-type-more-params-with-defaults.stderr b/src/test/ui/generics/generic-type-more-params-with-defaults.stderr similarity index 100% rename from src/test/ui/generic/generic-type-more-params-with-defaults.stderr rename to src/test/ui/generics/generic-type-more-params-with-defaults.stderr diff --git a/src/test/ui/generic/generic-type-params-forward-mention.rs b/src/test/ui/generics/generic-type-params-forward-mention.rs similarity index 100% rename from src/test/ui/generic/generic-type-params-forward-mention.rs rename to src/test/ui/generics/generic-type-params-forward-mention.rs diff --git a/src/test/ui/generic/generic-type-params-forward-mention.stderr b/src/test/ui/generics/generic-type-params-forward-mention.stderr similarity index 100% rename from src/test/ui/generic/generic-type-params-forward-mention.stderr rename to src/test/ui/generics/generic-type-params-forward-mention.stderr diff --git a/src/test/ui/generic/generic-type-params-name-repr.rs b/src/test/ui/generics/generic-type-params-name-repr.rs similarity index 100% rename from src/test/ui/generic/generic-type-params-name-repr.rs rename to src/test/ui/generics/generic-type-params-name-repr.rs diff --git a/src/test/ui/generic/generic-type-params-name-repr.stderr b/src/test/ui/generics/generic-type-params-name-repr.stderr similarity index 100% rename from src/test/ui/generic/generic-type-params-name-repr.stderr rename to src/test/ui/generics/generic-type-params-name-repr.stderr diff --git a/src/test/ui/generic/param-in-ct-in-ty-param-default.rs b/src/test/ui/generics/param-in-ct-in-ty-param-default.rs similarity index 100% rename from src/test/ui/generic/param-in-ct-in-ty-param-default.rs rename to src/test/ui/generics/param-in-ct-in-ty-param-default.rs diff --git a/src/test/ui/generic/param-in-ct-in-ty-param-default.stderr b/src/test/ui/generics/param-in-ct-in-ty-param-default.stderr similarity index 100% rename from src/test/ui/generic/param-in-ct-in-ty-param-default.stderr rename to src/test/ui/generics/param-in-ct-in-ty-param-default.stderr From 488b999fc20896318192f8e22709095cccd0a6bf Mon Sep 17 00:00:00 2001 From: Stein Somers Date: Tue, 6 Oct 2020 01:50:35 +0200 Subject: [PATCH 15/22] BTreeMap: test invariants more thoroughly and more readably --- .../alloc/src/collections/btree/map/tests.rs | 89 ++------------- .../alloc/src/collections/btree/node/tests.rs | 105 ++++++++++++++++++ 2 files changed, 115 insertions(+), 79 deletions(-) diff --git a/library/alloc/src/collections/btree/map/tests.rs b/library/alloc/src/collections/btree/map/tests.rs index 118e173bb16db..b51b95a635c87 100644 --- a/library/alloc/src/collections/btree/map/tests.rs +++ b/library/alloc/src/collections/btree/map/tests.rs @@ -1,4 +1,4 @@ -use super::super::{navigate::Position, node, DeterministicRng}; +use super::super::{node, DeterministicRng}; use super::Entry::{Occupied, Vacant}; use super::*; use crate::boxed::Box; @@ -7,7 +7,7 @@ use crate::rc::Rc; use crate::string::{String, ToString}; use crate::vec::Vec; use std::convert::TryFrom; -use std::iter::FromIterator; +use std::iter::{self, FromIterator}; use std::mem; use std::ops::Bound::{self, Excluded, Included, Unbounded}; use std::ops::RangeBounds; @@ -42,19 +42,6 @@ fn test_all_refs<'a, T: 'a>(dummy: &mut T, iter: impl Iterator } } -struct SeriesChecker { - previous: Option, -} - -impl SeriesChecker { - fn is_ascending(&mut self, next: T) { - if let Some(previous) = self.previous { - assert!(previous < next, "{:?} >= {:?}", previous, next); - } - self.previous = Some(next); - } -} - impl<'a, K: 'a, V: 'a> BTreeMap { /// Panics if the map (or the code navigating it) is corrupted. fn check(&self) @@ -63,44 +50,10 @@ impl<'a, K: 'a, V: 'a> BTreeMap { { if let Some(root) = &self.root { let root_node = root.node_as_ref(); - let mut checker = SeriesChecker { previous: None }; - let mut internal_length = 0; - let mut internal_kv_count = 0; - let mut leaf_length = 0; - root_node.visit_nodes_in_order(|pos| match pos { - Position::Leaf(node) => { - let is_root = root_node.height() == 0; - let min_len = if is_root { 0 } else { node::MIN_LEN }; - assert!(node.len() >= min_len, "{} < {}", node.len(), min_len); - - for idx in 0..node.len() { - let key = *unsafe { node.key_at(idx) }; - checker.is_ascending(key); - } - leaf_length += node.len(); - } - Position::Internal(node) => { - let is_root = root_node.height() == node.height(); - let min_len = if is_root { 1 } else { node::MIN_LEN }; - assert!(node.len() >= min_len, "{} < {}", node.len(), min_len); - - for idx in 0..=node.len() { - let edge = unsafe { node::Handle::new_edge(node, idx) }; - assert!(edge.descend().ascend().ok().unwrap() == edge); - } - - internal_length += node.len(); - } - Position::InternalKV(kv) => { - let key = *kv.into_kv().0; - checker.is_ascending(key); - - internal_kv_count += 1; - } - }); - assert_eq!(internal_length, internal_kv_count); - assert_eq!(root_node.calc_length(), internal_length + leaf_length); - assert_eq!(self.length, internal_length + leaf_length); + assert!(root_node.ascend().is_err()); + root_node.assert_back_pointers(); + root_node.assert_ascending(); + assert_eq!(self.length, root_node.assert_and_add_lengths()); } else { assert_eq!(self.length, 0); } @@ -116,28 +69,7 @@ impl<'a, K: 'a, V: 'a> BTreeMap { K: Debug, { if let Some(root) = self.root.as_ref() { - let mut result = String::new(); - let root_node = root.node_as_ref(); - root_node.visit_nodes_in_order(|pos| match pos { - Position::Leaf(leaf) => { - let depth = root_node.height(); - let indent = " ".repeat(depth); - result += &format!("\n{}", indent); - for idx in 0..leaf.len() { - if idx > 0 { - result += ", "; - } - result += &format!("{:?}", unsafe { leaf.key_at(idx) }); - } - } - Position::Internal(_) => {} - Position::InternalKV(kv) => { - let depth = root_node.height() - kv.into_node().height(); - let indent = " ".repeat(depth); - result += &format!("\n{}{:?}", indent, kv.into_kv().0); - } - }); - result + root.node_as_ref().dump_keys() } else { String::from("not yet allocated") } @@ -170,7 +102,6 @@ fn test_levels() { let last_key = *map.last_key_value().unwrap().0; map.insert(last_key + 1, ()); } - println!("{}", map.dump_keys()); map.check(); // Structure: // - 1 element in internal root node with 2 children @@ -372,7 +303,7 @@ fn test_iter_rev() { fn do_test_iter_mut_mutation(size: usize) where T: Copy + Debug + Ord + TryFrom, - >::Error: std::fmt::Debug, + >::Error: Debug, { let zero = T::try_from(0).unwrap(); let mut map: BTreeMap = (0..size).map(|i| (T::try_from(i).unwrap(), zero)).collect(); @@ -857,7 +788,7 @@ mod test_drain_filter { fn consuming_nothing() { let pairs = (0..3).map(|i| (i, i)); let mut map: BTreeMap<_, _> = pairs.collect(); - assert!(map.drain_filter(|_, _| false).eq(std::iter::empty())); + assert!(map.drain_filter(|_, _| false).eq(iter::empty())); map.check(); } @@ -878,7 +809,7 @@ mod test_drain_filter { *v += 6; false }) - .eq(std::iter::empty()) + .eq(iter::empty()) ); assert!(map.keys().copied().eq(0..3)); assert!(map.values().copied().eq(6..9)); diff --git a/library/alloc/src/collections/btree/node/tests.rs b/library/alloc/src/collections/btree/node/tests.rs index 2ef9aad0ccdcf..e56fc2aa51e7c 100644 --- a/library/alloc/src/collections/btree/node/tests.rs +++ b/library/alloc/src/collections/btree/node/tests.rs @@ -1,6 +1,111 @@ +use super::super::navigate; use super::*; +use crate::fmt::Debug; +use crate::string::String; use core::cmp::Ordering::*; +impl<'a, K: 'a, V: 'a> NodeRef, K, V, marker::LeafOrInternal> { + pub fn assert_back_pointers(self) { + match self.force() { + ForceResult::Leaf(_) => {} + ForceResult::Internal(node) => { + for idx in 0..=node.len() { + let edge = unsafe { Handle::new_edge(node, idx) }; + let child = edge.descend(); + assert!(child.ascend().ok() == Some(edge)); + child.assert_back_pointers(); + } + } + } + } + + pub fn assert_ascending(self) + where + K: Copy + Debug + Ord, + { + struct SeriesChecker { + previous: Option, + } + impl SeriesChecker { + fn is_ascending(&mut self, next: T) { + if let Some(previous) = self.previous { + assert!(previous < next, "{:?} >= {:?}", previous, next); + } + self.previous = Some(next); + } + } + + let mut checker = SeriesChecker { previous: None }; + self.visit_nodes_in_order(|pos| match pos { + navigate::Position::Leaf(node) => { + for idx in 0..node.len() { + let key = *unsafe { node.key_at(idx) }; + checker.is_ascending(key); + } + } + navigate::Position::InternalKV(kv) => { + let key = *kv.into_kv().0; + checker.is_ascending(key); + } + navigate::Position::Internal(_) => {} + }); + } + + pub fn assert_and_add_lengths(self) -> usize { + let mut internal_length = 0; + let mut internal_kv_count = 0; + let mut leaf_length = 0; + self.visit_nodes_in_order(|pos| match pos { + navigate::Position::Leaf(node) => { + let is_root = self.height() == 0; + let min_len = if is_root { 0 } else { MIN_LEN }; + assert!(node.len() >= min_len, "{} < {}", node.len(), min_len); + leaf_length += node.len(); + } + navigate::Position::Internal(node) => { + let is_root = self.height() == node.height(); + let min_len = if is_root { 1 } else { MIN_LEN }; + assert!(node.len() >= min_len, "{} < {}", node.len(), min_len); + internal_length += node.len(); + } + navigate::Position::InternalKV(_) => { + internal_kv_count += 1; + } + }); + assert_eq!(internal_length, internal_kv_count); + let total = internal_length + leaf_length; + assert_eq!(self.calc_length(), total); + total + } + + pub fn dump_keys(self) -> String + where + K: Debug, + { + let mut result = String::new(); + self.visit_nodes_in_order(|pos| match pos { + navigate::Position::Leaf(leaf) => { + let depth = self.height(); + let indent = " ".repeat(depth); + result += &format!("\n{}", indent); + for idx in 0..leaf.len() { + if idx > 0 { + result += ", "; + } + result += &format!("{:?}", unsafe { leaf.key_at(idx) }); + } + } + navigate::Position::Internal(_) => {} + navigate::Position::InternalKV(kv) => { + let depth = self.height() - kv.into_node().height(); + let indent = " ".repeat(depth); + result += &format!("\n{}{:?}", indent, kv.into_kv().0); + } + }); + result + } +} + #[test] fn test_splitpoint() { for idx in 0..=CAPACITY { From 736c27ec0b2cd8c79fedd66e5487b47b8746b7c0 Mon Sep 17 00:00:00 2001 From: wcampbell Date: Mon, 19 Oct 2020 07:22:45 -0400 Subject: [PATCH 16/22] Revert "[net] clippy: needless_update" This reverts commit 058699d0a2fca02127761f014d0ecfce1c5541ec. --- library/std/src/net/addr.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/std/src/net/addr.rs b/library/std/src/net/addr.rs index 549192c9d30fc..63de87128340f 100644 --- a/library/std/src/net/addr.rs +++ b/library/std/src/net/addr.rs @@ -364,6 +364,7 @@ impl SocketAddrV6 { sin6_addr: *ip.as_inner(), sin6_flowinfo: flowinfo, sin6_scope_id: scope_id, + ..unsafe { mem::zeroed() } }, } } From 34c80aaffd6fb7104460489952c58238eaea92ab Mon Sep 17 00:00:00 2001 From: Bastian Kauschke Date: Mon, 19 Oct 2020 15:23:32 +0200 Subject: [PATCH 17/22] change name in mailmap --- .mailmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index fa0728bd79461..f476926832158 100644 --- a/.mailmap +++ b/.mailmap @@ -29,7 +29,6 @@ Ariel Ben-Yehuda arielb1 Austin Seipp Aydin Kim aydin.kim Barosl Lee Barosl LEE -Bastian Kauschke Ben Alpert Ben Sago Ben S Ben Sago Ben S @@ -161,6 +160,7 @@ Kyle J Strand Kyle J Strand Kyle J Strand Laurențiu Nicola +lcnr Lee Jeffery Lee Jeffery Lee Wondong Lennart Kudling From 71ca239f8019755eb67a255fbf73450bae8ad4c2 Mon Sep 17 00:00:00 2001 From: SNCPlay42 Date: Mon, 19 Oct 2020 17:42:57 +0100 Subject: [PATCH 18/22] don't assume trait ambiguity happens in `Self` --- .../src/traits/error_reporting/mod.rs | 30 ++++++------- src/test/ui/issues/issue-72690.stderr | 33 ++++++-------- src/test/ui/traits/issue-77982.rs | 40 +++++++++++++++++ src/test/ui/traits/issue-77982.stderr | 44 +++++++++++++++++++ 4 files changed, 113 insertions(+), 34 deletions(-) create mode 100644 src/test/ui/traits/issue-77982.rs create mode 100644 src/test/ui/traits/issue-77982.stderr diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index f53465266d2ac..f8bd3ab96e254 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1462,9 +1462,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { let bound_predicate = predicate.bound_atom(); let mut err = match bound_predicate.skip_binder() { ty::PredicateAtom::Trait(data, _) => { - let self_ty = data.trait_ref.self_ty(); let trait_ref = bound_predicate.rebind(data.trait_ref); - debug!("self_ty {:?} {:?} trait_ref {:?}", self_ty, self_ty.kind(), trait_ref); + debug!("trait_ref {:?}", trait_ref); if predicate.references_error() { return; @@ -1479,6 +1478,17 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { // known, since we don't dispatch based on region // relationships. + // Pick the first substitution that still contains inference variables as the one + // we're going to emit an error for. If there are none (see above), fall back to + // the substitution for `Self`. + let subst = { + let substs = data.trait_ref.substs; + substs + .iter() + .find(|s| s.has_infer_types_or_consts()) + .unwrap_or_else(|| substs[0]) + }; + // This is kind of a hack: it frequently happens that some earlier // error prevents types from being fully inferred, and then we get // a bunch of uninteresting errors saying something like " InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> { // check upstream for type errors and don't add the obligations to // begin with in those cases. if self.tcx.lang_items().sized_trait() == Some(trait_ref.def_id()) { - self.emit_inference_failure_err( - body_id, - span, - self_ty.into(), - ErrorCode::E0282, - ) - .emit(); + self.emit_inference_failure_err(body_id, span, subst, ErrorCode::E0282).emit(); return; } - let mut err = self.emit_inference_failure_err( - body_id, - span, - self_ty.into(), - ErrorCode::E0283, - ); + let mut err = + self.emit_inference_failure_err(body_id, span, subst, ErrorCode::E0283); err.note(&format!("cannot satisfy `{}`", predicate)); if let ObligationCauseCode::ItemObligation(def_id) = obligation.cause.code { self.suggest_fully_qualified_path(&mut err, def_id, span, trait_ref.def_id()); diff --git a/src/test/ui/issues/issue-72690.stderr b/src/test/ui/issues/issue-72690.stderr index feb1316357e5c..3443cca5f3270 100644 --- a/src/test/ui/issues/issue-72690.stderr +++ b/src/test/ui/issues/issue-72690.stderr @@ -2,7 +2,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:7:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for struct `String` + | ^^^^^^^^^^^^ cannot infer type for reference `&_` | = note: cannot satisfy `String: From<&_>` = note: required by `from` @@ -13,11 +13,13 @@ error[E0282]: type annotations needed LL | |x| String::from("x".as_ref()); | ^ consider giving this closure parameter a type -error[E0283]: type annotations needed +error[E0283]: type annotations needed for `&T` --> $DIR/issue-72690.rs:15:17 | LL | let _ = "x".as_ref(); - | ^^^^^^ cannot infer type for type `str` + | - ^^^^^^ cannot infer type for type parameter `T` declared on the trait `AsRef` + | | + | consider giving this pattern the explicit type `&T`, where the type parameter `T` is specified | = note: cannot satisfy `str: AsRef<_>` @@ -25,7 +27,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:19:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for struct `String` + | ^^^^^^^^^^^^ cannot infer type for reference `&_` | = note: cannot satisfy `String: From<&_>` = note: required by `from` @@ -34,7 +36,7 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:25:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for struct `String` + | ^^^^^^^^^^^^ cannot infer type for reference `&_` | = note: cannot satisfy `String: From<&_>` = note: required by `from` @@ -43,41 +45,34 @@ error[E0283]: type annotations needed --> $DIR/issue-72690.rs:33:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for struct `String` + | ^^^^^^^^^^^^ cannot infer type for reference `&_` | = note: cannot satisfy `String: From<&_>` = note: required by `from` -error[E0283]: type annotations needed for `String` +error[E0283]: type annotations needed --> $DIR/issue-72690.rs:41:5 | LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for struct `String` -LL | let _ = String::from("x"); - | - consider giving this pattern a type + | ^^^^^^^^^^^^ cannot infer type for reference `&_` | = note: cannot satisfy `String: From<&_>` = note: required by `from` -error[E0283]: type annotations needed for `String` +error[E0283]: type annotations needed --> $DIR/issue-72690.rs:47:5 | -LL | let _ = String::from("x"); - | - consider giving this pattern a type LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for struct `String` + | ^^^^^^^^^^^^ cannot infer type for reference `&_` | = note: cannot satisfy `String: From<&_>` = note: required by `from` -error[E0283]: type annotations needed for `String` +error[E0283]: type annotations needed --> $DIR/issue-72690.rs:55:5 | -LL | let _ = String::from("x"); - | - consider giving this pattern a type -... LL | String::from("x".as_ref()); - | ^^^^^^^^^^^^ cannot infer type for struct `String` + | ^^^^^^^^^^^^ cannot infer type for reference `&_` | = note: cannot satisfy `String: From<&_>` = note: required by `from` diff --git a/src/test/ui/traits/issue-77982.rs b/src/test/ui/traits/issue-77982.rs new file mode 100644 index 0000000000000..03d4fe23cc5bc --- /dev/null +++ b/src/test/ui/traits/issue-77982.rs @@ -0,0 +1,40 @@ +use std::collections::HashMap; + +fn what() { + let descr = String::new(); + let mut opts = HashMap::::new(); + let opt = String::new(); + + opts.get(opt.as_ref()); //~ ERROR type annotations needed +} + +fn main() { + let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); + //~^ ERROR type annotations needed +} + +trait Foo<'a, T: ?Sized> { + fn foo(&self) -> Box { + todo!() + } +} + +trait Bar<'a, T: ?Sized> { + fn bar(&self) -> Box { + todo!() + } +} + +impl Foo<'static, u32> for () {} +impl<'a> Foo<'a, i16> for () {} + +impl<'a> Bar<'static, u32> for &'a () {} +impl<'a> Bar<'a, i16> for &'a () {} + +fn foo() { + let _ = ().foo(); //~ ERROR type annotations needed +} + +fn bar() { + let _ = (&()).bar(); //~ ERROR type annotations needed +} diff --git a/src/test/ui/traits/issue-77982.stderr b/src/test/ui/traits/issue-77982.stderr new file mode 100644 index 0000000000000..d788f1871ffac --- /dev/null +++ b/src/test/ui/traits/issue-77982.stderr @@ -0,0 +1,44 @@ +error[E0283]: type annotations needed + --> $DIR/issue-77982.rs:8:10 + | +LL | opts.get(opt.as_ref()); + | ^^^ ------------ this method call resolves to `&T` + | | + | cannot infer type for type parameter `Q` declared on the associated function `get` + | + = note: cannot satisfy `String: Borrow<_>` + +error[E0283]: type annotations needed + --> $DIR/issue-77982.rs:12:44 + | +LL | let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(); + | ^^^^^^^^^ ----------- this method call resolves to `T` + | | + | cannot infer type for type parameter `T` declared on the trait `From` + | + = note: cannot satisfy `u32: From<_>` + = note: required by `from` + +error[E0283]: type annotations needed for `Box` + --> $DIR/issue-77982.rs:35:16 + | +LL | let _ = ().foo(); + | - ^^^ cannot infer type for type parameter `T` declared on the trait `Foo` + | | + | consider giving this pattern the explicit type `Box`, where the type parameter `T` is specified + | + = note: cannot satisfy `(): Foo<'_, _>` + +error[E0283]: type annotations needed for `Box` + --> $DIR/issue-77982.rs:39:19 + | +LL | let _ = (&()).bar(); + | - ^^^ cannot infer type for type parameter `T` declared on the trait `Bar` + | | + | consider giving this pattern the explicit type `Box`, where the type parameter `T` is specified + | + = note: cannot satisfy `&(): Bar<'_, _>` + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0283`. From c146e8c54fa0b99defd1ba77ad4d6505c491f4f3 Mon Sep 17 00:00:00 2001 From: SNCPlay42 Date: Mon, 19 Oct 2020 17:58:44 +0100 Subject: [PATCH 19/22] revert workaround #73027 --- .../src/infer/error_reporting/need_type_info.rs | 17 ++--------------- ...nfer-vars-supply-ty-with-bound-region.stderr | 4 ++-- src/test/ui/issues/issue-23046.rs | 4 ++-- src/test/ui/issues/issue-23046.stderr | 13 ++++--------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index 2f3089f1a92c1..21023a06bb2d9 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -91,17 +91,6 @@ impl<'a, 'tcx> Visitor<'tcx> for FindHirNodeVisitor<'a, 'tcx> { if let (None, Some(ty)) = (self.found_local_pattern, self.node_ty_contains_target(local.hir_id)) { - // FIXME: There's a trade-off here - we can either check that our target span - // is contained in `local.span` or not. If we choose to check containment - // we can avoid some spurious suggestions (see #72690), but we lose - // the ability to report on things like: - // - // ``` - // let x = vec![]; - // ``` - // - // because the target span will be in the macro expansion of `vec![]`. - // At present we choose not to check containment. self.found_local_pattern = Some(&*local.pat); self.found_node_ty = Some(ty); } @@ -113,10 +102,8 @@ impl<'a, 'tcx> Visitor<'tcx> for FindHirNodeVisitor<'a, 'tcx> { if let (None, Some(ty)) = (self.found_arg_pattern, self.node_ty_contains_target(param.hir_id)) { - if self.target_span.contains(param.pat.span) { - self.found_arg_pattern = Some(&*param.pat); - self.found_node_ty = Some(ty); - } + self.found_arg_pattern = Some(&*param.pat); + self.found_node_ty = Some(ty); } } intravisit::walk_body(self, body); diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr index 0c6d11cd3211d..2005bd4dd5ca7 100644 --- a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr +++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed - --> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:8:5 + --> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:8:27 | LL | with_closure(|x: u32, y| {}); - | ^^^^^^^^^^^^ cannot infer type for type parameter `B` declared on the function `with_closure` + | ^ consider giving this closure parameter a type error: aborting due to previous error diff --git a/src/test/ui/issues/issue-23046.rs b/src/test/ui/issues/issue-23046.rs index 75be4a11efd22..a68369616d8b6 100644 --- a/src/test/ui/issues/issue-23046.rs +++ b/src/test/ui/issues/issue-23046.rs @@ -14,7 +14,7 @@ pub fn let_<'var, VAR, F: for<'v> Fn(Expr<'v, VAR>) -> Expr<'v, VAR>> } fn main() { - let ex = |x| { - let_(add(x,x), |y| { //~ ERROR type annotations needed + let ex = |x| { //~ ERROR type annotations needed + let_(add(x,x), |y| { let_(add(x, x), |x|x)})}; } diff --git a/src/test/ui/issues/issue-23046.stderr b/src/test/ui/issues/issue-23046.stderr index 77555fce7c460..12b2eb48e7eaa 100644 --- a/src/test/ui/issues/issue-23046.stderr +++ b/src/test/ui/issues/issue-23046.stderr @@ -1,13 +1,8 @@ -error[E0282]: type annotations needed for the closure `fn(Expr<'_, _>) -> Expr<'_, _>` - --> $DIR/issue-23046.rs:18:9 +error[E0282]: type annotations needed for `Expr<'_, VAR>` + --> $DIR/issue-23046.rs:17:15 | -LL | let_(add(x,x), |y| { - | ^^^^ cannot infer type for type parameter `VAR` declared on the function `let_` - | -help: give this closure an explicit return type without `_` placeholders - | -LL | let_(add(x, x), |x|-> Expr<'_, _> { x })})}; - | ^^^^^^^^^^^^^^^^ ^ +LL | let ex = |x| { + | ^ consider giving this closure parameter the explicit type `Expr<'_, VAR>`, where the type parameter `VAR` is specified error: aborting due to previous error From 66ac5a2d6380778e6ca29924e1c7f8287cb851a9 Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Mon, 19 Oct 2020 23:14:28 +0200 Subject: [PATCH 20/22] Do not ICE on pattern that uses a binding multiple times in generator --- compiler/rustc_typeck/src/check/generator_interior.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/rustc_typeck/src/check/generator_interior.rs b/compiler/rustc_typeck/src/check/generator_interior.rs index 3fc5f02a4a47d..4473aa2081f23 100644 --- a/compiler/rustc_typeck/src/check/generator_interior.rs +++ b/compiler/rustc_typeck/src/check/generator_interior.rs @@ -250,10 +250,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> { let mut scope_var_ids = self.guard_bindings.pop().expect("should have pushed at least one earlier"); for var_id in scope_var_ids.drain(..) { - assert!( - self.guard_bindings_set.remove(&var_id), - "variable should be placed in scope earlier" - ); + self.guard_bindings_set.remove(&var_id); } } self.visit_expr(body); From 334c6c54337b2cfd367f1dd9f696ecacd9369d8d Mon Sep 17 00:00:00 2001 From: LeSeulArtichaut Date: Mon, 19 Oct 2020 23:32:07 +0200 Subject: [PATCH 21/22] Add regression test --- src/test/ui/issues/issue-78115.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/test/ui/issues/issue-78115.rs diff --git a/src/test/ui/issues/issue-78115.rs b/src/test/ui/issues/issue-78115.rs new file mode 100644 index 0000000000000..ac18470c62113 --- /dev/null +++ b/src/test/ui/issues/issue-78115.rs @@ -0,0 +1,19 @@ +// Regression test for issue #78115: "ICE: variable should be placed in scope earlier" + +// check-pass +// edition:2018 + +#[allow(dead_code)] +struct Foo { + a: () +} + +async fn _bar() { + let foo = Foo { a: () }; + match foo { + Foo { a: _a } | Foo { a: _a } if true => {} + _ => {} + } +} + +fn main() {} From 21c29b1e954d494026b07241aa8365837d5ecfdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Tue, 20 Oct 2020 00:00:00 +0000 Subject: [PATCH 22/22] Check that pthread mutex initialization succeeded If pthread mutex initialization fails, the failure will go unnoticed unless debug assertions are enabled. Any subsequent use of mutex will also silently fail, since return values from lock & unlock operations are similarly checked only through debug assertions. In some implementations the mutex initialization requires a memory allocation and so it does fail in practice. Check that initialization succeeds to ensure that mutex guarantees mutual exclusion. --- library/std/src/sys/unix/mod.rs | 4 ++ library/std/src/sys/unix/mutex.rs | 39 +++++++++++-------- .../std/src/sys/unix/process/process_unix.rs | 6 +-- 3 files changed, 27 insertions(+), 22 deletions(-) diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 776f4f18ecfa2..b28c6d85b7c72 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -220,6 +220,10 @@ where } } +pub fn cvt_nz(error: libc::c_int) -> crate::io::Result<()> { + if error == 0 { Ok(()) } else { Err(crate::io::Error::from_raw_os_error(error)) } +} + // On Unix-like platforms, libc::abort will unregister signal handlers // including the SIGABRT handler, preventing the abort from being blocked, and // fclose streams, with the side effect of flushing them so libc buffered diff --git a/library/std/src/sys/unix/mutex.rs b/library/std/src/sys/unix/mutex.rs index ebc737b75ae0b..89c55eb859d09 100644 --- a/library/std/src/sys/unix/mutex.rs +++ b/library/std/src/sys/unix/mutex.rs @@ -1,5 +1,6 @@ use crate::cell::UnsafeCell; use crate::mem::MaybeUninit; +use crate::sys::cvt_nz; pub struct Mutex { inner: UnsafeCell, @@ -51,14 +52,11 @@ impl Mutex { // PTHREAD_MUTEX_NORMAL which is guaranteed to deadlock if we try to // re-lock it from the same thread, thus avoiding undefined behavior. let mut attr = MaybeUninit::::uninit(); - let r = libc::pthread_mutexattr_init(attr.as_mut_ptr()); - debug_assert_eq!(r, 0); - let r = libc::pthread_mutexattr_settype(attr.as_mut_ptr(), libc::PTHREAD_MUTEX_NORMAL); - debug_assert_eq!(r, 0); - let r = libc::pthread_mutex_init(self.inner.get(), attr.as_ptr()); - debug_assert_eq!(r, 0); - let r = libc::pthread_mutexattr_destroy(attr.as_mut_ptr()); - debug_assert_eq!(r, 0); + cvt_nz(libc::pthread_mutexattr_init(attr.as_mut_ptr())).unwrap(); + let attr = PthreadMutexAttr(&mut attr); + cvt_nz(libc::pthread_mutexattr_settype(attr.0.as_mut_ptr(), libc::PTHREAD_MUTEX_NORMAL)) + .unwrap(); + cvt_nz(libc::pthread_mutex_init(self.inner.get(), attr.0.as_ptr())).unwrap(); } #[inline] pub unsafe fn lock(&self) { @@ -106,15 +104,11 @@ impl ReentrantMutex { pub unsafe fn init(&self) { let mut attr = MaybeUninit::::uninit(); - let result = libc::pthread_mutexattr_init(attr.as_mut_ptr()); - debug_assert_eq!(result, 0); - let result = - libc::pthread_mutexattr_settype(attr.as_mut_ptr(), libc::PTHREAD_MUTEX_RECURSIVE); - debug_assert_eq!(result, 0); - let result = libc::pthread_mutex_init(self.inner.get(), attr.as_ptr()); - debug_assert_eq!(result, 0); - let result = libc::pthread_mutexattr_destroy(attr.as_mut_ptr()); - debug_assert_eq!(result, 0); + cvt_nz(libc::pthread_mutexattr_init(attr.as_mut_ptr())).unwrap(); + let attr = PthreadMutexAttr(&mut attr); + cvt_nz(libc::pthread_mutexattr_settype(attr.0.as_mut_ptr(), libc::PTHREAD_MUTEX_RECURSIVE)) + .unwrap(); + cvt_nz(libc::pthread_mutex_init(self.inner.get(), attr.0.as_ptr())).unwrap(); } pub unsafe fn lock(&self) { @@ -137,3 +131,14 @@ impl ReentrantMutex { debug_assert_eq!(result, 0); } } + +struct PthreadMutexAttr<'a>(&'a mut MaybeUninit); + +impl Drop for PthreadMutexAttr<'_> { + fn drop(&mut self) { + unsafe { + let result = libc::pthread_mutexattr_destroy(self.0.as_mut_ptr()); + debug_assert_eq!(result, 0); + } + } +} diff --git a/library/std/src/sys/unix/process/process_unix.rs b/library/std/src/sys/unix/process/process_unix.rs index b05319c89e8f2..a590c74435639 100644 --- a/library/std/src/sys/unix/process/process_unix.rs +++ b/library/std/src/sys/unix/process/process_unix.rs @@ -281,7 +281,7 @@ impl Command { envp: Option<&CStringArray>, ) -> io::Result> { use crate::mem::MaybeUninit; - use crate::sys; + use crate::sys::{self, cvt_nz}; if self.get_gid().is_some() || self.get_uid().is_some() @@ -343,10 +343,6 @@ impl Command { } } - fn cvt_nz(error: libc::c_int) -> io::Result<()> { - if error == 0 { Ok(()) } else { Err(io::Error::from_raw_os_error(error)) } - } - unsafe { let mut attrs = MaybeUninit::uninit(); cvt_nz(libc::posix_spawnattr_init(attrs.as_mut_ptr()))?;