Skip to content

Commit 2ce2d2d

Browse files
peterthejohnstonCQ Bot
authored and
CQ Bot
committed
[netstack3] Remove workaround for associated type bounds
Now that associated type bounds are stabilized in rustc (see rust-lang/rust#122055), we can remove the workaround used in the IP crate to put filtering constraints on the device ID type. Change-Id: I80a9d6ce9553ff64f5f7a209dccb26d667a1753b Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1055952 Fuchsia-Auto-Submit: Peter Johnston <[email protected]> Reviewed-by: Bruno Dal Bo <[email protected]> Commit-Queue: Auto-Submit <[email protected]>
1 parent 9e4a3af commit 2ce2d2d

File tree

1 file changed

+10
-24
lines changed
  • src/connectivity/network/netstack3/core/ip/src

1 file changed

+10
-24
lines changed

src/connectivity/network/netstack3/core/ip/src/base.rs

+10-24
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ pub trait IpLayerIngressContext<
974974
I: IpLayerIpExt + IcmpHandlerIpExt,
975975
BC: IpLayerBindingsContext<I, Self::DeviceId>,
976976
>:
977-
IpTransportDispatchContext<I, BC, DeviceId = Self::DeviceId_>
977+
IpTransportDispatchContext<I, BC, DeviceId: filter::InterfaceProperties<BC::DeviceClass>>
978978
+ IpDeviceStateContext<I, BC>
979979
+ IpDeviceSendContext<I, BC>
980980
+ IcmpErrorHandler<I, BC>
@@ -983,57 +983,43 @@ pub trait IpLayerIngressContext<
983983
+ FilterHandlerProvider<I, BC>
984984
+ RawIpSocketHandler<I, BC>
985985
{
986-
// This is working around the fact that currently, where clauses are only
987-
// elaborated for supertraits, and not, for example, bounds on associated types
988-
// as we have here.
989-
//
990-
// See https://github.com/rust-lang/rust/issues/20671#issuecomment-1905186183
991-
// for more discussion.
992-
type DeviceId_: filter::InterfaceProperties<BC::DeviceClass> + Debug;
993986
}
994987

995988
impl<
996989
I: IpLayerIpExt + IcmpHandlerIpExt,
997990
BC: IpLayerBindingsContext<I, CC::DeviceId>,
998-
CC: IpTransportDispatchContext<I, BC>
999-
+ IpDeviceStateContext<I, BC>
991+
CC: IpTransportDispatchContext<
992+
I,
993+
BC,
994+
DeviceId: filter::InterfaceProperties<BC::DeviceClass>,
995+
> + IpDeviceStateContext<I, BC>
1000996
+ IpDeviceSendContext<I, BC>
1001997
+ IcmpErrorHandler<I, BC>
1002998
+ IpLayerContext<I, BC>
1003999
+ FragmentHandler<I, BC>
10041000
+ FilterHandlerProvider<I, BC>
10051001
+ RawIpSocketHandler<I, BC>,
10061002
> IpLayerIngressContext<I, BC> for CC
1007-
where
1008-
Self::DeviceId: filter::InterfaceProperties<BC::DeviceClass>,
10091003
{
1010-
type DeviceId_ = Self::DeviceId;
10111004
}
10121005

10131006
/// A marker trait for all the contexts required for IP egress.
10141007
pub(crate) trait IpLayerEgressContext<I, BC>:
1015-
IpDeviceSendContext<I, BC, DeviceId = Self::DeviceId_> + FilterHandlerProvider<I, BC>
1008+
IpDeviceSendContext<I, BC, DeviceId: filter::InterfaceProperties<BC::DeviceClass>>
1009+
+ FilterHandlerProvider<I, BC>
10161010
where
10171011
I: IpLayerIpExt,
10181012
BC: FilterBindingsContext,
10191013
{
1020-
// This is working around the fact that currently, where clauses are only
1021-
// elaborated for supertraits, and not, for example, bounds on associated types
1022-
// as we have here.
1023-
//
1024-
// See https://github.com/rust-lang/rust/issues/20671#issuecomment-1905186183
1025-
// for more discussion.
1026-
type DeviceId_: filter::InterfaceProperties<BC::DeviceClass> + StrongDeviceIdentifier + Debug;
10271014
}
10281015

10291016
impl<I, BC, CC> IpLayerEgressContext<I, BC> for CC
10301017
where
10311018
I: IpLayerIpExt,
10321019
BC: FilterBindingsContext,
1033-
CC: IpDeviceSendContext<I, BC> + FilterHandlerProvider<I, BC>,
1034-
Self::DeviceId: filter::InterfaceProperties<BC::DeviceClass>,
1020+
CC: IpDeviceSendContext<I, BC, DeviceId: filter::InterfaceProperties<BC::DeviceClass>>
1021+
+ FilterHandlerProvider<I, BC>,
10351022
{
1036-
type DeviceId_ = Self::DeviceId;
10371023
}
10381024

10391025
/// A builder for IPv4 state.

0 commit comments

Comments
 (0)