Rollup merge of #101245 - GuillaumeGomez:remove-unneeded-where-whitespace, r=notriddle
Remove unneeded where whitespace
It fixes these two bugs:


It's a relic from a very old time (this commit: bfd01b7f40
).
You can test the result [here](https://rustdoc.crud.net/imperio/remove-unneeded-where-whitespace/lib2/struct.WhereWhitespace.html).
cc `````````@jsha`````````
r? `````````@notriddle`````````
This commit is contained in:
commit
21c8447d78
28 changed files with 114 additions and 67 deletions
|
@ -349,8 +349,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
|
||||||
let where_preds = comma_sep(where_predicates, false);
|
let where_preds = comma_sep(where_predicates, false);
|
||||||
let clause = if f.alternate() {
|
let clause = if f.alternate() {
|
||||||
if ending == Ending::Newline {
|
if ending == Ending::Newline {
|
||||||
// add a space so stripping <br> tags and breaking spaces still renders properly
|
format!(" where{where_preds},")
|
||||||
format!(" where{where_preds}, ")
|
|
||||||
} else {
|
} else {
|
||||||
format!(" where{where_preds}")
|
format!(" where{where_preds}")
|
||||||
}
|
}
|
||||||
|
@ -364,20 +363,16 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
|
||||||
|
|
||||||
if ending == Ending::Newline {
|
if ending == Ending::Newline {
|
||||||
let mut clause = " ".repeat(indent.saturating_sub(1));
|
let mut clause = " ".repeat(indent.saturating_sub(1));
|
||||||
// add a space so stripping <br> tags and breaking spaces still renders properly
|
write!(clause, "<span class=\"where fmt-newline\">where{where_preds},</span>")?;
|
||||||
write!(
|
|
||||||
clause,
|
|
||||||
" <span class=\"where fmt-newline\">where{where_preds}, </span>"
|
|
||||||
)?;
|
|
||||||
clause
|
clause
|
||||||
} else {
|
} else {
|
||||||
// insert a <br> tag after a single space but before multiple spaces at the start
|
// insert a <br> tag after a single space but before multiple spaces at the start
|
||||||
if indent == 0 {
|
if indent == 0 {
|
||||||
format!(" <br><span class=\"where\">where{where_preds}</span>")
|
format!("<br><span class=\"where\">where{where_preds}</span>")
|
||||||
} else {
|
} else {
|
||||||
let mut clause = br_with_padding;
|
let mut clause = br_with_padding;
|
||||||
clause.truncate(clause.len() - 5 * " ".len());
|
clause.truncate(clause.len() - 5 * " ".len());
|
||||||
write!(clause, " <span class=\"where\">where{where_preds}</span>")?;
|
write!(clause, "<span class=\"where\">where{where_preds}</span>")?;
|
||||||
clause
|
clause
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1737,8 +1737,8 @@ pub(crate) fn render_impl_summary(
|
||||||
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
|
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
|
||||||
aliases: &[String],
|
aliases: &[String],
|
||||||
) {
|
) {
|
||||||
let id =
|
let inner_impl = i.inner_impl();
|
||||||
cx.derive_id(get_id_for_impl(&i.inner_impl().for_, i.inner_impl().trait_.as_ref(), cx));
|
let id = cx.derive_id(get_id_for_impl(&inner_impl.for_, inner_impl.trait_.as_ref(), cx));
|
||||||
let aliases = if aliases.is_empty() {
|
let aliases = if aliases.is_empty() {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
|
@ -1750,9 +1750,9 @@ pub(crate) fn render_impl_summary(
|
||||||
write!(w, "<h3 class=\"code-header in-band\">");
|
write!(w, "<h3 class=\"code-header in-band\">");
|
||||||
|
|
||||||
if let Some(use_absolute) = use_absolute {
|
if let Some(use_absolute) = use_absolute {
|
||||||
write!(w, "{}", i.inner_impl().print(use_absolute, cx));
|
write!(w, "{}", inner_impl.print(use_absolute, cx));
|
||||||
if show_def_docs {
|
if show_def_docs {
|
||||||
for it in &i.inner_impl().items {
|
for it in &inner_impl.items {
|
||||||
if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind {
|
if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind {
|
||||||
w.write_str("<span class=\"where fmt-newline\"> ");
|
w.write_str("<span class=\"where fmt-newline\"> ");
|
||||||
assoc_type(
|
assoc_type(
|
||||||
|
@ -1770,11 +1770,11 @@ pub(crate) fn render_impl_summary(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
write!(w, "{}", i.inner_impl().print(false, cx));
|
write!(w, "{}", inner_impl.print(false, cx));
|
||||||
}
|
}
|
||||||
write!(w, "</h3>");
|
write!(w, "</h3>");
|
||||||
|
|
||||||
let is_trait = i.inner_impl().trait_.is_some();
|
let is_trait = inner_impl.trait_.is_some();
|
||||||
if is_trait {
|
if is_trait {
|
||||||
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
|
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
|
||||||
write!(w, "<span class=\"item-info\">{}</span>", portability);
|
write!(w, "<span class=\"item-info\">{}</span>", portability);
|
||||||
|
|
|
@ -143,3 +143,30 @@ pub struct LongItemInfo2;
|
||||||
/// Some docs.
|
/// Some docs.
|
||||||
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
|
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
|
||||||
impl SimpleTrait for LongItemInfo2 {}
|
impl SimpleTrait for LongItemInfo2 {}
|
||||||
|
|
||||||
|
pub struct WhereWhitespace<T>;
|
||||||
|
|
||||||
|
impl<T> WhereWhitespace<T> {
|
||||||
|
pub fn new<F>(f: F) -> Self
|
||||||
|
where
|
||||||
|
F: FnMut() -> i32,
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<K, T> Whitespace<&K> for WhereWhitespace<T>
|
||||||
|
where
|
||||||
|
K: std::fmt::Debug,
|
||||||
|
{
|
||||||
|
type Output = WhereWhitespace<T>;
|
||||||
|
fn index(&self, _key: &K) -> &Self::Output {
|
||||||
|
self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait Whitespace<Idx>
|
||||||
|
where
|
||||||
|
Idx: ?Sized,
|
||||||
|
{
|
||||||
|
type Output;
|
||||||
|
fn index(&self, index: Idx) -> &Self::Output;
|
||||||
|
}
|
||||||
|
|
27
src/test/rustdoc-gui/where-whitespace.goml
Normal file
27
src/test/rustdoc-gui/where-whitespace.goml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
// This test ensures that the where conditions are correctly displayed.
|
||||||
|
goto: file://|DOC_PATH|/lib2/trait.Whitespace.html
|
||||||
|
show-text: true
|
||||||
|
// First, we check in the trait definition if the where clause is "on its own" (not on the same
|
||||||
|
// line than "pub trait Whitespace<Idx>").
|
||||||
|
compare-elements-position-false: (".item-decl code", ".where.fmt-newline", ("y"))
|
||||||
|
// And that the code following it isn't on the same line either.
|
||||||
|
compare-elements-position-false: (".item-decl .fnname", ".where.fmt-newline", ("y"))
|
||||||
|
|
||||||
|
goto: file://|DOC_PATH|/lib2/struct.WhereWhitespace.html
|
||||||
|
// We make the screen a bit wider to ensure that the trait impl is on one line.
|
||||||
|
size: (915, 915)
|
||||||
|
|
||||||
|
compare-elements-position-false: ("#method\.new .fnname", "#method\.new .where.fmt-newline", ("y"))
|
||||||
|
// We ensure that both the trait name and the struct name are on the same line in
|
||||||
|
// "impl<K, T> Whitespace<&K> for WhereWhitespace<T>".
|
||||||
|
compare-elements-position: (
|
||||||
|
"#trait-implementations-list .impl h3 .trait",
|
||||||
|
"#trait-implementations-list .impl h3 .struct",
|
||||||
|
("y"),
|
||||||
|
)
|
||||||
|
// And we now check that the where condition isn't on the same line.
|
||||||
|
compare-elements-position-false: (
|
||||||
|
"#trait-implementations-list .impl h3 .trait",
|
||||||
|
"#trait-implementations-list .impl h3 .where.fmt-newline",
|
||||||
|
("y"),
|
||||||
|
)
|
|
@ -31,12 +31,12 @@ impl Trait<{1 + 2}> for u8 {}
|
||||||
impl<const N: usize> Trait<N> for [u8; N] {}
|
impl<const N: usize> Trait<N> for [u8; N] {}
|
||||||
|
|
||||||
// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \
|
// @has foo/struct.Foo.html '//pre[@class="rust struct"]' \
|
||||||
// 'pub struct Foo<const N: usize> where u8: Trait<N>'
|
// 'pub struct Foo<const N: usize>where u8: Trait<N>'
|
||||||
pub struct Foo<const N: usize> where u8: Trait<N>;
|
pub struct Foo<const N: usize> where u8: Trait<N>;
|
||||||
// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)'
|
// @has foo/struct.Bar.html '//pre[@class="rust struct"]' 'pub struct Bar<T, const N: usize>(_)'
|
||||||
pub struct Bar<T, const N: usize>([T; N]);
|
pub struct Bar<T, const N: usize>([T; N]);
|
||||||
|
|
||||||
// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M> where u8: Trait<M>'
|
// @has foo/struct.Foo.html '//*[@id="impl-Foo%3CM%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Foo<M>where u8: Trait<M>'
|
||||||
impl<const M: usize> Foo<M> where u8: Trait<M> {
|
impl<const M: usize> Foo<M> where u8: Trait<M> {
|
||||||
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
|
// @has - '//*[@id="associatedconstant.FOO_ASSOC"]' 'pub const FOO_ASSOC: usize'
|
||||||
pub const FOO_ASSOC: usize = M + 13;
|
pub const FOO_ASSOC: usize = M + 13;
|
||||||
|
@ -50,14 +50,14 @@ impl<const M: usize> Foo<M> where u8: Trait<M> {
|
||||||
// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8%2C%20M%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
|
// @has foo/struct.Bar.html '//*[@id="impl-Bar%3Cu8%2C%20M%3E"]/h3[@class="code-header in-band"]' 'impl<const M: usize> Bar<u8, M>'
|
||||||
impl<const M: usize> Bar<u8, M> {
|
impl<const M: usize> Bar<u8, M> {
|
||||||
// @has - '//*[@id="method.hey"]' \
|
// @has - '//*[@id="method.hey"]' \
|
||||||
// 'pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N>'
|
// 'pub fn hey<const N: usize>(&self) -> Foo<N>where u8: Trait<N>'
|
||||||
pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N> {
|
pub fn hey<const N: usize>(&self) -> Foo<N> where u8: Trait<N> {
|
||||||
Foo
|
Foo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @has foo/fn.test.html '//pre[@class="rust fn"]' \
|
// @has foo/fn.test.html '//pre[@class="rust fn"]' \
|
||||||
// 'pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N>'
|
// 'pub fn test<const N: usize>() -> impl Trait<N>where u8: Trait<N>'
|
||||||
pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> {
|
pub fn test<const N: usize>() -> impl Trait<N> where u8: Trait<N> {
|
||||||
2u8
|
2u8
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
// @has foo/trait.LendingIterator.html
|
// @has foo/trait.LendingIterator.html
|
||||||
pub trait LendingIterator {
|
pub trait LendingIterator {
|
||||||
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a"
|
// @has - '//*[@id="associatedtype.Item"]//h4[@class="code-header"]' "type Item<'a>where Self: 'a"
|
||||||
type Item<'a> where Self: 'a;
|
type Item<'a> where Self: 'a;
|
||||||
|
|
||||||
// @has - '//*[@id="tymethod.next"]//h4[@class="code-header"]' \
|
// @has - '//*[@id="tymethod.next"]//h4[@class="code-header"]' \
|
||||||
|
@ -24,7 +24,7 @@ impl LendingIterator for () {
|
||||||
pub struct Infinite<T>(T);
|
pub struct Infinite<T>(T);
|
||||||
|
|
||||||
// @has foo/trait.LendingIterator.html
|
// @has foo/trait.LendingIterator.html
|
||||||
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a> where Self: 'a = &'a T"
|
// @has - '//*[@id="associatedtype.Item-2"]//h4[@class="code-header"]' "type Item<'a>where Self: 'a = &'a T"
|
||||||
impl<T> LendingIterator for Infinite<T> {
|
impl<T> LendingIterator for Infinite<T> {
|
||||||
type Item<'a> where Self: 'a = &'a T;
|
type Item<'a> where Self: 'a = &'a T;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
pub trait Trait<'x> {}
|
pub trait Trait<'x> {}
|
||||||
|
|
||||||
// @has foo/fn.test1.html
|
// @has foo/fn.test1.html
|
||||||
// @has - '//pre' "pub fn test1<T>() where for<'a> &'a T: Iterator,"
|
// @has - '//pre' "pub fn test1<T>()where for<'a> &'a T: Iterator,"
|
||||||
pub fn test1<T>()
|
pub fn test1<T>()
|
||||||
where
|
where
|
||||||
for<'a> &'a T: Iterator,
|
for<'a> &'a T: Iterator,
|
||||||
|
@ -12,7 +12,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// @has foo/fn.test2.html
|
// @has foo/fn.test2.html
|
||||||
// @has - '//pre' "pub fn test2<T>() where for<'a, 'b> &'a T: Trait<'b>,"
|
// @has - '//pre' "pub fn test2<T>()where for<'a, 'b> &'a T: Trait<'b>,"
|
||||||
pub fn test2<T>()
|
pub fn test2<T>()
|
||||||
where
|
where
|
||||||
for<'a, 'b> &'a T: Trait<'b>,
|
for<'a, 'b> &'a T: Trait<'b>,
|
||||||
|
@ -20,7 +20,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// @has foo/fn.test3.html
|
// @has foo/fn.test3.html
|
||||||
// @has - '//pre' "pub fn test3<F>() where F: for<'a, 'b> Fn(&'a u8, &'b u8),"
|
// @has - '//pre' "pub fn test3<F>()where F: for<'a, 'b> Fn(&'a u8, &'b u8),"
|
||||||
pub fn test3<F>()
|
pub fn test3<F>()
|
||||||
where
|
where
|
||||||
F: for<'a, 'b> Fn(&'a u8, &'b u8),
|
F: for<'a, 'b> Fn(&'a u8, &'b u8),
|
||||||
|
@ -38,7 +38,7 @@ pub struct Foo<'a> {
|
||||||
// @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>"
|
// @has - '//span[@id="structfield.some_trait"]' "some_trait: &'a dyn for<'b> Trait<'b>"
|
||||||
|
|
||||||
impl<'a> Foo<'a> {
|
impl<'a> Foo<'a> {
|
||||||
// @has - '//h4[@class="code-header"]' "pub fn bar<T>() where T: Trait<'a>,"
|
// @has - '//h4[@class="code-header"]' "pub fn bar<T>()where T: Trait<'a>,"
|
||||||
pub fn bar<T>()
|
pub fn bar<T>()
|
||||||
where
|
where
|
||||||
T: Trait<'a>,
|
T: Trait<'a>,
|
||||||
|
|
|
@ -6,7 +6,7 @@ pub auto trait AnAutoTrait {}
|
||||||
pub struct Foo<T> { field: T }
|
pub struct Foo<T> { field: T }
|
||||||
|
|
||||||
// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has impl_parts/struct.Foo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync,"
|
// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync,"
|
||||||
// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \
|
// @has impl_parts/trait.AnAutoTrait.html '//*[@class="item-list"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync,"
|
// "impl<T: Clone> !AnAutoTrait for Foo<T>where T: Sync,"
|
||||||
impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync {}
|
impl<T: Clone> !AnAutoTrait for Foo<T> where T: Sync {}
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
|
||||||
|
|
||||||
pub mod reexport {
|
pub mod reexport {
|
||||||
// @has issue_20727_4/reexport/trait.Index.html
|
// @has issue_20727_4/reexport/trait.Index.html
|
||||||
// @has - '//*[@class="rust trait"]' 'trait Index<Idx> where Idx: ?Sized, {'
|
// @has - '//*[@class="rust trait"]' 'trait Index<Idx>where Idx: ?Sized,{'
|
||||||
// @has - '//*[@class="rust trait"]' 'type Output: ?Sized'
|
// @has - '//*[@class="rust trait"]' 'type Output: ?Sized'
|
||||||
// @has - '//*[@class="rust trait"]' \
|
// @has - '//*[@class="rust trait"]' \
|
||||||
// 'fn index(&self, index: Idx) -> &Self::Output'
|
// 'fn index(&self, index: Idx) -> &Self::Output'
|
||||||
|
@ -33,7 +33,7 @@ pub mod reexport {
|
||||||
|
|
||||||
// @has issue_20727_4/reexport/trait.IndexMut.html
|
// @has issue_20727_4/reexport/trait.IndexMut.html
|
||||||
// @has - '//*[@class="rust trait"]' \
|
// @has - '//*[@class="rust trait"]' \
|
||||||
// 'trait IndexMut<Idx>: Index<Idx> where Idx: ?Sized, {'
|
// 'trait IndexMut<Idx>: Index<Idx>where Idx: ?Sized,{'
|
||||||
// @has - '//*[@class="rust trait"]' \
|
// @has - '//*[@class="rust trait"]' \
|
||||||
// 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
|
// 'fn index_mut(&mut self, index: Idx) -> &mut Self::Output;'
|
||||||
pub use issue_20727::IndexMut;
|
pub use issue_20727::IndexMut;
|
||||||
|
|
|
@ -5,5 +5,5 @@ extern crate issue_21801;
|
||||||
|
|
||||||
// @has issue_21801/struct.Foo.html
|
// @has issue_21801/struct.Foo.html
|
||||||
// @has - '//*[@id="method.new"]' \
|
// @has - '//*[@id="method.new"]' \
|
||||||
// 'fn new<F>(f: F) -> Foo where F: FnMut() -> i32'
|
// 'fn new<F>(f: F) -> Foowhere F: FnMut() -> i32'
|
||||||
pub use issue_21801::Foo;
|
pub use issue_21801::Foo;
|
||||||
|
|
|
@ -5,7 +5,7 @@ pub trait MyTrait {
|
||||||
fn my_string(&self) -> String;
|
fn my_string(&self) -> String;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header in-band']" "impl<T> MyTrait for T where T: Debug"
|
// @has - "//div[@id='implementors-list']//*[@id='impl-MyTrait-for-T']//h3[@class='code-header in-band']" "impl<T> MyTrait for Twhere T: Debug"
|
||||||
impl<T> MyTrait for T
|
impl<T> MyTrait for T
|
||||||
where
|
where
|
||||||
T: fmt::Debug,
|
T: fmt::Debug,
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
pub trait Bar {}
|
pub trait Bar {}
|
||||||
|
|
||||||
// @has foo/struct.Foo.html '//pre' 'pub struct Foo<T>(pub T) where T: Bar;'
|
// @has foo/struct.Foo.html '//pre' 'pub struct Foo<T>(pub T)where T: Bar;'
|
||||||
pub struct Foo<T>(pub T) where T: Bar;
|
pub struct Foo<T>(pub T) where T: Bar;
|
||||||
|
|
|
@ -11,8 +11,8 @@ impl<B, C> Signal2 for B where B: Signal<Item = C> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @has issue_50159/struct.Switch.html
|
// @has issue_50159/struct.Switch.html
|
||||||
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Send for Switch<B> where <B as Signal>::Item: Send'
|
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Send for Switch<B>where <B as Signal>::Item: Send'
|
||||||
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Sync for Switch<B> where <B as Signal>::Item: Sync'
|
// @has - '//h3[@class="code-header in-band"]' 'impl<B> Sync for Switch<B>where <B as Signal>::Item: Sync'
|
||||||
// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
|
// @count - '//*[@id="implementations-list"]//*[@class="impl"]' 0
|
||||||
// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5
|
// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5
|
||||||
pub struct Switch<B: Signal> {
|
pub struct Switch<B: Signal> {
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub mod traits {
|
||||||
|
|
||||||
// @has issue_51236/struct.Owned.html
|
// @has issue_51236/struct.Owned.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<T> Send for Owned<T> where <T as Owned<'static>>::Reader: Send"
|
// "impl<T> Send for Owned<T>where <T as Owned<'static>>::Reader: Send"
|
||||||
pub struct Owned<T> where T: for<'a> ::traits::Owned<'a> {
|
pub struct Owned<T> where T: for<'a> ::traits::Owned<'a> {
|
||||||
marker: PhantomData<<T as ::traits::Owned<'static>>::Reader>,
|
marker: PhantomData<<T as ::traits::Owned<'static>>::Reader>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
pub trait ScopeHandle<'scope> {}
|
pub trait ScopeHandle<'scope> {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @has issue_54705/struct.ScopeFutureContents.html
|
// @has issue_54705/struct.ScopeFutureContents.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<'scope, S> Send for ScopeFutureContents<'scope, S> where S: Sync"
|
// "impl<'scope, S> Send for ScopeFutureContents<'scope, S>where S: Sync"
|
||||||
//
|
//
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<'scope, S> Sync for ScopeFutureContents<'scope, S> where S: Sync"
|
// "impl<'scope, S> Sync for ScopeFutureContents<'scope, S>where S: Sync"
|
||||||
pub struct ScopeFutureContents<'scope, S>
|
pub struct ScopeFutureContents<'scope, S>
|
||||||
where S: ScopeHandle<'scope>,
|
where S: ScopeHandle<'scope>,
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
extern crate issue_98697_reexport_with_anonymous_lifetime;
|
extern crate issue_98697_reexport_with_anonymous_lifetime;
|
||||||
|
|
||||||
// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>() where F: Fn(&str)'
|
// @has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'fn repro<F>()where F: Fn(&str)'
|
||||||
// @!has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'for<'
|
// @!has issue_98697/fn.repro.html '//pre[@class="rust fn"]/code' 'for<'
|
||||||
pub use issue_98697_reexport_with_anonymous_lifetime::repro;
|
pub use issue_98697_reexport_with_anonymous_lifetime::repro;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
// @has - '//span[@class="in-band"]' 'Primitive Type slice'
|
// @has - '//span[@class="in-band"]' 'Primitive Type slice'
|
||||||
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
|
// @has - '//section[@id="main-content"]//div[@class="docblock"]//p' 'this is a test!'
|
||||||
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
|
// @has - '//h2[@id="synthetic-implementations"]' 'Auto Trait Implementations'
|
||||||
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T] where T: Send'
|
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Send for [T]where T: Send'
|
||||||
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Sync for [T] where T: Sync'
|
// @has - '//div[@id="synthetic-implementations-list"]//h3' 'impl<T> Sync for [T]where T: Sync'
|
||||||
#[doc(primitive = "slice")]
|
#[doc(primitive = "slice")]
|
||||||
/// this is a test!
|
/// this is a test!
|
||||||
mod slice_prim {}
|
mod slice_prim {}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @has basic/struct.Foo.html
|
// @has basic/struct.Foo.html
|
||||||
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Send for Foo<T> where T: Send'
|
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Send for Foo<T>where T: Send'
|
||||||
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Sync for Foo<T> where T: Sync'
|
// @has - '//h3[@class="code-header in-band"]' 'impl<T> Sync for Foo<T>where T: Sync'
|
||||||
// @count - '//*[@id="implementations-list"]//*[@class="impl has-srclink"]' 0
|
// @count - '//*[@id="implementations-list"]//*[@class="impl has-srclink"]' 0
|
||||||
// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5
|
// @count - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]' 5
|
||||||
pub struct Foo<T> {
|
pub struct Foo<T> {
|
||||||
|
|
|
@ -21,7 +21,7 @@ mod foo {
|
||||||
|
|
||||||
// @has complex/struct.NotOuter.html
|
// @has complex/struct.NotOuter.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<'a, T, K: ?Sized> Send for Outer<'a, T, K> where K: for<'b> Fn((&'b bool, &'a u8)) \
|
// "impl<'a, T, K: ?Sized> Send for Outer<'a, T, K>where K: for<'b> Fn((&'b bool, &'a u8)) \
|
||||||
// -> &'b i8, T: MyTrait<'a>, <T as MyTrait<'a>>::MyItem: Copy, 'a: 'static"
|
// -> &'b i8, T: MyTrait<'a>, <T as MyTrait<'a>>::MyItem: Copy, 'a: 'static"
|
||||||
|
|
||||||
pub use foo::{Foo, Inner as NotInner, MyTrait as NotMyTrait, Outer as NotOuter};
|
pub use foo::{Foo, Inner as NotInner, MyTrait as NotMyTrait, Outer as NotOuter};
|
||||||
|
|
|
@ -10,10 +10,10 @@ where
|
||||||
|
|
||||||
// @has lifetimes/struct.Foo.html
|
// @has lifetimes/struct.Foo.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<'c, K> Send for Foo<'c, K> where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static"
|
// "impl<'c, K> Send for Foo<'c, K>where K: for<'b> Fn(&'b bool) -> &'c u8, 'c: 'static"
|
||||||
//
|
//
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<'c, K> Sync for Foo<'c, K> where K: Sync"
|
// "impl<'c, K> Sync for Foo<'c, K>where K: Sync"
|
||||||
pub struct Foo<'c, K: 'c> {
|
pub struct Foo<'c, K: 'c> {
|
||||||
inner_field: Inner<'c, K>,
|
inner_field: Inner<'c, K>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @has manual/struct.Foo.html
|
// @has manual/struct.Foo.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// 'impl<T> Sync for Foo<T> where T: Sync'
|
// 'impl<T> Sync for Foo<T>where T: Sync'
|
||||||
//
|
//
|
||||||
// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="trait-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// 'impl<T> Send for Foo<T>'
|
// 'impl<T> Send for Foo<T>'
|
||||||
|
|
|
@ -10,10 +10,10 @@ where
|
||||||
|
|
||||||
// @has nested/struct.Foo.html
|
// @has nested/struct.Foo.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// 'impl<T> Send for Foo<T> where T: Copy'
|
// 'impl<T> Send for Foo<T>where T: Copy'
|
||||||
//
|
//
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// 'impl<T> Sync for Foo<T> where T: Sync'
|
// 'impl<T> Sync for Foo<T>where T: Sync'
|
||||||
pub struct Foo<T> {
|
pub struct Foo<T> {
|
||||||
inner_field: Inner<T>,
|
inner_field: Inner<T>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ where
|
||||||
|
|
||||||
// @has no_redundancy/struct.Outer.html
|
// @has no_redundancy/struct.Outer.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<T> Send for Outer<T> where T: Send + Copy"
|
// "impl<T> Send for Outer<T>where T: Send + Copy"
|
||||||
pub struct Outer<T> {
|
pub struct Outer<T> {
|
||||||
inner_field: Inner<T>,
|
inner_field: Inner<T>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ where
|
||||||
|
|
||||||
// @has project/struct.Foo.html
|
// @has project/struct.Foo.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<'c, K> Send for Foo<'c, K> where K: MyTrait<MyItem = bool>, 'c: 'static"
|
// "impl<'c, K> Send for Foo<'c, K>where K: MyTrait<MyItem = bool>, 'c: 'static"
|
||||||
//
|
//
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<'c, K> Sync for Foo<'c, K> where K: MyTrait, <K as MyTrait>::MyItem: OtherTrait, \
|
// "impl<'c, K> Sync for Foo<'c, K>where K: MyTrait, <K as MyTrait>::MyItem: OtherTrait, \
|
||||||
// 'c: 'static,"
|
// 'c: 'static,"
|
||||||
pub struct Foo<'c, K: 'c> {
|
pub struct Foo<'c, K: 'c> {
|
||||||
inner_field: Inner<'c, K>,
|
inner_field: Inner<'c, K>,
|
||||||
|
|
|
@ -24,6 +24,6 @@ impl<T> Pattern for Wrapper<T> {
|
||||||
|
|
||||||
// @has self_referential/struct.WriteAndThen.html
|
// @has self_referential/struct.WriteAndThen.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<P1> Send for WriteAndThen<P1> where <P1 as Pattern>::Value: Send"
|
// "impl<P1> Send for WriteAndThen<P1>where <P1 as Pattern>::Value: Send"
|
||||||
pub struct WriteAndThen<P1>(pub P1::Value,pub <Constrain<P1, Wrapper<P1::Value>> as Pattern>::Value)
|
pub struct WriteAndThen<P1>(pub P1::Value,pub <Constrain<P1, Wrapper<P1::Value>> as Pattern>::Value)
|
||||||
where P1: Pattern;
|
where P1: Pattern;
|
||||||
|
|
|
@ -4,7 +4,7 @@ pub trait OwnedTrait<'a> {
|
||||||
|
|
||||||
// @has static_region/struct.Owned.html
|
// @has static_region/struct.Owned.html
|
||||||
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has - '//*[@id="synthetic-implementations-list"]//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<T> Send for Owned<T> where <T as OwnedTrait<'static>>::Reader: Send"
|
// "impl<T> Send for Owned<T>where <T as OwnedTrait<'static>>::Reader: Send"
|
||||||
pub struct Owned<T> where T: OwnedTrait<'static> {
|
pub struct Owned<T> where T: OwnedTrait<'static> {
|
||||||
marker: <T as OwnedTrait<'static>>::Reader,
|
marker: <T as OwnedTrait<'static>>::Reader,
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
// @has 'foo/trait.SomeTrait.html'
|
// @has 'foo/trait.SomeTrait.html'
|
||||||
// @has - "//*[@id='impl-SomeTrait%3C(A%2C%20B%2C%20C%2C%20D%2C%20E)%3E-for-(A%2C%20B%2C%20C%2C%20D%2C%20E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E) where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
|
// @has - "//*[@id='impl-SomeTrait%3C(A%2C%20B%2C%20C%2C%20D%2C%20E)%3E-for-(A%2C%20B%2C%20C%2C%20D%2C%20E)']/h3" "impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)where A: PartialOrd<A> + PartialEq<A>, B: PartialOrd<B> + PartialEq<B>, C: PartialOrd<C> + PartialEq<C>, D: PartialOrd<D> + PartialEq<D>, E: PartialOrd<E> + PartialEq<E> + ?Sized, "
|
||||||
impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)
|
impl<A, B, C, D, E> SomeTrait<(A, B, C, D, E)> for (A, B, C, D, E)
|
||||||
where
|
where
|
||||||
A: PartialOrd<A> + PartialEq<A>,
|
A: PartialOrd<A> + PartialEq<A>,
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
|
|
||||||
pub trait MyTrait { fn dummy(&self) { } }
|
pub trait MyTrait { fn dummy(&self) { } }
|
||||||
|
|
||||||
// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_) where A: MyTrait"
|
// @has foo/struct.Alpha.html '//pre' "pub struct Alpha<A>(_)where A: MyTrait"
|
||||||
pub struct Alpha<A>(A) where A: MyTrait;
|
pub struct Alpha<A>(A) where A: MyTrait;
|
||||||
// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B> where B: MyTrait"
|
// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B>where B: MyTrait"
|
||||||
pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); }
|
pub trait Bravo<B> where B: MyTrait { fn get(&self, B: B); }
|
||||||
// @has foo/fn.charlie.html '//pre' "pub fn charlie<C>() where C: MyTrait"
|
// @has foo/fn.charlie.html '//pre' "pub fn charlie<C>()where C: MyTrait"
|
||||||
pub fn charlie<C>() where C: MyTrait {}
|
pub fn charlie<C>() where C: MyTrait {}
|
||||||
|
|
||||||
pub struct Delta<D>(D);
|
pub struct Delta<D>(D);
|
||||||
|
|
||||||
// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has foo/struct.Delta.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<D> Delta<D> where D: MyTrait"
|
// "impl<D> Delta<D>where D: MyTrait"
|
||||||
impl<D> Delta<D> where D: MyTrait {
|
impl<D> Delta<D> where D: MyTrait {
|
||||||
pub fn delta() {}
|
pub fn delta() {}
|
||||||
}
|
}
|
||||||
|
@ -33,19 +33,19 @@ pub trait TraitWhere {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has foo/struct.Echo.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<E> MyTrait for Echo<E> where E: MyTrait"
|
// "impl<E> MyTrait for Echo<E>where E: MyTrait"
|
||||||
// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \
|
// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<E> MyTrait for Echo<E> where E: MyTrait"
|
// "impl<E> MyTrait for Echo<E>where E: MyTrait"
|
||||||
impl<E> MyTrait for Echo<E> where E: MyTrait {}
|
impl<E> MyTrait for Echo<E>where E: MyTrait {}
|
||||||
|
|
||||||
pub enum Foxtrot<F> { Foxtrot1(F) }
|
pub enum Foxtrot<F> { Foxtrot1(F) }
|
||||||
|
|
||||||
// @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
// @has foo/enum.Foxtrot.html '//*[@class="impl has-srclink"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<F> MyTrait for Foxtrot<F> where F: MyTrait"
|
// "impl<F> MyTrait for Foxtrot<F>where F: MyTrait"
|
||||||
// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \
|
// @has foo/trait.MyTrait.html '//*[@id="implementors-list"]//h3[@class="code-header in-band"]' \
|
||||||
// "impl<F> MyTrait for Foxtrot<F> where F: MyTrait"
|
// "impl<F> MyTrait for Foxtrot<F>where F: MyTrait"
|
||||||
impl<F> MyTrait for Foxtrot<F> where F: MyTrait {}
|
impl<F> MyTrait for Foxtrot<F>where F: MyTrait {}
|
||||||
|
|
||||||
// @has foo/type.Golf.html '//pre[@class="rust typedef"]' \
|
// @has foo/type.Golf.html '//pre[@class="rust typedef"]' \
|
||||||
// "type Golf<T> where T: Clone, = (T, T)"
|
// "type Golf<T>where T: Clone, = (T, T)"
|
||||||
pub type Golf<T> where T: Clone = (T, T);
|
pub type Golf<T> where T: Clone = (T, T);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue