summary refs log tree commit diff
path: root/src/libcore/cell.rs
AgeCommit message (Collapse)AuthorLines
2016-04-05Remove strange names created by lack of privacy-conscious name lookupTobias Bucher-39/+35
The fixed issue that allowed this was #12808.
2016-04-02Rollup merge of #32652 - VFLashM:refcell_ref_coercion, r=alexcrichtonManish Goregaokar-2/+8
Added missing refcell ref/refmut coercions to unsized Ref/RefMut should be coercible to unsized. This commit adds a unit test and two missing CoerceUnsized implementations.
2016-03-31added missing refcell ref/refmut coercions to unsizedВалерий Лашманов-2/+8
2016-03-28Remove `unsafe` qualifier from `RefCell::as_unsafe_cell`Tobias Bucher-6/+2
This method is no longer unsafe because the field of `UnsafeCell` is no longer public.
2016-03-07Fix some line lengthsSimon Sapin-2/+4
2016-03-07"can be built on Ref::map"… how?Simon Sapin-2/+2
Now that `std::cell::Ref::filter_map` and `RefMut::filter_map` are deprecated, using them gives a warning like: ``` script/dom/element.rs:754:9: 754:24 warning: use of deprecated item: can be built on Ref::map, #[warn(deprecated)] on by default ``` But it’s not at all obvious *how* the functionality can be built on `Ref::map`. This PR adds to the warning message a crates.io URL for a crate that does.
2016-03-01Explicitly opt out of `Sync` for `cell` and `mpsc` typesAndrew Paseltiner-0/+6
These types were already `!Sync`, but this improves error messages when they are used in contexts that require `Sync`, aligning them with conventions used with `Rc`, among others.
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-7/+4
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-01-25RefCell::borrow_mut example should demonstrate mutCorey Farwell-1/+3
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+1
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+3
2015-11-06Remove stability annotations from trait impl itemsVadim Petrochenkov-2/+0
Remove `stable` stability annotations from inherent impls
2015-10-23Unsafety -> Safety in doc headingsSteve Klabnik-2/+2
Follow https://doc.rust-lang.org/book/documentation.html#special-sections
2015-10-21Remove obsolete note about `UnsafeCell`'s fieldsAndrew Paseltiner-5/+1
2015-10-08typos: fix a grabbag of typos all over the placeCristi Cobzarenco-2/+2
2015-09-03Elide lifetimes in libcoreManish Goregaokar-7/+7
2015-08-15core: Fill out issues for unstable featuresAlex Crichton-9/+14
2015-08-12Remove all unstable deprecated functionalityAlex Crichton-27/+1
This commit removes all unstable and deprecated functions in the standard library. A release was recently cut (1.3) which makes this a good time for some spring cleaning of the deprecated functions.
2015-07-27Show appropriate feature flags in docsSteve Klabnik-2/+4
2015-07-17Remove confusing 'mutability root' termSteve Klabnik-7/+7
And some other outdated language. @echochamber came asking about these docs on IRC today, and they're a bit weird. I've updated them to be less ambiguous and use contemporary terminology.
2015-06-17Fallout in tests and docs from feature renamingsAlex Crichton-1/+1
2015-06-17core: Split apart the global `core` featureAlex Crichton-22/+28
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-04Doc-comment fix; trait names are capitalizedCorey Farwell-2/+2
2015-06-02Auto merge of #25867 - petrochenkov:ucellv, r=alexcrichtonbors-1/+8
Now when const functions are implemented and used, the `value` field of `UnsafeCell` can be made deprecated (and then private as intended).
2015-05-30Deprecate UnsafeCell::valuepetrochenkov-1/+8
2015-05-29Auto merge of #25747 - SimonSapin:map_ref, r=alexcrichtonbors-4/+152
For slightly complex data structures like `rustc_serialize::json::Json`, it is often convenient to have helper methods like `Json::as_string(&self) -> Option<&str>` that return a borrow of some component of `&self`. However, when `RefCell`s are involved, keeping a `Ref` around is required to hold a borrow to the insides of a `RefCell`. But `Ref` so far only references the entirety of the contents of a `RefCell`, not a component. But there is no reason it couldn’t: `Ref` internally contains just a data reference and a borrow count reference. The two can be dissociated. This adds a `map_ref` function that creates a new `Ref` for some other data, but borrowing the same `RefCell` as an existing `Ref`. Example: ```rust struct RefCellJson(RefCell<Json>); impl RefCellJson { fn as_string(&self) -> Option<Ref<str>> { map_ref(self.borrow(), |j| j.as_string()) } } ``` r? @alexcrichton
2015-05-29Add map and filter_map associated functions to std::cell::Ref and RefMutSimon Sapin-1/+132
See design discussion in https://github.com/rust-lang/rust/pull/25747
2015-05-28Auto merge of #25744 - SimonSapin:cell-eq, r=alexcrichtonbors-2/+8
`core::cell::Cell<T>` and `core::cell::RefCell<T>` currently implement `PartialEq` when `T` does, and just defer to comparing `T` values. There is no reason the same shouldn’t apply to `Eq`. This enables `#[derive(Eq, PartialEq)]` on e.g. structs that have a `RefCell` field. r? @alexcrichton I’m unsure what to do with `#[stable]` attributes on `impl`s. `impl`s generated by `#[derive]` don’t have them.
2015-05-28Move std::cell::clone_ref to a clone associated function on std::cell::RefSimon Sapin-3/+20
... and generalize the bounds on the value type.
2015-05-28Rollup merge of #25726 - nham:cell_docs, r=alexcrichtonManish Goregaokar-4/+4
Currently part of the description of the `into_inner` method of `UnsafeCell` seems backwards.
2015-05-27Use `const fn` to abstract away the contents of UnsafeCell & friends.Eduard Burtescu-3/+3
2015-05-24Implement Eq for Cell and RefCell.Simon Sapin-2/+8
`core::cell::Cell<T>` and `core::cell::RefCell<T>` currently implement `PartialEq` when `T` does, and just defer to comparing `T` values. There is no reason the same shouldn’t apply to `Eq`. This enables `#[derive(Eq, PartialEq)]` on e.g. structs that have a `RefCell` field.
2015-05-22docs: Improve descriptions for some methods in core::cell.Nick Hamann-4/+4
2015-05-13RebasingNick Cameron-1/+0
2015-05-09Convert #[lang="..."] to #[lang = "..."]Nick Hamann-1/+1
In my opinion this looks nicer, but also it matches the whitespace generally used for stability markers more closely.
2015-05-09Please the `make tidy`Barosl Lee-1/+2
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-2/+2
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-05-02Make `UnsafeCell`, `RefCell`, `Mutex`, and `RwLock` accept DSTsP1start-27/+32
This + DST coercions (#24619) would allow code like `Rc<RefCell<Box<Trait>>>` to be simplified to `Rc<RefCell<Trait>>`.
2015-04-28Register new snapshotsTamir Duberstein-2/+0
2015-04-26IMO better borrow_mut() documentation on RefCellgareins-1/+1
Previous borrow() is enough to make borrow_mut() panic, no need to have borrow_mut() twice. [This](http://is.gd/woKKAW)
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-5/+5
2015-04-01fallout from feature-gating unary negation on unsigned integers.Felix S. Klock II-1/+1
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-34/+0
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-03-25Change lint names to pluralsNick Cameron-1/+1
2015-03-25Add trivial cast lints.Nick Cameron-1/+5
This permits all coercions to be performed in casts, but adds lints to warn in those cases. Part of this patch moves cast checking to a later stage of type checking. We acquire obligations to check casts as part of type checking where we previously checked them. Once we have type checked a function or module, then we check any cast obligations which have been acquired. That means we have more type information available to check casts (this was crucial to making coercions work properly in place of some casts), but it means that casts cannot feed input into type inference. [breaking change] * Adds two new lints for trivial casts and trivial numeric casts, these are warn by default, but can cause errors if you build with warnings as errors. Previously, trivial numeric casts and casts to trait objects were allowed. * The unused casts lint has gone. * Interactions between casting and type inference have changed in subtle ways. Two ways this might manifest are: - You may need to 'direct' casts more with extra type information, for example, in some cases where `foo as _ as T` succeeded, you may now need to specify the type for `_` - Casts do not influence inference of integer types. E.g., the following used to type check: ``` let x = 42; let y = &x as *const u32; ``` Because the cast would inform inference that `x` must have type `u32`. This no longer applies and the compiler will fallback to `i32` for `x` and thus there will be a type error in the cast. The solution is to add more type information: ``` let x: u32 = 42; let y = &x as *const u32; ```
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+1
2015-03-19core: Inline most cell methods.Patrick Walton-0/+21
This is a significant performance problem in Servo.
2015-03-08Clean up references to opt-out traitsSteve Klabnik-3/+0
They're opt-in now. Fixes #22572
2015-02-22Add negative impls for SyncFlavio Percoco-1/+3
2015-02-17Register new snapshotsAlex Crichton-2/+1