Skip to content

Commit 56e6e74

Browse files
CoAlloc (big squash)
1 parent 84a554c commit 56e6e74

File tree

87 files changed

+2755
-461
lines changed

Some content is hidden

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

87 files changed

+2755
-461
lines changed

compiler/rustc_arena/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#![feature(dropck_eyepatch)]
1818
#![feature(new_uninit)]
1919
#![feature(maybe_uninit_slice)]
20+
#![feature(min_specialization)]
21+
// FIXME CoAlloc needs min_specialization at all!?
2022
#![feature(decl_macro)]
2123
#![feature(rustc_attrs)]
2224
#![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
///
@@ -3171,30 +3170,31 @@ pub type ForeignItem = Item<ForeignItemKind>;
31713170
mod size_asserts {
31723171
use super::*;
31733172
use rustc_data_structures::static_assert_size;
3173+
use std::alloc::{Allocator, Global};
31743174
// tidy-alphabetical-start
31753175
static_assert_size!(AssocItem, 88);
31763176
static_assert_size!(AssocItemKind, 16);
31773177
static_assert_size!(Attribute, 32);
3178-
static_assert_size!(Block, 32);
3179-
static_assert_size!(Expr, 72);
3180-
static_assert_size!(ExprKind, 40);
3181-
static_assert_size!(Fn, 160);
3178+
static_assert_size!(Block, 32 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3179+
static_assert_size!(Expr, 72 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3180+
static_assert_size!(ExprKind, 40 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3181+
static_assert_size!(Fn, 160 + 2 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31823182
static_assert_size!(ForeignItem, 96);
31833183
static_assert_size!(ForeignItemKind, 24);
31843184
static_assert_size!(GenericArg, 24);
3185-
static_assert_size!(GenericBound, 64);
3186-
static_assert_size!(Generics, 40);
3187-
static_assert_size!(Impl, 136);
3188-
static_assert_size!(Item, 136);
3189-
static_assert_size!(ItemKind, 64);
3185+
static_assert_size!(GenericBound, 64 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3186+
static_assert_size!(Generics, 40 + 2 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3187+
static_assert_size!(Impl, 136 + 3 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3188+
static_assert_size!(Item, 136 + 3 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
3189+
static_assert_size!(ItemKind, 64 + 3 * mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31903190
static_assert_size!(LitKind, 24);
31913191
static_assert_size!(Local, 72);
31923192
static_assert_size!(MetaItemLit, 40);
31933193
static_assert_size!(Param, 40);
3194-
static_assert_size!(Pat, 72);
3194+
static_assert_size!(Pat, 72 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31953195
static_assert_size!(Path, 24);
31963196
static_assert_size!(PathSegment, 24);
3197-
static_assert_size!(PatKind, 48);
3197+
static_assert_size!(PatKind, 48 + mem::size_of::<<Global as Allocator>::CoAllocMeta>());
31983198
static_assert_size!(Stmt, 32);
31993199
static_assert_size!(StmtKind, 16);
32003200
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
#![doc(rust_logo)]
1212
#![allow(internal_features)]
1313
#![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
@@ -383,7 +383,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
383383
return None; // do not suggest code that is already there (#53348)
384384
}
385385

386-
let method_call_list = [sym::to_vec, sym::to_string];
386+
let method_call_list = [sym::to_vec, sym::to_vec_co, sym::to_string];
387387
let mut sugg = if let ExprKind::MethodCall(receiver_method, ..) = expr.kind
388388
&& receiver_method.ident.name == sym::clone
389389
&& 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
@@ -34,6 +34,7 @@
3434
#![feature(exhaustive_patterns)]
3535
#![feature(coroutines)]
3636
#![feature(get_mut_unchecked)]
37+
#![feature(global_co_alloc_meta)]
3738
#![feature(if_let_guard)]
3839
#![feature(inline_const)]
3940
#![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
@@ -1651,7 +1651,10 @@ mod size_asserts {
16511651
use super::*;
16521652
use rustc_data_structures::static_assert_size;
16531653
// tidy-alphabetical-start
1654-
static_assert_size!(BasicBlockData<'_>, 136);
1654+
static_assert_size!(
1655+
BasicBlockData<'_>,
1656+
136 + mem::size_of::<<std::alloc::Global as std::alloc::Allocator>::CoAllocMeta>()
1657+
);
16551658
static_assert_size!(LocalDecl<'_>, 40);
16561659
static_assert_size!(SourceScopeData<'_>, 72);
16571660
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
@@ -457,8 +457,12 @@ fn make_token_stream(
457457
mod size_asserts {
458458
use super::*;
459459
use rustc_data_structures::static_assert_size;
460+
use std::alloc::{Allocator, Global};
460461
// tidy-alphabetical-start
461462
static_assert_size!(AttrWrapper, 16);
462-
static_assert_size!(LazyAttrTokenStreamImpl, 104);
463+
static_assert_size!(
464+
LazyAttrTokenStreamImpl,
465+
104 + std::mem::size_of::<<Global as Allocator>::CoAllocMeta>()
466+
);
463467
// tidy-alphabetical-end
464468
}

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)