Skip to content

[Diagnostics] --future-incompat-report gave me incorrect information and incorrect instructions #15337

@mcclure

Description

@mcclure

Problem

I got a message at the end of my cargo output telling me to run --future-incompat-report. When I did this, I got a messsage which (1) misdescribed my package and (2) told me to run a different cargo invocation; this second cargo invocation simply gave me an error.

There turns out to be a different invocation which did work, which either the initial suggestion to run --future-incompat-report should have given me exclusively, or which --future-incompat-report should have aliased to.

Steps

I have a small WIP program here:

https://github.com/mcclure/lisp0-experiment/tree/unstable

What it does isn't important because all we'll be doing is building it. Check out branch unstable, commit 35d955f995. Build it.

Observed behavior

I did the following tests in Rust 1.83.0 and Rust 1.85.1 (the newest version rustup will give me) and saw identical behavior in each.

When I run cargo build, it prints at the end

warning: the following packages contain code that will be rejected by a future version of Rust: lisp0 v0.1.0 (/home/mcc/work/r/emj)
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 4

Gosh, that's great to know! I immediately run cargo build --future-incompat-report. Now it prints at the end:

warning: the following packages contain code that will be rejected by a future version of Rust: lisp0 v0.1.0 (/home/mcc/work/r/emj)
note: 
To solve this problem, you can try the following approaches:


- If the issue is not solved by updating the dependencies, a fix has to be
implemented by those dependencies. You can help with that by notifying the
maintainers of this problem (e.g. by creating a bug report) or by proposing a
fix to the maintainers (e.g. by creating a pull request):

  - lisp0@0.1.0
  - Repository: <not found>
  - Detailed warning command: `cargo report future-incompatibilities --id 5 --package lisp0@0.1.0`

- If waiting for an upstream fix is not an option, you can use the `[patch]`
section in `Cargo.toml` to use your own version of the dependency. For more
information, see:
https://doc.rust-lang.org/cargo/reference/overriding-dependencies.html#the-patch-section
        
note: this report can be shown with `cargo report future-incompatibilities --id 4`

Wat

As you can see from the Cargo.toml, "lisp0" is the package I am building. I cannot update the dependencies because it's not a dependency. I cannot email the maintainer because I am the maintainer.

Well, fine, I guess I just need to run the detailed warning. I run cargo report future-incompatibilities --id 5 --package lisp0@0.1.0, just as it suggests.

error: could not find report with ID 5
Available IDs are: 1, 2, 3, 4

Wat

I notice that the original message also listed cargo report future-incompatibilities --id 4 as an option. I run that. It gives me a clear, concise explanation of the problem (to summarize: I used macro_rules! incorrectly). This "--id 4" message is exactly what I would have expected --future-incompat-report to print to begin with.

Expected behavior:

  • The text "to see what the problems were, use the option --future-incompat-report, or run cargo report future-incompatibilities --id 4" to me suggests that these two options are identical. If they are not identical, the text suggesting them should have clarified the difference.
  • If I am building package lisp0, Rust diagnostics should not discuss the lisp0 package as if it were a dependency.
  • --future-incompat-report should not under any circumstances tell me to access a report with an id that does not exist.
  • The text from cargo report future-incompatibilities --id 4 is what --future-incompat-report should have printed.

Possible Solution(s)

The text from cargo report future-incompatibilities --id 4 is what --future-incompat-report should have printed.

Notes

I don't know for a fact if this is being caused by cargo or rustc.

I have not tested with smaller test cases, so I don't know if this is a general problem with --future-incompat-report or somehow specific to my project.

Version

cargo 1.85.1 (d73d2caf9 2024-12-31)
release: 1.85.1
commit-hash: d73d2caf9e41a39daf2a8d6ce60ec80bf354d2a7
commit-date: 2024-12-31
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Debian n/a (trixie) [64-bit]

Metadata

Metadata

Assignees

Labels

A-future-incompatArea: future incompatible reportingC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions