Commit Graph

101 Commits

Author SHA1 Message Date
Andy Russell
9f88d75710
reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
John Kåre Alsaker
47a84f2170 Update tests 2020-03-23 19:31:41 +01:00
Mark Mansi
b6518f0f66 update tests 2020-03-12 15:47:36 -05:00
Esteban Küber
01286408c1 Account for arbitrary self types in E0599 2020-02-28 11:37:59 -08:00
Esteban Küber
1e7bcc733a Tweak wording 2020-02-28 11:37:59 -08:00
Esteban Küber
0387f0d19b Mention the full path of the implementing trait 2020-02-28 11:37:59 -08:00
Esteban Küber
8993b99ae2 On single local candidate, use span label 2020-02-28 11:37:58 -08:00
Esteban Küber
e6c85960d1 Revert "Backport only: avoid ICE on bad placeholder type"
This reverts commit 1cb555a1dc.
2020-02-27 15:59:08 -08:00
Yuki Okushi
add9338673
Rollup merge of #69324 - estebank:ice-break-backport-bad-placeholder-type, r=Centril
Backport only: avoid ICE on bad placeholder type

 #69148 has a proper fix, but it is too big to backport.
This change avoids the ICE by actually emitting an appropriate error. The
output will be duplicated in some cases, but that's better than the
avoidable ICE.

r? @Centril
2020-02-27 14:38:02 +09:00
Mark Mansi
9434d6b67f update some tests 2020-02-22 16:14:14 -06:00
Esteban Küber
1cb555a1dc Backport only: avoid ICE on bad placeholder type
#69148 has a proper fix, but it is too big to backport.
This change avoids the ICE by actually emitting an appropriate error. The
output will be duplicated in some cases, but that's better than the
avoidable ICE.
2020-02-20 11:05:24 -08:00
Matthew Jasper
78e0ab53fb Update tests 2020-02-14 22:40:03 +00:00
Matthias Prechtl
7b555178ae --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
Esteban Küber
a52ec87a17 Use more appropriate spans on object unsafe traits and provide structured suggestions when possible 2020-02-02 11:53:10 -08:00
Esteban Küber
413bfa4b98 Wording changes to object unsafe trait errors
Stemming from the thread at https://twitter.com/indygreg/status/1223279056398929920
2020-02-02 11:53:10 -08:00
Tyler Lanphear
f6c3894724 compiletest: error if compile-fail header in ui test. 2020-02-02 02:08:30 -05:00
Esteban Küber
2c5766f2d4 Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
Mazdak Farrokhzad
a436293994
Rollup merge of #66913 - VirrageS:help-self, r=varkor,Centril
Suggest calling method when first argument is `self`

Closes: #66782

I've explored different approaches for this MR but I think the most straightforward is the best one.

I've tried to find out if the methods for given type exist (to maybe have a better suggestion), but we don't collect them anywhere and collecting them is quite problematic. Moreover, collecting all the methods would require rewriting big part of the code and also could potentially include performance degradation, which I don't think is necessary for this simple case.
2020-01-04 02:19:44 +01:00
Yuki Okushi
76c1454d27
Rollup merge of #67595 - ohadravid:impl-trait-does-not-live-long-enough, r=estebank
Suggest adding a lifetime constraint for opaque type

Fixes #67577, where code like this:

```
struct List {
  data: Vec<String>,
}
impl List {
  fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> {
    self.data.iter().filter(|s| s.starts_with(prefix)).map(|s| s.as_ref())
  }
}
```

will show this error:
```
   Compiling playground v0.0.1 (/playground)
error[E0597]: `prefix` does not live long enough
 --> src/lib.rs:6:47
  |
5 |   fn started_with<'a>(&'a self, prefix: &'a str) -> impl Iterator<Item=&'a str> {
  |                   -- lifetime `'a` defined here     --------------------------- opaque type requires that `prefix` is borrowed for `'a`
...
```

but without suggesting the lovely `help: you can add a constraint..`.

r? @estebank
2020-01-03 17:56:21 +09:00
Ohad Ravid
1a4f6b85a7 Change wording for lifetime suggestion for opaque types from constraint to bound 2019-12-31 12:13:35 +01:00
Esteban Küber
6c8b2dcb19 Account for all item kinds when collecting and gateing _ in item defs 2019-12-29 19:16:15 -08:00
Esteban Küber
8cb193a5cb Suggest type param when encountering _ in fn defs
When encountering `_` type placeholder in fn arguments and return type,
suggest using generic type parameters.
Expand what counts as an inferable return type to slice, array and
tuples of `_`.
2019-12-29 19:11:27 -08:00
Janusz Marcinkiewicz
7353afdfd9 Extend suggestion span to whole method call 2019-12-23 11:57:09 +01:00
Janusz Marcinkiewicz
091853946b Add arguments to suggestion method call 2019-12-23 11:57:09 +01:00
Janusz Marcinkiewicz
8e5b2c80d3 Add more detailed suggestion 2019-12-23 11:57:09 +01:00
Janusz Marcinkiewicz
8d189ed2f1 Suggest calling method when first argument is self 2019-12-23 11:57:08 +01:00
Mazdak Farrokhzad
45c1e38147 parser: recover on &'lifetime mut $pat. 2019-12-13 02:36:25 +01:00
Mark Mansi
05db660d39 remove get_named_span 2019-11-29 11:07:06 -06:00
Mark Mansi
1f853d25b8 improve lifetime errors with implicit trait object lifetimes 2019-11-29 11:07:06 -06:00
Taylor Cramer
2083e2a647 Stabilize nested self receivers
Previously, only Self, &Self, &mut Self, Arc<Self>, Rc<Self>,
and Box<Self> were available as stable method receivers.

This commit stabilizes nested uses of all the above types.
However, nested receivers remain non-object-safe.
2019-11-26 13:35:33 -08:00
Mazdak Farrokhzad
e4a634189e
Rollup merge of #65730 - csmoe:return-lifetime, r=nikomatsakis
Suggest to add lifetime constraint at explicit ouput of functions

Closes #62097
2019-11-21 15:29:02 +01:00
csmoe
9124f7a096 update suggestion ui test 2019-11-13 00:38:37 +08:00
Guillaume Gomez
ffc1c5a04d Update ui tests 2019-11-07 13:02:34 +01:00
Esteban Küber
b26ddb8af3 Point at local similarly named element and tweak references to variants
Point at the span for the definition of ADTs internal to the current
crate.

Look at the leading char of the ident to determine whether we're
expecting a likely fn or any of a fn, a tuple struct or a tuple variant.

Turn fn `add_typo_suggestion` into a `Resolver` method.
2019-10-27 11:50:43 -07:00
Esteban Küber
0baf61bfdb Increase spacing for suggestions in diagnostics
Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.
2019-10-24 12:26:01 -07:00
bors
4a8c5b20c7 Auto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakis
Object safe for dispatch

cc #43561
2019-10-23 13:34:27 +00:00
Mathias Blikstad
ef5acdeceb RFC 2027: "first draft" of implementation
These are a squashed series of commits.
2019-10-22 15:24:33 -04:00
Mazdak Farrokhzad
aba84894d1
Rollup merge of #62330 - SimonSapin:no-drop-in-union-fields, r=RalfJung
Change untagged_unions to not allow union fields with drop

This is a rebase of #56440, massaged to solve merge conflicts and make the test suite pass.

Change untagged_unions to not allow union fields with drop

Union fields may now never have a type with attached destructor. This for example allows unions to use arbitrary field types only by wrapping them in `ManuallyDrop` (or similar).

The stable rule remains, that union fields must be `Copy`. We use the new rule for the `untagged_union` feature.

Tracking issue: https://github.com/rust-lang/rust/issues/55149
2019-10-21 22:00:45 +02:00
Simon Sapin
84ca0a1cb4 Remove most uses of allow(unions_with_drop_fields) in tests 2019-10-11 10:43:54 +02:00
Yuki Okushi
2ae5e3421d Print lifetimes with backticks 2019-10-11 16:08:53 +09:00
Tyler Mandry
cc5dcfaada
Rollup merge of #65057 - mathstuf:fix-warning-typo, r=Centril
typo: fix typo in E0392

See #64931.

---
Cc: @Centril @estebank
2019-10-03 16:25:51 -07:00
Ben Boeckel
126bf3b1dd typo: fix typo in E0392
See #64931.
2019-10-03 09:22:29 -04:00
bors
cfb6d84720 Auto merge of #64999 - nikomatsakis:issue-60424-async-return-inference, r=cramertj
extract expected return type for async fn generators

Fixes #60424

cc @Centril, I know you've been eager to see this fixed.

r? @cramertj
2019-10-03 12:19:21 +00:00
Niko Matsakis
a807032f9e ./x.py test --bless --compare-mode=nll 2019-10-03 04:20:51 -04:00
Esteban Küber
a180294f8b review comment 2019-10-02 14:34:29 -07:00
Niko Matsakis
dce20bf62a WIP fix tests 2019-10-02 14:17:38 -04:00
Esteban Küber
5cbe6aa6ca Reword E0392 slightly
Make it clearer that a type or lifetime argument not being used can be
fixed by referencing it in a struct's fields, not just using `PhathomData`.
2019-09-30 13:35:26 -07:00
bors
18f00b9496 Auto merge of #64455 - GuillaumeGomez:long-error-explanation-E0531, r=Centril
Add Long error explanation for E0531

Part of #61137.
2019-09-28 12:06:44 +00:00
Guillaume Gomez
2fd3811509 update ui tests 2019-09-25 16:41:05 +02:00
Vadim Petrochenkov
f7f8d6584b resolve: Remove ! from "cannot find" diagnostics for macros 2019-09-15 13:22:07 +03:00