Skip to content

Commit 7c21492

Browse files
committed
Use dedicated method for cargo detection
1 parent f32bb95 commit 7c21492

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_lint/src/non_local_def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
8181
if let Some(def_id) = oexpn.macro_def_id
8282
&& let ExpnKind::Macro(macro_kind, macro_name) = oexpn.kind
8383
&& def_id.krate != LOCAL_CRATE
84-
&& std::env::var_os("CARGO").is_some()
84+
&& rustc_session::utils::was_invoked_from_cargo()
8585
{
8686
Some(NonLocalDefinitionsCargoUpdateNote {
8787
macro_kind: macro_kind.descr(),

tests/ui/lint/non_local_definitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ check-pass
22
//@ edition:2021
33
//@ aux-build:non_local_macro.rs
4-
//@ rustc-env:CARGO=/usr/bin/cargo
4+
//@ rustc-env:CARGO_CRATE_NAME=non_local_def
55

66
#![feature(inline_const)]
77

0 commit comments

Comments
 (0)