about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-11-13 19:16:18 +0000
committerbors <bors@rust-lang.org>2018-11-13 19:16:18 +0000
commit9fefb67669f00c25b476e7a80c9c9300a987d517 (patch)
treeac52853cd239af068c447b627a9c4836d0ca4321 /src/test
parent5c9f7dcd8307f92931bc7e5534b467063b4ecc76 (diff)
parent56acb2a00180c1e041e03e48c1c1818c305e13c6 (diff)
downloadrust-9fefb67669f00c25b476e7a80c9c9300a987d517.tar.gz
rust-9fefb67669f00c25b476e7a80c9c9300a987d517.zip
Auto merge of #55356 - Aaron1011:fix/rustdoc-negative-auto, r=nikomatsakis
Check for negative impls when finding auto traits

Fixes #55321

When AutoTraitFinder begins examining a type, it checks for an explicit
negative impl. However, it wasn't checking for negative impls found when
calling 'select' on predicates found from nested obligations.

This commit makes AutoTraitFinder check for negative impls whenever it
makes a call to 'select'. If a negative impl is found, it immediately
bails out.

Normal users of SelectioContext don't need to worry about this, since
they stop as soon as an Unimplemented error is encountered. However, we
add predicates to our ParamEnv when we encounter this error, so we need
to handle negative impls specially (so that we don't try adding them to
our ParamEnv).
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc/issue-55321.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/rustdoc/issue-55321.rs b/src/test/rustdoc/issue-55321.rs
new file mode 100644
index 00000000000..f6ba7c7be17
--- /dev/null
+++ b/src/test/rustdoc/issue-55321.rs
@@ -0,0 +1,27 @@
+// 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.
+
+
+#![feature(optin_builtin_traits)]
+
+// @has issue_55321/struct.A.html
+// @has - '//*[@id="implementations-list"]/*[@class="impl"]//*/code' "impl !Send for A"
+// @has - '//*[@id="implementations-list"]/*[@class="impl"]//*/code' "impl !Sync for A"
+pub struct A();
+
+impl !Send for A {}
+impl !Sync for A {}
+
+// @has issue_55321/struct.B.html
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<T> !Send for \
+// B<T>"
+// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<T> !Sync for \
+// B<T>"
+pub struct B<T: ?Sized>(A, Box<T>);