diff options
| author | kennytm <kennytm@gmail.com> | 2018-11-07 18:01:48 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-07 18:01:48 +0800 |
| commit | 88f214cfd588e483911c177e050dcdf21b3b8ee6 (patch) | |
| tree | b5edb392e13543a49fea1c7ad88691db98f36363 /src/test/rustdoc | |
| parent | 0156dd2589fb0177404f9f125d1b66a025a6fa8b (diff) | |
| parent | 20aa7513835b26256664f409c36611a9bc3b88e4 (diff) | |
| download | rust-88f214cfd588e483911c177e050dcdf21b3b8ee6.tar.gz rust-88f214cfd588e483911c177e050dcdf21b3b8ee6.zip | |
Rollup merge of #55453 - Aaron1011:fix/rustdoc-lifetime, r=pnkfelix
Choose predicates without inference variables over those with them Fixes #54705 When constructing synthetic auto trait impls, we may come across multiple predicates involving the same type, trait, and substitutions. Since we can only display one of these, we pick the one with the 'most strict' lifetime paramters. This ensures that the impl we render the user is actually valid (that is, a struct matching that impl will actually implement the auto trait in question). This commit exapnds the definition of 'more strict' to take into account inference variables. We always choose a predicate without inference variables over a predicate with inference variables.
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/issue-54705.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/rustdoc/issue-54705.rs b/src/test/rustdoc/issue-54705.rs new file mode 100644 index 00000000000..ccc939657a1 --- /dev/null +++ b/src/test/rustdoc/issue-54705.rs @@ -0,0 +1,40 @@ +// 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 trait ScopeHandle<'scope> {} + + + +// @has issue_54705/struct.ScopeFutureContents.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \ +// Send for ScopeFutureContents<'scope, S> where S: Sync" +// +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl<'scope, S> \ +// Sync for ScopeFutureContents<'scope, S> where S: Sync" +pub struct ScopeFutureContents<'scope, S> + where S: ScopeHandle<'scope>, +{ + dummy: &'scope S, + this: Box<ScopeFuture<'scope, S>>, +} + +struct ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{ + contents: ScopeFutureContents<'scope, S>, +} + +unsafe impl<'scope, S> Send for ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{} +unsafe impl<'scope, S> Sync for ScopeFuture<'scope, S> + where S: ScopeHandle<'scope>, +{} |
