Skip to content

Commit 41aa06e

Browse files
committed
Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkov
report `unused_import` for empty reexports even it is pub Fixes #116032 An easy fix. r? `@petrochenkov` (Discovered this issue while reviewing #115993.)
2 parents 1322f92 + 482275b commit 41aa06e

File tree

38 files changed

+133
-55
lines changed

38 files changed

+133
-55
lines changed

compiler/rustc_ast/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ pub mod visit;
5353

5454
pub use self::ast::*;
5555
pub use self::ast_traits::{AstDeref, AstNodeWrapper, HasAttrs, HasNodeId, HasSpan, HasTokens};
56-
pub use self::format::*;
5756

5857
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5958

compiler/rustc_codegen_llvm/src/debuginfo/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ mod utils;
5050

5151
pub use self::create_scope_map::compute_mir_scopes;
5252
pub use self::metadata::build_global_var_di_node;
53-
pub use self::metadata::extend_scope_to_file;
5453

5554
#[allow(non_upper_case_globals)]
5655
const DW_TAG_auto_variable: c_uint = 0x100;

compiler/rustc_codegen_llvm/src/mono_item.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::llvm;
66
use crate::type_of::LayoutLlvmExt;
77
use rustc_codegen_ssa::traits::*;
88
use rustc_hir::def_id::{DefId, LOCAL_CRATE};
9-
pub use rustc_middle::mir::mono::MonoItem;
109
use rustc_middle::mir::mono::{Linkage, Visibility};
1110
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
1211
use rustc_middle::ty::{self, Instance, TypeVisitableExt};

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ mod arg_matrix;
44
mod checks;
55
mod suggestions;
66

7-
pub use _impl::*;
87
use rustc_errors::ErrorGuaranteed;
9-
pub use suggestions::*;
108

119
use crate::coercion::DynamicCoerceMany;
1210
use crate::{Diverges, EnclosingBreakables, Inherited};

compiler/rustc_infer/src/traits/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use rustc_span::Span;
1919

2020
pub use self::FulfillmentErrorCode::*;
2121
pub use self::ImplSource::*;
22-
pub use self::ObligationCauseCode::*;
2322
pub use self::SelectionError::*;
2423

2524
pub use self::engine::{TraitEngine, TraitEngineExt};

compiler/rustc_middle/src/mir/terminator.rs

-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ use rustc_hir::LangItem;
33
use smallvec::SmallVec;
44

55
use super::{BasicBlock, InlineAsmOperand, Operand, SourceInfo, TerminatorKind, UnwindAction};
6-
pub use rustc_ast::Mutability;
76
use rustc_macros::HashStable;
87
use std::iter;
98
use std::slice;
109

11-
pub use super::query::*;
1210
use super::*;
1311

1412
impl SwitchTargets {

compiler/rustc_middle/src/ty/assoc.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
pub use self::AssocItemContainer::*;
2-
31
use crate::ty;
42
use rustc_data_structures::sorted_map::SortedIndexMultiMap;
53
use rustc_hir as hir;

compiler/rustc_mir_dataflow/src/framework/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mod visitor;
4848
pub use self::cursor::{AnalysisResults, ResultsClonedCursor, ResultsCursor, ResultsRefCursor};
4949
pub use self::direction::{Backward, Direction, Forward};
5050
pub use self::engine::{Engine, EntrySets, Results, ResultsCloned};
51-
pub use self::lattice::{JoinSemiLattice, MaybeReachable, MeetSemiLattice};
51+
pub use self::lattice::{JoinSemiLattice, MaybeReachable};
5252
pub use self::visitor::{visit_results, ResultsVisitable, ResultsVisitor};
5353

5454
/// Analysis domains are all bitsets of various kinds. This trait holds

compiler/rustc_resolve/src/check_unused.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct UnusedImportCheckVisitor<'a, 'b, 'tcx> {
5959
base_use_tree: Option<&'a ast::UseTree>,
6060
base_id: ast::NodeId,
6161
item_span: Span,
62-
base_use_is_pub: bool,
6362
}
6463

6564
struct ExternCrateToLint {
@@ -146,7 +145,6 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
146145
// because this means that they were generated in some fashion by the
147146
// compiler and we don't need to consider them.
148147
ast::ItemKind::Use(..) if item.span.is_dummy() => return,
149-
ast::ItemKind::Use(..) => self.base_use_is_pub = item.vis.kind.is_pub(),
150148
ast::ItemKind::ExternCrate(orig_name) => {
151149
self.extern_crate_items.push(ExternCrateToLint {
152150
id: item.id,
@@ -173,7 +171,7 @@ impl<'a, 'b, 'tcx> Visitor<'a> for UnusedImportCheckVisitor<'a, 'b, 'tcx> {
173171
self.base_use_tree = Some(use_tree);
174172
}
175173

176-
if self.base_use_is_pub {
174+
if self.r.effective_visibilities.is_exported(self.r.local_def_id(id)) {
177175
self.check_import_as_underscore(use_tree, id);
178176
return;
179177
}
@@ -332,7 +330,6 @@ impl Resolver<'_, '_> {
332330
base_use_tree: None,
333331
base_id: ast::DUMMY_NODE_ID,
334332
item_span: DUMMY_SP,
335-
base_use_is_pub: false,
336333
};
337334
visit::walk_crate(&mut visitor, krate);
338335

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::ops::ControlFlow;
2020

2121
pub use self::infer_ctxt_ext::*;
2222
pub use self::type_err_ctxt_ext::*;
23-
pub use rustc_infer::traits::error_reporting::*;
2423

2524
// When outputting impl candidates, prefer showing those that are more similar.
2625
//

compiler/rustc_trait_selection/src/traits/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ use std::ops::ControlFlow;
4141

4242
pub(crate) use self::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
4343

44-
pub use self::FulfillmentErrorCode::*;
45-
pub use self::ImplSource::*;
46-
pub use self::ObligationCauseCode::*;
47-
pub use self::SelectionError::*;
48-
4944
pub use self::coherence::{add_placeholder_note, orphan_check, overlapping_impls};
5045
pub use self::coherence::{OrphanCheckErr, OverlapResult};
5146
pub use self::engine::{ObligationCtxt, TraitEngineExt};

compiler/rustc_trait_selection/src/traits/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_middle::ty::{self, ImplSubject, ToPredicate, Ty, TyCtxt, TypeVisitable
99
use rustc_span::Span;
1010
use smallvec::SmallVec;
1111

12-
pub use rustc_infer::traits::{self, util::*};
12+
pub use rustc_infer::traits::util::*;
1313

1414
///////////////////////////////////////////////////////////////////////////
1515
// `TraitAliasExpander` iterator

library/core/src/arch.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#![doc = include_str!("../../stdarch/crates/core_arch/src/core_arch_docs.md")]
22

3+
#[allow(unused_imports)]
34
#[stable(feature = "simd_arch", since = "1.27.0")]
45
pub use crate::core_arch::arch::*;
56

library/core/tests/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@
120120
#![deny(unsafe_op_in_unsafe_fn)]
121121
#![deny(fuzzy_provenance_casts)]
122122

123-
extern crate test;
124-
125123
mod alloc;
126124
mod any;
127125
mod array;

library/core/tests/num/flt2dec/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ use core::num::flt2dec::{
88
};
99
use core::num::fmt::{Formatted, Part};
1010

11-
pub use test::Bencher;
12-
1311
mod estimator;
1412
mod strategy {
1513
mod dragon;

library/portable-simd/crates/core_simd/src/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,5 @@ pub mod simd {
3535
pub use crate::core_simd::masks::*;
3636
pub use crate::core_simd::ord::*;
3737
pub use crate::core_simd::swizzle::*;
38-
pub use crate::core_simd::swizzle_dyn::*;
3938
pub use crate::core_simd::vector::*;
4039
}

library/std/src/sys/common/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
pub mod alloc;
1414
pub mod small_c_string;
15+
#[allow(unused_imports)]
1516
pub mod thread_local;
1617

1718
#[cfg(test)]

library/std/src/sys/unix/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ pub unsafe fn cleanup() {
241241

242242
#[cfg(target_os = "android")]
243243
pub use crate::sys::android::signal;
244+
#[allow(unused_imports)]
244245
#[cfg(not(target_os = "android"))]
245246
pub use libc::signal;
246247

library/std/src/sys/unix/process/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
pub use self::process_common::{Command, CommandArgs, ExitCode, Stdio, StdioPipes};
22
pub use self::process_inner::{ExitStatus, ExitStatusError, Process};
33
pub use crate::ffi::OsString as EnvKey;
4-
pub use crate::sys_common::process::CommandEnvs;
54

65
#[cfg_attr(any(target_os = "espidf", target_os = "horizon"), allow(unused))]
76
mod process_common;

library/std/src/sys/unix/process/process_common.rs

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ cfg_if::cfg_if! {
7575
return 0;
7676
}
7777
} else {
78+
#[allow(unused_imports)]
7879
pub use libc::{sigemptyset, sigaddset};
7980
}
8081
}

src/tools/clippy/tests/ui/enum_glob_use.fixed

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod in_fn_test {
1919
}
2020

2121
mod blurg {
22+
#[allow(unused_imports)]
2223
pub use std::cmp::Ordering::*; // ok, re-export
2324
}
2425

src/tools/clippy/tests/ui/enum_glob_use.rs

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ mod in_fn_test {
1919
}
2020

2121
mod blurg {
22+
#[allow(unused_imports)]
2223
pub use std::cmp::Ordering::*; // ok, re-export
2324
}
2425

src/tools/miri/tests/utils/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(dead_code)]
2+
#![allow(unused_imports)]
23

34
#[macro_use]
45
mod macros;

src/tools/rust-analyzer/crates/parser/src/syntax_kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
mod generated;
55

66
#[allow(unreachable_pub)]
7-
pub use self::generated::{SyntaxKind, T};
7+
pub use self::generated::SyntaxKind;
88

99
impl From<u16> for SyntaxKind {
1010
#[inline]

src/tools/rust-analyzer/crates/parser/src/syntax_kind/generated.rs

-1
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,3 @@ impl SyntaxKind {
497497
}
498498
#[macro_export]
499499
macro_rules ! T { [;] => { $ crate :: SyntaxKind :: SEMICOLON } ; [,] => { $ crate :: SyntaxKind :: COMMA } ; ['('] => { $ crate :: SyntaxKind :: L_PAREN } ; [')'] => { $ crate :: SyntaxKind :: R_PAREN } ; ['{'] => { $ crate :: SyntaxKind :: L_CURLY } ; ['}'] => { $ crate :: SyntaxKind :: R_CURLY } ; ['['] => { $ crate :: SyntaxKind :: L_BRACK } ; [']'] => { $ crate :: SyntaxKind :: R_BRACK } ; [<] => { $ crate :: SyntaxKind :: L_ANGLE } ; [>] => { $ crate :: SyntaxKind :: R_ANGLE } ; [@] => { $ crate :: SyntaxKind :: AT } ; [#] => { $ crate :: SyntaxKind :: POUND } ; [~] => { $ crate :: SyntaxKind :: TILDE } ; [?] => { $ crate :: SyntaxKind :: QUESTION } ; [$] => { $ crate :: SyntaxKind :: DOLLAR } ; [&] => { $ crate :: SyntaxKind :: AMP } ; [|] => { $ crate :: SyntaxKind :: PIPE } ; [+] => { $ crate :: SyntaxKind :: PLUS } ; [*] => { $ crate :: SyntaxKind :: STAR } ; [/] => { $ crate :: SyntaxKind :: SLASH } ; [^] => { $ crate :: SyntaxKind :: CARET } ; [%] => { $ crate :: SyntaxKind :: PERCENT } ; [_] => { $ crate :: SyntaxKind :: UNDERSCORE } ; [.] => { $ crate :: SyntaxKind :: DOT } ; [..] => { $ crate :: SyntaxKind :: DOT2 } ; [...] => { $ crate :: SyntaxKind :: DOT3 } ; [..=] => { $ crate :: SyntaxKind :: DOT2EQ } ; [:] => { $ crate :: SyntaxKind :: COLON } ; [::] => { $ crate :: SyntaxKind :: COLON2 } ; [=] => { $ crate :: SyntaxKind :: EQ } ; [==] => { $ crate :: SyntaxKind :: EQ2 } ; [=>] => { $ crate :: SyntaxKind :: FAT_ARROW } ; [!] => { $ crate :: SyntaxKind :: BANG } ; [!=] => { $ crate :: SyntaxKind :: NEQ } ; [-] => { $ crate :: SyntaxKind :: MINUS } ; [->] => { $ crate :: SyntaxKind :: THIN_ARROW } ; [<=] => { $ crate :: SyntaxKind :: LTEQ } ; [>=] => { $ crate :: SyntaxKind :: GTEQ } ; [+=] => { $ crate :: SyntaxKind :: PLUSEQ } ; [-=] => { $ crate :: SyntaxKind :: MINUSEQ } ; [|=] => { $ crate :: SyntaxKind :: PIPEEQ } ; [&=] => { $ crate :: SyntaxKind :: AMPEQ } ; [^=] => { $ crate :: SyntaxKind :: CARETEQ } ; [/=] => { $ crate :: SyntaxKind :: SLASHEQ } ; [*=] => { $ crate :: SyntaxKind :: STAREQ } ; [%=] => { $ crate :: SyntaxKind :: PERCENTEQ } ; [&&] => { $ crate :: SyntaxKind :: AMP2 } ; [||] => { $ crate :: SyntaxKind :: PIPE2 } ; [<<] => { $ crate :: SyntaxKind :: SHL } ; [>>] => { $ crate :: SyntaxKind :: SHR } ; [<<=] => { $ crate :: SyntaxKind :: SHLEQ } ; [>>=] => { $ crate :: SyntaxKind :: SHREQ } ; [as] => { $ crate :: SyntaxKind :: AS_KW } ; [async] => { $ crate :: SyntaxKind :: ASYNC_KW } ; [await] => { $ crate :: SyntaxKind :: AWAIT_KW } ; [box] => { $ crate :: SyntaxKind :: BOX_KW } ; [break] => { $ crate :: SyntaxKind :: BREAK_KW } ; [const] => { $ crate :: SyntaxKind :: CONST_KW } ; [continue] => { $ crate :: SyntaxKind :: CONTINUE_KW } ; [crate] => { $ crate :: SyntaxKind :: CRATE_KW } ; [do] => { $ crate :: SyntaxKind :: DO_KW } ; [dyn] => { $ crate :: SyntaxKind :: DYN_KW } ; [else] => { $ crate :: SyntaxKind :: ELSE_KW } ; [enum] => { $ crate :: SyntaxKind :: ENUM_KW } ; [extern] => { $ crate :: SyntaxKind :: EXTERN_KW } ; [false] => { $ crate :: SyntaxKind :: FALSE_KW } ; [fn] => { $ crate :: SyntaxKind :: FN_KW } ; [for] => { $ crate :: SyntaxKind :: FOR_KW } ; [if] => { $ crate :: SyntaxKind :: IF_KW } ; [impl] => { $ crate :: SyntaxKind :: IMPL_KW } ; [in] => { $ crate :: SyntaxKind :: IN_KW } ; [let] => { $ crate :: SyntaxKind :: LET_KW } ; [loop] => { $ crate :: SyntaxKind :: LOOP_KW } ; [macro] => { $ crate :: SyntaxKind :: MACRO_KW } ; [match] => { $ crate :: SyntaxKind :: MATCH_KW } ; [mod] => { $ crate :: SyntaxKind :: MOD_KW } ; [move] => { $ crate :: SyntaxKind :: MOVE_KW } ; [mut] => { $ crate :: SyntaxKind :: MUT_KW } ; [pub] => { $ crate :: SyntaxKind :: PUB_KW } ; [ref] => { $ crate :: SyntaxKind :: REF_KW } ; [return] => { $ crate :: SyntaxKind :: RETURN_KW } ; [self] => { $ crate :: SyntaxKind :: SELF_KW } ; [Self] => { $ crate :: SyntaxKind :: SELF_TYPE_KW } ; [static] => { $ crate :: SyntaxKind :: STATIC_KW } ; [struct] => { $ crate :: SyntaxKind :: STRUCT_KW } ; [super] => { $ crate :: SyntaxKind :: SUPER_KW } ; [trait] => { $ crate :: SyntaxKind :: TRAIT_KW } ; [true] => { $ crate :: SyntaxKind :: TRUE_KW } ; [try] => { $ crate :: SyntaxKind :: TRY_KW } ; [type] => { $ crate :: SyntaxKind :: TYPE_KW } ; [unsafe] => { $ crate :: SyntaxKind :: UNSAFE_KW } ; [use] => { $ crate :: SyntaxKind :: USE_KW } ; [where] => { $ crate :: SyntaxKind :: WHERE_KW } ; [while] => { $ crate :: SyntaxKind :: WHILE_KW } ; [yield] => { $ crate :: SyntaxKind :: YIELD_KW } ; [auto] => { $ crate :: SyntaxKind :: AUTO_KW } ; [builtin] => { $ crate :: SyntaxKind :: BUILTIN_KW } ; [default] => { $ crate :: SyntaxKind :: DEFAULT_KW } ; [existential] => { $ crate :: SyntaxKind :: EXISTENTIAL_KW } ; [union] => { $ crate :: SyntaxKind :: UNION_KW } ; [raw] => { $ crate :: SyntaxKind :: RAW_KW } ; [macro_rules] => { $ crate :: SyntaxKind :: MACRO_RULES_KW } ; [yeet] => { $ crate :: SyntaxKind :: YEET_KW } ; [offset_of] => { $ crate :: SyntaxKind :: OFFSET_OF_KW } ; [asm] => { $ crate :: SyntaxKind :: ASM_KW } ; [format_args] => { $ crate :: SyntaxKind :: FORMAT_ARGS_KW } ; [lifetime_ident] => { $ crate :: SyntaxKind :: LIFETIME_IDENT } ; [ident] => { $ crate :: SyntaxKind :: IDENT } ; [shebang] => { $ crate :: SyntaxKind :: SHEBANG } ; }
500-
pub use T;

src/tools/rust-analyzer/crates/syntax/src/tests/sourcegen_ast.rs

-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> String {
450450
[ident] => { $crate::SyntaxKind::IDENT };
451451
[shebang] => { $crate::SyntaxKind::SHEBANG };
452452
}
453-
pub use T;
454453
};
455454

456455
sourcegen::add_preamble("sourcegen_ast", sourcegen::reformat(ast.to_string()))

src/tools/rustfmt/src/config/options.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(unused_imports)]
2+
13
use std::collections::{hash_set, HashSet};
24
use std::fmt;
35
use std::path::{Path, PathBuf};
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![deny(unused_imports)]
2+
3+
mod a {}
4+
5+
pub use a::*;
6+
//~^ ERROR: unused import: `a::*`
7+
8+
mod b {
9+
mod c {
10+
#[derive(Clone)]
11+
pub struct D;
12+
}
13+
pub use self::c::*; // don't show unused import lint
14+
}
15+
16+
pub use b::*; // don't show unused import lint
17+
18+
mod d {
19+
const D: i32 = 1;
20+
}
21+
22+
pub use d::*;
23+
//~^ ERROR: unused import: `d::*`
24+
25+
fn main() {}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: unused import: `a::*`
2+
--> $DIR/pub-reexport-empty.rs:5:9
3+
|
4+
LL | pub use a::*;
5+
| ^^^^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/pub-reexport-empty.rs:1:9
9+
|
10+
LL | #![deny(unused_imports)]
11+
| ^^^^^^^^^^^^^^
12+
13+
error: unused import: `d::*`
14+
--> $DIR/pub-reexport-empty.rs:22:9
15+
|
16+
LL | pub use d::*;
17+
| ^^^^
18+
19+
error: aborting due to 2 previous errors
20+

tests/ui/imports/reexports.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ mod a {
55
mod foo {}
66

77
mod a {
8-
pub use super::foo; //~ ERROR cannot be re-exported
8+
pub use super::foo;
9+
//~^ ERROR cannot be re-exported
10+
//~| WARNING unused import: `super::foo`
911
pub use super::*;
1012
//~^ WARNING glob import doesn't reexport anything because no candidate is public enough
13+
//~| WARNING unused import: `super::*`
1114
}
1215
}
1316

tests/ui/imports/reexports.stderr

+23-11
Original file line numberDiff line numberDiff line change
@@ -11,52 +11,64 @@ LL | pub use super::foo;
1111
| ^^^^^^^^^^
1212

1313
error[E0603]: module import `foo` is private
14-
--> $DIR/reexports.rs:33:15
14+
--> $DIR/reexports.rs:36:15
1515
|
1616
LL | use b::a::foo::S;
1717
| ^^^ private module import
1818
|
1919
note: the module import `foo` is defined here...
20-
--> $DIR/reexports.rs:21:17
20+
--> $DIR/reexports.rs:24:17
2121
|
2222
LL | pub use super::foo; // This is OK since the value `foo` is visible enough.
2323
| ^^^^^^^^^^
2424
note: ...and refers to the module `foo` which is defined here
25-
--> $DIR/reexports.rs:16:5
25+
--> $DIR/reexports.rs:19:5
2626
|
2727
LL | mod foo {
2828
| ^^^^^^^
2929

3030
error[E0603]: module import `foo` is private
31-
--> $DIR/reexports.rs:34:15
31+
--> $DIR/reexports.rs:37:15
3232
|
3333
LL | use b::b::foo::S as T;
3434
| ^^^ private module import
3535
|
3636
note: the module import `foo` is defined here...
37-
--> $DIR/reexports.rs:26:17
37+
--> $DIR/reexports.rs:29:17
3838
|
3939
LL | pub use super::*; // This is also OK since the value `foo` is visible enough.
4040
| ^^^^^^^^
4141
note: ...and refers to the module `foo` which is defined here
42-
--> $DIR/reexports.rs:16:5
42+
--> $DIR/reexports.rs:19:5
4343
|
4444
LL | mod foo {
4545
| ^^^^^^^
4646

47-
warning: glob import doesn't reexport anything because no candidate is public enough
48-
--> $DIR/reexports.rs:9:17
47+
warning: unused import: `super::foo`
48+
--> $DIR/reexports.rs:8:17
4949
|
50-
LL | pub use super::*;
51-
| ^^^^^^^^
50+
LL | pub use super::foo;
51+
| ^^^^^^^^^^
5252
|
5353
note: the lint level is defined here
5454
--> $DIR/reexports.rs:1:9
5555
|
5656
LL | #![warn(unused_imports)]
5757
| ^^^^^^^^^^^^^^
5858

59-
error: aborting due to 3 previous errors; 1 warning emitted
59+
warning: glob import doesn't reexport anything because no candidate is public enough
60+
--> $DIR/reexports.rs:11:17
61+
|
62+
LL | pub use super::*;
63+
| ^^^^^^^^
64+
65+
warning: unused import: `super::*`
66+
--> $DIR/reexports.rs:11:17
67+
|
68+
LL | pub use super::*;
69+
| ^^^^^^^^
70+
71+
error: aborting due to 3 previous errors; 3 warnings emitted
6072

6173
Some errors have detailed explanations: E0364, E0603.
6274
For more information about an error, try `rustc --explain E0364`.

tests/ui/lint/unused/lint-unused-imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ mod foo {
4242
pub struct Square{pub p: Point, pub h: usize, pub w: usize}
4343
}
4444

45-
mod bar {
45+
pub mod bar {
4646
// Don't ignore on 'pub use' because we're not sure if it's used or not
4747
pub use std::cmp::PartialEq;
4848
pub struct Square;

tests/ui/parser/recover-missing-semi-before-item.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22

3-
#![allow(unused_variables, dead_code)]
3+
#![allow(unused_variables, dead_code, unused_imports)]
44

55
fn for_struct() {
66
let foo = 3; //~ ERROR expected `;`, found keyword `struct`

0 commit comments

Comments
 (0)