Skip to content

Commit e0b2590

Browse files
authored
Rollup merge of #72745 - lcnr:interned-cleanup, r=petrochenkov
generalize Borrow<[T]> for Interned<'tcx, List<T>>
2 parents b714f5c + 1595577 commit e0b2590

File tree

1 file changed

+2
-48
lines changed

1 file changed

+2
-48
lines changed

src/librustc_middle/ty/context.rs

+2-48
Original file line numberDiff line numberDiff line change
@@ -1971,32 +1971,8 @@ impl<'tcx, T: Hash> Hash for Interned<'tcx, List<T>> {
19711971
}
19721972
}
19731973

1974-
impl<'tcx> Borrow<[Ty<'tcx>]> for Interned<'tcx, List<Ty<'tcx>>> {
1975-
fn borrow<'a>(&'a self) -> &'a [Ty<'tcx>] {
1976-
&self.0[..]
1977-
}
1978-
}
1979-
1980-
impl<'tcx> Borrow<[CanonicalVarInfo]> for Interned<'tcx, List<CanonicalVarInfo>> {
1981-
fn borrow(&self) -> &[CanonicalVarInfo] {
1982-
&self.0[..]
1983-
}
1984-
}
1985-
1986-
impl<'tcx> Borrow<[GenericArg<'tcx>]> for Interned<'tcx, InternalSubsts<'tcx>> {
1987-
fn borrow<'a>(&'a self) -> &'a [GenericArg<'tcx>] {
1988-
&self.0[..]
1989-
}
1990-
}
1991-
1992-
impl<'tcx> Borrow<[ProjectionKind]> for Interned<'tcx, List<ProjectionKind>> {
1993-
fn borrow(&self) -> &[ProjectionKind] {
1994-
&self.0[..]
1995-
}
1996-
}
1997-
1998-
impl<'tcx> Borrow<[PlaceElem<'tcx>]> for Interned<'tcx, List<PlaceElem<'tcx>>> {
1999-
fn borrow(&self) -> &[PlaceElem<'tcx>] {
1974+
impl<'tcx, T> Borrow<[T]> for Interned<'tcx, List<T>> {
1975+
fn borrow<'a>(&'a self) -> &'a [T] {
20001976
&self.0[..]
20011977
}
20021978
}
@@ -2007,34 +1983,12 @@ impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
20071983
}
20081984
}
20091985

2010-
impl<'tcx> Borrow<[ExistentialPredicate<'tcx>]>
2011-
for Interned<'tcx, List<ExistentialPredicate<'tcx>>>
2012-
{
2013-
fn borrow<'a>(&'a self) -> &'a [ExistentialPredicate<'tcx>] {
2014-
&self.0[..]
2015-
}
2016-
}
2017-
2018-
impl<'tcx> Borrow<[Predicate<'tcx>]> for Interned<'tcx, List<Predicate<'tcx>>> {
2019-
fn borrow<'a>(&'a self) -> &'a [Predicate<'tcx>] {
2020-
&self.0[..]
2021-
}
2022-
}
2023-
20241986
impl<'tcx> Borrow<Const<'tcx>> for Interned<'tcx, Const<'tcx>> {
20251987
fn borrow<'a>(&'a self) -> &'a Const<'tcx> {
20261988
&self.0
20271989
}
20281990
}
20291991

2030-
impl<'tcx> Borrow<[traits::ChalkEnvironmentClause<'tcx>]>
2031-
for Interned<'tcx, List<traits::ChalkEnvironmentClause<'tcx>>>
2032-
{
2033-
fn borrow<'a>(&'a self) -> &'a [traits::ChalkEnvironmentClause<'tcx>] {
2034-
&self.0[..]
2035-
}
2036-
}
2037-
20381992
impl<'tcx> Borrow<PredicateKind<'tcx>> for Interned<'tcx, PredicateKind<'tcx>> {
20391993
fn borrow<'a>(&'a self) -> &'a PredicateKind<'tcx> {
20401994
&self.0

0 commit comments

Comments
 (0)