Commit graph

1640 commits

Author SHA1 Message Date
Esteban Kuber
d45e030c04 Fix mistake 2021-12-13 17:09:15 +00:00
Esteban Kuber
79749d64fa Remove yet more output from for-loop and ? errors 2021-12-13 17:09:15 +00:00
Esteban Kuber
81a3b90afd Further silence ? errors 2021-12-13 17:09:15 +00:00
Esteban Kuber
caf0c1bb1c Reduce verbosity for ? on non-Try expressions 2021-12-13 17:09:15 +00:00
Esteban Kuber
75b62757e4 Reduce verbosity when calling for-loop on non-Iterator expression 2021-12-13 17:09:15 +00:00
Esteban Kuber
7227a87371 When .await is called on a non-Future expression, suggest removal
Keep track of the origin of a `T: Future` obligation when caused by an
`.await` expression.

Address #66731.
2021-12-13 17:09:15 +00:00
bors
22f8bde876 Auto merge of #91549 - fee1-dead:const_env, r=spastorino
Eliminate ConstnessAnd again

Closes #91489.
Closes #89432.

Reverts #91491.
Reverts #89450.

r? `@spastorino`
2021-12-12 22:15:32 +00:00
bors
753e569c9c Auto merge of #90207 - BoxyUwU:stabilise_cg_defaults, r=lcnr
Stabilise `feature(const_generics_defaults)`

`feature(const_generics_defaults)` is complete implementation wise and has a pretty extensive test suite so I think is ready for stabilisation.

needs stabilisation report and maybe an RFC 😅

r? `@lcnr`
cc `@rust-lang/project-const-generics`
2021-12-12 14:24:23 +00:00
Deadbeef
83587e8d30
Small performance tweaks 2021-12-12 12:35:01 +08:00
Deadbeef
84b1d859c8
Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"
This reverts commit ff2439b7b9, reversing
changes made to 2a9e0831d6.
2021-12-12 12:34:46 +08:00
Deadbeef
5166f68754
Fix #91489 2021-12-12 12:09:27 +08:00
bors
229d0a9412 Auto merge of #91769 - estebank:type-trait-bound-span-2, r=oli-obk
Tweak assoc type obligation spans

* Point at RHS of associated type in obligation span
* Point at `impl` assoc type on projection error
* Reduce verbosity of recursive obligations
* Point at source of binding lifetime obligation
* Tweak "required bound" note
* Tweak "expected... found opaque (return) type" labels
* Point at set type in impl assoc type WF errors

r? `@oli-obk`

This is a(n uncontroversial) subset of #85799.
2021-12-11 21:57:19 +00:00
Matthias Krüger
7083f8edfd
Rollup merge of #91640 - cjgillot:in-band-collect, r=oli-obk
Simplify collection of in-band lifetimes

Split from https://github.com/rust-lang/rust/pull/91403

r? ````@oli-obk````
2021-12-11 16:02:46 +01:00
Esteban Kuber
5e1972eba7 Tweak assoc type obligation spans
* Point at RHS of associated type in obligation span
* Point at `impl` assoc type on projection error
* Reduce verbosity of recursive obligations
* Point at source of binding lifetime obligation
* Tweak "required bound" note
* Tweak "expected... found opaque (return) type" labels
* Point at set type in impl assoc type WF errors
2021-12-11 02:32:15 +00:00
Matthias Krüger
40988591ec
Rollup merge of #91625 - est31:remove_indexes, r=oli-obk
Remove redundant [..]s
2021-12-10 22:40:36 +01:00
Ellen
69d2d735bc remove feature gate and cleanup code 2021-12-10 19:20:31 +00:00
bors
e250777041 Auto merge of #91691 - matthiaskrgr:rollup-wfommdr, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #91042 (Use Vec extend instead of repeated pushes on several places)
 - #91476 (Improve 'cannot contain emoji' error.)
 - #91568 (Pretty print break and continue without redundant space)
 - #91645 (Implement `core::future::join!`)
 - #91666 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-09 04:04:01 +00:00
est31
15de4cbc4b Remove redundant [..]s 2021-12-09 00:01:29 +01:00
Matthias Krüger
2411cd7c7a
Rollup merge of #91245 - cameron1024:suggest-i32-u32-char-cast, r=nagisa
suggest casting between i/u32 and char

As discussed in https://github.com/rust-lang/rust/issues/91063 , this adds a suggestion for converting between i32/u32 <-> char with `as`, and a short explanation for why this is safe
2021-12-08 23:18:03 +01:00
Jakub Beránek
883d0a7aa5
Use Vec extend instead of repeated pushes in several places 2021-12-08 22:57:33 +01:00
Camille GILLOT
8576ab45e4 Store impl_trait_fn inside OpaqueTyOrigin. 2021-12-07 21:30:45 +01:00
Matthias Krüger
a8f47dc7aa
Rollup merge of #91503 - estebank:call-fn-span, r=michaelwoerister
Tweak "call this function" suggestion to have smaller span
2021-12-07 11:05:03 +01:00
Matthias Krüger
57ae43d1f2
Rollup merge of #91312 - terrarier2111:anon-const-ice, r=jackh726
Fix AnonConst ICE

I am not sure if this is even the correct place to fix this issue, but i went down the path where the generic args came from and i wasn't able to find a clear cause for this down there. But if anybody has a suggestion what i should do, just tell me.
This fixes: https://github.com/rust-lang/rust/issues/91267
2021-12-07 11:04:58 +01:00
Matthias Krüger
f84a734a8e
Rollup merge of #87614 - notriddle:notriddle-count2len, r=Mark-Simulacrum
Recommend fix `count()` -> `len()` on slices

Fixes #87302
2021-12-07 11:04:56 +01:00
Michael Howell
6a17ee6d41 Recommend fix count() -> len() on slices
Fixes #87302
2021-12-06 20:33:23 -07:00
threadexception
a0fb992433 Fix AnonConst ICE
Add test

Apply suggestions

Switch to match

Apply cargofmt
2021-12-06 17:59:37 +01:00
Fabian Wolff
a8daff2724 Fix ICE in check_must_not_suspend_ty() 2021-12-05 22:24:34 +01:00
bors
772d51f887 Auto merge of #91555 - matthiaskrgr:rollup-pq0iaq7, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #90529 (Skip reborrows in AbstractConstBuilder)
 - #91437 (Pretty print empty blocks as {})
 - #91450 (Don't suggest types whose inner type is erroneous)
 - #91535 (Stabilize `-Z emit-future-incompat` as `--json future-incompat`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-05 15:33:44 +00:00
Matthias Krüger
609d9a0108
Rollup merge of #91450 - hkmatsumoto:hide-type-error, r=estebank
Don't suggest types whose inner type is erroneous

Currently, we check if the returned type equals to `tcx.ty_error()` not to emit
erroneous types, but this has a pitfall; for example,
`Option<[type error]> != tcx.ty_error()` holds.

Fixes #91371.
2021-12-05 15:04:21 +01:00
Mara Bos
1acb44f03c Use IntoIterator for array impl everywhere. 2021-12-04 19:40:33 +01:00
Hirochika Matsumoto
9b77a1e571 Don't suggest types whose inner type is erroneous
Currently, we check if the returned type equals to `tcx.ty_error()` not to emit
erroneous types, but this has a pitfall; for example,
`Option<[type error]> != tcx.ty_error()` holds.
2021-12-04 23:51:56 +09:00
Matthias Krüger
0311cfa88c
Rollup merge of #90519 - estebank:issue-84003, r=petrochenkov
Keep spans for generics in `#[derive(_)]` desugaring

Keep the spans for generics coming from a `derive`d Item, so that errors
and suggestions have better detail.

Fix #84003.
2021-12-04 10:42:20 +01:00
Matthias Krüger
f9587b60b6
Rollup merge of #91478 - estebank:fix-newline-in-cast-suggestion, r=camelid
Remove incorrect newline from float cast suggestion
2021-12-04 02:26:24 +01:00
Esteban Kuber
93564c317b Tweak "call this function" suggestion to have smaller span 2021-12-03 23:05:49 +00:00
Esteban Kuber
962b2197a5 Annotate derived spans and move span suggestion code
* Annotate `derive`d spans from the user's code with the appropciate context
* Add `Span::can_be_used_for_suggestion` to query if the underlying span
  at the users' code
2021-12-03 18:41:40 +00:00
Santiago Pastorino
85b723c4e6
Revert "Auto merge of #91354 - fee1-dead:const_env, r=spastorino"
This reverts commit 18bb8c61a9, reversing
changes made to d9baa36190.
2021-12-03 10:11:21 -03:00
Esteban Kuber
5b5df0fa17 Remove incorrect newline from float cast suggestion 2021-12-03 01:00:09 +00:00
bors
ff23ad3179 Auto merge of #91469 - matthiaskrgr:rollup-xom3j55, r=matthiaskrgr
Rollup of 12 pull requests

Successful merges:

 - #89954 (Fix legacy_const_generic doc arguments display)
 - #91321 (Handle placeholder regions in NLL type outlive constraints)
 - #91329 (Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives`)
 - #91364 (Improve error message for incorrect field accesses through raw pointers)
 - #91387 (Clarify and tidy up explanation of E0038)
 - #91410 (Move `#![feature(const_precise_live_drops)]` checks earlier in the pipeline)
 - #91435 (Improve diagnostic for missing half of binary operator in `if` condition)
 - #91444 (disable tests in Miri that take too long)
 - #91457 (Add additional test from rust issue number 91068)
 - #91460 (Document how `last_os_error` should be used)
 - #91464 (Document file path case sensitivity)
 - #91466 (Improve the comments in `Symbol::interner`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-02 21:58:48 +00:00
Matthias Krüger
7483211ed5
Rollup merge of #91364 - FabianWolff:issue-91210-ptr-field, r=oli-obk
Improve error message for incorrect field accesses through raw pointers

Fixes #91210.
2021-12-02 22:16:11 +01:00
bors
acbe4443cc Auto merge of #91318 - eggyal:reduce-boilerplate-around-infallible-folders, r=jackh726
Reduce boilerplate around infallible folders

Further to https://github.com/rust-lang/rust/pull/91230#issuecomment-981059666

r? `@jackh726`
2021-12-02 19:12:00 +00:00
Alan Egerton
bfc434b6d0
Reduce boilerplate around infallible folders 2021-12-02 16:14:16 +00:00
bors
e5038e2099 Auto merge of #91455 - matthiaskrgr:rollup-gix2hy6, r=matthiaskrgr
Rollup of 4 iffy pull requests

Successful merges:

 - #89234 (Disallow non-c-like but "fieldless" ADTs from being casted to integer if they use arbitrary enum discriminant)
 - #91045 (Issue 90702 fix: Stop treating some crate loading failures as fatal errors)
 - #91394 (Bump stage0 compiler)
 - #91411 (Enable svh tests on msvc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-12-02 14:53:20 +00:00
bors
18bb8c61a9 Auto merge of #91354 - fee1-dead:const_env, r=spastorino
Cleanup: Eliminate ConstnessAnd

This is almost a behaviour-free change and purely a refactoring. "almost" because we appear to be using the wrong ParamEnv somewhere already, and this is now exposed by failing a test using the unstable `~const` feature.

We most definitely need to review all `without_const` and at some point should probably get rid of many of them by using `TraitPredicate` instead of `TraitRef`.

This is a continuation of https://github.com/rust-lang/rust/pull/90274.

r? `@oli-obk`

cc `@spastorino` `@ecstatic-morse`
2021-12-02 11:48:58 +00:00
Mark Rousskov
971c549ca3 re-format with new rustfmt 2021-11-30 13:08:41 -05:00
Mark Rousskov
b221c877e8 Apply cfg-bootstrap switch 2021-11-30 10:51:42 -05:00
Yuki Okushi
6e7cf2e88b
Rollup merge of #91243 - jackh726:issue-91068, r=nikomatsakis
Don't treat unnormalized function arguments as well-formed

Partial revert of #88312

r? ``@pnkfelix``
cc ``@nikomatsakis``
2021-11-30 17:29:06 +09:00
Fabian Wolff
821b92b102 Improve error message for incorrect field accesses through raw pointers 2021-11-29 19:31:17 +01:00
bors
6db0a0e9a4 Auto merge of #91299 - cjgillot:expect-ldid, r=petrochenkov
Take a LocalDefId in expect_*item.

Items and item-likes are always HIR owners.
When trying to find such nodes, there is no ambiguity, the `LocalDefId` and the `HirId::owner` always match.
In such cases, `local_def_id_to_hir_id` does not carry any meaningful information, so we can just skip calling it altogether.
2021-11-29 15:02:01 +00:00
Deadbeef
8710a2e169
Reformat everything 2021-11-29 21:19:51 +08:00
Oli Scherer
a9a79f657c
Completely remove ConstnessAnd 2021-11-29 21:19:49 +08:00