Commit Graph

1669 Commits

Author SHA1 Message Date
bors
e64f1110c0 Auto merge of #103345 - Nilstrieb:diag-flat, r=compiler-errors
Flatten diagnostic slug modules

This makes it easier to grep for the slugs in the code.

See https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Localization.20infra.20interferes.20with.20grepping.20for.20error for more discussion about it.

This was mostly done with a few regexes and a bunch of manual work. This also exposes a pretty annoying inconsistency for the extra labels. Some of the extra labels are defined as additional properties in the fluent message (which makes them not prefixed with the crate name) and some of them are new fluent messages themselves (which makes them prefixed with the crate name). I don't know whether we want to clean this up at some point but it's useful to know.

r? `@davidtwco`
2022-10-23 09:06:39 +00:00
Nilstrieb
c65ebae221
Migrate all diagnostics 2022-10-23 10:09:44 +02:00
Matthias Krüger
72f75d18b1
Rollup merge of #103368 - compiler-errors:normalization-ambiguity-bug, r=oli-obk
Delay ambiguity span bug in normalize query iff not rustdoc

Oli and I decided that the compiler debt of adding another usage of `tcx.sess.opts.actually_rustdoc` is fine, because we don't really want to add more complexity to the normalize query, and moving rustdoc to use fulfill normalization (`fully_normalize`, i.e. not use the normalize query) is unnecessary overhead given that it's skipping binders and stuff.

r? oli-obk

Fixes #102827
Fixes #103181
2022-10-23 08:14:32 +02:00
Matthias Krüger
1a077420f8
Rollup merge of #103328 - compiler-errors:trivial-false-const-sugg, r=jackh726
Do not suggest trivially false const predicates

Pass through constness to `predicate_can_apply` and don't suggest other impls if it's satisfied but not const.

Fixes #103267
2022-10-23 08:14:30 +02:00
bors
26c96e3416 Auto merge of #103227 - lcnr:bye-bye-unevaluated-const, r=oli-obk
stop using `ty::UnevaluatedConst` directly

best reviewed commit by commit.

simplifies #99798 because we now don't have to expand `ty::UnevaluatedConst` to `ty::Const`.
I also remember some other places where using `ty::UnevaluatedConst` directly was annoying and caused issues, though I don't quite remember what they were rn '^^

r? `@oli-obk` cc `@JulianKnodt`
2022-10-22 07:49:33 +00:00
Michael Goulet
9f6b9dd644 Delay ambiguity span bug in normalize query iff not rustdoc 2022-10-21 18:53:16 +00:00
Rageking8
62a2a1d257 fix some typos 2022-10-21 18:04:00 +08:00
Michael Goulet
6e21b7a9b7 Do not suggest trivially false const predicates 2022-10-20 23:24:45 +00:00
Michael Goulet
1e2eb97c6e Don't call own_existential_vtable_entries on unresolved trait ref 2022-10-19 17:11:40 +00:00
lcnr
c5c6ef7029 stop folding UnevaluatedConst 2022-10-19 10:15:46 +02: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
lcnr
116d35d401 const_evaluatable_unchecked to const eval 2022-10-18 16:31:56 +02:00
lcnr
660ca48041 change ConstEvaluatable to use ty::Const 2022-10-18 16:09:04 +02: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
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
León Orell Valerian Liehr
684df4d24e
Make diagnostic for unsatisfied Termination bounds more precise 2022-10-17 12:08:46 +02:00
lcnr
e8150fa60c mir constants: type traversing bye bye 2022-10-17 10:54:01 +02:00
bors
8be3ce9056 Auto merge of #102334 - compiler-errors:rpitit-substs-issue, r=cjgillot
Fix subst issues with return-position `impl Trait` in trait

1. Fix an issue where we were rebase impl substs onto trait method substs, instead of trait substs
2. Fix an issue where early-bound regions aren't being mapped correctly for RPITIT hidden types

Fixes #102301
Fixes #102310
Fixes #102334
Fixes #102918
2022-10-16 10:10:44 +00:00
bors
75dbd5b8c3 Auto merge of #102931 - camsteffen:inline-overlapping-impls, r=cjgillot
Make `overlapping_impls` not generic

Trying to win back perf from #101632.
2022-10-16 02:05:30 +00:00
Michael Goulet
c1aa9bf849 Fix subst issues with RPITIT 2022-10-15 17:46:03 +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
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
Rageking8
7122abaddf more dupe word typos 2022-10-14 12:57:56 +08:00
Takayuki Maeda
b8418485bc check if the self type is ty::Float before getting second substs 2022-10-14 13:31:15 +09:00
Cameron Steffen
c4068c76a8 Make overlapping_impls non-generic
This improves perf
2022-10-13 14:54:48 -05:00
Michael Goulet
4a8cfe9d14 Sort elaborated existential predicates in object_ty_for_trait 2022-10-13 02:21:15 +00: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
Michael Goulet
3021598fdb Do not register placeholder region outlives when considering_regions is false 2022-10-12 04:04:55 +00: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
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
Guillaume Gomez
adc24d1b5e Fix compiler docs 2022-10-10 18:28:29 +02:00
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
Michael Goulet
693485373b Point out incompatible closure bounds 2022-10-10 05:05:26 +00: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
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
Camille GILLOT
f5fd66e0c2 Elaborate trait ref to compute object safety. 2022-10-09 13:44:21 +00:00
Michael Goulet
70f3c79c50 ImplItemKind::TyAlias => ImplItemKind::Type 2022-10-09 07:09:57 +00:00
bors
c27948d255 Auto merge of #102809 - matthiaskrgr:rollup-qq62vuv, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #101520 (Allow transmutes between the same types after erasing lifetimes)
 - #102675 (Remove `mir::CastKind::Misc`)
 - #102778 (Fix MIR inlining of asm_unwind)
 - #102785 (Remove `DefId` from some `SelectionCandidate` variants)
 - #102788 (Update rustc-dev-guide)
 - #102789 (Update browser UI test version)
 - #102797 (rustdoc: remove no-op CSS `.rightside { position: initial }`)
 - #102798 (rustdoc: add main-heading and example-wrap link CSS to big selector)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-08 14:58:11 +00:00
Matthias Krüger
f1a03b6e4a
Rollup merge of #102785 - fee1-dead-contrib:rm_autoimpl_defid, r=compiler-errors
Remove `DefId` from some `SelectionCandidate` variants

They are both from `obligation.predicate.def_id()`, which do not need to be on the `SelectionCandidate`.

cc ````@lcnr```` ````@compiler-errors````
2022-10-08 14:38:19 +02:00
bors
bba9785dd7 Auto merge of #100720 - camsteffen:representable, r=cjgillot
Rewrite representability

 * Improve placement of `Box` in the suggestion
 * Multiple items in a cycle emit 1 error instead of an error for each item in the cycle
 * Introduce `representability` query to avoid traversing an item every time it is used.
 * Also introduce `params_in_repr` query to avoid traversing generic items every time it is used.
2022-10-08 11:53:25 +00:00
bors
2d3a85b4f8 Auto merge of #102787 - Dylan-DPC:rollup-fvbb4t9, r=Dylan-DPC
Rollup of 6 pull requests

Successful merges:

 - #102300 (Use a macro to not have to copy-paste `ConstFnMutClosure::new(&mut fold, NeverShortCircuit::wrap_mut_2_imp)).0` everywhere)
 - #102475 (unsafe keyword: trait examples and unsafe_op_in_unsafe_fn update)
 - #102760 (Avoid repeated re-initialization of the BufReader buffer)
 - #102764 (Check `WhereClauseReferencesSelf` after all other object safety checks)
 - #102779 (Fix `type_of` ICE)
 - #102780 (run Miri CI when std::sys changes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-10-07 17:37:39 +00:00
Michael Goulet
8b9a1f1f4e Remove tuple candidate, nothing special about it 2022-10-07 16:19:21 +00:00
Deadbeef
e8a2aee50d Remove DefId from some SelectionCandidate variants 2022-10-07 15:14:22 +00:00
Cameron Steffen
ff940db666 Rewrite representability 2022-10-07 09:33:46 -05:00