Don't trigger missing_const_for_fn in external macros
As reported in #3841. Only fixes the part where it triggers on the `derive`.
This commit is contained in:
parent
caccf8bd4c
commit
b87f5bc55a
2 changed files with 6 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ use crate::utils::{is_entrypoint_fn, span_lint};
|
|||
use rustc::hir;
|
||||
use rustc::hir::intravisit::FnKind;
|
||||
use rustc::hir::{Body, Constness, FnDecl, HirId};
|
||||
use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintPass};
|
||||
use rustc::{declare_tool_lint, lint_array};
|
||||
use rustc_mir::transform::qualify_min_const_fn::is_min_const_fn;
|
||||
use syntax_pos::Span;
|
||||
|
|
@ -82,7 +82,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingConstForFn {
|
|||
) {
|
||||
let def_id = cx.tcx.hir().local_def_id_from_hir_id(hir_id);
|
||||
|
||||
if is_entrypoint_fn(cx, def_id) {
|
||||
if in_external_macro(cx.tcx.sess, span) || is_entrypoint_fn(cx, def_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,3 +55,7 @@ trait Foo {
|
|||
33
|
||||
}
|
||||
}
|
||||
|
||||
// Don't lint in external macros (derive)
|
||||
#[derive(PartialEq, Eq)]
|
||||
struct Point(isize, isize);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue