Commit Graph

18041 Commits

Author SHA1 Message Date
lcnr
b93713fb99 manually inline and rm visit_abstract_const_expr 2022-10-19 10:15:46 +02:00
lcnr
c5c6ef7029 stop folding UnevaluatedConst 2022-10-19 10:15:46 +02:00
lcnr
116d35d401 const_evaluatable_unchecked to const eval 2022-10-18 16:31:56 +02:00
lcnr
660ca48041 change ConstEvaluatable to use ty::Const 2022-10-18 16:09:04 +02:00
bors
98a5ac269c Auto merge of #102543 - daym:patch-1, r=joshtriplett
Remove "execute" bit from lock file permissions

Previously, flock would set the "execute" bit on Rust lock files. That makes no sense.

This patch clears the "execute" bit on Rust lock files.

See issue #102531.
2022-10-18 02:04:24 +00:00
Danny Milosavljevic
e07e5104fe Remove execute bit from lock file permissions 2022-10-17 21:10:46 +02:00
bors
9c2797de22 Auto merge of #103151 - matthiaskrgr:rollup-t3mmnsg, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #102454 (Suggest parentheses for possible range method calling)
 - #102466 (only allow `ConstEquate` with `feature(gce)`)
 - #102945 (Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false)
 - #103091 (rustdoc: remove unused HTML class `sidebar-title`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-17 17:05:17 +00:00
Matthias Krüger
d02a221d31
Rollup merge of #102945 - compiler-errors:placeholder-region-outlives, r=lcnr
Do not register placeholder `RegionOutlives` obligations when `considering_regions` is false

**NOTE:** I'm kinda just putting this up for discussion. I'm not certain this is correct...?

This was introduced in [`608625d`](608625dae9 (diff-6e54b18681342ec725d75591dbf384ad08cd73df29db00485fe51b4e90f76ff7R361)).

Interestingly, we only check `data.has_placeholders()` for `RegionOutlives`, and not for `TypeOutlives`... why? For the record, that different treatment between `RegionOutlives` and `TypeOutlives` is why the fix "The compiling succeeds when all `'a : 'b` are replaced with `&'a () : 'b`" in #100689 _"works"_, but it seems like an implementation detail considering this.

Also, why do we care about placeholder regions being registered if `considering_regions` is false? It doesn't seem to affect any UI tests, for example.

r? `@lcnr`

Fixes #102899
Fixes #100689
2022-10-17 17:15:50 +02:00
Matthias Krüger
e91fd0b514
Rollup merge of #102466 - lcnr:const-equate-uwu, r=BoxyUwU
only allow `ConstEquate` with `feature(gce)`
2022-10-17 17:15:50 +02:00
Matthias Krüger
66de34b035
Rollup merge of #102454 - chenyukang:fix-102396-missing-parentheses, r=lcnr
Suggest parentheses for possible range method calling

Fixes #102396
2022-10-17 17:15:49 +02:00
bors
a9d1cafa87 Auto merge of #102355 - lcnr:bye-bye-type-traversal, r=oli-obk
remove type traversal for mir constants

r? `@oli-obk` cc `@b-naber`
2022-10-17 14:19:28 +00:00
Matthias Krüger
bb3f60b847
Rollup merge of #103139 - smoelius:patch-2, r=Dylan-DPC
Duplicate comment in mod.rs
2022-10-17 13:11:08 +02:00
lcnr
d04bff6583 add inline to TrivialTypeTraversalImpls 2022-10-17 10:54:03 +02:00
lcnr
face090ef1 rm try_normalize_mir_const_after_erasing_regions 2022-10-17 10:54:03 +02:00
lcnr
e8150fa60c mir constants: type traversing bye bye 2022-10-17 10:54:01 +02:00
bors
c19a893f87 Auto merge of #103116 - TaKO8Ki:fix-103053, r=lcnr
Fix `own_substs` ICE

Fixes #103053
2022-10-17 08:04:52 +00:00
Samuel Moelius
bf3a29f590
Duplicate comment in mod.rs 2022-10-17 03:54:56 -04:00
bors
1536ab1b38 Auto merge of #103096 - petrochenkov:indresdoc, r=cjgillot
resolve: Shadow erroneous glob imports with erroneous single imports

If such shadowing doesn't happen we end up in a weird state that may cause ICEs.
(In non-erroneous cases single imports always shadow glob imports too.)

Fixes https://github.com/rust-lang/rust/issues/100047
Fixes https://github.com/rust-lang/rust/issues/100241
2022-10-17 02:06:25 +00:00
yukang
151001c1cb trivial fix for comments feedback 2022-10-17 08:32:08 +08:00
bors
a501e6699e Auto merge of #103125 - matthiaskrgr:rollup-82xttcl, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #103087 (Documentation BTreeMap::append's behavior for already existing keys)
 - #103089 (Mark derived StructuralEq as automatically derived.)
 - #103102 (Clarify the possible return values of `len_utf16`)
 - #103109 (PhantomData: inline a macro that is used only once)
 - #103120 (rustdoc: Do not expect `doc(primitive)` modules to always exist)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-16 23:15:20 +00:00
Matthias Krüger
2c0bfbed43
Rollup merge of #103089 - cjgillot:automatic-structural-eq, r=oli-obk
Mark derived StructuralEq as automatically derived.

Fixes https://github.com/rust-lang/rust/issues/69952

Drive-by: use correct spans for generic params.
2022-10-16 22:36:05 +02:00
bors
b8b5caee04 Auto merge of #102026 - Bryanskiy:resolve_update, r=petrochenkov
Populate effective visibilities in 'rustc_resolve'

Next part of RFC https://github.com/rust-lang/rust/issues/48054.
previous: https://github.com/rust-lang/rust/pull/101713

`@rustbot` author
r? `@petrochenkov`
2022-10-16 20:34:38 +00:00
Bryanskiy
496ccd982c Populate effective visibilities in 'rustc_resolve' 2022-10-16 21:47:14 +03:00
Matthias Krüger
d6506cc0be
Rollup merge of #102953 - WaffleLapkin:better_docs_for_decorate_param, r=RalfJung
Improve docs for `struct_lint_level` function.

r? ``@RalfJung``

Does this answer your questions?
2022-10-16 17:51:31 +02:00
Ralf Jung
39375e14d7
fix typo 2022-10-16 16:47:55 +02:00
Takayuki Maeda
0b6fa0d418 fix own_substs ICE 2022-10-16 22:24:27 +09:00
bors
8be3ce9056 Auto merge of #102334 - compiler-errors:rpitit-substs-issue, r=cjgillot
Fix subst issues with return-position `impl Trait` in trait

1. Fix an issue where we were rebase impl substs onto trait method substs, instead of trait substs
2. Fix an issue where early-bound regions aren't being mapped correctly for RPITIT hidden types

Fixes #102301
Fixes #102310
Fixes #102334
Fixes #102918
2022-10-16 10:10:44 +00:00
bors
11432fe952 Auto merge of #102080 - yanchen4791:issue-99824-fix, r=cjgillot
Fix missing explanation of where the borrowed reference is used when the same borrow occurs multiple times due to loop iterations

Fix #99824.

Problem of the issue:
If a borrow occurs in a loop, the borrowed reference could be invalidated at the same place at next iteration of the loop. When this happens, the point where the borrow occurs is the same as the intervening point that might invalidate the reference in the loop. This causes a problem for the current code finding the point where the resulting reference is used, so that the explanation of the cause will be missing. As the second point of "explain all errors in terms of three points" (see [leveraging intuition framing errors in terms of points"](https://rust-lang.github.io/rfcs/2094-nll.html#leveraging-intuition-framing-errors-in-terms-of-points), this explanation is very helpful for user to understand the error.

In the current implementation, the searching region for finding the location where the borrowed reference is used is limited to between the place where the borrow occurs and the place where the reference is invalidated. If those two places happen to be the same, which indicates that the borrow and invalidation occur at the same place in a loop, the search will fail.

One solution to the problem is when these two places are the same,  find the terminator of the loop, and then use the location of the loop terminator instead of the location of the borrow for the region to find the place where the borrowed reference is used.
2022-10-16 07:40:56 +00:00
bors
e928a4656f Auto merge of #103105 - JohnTitor:rollup-x4ivrix, r=JohnTitor
Rollup of 6 pull requests

Successful merges:

 - #101717 (Add documentation about the memory layout of `UnsafeCell<T>`)
 - #102023 (Add MaybeUninit array transpose From impls)
 - #103033 (Update pkg-config)
 - #103080 (pretty: fix to print some lifetimes on HIR pretty-print)
 - #103082 (Surround type with backticks)
 - #103088 (Fix settings page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-16 04:54:29 +00:00
Yuki Okushi
b495c122e8
Rollup merge of #103082 - gimbles:patch-1, r=cjgillo
Surround type with backticks

Very smol PR. :)
2022-10-16 11:41:14 +09:00
Yuki Okushi
d08f4a6464
Rollup merge of #103080 - ohno418:fix-hir-pretty-print-lifetimes, r=cjgillot
pretty: fix to print some lifetimes on HIR pretty-print

HIR pretty-printer doesn't seem to print some lifetimes in types. This PR fixes that.

Closes https://github.com/rust-lang/rust/issues/85089
2022-10-16 11:41:13 +09:00
bors
75dbd5b8c3 Auto merge of #102931 - camsteffen:inline-overlapping-impls, r=cjgillot
Make `overlapping_impls` not generic

Trying to win back perf from #101632.
2022-10-16 02:05:30 +00:00
Vadim Petrochenkov
f767f2297d resolve: Shadow erroneous glob imports with erroneous single imports 2022-10-16 00:10:16 +04:00
Michael Goulet
4259f33305 typos 2022-10-15 17:49:32 +00:00
Michael Goulet
e994de803d Equate full fn signatures to infer all region variables 2022-10-15 17:46:05 +00:00
Michael Goulet
c1aa9bf849 Fix subst issues with RPITIT 2022-10-15 17:46:03 +00:00
Camille GILLOT
16e22e143d Mark derived StructuralEq as automatically derived. 2022-10-15 15:16:32 +00:00
Yutaro Ohno
7334526c38 pretty: fix to print some lifetimes on HIR pretty-print 2022-10-15 23:34:21 +09:00
bors
b8c35ca26b Auto merge of #102895 - Nilstrieb:query-cleanups, r=cjgillot
Get rid of `rustc_query_description!`

**I am not entirely sure whether this is an improvement and would like to get your feedback on it.**

Helps with #96524.

Queries can provide an arbitrary expression for their description and their caching behavior. Before, these expressions where stored in a `rustc_query_description` macro emitted by the `rustc_queries` macro, and then used in `rustc_query_impl` to fill out the methods for the `QueryDescription` trait.

Instead, we now emit two new modules from `rustc_queries` containing the functions with the expressions. `rustc_query_impl` calls these functions now instead of invoking the macro.

Since we are now defining some of the functions in `rustc_middle::query`, we now need all the imports for the key types mthere as well.

r? `@cjgillot`
2022-10-15 13:30:15 +00:00
bors
c93ef33700 Auto merge of #103083 - Dylan-DPC:rollup-97cvwdv, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #102773 (Use semaphores for thread parking on Apple platforms)
 - #102884 (resolve: Some cleanup, asserts and tests for lifetime ribs)
 - #102954 (Add missing checks for `doc(cfg_hide(...))`)
 - #102998 (Drop temporaries created in a condition, even if it's a let chain)
 - #103003 (Fix `suggest_floating_point_literal` ICE)
 - #103041 (Update cargo)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-15 10:45:36 +00:00
Dylan DPC
65dca11514
Rollup merge of #103003 - TaKO8Ki:fix-102989, r=compiler-errors
Fix `suggest_floating_point_literal` ICE

Fixes #102989
2022-10-15 15:45:33 +05:30
Dylan DPC
b79ad57ad7
Rollup merge of #102998 - nathanwhit:let-chains-drop-order, r=eholk
Drop temporaries created in a condition, even if it's a let chain

Fixes #100513.

During the lowering from AST to HIR we wrap expressions acting as conditions in a `DropTemps` expression so that any temporaries created in the condition are dropped after the condition is executed. Effectively this means we transform

```rust
if Some(1).is_some() { .. }
```

into (roughly)

```rust
if { let _t = Some(1).is_some(); _t } { .. }
```

so that if we create any temporaries, they're lifted into the new scope surrounding the condition, so for example something along the lines of

```rust
if { let temp = Some(1); let _t = temp.is_some(); _t }.
```

Before this PR, if the condition contained any let expressions we would not introduce that new scope, instead leaving the condition alone. This meant that in a let-chain like

```rust
if get_drop("first").is_some() && let None = get_drop("last") {
        println!("second");
} else { .. }
```

the temporary created for `get_drop("first")` would be lifted into the _surrounding block_, which caused it to be dropped after the execution of the entire `if` expression.

After this PR, we wrap everything but the `let` expression in terminating scopes. The upside to this solution is that it's minimally invasive, but the downside is that in the worst case, an expression with `let` exprs interspersed like

```rust
if get_drop("first").is_some()
    && let Some(_a) = get_drop("fifth")
    && get_drop("second").is_some()
    && let Some(_b) = get_drop("fourth") { .. }
```

gets _multiple_ new scopes, roughly

```rust
if { let _t = get_drop("first").is_some(); _t }
    && let Some(_a) = get_drop("fifth")
    && { let _t = get_drop("second").is_some(); _t }
    && let Some(_b) = get_drop("fourth") { .. }
```

so instead of all of the temporaries being dropped at the end of the entire condition, they will be dropped right after they're evaluated (before the subsequent `let` expr). So while I'd say the drop behavior around let-chains is _less_ surprising after this PR, it still might not exactly match what people might expect.

For tests, I've just extended the drop order tests added in #100526. I'm not sure if that's the best way to go about it, though, so suggestions are welcome.
2022-10-15 15:45:32 +05:30
Dylan DPC
59e0af68ab
Rollup merge of #102954 - GuillaumeGomez:cfg-hide-attr-checks, r=Manishearth
Add missing checks for `doc(cfg_hide(...))`

Part of  #43781.

The `doc(cfg_hide(...))` attribute can only be used at the crate level and takes a list of attributes as argument.

r? ```@Manishearth```
2022-10-15 15:45:32 +05:30
Dylan DPC
39ff2a60d6
Rollup merge of #102884 - petrochenkov:liferib, r=cjgillot
resolve: Some cleanup, asserts and tests for lifetime ribs

Follow up to https://github.com/rust-lang/rust/pull/98279 and friends.
r? ``@cjgillot``
2022-10-15 15:45:31 +05:30
Gimgim
49f34bd814
Surround type with backticks 2022-10-15 15:28:29 +05:30
bors
b15e2c129e Auto merge of #101832 - compiler-errors:dyn-star-plus, r=eholk
Make `dyn*` casts into a coercion, allow `dyn*` upcasting

I know that `dyn*` is likely not going to be a feature exposed to surface Rust, but this makes it slightly more ergonomic to write tests for these types anyways. ... and this was just fun to implement anyways.

1. Make `dyn*` into a coercion instead of a cast
2. Enable `dyn*` upcasting since we basically get it for free
3. Simplify some of the cast checking code since we're using the coercion path now

r? `@eholk` but feel free to reassign
cc `@nikomatsakis` and `@tmandry` who might care about making `dyn*` casts into a coercion
2022-10-15 07:36:38 +00:00
bors
46244f335b Auto merge of #99292 - Aaron1011:stability-use-tree, r=cjgillot
Correctly handle path stability for 'use tree' items

PR #95956 started checking the stability of path segments.
However, this was not applied to 'use tree' items
(e.g. 'use some::path::{ItemOne, ItemTwo}') due to the way
that we desugar these items in HIR lowering.

This PR modifies 'use tree' lowering to preserve resolution
information, which is needed by stability checking.
2022-10-15 04:27:15 +00:00
nils
24ce4cfa20
Remove the describe method from the QueryDescription trait
It was called directly already, but now it's even more useless since it
just forwards to the free function. Call it directly.
2022-10-14 22:35:56 +02:00
Nilstrieb
167b3bd3b2
Get rid of rustc_query_description!
Queries can provide an arbitrary expression for their description and
their caching behavior. Before, these expressions where stored in a
`rustc_query_description` macro emitted by the `rustc_queries` macro,
and then used in `rustc_query_impl` to fill out the methods for the
`QueryDescription` trait.

Instead, we now emit two new modules from `rustc_queries` containing the
functions with the expressions. `rustc_query_impl` calls these functions
now instead of invoking the macro.

Since we are now defining some of the functions in
`rustc_middle::query`, we now need all the imports for the key types
there as well.
2022-10-14 22:35:56 +02:00
Nilstrieb
1566273f48
Remove unsued variable in query macro 2022-10-14 22:32:05 +02:00