Commit Graph

151 Commits

Author SHA1 Message Date
Maybe Waffle
13b67fb9d2 bless ui tests 2022-10-01 10:03:06 +00:00
León Orell Valerian Liehr
28e0c5aec8 Allow more !Copy impls 2022-09-23 21:51:40 +02:00
Santiago Pastorino
ac0b6af37b Permit negative impls coherence to take advantage of implied bounds 2022-08-23 08:55:43 -03:00
Michael Goulet
ba7272959d Use separate infcx to solve obligations during negative coherence 2022-08-20 04:49:24 +00:00
Andy Wang
84a199369b Reword "Required because of the requirements on the impl of ..." 2022-08-18 21:08:08 +01:00
Matthias Krüger
a1fdea2b78 Rollup merge of #100514 - compiler-errors:issue-100191, r=spastorino
Delay span bug when failing to normalize negative coherence impl subject due to other malformed impls

Fixes #100191

r? ``@spastorino``
2022-08-15 20:11:36 +02:00
Michael Goulet
c436930f91 Delay span bug when failing to normalize negative coherence impl subject due to other malformed impls 2022-08-13 22:11:42 +00:00
lcnr
c9b21b0ea2 orphan check: remove const generics fixme 2022-07-28 17:35:27 +02:00
Michael Goulet
b7cf9f72f6 Restore Opaque behavior to coherence check 2022-07-25 23:38:41 +00:00
rhysd
d5aed20f47 Remove duplicate notes from error on inter-crate ambiguous impl of traits (fix #99092) 2022-07-10 16:39:12 +09:00
bors
9a6fa4f118 Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #97249 (`<details>`/`<summary>` UI fixes)
 - #98418 (Allow macOS to build LLVM as shared library)
 - #98460 (Use CSS variables to handle theming)
 - #98497 (Improve some inference diagnostics)
 - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests)

Failed merges:

 - #98761 (more `need_type_info` improvements)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-01 22:55:22 +00:00
Michael Goulet
12ab6bfafd Don't point at Self type if we can't find an infer variable in ambiguous trait predicate 2022-07-01 17:38:34 +00:00
Camille GILLOT
42e4eee893 Shorten def_span for more items. 2022-07-01 17:39:19 +02:00
Camille GILLOT
0ff8c65d6f Perform coherence checking per impl. 2022-06-22 21:18:46 +02:00
klensy
989d1a732f fix one more case of trailing space 2022-06-16 14:40:29 +03:00
lcnr
79c3011d9d update explicit impls error msg 2022-06-01 20:36:20 +02:00
Dylan DPC
04f903859a Rollup merge of #95979 - lcnr:coherence-docs, r=compiler-errors
update coherence docs, fix generator + opaque type ICE

the world is confusing, this makes it slightly less so
2022-05-18 08:41:14 +02:00
lcnr
58781edc54 update coherence docs, fix opaque type + generator ice 2022-05-10 09:09:06 +02:00
Takayuki Maeda
547cb2722b make E0117 error clear 2022-04-21 16:47:01 +09:00
bors
e70e211e99 Auto merge of #95082 - spastorino:overlap-inherent-impls, r=nikomatsakis
Overlap inherent impls

r? `@nikomatsakis`

Closes #94526
2022-03-25 09:09:48 +00:00
Santiago Pastorino
d96faef913 Where bounds are checked on inherent impls 2022-03-24 17:47:10 -03:00
Michael Goulet
c8cbd3d03c better errors when a Copy impl is not coherent 2022-03-22 18:15:29 -07:00
Santiago Pastorino
89fdb62331 Fix inherent impls on negative coherence 2022-03-18 14:11:04 -03:00
Santiago Pastorino
91846fe12a This test now works 2022-03-17 14:38:27 -03:00
Santiago Pastorino
64dfd3b234 Make negative coherence work when there's impl negative on super predicates 2022-03-17 12:15:11 -03:00
Santiago Pastorino
c3797dcce6 Add double negative trait test case 2022-03-16 14:59:03 -03:00
Santiago Pastorino
ff11dfd71d Add failing test that should pass 2022-02-14 12:57:22 -03:00
Santiago Pastorino
3fd89a662a Properly check regions on negative overlap check 2022-02-14 12:56:28 -03:00
Santiago Pastorino
a9bfb5d837 Move overlap_mode into trait level attribute + feature flag 2022-01-31 11:50:43 -03:00
Santiago Pastorino
d2d25a5be0 Implement stable with negative coherence mode 2022-01-21 18:22:21 -03:00
Andre Bogus
635533bebb manually implement Hash for DefId
This also reorders the fields to reduce the assembly operations for hashing
and changes two UI tests that depended on the former ordering because of
hashmap iteration order.
2021-12-10 00:40:41 +01: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
lcnr
1296719c06 no overlap errors after failing the orphan check 2021-11-10 15:10:19 +01:00
Esteban Kuber
ef212e7fb3 Point at overlapping impls when type annotations are needed 2021-10-24 18:33:04 +00:00
Santiago Pastorino
9534186857 Hide negative coherence checks under negative_impls feature flag 2021-10-22 17:54:20 -03:00
Santiago Pastorino
9e264137e9 Be sure that we do not allow too much 2021-10-22 16:42:06 -03:00
Santiago Pastorino
da79fa964c Add rustc_strict_coherence attribute and use it to check overlap 2021-10-22 15:49:46 -03:00
Santiago Pastorino
511076a102 Test that if we promise to not impl what would overlap it doesn't actually overlap 2021-10-20 12:10:45 -03:00
Aaron Hill
6dbb9d4eee Don't use projection cache or candidate cache in intercrate mode
Fixes #88969

It appears that *just* disabling the evaluation cache (in #88994)
leads to other issues involving intercrate mode caching. I suspect
that since we now always end up performing the full evaluation
in intercrate mode, we end up 'polluting' the candidate and projection
caches with results that depend on being in intercrate mode in some way.
Previously, we might have hit a cached evaluation (stored during
non-intercrate mode), and skipped doing this extra work in
intercrate mode.

The whole situation with intercrate mode caching is turning into
a mess. Ideally, we would remove intercrate mode entirely - however,
this might require waiting on Chalk.
2021-09-20 14:37:11 -05:00
bors
e36621057d Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisa
Point at argument instead of call for their obligations

When an obligation is introduced by a specific `fn` argument, point at
the argument instead of the `fn` call if the obligation fails to be
fulfilled.

Move the information about pointing at the call argument expression in
an unmet obligation span from the `FulfillmentError` to a new
`ObligationCauseCode`.

When giving an error about an obligation introduced by a function call
that an argument doesn't fulfill, and that argument is a block, add a
span_label pointing at the innermost tail expression.

Current output:

```
error[E0425]: cannot find value `x` in this scope
 --> f10.rs:4:14
  |
4 |         Some(x * 2)
  |              ^ not found in this scope

error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
 --> f10.rs:2:31
  |
2 |       let p = Some(45).and_then({
  |  ______________________--------_^
  | |                      |
  | |                      required by a bound introduced by this call
3 | |         |x| println!("doubling {}", x);
4 | |         Some(x * 2)
  | |         -----------
5 | |     });
  | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
  |
  = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
```

Previous output:

```
error[E0425]: cannot find value `x` in this scope
 --> f10.rs:4:14
  |
4 |         Some(x * 2)
  |              ^ not found in this scope

error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>`
 --> f10.rs:2:22
  |
2 |     let p = Some(45).and_then({
  |                      ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>`
  |
  = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>`
```

Partially address #27300. Will require rebasing on top of #88546.
2021-09-16 22:17:33 +00:00
Esteban Kuber
569a842730 Point at call span that introduced obligation for the arg 2021-09-16 12:12:27 +00:00
Esteban Kuber
9762116299 Move object safety suggestions to the end of the error 2021-09-15 14:48:53 +00:00
Camille GILLOT
bd2f08c22f Bless tests. 2021-09-02 19:08:59 +02:00
Mara Bos
bbc94ed329 Rollup merge of #88525 - notriddle:notriddle/coherence-dyn-auto-trait, r=petrochenkov
fix(rustc_typeck): produce better errors for dyn auto trait

Fixes #85026
2021-09-01 09:23:28 +02:00
Michael Howell
6e70678f7d Change wording to less jaron-y "non-auto trait"
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2021-08-31 08:53:23 -07:00
Michael Howell
026322c34b fix(rustc_typeck): produce better errors for dyn auto trait
Fixes #85026
2021-08-30 22:15:11 -07:00
Noah Lev
2f48bfa88c Improve errors for recursive type aliases 2021-08-21 18:30:25 -07:00
Esteban Küber
39f220ce12 Use note to point at bound introducing requirement 2021-08-16 17:47:22 +00:00
jackh726
b9ee2fb6d8 When pretty printing, name placeholders as bound regions 2021-07-18 03:35:54 -04:00
Esteban Küber
b8dda53e69 Remove trailing : from E0119 message 2021-04-06 18:16:11 -07:00