Rollup of 8 pull requests
Successful merges:
- #103110 (remove redundant Send impl for references)
- #103255 (Clean up hidden type registration)
- #103394 (Clarify documentation about the memory layout of `UnsafeCell`)
- #103408 (Clean return-position `impl Trait` in traits correctly in rustdoc)
- #103505 (rustdoc: parse self-closing tags and attributes in `invalid_html_tags`)
- #103524 (rustc_metadata: Add struct and variant constructors to module children at encoding time)
- #103544 (Add flag to forbid recovery in the parser)
- #103616 (rustdoc: remove CSS workaround for Firefox 29)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Add flag to forbid recovery in the parser
To start the effort of fixing #103534, this adds a new flag to the parser, which forbids the parser from doing recovery, which it shouldn't do in macros.
This doesn't add any new checks for recoveries yet and is just here to bikeshed the names for the functions here before doing more.
r? `@compiler-errors`
rustc_metadata: Add struct and variant constructors to module children at encoding time
instead of decoding time.
Continuation of https://github.com/rust-lang/rust/pull/95899.
The last time it caused some ICEs from generator use, but not everything seems ok.
Clarify documentation about the memory layout of `UnsafeCell`
This PR addresses a [comment](https://github.com/rust-lang/rust/pull/101717#issuecomment-1279908390) by `@RalfJung` in PR #101717 to further clarify the documentation of `UnsafeCell<T>`. The previous PR was merged already before we had a chance to correct this, hence this second PR :)
To goal of this PR is:
1. Split the paragraph about the memory layout of `UnsafeCell<T>` and the usage of `UnsafeCell::(raw_)get()` into two paragraphs, so that it is easier to digest for the reader.
2. Slightly simplify the previously added examples in order to reduce redundancy between the new examples and the examples that already [existed](ddd119b2fe/library/core/src/cell.rs (L1858-L1908)) before these 2 PRs (which remained untouched by both PRs).
Clean up hidden type registration
work on https://github.com/rust-lang/rust/issues/101186
Actually passing down the relation and using it instead of `eq` for the hidden type comparison has *no* effect whatsoever and allows for no further improvements at the call sites. I decided the increased complexity was not worth it and thus did not include that change in this PR.
r? `@compiler-errors`
remove redundant Send impl for references
Also explain why the other instance is not redundant, move it next to the trait they are implementing, and out of the redundant module. This seems to go back all the way to 35ca50bd56, not sure why the module was added.
The instance for `&mut` is the default instance we get anyway, and we don't have anything similar for `Sync`, so IMO we should be consistent and not have the redundant instance here, either.
Rollup of 9 pull requests
Successful merges:
- #103035 (Even nicer errors from assert_unsafe_precondition)
- #103106 (Try to say that memory outside the AM is always exposed)
- #103475 (Make param index generation a bit more robust)
- #103525 (Move a wf-check into the site where the value is instantiated)
- #103564 (library: allow some unused things in Miri)
- #103586 (Process registered region obligation in `resolve_regions_with_wf_tys`)
- #103592 (rustdoc: remove redundant CSS selector `.notable-traits .notable`)
- #103593 (Remove an unused parser function (`Expr::returns`))
- #103611 (Add test for issue 103574)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Try to say that memory outside the AM is always exposed
cc ``@Gankra`` ``@thomcc``
I want to confidently tell people that they can use `from_exposed_addr` to get a pointer for doing MMIO and/or other hardware interactions done with volatile reads/writes at particular addresses outside the Rust AM. Currently, the docs indicate that would be UB.
With this change, now the docs indicate that this is intended to be a valid use of `from_exposed_addr`.
r? ``@RalfJung``
Even nicer errors from assert_unsafe_precondition
For example, now running `cargo test` with this patch I get things like:
```
$ cargo +stage1 test
Finished test [unoptimized + debuginfo] target(s) in 0.01s
Running unittests src/lib.rs (target/debug/deps/malloc_buf-9d105ddf86862995)
running 5 tests
thread 'tests::test_null_buf' panicked at 'unsafe precondition violated: is_aligned_and_not_null(data) &&
crate::mem::size_of::<T>().saturating_mul(len) <= isize::MAX as usize', /home/ben/rust/library/core/src/slice/raw.rs:93:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread panicked while panicking. aborting.
error: test failed, to rerun pass `--lib`
Caused by:
process didn't exit successfully: `/tmp/malloc_buf-1.0.0/target/debug/deps/malloc_buf-9d105ddf86862995` (signal: 6, SIGABRT: process abort signal)
```
This is still not perfect, but these are better for another PR:
* `stringify!` is trying to do clever pretty-printing on the `expr` inside `assert_unsafe_precondition` and can even add a newline.
* It would be nice to print a bit more information about where the problem is. Perhaps this is `cfg_attr(debug_assertions, track_caller)`, or perhaps it the function name added to `Location`.
cc ``@RalfJung`` this is what I was thinking of for https://github.com/rust-lang/rust/pull/102732#discussion_r989068907
Remove `commit_if_ok` probe from NLL type relation
It was not really necessary to add the `commit_if_ok` in #100092 -- I added it to protect us against weird inference error messages due to recursive RPIT calls, but we are always on the error path when this happens anyways, and I can't come up with an example that makes this manifest.
Fixes#103599
r? `@oli-obk` since you reviewed #100092, feel free to re-roll.
🅱️📢 beta-nominating this since it's on beta (which forks in ~a week~ two days 😨) -- worst case we could revert the original PR on beta and land this on nightly, to give it some extra soak time...
Add Target Tier Policy notification.
This adds a notification posted to PRs when they add/modify a target spec.
This was hard-coded in highfive. I forgot to include this in https://github.com/rust-lang/rust/pull/103492.
ptr::eq: clarify that comparing dyn Trait is fragile
Also remove the dyn trait example from `ptr::eq` since those tests are not actually guaranteed to pass due to how unstable vtable comparison is.
Cc ``@rust-lang/libs-api``
Cc discussion following https://github.com/rust-lang/rust/pull/80505
Update cargo
5 commits in 071eeaf210708219a5a1b2c4728ca2f97df7f2ae..9210810d1fd7b51ae0439a0a363cc50e36963455 2022-10-22 01:17:55 +0000 to 2022-10-25 22:31:50 +0000
- Fix 410 gone response handling (rust-lang/cargo#11286)
- Fix inequality in "stale mtime" log messages (rust-lang/cargo#11281)
- doc(cargo-tree): mention it considering feature unification (rust-lang/cargo#11282)
- Improve the error message if `publish` is `false` or empty list (rust-lang/cargo#11280)
- Add test for deleted index entry (rust-lang/cargo#11278)
rustdoc: don't mark Box<T> as Iterator, Read, etc
Because Box<T> has pass-through implementations, rustdoc was giving it the "Notable Traits" treatment for Iterator, Read, Write, and Future, even when the type of T was unspecified.
Pin had the same problem, but just for Future.
Fixes#100320