Commit graph

169 commits

Author SHA1 Message Date
Nadrieril
3b37d941a2 Add some tests 2020-10-18 14:21:19 +01:00
Oliver Scherer
daf976f612 Revert a test change to make sure it's still testing the original issue 2020-09-24 17:11:47 +02:00
Oliver Scherer
177d0cef48 Deduplicate errors in const to pat conversion 2020-09-23 17:03:31 +02:00
Oliver Scherer
adf98ab2dc Use precise errors during const to pat conversion instead of a catch-all on the main constant 2020-09-20 18:42:15 +02:00
Oliver Scherer
b2532a8730 Implement destructuring for all aggregates and for references 2020-09-20 13:28:18 +02: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
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
9e5f7d5631 mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
bors
19cefa6864 Auto merge of #74963 - JohnTitor:ptn-ice, r=petrochenkov
Fix ICEs with `@ ..` binding

This reverts #74557 and introduces an alternative fix while ensuring that #74954 is not broken.
The diagnostics are verbose though, it fixes three related issues.
cc #74954, #74539, and #74702
2020-08-02 18:01:27 +00:00
Valentin Lazureanu
40e6dccfb4 Rename HAIR to THIR (Typed HIR). 2020-07-31 22:15:12 +00:00
Yuki Okushi
c2afce4058
Fix ICEs with @ .. binding 2020-07-31 07:50:29 +09:00
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
Yuki Okushi
85072e3303
Update reference to CONTRIBUTING.md 2020-07-07 17:12:22 +09:00
Yuki Okushi
b93ecc1dac
Address code reviews 2020-07-05 03:43:43 +09:00
Yuki Okushi
dcbe85abad
Explain exhaustive matching on {usize,isize} maximum values 2020-07-05 02:10:57 +09:00
Oliver Scherer
819cde5dab Show the values and computation that would overflow a const evaluation or propagation 2020-06-26 10:08:52 +02:00
Esteban Küber
520461f1fb Provide suggestions for some moved value errors
When encountering an used moved value where the previous move happened
in a `match` or `if let` pattern, suggest using `ref`. Fix #63988.

When encountering a `&mut` value that is used in multiple iterations of
a loop, suggest reborrowing it with `&mut *`. Fix #62112.
2020-06-24 17:42:26 -07:00
Lzu Tao
c755292859 Prefer the associated consts for pattern matching error 2020-06-13 01:18:18 +00:00
Dylan DPC
89cb4d75a1
Rollup merge of #72572 - JohnTitor:add-tests, r=matthewjasper
Add some regression tests

Closes #68532
Closes #70121
Closes #71042
CC #56445

r? @matthewjasper since they (except for #71042) are related to #72362.
2020-05-29 20:21:20 +02:00
Yuki Okushi
6315d0c99e
Add test for #71042 2020-05-27 00:56:27 +09:00
Nadrieril
3e8ba3a3cb Remove out-of-date comment 2020-05-23 19:39:38 +01:00
Nadrieril
7addc115eb Work around type normalization issues 2020-05-23 18:59:27 +01:00
Nadrieril
e5a2cd526a We don't use tyerr anymore
This however unearthed a bug, hence the FIXME and the workaround.
2020-05-17 17:38:23 +01:00
RoccoDev
b85c64c3ea
rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
Eduard-Mihai Burtescu
8deff18529 tests: remove ignore directives from tests that mention core/alloc/std spans. 2020-04-02 11:48:34 +03:00
Mazdak Farrokhzad
c858593ed0 non-exhastive diagnostic: add note re. scrutinee type 2020-03-27 06:49:07 +01:00
Mazdak Farrokhzad
c70aa344e4 borrowck: prefer "value" over "_". 2020-03-25 11:42:25 +01:00
Aaron Hill
86b8dea5ec
Ignore tests on some platforms due to #53081 2020-03-23 02:04:43 -04:00
Aaron Hill
96e2d03d4b
Store idents for DefPathData into crate metadata
Previously, we threw away the `Span` associated with a definition's
identifier when we encoded crate metadata, causing us to lose location
and hygiene information.

We now store the identifier's `Span` in the crate metadata.
When we decode items from the metadata, we combine
the name and span back into an `Ident`.

This improves the output of several tests, which previously had messages
suppressed due to dummy spans.

This is a prerequisite for #68686, since throwing away a `Span` means
that we lose hygiene information.
2020-03-22 23:40:19 -04:00
Matthew Jasper
1ee5829575 Update tests for erasing regions in typeck 2020-03-17 09:07:56 +00:00
Matthew Kuo
b4788a739b test(pattern): harden tests for or-patterns with slice-patterns
Some of the nested OR paths were being missed
2020-03-04 01:33:32 -06:00
Matthew Kuo
5456114858 test(pattern): add tests for combinations of pattern features
Reference issue #67311

Tests combinations of the following pattern features:
- bindings_after_at
- or_patterns
- slice_patterns
- box_patterns
2020-03-04 01:17:41 -06:00
Mazdak Farrokhzad
b1de8f16ca check_pat_tuple: use pattern_cause 2020-02-25 05:46:58 +01:00
Mazdak Farrokhzad
e9f6bb7f79 check_pat_path: use pattern_cause 2020-02-25 05:41:03 +01:00
LeSeulArtichaut
38a22b8130 Fix error message
Bless tests
2020-02-21 22:43:51 +01:00
LeSeulArtichaut
2e07892c7d Do not emit note suggesting to implement trait to foreign type
Update tests

Extend to other operations

Refractor check in a separate function

Fix more tests
2020-02-17 15:21:36 +01:00
bors
dc4242d905 Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPC
Make issue references consistent

Fixes https://github.com/rust-lang/rust/issues/62976

cc https://github.com/rust-lang/rust/pull/63008

r? @varkor because you reviewed the original pr
2020-02-11 02:00:27 +00:00
Matthias Prechtl
7b555178ae --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
Matthew Jasper
fa5a3c35dc Don't parse mut a @ b as mut a @ mut b 2020-02-09 13:19:06 +00:00
bors
f8d830b4de Auto merge of #68376 - Centril:move-ref-patterns, r=matthewjasper
Initial implementation of `#![feature(move_ref_pattern)]`

Following up on #45600, under the gate `#![feature(move_ref_pattern)]`, `(ref x, mut y)` is allowed subject to restrictions necessary for soundness. The match checking implementation and tests for `#![feature(bindings_after_at)]` is also adjusted as necessary.

Closes #45600.
Tracking issue: #68354.

r? @matthewjasper
2020-02-09 04:01:28 +00:00
Eduard-Mihai Burtescu
4c7eb59e81 rustc_macros: don't limit the -Zmacro-backtrace suggestion to extern macros. 2020-02-06 21:46:38 +02:00
Mazdak Farrokhzad
d2b88b7050 move_ref_pattern: test captures inside closure 2020-02-02 21:17:49 +01:00
Mazdak Farrokhzad
bd318be05d move_ref_pattern: change pov in diagnostics & add binding names 2020-02-02 17:58:15 +01:00
Mazdak Farrokhzad
8d4973f587 move_ref_pattern: don't ICE on unreachable 2xby-move conflicts 2020-02-02 16:07:51 +01:00
Mazdak Farrokhzad
d984f127f6 move_ref_patterns: introduce tests
bindings_after_at: harden tests
2020-02-02 14:13:07 +01:00
Matthew Jasper
425e494fce Remove or_patterns from INCOMPLETE_FEATURES 2020-02-01 22:07:11 +00:00
varkor
24a2929ed1 Normalise notes with the/is 2020-01-24 16:24:50 +00:00
Mazdak Farrokhzad
58eb03d20f check_match: simplify check_arm 2020-01-20 23:39:24 +01:00
Mazdak Farrokhzad
78f0c7fd64 check_match: unify some lowering code and fix some ICEs 2020-01-20 19:46:27 +01:00