Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

http::HeaderName interacts poorly with declare_interior_mutable_const #9776

Closed
lucacasonato opened this issue Nov 2, 2022 · 5 comments · Fixed by #12691
Closed

http::HeaderName interacts poorly with declare_interior_mutable_const #9776

lucacasonato opened this issue Nov 2, 2022 · 5 comments · Fixed by #12691
Assignees
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

Comments

@lucacasonato
Copy link

lucacasonato commented Nov 2, 2022

Summary

The reproducer code emits a declare_interior_mutable_const warning, even though HeaderName is not interior mutable AFAICT.

Lint Name

declare_interior_mutable_const

Reproducer

use http::HeaderName;

const X_FOO_BAR: HeaderName = HeaderName::from_static("x-foo-bar");

Version

rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: aarch64-apple-darwin
release: 1.64.0
LLVM version: 14.0.6

Additional Labels

No response

@lucacasonato lucacasonato 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 labels Nov 2, 2022
@lucacasonato
Copy link
Author

Quite possibly caused by #5812.

@rail-rain
Copy link
Contributor

The lints now (#11678) don't think of Bytes as interior mutable. It's probably a bug in the implementation that types that wrap Bytes still trigger the lints.

@djc
Copy link
Contributor

djc commented Apr 10, 2024

This also seems to trigger mutable_key_type, which seems unwarranted as well. Would be nice to get this fixed?

@ThinkerDreamer
Copy link
Contributor

It also seems triggered by http::header::value::HeaderValue which has Bytes inside as well.

const MY_HEADER_VAL: HeaderValue = HeaderValue::from_static("my_header_value");

@djc
Copy link
Contributor

djc commented Apr 20, 2024

@Alexendoo awesome, thanks!

# for free to join this conversation on GitHub. Already have an account? # 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants