Commit Graph

18106 Commits

Author SHA1 Message Date
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
Andy Fiddaman
f3deac2559 The illumos linker does not support --strip-debug 2022-10-15 08:21:52 +00:00
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
nils
b00cb04037
Sort target features alphabetically 2022-10-14 22:01:18 +02:00
bors
ee1c3b385b Auto merge of #102529 - colinba:master, r=joshtriplett
Detect and reject out-of-range integers in format string literals

Until now out-of-range integers in format string literals were silently ignored. They wrapped around to zero at usize::MAX, producing unexpected results.

When using debug builds of rustc, such integers in format string literals even cause an 'attempt to add with overflow' panic in rustc.

Fix this by producing an error diagnostic for integers in format string literals which do not fit into usize.

Fixes #102528
2022-10-14 13:41:40 +00:00
Dylan DPC
7cf09c57a2
Rollup merge of #103031 - est31:match_guard_irrefutable_let, r=oli-obk
Suppress irrefutable let patterns lint for prefixes in match guards

In match guards, irrefutable prefixes might use the bindings created by the match pattern. Ideally, we check for this, but we can do the next best thing and just not lint for irrefutable prefixes in match guards.

Fixes #98361
2022-10-14 16:19:16 +05:30
Dylan DPC
77064b7f0a
Rollup merge of #103018 - Rageking8:more-dupe-word-typos, r=TaKO8Ki
More dupe word typos

I only picked those changes (from the regex search) that I am pretty certain doesn't change meaning and is just a typo fix. Do correct me if any fix is undesirable and I can revert those. Thanks.
2022-10-14 16:19:15 +05:30
Dylan DPC
8c9ecbb7e3
Rollup merge of #103015 - whentojump:patch, r=compiler-errors
fix a typo
2022-10-14 16:19:15 +05:30
Dylan DPC
b4906acbce
Rollup merge of #102856 - cjgillot:impl-single-check, r=petrochenkov
Only test duplicate inherent impl items in a single place

Based on https://github.com/rust-lang/rust/pull/100387

r? ``@petrochenkov``
2022-10-14 16:19:12 +05:30
Guillaume Gomez
f528414e40 Add missing checks for doc(cfg_hide(...)) attribute 2022-10-14 11:29:54 +02:00
Oli Scherer
1dc2119c03 Require lifetime bounds for opaque types in order to allow hidden types to capture said lifetimes 2022-10-14 08:15:51 +00:00
bors
32717603f6 Auto merge of #102695 - compiler-errors:int-and-float-trivial-copy, r=lcnr
Int and float inference variables are trivially copy

Fixes #102645
2022-10-14 07:41:55 +00:00
Michael Goulet
8c7e836abb Address nits, add test for implicit dyn-star coercion without feature gate 2022-10-14 05:47:09 +00:00
Michael Goulet
0cb217d29b Remove CastCheckResult since it's unused 2022-10-14 05:47:09 +00:00
Michael Goulet
a010df9389 float and int vars are trivially copy 2022-10-14 05:26:32 +00:00
Rageking8
7122abaddf more dupe word typos 2022-10-14 12:57:56 +08:00
Michael Goulet
feb4244f54 Allow dyn* upcasting 2022-10-14 04:43:56 +00:00
bors
1755c85302 Auto merge of #102684 - JhonnyBillM:delete-target-data-layout-errors-wrapper, r=davidtwco
Move `IntoDiagnostic` conformance for `TargetDataLayoutErrors` into `rustc_errors`

Addressed this suggestion https://github.com/rust-lang/rust/pull/101558#issuecomment-1243830009.

This way we comply with the Coherence rule given that `IntoDiagnostic` trait is defined in `rustc_errors`, and almost all other crates depend on it.
2022-10-14 04:35:22 +00:00
Takayuki Maeda
b8418485bc check if the self type is ty::Float before getting second substs 2022-10-14 13:31:15 +09:00
Michael Goulet
76386bd65e Make dyn* cast into a coercion 2022-10-14 04:27:01 +00:00
bors
edabf59ca4 Auto merge of #103026 - matthiaskrgr:rollup-gfmlfkt, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #103000 (Add suggestion to the "missing native library" error)
 - #103006 (rustdoc: don't ICE on `TyKind::Typeof`)
 - #103008 (replace ReErased with fresh region vars in opaque types)
 - #103011 (Improve rustdoc `unsafe-fn` GUI test)
 - #103013 (Add new bootstrap entrypoints to triagebot)
 - #103016 (Ensure enum cast moves)
 - #103021 (Add links to relevant pages to find constraint information)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-14 01:28:06 +00:00
Nathan Whitaker
709a08ade6 Lower condition directly from AST to HIR 2022-10-13 18:20:39 -07:00
est31
eab41a136a Suppress irrefutable let patterns lint for prefixes in match guards
In match guards, irrefutable prefixes might use the bindings created
by the match pattern. Ideally, we check for this, but we can do the
next best thing and just not lint for irrefutable prefixes in match
guards.
2022-10-14 02:16:40 +02:00
Matthias Krüger
3f12e4bd21
Rollup merge of #103021 - GuillaumeGomez:constraint-pages, r=Amanieu
Add links to relevant pages to find constraint information

I think it can be quite helpful to find this information more quickly.

r? `@Amanieu`
2022-10-14 00:45:20 +02:00
Matthias Krüger
cf675656cb
Rollup merge of #103016 - nbdd0121:enum, r=pnkfelix
Ensure enum cast moves

Fix #102389

r? ``@pnkfelix``
2022-10-14 00:45:19 +02:00
Matthias Krüger
059bbf7ea9
Rollup merge of #103008 - aliemjay:opaque-parent-substs, r=oli-obk
replace ReErased with fresh region vars in opaque types

See inline comments.

Prior art #102943. cc ``@compiler-errors`` ``@oli-obk``

Fixes #100267
Fixes #101940
Fixes #102649
Fixes #102510
2022-10-14 00:45:18 +02:00
Matthias Krüger
c7f048ea00
Rollup merge of #103000 - wesleywiser:suggest_libname, r=compiler-errors
Add suggestion to the "missing native library" error

If we fail to locate a native library that we are linking with, it could be the case the user entered a complete file name like `foo.lib` or `libfoo.a` when we expect them to simply provide `foo`.

In this situation, we now detect that case and suggest the user only provide the library name itself.
2022-10-14 00:45:17 +02:00
bors
60bd3f9677 Auto merge of #102700 - oli-obk:0xDEAD_TAIT, r=compiler-errors
Check hidden types in dead code

fixes #99490

r? `@compiler-errors`

best reviewed commit by commit
2022-10-13 22:39:05 +00:00
Guillaume Gomez
2214748ade Add links to relevant pages to find constraint information 2022-10-13 22:05:49 +02:00
Cameron Steffen
c4068c76a8 Make overlapping_impls non-generic
This improves perf
2022-10-13 14:54:48 -05:00
Camille GILLOT
112ce80726 Report duplicate definition in impls with overlap check. 2022-10-13 16:50:24 +00:00
wtj
5191256400 fix a typo 2022-10-14 00:10:04 +08:00
Ali MJ Al-Nasrawy
d2d3d94332 replace ReErased with fresh region vars in opaque types 2022-10-13 19:06:21 +03:00
Gary Guo
de0396c718 Ensure enum cast moves 2022-10-13 16:44:47 +01:00
Dylan DPC
0f12b40bff
Rollup merge of #102999 - compiler-errors:issue-102985, r=fee1-dead
Delay `is_intrinsic` query until after we've determined the callee is a function

Fixes #102985
2022-10-13 18:19:21 +05:30
Dylan DPC
48f950c527
Rollup merge of #102956 - TaKO8Ki:fix-102946, r=fee1-dead
Use `full_res` instead of `expect_full_res`

Fixes #102946
Fixes #102978
2022-10-13 18:19:21 +05:30
Dylan DPC
42991e551b
Rollup merge of #102947 - compiler-errors:sort-elaborated-existentials, r=cjgillot
Sort elaborated existential predicates in `object_ty_for_trait`

r? `@cjgillot`

I think that #102845 caused #102933. Depending on the order that we elaborate these existential projection predicates, there's no guarantee that they'll be sorted by def id, which is what is failing the assertion in the issue.

Fixes #102933
Fixes #102973
2022-10-13 18:19:20 +05:30
Dylan DPC
dbff6a91c1
Rollup merge of #102904 - compiler-errors:rpitit-verbosely, r=cjgillot
Print return-position `impl Trait` in trait verbosely if `-Zverbose`

Makes the behavior a bit closer to regular `impl Trait` printing
2022-10-13 18:19:20 +05:30
Dylan DPC
ad45dd1722
Rollup merge of #102765 - TaKO8Ki:follow-up-to-102708, r=compiler-errors
Suggest `==` to the first expr which has `ExprKind::Assign` kind

follow-up to #102708

[playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=4241dc33ed8af02e1ef530d6b14903fd)
2022-10-13 18:19:18 +05:30
Wesley Wiser
097b6d3baf Add suggestion to the "missing native library" error
If we fail to locate a native library that we are linking with, it could
be the case the user entered a complete file name like `foo.lib` or
`libfoo.a` when we expect them to simply provide `foo`.

In this situation, we now detect that case and suggest the user only
provide the library name itself.
2022-10-13 07:35:36 -04:00
Vadim Petrochenkov
f634106591 resolve: Regroup lifetime rib kinds to account for their purpose 2022-10-13 13:32:24 +04:00
Vadim Petrochenkov
e94ec30dc4 resolve: Remove redundant item lifetime ribs
and cleanup lifetime rib walking loops
2022-10-13 13:32:24 +04:00
Vadim Petrochenkov
e8a6e60c5d resolve: Add some asserts for unexpected lifetime rib combinations 2022-10-13 13:32:24 +04:00
Michael Goulet
af3c6f9a03 Delay intrinsic call until after we've determined the callee is a function 2022-10-13 03:10:00 +00:00
Michael Goulet
61f097308b Print RPITIT verbosely if -Zverbose 2022-10-13 02:31:43 +00:00
Michael Goulet
4a8cfe9d14 Sort elaborated existential predicates in object_ty_for_trait 2022-10-13 02:21:15 +00:00
Nathan Whitaker
ad8b242724 Let chains should still drop temporaries
by the end of the condition's execution
2022-10-12 17:57:32 -07:00
Yuki Okushi
0ace46f98c
Rollup merge of #102974 - Rageking8:fix-small-word-dupe-typos, r=JohnTitor
Fix small word dupe typos
2022-10-13 09:41:27 +09:00
Yuki Okushi
f4c9580c65
Rollup merge of #102836 - petrochenkov:jsonspec, r=eholk
rustc_target: Fix json target specs using LLD linker flavors in link args

Fixes https://github.com/rust-lang/rust/pull/101988#issuecomment-1272407248 (a regression introduced by https://github.com/rust-lang/rust/pull/101988).
2022-10-13 09:41:25 +09:00
Yuki Okushi
6755c2a89d
Rollup merge of #102641 - eholk:dyn-star-box, r=compiler-errors
Support casting boxes to dyn*

Boxes have a pointer type at codegen time which LLVM does not allow to be transparently converted to an integer. Work around this by inserting a `ptrtoint` instruction if the argument is a pointer.

r? ``@compiler-errors``

Fixes #102427
2022-10-13 09:41:25 +09:00
Eric Holk
8b2c3ebb86 Add a fixme 2022-10-12 14:26:22 -07:00
bors
0938e1680d Auto merge of #101679 - compiler-errors:rpitit-default-body, r=nikomatsakis
Support default-body trait functions with return-position `impl Trait` in traits

Introduce a new `Trait` candidate kind for the `ImplTraitInTrait` projection candidate, which just projects an RPITIT down to its opaque type form.

This is a hack until we lower RPITITs to regular associated types, after which we will need to rework how these default bodies are type-checked, so comments are left in a few places for us to clean up later.

Fixes #101665
2022-10-12 21:03:47 +00:00
Jhonny Bill Mena
be221573c8 UPDATE - Move IntoDiagnosticArg implementations to diagnostic_impls file 2022-10-12 16:55:28 -04:00
Jhonny Bill Mena
5645cd5b09 ADD - IntoDiagnostic conformance for TargetDataLayoutErrors in rustc_errors
This way we comply with the Coherence rule given that IntoDiagnostic trait is defined in rustc_errors, and almost all other crates depend on it.
2022-10-12 16:54:25 -04:00
bors
c0983a9aac Auto merge of #102975 - Dylan-DPC:rollup-vzuwsh2, r=Dylan-DPC
Rollup of 7 pull requests

Successful merges:

 - #102623 (translation: eager translation)
 - #102719 (Enforce alphabetical sorting with tidy)
 - #102830 (Unify `tcx.constness` query and param env constness checks)
 - #102883 (Fix stabilization of `feature(half_open_range_patterns)`)
 - #102927 (Fix `let` keyword removal suggestion in structs)
 - #102936 (rustdoc: remove unused CSS `nav.sum`)
 - #102940 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-12 17:48:31 +00:00
Rageking8
d1982bd0af fix small word dupe typos 2022-10-13 00:53:46 +08:00
Dylan DPC
a9a5529eac
Rollup merge of #102927 - compiler-errors:let, r=davidtwco
Fix `let` keyword removal suggestion in structs

(1.) Fixes a bug where, given this code:
```rust
struct Foo {
  let x: i32,
}
```

We were parsing the field name as `let` instead of `x`, which causes issues later on in the type-checking phase.

(2.) Also, suggestions for `let: i32` as a field regressed, displaying this extra `help:` which is removed by this PR

```
help: remove the let, the `let` keyword is not allowed in struct field definitions
  |
2 -     let: i32,
2 +     : i32,
```

(3.) Makes the suggestion text a bit more succinct, since we don't need to re-explain that `let` is not allowed in this position (since it's in a note that follows). This causes the suggestion to render inline as well.

cc `@gimbles,` this addresses a few nits I mentioned in your PR.
2022-10-12 22:13:26 +05:30
Dylan DPC
117a98c5ce
Rollup merge of #102883 - Urgau:fix-stabilization-half_open_range_patterns, r=lcnr
Fix stabilization of `feature(half_open_range_patterns)`

Fixes https://github.com/rust-lang/rust/pull/102275/files#r991292215 by removing the relevant code that was [already partial moved](https://github.com/rust-lang/rust/pull/102275/files#diff-307e0d3a2037c11a3fa16822fbaa0fec08e57ac7d0d6e7354f6005c9482a9e26).

cc `@Undin`
2022-10-12 22:13:25 +05:30
Dylan DPC
c763ebc72f
Rollup merge of #102830 - compiler-errors:constness-parity, r=fee1-dead
Unify `tcx.constness` query and param env constness checks

The checks that we do in the `constness` query seem inconsistent with the checks that we do to determine if an item's param-env is const, so I merged them into the `constness` query and call that from the `param_env` query.

I'm not sure if this totally makes sense -- is there a case where `tcx.param_env()` would return a const param-env for an item whose `tcx.constness()` is `Constness::NotConst`? Because if not, it seems a bit dangerous that these two differ.

Luckily, not many places actually use `tcx.constness()`, and the checks in `tcx.param_env()` seem stricter than the checks in `tcx.constness()` (at least for the types of items we type-check).

Also, due to the way that `tcx.param_env()` is implemented, it _never_ used to return a const param-env for a item coming from a different crate, which also seems dangerous (though also probably not weaponizable currently, because we seldom actually compute the param-env for a non-local item).
2022-10-12 22:13:25 +05:30
Dylan DPC
40deecef03
Rollup merge of #102719 - Nilstrieb:tidy-alphabetical, r=jackh726
Enforce alphabetical sorting with tidy

We have many places where things are supposed to be sorted alphabetically. For the smaller and more recent size assertions, this is mostly upheld, but in other more... alive places it's very messy.

This introduces a new tidy directive to check that a section of code is sorted alphabetically and fixes all places where sorting has gone wrong.
2022-10-12 22:13:24 +05:30
Dylan DPC
dc9f6f3243
Rollup merge of #102623 - davidtwco:translation-eager, r=compiler-errors
translation: eager translation

Part of #100717. See [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/295010720) for additional context.

- **Store diagnostic arguments in a `HashMap`**: Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`.
- **Add `AddToDiagnostic::add_to_diagnostic_with`**: `AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure.
- **Add `DiagnosticMessage::Eager`**: Add variant of `DiagnosticMessage` for eagerly translated messages
(messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation.
- **Support `#[subdiagnostic(eager)]`**: Add support for `eager` argument to the `subdiagnostic` attribute which generates a call to `eager_subdiagnostic`.
- **Finish migrating `rustc_query_system`**: Using eager translation, migrate the remaining repeated cycle stack diagnostic.
- **Split formatting initialization and use in diagnostic derives**: Diagnostic derives have previously had to take special care when ordering the generated code so that fields were not used after a move.

  This is unlikely for most fields because a field is either annotated with a subdiagnostic attribute and is thus likely a `Span` and copiable, or is a argument, in which case it is only used once by `set_arg`
anyway.

  However, format strings for code in suggestions can result in fields being used after being moved if not ordered carefully. As a result, the derive currently puts `set_arg` calls last (just before emission), such as:

      let diag = { /* create diagnostic */ };

      diag.span_suggestion_with_style(
          span,
          fluent::crate::slug,
          format!("{}", __binding_0),
          Applicability::Unknown,
          SuggestionStyle::ShowAlways
      );
      /* + other subdiagnostic additions */

      diag.set_arg("foo", __binding_0);
      /* + other `set_arg` calls */

      diag.emit();

  For eager translation, this doesn't work, as the message being translated eagerly can assume that all arguments are available - so arguments _must_ be set first.

  Format strings for suggestion code are now separated into two parts - an initialization line that performs the formatting into a variable, and a usage in the subdiagnostic addition.

  By separating these parts, the initialization can happen before arguments are set, preserving the desired order so that code compiles, while still enabling arguments to be set before subdiagnostics are added.

      let diag = { /* create diagnostic */ };

      let __code_0 = format!("{}", __binding_0);
      /* + other formatting */

      diag.set_arg("foo", __binding_0);
      /* + other `set_arg` calls */

      diag.span_suggestion_with_style(
          span,
          fluent::crate::slug,
          __code_0,
          Applicability::Unknown,
          SuggestionStyle::ShowAlways
      );
      /* + other subdiagnostic additions */

      diag.emit();

- **Remove field ordering logic in diagnostic derive:** Following the approach taken in earlier commits to separate formatting initialization from use in the subdiagnostic derive, simplify the diagnostic derive by removing the field-ordering logic that previously solved this problem.

r? ```@compiler-errors```
2022-10-12 22:13:23 +05:30
bors
538f118da1 Auto merge of #102732 - RalfJung:assert_unsafe_precondition2, r=bjorn3
nicer errors from assert_unsafe_precondition

This makes the errors shown by cargo-careful nicer, and since `panic_no_unwind` is `nounwind noreturn` it hopefully doesn't have bad codegen impact. Thanks to `@bjorn3` for the hint!

Would be nice if we could somehow supply our own (static) message to print, currently it always prints `panic in a function that cannot unwind`. But still, this is better than before.
2022-10-12 14:39:43 +00:00
Maybe Waffle
c5de3ecec3 link lint function with decorate function param to struct_lint_level 2022-10-12 14:16:24 +00:00
Waffle Maybe
b1c3e78661
Apply suggestions from code review
Co-authored-by: Ralf Jung <post@ralfj.de>
2022-10-12 16:39:11 +04:00
Nilstrieb
7bfef19844 Use tidy-alphabetical in the compiler 2022-10-12 17:49:10 +05:30
Takayuki Maeda
b11dddd1c1 fix #102946 2022-10-12 19:03:46 +09:00
Maybe Waffle
f1ac7b5a65 Improve docs for struct_lint_level function. 2022-10-12 09:28:11 +00:00
bors
e6ce5627a9 Auto merge of #102948 - Dylan-DPC:rollup-j8h74rb, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #102110 (Migrate rustc_passes diagnostics)
 - #102187 (Use correct location for type tests in promoted constants)
 - #102239 (Move style guide to rust-lang/rust)
 - #102578 (Panic for invalid arguments of `{integer primitive}::ilog{,2,10}` in all modes)
 - #102811 (Use memset to initialize readbuf)
 - #102890 (Check representability in adt_sized_constraint)
 - #102913 (unify `IsPattern` and `IsImport` enum in `show_candidates`)
 - #102924 (rustdoc: remove unused classes from sidebar links)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-12 06:57:24 +00:00
Dylan DPC
252ce10bb0
Rollup merge of #102913 - SparrowLii:import-candidate, r=compiler-errors
unify `IsPattern` and `IsImport` enum in `show_candidates`

Follow-up of #102876
A binding cannot appear in both pattern and import at the same time, so it makes sense to unify them
r? `@compiler-errors`
2022-10-12 11:11:26 +05:30
Dylan DPC
c8a8e7d116
Rollup merge of #102890 - camsteffen:adt-sized-representability, r=cjgillot
Check representability in adt_sized_constraint

Now that representability is a query, we can use it to preemptively avoid a cycle in `adt_sized_constraint`.

I moved the representability check into `check_mod_type_wf` to avoid a scenario where rustc quits before checking all the types for representability. This also removes the check from rustdoc, which is alright AFAIK.

r? ``@cjgillot``
2022-10-12 11:11:26 +05:30
Dylan DPC
5e04567ac7
Rollup merge of #102187 - b-naber:inline-const-source-info, r=eholk
Use correct location for type tests in promoted constants

Previously we forgot to remap the location in a type test collected when visiting the body of a promoted constant back to the usage location, causing an ICE when trying to get span information for that type test.

Fixes https://github.com/rust-lang/rust/issues/102117
2022-10-12 11:11:24 +05:30
Dylan DPC
32471a7035
Rollup merge of #102110 - CleanCut:migrate_rustc_passes_diagnostics, r=davidtwco
Migrate rustc_passes diagnostics

Picks up abandoned work from https://github.com/rust-lang/rust/pull/100870

I would like to do this collaboratively, as there is a lot of work! Here's the process:

- Comment below that you are willing to help and I will add you as a collaborator to my `rust` fork (that gives you write access)
- Indicate which file/task you would like to work on (so we don't duplicate work) from the list below
- Do the work, push up a commit, comment that you're done with that file/task
- Repeat until done 😄

### Files to Migrate (in `compiler/rustc_passes/src/`)

- [x] check_attr.rs ``@CleanCut``
- [x] check_const.rs ``@CleanCut``
- [x] dead.rs ``@CleanCut``
- [x] debugger_visualizer.rs ``@CleanCut``
- [x] diagnostic_items.rs ``@CleanCut``
- [x] entry.rs ``@CleanCut``
- [x] lang_items.rs ``@CleanCut``
- [x] layout_test.rs ``@CleanCut``
- [x] lib_features.rs ``@CleanCut``
- [x] ~liveness.rs~ ``@CleanCut`` Nothing to do
- [x] loops.rs ``@CleanCut``
- [x] naked_functions.rs ``@CleanCut``
- [x] stability.rs ``@CleanCut``
- [x] weak_lang_items.rs ``@CleanCut``

### Tasks

- [x] Rebase on current `master` ``@CleanCut``
- [x] Review work from [the earlier PR](https://github.com/rust-lang/rust/pull/100870) and make sure it all looks good
  - [x] compiler/rustc_error_messages/locales/en-US/passes.ftl ``@CleanCut``
  - [x] compiler/rustc_passes/src/check_attr.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/errors.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/lang_items.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/lib.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/weak_lang_items.rs ``@CleanCut``
2022-10-12 11:11:23 +05:30
Michael Goulet
bef8681a18 TyAlias needs encoded constness too, for layout computation in rustdoc 2022-10-12 04:17:21 +00:00
Michael Goulet
3021598fdb Do not register placeholder region outlives when considering_regions is false 2022-10-12 04:04:55 +00:00
Michael Goulet
c646c4d403 Unify tcx.constness and param env constness checks 2022-10-12 04:04:09 +00:00
bors
2b91cbe2d4 Auto merge of #102692 - nnethercote:TokenStreamBuilder, r=Aaron1011
Remove `TokenStreamBuilder`

`TokenStreamBuilder` is used to combine multiple token streams. It can be removed, leaving the code a little simpler and a little faster.

r? `@Aaron1011`
2022-10-12 03:46:16 +00:00
SparrowLii
a7f58af9fe unify IsPattern and IsImport enum 2022-10-12 08:46:52 +08:00
Ralf Jung
66282cb47d add panic_fmt_nounwind for panicing without unwinding, and use it for panic_no_unwind 2022-10-11 22:47:31 +02:00
Ralf Jung
2b50cd1877 rename rustc_allocator_nounwind to rustc_nounwind 2022-10-11 22:47:31 +02:00
Michael Goulet
f9d3c83526 Fix let removal suggestion in struct 2022-10-11 17:35:50 +00:00
Matthias Krüger
a13c7da23e
Rollup merge of #102893 - TaKO8Ki:fix-102878, r=davidtwco
Fix ICE #102878

Fixes #102878
2022-10-11 18:59:50 +02:00
Matthias Krüger
cb67283392
Rollup merge of #102889 - petrochenkov:partres, r=cjgillot
rustc_hir: Less error-prone methods for accessing `PartialRes` resolution
2022-10-11 18:59:50 +02:00
Matthias Krüger
24722e8d5b
Rollup merge of #102612 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 1]

Initial migration of `codegen_ssa`. Going to split this crate migration in at least two PRs in order to avoid a huge PR and to quick off some questions around:

1. Translating messages from "external" crates.
2. Interfacing with OS messages.
3. Adding UI tests while migrating diagnostics.

_See comments below._
2022-10-11 18:59:48 +02:00
Matthias Krüger
cadb37a8c7
Rollup merge of #101727 - est31:stabilize_map_first_last, r=m-ou-se
Stabilize map_first_last

Stabilizes the following functions:

```Rust
impl<T> BTreeSet<T> {
    pub fn first(&self) -> Option<&T> where T: Ord;
    pub fn last(&self) -> Option<&T> where T: Ord;
    pub fn pop_first(&mut self) -> Option<T> where T: Ord;
    pub fn pop_last(&mut self) -> Option<T> where T: Ord;
}

impl<K, V> BTreeMap<K, V> {
    pub fn first_key_value(&self) -> Option<(&K, &V)> where K: Ord;
    pub fn last_key_value(&self) -> Option<(&K, &V)> where K: Ord;
    pub fn first_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>> where K: Ord;
    pub fn last_entry(&mut self) -> Option<OccupiedEntry<'_, K, V>> where K: Ord;
    pub fn pop_first(&mut self) -> Option<(K, V)> where K: Ord;
    pub fn pop_last(&mut self) -> Option<(K, V)> where K: Ord;
}
```

Closes #62924

~~Blocked on the [FCP](https://github.com/rust-lang/rust/issues/62924#issuecomment-1179489929) finishing.~~ Edit: It finished!
2022-10-11 18:59:46 +02:00
Matthias Krüger
6d58ff7fe6
Rollup merge of #100387 - cjgillot:hygiene-trait-impl, r=petrochenkov
Check uniqueness of impl items by trait item when applicable.

When checking uniqueness of item names in impl blocks, we currently use the same definition of hygiene as for toplevel items.  This means that a plain item and one generated by a macro 2.0 do not collide.

This hygiene rule does not match with how impl items resolve to associated trait items. As a consequence, we misdiagnose the trait impls.

This PR proposes to consider that trait impl items are uses of the corresponding trait items during resolution, instead of checking for duplicates later. An error is emitted when a trait impl item is used twice.

There should be no stable breakage, since macros 2.0 are still unstable.

r? ``@petrochenkov``
cc ``@RalfJung``

Fixes https://github.com/rust-lang/rust/issues/71614.
2022-10-11 18:59:45 +02:00
Yuki Okushi
98764c0c72
Rollup merge of #102859 - cjgillot:collect-lifetimes, r=oli-obk
Move lifetime resolution module to rustc_hir_analysis.

Now that lifetime resolution has been removed from it, this file has nothing to do in `rustc_resolve`.  It's purpose is to compute Debruijn indices for lifetimes, so let's put it in type collection.
2022-10-11 18:37:55 +09:00
Camille GILLOT
152cd63226 Report duplicate definitions in trait impls during resolution. 2022-10-11 06:24:51 +00:00
Vadim Petrochenkov
1a8f177772 rustc_hir: Less error-prone methods for accessing PartialRes resolution 2022-10-11 09:04:52 +04:00
bors
518263d889 Auto merge of #102896 - matthiaskrgr:rollup-jg5xawz, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #101360 (Point out incompatible closure bounds)
 - #101789 (`let`'s not needed in struct field definitions)
 - #102846 (update to syn-1.0.102)
 - #102871 (rustdoc: clean up overly complex `.trait-impl` CSS selectors)
 - #102876 (suggest candidates for unresolved import)
 - #102888 (Improve rustdoc-gui search-color test)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-11 00:36:26 +00:00
Cameron Steffen
d933092dc5 Check representability in adt_sized_constraint 2022-10-10 14:36:12 -05:00
Matthias Krüger
0bd1cba98b
Rollup merge of #102876 - SparrowLii:import-candidate, r=fee1-dead
suggest candidates for unresolved import

Currently we prompt suggestion of candidates(help notes of `use xxx::yyy`) for names which cannot be resolved, but we don't do that for import statements themselves that couldn't be resolved. It seems reasonable to add candidate help information for these statements as well.
Fixes #102711
2022-10-10 20:47:34 +02:00
Matthias Krüger
01a2246000
Rollup merge of #101789 - gimbles:let, r=estebank
`let`'s not needed in struct field definitions

Fixes #101683
2022-10-10 20:47:32 +02:00
Matthias Krüger
d8d01e3216
Rollup merge of #101360 - compiler-errors:multiple-closure-bounds, r=petrochenkov
Point out incompatible closure bounds

Fixes #100295
2022-10-10 20:47:31 +02:00
Takayuki Maeda
68260289b5 fix #102878 2022-10-11 02:43:36 +09:00
Camille GILLOT
a474ec50b7 Move lifetime resolution module to rustc_hir_analysis. 2022-10-10 17:40:52 +00:00
Guillaume Gomez
adc24d1b5e Fix compiler docs 2022-10-10 18:28:29 +02:00
Guillaume Gomez
3416fa1882 Fix doc lint error 2022-10-10 18:28:29 +02:00
Nathan Stocks
5ef1c03bd8 make up your mind, rustfmt 2022-10-10 10:06:52 -06:00
Nathan Stocks
50e2795624 remove out-of-date fixme 2022-10-10 09:52:53 -06:00
Urgau
d17a69e453 Fix stabilization of feature(half_open_range_patterns) 2022-10-10 15:45:57 +02:00
David Wood
fbac1f288b macros: simplify field ordering in diag derive
Following the approach taken in earlier commits to separate formatting
initialization from use in the subdiagnostic derive, simplify the
diagnostic derive by removing the field-ordering logic that previously
solved this problem.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
7e20929e55 macros: separate suggestion fmt'ing and emission
Diagnostic derives have previously had to take special care when
ordering the generated code so that fields were not used after a move.

This is unlikely for most fields because a field is either annotated
with a subdiagnostic attribute and is thus likely a `Span` and copiable,
or is a argument, in which case it is only used once by `set_arg`
anyway.

However, format strings for code in suggestions can result in fields
being used after being moved if not ordered carefully. As a result, the
derive currently puts `set_arg` calls last (just before emission), such
as:

```rust
let diag = { /* create diagnostic */ };

diag.span_suggestion_with_style(
    span,
    fluent::crate::slug,
    format!("{}", __binding_0),
    Applicability::Unknown,
    SuggestionStyle::ShowAlways
);
/* + other subdiagnostic additions */

diag.set_arg("foo", __binding_0);
/* + other `set_arg` calls */

diag.emit();
```

For eager translation, this doesn't work, as the message being
translated eagerly can assume that all arguments are available - so
arguments _must_ be set first.

Format strings for suggestion code are now separated into two parts - an
initialization line that performs the formatting into a variable, and a
usage in the subdiagnostic addition.

By separating these parts, the initialization can happen before
arguments are set, preserving the desired order so that code compiles,
while still enabling arguments to be set before subdiagnostics are
added.

```rust
let diag = { /* create diagnostic */ };

let __code_0 = format!("{}", __binding_0);
/* + other formatting */

diag.set_arg("foo", __binding_0);
/* + other `set_arg` calls */

diag.span_suggestion_with_style(
    span,
    fluent::crate::slug,
    __code_0,
    Applicability::Unknown,
    SuggestionStyle::ShowAlways
);
/* + other subdiagnostic additions */

diag.emit();
```

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
113e94369c query_system: finish migration
Using eager translation, migrate the remaining repeated cycle stack
diagnostic.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
291a4736d9 macros: #[subdiagnostic(eager)]
Add support for `eager` argument to the `subdiagnostic` attribute which
generates a call to `eager_subdiagnostic`.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
540b203bf9 errors: DiagnosticMessage::Eager
Add variant of `DiagnosticMessage` for eagerly translated messages
(messages in the target language which don't need translated by the
emitter during emission). Also adds `eager_subdiagnostic` function which
is intended to be invoked by the diagnostic derive for subdiagnostic
fields which are marked as needing eager translation.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
b4ac26289f errors: AddToDiagnostic::add_to_diagnostic_with
`AddToDiagnostic::add_to_diagnostic_with` is similar to the previous
`AddToDiagnostic::add_to_diagnostic` but takes a function that can be
used by the caller to modify diagnostic messages originating from the
subdiagnostic (such as performing translation eagerly).

`add_to_diagnostic` now just calls `add_to_diagnostic_with` with an
empty closure.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
508d7e6d26 errors: use HashMap to store diagnostic args
Eager translation will enable subdiagnostics to be translated multiple
times with different arguments - this requires the ability to replace
the value of one argument with a new value, which is better suited to a
`HashMap` than the previous storage, a `Vec`.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
febbf71219 macros: tidy up lint changes
Small tweaks to changes made in a previous PR, unrelated to eager
translation.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 13:32:23 +01:00
gimbles
6071b4b8a6 let is not allowed in struct field definitions
Co-authored-by: jyn514 <jyn514@gmail.com>
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2022-10-10 16:53:13 +05:30
Dylan DPC
81b9d0b1d1
Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8Ki
Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type`

Thanks `@camsteffen` for catching this in ast too, cc https://github.com/rust-lang/rust/pull/102829#issuecomment-1272649247
2022-10-10 13:43:43 +05:30
Dylan DPC
5a09b72156
Rollup merge of #102853 - cjgillot:skip-opaque-cast, r=jackh726
Skip chained OpaqueCast when building captures.

Fixes https://github.com/rust-lang/rust/issues/102089
2022-10-10 13:43:42 +05:30
Dylan DPC
58d533dfc1
Rollup merge of #102786 - compiler-errors:no-tuple-candidate, r=lcnr
Remove tuple candidate, nothing special about it

r? `@lcnr` you mentioned this during the talk you gave i think
2022-10-10 13:43:41 +05:30
Dylan DPC
7e16f9f1ea
Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-dead
Uplift `clippy::for_loops_over_fallibles` lint into rustc

This PR, as the title suggests, uplifts [`clippy::for_loops_over_fallibles`] lint into rustc. This lint warns for code like this:
```rust
for _ in Some(1) {}
for _ in Ok::<_, ()>(1) {}
```
i.e. directly iterating over `Option` and `Result` using `for` loop.

There are a number of suggestions that this PR adds (on top of what clippy suggested):
1. If the argument (? is there a better name for that expression) of a `for` loop is a `.next()` call, then we can suggest removing it (or rather replacing with `.by_ref()` to allow iterator being used later)
   ```rust
    for _ in iter.next() {}
    // turns into
    for _ in iter.by_ref() {}
    ```
2. (otherwise) We can suggest using `while let`, this is useful for non-iterator, iterator-like things like [async] channels
   ```rust
   for _ in rx.recv() {}
   // turns into
   while let Some(_) = rx.recv() {}
   ```
3. If the argument type is `Result<impl IntoIterator, _>` and the body has a `Result<_, _>` type, we can suggest using `?`
   ```rust
   for _ in f() {}
   // turns into
   for _ in f()? {}
   ```
4. To preserve the original behavior and clear intent, we can suggest using `if let`
   ```rust
   for _ in f() {}
   // turns into
   if let Some(_) = f() {}
   ```
(P.S. `Some` and `Ok` are interchangeable depending on the type)

I still feel that the lint wording/look is somewhat off, so I'll be happy to hear suggestions (on how to improve suggestions :D)!

Resolves #99272

[`clippy::for_loops_over_fallibles`]: https://rust-lang.github.io/rust-clippy/master/index.html#for_loops_over_fallibles
2022-10-10 13:43:40 +05:30
Michael Goulet
693485373b Point out incompatible closure bounds 2022-10-10 05:05:26 +00:00
SparrowLii
0571b0af65 suggest candidates for unresolved import 2022-10-10 11:14:32 +08:00
Michael Goulet
d3bd6beb97 Rename AssocItemKind::TyAlias to AssocItemKind::Type 2022-10-10 02:31:37 +00:00
Yuki Okushi
e435a051dd
Rollup merge of #102860 - GuillaumeGomez:missing-docs-FileNameDisplayPreference, r=nagisa
Add missing documentation for FileNameDisplayPreference variants

Took me a while to find the information when I needed it so hopefully it should save some time for the next ones.

r? ``@thomcc``
2022-10-10 10:23:05 +09:00
Yuki Okushi
a4e5577262
Rollup merge of #102845 - cjgillot:gat-object, r=fee1-dead
Elaborate trait ref to compute object safety.

instead of building them manually from supertraits and associated items.

This allows to have the correct substs for GATs.

Fixes https://github.com/rust-lang/rust/issues/102751
2022-10-10 10:23:05 +09:00
Yuki Okushi
303ebd5b04
Rollup merge of #102345 - chenyukang:fix-102182-impl-trait, r=estebank
Recover from impl Trait in type param bound

Fixes #102182
r? ``@estebank``
2022-10-10 10:23:04 +09:00
Yuki Okushi
0db05f16c8
Rollup merge of #102323 - Stoozy:master, r=cjgillot
Trying to suggest additional lifetime parameter

``@cjgillot`` This is what I have so far for #100615
2022-10-10 10:23:04 +09:00
Yuki Okushi
c50e64d872
Rollup merge of #102275 - Urgau:stabilize-half_open_range_patterns, r=cjgillot
Stabilize `half_open_range_patterns`

This PR stabilize `feature(half_open_range_patterns)`:
```
Allows using `..=X` as a pattern.
```

And adds a new `feature(half_open_range_patterns_in_slices)` for the slice part, https://github.com/rust-lang/rust/pull/102275#issuecomment-1267422806.

The FCP was completed in https://github.com/rust-lang/rust/issues/67264.
2022-10-10 10:23:03 +09:00
Guillaume Gomez
550f579816 Add missing documentation for FileNameDisplayPreference variants 2022-10-09 23:32:15 +02:00
Camille GILLOT
e828ce53b9 Skip chained OpaqueCast when building captures. 2022-10-09 16:18:16 +00:00
Yuki Okushi
24424d0acb
Rollup merge of #102829 - compiler-errors:rename-impl-item-kind, r=TaKO8Ki
rename `ImplItemKind::TyAlias` to `ImplItemKind::Type`

The naming of this variant seems inconsistent given that this is not really a "type alias", and the associated type variant for `TraitItemKind` is just called `Type`.
2022-10-10 00:09:42 +09:00
Yuki Okushi
c5d4456564
Rollup merge of #102820 - ehuss:let-else-nightly-suggestion, r=petrochenkov
Show let-else suggestion on stable.

The E0005 error message has a suggestion to use let-else. Now that let-else is stabilized, I think this message should be included on non-nightly toolchains. I suspect this was just an oversight from #93628.  [`E0005.stderr`](be1c7aad72/src/test/ui/error-codes/E0005.stderr (L22-L25)) contains an example of what this suggestion looks like.
2022-10-10 00:09:41 +09:00
Camille GILLOT
f5fd66e0c2 Elaborate trait ref to compute object safety. 2022-10-09 13:44:21 +00:00
Maybe Waffle
9d4edff1b0 adopt to building infcx 2022-10-09 13:07:21 +00:00
Maybe Waffle
40f36fac49 adopt to new rustc lint api 2022-10-09 13:07:21 +00:00
Maybe Waffle
7434b9f0d1 fixup lint name 2022-10-09 13:07:21 +00:00
Maybe Waffle
98e0c4df73 fix for_loop_over_fallibles lint docs 2022-10-09 13:07:21 +00:00
Maybe Waffle
6766113c87 remove an infinite loop 2022-10-09 13:07:21 +00:00
Maybe Waffle
b9b2059e84 Edit documentation for for_loop_over_fallibles lint 2022-10-09 13:07:20 +00:00
Maybe Waffle
0250f0244b allow or avoid for loops over option in compiler and tests 2022-10-09 13:07:20 +00:00
Maybe Waffle
8ca57b54c1 for_loop_over_fallibles: don't use MachineApplicable
The loop could contain `break;` that won't work with an `if let`
2022-10-09 13:05:53 +00:00
Maybe Waffle
23a7674e3e for_loop_over_fallibles: fix suggestion for "remove .next()" case
if the iterator is used after the loop, we need to use `.by_ref()`
2022-10-09 13:05:53 +00:00
Maybe Waffle
dd842ffc3d for_loop_over_fallibles: remove duplication from the message 2022-10-09 13:05:53 +00:00
Maybe Waffle
b2975ee974 for_loop_over_fallibles: suggest using ? in some cases 2022-10-09 13:05:52 +00:00
Maybe Waffle
5dcfdbf31e for_loop_over_fallibles: suggest while let loop 2022-10-09 13:05:52 +00:00
Maybe Waffle
21ec99b6fa for_loop_over_fallibles: Suggest removing .next() 2022-10-09 13:05:52 +00:00