refactor(rustc_middle): Substs -> GenericArg
This commit is contained in:
parent
660ef4ffe8
commit
fdb2e363d3
94 changed files with 307 additions and 307 deletions
|
|
@ -198,14 +198,14 @@ fn is_mutable_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>, tys: &mut DefIdSet)
|
|||
match *ty.kind() {
|
||||
// primitive types are never mutable
|
||||
ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str => false,
|
||||
ty::Adt(adt, substs) => {
|
||||
ty::Adt(adt, args) => {
|
||||
tys.insert(adt.did()) && !ty.is_freeze(cx.tcx, cx.param_env)
|
||||
|| KNOWN_WRAPPER_TYS
|
||||
.iter()
|
||||
.any(|&sym| cx.tcx.is_diagnostic_item(sym, adt.did()))
|
||||
&& substs.types().any(|ty| is_mutable_ty(cx, ty, tys))
|
||||
&& args.types().any(|ty| is_mutable_ty(cx, ty, tys))
|
||||
},
|
||||
ty::Tuple(substs) => substs.iter().any(|ty| is_mutable_ty(cx, ty, tys)),
|
||||
ty::Tuple(args) => args.iter().any(|ty| is_mutable_ty(cx, ty, tys)),
|
||||
ty::Array(ty, _) | ty::Slice(ty) => is_mutable_ty(cx, ty, tys),
|
||||
ty::RawPtr(ty::TypeAndMut { ty, mutbl }) | ty::Ref(_, ty, mutbl) => {
|
||||
mutbl == hir::Mutability::Mut || is_mutable_ty(cx, ty, tys)
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ fn result_err_ty<'tcx>(
|
|||
) -> Option<(&'tcx hir::Ty<'tcx>, Ty<'tcx>)> {
|
||||
if !in_external_macro(cx.sess(), item_span)
|
||||
&& let hir::FnRetTy::Return(hir_ty) = decl.output
|
||||
&& let ty = cx.tcx.erase_late_bound_regions(cx.tcx.fn_sig(id).subst_identity().output())
|
||||
&& let ty = cx.tcx.erase_late_bound_regions(cx.tcx.fn_sig(id).instantiate_identity().output())
|
||||
&& is_type_diagnostic_item(cx, ty, sym::Result)
|
||||
&& let ty::Adt(_, substs) = ty.kind()
|
||||
&& let ty::Adt(_, args) = ty.kind()
|
||||
{
|
||||
let err_ty = substs.type_at(1);
|
||||
let err_ty = args.type_at(1);
|
||||
Some((hir_ty, err_ty))
|
||||
} else {
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue