Dylan DPC
cbd561d41f
Rollup merge of #98441 - calebzulawski:simd_as, r=oli-obk
...
Implement simd_as for pointers
Expands `simd_as` (and `simd_cast`) to handle pointer-to-pointer, pointer-to-integer, and integer-to-pointer conversions.
cc ``@programmerjake`` ``@thomcc``
2022-09-17 15:31:07 +05:30
Dylan DPC
3ad81e0dd8
Rollup merge of #93628 - est31:stabilize_let_else, r=joshtriplett
...
Stabilize `let else`
🎉 **Stabilizes the `let else` feature, added by [RFC 3137](https://github.com/rust-lang/rfcs/pull/3137 ).** 🎉
Reference PR: https://github.com/rust-lang/reference/pull/1156
closes #87335 (`let else` tracking issue)
FCP: https://github.com/rust-lang/rust/pull/93628#issuecomment-1029383585
----------
## Stabilization report
### Summary
The feature allows refutable patterns in `let` statements if the expression is
followed by a diverging `else`:
```Rust
fn get_count_item(s: &str) -> (u64, &str) {
let mut it = s.split(' ');
let (Some(count_str), Some(item)) = (it.next(), it.next()) else {
panic!("Can't segment count item pair: '{s}'");
};
let Ok(count) = u64::from_str(count_str) else {
panic!("Can't parse integer: '{count_str}'");
};
(count, item)
}
assert_eq!(get_count_item("3 chairs"), (3, "chairs"));
```
### Differences from the RFC / Desugaring
Outside of desugaring I'm not aware of any differences between the implementation and the RFC. The chosen desugaring has been changed from the RFC's [original](https://rust-lang.github.io/rfcs/3137-let-else.html#reference-level-explanations ). You can read a detailed discussion of the implementation history of it in `@cormacrelf` 's [summary](https://github.com/rust-lang/rust/pull/93628#issuecomment-1041143670 ) in this thread, as well as the [followup](https://github.com/rust-lang/rust/pull/93628#issuecomment-1046598419 ). Since that followup, further changes have happened to the desugaring, in #98574 , #99518 , #99954 . The later changes were mostly about the drop order: On match, temporaries drop in the same order as they would for a `let` declaration. On mismatch, temporaries drop before the `else` block.
### Test cases
In chronological order as they were merged.
Added by df9a2e0687
(#87688 ):
* [`ui/pattern/usefulness/top-level-alternation.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/pattern/usefulness/top-level-alternation.rs ) to ensure the unreachable pattern lint visits patterns inside `let else`.
Added by 5b95df4bdc
(#87688 ):
* [`ui/let-else/let-else-bool-binop-init.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-bool-binop-init.rs ) to ensure that no lazy boolean expressions (using `&&` or `||`) are allowed in the expression, as the RFC mandates.
* [`ui/let-else/let-else-brace-before-else.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-brace-before-else.rs ) to ensure that no `}` directly preceding the `else` is allowed in the expression, as the RFC mandates.
* [`ui/let-else/let-else-check.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-check.rs ) to ensure that `#[allow(...)]` attributes added to the entire `let` statement apply for the `else` block.
* [`ui/let-else/let-else-irrefutable.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-irrefutable.rs ) to ensure that the `irrefutable_let_patterns` lint fires.
* [`ui/let-else/let-else-missing-semicolon.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-missing-semicolon.rs ) to ensure the presence of semicolons at the end of the `let` statement.
* [`ui/let-else/let-else-non-diverging.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-non-diverging.rs ) to ensure the `else` block diverges.
* [`ui/let-else/let-else-run-pass.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-run-pass.rs ) to ensure the feature works in some simple test case settings.
* [`ui/let-else/let-else-scope.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-scope.rs ) to ensure the bindings created by the outer `let` expression are not available in the `else` block of it.
Added by bf7c32a447
(#89965 ):
* [`ui/let-else/issue-89960.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/issue-89960.rs ) as a regression test for the ICE-on-error bug #89960 . Later in 102b9125e1
this got removed in favour of more comprehensive tests.
Added by 856541963c
(#89974 ):
* [`ui/let-else/let-else-if.rs`](https://github.com/rust-lang/rust/blob/1.58.1/src/test/ui/let-else/let-else-if.rs ) to test for the improved error message that points out that `let else if` is not possible.
Added by 9b45713b6c
:
* [`ui/let-else/let-else-allow-unused.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-allow-unused.rs ) as a regression test for #89807 , to ensure that `#[allow(...)]` attributes added to the entire `let` statement apply for bindings created by the `let else` pattern.
Added by 61bcd8d307
(#89841 ):
* [`ui/let-else/let-else-non-copy.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-non-copy.rs ) to ensure that a copy is performed out of non-copy wrapper types. This mirrors `if let` behaviour. The test case bases on rustc internal changes originally meant for #89933 but then removed from the PR due to the error prior to the improvements of #89841 .
* [`ui/let-else/let-else-source-expr-nomove-pass.rs `](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-source-expr-nomove-pass.rs ) to ensure that while there is a move of the binding in the successful case, the `else` case can still access the non-matching value. This mirrors `if let` behaviour.
Added by 102b9125e1
(#89841 ):
* [`ui/let-else/let-else-ref-bindings.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-ref-bindings.rs ) and [`ui/let-else/let-else-ref-bindings-pass.rs `](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-ref-bindings-pass.rs ) to check `ref` and `ref mut` keywords in the pattern work correctly and error when needed.
Added by 2715c5f984
(#89841 ):
* Match ergonomic tests adapted from the `rfc2005` test suite.
Added by fec8a507a2
(#89841 ):
* [`ui/let-else/let-else-deref-coercion-annotated.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-deref-coercion-annotated.rs ) and [`ui/let-else/let-else-deref-coercion.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-deref-coercion.rs ) to check deref coercions.
#### Added since this stabilization report was originally written (2022-02-09)
Added by 76ea566677
(#94211 ):
* [`ui/let-else/let-else-destructuring.rs`](https://github.com/rust-lang/rust/blob/1.63.0/src/test/ui/let-else/let-else-destructuring.rs ) to give a nice error message if an user tries to do an assignment with a (possibly refutable) pattern and an `else` block, like asked for in #93995 .
Added by e7730dcb7e
(#94208 ):
* [`ui/let-else/let-else-allow-in-expr.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-allow-in-expr.rs ) to test whether `#[allow(unused_variables)]` works in the expr, as well as its non presence, as well as putting it on the entire `let else` *affects* the expr, too. This was adding a missing test as pointed out by the stabilization report.
* Expansion of `ui/let-else/let-else-allow-unused.rs` and `ui/let-else/let-else-check.rs` to ensure that non-presence of `#[allow(unused)]` does issue the unused lint. This was adding a missing test case as pointed out by the stabilization report.
Added by 5bd71063b3
(#94208 ):
* [`ui/let-else/let-else-slicing-error.rs`](https://github.com/rust-lang/rust/blob/1.61.0/src/test/ui/let-else/let-else-slicing-error.rs ), a regression test for #92069 , which got fixed without addition of a regression test. This resolves a missing test as pointed out by the stabilization report.
Added by 5374688e1d
(#98574 ):
* [`src/test/ui/async-await/async-await-let-else.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/async-await/async-await-let-else.rs ) to test the interaction of async/await with `let else`
Added by 6c529ded86
(#98574 ):
* [`src/test/ui/let-else/let-else-temporary-lifetime.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-temporary-lifetime.rs ) as a (partial) regression test for #98672
Added by 9b56640106
(#99518 ):
* [`src/test/ui/let-else/let-else-temp-borrowck.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-temporary-lifetime.rs ) as a regression test for #93951
* Extension of `src/test/ui/let-else/let-else-temporary-lifetime.rs` to include a partial regression test for #98672 (especially regarding `else` drop order)
Added by baf9a7cb57
(#99518 ):
* Extension of `src/test/ui/let-else/let-else-temporary-lifetime.rs` to include a partial regression test for #93951 , similar to `let-else-temp-borrowck.rs`
Added by 60be2de8b7
(#99518 ):
* Extension of `src/test/ui/let-else/let-else-temporary-lifetime.rs` to include a program that can now be compiled thanks to borrow checker implications of #99518
Added by 47a7a91c96
(#100132 ):
* [`src/test/ui/let-else/issue-100103.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/issue-100103.rs ), as a regression test for #100103 , to ensure that there is no ICE when doing `Err(...)?` inside else blocks.
Added by e3c5bd617d
(#100443 ):
* [`src/test/ui/let-else/let-else-then-diverge.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-then-diverge.rs ), to verify that there is no unreachable code error with the current desugaring.
Added by 981852677c
(#100443 ):
* [`src/test/ui/let-else/issue-94176.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/issue-94176.rs ), to make sure that a correct span is emitted for a missing trailing expression error. Regression test for #94176 .
Added by e182d12a84
(#100434 ):
* [src/test/ui/unpretty/pretty-let-else.rs](https://github.com/rust-lang/rust/blob/master/src/test/ui/unpretty/pretty-let-else.rs ), as a regression test to ensure pretty printing works for `let else` (this bug surfaced in many different ways)
Added by e26285603c
(#99954 ):
* [`src/test/ui/let-else/let-else-temporary-lifetime.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-temporary-lifetime.rs ) extended to contain & borrows as well, as this was identified as an earlier issue with the desugaring: https://github.com/rust-lang/rust/issues/98672#issuecomment-1200196921
Added by 2d8460ef43
(#99291 ):
* [`src/test/ui/let-else/let-else-drop-order.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/let-else-drop-order.rs ) a matrix based test for various drop order behaviour of `let else`. Especially, it verifies equality of `let` and `let else` drop orders, [resolving](https://github.com/rust-lang/rust/pull/93628#issuecomment-1238498468 ) a [stabilization blocker](https://github.com/rust-lang/rust/pull/93628#issuecomment-1055738523 ).
Added by 1b87ce0d40
(#101410 ):
* Edit to `src/test/ui/let-else/let-else-temporary-lifetime.rs` to add the `-Zvalidate-mir` flag, as a regression test for #99228
Added by af591ebe4d
(#101410 ):
* [`src/test/ui/let-else/issue-99975.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui/let-else/issue-99975.rs ) as a regression test for the ICE #99975 .
Added by this PR:
* `ui/let-else/let-else.rs`, a simple run-pass check, similar to `ui/let-else/let-else-run-pass.rs`.
### Things not currently tested
* ~~The `#[allow(...)]` tests check whether allow works, but they don't check whether the non-presence of allow causes a lint to fire.~~ → *test added by e7730dcb7eb29a10ee73f269f4dc6e9d606db0da*
* ~~There is no `#[allow(...)]` test for the expression, as there are tests for the pattern and the else block.~~ → *test added by e7730dcb7eb29a10ee73f269f4dc6e9d606db0da*
* ~~`let-else-brace-before-else.rs` forbids the `let ... = {} else {}` pattern and there is a rustfix to obtain `let ... = ({}) else {}`. I'm not sure whether the `.fixed` files are checked by the tooling that they compile. But if there is no such check, it would be neat to make sure that `let ... = ({}) else {}` compiles.~~ → *test added by e7730dcb7eb29a10ee73f269f4dc6e9d606db0da*
* ~~#92069 got closed as fixed, but no regression test was added. Not sure it's worth to add one.~~ → *test added by 5bd71063b3810d977aa376d1e6dd7cec359330cc*
* ~~consistency between `let else` and `if let` regarding lifetimes and drop order: https://github.com/rust-lang/rust/pull/93628#issuecomment-1055738523~~ → *test added by 2d8460ef43d902f34ba2133fe38f66ee8d2fdafc*
Edit: they are all tested now.
### Possible future work / Refutable destructuring assignments
[RFC 2909](https://rust-lang.github.io/rfcs/2909-destructuring-assignment.html ) specifies destructuring assignment, allowing statements like `FooBar { a, b, c } = foo();`.
As it was stabilized, destructuring assignment only allows *irrefutable* patterns, which before the advent of `let else` were the only patterns that `let` supported.
So the combination of `let else` and destructuring assignments gives reason to think about extensions of the destructuring assignments feature that allow refutable patterns, discussed in #93995 .
A naive mapping of `let else` to destructuring assignments in the form of `Some(v) = foo() else { ... };` might not be the ideal way. `let else` needs a diverging `else` clause as it introduces new bindings, while assignments have a default behaviour to fall back to if the pattern does not match, in the form of not performing the assignment. Thus, there is no good case to require divergence, or even an `else` clause at all, beyond the need for having *some* introducer syntax so that it is clear to readers that the assignment is not a given (enums and structs look similar). There are better candidates for introducer syntax however than an empty `else {}` clause, like `maybe` which could be added as a keyword on an edition boundary:
```Rust
let mut v = 0;
maybe Some(v) = foo(&v);
maybe Some(v) = foo(&v) else { bar() };
```
Further design discussion is left to an RFC, or the linked issue.
2022-09-17 15:31:06 +05:30
bors
4a12d10bcc
Auto merge of #101928 - notriddle:rollup-pexhhxe, r=notriddle
...
Rollup of 8 pull requests
Successful merges:
- #101340 (Adding Fuchsia zxdb debugging walkthrough to docs)
- #101741 (Adding needs-unwind arg to applicable compiler ui tests)
- #101782 (Update `symbol_mangling` diagnostics migration)
- #101878 (More simple formatting)
- #101898 (Remove some unused CSS rules)
- #101911 (rustdoc: remove no-op CSS on `.source .content`)
- #101914 (rustdoc-json-types: Document that ResolvedPath can also be a union)
- #101921 (Pass --cfg=bootstrap for rustdoc for proc_macro crates)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-17 05:45:28 +00:00
Michael Howell
8b88370ee5
Rollup merge of #101878 - Rageking8:More-simple-formatting, r=lcnr
...
More simple formatting
2022-09-16 20:37:16 -07:00
Michael Howell
d6534317c7
Rollup merge of #101782 - JhonnyBillM:refactor-symbol-mangling-diags-migration, r=davidtwco
...
Update `symbol_mangling` diagnostics migration
Addresses comments raised in #100831 .
r? `@eddyb` `@davidtwco`
2022-09-16 20:37:15 -07:00
bors
c524c7dd25
Auto merge of #98588 - b-naber:valtrees-cleanup, r=lcnr
...
Use only ty::Unevaluated<'tcx, ()> in type system
r? `@lcnr`
2022-09-17 03:04:22 +00:00
Jack Huey
e09242d5b8
Final bits
2022-09-16 17:47:53 -04:00
Jack Huey
f1767dbb42
Add ExtraConstraintInfo
2022-09-16 17:33:12 -04:00
Jack Huey
9929c0ac76
Add AscribeUserTypeProvePredicate
2022-09-16 17:20:11 -04:00
Jack Huey
ec17be2656
Add outlives_constraint to BlameConstraint
2022-09-16 17:08:35 -04:00
Jack Huey
67653292be
Add to_constraint_category to ObligationCause and SubregionOrigin
2022-09-16 17:00:11 -04:00
Jack Huey
6075877c89
Pass ConstraintCategory thorough a few more places
2022-09-16 16:44:18 -04:00
Jack Huey
a46376e247
Make QueryOutlivesConstraint contain a ConstraintCategory
2022-09-16 16:15:41 -04:00
bors
95a992a686
Auto merge of #97800 - pnkfelix:issue-97463-fix-aarch64-call-abi-does-not-zeroext, r=wesleywiser
...
Aarch64 call abi does not zeroext (and one cannot assume it does so)
Fix #97463
2022-09-16 20:08:05 +00:00
Charles Lew
a76dcd8b3b
Update unicode-rs
crates to Unicode 15
2022-09-17 01:55:56 +08:00
bors
4d4e51e428
Auto merge of #101902 - jackh726:revert-static-hrtb-error, r=nikomatsakis
...
Partially revert #101433
reverts #101433 to fix #101844
We should get this into the beta cut, since the ICE is getting hit quite a bit.
2022-09-16 16:46:14 +00:00
Rageking8
b248a6faf9
add help for invalid inline argument
2022-09-16 23:57:08 +08:00
Jack Huey
92b759f517
Revert "Better errors for implied static bound"
...
This reverts commit c75817b0a7
.
2022-09-16 09:47:07 -04:00
Jack Huey
bba514b7b4
Revert "Use Predicate ConstraintCategory when normalizing"
...
This reverts commit aae37f8763
.
2022-09-16 09:01:28 -04:00
bors
54f20bbb8a
Auto merge of #101895 - GuillaumeGomez:rollup-ured85q, r=GuillaumeGomez
...
Rollup of 7 pull requests
Successful merges:
- #101494 (rustdoc mobile: move notable traits to return type)
- #101813 (Extend CSS check to CSS variables)
- #101825 (Fix back RPIT changes)
- #101843 (Suggest associated const for incorrect use of let in traits)
- #101859 (Slight vertical formatting)
- #101868 (rustdoc: use more precise URLs for jump-to-definition links)
- #101877 (rustdoc: remove no-op CSS `.block { padding: 0 }`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-16 12:43:22 +00:00
Oli Scherer
dab1074b91
Only generate OpaqueCast
for opaque types
2022-09-16 11:37:50 +00:00
Oli Scherer
40e2de8c41
Revert "Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank""
...
This reverts commit 4a742a691e
.
2022-09-16 11:36:39 +00:00
Oli Scherer
5d664f7a8f
Merge two arguments into one
2022-09-16 11:36:09 +00:00
Rageking8
d433efa649
more simple formatting
2022-09-16 19:07:42 +08:00
Guillaume Gomez
9a72ded562
Rollup merge of #101859 - Rageking8:slight-vertical-formatting, r=compiler-errors
...
Slight vertical formatting
2022-09-16 13:07:18 +02:00
Guillaume Gomez
72d9e0821e
Rollup merge of #101843 - chenyukang:fix-101797, r=oli-obk
...
Suggest associated const for incorrect use of let in traits
Fixes #101797
2022-09-16 13:07:18 +02:00
Guillaume Gomez
8ba133fa7b
Rollup merge of #101825 - spastorino:fix-rpit-changes, r=oli-obk
...
Fix back RPIT changes
r? `@oli-obk`
cc `@compiler-errors`
2022-09-16 13:07:17 +02:00
bors
2d1aa57d1e
Auto merge of #101860 - oli-obk:information_throwing, r=compiler-errors
...
Don't throw away information just to recompute it again
also allows making some functions private.
2022-09-16 09:57:32 +00:00
Dylan DPC
28b4c62382
Rollup merge of #101787 - compiler-errors:cache-rpitit, r=petrochenkov
...
cache `collect_trait_impl_trait_tys`
Micro-optimization for RPITITs
2022-09-16 11:17:01 +05:30
Dylan DPC
edf9e5eb63
Rollup merge of #101753 - oli-obk:tait_closure_args, r=compiler-errors
...
Prefer explict closure sig types over expected ones
fixes #100800
Previously we only checked that given closure arguments are equal to expected closure arguments, but now we choose the given closure arguments for the signature that is used when type checking the closure body, and keep the other signature for the type of the closure as seen outside of it.
2022-09-16 11:17:01 +05:30
Dylan DPC
61126d3611
Rollup merge of #101738 - dpaoliello:linkname, r=petrochenkov
...
Fix `#[link kind="raw-dylib"]` to respect `#[link_name]`
Issue Details:
When using `#[link kind="raw-dylib"]` (#58713 ), the Rust compiler ignored any `#[link_name]` attributes when generating the import library and so the resulting binary would fail to link due to missing symbols.
Fix Details:
Use the name from `#[link_name]` if present when generating the `raw-dylib` import library, otherwise default back to the actual symbol name.
2022-09-16 11:17:00 +05:30
Takayuki Maeda
7510a1b15e
remove an unused struct field
2022-09-16 14:34:05 +09:00
Takayuki Maeda
527292a1a6
do not suggest a placeholder to const and static without a type
2022-09-16 11:24:14 +09:00
bors
cf9ed0dd58
Auto merge of #101831 - compiler-errors:issue-75899, r=jackh726
...
Normalize struct field types in `confirm_builtin_unsize_candidate`
Fixes #75899
---
edited to move the normalization into `confirm_builtin_unsize_candidate` instead of the coercion code.
2022-09-15 21:06:36 +00:00
b-naber
d77248e6d2
nits
2022-09-15 22:27:41 +02:00
est31
173eb6f407
Only enable the let_else feature on bootstrap
...
On later stages, the feature is already stable.
Result of running:
rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-15 21:06:45 +02:00
est31
5633e863bd
Remove feature gate from let else suggestion
...
The let else suggestion added by 0d92752b8a
does not need a feature gate any more.
2022-09-15 21:06:45 +02:00
est31
bca3cf7e86
Stabilize the let_else feature
2022-09-15 21:06:45 +02:00
bors
df34db9b03
Auto merge of #101858 - oli-obk:lift_derive, r=lcnr
...
derive various impls instead of hand-rolling them
r? `@lcnr`
This may not have been what you asked for in 964b97e845 (r84051418)
but I got carried away while following the compiler team meeting today.
2022-09-15 18:14:29 +00:00
yukang
4bf7d2ca91
tweak suggestion
2022-09-16 01:09:26 +08:00
Camille GILLOT
c9c6c507b7
Do not fetch HIR node when iterating to find lint.
2022-09-15 18:40:03 +02:00
Oli Scherer
8aed75bee0
Don't throw away information just to recompute it again
2022-09-15 16:23:10 +00:00
Rageking8
6d7beafc87
slight vertical formatting
2022-09-15 23:51:43 +08:00
Oli Scherer
c6fcb1c6a3
Merge all TypeVisitable for &List<T>
impls into one generic one
2022-09-15 15:33:46 +00:00
bors
35a0407814
Auto merge of #101410 - dingxiangfei2009:fix-let-else-scoping, r=jackh726
...
Reorder nesting scopes and declare bindings without drop schedule
Fix #99228
Fix #99975
Storages are previously not declared before entering the `else` block of a `let .. else` statement. However, when breaking out of the pattern matching into the `else` block, those storages are recorded as scheduled for drops. This is not expected.
This MR fixes this issue by not scheduling the drops for those storages.
cc `@est31`
2022-09-15 15:19:40 +00:00
Oli Scherer
9d9306828c
Replace more manual TypeFoldable and TypeVisitable impls with derives
2022-09-15 15:05:03 +00:00
lcnr
5669ce1a28
change FnMutDelegate
to trait objects
2022-09-15 16:59:58 +02:00
Oli Scherer
a5ab8da1e2
derive TypeVisitable and TypeFoldable for mir types
2022-09-15 14:42:43 +00:00
Oli Scherer
d376012a43
Derive TypeFoldable and TypeVisitable for mir::PlaceElement
2022-09-15 13:43:44 +00:00
Oli Scherer
10c0560cd2
Resolve a FIXME
2022-09-15 13:37:34 +00:00
Oli Scherer
d4e986c1f0
derive various Lift impl instead of hand rolling them
2022-09-15 13:32:43 +00:00
bors
294f0eef73
Auto merge of #101173 - jyn514:simplify-macro-arguments, r=cjgillot
...
Further simplify the macros generated by `rustc_queries`
This doesn't actually move anything outside the macros, but it makes them simpler to read.
- Add a new `rustc_query_names` macro. This allows a much simpler syntax for the matchers in the macros passed to it as a callback.
- Convert `define_dep_nodes` and `alloc_once` to use `rustc_query_names`. This is possible because they only use the names
(despite the quite complicated matchers in `define_dep_nodes`, none of the other arguments are used).
- Get rid of `rustc_dep_node_append`.
r? `@cjgillot`
2022-09-15 11:54:03 +00:00
yukang
98e20c097c
fix #101797 : Suggest associated const for incorrect use of let in traits
2022-09-15 16:15:38 +08:00
SparrowLii
89fd6ae458
correct span, add help message and add UI test when query depth overflows
2022-09-15 16:05:44 +08:00
SparrowLii
44506f38e0
add note for layout_of
when query depth overflows
2022-09-15 16:05:00 +08:00
Matthias Krüger
ad154e41a1
Rollup merge of #100415 - WorksButNotTested:be8, r=wesleywiser
...
Add BE8 support
Built using the following `/config.toml`
```
changelog-seen = 2
[llvm]
download-ci-llvm = false
skip-rebuild = true
optimize = true
ninja = true
targets = "ARM;X86"
clang = false
[build]
target = ["x86_64-unknown-linux-gnu", "armeb-linux-gnueabi"]
docs = false
docs-minification = false
compiler-docs = false
[install]
prefix = "/home/user/x-tools/rust/"
[rust]
debug-logging=true
backtrace = true
incremental = true
[target.x86_64-unknown-linux-gnu]
[dist]
[target.armeb-linux-gnueabi]
cc = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-gcc"
cxx = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-g++"
ar = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-ar"
ranlib = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-ranlib"
linker = "/home/user/x-tools/armeb-linux-gnueabi/bin/armeb-linux-gnueabi-gcc"
llvm-config = "/home/user/x-tools/clang/bin/llvm-config"
llvm-filecheck = "/home/user/x-tools/clang/bin/FileCheck"
```
The following `.cargo/config` is needed inside any project directory:
```
[build]
target = "armeb-linux-gnueabi"
[target.armeb-linux-gnueabi]
linker = "armeb-linux-gnueabi-gcc"
```
2022-09-15 08:00:11 +02:00
Ding Xiang Fei
4a5d2a561c
add diagram to explain the MIR structure
2022-09-15 10:08:14 +08:00
Ding Xiang Fei
c7d1c9b66f
add explanatory note
2022-09-15 10:08:13 +08:00
Ding Xiang Fei
635b57c2ed
enclose else block in terminating scope
2022-09-15 10:08:12 +08:00
Ding Xiang Fei
34f0c4502f
supplement for the missing or incomplete comments
2022-09-15 10:08:11 +08:00
Ding Xiang Fei
1b87ce0d40
reorder nesting scopes and declare bindings without drop schedule
2022-09-15 10:07:54 +08:00
Michael Goulet
7893ca74e5
Normalize struct types in confirm_builtin_unsize_candidate
2022-09-15 01:20:36 +00:00
bors
2cb9a65684
Auto merge of #101620 - cjgillot:compute_lint_levels_by_def, r=oli-obk
...
Compute lint levels by definition
Lint levels are currently computed once for the whole crate. Any code that wants to emit a lint depends on this single `lint_levels(())` query. This query contains the `Span` for each attribute that participates in the lint level tree, so any code that wants to emit a lint basically depends on the spans in all files in the crate.
Contrary to hard errors, we do not clear the incremental session on lints, so this implicit world dependency pessimizes incremental reuse. (And is furthermore invisible for allowed lints.)
This PR completes https://github.com/rust-lang/rust/pull/99634 (thanks for the initial work `@fee1-dead)` and includes it in the dependency graph.
The design is based on 2 queries:
1. `lint_levels_on(HirId) -> FxHashMap<LintId, LevelAndSource>` which accesses the attributes at the given `HirId` and processes them into lint levels. The `TyCtxt` is responsible for probing the HIR tree to find the user-visible level.
2. `lint_expectations(())` which lists all the `#[expect]` attributes in the crate.
This PR also introduces the ability to reconstruct a `HirId` from a `DepNode` by encoding the local part of the `DefPathHash` and the `ItemLocalId` in the two `u64` of the fingerprint. This allows for the dep-graph to directly recompute `lint_levels_on` directly, without having to force the calling query.
Closes https://github.com/rust-lang/rust/issues/95094 .
Supersedes https://github.com/rust-lang/rust/pull/99634 .
2022-09-15 00:01:17 +00:00
bors
750bd1a7ff
Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot
...
make `mk_attr_id` part of `ParseSess`
Updates #48685
The current `mk_attr_id` uses the `AtomicU32` type, which is not very efficient and adds a lot of lock contention in a parallel environment.
This PR refers to the task list in #48685 , uses `mk_attr_id` as a method of the `AttrIdGenerator` struct, and adds a new field `attr_id_generator` to `ParseSess`.
`AttrIdGenerator` uses the `WorkerLocal`, which has two advantages: 1. `Cell` is more efficient than `AtomicU32`, and does not increase any lock contention. 2. We put the index of the work thread in the first few bits of the generated `AttrId`, so that the `AttrId` generated in different threads can be easily guaranteed to be unique.
cc `@cjgillot`
2022-09-14 20:52:18 +00:00
Michael Goulet
4cdf264e6f
cache collect_trait_impl_trait_tys
2022-09-14 20:50:52 +00:00
Santiago Pastorino
45d8049387
Get rid of 'b lifetime in lower_param_bounds_mut
2022-09-14 17:40:51 -03:00
Santiago Pastorino
861055094c
Pass ImplTraitContext as &, there's no need for that to be &mut
2022-09-14 17:39:52 -03:00
Santiago Pastorino
669f2d4550
Revert "Rollup merge of #101496 - spastorino:lower_lifetime_binder_api_changes, r=oli-obk"
...
This reverts commit 953a6b3da7
, reversing
changes made to b5ffbd32d4
.
2022-09-14 17:26:37 -03:00
bors
6153d3cbe6
Auto merge of #101212 - eholk:dyn-star, r=compiler-errors
...
Initial implementation of dyn*
This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/ ). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things:
* Introduce `dyn_star` feature flag
* Adds parsing for `dyn* Trait` types
* Defines `dyn* Trait` as a sized type
* Adds support for explicit casts, like `42usize as dyn* Debug`
* Including const evaluation of such casts
* Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope
* Adds codegen for method calls, at least for methods that take `&self`
Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits.
Joint work with `@nikomatsakis` and `@compiler-errors.`
r? `@bjorn3`
2022-09-14 18:10:51 +00:00
Your Name
73d6dd5098
Changes to rename target and update docs
2022-09-14 18:38:01 +01:00
Camille Gillot
cb2949e642
Update compiler/rustc_macros/src/query.rs
2022-09-14 19:11:53 +02:00
Camille GILLOT
42a92eb54b
Correct Key impl for HirId.
2022-09-14 19:06:48 +02:00
Camille GILLOT
1fcc440391
Add FIXME.
2022-09-14 19:06:39 +02:00
Camille GILLOT
fca0d8a10e
Comment LintLevelSets.
2022-09-14 19:06:30 +02:00
Camille GILLOT
bb61842048
Remove unused tool_name.
2022-09-14 19:06:09 +02:00
Camille GILLOT
ad09abc194
Move some code and add comments.
2022-09-14 19:06:05 +02:00
Camille GILLOT
bd45139cb0
Allow query system to recover a HirId.
2022-09-14 19:04:13 +02:00
Jack Huey
d657d1f4a1
Disallow defaults on type GATs
2022-09-14 13:03:01 -04:00
Deadbeef
eb19a8a620
Compute lint_levels
by definition
2022-09-14 19:02:44 +02:00
b-naber
6af8fb7936
address review again
2022-09-14 17:30:25 +02:00
hanar3
dddfb7db24
Improve error message for unsupported crate
2022-09-14 12:19:42 -03:00
Bryanskiy
d7b9221405
change AccessLevels representation
2022-09-14 18:11:00 +03:00
Dylan DPC
94bc08d94f
Rollup merge of #101772 - est31:replace_placeholder_diagnostics, r=jackh726
...
Also replace the placeholder for the stable_features lint
Follow up of #101215 and #100591 .
Fixes #101766
2022-09-14 19:26:21 +05:30
Dylan DPC
430123164f
Rollup merge of #101433 - jackh726:better-static-placeholder-error, r=compiler-errors
...
Emit a note that static bounds from HRTBs are a bug
This note isn't perfect, but opening this to either 1) land as is or 2) get some feedback on how to improve it
Let r? `@compiler-errors` and cc. `@nikomatsakis`
2022-09-14 19:26:18 +05:30
Oli Scherer
7794ea5854
Prefer explict closure sig types over expected ones
2022-09-14 10:44:56 +00:00
bors
c97922dca5
Auto merge of #99443 - jam1garner:mips-virt-feature, r=nagisa
...
Add support for MIPS VZ ISA extension
[Link to relevant LLVM line where virt extension is specified](83fab8cee9/llvm/lib/Target/Mips/Mips.td (L172-L173)
)
This has been tested on mips-unknown-linux-musl with a target-cpu that is >= MIPS32 5 and `target-features=+virt`. The example was checked in a disassembler to ensure the correct assembly sequence was being generated using the virtualization instructions.
Needed additional work:
* MIPS is missing from [the Rust reference CPU feature lists](https://doc.rust-lang.org/reference/attributes/codegen.html#available-features )
Example docs for later:
```md
#### `mips` or `mips64`
This platform requires that `#[target_feature]` is only applied to [`unsafe`
functions][unsafe function]. This target's feature support is currently unstable
and must be enabled by `#![feature(mips_target_feature)]` ([Issue #44839 ])
[Issue #44839 ]: https://github.com/rust-lang/rust/issues/44839
Further documentation on these features can be found in the [MIPS Instruction Set
Reference Manual], or elsewhere on [mips.com].
[MIPS Instruction Set Reference Manual]: https://s3-eu-west-1.amazonaws.com/downloads-mips/documents/MD00086-2B-MIPS32BIS-AFP-6.06.pdf
[developer.arm.com]: https://www.mips.com/products/architectures/ase/
Feature | Implicitly Enables | Description
---------------|--------------------|-------------------
`fp64` | | 64-bit Floating Point
`msa` | | "MIPS SIMD Architecture"
`virt` | | Virtualization instructions (VZ ASE)
```
If the above is good I can also submit a PR for that if there's interest in documenting it while it's still unstable. Otherwise that can be dropped, I just wrote it before realizing it was possibly not a good idea.
Relevant to #44839
2022-09-14 08:21:25 +00:00
bors
a0d1df4a5d
Auto merge of #101709 - nnethercote:simplify-visitors-more, r=cjgillot
...
Simplify visitors more
A successor to #100392 .
r? `@cjgillot`
2022-09-14 05:21:14 +00:00
bors
a5b58addae
Auto merge of #101307 - jyn514:simplify-storage, r=cjgillot
...
Simplify caching and storage for queries
I highly recommend reviewing commit-by-commit; each individual commit is quite small but it can be hard to see looking at the overall diff that the behavior is the same. Each commit depends on the previous.
r? `@cjgillot`
2022-09-14 02:39:51 +00:00
est31
3a38d566bd
Also replace the placeholder for the stable_features lint
2022-09-14 03:28:54 +02:00
SparrowLii
bfc4f2e189
add debug assertion for max attr_id
2022-09-14 08:49:12 +08:00
SparrowLii
1a3ecbdb6a
make mk_attr_id
part of ParseSess
2022-09-14 08:49:10 +08:00
Jack Huey
aae37f8763
Use Predicate ConstraintCategory when normalizing
2022-09-13 20:18:49 -04:00
Jack Huey
c75817b0a7
Better errors for implied static bound
2022-09-13 20:18:04 -04:00
Jack Huey
ff623ffc39
Cleanup retrieve_closure_constraint_info
2022-09-13 19:58:53 -04:00
Jack Huey
2be6301857
Remove unused body args
2022-09-13 19:58:53 -04:00
Eric Holk
cf04547b0b
Address code review comments
2022-09-13 14:50:12 -07:00
bors
17cbdfd071
Auto merge of #101777 - matthiaskrgr:rollup-x2dyaa2, r=matthiaskrgr
...
Rollup of 7 pull requests
Successful merges:
- #101266 (translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final)
- #101737 (rustdoc: remove no-op CSS `.search-results .result-name > span`)
- #101752 (Improve Attribute doc methods)
- #101754 (Fix doc of log function)
- #101759 (⬆️ rust-analyzer)
- #101765 (Add documentation for TyCtxt::visibility)
- #101770 (Rustdoc-Json: Don't loose subitems of foreign traits.)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-13 21:05:21 +00:00
Matthias Krüger
68dc6396a5
Rollup merge of #101765 - GuillaumeGomez:tyctxt-visibility-doc, r=jyn514
...
Add documentation for TyCtxt::visibility
We encountered this issue while working on https://github.com/rust-lang/rust/pull/98450 .
cc ``@lqd``
r? ``@cjgillot``
2022-09-13 22:25:38 +02:00
Matthias Krüger
8fa8021451
Rollup merge of #101752 - GuillaumeGomez:improve-attr-docs, r=lqd
...
Improve Attribute doc methods
r? `@lqd`
2022-09-13 22:25:35 +02:00
Matthias Krüger
bc8ec5e5fa
Rollup merge of #101266 - LuisCardosoOliveira:translation-rustcsession-pt3, r=davidtwco
...
translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final
# Description
This is the final part of the rustc_session https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883 .
Please only review this [commit](a545347037
). The other ones are from the PR https://github.com/rust-lang/rust/pull/101041# that is not yet merged.
In this PR, we migrate the file `output.rs`
2022-09-13 22:25:34 +02:00