@@ -6,7 +6,6 @@ use core::ops::ControlFlow;
6
6
use either:: Either ;
7
7
use hir:: { ExprKind , Param } ;
8
8
use rustc_abi:: FieldIdx ;
9
- use rustc_data_structures:: fx:: FxHashMap ;
10
9
use rustc_errors:: { Applicability , Diag } ;
11
10
use rustc_hir:: intravisit:: Visitor ;
12
11
use rustc_hir:: { self as hir, BindingMode , ByRef , Node } ;
@@ -952,8 +951,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
952
951
}
953
952
}
954
953
955
- /// When modifying a binding from inside of an `Fn` closure, point at the binding definition
956
- /// and suggest using an `std::sync` type that would allow the code to compile.
954
+ /// When modifying a binding from inside of an `Fn` closure, point at the binding definition.
957
955
fn point_at_binding_outside_closure (
958
956
& self ,
959
957
err : & mut Diag < ' _ > ,
@@ -985,31 +983,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
985
983
&& let hir:: def:: Res :: Local ( hir_id) = path. res
986
984
&& let hir:: Node :: Pat ( pat) = self . infcx . tcx . hir_node ( hir_id)
987
985
{
988
- let hir = self . infcx . tcx . hir ( ) ;
989
- let def_id = hir. enclosing_body_owner ( self . mir_hir_id ( ) ) ;
990
- let typeck_results = self . infcx . tcx . typeck ( def_id) ;
991
- let ty = typeck_results. node_type_opt ( expr. hir_id ) ;
992
- if let Some ( ty) = ty {
993
- let mutex = format ! ( "std::sync::atomic::Mutex<{ty}>" ) ;
994
- let mutex = mutex. as_str ( ) ;
995
- let suggestions: FxHashMap < _ , _ > = [
996
- ( self . infcx . tcx . types . isize , "std::sync::atomic::AtomicIsize" ) ,
997
- ( self . infcx . tcx . types . usize , "std::sync::atomic::AtomicUsize" ) ,
998
- ( self . infcx . tcx . types . i64 , "std::sync::atomic::AtomicI64" ) ,
999
- ( self . infcx . tcx . types . u64 , "std::sync::atomic::AtomicU64" ) ,
1000
- ( self . infcx . tcx . types . i32 , "std::sync::atomic::AtomicI32" ) ,
1001
- ( self . infcx . tcx . types . u32 , "std::sync::atomic::AtomicU32" ) ,
1002
- ( self . infcx . tcx . types . i16 , "std::sync::atomic::AtomicI16" ) ,
1003
- ( self . infcx . tcx . types . u16 , "std::sync::atomic::AtomicU16" ) ,
1004
- ( self . infcx . tcx . types . i8 , "std::sync::atomic::AtomicI8" ) ,
1005
- ( self . infcx . tcx . types . u8 , "std::sync::atomic::AtomicU8" ) ,
1006
- ( self . infcx . tcx . types . bool , "std::sync::atomic::AtomicBool" ) ,
1007
- ]
1008
- . into_iter ( )
1009
- . collect ( ) ;
1010
- let ty = suggestions. get ( & ty) . unwrap_or ( & mutex) ;
1011
- err. help ( format ! ( "consider using `{ty}` instead, which allows for multiple threads to access and modify the value" ) ) ;
1012
- }
1013
986
let name = upvar. to_string ( self . infcx . tcx ) ;
1014
987
err. span_label (
1015
988
pat. span ,
0 commit comments