Commit Graph

866 Commits

Author SHA1 Message Date
Mazdak Farrokhzad aba84894d1 Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung
Change untagged_unions to not allow union fields with drop

This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass.

Change untagged_unions to not allow union fields with drop

Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar).

The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature.

Tracking issue: https://github.com/rust-lang/rust/issues/55149
2019-10-21 22:00:45 +02:00
Shotaro Yamada 23cb1d520b Avoid realloc in CString::new 2019-10-18 16:10:13 +09:00
Oliver Scherer 2fc257ca81 Prefer ManuallyDrop::{take,new} over ptr::{read,write} 2019-10-11 10:43:54 +02:00
Jon Gjengset 45aca119a6 Stabilize mem::take (mem_take)
Tracking issue: https://github.com/rust-lang/rust/issues/61129
2019-10-08 18:04:18 -04:00
Tyler Mandry f7ee31e3d7 Rollup merge of #61879 - stjepang:stabilize-todo, r=withoutboats
Stabilize todo macro

The `todo!` macro is just another name for `unimplemented!`.

Tracking issue: https://github.com/rust-lang/rust/issues/59277

This PR needs a FCP to merge.

r? @withoutboats
2019-10-03 16:25:35 -07:00
Mark Rousskov f359a94849 Snap cfgs to new beta 2019-09-25 08:42:46 -04:00
bors fe6d05a8b3 Auto merge of #64154 - alexcrichton:std-backtrace, r=sfackler
std: Add a `backtrace` module

This commit adds a `backtrace` module to the standard library, as
designed in [RFC 2504]. The `Backtrace` type is intentionally very
conservative, effectively only allowing capturing it and printing it.

Additionally this commit also adds a `backtrace` method to the `Error`
trait which defaults to returning `None`, as specified in [RFC 2504].
More information about the design here can be found in [RFC 2504] and in
the [tracking issue].

Implementation-wise this is all based on the `backtrace` crate and very
closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise
it's pretty standard in how it handles everything internally.

[RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md
[tracking issue]: https://github.com/rust-lang/rust/issues/53487

cc #53487
2019-09-11 14:46:08 +00:00
Alex Crichton 34662c6961 std: Add a backtrace module
This commit adds a `backtrace` module to the standard library, as
designed in [RFC 2504]. The `Backtrace` type is intentionally very
conservative, effectively only allowing capturing it and printing it.

Additionally this commit also adds a `backtrace` method to the `Error`
trait which defaults to returning `None`, as specified in [RFC 2504].
More information about the design here can be found in [RFC 2504] and in
the [tracking issue].

Implementation-wise this is all based on the `backtrace` crate and very
closely mirrors the `backtrace::Backtrace` type on crates.io. Otherwise
it's pretty standard in how it handles everything internally.

[RFC 2504]: https://github.com/rust-lang/rfcs/blob/master/text/2504-fix-error.md
[tracking issue]: https://github.com/rust-lang/rust/issues/53487

cc #53487
2019-09-09 08:20:34 -07:00
Mazdak Farrokhzad 0356813b27 Dont use gate bind_by_move_pattern_guards internally. 2019-09-08 01:27:10 +02:00
Vitaly _Vi Shukela 843fba3ed1 Stabilize checked_duration_since for 1.39.0
Resolves #58402.
2019-09-05 01:58:37 +03:00
Mazdak Farrokhzad cd21715c34 Rollup merge of #63613 - petrochenkov:stdhyg, r=alexcrichton
Hygienize use of built-in macros in the standard library

Same as https://github.com/rust-lang/rust/pull/61629, but for built-in macros.

Closes https://github.com/rust-lang/rust/issues/48781
r? @alexcrichton
2019-08-16 18:22:30 +02:00
Simon Sapin 59a340963f Add the Layout of the failed allocation to TryReserveError::AllocError
… and add a separately-unstable field to force non-exhaustive matching
(`#[non_exhaustive]` is no implemented yet on enum variants)
so that we have the option to later expose the allocator’s error value.

CC https://github.com/rust-lang/wg-allocators/issues/23
2019-08-16 18:08:37 +02:00
Vadim Petrochenkov 263e3c5950 Remove __rust_unstable_column 2019-08-15 22:58:57 +03:00
Mark Rousskov 2601c86487 Handle cfg(bootstrap) throughout 2019-08-14 05:39:53 -04:00
Mazdak Farrokhzad 6743ad6726 Rollup merge of #63350 - iluuu1994:use-associated-type-bounds, r=Centril
Use associated_type_bounds where applicable - closes #61738
2019-08-10 08:13:19 +02:00
Vadim Petrochenkov cbcc7dd182 Give built-in macros stable addresses in the standard library 2019-08-10 00:05:37 +03:00
Ilija Tovilo 3d231accee Add missing #![feature(associated_type_bounds)] 2019-08-09 11:19:45 +02:00
Lzu Tao 90fa7901b9 Postpone deprecating try! until 1.39.0 2019-08-09 02:29:44 +00:00
BO41 fd7ac6b17e Deprecate try! macro
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
Co-Authored-By: Oliver Middleton <olliemail27@gmail.com>
2019-08-09 02:29:44 +00:00
Vadim Petrochenkov 73dae4eaf9 Remove derives Encodable/Decodable and unstabilize attribute #[bench] 2019-07-31 21:27:59 +03:00
Vadim Petrochenkov 676d282dd3 Deny unused_lifetimes through rustbuild 2019-07-28 18:47:02 +03:00
Vadim Petrochenkov 434152157f Remove lint annotations in specific crates that are already enforced by rustbuild
Remove some random unnecessary lint `allow`s
2019-07-28 18:46:24 +03:00
Vadim Petrochenkov 8eaf17bca2 Introduce built-in macros through libcore 2019-07-26 13:09:54 +03:00
Nathan e1e0df8a49 Remove uses of mem::uninitialized in std::sys::cloudabi
Usages still appear in cloudabi tests and in the reentrant mutex implementation
2019-07-22 20:42:08 -04:00
Ralf Jung 13ed0cf9e8 do not use mem::uninitialized in std::io 2019-07-19 09:45:38 +02:00
Ralf Jung 33452b0587 warn about deprecated-in-future in most of libstd 2019-07-19 09:35:32 +02:00
gnzlbg 77c14a5c5f Update the stdarch submodule 2019-07-15 14:05:28 +02:00
Chris Gregory b0c199a969 Enable mem_take feature in relevant crates 2019-07-01 20:21:53 -07:00
Mazdak Farrokhzad a99a7b7f35 Remove FnBox. 2019-06-22 06:59:27 +02:00
Stjepan Glavina 8e3b9d2118 Stabilize todo macro 2019-06-16 01:24:37 +02:00
Alex Crichton 8eb7f36a3b std: Remove internal definitions of cfg_if! macro
This is duplicated in a few locations throughout the sysroot to work
around issues with not exporting a macro in libstd but still wanting it
available to sysroot crates to define blocks. Nowadays though we can
simply depend on the `cfg-if` crate on crates.io, allowing us to use it
from there!
2019-06-10 10:58:44 -07:00
Jethro Beekman a3d5e34903 Fix cfg(test) build for x86_64-fortanix-unknown-sgx 2019-06-03 13:06:35 -07:00
Ralf Jung b7afe777f7 stabilize core parts of MaybeUninit and deprecate mem::uninitialized in the future
Also expand the documentation a bit
2019-05-20 10:44:02 +02:00
Jethro Beekman adb998fe21 Fix cfg(test) build on SGX 2019-05-09 15:00:06 -07:00
Yuki OKUSHI 028e78d93a Stabilize and re-export core::array 2019-05-09 12:50:55 +09:00
Christopher Serr cf9d6672b7 Remove feature gates from std and tests 2019-04-26 12:33:42 +02:00
Mazdak Farrokhzad 3fffcd3314 Rollup merge of #60185 - NieDzejkob:int-error-kind-reexport, r=rkruppe
Reexport IntErrorKind in std

Currently `IntErrorKind` can only be found in `core`. @Centril confirmed on Discord that this is unintentional (should I r? him in this situation?).

Should there be a test for this? As far as this *specific* situation goes, I don't think so, I'll risk it and say that there's no way this regresses. However, it might be a good idea to have some tool detect public items in `core` that are not reexported in `std`. Does this belong in tidy, or should that be a separate tool? Is there some rustc-specific *linter*? Unless that's entirely a dumb idea, this should probably get an issue.

Note: My local build hasn't finished yet, but it's well past the point where I would expect problems.
2019-04-25 03:05:25 +02:00
Taylor Cramer 3f966dcd53 Stabilize futures_api 2019-04-23 16:13:53 -07:00
Jakub Kądziołka 7af0fccc88 Reexport IntErrorKind in std 2019-04-23 00:15:43 +02:00
Ralf Jung 8ef7ca1302 make lint levels more consistent 2019-04-14 10:16:23 +02:00
Simon Sapin fc928a18ba Stabilize the alloc crate.
This implements RFC 2480:

* https://github.com/rust-lang/rfcs/pull/2480
* https://github.com/rust-lang/rfcs/blob/master/text/2480-liballoc.md

Closes https://github.com/rust-lang/rust/issues/27783
2019-04-12 20:07:30 +02:00
Mazdak Farrokhzad 379c380a60 libstd: deny(elided_lifetimes_in_paths) 2019-03-31 12:56:51 +02:00
Aleksey Kladov 9d408d972f Add todo!() macro
The use-case of `todo!()` macro is to be a much easier to type
alternative to `unimplemented!()` macro.
2019-03-18 19:27:31 +03:00
kennytm 6241fb55ba Rollup merge of #59152 - smmalis37:range_contains, r=SimonSapin
Stabilize Range*::contains.

Closes https://github.com/rust-lang/rust/issues/32311. There's also a bit of rustfmt on range.rs thrown in for good measure (I forgot to turn off format-on-save in VSCode).
2019-03-16 22:40:23 +08:00
bors 70d1150478 Auto merge of #58710 - EdorianDark:master, r=sfackler
Add clamp for ranges. Implements #44095

Ready for merge
2019-03-15 06:23:21 +00:00
Steven Malis 266ca31f74 Stabilize Range*::contains. 2019-03-12 21:00:37 -07:00
Dirk Leifeld 6041ec3b78 add feature clamp 2019-03-09 20:10:48 +01:00
Jethro Beekman c0e8cf9410 Use the correct stderr when testing libstd 2019-02-28 19:09:17 -08:00
Taiki Endo 90dbf59b92 Fix some imports and paths 2019-02-28 04:06:17 +09:00
Taiki Endo 2c783c3543 Revert removed #![feature(nll)] 2019-02-28 04:06:16 +09:00