Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/alloc_error_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::errors;
use crate::util::check_builtin_macro_attribute;

pub(crate) fn expand(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
_span: Span,
meta_item: &ast::MetaItem,
item: Annotatable,
Expand Down Expand Up @@ -59,7 +59,7 @@ pub(crate) fn expand(
// unsafe fn __rust_alloc_error_handler(size: usize, align: usize) -> ! {
// handler(core::alloc::Layout::from_size_align_unchecked(size, align))
// }
fn generate_handler(cx: &ExtCtxt<'_>, handler: Ident, span: Span, sig_span: Span) -> Stmt {
fn generate_handler(cx: &ExtCtxt<'_, '_>, handler: Ident, span: Span, sig_span: Span) -> Stmt {
let usize = cx.path_ident(span, Ident::new(sym::usize, span));
let ty_usize = cx.ty_path(usize);
let size = Ident::new(sym::size, span);
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct ValidatedAsmArgs {
}

fn parse_args<'a>(
ecx: &ExtCtxt<'a>,
ecx: &ExtCtxt<'a, '_>,
sp: Span,
tts: TokenStream,
asm_macro: AsmMacro,
Expand All @@ -37,7 +37,7 @@ fn parse_args<'a>(
}

fn validate_asm_args<'a>(
ecx: &ExtCtxt<'a>,
ecx: &ExtCtxt<'a, '_>,
asm_macro: AsmMacro,
args: Vec<AsmArg>,
) -> PResult<'a, ValidatedAsmArgs> {
Expand Down Expand Up @@ -263,7 +263,7 @@ fn validate_asm_args<'a>(
}

fn expand_preparsed_asm(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
asm_macro: AsmMacro,
args: ValidatedAsmArgs,
) -> ExpandResult<Result<ast::InlineAsm, ErrorGuaranteed>, ()> {
Expand Down Expand Up @@ -580,7 +580,7 @@ fn expand_preparsed_asm(
}

pub(super) fn expand_asm<'cx>(
ecx: &'cx mut ExtCtxt<'_>,
ecx: &'cx mut ExtCtxt<'_, '_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {
Expand Down Expand Up @@ -609,7 +609,7 @@ pub(super) fn expand_asm<'cx>(
}

pub(super) fn expand_naked_asm<'cx>(
ecx: &'cx mut ExtCtxt<'_>,
ecx: &'cx mut ExtCtxt<'_, '_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {
Expand Down Expand Up @@ -639,7 +639,7 @@ pub(super) fn expand_naked_asm<'cx>(
}

pub(super) fn expand_global_asm<'cx>(
ecx: &'cx mut ExtCtxt<'_>,
ecx: &'cx mut ExtCtxt<'_, '_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_builtin_macros/src/assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::edition_panic::use_panic_2021;
use crate::errors;

pub(crate) fn expand_assert<'cx>(
cx: &'cx mut ExtCtxt<'_>,
cx: &'cx mut ExtCtxt<'_, '_>,
span: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {
Expand Down Expand Up @@ -101,7 +101,7 @@ struct Assert {

// if !{ ... } { ... } else { ... }
fn expr_if_not(
cx: &ExtCtxt<'_>,
cx: &ExtCtxt<'_, '_>,
span: Span,
cond: Box<Expr>,
then: Box<Expr>,
Expand All @@ -110,7 +110,7 @@ fn expr_if_not(
cx.expr_if(span, cx.expr(span, ExprKind::Unary(UnOp::Not, cond)), then, els)
}

fn parse_assert<'a>(cx: &ExtCtxt<'a>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> {
fn parse_assert<'a>(cx: &ExtCtxt<'a, '_>, sp: Span, stream: TokenStream) -> PResult<'a, Assert> {
let mut parser = cx.new_parser_from_tts(stream);

if parser.token == token::Eof {
Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_builtin_macros/src/assert/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ use rustc_expand::base::ExtCtxt;
use rustc_span::{Ident, Span, Symbol, sym};
use thin_vec::{ThinVec, thin_vec};

pub(super) struct Context<'cx, 'a> {
pub(super) struct Context<'cx, 'a, 'tcx> {
// An optimization.
//
// Elements that aren't consumed (PartialEq, PartialOrd, ...) can be copied **after** the
// `assert!` expression fails rather than copied on-the-fly.
best_case_captures: Vec<Stmt>,
// Top-level `let captureN = Capture::new()` statements
capture_decls: Vec<Capture>,
cx: &'cx ExtCtxt<'a>,
cx: &'cx ExtCtxt<'a, 'tcx>,
// Formatting string used for debugging
fmt_string: String,
// If the current expression being visited consumes itself. Used to construct
Expand All @@ -36,8 +36,8 @@ pub(super) struct Context<'cx, 'a> {
span: Span,
}

impl<'cx, 'a> Context<'cx, 'a> {
pub(super) fn new(cx: &'cx ExtCtxt<'a>, span: Span) -> Self {
impl<'cx, 'a, 'tcx> Context<'cx, 'a, 'tcx> {
pub(super) fn new(cx: &'cx ExtCtxt<'a, 'tcx>, span: Span) -> Self {
Self {
best_case_captures: <_>::default(),
capture_decls: <_>::default(),
Expand Down Expand Up @@ -443,12 +443,12 @@ fn escape_to_fmt(s: &str) -> String {
rslt
}

fn expr_addr_of_mut(cx: &ExtCtxt<'_>, sp: Span, e: Box<Expr>) -> Box<Expr> {
fn expr_addr_of_mut(cx: &ExtCtxt<'_, '_>, sp: Span, e: Box<Expr>) -> Box<Expr> {
cx.expr(sp, ExprKind::AddrOf(BorrowKind::Ref, Mutability::Mut, e))
}

fn expr_method_call(
cx: &ExtCtxt<'_>,
cx: &ExtCtxt<'_, '_>,
seg: PathSegment,
receiver: Box<Expr>,
args: ThinVec<Box<Expr>>,
Expand All @@ -457,6 +457,6 @@ fn expr_method_call(
cx.expr(span, ExprKind::MethodCall(Box::new(MethodCall { seg, receiver, args, span })))
}

fn expr_paren(cx: &ExtCtxt<'_>, sp: Span, e: Box<Expr>) -> Box<Expr> {
fn expr_paren(cx: &ExtCtxt<'_, '_>, sp: Span, e: Box<Expr>) -> Box<Expr> {
cx.expr(sp, ExprKind::Paren(e))
}
14 changes: 7 additions & 7 deletions compiler/rustc_builtin_macros/src/autodiff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ mod llvm_enzyme {
}

pub(crate) fn from_ast(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
meta_item: &ThinVec<MetaItemInner>,
has_ret: bool,
mode: DiffMode,
Expand Down Expand Up @@ -162,7 +162,7 @@ mod llvm_enzyme {
}

pub(crate) fn expand_forward(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
expand_span: Span,
meta_item: &ast::MetaItem,
item: Annotatable,
Expand All @@ -171,7 +171,7 @@ mod llvm_enzyme {
}

pub(crate) fn expand_reverse(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
expand_span: Span,
meta_item: &ast::MetaItem,
item: Annotatable,
Expand Down Expand Up @@ -203,7 +203,7 @@ mod llvm_enzyme {
/// FIXME(ZuseZ4): Once autodiff is enabled by default, make this a doc comment which is checked
/// in CI.
pub(crate) fn expand_with_mode(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
expand_span: Span,
meta_item: &ast::MetaItem,
mut item: Annotatable,
Expand Down Expand Up @@ -502,7 +502,7 @@ mod llvm_enzyme {
// std::intrinsics::autodiff(source as fn(..) -> .., diff, (args))
// ```
fn call_autodiff(
ecx: &ExtCtxt<'_>,
ecx: &ExtCtxt<'_, '_>,
primal: Ident,
diff: Ident,
span: Span,
Expand Down Expand Up @@ -586,7 +586,7 @@ mod llvm_enzyme {
// Given `foo` and `<A, B, C>` params, gen `foo::<A, B, C>`
// We use this expression when passing primal and diff function to the autodiff intrinsic
fn gen_turbofish_expr(
ecx: &ExtCtxt<'_>,
ecx: &ExtCtxt<'_, '_>,
ident: Ident,
generics: &Generics,
span: Span,
Expand Down Expand Up @@ -648,7 +648,7 @@ mod llvm_enzyme {
// FIXME(Sa4dUs): make individual activities' span available so errors
// can point to only the activity instead of the entire attribute
fn gen_enzyme_decl(
ecx: &ExtCtxt<'_>,
ecx: &ExtCtxt<'_, '_>,
sig: &ast::FnSig,
x: &RustcAutodiff,
span: Span,
Expand Down
8 changes: 6 additions & 2 deletions compiler/rustc_builtin_macros/src/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_span::{ErrorGuaranteed, Span, sym};
use crate::errors;

pub(crate) fn expand_cfg(
cx: &mut ExtCtxt<'_>,
cx: &mut ExtCtxt<'_, '_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'static> {
Expand All @@ -35,7 +35,11 @@ pub(crate) fn expand_cfg(
})
}

fn parse_cfg(cx: &ExtCtxt<'_>, span: Span, tts: TokenStream) -> Result<CfgEntry, ErrorGuaranteed> {
fn parse_cfg(
cx: &ExtCtxt<'_, '_>,
span: Span,
tts: TokenStream,
) -> Result<CfgEntry, ErrorGuaranteed> {
let mut parser = cx.new_parser_from_tts(tts);
if parser.token == token::Eof {
return Err(cx.dcx().emit_err(errors::RequiresCfgPattern { span }));
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_builtin_macros/src/cfg_accessible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::errors;

pub(crate) struct Expander;

fn validate_input<'a>(ecx: &ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> {
fn validate_input<'a>(ecx: &ExtCtxt<'_, '_>, mi: &'a ast::MetaItem) -> Option<&'a ast::Path> {
use errors::CfgAccessibleInvalid::*;
match mi.meta_item_list() {
None => {}
Expand Down Expand Up @@ -38,7 +38,7 @@ fn validate_input<'a>(ecx: &ExtCtxt<'_>, mi: &'a ast::MetaItem) -> Option<&'a as
impl MultiItemModifier for Expander {
fn expand(
&self,
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
span: Span,
meta_item: &ast::MetaItem,
item: Annotatable,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/cfg_eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use tracing::instrument;
use crate::util::{check_builtin_macro_attribute, warn_on_duplicate_attribute};

pub(crate) fn expand(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
_span: Span,
meta_item: &ast::MetaItem,
annotatable: Annotatable,
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_builtin_macros/src/cfg_select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ use crate::errors::CfgSelectNoMatches;
/// This intermediate structure is used to emit parse errors for the branches that are not chosen.
/// The `MacResult` instance below parses all branches, emitting any errors it encounters, but only
/// keeps the parse result for the selected branch.
struct CfgSelectResult<'cx, 'sess> {
ecx: &'cx mut ExtCtxt<'sess>,
struct CfgSelectResult<'cx, 'sess, 'tcx> {
ecx: &'cx mut ExtCtxt<'sess, 'tcx>,
site_span: Span,
selected_tts: TokenStream,
selected_span: Span,
other_branches: CfgSelectBranches,
}

fn tts_to_mac_result<'cx, 'sess>(
ecx: &'cx mut ExtCtxt<'sess>,
ecx: &'cx mut ExtCtxt<'sess, '_>,
site_span: Span,
tts: TokenStream,
span: Span,
Expand All @@ -46,7 +46,7 @@ macro_rules! forward_to_parser_any_macro {
};
}

impl<'cx, 'sess> MacResult for CfgSelectResult<'cx, 'sess> {
impl<'cx, 'sess> MacResult for CfgSelectResult<'cx, 'sess, '_> {
forward_to_parser_any_macro!(make_expr, Box<Expr>);
forward_to_parser_any_macro!(make_stmts, SmallVec<[ast::Stmt; 1]>);
forward_to_parser_any_macro!(make_items, SmallVec<[Box<ast::Item>; 1]>);
Expand All @@ -61,7 +61,7 @@ impl<'cx, 'sess> MacResult for CfgSelectResult<'cx, 'sess> {
}

pub(super) fn expand_cfg_select<'cx>(
ecx: &'cx mut ExtCtxt<'_>,
ecx: &'cx mut ExtCtxt<'_, '_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/compile_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rustc_span::Span;
use crate::util::get_single_str_from_tts;

pub(crate) fn expand_compile_error<'cx>(
cx: &'cx mut ExtCtxt<'_>,
cx: &'cx mut ExtCtxt<'_, '_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'cx> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/concat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::errors;
use crate::util::get_exprs_from_tts;

pub(crate) fn expand_concat(
cx: &mut ExtCtxt<'_>,
cx: &mut ExtCtxt<'_, '_>,
sp: rustc_span::Span,
tts: TokenStream,
) -> MacroExpanderResult<'static> {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_builtin_macros/src/concat_bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::util::get_exprs_from_tts;

/// Emits errors for literal expressions that are invalid inside and outside of an array.
fn invalid_type_err(
cx: &ExtCtxt<'_>,
cx: &ExtCtxt<'_, '_>,
token_lit: token::Lit,
span: Span,
is_nested: bool,
Expand Down Expand Up @@ -86,7 +86,7 @@ fn invalid_type_err(
/// Otherwise, returns `None`, and either pushes the `expr`'s span to `missing_literals` or
/// updates `guar` accordingly.
fn handle_array_element(
cx: &ExtCtxt<'_>,
cx: &ExtCtxt<'_, '_>,
guar: &mut Option<ErrorGuaranteed>,
missing_literals: &mut Vec<rustc_span::Span>,
expr: &Box<rustc_ast::Expr>,
Expand Down Expand Up @@ -130,7 +130,7 @@ fn handle_array_element(
}

pub(crate) fn expand_concat_bytes(
cx: &mut ExtCtxt<'_>,
cx: &mut ExtCtxt<'_, '_>,
sp: Span,
tts: TokenStream,
) -> MacroExpanderResult<'static> {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_builtin_macros/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub(crate) struct ExpandEnsures;
impl AttrProcMacro for ExpandRequires {
fn expand<'cx>(
&self,
ecx: &'cx mut ExtCtxt<'_>,
ecx: &'cx mut ExtCtxt<'_, '_>,
span: Span,
annotation: TokenStream,
annotated: TokenStream,
Expand All @@ -24,7 +24,7 @@ impl AttrProcMacro for ExpandRequires {
impl AttrProcMacro for ExpandEnsures {
fn expand<'cx>(
&self,
ecx: &'cx mut ExtCtxt<'_>,
ecx: &'cx mut ExtCtxt<'_, '_>,
span: Span,
annotation: TokenStream,
annotated: TokenStream,
Expand All @@ -45,7 +45,7 @@ impl AttrProcMacro for ExpandEnsures {
// our attribute infrastructure does not yet support mixing a token-tree annotation with an AST
// annotated, we end up doing token tree manipulation.
fn expand_contract_clause(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
attr_span: Span,
annotated: TokenStream,
inject: impl FnOnce(&mut TokenStream) -> Result<(), ErrorGuaranteed>,
Expand Down Expand Up @@ -131,7 +131,7 @@ fn expand_contract_clause(
}

fn expand_contract_clause_tts(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
attr_span: Span,
annotation: TokenStream,
annotated: TokenStream,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/define_opaque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_expand::base::{Annotatable, ExtCtxt};
use rustc_span::Span;

pub(crate) fn expand(
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
_expand_span: Span,
meta_item: &ast::MetaItem,
mut item: Annotatable,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(crate) struct Expander {
impl MultiItemModifier for Expander {
fn expand(
&self,
ecx: &mut ExtCtxt<'_>,
ecx: &mut ExtCtxt<'_, '_>,
span: Span,
meta_item: &ast::MetaItem,
item: Annotatable,
Expand Down
Loading
Loading