Currently, Cargo.toml specifies Apache-2.0 OR MIT, but LICENSE.txt
describes MIT OR NCSA. compiler-builtins is derived from LLVM's
compiler-rt. LICENSE.txt correctly reflects the state of compiler-rt
prior to relicensing on 2019-01-19, during which time software was
available for use under either MIT or the University of Illinois NCSA
license. After relicensing, however, compiler-rt is available for use
only under Apache-2.0 with the LLVM exception; this is not reflected
anywhere in the repository.
Update the SPDX license identifier to `MIT AND Apache-2.0 WITH
LLVM-exception AND (MIT OR Apache-2.0)`. Each AND portion covers
something specific:
* Apache-2.0 WITH LLVM-exception: this covers work that is derived from
the LLVM repository since after the LLVM relicensing.
* MIT: This covers work that is derived from LLVM before the LLVM
relicensing (under MIT OR NCSA), as well as the vendored `libm`
components.
* MIT AND Apache-2.0: This ensures that any contributions to this
repository, in addition to meeting the above required licenses, is
also released for use under the Rust-standard Apache-2.0 with no LLVM
exception.
See also the parallel license update in rust-lang/libm [1].
Fixes: https://github.com/rust-lang/compiler-builtins/issues/307
Closes: https://github.com/rust-lang/compiler-builtins/pull/511
Link: https://rust-lang.zulipchat.com/#narrow/channel/335408-foundation/topic/Request.20for.20legal.20team.20input.20on.20crate.20licensing
Link: https://github.com/rust-lang/libm/pull/317 [1]
Currently both Cargo.toml and the license files indicate that this
library may be used under either MIT or Apache-2.0. However, this is not
accurate; since portions of this library were derived from musl libc,
which is available under the MIT license, this terms of use for this
library must also include use under the MIT license. That is, it is not
correct that this library may be used under only the Apache-2.0 license.
Update the SPDX license identifier to `MIT OR (MIT AND Apache-2.0)` to
indicate that use must include the MIT license, but to clarify that
contributions are made under `MIT OR Apache-2.0`. This is compatible
with the current state of this repository since it has always contained
both license files, and the `Cargo.toml` license field has indicated
`MIT OR Apache-2.0` since it was added.
In accordance with the above, replace the two license files with a
combined LICENSE.txt that makes these terms clear and gives attribution
to works from which this library is derived.
Fixes: https://github.com/rust-lang/libm/issues/215
Link: https://rust-lang.zulipchat.com/#narrow/channel/335408-foundation/topic/Request.20for.20legal.20team.20input.20on.20crate.20licensing
Link: https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
Having `#![deny(warnings)]` for the entire crate is a bit of a
development annoyance. We already run CI with `RUSTFLAGS=-Dwarnings` so
there isn't much of a reason to check this locally. Thus, remove the
attribute.
Additionally, sort the clippy allows.
We will have more test features in the near future, and it would be nice
for them all to have a common `test-` prefix. Reverse the existing
feature so this is the case.
`to_bits` and `from_bits` are builtin methods on float types. Rename
`repr` to `to_bits` and `from_repr` to `from_bits` so this is consistent
with usage that doesn't go through the trait.
There isn't any reason for this feature to be exposed or part of the
build script. Move it to a separate crate.
We will also want more tests that require some support functions; this
will create a place for them.
<https://github.com/rust-lang/rust/issues/126984> has been resolved.
Remove the workaround that was introduced to suppress it.
This reverts commit 254edbcad4cfd6a8af32e3297c1037d7984c3c49.
Float division currently has a separate `div32` and `div64` for `f32`
and `f64`, respectively. Combine these to make use of generics. This
will make it easier to support `f128` division, and reduces a lot of
redundant code.
This includes a simplification of division tests.
Add some bounds to integer types that allow our function trait bounds to
be slightly less verbose. Also clarify documentation and remove a
redundant operation.