Also remove comments that reference the unique_type_id HEAP_VEC_BOX
metadata, which was removed in 3e62637 and the unique_type_id GC_BOX
metadata, which was removed in 8a91d33.
Since the hashmap and its hasher are implemented in different crates, we
currently can't benefit from inlining, which means that especially for
small, fixed size keys, there is a huge overhead in hash calculations,
because the compiler can't apply optimizations that only apply for these
keys.
Fixes the brainfuck benchmark in #24014.
E.g. if `foo.rs` looks like
#![feature(test)]
extern crate test;
#[bench]
fn bar(b: &mut test::Bencher) {
b.iter(|| {
1
})
}
#[test]
fn baz() {}
#[bench]
fn qux(b: &mut test::Bencher) {
b.iter(|| {
panic!()
})
}
Then
$ rustc --test foo.rs
$ ./foo
running 3 tests
test baz ... ok
test qux ... FAILED
test bar ... ok
failures:
---- qux stdout ----
thread 'qux' panicked at 'explicit panic', bench.rs:17
failures:
qux
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured
$ ./foo --bench ba
running 2 tests
test baz ... ignored
test bar ... bench: 97 ns/iter (+/- 74)
test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured
In particular, the two benchmark are being run as tests in the default
mode.
This helps for the main distribution, since benchmarks are only run with
`PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
and helps for code-coverage tools: benchmarks are run and so don't count
as dead code.
Fixes#15842.
Since the hashmap and its hasher are implemented in different crates, we
currently can't benefit from inlining, which means that especially for
small, fixed size keys, there is a huge overhead in hash calculations,
because the compiler can't apply optimizations that only apply for these
keys.
Fixes the brainfuck benchmark in #24014.
typeck: Make sure casts from other types to fat pointers are illegal
Fixes ICEs where non-fat pointers and scalars are cast to fat pointers,
Fixes#21397Fixes#22955Fixes#23237Fixes#24100
Adds an `attrs` field to `FieldInfo` which lets one check the attributes on
a field whilst expanding.
This lets deriving plugins be more robust, for example providing the ability to
"ignore" a field for the purpose of deriving, or perhaps handle the field a
different way.
r? @huonw
E.g. if `foo.rs` looks like
#![feature(test)]
extern crate test;
#[bench]
fn bar(b: &mut test::Bencher) {
b.iter(|| {
1
})
}
#[test]
fn baz() {}
#[bench]
fn qux(b: &mut test::Bencher) {
b.iter(|| {
panic!()
})
}
Then
$ rustc --test foo.rs
$ ./foo
running 3 tests
test baz ... ok
test qux ... FAILED
test bar ... ok
failures:
---- qux stdout ----
thread 'qux' panicked at 'explicit panic', bench.rs:17
failures:
qux
test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured
$ ./foo --bench ba
running 2 tests
test baz ... ignored
test bar ... bench: 97 ns/iter (+/- 74)
test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured
In particular, the two benchmark are being run as tests in the default
mode.
This helps for the main distribution, since benchmarks are only run with
`PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
and helps for code-coverage tools: benchmarks are run and so don't count
as dead code.
Fixes#15842.
collections: Implement String::drain(range) according to RFC 574
`.drain(range)` is unstable and under feature(collections_drain).
This adds a safe way to remove any range of a String as efficiently as
possible.
As noted in the code, this drain iterator has none of the memory safety
issues of the vector version.
RFC tracking issue is #23055
Apparently implementations are allowed to return EDEADLK instead of blocking
forever, in which case this can lead to unsafety in the `RwLock` primitive
exposed by the standard library. A debug-build of the standard library would
have caught this error (due to the debug assert), but we don't ship debug
builds right now.
This commit adds explicit checks for the EDEADLK error code and triggers a panic
to ensure the call does not succeed.
Closes#25012
Ensures that the same error type is propagated throughout. Unnecessary leakage
of the internals is prevented through the usage of stability attributes.
Closes#24748
Ensures that the same error type is propagated throughout. Unnecessary leakage
of the internals is prevented through the usage of stability attributes.
Closes#24748
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.
One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.
Closes#24791
[breaking-change]
`.drain(range)` is unstable and under feature(collections_drain).
This adds a safe way to remove any range of a String as efficiently as
possible.
As noted in the code, this drain iterator has none of the memory safety
issues of the vector version.
RFC tracking issue is #23055
These implementations were intended to be unstable, but currently the stability
attributes cannot handle a stable trait with an unstable `impl` block. This
commit also audits the rest of the standard library for explicitly-`#[unstable]`
impl blocks. No others were removed but some annotations were changed to
`#[stable]` as they're defacto stable anyway.
One particularly interesting `impl` marked `#[stable]` as part of this commit
is the `Add<&[T]>` impl for `Vec<T>`, which uses `push_all` and implicitly
clones all elements of the vector provided.
Closes#24791
- unbreak the build under openbsd
- while here, apply same modification to dragonfly, freebsd, ios (pid_t
imported, but not used in raw.rs)
r? @alexcrichton
cc @wg @mneumann @vhbit
Hi! While researching stuff for the reference and the grammar, I came across a few mentions of using the `priv` keyword that was removed in 0.11.0 (#13547, #8122, rust-lang/rfcs#26, [RFC 0026](https://github.com/rust-lang/rfcs/blob/master/text/0026-remove-priv.md)).
One occurrence is a mention in the reference, a few are in comments, and a few are marking test functions. I left the test that makes sure you can't name an ident `priv` since it's still a reserved keyword. I did a little grepping around for `priv `, priv in backticks, `Private` etc and I think the remaining instances are fine, but if anyone knows anywhere in particular I should check for any other lingering mentions of `priv`, please let me know and I would be happy to! 🍂🌊