mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #124943 - lcnr:generic-args-ref, r=compiler-errors
always use `GenericArgsRef` r? ```@compiler-errors```
This commit is contained in:
commit
30bd6cb726
@ -315,7 +315,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
trait_def_id: DefId,
|
||||
self_ty: Ty<'tcx>,
|
||||
opt_input_types: Option<&[Ty<'tcx>]>,
|
||||
) -> (traits::PredicateObligation<'tcx>, &'tcx ty::List<ty::GenericArg<'tcx>>) {
|
||||
) -> (traits::PredicateObligation<'tcx>, ty::GenericArgsRef<'tcx>) {
|
||||
// Construct a trait-reference `self_ty : Trait<input_tys>`
|
||||
let args = GenericArgs::for_item(self.tcx, trait_def_id, |param, _| {
|
||||
match param.kind {
|
||||
@ -365,7 +365,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
m_name: Ident,
|
||||
trait_def_id: DefId,
|
||||
obligation: traits::PredicateObligation<'tcx>,
|
||||
args: &'tcx ty::List<ty::GenericArg<'tcx>>,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
) -> Option<InferOk<'tcx, MethodCallee<'tcx>>> {
|
||||
debug!(?obligation);
|
||||
|
||||
|
@ -1676,7 +1676,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
unmentioned_fields: &mut Vec<(&'tcx ty::FieldDef, Ident)>,
|
||||
pat: &'tcx Pat<'tcx>,
|
||||
variant: &ty::VariantDef,
|
||||
args: &'tcx ty::List<ty::GenericArg<'tcx>>,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
) -> Diag<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let (field_names, t, plural) = if let [field] = inexistent_fields {
|
||||
|
@ -9,7 +9,7 @@ use crate::{
|
||||
use hir::{Expr, Pat};
|
||||
use rustc_hir as hir;
|
||||
use rustc_infer::{infer::TyCtxtInferExt, traits::ObligationCause};
|
||||
use rustc_middle::ty::{self, List};
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
use rustc_span::{sym, Span};
|
||||
use rustc_trait_selection::traits::ObligationCtxt;
|
||||
@ -123,7 +123,7 @@ fn extract_iterator_next_call<'tcx>(
|
||||
fn suggest_question_mark<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
adt: ty::AdtDef<'tcx>,
|
||||
args: &List<ty::GenericArg<'tcx>>,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
span: Span,
|
||||
) -> bool {
|
||||
let Some(body_id) = cx.enclosing_body else { return false };
|
||||
|
@ -2331,7 +2331,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn mk_args_from_iter<I, T>(self, iter: I) -> T::Output
|
||||
where
|
||||
I: Iterator<Item = T>,
|
||||
T: CollectAndApply<GenericArg<'tcx>, &'tcx List<GenericArg<'tcx>>>,
|
||||
T: CollectAndApply<GenericArg<'tcx>, ty::GenericArgsRef<'tcx>>,
|
||||
{
|
||||
T::collect_and_apply(iter, |xs| self.mk_args(xs))
|
||||
}
|
||||
|
@ -977,7 +977,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
|
||||
fn pretty_print_opaque_impl_type(
|
||||
&mut self,
|
||||
def_id: DefId,
|
||||
args: &'tcx ty::List<ty::GenericArg<'tcx>>,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
) -> Result<(), PrintError> {
|
||||
let tcx = self.tcx();
|
||||
|
||||
|
@ -10,7 +10,7 @@ use rustc_infer::infer::canonical::Canonical;
|
||||
use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
|
||||
use rustc_infer::traits::query::NoSolution;
|
||||
use rustc_infer::{infer::outlives::env::OutlivesEnvironment, traits::FulfillmentError};
|
||||
use rustc_middle::ty::{self, AdtDef, GenericArg, List, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, AdtDef, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_span::DUMMY_SP;
|
||||
|
||||
use super::outlives_bounds::InferCtxtExt;
|
||||
@ -129,7 +129,7 @@ pub fn all_fields_implement_trait<'tcx>(
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
self_type: Ty<'tcx>,
|
||||
adt: AdtDef<'tcx>,
|
||||
args: &'tcx List<GenericArg<'tcx>>,
|
||||
args: ty::GenericArgsRef<'tcx>,
|
||||
parent_cause: ObligationCause<'tcx>,
|
||||
lang_item: LangItem,
|
||||
) -> Result<(), Vec<(&'tcx ty::FieldDef, Ty<'tcx>, InfringingFieldsReason<'tcx>)>> {
|
||||
|
@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use rustc_hir::{HirId, Item, ItemKind};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::{self, FieldDef, GenericArg, List};
|
||||
use rustc_middle::ty::{self, FieldDef};
|
||||
use rustc_session::declare_lint_pass;
|
||||
use rustc_span::sym;
|
||||
|
||||
@ -85,7 +85,7 @@ fn is_union_with_two_non_zst_fields<'tcx>(cx: &LateContext<'tcx>, item: &Item<'t
|
||||
}
|
||||
}
|
||||
|
||||
fn is_zst<'tcx>(cx: &LateContext<'tcx>, field: &FieldDef, args: &'tcx List<GenericArg<'tcx>>) -> bool {
|
||||
fn is_zst<'tcx>(cx: &LateContext<'tcx>, field: &FieldDef, args: ty::GenericArgsRef<'tcx>) -> bool {
|
||||
let ty = field.ty(cx.tcx, args);
|
||||
if let Ok(layout) = cx.layout_of(ty) {
|
||||
layout.is_zst()
|
||||
|
@ -13,7 +13,7 @@ use rustc_infer::infer::TyCtxtInferExt;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::mir::{Rvalue, StatementKind};
|
||||
use rustc_middle::ty::{
|
||||
self, ClauseKind, EarlyBinder, FnSig, GenericArg, GenericArgKind, List, ParamTy, ProjectionPredicate, Ty,
|
||||
self, ClauseKind, EarlyBinder, FnSig, GenericArg, GenericArgKind, ParamTy, ProjectionPredicate, Ty,
|
||||
};
|
||||
use rustc_session::impl_lint_pass;
|
||||
use rustc_span::symbol::sym;
|
||||
@ -161,7 +161,7 @@ fn needless_borrow_count<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
possible_borrowers: &mut Vec<(LocalDefId, PossibleBorrowerMap<'tcx, 'tcx>)>,
|
||||
fn_id: DefId,
|
||||
callee_args: &'tcx List<GenericArg<'tcx>>,
|
||||
callee_args: ty::GenericArgsRef<'tcx>,
|
||||
arg_index: usize,
|
||||
param_ty: ParamTy,
|
||||
mut expr: &Expr<'tcx>,
|
||||
|
@ -19,7 +19,7 @@ use rustc_middle::traits::EvaluationResult;
|
||||
use rustc_middle::ty::layout::ValidityRequirement;
|
||||
use rustc_middle::ty::{
|
||||
self, AdtDef, AliasTy, AssocKind, Binder, BoundRegion, FnSig, GenericArg, GenericArgKind, GenericArgsRef,
|
||||
GenericParamDefKind, IntTy, List, ParamEnv, Region, RegionKind, ToPredicate, TraitRef, Ty, TyCtxt,
|
||||
GenericParamDefKind, IntTy, ParamEnv, Region, RegionKind, ToPredicate, TraitRef, Ty, TyCtxt,
|
||||
TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor, UintTy, VariantDef, VariantDiscr,
|
||||
};
|
||||
use rustc_span::symbol::Ident;
|
||||
@ -961,7 +961,11 @@ pub struct AdtVariantInfo {
|
||||
|
||||
impl AdtVariantInfo {
|
||||
/// Returns ADT variants ordered by size
|
||||
pub fn new<'tcx>(cx: &LateContext<'tcx>, adt: AdtDef<'tcx>, subst: &'tcx List<GenericArg<'tcx>>) -> Vec<Self> {
|
||||
pub fn new<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
adt: AdtDef<'tcx>,
|
||||
subst: GenericArgsRef<'tcx>
|
||||
) -> Vec<Self> {
|
||||
let mut variants_size = adt
|
||||
.variants()
|
||||
.iter()
|
||||
|
Loading…
Reference in New Issue
Block a user