about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2019-01-02Wf-check the output type of a function in MIR-typeckMatthew Jasper-0/+38
2019-01-02Auto merge of #57250 - codeworm96:tyerr_msg, r=varkorbors-103/+103
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-02Auto merge of #57251 - petrochenkov:reregr, r=varkorbors-1/+13
syntax: Fix regression in diagnostics for patterns in trait method parameters Fixes https://github.com/rust-lang/rust/issues/55036
2019-01-01Auto merge of #57209 - estebank:suggest-raw-ident, r=petrochenkovbors-0/+80
Suggest using raw identifiers in 2018 edition when using keywords
2019-01-01syntax: Fix regression in diagnostics for patterns in trait method parametersVadim Petrochenkov-1/+13
2019-01-01Auto merge of #55937 - davidtwco:issue-54943, r=pnkfelixbors-14/+150
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-01Auto merge of #57210 - estebank:str-err, r=zackmdavisbors-5/+73
Tweak unicode escape diagnostics
2019-01-01Auto merge of #57194 - matthiaskrgr:copyright_headers, r=Centrilbors-171/+13
remove more copyright headers r? @Mark-Simulacrum
2019-01-01Auto merge of #57199 - petrochenkov:ambig, r=estebankbors-2/+13
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).
2018-12-31Improve type mismatch error messagesYuning Zhang-103/+103
Replace "integral variable" with "integer" and replace "floating-point variable" with "floating-point number" to make the message less confusing.
2018-12-31Auto merge of #56878 - petrochenkov:privdyn, r=arielb1bors-35/+163
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.
2019-01-01Address review commentsVadim Petrochenkov-19/+19
Say "trait" instead of "type" in diagnostics for `dyn Trait`
2019-01-01privacy: Use common `DefId` visiting infra for all privacy visitorsVadim Petrochenkov-20/+148
2018-12-31Auto merge of #57047 - euclio:field-structured-suggestions, r=estebankbors-28/+33
use structured suggestions for nonexistent fields r? @estebank
2018-12-31Do not use unicode character in diagnostic helpEsteban Küber-3/+3
2018-12-31use structured suggestions for nonexistent fieldsAndy Russell-28/+33
2018-12-31Use structured suggestion for braceless unicode escape squenceEsteban Küber-8/+15
2018-12-31Account for `\xFF` and `\u{FF}` sequences in string format errorsEsteban Küber-1/+62
2018-12-31Update tests after rebaseEsteban Küber-0/+4
2018-12-31Address review commentsEsteban Küber-7/+55
- Suggest raw ident escaping in all editions - Keep primary label in all cases
2018-12-31Suggest using raw identifiers in 2018 edition when using keywordsEsteban Küber-7/+35
2018-12-31Auto merge of #57208 - estebank:issue-57198, r=petrochenkovbors-0/+25
Do not complain about missing crate named as a keyword Fix #57198.
2018-12-31Auto merge of #57044 - varkor:E0512-equal-type, r=matthewjasperbors-115/+135
Add specific diagnostic when attempting to transmute between equal generic types Also clarifies the wording of E0512. Fixes https://github.com/rust-lang/rust/issues/49793.
2018-12-30Fix variable string size problem in transmute testvarkor-3/+3
2018-12-30Auto merge of #57205 - petrochenkov:extrecov, r=estebankbors-25/+42
Improve error recovery for some built-in macros Fixes https://github.com/rust-lang/rust/issues/55897
2018-12-30Guarantee `rustc_dump_user_substs` error order.David Wood-8/+8
This commit buffers the errors output by the `rustc_dump_user_substs` attribute so that they can be output in order of span and would therefore be consistent.
2018-12-30Stop well-formedness checking unreachable code.David Wood-29/+33
This commit stops well-formedness checking applying to unreachable code and therefore stops some of the ICEs that the intended solution taken by this PR causes. By disabling these checks, we can land the other fixes and larger refactors that this PR includes.
2018-12-30Fix unresolved inference variable ICE.David Wood-2/+35
This commit moves well-formedness check for the `UserTypeAnnotation::Ty(..)` case from always running to only when the code is reachable. This solves the ICE that resulted from `src/test/ui/issue-54943-1.rs` (a minimal repro of `dropck-eyepatch` run-pass tests that failed). The main well-formedness check that was intended to be run despite unreachable code still is, that being the `UserTypeAnnotation::TypeOf(..)` case. Before this PR, the other case wasn't being checked at all. It is possible to fix this ICE while still always checking well-formedness for the `UserTypeAnnotation::Ty(..)` case but that solution will ICE in unreachable code for that case, the diff for that change [can be found here](0). [0]: https://gist.github.com/davidtwco/f9751ffd9c0508f7251c0f17adc3af53
2018-12-30Add explicit error annotations to test.David Wood-1/+3
This commit adds explicit error annotations to tests after rebasing which is now required.
2018-12-30Support user type annotations in `ref` bindings.David Wood-0/+19
This commit adds support for user type annotations in variables declared using `ref` bindings. When a variable declared using a `ref` binding, then the `LocalDecl` has the type `&T` where the `&` was introduced by the `ref` binding but the canonicalized type annotation has only a `T` since the reference is implicit with the `ref` binding. Therefore, to support type annotations, the canonicalized type annotation either needs wrapped in a reference, or the `LocalDecl` type must have a wrapped reference removed for comparison. It is easier to remove the outer reference from the `LocalDecl` for the purpose of comparison, so that is the approach this commit takes.
2018-12-30Type annotations in associated constant patterns.David Wood-1/+48
This commit adds support for respecting user type annotations with associated constants in patterns.
2018-12-30Add test for unreachable well-formedness.David Wood-0/+18
This commit adds a test for checking that types are well-formed when unreachable.
2018-12-30Always check well-formedness.David Wood-8/+21
This commit uses the map introduced by the previous commit to ensure that types are always checked for well-formedness by the NLL type check. Previously, without the map introduced by the previous commit, types would not be checked for well-formedness if the `AscribeUserType` statement that would trigger that check was removed as unreachable code.
2018-12-30Refactor `UserTypeAnnotation`.David Wood-12/+12
This commit refactors the `UserTypeAnnotation` type to be referred to by an index within `UserTypeProjection`. `UserTypeAnnotation` is instead kept in an `IndexVec` within the `Mir` struct. Further, instead of `UserTypeAnnotation` containing canonicalized types, it now contains normal types and the entire `UserTypeAnnotation` is canonicalized. To support this, the type was moved from the `rustc::mir` module to `rustc::ty` module.
2018-12-30Auto merge of #57158 - estebank:as-ref, r=zackmdavisbors-47/+91
Suggest `.as_ref()` when appropriate for `Option` and `Result` Fix #55198.
2018-12-30Auto merge of #57185 - petrochenkov:impice4, r=estebankbors-26/+29
resolve: Fix one more ICE in import validation So if you have an unresolved import ```rust mod m { use foo::bar; } ``` error recovery will insert a special item with `Def::Err` definition into module `m`, so other things depending on `bar` won't produce extra errors. The issue was that erroneous `bar` was overwriting legitimate `bar`s coming from globs, e.g. ```rust mod m { use baz::*; // imports real existing `bar` use foo::bar; } ``` causing some unwanted diagnostics talking about "unresolved items", and producing inconsistent resolutions like https://github.com/rust-lang/rust/issues/57015. This PR stops overwriting real successful resolutions with `Def::Err`s. Fixes https://github.com/rust-lang/rust/issues/57015
2018-12-29Do not complain about missing crate named as a keywordEsteban Küber-0/+25
2018-12-29Auto merge of #56843 - csmoe:non-copy, r=davidtwcobors-48/+65
Add a note describing the type of the non-Copy moved variable Closes #56654 r?@davidtwco
2018-12-30Improve error recovery for some built-in macrosVadim Petrochenkov-25/+42
2018-12-29Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkovbors-315/+946
Implement RFC 2338, "Type alias enum variants" This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following. ```rust #![feature(type_alias_enum_variants)] enum Foo { Bar(i32), Baz { i: i32 }, } type Alias = Foo; fn main() { let t = Alias::Bar(0); let t = Alias::Baz { i: 0 }; match t { Alias::Bar(_i) => {} Alias::Baz { i: _i } => {} } } ``` Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern. Fixes issues #56199 and #56611. N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible. ```rust Option::<u8>::None; // OK Option::None::<u8>; // OK, but lint in near future (hard error next edition?) Alias::<u8>::None; // OK Alias::None::<u8>; // Error ``` I do not know if this will need an FCP, but let's start one if so.
2018-12-29Auto merge of #57197 - kennytm:rollup, r=kennytmbors-20/+20
Rollup of 7 pull requests Successful merges: - #57149 (Fix typo in pin documentation) - #57153 (Small: Fix span in char documentation) - #57159 (Update references to closed issue) - #57163 (Give the crate select chevron room to breathe.) - #57168 (Removed aligned ZST requirement from docs of read_/write_unaligned.) - #57174 (Update link to rustc guide) - #57177 (Fix warning when compiling rustc) Failed merges: r? @ghost
2018-12-29resolve: Simplify treatment of ambiguity errorsVadim Petrochenkov-23/+15
2018-12-29Auto merge of #57181 - petrochenkov:impice3, r=estebankbors-0/+12
resolve: Fix another ICE in import validation Imports are allowed to have ambiguous resolutions as long as all of them have same `Def`. As it turned out, it's possible for different `Module`s to have same `Def` when `extern crate` items are involved. Fixes https://github.com/rust-lang/rust/issues/56596
2018-12-29Rollup merge of #57159 - ids1024:closed-issue, r=Centrilkennytm-20/+20
Update references to closed issue Issue #28979 was closed with a link to #55467.
2018-12-29Auto merge of #57160 - petrochenkov:impice2, r=estebankbors-0/+33
resolve: Fix an ICE in import validation Fixes ICE reported in the comment https://github.com/rust-lang/rust/issues/56596#issuecomment-449866807
2018-12-29update tests line numbersMatthias Krüger-13/+13
2018-12-29Auto merge of #57140 - estebank:str-err, r=varkorbors-31/+49
Tweaks to format string diagnostics Add label spans and fix incorrect spans. Fix #55155, fix #55350.
2018-12-29Fixed stderr files for ui tests.Alexander Regueiro-12/+3
2018-12-29add non-copy note to stderrcsmoe-45/+62
2018-12-29Auto merge of #57006 - GuillaumeGomez:no-crate-filter, r=QuietMisdreavusbors-0/+16
Add no-crate filter option on rustdoc @onur asked me about it so here it is! r? @QuietMisdreavus