Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoVec MVP 2 #106467

Closed
wants to merge 47 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
74c8a3f
Global alloc; GlobalCoAllocMeta; type size tests
peter-lyons-kehl Dec 10, 2022
6092fff
Co-allocating functions for GlobalAlloc
peter-lyons-kehl Dec 10, 2022
066da2a
RawVec includes GlobalCoAllocMeta based on allocator; related bounds
peter-lyons-kehl Dec 10, 2022
d726a08
Vec, VecDeque, RawVec with COOP_PREFERRED. WIP: probably NOT compilable.
peter-lyons-kehl Dec 11, 2022
48e7037
Vec, VecDeque, RawVec etc. with COOP_PREFERRED. WIP: probably NOT com…
peter-lyons-kehl Dec 11, 2022
d867e93
VecDeque use cases have COOP_PREFERRED. Probably still not compilable…
peter-lyons-kehl Jan 4, 2023
e3798b5
Vec & VecDeque use cases have COOP_PREFERRED. NOT COMPILABLE.
peter-lyons-kehl Dec 12, 2022
c6fa9aa
Vec & VecDeque use cases have COOP_PREFERRED. NOT COMPILABLE.
peter-lyons-kehl Dec 12, 2022
1549f7b
Clean up: Applied x test tidy --bless. NOT COMPILABLE
peter-lyons-kehl Dec 12, 2022
219edc7
Vec/VecDeque to use COOP_PREFERRED. WIP, NOT COMPILING. But: rustc do…
peter-lyons-kehl Dec 13, 2022
e61c02f
(Some) compile errors fixed; but: nightly panics again!
peter-lyons-kehl Dec 13, 2022
313616f
Docs and FIXME
peter-lyons-kehl Dec 13, 2022
be8f776
Vec to use COOP_PREFERRED
peter-lyons-kehl Dec 14, 2022
4827624
String uses COOP_PREFERRED
peter-lyons-kehl Dec 14, 2022
4bc88b4
Minor
peter-lyons-kehl Dec 15, 2022
017b05d
Moved co_alloc_metadata_num_slots_with_preference_global from ::core:…
peter-lyons-kehl Dec 15, 2022
5a9e6bc
Renamed ::core::alloc::co_alloc_metadata_num_slots_with_preference to…
peter-lyons-kehl Dec 15, 2022
d070478
Minor; nightly still dies
peter-lyons-kehl Dec 16, 2022
738d4f4
Tidy
peter-lyons-kehl Dec 17, 2022
adfb416
Working around ICE rust-lang/rust issue #106473. WIP
peter-lyons-kehl Jan 6, 2023
ea538d2
INTERIM: Macros instead of const for global COOP defaults.
peter-lyons-kehl Jan 7, 2023
7d05058
TODO replace co_alloc_metadata_num_slots_with_preference_global(...)
peter-lyons-kehl Jan 7, 2023
8bf943d
Hopefully fixed an impl conflict for ToString for String (itself) vs.…
peter-lyons-kehl Jan 7, 2023
4e14196
Renamed co_alloc_metadata_num_slots_with_preference_specific(...) to …
peter-lyons-kehl Jan 7, 2023
20b1238
Fixing COOP_PREFERRED (and similar). WIP.
peter-lyons-kehl Jan 8, 2023
e3a5fb6
Fixing A and COOP_PREFERRED generics. WIP.
peter-lyons-kehl Jan 9, 2023
ac054b9
Fixing A and COOP_PREFERRED generics. WIP..
peter-lyons-kehl Jan 9, 2023
1f04b07
Fixing A and COOP_PREFERRED generics. WIP...
peter-lyons-kehl Jan 9, 2023
9d05507
Fixing A and COOP_PREFERRED generics. WIP....
peter-lyons-kehl Jan 9, 2023
e65b809
Fixing A and COOP_PREFERRED generics. WIP.....
peter-lyons-kehl Jan 9, 2023
16c897e
Fixing A and COOP_PREFERRED generics. WIP
peter-lyons-kehl Jan 10, 2023
9c0e8e0
Fixing A and COOP_PREFERRED generics. WIP.
peter-lyons-kehl Jan 11, 2023
de1791e
Cleanup of unused import
peter-lyons-kehl Jan 11, 2023
ac8406e
Re-added a closing curly bracket in mod test_helpers = Fixing my earl…
peter-lyons-kehl Jan 11, 2023
701135d
Fixing A and COOP_PREFERRED generics. WIP.
peter-lyons-kehl Jan 11, 2023
e6cb4de
Fixing A and COOP_PREFERRED generics. WIP..
peter-lyons-kehl Jan 12, 2023
ab2b964
Fixing A and COOP_PREFERRED generics. WIP...
peter-lyons-kehl Jan 12, 2023
87499b8
Adding COOP_PREFERRED to Cow, ToOwned..
peter-lyons-kehl Jan 12, 2023
4206d09
Adding COOP_PREFERRED to Cow, ToOwned...
peter-lyons-kehl Jan 12, 2023
f5d5b8a
Adding COOP_PREFERRED to Cow, ToOwned, String.
peter-lyons-kehl Jan 13, 2023
023bdd1
Adding COOP_PREFERRED to Cow, ToOwned..
peter-lyons-kehl Jan 13, 2023
0537478
CoVec, PlVec, DefVec, WeVec. Cleanup.
peter-lyons-kehl Jan 13, 2023
0a4d9a5
COOP_PREFERRED for String and Cow of CStr etc.
peter-lyons-kehl Jan 13, 2023
aa30184
Uncommenting assert of BorrowType::TRAVERSAL_PERMIT. FIXME: Undo once…
peter-lyons-kehl Jan 13, 2023
301d090
Renamed String::from_utf8_lossy_coop_or_not(..) to from_utf8_lossy_co…
peter-lyons-kehl Jan 17, 2023
9e7e06a
Minor fixes
peter-lyons-kehl Jan 21, 2023
2089cb6
Added ToString::RESULT - an associated type with a default.
peter-lyons-kehl Jan 21, 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
24 changes: 12 additions & 12 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pub use UnsafeSource::*;
use crate::ptr::P;
use crate::token::{self, CommentKind, Delimiter};
use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, TokenStream};
use core::alloc::GlobalCoAllocMeta;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_data_structures::stack::ensure_sufficient_stack;
use rustc_data_structures::sync::Lrc;
Expand All @@ -36,7 +37,6 @@ use rustc_span::{Span, DUMMY_SP};
use std::fmt;
use std::mem;
use thin_vec::{thin_vec, ThinVec};

/// A "Label" is an identifier of some point in sources,
/// e.g. in the following code:
///
Expand Down Expand Up @@ -3100,26 +3100,26 @@ mod size_asserts {
static_assert_size!(AssocItem, 104);
static_assert_size!(AssocItemKind, 32);
static_assert_size!(Attribute, 32);
static_assert_size!(Block, 48);
static_assert_size!(Expr, 72);
static_assert_size!(ExprKind, 40);
static_assert_size!(Fn, 184);
static_assert_size!(Block, 48 + mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(Expr, 72 + mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(ExprKind, 40 + mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(Fn, 184 + 2 * mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(ForeignItem, 96);
static_assert_size!(ForeignItemKind, 24);
static_assert_size!(GenericArg, 24);
static_assert_size!(GenericBound, 72);
static_assert_size!(Generics, 72);
static_assert_size!(Impl, 184);
static_assert_size!(Item, 184);
static_assert_size!(ItemKind, 112);
static_assert_size!(GenericBound, 72 + mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(Generics, 72 + 2 * mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(Impl, 184 + 3 * mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(Item, 184 + 3 * mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(ItemKind, 112 + 3 * mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(LitKind, 24);
static_assert_size!(Local, 72);
static_assert_size!(MetaItemLit, 40);
static_assert_size!(Param, 40);
static_assert_size!(Pat, 88);
static_assert_size!(Pat, 88 + mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(Path, 24);
static_assert_size!(PathSegment, 24);
static_assert_size!(PatKind, 64);
static_assert_size!(PatKind, 64 + mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(Stmt, 32);
static_assert_size!(StmtKind, 16);
static_assert_size!(Ty, 64);
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#![feature(box_patterns)]
#![feature(const_default_impls)]
#![feature(const_trait_impl)]
#![feature(global_co_alloc_meta)]
#![feature(if_let_guard)]
#![feature(let_chains)]
#![feature(min_specialization)]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#![feature(exhaustive_patterns)]
#![feature(generators)]
#![feature(get_mut_unchecked)]
#![feature(global_co_alloc_meta)]
#![feature(if_let_guard)]
#![feature(iter_from_generator)]
#![feature(negative_impls)]
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_middle/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use crate::ty::visit::{TypeVisitable, TypeVisitor};
use crate::ty::{self, DefIdTree, List, Ty, TyCtxt};
use crate::ty::{AdtDef, InstanceDef, ScalarInt, UserTypeAnnotationIndex};
use crate::ty::{GenericArg, InternalSubsts, SubstsRef};
use core::alloc::GlobalCoAllocMeta;

use rustc_data_structures::captures::Captures;
use rustc_errors::ErrorGuaranteed;
Expand Down Expand Up @@ -3060,7 +3061,7 @@ mod size_asserts {
use super::*;
use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start
static_assert_size!(BasicBlockData<'_>, 144);
static_assert_size!(BasicBlockData<'_>, 144 + mem::size_of::<GlobalCoAllocMeta>());
static_assert_size!(LocalDecl<'_>, 56);
static_assert_size!(Statement<'_>, 32);
static_assert_size!(StatementKind<'_>, 16);
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_middle/src/mir/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//! The intention is that this file only contains datatype declarations, no code.

use super::{BasicBlock, Constant, Field, Local, SwitchTargets, UserTypeProjection};
use core::alloc::GlobalCoAllocMeta;
use core::mem;

use crate::mir::coverage::{CodeRegion, CoverageKind};
use crate::traits::Reveal;
Expand Down Expand Up @@ -1278,6 +1280,6 @@ mod size_asserts {
static_assert_size!(Operand<'_>, 24);
static_assert_size!(Place<'_>, 16);
static_assert_size!(PlaceElem<'_>, 24);
static_assert_size!(Rvalue<'_>, 40);
static_assert_size!(Rvalue<'_>, 40 + mem::size_of::<GlobalCoAllocMeta>());
// tidy-alphabetical-end
}
1 change: 1 addition & 0 deletions compiler/rustc_parse/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![feature(array_windows)]
#![feature(box_patterns)]
#![feature(global_co_alloc_meta)]
#![feature(if_let_guard)]
#![feature(iter_intersperse)]
#![feature(let_chains)]
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_parse/src/parser/attr_wrapper.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use super::{Capturing, FlatToken, ForceCollect, Parser, ReplaceRange, TokenCursor, TrailingToken};
use core::alloc::GlobalCoAllocMeta;
use core::mem;
use rustc_ast::token::{self, Delimiter, Token, TokenKind};
use rustc_ast::tokenstream::{AttrTokenStream, AttributesData, ToAttrTokenStream};
use rustc_ast::tokenstream::{AttrTokenTree, DelimSpan, LazyAttrTokenStream, Spacing};
Expand Down Expand Up @@ -469,6 +471,6 @@ mod size_asserts {
use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start
static_assert_size!(AttrWrapper, 16);
static_assert_size!(LazyAttrTokenStreamImpl, 144);
static_assert_size!(LazyAttrTokenStreamImpl, 144 + mem::size_of::<GlobalCoAllocMeta>());
// tidy-alphabetical-end
}
6 changes: 5 additions & 1 deletion compiler/rustc_parse/src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod ty;

use crate::lexer::UnmatchedBrace;
pub use attr_wrapper::AttrWrapper;
use core::alloc::GlobalCoAllocMeta;
pub use diagnostics::AttemptLocalParseRecovery;
pub(crate) use item::FnParseMode;
pub use pat::{CommaRecoveryMode, RecoverColon, RecoverComma};
Expand Down Expand Up @@ -168,7 +169,10 @@ pub struct Parser<'a> {
// This type is used a lot, e.g. it's cloned when matching many declarative macro rules with nonterminals. Make sure
// it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
rustc_data_structures::static_assert_size!(Parser<'_>, 336);
rustc_data_structures::static_assert_size!(
Parser<'_>,
336 + 4 * mem::size_of::<GlobalCoAllocMeta>()
);

/// Stores span information about a closure.
#[derive(Clone)]
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#![feature(box_patterns)]
#![feature(control_flow_enum)]
#![feature(drain_filter)]
#![feature(global_co_alloc_meta)]
#![feature(hash_drain_filter)]
#![feature(let_chains)]
#![feature(if_let_guard)]
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_trait_selection/src/traits/fulfill.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::infer::{InferCtxt, TyOrConstInferVar};
use core::alloc::GlobalCoAllocMeta;
use core::mem;
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::obligation_forest::ProcessResult;
use rustc_data_structures::obligation_forest::{Error, ForestObligation, Outcome};
Expand Down Expand Up @@ -80,7 +82,7 @@ pub struct PendingPredicateObligation<'tcx> {

// `PendingPredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
static_assert_size!(PendingPredicateObligation<'_>, 72);
static_assert_size!(PendingPredicateObligation<'_>, 72 + mem::size_of::<GlobalCoAllocMeta>());

impl<'a, 'tcx> FulfillmentContext<'tcx> {
/// Creates a new fulfillment context.
Expand Down
Loading