Skip to content

Commit 37becf7

Browse files
committed
Add warn(unreachable_pub) to rustc_incremental.
1 parent 7fc0444 commit 37becf7

File tree

7 files changed

+50
-49
lines changed

7 files changed

+50
-49
lines changed

compiler/rustc_incremental/src/assert_dep_graph.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use {rustc_ast as ast, rustc_graphviz as dot, rustc_hir as hir};
5555
use crate::errors;
5656

5757
#[allow(missing_docs)]
58-
pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
58+
pub(crate) fn assert_dep_graph(tcx: TyCtxt<'_>) {
5959
tcx.dep_graph.with_ignore(|| {
6060
if tcx.sess.opts.unstable_opts.dump_dep_graph {
6161
tcx.dep_graph.with_query(dump_graph);
@@ -261,7 +261,7 @@ fn dump_graph(query: &DepGraphQuery) {
261261
}
262262

263263
#[allow(missing_docs)]
264-
pub struct GraphvizDepGraph(FxIndexSet<DepKind>, Vec<(DepKind, DepKind)>);
264+
struct GraphvizDepGraph(FxIndexSet<DepKind>, Vec<(DepKind, DepKind)>);
265265

266266
impl<'a> dot::GraphWalk<'a> for GraphvizDepGraph {
267267
type Node = DepKind;

compiler/rustc_incremental/src/errors.rs

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,36 @@ use rustc_span::{Span, Symbol};
66

77
#[derive(Diagnostic)]
88
#[diag(incremental_unrecognized_depnode)]
9-
pub struct UnrecognizedDepNode {
9+
pub(crate) struct UnrecognizedDepNode {
1010
#[primary_span]
1111
pub span: Span,
1212
pub name: Symbol,
1313
}
1414

1515
#[derive(Diagnostic)]
1616
#[diag(incremental_missing_depnode)]
17-
pub struct MissingDepNode {
17+
pub(crate) struct MissingDepNode {
1818
#[primary_span]
1919
pub span: Span,
2020
}
2121

2222
#[derive(Diagnostic)]
2323
#[diag(incremental_missing_if_this_changed)]
24-
pub struct MissingIfThisChanged {
24+
pub(crate) struct MissingIfThisChanged {
2525
#[primary_span]
2626
pub span: Span,
2727
}
2828

2929
#[derive(Diagnostic)]
3030
#[diag(incremental_ok)]
31-
pub struct Ok {
31+
pub(crate) struct Ok {
3232
#[primary_span]
3333
pub span: Span,
3434
}
3535

3636
#[derive(Diagnostic)]
3737
#[diag(incremental_no_path)]
38-
pub struct NoPath {
38+
pub(crate) struct NoPath {
3939
#[primary_span]
4040
pub span: Span,
4141
pub target: Symbol,
@@ -44,7 +44,7 @@ pub struct NoPath {
4444

4545
#[derive(Diagnostic)]
4646
#[diag(incremental_assertion_auto)]
47-
pub struct AssertionAuto<'a> {
47+
pub(crate) struct AssertionAuto<'a> {
4848
#[primary_span]
4949
pub span: Span,
5050
pub name: &'a str,
@@ -53,139 +53,139 @@ pub struct AssertionAuto<'a> {
5353

5454
#[derive(Diagnostic)]
5555
#[diag(incremental_undefined_clean_dirty_assertions_item)]
56-
pub struct UndefinedCleanDirtyItem {
56+
pub(crate) struct UndefinedCleanDirtyItem {
5757
#[primary_span]
5858
pub span: Span,
5959
pub kind: String,
6060
}
6161

6262
#[derive(Diagnostic)]
6363
#[diag(incremental_undefined_clean_dirty_assertions)]
64-
pub struct UndefinedCleanDirty {
64+
pub(crate) struct UndefinedCleanDirty {
6565
#[primary_span]
6666
pub span: Span,
6767
pub kind: String,
6868
}
6969

7070
#[derive(Diagnostic)]
7171
#[diag(incremental_repeated_depnode_label)]
72-
pub struct RepeatedDepNodeLabel<'a> {
72+
pub(crate) struct RepeatedDepNodeLabel<'a> {
7373
#[primary_span]
7474
pub span: Span,
7575
pub label: &'a str,
7676
}
7777

7878
#[derive(Diagnostic)]
7979
#[diag(incremental_unrecognized_depnode_label)]
80-
pub struct UnrecognizedDepNodeLabel<'a> {
80+
pub(crate) struct UnrecognizedDepNodeLabel<'a> {
8181
#[primary_span]
8282
pub span: Span,
8383
pub label: &'a str,
8484
}
8585

8686
#[derive(Diagnostic)]
8787
#[diag(incremental_not_dirty)]
88-
pub struct NotDirty<'a> {
88+
pub(crate) struct NotDirty<'a> {
8989
#[primary_span]
9090
pub span: Span,
9191
pub dep_node_str: &'a str,
9292
}
9393

9494
#[derive(Diagnostic)]
9595
#[diag(incremental_not_clean)]
96-
pub struct NotClean<'a> {
96+
pub(crate) struct NotClean<'a> {
9797
#[primary_span]
9898
pub span: Span,
9999
pub dep_node_str: &'a str,
100100
}
101101

102102
#[derive(Diagnostic)]
103103
#[diag(incremental_not_loaded)]
104-
pub struct NotLoaded<'a> {
104+
pub(crate) struct NotLoaded<'a> {
105105
#[primary_span]
106106
pub span: Span,
107107
pub dep_node_str: &'a str,
108108
}
109109

110110
#[derive(Diagnostic)]
111111
#[diag(incremental_unknown_item)]
112-
pub struct UnknownItem {
112+
pub(crate) struct UnknownItem {
113113
#[primary_span]
114114
pub span: Span,
115115
pub name: Symbol,
116116
}
117117

118118
#[derive(Diagnostic)]
119119
#[diag(incremental_no_cfg)]
120-
pub struct NoCfg {
120+
pub(crate) struct NoCfg {
121121
#[primary_span]
122122
pub span: Span,
123123
}
124124

125125
#[derive(Diagnostic)]
126126
#[diag(incremental_associated_value_expected_for)]
127-
pub struct AssociatedValueExpectedFor {
127+
pub(crate) struct AssociatedValueExpectedFor {
128128
#[primary_span]
129129
pub span: Span,
130130
pub ident: Ident,
131131
}
132132

133133
#[derive(Diagnostic)]
134134
#[diag(incremental_associated_value_expected)]
135-
pub struct AssociatedValueExpected {
135+
pub(crate) struct AssociatedValueExpected {
136136
#[primary_span]
137137
pub span: Span,
138138
}
139139

140140
#[derive(Diagnostic)]
141141
#[diag(incremental_unchecked_clean)]
142-
pub struct UncheckedClean {
142+
pub(crate) struct UncheckedClean {
143143
#[primary_span]
144144
pub span: Span,
145145
}
146146

147147
#[derive(Diagnostic)]
148148
#[diag(incremental_delete_old)]
149-
pub struct DeleteOld<'a> {
149+
pub(crate) struct DeleteOld<'a> {
150150
pub name: &'a str,
151151
pub path: PathBuf,
152152
pub err: std::io::Error,
153153
}
154154

155155
#[derive(Diagnostic)]
156156
#[diag(incremental_create_new)]
157-
pub struct CreateNew<'a> {
157+
pub(crate) struct CreateNew<'a> {
158158
pub name: &'a str,
159159
pub path: PathBuf,
160160
pub err: std::io::Error,
161161
}
162162

163163
#[derive(Diagnostic)]
164164
#[diag(incremental_write_new)]
165-
pub struct WriteNew<'a> {
165+
pub(crate) struct WriteNew<'a> {
166166
pub name: &'a str,
167167
pub path: PathBuf,
168168
pub err: std::io::Error,
169169
}
170170

171171
#[derive(Diagnostic)]
172172
#[diag(incremental_canonicalize_path)]
173-
pub struct CanonicalizePath {
173+
pub(crate) struct CanonicalizePath {
174174
pub path: PathBuf,
175175
pub err: std::io::Error,
176176
}
177177

178178
#[derive(Diagnostic)]
179179
#[diag(incremental_create_incr_comp_dir)]
180-
pub struct CreateIncrCompDir<'a> {
180+
pub(crate) struct CreateIncrCompDir<'a> {
181181
pub tag: &'a str,
182182
pub path: &'a Path,
183183
pub err: std::io::Error,
184184
}
185185

186186
#[derive(Diagnostic)]
187187
#[diag(incremental_create_lock)]
188-
pub struct CreateLock<'a> {
188+
pub(crate) struct CreateLock<'a> {
189189
pub lock_err: std::io::Error,
190190
pub session_dir: &'a Path,
191191
#[note(incremental_lock_unsupported)]
@@ -197,113 +197,113 @@ pub struct CreateLock<'a> {
197197

198198
#[derive(Diagnostic)]
199199
#[diag(incremental_delete_lock)]
200-
pub struct DeleteLock<'a> {
200+
pub(crate) struct DeleteLock<'a> {
201201
pub path: &'a Path,
202202
pub err: std::io::Error,
203203
}
204204

205205
#[derive(Diagnostic)]
206206
#[diag(incremental_hard_link_failed)]
207-
pub struct HardLinkFailed<'a> {
207+
pub(crate) struct HardLinkFailed<'a> {
208208
pub path: &'a Path,
209209
}
210210

211211
#[derive(Diagnostic)]
212212
#[diag(incremental_delete_partial)]
213-
pub struct DeletePartial<'a> {
213+
pub(crate) struct DeletePartial<'a> {
214214
pub path: &'a Path,
215215
pub err: std::io::Error,
216216
}
217217

218218
#[derive(Diagnostic)]
219219
#[diag(incremental_delete_full)]
220-
pub struct DeleteFull<'a> {
220+
pub(crate) struct DeleteFull<'a> {
221221
pub path: &'a Path,
222222
pub err: std::io::Error,
223223
}
224224

225225
#[derive(Diagnostic)]
226226
#[diag(incremental_finalize)]
227-
pub struct Finalize<'a> {
227+
pub(crate) struct Finalize<'a> {
228228
pub path: &'a Path,
229229
pub err: std::io::Error,
230230
}
231231

232232
#[derive(Diagnostic)]
233233
#[diag(incremental_invalid_gc_failed)]
234-
pub struct InvalidGcFailed<'a> {
234+
pub(crate) struct InvalidGcFailed<'a> {
235235
pub path: &'a Path,
236236
pub err: std::io::Error,
237237
}
238238

239239
#[derive(Diagnostic)]
240240
#[diag(incremental_finalized_gc_failed)]
241-
pub struct FinalizedGcFailed<'a> {
241+
pub(crate) struct FinalizedGcFailed<'a> {
242242
pub path: &'a Path,
243243
pub err: std::io::Error,
244244
}
245245

246246
#[derive(Diagnostic)]
247247
#[diag(incremental_session_gc_failed)]
248-
pub struct SessionGcFailed<'a> {
248+
pub(crate) struct SessionGcFailed<'a> {
249249
pub path: &'a Path,
250250
pub err: std::io::Error,
251251
}
252252

253253
#[derive(Diagnostic)]
254254
#[diag(incremental_assert_not_loaded)]
255-
pub struct AssertNotLoaded;
255+
pub(crate) struct AssertNotLoaded;
256256

257257
#[derive(Diagnostic)]
258258
#[diag(incremental_assert_loaded)]
259-
pub struct AssertLoaded;
259+
pub(crate) struct AssertLoaded;
260260

261261
#[derive(Diagnostic)]
262262
#[diag(incremental_delete_incompatible)]
263-
pub struct DeleteIncompatible {
263+
pub(crate) struct DeleteIncompatible {
264264
pub path: PathBuf,
265265
pub err: std::io::Error,
266266
}
267267

268268
#[derive(Diagnostic)]
269269
#[diag(incremental_load_dep_graph)]
270-
pub struct LoadDepGraph {
270+
pub(crate) struct LoadDepGraph {
271271
pub path: PathBuf,
272272
pub err: std::io::Error,
273273
}
274274

275275
#[derive(Diagnostic)]
276276
#[diag(incremental_move_dep_graph)]
277-
pub struct MoveDepGraph<'a> {
277+
pub(crate) struct MoveDepGraph<'a> {
278278
pub from: &'a Path,
279279
pub to: &'a Path,
280280
pub err: std::io::Error,
281281
}
282282

283283
#[derive(Diagnostic)]
284284
#[diag(incremental_create_dep_graph)]
285-
pub struct CreateDepGraph<'a> {
285+
pub(crate) struct CreateDepGraph<'a> {
286286
pub path: &'a Path,
287287
pub err: std::io::Error,
288288
}
289289

290290
#[derive(Diagnostic)]
291291
#[diag(incremental_copy_workproduct_to_cache)]
292-
pub struct CopyWorkProductToCache<'a> {
292+
pub(crate) struct CopyWorkProductToCache<'a> {
293293
pub from: &'a Path,
294294
pub to: &'a Path,
295295
pub err: std::io::Error,
296296
}
297297

298298
#[derive(Diagnostic)]
299299
#[diag(incremental_delete_workproduct)]
300-
pub struct DeleteWorkProduct<'a> {
300+
pub(crate) struct DeleteWorkProduct<'a> {
301301
pub path: &'a Path,
302302
pub err: std::io::Error,
303303
}
304304

305305
#[derive(Diagnostic)]
306306
#[diag(incremental_corrupt_file)]
307-
pub struct CorruptFile<'a> {
307+
pub(crate) struct CorruptFile<'a> {
308308
pub path: &'a Path,
309309
}

compiler/rustc_incremental/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
77
#![doc(rust_logo)]
88
#![feature(rustdoc_internals)]
9+
#![warn(unreachable_pub)]
910
// tidy-alphabetical-end
1011

1112
mod assert_dep_graph;

compiler/rustc_incremental/src/persist/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_macros::{Decodable, Encodable};
44
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
55

66
#[derive(Debug, Encodable, Decodable)]
7-
pub struct SerializedWorkProduct {
7+
pub(crate) struct SerializedWorkProduct {
88
/// node that produced the work-product
99
pub id: WorkProductId,
1010

0 commit comments

Comments
 (0)