Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6ce0b9f

Browse files
committedAug 30, 2023
Remove -Zfuel.
1 parent 26089ba commit 6ce0b9f

27 files changed

+14
-271
lines changed
 

‎compiler/rustc_driver_impl/src/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use rustc_codegen_ssa::{traits::CodegenBackend, CodegenErrors, CodegenResults};
2424
use rustc_data_structures::profiling::{
2525
get_resident_set_size, print_time_passes_entry, TimePassesFormat,
2626
};
27-
use rustc_data_structures::sync::SeqCst;
2827
use rustc_errors::registry::{InvalidErrorCode, Registry};
2928
use rustc_errors::{markdown, ColorConfig};
3029
use rustc_errors::{DiagnosticMessage, ErrorGuaranteed, Handler, PResult, SubdiagnosticMessage};
@@ -474,14 +473,6 @@ fn run_compiler(
474473
sess.print_perf_stats();
475474
}
476475

477-
if sess.opts.unstable_opts.print_fuel.is_some() {
478-
eprintln!(
479-
"Fuel used by {}: {}",
480-
sess.opts.unstable_opts.print_fuel.as_ref().unwrap(),
481-
sess.print_fuel.load(SeqCst)
482-
);
483-
}
484-
485476
Ok(())
486477
})
487478
}

‎compiler/rustc_interface/src/tests.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,6 @@ fn test_unstable_options_tracking_hash() {
780780
tracked!(fewer_names, Some(true));
781781
tracked!(flatten_format_args, false);
782782
tracked!(force_unstable_if_unmarked, true);
783-
tracked!(fuel, Some(("abc".to_string(), 99)));
784783
tracked!(function_sections, Some(false));
785784
tracked!(human_readable_cgu_names, true);
786785
tracked!(incremental_ignore_spans, true);
@@ -817,7 +816,6 @@ fn test_unstable_options_tracking_hash() {
817816
tracked!(plt, Some(true));
818817
tracked!(polonius, true);
819818
tracked!(precise_enum_drop_elaboration, false);
820-
tracked!(print_fuel, Some("abc".to_string()));
821819
tracked!(profile, true);
822820
tracked!(profile_emit, Some(PathBuf::from("abc")));
823821
tracked!(profile_sample_use, Some(PathBuf::from("abc")));

‎compiler/rustc_middle/src/ty/context.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,6 @@ impl<'tcx> TyCtxt<'tcx> {
738738
}
739739
}
740740

741-
pub fn consider_optimizing<T: Fn() -> String>(self, msg: T) -> bool {
742-
self.sess.consider_optimizing(|| self.crate_name(LOCAL_CRATE), msg)
743-
}
744-
745741
/// Obtain all lang items of this crate and all dependencies (recursively)
746742
pub fn lang_items(self) -> &'tcx rustc_hir::lang_items::LanguageItems {
747743
self.get_lang_items(())

‎compiler/rustc_middle/src/ty/mod.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,11 +2198,6 @@ impl<'tcx> TyCtxt<'tcx> {
21982198
flags.insert(ReprFlags::RANDOMIZE_LAYOUT);
21992199
}
22002200

2201-
// This is here instead of layout because the choice must make it into metadata.
2202-
if !self.consider_optimizing(|| format!("Reorder fields of {:?}", self.def_path_str(did))) {
2203-
flags.insert(ReprFlags::IS_LINEAR);
2204-
}
2205-
22062201
ReprOptions { int: size, align: max_align, pack: min_pack, flags, field_shuffle_seed }
22072202
}
22082203

‎compiler/rustc_mir_transform/src/const_prop.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,9 +555,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
555555
// type whose creation requires no write. E.g. a generator whose initial state
556556
// consists solely of uninitialized memory (so it doesn't capture any locals).
557557
let value = self.get_const(place)?;
558-
if !self.tcx.consider_optimizing(|| format!("ConstantPropagation - {value:?}")) {
559-
return None;
560-
}
561558
trace!("replacing {:?} with {:?}", place, value);
562559

563560
// FIXME> figure out what to do when read_immediate_raw fails

‎compiler/rustc_mir_transform/src/dest_prop.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
222222
else {
223223
continue;
224224
};
225-
if !tcx.consider_optimizing(|| {
226-
format!("{} round {}", tcx.def_path_str(def_id), round_count)
227-
}) {
228-
break;
229-
}
230225
merges.insert(*src, *dest);
231226
merged_locals.insert(*src);
232227
merged_locals.insert(*dest);

‎compiler/rustc_mir_transform/src/early_otherwise_branch.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,6 @@ impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
109109
let parent = BasicBlock::from_usize(i);
110110
let Some(opt_data) = evaluate_candidate(tcx, body, parent) else { continue };
111111

112-
if !tcx.consider_optimizing(|| format!("EarlyOtherwiseBranch {:?}", &opt_data)) {
113-
break;
114-
}
115-
116112
trace!("SUCCESS: found optimization possibility to apply: {:?}", &opt_data);
117113

118114
should_cleanup = true;

‎compiler/rustc_mir_transform/src/inline.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,6 @@ impl<'tcx> Inliner<'tcx> {
187187
let callee_body = try_instance_mir(self.tcx, callsite.callee.def)?;
188188
self.check_mir_body(callsite, callee_body, callee_attrs)?;
189189

190-
if !self.tcx.consider_optimizing(|| {
191-
format!("Inline {:?} into {:?}", callsite.callee, caller_body.source)
192-
}) {
193-
return Err("optimization fuel exhausted");
194-
}
195-
196190
let Ok(callee_body) = callsite.callee.try_subst_mir_and_normalize_erasing_regions(
197191
self.tcx,
198192
self.param_env,

‎compiler/rustc_mir_transform/src/instsimplify.rs

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_middle::mir::*;
77
use rustc_middle::ty::layout::ValidityRequirement;
88
use rustc_middle::ty::{self, GenericArgsRef, ParamEnv, Ty, TyCtxt};
99
use rustc_span::symbol::Symbol;
10+
use rustc_span::DUMMY_SP;
1011
use rustc_target::abi::FieldIdx;
1112

1213
pub struct InstSimplify;
@@ -26,10 +27,10 @@ impl<'tcx> MirPass<'tcx> for InstSimplify {
2627
for statement in block.statements.iter_mut() {
2728
match statement.kind {
2829
StatementKind::Assign(box (_place, ref mut rvalue)) => {
29-
ctx.simplify_bool_cmp(&statement.source_info, rvalue);
30-
ctx.simplify_ref_deref(&statement.source_info, rvalue);
31-
ctx.simplify_len(&statement.source_info, rvalue);
32-
ctx.simplify_cast(&statement.source_info, rvalue);
30+
ctx.simplify_bool_cmp(rvalue);
31+
ctx.simplify_ref_deref(rvalue);
32+
ctx.simplify_len(rvalue);
33+
ctx.simplify_cast(rvalue);
3334
}
3435
_ => {}
3536
}
@@ -55,14 +56,8 @@ struct InstSimplifyContext<'tcx, 'a> {
5556
}
5657

5758
impl<'tcx> InstSimplifyContext<'tcx, '_> {
58-
fn should_simplify(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool {
59-
self.tcx.consider_optimizing(|| {
60-
format!("InstSimplify - Rvalue: {rvalue:?} SourceInfo: {source_info:?}")
61-
})
62-
}
63-
6459
/// Transform boolean comparisons into logical operations.
65-
fn simplify_bool_cmp(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
60+
fn simplify_bool_cmp(&self, rvalue: &mut Rvalue<'tcx>) {
6661
match rvalue {
6762
Rvalue::BinaryOp(op @ (BinOp::Eq | BinOp::Ne), box (a, b)) => {
6863
let new = match (op, self.try_eval_bool(a), self.try_eval_bool(b)) {
@@ -93,7 +88,7 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
9388
_ => None,
9489
};
9590

96-
if let Some(new) = new && self.should_simplify(source_info, rvalue) {
91+
if let Some(new) = new {
9792
*rvalue = new;
9893
}
9994
}
@@ -108,17 +103,13 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
108103
}
109104

110105
/// Transform "&(*a)" ==> "a".
111-
fn simplify_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
106+
fn simplify_ref_deref(&self, rvalue: &mut Rvalue<'tcx>) {
112107
if let Rvalue::Ref(_, _, place) = rvalue {
113108
if let Some((base, ProjectionElem::Deref)) = place.as_ref().last_projection() {
114109
if rvalue.ty(self.local_decls, self.tcx) != base.ty(self.local_decls, self.tcx).ty {
115110
return;
116111
}
117112

118-
if !self.should_simplify(source_info, rvalue) {
119-
return;
120-
}
121-
122113
*rvalue = Rvalue::Use(Operand::Copy(Place {
123114
local: base.local,
124115
projection: self.tcx.mk_place_elems(base.projection),
@@ -128,22 +119,18 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
128119
}
129120

130121
/// Transform "Len([_; N])" ==> "N".
131-
fn simplify_len(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
122+
fn simplify_len(&self, rvalue: &mut Rvalue<'tcx>) {
132123
if let Rvalue::Len(ref place) = *rvalue {
133124
let place_ty = place.ty(self.local_decls, self.tcx).ty;
134125
if let ty::Array(_, len) = *place_ty.kind() {
135-
if !self.should_simplify(source_info, rvalue) {
136-
return;
137-
}
138-
139126
let literal = ConstantKind::from_const(len, self.tcx);
140-
let constant = Constant { span: source_info.span, literal, user_ty: None };
127+
let constant = Constant { span: DUMMY_SP, literal, user_ty: None };
141128
*rvalue = Rvalue::Use(Operand::Constant(Box::new(constant)));
142129
}
143130
}
144131
}
145132

146-
fn simplify_cast(&self, _source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) {
133+
fn simplify_cast(&self, rvalue: &mut Rvalue<'tcx>) {
147134
if let Rvalue::Cast(kind, operand, cast_ty) = rvalue {
148135
let operand_ty = operand.ty(self.local_decls, self.tcx);
149136
if operand_ty == *cast_ty {
@@ -223,16 +210,6 @@ impl<'tcx> InstSimplifyContext<'tcx, '_> {
223210
return;
224211
}
225212

226-
if !self.tcx.consider_optimizing(|| {
227-
format!(
228-
"InstSimplify - Call: {:?} SourceInfo: {:?}",
229-
(fn_def_id, fn_args),
230-
terminator.source_info
231-
)
232-
}) {
233-
return;
234-
}
235-
236213
let Some(arg_place) = args.pop().unwrap().place() else { return };
237214

238215
statements.push(Statement {

‎compiler/rustc_mir_transform/src/match_branches.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ impl<'tcx> MirPass<'tcx> for MatchBranchSimplification {
5151
let bbs = body.basic_blocks.as_mut();
5252
let mut should_cleanup = false;
5353
'outer: for bb_idx in bbs.indices() {
54-
if !tcx.consider_optimizing(|| format!("MatchBranchSimplification {def_id:?} ")) {
55-
continue;
56-
}
57-
5854
let (discr, val, first, second) = match bbs[bb_idx].terminator().kind {
5955
TerminatorKind::SwitchInt {
6056
discr: ref discr @ (Operand::Copy(_) | Operand::Move(_)),

‎compiler/rustc_mir_transform/src/multiple_return_terminators.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators {
1616
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
1717
// find basic blocks with no statement and a return terminator
1818
let mut bbs_simple_returns = BitSet::new_empty(body.basic_blocks.len());
19-
let def_id = body.source.def_id();
2019
let bbs = body.basic_blocks_mut();
2120
for idx in bbs.indices() {
2221
if bbs[idx].statements.is_empty()
@@ -27,10 +26,6 @@ impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators {
2726
}
2827

2928
for bb in bbs {
30-
if !tcx.consider_optimizing(|| format!("MultipleReturnTerminators {def_id:?} ")) {
31-
break;
32-
}
33-
3429
if let TerminatorKind::Goto { target } = bb.terminator().kind {
3530
if bbs_simple_returns.contains(target) {
3631
bb.terminator_mut().kind = TerminatorKind::Return;

‎compiler/rustc_mir_transform/src/nrvo.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
4545
return;
4646
};
4747

48-
if !tcx.consider_optimizing(|| format!("RenameReturnPlace {def_id:?}")) {
49-
return;
50-
}
51-
5248
debug!(
5349
"`{:?}` was eligible for NRVO, making {:?} the return place",
5450
def_id, returned_local

‎compiler/rustc_mir_transform/src/remove_unneeded_drops.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ impl<'tcx> MirPass<'tcx> for RemoveUnneededDrops {
2727
if ty.ty.needs_drop(tcx, param_env) {
2828
continue;
2929
}
30-
if !tcx.consider_optimizing(|| format!("RemoveUnneededDrops {did:?} ")) {
31-
continue;
32-
}
3330
debug!("SUCCESS: replacing `drop` with goto({:?})", target);
3431
terminator.kind = TerminatorKind::Goto { target };
3532
should_simplify = true;

‎compiler/rustc_mir_transform/src/remove_zsts.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,12 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
9595
}
9696
}
9797

98-
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, loc: Location) {
98+
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, _: Location) {
9999
if let Operand::Constant(_) = operand {
100100
return;
101101
}
102102
let op_ty = operand.ty(self.local_decls, self.tcx);
103-
if self.known_to_be_zst(op_ty)
104-
&& self.tcx.consider_optimizing(|| {
105-
format!("RemoveZsts - Operand: {operand:?} Location: {loc:?}")
106-
})
107-
{
103+
if self.known_to_be_zst(op_ty) {
108104
*operand = Operand::Constant(Box::new(self.make_zst(op_ty)))
109105
}
110106
}
@@ -131,9 +127,6 @@ impl<'tcx> MutVisitor<'tcx> for Replacer<'_, 'tcx> {
131127
if let Some(place_for_ty) = place_for_ty
132128
&& let ty = place_for_ty.ty(self.local_decls, self.tcx).ty
133129
&& self.known_to_be_zst(ty)
134-
&& self.tcx.consider_optimizing(|| {
135-
format!("RemoveZsts - Place: {:?} SourceInfo: {:?}", place_for_ty, statement.source_info)
136-
})
137130
{
138131
statement.make_nop();
139132
} else {

‎compiler/rustc_mir_transform/src/unreachable_prop.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,12 @@ impl MirPass<'_> for UnreachablePropagation {
3939

4040
// We do want do keep some unreachable blocks, but make them empty.
4141
for bb in unreachable_blocks {
42-
if !tcx.consider_optimizing(|| {
43-
format!("UnreachablePropagation {:?} ", body.source.def_id())
44-
}) {
45-
break;
46-
}
47-
4842
body.basic_blocks_mut()[bb].statements.clear();
4943
}
5044

5145
let replaced = !replacements.is_empty();
5246

5347
for (bb, terminator_kind) in replacements {
54-
if !tcx.consider_optimizing(|| {
55-
format!("UnreachablePropagation {:?} ", body.source.def_id())
56-
}) {
57-
break;
58-
}
59-
6048
body.basic_blocks_mut()[bb].terminator_mut().kind = terminator_kind;
6149
}
6250

‎compiler/rustc_session/messages.ftl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ session_not_supported = not supported
8080
session_nul_in_c_str = null characters in C string literals are not supported
8181
8282
session_octal_float_literal_not_supported = octal float literal is not supported
83-
session_optimization_fuel_exhausted = optimization-fuel-exhausted: {$msg}
8483
8584
session_profile_sample_use_file_does_not_exist = file `{$path}` passed to `-C profile-sample-use` does not exist.
8685

‎compiler/rustc_session/src/config.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2107,10 +2107,6 @@ fn check_thread_count(handler: &EarlyErrorHandler, unstable_opts: &UnstableOptio
21072107
if unstable_opts.threads == 0 {
21082108
handler.early_error("value for threads must be a positive non-zero integer");
21092109
}
2110-
2111-
if unstable_opts.threads > 1 && unstable_opts.fuel.is_some() {
2112-
handler.early_error("optimization fuel is incompatible with multiple threads");
2113-
}
21142110
}
21152111

21162112
fn collect_print_requests(

‎compiler/rustc_session/src/errors.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,6 @@ pub fn report_lit_error(sess: &ParseSess, err: LitError, lit: token::Lit, span:
442442
}
443443
}
444444

445-
#[derive(Diagnostic)]
446-
#[diag(session_optimization_fuel_exhausted)]
447-
pub struct OptimisationFuelExhausted {
448-
pub msg: String,
449-
}
450-
451445
#[derive(Diagnostic)]
452446
#[diag(session_incompatible_linker_flavor)]
453447
#[note]

‎compiler/rustc_session/src/options.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ mod desc {
378378
pub const parse_debuginfo: &str = "either an integer (0, 1, 2), `none`, `line-directives-only`, `line-tables-only`, `limited`, or `full`";
379379
pub const parse_strip: &str = "either `none`, `debuginfo`, or `symbols`";
380380
pub const parse_linker_flavor: &str = ::rustc_target::spec::LinkerFlavorCli::one_of();
381-
pub const parse_optimization_fuel: &str = "crate=integer";
382381
pub const parse_mir_spanview: &str = "`statement` (default), `terminator`, or `block`";
383382
pub const parse_dump_mono_stats: &str = "`markdown` (default) or `json`";
384383
pub const parse_instrument_coverage: &str =
@@ -790,28 +789,6 @@ mod parse {
790789
true
791790
}
792791

793-
pub(crate) fn parse_optimization_fuel(
794-
slot: &mut Option<(String, u64)>,
795-
v: Option<&str>,
796-
) -> bool {
797-
match v {
798-
None => false,
799-
Some(s) => {
800-
let parts = s.split('=').collect::<Vec<_>>();
801-
if parts.len() != 2 {
802-
return false;
803-
}
804-
let crate_name = parts[0].to_string();
805-
let fuel = parts[1].parse::<u64>();
806-
if fuel.is_err() {
807-
return false;
808-
}
809-
*slot = Some((crate_name, fuel.unwrap()));
810-
true
811-
}
812-
}
813-
}
814-
815792
pub(crate) fn parse_unpretty(slot: &mut Option<String>, v: Option<&str>) -> bool {
816793
match v {
817794
None => false,
@@ -1501,8 +1478,6 @@ options! {
15011478
(default: yes)"),
15021479
force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED],
15031480
"force all crates to be `rustc_private` unstable (default: no)"),
1504-
fuel: Option<(String, u64)> = (None, parse_optimization_fuel, [TRACKED],
1505-
"set the optimization fuel quota for a crate"),
15061481
function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED],
15071482
"whether each function should go in its own section"),
15081483
future_incompat_test: bool = (false, parse_bool, [UNTRACKED],
@@ -1670,8 +1645,6 @@ options! {
16701645
#[rustc_lint_opt_deny_field_access("use `Session::print_codegen_stats` instead of this field")]
16711646
print_codegen_stats: bool = (false, parse_bool, [UNTRACKED],
16721647
"print codegen statistics (default: no)"),
1673-
print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],
1674-
"make rustc print the total optimization fuel used by a crate"),
16751648
print_llvm_passes: bool = (false, parse_bool, [UNTRACKED],
16761649
"print the LLVM optimization passes being run (default: no)"),
16771650
print_mono_items: Option<String> = (None, parse_opt_string, [UNTRACKED],

‎compiler/rustc_session/src/session.rs

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use rustc_data_structures::flock;
1616
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
1717
use rustc_data_structures::jobserver::{self, Client};
1818
use rustc_data_structures::profiling::{duration_to_secs_str, SelfProfiler, SelfProfilerRef};
19-
use rustc_data_structures::sync::{
20-
AtomicU64, AtomicUsize, Lock, Lrc, OneThread, Ordering, Ordering::SeqCst,
21-
};
19+
use rustc_data_structures::sync::{AtomicUsize, Lock, Lrc, OneThread, Ordering};
2220
use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitterWriter;
2321
use rustc_errors::emitter::{DynEmitter, EmitterWriter, HumanReadableErrorType};
2422
use rustc_errors::json::JsonEmitter;
@@ -48,13 +46,6 @@ use std::str::FromStr;
4846
use std::sync::Arc;
4947
use std::time::Duration;
5048

51-
pub struct OptimizationFuel {
52-
/// If `-zfuel=crate=n` is specified, initially set to `n`, otherwise `0`.
53-
remaining: u64,
54-
/// We're rejecting all further optimizations.
55-
out_of_fuel: bool,
56-
}
57-
5849
/// The behavior of the CTFE engine when an error occurs with regards to backtraces.
5950
#[derive(Clone, Copy)]
6051
pub enum CtfeBacktrace {
@@ -166,12 +157,6 @@ pub struct Session {
166157
/// Data about code being compiled, gathered during compilation.
167158
pub code_stats: CodeStats,
168159

169-
/// Tracks fuel info if `-zfuel=crate=n` is specified.
170-
optimization_fuel: Lock<OptimizationFuel>,
171-
172-
/// Always set to zero and incremented so that we can print fuel expended by a crate.
173-
pub print_fuel: AtomicU64,
174-
175160
/// Loaded up early on in the initialization of this `Session` to avoid
176161
/// false positives about a job server in our environment.
177162
pub jobserver: Client,
@@ -885,41 +870,6 @@ impl Session {
885870
);
886871
}
887872

888-
/// We want to know if we're allowed to do an optimization for crate foo from -z fuel=foo=n.
889-
/// This expends fuel if applicable, and records fuel if applicable.
890-
pub fn consider_optimizing(
891-
&self,
892-
get_crate_name: impl Fn() -> Symbol,
893-
msg: impl Fn() -> String,
894-
) -> bool {
895-
let mut ret = true;
896-
if let Some((ref c, _)) = self.opts.unstable_opts.fuel {
897-
if c == get_crate_name().as_str() {
898-
assert_eq!(self.threads(), 1);
899-
let mut fuel = self.optimization_fuel.lock();
900-
ret = fuel.remaining != 0;
901-
if fuel.remaining == 0 && !fuel.out_of_fuel {
902-
if self.diagnostic().can_emit_warnings() {
903-
// We only call `msg` in case we can actually emit warnings.
904-
// Otherwise, this could cause a `delay_good_path_bug` to
905-
// trigger (issue #79546).
906-
self.emit_warning(errors::OptimisationFuelExhausted { msg: msg() });
907-
}
908-
fuel.out_of_fuel = true;
909-
} else if fuel.remaining > 0 {
910-
fuel.remaining -= 1;
911-
}
912-
}
913-
}
914-
if let Some(ref c) = self.opts.unstable_opts.print_fuel {
915-
if c == get_crate_name().as_str() {
916-
assert_eq!(self.threads(), 1);
917-
self.print_fuel.fetch_add(1, SeqCst);
918-
}
919-
}
920-
ret
921-
}
922-
923873
/// Is this edition 2015?
924874
pub fn is_rust_2015(&self) -> bool {
925875
self.edition().is_rust_2015()
@@ -1412,12 +1362,6 @@ pub fn build_session(
14121362
Lrc::new(SearchPath::from_sysroot_and_triple(&sysroot, target_triple))
14131363
};
14141364

1415-
let optimization_fuel = Lock::new(OptimizationFuel {
1416-
remaining: sopts.unstable_opts.fuel.as_ref().map_or(0, |&(_, i)| i),
1417-
out_of_fuel: false,
1418-
});
1419-
let print_fuel = AtomicU64::new(0);
1420-
14211365
let cgu_reuse_tracker = if sopts.unstable_opts.query_dep_graph {
14221366
CguReuseTracker::new()
14231367
} else {
@@ -1457,8 +1401,6 @@ pub fn build_session(
14571401
normalize_projection_ty: AtomicUsize::new(0),
14581402
},
14591403
code_stats: Default::default(),
1460-
optimization_fuel,
1461-
print_fuel,
14621404
jobserver: jobserver::client(),
14631405
driver_lint_caps,
14641406
ctfe_backtrace,

‎tests/ui/lint/issue-79546-fuel-ice.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

‎tests/ui/optimization-fuel-0.rs

Lines changed: 0 additions & 17 deletions
This file was deleted.

‎tests/ui/optimization-fuel-0.stderr

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎tests/ui/optimization-fuel-1.rs

Lines changed: 0 additions & 18 deletions
This file was deleted.

‎tests/ui/optimization-fuel-1.stderr

Lines changed: 0 additions & 4 deletions
This file was deleted.

‎tests/ui/print-fuel/print-fuel.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎tests/ui/print-fuel/print-fuel.stderr

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.