Skip to content
5 changes: 2 additions & 3 deletions compiler/rustc_ast_lowering/src/expr/closure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl<'hir> LoweringContext<'_, 'hir> {

let bound_generic_params = self.lower_lifetime_binder(closure_id, generic_params);
// Lower outside new scope to preserve `is_in_loop_condition`.
let fn_decl = self.lower_fn_decl(decl, closure_id, fn_decl_span, FnDeclKind::Closure, None);
let fn_decl = self.lower_fn_decl(decl, closure_id, FnDeclKind::Closure, None);

let c = self.arena.alloc(hir::Closure {
def_id: closure_def_id,
Expand Down Expand Up @@ -327,8 +327,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
// We need to lower the declaration outside the new scope, because we
// have to conserve the state of being inside a loop condition for the
// closure argument types.
let fn_decl =
self.lower_fn_decl(&decl, closure_id, fn_decl_span, FnDeclKind::Closure, None);
let fn_decl = self.lower_fn_decl(&decl, closure_id, FnDeclKind::Closure, None);

if let Const::Yes(span) = constness {
self.dcx().span_err(span, "const coroutines are not supported");
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_ast_lowering/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl<'hir> LoweringContext<'_, 'hir> {

let itctx = ImplTraitContext::Universal;
let (generics, decl) = this.lower_generics(generics, itctx, |this| {
this.lower_fn_decl(decl, id, *fn_sig_span, FnDeclKind::Fn, coroutine_marker)
this.lower_fn_decl(decl, id, FnDeclKind::Fn, coroutine_marker)
});
let sig = hir::FnSig {
decl,
Expand Down Expand Up @@ -742,7 +742,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let (generics, (decl, fn_args)) = self.lower_generics(generics, itctx, |this| {
(
// Disallow `impl Trait` in foreign items.
this.lower_fn_decl(fdec, i.id, sig.span, FnDeclKind::ExternFn, None),
this.lower_fn_decl(fdec, i.id, FnDeclKind::ExternFn, None),
this.lower_fn_params_to_idents(fdec),
)
});
Expand Down Expand Up @@ -1681,7 +1681,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
let header = self.lower_fn_header(sig.header, hir::Safety::Safe, attrs);
let itctx = ImplTraitContext::Universal;
let (generics, decl) = self.lower_generics(generics, itctx, |this| {
this.lower_fn_decl(&sig.decl, id, sig.span, kind, coroutine_marker)
this.lower_fn_decl(&sig.decl, id, kind, coroutine_marker)
});
(generics, hir::FnSig { header, decl, span: self.lower_span(sig.span) })
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
generic_params,
safety: self.lower_safety(f.safety, hir::Safety::Safe),
abi: self.lower_extern(f.ext),
decl: self.lower_fn_decl(&f.decl, t.id, t.span, FnDeclKind::Pointer, None),
decl: self.lower_fn_decl(&f.decl, t.id, FnDeclKind::Pointer, None),
param_idents: self.lower_fn_params_to_idents(&f.decl),
}))
}
Expand Down Expand Up @@ -1962,7 +1962,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
&mut self,
decl: &FnDecl,
fn_node_id: NodeId,
fn_span: Span,
kind: FnDeclKind,
coro: Option<CoroutineMarker>,
) -> &'hir hir::FnDecl<'hir> {
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_expand/src/mbe/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ pub(super) fn failed_to_match_macro(
let mut tracker = CollectTrackerAndEmitter::new(name, psess.dcx(), sp);

let try_success_result = match args {
FailedMacro::Func => try_match_macro(psess, name, body, rules, &mut tracker),
FailedMacro::Func => try_match_macro(psess, body, rules, &mut tracker),
FailedMacro::Attr(attr_args) => {
try_match_macro_attr(psess, name, attr_args, body, rules, &mut tracker)
try_match_macro_attr(psess, attr_args, body, rules, &mut tracker)
}
FailedMacro::Derive => try_match_macro_derive(psess, name, body, rules, &mut tracker),
FailedMacro::Derive => try_match_macro_derive(psess, body, rules, &mut tracker),
};

if try_success_result.is_ok() {
Expand Down
9 changes: 3 additions & 6 deletions compiler/rustc_expand/src/mbe/macro_rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ impl MacroRulesMacroExpander {
trace_macros_note(&mut cx.expansions, sp, msg);
}

match try_match_macro_derive(psess, name, body, rules, &mut NoopTracker) {
match try_match_macro_derive(psess, body, rules, &mut NoopTracker) {
Ok((rule_index, rule, named_matches)) => {
let MacroRule::Derive { rhs, .. } = rule else {
panic!("try_match_macro_derive returned non-derive rule");
Expand Down Expand Up @@ -447,7 +447,7 @@ fn expand_macro<'cx, 'a: 'cx>(
}

// Track nothing for the best performance.
let try_success_result = try_match_macro(psess, name, &arg, rules, &mut NoopTracker);
let try_success_result = try_match_macro(psess, &arg, rules, &mut NoopTracker);

match try_success_result {
Ok((rule_index, rule, named_matches)) => {
Expand Down Expand Up @@ -538,7 +538,7 @@ fn expand_macro_attr(
}

// Track nothing for the best performance.
match try_match_macro_attr(psess, name, &args, &body, rules, &mut NoopTracker) {
match try_match_macro_attr(psess, &args, &body, rules, &mut NoopTracker) {
Ok((i, rule, named_matches)) => {
let MacroRule::Attr { rhs, unsafe_rule, .. } = rule else {
panic!("try_macro_match_attr returned non-attr rule");
Expand Down Expand Up @@ -606,7 +606,6 @@ pub(super) enum CanRetry {
#[instrument(level = "debug", skip(psess, arg, rules, track), fields(tracking = %T::description()))]
pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>(
psess: &ParseSess,
name: Ident,
arg: &TokenStream,
rules: &'matcher [MacroRule],
track: &mut T,
Expand Down Expand Up @@ -686,7 +685,6 @@ pub(super) fn try_match_macro<'matcher, T: Tracker<'matcher>>(
#[instrument(level = "debug", skip(psess, attr_args, attr_body, rules, track), fields(tracking = %T::description()))]
pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>(
psess: &ParseSess,
name: Ident,
attr_args: &TokenStream,
attr_body: &TokenStream,
rules: &'matcher [MacroRule],
Expand Down Expand Up @@ -743,7 +741,6 @@ pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>(
#[instrument(level = "debug", skip(psess, body, rules, track), fields(tracking = %T::description()))]
pub(super) fn try_match_macro_derive<'matcher, T: Tracker<'matcher>>(
psess: &ParseSess,
name: Ident,
body: &TokenStream,
rules: &'matcher [MacroRule],
track: &mut T,
Expand Down
5 changes: 2 additions & 3 deletions compiler/rustc_hir_analysis/src/check/wfcheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ where

lint_redundant_lifetimes(tcx, body_def_id, &outlives_env);

let errors = infcx.resolve_regions_with_outlives_env(&outlives_env, tcx.def_span(body_def_id));
let errors = infcx.resolve_regions_with_outlives_env(&outlives_env);
if errors.is_empty() {
return Ok(());
}
Expand All @@ -215,8 +215,7 @@ where
// the implied bounds hack if this contains `bevy_ecs`'s `ParamSet` type.
false,
);
let errors_compat =
infcx_compat.resolve_regions_with_outlives_env(&outlives_env, tcx.def_span(body_def_id));
let errors_compat = infcx_compat.resolve_regions_with_outlives_env(&outlives_env);
if errors_compat.is_empty() {
// FIXME: Once we fix bevy, this would be the place to insert a warning
// to upgrade bevy.
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
pub(crate) fn write_splatted_call(
&self,
hir_id: HirId,
span: Span,
fn_id: SplatLoweringInfo<'tcx>,
callee_generic_args: Option<GenericArgsRef<'tcx>>,
first_tupled_arg_index: u16,
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// FIXME(const_trait_impl): does not enforce constness yet
self.write_splatted_call(
call_expr.hir_id,
call_span,
fn_id,
callee_generic_args,
first_tupled_arg_index,
Expand Down
4 changes: 1 addition & 3 deletions compiler/rustc_infer/src/infer/outlives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use std::iter;
use rustc_data_structures::undo_log::UndoLogs;
use rustc_middle::traits::query::OutlivesBound;
use rustc_middle::ty;
use rustc_span::Span;
use tracing::instrument;

use self::env::OutlivesEnvironment;
Expand Down Expand Up @@ -44,9 +43,8 @@ impl<'tcx> InferCtxt<'tcx> {
pub fn resolve_regions_with_outlives_env(
&self,
outlives_env: &OutlivesEnvironment<'tcx>,
span: Span,
) -> Vec<RegionResolutionError<'tcx>> {
self.process_registered_region_obligations(outlives_env, span);
self.process_registered_region_obligations(outlives_env);

let mut storage = {
let mut inner = self.inner.borrow_mut();
Expand Down
8 changes: 1 addition & 7 deletions compiler/rustc_infer/src/infer/outlives/obligations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ use rustc_middle::ty::{
self, GenericArgKind, GenericArgsRef, PolyTypeOutlivesClause, Region, RegionVid, Ty, TyCtxt,
TypeVisitableExt, Upcast,
};
use rustc_span::Span;
use rustc_type_ir::region_constraint::{self, LeafRegionConstraint};
use smallvec::smallvec;
use tracing::{debug, instrument};
Expand Down Expand Up @@ -335,13 +334,8 @@ impl<'tcx> InferCtxt<'tcx> {
/// invoked after all type-inference variables have been bound --
/// right before lexical region resolution.
#[instrument(level = "debug", skip(self, outlives_env))]
pub fn process_registered_region_obligations(
&self,
outlives_env: &OutlivesEnvironment<'tcx>,
span: Span,
) {
pub fn process_registered_region_obligations(&self, outlives_env: &OutlivesEnvironment<'tcx>) {
use rustc_type_ir::InferCtxtLike;

assert!(!self.in_snapshot(), "cannot process registered region obligations in a snapshot");

if self.tcx.assumptions_on_binders() {
Expand Down
13 changes: 3 additions & 10 deletions compiler/rustc_mir_build/src/thir/pattern/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> {
self.check_match(scrutinee, arms, MatchSource::Normal, span);
}
ExprKind::Let { ref pat, expr } => {
self.check_let(pat, Some(expr), ex.span, None);
self.check_let(pat, Some(expr), ex.span);
}
ExprKind::LogicalOp { op: LogicalOp::And, .. }
if !matches!(self.let_source, LetSource::None) =>
Expand All @@ -180,9 +180,8 @@ impl<'p, 'tcx> Visitor<'p, 'tcx> for MatchVisitor<'p, 'tcx> {
self.with_hir_source(hir_id, |this| {
let let_source =
if else_block.is_some() { LetSource::LetElse } else { LetSource::PlainLet };
let else_span = else_block.map(|bid| this.thir.blocks[bid].span);
this.with_let_source(let_source, |this| {
this.check_let(pattern, initializer, span, else_span)
this.check_let(pattern, initializer, span)
});
visit::walk_stmt(this, stmt);
});
Expand Down Expand Up @@ -424,13 +423,7 @@ impl<'p, 'tcx> MatchVisitor<'p, 'tcx> {
}

#[instrument(level = "trace", skip(self))]
fn check_let(
&mut self,
pat: &'p Pat<'tcx>,
scrutinee: Option<ExprId>,
span: Span,
else_span: Option<Span>,
) {
fn check_let(&mut self, pat: &'p Pat<'tcx>, scrutinee: Option<ExprId>, span: Span) {
assert!(self.let_source != LetSource::None);
let scrut = scrutinee.map(|id| &self.thir[id]);
if let LetSource::PlainLet = self.let_source {
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_mir_transform/src/gvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,6 @@ impl<'body, 'a, 'tcx> VnState<'body, 'a, 'tcx> {
#[instrument(level = "trace", skip(self), ret)]
fn simplify_rvalue(
&mut self,
lhs: &Place<'tcx>,
rvalue: &mut Rvalue<'tcx>,
location: Location,
) -> Option<VnIndex> {
Expand Down Expand Up @@ -2100,7 +2099,7 @@ impl<'tcx> MutVisitor<'tcx> for VnState<'_, '_, 'tcx> {
) {
self.simplify_place_projection(lhs, location);

let value = self.simplify_rvalue(lhs, rvalue, location);
let value = self.simplify_rvalue(rvalue, location);
if let Some(value) = value {
// FIXME: Is it correct to make these retagging assignments?
if let Some(const_) = self.try_as_constant(value) {
Expand Down
7 changes: 2 additions & 5 deletions compiler/rustc_next_trait_solver/src/canonical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ where
/// the `normalization_nested_goals`
pub(super) fn instantiate_and_apply_query_response<D, I>(
delegate: &D,
param_env: I::ParamEnv,
original_values: &[I::GenericArg],
response: CanonicalResponse<I>,
span: I::Span,
Expand All @@ -115,7 +114,7 @@ where
let Response { var_values, external_constraints, certainty } =
delegate.instantiate_canonical(response, instantiation);

unify_query_var_values(delegate, param_env, &original_values, var_values, span);
unify_query_var_values(delegate, &original_values, var_values, span);

let ExternalConstraintsData { region_constraints, opaque_types, normalization_nested_goals } =
&*external_constraints;
Expand Down Expand Up @@ -490,7 +489,6 @@ where
#[instrument(level = "trace", skip(delegate))]
fn unify_query_var_values<D, I>(
delegate: &D,
param_env: I::ParamEnv,
original_values: &[I::GenericArg],
var_values: CanonicalVarValues<I>,
span: I::Span,
Expand Down Expand Up @@ -577,7 +575,6 @@ where
pub fn instantiate_canonical_state<D, I, T>(
delegate: &D,
span: I::Span,
param_env: I::ParamEnv,
prev_universe: ty::UniverseIndex,
orig_values: &mut ThinVec<I::GenericArg>,
state: inspect::CanonicalState<I, T>,
Expand Down Expand Up @@ -609,7 +606,7 @@ where

let inspect::State { var_values, data } = delegate.instantiate_canonical(state, instantiation);

unify_query_var_values(delegate, param_env, orig_values, var_values, span);
unify_query_var_values(delegate, orig_values, var_values, span);
data
}

Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,6 @@ where

let (normalization_nested_goals, certainty) = instantiate_and_apply_query_response(
self.delegate,
goal.param_env,
&orig_values,
response,
self.origin_span,
Expand Down Expand Up @@ -1955,7 +1954,6 @@ pub(super) fn evaluate_root_goal_for_proof_tree<D: SolverDelegate<Interner = I>,

let (normalization_nested_goals, _certainty) = instantiate_and_apply_query_response(
delegate,
goal.param_env,
&proof_tree.orig_values,
response,
origin_span,
Expand Down
10 changes: 6 additions & 4 deletions compiler/rustc_trait_selection/src/regions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ impl<'tcx> InferCtxt<'tcx> {
param_env: ty::ParamEnv<'tcx>,
assumed_wf_tys: impl IntoIterator<Item = Ty<'tcx>>,
) -> Vec<RegionResolutionError<'tcx>> {
self.resolve_regions_with_outlives_env(
&OutlivesEnvironment::new(self, body_def_id, param_env, assumed_wf_tys),
self.tcx.def_span(body_def_id),
)
self.resolve_regions_with_outlives_env(&OutlivesEnvironment::new(
self,
body_def_id,
param_env,
assumed_wf_tys,
))
}
}

Expand Down
6 changes: 0 additions & 6 deletions compiler/rustc_trait_selection/src/solve/inspect/analyse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
)]
pub fn instantiate_nested_goals(&self, span: Span) -> Vec<InspectGoal<'a, 'tcx>> {
let infcx = self.goal.infcx;
let param_env = self.goal.goal.param_env;
let mut orig_values = self.goal.orig_values.clone();

let mut instantiated_goals = vec![];
Expand All @@ -109,7 +108,6 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
instantiate_canonical_state(
infcx,
span,
param_env,
self.goal.prev_universe,
&mut orig_values,
goal,
Expand All @@ -124,7 +122,6 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
let () = instantiate_canonical_state(
infcx,
span,
param_env,
self.goal.prev_universe,
&mut orig_values,
self.final_state,
Expand All @@ -148,7 +145,6 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
use rustc_middle::ty::InferCtxtLike;

let infcx = self.goal.infcx;
let param_env = self.goal.goal.param_env;
let mut orig_values = self.goal.orig_values.clone();

for step in &self.steps {
Expand All @@ -157,7 +153,6 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
let impl_args = instantiate_canonical_state(
infcx,
span,
param_env,
self.goal.prev_universe,
&mut orig_values,
impl_args,
Expand All @@ -166,7 +161,6 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> {
let () = instantiate_canonical_state(
infcx,
span,
param_env,
self.goal.prev_universe,
&mut orig_values,
self.final_state,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
}

let outlives_env = OutlivesEnvironment::new(&infcx, CRATE_DEF_ID, full_env, []);
let _ = infcx.process_registered_region_obligations(&outlives_env, DUMMY_SP);
let _ = infcx.process_registered_region_obligations(&outlives_env);

let region_data = infcx.inner.borrow_mut().unwrap_region_constraints().data().clone();

Expand Down
Loading