Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f0be145
drive-by cleanup of rustdoc comment
jyn514 Apr 29, 2023
6edb4ca
Don't print backtrace on ICEs in `issue-86800.rs`.
nnethercote May 1, 2023
5f45c69
Improve filtering in `default-backtrace-ice.rs`.
nnethercote May 1, 2023
2469afe
Make the BUG_REPORT_URL configurable by tools
jyn514 Apr 29, 2023
8ff3903
initial step towards implementing C string literals
fee1-dead Mar 5, 2023
76d1f93
update and add a few tests
fee1-dead Mar 6, 2023
a49570f
fix TODO comments
fee1-dead Mar 6, 2023
d5e7206
rm diag item, use lang item
fee1-dead Mar 6, 2023
4c01d49
refactor unescape
fee1-dead Mar 6, 2023
78e3455
address comments
fee1-dead Mar 6, 2023
bf3ca59
try gating early, add non-ascii test
fee1-dead Mar 7, 2023
abb181d
make it semantic error
fee1-dead Mar 10, 2023
6d905a8
fix tidy
fee1-dead Mar 10, 2023
d30c668
make cook generic
fee1-dead Apr 28, 2023
d5bc581
Migrate `mir_transform` to translatable diagnostics
clubby789 Apr 30, 2023
6bb1f79
cleanup nll generalizer
lcnr May 3, 2023
0c5fe37
remove `inside_canonicalization_ctxt` flag
lcnr May 3, 2023
1e45f08
Add deployment-target --print flag for Apple targets
BlackHoleFox Dec 6, 2022
025c603
bootstrap: add llvm-project/runtimes to the sources
krasimirgg May 4, 2023
7157ef7
Rollup merge of #105354 - BlackHoleFox:apple-deployment-printer, r=ol…
Manishearth May 4, 2023
7ba3a5a
Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors
Manishearth May 4, 2023
1e5a57e
Rollup merge of #110989 - jyn514:bug-report-url, r=WaffleLapkin
Manishearth May 4, 2023
66ad50e
Rollup merge of #111004 - clubby789:migrate-mir-transform, r=oli-obk
Manishearth May 4, 2023
5ff35ce
Rollup merge of #111052 - nnethercote:fix-ice-test, r=Nilstrieb
Manishearth May 4, 2023
ca133b5
Rollup merge of #111132 - lcnr:nll-generalize, r=b-naber
Manishearth May 4, 2023
adcfc2d
Rollup merge of #111187 - krasimirgg:llvm-runtimes, r=jyn514
Manishearth May 4, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove inside_canonicalization_ctxt flag
we never reach the code checking for this flag while the
flag is enabled, so it does not change the behavior
of the code.
  • Loading branch information
lcnr committed May 3, 2023
commit 0c5fe37786425edf53db60f20fe68f86dcb0b481
8 changes: 4 additions & 4 deletions compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,11 @@ impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
let next_region = self.infcx.next_region_var(origin);
let vid = next_region.as_var();

if cfg!(debug_assertions) && !self.inside_canonicalization_ctxt() {
if cfg!(debug_assertions) {
debug!("inserting vid {:?} with origin {:?} into var_to_origin", vid, origin);
let ctxt = get_ctxt_fn();
let mut var_to_origin = self.reg_var_to_origin.borrow_mut();
var_to_origin.insert(vid, ctxt);
assert_eq!(var_to_origin.insert(vid, ctxt), None);
}

next_region
Expand All @@ -520,11 +520,11 @@ impl<'cx, 'tcx> BorrowckInferCtxt<'cx, 'tcx> {
let next_region = self.infcx.next_nll_region_var(origin);
let vid = next_region.as_var();

if cfg!(debug_assertions) && !self.inside_canonicalization_ctxt() {
if cfg!(debug_assertions) {
debug!("inserting vid {:?} with origin {:?} into var_to_origin", vid, origin);
let ctxt = get_ctxt_fn();
let mut var_to_origin = self.reg_var_to_origin.borrow_mut();
var_to_origin.insert(vid, ctxt);
assert_eq!(var_to_origin.insert(vid, ctxt), None);
}

next_region
Expand Down
13 changes: 9 additions & 4 deletions compiler/rustc_borrowck/src/type_check/relate_tys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
};

if cfg!(debug_assertions) && !self.type_checker.infcx.inside_canonicalization_ctxt() {
if cfg!(debug_assertions) {
let mut var_to_origin = self.type_checker.infcx.reg_var_to_origin.borrow_mut();
var_to_origin.insert(reg.as_var(), RegionCtxt::Placeholder(reg_info));
let new = RegionCtxt::Placeholder(reg_info);
let prev = var_to_origin.insert(reg.as_var(), new);
if let Some(prev) = prev {
assert_eq!(new, prev);
}
}

reg
Expand All @@ -146,9 +150,10 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
universe,
);

if cfg!(debug_assertions) && !self.type_checker.infcx.inside_canonicalization_ctxt() {
if cfg!(debug_assertions) {
let mut var_to_origin = self.type_checker.infcx.reg_var_to_origin.borrow_mut();
var_to_origin.insert(reg.as_var(), RegionCtxt::Existential(None));
let prev = var_to_origin.insert(reg.as_var(), RegionCtxt::Existential(None));
assert_eq!(prev, None);
}

reg
Expand Down
3 changes: 0 additions & 3 deletions compiler/rustc_infer/src/infer/at.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ use super::*;
use rustc_middle::ty::relate::{Relate, TypeRelation};
use rustc_middle::ty::{Const, ImplSubject};

use std::cell::Cell;

/// Whether we should define opaque types or just treat them opaquely.
///
/// Currently only used to prevent predicate matching from matching anything
Expand Down Expand Up @@ -84,7 +82,6 @@ impl<'tcx> InferCtxt<'tcx> {
in_snapshot: self.in_snapshot.clone(),
universe: self.universe.clone(),
intercrate: self.intercrate,
inside_canonicalization_ctxt: Cell::new(self.inside_canonicalization_ctxt()),
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_infer/src/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,6 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
where
V: TypeFoldable<TyCtxt<'tcx>>,
{
let _inside_canonical_ctxt_guard = infcx.set_canonicalization_ctxt();

let needs_canonical_flags = if canonicalize_region_mode.any() {
TypeFlags::HAS_INFER |
TypeFlags::HAS_FREE_REGIONS | // `HAS_RE_PLACEHOLDER` implies `HAS_FREE_REGIONS`
Expand Down
32 changes: 0 additions & 32 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ use rustc_span::Span;

use std::cell::{Cell, RefCell};
use std::fmt;
use std::ops::Drop;

use self::combine::CombineFields;
use self::error_reporting::TypeErrCtxt;
Expand Down Expand Up @@ -342,11 +341,6 @@ pub struct InferCtxt<'tcx> {
/// there is no type that the user could *actually name* that
/// would satisfy it. This avoids crippling inference, basically.
pub intercrate: bool,

/// Flag that is set when we enter canonicalization. Used for debugging to ensure
/// that we only collect region information for `BorrowckInferCtxt::reg_var_to_origin`
/// inside non-canonicalization contexts.
inside_canonicalization_ctxt: Cell<bool>,
}

/// See the `error_reporting` module for more details.
Expand Down Expand Up @@ -638,7 +632,6 @@ impl<'tcx> InferCtxtBuilder<'tcx> {
skip_leak_check: Cell::new(false),
universe: Cell::new(ty::UniverseIndex::ROOT),
intercrate,
inside_canonicalization_ctxt: Cell::new(false),
}
}
}
Expand Down Expand Up @@ -1636,31 +1629,6 @@ impl<'tcx> InferCtxt<'tcx> {
}
}
}

pub fn inside_canonicalization_ctxt(&self) -> bool {
self.inside_canonicalization_ctxt.get()
}

pub fn set_canonicalization_ctxt(&self) -> CanonicalizationCtxtGuard<'_, 'tcx> {
let prev_ctxt = self.inside_canonicalization_ctxt();
self.inside_canonicalization_ctxt.set(true);
CanonicalizationCtxtGuard { prev_ctxt, infcx: self }
}

fn set_canonicalization_ctxt_to(&self, ctxt: bool) {
self.inside_canonicalization_ctxt.set(ctxt);
}
}

pub struct CanonicalizationCtxtGuard<'cx, 'tcx> {
prev_ctxt: bool,
infcx: &'cx InferCtxt<'tcx>,
}

impl<'cx, 'tcx> Drop for CanonicalizationCtxtGuard<'cx, 'tcx> {
fn drop(&mut self) {
self.infcx.set_canonicalization_ctxt_to(self.prev_ctxt)
}
}

impl<'tcx> TypeErrCtxt<'_, 'tcx> {
Expand Down