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

Implement unused crate lint for 2018 edition #69203

Closed

Conversation

Aaron1011
Copy link
Member

@Aaron1011 Aaron1011 commented Feb 16, 2020

Fixes #57274

This PR fixes the unused_extern_crate lint to work with the 2018 edition. We now separately track whether or not crates in the extern prelude ended up getting used, and lint those that do not.

Notes:

  • This lint ignores crates that have an extern crate statement. That is, exern crate mycrate as renamed will not trigger a lint for mycrate (but the existing extern crate-based lints will still run). This avoids false-positives when #[macro_use] is involved, and allows this lint to be suppressed using either use mycrate as _ or extern mycrate.
  • I added in a hack which ignores crates named panic_abort and panic_unwind, to avoid lints in libstd. Ideally, we could just do use panic_abort as _ and use panic_unwind as _ - however, this currently triggers an error due to two different panic runtimes being linked in.
  • The extern crate-based lint (e.g. the already existing lint) performs several checks on the metadata of unused crates (e.g. is_compiler_builtins) to see if it should skip linting an otherwise unused crate. Unfortuantely, the nature of the extern prelude means that if a crate ends up unused, we will never have loaded the metadata for it. Unless we want to deliberately load unused crates during the new lint (which seems like a horrible hack), we can only use command line flags to determine if we should skip linting a crate. This prevents us from detecting panic_abort and panic_unwind via crate metadata instead of crate names.
  • There is no span associated with the new warning - by its very nature, there isn't any location that makes sense. Because of this, I chose to include the current crate name in the warning message - otherwise, the messages become useless when multiple crates in a workspace are built in parallel.

@rust-highfive
Copy link
Collaborator

r? @ecstatic-morse

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 16, 2020
@Aaron1011
Copy link
Member Author

This ended up catching several unused crates within the compiler itself, which I fixed. Several crates needed suppressions due to rustc-specific quirks (forcing things to end up in the sysroot, or #[cfg(parallel_compiler)]-related dependencies that are unused with a non-parallel build).

@rust-highfive

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@petrochenkov petrochenkov self-assigned this Feb 16, 2020
@petrochenkov
Copy link
Contributor

This seems significantly more complicated than it can be.

All crate resolutions go through a single point (CrateLoader::maybe_resolve_crate), so CrateLoader can keep a list of crate names requested by source code.
If some name x is not in the list, then the corresponding option --extern x is unused.

The list is finalized after the self.crate_loader.postprocess(krate) call in fn resolve_crate, so all the reporting for unused --extern options can be done at that point without ever going to typeck.

@petrochenkov
Copy link
Contributor

r? @petrochenkov

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 16, 2020
@ehuss
Copy link
Contributor

ehuss commented Feb 16, 2020

I'm a little concerned about turning this on by default. Because Cargo cannot specify dependencies for individual targets, this might give noisy warnings that are annoying to resolve. For example, if you have multiple bin targets, and only one of them uses a dependency, you have to squelch it in all the other targets (lib, other bins, examples, integration tests, benchmarks). Same with dev-dependencies, where it is only used in one example or test, then all other targets will get warnings. For larger projects, this could be very frustrating.

I'm not sure what the right solution is. Perhaps this could be "allow" by default and make it opt-in? Maybe when Cargo has per-target controls, it will be easier to silence the warnings and it could be switched to "warn" by default?

@Aaron1011
Copy link
Member Author

Aaron1011 commented Feb 16, 2020

For example, if you have multiple bin targets, and only one of them uses a dependency, you have to squelch it in all the other targets (lib, other bins, examples, integration tests, benchmarks). Same with dev-dependencies, where it is only used in one example or test, then all other targets will get warnings. For larger projects, this could be very frustrating.

I see - that's quite unfortunate.

Perhaps this could be "allow" by default and make it opt-in?

I'm definitely biased, but I think this lint loses a lot of its value if it's opt-in. Removing unused dependencies improves build times for both your own crates as well as downstream crates - it would be really nice if we could warn about this by default.

Maybe when Cargo has per-target controls, it will be easier to silence the warnings and it could be switched to "warn" by default?

Is there a tracking issue or RFC for that kind of per-target control?

@ehuss
Copy link
Contributor

ehuss commented Feb 16, 2020

I agree this would be useful. I just want to be cautious to not make things worse. It might be useful to gather more data about how common legitimate unused crates are vs the false positives.

rust-lang/cargo#1982 is the main issue tracking per-target dependencies. Someone was working on an RFC, but it looks like they didn't finish.

@Aaron1011
Copy link
Member Author

Aaron1011 commented Feb 16, 2020

We could potentially have Cargo disable the lint (split the new part into a lint called unused_extern_prelude and pass -A unused_extern_prelude) if you're building a multi-target crate. Once Cargo gains better support for per-target dependencies, we could leave it enabled in all cases.

@Aaron1011
Copy link
Member Author

An alternative would be to add the ability to tell rust to ignore crates for the purposes of this lint. This could be applied to panic runtime crates, as well as dev-dependencies.

@bors

This comment has been minimized.

@Aaron1011 Aaron1011 force-pushed the feature/final-lint-unused-crate branch from 6537794 to c669c2b Compare February 17, 2020 12:53
@Aaron1011
Copy link
Member Author

This is blocked on reaching some kind of decision about how to enable this (on-by-default, off-by-default, or some hybrid).

@petrochenkov
Copy link
Contributor

FWIW, it would be nice to land the part of this PR that removes unused crates from Cargo.tomls.

Otherwise, this could be implemented as a new allow-by-default lint unused_extern_options.

@petrochenkov
Copy link
Contributor

Even if cargo passes all the dependencies correctly, it would still make sense to configure this lint separately for cases like playground, which adds 100 or so most popular crates to the command line regardless of whether they are used or not.

@Aaron1011
Copy link
Member Author

Aaron1011 commented Feb 24, 2020

Even if cargo passes all the dependencies correctly, it would still make sense to configure this lint separately for cases like playground, which adds 100 or so most popular crates to the command line regardless of whether they are used or not.

@petrochenkov: Could the playground disable this via -A unused_extern_options?

@petrochenkov
Copy link
Contributor

@Aaron1011
Yes, that's what it's probably going to do if the lint is upgraded from allow-by-default to warn-by-default when the related Cargo issues are fixed, but it would be nice for -A unused_extern_options to not have a collateral damage of allowing unused_extern_crates as well.

@bors

This comment has been minimized.

@Aaron1011 Aaron1011 force-pushed the feature/final-lint-unused-crate branch from c669c2b to c38da53 Compare March 12, 2020 00:25
@rust-highfive

This comment has been minimized.

Aaron1011 added a commit to Aaron1011/rust that referenced this pull request Mar 12, 2020
This lint fires for any unused crates in the Rust 2018 extern prelude
(e.g. passed in via `--extern`)

For now, it is allow-by-default to prevent false positives in
multi-target crate. See rust-lang#69203 (comment)
for more details, and rust-lang/cargo#1982 for
the tracking issue.
@Aaron1011 Aaron1011 force-pushed the feature/final-lint-unused-crate branch from c38da53 to 3db14a8 Compare March 12, 2020 04:36
@petrochenkov petrochenkov added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 12, 2020
@rust-highfive

This comment has been minimized.

This lint fires for any unused crates in the Rust 2018 extern prelude
(e.g. passed in via `--extern`)

For now, it is allow-by-default to prevent false positives in
multi-target crate. See rust-lang#69203 (comment)
for more details, and rust-lang/cargo#1982 for
the tracking issue.
This fixes an ICE for items without a `DefId`
This is necessary for Rustdoc to work, since we never end up calling
`Resolver.into_outputs`
@Aaron1011 Aaron1011 force-pushed the feature/final-lint-unused-crate branch from 894499b to bb0dac2 Compare March 12, 2020 19:58
@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2020-03-13T04:53:17.3592719Z ========================== Starting Command Output ===========================
2020-03-13T04:53:17.3595718Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/a70b1668-d049-435b-a98a-132990ad7d50.sh
2020-03-13T04:53:17.3596121Z 
2020-03-13T04:53:17.3600295Z ##[section]Finishing: Disable git automatic line ending conversion
2020-03-13T04:53:17.3616960Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69203/merge to s
2020-03-13T04:53:17.3619642Z Task         : Get sources
2020-03-13T04:53:17.3619910Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-13T04:53:17.3620155Z Version      : 1.0.0
2020-03-13T04:53:17.3620322Z Author       : Microsoft
---
2020-03-13T04:53:18.6714060Z ##[command]git remote add origin https://github.com/rust-lang/rust
2020-03-13T04:53:18.6721542Z ##[command]git config gc.auto 0
2020-03-13T04:53:18.6726659Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2020-03-13T04:53:19.6708780Z ##[command]git config --get-all http.proxy
2020-03-13T04:53:19.6722281Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/69203/merge:refs/remotes/pull/69203/merge
---
2020-03-13T05:45:37.8176532Z .................................................................................................... 1700/9767
2020-03-13T05:45:42.2228442Z .................................................................................................... 1800/9767
2020-03-13T05:45:53.1575836Z ................................................................i................................... 1900/9767
2020-03-13T05:45:59.7406125Z .................................................................................................... 2000/9767
2020-03-13T05:46:13.2310326Z ......................................................iiiii......................................... 2100/9767
2020-03-13T05:46:23.0210305Z .................................................................................................... 2300/9767
2020-03-13T05:46:25.1210780Z .................................................................................................... 2400/9767
2020-03-13T05:46:28.0919893Z .................................................................................................... 2500/9767
2020-03-13T05:46:48.3696414Z .................................................................................................... 2600/9767
---
2020-03-13T05:49:20.9071106Z .........................i...............i.......................................................... 5000/9767
2020-03-13T05:49:30.3848470Z .................................................................................................... 5100/9767
2020-03-13T05:49:35.5880031Z ....................................................................i............................... 5200/9767
2020-03-13T05:49:41.5167592Z .................................................................................................... 5300/9767
2020-03-13T05:49:50.2661228Z .................................................ii.ii........i...i................................. 5400/9767
2020-03-13T05:49:58.0848256Z .................................................................................................... 5600/9767
2020-03-13T05:50:07.1319307Z .................................................................................................... 5700/9767
2020-03-13T05:50:13.0635676Z .........................................i.......................................................... 5800/9767
2020-03-13T05:50:18.9355565Z .................................................................................................... 5900/9767
2020-03-13T05:50:18.9355565Z .................................................................................................... 5900/9767
2020-03-13T05:50:28.5700111Z .................................................................................................... 6000/9767
2020-03-13T05:50:36.9106177Z ..................................ii...i..ii...........i............................................ 6100/9767
2020-03-13T05:50:53.2487037Z .................................................................................................... 6300/9767
2020-03-13T05:50:56.5222892Z .................................................................................................... 6400/9767
2020-03-13T05:50:56.5222892Z .................................................................................................... 6400/9767
2020-03-13T05:51:01.5562483Z .................................................................i..ii.............................. 6500/9767
2020-03-13T05:51:25.0689710Z .................................................................................................... 6700/9767
2020-03-13T05:51:30.0408955Z ...............................................................i.................................... 6800/9767
2020-03-13T05:51:31.9452794Z .................................................................................................... 6900/9767
2020-03-13T05:51:33.9456541Z .................................................................................................i.. 7000/9767
---
2020-03-13T05:53:09.0909550Z .................................................................................................... 7700/9767
2020-03-13T05:53:13.7324007Z .................................................................................................... 7800/9767
2020-03-13T05:53:19.7323859Z .................................................................................................... 7900/9767
2020-03-13T05:53:25.7970339Z ...............................................i.................................................... 8000/9767
2020-03-13T05:53:35.8756246Z ................................................................................................iiii 8100/9767
2020-03-13T05:53:41.5937215Z iiiiii.i............................................................................................ 8200/9767
2020-03-13T05:53:55.3022624Z .................................................................................................... 8400/9767
2020-03-13T05:54:05.6748074Z .................................................................................................... 8500/9767
2020-03-13T05:54:17.3214722Z .................................................................................................... 8600/9767
2020-03-13T05:54:22.6035878Z .................................................................................................... 8700/9767
---
2020-03-13T05:56:31.1930989Z  finished in 6.907
2020-03-13T05:56:31.2123971Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-13T05:56:31.4064931Z 
2020-03-13T05:56:31.4065251Z running 179 tests
2020-03-13T05:56:34.1608744Z iiii......i...........ii..iiii....i....i...........i............i..i..................i....i........ 100/179
2020-03-13T05:56:36.3593048Z ....i.i.i...iii..iiiiiiiiiiiiiiii.......................iii............ii......
2020-03-13T05:56:36.3595746Z 
2020-03-13T05:56:36.3599916Z  finished in 5.147
2020-03-13T05:56:36.3795566Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-13T05:56:36.5431843Z 
---
2020-03-13T05:56:38.3603682Z  finished in 1.980
2020-03-13T05:56:38.3802579Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-13T05:56:38.5357273Z 
2020-03-13T05:56:38.5358172Z running 9 tests
2020-03-13T05:56:38.5359419Z iiiiiiiii
2020-03-13T05:56:38.5360627Z 
2020-03-13T05:56:38.5360966Z  finished in 0.155
2020-03-13T05:56:38.5556433Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-13T05:56:38.7348836Z 
---
2020-03-13T05:56:57.2565979Z  finished in 18.701
2020-03-13T05:56:57.2798193Z Check compiletest suite=debuginfo mode=debuginfo (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-13T05:56:57.4535868Z 
2020-03-13T05:56:57.4536267Z running 115 tests
2020-03-13T05:57:10.1077353Z iiiii..i.....i..i...i..i.i.i..i..i..ii....i.i....ii..........iiii.........i.....i..i.......ii.i.ii.. 100/115
2020-03-13T05:57:11.6294367Z ...iiii.....ii.
2020-03-13T05:57:11.6295594Z 
2020-03-13T05:57:11.6296185Z  finished in 14.349
2020-03-13T05:57:11.6303596Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2020-03-13T05:57:11.6304324Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2020-03-13T06:08:42.3144390Z 
2020-03-13T06:08:42.3154160Z    Doc-tests core
2020-03-13T06:08:47.3938118Z 
2020-03-13T06:08:47.3938792Z running 2480 tests
2020-03-13T06:08:54.8586546Z ......iiiii......................................................................................... 100/2480
2020-03-13T06:09:03.1158717Z ....................................................................................ii.............. 200/2480
2020-03-13T06:09:22.4013555Z ...................i................................................................................ 400/2480
2020-03-13T06:09:22.4013555Z ...................i................................................................................ 400/2480
2020-03-13T06:09:31.1810934Z ........................................................................i..i..................iiii.. 500/2480
2020-03-13T06:09:46.4063659Z .................................................................................................... 700/2480
2020-03-13T06:09:53.9961051Z .................................................................................................... 800/2480
2020-03-13T06:10:01.6920125Z .................................................................................................... 900/2480
2020-03-13T06:10:09.4562936Z .................................................................................................... 1000/2480
---
2020-03-13T06:12:14.7802485Z    Compiling std v0.0.0 (/checkout/src/libstd)
2020-03-13T06:12:14.8324910Z error: crate `cfg_if` is unused in crate `env`
2020-03-13T06:12:14.8325667Z   |
2020-03-13T06:12:14.8326373Z   = note: `-D unused-extern-options` implied by `-D warnings`
2020-03-13T06:12:14.8327225Z   = help: try removing `cfg_if` from your `Cargo.toml`
2020-03-13T06:12:14.8328064Z error: crate `compiler_builtins` is unused in crate `env`
2020-03-13T06:12:14.8328830Z   |
2020-03-13T06:12:14.8329492Z   = help: try removing `compiler_builtins` from your `Cargo.toml`
2020-03-13T06:12:14.8329840Z 
2020-03-13T06:12:14.8329840Z 
2020-03-13T06:12:14.8338435Z error: crate `libc` is unused in crate `env`
2020-03-13T06:12:14.8339244Z   |
2020-03-13T06:12:14.8339896Z   = help: try removing `libc` from your `Cargo.toml`
2020-03-13T06:12:14.8340205Z 
2020-03-13T06:12:14.8340697Z error: crate `backtrace_rs` is unused in crate `env`
2020-03-13T06:12:14.8341216Z   |
2020-03-13T06:12:14.8341849Z   = help: try removing `backtrace_rs` from your `Cargo.toml`
2020-03-13T06:12:14.8342642Z error: crate `unwind` is unused in crate `env`
2020-03-13T06:12:14.8343161Z   |
2020-03-13T06:12:14.8343771Z   = help: try removing `unwind` from your `Cargo.toml`
2020-03-13T06:12:14.8344081Z 
2020-03-13T06:12:14.8344081Z 
2020-03-13T06:12:14.8344576Z error: crate `hashbrown` is unused in crate `env`
2020-03-13T06:12:14.8345079Z   |
2020-03-13T06:12:14.8345694Z   = help: try removing `hashbrown` from your `Cargo.toml`
2020-03-13T06:12:14.8346491Z error: crate `alloc` is unused in crate `env`
2020-03-13T06:12:14.8346978Z   |
2020-03-13T06:12:14.8347600Z   = help: try removing `alloc` from your `Cargo.toml`
2020-03-13T06:12:14.8347907Z 
---
2020-03-13T06:13:12.6450905Z   local time: Fri Mar 13 06:13:12 UTC 2020
2020-03-13T06:13:12.9403037Z   network time: Fri, 13 Mar 2020 06:13:12 GMT
2020-03-13T06:13:12.9406418Z == end clock drift check ==
2020-03-13T06:13:13.3373334Z 
2020-03-13T06:13:13.3472830Z ##[error]Bash exited with code '1'.
2020-03-13T06:13:13.3486886Z ##[section]Finishing: Run build
2020-03-13T06:13:13.3536582Z ##[section]Starting: Checkout rust-lang/rust@refs/pull/69203/merge to s
2020-03-13T06:13:13.3541623Z Task         : Get sources
2020-03-13T06:13:13.3541973Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
2020-03-13T06:13:13.3542409Z Version      : 1.0.0
2020-03-13T06:13:13.3542622Z Author       : Microsoft
2020-03-13T06:13:13.3542622Z Author       : Microsoft
2020-03-13T06:13:13.3542953Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
2020-03-13T06:13:13.3543350Z ==============================================================================
2020-03-13T06:13:13.6750006Z Cleaning any cached credential from repository: rust-lang/rust (GitHub)
2020-03-13T06:13:13.6793697Z ##[section]Finishing: Checkout rust-lang/rust@refs/pull/69203/merge to s
2020-03-13T06:13:13.6903382Z Cleaning up task key
2020-03-13T06:13:13.6904754Z Start cleaning up orphan processes.
2020-03-13T06:13:13.7058641Z Terminate orphan process: pid (3912) (python)
2020-03-13T06:13:13.7285239Z ##[section]Finishing: Finalize Job

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @rust-lang/infra. (Feature Requests)

@Aaron1011
Copy link
Member Author

This is firing on a large number of tests. I think users are going to run into this problem as well - should we be suppressing these warnings for tests?

@petrochenkov
Copy link
Contributor

@Aaron1011

This is firing on a large number of tests.

Why does it happen?
Is each doc test considered a separate program, but the --extern options are inherited from the whole crate?
If doc tests use rustdoc driver (I'm not sure), then it can be detected using sess.opts.actually_rustdoc.

@@ -1067,6 +1067,10 @@ impl<'a> Builder<'a> {
// some code doesn't go through this `rustc` wrapper.
rustflags.arg("-Wrust_2018_idioms");
rustflags.arg("-Wunused_lifetimes");
// Remove this after the next cfg(bootstrap) bump
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Remove this after the next cfg(bootstrap) bump
// Remove this condition after the next cfg(bootstrap) bump

declare_lint! {
pub UNUSED_EXTERN_OPTIONS,
Allow,
"extern path crates that are never used"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"extern path crates that are never used"
"`--extern` command line options that are never used"

@@ -136,6 +136,9 @@ pub struct ResolverOutputs {
/// Extern prelude entries. The value is `true` if the entry was introduced
/// via `extern crate` item and not `--extern` option or compiler built-in.
pub extern_prelude: FxHashMap<Name, bool>,
/// All crates that ended up getting loaded.
/// Used to determine which `--extern` entries are unused
pub used_crates: Option<FxHashSet<Symbol>>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting this list into ResolverOutputs should be unnecessary, the lint can be reported before ResolverOutputs are constructed.
The whole lint logic should be able to live entirely inside rustc_metadata, I suggested the point to report it in #69203 (comment) (CrateLoader::postprocess).

Copy link
Member Author

@Aaron1011 Aaron1011 Mar 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petrochenkov: Things are not actually done when postprocess is called - while we won't resolve any more crates, we may register additional names for crates that are already loaded. I initially finalized things in postprocess, but that ended up causing false positives.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may register additional names for crates that are already loaded.

How?
(Ignoring rustdoc, which shouldn't report this lint.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we find a previous crate when loading a crate:

result = LoadResult::Previous(cnum);

then we may map a different name in the extern prelude to an already loaded crate.

Copy link
Contributor

@petrochenkov petrochenkov Mar 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CrateLoader::load can only happen before postprocess.
(Or rather it can happen later during AST lowering when resolving std paths, but if lowering actually loads new crates, it will break more than just this lint.)
Could you give some examples of the false positives?

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 13, 2020
@bors
Copy link
Contributor

bors commented Mar 14, 2020

☔ The latest upstream changes (presumably #69076) made this pull request unmergeable. Please resolve the merge conflicts.

@est31
Copy link
Member

est31 commented Mar 29, 2020

There is no span associated with the new warning - by its very nature, there isn't any location that makes sense.

From an end user perspective, the location that would make sense is the declaration in Cargo.toml.

However, that would require cargo to tell the span to rustc and would bloat the rustc invocation even more than now. Note that there's an upper limit onto how much you can pass to a process. Maybe cargo could intercept the warning somehow and add a span to it? Note that Cargo currently doesn't yield any spans whatsoever.

@joelpalmer joelpalmer added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 6, 2020
@Dylan-DPC-zz
Copy link

Closing this due to inactivity.

@Dylan-DPC-zz Dylan-DPC-zz added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2018: fix lint on unused dependencies
9 participants