Skip to content

Commit d87c513

Browse files
committed
Fix rustdoc
1 parent df9047d commit d87c513

34 files changed

+419
-126
lines changed

library/core/src/primitive_docs.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,26 +1077,6 @@ mod prim_tuple {}
10771077
#[doc(hidden)]
10781078
impl<T> (T,) {}
10791079

1080-
// Fake impl that's only really used for docs.
1081-
#[cfg(doc)]
1082-
#[stable(feature = "rust1", since = "1.0.0")]
1083-
#[doc(fake_variadic)]
1084-
/// This trait is implemented on arbitrary-length tuples.
1085-
impl<T: Clone> Clone for (T,) {
1086-
fn clone(&self) -> Self {
1087-
loop {}
1088-
}
1089-
}
1090-
1091-
// Fake impl that's only really used for docs.
1092-
#[cfg(doc)]
1093-
#[stable(feature = "rust1", since = "1.0.0")]
1094-
#[doc(fake_variadic)]
1095-
/// This trait is implemented on arbitrary-length tuples.
1096-
impl<T: Copy> Copy for (T,) {
1097-
// empty
1098-
}
1099-
11001080
#[rustc_doc_primitive = "f32"]
11011081
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
11021082
///

src/librustdoc/core.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,10 @@ pub(crate) fn run_global_ctxt(
320320
tcx.hir().for_each_module(|module| tcx.ensure().collect_mod_item_types(module))
321321
});
322322

323-
// NOTE: This is copy/pasted from typeck/lib.rs and should be kept in sync with those changes.
324323
tcx.sess.time("item_types_checking", || {
325-
tcx.hir().for_each_module(|module| tcx.ensure().check_mod_item_types(module))
324+
tcx.hir().for_each_module(|module| {
325+
let _ = tcx.ensure().check_mod_type_wf(module);
326+
});
326327
});
327328
tcx.sess.abort_if_errors();
328329
tcx.sess.time("missing_docs", || rustc_lint::check_crate(tcx));

tests/rustdoc-json/enums/field_hidden.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// Regression test for <https://github.com/rust-lang/rust/issues/100529>.
22

33
#![no_core]
4-
#![feature(no_core)]
4+
#![feature(no_core, lang_items)]
5+
6+
#[lang = "sized"]
7+
trait Sized {}
58

69
// @has "$.index[*][?(@.name=='ParseError')]"
710
// @has "$.index[*][?(@.name=='UnexpectedEndTag')]"

tests/rustdoc-json/enums/kind.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
// ignore-tidy-linelength
22

3-
#![feature(no_core)]
3+
#![feature(no_core, lang_items)]
44
#![no_core]
55

6+
#[lang = "sized"]
7+
trait Sized {}
8+
69
pub enum Foo {
710
// @set Unit = "$.index[*][?(@.name=='Unit')].id"
811
// @is "$.index[*][?(@.name=='Unit')].inner.variant.kind" '"plain"'

tests/rustdoc-json/enums/tuple_fields_hidden.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
#![feature(no_core)]
1+
#![feature(no_core, lang_items)]
22
#![no_core]
33

4+
#[lang = "sized"]
5+
trait Sized {}
6+
47
// @set 1.1.0 = "$.index[*][?(@.docs=='1.1.0')].id"
58
// @set 2.1.0 = "$.index[*][?(@.docs=='2.1.0')].id"
69
// @set 2.1.1 = "$.index[*][?(@.docs=='2.1.1')].id"

tests/rustdoc-json/generic-associated-types/gats.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
// ignore-tidy-linelength
22

33
#![no_core]
4-
#![feature(lang_items, no_core)]
4+
#![feature(lang_items, no_core, arbitrary_self_types)]
55

66
#[lang = "sized"]
77
pub trait Sized {}
88

9+
#[lang = "receiver"]
10+
pub trait Receiver {}
11+
912
pub trait Display {}
1013

1114
pub trait LendingIterator {

tests/rustdoc-json/impls/auto.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
#![feature(no_core, auto_traits, lang_items)]
1+
#![feature(no_core, auto_traits, lang_items, arbitrary_self_types)]
22
#![no_core]
33

44
#[lang = "sized"]
55
trait Sized {}
66

7+
#[lang = "receiver"]
8+
pub trait Receiver {}
9+
710
pub auto trait Bar {}
811

912
/// has span
@@ -12,8 +15,8 @@ impl Foo {
1215
}
1316

1417
// Testing spans, so all tests below code
15-
// @is "$.index[*][?(@.docs=='has span')].span.begin" "[10, 0]"
16-
// @is "$.index[*][?(@.docs=='has span')].span.end" "[12, 1]"
18+
// @is "$.index[*][?(@.docs=='has span')].span.begin" "[13, 0]"
19+
// @is "$.index[*][?(@.docs=='has span')].span.end" "[15, 1]"
1720
// FIXME: this doesn't work due to https://github.com/freestrings/jsonpath/issues/91
1821
// is "$.index[*][?(@.inner.impl.synthetic==true)].span" null
1922
pub struct Foo;

tests/rustdoc-json/type/inherent_associated_type_bound.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ pub struct Carrier<'a>(&'a ());
1616
pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {}
1717

1818
impl<'a> Carrier<'a> {
19-
pub type Focus<T> = &'a mut T;
19+
pub type Focus<T> = &'a mut T where T: 'a;
2020
}

tests/rustdoc-ui/error-in-impl-trait/infinite-recursive-type-2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
// check-pass
2-
31
pub fn f() -> impl Sized {
42
pub enum E {
3+
//~^ ERROR: recursive type
54
V(E),
65
}
76

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
error[E0072]: recursive type `f::E` has infinite size
2+
--> $DIR/infinite-recursive-type-2.rs:2:5
3+
|
4+
LL | pub enum E {
5+
| ^^^^^^^^^^
6+
LL |
7+
LL | V(E),
8+
| - recursive without indirection
9+
|
10+
help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
11+
|
12+
LL | V(Box<E>),
13+
| ++++ +
14+
15+
error: aborting due to previous error
16+
17+
For more information about this error, try `rustc --explain E0072`.

0 commit comments

Comments
 (0)