Commit graph

1623 commits

Author SHA1 Message Date
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
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
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
Oli Scherer
a848c4ba3f
Avoid storing the ImplPolarity and Constness next to a TraitRef and use TraitPredicate instead 2021-11-29 21:19:49 +08:00
Oli Scherer
d51068ca28
Use the constness from the param env instead of having a separate dimension for it
This breaks a ~const test that will be fixed in a follow up commit of this PR
2021-11-29 21:19:47 +08:00
Oli Scherer
721ffd14c3
Add constness to ParamEnv
This now causes a lot of queries to be executed twice, as reveal_all forces NotConst
2021-11-29 21:19:46 +08:00
cameron
37ca2eb8c2 suggest cast char -> int 2021-11-28 21:46:53 +00:00
Camille GILLOT
5fb4648757 Take a LocalDefId in expect_*item. 2021-11-28 21:09:45 +01:00
Matthias Krüger
67d175515f
Rollup merge of #91308 - BGR360:issue-88586, r=jackh726
Fix ICE when lowering `trait A where for<'a> Self: 'a`

Fixes #88586.

r? `@jackh726`

Jack, this fix is much smaller in scope than what I think you were proposing in the issue. Let me know if you had a vision for a larger refactor here.

cc `@JohnTitor`
2021-11-28 17:11:11 +01:00
Matthias Krüger
233c50e79e
Rollup merge of #91251 - oli-obk:wf_sync_statics, r=matthewjasper
Perform Sync check on static items in wf-check instead of during const checks

r? `@RalfJung`

This check is solely happening on the signature of the static item and not on its body, therefor it belongs into wf-checking instead of const checking.
2021-11-28 17:11:10 +01:00
Ben Reeves
6df2c78e1c Address PR feedback 2021-11-28 07:05:23 -06:00
Ben Reeves
9155f672bf typeck: Ensure proper bound vars passed to add_bounds.
Fixes the ICE in #88586.
2021-11-27 23:59:08 -06:00
Oli Scherer
18694126b1 Perform Sync check on static items in wf-check instead of during const checks 2021-11-26 14:22:45 +00:00
LeSeulArtichaut
30bf20a692
Unwrap the results of type folders
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26 07:38:25 +00:00
LeSeulArtichaut
6dc3dae46f
Adapt TypeFolder implementors to return a Result
Co-authored-by: Alan Egerton <eggyal@gmail.com>
2021-11-26 07:25:16 +00:00
jackh726
eeaa215f85 Don't treat unnormalized function arguments as well-formed 2021-11-25 21:16:27 -05:00
Esteban Kuber
9cce7bb921 Account for type obligation coming from const and static 2021-11-25 18:04:33 +00:00
Esteban Küber
37a11a96a1 On type mismatch caused by assignment, point at assignee
* Do not emit unnecessary E0308 after E0070
* Show fewer errors on `while let` missing `let`
* Hide redundant E0308 on `while let` missing `let`
* Point at binding definition when possible on invalid assignment
* do not point at closure twice
* do not suggest `if let` for literals in lhs
* account for parameter types
2021-11-25 18:04:33 +00:00
bors
f7c48297ce Auto merge of #88681 - ehuss:duplicate-attributes, r=petrochenkov
Check for duplicate attributes.

This adds some checks for duplicate attributes. In many cases, the duplicates were being ignored without error or warning. This adds several kinds of checks (see `AttributeDuplicates` enum).

The motivation here is to issue unused warnings with similar reasoning for any unused lint, and to error for cases where there are conflicts.

This also adds a check for empty attribute lists in a few attributes where this causes the attribute to be ignored.

Closes #55112.
2021-11-22 02:15:25 +00:00
Eric Huss
36dcd4cbd9 Update link_ordinal duplicate attribute handling.
This removes the duplicate check, as this is now handled in a
centralized location.
2021-11-21 08:02:00 -08:00