bors
2f2243c9b6
Auto merge of #99843 - oli-obk:is_useful_perf, r=compiler-errors
...
Some `is_useful` cleanups
#98582 was reverted because it was a perf regression.
https://github.com/rust-lang/rust/pull/99806 reintroduces the changes, but this PR picks individual ones that have no regressions.
2022-08-04 07:35:33 +00:00
Camille GILLOT
957548183d
Remove trait_of_item query.
2022-08-01 21:39:26 +02:00
Camille GILLOT
d7ea161b7e
Remove DefId from AssocItemContainer.
2022-08-01 21:38:45 +02:00
Matthias Krüger
8db3d7cfb6
Rollup merge of #99911 - cjgillot:no-guess, r=davidtwco
...
Remove some uses of `guess_head_span`
That function cuts a span at the first occurrence of `{`. Using `def_span` is almost always more precise.
2022-08-01 16:49:31 +02:00
Dylan DPC
403c1b3802
Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot
...
Use LocalDefId for closures more
2022-07-31 17:36:40 +05:30
Cameron Steffen
cf2433a74f
Use LocalDefId for closures more
2022-07-30 15:59:17 -05:00
Dylan DPC
c668820365
Rollup merge of #99311 - kckeiks:clean-up-body-owner-methods, r=cjgillot
...
change maybe_body_owned_by to take local def id
Issue https://github.com/rust-lang/rust/issues/96341
r? `@cjgillot`
2022-07-30 20:39:46 +05:30
Yuki Okushi
955091be8f
Rollup merge of #99518 - dingxiangfei2009:let-else-additional-tests, r=oli-obk
...
Let-else: break out scopes when a let-else pattern fails to match
This PR will commit to a new behavior so that values from initializer expressions are dropped earlier when a let-else pattern fails to match.
Fix #98672 .
Close #93951 .
cc `@camsteffen` `@est31`
2022-07-30 07:39:49 +09:00
Miguel Guarniz
0c609a4c1f
Change enclosing_body_owner to return LocalDefId
...
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:26:10 -04:00
Miguel Guarniz
16513d689e
Rename local_did to def_id
...
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:26:10 -04:00
Miguel Guarniz
25bdc8965e
Change maybe_body_owned_by to take local def id
...
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:25:58 -04:00
Camille GILLOT
a09b7ebfd3
Use DefKind instead of FnKind for recursion lint.
2022-07-29 18:10:43 +02:00
Camille GILLOT
6733bc3066
Remove guess_head_span.
2022-07-28 23:14:04 +02:00
Oli Scherer
803d374f9b
Pass PatCtxt instead of passing MatchCtxt + Ty separately
2022-07-28 08:49:39 +00:00
Oli Scherer
544de44a6b
Don't pass (the rather large) PatCtxt
by value
2022-07-28 08:44:49 +00:00
Oli Scherer
970ff3d45d
Move constructor into the branch that actually uses it
2022-07-28 08:33:36 +00:00
Guillaume Gomez
9e7b7d5e1c
Rollup merge of #99651 - compiler-errors:fn-and-raw-ptr-in-const-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 #99641
2022-07-27 17:55:04 +02:00
Takayuki Maeda
051e98b7bf
avoid &str
/Symbol
to String
conversions
2022-07-25 22:40:00 +09:00
Michael Goulet
10b69ab0d2
Remove non-descriptive boolean from search_for_structural_match_violation
2022-07-25 03:39:23 +00:00
Michael Goulet
c1f54c30bb
Get rid of redundant NonStructuralMatchTyKind
2022-07-25 03:39:22 +00:00
Michael Goulet
1152e70363
Deeply deny fn and raw ptrs in const generics
2022-07-25 03:39:22 +00:00
Ding Xiang Fei
9b56640106
break out scopes when let-else fails to match
2022-07-21 00:35:43 +08:00
Oli Scherer
4a742a691e
Revert "Rollup merge of #98582 - oli-obk:unconstrained_opaque_type, r=estebank"
...
This reverts commit 6f8fb911ad
, reversing
changes made to 7210e46dc6
.
2022-07-20 07:55:58 +00:00
Michael Goulet
6d2bd541e0
use body's param-env when checking if type needs drop
2022-07-17 10:56:12 -07:00
Caio
3266460749
Stabilize let_chains
2022-07-16 20:17:58 -03:00
Oli Scherer
57e9f7a556
Infer wildcard type from other patterns at every pattern level
2022-07-15 15:56:17 +00:00
Oli Scherer
92e470a1de
Move constructor into the branch that actually uses it
2022-07-15 15:56:17 +00:00
Oli Scherer
ea68ce7fac
Revert a hack that only ever worked on level deep
2022-07-15 15:56:17 +00:00
Oli Scherer
728c7e8bda
Allow destructuring opaque types, since the patterns constrain the opaque types
2022-07-15 15:56:17 +00:00
Oli Scherer
12457f814c
Some tracing helpers
2022-07-15 15:56:16 +00:00
Oli Scherer
0c6918fe21
Reuse a helper method instead of manually rolling it
2022-07-15 15:56:16 +00:00
Oli Scherer
7a8a048b58
Remove early return that would likely have caused miscompilations if it ever happened
2022-07-15 15:56:16 +00:00
Oli Scherer
eeb10335ce
Pass one argument instead of fetching two fields of it at every call site
2022-07-15 15:56:16 +00:00
Oli Scherer
a034446fae
Add some tracing instrumentation
2022-07-15 15:56:16 +00:00
Oli Scherer
84a444a1f4
Introduce opaque type to hidden type projection
2022-07-15 15:49:22 +00:00
bors
f1a8854f9b
Auto merge of #99231 - Dylan-DPC:rollup-0tl8c0o, r=Dylan-DPC
...
Rollup of 5 pull requests
Successful merges:
- #97720 (Always create elided lifetime parameters for functions)
- #98315 (Stabilize `core::ffi:c_*` and rexport in `std::ffi`)
- #98705 (Implement `for<>` lifetime binder for closures)
- #99126 (remove allow(rustc::potential_query_instability) in rustc_span)
- #99139 (Give a better error when `x dist` fails for an optional tool)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-14 11:00:30 +00:00
Dylan DPC
e5a86d7358
Rollup merge of #98705 - WaffleLapkin:closure_binder, r=cjgillot
...
Implement `for<>` lifetime binder for closures
This PR implements RFC 3216 ([TI](https://github.com/rust-lang/rust/issues/97362 )) and allows code like the following:
```rust
let _f = for<'a, 'b> |a: &'a A, b: &'b B| -> &'b C { b.c(a) };
// ^^^^^^^^^^^--- new!
```
cc ``@Aaron1011`` ``@cjgillot``
2022-07-14 14:14:21 +05:30
bors
0ed9c64c3e
Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiser
...
Rename `debugging_opts` to `unstable_opts`
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.
cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options
r? `@Amanieu` cc `@nikic` `@joshtriplett`
2022-07-14 08:14:31 +00:00
Joshua Nelson
3c9765cff1
Rename debugging_opts
to unstable_opts
...
This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`).
Rename it to be more clear.
2022-07-13 17:47:06 -05:00
Ralf Jung
e4593ef0f2
assigning to a union field can never drop now
2022-07-13 18:27:28 -04:00
Maybe Waffle
df4fee9841
Add an indirection for closures in hir::ExprKind
...
This helps bring `hir::Expr` size down, `Closure` was the biggest
variant, especially after `for<>` additions.
2022-07-12 21:00:13 +04:00
Ding Xiang Fei
5374688e1d
add tests for async await
2022-07-11 23:20:39 +02:00
Ding Xiang Fei
1cd30e7b32
move else block into the Local
struct
2022-07-11 23:20:37 +02:00
Ding Xiang Fei
6c529ded86
lower let-else in MIR instead
2022-07-11 23:20:36 +02:00
Dylan DPC
9fc297a2ae
Rollup merge of #99140 - TaKO8Ki:implement-is-accessible-span, r=fee1-dead
...
Implement `SourceMap::is_span_accessible`
This patch adds `SourceMap::is_span_accessible` and replaces `span_to_snippet(span).is_ok()` and `span_to_snippet(span).is_err()` with it. This removes a `&str` to `String` conversion.
2022-07-11 15:19:32 +05:30
Takayuki Maeda
018155c3a2
rename a method
2022-07-11 16:51:19 +09:00
Takayuki Maeda
12d11e9a35
implement is_accessible_span
2022-07-11 11:36:15 +09:00
Michael Goulet
a1634642e0
Deny floats even when adt_const_params is enabled
2022-07-11 00:04:00 +00:00
Ralf Jung
4e7aaf1f44
tweak names and output and bless
2022-07-09 07:43:56 -04:00
Ralf Jung
ac265cdc19
review feedback
2022-07-09 07:27:29 -04:00