Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo fix: after fixes were applied the compiler reported errors #71047

Closed
jyn514 opened this issue Apr 12, 2020 · 2 comments
Closed

cargo fix: after fixes were applied the compiler reported errors #71047

jyn514 opened this issue Apr 12, 2020 · 2 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-visibility Area: Visibility / privacy C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Apr 12, 2020

I tried this code: jyn514/saltwater@16d8b2d

I expected to see this happen: Duplicate imports removed

Instead, this happened: cargo fix gave an internal error.

Meta

rustc --version --verbose:

rustc +nightly --version -v
rustc 1.44.0-nightly (77621317d 2020-03-28)
binary: rustc
commit-hash: 77621317d643cc5d13da60b26ab68b057668e688
commit-date: 2020-03-28
host: x86_64-unknown-linux-gnu
release: 1.44.0-nightly
LLVM version: 9.0

cargo --version -v: cargo 1.44.0-nightly (8a0d4d9c9 2020-03-24)

Note the error also occurs with 1.42.0 stable.

Full output

cargo fix
    Checking rcc v0.6.0 (/home/joshua/src/rust/rcc)
warning: failed to automatically apply fixes suggested by rustc to crate `rcc`

after fixes were automatically applied the compiler reported errors within these files:

  * src/analyze/mod.rs
  * src/analyze/stmt.rs
  * src/data/ast.rs
  * src/ir/expr.rs
  * src/ir/mod.rs
  * src/lib.rs

This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see 
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag

The following errors were reported:
error[E0365]: `PreProcessor` is private, and cannot be re-exported
  --> src/lib.rs:44:22
   |
44 | pub use lex::{Lexer, PreProcessor};
   |                      ^^^^^^^^^^^^ re-export of private `PreProcessor`
   |
   = note: consider declaring type or module `PreProcessor` with `pub`

warning: the item `Expr` is imported redundantly
   --> src/analyze/stmt.rs:100:13
    |
5   |     hir::*,
    |     ------ the item `Expr` is already imported here
...
100 |         use crate::data::hir::Expr;
    |             ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(unused_imports)]` on by default

warning: unused imports: `ComparisonToken`, `self`
  --> src/analyze/mod.rs:14:5
   |
14 |     self,
   |     ^^^^
...
17 |     lex::{ComparisonToken, Keyword},
   |           ^^^^^^^^^^^^^^^

warning: the item `HashSet` is imported redundantly
   --> src/analyze/mod.rs:724:21
    |
7   | use std::collections::{HashSet, VecDeque};
    |                        ------- the item `HashSet` is already imported here
...
724 |                 use std::collections::HashSet;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: the item `StorageClass` is imported redundantly
    --> src/analyze/mod.rs:1009:13
     |
18   |     *,
     |     - the item `StorageClass` is already imported here
...
1009 |         use crate::data::StorageClass;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: the item `StorageClass` is imported redundantly
   --> src/ir/expr.rs:500:44
    |
6   | use crate::data::*;
    |     -------------- the item `StorageClass` is already imported here
...
500 |         use crate::data::{hir::Qualifiers, StorageClass};
    |                                            ^^^^^^^^^^^^

warning: unused imports: `Expr`, `MetadataRef`
  --> src/ir/mod.rs:26:24
   |
26 |     hir::{Declaration, Expr, Initializer, Metadata, MetadataRef, Scope, Stmt},
   |                        ^^^^                         ^^^^^^^^^^^

warning: unused import: `std::fmt::Write`
   --> src/data/ast.rs:476:13
    |
476 |         use std::fmt::Write;
    |             ^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0365`.
Original diagnostics will follow.

warning: unused imports: `error::Warning`, `self`
 --> src/analyze/expr.rs:3:19
  |
3 | use crate::data::{self, error::Warning, hir::*, lex::ComparisonToken, *};
  |                   ^^^^  ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `lex::LocationTrait`
 --> src/analyze/init.rs:2:54
  |
2 | use crate::data::{ast, error::SemanticError, hir::*, lex::LocationTrait, types, Location, Type};
  |                                                      ^^^^^^^^^^^^^^^^^^

warning: unused import: `LocationTrait`
 --> src/analyze/stmt.rs:6:22
  |
6 |     lex::{Locatable, LocationTrait},
  |                      ^^^^^^^^^^^^^

warning: the item `Expr` is imported redundantly
   --> src/analyze/stmt.rs:100:13
    |
5   |     hir::*,
    |     ------ the item `Expr` is already imported here
...
100 |         use crate::data::hir::Expr;
    |             ^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `HashMap`
 --> src/analyze/mod.rs:7:24
  |
7 | use std::collections::{HashMap, HashSet, VecDeque};
  |                        ^^^^^^^

warning: unused import: `std::iter::Peekable`
 --> src/analyze/mod.rs:8:5
  |
8 | use std::iter::Peekable;
  |     ^^^^^^^^^^^^^^^^^^^

warning: unused import: `crate::arch`
  --> src/analyze/mod.rs:12:5
   |
12 | use crate::arch;
   |     ^^^^^^^^^^^

warning: unused imports: `ComparisonToken`, `self`
  --> src/analyze/mod.rs:14:5
   |
14 |     self,
   |     ^^^^
...
17 |     lex::{ComparisonToken, Keyword},
   |           ^^^^^^^^^^^^^^^

warning: unused import: `expr::literal`
  --> src/analyze/mod.rs:22:5
   |
22 | use expr::literal;
   |     ^^^^^^^^^^^^^

warning: the item `HashSet` is imported redundantly
   --> src/analyze/mod.rs:226:13
    |
7   | use std::collections::{HashMap, HashSet, VecDeque};
    |                                 ------- the item `HashSet` is already imported here
...
226 |         use std::collections::HashSet;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::collections::HashSet`
   --> src/analyze/mod.rs:226:13
    |
226 |         use std::collections::HashSet;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::convert::TryFrom`
   --> src/analyze/mod.rs:557:13
    |
557 |         use std::convert::TryFrom;
    |             ^^^^^^^^^^^^^^^^^^^^^

warning: the item `HashSet` is imported redundantly
   --> src/analyze/mod.rs:724:21
    |
7   | use std::collections::{HashMap, HashSet, VecDeque};
    |                                 ------- the item `HashSet` is already imported here
...
724 |                 use std::collections::HashSet;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: the item `StorageClass` is imported redundantly
    --> src/analyze/mod.rs:1009:13
     |
18   |     *,
     |     - the item `StorageClass` is already imported here
...
1009 |         use crate::data::StorageClass;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `ExprType`
 --> src/data/error.rs:4:24
  |
4 | use super::hir::{Expr, ExprType};
  |                        ^^^^^^^^

warning: unused import: `VecDeque`
 --> src/data/hir.rs:4:33
  |
4 | use std::collections::{HashMap, VecDeque};
  |                                 ^^^^^^^^

warning: unused import: `super::error::CompileError`
  --> src/data/hir.rs:10:5
   |
10 | use super::error::CompileError;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `AssignmentToken`
  --> src/data/hir.rs:11:18
   |
11 | use super::lex::{AssignmentToken, ComparisonToken, Keyword, Literal, Locatable};
   |                  ^^^^^^^^^^^^^^^

warning: unused imports: `Recover`, `RecoverableResult`
 --> src/data/mod.rs:9:38
  |
9 | pub(crate) use error::{ErrorHandler, Recover, RecoverableResult};
  |                                      ^^^^^^^  ^^^^^^^^^^^^^^^^^

warning: unused import: `crate::data::lex::ComparisonToken::*`
  --> src/fold.rs:93:13
   |
93 |         use crate::data::lex::ComparisonToken::*;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `Token`
 --> src/ir/expr.rs:9:54
  |
9 |     lex::{AssignmentToken, ComparisonToken, Literal, Token},
  |                                                      ^^^^^

warning: the item `StorageClass` is imported redundantly
   --> src/ir/expr.rs:500:44
    |
6   | use crate::data::*;
    |     -------------- the item `StorageClass` is already imported here
...
500 |         use crate::data::{hir::Qualifiers, StorageClass};
    |                                            ^^^^^^^^^^^^

warning: unused import: `Metadata`
  --> src/ir/static_init.rs:13:40
   |
13 |     hir::{Expr, ExprType, Initializer, Metadata, MetadataRef},
   |                                        ^^^^^^^^

warning: unused imports: `Expr`, `MetadataRef`
  --> src/ir/mod.rs:26:24
   |
26 |     hir::{Declaration, Expr, Initializer, Metadata, MetadataRef, Scope, Stmt},
   |                        ^^^^                         ^^^^^^^^^^^

warning: unused import: `std::fmt::Write`
   --> src/data/ast.rs:476:13
    |
476 |         use std::fmt::Write;
    |             ^^^^^^^^^^^^^^^

warning: variable does not need to be mutable
   --> src/ir/expr.rs:469:13
    |
469 |         let mut value = value;
    |             ----^^^^^
    |             |
    |             help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: variable does not need to be mutable
  --> src/ir/static_init.rs:24:20
   |
24 |         &mut self, mut symbol: MetadataRef, init: Option<Initializer>, location: Location,
   |                    ----^^^^^^
   |                    |
   |                    help: remove this `mut`

warning: type alias is never used: `SemanticResult`
  --> src/analyze/mod.rs:25:1
   |
25 | type SemanticResult<T> = Result<T, Locatable<SemanticError>>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: field is never read: `declared_compound_type`
    --> src/analyze/mod.rs:1040:5
     |
1040 |     declared_compound_type: bool,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `is_function`
   --> src/data/ast.rs:276:5
    |
276 |     pub(crate) fn is_function(&self) -> bool {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `compare`
   --> src/ir/expr.rs:407:5
    |
407 | /     fn compare(
408 | |         &mut self, left: Expr, right: Expr, token: ComparisonToken, builder: &mut FunctionBuilder,
409 | |     ) -> IrResult {
410 | |         let (left, right) = (
...   |
433 | |         })
434 | |     }
    | |_____^

warning: method is never used: `assignment`
   --> src/ir/expr.rs:435:5
    |
435 | /     fn assignment(
436 | |         &mut self, lval: Expr, rval: Expr, token: AssignmentToken, builder: &mut FunctionBuilder,
437 | |     ) -> IrResult {
438 | |         let ctype = lval.ctype.clone();
...   |
495 | |         Ok(value)
496 | |     }
    | |_____^

warning: unreachable `pub` item
  --> src/analyze/stmt.rs:16:5
   |
16 |     pub fn parse_stmt(&mut self, stmt: ast::Stmt) -> Stmt {
   |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     help: consider restricting its visibility: `pub(crate)`
   |
note: lint level defined here
  --> src/lib.rs:4:9
   |
4  | #![warn(unreachable_pub)]
   |         ^^^^^^^^^^^^^^^

warning: unreachable `pub` item
   --> src/data/hir.rs:107:5
    |
107 |     pub fn get(&self, i: MetadataRef) -> Rc<Metadata> {
    |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(crate)`

warning: unreachable `pub` item
  --> src/lex/mod.rs:14:1
   |
14 | pub use cpp::PreProcessor;
   | ---^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

warning: unreachable `pub` item
  --> src/parse/mod.rs:15:1
   |
15 | pub use crate::analyze::Analyzer;
   | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

warning: unused imports: `error::Warning`, `self`
 --> src/analyze/expr.rs:3:19
  |
3 | use crate::data::{self, error::Warning, hir::*, lex::ComparisonToken, *};
  |                   ^^^^  ^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `lex::LocationTrait`
 --> src/analyze/init.rs:2:54
  |
2 | use crate::data::{ast, error::SemanticError, hir::*, lex::LocationTrait, types, Location, Type};
  |                                                      ^^^^^^^^^^^^^^^^^^

warning: unused import: `LocationTrait`
 --> src/analyze/stmt.rs:6:22
  |
6 |     lex::{Locatable, LocationTrait},
  |                      ^^^^^^^^^^^^^

warning: the item `Expr` is imported redundantly
   --> src/analyze/stmt.rs:100:13
    |
5   |     hir::*,
    |     ------ the item `Expr` is already imported here
...
100 |         use crate::data::hir::Expr;
    |             ^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `HashMap`
 --> src/analyze/mod.rs:7:24
  |
7 | use std::collections::{HashMap, HashSet, VecDeque};
  |                        ^^^^^^^

warning: unused import: `std::iter::Peekable`
 --> src/analyze/mod.rs:8:5
  |
8 | use std::iter::Peekable;
  |     ^^^^^^^^^^^^^^^^^^^

warning: unused import: `crate::arch`
  --> src/analyze/mod.rs:12:5
   |
12 | use crate::arch;
   |     ^^^^^^^^^^^

warning: unused imports: `ComparisonToken`, `self`
  --> src/analyze/mod.rs:14:5
   |
14 |     self,
   |     ^^^^
...
17 |     lex::{ComparisonToken, Keyword},
   |           ^^^^^^^^^^^^^^^

warning: unused import: `expr::literal`
  --> src/analyze/mod.rs:22:5
   |
22 | use expr::literal;
   |     ^^^^^^^^^^^^^

warning: the item `HashSet` is imported redundantly
   --> src/analyze/mod.rs:226:13
    |
7   | use std::collections::{HashMap, HashSet, VecDeque};
    |                                 ------- the item `HashSet` is already imported here
...
226 |         use std::collections::HashSet;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::collections::HashSet`
   --> src/analyze/mod.rs:226:13
    |
226 |         use std::collections::HashSet;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `std::convert::TryFrom`
   --> src/analyze/mod.rs:557:13
    |
557 |         use std::convert::TryFrom;
    |             ^^^^^^^^^^^^^^^^^^^^^

warning: the item `HashSet` is imported redundantly
   --> src/analyze/mod.rs:724:21
    |
7   | use std::collections::{HashMap, HashSet, VecDeque};
    |                                 ------- the item `HashSet` is already imported here
...
724 |                 use std::collections::HashSet;
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: the item `StorageClass` is imported redundantly
    --> src/analyze/mod.rs:1009:13
     |
18   |     *,
     |     - the item `StorageClass` is already imported here
...
1009 |         use crate::data::StorageClass;
     |             ^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `StructType`
    --> src/analyze/mod.rs:1098:55
     |
1098 |     use crate::data::types::{ArrayType, FunctionType, StructType, Type::*};
     |                                                       ^^^^^^^^^^

warning: unused import: `ExprType`
 --> src/data/error.rs:4:24
  |
4 | use super::hir::{Expr, ExprType};
  |                        ^^^^^^^^

warning: unused import: `VecDeque`
 --> src/data/hir.rs:4:33
  |
4 | use std::collections::{HashMap, VecDeque};
  |                                 ^^^^^^^^

warning: unused import: `super::error::CompileError`
  --> src/data/hir.rs:10:5
   |
10 | use super::error::CompileError;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `AssignmentToken`
  --> src/data/hir.rs:11:18
   |
11 | use super::lex::{AssignmentToken, ComparisonToken, Keyword, Literal, Locatable};
   |                  ^^^^^^^^^^^^^^^

warning: unused import: `crate::Parser`
   --> src/data/hir.rs:526:9
    |
526 |     use crate::Parser;
    |         ^^^^^^^^^^^^^

warning: unused imports: `Recover`, `RecoverableResult`
 --> src/data/mod.rs:9:38
  |
9 | pub(crate) use error::{ErrorHandler, Recover, RecoverableResult};
  |                                      ^^^^^^^  ^^^^^^^^^^^^^^^^^

warning: unused import: `crate::data::lex::ComparisonToken::*`
  --> src/fold.rs:93:13
   |
93 |         use crate::data::lex::ComparisonToken::*;
   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `Token`
 --> src/ir/expr.rs:9:54
  |
9 |     lex::{AssignmentToken, ComparisonToken, Literal, Token},
  |                                                      ^^^^^

warning: the item `StorageClass` is imported redundantly
   --> src/ir/expr.rs:500:44
    |
6   | use crate::data::*;
    |     -------------- the item `StorageClass` is already imported here
...
500 |         use crate::data::{hir::Qualifiers, StorageClass};
    |                                            ^^^^^^^^^^^^

warning: unused import: `Metadata`
  --> src/ir/static_init.rs:13:40
   |
13 |     hir::{Expr, ExprType, Initializer, Metadata, MetadataRef},
   |                                        ^^^^^^^^

warning: unused imports: `Expr`, `MetadataRef`
  --> src/ir/mod.rs:26:24
   |
26 |     hir::{Declaration, Expr, Initializer, Metadata, MetadataRef, Scope, Stmt},
   |                        ^^^^                         ^^^^^^^^^^^

error[E0560]: struct `rcc::Opt` has no field named `filename`
 --> benches/examples.rs:9:9
  |
9 |         filename: "<benchmark>".into(),
  |         ^^^^^^^^ `rcc::Opt` does not have this field
  |
  = note: available fields are: `debug_lex`, `debug_ast`, `debug_asm`, `no_link`, `max_errors`, `search_path`

error[E0061]: this function takes 4 parameters but 2 parameters were supplied
  --> benches/examples.rs:14:29
   |
14 |         b.iter(|| black_box(compile(FIBONACCI, &opts)));
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^ expected 4 parameters

error[E0061]: this function takes 4 parameters but 2 parameters were supplied
  --> benches/examples.rs:20:29
   |
20 |         b.iter(|| black_box(compile(FACTORIAL, &opts)));
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^ expected 4 parameters

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0061, E0560.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `rcc`.
warning: build failed, waiting for other jobs to finish...
      Fixing src/main.rs (1 fix)
warning: unused import: `std::fmt::Write`
   --> src/data/ast.rs:476:13
    |
476 |         use std::fmt::Write;
    |             ^^^^^^^^^^^^^^^

warning: variable does not need to be mutable
   --> src/ir/expr.rs:469:13
    |
469 |         let mut value = value;
    |             ----^^^^^
    |             |
    |             help: remove this `mut`
    |
    = note: `#[warn(unused_mut)]` on by default

warning: variable does not need to be mutable
  --> src/ir/static_init.rs:24:20
   |
24 |         &mut self, mut symbol: MetadataRef, init: Option<Initializer>, location: Location,
   |                    ----^^^^^^
   |                    |
   |                    help: remove this `mut`

warning: type alias is never used: `SemanticResult`
  --> src/analyze/mod.rs:25:1
   |
25 | type SemanticResult<T> = Result<T, Locatable<SemanticError>>;
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default

warning: field is never read: `declared_compound_type`
    --> src/analyze/mod.rs:1040:5
     |
1040 |     declared_compound_type: bool,
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: function is never used: `assert_extern_decl_display`
    --> src/analyze/mod.rs:1165:8
     |
1165 |     fn assert_extern_decl_display(s: &str) {
     |        ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `is_function`
   --> src/data/ast.rs:276:5
    |
276 |     pub(crate) fn is_function(&self) -> bool {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: method is never used: `compare`
   --> src/ir/expr.rs:407:5
    |
407 | /     fn compare(
408 | |         &mut self, left: Expr, right: Expr, token: ComparisonToken, builder: &mut FunctionBuilder,
409 | |     ) -> IrResult {
410 | |         let (left, right) = (
...   |
433 | |         })
434 | |     }
    | |_____^

warning: method is never used: `assignment`
   --> src/ir/expr.rs:435:5
    |
435 | /     fn assignment(
436 | |         &mut self, lval: Expr, rval: Expr, token: AssignmentToken, builder: &mut FunctionBuilder,
437 | |     ) -> IrResult {
438 | |         let ctype = lval.ctype.clone();
...   |
495 | |         Ok(value)
496 | |     }
    | |_____^

warning: unreachable `pub` item
  --> src/analyze/stmt.rs:16:5
   |
16 |     pub fn parse_stmt(&mut self, stmt: ast::Stmt) -> Stmt {
   |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     help: consider restricting its visibility: `pub(crate)`
   |
note: lint level defined here
  --> src/lib.rs:4:9
   |
4  | #![warn(unreachable_pub)]
   |         ^^^^^^^^^^^^^^^

warning: unreachable `pub` item
   --> src/data/hir.rs:107:5
    |
107 |     pub fn get(&self, i: MetadataRef) -> Rc<Metadata> {
    |     ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |     |
    |     help: consider restricting its visibility: `pub(crate)`

warning: unreachable `pub` item
  --> src/lex/mod.rs:14:1
   |
14 | pub use cpp::PreProcessor;
   | ---^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

warning: unreachable `pub` item
  --> src/parse/mod.rs:15:1
   |
15 | pub use crate::analyze::Analyzer;
   | ---^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   | |
   | help: consider restricting its visibility: `pub(crate)`
   |
   = help: or consider exporting it for use by other crates

error: build failed

@jyn514 jyn514 added the C-bug Category: This is a bug. label Apr 12, 2020
@jyn514
Copy link
Member Author

jyn514 commented Apr 12, 2020

Minimal example:

#![warn(unreachable_pub)]
pub use inner::{A, P};

mod inner {
    pub struct A;
    pub use double_inner::P;
    mod double_inner {
        pub struct P;
    }
}

Rustc warns that P is unreachable in inner even though it must be rexported in order for the pub use inner::{A, P}; to compile. Looks related to #64762.

@JohnTitor JohnTitor added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-visibility Area: Visibility / privacy T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 13, 2020
@jyn514
Copy link
Member Author

jyn514 commented Jan 25, 2023

This is fixed (presumably at the same time as #64762).

@jyn514 jyn514 closed this as completed Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. A-visibility Area: Visibility / privacy C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants