Commit Graph

398 Commits

Author SHA1 Message Date
Oli Scherer 1f7df1956a Replace `type_alias_impl_trait` by `min_type_alias_impl_trait` with no actual changes in behaviour
This makes `type_alias_impl_trait` not actually do anything anymore
2021-03-15 17:32:43 +00:00
Camille GILLOT 445b4e379c Make def_key and HIR parenting consistent. 2021-03-12 22:48:32 +01:00
Dan Aloni eaefe4a230 path trimming: ignore type aliases 2021-02-06 12:03:48 +02:00
Caio ad35979c50 Move some tests to more reasonable directories - 2
Address comments

Update limits
2021-01-16 19:46:54 -03:00
Esteban Küber 9a5dcaab67 Use correct span for structured suggestion
On structured suggestion for `let` -> `const`  and `const` -> `let`, use
a proper `Span` and update tests to check the correct application.

Follow up to #80012.
2021-01-07 16:52:44 -08:00
Daiki Ihara c9e7045e81 bless tests 2021-01-07 20:20:58 +09:00
Alex Macleod 2a5a379b46 Add two regression tests
For #78721 and #78722
2020-11-16 23:13:45 +00:00
Yuki Okushi 6abd2a59e7
Rollup merge of #78349 - JohnTitor:issue-75962, r=davidtwco
Use its own `TypeckResults` to avoid ICE

Fixes #75962
2020-10-27 08:45:07 +09:00
Yuki Okushi 88d39673d7 Use its own `TypeckResults` to avoid ICE 2020-10-25 18:35:24 +09:00
bors 3e0dd24a6c Auto merge of #77546 - lcnr:impl-trait-closure, r=eddyb
fix def collector for impl trait

fixes #77329

We now consistently make `impl Trait` a hir owner, requiring some special casing for synthetic generic params.

r? `@eddyb`
2020-10-25 07:03:58 +00:00
Esteban Küber 88f5e110db review comments 2020-10-20 09:26:15 -07:00
Esteban Küber ae0e3d0511 Tweak "object unsafe" errors
Fix #77598.
2020-10-20 09:26:14 -07:00
Yuki Okushi 7db8904518 Add test for issue-70877 2020-10-18 07:57:23 +09:00
Yuki Okushi f7150be674 Suggest minimal subset features in `incomplete_features` lint 2020-10-17 02:01:08 +09:00
Yuki Okushi 3a4fe97052 Add a regression test for issue-65581 2020-10-09 18:32:33 +09:00
Bastian Kauschke a5d2db4a58 arg position 2020-10-07 10:19:04 +02:00
Bastian Kauschke 5ac268c435 do not lower patterns in impl Trait 2020-10-07 10:19:04 +02:00
Jack Huey 23491084bc Update to chalk 0.31. Implement some unimplemented. Ignore some tests in compare mode chalk don't finish. 2020-10-06 14:14:25 -04:00
Matthew Jasper 022c148fcd Fix tests from rebase 2020-10-06 11:19:33 +01:00
Matthew Jasper bc08b791bc Fix bugs in evaluating WellFormed predicates
- List the nestsed obligations in an order that works with the
  single pass used by evaluation
- Propagate recursion depth correctly
2020-10-06 11:19:31 +01:00
Matthew Jasper 5b279c8016 Check opaque types satisfy their bounds 2020-10-06 11:19:30 +01:00
bors 6ac6c67574 Auto merge of #77069 - sexxi-goose:closure_print_2, r=nikomatsakis
pretty.rs: Update Closure and Generator print

More detailed outline: https://github.com/rust-lang/project-rfc-2229/pull/17

Closes: https://github.com/rust-lang/project-rfc-2229/issues/11

r? `@nikomatsakis`
cc `@eddyb` `@davidtwco` `@estebank`
2020-09-30 03:10:47 +00:00
Aman Arora c923da0b49 pretty.rs: Update Closure and Generator print
Co-authored-by: Dhruv Jauhar <dhruvjhr@gmail.com>
Co-authored-by: Logan Mosier <logmosier@gmail.com>
2020-09-28 01:27:19 -04:00
Matthew Jasper 3a81adeca2 Call `type_of` for opaque types later in compilation
This ensures that various wf checks have already been done before we
typeck item bodies.
2020-09-26 17:56:03 +01:00
marmeladema f1878d19fa Move from {{closure}}#0 syntax to {closure#0} for (def) path components 2020-09-25 22:46:14 +01:00
Esteban Küber 5d2a935e6c Make suggestion more complete 2020-09-11 17:05:18 -07:00
Esteban Küber ff297fafbf Make suggestion have a more targetted underline 2020-09-11 17:05:18 -07:00
Esteban Küber c8ee33714b Use structured suggestion for `impl T` to `Box<dyn T>` 2020-09-11 17:05:18 -07:00
Tyler Mandry 5ea55518bc
Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasper
Improve unresolved use error message

"use of undeclared type or module `foo`" doesn't mention that it could be a crate.

This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate.

I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.
2020-09-09 15:05:45 -07:00
Bastian Kauschke c81935e6df make `ConstEvaluatable` more strict 2020-09-08 16:39:12 +02:00
Dan Aloni 07e7823c01 pretty: trim paths of unique symbols
If a symbol name can only be imported from one place for a type, and
as long as it was not glob-imported anywhere in the current crate, we
can trim its printed path and print only the name.

This has wide implications on error messages with types, for example,
shortening `std::vec::Vec` to just `Vec`, as long as there is no other
`Vec` importable anywhere.

This adds a new '-Z trim-diagnostic-paths=false' option to control this
feature.

On the good path, with no diagnosis printed, we should try to avoid
issuing this query, so we need to prevent trimmed_def_paths query on
several cases.

This change also relies on a previous commit that differentiates
between `Debug` and `Display` on various rustc types, where the latter
is trimmed and presented to the user and the former is not.
2020-09-02 22:26:37 +03:00
Kornel 7ec1de062a Clarify message about unresolved use 2020-09-01 18:38:14 +01:00
mark 2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
Yuki Okushi 8dcf86887c
Add test for issue-72911 2020-07-26 18:54:54 +09:00
Esteban Küber 7bf39fa9d9 Further tweak wording of E0759 and introduce E0767 2020-07-22 12:25:54 -07:00
Esteban Küber b7db6bb5af Remove `Sized` `on_unimplemented` note 2020-07-14 10:50:24 -07:00
Dylan DPC 45de677b1e
Rollup merge of #73646 - JohnTitor:add-tests, r=Dylan-DPC
Add some regression tests

Closes #44861
Closes #51506
Closes #59435
Closes #69840
2020-06-24 14:28:41 +02:00
Yuki Okushi 814782b4c6
Add test for issue-69840 2020-06-23 17:52:51 +09:00
Manish Goregaokar cd18ac1ce8
Rollup merge of #73496 - estebank:opaque-missing-lts-in-fn-3, r=nikomatsakis
Account for multiple impl/dyn Trait in return type when suggesting `'_`

Make `impl` and `dyn` Trait lifetime suggestions a bit more resilient.

Follow up to #72804.

r? @nikomatsakis
2020-06-23 00:33:58 -07:00
Manish Goregaokar 203305d095
Rollup merge of #71420 - RalfJung:specialization-incomplete, r=matthewjasper
Specialization is unsound

As discussed in https://github.com/rust-lang/rust/issues/31844#issuecomment-617013949, it might be a good idea to warn users of specialization that the feature they are using is unsound.

I also expanded the "incomplete feature" warning to link the user to the tracking issue.
2020-06-19 19:42:43 -07:00
Esteban Küber 562f4967b4 Account for multiple impl/dyn Trait in return type when suggesting `'_` 2020-06-19 13:40:51 -07:00
Manish Goregaokar b443a107f8
Rollup merge of #73382 - Aaron1011:fix/self-receiver-candidates, r=petrochenkov
Only display other method receiver candidates if they actually apply

Previously, we would suggest `Box<Self>` as a valid receiver, even if
method resolution only succeeded due to an autoderef (e.g. to `&self`)
2020-06-19 09:15:16 -07:00
Manish Goregaokar 40fd2bdcfe
Rollup merge of #72804 - estebank:opaque-missing-lts-in-fn-2, r=nikomatsakis
Further tweak lifetime errors involving `dyn Trait` and `impl Trait` in return position

* Suggest substituting `'static` lifetime in impl/dyn `Trait + 'static` instead of `Trait + 'static + '_`
* When `'static` is explicit, also suggest constraining argument with it
* Reduce verbosity of suggestion message and mention lifetime in label
* Tweak output for overlapping required/captured spans
* Give these errors an error code

Follow up to #72543.

r? @nikomatsakis
2020-06-18 15:20:43 -07:00
Ralf Jung 5fbef22a44 warn against 'specialization' feature 2020-06-16 09:39:34 +02:00
Aaron Hill 8956a7f581
Only display other method receiver candidates if they actually apply
Previously, we would suggest `Box<Self>` as a valid receiver, even if
method resolution only succeeded due to an autoderef (e.g. to `&self`)
2020-06-15 15:15:35 -04:00
Esteban Küber 8f12485335 review comments 2020-06-15 12:11:28 -07:00
Esteban Küber 96f5584b80 Expand "recursive opaque type" diagnostic
Fix #70968, partially address #66523.
2020-06-15 11:08:43 -07:00
Esteban Küber f7a1f97307 Change E0758 to E0759 to avoid conflict with #72912 2020-06-15 09:06:58 -07:00
Esteban Küber e31367de6b small tweaks 2020-06-15 09:06:58 -07:00
Esteban Küber 34d8692262 Register new eror code 2020-06-15 09:06:58 -07:00