lcnr
d398b54de6
do not implement type traversal for EarlyBinder
2022-09-19 11:28:32 +02:00
bors
503e19d01e
Auto merge of #101629 - compiler-errors:issue-101623, r=sanxiyn
...
Be careful about `expr_ty_adjusted` when noting block tail type
Fixes #101623
2022-09-19 07:41:54 +00:00
bors
efa717bc2d
Auto merge of #101924 - jackh726:revert-static-hrtb-error, r=compiler-errors
...
Re-add HRTB implied static bug note
r? `@compiler-errors` since you reviewed it previously
I deleted a `normalize` call and forgot about it. Whoops.
2022-09-19 04:56:14 +00:00
Josh Stone
fac12e25dd
Use LLVM C-API to build atomic cmpxchg and fence
2022-09-18 16:01:57 -07:00
The 8472
40b37268eb
use partition_point instead of binary_search when looking up source lines
...
In local benchmarks this results in 0.4% fewer cycles in a critical sequential
section when compiling libcore.
2022-09-19 00:48:14 +02:00
Ralf Jung
9fa3171015
interpret: expose generate_stacktrace without full InterpCx
2022-09-18 20:51:04 +02:00
Deadbeef
ee96ae0a32
make projection bounds with const bounds satisfy const
2022-09-18 18:05:30 +00:00
Ralf Jung
eed6fdb0eb
clarify that linting is not a semantic change
2022-09-18 14:14:42 +02:00
Ding Xiang Fei
48c1c1d190
avoid duplicating StorageLive in let-else
2022-09-18 12:10:53 +08:00
bors
65c16dc3a8
Auto merge of #101960 - matthiaskrgr:rollup-1l5v7ip, r=matthiaskrgr
...
Rollup of 5 pull requests
Successful merges:
- #101151 (Document x86_64-fortanix-unknown-sgx platform)
- #101912 (Update `unicode-rs` crates to Unicode 15)
- #101923 (Don't add rustdoc's CSS to other doc pages)
- #101953 (Fix tooltip display for error codes)
- #101954 (rustdoc: remove redundant `.location a { font-weight: 500 }`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-18 03:40:01 +00:00
Matthias Krüger
46ebe7cf41
Rollup merge of #101912 - crlf0710:compiler_update_unicode_15, r=Manishearth
...
Update `unicode-rs` crates to Unicode 15
r? `@Manishearth`
2022-09-18 02:55:29 +02:00
bors
bc7b17cfe3
Auto merge of #101862 - cjgillot:lint-regression, r=oli-obk
...
Do not fetch HIR node when iterating to find lint.
Addresses the regression in https://github.com/rust-lang/rust/pull/101620
2022-09-18 00:46:14 +00:00
hanar3
0405a5d4e9
improve error message for when a query isn't supported
2022-09-17 20:25:37 -03:00
bors
5253b0a0a1
Auto merge of #101949 - matthiaskrgr:rollup-xu5cqnd, r=matthiaskrgr
...
Rollup of 7 pull requests
Successful merges:
- #101093 (Initial version of 1.64 release notes)
- #101713 (change AccessLevels representation)
- #101821 (Bump Unicode to version 15.0.0, regenerate tables)
- #101826 (Enforce "joined()" and "joined_with_noop()" test)
- #101835 (Allow using vendoring when running bootstrap from outside the source root)
- #101942 (Revert "Copy stage0 binaries into stage0-sysroot")
- #101943 (rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-17 22:04:28 +00:00
Matthias Krüger
a6b34cd928
Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkov
...
change AccessLevels representation
Part of RFC (https://github.com/rust-lang/rust/issues/48054 ). This patch implements effective visibility table with basic methods and change AccessLevels table representation according to it.
r? ``@petrochenkov``
2022-09-17 23:30:49 +02:00
Matthias Krüger
4757d2d57e
Rollup merge of #101801 - SparrowLii:query_depth_note, r=estebank
...
add note for `layout_of` when query depth overflows
Fixes #101747
Added `try_find_layout_root` function to add a note for `layout_of` when query depth overflows. This would make the error in #101747 look like this:
```
error: queries overflow the depth limit!
|
note: Query depth increased by 66 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`!
--> D:\rust-backup\parallel_rust\query_depth.rs:40:1
|
40 | fn main() {
| ^^^^^^^^^
error: aborting due to previous error
```
cc ``@semicoleon``
2022-09-17 19:27:06 +02:00
Jack Huey
e7ca6e1b47
Use Predicate ConstraintCategory when normalizing
2022-09-17 11:46:05 -04:00
Jack Huey
1eb71f0893
Add back in normalize call
2022-09-17 11:46:04 -04:00
bors
48de123d7a
Auto merge of #101857 - lcnr:make-dyn-again, r=jackh726
...
change `FnMutDelegate` to trait objects
cc #100016 as mentioned in the last t-compiler meeting
r? `@jackh726`
2022-09-17 13:37:48 +00:00
Dylan DPC
7c55c992ab
Rollup merge of #101807 - jackh726:no-gat-defaults, r=lcnr
...
Disallow defaults on type GATs
Fixes #99205
2022-09-17 15:31:08 +05:30
Dylan DPC
4c64c14420
Rollup merge of #101790 - TaKO8Ki:do-not-suggest-placeholder-to-const-and-static-without-type, r=compiler-errors
...
Do not suggest a placeholder to const and static without a type
Fixes #101755
2022-09-17 15:31:08 +05:30
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
yukang
484b612909
use subdiagnostic for logical negation, bitwise not
2022-09-16 14:41:42 +08: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
Deadbeef
5ead742e18
remap ParamEnv with obligation
2022-09-16 12:08:46 +08:00
Deadbeef
08aeb1aa9b
unconditionally remap to nonconst in borrowck
2022-09-16 12:08:46 +08:00
Deadbeef
f8813cf10e
do const trait method bounds check later in rustc_const_eval
2022-09-16 11:48:43 +08:00
Deadbeef
77b0c47b82
Normalize param_env for trait assoc consts in typeck
2022-09-16 11:48:43 +08:00
Deadbeef
07608bd60e
fix const_trait
unstable message
2022-09-16 11:48:43 +08:00
Deadbeef
4231661789
Do not require const predicates to hold when checking if a projection type is wf
2022-09-16 11:48:42 +08:00
Deadbeef
81b1810cd7
Require #[const_trait]
for const
impl
s
2022-09-16 11:48:42 +08: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
yukang
f43562b95b
more tweak on diagnostic messages
2022-09-15 22:39:16 +08: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
2194fc957a
fix 101793, fix the wording of help msg for bitwise not
2022-09-15 17:33:28 +08: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