generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 134
2021 week 36: merge changes from rustc (#487) #489
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…hearth Avoid slice indexing in Clippy (down with the ICEs) While working on #7569 I got about 23 lint reports where we can avoid slice indexing by destructing the slice early. This is a preparation PR to avoid fixing them in the lint PR. (The implementation already takes about 300 lines without tests 😅). Either way, this should hopefully be easy to review 🙃 --- changelog: none
…rd's documentation page.
New lint: option_needless_deref changelog: [`option_needless_deref`] fix #7571
Fix #88256 remove duplicated diagnostics Fix #88256
…shearth Fix documentation of eval_order_dependence Fixes #7624. changelog: fix documentation of eval_order_dependence
This only applies to builtin derives as I don't think there is a clean way to get the available derives in typeck. Closes #85851
backport-of: none
this also renders them as `_`, which rustdoc previously did not.
Adapts clippy for fe1a7f7
Note that this incorrectly suggests a shared borrow, but at least we know it's happening.
Add `TAU` to `approx_constant` changelog: [`approx_constant`]: Add `TAU`
Use index newtyping for TyVid This is useful for using TyVid in types like VecGraph, and just otherwise seems like a small win.
Bump RLS submodule r? `@Mark-Simulacrum`
These were deleted in https://reviews.llvm.org/D108614, and in C++ I definitely see the argument for their removal. I didn't try and propagate the changes up into higher layers of rustc in this change because my initial goal was to get rustc working against LLVM HEAD promptly, but I'm happy to follow up with some refactoring to make the API on the Rust side match the LLVM API more directly (though the way the enum works in Rust makes the API less scary IMO). r? @nagisa cc @nikic
Add -Z panic-in-drop={unwind,abort} command-line option
This PR changes `Drop` to abort if an unwinding panic attempts to escape it, making the process abort instead. This has several benefits:
- The current behavior when unwinding out of `Drop` is very unintuitive and easy to miss: unwinding continues, but the remaining drops in scope are simply leaked.
- A lot of unsafe code doesn't expect drops to unwind, which can lead to unsoundness:
- servo/rust-smallvec#14
- bluss/arrayvec#3
- There is a code size and compilation time cost to this: LLVM needs to generate extra landing pads out of all calls in a drop implementation. This can compound when functions are inlined since unwinding will then continue on to process drops in the callee, which can itself unwind, etc.
- Initial measurements show a 3% size reduction and up to 10% compilation time reduction on some crates (`syn`).
One thing to note about `-Z panic-in-drop=abort` is that *all* crates must be built with this option for it to be sound since it makes the compiler assume that dropping `Box<dyn Any>` will never unwind.
cc rust-lang/lang-team#97
Introduce NullOp::AlignOf This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`. The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
Update Clippy dependencies without patch versions Trial run for rust-lang/rust-clippy#7606
ARMv6K Nintendo 3DS Tier 3 target added Addition of the target specifications to build .elf files for Nintendo 3DS (ARMv6K, Horizon). Requires devkitARM 3DS toolkit for system libraries and arm-none-eabi-gcc linker.
…eGomez Allow missing code examples in trait impls. Excludes Trait implementations from the items that need to have doc code examples when using the `rustdoc::missing_doc_code_examples` lint. For details see #88741 fixes #88741 r? `@jyn514`
Update cargo 6 commits in 18751dd3f238d94d384a7fe967abfac06cbfe0b9..e515c3277bf0681bfc79a9e763861bfe26bb05db 2021-09-01 14:26:00 +0000 to 2021-09-08 14:32:15 +0000 - Remove log output that may leak tokens (rust-lang/cargo#9873) - rev = "refs/pull/𑑛/head" (rust-lang/cargo#9859) - Update suggestion message on bad project name error (rust-lang/cargo#9877) - clarify what goes into "*-sys" crates (rust-lang/cargo#9871) - Improve error message when unable to initialize git index repo (rust-lang/cargo#9869) - Use serde_json to generate cargo_vcs_info.json (rust-lang/cargo#9865)
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
* Add test for jump-to-def links background color
Add links for primitives in "jump to definition" feature Follow-up of #84176. I created a function `primitive_from_str` which is code that was originally in `collect_intra_doc_links::resolve_primitive` to prevent code duplication. I also created the `primitive_link_url` function which is somewhat similar to `primitive_link` but too much different to merge both of them. r? ``@jyn514``
…olnay Make `UnsafeCell::get_mut` const
Fix duplicate bounds for const_trait_impl Fixes #88383. Compare the constness of the candidates before winnowing and removing a `~const` `BoundCandidate`.
interpreter PointerArithmetic: use new Size helper methods
…melid Fix jump def background Fixes #88870. I somehow badly wrote the color in #88111. r? ``@camelid``
Improve error message for missing trait in trait impl
Fixes #88818. For the following example:
```rust
struct S { }
impl for S { }
```
the current output is:
```
error: missing trait in a trait impl
--> t1.rs:2:5
|
2 | impl for S { }
| ^
```
With my changes, I get:
```
error: missing trait in a trait impl
--> t1.rs:2:5
|
2 | impl for S { }
| ^
|
help: add a trait here
|
2 | impl Trait for S { }
| +++++
help: for an inherent impl, drop this `for`
|
2 - impl for S { }
2 + impl S { }
|
```
Reduce possibility of flaky tests As asked in rust-lang/rust#88885. r? ``@camelid``
Enum should prefer discriminant zero for niche
Given an enum with unassigned zero-discriminant, rust should prefer it for niche selection.
Zero as discriminant for `Option<Enum>` makes it possible for LLVM to optimize resulting asm.
- Eliminate branch when expected value coincides.
- Use smaller instruction `test eax, eax` instead of `cmp eax, ?`
- Possible interaction with zeroed memory?
Example:
```rust
pub enum Size {
One = 1,
Two = 2,
Three = 3,
}
pub fn handle(x: Option<Size>) -> u8 {
match x {
None => {0}
Some(size) => {size as u8}
}
}
```
In this case discriminant zero is available as a niche.
Above example on nightly:
```asm
mov eax, edi
cmp al, 4
jne .LBB0_2
xor eax, eax
.LBB0_2:
ret
```
PR:
```asm
mov eax, edi
ret
```
I created this PR because I had a performance regression when I tried to use an enum to represent legal grapheme byte-length for utf8.
Using an enum instead of `NonZeroU8` [here](https://github.com/bonega/yore/blob/d683304f5dfe2e99f769e6ab8adf8d60a0d1d9b3/src/internal/decoder_incomplete.rs#L90)
resulted in a performance regression of about 5%.
I consider this to be a somewhat realistic benchmark.
Thanks to `@ogoffart` for pointing me in the right direction!
Edit: Updated description
Rollup of 7 pull requests Successful merges: - #88033 (Add links for primitives in "jump to definition" feature) - #88722 (Make `UnsafeCell::get_mut` const) - #88851 (Fix duplicate bounds for const_trait_impl) - #88859 (interpreter PointerArithmetic: use new Size helper methods) - #88885 (Fix jump def background) - #88894 (Improve error message for missing trait in trait impl) - #88896 (Reduce possibility of flaky tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Rename "--display-warnings" to "--display-doctest-warnings" Fixes #41574. cc `@ollie27` r? `@kinnison`
Conflicts:
.github/workflows/ci.yml
A new NullOp was added in order to retrieve the minimum alignment of a type in the rust compiler. This change adds code generation for this operator in the gotoc codegen.
tedinski
approved these changes
Sep 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
Merge changes from the upstream rust compiler repository. This PR also includes a subsequent commit required to get the regression working.
Resolved issues:
Resolves #487: Weekly merge
Resolves #488: Add support to the new operation added in rustc
Call-outs:
Do not merge-squash this PR. I'll mark it as draft to get feedback and manually push it once it's approved.
Testing:
Ran the regression
No
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.