Skip to content

Rollup of 11 pull requests #76376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Sep 5, 2020
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
18ad5a5
Add a regression test for issue-72793
JohnTitor Aug 19, 2020
aa40c02
Unstable Book: add links to tracking issues for FFI features
ArekPiekarz Aug 26, 2020
f03d0b3
`impl Rc::new_cyclic`
mental32 Aug 27, 2020
42fb270
typo
mental32 Aug 29, 2020
bb5e79c
Link vec doc to & reference
pickfire Aug 29, 2020
1b19354
[WIP] Fix intra-doc links on pub re-exports
jyn514 Aug 29, 2020
20a6866
Try removing [prim@reference]
pickfire Aug 30, 2020
e885f00
Comment out test for generated docs until rustdoc changes its behavio…
jyn514 Aug 30, 2020
d715015
Improve tests
jyn514 Aug 30, 2020
0f301e8
Removed [inline] and copied over comments from Arc::new_cyclic
mental32 Sep 1, 2020
af19262
Fold length constant in Rvalue::Repeat
tmiasko Sep 2, 2020
2276991
Avoid spurious print outs during dryrun
Mark-Simulacrum Sep 2, 2020
850c321
Move jointness censoring to proc_macro
matklad Sep 3, 2020
89ae59a
Remove needless .to_owned() for link
jyn514 Jul 6, 2020
d5495e2
Refactor `ItemLink` into its own struct
jyn514 Jul 6, 2020
31a7b6e
Refactor RenderedLink into its own type
jyn514 Jul 6, 2020
9815010
Remove disambiguators from link text
jyn514 Jul 6, 2020
9d7e797
display_for -> suggestion_for
jyn514 Aug 29, 2020
4df6490
Link & primitive using relative link
pickfire Sep 3, 2020
af13338
Check test/example/benchmark on x.py check
Mark-Simulacrum Sep 2, 2020
09d3db2
Optimize Cursor::look_ahead
matklad Sep 3, 2020
85146b9
Add slice primitive link to vec
pickfire Sep 4, 2020
18c14fd
Misc cleanup
jyn514 Aug 29, 2020
cbc396f
inliner: Check for target features compatibility
tmiasko Sep 3, 2020
326b772
inliner: Check for no_sanitize attribute compatibility
tmiasko Sep 3, 2020
c23151b
inliner: Add mir-opt tests for codegen attributes compatibility
tmiasko Sep 4, 2020
b97d413
Refactor byteorder to std in rustc_middle
workingjubilee Aug 20, 2020
74b4eea
Remove reference to byteorder limits
workingjubilee Aug 20, 2020
fe2a867
Be explicit that we're handling bytes
workingjubilee Aug 20, 2020
dc00eff
Explain contract of {read, write}_target_uint
workingjubilee Aug 21, 2020
2df552b
Fix big endian read/write
workingjubilee Aug 22, 2020
cb33a15
Rollup merge of #75695 - JohnTitor:regression-test, r=Dylan-DPC
Dylan-DPC Sep 5, 2020
e160d2b
Rollup merge of #75741 - workingjubilee:refactor-byteorder, r=matthew…
Dylan-DPC Sep 5, 2020
c3a09fb
Rollup merge of #75954 - ArekPiekarz:unstable_book_ffi_tracking_issue…
Dylan-DPC Sep 5, 2020
4bd3f26
Rollup merge of #75994 - mental32:impl-rc-new-cyclic, r=KodrAus
Dylan-DPC Sep 5, 2020
86cf797
Rollup merge of #76060 - pickfire:patch-12, r=jyn514
Dylan-DPC Sep 5, 2020
ed39e6d
Rollup merge of #76078 - jyn514:no-disambiguator, r=manishearth
Dylan-DPC Sep 5, 2020
f1eb5f8
Rollup merge of #76082 - jyn514:top-level-links, r=ollie27,GuillaumeG…
Dylan-DPC Sep 5, 2020
79b8f59
Rollup merge of #76254 - tmiasko:fold-len, r=wesleywiser
Dylan-DPC Sep 5, 2020
45bdee8
Rollup merge of #76258 - Mark-Simulacrum:check-tests, r=ehuss
Dylan-DPC Sep 5, 2020
b4d3873
Rollup merge of #76263 - tmiasko:inline-codegen-fn-attrs, r=ecstatic-…
Dylan-DPC Sep 5, 2020
85cee57
Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov
Dylan-DPC Sep 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Explain contract of {read, write}_target_uint
  • Loading branch information
workingjubilee committed Sep 5, 2020
commit dc00efff9f44ddda1ce318e28f69e716f58d39dd
6 changes: 6 additions & 0 deletions compiler/rustc_middle/src/mir/interpret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,17 +561,23 @@ pub fn write_target_uint(
mut target: &mut [u8],
data: u128,
) -> Result<(), io::Error> {
// This u128 holds an "any-size uint" (since smaller uints can fits in it)
// So we do not write all bytes of the u128, just the "payload".
match endianness {
Endian::Little => target.write(&data.to_le_bytes())?,
Endian::Big => target.write(&data.to_be_bytes())?,
};
debug_assert!(target.len() == 0); // We should have filled the target buffer.
Ok(())
}

#[inline]
pub fn read_target_uint(endianness: Endian, mut source: &[u8]) -> Result<u128, io::Error> {
// This u128 holds an "any-size uint" (since smaller uints can fits in it)
let mut buf = [0u8; std::mem::size_of::<u128>()];
// So we do not read exactly 16 bytes into the u128, just the "payload".
source.read(&mut buf)?;
debug_assert!(source.len() == 0); // We should have consumed the source buffer.
match endianness {
Endian::Little => Ok(u128::from_le_bytes(buf)),
Endian::Big => Ok(u128::from_be_bytes(buf)),
Expand Down