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

Make const_err a future-incompatibility lint and eventually a hard error #71800

Closed
RalfJung opened this issue May 2, 2020 · 17 comments · Fixed by #102091
Closed

Make const_err a future-incompatibility lint and eventually a hard error #71800

RalfJung opened this issue May 2, 2020 · 17 comments · Fixed by #102091
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-future-incompatibility Category: Future-incompatibility lints T-lang Relevant to the language team, which will review and decide on the PR/issue.

Comments

@RalfJung
Copy link
Member

RalfJung commented May 2, 2020

Currently, when Miri raises an error while evaluating a const, that does not lead to a hard compiler error (sess.struct_err or so). Instead, the const_err lint is emitted (and there are a bunch of exceptions I keep forgetting... promoteds and static each get their own treatment). Then later consumers of consts have to remember to struct_err when they query for the value of the const (and they do that with inconsistent messages and some might even forget to do it), usually without any actual details so if you allow(const_err) the error makes no sense... in a word, it's a mess (and so is the code backing this).

Can we clean that up? I think we should try. IMO the long-term goal should be to just make errors when evaluating a const hard errors, so we can have that error-reporting code once in librustc_mir/const_eval and not worry about it everywhere else in the compiler. Right now, it's a deny-by-default lint, for backwards compatibility.

To make this slightly more complicated, we also evaluate consts that the program does not actually use, so we can tell library crate authors when their consts are wrong. Inside the const-eval engine, these look like normal const-eval queries, so if we switch to a hard error, that would be a hard error, too. We have to decide what to do about that.

Option 1: treat unused consts like used consts whenever we can

The easiest way forward would be to say that an eventual hard error for CTFE failures in unused consts is fine. Then we can just make the current const_err lint reporting into a future-incompatibility lint (maybe clean it up a little, and clean up the way that we error when we truly need the const value). Later, we can experiment with making it a hard error, and at that point everything would become simple and uniform and beautiful. (Promoteds would still only lint as the user did not ask for const-evaluation, but at least behavior wouldn't depend on context any more: const/static always hard-error [which currently const only does for some callers], and promoteds never do. Okay maybe it's not beautiful but it is better.)

Note that this matches what we already do for static. However, unlike static, const can exist in generic contexts (as associated consts), and those we cannot evaluate and thus not lint or error for. So, "top-level" const would behave differently from associated consts in terms of error reporting. (That is already the case, but currently the difference is a deny-by-default lint that can be allow'ed away.) There is no technical need to hard-error on CTFE failures in unused consts, but then one could say the same about unused statics and we do already hard-error there (and I don't remember anyone ever complaining about that). So my personal preference would be to hard-error for failing consts as often as we can.

Option 2: keep just linting for unused consts

Alternatively, maybe we don't want to hard-error when a const that is not used fails to evaluate (consistently with how we cannot produce a hard error when an assoc const fails to evaluate as we cannot even check that). Arguably we should then downgrade such messages to warn-by-default.

In this case we should probably find a way for the caller to inform the const-eval engine whether they truly need the result of the query or not (almost always they do need it, except for that lint), and then use that to control our lint level... but how can we do that without duplicating errors or work? Currently it is deduplicated because the query only runs once, and it always emits a lint, and then the caller potentially additionally emits a hard error but pointing at the span where the const actually gets used. But this is bad, it means that with allow(const_err) none of the relevant error details are shown even when we do get a hard error.

Backwards compatibility concerns

A potential concern here might be that if we make CTFE errors hard errors, we have to be careful with making the Miri engine raise more CTFE errors (like, improved UB checking). But that is already the case: when raise more CTFE errors, the consts affected by it go from having a value to not having one, and cannot be used any more. So I don't think the proposal here creates any new backcompat issues.

Cc @rust-lang/wg-const-eval @rust-lang/lang

@RalfJung RalfJung added T-lang Relevant to the language team, which will review and decide on the PR/issue. A-const-eval Area: Constant evaluation (MIR interpretation) labels May 2, 2020
@joshtriplett
Copy link
Member

joshtriplett commented May 2, 2020 via email

@oli-obk
Copy link
Contributor

oli-obk commented May 3, 2020

I think we should have a single hard-error
behavior for all constants.

Just for the record: I think so, too.

We've had the deny warning around since one of my first contributions to rustc, and it not being a hard error has frequently required us to add more complexity to code that tries to work with constants just in case the user used #[warn(const_err)] or even #[allow(const_err)].

@Shnatsel
Copy link
Member

Shnatsel commented May 3, 2020

For reference, here are all occurrences of const_err on crates.io, found with ripgrep: https://gist.github.com/Shnatsel/ff0bc7da32a0129fe5fe7211fac7d45c

@RalfJung
Copy link
Member Author

RalfJung commented May 3, 2020

@Shnatsel thanks!
That's actually not that many (131 lines, and a bunch of these are deny(const_err) or comments or function names).

@RalfJung
Copy link
Member Author

RalfJung commented May 6, 2020

Here's an example of an ICE caused by being able to make const_err not hard errors, that would be quite annoying to fix I think (other than what this issue proposes):

#![feature(const_transmute)]
#![warn(const_err)]

use std::mem;

const X: &i32 = unsafe {
    let x = 0;
    mem::transmute(&x)
};

This is just an example of the kind of problem we have because one part of the compiler cannot rely on other parts actually properly reporting good hard errors in certain situation. The code where we currently call delay_span_bug could emit a hard error instead, but that error is not as good as the const_err as it has less information, and we would get both errors in the default setting of deny(const_err).

@RalfJung
Copy link
Member Author

RalfJung commented May 8, 2020

Ah I think that ICE will actually be fixed by #71665... or at least behavior will change (likely to a duplicate error as discussed here).

Right now, interning fails on that constant, raises a Miri error, and that Miri error is treated as const_err. With my PR, interning can never fail with a Miri error (it might report diagnostic errors but the operation will always complete) -- and then in the next step we'll get to validation, and validation errors are always hard errors.

So this particular ICE can probably actually be fixed... but thinking this through is quite complicated each time.^^

@nikomatsakis
Copy link
Contributor

I am 👍 with making it a future-incompatibility lint, if it's not already, and I would be in favor of moving to a hard error. I'm not sure of the timeline on those two steps, but I imagine that doing a crater run with a hard error would be a good way to augment the data that @Shnatsel gathered in terms of assessing the impact (the ripgrep suggests "not much", right?).

@nikomatsakis
Copy link
Contributor

I wonder if an RFC is an appropriate idea here.

@golddranks
Copy link
Contributor

The momentum here seems to be that the const_err lint is going to go the way of the dodo. It makes me think whether we should get rid of the "note: #[deny(const_err)] on by default" note on any const item eval failure? If we discourage the use of this lint, we shouldn't advertise it by default – the users may get the wrong picture there. I sure did.

I'm considering removing the note a part of #72660 for now. If anybody disagrees, please tell me.

@RalfJung
Copy link
Member Author

That note is AFAIK printed by the general lint code in rustc.

But maybe it goes away when we declare const_err a future compat lint?

@RalfJung
Copy link
Member Author

As part of this we should probably also clean up our span handling for const errors... currently there are up to 3 spans which the party reporting the error is specifying, and it is entirely unclear what they all mean:

span: Option<Span>,

tcx: TyCtxtAt<'tcx>,

span: Option<Span>,

@RalfJung RalfJung added the C-cleanup Category: PRs that clean code up or issues documenting cleanup. label Aug 12, 2020
@lcnr
Copy link
Contributor

lcnr commented Aug 15, 2020

Taken from rust-lang/const-eval#53 (comment) as it is more relevant to this issue:

If we convert const_err to a hard error, we stabilize when we evaluate associated consts:

struct Foo<T>(T);

impl<T> Foo<T> {
    const ASSOC:usize = 4 / std::mem::size_of::<T>();

    fn dummy1(&self) {}

    fn dummy2(&self) {
        if false {
            Self::ASSOC;
        }
    }

    fn dummy3(&self) {
        Self::ASSOC;
    }
}

fn main() {
    // Which of these lines should try to evaluate `Foo::<()>::ASSOC` and cause `const_err`.
    let x: Foo<()> = Foo(()); // does not rn
    x.dummy1(); // does not rn
    x.dummy2(); // does rn (I fairly strongly oppose changing this to a hard error)
    x.dummy3(); // does rn
}

@RalfJung
Copy link
Member Author

RalfJung commented Aug 15, 2020

x.dummy2(); // does rn (I fairly strongly oppose changing this to a hard error)

I think a hard error is the only sensible choice. Leaving aside associated consts, we recently fixed the following to be a hard error:

const ERR: i32 = 1/0;

fn foo() { if false { let _val = ERR; } }

This was needed to resolve #67083, which was considered a critical issue. By the same argument, we have to also make dummy2 a hard error.

@RalfJung
Copy link
Member Author

RalfJung commented Aug 15, 2020

@lcnr your dummy2 and dummy3 btw are already hard errors now -- they fail to compile even with allow(const_err).

So nobody is proposing to change dummy2 to a hard error, it already is. allow(const_err) just makes the error message terrible, which is hard to fix without making const_err a hard error itself (so we do not need to rely on the later "erroneous constant used"). The only behavior that is proposed to be changed here is what happens with entirely unused consts (syntactically unused, even in dead code) that fail to evaluate.

@lcnr
Copy link
Contributor

lcnr commented Aug 15, 2020

true 🤔 I was thinking of 4 / Self::ASSOC here... mb (with assoc being std::mem::size_of::<Self>())

m-ou-se added a commit to m-ou-se/rust that referenced this issue Feb 3, 2021
make const_err a future incompat lint

This is the first step for rust-lang#71800: make const_err a future-incompat lint. I also rewrote the const_err lint description as the old one seemed wrong.

This has the unfortunate side-effect of making const-eval error even more verbose by making the const_err message longer without fixing the redundancy caused by additionally emitting an error on each use site of the constant. We cannot fix that redundancy until const_err is a *hard* error (at that point the error-on-use-site can be turned into a `delay_span_bug!` for uses of monomorphic consts, and into a nicely rendered error for [lazily / post-monomorhization evaluated] associated consts).

~~The one annoying effect of this PR is that `let _x = &(1/(1-1));` now also shows the future-incompat warning, even though of course we will *not* make this a hard error. We'll instead (hopefully) stop promoting it -- see rust-lang/rfcs#3027. The only way I see to avoid the future-incompat warning is to use a different lint for "failure to evaluate promoted".~~

Cc `@rust-lang/wg-const-eval`
pabigot added a commit to pabigot/atsamd that referenced this issue Dec 18, 2022
As of Rust 1.66 this produces:

warning: lint `const_err` has been removed: converted into hard error, see issue #71800 <rust-lang/rust#71800> for more information
 --> /mnt/devel/external/Rust/github.com/atsamd-rs/atsamd/pac/atsamd51p/src/lib.rs:3:9
  |
3 | #![deny(const_err)]
  |         ^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default
marcsvll added a commit to marcsvll/parsec-tool that referenced this issue Dec 23, 2022
This PR only removed `const_err` since it will be a hard error in future: rust-lang/rust#71800
marcsvll added a commit to marcsvll/parsec-tool that referenced this issue Dec 23, 2022
This PR only removed `const_err` since it will be a hard error in future: rust-lang/rust#71800

Signed-off-by: Marcus de Lima <marcus.lima@azion.com>
pabigot added a commit to pabigot/atsamd that referenced this issue Dec 27, 2022
As of Rust 1.66 this produces:

warning: lint `const_err` has been removed: converted into hard error, see issue #71800 <rust-lang/rust#71800> for more information
 --> /mnt/devel/external/Rust/github.com/atsamd-rs/atsamd/pac/atsamd51p/src/lib.rs:3:9
  |
3 | #![deny(const_err)]
  |         ^^^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default
aplanas added a commit to aplanas/rust-keylime that referenced this issue Jan 16, 2023
In 1.66 / 1.66.1 const_err is already a hard error, and was enabled as
such as long ago. New compilers will complain in case that this is still
used:

  warning: lint `const_err` has been removed: converted into hard error

More info:
  rust-lang/rust#71800
ansasaki pushed a commit to aplanas/rust-keylime that referenced this issue Jan 19, 2023
In 1.66 / 1.66.1 const_err is already a hard error, and was enabled as
such as long ago. New compilers will complain in case that this is still
used:

  warning: lint `const_err` has been removed: converted into hard error

More info:
  rust-lang/rust#71800
ansasaki pushed a commit to keylime/rust-keylime that referenced this issue Jan 19, 2023
In 1.66 / 1.66.1 const_err is already a hard error, and was enabled as
such as long ago. New compilers will complain in case that this is still
used:

  warning: lint `const_err` has been removed: converted into hard error

More info:
  rust-lang/rust#71800
flavio added a commit to flavio/wapc-rs that referenced this issue Jan 25, 2023
The lint `const_err` has been removed: converted into hard error, see issue #71800 <rust-lang/rust#71800> for more information

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
thomcc pushed a commit to tcdi/postgrestd that referenced this issue Feb 10, 2023
make const_err a hard error

This lint has been deny-by-default with future incompat wording since [Rust 1.51](rust-lang/rust#80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;)

r? `@oli-obk`
Fixes rust-lang/rust#71800
Fixes rust-lang/rust#100114
pkedy pushed a commit to wapc/wapc-rs that referenced this issue Feb 13, 2023
* chore(deps): update rust version

Update to latest stable release of Rust, this is required to build
wasmtime's latest release.

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

* chore(refactor): fix clippy warnings

The lint `const_err` has been removed: converted into hard error, see issue #71800 <rust-lang/rust#71800> for more information

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

* chore(deps): update to latest version of wasmtime

Update wasmtime-provider to consume latest version of wasmtime

Signed-off-by: Flavio Castelli <fcastelli@suse.com>

---------

Signed-off-by: Flavio Castelli <fcastelli@suse.com>
dmilith added a commit to VerKnowSys/krecik that referenced this issue Mar 9, 2023
hawkw pushed a commit to tokio-rs/tracing that referenced this issue Apr 12, 2023
## Motivation

Clippy check fails in recent CI runs in v0.1.x branch PRs, for example
this run:
https://github.com/tokio-rs/tracing/actions/runs/4641107803/jobs/8215263838


Relevant error logs:
```
error: lint `const_err` has been removed: converted into hard error, see issue #71800 <rust-lang/rust#71800> for more information
   --> tracing-core/src/lib.rs:132:5
    |
132 |     const_err,
    |     ^^^^^^^^^
    |
    = note: `-D renamed-and-removed-lints` implied by `-D warnings`


error: deref which would be done by auto-deref
   --> tracing-core/src/dispatcher.rs:371:26
    |
371 |                 return f(&*entered.current());
    |                          ^^^^^^^^^^^^^^^^^^^ help: try this: `&entered.current()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
    = note: `-D clippy::explicit-auto-deref` implied by `-D warnings`


error: deref which would be done by auto-deref
   --> tracing-core/src/dispatcher.rs:393:20
    |
393 |             Some(f(&*entered.current()))
    |                    ^^^^^^^^^^^^^^^^^^^ help: try this: `&entered.current()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
```

## Solution

Fix the warnings based on the suggestions for Clippy.
ten3roberts added a commit to ten3roberts/eyre that referenced this issue Aug 15, 2023
yaahc pushed a commit to eyre-rs/eyre that referenced this issue Aug 16, 2023
* fix: const_err is not a hard error

See: rust-lang/rust#71800

* fix: lints

* fix: macro doctests

* fix: renamed lint

* fix: restore use of enum variant
linyihai pushed a commit to linyihai/rust-clippy that referenced this issue Oct 23, 2023
同步社区最新master分支代码

Created-by: lizheng 30020856
Author-id: 11958
MR-id: 457385
Commit-by: bors;Michael Krasnitski;Mara Bos;KaDiWa;Alex Macleod;Manish Goregaokar;Tyler Weaver;Niki4tap;koka;Sylvain Desodt;ksaleem;Philipp Krones;Collin Styles;xFrednet;Martin Fischer;Evan Typanski;Vincenzo Palazzo;Samuel Moelius;chansuke;Michael Woerister;Kyle Matsuda;Maria José Solano;Michael Goulet;Yuki Okushi;Jason Newcomb;Joshua Nelson;Oli Scherer;Robert Bastian;navh;asquared31415;Andre Bogus;Albert Larsan;dswij;Raiki Tamura;Caio;blyxyas;Robin Schroer;Kyle Huey;Eric Wu;Nilstrieb;Andy Russell;Max Baumann;Ardis Lu;Trevor Gross;Ray Redondo;Matthias Krüger;Esteban Küber;Lukas Lueg;alexey semenyuk;dboso;Samuel Tardieu;feniljain;Gary Guo;Nicholas Nethercote;Fridtjof Stoldt;naosense;alex-semenyuk;Taiki Endo;Hannah Town;Jakob Degen;Lukas Wirth;Vadim Petrochenkov;mdgaziur;Eric Huss;Yuri Astrakhan;kraktus;Ralf Jung;Santiago Pastorino;Camille GILLOT;hkalbasi;Arpad Borsos;Maybe Waffle;ozkanonur;Sosthène Guédon;Deadbeef;Kartavya Vashishtha;Aphek;Nadir Fejzic;Lukas Markeffsky;hrxi;clubby789;yukang;Ryan Scheidter;Grachev Mikhail;Elliot Bobrow;Dylan DPC;Steven Casper;bebecue;Trevor Arjeski;Onur Özkan;Cameron Steffen;Guillaume Gomez;Matthew Ingwersen;Alex ✨ Cosmic Princess ✨;dswijj;mejrs;Rageking8;Alex;est31;oxalica;JT;Doru-Florin Blanzeanu;Andreu Botella;royrustdev;flip1995;lcnr;Kevin Per;Josh Stone;TennyZhuang;Marijn Schouten;Steven Nguyen;Cody;Urgau;ouz-a;Nahua Kang;Felix Kohlgrüber
Merged-by: wangqilin 00349210
E2E-issues: 
Description:
add syntax-tree-patterns RFC,
Remove if_chain from equatable_if_let,
Lint suggests matches macro if PartialEq trait is not implemented,
Run cargo dev bless to update fixes & stderr,
Merge commit 'ac0e10aa68325235069a842f47499852b2dee79e' into clippyup,
Remove `mir::CastKind::Misc`,
Merge commit '8f1ebdd18bdecc621f16baaf779898cc08cc2766' into clippyup,
Introduce TypeErrCtxt

TypeErrCtxt optionally has a TypeckResults so that InferCtxt doesn't
need to.,
Change InferCtxtBuilder from enter to build,
make const_err a hard error,
Auto merge of #102091 - RalfJung:const_err, r=oli-obk

make const_err a hard error

This lint has been deny-by-default with future incompat wording since [Rust 1.51](rust-lang/rust#80394) and the stable release of this week starts showing it in cargo's future compat reports. I can't wait to finally get rid of at least some of the mess in our const-err-reporting-code. ;)

r? `@oli-obk`
Fixes rust-lang/rust#71800
Fixes rust-lang/rust#100114,
Auto merge of rust-lang#2583 - RalfJung:rustup, r=oli-obk

initial josh subtree sync

This demonstrates what a josh-based rustup would look like with my patched josh. To create it I did
```
git fetch http://localhost:8000/rust-lang/rust.git:start=75dd959a3a40eb5b4574f8d2e23aa6efbeb33573[:prefix=src/tools/miri]:/src/tools/miri.git master
git merge FETCH_HEAD
./rustup-toolchain HEAD && ./miri fmt
git commit -am rustup
```
Unlike the [previous attempt](rust-lang/miri#2554), this does not add a new root commit to the repo.

Once we merge this, we committed to using josh for subtree syncing, and in particular a version of josh that includes josh-project/josh#961 (or something compatible).,
Stabilize half_open_range_patterns,
Rollup merge of #102675 - ouz-a:mir-technical-debt, r=oli-obk

Remove `mir::CastKind::Misc`

As discussed in #97649 `mir::CastKind::Misc` is not clear, this PR addresses that by creating a new enum variant for every valid cast.

r? ````@oli-obk````,
[`unnecessary_cast`] Do not lint negative hexadecimal literals when cast as float

Floats cannot be expressed as hexadecimal literals,
ImplItemKind::TyAlias => ImplItemKind::Type,
merge rustc history,
Fix clippy tests that trigger `for_loop_over_fallibles` lint,
fixup lint name,
deprecate `clippy::for_loops_over_fallibles`,
Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8Ki

rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`

The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.,
Rollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillot

Stabilize `half_open_range_patterns`

This PR stabilize `feature(half_open_range_patterns)`:
```
Allows using `..=X` as a pattern.
```

And adds a new `feature(half_open_range_patterns_in_slices)` for the slice part, rust-lang/rust#102275 (comment).

The FCP was completed in rust-lang/rust#67264.,
Rename AssocItemKind::TyAlias to AssocItemKind::Type,
Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-dead

Uplift `clippy::for_loops_over_fallibles` lint into rustc

This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this:
```rust
for _ in Some(1) {}
for _ in Ok::<_, ()>(1) {}
```
i.e. directly iterating over `Option` and `Result` using `for` loop.

There are a number of suggestions that this PR adds (on top of what clippy suggested):
1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later)
   ```rust
    for _ in iter.next() {}
    // turns into
    for _ in iter.by_ref() {}
    ```
2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels
   ```rust
   for _ in rx.recv() {}
   // turns into
   while let Some(_) = rx.recv() {}
   ```
3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?`
   ```rust
   for _ in f() {}
   // turns into
   for _ in f()? {}
   ```
4. To preserve the original behavior and clear intent, we can suggest using `if let`
   ```rust
   for _ in f() {}
   // turns into
   if let Some(_) = f() {}
   ```
(P.S. `Some` and `Ok` are interchangeable depending on the type)

I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)!

Resolves #99272

[`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles,
Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki

Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`

Thanks `@camsteffen` for catching this in ast too, cc rust-lang/rust#102829 (comment),
merge rustc history,
Fix unclosed HTML tag in clippy doc,
fix `box-default` ignoring trait objects' types,
Fix allow_attributes_without_reason applying to external crate macros

Previously the `clippy::allow_attributes_without_reason` lint would
apply to external crate macros. Many macros in the Rust ecosystem
include these `allow` attributes without adding a reason, making this
lint pretty much unusable in any sizable Rust project.

This commit fixes that by adding a check to the lint if the attribute is
from an external crate macro and returning early.,
Fix bug in `referent_used_exactly_once`,
merge rustc history,
`default_numeric_fallback` do not lint on constants,
refactor `default_numeric_fallback`

We only need to store if the literal binding has an explicit type bound or not,
Book: Small grammar + link a11y change,
Remove CastCheckResult since it's unused,
add missing comma,
Auto merge of rust-lang#9644 - hkBst:patch-1, r=flip1995

add missing comma

changelog: none,
Auto merge of rust-lang#9643 - icecream17:patch-1, r=flip1995

Book: Small grammar + link a11y change

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none

---

Very minor

For the link accessibility change, `here` and related don't provide context for screen readers who are reading a list of links.
(Random supporting google links)
https://www.w3.org/QA/Tips/noClickHere
https://usability.yale.edu/web-accessibility/articles/links,
Don't lint `ptr_arg` when used as an incompatible trait object,
Auto merge of rust-lang#9645 - Jarcho:ptr_arg_9542, r=llogiq

Don't lint `ptr_arg` when used as an incompatible trait object

fixes rust-lang#9542
changelog: [`ptr_arg`](https://rust-lang.github.io/rust-clippy/master/#ptr_arg): Don't lint when used as an incompatible trait object,
Add a suggestion and a note about orphan rules for `from_over_into`,
Auto merge of rust-lang#9649 - Alexendoo:from-over-into-suggestion, r=llogiq

Add a suggestion and a note about orphan rules for `from_over_into`

Adds a machine applicable suggestion to convert the `Into` impl into a `From` one to `from_over_into`

Also adds a note explaining that `impl From<Local> for Foreign` is fine if the `Into` type is foreign

Closes rust-lang#7444
Addresses half of rust-lang#9638

changelog: [`from_over_into`] Add a suggestion and a note about orphan rules,
Separate internal lints by pass,
Move some things around,
Expand `unnecessary_def_path` lint,
Fix adjacent code,
Format affected files,
`explicit_ty_bound` code golf,
[`zero_prefixed_literal`] Do not advise to use octal form if not possible,
Enable test no_std_main_recursion,
fix `box-default` linting `no_std` non-boxes,
Auto merge of rust-lang#9655 - llogiq:unbox-default, r=dswij

fix `box-default` linting `no_std` non-boxes

This fixes rust-lang#9653 by doing the check against the `Box` type correctly even if `Box` isn't there, as in `no_std` code. Thanks to `@lukas-code` for opening the issue and supplying a reproducer!

---

changelog: none,
Auto merge of rust-lang#9636 - kraktus:numeric-fallback, r=dswij

[`default_numeric_fallback`] do not lint on constants

fix rust-lang#9632

changelog:[`default_numeric_fallback`] do not lint on constants,
Auto merge of rust-lang#9566 - smoelius:diagnostic-item-path, r=dswij

Expand internal lint `unnecessary_def_path`

This PR does essentially two things:
* Separates the internal lints into modules by pass. (`internal_lints.rs` was over 1400 lines, which is a little unruly IMHO.)
* ~Adds a new~ Expands the `unnecessary_def_path` internal lint to flag hardcoded paths to diagnostic and language items.

My understanding is that the latter is currently done by reviewers. Automating this process should make things easier for both reviewers and contributors.

I could make the first bullet a separate PR, or remove it entirely, if desired.

changelog: Add internal lint `diagnostic_item_path`,
Add new lint `partial_pub_fields`

Signed-off-by: TennyZhuang <zty0826@gmail.com>,
fix dogfood

Signed-off-by: TennyZhuang <zty0826@gmail.com>,
add many tests

Signed-off-by: TennyZhuang <zty0826@gmail.com>,
fix a doctest

Signed-off-by: TennyZhuang <zty0826@gmail.com>,
Auto merge of rust-lang#9658 - TennyZhuang:partial-pub-fields, r=llogiq

Add new lint `partial_pub_fields`

Signed-off-by: TennyZhuang <zty0826@gmail.com>

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: `partial_pub_fields`: new lint to disallow partial fields of a struct be pub

Resolve rust-lang#9604,
Auto merge of rust-lang#9652 - kraktus:octo_89, r=xFrednet

[`zero_prefixed_literal`] Do not advise to use octal form if not possible

fix rust-lang#9651

changelog: [`zero_prefixed_literal`] Do not advise to use octal form if not possible,
Auto merge of rust-lang#9609 - kraktus:hexa_f32, r=giraffate

[`unnecessary_cast`] Do not lint negative he

See merge request innersource/rust/toolset/rust-clippy!8
kaffarell pushed a commit to kaffarell/tracing that referenced this issue May 22, 2024
## Motivation

Clippy check fails in recent CI runs in v0.1.x branch PRs, for example
this run:
https://github.com/tokio-rs/tracing/actions/runs/4641107803/jobs/8215263838


Relevant error logs:
```
error: lint `const_err` has been removed: converted into hard error, see issue #71800 <rust-lang/rust#71800> for more information
   --> tracing-core/src/lib.rs:132:5
    |
132 |     const_err,
    |     ^^^^^^^^^
    |
    = note: `-D renamed-and-removed-lints` implied by `-D warnings`


error: deref which would be done by auto-deref
   --> tracing-core/src/dispatcher.rs:371:26
    |
371 |                 return f(&*entered.current());
    |                          ^^^^^^^^^^^^^^^^^^^ help: try this: `&entered.current()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
    = note: `-D clippy::explicit-auto-deref` implied by `-D warnings`


error: deref which would be done by auto-deref
   --> tracing-core/src/dispatcher.rs:393:20
    |
393 |             Some(f(&*entered.current()))
    |                    ^^^^^^^^^^^^^^^^^^^ help: try this: `&entered.current()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref
```

## Solution

Fix the warnings based on the suggestions for Clippy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: Constant evaluation (MIR interpretation) C-cleanup Category: PRs that clean code up or issues documenting cleanup. C-future-incompatibility Category: Future-incompatibility lints T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants