about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-04-09 14:48:05 +0000
committerbors <bors@rust-lang.org>2025-04-09 14:48:05 +0000
commit48f89e7659678f91a68c0c2d868180a0036ab32d (patch)
treefd5e5fb7e10f18ac69d39d81da5ecb3240b14baf /tests/ui
parentf06e5c1e35bc5bc6131c6f8a0eb782097e3f28c3 (diff)
parent1aa6f70e3e9bf24cb45ae6f87e3b11fc51b1a9e7 (diff)
downloadrust-48f89e7659678f91a68c0c2d868180a0036ab32d.tar.gz
rust-48f89e7659678f91a68c0c2d868180a0036ab32d.zip
Auto merge of #139581 - matthiaskrgr:rollup-d6hph16, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #138869 (Try not to use verbatim paths in `Command::current_dir`)
 - #138993 (Make `cfg_match!` a semitransparent macro)
 - #139099 (Promise `array::from_fn` is generated in order of increasing indices)
 - #139364 (Make the compiler suggest actual paths instead of visible paths if the visible paths are through any doc hidden path.)
 - #139468 (Don't call `Span::with_parent` on the good path in `has_stashed_diagnostic`)
 - #139481 (Add job summary links to post-merge report)
 - #139573 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/process/win-command-curdir-no-verbatim.rs36
-rw-r--r--tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-a.rs5
-rw-r--r--tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-b.rs14
-rw-r--r--tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs11
-rw-r--r--tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr15
5 files changed, 81 insertions, 0 deletions
diff --git a/tests/ui/process/win-command-curdir-no-verbatim.rs b/tests/ui/process/win-command-curdir-no-verbatim.rs
new file mode 100644
index 00000000000..99943e1c8ab
--- /dev/null
+++ b/tests/ui/process/win-command-curdir-no-verbatim.rs
@@ -0,0 +1,36 @@
+// Test that windows verbatim paths in `Command::current_dir` are converted to
+// non-verbatim paths before passing to the subprocess.
+
+//@ run-pass
+//@ only-windows
+//@ needs-subprocess
+
+use std::env;
+use std::process::Command;
+
+fn main() {
+    if env::args().skip(1).any(|s| s == "--child") {
+        child();
+    } else {
+        parent();
+    }
+}
+
+fn parent() {
+    let exe = env::current_exe().unwrap();
+    let dir = env::current_dir().unwrap();
+    let status = Command::new(&exe)
+        .arg("--child")
+        .current_dir(dir.canonicalize().unwrap())
+        .spawn()
+        .unwrap()
+        .wait()
+        .unwrap();
+    assert_eq!(status.code(), Some(0));
+}
+
+fn child() {
+    let current_dir = env::current_dir().unwrap();
+    let current_dir = current_dir.as_os_str().as_encoded_bytes();
+    assert!(!current_dir.starts_with(br"\\?\"));
+}
diff --git a/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-a.rs b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-a.rs
new file mode 100644
index 00000000000..87d83663626
--- /dev/null
+++ b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-a.rs
@@ -0,0 +1,5 @@
+//@ edition: 2021
+
+pub trait Foo {
+    fn foo();
+}
diff --git a/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-b.rs b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-b.rs
new file mode 100644
index 00000000000..9e90e0f0b35
--- /dev/null
+++ b/tests/ui/typeck/auxiliary/suggest-trait-reexported-as-not-doc-visible-b.rs
@@ -0,0 +1,14 @@
+// ignore-tidy-linelength
+//@ edition: 2021
+//@ aux-crate:suggest_trait_reexported_as_not_doc_visible_a=suggest-trait-reexported-as-not-doc-visible-a.rs
+
+pub struct Bar;
+
+impl __DocHidden::Foo for Bar {
+    fn foo() {}
+}
+
+#[doc(hidden)]
+pub mod __DocHidden {
+    pub use suggest_trait_reexported_as_not_doc_visible_a::Foo;
+}
diff --git a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs
new file mode 100644
index 00000000000..3cb775e85ac
--- /dev/null
+++ b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs
@@ -0,0 +1,11 @@
+// ignore-tidy-linelength
+//@ edition: 2021
+//@ aux-crate:suggest_trait_reexported_as_not_doc_visible_a=suggest-trait-reexported-as-not-doc-visible-a.rs
+//@ aux-crate:suggest_trait_reexported_as_not_doc_visible_b=suggest-trait-reexported-as-not-doc-visible-b.rs
+
+use suggest_trait_reexported_as_not_doc_visible_b::Bar;
+
+fn main() {
+    Bar::foo();
+    //~^ ERROR: no function or associated item named `foo` found for struct `Bar` in the current scope [E0599]
+}
diff --git a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr
new file mode 100644
index 00000000000..9128ee68444
--- /dev/null
+++ b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr
@@ -0,0 +1,15 @@
+error[E0599]: no function or associated item named `foo` found for struct `Bar` in the current scope
+  --> $DIR/suggest-trait-reexported-as-not-doc-visible.rs:9:10
+   |
+LL |     Bar::foo();
+   |          ^^^ function or associated item not found in `Bar`
+   |
+   = help: items from traits can only be used if the trait is in scope
+help: trait `Foo` which provides `foo` is implemented but not in scope; perhaps you want to import it
+   |
+LL + use suggest_trait_reexported_as_not_doc_visible_a::Foo;
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0599`.