Commit graph

50 commits

Author SHA1 Message Date
Matthew Jasper
acb6a06123 Fix various Chalk lowering bugs
- Add more well-known traits
- Use the correct binders when lowering trait objects
- Use correct substs when lowering trait objects
- Use the correct binders for opaque_ty_data
- Lower negative impls with the correct polarity
- Supply associated type values
- Use `predicates_defined_on` for where clauses
2020-10-30 19:39:33 +00:00
Matthew Jasper
f958e6c246 Separate bounds and predicates for associated/opaque types 2020-10-06 11:19:29 +01:00
Bram van den Heuvel
7dad29d686 Remove def_id field from ParamEnv 2020-09-09 10:14:31 +02:00
Jack Huey
3a9a4e8b2d Bless changed test output 2020-09-04 19:12:54 -04:00
Jack Huey
d66452c3e5 Upgrade chalk to 0.21 2020-09-04 19:12:54 -04: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
Esteban Küber
b7db6bb5af Remove Sized on_unimplemented note 2020-07-14 10:50:24 -07:00
Jack Huey
ecb8b9f9f7 Update Chalk 2020-06-24 00:48:33 -04:00
Jack Huey
16ad3f302b Nits and change skip_binder to no_bound_vars for fndef 2020-06-19 14:05:14 -04:00
Jack Huey
e997375934 Test error order is non-deterministic 2020-06-19 14:05:14 -04:00
Jack Huey
a42e5a14c4 Implement fn_def_datum 2020-06-19 14:05:14 -04:00
Jack Huey
a24df5b3cd Reintegrate chalk using chalk-solve 2020-05-07 17:35:58 -04:00
CAD97
b3777c952f Remove chalk integration 2020-03-02 18:11:53 -05: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
b370c111fd On obligation errors point at the unfulfilled binding when possible 2019-09-22 11:33:12 -07:00
Esteban Küber
444bc3ca66 Use span label instead of note for cause in E0631 2019-08-31 00:14:23 -07:00
Vadim Petrochenkov
9be35f82c1 tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
Andy Russell
b6f148c8bd
hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
scalexm
d6a2b7c470 Fix a bug in implied bounds 2019-03-20 20:09:26 +01:00
scalexm
60ea7cbe4e Gather region constraints not coming from unification 2019-03-20 20:03:20 +01:00
Vadim Petrochenkov
fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Yuning Zhang
710dcbd381 Improve type mismatch error messages
Replace "integral variable" with "integer" and replace
"floating-point variable" with "floating-point number" to make the
message less confusing.
2018-12-31 20:43:08 -05:00
scalexm
81d6f9cc81 Add tests 2018-12-27 19:21:16 +01:00
Mark Rousskov
2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
csmoe
e853d6c5b6 Implement ProjectionEq-Normalize 2018-11-13 20:33:21 +01:00
scalexm
79b6c41bc2 Use a dummy outlives requirement for where Type:, (see #53696)
A `WF(Type)` predicate was used previously, which did not play
well with implied bounds in chalk.
2018-11-13 12:28:43 +01:00
scalexm
239df7be37 Bypass ppaux for Outlives predicates 2018-11-13 12:28:43 +01:00
scalexm
3510805f7e Provide program clauses for builtin types 2018-11-13 12:28:43 +01:00
scalexm
eacebf24b0 Pretty print quantified goals and clauses 2018-11-13 12:28:43 +01:00
scalexm
b5d1aac883 Add tests for program_clauses_for_env 2018-10-17 14:09:39 +02:00
scalexm
96ff827395 Add chalk rules related to associated type defs
* Rule ProjectionEq-Skolemize
* Rule WellFormed-AssocTy
* Rule Implied-Trait-From-AssocTy
2018-10-08 15:26:22 +02:00
scalexm
8327976890 Remove duplicate predicates in explicit_predicates_of
Fixes #52187.
2018-10-03 13:57:47 +02:00
Eduard-Mihai Burtescu
6b8fba5a42 rustc_typeck: turn where Type:, into a WF(Type) predicate, instead of ignoring it. 2018-08-31 09:02:35 +03:00
Mark Mansi
3a9cf12021 fix some anon params 2018-08-27 12:40:16 -05:00
csmoe
f5f97b37a7 update tests 2018-07-07 11:57:04 +08:00
csmoe
ff83ef0c24 merge wellformed(wc)s 2018-07-05 18:49:02 +08:00
csmoe
329d03ac1f update test 2018-07-05 18:47:00 +08:00
Niko Matsakis
90ea49b891 introduce predicates_defined_on for traits
This new query returns only the predicates *directly defined* on an
item (in contrast to the more common `predicates_of`, which returns
the predicates that must be proven to reference an item). These two
sets are almost always identical except for traits, where
`predicates_of` includes an artificial `Self: Trait<...>` predicate
(basically saying that you cannot use a trait item without proving
that the trait is implemented for the type parameters).

This new query is only used in chalk lowering, where this artificial
`Self: Trait` predicate is problematic. We encode it in metadata but
only where needed since it is kind of repetitive with existing
information.

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 11:33:24 -04:00
scalexm
796ded2dfd Add tests for WellFormed-Type and FromEnv-Type rules 2018-06-07 14:45:09 +02:00
scalexm
09f6cb93ca Remove FromEnv(ProjectionEq(...)) from tests 2018-06-07 14:40:24 +02:00
Niko Matsakis
2c5fbe2058 sort strings on output 2018-04-23 13:28:15 -04:00
Niko Matsakis
294cae22ee first draft of program_clauses_for_env
This computes the transitive closure of traits that appear in the
environment and then appends their clauses. It needs some work, but
it's in the right direction.
2018-04-23 13:28:14 -04:00
Niko Matsakis
7173fd78c6 in unit tests, use note to dump multiple program clauses
(rather than issuing multiple errors)

Also, reorder so that the annotations are considered "used" when the
lint runs.
2018-04-23 13:28:14 -04:00
Fabian Zaiser
de475582c4 Stop duplicating where clauses from impl's. 2018-04-15 23:32:58 +02:00
Fabian Zaiser
5a73fd5e1f Implement Chalk lowering rule Normalize-From-Impl 2018-04-15 23:32:57 +02:00
Tyler Mandry
7ac35eaa12 chalkify: Implement Rule Implied-Bound-From-Trait 2018-04-06 13:05:45 -05:00
varkor
7791995ad5 Add unit test for Implemented-From-Env 2018-03-20 15:23:54 +00:00
scalexm
04b228c3e2 Address niko's nits 2018-03-14 14:14:33 +01:00
scalexm
1271f0bd25 Add MVP for chalkification 2018-03-14 13:39:58 +01:00