Commit graph

1602 commits

Author SHA1 Message Date
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
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
Esteban Kuber
e30e47fa68 review comments 2021-11-20 19:19:34 +00:00
Esteban Kuber
cecbd7657a Suggest constraining fn type params when appropriate 2021-11-20 19:19:34 +00:00
Esteban Kuber
9fa165d11b Point at impl blocks when they introduce unmet obligations
Group obligations by `impl` block that introduced them.
2021-11-20 19:19:33 +00:00
Esteban Kuber
563db4245b Do not mention associated items when they introduce an obligation 2021-11-20 19:19:31 +00:00
Esteban Kuber
446b46673d Point at bounds when comparing impl items to trait 2021-11-20 18:54:31 +00:00
Esteban Kuber
6b9d910639 Point at source of trait bound obligations in more places
Be more thorough in using `ItemObligation` and `BindingObligation` when
evaluating obligations so that we can point at trait bounds that
introduced unfulfilled obligations. We no longer incorrectly point at
unrelated trait bounds (`substs-ppaux.verbose.stderr`).

In particular, we now point at trait bounds on method calls.

We no longer point at "obvious" obligation sources (we no longer have a
note pointing at `Trait` saying "required by a bound in `Trait`", like
in `associated-types-no-suitable-supertrait*`).

Address part of #89418.
2021-11-20 18:54:31 +00:00
Matthias Krüger
7354bb331e
Rollup merge of #90575 - m-ou-se:compatible-variant-improvements, r=estebank
Improve suggestions for compatible variants on type mismatch.

Fixes #90553.

Before:
![image](https://user-images.githubusercontent.com/783247/140385675-6ff41090-eca2-41bc-b161-99c5dabfec61.png)

After:
![image](https://user-images.githubusercontent.com/783247/140385748-20cf26b5-ea96-4e56-8af2-5fe1ab16fd3b.png)

r? `````@estebank`````
2021-11-20 10:21:12 +01:00
bors
e8423e6c44 Auto merge of #91033 - JohnTitor:rollup-sr9zg6o, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #89258 (Make char conversion functions unstably const)
 - #90578 (add const generics test)
 - #90633 (Refactor single variant `Candidate` enum into a struct)
 - #90800 (bootstap: create .cargo/config only if not present)
 - #90942 (windows: Return the "Not Found" error when a path is empty)
 - #90947 (Move some tests to more reasonable directories - 9.5)
 - #90961 (Suggest removal of arguments for unit variant, not replacement)
 - #90990 (Arenas cleanup)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-19 06:13:29 +00:00
Yuki Okushi
c74ff8b563
Rollup merge of #90961 - estebank:suggest-removal-of-call, r=nagisa
Suggest removal of arguments for unit variant, not replacement
2021-11-19 13:06:37 +09:00
bors
ce3f3a5ffa Auto merge of #90329 - nbdd0121:typeck, r=nagisa
Try all stable method candidates first before trying unstable ones

Currently we try methods in this order in each step:
* Stable by value
* Unstable by value
* Stable autoref
* Unstable autoref
* ...

This PR changes it to first try pick methods without any unstable candidates, and if none is found, try again to pick unstable ones.

Fix #90320
CC #88971, hopefully would allow us to rename the "unstable_*" methods for integer impls back.

`@rustbot` label T-compiler T-libs-api
2021-11-19 03:00:46 +00:00
bors
cc946fcd32 Auto merge of #91019 - JohnTitor:rollup-q95ra7r, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #90386 (Add `-Zassert-incr-state` to assert state of incremental cache)
 - #90438 (Clean up mess for --show-coverage documentation)
 - #90480 (Mention `Vec::remove` in `Vec::swap_remove`'s docs)
 - #90607 (Make slice->str conversion and related functions `const`)
 - #90750 (rustdoc: Replace where-bounded Clean impl with simple function)
 - #90895 (require full validity when determining the discriminant of a value)
 - #90989 (Avoid suggesting literal formatting that turns into member access)
 - #91002 (rustc: Remove `#[rustc_synthetic]`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-11-18 20:23:26 +00:00
Yuki Okushi
08c1639fd9
Rollup merge of #91002 - petrochenkov:nosynth, r=davidtwco
rustc: Remove `#[rustc_synthetic]`

This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.

Noticed while reviewing https://github.com/rust-lang/rust/pull/90947.
2021-11-19 02:22:59 +09:00
Yuki Okushi
dfbbb3b900
Rollup merge of #90989 - notriddle:notriddle/rustc-suggest-float-ending-in-dot, r=sanxiyn
Avoid suggesting literal formatting that turns into member access

Fixes #90974
2021-11-19 02:22:59 +09:00
bors
b6f580acc0 Auto merge of #90382 - alexcrichton:wasm64-libstd, r=joshtriplett
std: Get the standard library compiling for wasm64

This commit goes through and updates various `#[cfg]` as appropriate to
get the wasm64-unknown-unknown target behaving similarly to the
wasm32-unknown-unknown target. Most of this is just updating various
conditions for `target_arch = "wasm32"` to also account for `target_arch
= "wasm64"` where appropriate. This commit also lists `wasm64` as an
allow-listed architecture to not have the `restricted_std` feature
enabled, enabling experimentation with `-Z build-std` externally.

The main goal of this commit is to enable playing around with
`wasm64-unknown-unknown` externally via `-Z build-std` in a way that's
similar to the `wasm32-unknown-unknown` target. These targets are
effectively the same and only differ in their pointer size, but wasm64
is much newer and has much less ecosystem/library support so it'll still
take time to get wasm64 fully-fledged.
2021-11-18 17:19:27 +00:00
Vadim Petrochenkov
91e02177a1 rustc: Remove #[rustc_synthetic]
This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.
2021-11-18 14:32:29 +08:00
Michael Howell
a7261c32f4 Avoid suggesting literal formatting that turns into member access
Fixes #90974
2021-11-17 17:23:15 -07:00
Matthias Krüger
469faa2b66
Rollup merge of #90901 - rukai:improve_manuallydrop_help, r=estebank
Improve ManuallyDrop suggestion

closes https://github.com/rust-lang/rust/issues/90585
* Fixes the recommended change to use ManuallyDrop as per the issue
* Changes the note to a help
* improves the span so it only points at the type.
2021-11-17 15:58:06 +01:00
Matthias Krüger
23ad7a7697
Rollup merge of #90884 - Nilstrieb:fix-span-trivial-trait-bound, r=estebank
Fix span for non-satisfied trivial trait bounds

The spans for "trait bound not satisfied" errors in trivial trait bounds referenced the entire item (fn, impl, struct) before.
Now they only reference the obligation itself (`String: Copy`)

Address #90869
2021-11-17 15:58:04 +01:00
Esteban Kuber
4ca4e094ab Suggest removal of arguments for unit variant, not replacement 2021-11-16 20:40:35 +00:00
Mara Bos
09e4a75f29 Use span_suggestions instead of multipart_suggestions. 2021-11-16 19:53:00 +01:00
Mara Bos
b331b66082 Improve compatible enum variant suggestions. 2021-11-16 19:52:58 +01:00