diff --git a/compiler/rustc_ast_lowering/src/expr/closure.rs b/compiler/rustc_ast_lowering/src/expr/closure.rs index 8505d39a718c4..26c267a174782 100644 --- a/compiler/rustc_ast_lowering/src/expr/closure.rs +++ b/compiler/rustc_ast_lowering/src/expr/closure.rs @@ -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, @@ -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"); diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 256da9d6c7d5b..4680799c6d213 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -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, @@ -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), ) }); @@ -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) }) } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a5896f495847d..1f9377089260b 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -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), })) } @@ -1962,7 +1962,6 @@ impl<'hir> LoweringContext<'_, 'hir> { &mut self, decl: &FnDecl, fn_node_id: NodeId, - fn_span: Span, kind: FnDeclKind, coro: Option, ) -> &'hir hir::FnDecl<'hir> { diff --git a/compiler/rustc_expand/src/mbe/diagnostics.rs b/compiler/rustc_expand/src/mbe/diagnostics.rs index 024a0542a5f64..0e79dadb3503e 100644 --- a/compiler/rustc_expand/src/mbe/diagnostics.rs +++ b/compiler/rustc_expand/src/mbe/diagnostics.rs @@ -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() { diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index b268b8b767327..2212724c68bc1 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -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"); @@ -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)) => { @@ -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"); @@ -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, @@ -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], @@ -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, diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index 34aafd72526a8..41da833aaf887 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -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(()); } @@ -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. diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 9a7c381a2dc39..b95105519ca8b 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -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>, first_tupled_arg_index: u16, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index 9859a1ad27444..fbd2fbb43e12b 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -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, diff --git a/compiler/rustc_infer/src/infer/outlives/mod.rs b/compiler/rustc_infer/src/infer/outlives/mod.rs index 20bf987e07d0c..79c1a4fb7662f 100644 --- a/compiler/rustc_infer/src/infer/outlives/mod.rs +++ b/compiler/rustc_infer/src/infer/outlives/mod.rs @@ -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; @@ -44,9 +43,8 @@ impl<'tcx> InferCtxt<'tcx> { pub fn resolve_regions_with_outlives_env( &self, outlives_env: &OutlivesEnvironment<'tcx>, - span: Span, ) -> Vec> { - 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(); diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index bc75f1eeb40e1..60004c709f4ac 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -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}; @@ -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() { diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index d11eef067c51a..6a1b0717da0a3 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -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) => @@ -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); }); @@ -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, - span: Span, - else_span: Option, - ) { + fn check_let(&mut self, pat: &'p Pat<'tcx>, scrutinee: Option, span: Span) { assert!(self.let_source != LetSource::None); let scrut = scrutinee.map(|id| &self.thir[id]); if let LetSource::PlainLet = self.let_source { diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index a8aa38461a8c1..24e7c1fd3079e 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -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 { @@ -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) { diff --git a/compiler/rustc_next_trait_solver/src/canonical/mod.rs b/compiler/rustc_next_trait_solver/src/canonical/mod.rs index c60e6ee246273..fc9024333bf44 100644 --- a/compiler/rustc_next_trait_solver/src/canonical/mod.rs +++ b/compiler/rustc_next_trait_solver/src/canonical/mod.rs @@ -100,7 +100,6 @@ where /// the `normalization_nested_goals` pub(super) fn instantiate_and_apply_query_response( delegate: &D, - param_env: I::ParamEnv, original_values: &[I::GenericArg], response: CanonicalResponse, span: I::Span, @@ -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; @@ -490,7 +489,6 @@ where #[instrument(level = "trace", skip(delegate))] fn unify_query_var_values( delegate: &D, - param_env: I::ParamEnv, original_values: &[I::GenericArg], var_values: CanonicalVarValues, span: I::Span, @@ -577,7 +575,6 @@ where pub fn instantiate_canonical_state( delegate: &D, span: I::Span, - param_env: I::ParamEnv, prev_universe: ty::UniverseIndex, orig_values: &mut ThinVec, state: inspect::CanonicalState, @@ -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 } diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs index 61cd8e46d8816..c5665246710a3 100644 --- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs +++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs @@ -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, @@ -1955,7 +1954,6 @@ pub(super) fn evaluate_root_goal_for_proof_tree, let (normalization_nested_goals, _certainty) = instantiate_and_apply_query_response( delegate, - goal.param_env, &proof_tree.orig_values, response, origin_span, diff --git a/compiler/rustc_trait_selection/src/regions.rs b/compiler/rustc_trait_selection/src/regions.rs index c63b7773739d0..83a1af895032b 100644 --- a/compiler/rustc_trait_selection/src/regions.rs +++ b/compiler/rustc_trait_selection/src/regions.rs @@ -74,10 +74,12 @@ impl<'tcx> InferCtxt<'tcx> { param_env: ty::ParamEnv<'tcx>, assumed_wf_tys: impl IntoIterator>, ) -> Vec> { - 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, + )) } } diff --git a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs index 8c8af70f4af46..19d423cc0ecfd 100644 --- a/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs +++ b/compiler/rustc_trait_selection/src/solve/inspect/analyse.rs @@ -98,7 +98,6 @@ impl<'a, 'tcx> InspectCandidate<'a, 'tcx> { )] pub fn instantiate_nested_goals(&self, span: Span) -> Vec> { 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![]; @@ -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, @@ -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, @@ -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 { @@ -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, @@ -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, diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index fadc64ed4af5c..71dee3de72cb8 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -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();