Skip to content

Commit aefc5ec

Browse files
committed
remove cfgs
1 parent 2d2bccf commit aefc5ec

File tree

7 files changed

+78
-209
lines changed

7 files changed

+78
-209
lines changed

Cargo.lock

+36
Original file line numberDiff line numberDiff line change
@@ -2003,9 +2003,15 @@ dependencies = [
20032003

20042004
[[package]]
20052005
name = "http-auth"
2006+
<<<<<<< HEAD
20062007
version = "0.1.8"
20072008
source = "registry+https://github.com/rust-lang/crates.io-index"
20082009
checksum = "5430cacd7a1f9a02fbeb350dfc81a0e5ed42d81f3398cb0ba184017f85bdcfbc"
2010+
=======
2011+
version = "0.1.6"
2012+
source = "registry+https://github.com/rust-lang/crates.io-index"
2013+
checksum = "c0b40b39d66c28829a0cf4d09f7e139ff8201f7500a5083732848ed3b4b4d850"
2014+
>>>>>>> 570ad623189 (remove cfgs)
20092015
dependencies = [
20102016
"memchr",
20112017
]
@@ -6271,6 +6277,7 @@ checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
62716277

62726278
[[package]]
62736279
name = "windows_aarch64_msvc"
6280+
<<<<<<< HEAD
62746281
version = "0.42.1"
62756282
source = "registry+https://github.com/rust-lang/crates.io-index"
62766283
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
@@ -6292,6 +6299,29 @@ name = "windows_x86_64_gnu"
62926299
version = "0.42.1"
62936300
source = "registry+https://github.com/rust-lang/crates.io-index"
62946301
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
6302+
=======
6303+
version = "0.42.0"
6304+
source = "registry+https://github.com/rust-lang/crates.io-index"
6305+
checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
6306+
6307+
[[package]]
6308+
name = "windows_i686_gnu"
6309+
version = "0.42.0"
6310+
source = "registry+https://github.com/rust-lang/crates.io-index"
6311+
checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
6312+
6313+
[[package]]
6314+
name = "windows_i686_msvc"
6315+
version = "0.42.0"
6316+
source = "registry+https://github.com/rust-lang/crates.io-index"
6317+
checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
6318+
6319+
[[package]]
6320+
name = "windows_x86_64_gnu"
6321+
version = "0.42.0"
6322+
source = "registry+https://github.com/rust-lang/crates.io-index"
6323+
checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
6324+
>>>>>>> 570ad623189 (remove cfgs)
62956325

62966326
[[package]]
62976327
name = "windows_x86_64_gnullvm"
@@ -6301,9 +6331,15 @@ checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
63016331

63026332
[[package]]
63036333
name = "windows_x86_64_msvc"
6334+
<<<<<<< HEAD
63046335
version = "0.42.1"
63056336
source = "registry+https://github.com/rust-lang/crates.io-index"
63066337
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
6338+
=======
6339+
version = "0.42.0"
6340+
source = "registry+https://github.com/rust-lang/crates.io-index"
6341+
checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
6342+
>>>>>>> 570ad623189 (remove cfgs)
63076343

63086344
[[package]]
63096345
name = "writeable"

compiler/rustc_borrowck/src/lib.rs

-21
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ use nll::{PoloniusOutput, ToRegionVid};
9797
use place_ext::PlaceExt;
9898
use places_conflict::{places_conflict, PlaceConflictBias};
9999
use region_infer::RegionInferenceContext;
100-
#[cfg(debug_assertions)]
101100
use renumber::RegionCtxt;
102101

103102
// FIXME(eddyb) perhaps move this somewhere more centrally.
@@ -488,28 +487,14 @@ pub struct BodyWithBorrowckFacts<'tcx> {
488487

489488
pub struct BorrowckInferCtxt<'cx, 'tcx> {
490489
pub(crate) infcx: &'cx InferCtxt<'tcx>,
491-
492-
#[cfg(debug_assertions)]
493490
pub(crate) reg_var_to_origin: RefCell<FxHashMap<ty::RegionVid, RegionCtxt>>,
494491
}
495492

496493
impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
497-
#[cfg(not(debug_assertions))]
498-
pub(crate) fn new(infcx: &'cx InferCtxt<'tcx>) -> Self {
499-
BorrowckInferCtxt { infcx }
500-
}
501-
502-
#[cfg(debug_assertions)]
503494
pub(crate) fn new(infcx: &'cx InferCtxt<'tcx>) -> Self {
504495
BorrowckInferCtxt { infcx, reg_var_to_origin: RefCell::new(Default::default()) }
505496
}
506497

507-
#[cfg(not(debug_assertions))]
508-
pub(crate) fn next_region_var(&self, origin: RegionVariableOrigin) -> ty::Region<'tcx> {
509-
self.infcx.next_region_var(origin)
510-
}
511-
512-
#[cfg(debug_assertions)]
513498
pub(crate) fn next_region_var(
514499
&self,
515500
origin: RegionVariableOrigin,
@@ -533,12 +518,6 @@ impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
533518
next_region
534519
}
535520

536-
#[cfg(not(debug_assertions))]
537-
pub(crate) fn next_nll_region_var(&self, origin: NllRegionVariableOrigin) -> ty::Region<'tcx> {
538-
self.infcx.next_nll_region_var(origin)
539-
}
540-
541-
#[cfg(debug_assertions)]
542521
#[instrument(skip(self), level = "debug")]
543522
pub(crate) fn next_nll_region_var(
544523
&self,

compiler/rustc_borrowck/src/region_infer/mod.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ pub enum ExtraConstraintInfo {
244244
PlaceholderFromPredicate(Span),
245245
}
246246

247-
#[cfg(debug_assertions)]
248247
#[instrument(skip(infcx, sccs), level = "debug")]
249248
fn sccs_info<'cx, 'tcx>(
250249
infcx: &'cx BorrowckInferCtxt<'cx, 'tcx>,
@@ -278,7 +277,7 @@ fn sccs_info<'cx, 'tcx>(
278277
.map(|(scc_idx, region_ctxts)| {
279278
let repr = region_ctxts
280279
.into_iter()
281-
.max_by(|x, y| x._preference_value().cmp(&y._preference_value()))
280+
.max_by(|x, y| x.preference_value().cmp(&y.preference_value()))
282281
.unwrap();
283282

284283
(ConstraintSccIndex::from_usize(scc_idx), repr)
@@ -334,10 +333,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
334333
let fr_static = universal_regions.fr_static;
335334
let constraint_sccs = Rc::new(constraints.compute_sccs(&constraint_graph, fr_static));
336335

337-
#[cfg(debug_assertions)]
338-
{
339-
sccs_info(_infcx, constraint_sccs.clone());
340-
}
336+
sccs_info(_infcx, constraint_sccs.clone());
341337

342338
let mut scc_values =
343339
RegionValues::new(elements, universal_regions.len(), &placeholder_indices);

compiler/rustc_borrowck/src/renumber.rs

+1-66
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use rustc_middle::mir::Constant;
88
use rustc_middle::mir::{Body, Location, Promoted};
99
use rustc_middle::ty::subst::SubstsRef;
1010
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
11-
#[cfg(debug_assertions)]
1211
use rustc_span::{Span, Symbol};
1312

1413
/// Replaces all free regions appearing in the MIR with fresh
@@ -32,21 +31,6 @@ pub fn renumber_mir<'tcx>(
3231

3332
/// Replaces all regions appearing in `value` with fresh inference
3433
/// variables.
35-
#[cfg(not(debug_assertions))]
36-
#[instrument(skip(infcx), level = "debug")]
37-
pub(crate) fn renumber_regions<'tcx, T>(infcx: &BorrowckInferCtxt<'_, 'tcx>, value: T) -> T
38-
where
39-
T: TypeFoldable<'tcx>,
40-
{
41-
infcx.tcx.fold_regions(value, |_region, _depth| {
42-
let origin = NllRegionVariableOrigin::Existential { from_forall: false };
43-
infcx.next_nll_region_var(origin)
44-
})
45-
}
46-
47-
/// Replaces all regions appearing in `value` with fresh inference
48-
/// variables.
49-
#[cfg(debug_assertions)]
5034
#[instrument(skip(infcx), level = "debug")]
5135
pub(crate) fn renumber_regions<'tcx, T>(
5236
infcx: &BorrowckInferCtxt<'_, 'tcx>,
@@ -62,14 +46,12 @@ where
6246
})
6347
}
6448

65-
#[cfg(debug_assertions)]
6649
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
6750
pub(crate) enum BoundRegionInfo {
6851
Name(Symbol),
6952
Span(Span),
7053
}
7154

72-
#[cfg(debug_assertions)]
7355
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
7456
pub(crate) enum RegionCtxt {
7557
Location(Location),
@@ -82,12 +64,11 @@ pub(crate) enum RegionCtxt {
8264
Unknown,
8365
}
8466

85-
#[cfg(debug_assertions)]
8667
impl RegionCtxt {
8768
/// Used to determine the representative of a component in the strongly connected
8869
/// constraint graph
8970
/// FIXME: don't use underscore here. Got a 'not used' error for some reason
90-
pub(crate) fn _preference_value(self) -> usize {
71+
pub(crate) fn preference_value(self) -> usize {
9172
let _anon = Symbol::intern("anon");
9273

9374
match self {
@@ -106,70 +87,33 @@ struct NllVisitor<'a, 'tcx> {
10687
}
10788

10889
impl<'a, 'tcx> NllVisitor<'a, 'tcx> {
109-
#[cfg(debug_assertions)]
11090
fn renumber_regions<T>(&mut self, value: T, ctxt: RegionCtxt) -> T
11191
where
11292
T: TypeFoldable<'tcx>,
11393
{
11494
renumber_regions(self.infcx, value, ctxt)
11595
}
116-
117-
#[cfg(not(debug_assertions))]
118-
fn renumber_regions<T>(&mut self, value: T) -> T
119-
where
120-
T: TypeFoldable<'tcx>,
121-
{
122-
renumber_regions(self.infcx, value)
123-
}
12496
}
12597

12698
impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> {
12799
fn tcx(&self) -> TyCtxt<'tcx> {
128100
self.infcx.tcx
129101
}
130102

131-
#[cfg(not(debug_assertions))]
132-
#[instrument(skip(self), level = "debug")]
133-
fn visit_ty(&mut self, ty: &mut Ty<'tcx>, _ty_context: TyContext) {
134-
*ty = self.renumber_regions(*ty);
135-
136-
debug!(?ty);
137-
}
138-
139-
#[cfg(debug_assertions)]
140103
#[instrument(skip(self), level = "debug")]
141104
fn visit_ty(&mut self, ty: &mut Ty<'tcx>, _ty_context: TyContext) {
142105
*ty = self.renumber_regions(*ty, RegionCtxt::TyContext(_ty_context));
143106

144107
debug!(?ty);
145108
}
146109

147-
#[cfg(not(debug_assertions))]
148-
#[instrument(skip(self), level = "debug")]
149-
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) {
150-
*substs = self.renumber_regions(*substs);
151-
152-
debug!(?substs);
153-
}
154-
155-
#[cfg(debug_assertions)]
156110
#[instrument(skip(self), level = "debug")]
157111
fn visit_substs(&mut self, substs: &mut SubstsRef<'tcx>, location: Location) {
158112
*substs = self.renumber_regions(*substs, RegionCtxt::Location(location));
159113

160114
debug!(?substs);
161115
}
162116

163-
#[cfg(not(debug_assertions))]
164-
#[instrument(skip(self), level = "debug")]
165-
fn visit_region(&mut self, region: &mut ty::Region<'tcx>, location: Location) {
166-
let old_region = *region;
167-
*region = self.renumber_regions(old_region);
168-
169-
debug!(?region);
170-
}
171-
172-
#[cfg(debug_assertions)]
173117
#[instrument(skip(self), level = "debug")]
174118
fn visit_region(&mut self, region: &mut ty::Region<'tcx>, location: Location) {
175119
let old_region = *region;
@@ -178,15 +122,6 @@ impl<'a, 'tcx> MutVisitor<'tcx> for NllVisitor<'a, 'tcx> {
178122
debug!(?region);
179123
}
180124

181-
#[cfg(not(debug_assertions))]
182-
#[instrument(skip(self), level = "debug")]
183-
fn visit_constant(&mut self, constant: &mut Constant<'tcx>, _location: Location) {
184-
let literal = constant.literal;
185-
constant.literal = self.renumber_regions(literal);
186-
debug!("constant: {:#?}", constant);
187-
}
188-
189-
#[cfg(debug_assertions)]
190125
#[instrument(skip(self), level = "debug")]
191126
fn visit_constant(&mut self, constant: &mut Constant<'tcx>, _location: Location) {
192127
let literal = constant.literal;

compiler/rustc_borrowck/src/type_check/mod.rs

+18-34
Original file line numberDiff line numberDiff line change
@@ -1335,43 +1335,27 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
13351335
}
13361336
};
13371337
let (sig, map) = tcx.replace_late_bound_regions(sig, |br| {
1338-
#[cfg(not(debug_assertions))]
1339-
{
1340-
self.infcx.next_region_var(LateBoundRegion(
1338+
use crate::renumber::{BoundRegionInfo, RegionCtxt};
1339+
use rustc_span::Symbol;
1340+
1341+
let reg_info = match br.kind {
1342+
// FIXME Probably better to use the `Span` here
1343+
ty::BoundRegionKind::BrAnon(_, Some(span)) => BoundRegionInfo::Span(span),
1344+
ty::BoundRegionKind::BrAnon(..) => {
1345+
BoundRegionInfo::Name(Symbol::intern("anon"))
1346+
}
1347+
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
1348+
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(Symbol::intern("env")),
1349+
};
1350+
1351+
self.infcx.next_region_var(
1352+
LateBoundRegion(
13411353
term.source_info.span,
13421354
br.kind,
13431355
LateBoundRegionConversionTime::FnCall,
1344-
))
1345-
}
1346-
1347-
#[cfg(debug_assertions)]
1348-
{
1349-
use crate::renumber::{BoundRegionInfo, RegionCtxt};
1350-
use rustc_span::Symbol;
1351-
1352-
let reg_info = match br.kind {
1353-
// FIXME Probably better to use the `Span` here
1354-
ty::BoundRegionKind::BrAnon(_, Some(span)) => {
1355-
BoundRegionInfo::Span(span)
1356-
}
1357-
ty::BoundRegionKind::BrAnon(..) => {
1358-
BoundRegionInfo::Name(Symbol::intern("anon"))
1359-
}
1360-
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
1361-
ty::BoundRegionKind::BrEnv => {
1362-
BoundRegionInfo::Name(Symbol::intern("env"))
1363-
}
1364-
};
1365-
1366-
self.infcx.next_region_var(
1367-
LateBoundRegion(
1368-
term.source_info.span,
1369-
br.kind,
1370-
LateBoundRegionConversionTime::FnCall,
1371-
),
1372-
RegionCtxt::LateBound(reg_info),
1373-
)
1374-
}
1356+
),
1357+
RegionCtxt::LateBound(reg_info),
1358+
)
13751359
});
13761360
debug!(?sig);
13771361
// IMPORTANT: We have to prove well formed for the function signature before

0 commit comments

Comments
 (0)