Open
Description
There are various "patterns" we don't want in the compiler out of one reason or another. I'm using this issue to collect them and create lints for detecting those patterns. The lints will only be available while building the compiler via a -Z flag. The flag will be enabled by the bootstrap script, so we don't have to worry about accidentally running them for users.
- forbid uses of
HashSet
orHashMap
(suggestFxHash*
) - suggest using
TyCtxtAt
overTyCtxt
+Span
as arguments - calling
clone
onCopy
types (Lint against calling .clone() on an otherwise copyable value. #27266) - do not use
features_untracked
when a tcx is in scope - do not use
TyKind::Foo
, usety::Foo
instead - do not use
TyKind
as a type outside thesty
module, useTy
instead - don't use
TyS
outsiderustc::ty::sty
-
don't useVec::new()
usevec![]
- don't use
==
for span contexts, useeq_ctxt
instead (Implement an internal lint encouraging use ofSpan::eq_ctxt
#116787) - prefer
param_env_reveal_all_normalized
overparram_env(did).with_reveal_all_normalized()
(Avoid some unnecessary query invocations. #121387 (comment)) - require
'tcx
to be the last lifetime in generic args of type decls, functions and impls (see Lifetime cleanups #130294) E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. - forbid storing a
TyCtxt
and aSession
in the same struct or use both in function args. Only use tcx E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Metadata
Metadata
Assignees
Labels
Area: Makes things more difficult for new or seasoned contributors to RustArea: Lints (warnings about flaws in source code) such as unused_mut.Category: An issue tracking the progress of sth. like the implementation of an RFCCall for participation: Help is requested to fix this issue.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Status: The implementation is incomplete.Relevant to the compiler team, which will review and decide on the PR/issue.