2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
//! The entry point of the NLL borrow checker.
2
2
3
+ use std:: io;
3
4
use std:: path:: PathBuf ;
4
5
use std:: rc:: Rc ;
5
6
use std:: str:: FromStr ;
6
- use std:: { env, io} ;
7
7
8
8
use polonius_engine:: { Algorithm , Output } ;
9
9
use rustc_data_structures:: fx:: FxIndexMap ;
@@ -145,9 +145,11 @@ pub(crate) fn compute_regions<'a, 'tcx>(
145
145
}
146
146
147
147
if polonius_output {
148
- let algorithm =
149
- env:: var ( "POLONIUS_ALGORITHM" ) . unwrap_or_else ( |_| String :: from ( "Hybrid" ) ) ;
150
- let algorithm = Algorithm :: from_str ( & algorithm) . unwrap ( ) ;
148
+ let algorithm = infcx
149
+ . tcx
150
+ . env_var ( "POLONIUS_ALGORITHM" . as_ref ( ) )
151
+ . unwrap_or_else ( |_| "Hybrid" . as_ref ( ) ) ;
152
+ let algorithm = Algorithm :: from_str ( algorithm) . unwrap ( ) ;
151
153
debug ! ( "compute_regions: using polonius algorithm {:?}" , algorithm) ;
152
154
let _prof_timer = infcx. tcx . prof . generic_activity ( "polonius_analysis" ) ;
153
155
Some ( Box :: 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_os ( "UNSTABLE_RUSTDOC_TEST_PATH" . as_ref ( ) ) . is_some ( )
111
+ } ;
110
112
111
113
match item. kind {
112
114
ItemKind :: Impl ( impl_) => {
0 commit comments