Skip to content

missing_const_for_fn does not work with TAIT #13009

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

Closed
matthiaskrgr opened this issue Jun 28, 2024 · 0 comments · Fixed by #13045
Closed

missing_const_for_fn does not work with TAIT #13009

matthiaskrgr opened this issue Jun 28, 2024 · 0 comments · Fixed by #13045
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 28, 2024

Summary

#![feature(type_alias_impl_trait)]
type Foo4 = impl Debug;

fn define4(_: Foo4) {
    let y: Foo4 = 42;
}

=>

warning: this could be a `const fn`
  --> a.rs:28:1
   |
28 | / fn define4(_: Foo4) {
29 | |     let y: Foo4 = 42;
30 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn
help: make the function `const`
   |
28 | const fn define4(_: Foo4) {
   | +++++

=>

error[E0493]: destructor of `Foo4` cannot be evaluated at compile-time
  --> a.rs:28:18
   |
28 | const fn define4(_: Foo4) {
   |                  ^ the destructor for this type cannot be evaluated in constant functions
29 |     let y: Foo4 = 42;
30 | }
   | - value is dropped here

error: aborting due to 1 previous error; 3 warnings emitted
@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied labels Jun 28, 2024
@bors bors closed this as completed in 2ad8cdc Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant