Skip to content

Commit 531cb83

Browse files
committed
Auto merge of rust-lang#117881 - TaKO8Ki:rollup-n7jtmgj, r=TaKO8Ki
Rollup of 5 pull requests Successful merges: - rust-lang#117737 (Remove `-Zkeep-hygiene-data`.) - rust-lang#117830 (Small improvements in object lifetime default code) - rust-lang#117858 (Compute layout with spans for better cycle errors in coroutines) - rust-lang#117863 (Remove some unused stuff from `rustc_index`) - rust-lang#117872 (Cranelift isn't available on non-nightly channels) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 4bd2fd5 + b0a68a4 commit 531cb83

File tree

16 files changed

+39
-114
lines changed

16 files changed

+39
-114
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,11 @@ impl<'hir> LoweringContext<'_, 'hir> {
792792
// debuggers and debugger extensions expect it to be called `__awaitee`. They use
793793
// this name to identify what is being awaited by a suspended async functions.
794794
let awaitee_ident = Ident::with_dummy_span(sym::__awaitee);
795-
let (awaitee_pat, awaitee_pat_hid) =
796-
self.pat_ident_binding_mode(span, awaitee_ident, hir::BindingAnnotation::MUT);
795+
let (awaitee_pat, awaitee_pat_hid) = self.pat_ident_binding_mode(
796+
gen_future_span,
797+
awaitee_ident,
798+
hir::BindingAnnotation::MUT,
799+
);
797800

798801
let task_context_ident = Ident::with_dummy_span(sym::_task_context);
799802

compiler/rustc_ast_lowering/src/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,6 @@ pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
443443
drop(ast_index);
444444
sess.time("drop_ast", || drop(krate));
445445

446-
// Discard hygiene data, which isn't required after lowering to HIR.
447-
if !sess.opts.unstable_opts.keep_hygiene_data {
448-
rustc_span::hygiene::clear_syntax_context_map();
449-
}
450-
451446
// Don't hash unless necessary, because it's expensive.
452447
let opt_hir_hash =
453448
if tcx.needs_crate_hash() { Some(compute_hir_hash(tcx, &owners)) } else { None };

compiler/rustc_hir_analysis/src/astconv/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2847,6 +2847,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
28472847
/// provided, if they provided one, and otherwise search the supertypes of trait bounds
28482848
/// for region bounds. It may be that we can derive no bound at all, in which case
28492849
/// we return `None`.
2850+
#[instrument(level = "debug", skip(self, span), ret)]
28502851
fn compute_object_lifetime_bound(
28512852
&self,
28522853
span: Span,
@@ -2855,8 +2856,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
28552856
{
28562857
let tcx = self.tcx();
28572858

2858-
debug!("compute_opt_region_bound(existential_predicates={:?})", existential_predicates);
2859-
28602859
// No explicit region bound specified. Therefore, examine trait
28612860
// bounds and see if we can derive region bounds from those.
28622861
let derived_region_bounds = object_region_bounds(tcx, existential_predicates);

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1848,8 +1848,8 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
18481848
}
18491849
}
18501850

1851+
#[instrument(level = "debug", skip(self))]
18511852
fn resolve_object_lifetime_default(&mut self, lifetime_ref: &'tcx hir::Lifetime) {
1852-
debug!("resolve_object_lifetime_default(lifetime_ref={:?})", lifetime_ref);
18531853
let mut late_depth = 0;
18541854
let mut scope = self.scope;
18551855
let lifetime = loop {

compiler/rustc_index/src/bit_set.rs

+4-63
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,12 @@ impl<T: Idx> BitSet<T> {
237237
new_word != word
238238
}
239239

240-
/// Gets a slice of the underlying words.
241-
pub fn words(&self) -> &[Word] {
242-
&self.words
243-
}
244-
245240
/// Iterates over the indices of set bits in a sorted order.
246241
#[inline]
247242
pub fn iter(&self) -> BitIter<'_, T> {
248243
BitIter::new(&self.words)
249244
}
250245

251-
/// Duplicates the set as a hybrid set.
252-
pub fn to_hybrid(&self) -> HybridBitSet<T> {
253-
// Note: we currently don't bother trying to make a Sparse set.
254-
HybridBitSet::Dense(self.to_owned())
255-
}
256-
257246
/// Set `self = self | other`. In contrast to `union` returns `true` if the set contains at
258247
/// least one bit that is not in `other` (i.e. `other` is not a superset of `self`).
259248
///
@@ -1601,11 +1590,11 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
16011590
pub fn from_row_n(row: &BitSet<C>, num_rows: usize) -> BitMatrix<R, C> {
16021591
let num_columns = row.domain_size();
16031592
let words_per_row = num_words(num_columns);
1604-
assert_eq!(words_per_row, row.words().len());
1593+
assert_eq!(words_per_row, row.words.len());
16051594
BitMatrix {
16061595
num_rows,
16071596
num_columns,
1608-
words: iter::repeat(row.words()).take(num_rows).flatten().cloned().collect(),
1597+
words: iter::repeat(&row.words).take(num_rows).flatten().cloned().collect(),
16091598
marker: PhantomData,
16101599
}
16111600
}
@@ -1700,9 +1689,9 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
17001689
assert_eq!(with.domain_size(), self.num_columns);
17011690
let (write_start, write_end) = self.range(write);
17021691
let mut changed = false;
1703-
for (read_index, write_index) in iter::zip(0..with.words().len(), write_start..write_end) {
1692+
for (read_index, write_index) in iter::zip(0..with.words.len(), write_start..write_end) {
17041693
let word = self.words[write_index];
1705-
let new_word = word | with.words()[read_index];
1694+
let new_word = word | with.words[read_index];
17061695
self.words[write_index] = new_word;
17071696
changed |= word != new_word;
17081697
}
@@ -2002,54 +1991,6 @@ impl std::fmt::Debug for FiniteBitSet<u32> {
20021991
}
20031992
}
20041993

2005-
impl FiniteBitSetTy for u64 {
2006-
const DOMAIN_SIZE: u32 = 64;
2007-
2008-
const FILLED: Self = Self::MAX;
2009-
const EMPTY: Self = Self::MIN;
2010-
2011-
const ONE: Self = 1u64;
2012-
const ZERO: Self = 0u64;
2013-
2014-
fn checked_shl(self, rhs: u32) -> Option<Self> {
2015-
self.checked_shl(rhs)
2016-
}
2017-
2018-
fn checked_shr(self, rhs: u32) -> Option<Self> {
2019-
self.checked_shr(rhs)
2020-
}
2021-
}
2022-
2023-
impl std::fmt::Debug for FiniteBitSet<u64> {
2024-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2025-
write!(f, "{:064b}", self.0)
2026-
}
2027-
}
2028-
2029-
impl FiniteBitSetTy for u128 {
2030-
const DOMAIN_SIZE: u32 = 128;
2031-
2032-
const FILLED: Self = Self::MAX;
2033-
const EMPTY: Self = Self::MIN;
2034-
2035-
const ONE: Self = 1u128;
2036-
const ZERO: Self = 0u128;
2037-
2038-
fn checked_shl(self, rhs: u32) -> Option<Self> {
2039-
self.checked_shl(rhs)
2040-
}
2041-
2042-
fn checked_shr(self, rhs: u32) -> Option<Self> {
2043-
self.checked_shr(rhs)
2044-
}
2045-
}
2046-
2047-
impl std::fmt::Debug for FiniteBitSet<u128> {
2048-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2049-
write!(f, "{:0128b}", self.0)
2050-
}
2051-
}
2052-
20531994
/// A fixed-sized bitset type represented by an integer type. Indices outwith than the range
20541995
/// representable by `T` are considered set.
20551996
#[derive(Copy, Clone, Eq, PartialEq, Decodable, Encodable)]

compiler/rustc_index/src/vec.rs

-4
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,6 @@ impl<I: Idx, T> IndexVec<I, T> {
137137
self.raw.truncate(a)
138138
}
139139

140-
pub fn convert_index_type<Ix: Idx>(self) -> IndexVec<Ix, T> {
141-
IndexVec::from_raw(self.raw)
142-
}
143-
144140
/// Grows the index vector so that it contains an entry for
145141
/// `elem`; if that is already true, then has no
146142
/// effect. Otherwise, inserts new values as needed by invoking

compiler/rustc_index/src/vec/tests.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(dead_code)]
2-
31
// Allows the macro invocation below to work
42
use crate as rustc_index;
53

compiler/rustc_interface/src/tests.rs

-1
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ fn test_unstable_options_tracking_hash() {
679679
untracked!(incremental_info, true);
680680
untracked!(incremental_verify_ich, true);
681681
untracked!(input_stats, true);
682-
untracked!(keep_hygiene_data, true);
683682
untracked!(link_native_libraries, false);
684683
untracked!(llvm_time_trace, true);
685684
untracked!(ls, vec!["all".to_owned()]);

compiler/rustc_session/src/options.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1621,8 +1621,6 @@ options! {
16211621
`=skip-entry`
16221622
`=skip-exit`
16231623
Multiple options can be combined with commas."),
1624-
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
1625-
"keep hygiene data after analysis (default: no)"),
16261624
layout_seed: Option<u64> = (None, parse_opt_number, [TRACKED],
16271625
"seed layout randomization"),
16281626
link_directives: bool = (true, parse_bool, [TRACKED],

compiler/rustc_span/src/hygiene.rs

-4
Original file line numberDiff line numberDiff line change
@@ -569,10 +569,6 @@ impl HygieneData {
569569
}
570570
}
571571

572-
pub fn clear_syntax_context_map() {
573-
HygieneData::with(|data| data.syntax_context_map = FxHashMap::default());
574-
}
575-
576572
pub fn walk_chain(span: Span, to: SyntaxContext) -> Span {
577573
HygieneData::with(|data| data.walk_chain(span, to))
578574
}

compiler/rustc_trait_selection/src/traits/wf.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -913,20 +913,15 @@ pub fn object_region_bounds<'tcx>(
913913
tcx: TyCtxt<'tcx>,
914914
existential_predicates: &'tcx ty::List<ty::PolyExistentialPredicate<'tcx>>,
915915
) -> Vec<ty::Region<'tcx>> {
916-
// Since we don't actually *know* the self type for an object,
917-
// this "open(err)" serves as a kind of dummy standin -- basically
918-
// a placeholder type.
919-
let open_ty = Ty::new_fresh(tcx, 0);
920-
921916
let predicates = existential_predicates.iter().filter_map(|predicate| {
922917
if let ty::ExistentialPredicate::Projection(_) = predicate.skip_binder() {
923918
None
924919
} else {
925-
Some(predicate.with_self_ty(tcx, open_ty))
920+
Some(predicate.with_self_ty(tcx, tcx.types.trait_object_dummy_self))
926921
}
927922
});
928923

929-
required_region_bounds(tcx, open_ty, predicates)
924+
required_region_bounds(tcx, tcx.types.trait_object_dummy_self, predicates)
930925
}
931926

932927
/// Given a set of predicates that apply to an object type, returns

compiler/rustc_ty_utils/src/layout.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -740,11 +740,11 @@ fn coroutine_layout<'tcx>(
740740
};
741741
let tag_layout = cx.tcx.mk_layout(LayoutS::scalar(cx, tag));
742742

743-
let promoted_layouts = ineligible_locals
744-
.iter()
745-
.map(|local| subst_field(info.field_tys[local].ty))
746-
.map(|ty| Ty::new_maybe_uninit(tcx, ty))
747-
.map(|ty| Ok(cx.layout_of(ty)?.layout));
743+
let promoted_layouts = ineligible_locals.iter().map(|local| {
744+
let field_ty = subst_field(info.field_tys[local].ty);
745+
let uninit_ty = Ty::new_maybe_uninit(tcx, field_ty);
746+
Ok(cx.spanned_layout_of(uninit_ty, info.field_tys[local].source_info.span)?.layout)
747+
});
748748
let prefix_layouts = args
749749
.as_coroutine()
750750
.prefix_tys()

src/bootstrap/src/core/build_steps/dist.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1630,14 +1630,11 @@ impl Step for Extended {
16301630
prepare("rust-analysis");
16311631
prepare("clippy");
16321632
prepare("rust-analyzer");
1633-
for tool in &["rust-docs", "rust-demangler", "miri"] {
1633+
for tool in &["rust-docs", "rust-demangler", "miri", "rustc-codegen-cranelift"] {
16341634
if built_tools.contains(tool) {
16351635
prepare(tool);
16361636
}
16371637
}
1638-
if builder.config.rust_codegen_backends.contains(&INTERNER.intern_str("cranelift")) {
1639-
prepare("rustc-codegen-cranelift");
1640-
}
16411638
// create an 'uninstall' package
16421639
builder.install(&etc.join("pkg/postinstall"), &pkg.join("uninstall"), 0o755);
16431640
pkgbuild("uninstall");

tests/mir-opt/building/async_await.b-{closure#0}.coroutine_resume.0.mir

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Static,
1515
),
1616
source_info: SourceInfo {
17-
span: $DIR/async_await.rs:16:9: 16:14 (#8),
17+
span: $DIR/async_await.rs:16:5: 16:14 (#9),
1818
scope: scope[0],
1919
},
2020
ignore_for_traits: false,
@@ -32,7 +32,7 @@
3232
Static,
3333
),
3434
source_info: SourceInfo {
35-
span: $DIR/async_await.rs:17:9: 17:14 (#10),
35+
span: $DIR/async_await.rs:17:5: 17:14 (#11),
3636
scope: scope[0],
3737
},
3838
ignore_for_traits: false,

tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// edition: 2021
22
// build-fail
3-
//~^^ ERROR cycle detected when computing layout of
43

54
#![feature(impl_trait_in_assoc_type)]
65

@@ -21,6 +20,7 @@ impl Recur for () {
2120

2221
fn recur(self) -> Self::Recur {
2322
async move { recur(self).await; }
23+
//~^ ERROR cycle detected when computing layout of
2424
}
2525
}
2626

tests/ui/type-alias-impl-trait/indirect-recursion-issue-112047.stderr

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
error[E0391]: cycle detected when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}`
1+
error[E0391]: cycle detected when computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:22:9: 22:42}`
2+
--> $DIR/indirect-recursion-issue-112047.rs:22:22
23
|
3-
= note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`...
4-
= note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}>`...
5-
= note: ...which requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:15:31: 17:2}`...
4+
LL | async move { recur(self).await; }
5+
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async fn body@$DIR/indirect-recursion-issue-112047.rs:14:31: 16:2}>`...
8+
= note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async fn body@$DIR/indirect-recursion-issue-112047.rs:14:31: 16:2}>`...
9+
note: ...which requires computing layout of `{async fn body@$DIR/indirect-recursion-issue-112047.rs:14:31: 16:2}`...
10+
--> $DIR/indirect-recursion-issue-112047.rs:15:5
11+
|
12+
LL | t.recur().await;
13+
| ^^^^^^^^^^^^^^^
614
= note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<<() as Recur>::Recur>`...
7-
= note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`...
8-
= note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}>`...
9-
= note: ...which again requires computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:23:9: 23:42}`, completing the cycle
10-
note: cycle used when elaborating drops for `<impl at $DIR/indirect-recursion-issue-112047.rs:19:1: 19:18>::recur`
11-
--> $DIR/indirect-recursion-issue-112047.rs:22:5
15+
= note: ...which requires computing layout of `core::mem::maybe_uninit::MaybeUninit<{async block@$DIR/indirect-recursion-issue-112047.rs:22:9: 22:42}>`...
16+
= note: ...which requires computing layout of `core::mem::manually_drop::ManuallyDrop<{async block@$DIR/indirect-recursion-issue-112047.rs:22:9: 22:42}>`...
17+
= note: ...which again requires computing layout of `{async block@$DIR/indirect-recursion-issue-112047.rs:22:9: 22:42}`, completing the cycle
18+
note: cycle used when elaborating drops for `<impl at $DIR/indirect-recursion-issue-112047.rs:18:1: 18:18>::recur`
19+
--> $DIR/indirect-recursion-issue-112047.rs:21:5
1220
|
1321
LL | fn recur(self) -> Self::Recur {
1422
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)