Commit Graph

374 Commits

Author SHA1 Message Date
Esteban Küber
55dce720b2 Account for ty::Error when suggesting impl Trait or Box<dyn Trait> 2020-01-23 17:04:09 -08:00
Esteban Küber
00e2626895 Account for object safety when suggesting Box<dyn Trait> 2020-01-16 09:49:14 -08:00
Esteban Küber
d7a6212401 review comments 2020-01-16 09:49:14 -08:00
Esteban Küber
509cb33dbc review comments 2020-01-16 09:49:13 -08:00
Esteban Küber
5b36c187dc review comments 2020-01-16 09:49:13 -08:00
Esteban Küber
4c13d2555c Add E0746 explanation to the index 2020-01-16 09:37:24 -08:00
Esteban Küber
e1dd8a9095 When trait bounds are missing for return values, point at them 2020-01-16 09:37:24 -08:00
Esteban Küber
ea7e885204 Elide E0308 errors in favor of E0746
When a type error involves a `dyn Trait` as the return type, do not emit
the type error, as the "return type is not `Sized`" error will provide
enough information to the user.
2020-01-16 09:37:24 -08:00
Esteban Küber
75eabb17ae Account for diverging types in return impl Trait 2020-01-16 09:37:24 -08:00
Esteban Küber
6fd564112f Specific error for unsized dyn Trait return type
Suggest `impl Trait` when possible, and `Box<dyn Trait>` otherwise.
2020-01-16 09:37:24 -08:00
csmoe
4eb47ded54 wrap expr id into GeneratorInteriorTypeCause 2020-01-15 15:13:51 +08:00
Yuki Okushi
a491100aa3
Rollup merge of #68014 - estebank:unify-e0599, r=cramertj
Unify output of "variant not found" errors

Fix #49566.
2020-01-11 04:50:48 +09:00
Mazdak Farrokhzad
aabb03763d
Rollup merge of #66463 - estebank:point-at-closure-and-opaque-types, r=Centril
Point at opaque and closure type definitions in type errors

Fixes #57266, fixes #67117.
2020-01-10 02:47:29 +01:00
Vadim Petrochenkov
642669c74d Update tests 2020-01-09 21:23:12 +03:00
Esteban Küber
0dcdbaec0b Point at the def span of trait refs E0277 2020-01-08 09:30:27 -08:00
Esteban Küber
c55615155d review comments 2020-01-08 09:29:47 -08:00
Esteban Küber
9c0000caca Point at opaque and closure type definitions in type errors 2020-01-08 09:29:47 -08:00
Esteban Küber
2c5766f2d4 Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
Esteban Küber
2905f14b67 Account for type X = impl Trait; in lifetime suggestion 2020-01-06 13:36:06 -08:00
Ohad Ravid
1a4f6b85a7 Change wording for lifetime suggestion for opaque types from constraint to bound 2019-12-31 12:13:35 +01:00
Ohad Ravid
d4fbb55c9c Suggest adding a lifetime constraint when opaque type is responsible for "does not live long enough" error 2019-12-30 18:10:46 +01:00
Esteban Küber
90bf0d2e33 Ignore i586-unknown-linux-gnu and i586-unknown-musl in tests 2019-12-28 12:26:48 -08:00
Remy Rakic
720716f9d0 bless polonius output due to lacking the 'static special-casing 2019-12-06 11:50:02 +01:00
Aaron Hill
4b57d2228b
Fix opaque types resulting from projections in function signature
When we normalize the types in a function signature, we may end up
resolving a projection to an opaque type (e.g. `Self::MyType` when
we have `type MyType = impl SomeTrait`). When the projection is
resolved, we will instantiate the generic parameters into fresh
inference variables.

While we do want to normalize projections to opaque types, we don't want
to replace the explicit generic parameters (e.g. `T` in `impl
MyTrait<T>`) with inference variables. We want the opaque type in the
function signature to be eligible to be a defining use of that opaque
type - adding inference variables prevents this, since the opaque type
substs now appears to refer to some specific type, rather than a generic
type.

To resolve this issue, we inspect the opaque types in the function
signature after normalization. Any inference variables in the substs are
replaced with the corresponding generic parameter in the identity substs
(e.g. `T` in `impl MyTrait<T>`). Note that normalization is the only way
that we can end up with inference variables in opaque substs in a
function signature - users have no way of getting inference variables
into a function signature.

Note that all of this refers to the opaque type (ty::Opaque) and its
subst - *not* to the underlying type.

Fixes #59342
2019-11-24 14:37:23 -05:00
Esteban Küber
34f03c01f6 Point at type in let assignment on type errors 2019-11-21 19:24:31 -08:00
bors
53712f8637 Auto merge of #66389 - estebank:type-err-labels, r=petrochenkov
Specific labels when referring to "expected" and "found" types
2019-11-21 17:53:19 +00:00
Mazdak Farrokhzad
ee535a0f95
Rollup merge of #66431 - Aaron1011:fix/opaque-type-infer, r=varkor
Fix 'type annotations needed' error with opaque types

Related: #66426

This commit adds handling for opaque types during inference variable
fallback. Type variables generated from the instantiation of opaque
types now fallback to the opaque type itself.

Normally, the type variable for an instantiated opaque type is either
unified with the concrete type, or with the opaque type itself (e.g when
a function returns an opaque type by calling another function).

However, it's possible for the type variable to be left completely
unconstrained. This can occur in code like this:

```rust
pub type Foo = impl Copy;
fn produce() -> Option<Foo> {
    None
}
```

Here, we'll instantatiate the `Foo` in `Option<Foo>` to a fresh type
variable, but we will never unify it with anything due to the fact
that we return a `None`.

This results in the error message:
```
type annotations needed: cannot resolve `_: std::marker::Copy
```

pointing at `pub type Foo = impl Copy`.

This message is not only confusing, it's incorrect. When an opaque type
inference variable is completely unconstrained, we can always fall back
to using the opaque type itself. This effectively turns that particular
use of the opaque type into a non-defining use, even if it appears in a
defining scope.
2019-11-19 13:10:17 +01:00
bors
0ccee30773 Auto merge of #58281 - mark-i-m:synthesis, r=estebank
Add outlives suggestions for some lifetime errors

This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound:

- If a and b are normal named regions, suggest to add the bound `'a: 'b`
- If b is static, suggest to replace a with static
- If b also needs to outlive a, they must be the same, so suggest unifying  them

We start with a simpler implementation that avoids diagnostic regression or implementation complexity:
- We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions)
- For now, we only emit a help note, not an actually suggestion because it is significantly easier.

Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name.

For more info, see this internals thread:

https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3

TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above.

r? @estebank

TODO
- [x] Clean up code
- [x] Only make idiomatic suggestions
     - [x] don't suggest naming `&'a self`
     - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static`
     - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa
- [x] Performance (maybe need a perf run when this is closer to the finish line?)
     - perf run was clean...
     - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress?
- [x] Needs ui tests
- [x] Integrate the `help` message into the main lifetime `error`
2019-11-18 22:08:31 +00:00
Esteban Küber
6f8f70624b Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
Esteban Küber
94c6425464 Remove E0308 note when primary label has all info 2019-11-18 11:03:03 -08:00
Esteban Küber
83ffda5216 Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
Aaron Hill
a11abe0d6b
Update test output 2019-11-18 14:01:37 -05:00
Aaron Hill
0e2ccaaa3e
Fix 'type annotations needed' error with opaque types
Related: #66426

This commit adds handling for opaque types during inference variable
fallback. Type variables generated from the instantiatino of opaque
types now fallback to the opque type itself.

Normally, the type variable for an instantiated opaque type is either
unified with the concrete type, or with the opaque type itself (e.g when
a function returns an opaque type by calling another function).

However, it's possible for the type variable to be left completely
unconstrained. This can occur in code like this:

```rust
pub type Foo = impl Copy;
fn produce() -> Option<Foo> {
    None
}
```

Here, we'll instantatiate the `Foo` in `Option<Foo>` to a fresh type
variable, but we will never unify it with anything due to the fact
that we return a `None`.

This results in the error message:

`type annotations needed: cannot resolve `_: std::marker::Copy``

pointing at `pub type Foo = impl Copy`.

This message is not only confusing, it's incorrect. When an opaque type
inference variable is completely unconstrained, we can always fall back
to using the opaque type itself. This effectively turns that particular
use of the opaque type into a non-defining use, even if it appears in a
defining scope.
2019-11-18 14:01:36 -05:00
Mazdak Farrokhzad
03cf0d737f TAIT: adjust tests 2019-11-14 14:00:16 +01:00
Yuki Okushi
be3fcf4832
Rollup merge of #66186 - GuillaumeGomez:long-err-explanation-E0623, r=Dylan-DPC
Add long error explanation for E0623

Part of #61137.

r? @Dylan-DPC
2019-11-13 22:09:15 +09:00
Mazdak Farrokhzad
7ab50e4006
Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obk
Transition future compat lints to {ERROR, DENY} - Take 2

Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992.

- `legacy_ctor_visibility` (ERROR) -- closes #39207
- `legacy_directory_ownership` (ERROR) -- closes #37872
- `safe_extern_static` (ERROR) -- closes #36247
- `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238
- `duplicate_macro_exports` (ERROR)
- `nested_impl_trait` (ERROR) -- closes #59014
- `ill_formed_attribute_input` (DENY) -- transitions #57571
- `patterns_in_fns_without_body` (DENY) -- transitions #35203

r? @varkor
cc @petrochenkov
2019-11-08 16:50:33 +01:00
Yuki Okushi
9dc5d0ec81
Rollup merge of #66049 - RalfJung:missing-spans, r=alexcrichton
consistent handling of missing sysroot spans

Due to https://github.com/rust-lang/rust/issues/53081, sysroot spans (pointing to code in libcore/libstd/...) fails to print on some x86 runners. This consolidates the ignore directives for that and references the relevant issue.

I also did that for the generated derive-error-span tests -- but there the script and the tests were not entirely in sync any more since https://github.com/rust-lang/rust/pull/64151. Cc @estebank @varkor
2019-11-08 13:42:16 +09:00
Mazdak Farrokhzad
a96811ee9c
Rollup merge of #66087 - tmiasko:ui-mode, r=Centril
Update some build-pass ui tests to use check-pass where applicable

Helps with issue https://github.com/rust-lang/rust/issues/62277.
2019-11-07 14:27:24 +01:00
Guillaume Gomez
ffc1c5a04d Update ui tests 2019-11-07 13:02:34 +01:00
Esteban Küber
f545a50ee4 Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
Mazdak Farrokhzad
0cbd06ae1c nested_impl_trait -> error 2019-11-06 11:10:37 +01:00
Tomasz Miąsko
0501d8ab0d Use check-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
Ralf Jung
05c07916ed consistent handling of missing sysroot spans 2019-11-02 23:15:45 +01:00
Dmitry Kadashev
774e60b0c1 Prettify mismatched types error message in a special case
Type parameters are referenced in the error message after the previous
few commits (using span label). But when the main error message already
references the very same type parameter it becomes clumsy. Do not show
the additional label in this case as per code review comment by
@estebank.

Also this contains a small style fix.
2019-11-02 14:55:03 +07:00
Dmitry Kadashev
4e10b75951 Update tests
Update the tests to reflect changes to how type mismatch errors are
reported (two previous commits).
2019-11-02 13:23:28 +07:00
Mazdak Farrokhzad
b5b4f9b304
Rollup merge of #65855 - ObsidianMinor:extended_error/E0666, r=varkor
Add long error explaination for E0666

In the spirit of the month of spooks, here's a long explanation for E0666 for #61137.
2019-10-27 16:46:58 +01:00
Mazdak Farrokhzad
5406f7ad49
Rollup merge of #65777 - matthewjasper:allow-impl-trait-expansion, r=davidtwco
Don't ICE for completely unexpandable `impl Trait` types

Save the resolution of these types (to themselves) to the typeck tables so that they will eventually reach E0720.

closes #65561
2019-10-27 16:46:54 +01:00
Mark Mansi
cba0761e5f update tests 2019-10-27 09:39:14 -05:00
Sydney Acksman
4b2b23cc07 Add detailed explaination for E0666 2019-10-26 17:44:23 -05:00
Mazdak Farrokhzad
0aa7c6f96b
Rollup merge of #65773 - estebank:sugg-whitespace, r=Centril
Increase spacing for suggestions in diagnostics

Make the spacing between the code snippet and verbose structured
suggestions consistent with note and help messages.

r? @Centril
2019-10-26 14:17:45 +02:00
matthewjasper
0c05ed29fd
Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-10-25 18:50:40 +01:00
Matthew Jasper
707315857a Don't ICE for completely unexpandable impl Trait types 2019-10-24 21:33:09 +01: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
Sydney Acksman
4cfcb77084 Changed APIT with explicit generic args span to specific arg spans 2019-10-24 09:47:26 -05:00
Mazdak Farrokhzad
4de42a7a0b
Rollup merge of #65614 - varkor:apit-explicit-generics, r=matthewjasper
Improve error message for APIT with explicit generic arguments

This is disallowed with type or const generics. cc https://github.com/rust-lang/rust/issues/61410.
2019-10-21 01:39:16 +02:00
varkor
2f7c9a2896 Improve error message for APIT with explicit generic parameters
This is disallowed with type or const generics.
2019-10-20 01:40:24 +01:00
Esteban Küber
dbd75c8c40 Handle more cases involving impl and trait 2019-10-15 13:55:43 -07:00
Yuki Okushi
2ae5e3421d Print lifetimes with backticks 2019-10-11 16:08:53 +09:00
Alexander Regueiro
13b61b50d9 Fixed grammar in one diagnostic and blessed tests. 2019-09-30 01:15:25 +01:00
Mazdak Farrokhzad
5ed746b552
Rollup merge of #64746 - estebank:elide-impl-trait-obligations-on-err, r=cramertj
Remove blanket silencing of "type annotation needed" errors

Remove blanket check for existence of other errors before emitting "type annotation needed" errors, and add some eager checks to avoid adding obligations when they refer to types that reference `[type error]` in order to reduce unneeded errors.

Fix #64084.
2019-09-25 03:48:30 +02:00
Aaron Hill
61cfe92a99
Add additional tests for type alias impl trait coherence 2019-09-24 15:59:02 -04:00
Esteban Küber
d9ab4ff9a3 Remove blanket silencing of "type annotation needed" errors
Remove blanket check for existence of other errors before emitting
"type annotation needed" errors, and add some eager checks to avoid
adding obligations when they refer to types that reference
`[type error]` in order to reduce unneded errors.
2019-09-24 11:31:14 -07:00
Esteban Küber
b370c111fd On obligation errors point at the unfulfilled binding when possible 2019-09-22 11:33:12 -07:00
Esteban Küber
479ce39939 Add explanation to type mismatch involving type params and assoc types 2019-09-18 17:30:35 -07:00
bors
824383d4ab Auto merge of #64237 - estebank:tweak-method-not-found, r=Centril
Give method not found a primary span label
2019-09-09 08:39:59 +00:00
Esteban Küber
5799fb419c Give method not found a primary span label 2019-09-08 18:27:02 -07:00
Mark Rousskov
6fdbece55f Update test stderr with results of enabling unused lints 2019-09-08 11:32:28 -04:00
Mazdak Farrokhzad
9024032591
Rollup merge of #64038 - matthewjasper:deny-mutual-impl-trait-recursion, r=varkor
Check impl trait substs when checking for recursive types

closes #64004
2019-09-05 03:59:40 +02:00
Mazdak Farrokhzad
56d00e388b
Rollup merge of #64056 - estebank:arbitrary-self-types, r=Centril
Account for arbitrary self types in E0599

Fix https://github.com/rust-lang/rust/issues/62373
2019-09-03 14:27:00 +02:00
Esteban Küber
a9ce33c059 Account for arbitrary self types in E0599 2019-09-01 02:22:42 -07:00
Matthew Jasper
877faf3844 Check impl trait substs when checking for recursive types
This prevents mutual `async fn` recursion
2019-08-31 15:44:09 +01:00
Esteban Küber
444bc3ca66 Use span label instead of note for cause in E0631 2019-08-31 00:14:23 -07:00
Mazdak Farrokhzad
21476e7d6c --bless post no async_await gates in tests. 2019-08-20 03:08:42 +02:00
Mazdak Farrokhzad
228015acd2 Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
Niko Matsakis
832199ee76 use static as object-lifetime default for type XX in Foo<Item=XX>
Currently the default is "inherited" from context, so e.g.  `&impl
Foo<Item = dyn Bar>` would default to `&'x impl Foo<Item = dyn Bar +
'x>`, but this triggers an ICE and is not very consistent.

This patch doesn't implement what I expect would be the correct
semantics, because those are likely too complex. Instead, it handles
what I'd expect to be the common case -- where the trait has no
lifetime parameters.
2019-08-19 13:50:44 -04:00
Niko Matsakis
af86fb1959 distinguish object-lifetime-default elision from other elision
Object-lifetime-default elision is distinct from other forms of
elision; it always refers to some enclosing lifetime *present in the
surrounding type* (e.g., `&dyn Bar` expands to `&'a (dyn Bar + 'a)`.
If there is no enclosing lifetime, then it expands to `'static`.

Therefore, in an `impl Trait<Item = dyn Bar>` setting, we don't expand
to create a lifetime parameter for the `dyn Bar + 'X` bound.  It will
just be resolved to `'static`.

Annoyingly, the responsibility for this resolution is spread across
multiple bits of code right now (`middle::resolve_lifetimes`,
`lowering`). The lowering code knows that the default is for an object
lifetime, but it doesn't know what the correct result would be.
Probably this should be fixed, but what we do now is a surgical fix:
we have it generate a different result for elided lifetimes in a
object context, and then we can ignore those results when figuring out
the lifetimes that are captured in the opaque type.
2019-08-19 13:50:42 -04:00
sd234678
b7b4c3a9aa Update stderr files with --bless 2019-08-16 10:54:20 +01:00
sd234678
56ebd57960 Remove meaningless comments in src/test 2019-08-16 10:54:20 +01:00
David Wood
861d1bb365
typeck: Prohibit RPIT types that inherit lifetimes
This commit prohibits return position `impl Trait` types that "inherit
lifetimes" from the parent scope. The intent is to forbid cases that are
challenging until they can be addressed properly.
2019-08-12 19:04:11 +01:00
Vadim Petrochenkov
8cc8133973 Fix calls to resolver from rustdoc and HIR lowering
Cleanup some surrounding code.
Support resolution of intra doc links in unnamed block scopes.
(Paths from rustdoc now use early resolution and no longer need results of late resolution like all the built ribs.)

Fix one test hitting file path limits on Windows.
2019-08-10 13:16:06 +03:00
varkor
70c8839f7c Fix fallout after rebase 2019-08-02 02:44:36 +01:00
varkor
c28ce3e4ca Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
varkor
fc48541ab1 Update syntax in existing tests 2019-08-02 02:44:35 +01:00
Mazdak Farrokhzad
24a178e397 --bless tests due to INCOMPLETE_FEATURES being a lint. 2019-07-30 10:43:32 +02:00
Vadim Petrochenkov
5486cc69bd tests: Move run-pass tests with naming conflicts to ui 2019-07-27 18:56:17 +03:00
Vadim Petrochenkov
9be35f82c1 tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
Samy Kacimi
51ee196235
normalize use of backticks in compiler messages for librustc/hir
https://github.com/rust-lang/rust/issues/60532
2019-07-21 16:54:33 +02:00
bors
fe499a7b34 Auto merge of #62684 - petrochenkov:scopevisit, r=davidtwco
resolve: Improve candidate search for unresolved macro suggestions

Use same scope visiting machinery for both collecting suggestion candidates and actually resolving the names.

The PR is better read in per-commit fashion with whitespace changes ignored (the first commit in particular moves some code around).

This should be the last pre-requisite for https://github.com/rust-lang/rust/pull/62086.
r? @davidtwco
2019-07-19 00:24:39 +00:00
Mark Rousskov
4544b4d288
Rollup merge of #62777 - gilescope:self-referencial-to-recursion, r=eddyb
Self-referencial type now called a recursive type

As per Boat's suggestion - #62539, this makes the error message clearer.
2019-07-18 11:29:57 -04:00
Vadim Petrochenkov
a7726ce086 resolve: Attempt to resolve unresolved paths in macro namespace 2019-07-18 13:42:45 +03:00
Giles Cope
c56c5a861a Self-referencial type renamed to recursive type. 2019-07-18 07:30:51 +01:00
bors
0b680cfce5 Auto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakis
Normalize projections appearing in `impl Trait`

Fixes #60414

This does not try to do the same for `existential type`s (which have the same bug), since that always seems to lead to cycle errors.
2019-07-09 18:35:12 +00:00
Niko Matsakis
66e026666d rewrite the test to workaround #51525 2019-07-09 06:57:52 -04:00
Mazdak Farrokhzad
3bbc421142
Rollup merge of #62090 - davidtwco:ice-async-await-out-of-range-substitution, r=nikomatsakis
typeck: merge opaque type inference logic

Fixes #55872. See [relevant Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async-foundations/topic/type.20parameter.20out.20of.20range.20.2355872).

r? @nikomatsakis
2019-07-09 04:52:37 +02:00
Yuki Okushi
ce77031e96 Remove compile-pass from compiletest
Also change annotations in some tests
2019-07-06 02:06:00 +09:00
Mazdak Farrokhzad
919349701a
Rollup merge of #62317 - JohnTitor:move-tests-to-build-pass, r=Centril
Migrate `compile-pass` annotations to `build-pass`

This is a part of #62277.

As a first step, the `compile-pass` tests are migrated to `build-pass`.

r? @cramertj
cc @Centril
2019-07-04 01:38:58 +02:00
Jonas Schievink
769b1cfd03 Normalize projections in opaque types 2019-07-03 22:21:34 +02:00
David Wood
de8660ab61
typeck: merge opaque type inference logic
This commit merges the logic used for opaque type type inference for
impl Trait and non-impl Trait cases. This fixes an ICE where
existential types used in the return types of functions would be allowed
to have an out-of-scope generic type parameter.
2019-07-03 08:32:09 +01:00
Yuki Okushi
c004451a20 Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
Niko Matsakis
f7e00a55bb fix ICE with delay-span-bug 2019-07-02 14:23:38 -04:00
Niko Matsakis
0c2c2416bf address nits 2019-07-02 12:25:23 -04:00
Niko Matsakis
076b0d0f5c more nits + typos 2019-07-02 12:25:23 -04:00
Niko Matsakis
74a6efbf00 feature-gate member constraints outside of async-await
Minimizes risk.
2019-07-02 12:25:22 -04:00
Niko Matsakis
5d44bebb32 bless test output 2019-07-02 12:25:21 -04:00
Niko Matsakis
adba6a8f90 address nits by mattewjasper 2019-07-02 12:25:21 -04:00
Niko Matsakis
0b15a66a80 account for the pick-constraint edges when reporting errors
Also, thread through better span info to improve the error message to
something tolerable.
2019-07-02 12:25:21 -04:00
Niko Matsakis
e9de08a5ea test with explicit existential type 2019-07-02 12:15:21 -04:00
Niko Matsakis
b170c0f1c4 add a preliminary existential test; not really enough 2019-07-02 12:15:21 -04:00
Niko Matsakis
4de99600b0 add a FIXME related to the non-free-region case
I don't think it would actually be harmful to just ignore such cases
but I'm inclined not to take chances.
2019-07-02 12:15:21 -04:00
Niko Matsakis
b5fb906766 fix tests and remove outdated stderr files 2019-07-02 12:15:20 -04:00
Niko Matsakis
07ee532031 improve tests with migration mode, mir mode 2019-07-02 12:15:20 -04:00
Niko Matsakis
cc581bfa0e remove old error and add an explanation 2019-07-02 12:15:20 -04:00
Niko Matsakis
d6ec0ae777 enforce and report pick-constraint errors
The error message here is not great.
2019-07-02 12:15:19 -04:00
Niko Matsakis
f0eebcd02f integrate pick constraints into lexical solver more completely 2019-07-02 12:15:19 -04:00
Niko Matsakis
c36205b48e add some tests, currently ICE-ing 2019-07-02 12:15:19 -04:00
Alexander Regueiro
ee890331f6 Reblessed tests with NLL compare mode on. 2019-06-06 03:29:02 +01:00
Mazdak Farrokhzad
5baa58ea5f
Rollup merge of #61499 - varkor:issue-53457, r=oli-obk
Add regression test for existential type ICE #53457

Closes #53457.
2019-06-04 04:48:31 +02:00
varkor
1c6dce8b6d Add ui/impl-trait/issues folder 2019-06-03 19:57:13 +01:00
varkor
41dd21a9bc Add a regression test for #53457 2019-06-03 19:54:28 +01:00
Esteban Küber
860dce794c Remove unecessary -Z continue-parse-after-error from tests 2019-05-30 18:57:17 -07:00
Mazdak Farrokhzad
e19a229c88
Rollup merge of #60756 - matthewjasper:extra-impl-trait-tests, r=nikomatsakis
Add better tests for hidden lifetimes in impl trait

cc #60670
2019-05-29 00:19:53 +02:00
varkor
59762baf8a Move async/await tests to test/ui/async-await 2019-05-24 21:49:34 +01:00
Matthew Jasper
53e0474254 Add better tests for hidden lifetimes in impl trait 2019-05-18 13:16:45 +01:00
bors
b982867a73 Auto merge of #60171 - matthewjasper:full-nll-compare-mode, r=pnkfelix
Use -Zborrowck=mir for NLL compare mode

closes #56993

r? @pnkfelix
2019-05-17 13:01:23 +00:00
Pulkit Goyal
ea956e3ae9 add impl_trait_in_bindings to INCOMPLETE_FEATURES
impl_trait_in_bindings is not yet complete and can lead to compiler crashes.

Fixes #60764.
2019-05-13 18:45:20 +03:00
Matthew Jasper
be5fe051a8 Remove feature(nll) when compare mode is sufficient 2019-05-12 18:46:43 +01:00
Matthew Jasper
ff71b80a85 Change compare mode to use -Zborrowck=mir 2019-05-12 18:46:43 +01:00
Matthew Jasper
664c8ed301 Always use the stronger outlives version for opaque types 2019-05-12 17:12:49 +01:00
Matthew Jasper
d72f4de659 Constrain all regions in the concrete type for an opaque type 2019-05-02 18:56:56 +01:00
Taylor Cramer
3f966dcd53 Stabilize futures_api 2019-04-23 16:13:53 -07:00
varkor
497dcfa221 Update ui tests 2019-04-23 11:42:14 +01:00
varkor
62838975d0 Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
varkor
7f0f0e31ec Remove double trailing newlines 2019-04-22 16:57:01 +01:00
Andy Russell
b6f148c8bd
hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
Esteban Küber
30c247f881 Suggest using anonymous lifetime in impl Trait return without hacks
Fallback to `static_impl_trait` for nice error message by peeking at the
return type and the lifetime type. Point at the return type instead of
the return expr/stmt in NLL mode.
2019-03-31 09:11:47 -07:00
Esteban Küber
ee2a9d93e9 Suggest using anonymous lifetime in impl Trait return 2019-03-29 13:24:29 -07:00
Eduard-Mihai Burtescu
a54a41ce47 rustc: provide DisambiguatedDefPathData in ty::print. 2019-03-15 13:25:10 +02:00
bors
8f4c226fc5 Auto merge of #58608 - pnkfelix:warning-period-for-detecting-nested-impl-trait, r=zoxc
Warning period for detecting nested impl trait

Here is some proposed code for making a warning period for the new checking of nested impl trait.

It undoes some of the corrective effects of PR #57730, by using boolean flags to track parts of the analysis that were previously skipped prior to PRs #57730 and #57981 landing.

Cc #57979
2019-03-12 12:09:47 +00:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Felix S. Klock II
837856d120 Test illustrating that the nested_impl_trait lint should only catch shallow cases. 2019-03-11 16:30:40 +01:00
Felix S. Klock II
d6cee67c27 Unit (and regression) tests for warning cycle code. 2019-03-08 16:36:37 +01:00
Nathan Corbyn
8300f51936 Deny async fn in 2015 edition
Fix style issues and update diagnostic messages

Update src/librustc_passes/diagnostics.rs

Co-Authored-By: doctorn <me@nathancorbyn.com>

Deny nested `async fn` in Rust 2015 edition

Deny nested `async fn` in Rust 2015 edition

Deny nested `async fn` in Rust 2015 edition
2019-02-24 16:33:12 +00:00
varkor
f2fe71c02a Resolve incorrect diagnostic for using a non-const value in a constant 2019-02-07 16:03:12 +01:00
Mazdak Farrokhzad
8ef8d57029
Rollup merge of #57793 - estebank:impl-trait-resolve, r=oli-obk
Explain type mismatch cause pointing to return type when it is `impl Trait`

Fix #57743.
2019-01-24 00:19:54 +01:00
Esteban Küber
e33f7f7de1 Explain type mismatch cause pointing to return type when it is impl Trait 2019-01-20 18:42:10 -08:00
Esteban Küber
c4b8df5df2 Remove unnecessary dummy span checks
The emitter already verifies wether a given span note or span label
can be emitted to the output. If it can't, because it is a dummy
span, it will be either elided for labels or emitted as an unspanned
note/help when applicable.
2019-01-20 13:29:03 -08:00
John Kåre Alsaker
468254b38f Update tests 2019-01-11 03:53:30 +01:00
Matthew Jasper
65c1f54a06 Forbid impl Trait from referring to unnamable recursive types
There is no type T, such that `T = [T; 2]`, we should not allow this
to be circumvented by impl Trait.
2019-01-03 22:15:02 +00:00
Vadim Petrochenkov
8b1c424b6d privacy: Use common DefId visiting infra for all privacy visitors 2019-01-01 01:39:55 +03:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00