mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Invert IgnoreRegions
to CheckRegions
This commit is contained in:
parent
f08b517597
commit
31ae7c46bd
@ -6,7 +6,7 @@ use rustc_errors::{struct_span_err, ErrorGuaranteed};
|
|||||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||||
use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
|
use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
|
||||||
use rustc_middle::ty::subst::SubstsRef;
|
use rustc_middle::ty::subst::SubstsRef;
|
||||||
use rustc_middle::ty::util::IgnoreRegions;
|
use rustc_middle::ty::util::CheckRegions;
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
|
|||||||
self_type_did: DefId,
|
self_type_did: DefId,
|
||||||
adt_to_impl_substs: SubstsRef<'tcx>,
|
adt_to_impl_substs: SubstsRef<'tcx>,
|
||||||
) -> Result<(), ErrorGuaranteed> {
|
) -> Result<(), ErrorGuaranteed> {
|
||||||
let Err(arg) = tcx.uses_unique_generic_params(adt_to_impl_substs, IgnoreRegions::No) else {
|
let Err(arg) = tcx.uses_unique_generic_params(adt_to_impl_substs, CheckRegions::OnlyEarlyBound) else {
|
||||||
return Ok(())
|
return Ok(())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use rustc_errors::{struct_span_err, DelayDm};
|
|||||||
use rustc_errors::{Diagnostic, ErrorGuaranteed};
|
use rustc_errors::{Diagnostic, ErrorGuaranteed};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_middle::ty::subst::InternalSubsts;
|
use rustc_middle::ty::subst::InternalSubsts;
|
||||||
use rustc_middle::ty::util::IgnoreRegions;
|
use rustc_middle::ty::util::CheckRegions;
|
||||||
use rustc_middle::ty::{
|
use rustc_middle::ty::{
|
||||||
self, AliasKind, ImplPolarity, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
|
self, AliasKind, ImplPolarity, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
|
||||||
TypeVisitor,
|
TypeVisitor,
|
||||||
@ -507,7 +507,7 @@ fn lint_auto_trait_impl<'tcx>(
|
|||||||
// Impls which completely cover a given root type are fine as they
|
// Impls which completely cover a given root type are fine as they
|
||||||
// disable auto impls entirely. So only lint if the substs
|
// disable auto impls entirely. So only lint if the substs
|
||||||
// are not a permutation of the identity substs.
|
// are not a permutation of the identity substs.
|
||||||
let Err(arg) = tcx.uses_unique_generic_params(substs, IgnoreRegions::Yes) else {
|
let Err(arg) = tcx.uses_unique_generic_params(substs, CheckRegions::No) else {
|
||||||
// ok
|
// ok
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -34,9 +34,9 @@ pub struct Discr<'tcx> {
|
|||||||
|
|
||||||
/// Used as an input to [`TyCtxt::uses_unique_generic_params`].
|
/// Used as an input to [`TyCtxt::uses_unique_generic_params`].
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||||
pub enum IgnoreRegions {
|
pub enum CheckRegions {
|
||||||
Yes,
|
|
||||||
No,
|
No,
|
||||||
|
OnlyEarlyBound,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug)]
|
#[derive(Copy, Clone, Debug)]
|
||||||
@ -468,13 +468,13 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||||||
pub fn uses_unique_generic_params(
|
pub fn uses_unique_generic_params(
|
||||||
self,
|
self,
|
||||||
substs: SubstsRef<'tcx>,
|
substs: SubstsRef<'tcx>,
|
||||||
ignore_regions: IgnoreRegions,
|
ignore_regions: CheckRegions,
|
||||||
) -> Result<(), NotUniqueParam<'tcx>> {
|
) -> Result<(), NotUniqueParam<'tcx>> {
|
||||||
let mut seen = GrowableBitSet::default();
|
let mut seen = GrowableBitSet::default();
|
||||||
for arg in substs {
|
for arg in substs {
|
||||||
match arg.unpack() {
|
match arg.unpack() {
|
||||||
GenericArgKind::Lifetime(lt) => {
|
GenericArgKind::Lifetime(lt) => {
|
||||||
if ignore_regions == IgnoreRegions::No {
|
if ignore_regions == CheckRegions::OnlyEarlyBound {
|
||||||
let ty::ReEarlyBound(p) = lt.kind() else {
|
let ty::ReEarlyBound(p) = lt.kind() else {
|
||||||
return Err(NotUniqueParam::NotParam(lt.into()))
|
return Err(NotUniqueParam::NotParam(lt.into()))
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user