about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-01 14:44:20 +0000
committerbors <bors@rust-lang.org>2022-06-01 14:44:20 +0000
commit8256e97231332ef49bd47a74b1809e785ecc78df (patch)
tree65a1388d9fd21c48e6549dc3d6c0367aac4fe577 /src/test
parent395a09c3dafe0c7838c9ca41d2b47bb5e79a5b6d (diff)
parent85fdef087c889846644192553dc6f4ebaf7b4494 (diff)
downloadrust-8256e97231332ef49bd47a74b1809e785ecc78df.tar.gz
rust-8256e97231332ef49bd47a74b1809e785ecc78df.zip
Auto merge of #97622 - JohnTitor:rollup-4qoxrjn, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #94647 (Expose `get_many_mut` and `get_many_unchecked_mut` to HashMap)
 - #97216 (Ensure we never consider the null pointer dereferencable)
 - #97399 (simplify code of finding arg index in `opt_const_param_of`)
 - #97470 (rustdoc: add more test coverage)
 - #97498 (Corrected EBNF grammar for from_str)
 - #97562 (Fix comment in `poly_project_and_unify_type`)
 - #97580 (Add regression test for #71546)
 - #97611 (Tweak insert docs)
 - #97616 (Remove an unnecessary `Option`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/inline_cross/auxiliary/implementors_inline.rs18
-rw-r--r--src/test/rustdoc/inline_cross/implementors-js.rs25
-rw-r--r--src/test/rustdoc/intra-doc/email-address.rs6
-rw-r--r--src/test/ui/borrowck/issue-71546.rs19
-rw-r--r--src/test/ui/borrowck/issue-71546.stderr20
5 files changed, 86 insertions, 2 deletions
diff --git a/src/test/rustdoc/inline_cross/auxiliary/implementors_inline.rs b/src/test/rustdoc/inline_cross/auxiliary/implementors_inline.rs
new file mode 100644
index 00000000000..b003fb357d0
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/auxiliary/implementors_inline.rs
@@ -0,0 +1,18 @@
+pub mod my_trait {
+    pub trait MyTrait {
+        fn my_fn(&self) -> Self;
+    }
+}
+
+pub mod prelude {
+    #[doc(inline)]
+    pub use crate::my_trait::MyTrait;
+}
+
+pub struct SomeStruct;
+
+impl my_trait::MyTrait for SomeStruct {
+    fn my_fn(&self) -> SomeStruct {
+        SomeStruct
+    }
+}
diff --git a/src/test/rustdoc/inline_cross/implementors-js.rs b/src/test/rustdoc/inline_cross/implementors-js.rs
new file mode 100644
index 00000000000..c79f05d8d3c
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/implementors-js.rs
@@ -0,0 +1,25 @@
+// aux-build:implementors_inline.rs
+// build-aux-docs
+// ignore-cross-compile
+
+extern crate implementors_inline;
+
+// @!has implementors/implementors_js/trait.MyTrait.js
+// @has implementors/implementors_inline/my_trait/trait.MyTrait.js
+// @!has implementors/implementors_inline/prelude/trait.MyTrait.js
+// @has implementors_inline/my_trait/trait.MyTrait.html
+// @has - '//script/@src' '../../implementors/implementors_inline/my_trait/trait.MyTrait.js'
+// @has implementors_js/trait.MyTrait.html
+// @has - '//script/@src' '../implementors/implementors_inline/my_trait/trait.MyTrait.js'
+/// When re-exporting this trait, the HTML will be inlined,
+/// but, vitally, the JavaScript will be located only at the
+/// one canonical path.
+pub use implementors_inline::prelude::MyTrait;
+
+pub struct OtherStruct;
+
+impl MyTrait for OtherStruct {
+    fn my_fn(&self) -> OtherStruct {
+        OtherStruct
+    }
+}
diff --git a/src/test/rustdoc/intra-doc/email-address.rs b/src/test/rustdoc/intra-doc/email-address.rs
index ae74fbbc892..24161c3bb48 100644
--- a/src/test/rustdoc/intra-doc/email-address.rs
+++ b/src/test/rustdoc/intra-doc/email-address.rs
@@ -1,8 +1,10 @@
-#![allow(rustdoc::broken_intra_doc_links)]
+#![forbid(rustdoc::broken_intra_doc_links)]
 
 //! Email me at <hello@example.com>.
 //! Email me at <hello-world@example.com>.
-//! Email me at <hello@localhost> (this warns but will still become a link).
+//! Email me at <hello@localhost>.
+//! Email me at <prim@i32>.
 // @has email_address/index.html '//a[@href="mailto:hello@example.com"]' 'hello@example.com'
 // @has email_address/index.html '//a[@href="mailto:hello-world@example.com"]' 'hello-world@example.com'
 // @has email_address/index.html '//a[@href="mailto:hello@localhost"]' 'hello@localhost'
+// @has email_address/index.html '//a[@href="mailto:prim@i32"]' 'prim@i32'
diff --git a/src/test/ui/borrowck/issue-71546.rs b/src/test/ui/borrowck/issue-71546.rs
new file mode 100644
index 00000000000..943f7f86e55
--- /dev/null
+++ b/src/test/ui/borrowck/issue-71546.rs
@@ -0,0 +1,19 @@
+// Regression test for #71546.
+
+// ignore-compare-mode-nll
+// NLL stderr is different from the original one.
+
+pub fn serialize_as_csv<V>(value: &V) -> Result<String, &str>
+where
+    V: 'static,
+    for<'a> &'a V: IntoIterator,
+    for<'a> <&'a V as IntoIterator>::Item: ToString + 'static,
+{
+    let csv_str: String = value //~ ERROR: the associated type `<&'a V as IntoIterator>::Item` may not live long enough
+        .into_iter()
+        .map(|elem| elem.to_string())
+        .collect::<String>();
+    Ok(csv_str)
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/issue-71546.stderr b/src/test/ui/borrowck/issue-71546.stderr
new file mode 100644
index 00000000000..d479ca8f1d8
--- /dev/null
+++ b/src/test/ui/borrowck/issue-71546.stderr
@@ -0,0 +1,20 @@
+error[E0310]: the associated type `<&'a V as IntoIterator>::Item` may not live long enough
+  --> $DIR/issue-71546.rs:12:27
+   |
+LL |       let csv_str: String = value
+   |  ___________________________^
+LL | |         .into_iter()
+LL | |         .map(|elem| elem.to_string())
+   | |_____________________________________^
+   |
+   = help: consider adding an explicit lifetime bound `<&'a V as IntoIterator>::Item: 'static`...
+   = note: ...so that the type `<&'a V as IntoIterator>::Item` will meet its required lifetime bounds...
+note: ...that is required by this bound
+  --> $DIR/issue-71546.rs:10:55
+   |
+LL |     for<'a> <&'a V as IntoIterator>::Item: ToString + 'static,
+   |                                                       ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.