bors
7908a1d654
Auto merge of #110243 - WaffleLapkin:bless_tagged_pointers 🙏 , r=Nilstrieb
...
Tagged pointers, now with strict provenance!
This is a big refactor of tagged pointers in rustc, with three main goals:
1. Porting the code to the strict provenance
2. Cleanup the code
3. Document the code (and safety invariants) better
This PR has grown quite a bit (almost a complete rewrite at this point...), so I'm not sure what's the best way to review this, but reviewing commit-by-commit should be fine.
r? `@Nilstrieb`
2023-04-17 21:50:13 +00:00
Josh Soref
e09d0d2a29
Spelling - compiler
...
* account
* achieved
* advising
* always
* ambiguous
* analysis
* annotations
* appropriate
* build
* candidates
* cascading
* category
* character
* clarification
* compound
* conceptually
* constituent
* consts
* convenience
* corresponds
* debruijn
* debug
* debugable
* debuggable
* deterministic
* discriminant
* display
* documentation
* doesn't
* ellipsis
* erroneous
* evaluability
* evaluate
* evaluation
* explicitly
* fallible
* fulfill
* getting
* has
* highlighting
* illustrative
* imported
* incompatible
* infringing
* initialized
* into
* intrinsic
* introduced
* javascript
* liveness
* metadata
* monomorphization
* nonexistent
* nontrivial
* obligation
* obligations
* offset
* opaque
* opportunities
* opt-in
* outlive
* overlapping
* paragraph
* parentheses
* poisson
* precisely
* predecessors
* predicates
* preexisting
* propagated
* really
* reentrant
* referent
* responsibility
* rustonomicon
* shortcircuit
* simplifiable
* simplifications
* specify
* stabilized
* structurally
* suggestibility
* translatable
* transmuting
* two
* unclosed
* uninhabited
* visibility
* volatile
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17 16:09:18 -04:00
bors
e49122fb1c
Auto merge of #110367 - saethlin:no-truncations, r=oli-obk
...
Remove some suspicious cast truncations
These truncations were added a long time ago, and as best I can tell without a perf justification. And with rust-lang/rust#110410 it has become perf-neutral to not truncate anymore. We worked hard for all these bits, let's use them.
2023-04-17 09:38:31 +00:00
Ben Kimock
84facac97a
Remove some unnecessary hash truncations
2023-04-16 20:05:02 -04:00
Ben Kimock
ad8d304163
Implement StableHasher::write_u128 via write_u64
2023-04-16 09:44:03 -04:00
Nilstrieb
7859a8e9a5
Don't use serde_json
to serialize a simple JSON object
...
This avoids `rustc_data_structures` depending on `serde_json` which
allows it to be compiled much earlier, unlocking most of rustc.
2023-04-16 15:00:06 +02:00
Matthias Krüger
543f8bc38c
fix clippy::toplevel_ref_arg and ::manual_map
2023-04-16 13:28:13 +02:00
John Kåre Alsaker
64474a40b0
Move the WorkerLocal type from the rustc-rayon fork into rustc_data_structures
2023-04-16 05:50:57 +02:00
Maybe Waffle
5571dd061d
fix broken intradoclinks
2023-04-14 13:04:58 +00:00
Maybe Waffle
014c6f208e
Use ptr::Alignment
for extra coolness points
2023-04-14 12:31:49 +00:00
Maybe Waffle
36f5918bf1
Test CopyTaggedPtr
's HashStable
impl
2023-04-14 11:59:53 +00:00
Maybe Waffle
251f662e4d
Share Tag2
impl between CopyTaggedPtr
and TaggedPtr
tests
2023-04-14 11:24:22 +00:00
Maybe Waffle
8d49e948a8
Doc fixes from review
2023-04-14 11:24:22 +00:00
Maybe Waffle
c155d5149f
Implement Send
/Sync
for CopyTaggedPtr
2023-04-13 16:51:04 +00:00
Maybe Waffle
dc19dc29c9
doc fixes
2023-04-12 19:00:27 +00:00
Maybe Waffle
838c5491a4
Document tagged pointers better
2023-04-12 16:22:20 +00:00
Maybe Waffle
6f9b15c40c
Add tests for tagged pointers
2023-04-12 16:20:34 +00:00
Maybe Waffle
5e4577ec65
Add TaggedPtr::set_tag
2023-04-12 12:35:43 +00:00
Maybe Waffle
6f64ae3fbc
Move code around
2023-04-12 11:50:45 +00:00
Maybe Waffle
3df9a7bde3
Shorten COMPARE_PACKED
=> CP
where it is not important
...
why can't I _ it :'(
2023-04-12 11:44:52 +00:00
Maybe Waffle
8f408202c3
Remove pointer_{ref,mut}
from tagged pointers
...
Just use `deref{,_mut}`!
2023-04-12 11:41:41 +00:00
Maybe Waffle
c7c0b85f67
Make tagged pointers debug impls print the pointer
...
Does not really matter, but may be nicer in case
the pointer has some specific debug impl.
2023-04-12 11:30:45 +00:00
Maybe Waffle
c6acd5c92f
Remove Pointer::with_ref
in favour implementing it on tagged pointers directly
2023-04-12 11:26:34 +00:00
Maybe Waffle
9051331dd7
Lift Pointer
's requirement for the pointer to be thin
...
fat pointers rule!
2023-04-12 11:00:35 +00:00
Maybe Waffle
26232f1ff5
Remove useless parameter from ghost
2023-04-12 10:34:29 +00:00
Maybe Waffle
ad92677008
Fix doc test
2023-04-11 21:45:19 +00:00
Maybe Waffle
12fd610e01
Refactor tagged ptr packing into a function
2023-04-11 21:40:39 +00:00
Maybe Waffle
3c6f4c1260
Bless tagged pointers (comply to strict provenance)
2023-04-11 21:31:23 +00:00
Maybe Waffle
f028636b1a
Sprinkle some whitespace & uses
2023-04-11 19:33:33 +00:00
Maybe Waffle
c738dcc284
Add bits_for
helper for tagged pointers & fixup docs
2023-04-11 19:18:59 +00:00
Maybe Waffle
a32959263c
Use SSO_ARRAY_SIZE
instead of 8
in SsoHashMap
impl
2023-04-11 11:02:01 +00:00
Maybe Waffle
0465201f77
Use itertools::Either
instead of own EitherIter
impl
2023-04-11 11:02:01 +00:00
Nilstrieb
73417b1e15
Inline format_args
...
Co-authored-by: Michael Goulet <michael@errs.io>
2023-04-09 23:29:39 +02:00
Nilstrieb
81c320ea77
Fix some clippy::complexity
2023-04-09 23:22:14 +02:00
Nilstrieb
0a0968b207
Allow modulo_one
on function using cfg consts
2023-04-09 22:30:24 +02:00
Nilstrieb
f058d05fc2
Some simple clippy::perf
fixes
2023-04-09 21:59:28 +02:00
bors
0f0dc29264
Auto merge of #109971 - WaffleLapkin:yeet_ownership, r=Nilstrieb
...
Yeet `owning_ref`
Based on the discussions from https://github.com/rust-lang/rust/pull/109948
This replaces `owning_ref` with a far simpler & safer abstraction.
Fixes #109974
2023-04-08 01:08:26 +00:00
Maybe Waffle
fbe0591c68
Mark OwnedSlice::{deref, borrow}
as #[inline]
2023-04-07 10:14:50 +00:00
Maybe Waffle
2733c29bb1
Support multithreaded mode in OwnedSlice
tests
2023-04-06 18:13:07 +00:00
Maybe Waffle
e0e39caf84
Add basic tests for OwnedSlice
2023-04-06 17:33:55 +00:00
Maybe Waffle
b6970d0e26
Use FnOnce
for slice_owned
instead of Fn
2023-04-06 17:03:42 +00:00
Nilstrieb
504c4c40e9
Add context to phantom comment
2023-04-05 18:55:55 +02:00
Thom Chiovoloni
9d314627aa
Fix a couple missed hash constants
2023-04-05 15:48:37 +00:00
Thom Chiovoloni
bb0969cae0
Use SipHash-1-3 instead of SipHash-2-4 for StableHasher
2023-04-05 15:48:37 +00:00
Maybe Waffle
9405f586f5
Fix typo
2023-04-05 13:49:48 +00:00
Maybe Waffle
d7056548f9
Yeet owning_ref
...
Turns out
- `owning_ref` is unsound due to `Box` aliasing stuff
- `rustc` doesn't need 99% of the `owning_ref` API
- `rustc` can use a far simpler abstraction that is `OwnedSlice`
2023-04-05 13:49:48 +00:00
Maybe Waffle
c0ceefdfaf
Use OwnedSlice
instead of owning_ref
2023-04-05 13:49:48 +00:00
Maybe Waffle
689beda166
Implement OwnedSlice
2023-04-05 13:49:48 +00:00
Oli Scherer
457a162d00
Use elsa =1.7.1 as 1.8.0 was an accidental copy of 1.7.0
2023-04-05 08:07:29 +00:00
Oli Scherer
54214c8d8d
Use a simpler atomic operation than the compare_exchange
hammer
2023-04-04 09:01:44 +00:00