Skip to content

Commit 27976f4

Browse files
CoAlloc: Big Squash; const_trait TODO and ICE on Dec 4, 2023
1 parent 152a4e9 commit 27976f4

File tree

85 files changed

+2824
-451
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2824
-451
lines changed

compiler/rustc_arena/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@
1111
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1212
test(no_crate_inject, attr(deny(warnings)))
1313
)]
14+
#![allow(incomplete_features)]
1415
#![cfg_attr(not(bootstrap), doc(rust_logo))]
1516
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
1617
#![feature(core_intrinsics)]
1718
#![feature(dropck_eyepatch)]
1819
#![feature(new_uninit)]
1920
#![feature(maybe_uninit_slice)]
21+
//#![feature(min_specialization)]
22+
// TODO CoAlloc specialization!
23+
#![feature(specialization)]
2024
#![feature(decl_macro)]
2125
#![feature(rustc_attrs)]
2226
#![cfg_attr(test, feature(test))]

compiler/rustc_ast/src/ast.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ pub use rustc_type_ir::{Movability, Mutability};
3838
use std::fmt;
3939
use std::mem;
4040
use thin_vec::{thin_vec, ThinVec};
41-
4241
/// A "Label" is an identifier of some point in sources,
4342
/// e.g. in the following code:
4443
///
@@ -3144,30 +3143,31 @@ pub type ForeignItem = Item<ForeignItemKind>;
31443143
mod size_asserts {
31453144
use super::*;
31463145
use rustc_data_structures::static_assert_size;
3146+
use std::alloc::{Allocator, Global};
31473147
// tidy-alphabetical-start
31483148
static_assert_size!(AssocItem, 88);
31493149
static_assert_size!(AssocItemKind, 16);
31503150
static_assert_size!(Attribute, 32);
3151-
static_assert_size!(Block, 32);
3152-
static_assert_size!(Expr, 72);
3153-
static_assert_size!(ExprKind, 40);
3154-
static_assert_size!(Fn, 152);
3151+
static_assert_size!(Block, 32 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3152+
static_assert_size!(Expr, 72 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3153+
static_assert_size!(ExprKind, 40 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3154+
static_assert_size!(Fn, 152 + 2 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31553155
static_assert_size!(ForeignItem, 96);
31563156
static_assert_size!(ForeignItemKind, 24);
31573157
static_assert_size!(GenericArg, 24);
3158-
static_assert_size!(GenericBound, 56);
3159-
static_assert_size!(Generics, 40);
3160-
static_assert_size!(Impl, 136);
3161-
static_assert_size!(Item, 136);
3162-
static_assert_size!(ItemKind, 64);
3158+
static_assert_size!(GenericBound, 56 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3159+
static_assert_size!(Generics, 40 + 2 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3160+
static_assert_size!(Impl, 136 + 3 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3161+
static_assert_size!(Item, 136 + 3 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3162+
static_assert_size!(ItemKind, 64 + 3 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31633163
static_assert_size!(LitKind, 24);
31643164
static_assert_size!(Local, 72);
31653165
static_assert_size!(MetaItemLit, 40);
31663166
static_assert_size!(Param, 40);
3167-
static_assert_size!(Pat, 72);
3167+
static_assert_size!(Pat, 72 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31683168
static_assert_size!(Path, 24);
31693169
static_assert_size!(PathSegment, 24);
3170-
static_assert_size!(PatKind, 48);
3170+
static_assert_size!(PatKind, 48 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31713171
static_assert_size!(Stmt, 32);
31723172
static_assert_size!(StmtKind, 16);
31733173
static_assert_size!(Ty, 64);

compiler/rustc_ast/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
#![cfg_attr(not(bootstrap), doc(rust_logo))]
1212
#![cfg_attr(not(bootstrap), allow(internal_features))]
1313
#![cfg_attr(not(bootstrap), feature(rustdoc_internals))]
14+
#![feature(allocator_api)]
1415
#![feature(associated_type_bounds)]
1516
#![feature(box_patterns)]
1617
#![feature(const_trait_impl)]
18+
#![feature(global_co_alloc_meta)]
1719
#![feature(if_let_guard)]
1820
#![feature(let_chains)]
1921
#![feature(min_specialization)]

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
390390
return None; // do not suggest code that is already there (#53348)
391391
}
392392

393-
let method_call_list = [sym::to_vec, sym::to_string];
393+
let method_call_list = [sym::to_vec, sym::to_vec_co, sym::to_string];
394394
let mut sugg = if let ExprKind::MethodCall(receiver_method, ..) = expr.kind
395395
&& receiver_method.ident.name == sym::clone
396396
&& method_call_list.contains(&conversion_method.name)

compiler/rustc_middle/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#![cfg_attr(bootstrap, feature(generators))]
3636
#![cfg_attr(not(bootstrap), feature(coroutines))]
3737
#![feature(get_mut_unchecked)]
38+
#![feature(global_co_alloc_meta)]
3839
#![feature(if_let_guard)]
3940
#![feature(inline_const)]
4041
#![feature(iter_from_coroutine)]

compiler/rustc_middle/src/mir/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,10 @@ mod size_asserts {
16291629
use super::*;
16301630
use rustc_data_structures::static_assert_size;
16311631
// tidy-alphabetical-start
1632-
static_assert_size!(BasicBlockData<'_>, 136);
1632+
static_assert_size!(
1633+
BasicBlockData<'_>,
1634+
136 + mem::size_of::<<std::alloc::Global as std::alloc::Allocator>::CoAllocMeta>()
1635+
);
16331636
static_assert_size!(LocalDecl<'_>, 40);
16341637
static_assert_size!(SourceScopeData<'_>, 72);
16351638
static_assert_size!(Statement<'_>, 32);

compiler/rustc_middle/src/mir/syntax.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1442,6 +1442,9 @@ mod size_asserts {
14421442
static_assert_size!(Operand<'_>, 24);
14431443
static_assert_size!(Place<'_>, 16);
14441444
static_assert_size!(PlaceElem<'_>, 24);
1445-
static_assert_size!(Rvalue<'_>, 40);
1445+
static_assert_size!(
1446+
Rvalue<'_>,
1447+
40 + std::mem::size_of::<<std::alloc::Global as std::alloc::Allocator>::CoAllocMeta>()
1448+
);
14461449
// tidy-alphabetical-end
14471450
}

compiler/rustc_parse/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
//! The main parser interface.
22
3+
#![feature(allocator_api)]
34
#![feature(array_windows)]
45
#![feature(box_patterns)]
6+
#![feature(global_co_alloc_meta)]
57
#![feature(if_let_guard)]
68
#![feature(iter_intersperse)]
79
#![feature(let_chains)]

compiler/rustc_parse/src/parser/attr_wrapper.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,12 @@ fn make_token_stream(
458458
mod size_asserts {
459459
use super::*;
460460
use rustc_data_structures::static_assert_size;
461+
use std::alloc::{Allocator, Global};
461462
// tidy-alphabetical-start
462463
static_assert_size!(AttrWrapper, 16);
463-
static_assert_size!(LazyAttrTokenStreamImpl, 104);
464+
static_assert_size!(
465+
LazyAttrTokenStreamImpl,
466+
104 + std::mem::size_of::<<Global as Allocator>::CoAllocMeta>()
467+
);
464468
// tidy-alphabetical-end
465469
}

compiler/rustc_parse/src/parser/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ pub struct Parser<'a> {
179179
// This type is used a lot, e.g. it's cloned when matching many declarative macro rules with nonterminals. Make sure
180180
// it doesn't unintentionally get bigger.
181181
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
182-
rustc_data_structures::static_assert_size!(Parser<'_>, 264);
182+
rustc_data_structures::static_assert_size!(
183+
Parser<'_>,
184+
264 + 4 * mem::size_of::<<std::alloc::Global as std::alloc::Allocator>::CoAllocMeta>()
185+
);
183186

184187
/// Stores span information about a closure.
185188
#[derive(Clone)]

0 commit comments

Comments
 (0)