Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
17ce56f
Fix Iterator::advance_by contract inconsistency
the8472 Oct 14, 2021
7272b6f
Make char conversion functions unstably const
est31 Sep 25, 2021
afd9dfa
bootstap: create .cargo/config only if not present
aplanas Nov 11, 2021
ddc1d58
windows: Return the "Not Found" error when a path is empty
JohnTitor Nov 16, 2021
483cff7
Add SourceMap::indentation_before.
m-ou-se Nov 4, 2021
453e242
Improve suggestion for unit Option/Result at the end of a block.
m-ou-se Nov 4, 2021
b331b66
Improve compatible enum variant suggestions.
m-ou-se Nov 4, 2021
4877756
Update tests.
m-ou-se Nov 4, 2021
5a25751
Add new tests for compatible variant diagnostics.
m-ou-se Nov 4, 2021
09e4a75
Use span_suggestions instead of multipart_suggestions.
m-ou-se Nov 4, 2021
b66fb64
Update test output.
m-ou-se Nov 16, 2021
5520737
Remove unnecessary lifetime argument from arena macros.
nnethercote Nov 15, 2021
f1aeebf
add const generics test
lcnr Nov 4, 2021
f5dc388
Point at source of trait bound obligations in more places
estebank Oct 5, 2021
3fe48b2
Change `trait_defs.rs` incremental hash test
estebank Oct 6, 2021
412793f
Point at bounds when comparing impl items to trait
estebank Oct 6, 2021
abf70a9
Do not mention associated items when they introduce an obligation
estebank Oct 12, 2021
a6b31eb
Align multiline messages to their label (add left margin)
estebank Oct 13, 2021
70e8240
Point at `impl` blocks when they introduce unmet obligations
estebank Oct 13, 2021
8d443ea
Suggest constraining `fn` type params when appropriate
estebank Oct 13, 2021
1cadfe6
Move tests for missing trait bounds to their own directory
estebank Oct 14, 2021
2c173af
review comments
estebank Nov 18, 2021
a8dcc87
Move tests from ui directory
estebank Nov 18, 2021
2f1a1f5
fix CTFE/Miri simd_insert/extract on array-style repr(simd) types
RalfJung Nov 18, 2021
0304e16
CTFE SIMD: also test 1-element array
RalfJung Nov 18, 2021
8ace192
bless nll
lcnr Nov 18, 2021
0a89598
Add some comments.
nnethercote Nov 15, 2021
0e39dca
Rollup merge of #89258 - est31:const_char_convert, r=oli-obk
matthiaskrgr Nov 18, 2021
da32a0f
Rollup merge of #89580 - estebank:trait-bounds-are-tricky, r=nagisa
matthiaskrgr Nov 18, 2021
79d3077
Rollup merge of #89916 - the8472:advance_by-avoid-err-0, r=dtolnay
matthiaskrgr Nov 18, 2021
281b65a
Rollup merge of #90575 - m-ou-se:compatible-variant-improvements, r=e…
matthiaskrgr Nov 18, 2021
439afef
Rollup merge of #90578 - lcnr:add-test, r=Mark-Simulacrum
matthiaskrgr Nov 18, 2021
2f371b0
Rollup merge of #90800 - aplanas:fix_cargo_config, r=Mark-Simulacrum
matthiaskrgr Nov 18, 2021
b9414a8
Rollup merge of #90942 - JohnTitor:should-os-error-3, r=m-ou-se
matthiaskrgr Nov 18, 2021
d1662ee
Rollup merge of #90990 - nnethercote:arenas-cleanup, r=oli-obk
matthiaskrgr Nov 18, 2021
7131806
Rollup merge of #90999 - RalfJung:miri_simd, r=oli-obk
matthiaskrgr Nov 18, 2021
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 unnecessary lifetime argument from arena macros.
Because it's always `'tcx`. In fact, some of them use a mixture of
passed-in `$tcx` and hard-coded `'tcx`, so no other lifetime would even
work.

This makes the code easier to read.
  • Loading branch information
nnethercote committed Nov 16, 2021
commit 552073701f0c20c26b8579b7b6810bbeb6595f26
10 changes: 5 additions & 5 deletions compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,9 @@ impl DroplessArena {
}

#[rustc_macro_transparency = "semitransparent"]
pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) {
pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*]) {
#[derive(Default)]
pub struct Arena<$tcx> {
pub struct Arena<'tcx> {
pub dropless: $crate::DroplessArena,
$($name: $crate::TypedArena<$ty>,)*
}
Expand Down Expand Up @@ -547,9 +547,9 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) {

}
$(
impl<$tcx> ArenaAllocatable<$tcx, $ty> for $ty {
impl<'tcx> ArenaAllocatable<'tcx, $ty> for $ty {
#[inline]
fn allocate_on<'a>(self, arena: &'a Arena<$tcx>) -> &'a mut Self {
fn allocate_on<'a>(self, arena: &'a Arena<'tcx>) -> &'a mut Self {
if !::std::mem::needs_drop::<Self>() {
arena.dropless.alloc(self)
} else {
Expand All @@ -559,7 +559,7 @@ pub macro declare_arena([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) {

#[inline]
fn allocate_from_iter<'a>(
arena: &'a Arena<$tcx>,
arena: &'a Arena<'tcx>,
iter: impl ::std::iter::IntoIterator<Item = Self>,
) -> &'a mut [Self] {
if !::std::mem::needs_drop::<Self>() {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ mod item;
mod pat;
mod path;

rustc_hir::arena_types!(rustc_arena::declare_arena, 'tcx);
rustc_hir::arena_types!(rustc_arena::declare_arena);

struct LoweringContext<'a, 'hir: 'a> {
/// Used to assign IDs to HIR nodes that do not directly correspond to AST nodes.
Expand Down
74 changes: 37 additions & 37 deletions compiler/rustc_hir/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,49 @@
/// where `T` is the type listed. These impls will appear in the implement_ty_decoder! macro.
#[macro_export]
macro_rules! arena_types {
($macro:path, $tcx:lifetime) => (
($macro:path) => (
$macro!([
// HIR types
[] hir_krate: rustc_hir::Crate<$tcx>,
[] arm: rustc_hir::Arm<$tcx>,
[] asm_operand: (rustc_hir::InlineAsmOperand<$tcx>, Span),
[] hir_krate: rustc_hir::Crate<'tcx>,
[] arm: rustc_hir::Arm<'tcx>,
[] asm_operand: (rustc_hir::InlineAsmOperand<'tcx>, Span),
[] asm_template: rustc_ast::InlineAsmTemplatePiece,
[] attribute: rustc_ast::Attribute,
[] block: rustc_hir::Block<$tcx>,
[] bare_fn_ty: rustc_hir::BareFnTy<$tcx>,
[] body: rustc_hir::Body<$tcx>,
[] generic_arg: rustc_hir::GenericArg<$tcx>,
[] generic_args: rustc_hir::GenericArgs<$tcx>,
[] generic_bound: rustc_hir::GenericBound<$tcx>,
[] generic_param: rustc_hir::GenericParam<$tcx>,
[] expr: rustc_hir::Expr<$tcx>,
[] expr_field: rustc_hir::ExprField<$tcx>,
[] pat_field: rustc_hir::PatField<$tcx>,
[] fn_decl: rustc_hir::FnDecl<$tcx>,
[] foreign_item: rustc_hir::ForeignItem<$tcx>,
[] block: rustc_hir::Block<'tcx>,
[] bare_fn_ty: rustc_hir::BareFnTy<'tcx>,
[] body: rustc_hir::Body<'tcx>,
[] generic_arg: rustc_hir::GenericArg<'tcx>,
[] generic_args: rustc_hir::GenericArgs<'tcx>,
[] generic_bound: rustc_hir::GenericBound<'tcx>,
[] generic_param: rustc_hir::GenericParam<'tcx>,
[] expr: rustc_hir::Expr<'tcx>,
[] expr_field: rustc_hir::ExprField<'tcx>,
[] pat_field: rustc_hir::PatField<'tcx>,
[] fn_decl: rustc_hir::FnDecl<'tcx>,
[] foreign_item: rustc_hir::ForeignItem<'tcx>,
[] foreign_item_ref: rustc_hir::ForeignItemRef,
[] impl_item: rustc_hir::ImplItem<$tcx>,
[] impl_item: rustc_hir::ImplItem<'tcx>,
[] impl_item_ref: rustc_hir::ImplItemRef,
[] item: rustc_hir::Item<$tcx>,
[] inline_asm: rustc_hir::InlineAsm<$tcx>,
[] llvm_inline_asm: rustc_hir::LlvmInlineAsm<$tcx>,
[] local: rustc_hir::Local<$tcx>,
[] mod_: rustc_hir::Mod<$tcx>,
[] owner_info: rustc_hir::OwnerInfo<$tcx>,
[] param: rustc_hir::Param<$tcx>,
[] pat: rustc_hir::Pat<$tcx>,
[] path: rustc_hir::Path<$tcx>,
[] path_segment: rustc_hir::PathSegment<$tcx>,
[] poly_trait_ref: rustc_hir::PolyTraitRef<$tcx>,
[] qpath: rustc_hir::QPath<$tcx>,
[] stmt: rustc_hir::Stmt<$tcx>,
[] field_def: rustc_hir::FieldDef<$tcx>,
[] trait_item: rustc_hir::TraitItem<$tcx>,
[] item: rustc_hir::Item<'tcx>,
[] inline_asm: rustc_hir::InlineAsm<'tcx>,
[] llvm_inline_asm: rustc_hir::LlvmInlineAsm<'tcx>,
[] local: rustc_hir::Local<'tcx>,
[] mod_: rustc_hir::Mod<'tcx>,
[] owner_info: rustc_hir::OwnerInfo<'tcx>,
[] param: rustc_hir::Param<'tcx>,
[] pat: rustc_hir::Pat<'tcx>,
[] path: rustc_hir::Path<'tcx>,
[] path_segment: rustc_hir::PathSegment<'tcx>,
[] poly_trait_ref: rustc_hir::PolyTraitRef<'tcx>,
[] qpath: rustc_hir::QPath<'tcx>,
[] stmt: rustc_hir::Stmt<'tcx>,
[] field_def: rustc_hir::FieldDef<'tcx>,
[] trait_item: rustc_hir::TraitItem<'tcx>,
[] trait_item_ref: rustc_hir::TraitItemRef,
[] ty: rustc_hir::Ty<$tcx>,
[] type_binding: rustc_hir::TypeBinding<$tcx>,
[] variant: rustc_hir::Variant<$tcx>,
[] where_predicate: rustc_hir::WherePredicate<$tcx>,
], $tcx);
[] ty: rustc_hir::Ty<'tcx>,
[] type_binding: rustc_hir::TypeBinding<'tcx>,
[] variant: rustc_hir::Variant<'tcx>,
[] where_predicate: rustc_hir::WherePredicate<'tcx>,
]);
)
}
28 changes: 14 additions & 14 deletions compiler/rustc_middle/src/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@
/// listed. These impls will appear in the implement_ty_decoder! macro.
#[macro_export]
macro_rules! arena_types {
($macro:path, $tcx:lifetime) => (
($macro:path) => (
$macro!([
[] layout: rustc_target::abi::Layout,
[] fn_abi: rustc_target::abi::call::FnAbi<$tcx, rustc_middle::ty::Ty<$tcx>>,
[] fn_abi: rustc_target::abi::call::FnAbi<'tcx, rustc_middle::ty::Ty<'tcx>>,
// AdtDef are interned and compared by address
[] adt_def: rustc_middle::ty::AdtDef,
[] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<$tcx>>,
[] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<$tcx>>,
[decode] mir: rustc_middle::mir::Body<$tcx>,
[] steal_thir: rustc_data_structures::steal::Steal<rustc_middle::thir::Thir<'tcx>>,
[] steal_mir: rustc_data_structures::steal::Steal<rustc_middle::mir::Body<'tcx>>,
[decode] mir: rustc_middle::mir::Body<'tcx>,
[] steal_promoted:
rustc_data_structures::steal::Steal<
rustc_index::vec::IndexVec<
rustc_middle::mir::Promoted,
rustc_middle::mir::Body<$tcx>
rustc_middle::mir::Body<'tcx>
>
>,
[decode] promoted:
rustc_index::vec::IndexVec<
rustc_middle::mir::Promoted,
rustc_middle::mir::Body<$tcx>
rustc_middle::mir::Body<'tcx>
>,
[decode] typeck_results: rustc_middle::ty::TypeckResults<$tcx>,
[decode] typeck_results: rustc_middle::ty::TypeckResults<'tcx>,
[decode] borrowck_result:
rustc_middle::mir::BorrowCheckResult<$tcx>,
rustc_middle::mir::BorrowCheckResult<'tcx>,
[decode] unsafety_check_result: rustc_middle::mir::UnsafetyCheckResult,
[decode] code_region: rustc_middle::mir::coverage::CodeRegion,
[] const_allocs: rustc_middle::mir::interpret::Allocation,
Expand Down Expand Up @@ -78,14 +78,14 @@ macro_rules! arena_types {
[] foreign_modules: Vec<rustc_session::cstore::ForeignModule>,
[] upvars_mentioned: rustc_data_structures::fx::FxIndexMap<rustc_hir::HirId, rustc_hir::Upvar>,
[] object_safety_violations: rustc_middle::traits::ObjectSafetyViolation,
[] codegen_unit: rustc_middle::mir::mono::CodegenUnit<$tcx>,
[] codegen_unit: rustc_middle::mir::mono::CodegenUnit<'tcx>,
[] attribute: rustc_ast::Attribute,
[] name_set: rustc_data_structures::fx::FxHashSet<rustc_span::symbol::Symbol>,
[] hir_id_set: rustc_hir::HirIdSet,

// Interned types
[] tys: rustc_middle::ty::TyS<$tcx>,
[] predicates: rustc_middle::ty::PredicateInner<$tcx>,
[] tys: rustc_middle::ty::TyS<'tcx>,
[] predicates: rustc_middle::ty::PredicateInner<'tcx>,

// Note that this deliberately duplicates items in the `rustc_hir::arena`,
// since we need to allocate this type on both the `rustc_hir` arena
Expand All @@ -97,8 +97,8 @@ macro_rules! arena_types {
[decode] used_trait_imports: rustc_data_structures::fx::FxHashSet<rustc_hir::def_id::LocalDefId>,

[] dep_kind: rustc_middle::dep_graph::DepKindStruct,
], $tcx);
]);
)
}

arena_types!(rustc_arena::declare_arena, 'tcx);
arena_types!(rustc_arena::declare_arena);
18 changes: 9 additions & 9 deletions compiler/rustc_middle/src/ty/codec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,17 +417,17 @@ macro_rules! __impl_decoder_methods {
macro_rules! impl_arena_allocatable_decoder {
([]$args:tt) => {};
([decode $(, $attrs:ident)*]
[[$name:ident: $ty:ty], $tcx:lifetime]) => {
impl<$tcx, D: TyDecoder<$tcx>> RefDecodable<$tcx, D> for $ty {
[$name:ident: $ty:ty]) => {
impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for $ty {
#[inline]
fn decode(decoder: &mut D) -> Result<&$tcx Self, D::Error> {
fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
decode_arena_allocable(decoder)
}
}

impl<$tcx, D: TyDecoder<$tcx>> RefDecodable<$tcx, D> for [$ty] {
impl<'tcx, D: TyDecoder<'tcx>> RefDecodable<'tcx, D> for [$ty] {
#[inline]
fn decode(decoder: &mut D) -> Result<&$tcx Self, D::Error> {
fn decode(decoder: &mut D) -> Result<&'tcx Self, D::Error> {
decode_arena_allocable_slice(decoder)
}
}
Expand All @@ -438,15 +438,15 @@ macro_rules! impl_arena_allocatable_decoder {
}

macro_rules! impl_arena_allocatable_decoders {
([$($a:tt $name:ident: $ty:ty,)*], $tcx:lifetime) => {
([$($a:tt $name:ident: $ty:ty,)*]) => {
$(
impl_arena_allocatable_decoder!($a [[$name: $ty], $tcx]);
impl_arena_allocatable_decoder!($a [$name: $ty]);
)*
}
}

rustc_hir::arena_types!(impl_arena_allocatable_decoders, 'tcx);
arena_types!(impl_arena_allocatable_decoders, 'tcx);
rustc_hir::arena_types!(impl_arena_allocatable_decoders);
arena_types!(impl_arena_allocatable_decoders);

#[macro_export]
macro_rules! implement_ty_decoder {
Expand Down