rust/src/liballoc
Dylan DPC 4d11c3fe30
Rollup merge of #71107 - vorner:weak-into-raw-dangling, r=Amanieu
Address concerns of weak-into-raw

This should address the standing concerns in https://github.com/rust-lang/rust/issues/60728#issuecomment-612525616.

I've still left the ability to create a new dangling pointer from `null`, as I feel like this is the natural behaviour to expect, but I'm fine removing that too. I've modified the documentation to allow the `as_ptr` or `into_ptr` to return whatever garbage in case of a dangling pointer. I've also removed the guarantee to be able to do `from_raw(as_ptr)` from the documentation (but it would still work right now).

I've renamed the method and added implementations for `Rc`/`Arc`.

I've also tried if I can just „enable“ unsized types. I believe the current interface is compatible with them. But the inner implementation will be a bit challenging ‒ I can't use the `data_offset` as is used by `Rc` or `Arc` because it AFAIK „touches“ (creates a reference to) the live value of `T` ‒ and in case of `Weak`, it might be completely bogus or already dead ‒ so that would be UB.

`./x.py test tidy` is completely mad on my own system all over the code base :-(. I'll just hope it goes through CI, or will fix as necessary.

Is it OK if I ask @Amanieu for review, as the concerns are from you?

~r @Amanieu
2020-04-19 15:12:36 +02:00
..
alloc Make fields in MemoryBlock public 2020-03-28 20:22:07 +01:00
benches BTreeMap/BTreeSet: implement and test drain_filter 2020-03-29 16:05:53 +02:00
collections Rollup merge of #71167 - RalfJung:big-o, r=shepmaster 2020-04-17 23:56:00 +02:00
prelude Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
raw_vec Remove alignment from MemoryBlock 2020-03-26 17:14:12 +01:00
rc Format the world 2019-12-22 17:42:47 -05:00
sync Format the world 2019-12-22 17:42:47 -05:00
tests Disable try_reserve tests on Android 2020-04-09 15:55:12 +01:00
alloc.rs Stop importing integer modules in liballoc 2020-04-05 11:22:01 +02:00
borrow.rs Format the world 2019-12-22 17:42:47 -05:00
boxed.rs use ManuallyDrop instead of forget inside collections 2020-04-04 14:30:33 +02:00
Cargo.toml bump rand to fix Miri failures 2019-08-04 14:50:26 +02:00
fmt.rs Add note about localization to std::fmt docs 2020-03-09 12:31:33 -04:00
lib.rs Dogfood or_patterns in the standard library 2020-04-16 12:44:57 -07:00
macros.rs make vec![,] uncompilable 2020-04-14 10:27:55 +03:00
raw_vec.rs Use usize::MAX as assoc const in liballoc 2020-04-06 23:07:38 +02:00
rc.rs weak-into-raw: Add {Arc,Rc}::as_ptr 2020-04-19 09:38:16 +02:00
slice.rs Explain why we shouldn't add inline attr to into_vec 2020-04-19 01:03:43 +09:00
str.rs Replace max/min_value() with MAX/MIN assoc consts 2020-04-03 09:33:10 +02:00
string.rs Rollup merge of #71121 - AnthonyMikh:fix_string_doc_link, r=Dylan-DPC 2020-04-14 15:35:32 +02:00
sync.rs weak-into-raw: Add {Arc,Rc}::as_ptr 2020-04-19 09:38:16 +02:00
task.rs Fix link in task::Wake docs 2020-04-03 11:33:27 +02:00
tests.rs Stop importing integer modules in liballoc 2020-04-05 11:22:01 +02:00
vec.rs Fix clippy warnings 2020-04-15 23:38:48 +02:00