1
Fork 0

Use report_in_external_macro for internal lints

Add the option to report lints in external macros for rustc internal
lints
This commit is contained in:
Afnan Enayet 2020-01-03 17:27:14 -08:00
parent e82febc78e
commit 9d95eaa49b
No known key found for this signature in database
GPG key ID: 94EEFE1FD178056B
2 changed files with 9 additions and 4 deletions

View file

@ -12,7 +12,8 @@ use syntax::ast::{Ident, Item, ItemKind};
declare_tool_lint! { declare_tool_lint! {
pub rustc::DEFAULT_HASH_TYPES, pub rustc::DEFAULT_HASH_TYPES,
Allow, Allow,
"forbid HashMap and HashSet and suggest the FxHash* variants" "forbid HashMap and HashSet and suggest the FxHash* variants",
report_in_external_macro: true
} }
pub struct DefaultHashTypes { pub struct DefaultHashTypes {
@ -52,19 +53,22 @@ impl EarlyLintPass for DefaultHashTypes {
declare_tool_lint! { declare_tool_lint! {
pub rustc::USAGE_OF_TY_TYKIND, pub rustc::USAGE_OF_TY_TYKIND,
Allow, Allow,
"usage of `ty::TyKind` outside of the `ty::sty` module" "usage of `ty::TyKind` outside of the `ty::sty` module",
report_in_external_macro: true
} }
declare_tool_lint! { declare_tool_lint! {
pub rustc::TY_PASS_BY_REFERENCE, pub rustc::TY_PASS_BY_REFERENCE,
Allow, Allow,
"passing `Ty` or `TyCtxt` by reference" "passing `Ty` or `TyCtxt` by reference",
report_in_external_macro: true
} }
declare_tool_lint! { declare_tool_lint! {
pub rustc::USAGE_OF_QUALIFIED_TY, pub rustc::USAGE_OF_QUALIFIED_TY,
Allow, Allow,
"using `ty::{Ty,TyCtxt}` instead of importing it" "using `ty::{Ty,TyCtxt}` instead of importing it",
report_in_external_macro: true
} }
declare_lint_pass!(TyTyKind => [ declare_lint_pass!(TyTyKind => [

View file

@ -1049,6 +1049,7 @@ pub mod kw {
} }
// This module has a very short name because it's used a lot. // This module has a very short name because it's used a lot.
#[allow(rustc::default_hash_types)]
pub mod sym { pub mod sym {
use super::Symbol; use super::Symbol;
use std::convert::TryInto; use std::convert::TryInto;