about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-27 18:02:10 +0000
committerbors <bors@rust-lang.org>2023-02-27 18:02:10 +0000
commit7281249a19a9755e9d889ee251ec323629caadab (patch)
treecd760c33b0d2a3b6f12923fdb2e02b96a2732b3c /tests
parentf540a25745e03cfe9eac7e3a5e5489d36e4ad58a (diff)
parenta184150247298c98edd445d241ef487e197c91a9 (diff)
downloadrust-7281249a19a9755e9d889ee251ec323629caadab.tar.gz
rust-7281249a19a9755e9d889ee251ec323629caadab.zip
Auto merge of #108538 - matthiaskrgr:rollup-vw6h5ea, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #104265 (Move IpAddr, SocketAddr and V4+V6 related types to `core`)
 - #107110 ([stdio][windows] Use MBTWC and WCTMB)
 - #108308 (Allow building serde and serde_derive in parallel)
 - #108363 (Move the unused extern crate check back to the resolver.)
 - #108519 (Bages for easy access links to Rust community)
 - #108522 (Commit some new solver tests)
 - #108523 (Avoid `&str` to `String` conversions)
 - #108533 (diagnostics: avoid querying `associated_item` in the resolver)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/resolve/issue-108529.rs8
-rw-r--r--tests/ui/resolve/issue-108529.stderr9
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.fixed10
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.rs10
-rw-r--r--tests/ui/rust-2018/remove-extern-crate.stderr22
-rw-r--r--tests/ui/traits/issue-77982.stderr2
-rw-r--r--tests/ui/traits/new-solver/try-example.rs28
-rw-r--r--tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs24
-rw-r--r--tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr14
9 files changed, 123 insertions, 4 deletions
diff --git a/tests/ui/resolve/issue-108529.rs b/tests/ui/resolve/issue-108529.rs
new file mode 100644
index 00000000000..8e3aafab6aa
--- /dev/null
+++ b/tests/ui/resolve/issue-108529.rs
@@ -0,0 +1,8 @@
+#![allow(nonstandard_style)]
+use f::f::f; //~ ERROR
+
+trait f {
+    extern "C" fn f();
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/issue-108529.stderr b/tests/ui/resolve/issue-108529.stderr
new file mode 100644
index 00000000000..cf4e4759c37
--- /dev/null
+++ b/tests/ui/resolve/issue-108529.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `f::f`
+  --> $DIR/issue-108529.rs:2:8
+   |
+LL | use f::f::f;
+   |        ^ expected type, found associated function `f` in `f`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/rust-2018/remove-extern-crate.fixed b/tests/ui/rust-2018/remove-extern-crate.fixed
index 832632268fb..15e0ccc5256 100644
--- a/tests/ui/rust-2018/remove-extern-crate.fixed
+++ b/tests/ui/rust-2018/remove-extern-crate.fixed
@@ -23,6 +23,7 @@ extern crate alloc;
 fn main() {
     another_name::mem::drop(3);
     another::foo();
+    with_visibility::foo();
     remove_extern_crate::foo!();
     bar!();
     alloc::vec![5];
@@ -37,3 +38,12 @@ mod another {
         remove_extern_crate::foo!();
     }
 }
+
+mod with_visibility {
+    pub use core; //~ WARNING `extern crate` is not idiomatic
+
+    pub fn foo() {
+        core::mem::drop(4);
+        remove_extern_crate::foo!();
+    }
+}
diff --git a/tests/ui/rust-2018/remove-extern-crate.rs b/tests/ui/rust-2018/remove-extern-crate.rs
index bbb84cd462d..aec0bc7c374 100644
--- a/tests/ui/rust-2018/remove-extern-crate.rs
+++ b/tests/ui/rust-2018/remove-extern-crate.rs
@@ -23,6 +23,7 @@ extern crate alloc;
 fn main() {
     another_name::mem::drop(3);
     another::foo();
+    with_visibility::foo();
     remove_extern_crate::foo!();
     bar!();
     alloc::vec![5];
@@ -37,3 +38,12 @@ mod another {
         remove_extern_crate::foo!();
     }
 }
+
+mod with_visibility {
+    pub extern crate core; //~ WARNING `extern crate` is not idiomatic
+
+    pub fn foo() {
+        core::mem::drop(4);
+        remove_extern_crate::foo!();
+    }
+}
diff --git a/tests/ui/rust-2018/remove-extern-crate.stderr b/tests/ui/rust-2018/remove-extern-crate.stderr
index bde4c180811..d07358e471b 100644
--- a/tests/ui/rust-2018/remove-extern-crate.stderr
+++ b/tests/ui/rust-2018/remove-extern-crate.stderr
@@ -12,10 +12,26 @@ LL | #![warn(rust_2018_idioms)]
    = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
 
 warning: `extern crate` is not idiomatic in the new edition
-  --> $DIR/remove-extern-crate.rs:32:5
+  --> $DIR/remove-extern-crate.rs:33:5
    |
 LL |     extern crate core;
-   |     ^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
+   |     ^^^^^^^^^^^^^^^^^^
+   |
+help: convert it to a `use`
+   |
+LL |     use core;
+   |     ~~~
+
+warning: `extern crate` is not idiomatic in the new edition
+  --> $DIR/remove-extern-crate.rs:43:5
+   |
+LL |     pub extern crate core;
+   |     ^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: convert it to a `use`
+   |
+LL |     pub use core;
+   |         ~~~
 
-warning: 2 warnings emitted
+warning: 3 warnings emitted
 
diff --git a/tests/ui/traits/issue-77982.stderr b/tests/ui/traits/issue-77982.stderr
index a397b0accc8..d4fea05fe4b 100644
--- a/tests/ui/traits/issue-77982.stderr
+++ b/tests/ui/traits/issue-77982.stderr
@@ -43,7 +43,7 @@ LL |     let ips: Vec<_> = (0..100_000).map(|_| u32::from(0u32.into())).collect(
    |                                            |
    |                                            required by a bound introduced by this call
    |
-   = note: multiple `impl`s satisfying `u32: From<_>` found in the following crates: `core`, `std`:
+   = note: multiple `impl`s satisfying `u32: From<_>` found in the `core` crate:
            - impl From<Ipv4Addr> for u32;
            - impl From<NonZeroU32> for u32;
            - impl From<bool> for u32;
diff --git a/tests/ui/traits/new-solver/try-example.rs b/tests/ui/traits/new-solver/try-example.rs
new file mode 100644
index 00000000000..e826f3a0059
--- /dev/null
+++ b/tests/ui/traits/new-solver/try-example.rs
@@ -0,0 +1,28 @@
+// check-pass
+// compile-flags: -Ztrait-solver=next
+
+use std::error::Error;
+
+fn main() -> Result<(), Box<dyn Error>> {
+    let x: i32 = parse()?;
+    Ok(())
+}
+
+trait Parse {}
+
+impl Parse for i32 {}
+
+#[derive(Debug)]
+struct ParseError;
+
+impl std::fmt::Display for ParseError {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        write!(f, "ParseError")
+    }
+}
+
+impl Error for ParseError {}
+
+fn parse<T: Parse>() -> Result<T, ParseError> {
+    todo!()
+}
diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs
new file mode 100644
index 00000000000..019c6e81c50
--- /dev/null
+++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.rs
@@ -0,0 +1,24 @@
+// compile-flags: -Ztrait-solver=next
+// known-bug: unknown
+
+trait Test {
+    type Assoc;
+}
+
+fn transform<T: Test>(x: T) -> T::Assoc {
+    todo!()
+}
+
+impl Test for i32 {
+    type Assoc = i32;
+}
+
+impl Test for String {
+    type Assoc = String;
+}
+
+fn main() {
+    let mut x = Default::default();
+    x = transform(x);
+    x = 1i32;
+}
diff --git a/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr
new file mode 100644
index 00000000000..57cbc65a17a
--- /dev/null
+++ b/tests/ui/typeck/lazy-norm/equating-projection-cyclically.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+  --> $DIR/equating-projection-cyclically.rs:22:19
+   |
+LL |     x = transform(x);
+   |                   ^ expected inferred type, found associated type
+   |
+   = note:         expected type `_`
+           found associated type `<_ as Test>::Assoc`
+   = help: consider constraining the associated type `<_ as Test>::Assoc` to `_`
+   = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.