Age | Commit message (Collapse) | Author |
|
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
|
|
* enabled as much functionality and defines that match
updated libc definitions for haiku
|
|
|
|
Using features reduces build time and size for consumer crates. By
default all features are enabled.
|
|
This saves code in several separate places that need to do this
separately. At the same time, remove a few uses of mem::transmute that
were implementing TryFrom or similar functionality.
Issue #373
|
|
|
|
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.
Fixes #1182
|
|
For many of Nix's consumers it be convenient to easily convert a Nix
error into a std::io::Error. That's currently not possible because of
the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have
no equivalent in std::io::Error.
However, very few of Nix's public APIs actually return those unusual
errors. So a more useful API would be for Nix's standard error type to
implement Into<std::io::Error>.
This commit makes Error a simple NewType around Errno. For most
functions it's a drop-in replacement. There are only three exceptions:
* clearenv now returns a bespoke error type. It was the only Nix
function whose error couldn't be cleanly mapped onto an Errno.
* sys::signal::signal now returns Error(Errno::ENOTSUP) instead of
Error::UnsupportedOperation when the user passes an incompatible
argument to `handler`.
* When a NixPath exceeds PATH_MAX, it will now return
Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath.
In the latter two cases there is now some abiguity about whether the
error code was generated by Nix or by the OS. But I think the ambiguity
is worth it for the sake of being able to implement Into<io::Error>.
This commit also introduces Error::Sys() as a migration aid. Previously
that as an enum variant. Now it's a function, but it will work in many
of the same contexts as the original.
Fixes #1155
|
|
|
|
Co-authored-by: Dominik Hassler <hadfl@omnios.org>
Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
|
|
|
|
|
|
|
|
ignore really is the correct things to do for these doc tests.
compile_fail should only be used for examples that demonstrate a compile
failure by design, not for stuff that only works on one platform.
|
|
The old From implementation was actually falliable, and would panic on
failure.
|
|
Replace it with mem::zeroed. It isn't perfect, but it's better than it
was.
Issue #1115
|
|
|
|
The fix for #1149 has the logic for the [cfg()] conditional inverted
so that the aliases for VMIN and VTIME are defined on targets that
are not linux-sparc64.
|
|
On sparc64, glibc defines VMIN as VEOF and VTIME as VEOL for
termios, so we need to inherit these alias definitions for
nix-rust as well.
Fixes #1149
|
|
`assert_eq!` gives more debug info when the test fails by default than
`assert!`. This should help make debugging easier.
|
|
Only two instances remain:
* For the deprecated sys::socket::CmsgSpace::new. We should probably
just remove that method.
* For sys::termios::Termios::default_uninit. This will require some
more thought.
Fixes #1096
|
|
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all
traits are supported by all types, which is why many are missing
some.
|
|
try! is not available in Rust 2018
|
|
These constants have the same value on sparc64, so need to be removed as enums
in Rust can't have multiple names for the same value.
|
|
|
|
I previously advocated for the latter syntax on stylistic grounds. But
it generates less efficient code, because it creates a new lambda
function for each usage. The optimizer does not combine them. This
change saves about 6KB of code.
|
|
|
|
|
|
|
|
|
|
|
|
.map(drop) makes it seem like there is a need to drop the type at
that point when really all you're doing is trying to erase the
type information and return an empty tuple. So do that explicitly
instead of throwing drop in there.
|
|
|
|
|
|
cc #664 (unsure if this is everything needed)
|
|
The libc_bitflags! macro was replaced with a non-recursive one supporting
only public structs. I could not figure out how to make the old macro work
with the upgrade, so I reworked part of the bitflags! macro directly to suit
our needs, much as the original recursive macro was made. There are no uses
of this macro for non-public structs, so this is not a problem for internal code.
|
|
|
|
|
|
|
|
This also removes the incorrect TCSASOFT definition as an enum type because it's
actually a bitfield.
|
|
|
|
|
|
|
|
|
|
|
|
New baud constants landed in rust-lang/libc#530, we'll use them.
|
|
|
|
Issue #514
|
|
|
|
This fixes an import that was missed in the upgrade from libc 0.1 series
to 0.2 series.
Refs https://github.com/nix-rust/nix/issues/298
|