Skip to content

Cleanup cfgs in unix module#1812

Merged
Thomasdezeeuw merged 4 commits intomasterfrom
cleanup-cfgs
Jun 21, 2024
Merged

Cleanup cfgs in unix module#1812
Thomasdezeeuw merged 4 commits intomasterfrom
cleanup-cfgs

Conversation

@Thomasdezeeuw
Copy link
Collaborator

The cfg situation in the sys::unix module is messy to say the least. This series of commits aims to clean them up.

Base automatically changed from port-fuchsia to master June 21, 2024 14:10
Using the old method in src/sys/unix/selector/mod.rs we needed to define
all the targets twice, now we just do it once and set the path to the
correct selector implementation.

Note that is only possible because we increased MSRV so that it supports
the path attribute, when the code was originally written this was not a
thing.
The old macro was a mess of not(any(targets...)), means that when
porting to a new target you always used the stateless implementation
even if you didn't know about it.

This fixes gotcha that and moves the logic of what kind of IoSourceState
to use to the selector implemtnation files, which means that we don't
have to worry about it when porting to a new platform.
Initially I though this would give a nice error message saying that
platform X wasn't supported. But due to the amount of other errors the
error message is still not great.

So, to make porting easier in the future, just remove this and we'll get
a `fds` not defined error.
Means we can remove the cfg_io_source! macro usage as that is already
done in the selector implementation file.
@Thomasdezeeuw Thomasdezeeuw merged commit 6c710f1 into master Jun 21, 2024
@Thomasdezeeuw Thomasdezeeuw deleted the cleanup-cfgs branch June 21, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants