about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-11-19 06:40:38 +0000
committerbors <bors@rust-lang.org>2022-11-19 06:40:38 +0000
commit2f8d8040166a730d0da7bba0f2864f0ef7ff6364 (patch)
treeb3c1cb60370e9195576083b367a68464deebf57d /src
parentbecc24a23aed2639db3b78acd93ec6d553898583 (diff)
parent3cf3a65a719e29bc5aac8a3a3be8a21f3162acf2 (diff)
downloadrust-2f8d8040166a730d0da7bba0f2864f0ef7ff6364.tar.gz
rust-2f8d8040166a730d0da7bba0f2864f0ef7ff6364.zip
Auto merge of #104600 - Dylan-DPC:rollup-glw1e8b, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #104001 (Improve generating Custom entry function)
 - #104411 (nll: correctly deal with bivariance)
 - #104528 (Properly link `{Once,Lazy}{Cell,Lock}` in docs)
 - #104553 (Improve accuracy of asinh and acosh)
 - #104554 (Use `ErrorGuaranteed::unchecked_claim_error_was_emitted` less)
 - #104566 (couple of clippy::perf fixes)
 - #104575 (deduplicate tests)
 - #104580 (diagnostics: only show one suggestion for method -> assoc fn)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/config.rs4
-rw-r--r--src/librustdoc/html/static_files.rs2
-rw-r--r--src/test/ui/coherence/issue-100191-2.rs12
-rw-r--r--src/test/ui/coherence/issue-100191.rs21
-rw-r--r--src/test/ui/issues/issue-52262.rs1
-rw-r--r--src/test/ui/issues/issue-52262.stderr2
-rw-r--r--src/test/ui/mir/important-higher-ranked-regions.rs26
-rw-r--r--src/test/ui/specialization/issue-43037.current.stderr (renamed from src/test/ui/specialization/issue-43037.stderr)2
-rw-r--r--src/test/ui/specialization/issue-43037.negative.stderr (renamed from src/test/ui/coherence/issue-100191.stderr)2
-rw-r--r--src/test/ui/specialization/issue-43037.rs2
-rw-r--r--src/test/ui/specialization/issue-45814.current.stderr (renamed from src/test/ui/specialization/issue-45814.stderr)2
-rw-r--r--src/test/ui/specialization/issue-45814.negative.stderr (renamed from src/test/ui/coherence/issue-100191-2.stderr)4
-rw-r--r--src/test/ui/specialization/issue-45814.rs3
-rw-r--r--src/test/ui/suggestions/issue-102354.stderr13
-rw-r--r--src/tools/miropt-test-tools/src/lib.rs2
15 files changed, 44 insertions, 54 deletions
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 789dd398be5..e0cdb86d9d1 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -418,7 +418,7 @@ impl Options {
             ) {
                 Ok(p) => p,
                 Err(e) => {
-                    diag.struct_err(&e.to_string()).emit();
+                    diag.struct_err(e).emit();
                     return Err(1);
                 }
             };
@@ -561,7 +561,7 @@ impl Options {
             ) {
                 Ok(p) => p,
                 Err(e) => {
-                    diag.struct_err(&e.to_string()).emit();
+                    diag.struct_err(e).emit();
                     return Err(1);
                 }
             };
diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs
index b4d4150cddb..1f87f95563a 100644
--- a/src/librustdoc/html/static_files.rs
+++ b/src/librustdoc/html/static_files.rs
@@ -58,7 +58,7 @@ pub(crate) fn suffix_path(filename: &str, suffix: &str) -> PathBuf {
 }
 
 pub(crate) fn static_filename(filename: &str, contents: &[u8]) -> PathBuf {
-    let filename = filename.rsplit("/").next().unwrap();
+    let filename = filename.rsplit('/').next().unwrap();
     suffix_path(filename, &static_suffix(contents))
 }
 
diff --git a/src/test/ui/coherence/issue-100191-2.rs b/src/test/ui/coherence/issue-100191-2.rs
deleted file mode 100644
index 1c8316f87fa..00000000000
--- a/src/test/ui/coherence/issue-100191-2.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//~ ERROR overflow evaluating the requirement `T: Trait<_>`
-
-#![feature(specialization, with_negative_coherence)]
-#![allow(incomplete_features)]
-
-pub trait Trait<T> {}
-
-default impl<T, U> Trait<T> for U {}
-
-impl<T> Trait<<T as Iterator>::Item> for T {}
-
-fn main() {}
diff --git a/src/test/ui/coherence/issue-100191.rs b/src/test/ui/coherence/issue-100191.rs
deleted file mode 100644
index e8597fde54d..00000000000
--- a/src/test/ui/coherence/issue-100191.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-#![crate_type = "lib"]
-#![feature(specialization, with_negative_coherence)]
-#![allow(incomplete_features)]
-
-trait X {}
-trait Y: X {}
-trait Z {
-    type Assoc: Y;
-}
-struct A<T>(T);
-
-impl<T> Y for T where T: X {}
-impl<T: X> Z for A<T> {
-    type Assoc = T;
-}
-
-// this impl is invalid, but causes an ICE anyway
-impl<T> From<<A<T> as Z>::Assoc> for T {}
-//~^ ERROR type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-
-fn main() {}
diff --git a/src/test/ui/issues/issue-52262.rs b/src/test/ui/issues/issue-52262.rs
index 2195b895557..547643f0d6e 100644
--- a/src/test/ui/issues/issue-52262.rs
+++ b/src/test/ui/issues/issue-52262.rs
@@ -1,4 +1,3 @@
-// compile-flags:-Ztreat-err-as-bug=5
 #[derive(Debug)]
 enum MyError {
     NotFound { key: Vec<u8> },
diff --git a/src/test/ui/issues/issue-52262.stderr b/src/test/ui/issues/issue-52262.stderr
index c0bde4b2321..ef41f078b80 100644
--- a/src/test/ui/issues/issue-52262.stderr
+++ b/src/test/ui/issues/issue-52262.stderr
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of `*key` which is behind a shared reference
-  --> $DIR/issue-52262.rs:16:35
+  --> $DIR/issue-52262.rs:15:35
    |
 LL |                 String::from_utf8(*key).unwrap()
    |                                   ^^^^ move occurs because `*key` has type `Vec<u8>`, which does not implement the `Copy` trait
diff --git a/src/test/ui/mir/important-higher-ranked-regions.rs b/src/test/ui/mir/important-higher-ranked-regions.rs
new file mode 100644
index 00000000000..cadfb3b66f2
--- /dev/null
+++ b/src/test/ui/mir/important-higher-ranked-regions.rs
@@ -0,0 +1,26 @@
+// check-pass
+// compile-flags: -Zvalidate-mir
+
+// This test checks that bivariant parameters are handled correctly
+// in the mir.
+#![allow(coherence_leak_check)]
+trait Trait {
+    type Assoc;
+}
+
+struct Foo<T, U>(T)
+where
+    T: Trait<Assoc = U>;
+
+impl Trait for for<'a> fn(&'a ()) {
+    type Assoc = u32;
+}
+impl Trait for fn(&'static ()) {
+    type Assoc = String;
+}
+
+fn foo(x: Foo<for<'a> fn(&'a ()), u32>) -> Foo<fn(&'static ()), String> {
+    x
+}
+
+fn main() {}
diff --git a/src/test/ui/specialization/issue-43037.stderr b/src/test/ui/specialization/issue-43037.current.stderr
index 4249cd89477..26db9d7c997 100644
--- a/src/test/ui/specialization/issue-43037.stderr
+++ b/src/test/ui/specialization/issue-43037.current.stderr
@@ -1,5 +1,5 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/issue-43037.rs:17:6
+  --> $DIR/issue-43037.rs:19:6
    |
 LL | impl<T> From<<A<T> as Z>::Assoc> for T {}
    |      ^ type parameter `T` must be used as the type parameter for some local type
diff --git a/src/test/ui/coherence/issue-100191.stderr b/src/test/ui/specialization/issue-43037.negative.stderr
index 1adb0f1e4fa..26db9d7c997 100644
--- a/src/test/ui/coherence/issue-100191.stderr
+++ b/src/test/ui/specialization/issue-43037.negative.stderr
@@ -1,5 +1,5 @@
 error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
-  --> $DIR/issue-100191.rs:18:6
+  --> $DIR/issue-43037.rs:19:6
    |
 LL | impl<T> From<<A<T> as Z>::Assoc> for T {}
    |      ^ type parameter `T` must be used as the type parameter for some local type
diff --git a/src/test/ui/specialization/issue-43037.rs b/src/test/ui/specialization/issue-43037.rs
index c49119f9c09..a1e3f998b23 100644
--- a/src/test/ui/specialization/issue-43037.rs
+++ b/src/test/ui/specialization/issue-43037.rs
@@ -1,4 +1,6 @@
+// revisions: current negative
 #![feature(specialization)]
+#![cfg_attr(negative, feature(with_negative_coherence))]
 #![allow(incomplete_features)]
 
 trait X {}
diff --git a/src/test/ui/specialization/issue-45814.stderr b/src/test/ui/specialization/issue-45814.current.stderr
index 419345addc2..5013559b80e 100644
--- a/src/test/ui/specialization/issue-45814.stderr
+++ b/src/test/ui/specialization/issue-45814.current.stderr
@@ -2,7 +2,7 @@ error[E0275]: overflow evaluating the requirement `T: Trait<_>`
    |
    = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_45814`)
 note: required for `T` to implement `Trait<_>`
-  --> $DIR/issue-45814.rs:8:20
+  --> $DIR/issue-45814.rs:9:20
    |
 LL | default impl<T, U> Trait<T> for U {}
    |                    ^^^^^^^^     ^
diff --git a/src/test/ui/coherence/issue-100191-2.stderr b/src/test/ui/specialization/issue-45814.negative.stderr
index d50c220bcfd..5013559b80e 100644
--- a/src/test/ui/coherence/issue-100191-2.stderr
+++ b/src/test/ui/specialization/issue-45814.negative.stderr
@@ -1,8 +1,8 @@
 error[E0275]: overflow evaluating the requirement `T: Trait<_>`
    |
-   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_100191_2`)
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_45814`)
 note: required for `T` to implement `Trait<_>`
-  --> $DIR/issue-100191-2.rs:8:20
+  --> $DIR/issue-45814.rs:9:20
    |
 LL | default impl<T, U> Trait<T> for U {}
    |                    ^^^^^^^^     ^
diff --git a/src/test/ui/specialization/issue-45814.rs b/src/test/ui/specialization/issue-45814.rs
index 8ee5d3e2e58..fce236390c2 100644
--- a/src/test/ui/specialization/issue-45814.rs
+++ b/src/test/ui/specialization/issue-45814.rs
@@ -1,6 +1,7 @@
 //~ ERROR overflow evaluating the requirement `T: Trait<_>`
-
+// revisions: current negative
 #![feature(specialization)]
+#![cfg_attr(negative, feature(with_negative_coherence))]
 #![allow(incomplete_features)]
 
 pub trait Trait<T> {}
diff --git a/src/test/ui/suggestions/issue-102354.stderr b/src/test/ui/suggestions/issue-102354.stderr
index b17c4dc5dfb..08d4b995590 100644
--- a/src/test/ui/suggestions/issue-102354.stderr
+++ b/src/test/ui/suggestions/issue-102354.stderr
@@ -2,7 +2,10 @@ error[E0599]: no method named `func` found for type `i32` in the current scope
   --> $DIR/issue-102354.rs:9:7
    |
 LL |     x.func();
-   |       ^^^^ this is an associated function, not a method
+   |     --^^^^--
+   |     | |
+   |     | this is an associated function, not a method
+   |     help: use associated function syntax instead: `i32::func()`
    |
    = note: found the following associated functions; to be used as methods, functions must have a `self` parameter
 note: the candidate is defined in the trait `Trait`
@@ -10,14 +13,6 @@ note: the candidate is defined in the trait `Trait`
    |
 LL |     fn func() {}
    |     ^^^^^^^^^
-help: use associated function syntax instead
-   |
-LL |     i32::func();
-   |     ~~~~~~~~~~~
-help: disambiguate the associated function for the candidate
-   |
-LL |     <i32 as Trait>::func(x);
-   |     ~~~~~~~~~~~~~~~~~~~~~~~
 
 error: aborting due to previous error
 
diff --git a/src/tools/miropt-test-tools/src/lib.rs b/src/tools/miropt-test-tools/src/lib.rs
index 96819d3547b..cfba7d583b1 100644
--- a/src/tools/miropt-test-tools/src/lib.rs
+++ b/src/tools/miropt-test-tools/src/lib.rs
@@ -11,7 +11,7 @@ pub fn files_for_miropt_test(testfile: &std::path::Path, bit_width: u32) -> Vec<
     let test_file_contents = fs::read_to_string(&testfile).unwrap();
 
     let test_dir = testfile.parent().unwrap();
-    let test_crate = testfile.file_stem().unwrap().to_str().unwrap().replace("-", "_");
+    let test_crate = testfile.file_stem().unwrap().to_str().unwrap().replace('-', "_");
 
     let bit_width = if test_file_contents.lines().any(|l| l == "// EMIT_MIR_FOR_EACH_BIT_WIDTH") {
         format!(".{}bit", bit_width)