2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ use rustc_mir_dataflow::move_paths::MoveData;
22
22
use rustc_mir_dataflow:: points:: DenseLocationMap ;
23
23
use rustc_session:: config:: MirIncludeSpans ;
24
24
use rustc_span:: symbol:: sym;
25
+ use rustc_span:: Symbol ;
25
26
use tracing:: { debug, instrument} ;
26
27
27
28
use crate :: borrow_set:: BorrowSet ;
@@ -179,9 +180,11 @@ pub(crate) fn compute_regions<'a, 'tcx>(
179
180
}
180
181
181
182
if polonius_output {
182
- let algorithm =
183
- env:: var ( "POLONIUS_ALGORITHM" ) . unwrap_or_else ( |_| String :: from ( "Hybrid" ) ) ;
184
- let algorithm = Algorithm :: from_str ( & algorithm) . unwrap ( ) ;
183
+ let algorithm = infcx
184
+ . tcx
185
+ . env_var ( Symbol :: intern ( "POLONIUS_ALGORITHM" ) )
186
+ . unwrap_or_else ( || Symbol :: intern ( "Hybrid" ) ) ;
187
+ let algorithm = Algorithm :: from_str ( algorithm. as_str ( ) ) . unwrap ( ) ;
185
188
debug ! ( "compute_regions: using polonius algorithm {:?}" , algorithm) ;
186
189
let _prof_timer = infcx. tcx . prof . generic_activity ( "polonius_analysis" ) ;
187
190
Some ( Rc :: new ( Output :: compute ( all_facts, algorithm, false ) ) )
Original file line number Diff line number Diff line change @@ -105,8 +105,10 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
105
105
// determining if we are in a doctest context can't currently be determined
106
106
// by the code itself (there are no specific attributes), but fortunately rustdoc
107
107
// sets a perma-unstable env var for libtest so we just reuse that for now
108
- let is_at_toplevel_doctest =
109
- || self . body_depth == 2 && std:: env:: var ( "UNSTABLE_RUSTDOC_TEST_PATH" ) . is_ok ( ) ;
108
+ let is_at_toplevel_doctest = || {
109
+ self . body_depth == 2
110
+ && cx. tcx . env_var ( Symbol :: intern ( "UNSTABLE_RUSTDOC_TEST_PATH" ) ) . is_some ( )
111
+ } ;
110
112
111
113
match item. kind {
112
114
ItemKind :: Impl ( impl_) => {
0 commit comments