This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +34
-3
lines changed
compiler/rustc_privacy/src Expand file tree Collapse file tree 3 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -973,8 +973,12 @@ impl<'tcx> NamePrivacyVisitor<'tcx> {
973973
974974impl < ' tcx > Visitor < ' tcx > for NamePrivacyVisitor < ' tcx > {
975975 fn visit_nested_body ( & mut self , body_id : hir:: BodyId ) {
976- let old_maybe_typeck_results =
977- self . maybe_typeck_results . replace ( self . tcx . typeck_body ( body_id) ) ;
976+ let new_typeck_results = self . tcx . typeck_body ( body_id) ;
977+ // Do not try reporting privacy violations if we failed to infer types.
978+ if new_typeck_results. tainted_by_errors . is_some ( ) {
979+ return ;
980+ }
981+ let old_maybe_typeck_results = self . maybe_typeck_results . replace ( new_typeck_results) ;
978982 self . visit_body ( self . tcx . hir ( ) . body ( body_id) ) ;
979983 self . maybe_typeck_results = old_maybe_typeck_results;
980984 }
Original file line number Diff line number Diff line change 1- //@ known-bug: #122736
21fn main_ref ( ) {
32 let array = [ ( ) ; {
43 let mut x = & 0 ;
54 let mut n = 0 ;
65 while n < 5 {
6+ //~^ ERROR constant evaluation is taking a long time
77 x = & 0 ;
88 }
99 0
Original file line number Diff line number Diff line change 1+ error: constant evaluation is taking a long time
2+ --> $DIR/no-ice-on-inference-failure.rs:5:9
3+ |
4+ LL | / while n < 5 {
5+ LL | |
6+ LL | | x = &0;
7+ LL | | }
8+ | |_________^
9+ |
10+ = note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
11+ If your compilation actually takes a long time, you can safely allow the lint.
12+ help: the constant being evaluated
13+ --> $DIR/no-ice-on-inference-failure.rs:2:22
14+ |
15+ LL | let array = [(); {
16+ | ______________________^
17+ LL | | let mut x = &0;
18+ LL | | let mut n = 0;
19+ LL | | while n < 5 {
20+ ... |
21+ LL | | 0
22+ LL | | }];
23+ | |_____^
24+ = note: `#[deny(long_running_const_eval)]` on by default
25+
26+ error: aborting due to 1 previous error
27+
You can’t perform that action at this time.
0 commit comments