-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
uninhabited_reference: new lint #11878
Conversation
r? @giraffate (rustbot has picked a reviewer for you, use r? to override) |
d805db1
to
9b34cf5
Compare
I've converted it to draft because I get too many hits on popular crates. I think the lint should be restricted to two cases: dereferencing a reference to an uninhabited type, and returning a reference to an uninhabited type. |
bb9d1b0
to
1ff8162
Compare
I've ran lintcheck on the 500 most popular crates with the updated version of this lint. Only |
1ff8162
to
305c7d7
Compare
Update: the libc PR has been merged, so this lint, after having caught a legitimate issue, does not trigger for the top-500 packages. |
☔ The latest upstream changes (presumably #11597) made this pull request unmergeable. Please resolve the merge conflicts. |
305c7d7
to
ead26eb
Compare
Requesting another reviewer as @giraffate seems to be unavailable at this time. r? @flip1995 |
Thanks for running lintcheck ❤️ |
ead26eb
to
d630546
Compare
e86d9ec
to
bc88826
Compare
bc88826
to
cdfa38a
Compare
@bors r+ Thanks! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Summary: `1.76.0` release with fixes addressing the following: * Release notes ([link](https://releases.rs/docs/1.76.0/)) * Most notable is [#118054](rust-lang/rust#118054) manifesting as: ``` error: unused implementer of `futures::Future` that must be used --> fbcode/mlx/metalearner/housekeeper/housekeeper.rs:213:13 | 213 | self.ping_oncall(&oncall, usecases); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: futures do nothing unless you `.await` or poll them = note: requested on the command line with `-D unused-must-use` ``` * Changes in `search_index.js` spec for `rustdoc` ([link](https://github.com/rust-lang/rust/pull/118910/files#diff-3ac57789ddcd2856a3b4f0c444f2813315179bdbe55bb945fe64fcb27b53fee5L491)) * Split of `#![feature(exposed_provenance)]` ([link](rust-lang/rust#118487)) from [#95228](rust-lang/rust#95228) * `buck2` OSS toolchain bump to `nightly-2023-12-11` just before [#11878](rust-lang/rust-clippy#11878) and a bunch of other clippy lint renames. Reviewed By: dtolnay Differential Revision: D53776867 fbshipit-source-id: 78db83d8cdd6b0abae2b94ed1075e67b501fcd73
Summary: `1.76.0` release with fixes addressing the following: * Release notes ([link](https://releases.rs/docs/1.76.0/)) * Most notable is [#118054](rust-lang/rust#118054) manifesting as: ``` error: unused implementer of `futures::Future` that must be used --> fbcode/mlx/metalearner/housekeeper/housekeeper.rs:213:13 | 213 | self.ping_oncall(&oncall, usecases); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: futures do nothing unless you `.await` or poll them = note: requested on the command line with `-D unused-must-use` ``` * Changes in `search_index.js` spec for `rustdoc` ([link](https://github.com/rust-lang/rust/pull/118910/files#diff-3ac57789ddcd2856a3b4f0c444f2813315179bdbe55bb945fe64fcb27b53fee5L491)) * Split of `#![feature(exposed_provenance)]` ([link](rust-lang/rust#118487)) from [#95228](rust-lang/rust#95228) * `buck2` OSS toolchain bump to `nightly-2023-12-11` just before [#11878](rust-lang/rust-clippy#11878) and a bunch of other clippy lint renames. Reviewed By: dtolnay Differential Revision: D53776867 fbshipit-source-id: 78db83d8cdd6b0abae2b94ed1075e67b501fcd73
Summary: `1.76.0` release with fixes addressing the following: * Release notes ([link](https://releases.rs/docs/1.76.0/)) * Most notable is [#118054](rust-lang/rust#118054) manifesting as: ``` error: unused implementer of `futures::Future` that must be used --> fbcode/mlx/metalearner/housekeeper/housekeeper.rs:213:13 | 213 | self.ping_oncall(&oncall, usecases); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: futures do nothing unless you `.await` or poll them = note: requested on the command line with `-D unused-must-use` ``` * Changes in `search_index.js` spec for `rustdoc` ([link](https://github.com/rust-lang/rust/pull/118910/files#diff-3ac57789ddcd2856a3b4f0c444f2813315179bdbe55bb945fe64fcb27b53fee5L491)) * Split of `#![feature(exposed_provenance)]` ([link](rust-lang/rust#118487)) from [#95228](rust-lang/rust#95228) * `buck2` OSS toolchain bump to `nightly-2023-12-11` just before [#11878](rust-lang/rust-clippy#11878) and a bunch of other clippy lint renames. Reviewed By: dtolnay Differential Revision: D53776867 fbshipit-source-id: 78db83d8cdd6b0abae2b94ed1075e67b501fcd73
Summary: `1.76.0` release with fixes addressing the following: * Release notes ([link](https://releases.rs/docs/1.76.0/)) * Most notable is [#118054](rust-lang/rust#118054) manifesting as: ``` error: unused implementer of `futures::Future` that must be used --> fbcode/mlx/metalearner/housekeeper/housekeeper.rs:213:13 | 213 | self.ping_oncall(&oncall, usecases); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: futures do nothing unless you `.await` or poll them = note: requested on the command line with `-D unused-must-use` ``` * Changes in `search_index.js` spec for `rustdoc` ([link](https://github.com/rust-lang/rust/pull/118910/files#diff-3ac57789ddcd2856a3b4f0c444f2813315179bdbe55bb945fe64fcb27b53fee5L491)) * Split of `#![feature(exposed_provenance)]` ([link](rust-lang/rust#118487)) from [#95228](rust-lang/rust#95228) * `buck2` OSS toolchain bump to `nightly-2023-12-11` just before [#11878](rust-lang/rust-clippy#11878) and a bunch of other clippy lint renames. Reviewed By: dtolnay Differential Revision: D53776867 fbshipit-source-id: 78db83d8cdd6b0abae2b94ed1075e67b501fcd73
Summary: `1.76.0` release with fixes addressing the following: * Release notes ([link](https://releases.rs/docs/1.76.0/)) * Most notable is [#118054](rust-lang/rust#118054) manifesting as: ``` error: unused implementer of `futures::Future` that must be used --> fbcode/mlx/metalearner/housekeeper/housekeeper.rs:213:13 | 213 | self.ping_oncall(&oncall, usecases); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: futures do nothing unless you `.await` or poll them = note: requested on the command line with `-D unused-must-use` ``` * Changes in `search_index.js` spec for `rustdoc` ([link](https://github.com/rust-lang/rust/pull/118910/files#diff-3ac57789ddcd2856a3b4f0c444f2813315179bdbe55bb945fe64fcb27b53fee5L491)) * Split of `#![feature(exposed_provenance)]` ([link](rust-lang/rust#118487)) from [#95228](rust-lang/rust#95228) * `buck2` OSS toolchain bump to `nightly-2023-12-11` just before [#11878](rust-lang/rust-clippy#11878) and a bunch of other clippy lint renames. Reviewed By: dtolnay Differential Revision: D53776867 fbshipit-source-id: 78db83d8cdd6b0abae2b94ed1075e67b501fcd73
Summary: `1.76.0` release with fixes addressing the following: * Release notes ([link](https://releases.rs/docs/1.76.0/)) * Most notable is [#118054](rust-lang/rust#118054) manifesting as: ``` error: unused implementer of `futures::Future` that must be used --> fbcode/mlx/metalearner/housekeeper/housekeeper.rs:213:13 | 213 | self.ping_oncall(&oncall, usecases); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: futures do nothing unless you `.await` or poll them = note: requested on the command line with `-D unused-must-use` ``` * Changes in `search_index.js` spec for `rustdoc` ([link](https://github.com/rust-lang/rust/pull/118910/files#diff-3ac57789ddcd2856a3b4f0c444f2813315179bdbe55bb945fe64fcb27b53fee5L491)) * Split of `#![feature(exposed_provenance)]` ([link](rust-lang/rust#118487)) from [#95228](rust-lang/rust#95228) * `buck2` OSS toolchain bump to `nightly-2023-12-11` just before [#11878](rust-lang/rust-clippy#11878) and a bunch of other clippy lint renames. Reviewed By: dtolnay Differential Revision: D53776867 fbshipit-source-id: 78db83d8cdd6b0abae2b94ed1075e67b501fcd73
Summary: `1.76.0` release with fixes addressing the following: * Release notes ([link](https://releases.rs/docs/1.76.0/)) * Most notable is [#118054](rust-lang/rust#118054) manifesting as: ``` error: unused implementer of `futures::Future` that must be used --> fbcode/mlx/metalearner/housekeeper/housekeeper.rs:213:13 | 213 | self.ping_oncall(&oncall, usecases); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: futures do nothing unless you `.await` or poll them = note: requested on the command line with `-D unused-must-use` ``` * Changes in `search_index.js` spec for `rustdoc` ([link](https://github.com/rust-lang/rust/pull/118910/files#diff-3ac57789ddcd2856a3b4f0c444f2813315179bdbe55bb945fe64fcb27b53fee5L491)) * Split of `#![feature(exposed_provenance)]` ([link](rust-lang/rust#118487)) from [#95228](rust-lang/rust#95228) * `buck2` OSS toolchain bump to `nightly-2023-12-11` just before [#11878](rust-lang/rust-clippy#11878) and a bunch of other clippy lint renames. Reviewed By: dtolnay Differential Revision: D53776867 fbshipit-source-id: 78db83d8cdd6b0abae2b94ed1075e67b501fcd73
Close #11851
The lint is implemented on function parameters and return types, as this is the place where the risk of exchanging references to uninhabited types is the highest. Other constructs, such as in a local variable,
would require the use of
unsafe
and will clearly be done on purpose.changelog: [
uninhabited_reference
]: new lint