Skip to content

Commit 8ede3aa

Browse files
committed
Auto merge of #113602 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.71.0 release, backports This PR adds a last-minute backport of: - #112343: Prevent emitting `missing_docs` for `pub extern crate` - no beta/mainline PR -- dropping empty section from relnotes
2 parents 7bb6185 + 20f5748 commit 8ede3aa

File tree

5 files changed

+37
-43
lines changed

5 files changed

+37
-43
lines changed

RELEASES.md

-15
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ Rustdoc
103103
- [Add a new `rustdoc::unescaped_backticks` lint for broken inline code.](https://github.com/rust-lang/rust/pull/105848/)
104104
- [Support strikethrough with single tildes.](https://github.com/rust-lang/rust/pull/111152/) (`~~old~~` vs. `~new~`)
105105

106-
<a id="1.71.0-Misc"></a>
107-
108-
Misc
109-
----
110-
111106
<a id="1.71.0-Compatibility-Notes"></a>
112107

113108
Compatibility Notes
@@ -131,16 +126,6 @@ Compatibility Notes
131126
table. This is considered to be not a use case Cargo would like to support, since it will likely
132127
cause problems or lead to confusion.
133128

134-
<a id="1.71.0-Internal-Changes"></a>
135-
136-
Internal Changes
137-
----------------
138-
139-
These changes do not affect any public interfaces of Rust, but they represent
140-
significant improvements to the performance or internals of rustc and related
141-
tools.
142-
143-
144129
Version 1.70.0 (2023-06-01)
145130
==========================
146131

compiler/rustc_lint/src/builtin.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,12 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
548548

549549
fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
550550
// Previously the Impl and Use types have been excluded from missing docs,
551-
// so we will continue to exclude them for compatibility
552-
if let hir::ItemKind::Impl(..) | hir::ItemKind::Use(..) = it.kind {
551+
// so we will continue to exclude them for compatibility.
552+
//
553+
// The documentation on `ExternCrate` is not used at the moment so no need to warn for it.
554+
if let hir::ItemKind::Impl(..) | hir::ItemKind::Use(..) | hir::ItemKind::ExternCrate(_) =
555+
it.kind
556+
{
553557
return;
554558
}
555559

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub struct Foo;

tests/ui/lint/lint-missing-doc.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// When denying at the crate level, be sure to not get random warnings from the
22
// injected intrinsics by the compiler.
3+
// aux-build:missing_docs.rs
34
#![deny(missing_docs)]
45
#![allow(dead_code)]
56
#![feature(associated_type_defaults, extern_types)]
@@ -8,6 +9,9 @@
89
//! Some garbage docs for the crate here
910
#![doc="More garbage"]
1011

12+
// There should be not "missing_docs" warning on "pub extern crate".
13+
pub extern crate missing_docs;
14+
1115
type Typedef = String;
1216
pub type PubTypedef = String; //~ ERROR: missing documentation for a type alias
1317

tests/ui/lint/lint-missing-doc.stderr

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,155 @@
11
error: missing documentation for a type alias
2-
--> $DIR/lint-missing-doc.rs:12:1
2+
--> $DIR/lint-missing-doc.rs:16:1
33
|
44
LL | pub type PubTypedef = String;
55
| ^^^^^^^^^^^^^^^^^^^
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-missing-doc.rs:3:9
8+
--> $DIR/lint-missing-doc.rs:4:9
99
|
1010
LL | #![deny(missing_docs)]
1111
| ^^^^^^^^^^^^
1212

1313
error: missing documentation for a struct
14-
--> $DIR/lint-missing-doc.rs:19:1
14+
--> $DIR/lint-missing-doc.rs:23:1
1515
|
1616
LL | pub struct PubFoo {
1717
| ^^^^^^^^^^^^^^^^^
1818

1919
error: missing documentation for a struct field
20-
--> $DIR/lint-missing-doc.rs:20:5
20+
--> $DIR/lint-missing-doc.rs:24:5
2121
|
2222
LL | pub a: isize,
2323
| ^^^^^^^^^^^^
2424

2525
error: missing documentation for a module
26-
--> $DIR/lint-missing-doc.rs:31:1
26+
--> $DIR/lint-missing-doc.rs:35:1
2727
|
2828
LL | pub mod pub_module_no_dox {}
2929
| ^^^^^^^^^^^^^^^^^^^^^^^^^
3030

3131
error: missing documentation for a function
32-
--> $DIR/lint-missing-doc.rs:35:1
32+
--> $DIR/lint-missing-doc.rs:39:1
3333
|
3434
LL | pub fn foo2() {}
3535
| ^^^^^^^^^^^^^
3636

3737
error: missing documentation for a trait
38-
--> $DIR/lint-missing-doc.rs:53:1
38+
--> $DIR/lint-missing-doc.rs:57:1
3939
|
4040
LL | pub trait C {
4141
| ^^^^^^^^^^^
4242

4343
error: missing documentation for a method
44-
--> $DIR/lint-missing-doc.rs:54:5
44+
--> $DIR/lint-missing-doc.rs:58:5
4545
|
4646
LL | fn foo(&self);
4747
| ^^^^^^^^^^^^^^
4848

4949
error: missing documentation for a method
50-
--> $DIR/lint-missing-doc.rs:55:5
50+
--> $DIR/lint-missing-doc.rs:59:5
5151
|
5252
LL | fn foo_with_impl(&self) {}
5353
| ^^^^^^^^^^^^^^^^^^^^^^^
5454

5555
error: missing documentation for an associated function
56-
--> $DIR/lint-missing-doc.rs:56:5
56+
--> $DIR/lint-missing-doc.rs:60:5
5757
|
5858
LL | fn foo_no_self();
5959
| ^^^^^^^^^^^^^^^^^
6060

6161
error: missing documentation for an associated function
62-
--> $DIR/lint-missing-doc.rs:57:5
62+
--> $DIR/lint-missing-doc.rs:61:5
6363
|
6464
LL | fn foo_no_self_with_impl() {}
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
6666

6767
error: missing documentation for an associated type
68-
--> $DIR/lint-missing-doc.rs:67:5
68+
--> $DIR/lint-missing-doc.rs:71:5
6969
|
7070
LL | type AssociatedType;
7171
| ^^^^^^^^^^^^^^^^^^^
7272

7373
error: missing documentation for an associated type
74-
--> $DIR/lint-missing-doc.rs:68:5
74+
--> $DIR/lint-missing-doc.rs:72:5
7575
|
7676
LL | type AssociatedTypeDef = Self;
7777
| ^^^^^^^^^^^^^^^^^^^^^^
7878

7979
error: missing documentation for an associated function
80-
--> $DIR/lint-missing-doc.rs:84:5
80+
--> $DIR/lint-missing-doc.rs:88:5
8181
|
8282
LL | pub fn foo() {}
8383
| ^^^^^^^^^^^^
8484

8585
error: missing documentation for an enum
86-
--> $DIR/lint-missing-doc.rs:121:1
86+
--> $DIR/lint-missing-doc.rs:125:1
8787
|
8888
LL | pub enum PubBaz {
8989
| ^^^^^^^^^^^^^^^
9090

9191
error: missing documentation for a variant
92-
--> $DIR/lint-missing-doc.rs:122:5
92+
--> $DIR/lint-missing-doc.rs:126:5
9393
|
9494
LL | PubBazA {
9595
| ^^^^^^^
9696

9797
error: missing documentation for a struct field
98-
--> $DIR/lint-missing-doc.rs:123:9
98+
--> $DIR/lint-missing-doc.rs:127:9
9999
|
100100
LL | a: isize,
101101
| ^^^^^^^^
102102

103103
error: missing documentation for a constant
104-
--> $DIR/lint-missing-doc.rs:154:1
104+
--> $DIR/lint-missing-doc.rs:158:1
105105
|
106106
LL | pub const FOO4: u32 = 0;
107107
| ^^^^^^^^^^^^^^^^^^^
108108

109109
error: missing documentation for a static
110-
--> $DIR/lint-missing-doc.rs:164:1
110+
--> $DIR/lint-missing-doc.rs:168:1
111111
|
112112
LL | pub static BAR4: u32 = 0;
113113
| ^^^^^^^^^^^^^^^^^^^^
114114

115115
error: missing documentation for a function
116-
--> $DIR/lint-missing-doc.rs:170:5
116+
--> $DIR/lint-missing-doc.rs:174:5
117117
|
118118
LL | pub fn undocumented1() {}
119119
| ^^^^^^^^^^^^^^^^^^^^^^
120120

121121
error: missing documentation for a function
122-
--> $DIR/lint-missing-doc.rs:171:5
122+
--> $DIR/lint-missing-doc.rs:175:5
123123
|
124124
LL | pub fn undocumented2() {}
125125
| ^^^^^^^^^^^^^^^^^^^^^^
126126

127127
error: missing documentation for a function
128-
--> $DIR/lint-missing-doc.rs:177:9
128+
--> $DIR/lint-missing-doc.rs:181:9
129129
|
130130
LL | pub fn also_undocumented1() {}
131131
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
132132

133133
error: missing documentation for a function
134-
--> $DIR/lint-missing-doc.rs:192:5
134+
--> $DIR/lint-missing-doc.rs:196:5
135135
|
136136
LL | pub fn extern_fn_undocumented(f: f32) -> f32;
137137
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
138138

139139
error: missing documentation for a static
140-
--> $DIR/lint-missing-doc.rs:197:5
140+
--> $DIR/lint-missing-doc.rs:201:5
141141
|
142142
LL | pub static EXTERN_STATIC_UNDOCUMENTED: u8;
143143
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144144

145145
error: missing documentation for a foreign type
146-
--> $DIR/lint-missing-doc.rs:202:5
146+
--> $DIR/lint-missing-doc.rs:206:5
147147
|
148148
LL | pub type ExternTyUndocumented;
149149
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
150150

151151
error: missing documentation for a trait alias
152-
--> $DIR/lint-missing-doc.rs:206:1
152+
--> $DIR/lint-missing-doc.rs:210:1
153153
|
154154
LL | pub trait T = Sync;
155155
| ^^^^^^^^^^^

0 commit comments

Comments
 (0)