about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-13 22:17:46 +0000
committerbors <bors@rust-lang.org>2018-11-13 22:17:46 +0000
commitf1d61837d1cf058cfbd0902b0bf79a2657b81187 (patch)
tree21c9d58f3ee5f7799f5079b0527013712b52e7b9 /src/test
parent9fefb67669f00c25b476e7a80c9c9300a987d517 (diff)
parent7921572acf98d573464eae4aad73112a0d3d6f82 (diff)
downloadrust-f1d61837d1cf058cfbd0902b0bf79a2657b81187.tar.gz
rust-f1d61837d1cf058cfbd0902b0bf79a2657b81187.zip
Auto merge of #55912 - kennytm:rollup, r=kennytm
Rollup of 20 pull requests

Successful merges:

 - #55136 (Remove short doc where it starts with a codeblock)
 - #55711 (Format BtreeMap::range_mut example)
 - #55722 (impl_stable_hash_for: support enums and tuple structs with generic parameters)
 - #55754 (Avoid converting bytes to UTF-8 strings to print, just pass bytes to stdout/err)
 - #55804 (rustdoc: don't inline `pub use some_crate` unless directly asked to)
 - #55805 (Move `static_assert!` into librustc_data_structures)
 - #55837 (Make PhantomData #[structural_match])
 - #55840 (Fix TLS errors when downloading stage0)
 - #55843 (add FromIterator<A> to Box<[A]>)
 - #55858 (Small fixes on code blocks in rustdoc)
 - #55863 (Fix a typo in std::panic)
 - #55870 (Fix typos.)
 - #55874 (string: Add documentation for `From` impls)
 - #55879 (save-analysis: Don't panic for macro-generated use globs)
 - #55882 (Reference count `crate_inherent_impls`s return value.)
 - #55888 (miri: for uniformity, also move memory_deallocated to AllocationExtra)
 - #55889 (global allocators: add a few comments)
 - #55896 (Document optimizations enabled by FusedIterator)
 - #55905 (Change `Lit::short_name` to `Lit::literal_name`.)
 - #55908 (Fix their/there grammar nit)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs2
-rw-r--r--src/test/rustdoc/doc-cfg.rs6
-rw-r--r--src/test/rustdoc/inline_cross/auxiliary/use_crate.rs15
-rw-r--r--src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs11
-rw-r--r--src/test/rustdoc/inline_cross/use_crate.rs37
-rw-r--r--src/test/rustdoc/short-docblock-codeblock.rs22
-rw-r--r--src/test/rustdoc/src-links-external.rs1
-rw-r--r--src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs2
-rw-r--r--src/test/ui/rfc1445/phantom-data-is-structurally-matchable.rs53
9 files changed, 144 insertions, 5 deletions
diff --git a/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs b/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs
index 9fa0b40d49c..e519d48ac1d 100644
--- a/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs
+++ b/src/test/run-pass-fulldeps/dropck_tarena_sound_drop.rs
@@ -31,7 +31,7 @@ struct CheckId<T:HasId> { v: T }
 // In the code below, the impl of HasId for `&'a usize` does not
 // actually access the borrowed data, but the point is that the
 // interface to CheckId does not (and cannot) know that, and therefore
-// when encountering the a value V of type CheckId<S>, we must
+// when encountering a value V of type CheckId<S>, we must
 // conservatively force the type S to strictly outlive V.
 impl<T:HasId> Drop for CheckId<T> {
     fn drop(&mut self) {
diff --git a/src/test/rustdoc/doc-cfg.rs b/src/test/rustdoc/doc-cfg.rs
index 27077ed4f1a..f82dafa2517 100644
--- a/src/test/rustdoc/doc-cfg.rs
+++ b/src/test/rustdoc/doc-cfg.rs
@@ -20,8 +20,8 @@ pub struct Portable;
 // @has doc_cfg/unix_only/index.html \
 //  '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
 //  'This is supported on Unix only.'
-// @matches - '//*[@class=" module-item"]//*[@class="stab portability"]' '\AUnix\Z'
-// @matches - '//*[@class=" module-item"]//*[@class="stab portability"]' '\AUnix and ARM\Z'
+// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AUnix\Z'
+// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\AUnix and ARM\Z'
 // @count - '//*[@class="stab portability"]' 3
 #[doc(cfg(unix))]
 pub mod unix_only {
@@ -52,7 +52,7 @@ pub mod unix_only {
 
 // the portability header is different on the module view versus the full view
 // @has doc_cfg/index.html
-// @matches - '//*[@class=" module-item"]//*[@class="stab portability"]' '\Aavx\Z'
+// @matches - '//*[@class="module-item"]//*[@class="stab portability"]' '\Aavx\Z'
 
 // @has doc_cfg/fn.uses_target_feature.html
 // @has - '//*[@id="main"]/*[@class="stability"]/*[@class="stab portability"]' \
diff --git a/src/test/rustdoc/inline_cross/auxiliary/use_crate.rs b/src/test/rustdoc/inline_cross/auxiliary/use_crate.rs
new file mode 100644
index 00000000000..55202de1981
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/auxiliary/use_crate.rs
@@ -0,0 +1,15 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub mod asdf {
+    pub struct SomeStruct;
+}
+
+pub trait SomeTrait {}
diff --git a/src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs b/src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs
new file mode 100644
index 00000000000..1f11cbc4da7
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/auxiliary/use_crate_2.rs
@@ -0,0 +1,11 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+pub struct SomethingElse;
diff --git a/src/test/rustdoc/inline_cross/use_crate.rs b/src/test/rustdoc/inline_cross/use_crate.rs
new file mode 100644
index 00000000000..a98704446ee
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/use_crate.rs
@@ -0,0 +1,37 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:use_crate.rs
+// aux-build:use_crate_2.rs
+// build-aux-docs
+// edition:2018
+// compile-flags:--extern use_crate --extern use_crate_2 -Z unstable-options
+
+// During the buildup to Rust 2018, rustdoc would eagerly inline `pub use some_crate;` as if it
+// were a module, so we changed it to make `pub use`ing crate roots remain as a `pub use` statement
+// in docs... unless you added `#[doc(inline)]`.
+
+#![crate_name = "local"]
+
+// @!has-dir local/use_crate
+// @has local/index.html
+// @has - '//code' 'pub use use_crate'
+pub use use_crate;
+
+// @has-dir local/asdf
+// @has local/asdf/index.html
+// @has local/index.html '//a/@href' 'asdf/index.html'
+pub use use_crate::asdf;
+
+// @has-dir local/use_crate_2
+// @has local/use_crate_2/index.html
+// @has local/index.html '//a/@href' 'use_crate_2/index.html'
+#[doc(inline)]
+pub use use_crate_2;
diff --git a/src/test/rustdoc/short-docblock-codeblock.rs b/src/test/rustdoc/short-docblock-codeblock.rs
new file mode 100644
index 00000000000..060b349c251
--- /dev/null
+++ b/src/test/rustdoc/short-docblock-codeblock.rs
@@ -0,0 +1,22 @@
+// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![crate_name = "foo"]
+
+// @has foo/index.html '//*[@class="module-item"]//td[@class="docblock-short"]' ""
+// @!has foo/index.html '//*[@id="module-item"]//td[@class="docblock-short"]' "Some text."
+// @!has foo/index.html '//*[@id="module-item"]//td[@class="docblock-short"]' "let x = 12;"
+
+/// ```
+/// let x = 12;
+/// ```
+///
+/// Some text.
+pub fn foo() {}
diff --git a/src/test/rustdoc/src-links-external.rs b/src/test/rustdoc/src-links-external.rs
index d3307bb4d42..6cc7f1743ad 100644
--- a/src/test/rustdoc/src-links-external.rs
+++ b/src/test/rustdoc/src-links-external.rs
@@ -18,6 +18,7 @@
 extern crate src_links_external;
 
 // @has foo/bar/index.html '//a/@href' '../../src/src_links_external/src-links-external.rs.html#11'
+#[doc(inline)]
 pub use src_links_external as bar;
 
 // @has foo/bar/struct.Foo.html '//a/@href' '../../src/src_links_external/src-links-external.rs.html#11'
diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs
index 5bb8bb024ed..c23b43dfff7 100644
--- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs
+++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs
@@ -13,7 +13,7 @@
 // not descend further into the mod for other occurrences of the same
 // error.
 //
-// This file sits on its own because the the "weird" occurrences here
+// This file sits on its own because the "weird" occurrences here
 // signal errors, making it incompatible with the "warnings only"
 // nature of issue-43106-gating-of-builtin-attrs.rs
 
diff --git a/src/test/ui/rfc1445/phantom-data-is-structurally-matchable.rs b/src/test/ui/rfc1445/phantom-data-is-structurally-matchable.rs
new file mode 100644
index 00000000000..af025b9bbbf
--- /dev/null
+++ b/src/test/ui/rfc1445/phantom-data-is-structurally-matchable.rs
@@ -0,0 +1,53 @@
+// run-pass
+
+// This file checks that `PhantomData` is considered structurally matchable.
+
+use std::marker::PhantomData;
+
+fn main() {
+    let mut count = 0;
+
+    // A type which is not structurally matchable:
+    struct NotSM;
+
+    // And one that is:
+    #[derive(PartialEq, Eq)]
+    struct SM;
+
+    // Check that SM is #[structural_match]:
+    const CSM: SM = SM;
+    match SM {
+        CSM => count += 1,
+    };
+
+    // Check that PhantomData<T> is #[structural_match] even if T is not.
+    const CPD1: PhantomData<NotSM> = PhantomData;
+    match PhantomData {
+        CPD1 => count += 1,
+    };
+
+    // Check that PhantomData<T> is #[structural_match] when T is.
+    const CPD2: PhantomData<SM> = PhantomData;
+    match PhantomData {
+        CPD2 => count += 1,
+    };
+
+    // Check that a type which has a PhantomData is `#[structural_match]`.
+    #[derive(PartialEq, Eq, Default)]
+    struct Foo {
+        alpha: PhantomData<NotSM>,
+        beta: PhantomData<SM>,
+    }
+
+    const CFOO: Foo = Foo {
+        alpha: PhantomData,
+        beta: PhantomData,
+    };
+
+    match Foo::default() {
+        CFOO => count += 1,
+    };
+
+    // Final count must be 4 now if all
+    assert_eq!(count, 4);
+}