These variants occur rarely but inflate the whole enum for the other variants, leaving a lot of wasted space. In total this reduces `ty::sty` from 160 bytes to 96 (on a 64-bit platform).
After this, `ty_struct` and `ty_enum` are the largest variants, with the 80-byte `substs` being the major contributor.
Previously, any library of the pattern `lib<name>-<hash>-<version>.so` was
>considered a candidate (rightly so) for loading a crate. Sets are generated for
each unique `<hash>`, and then from these sets a candidate is selected. If a set
contained more than one element, then it immediately generated an error saying
that multiple copies of the same dylib were found.
This is incorrect because each candidate needs to be validated to actually
contain a rust library (valid metadata). This commit alters the logic to filter
each set of candidates for a hash to only libraries which are actually rust
libraries. This means that if multiple false positives are found with the right
name pattern, they're all ignored.
Closes#13010
This fixes struct passing abi on x86 ffi: Structs are now passed
indirectly with byval attribute (as clang does).
Empty structs are also explicitly ignored rather than directly passed.
Fixes#5744Fixes#11198Fixes#11343
This reduces the size of sty from 112 to 96; like with the ty_trait
variant, this variant of sty occurs rarely (~1%) so the benefits are
large and the costs small.
This reduces ty::sty from 160 bytes to just 112, and some measurements
eddyb made suggest that the ty_trait variant occurs very
rarely (e.g. ~1% of all sty instances) hence this will result in a large
memory saving, and the cost of the indirection is unlikely to be an
issue.
This adds lots of docs to the atomics module. Two of the examples
are using the future atomics API (relying on `Share`) and are ignored temporarily.
I discovered a bug in the way AtomicBool's fetch_nand method is
implemented and fixed it by using the correct value for `true`.
I also fixed the implementation of AcqRel fences (it was only doing
a release barrier), and made a "relaxed" fence a failure.
possible by also calling `clone_from` on it.
In general, `Clone` implementors that overwrite `clone_from`
should try to to use it recursivly for substructures.
A major discoverability issue with rustdoc is that all crates have their
documentation built in isolation, so it's difficult when looking at the
documentation for libstd to learn that there's a libcollections crate with a
HashMap in it.
This commit moves rustdoc a little closer to improving the multiple crate
experience. This unifies all search indexes for all crates into one file so all
pages share the same search index. This allows searching to work across crates
in the same documentation directory (as the standard distribution is currently
built).
This strategy involves updating a shared file amongst many rustdoc processes, so
I implemented a simple file locking API for handling synchronization for updates
to the shared files.
cc #12554
Remove the linker_private and linker_private_weak linkage attributes,
they have been superseded by private and private_weak and have been
removed in upstream LLVM in commit r203866.
It appears that the --as-needed flag to linkers will not pull in a dynamic library unless it satisfies a non weak undefined symbol. The linkage1 test was creating a dynamic library where it was only used for a weak-symbol as part of an executable, so the dynamic library was getting discarded.
This commit adds another symbol to the library which satisfies a strong undefined symbol, so the library is pulled in to resolve the weak reference.
The pretty printer constitues an enormous amount of code, there's no reason for
it to be generic. This just least to a huge amount of metadata which isn't
necessary. Instead, this change migrates the pretty printer to using a trait
object instead.
Closes#12985
This takes the time for `rustc libstd/lib.rs -Z ast-json-noexpand >
file.json` from 9.0s to 3.5s (~0.5s spent parsing etc.) and `-Z
ast-json` from 11s to 5s (~1.5s spent parsing and expanding).
This is adequate because when a function has a type that isn't caught here,
that is, it has a single argument, but it *isn't* `&mut BenchHarness`, it
errors later on with:
error: mismatched types: expected `fn(&mut test::BenchHarness)` but found
`fn(int)` (expected &-ptr but found int)
which I consider acceptable.
Closes#12997
This adds lots of docs to the atomics module. Two of the examples
are using the future atomics API and are ignored temporarily.
I discovered a bug in the way AtomicBool's fetch_nand method is
implemented and fixed it by using the correct value for `true`.
I also fixed the implementation of AcqRel fences (it was only doing
a release barrier), and made a "relaxed" fence a failure.
This PR enables the use of mutable slices in *mutable* static items. The work was started by @xales and I added a follow-up commit that moves the *immutable* restriction to the recently added `check_static`
Closes#11411