about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-12-10 21:59:07 +0000
committerbors <bors@rust-lang.org>2021-12-10 21:59:07 +0000
commitf0448f44bcda55fd9eb71da82495ef648eedb4e4 (patch)
treed7157697f5cdcd6bf59adb15521427a212f0dbce /src/test
parent0b42deaccc2cbe17a68067aa5fdb76104369e1fd (diff)
parent1fca934898354160b46c17c58b67707a2dcb8988 (diff)
downloadrust-f0448f44bcda55fd9eb71da82495ef648eedb4e4.tar.gz
rust-f0448f44bcda55fd9eb71da82495ef648eedb4e4.zip
Auto merge of #91760 - matthiaskrgr:rollup-zcemh6j, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - #90407 (Document all public items in `rustc_incremental`)
 - #90897 (Fix incorrect stability attributes)
 - #91105 (Fix method name reference in stream documentation)
 - #91325 (adjust const_eval_select documentation)
 - #91470 (code-cov: generate dead functions with private/default linkage)
 - #91482 (Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s)
 - #91524 (Fix Vec::extend_from_slice docs)
 - #91575 (Fix ICE on format string of macro with secondary-label)
 - #91625 (Remove redundant [..]s)
 - #91646 (Fix documentation for `core::ready::Ready`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-85461.txt36
-rw-r--r--src/test/run-make-fulldeps/coverage/issue-85461.rs10
-rw-r--r--src/test/run-make-fulldeps/coverage/lib/inline_always_with_dead_code.rs22
-rw-r--r--src/test/ui/fmt/issue-91556.rs8
-rw-r--r--src/test/ui/fmt/issue-91556.stderr11
-rw-r--r--src/test/ui/issues/issue-85461.rs27
6 files changed, 114 insertions, 0 deletions
diff --git a/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-85461.txt b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-85461.txt
new file mode 100644
index 00000000000..2831e9b532a
--- /dev/null
+++ b/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.issue-85461.txt
@@ -0,0 +1,36 @@
+../coverage/issue-85461.rs:
+    1|       |// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
+    2|       |
+    3|       |extern crate inline_always_with_dead_code;
+    4|       |
+    5|       |use inline_always_with_dead_code::{bar, baz};
+    6|       |
+    7|      1|fn main() {
+    8|      1|    bar::call_me();
+    9|      1|    baz::call_me();
+   10|      1|}
+
+../coverage/lib/inline_always_with_dead_code.rs:
+    1|       |// compile-flags: -Zinstrument-coverage -Ccodegen-units=4 -Copt-level=0
+    2|       |
+    3|       |#![allow(dead_code)]
+    4|       |
+    5|       |mod foo {
+    6|       |    #[inline(always)]
+    7|      2|    pub fn called() { }
+    8|       |
+    9|      0|    fn uncalled() { }
+   10|       |}
+   11|       |
+   12|       |pub mod bar {
+   13|      1|    pub fn call_me() {
+   14|      1|        super::foo::called();
+   15|      1|    }
+   16|       |}
+   17|       |
+   18|       |pub mod baz {
+   19|      1|    pub fn call_me() {
+   20|      1|        super::foo::called();
+   21|      1|    }
+   22|       |}
+
diff --git a/src/test/run-make-fulldeps/coverage/issue-85461.rs b/src/test/run-make-fulldeps/coverage/issue-85461.rs
new file mode 100644
index 00000000000..a1b9ebb1ed3
--- /dev/null
+++ b/src/test/run-make-fulldeps/coverage/issue-85461.rs
@@ -0,0 +1,10 @@
+// Regression test for #85461: MSVC sometimes fail to link with dead code and #[inline(always)]
+
+extern crate inline_always_with_dead_code;
+
+use inline_always_with_dead_code::{bar, baz};
+
+fn main() {
+    bar::call_me();
+    baz::call_me();
+}
diff --git a/src/test/run-make-fulldeps/coverage/lib/inline_always_with_dead_code.rs b/src/test/run-make-fulldeps/coverage/lib/inline_always_with_dead_code.rs
new file mode 100644
index 00000000000..b567916aea0
--- /dev/null
+++ b/src/test/run-make-fulldeps/coverage/lib/inline_always_with_dead_code.rs
@@ -0,0 +1,22 @@
+// compile-flags: -Zinstrument-coverage -Ccodegen-units=4 -Copt-level=0
+
+#![allow(dead_code)]
+
+mod foo {
+    #[inline(always)]
+    pub fn called() { }
+
+    fn uncalled() { }
+}
+
+pub mod bar {
+    pub fn call_me() {
+        super::foo::called();
+    }
+}
+
+pub mod baz {
+    pub fn call_me() {
+        super::foo::called();
+    }
+}
diff --git a/src/test/ui/fmt/issue-91556.rs b/src/test/ui/fmt/issue-91556.rs
new file mode 100644
index 00000000000..e782e6f9076
--- /dev/null
+++ b/src/test/ui/fmt/issue-91556.rs
@@ -0,0 +1,8 @@
+fn main() {
+  let _ = format!(concat!("{0}π–³π–Ύπ—Œπ—{"), i);
+  //~^ ERROR: invalid format string: expected `'}'` but string was terminated
+  //~| NOTE: if you intended to print `{`, you can escape it using `{{`
+  //~| NOTE: in this expansion of concat!
+  //~| NOTE: in this expansion of concat!
+  //~| NOTE: expected `'}'` in format string
+}
diff --git a/src/test/ui/fmt/issue-91556.stderr b/src/test/ui/fmt/issue-91556.stderr
new file mode 100644
index 00000000000..dbd5aef458b
--- /dev/null
+++ b/src/test/ui/fmt/issue-91556.stderr
@@ -0,0 +1,11 @@
+error: invalid format string: expected `'}'` but string was terminated
+  --> $DIR/issue-91556.rs:2:19
+   |
+LL |   let _ = format!(concat!("{0}π–³π–Ύπ—Œπ—{"), i);
+   |                   ^^^^^^^^^^^^^^^^^^^ expected `'}'` in format string
+   |
+   = note: if you intended to print `{`, you can escape it using `{{`
+   = note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issues/issue-85461.rs b/src/test/ui/issues/issue-85461.rs
new file mode 100644
index 00000000000..4c6c83f2612
--- /dev/null
+++ b/src/test/ui/issues/issue-85461.rs
@@ -0,0 +1,27 @@
+// compile-flags: -Zinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0
+// build-pass
+// needs-profiler-support
+
+// Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries
+// with dead code and #[inline(always)].
+
+#![allow(dead_code)]
+
+mod foo {
+    #[inline(always)]
+    pub fn called() { }
+
+    fn uncalled() { }
+}
+
+pub mod bar {
+    pub fn call_me() {
+        super::foo::called();
+    }
+}
+
+pub mod baz {
+    pub fn call_me() {
+        super::foo::called();
+    }
+}