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 7 pull requests #99816

Merged
merged 31 commits into from
Jul 27, 2022
Merged

Rollup of 7 pull requests #99816

merged 31 commits into from
Jul 27, 2022

Conversation

GuillaumeGomez
Copy link
Member

Successful merges:

Failed merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

saethlin and others added 30 commits July 3, 2022 00:15
Add a brief comment explaining why the diagnostic migration lints aren't
included in the `rustc::internal` diagnostic group.

Signed-off-by: David Wood <[email protected]>
If an internal lint uses `typeck_results` or similar queries then that
can result in rustdoc checking code that it shouldn't (e.g. from other
platforms) and emit compilation errors.

Signed-off-by: David Wood <[email protected]>
Some command-line options accessible through `sess.opts` are best
accessed through wrapper functions on `Session`, `TyCtxt` or otherwise,
rather than through field access on the option struct in the `Session`.

Adds a new lint which triggers on those options that should be accessed
through a wrapper function so that this is prohibited. Options are
annotated with a new attribute `rustc_lint_opt_deny_field_access` which
can specify the error message (i.e. "use this other function instead")
to be emitted.

A simpler alternative would be to simply rename the options in the
option type so that it is clear they should not be used, however this
doesn't prevent uses, just discourages them. Another alternative would
be to make the option fields private, and adding accessor functions on
the option types, however the wrapper functions sometimes rely on
additional state from `Session` or `TyCtxt` which wouldn't be available
in an function on the option type, so the accessor would simply make the
field available and its use would be discouraged too.

Signed-off-by: David Wood <[email protected]>
Fix slice::ChunksMut aliasing

Fixes rust-lang#94231, details in that issue.
cc `@RalfJung`

This isn't done just yet, all the safety comments are placeholders. But otherwise, it seems to work.

I don't really like this approach though. There's a lot of unsafe code where there wasn't before, but as far as I can tell the only other way to uphold the aliasing requirement imposed by `__iterator_get_unchecked` is to use raw slices, which I think require the same amount of unsafe code. All that would do is tie the `len` and `ptr` fields together.

Oh I just looked and I'm pretty sure that `ChunksExactMut`, `RChunksMut`, and `RChunksExactMut` also need to be patched. Even more reason to put up a draft.
Allow `ValTree::try_to_raw_bytes` on `u8` array

Fixes rust-lang#99325

cc `@b-naber` I think who touched this last in 705d818
…onst-generics, r=oli-obk

Deeply deny fn and raw ptrs in const generics

I think this is right -- just because we wrap a fn ptr in a wrapper type does not mean we should allow it in a const parameter.

We now reject both of these in the same way:

```
#![feature(adt_const_params)]

#[derive(Eq, PartialEq)]
struct Wrapper();

fn foo<const W: Wrapper>() {}

fn foo2<const F: fn()>() {}
```

This does regress one test (`src/test/ui/consts/refs_check_const_eq-issue-88384.stderr`), but I'm not sure it should've passed in the first place.

cc: ``@b-naber`` who introduced that test^
fixes rust-lang#99641
lint: add bad opt access internal lint

Prompted by [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/sess.2Ecrate_types.28.29.20vs.20sess.2Eopts.2Ecrate_types/near/290682847).

Some command-line options accessible through `sess.opts` are best accessed through wrapper functions on `Session`, `TyCtxt` or otherwise, rather than through field access on the option struct in the `Session`.

Adds a new lint which triggers on those options that should be accessed through a wrapper function so that this is prohibited. Options are annotated with a new attribute `rustc_lint_opt_deny_field_access` which can specify the error message (i.e. "use this other function instead") to be emitted.

A simpler alternative would be to simply rename the options in the option type so that it is clear they should not be used, however this doesn't prevent uses, just discourages them. Another alternative would be to make the option fields private, and adding accessor functions on the option types, however the wrapper functions sometimes rely on additional state from `Session` or `TyCtxt` which wouldn't be available in an function on the option type, so the accessor would simply make the field available and its use would be discouraged too.

**Leave a comment if there's an option I should add this to.**
…rk-Simulacrum

Add some comments to the docs issue template to clarify

Newcomers may not know that some docs have their own repositories (e.g. the book, the reference), or that the documentation and rustdoc are different.
Actually, this template was used to report an issue related to the book: rust-lang#99699
This adds some comments to clarify the above things. I'm not sure if the current wording is the best, any suggestion would be helpful!

Signed-off-by: Yuki Okushi <[email protected]>
…r=petrochenkov

Clean up HIR-based lifetime resolution

Based on rust-lang#97313.

Fixes rust-lang#98932.

r? `@petrochenkov`
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. rollup A PR which is a rollup labels Jul 27, 2022
@GuillaumeGomez
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Jul 27, 2022

📌 Commit 2d52aa0 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@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 Jul 27, 2022
@bors
Copy link
Contributor

bors commented Jul 27, 2022

⌛ Testing commit 2d52aa0 with merge 2643b16...

@bors
Copy link
Contributor

bors commented Jul 27, 2022

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing 2643b16 to master...

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2643b16): comparison url.

Instruction count

  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: 🎉 relevant improvements found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
1.0% 1.0% 1
Improvements 🎉
(primary)
-0.2% -0.2% 1
Improvements 🎉
(secondary)
-0.5% -1.6% 10
All 😿🎉 (primary) -0.2% -0.2% 1

Max RSS (memory usage)

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.1% 3.1% 1
Improvements 🎉
(primary)
-0.5% -0.5% 1
Improvements 🎉
(secondary)
-2.1% -2.1% 1
All 😿🎉 (primary) -0.5% -0.5% 1

Cycles

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: no relevant changes found
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
N/A N/A 0
Improvements 🎉
(primary)
-3.9% -3.9% 1
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) -3.9% -3.9% 1

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants