Skip to content
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

Rollup of 4 pull requests #75244

Merged
merged 21 commits into from
Aug 7, 2020
Merged

Rollup of 4 pull requests #75244

merged 21 commits into from
Aug 7, 2020

Conversation

Manishearth
Copy link
Member

Successful merges:

Failed merges:

r? @ghost

jyn514 and others added 21 commits August 2, 2020 22:39
This caused the following false positive:

```
warning: unresolved link to `Default::default`
 --> /home/joshua/rustc2/default.rs:1:14
  |
1 | /// Link to [Default::default()]
  |              ^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(broken_intra_doc_links)]` on by default
note: this item resolved to a trait, which did not match the disambiguator 'fn'
 --> /home/joshua/rustc2/default.rs:1:14
  |
1 | /// Link to [Default::default()]
  |              ^^^^^^^^^^^^^^^^^^
```
Now that we're returning the `Res` of the associated item,
not the trait itself, it got confused.
Clearly it has been resolved, because we say on the next line what it
resolved to.
See comments in the diff; this is such a hack.

The reason this can't be done properly in `register_res` is because
there's no way to get back the parent type: calling
`tcx.parent(assoc_item)` gets you the _impl_, not the type.
You can call `tcx.impl_trait_ref(impl_).self_ty()`, but there's no way
to go from that to a DefId without unwrapping.
adds [*mut|*const] ptr::set_ptr_value

I propose the addition of these two functions to `*mut T` and `*const T`, respectively. The motivation for this is primarily byte-wise pointer arithmetic on (potentially) fat pointers, i.e. for types with a `T: ?Sized` bound. A concrete use-case has been discussed in [this](https://internals.rust-lang.org/t/byte-wise-fat-pointer-arithmetic/12739) thread.
TL;DR: Currently, byte-wise pointer arithmetic with potentially fat pointers in not possible in either stable or nightly Rust without making assumptions about the layout of fat pointers, which is currently still an implementation detail and not formally stabilized. This PR adds one function to `*mut T` and `*const T` each, allowing to circumvent this restriction without exposing any internal implementation details.
One possible alternative would be to add specific byte-wise pointer arithmetic functions to the two pointer types in addition to the already existing count-wise functions. However, I feel this fairly niche use case does not warrant adding a whole set of new functions like `add_bytes`, `offset_bytes`, `wrapping_offset_bytes`, etc. (times two, one for each pointer type) to `libcore`.
Disallow linking to items with a mismatched disambiguator

Closes rust-lang#74851

r? @Manishearth
Make `IntoIterator` lifetime bounds of `&BTreeMap` match with `&HashMap`

This is a pretty small change on the lifetime bounds of `IntoIterator` implementations of both `&BTreeMap` and `&mut BTreeMap`. This is loosening the lifetime bounds, so more code should be accepted with this PR. This is lifetime bounds will still be implicit since we have `type Item = (&'a K, &'a V);` in the implementation. This change will make the HashMap and BTreeMap share the same signature, so we can share the same function/trait with both HashMap and BTreeMap in the code.

Fixes rust-lang#74034.
r? @dtolnay hey, I was touching this file on my previous PR and wanted to fix this on the way. Would you mind taking a look at this, or redirecting it if you are busy?
…crum

Fix ICE when using asm! on an unsupported architecture

Fixes rust-lang#75220
@Manishearth
Copy link
Member Author

@rustbot modify labels: +rollup
@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Aug 7, 2020

📌 Commit 9ab750d has been approved by Manishearth

@rustbot rustbot added the rollup A PR which is a rollup label Aug 7, 2020
@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 7, 2020
@bors
Copy link
Contributor

bors commented Aug 7, 2020

⌛ Testing commit 9ab750d with merge d4c940f...

@bors
Copy link
Contributor

bors commented Aug 7, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Manishearth
Pushing d4c940f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 7, 2020
@bors bors merged commit d4c940f into rust-lang:master Aug 7, 2020
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants