Commit Graph

87970 Commits

Author SHA1 Message Date
Niko Matsakis
1db7193162 address tmandry nits 2019-01-02 17:35:06 -05:00
Niko Matsakis
cf2f7cccb4 pacify the mercilous tidy 2019-01-02 17:35:06 -05:00
Niko Matsakis
bc4404c0b5 improve handling for subtype
Still not great, but good enough to land this PR.
2019-01-02 17:35:06 -05:00
Niko Matsakis
a24e04dff6 say "the lifetime" instead of "some lifetime" when it feels right
In particular, when we want to indicate that there is a connection
between the self type and the other types.
2019-01-02 17:35:06 -05:00
Niko Matsakis
7bc3f5585a apply the same logic to ConcreteFailure errors 2019-01-02 17:35:06 -05:00
Niko Matsakis
77924de4a6 refactor highlighting to take any RegionKind, making it more general 2019-01-02 17:35:06 -05:00
Niko Matsakis
6cbbee1dc7 apply the new placeholder errors even with just one placeholder 2019-01-02 17:35:06 -05:00
Niko Matsakis
0a61d682a1 introduce placeholder-placeholder errors for trait matching 2019-01-02 17:35:06 -05:00
Niko Matsakis
1597f2a0fc add the ability to highlight placeholders 2019-01-02 17:35:05 -05:00
Niko Matsakis
37b0b3e9a3 generalize region highlights into a struct 2019-01-02 17:35:05 -05:00
Niko Matsakis
6a6d2f4b3f dump out the exact state in error reporting debugs 2019-01-02 17:35:05 -05:00
Niko Matsakis
995192a472 make get_highlight_region_for_regionvid only affect re-vid
In NLL, ReVid is all there is, but I might want to repurpose.
2019-01-02 17:35:05 -05:00
Niko Matsakis
0b03b9bbcf remove outdated rustc_driver tests
they are subsumed by `hr-subtype/hr-subtype.rs` and other tests
2019-01-02 17:35:05 -05:00
Niko Matsakis
a2d917989c WIP other test changes 2019-01-02 17:35:05 -05:00
Niko Matsakis
c8e0a90dfc tests: cases where we now do the right thing but did not before
Fixes #33684
2019-01-02 17:35:05 -05:00
Niko Matsakis
d3c96ff152 tests: worse diagnostics, but basically same errors 2019-01-02 17:35:05 -05:00
Niko Matsakis
78705b5ec7 tests: move coherence-subtyping from run-pass to compile-fail
This is the pattern we no longer accept.
2019-01-02 17:35:05 -05:00
Niko Matsakis
652fd2efdf add tests exercising exists<'a> { forall<'b> { .. } } pattern
Amazingly, this scenario was not tested for trait matching.
2019-01-02 17:35:05 -05:00
Niko Matsakis
b68fad670b universe transition
Remove the leak-check and its associated machinery. Replace with
making the solver aware of universes.
2019-01-02 17:35:05 -05:00
Niko Matsakis
eba2ae526b WIP: wfcheck ability to detect 2019-01-02 17:35:05 -05:00
Niko Matsakis
904a0bde93 select.rs: unsizing coercion should use a subtype
When we coerce `dyn Foo` to `dyn Bar`, that is OK as long as `Foo` is
usable in all contexts where `Bar` is usable (hence using the source
must be a subtype of the target).

This is needed for the universe-based code to handle
`old-lub-glb-object`; that test used to work sort of by accident
before with the old code.
2019-01-02 17:35:05 -05:00
Niko Matsakis
4170829e53 introduce ability to detect region constraints from snapshot 2019-01-02 17:35:05 -05:00
Niko Matsakis
4b5f274f90 make evaluation track whether outlives relationships mattered
Previously, evaluation ignored outlives relationships. Since we using
evaluation to skip the "normal" trait selection (which enforces
outlives relationships) this led to incorrect results in some cases.
2019-01-02 17:35:05 -05:00
Niko Matsakis
79efed84a0 remove wrapper functions that had no purpose 2019-01-02 17:35:05 -05:00
Niko Matsakis
5f0fe8f093 remove commit_if_ok wrapper 2019-01-02 17:35:04 -05:00
bors
ec194646fe Auto merge of #57243 - dingelish:master, r=sfackler
Bound sgx target_env with fortanix as target_vendor

This PR adds `target_vendor` check, as discussed in issue [57231](https://github.com/rust-lang/rust/issues/57231)

Signed-off-by: Yu Ding <dingelish@gmail.com>
2019-01-02 15:09:41 +00:00
bors
a36b960df6 Auto merge of #57250 - codeworm96:tyerr_msg, r=varkor
Improve type mismatch error messages

Closes #56115.

Replace "integral variable" with "integer" and replace "floating-point variable" with "floating-point number" to make the message less confusing.

TODO the book and clippy needs to be changed accordingly later.

r? @varkor
2019-01-02 11:59:15 +00:00
bors
d3704932bd Auto merge of #57251 - petrochenkov:reregr, r=varkor
syntax: Fix regression in diagnostics for patterns in trait method parameters

Fixes https://github.com/rust-lang/rust/issues/55036
2019-01-02 09:24:10 +00:00
bors
96530344ef Auto merge of #56827 - faern:eliminate-recv-timeout-panic, r=KodrAus
Eliminate Receiver::recv_timeout panic

Fixes #54552.

This panic is because `recv_timeout` uses `Instant::now() + timeout` internally. This possible panic is not mentioned in the documentation for this method.

Very recently we merged (still unstable) support for checked addition (#56490) of `Instant + Duration`, so it's now finally possible to add these together without risking a panic.
2019-01-02 02:03:15 +00:00
bors
443ae75eaf Auto merge of #57209 - estebank:suggest-raw-ident, r=petrochenkov
Suggest using raw identifiers in 2018 edition when using keywords
2019-01-01 23:30:34 +00:00
Yu Ding
20e0395e66 Merge remote-tracking branch 'upstream/master' 2019-01-01 14:55:33 -08:00
Vadim Petrochenkov
3df500db29 syntax: Fix regression in diagnostics for patterns in trait method parameters 2019-01-01 23:59:32 +03:00
bors
b2b7a063af Auto merge of #57125 - doitian:inconsistent-clone-doc, r=bluss
Fix inconsistent Clone documentation.

Now, arrays of any size Clone if the element type is Clone. So remove the
the document that uses this as an example.

refs #57123
2019-01-01 20:50:13 +00:00
Yu Ding
a3128116d2 Remove min_const_unsafe_fn since it is stable
Signed-off-by: Yu Ding <dingelish@gmail.com>
2019-01-01 11:49:54 -08:00
bors
cae164753f Auto merge of #55937 - davidtwco:issue-54943, r=pnkfelix
NLL: User type annotations refactor, associated constant patterns and ref bindings.

Fixes #55511 and Fixes #55401. Contributes to #54943.

This PR performs a large refactoring on user type annotations, checks user type annotations for associated constants in patterns and that user type annotations for `ref` bindings are respected.

r? @nikomatsakis
2019-01-01 15:26:12 +00:00
bors
36500deb1a Auto merge of #57203 - nagisa:readme, r=Mark-Simulacrum
Remove mention of required memory to build

Because it, obviously, changes all the time and 600MiB is way out-of-date now.
2019-01-01 11:47:58 +00:00
bors
7a2779a462 Auto merge of #57210 - estebank:str-err, r=zackmdavis
Tweak unicode escape diagnostics
2019-01-01 09:10:23 +00:00
bors
0432798fdb Auto merge of #57194 - matthiaskrgr:copyright_headers, r=Centril
remove more copyright headers

r? @Mark-Simulacrum
2019-01-01 06:34:11 +00:00
bors
d8371c61e6 Auto merge of #57199 - petrochenkov:ambig, r=estebank
resolve: Simplify treatment of ambiguity errors

If we have a glob conflict like this
```rust
mod m1 { struct S; }
mod m2 { struct S; }

use m1::*;
use m2::*;
```
we treat it as a special "ambiguity item" that's not an error by itself, but produces an error when actually used.
```rust
use m1::*; // primary
use m2::*; // secondary

=>

ambiguity S(m1::S, m2::S);
```

Ambiguity items were *sometimes* treated as their primary items for error recovery, but pretty irregularly.

After this PR they are always treated as their primary items, except that
- If an ambiguity item is marked as used, then it still produces an error.
- Ambiguity items are still filtered away when exported to other crates (which is also a use in some sense).
2019-01-01 02:08:39 +00: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
Yu Ding
d04f5208ba Bound sgx target_env with fortanix as target_vendor
Signed-off-by: Yu Ding <dingelish@gmail.com>
2018-12-31 16:32:56 -08:00
bors
fe6a54d220 Auto merge of #56878 - petrochenkov:privdyn, r=arielb1
privacy: Use common `DefId` visiting infrastructure for all privacy visitors

One repeating pattern in privacy checking is going through a type, visiting all `DefId`s inside it and doing something with them.
This is the case because visibilities and reachabilities are attached to `DefId`s.

Previously various privacy visitors visited types slightly differently using their own methods, with most recently written `TypePrivacyVisitor` being the "gold standard".
This mostly worked okay, but differences could manifest in overly conservative reachability analysis, some errors being reported twice, some private-in-public lints (not errors) being wrongly reported or not reported.

This PR does something that I wanted to do since https://github.com/rust-lang/rust/pull/32674#discussion_r58291608 - factoring out the common visiting logic!
Now all the common logic is contained in `struct DefIdVisitorSkeleton`, with specific privacy visitors deciding only what to do with visited `DefId`s (via `trait DefIdVisitor`).

A bunch of cleanups is also applied in the process.
This area is somewhat tricky due to lots of easily miss-able details, but thankfully it's was well covered by tests in https://github.com/rust-lang/rust/pull/46083 and previous PRs, so I'm relatively sure in the refactoring correctness.

Fixes https://github.com/rust-lang/rust/pull/56837#discussion_r241962239 in particular.
Also this will help with implementing https://github.com/rust-lang/rust/issues/48054.
2018-12-31 23:30:57 +00:00
Vadim Petrochenkov
60d1fa70bb Address review comments
Say "trait" instead of "type" in diagnostics for `dyn Trait`
2019-01-01 01:39:55 +03:00
Vadim Petrochenkov
8b1c424b6d privacy: Use common DefId visiting infra for all privacy visitors 2019-01-01 01:39:55 +03:00
bors
9eac386342 Auto merge of #57047 - euclio:field-structured-suggestions, r=estebank
use structured suggestions for nonexistent fields

r? @estebank
2018-12-31 20:56:19 +00:00
Esteban Küber
30961c958d Do not use unicode character in diagnostic help 2018-12-31 10:00:08 -08:00
Andy Russell
dfc326d0e2
use structured suggestions for nonexistent fields 2018-12-31 12:52:30 -05:00
Esteban Küber
b416f1398f Use structured suggestion for braceless unicode escape squence 2018-12-31 09:44:58 -08:00
Esteban Küber
7edc434b72 Account for \xFF and \u{FF} sequences in string format errors 2018-12-31 09:44:58 -08:00
Esteban Küber
18e0bdae54 Update tests after rebase 2018-12-31 08:41:05 -08:00