Commit Graph

18075 Commits

Author SHA1 Message Date
Michael Goulet
ab36a2fe16 Revert "Unify tcx.constness and param env constness checks"
This reverts commit bef8681a18.
This reverts commit c646c4d403.
2022-10-20 03:44:12 +00:00
bors
cb9467515b Auto merge of #102417 - oli-obk:opaque_lifetimes2, r=jackh726
Require lifetime bounds for opaque types in order to allow hidden types to capture said lifetimes

fixes #96996

cc `@aliemjay`
2022-10-20 00:22:17 +00:00
Matthias Krüger
12775ce16a
Rollup merge of #103239 - m-ou-se:unstable-abi-fn-impl-check, r=lcnr
Allow #[unstable] impls for fn() with unstable abi.

This allows `#[unstable]` trait impls for `extern "unwind-C" fn()`, based on the fact that that abi and therefore that type is unstable.

See https://github.com/rust-lang/rust/pull/101263#issuecomment-1283099947
2022-10-19 21:38:41 +02:00
Matthias Krüger
e500dcb8cb
Rollup merge of #103223 - compiler-errors:deref-sugg-slow, r=wesleywiser
Use already checked RHS ty for LHS deref suggestions

There's no reason to do the `check_lhs_assignable` and RHS `check_expr_with_hint` in that order, so invert them and use the typeck results to avoid exponential blowup on error.

Fixes #103219
2022-10-19 21:38:40 +02:00
bors
4b8f431995 Auto merge of #103214 - Nilstrieb:set-theory, r=petrochenkov
Use Set instead of Vec in transitive_relation

Helps with #103195. It doesn't fix the underlying quadraticness but it makes it _a lot_ faster to an extent where even doubling the amount of nested references still takes less than two seconds (50s on nightly).

I want to see whether this causes regressions (because the vec was usually quite small) or improvements (as lookup for bigger sets is now much faster) in real code.
2022-10-19 13:53:06 +00:00
Mara Bos
c4f829b2e5 Allow #[unstable] impl for fn() -> UnstableType.
(But not fn() -> !, which is stable.)
2022-10-19 13:34:18 +02:00
nils
d45f025c90
Use Set instead of Vec in transitive_relation 2022-10-19 12:50:28 +02:00
Mara Bos
ead96f7f74 Allow #[unstable] impls for fn() with unstable abi. 2022-10-19 12:41:35 +02:00
Mara Bos
e60016eb55 Split is_stable from rustc_target::spec::abi::is_enabled. 2022-10-19 12:41:11 +02:00
Dylan DPC
32159e3fa4
Rollup merge of #103216 - cjgillot:issue-103210, r=jackh726
Consider patterns in fn params in an `Elided(Infer)` lifetime rib.

Fixes https://github.com/rust-lang/rust/issues/103210
2022-10-19 14:05:54 +05:30
Dylan DPC
02d6135b5f
Rollup merge of #103182 - Nilstrieb:query-desc-cleanup, r=oli-obk
Clean up query descriptions

Use the same tense everywhere and prefer display over debug, as these descriptions are user facing.
2022-10-19 14:05:53 +05:30
Dylan DPC
48c5e0c262
Rollup merge of #103034 - nathanwhit:let-chains-rhs-temporaries, r=wesleywiser
Let expressions on RHS shouldn't be terminating scopes

Fixes #100276.

Before this PR, we were unconditionally marking the RHS of short-circuiting binary expressions as a terminating scope.

In the case of a let chain where the `let` expression was on the RHS, this meant that temporaries within the `let` expr would only live until the end of the expression. Since this only affected the RHS, this led to surprising behavior ([example](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=d1b0a5d1f01882f9c89c2194a75eb19f)).

After this PR, we only mark the RHS as a terminating scope if it is not a `let` expression.
2022-10-19 14:05:52 +05:30
Dylan DPC
5c2c476ad1
Rollup merge of #102863 - compiler-errors:call-suggestion-on-unimplemented, r=nagisa
Standardize "use parentheses to call" suggestions between typeck and trait selection

1. Suggest calling constructors, since they're basically `FnDef`s but they have a different def kind and hir representation, so we were leaving them out.
2. Standardize the call suggestions between trait fulfillment errors and type mismatch. In the type mismatch suggestion, we suggest `/* Ty */` as the placeholder for an arg, and not the parameter's name, which is less helpful.
3. Use `predicate_must_hold_modulo_regions` instead of matching on `EvaluationResult` -- this might cause some suggestions to be filtered out, but we really shouldn't be suggesting a call if it "may" hold, only when it "must" hold.
4. Borrow some logic from `extract_callable_info` to generalize this suggestion to fn pointers, type parameters, and opaque types.

Fixes #102852
2022-10-19 14:05:51 +05:30
Matthias Krüger
e86bc89831
Rollup merge of #103176 - nnethercote:fix-TyKind-is_simple_path, r=spastorino
Fix `TyKind::is_simple_path`

Fixes #103157.

r? `@spastorino`
2022-10-19 07:15:31 +02:00
Michael Goulet
d38dc68aa3 Use already checked RHS ty for LHS deref suggestions 2022-10-19 04:20:48 +00:00
Michael Goulet
35f1570732 instantiate -> construct 2022-10-19 02:55:23 +00:00
Michael Goulet
7eb2d4e7d0 Generalize call suggestion for unsatisfied predicate 2022-10-19 02:06:19 +00:00
Michael Goulet
f5336a969c Standardize arg suggestions between typeck and trait selection 2022-10-19 02:06:19 +00:00
Michael Goulet
b3edd9f775 Use predicate_must_hold_modulo_regions 2022-10-19 02:06:19 +00:00
Michael Goulet
63be7a2424 Suggest calling ctor when trait is unimplemented 2022-10-19 02:06:19 +00:00
Camille GILLOT
9c3bf4de55 Consider patterns in fn params in an Elided(Infer) lifetime rib. 2022-10-18 21:25:38 +00:00
Nicholas Nethercote
63db9e540c Replace a spawn_unchecked with spawn_scoped. 2022-10-19 08:09:40 +11:00
Nicholas Nethercote
ec409f95bf Apply Lrc later to sess and codegen_backend.
This avoids the need for a degenerate `Lrc::get_mut` call.
2022-10-19 08:09:40 +11:00
Nicholas Nethercote
b6ae1453cb Inline and remove create_compiler_and_run.
It has a single call site.
2022-10-19 08:09:36 +11:00
Nicholas Nethercote
dcc194e4bf Reduce visibility of some functions. 2022-10-19 07:23:14 +11:00
Nicholas Nethercote
134e9d36ce Inline and remove scoped_thread.
It has a single call site, and removing it slightly improves the
confusing tangle of nested closures present at startup.
2022-10-19 07:23:14 +11:00
bors
a24a020e6d Auto merge of #102418 - citrus-it:illumos-strip-debug, r=nagisa
The illumos linker does not support --strip-debug

When building and testing rust 1.64.0 on illumos, we saw a large number of failing tests associated with:

```
   = note: ld: fatal: unrecognized option '--strip-debug'
           ld: fatal: use the -z help option for usage information
           collect2: error: ld returned 1 exit status
```

The illumos linker does not support the `--strip-debug` option (although it does support `--strip-all`).
2022-10-18 16:32:41 +00:00
nils
4ed834523e
Clean up query descriptions
Use the same tense everywhere and prefer display over debug, as these
descriptions are user facing.
2022-10-18 17:29:42 +02:00
Yuki Okushi
6e7d206a7b
Rollup merge of #103168 - Amanieu:stable_asm_sym, r=davidtwco
Stabilize asm_sym

Tracking issue #93333

Reference PR: https://github.com/rust-lang/reference/pull/1270
2022-10-18 21:21:32 +09:00
Yuki Okushi
472a8742a6
Rollup merge of #103142 - fmease:fix-103052, r=oli-obk
Make diagnostic for unsatisfied `Termination` bounds more precise

Don't blindly emit a diagnostic claiming that “*`main` has an invalid return type*” if we encounter a type that should but doesn't implement `std::process::Termination` and isn't actually the return type of the program entry `main`.

Fixes #103052.

``@rustbot`` label A-diagnostics T-compiler T-libs
r? diagnostics
2022-10-18 21:21:30 +09:00
bors
a03ca01f47 Auto merge of #102992 - nnethercote:rm-RunCompiler-emitter, r=bjorn3
Remove `RunCompiler::emitter`.

It's no longer used.

r? `@bjorn3`
2022-10-18 05:06:04 +00:00
Nicholas Nethercote
9a23f60f9c Fix TyKind::is_simple_path.
PR #98758 introduced code to avoid redundant assertions in derived code
like this:
```
let _: ::core::clone::AssertParamIsClone<u32>;
let _: ::core::clone::AssertParamIsClone<u32>;
```
But the predicate `is_simple_path` introduced as part of this failed to
account for generic arguments. Therefore the deriving code erroneously
considers types like `Option<bool>` and `Option<f32>` to be the same.

This commit fixes `is_simple_path`.

Fixes #103157.
2022-10-18 15:51:23 +11: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
Nicholas Nethercote
641f8249f9 Remove RunCompiler::emitter.
It's no longer used.
2022-10-18 08:48:58 +11:00
Amanieu d'Antras
430bd6200d Stabilize asm_sym 2022-10-17 22:38:37 +01: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
León Orell Valerian Liehr
684df4d24e
Make diagnostic for unsatisfied Termination bounds more precise 2022-10-17 12:08:46 +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