about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2019-01-12Rollup merge of #57535 - varkor:stabilise-if-while-let-patterns, r=CentrilMazdak Farrokhzad-7/+8
Stabilise irrefutable if-let and while-let patterns This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). This replaces https://github.com/rust-lang/rust/pull/55639, as we want to stabilise this in time for the beta cut-off. Closes https://github.com/rust-lang/rust/pull/55639. r? @Centril
2019-01-12Rollup merge of #57175 - oli-obk:const_let_stabilization, r=nikomatsakisMazdak Farrokhzad-217/+27
Stabilize `let` bindings and destructuring in constants and const fn r? @Centril This PR stabilizes the following features in constants and `const` functions: * irrefutable destructuring patterns (e.g. `const fn foo((x, y): (u8, u8)) { ... }`) * `let` bindings (e.g. `let x = 1;`) * mutable `let` bindings (e.g. `let mut x = 1;`) * assignment (e.g. `x = y`) and assignment operator (e.g. `x += y`) expressions, even where the assignment target is a projection (e.g. a struct field or index operation like `x[3] = 42`) * expression statements (e.g. `3;`) This PR does explicitly *not* stabilize: * mutable references (i.e. `&mut T`) * dereferencing mutable references * refutable patterns (e.g. `Some(x)`) * operations on `UnsafeCell` types (as that would need raw pointers and mutable references and such, not because it is explicitly forbidden. We can't explicitly forbid it as such values are OK as long as they aren't mutated.) * We are not stabilizing `let` bindings in constants that use `&&` and `||` short circuiting operations. These are treated as `&` and `|` inside `const` and `static` items right now. If we stopped treating them as `&` and `|` after stabilizing `let` bindings, we'd break code like `let mut x = false; false && { x = true; false };`. So to use `let` bindings in constants you need to change `&&` and `||` to `&` and `|` respectively.
2019-01-12const_let: --bless with --compare-mode=nllMazdak Farrokhzad-57/+3
2019-01-12Stabilise irrefutable if-let and while-let patternsvarkor-7/+8
This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). Co-Authored-By: Sebastian Malton <sebastian@malton.name>
2019-01-11Auto merge of #57355 - arielb1:correct-subst, r=nikomatsakisbors-0/+23
use the correct supertrait substitution in `object_ty_for_trait` beta-nominating because regression. Fixes #57156.
2019-01-09const fn feature gate is not needed anymore in a lot of testsOliver Scherer-5/+3
2019-01-09Stabilize `let` bindings and destructuring in constants and const fnOliver Scherer-158/+24
2019-01-06Auto merge of #57272 - petrochenkov:featrecov, r=estebankbors-4/+6
Make sure feature gate errors are recoverable (take 2) Continuation of https://github.com/rust-lang/rust/pull/56999/commits/15cefe4b2a65bb2a4febcd353cb37b90dfafa4f1. Turns out I missed the most important part - the main feature gate checking pass.
2019-01-06Make sure feature gate errors are recoverable (take 2)Vadim Petrochenkov-4/+6
2019-01-06Auto merge of #57291 - euclio:method-call-suggestion, r=estebankbors-9/+13
use structured suggestion for method calls Furthermore, don't suggest calling the method if it is part of a place expression, as this is invalid syntax. I'm thinking it might be worth putting a label on the method assignment span like "this is a method" and removing the span from the "methods are immutable" text so it isn't reported twice. The suggestions in `src/test/ui/did_you_mean/issue-40396.stderr` are suboptimal. I could check if the containing expression is `BinOp`, but I'm not sure if that's general enough. Any ideas? r? @estebank
2019-01-05Auto merge of #57230 - estebank:return-mismatch, r=varkorbors-22/+24
Modify mismatched type error for functions with no return Fix #50009. ``` error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:3:24 | LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types | -------- ^^^ expected i32, found () | | | this function's body doesn't return LL | x + 1; | - help: consider removing this semicolon | = note: expected type `i32` found type `()` ``` instead of ``` error[E0308]: mismatched types --> $DIR/coercion-missing-tail-expected-type.rs:3:28 | LL | fn plus_one(x: i32) -> i32 { //~ ERROR mismatched types | ____________________________^ LL | | x + 1; | | - help: consider removing this semicolon LL | | } | |_^ expected i32, found () | = note: expected type `i32` found type `()` ```
2019-01-05use the correct supertrait substitution in `object_ty_for_trait`Ariel Ben-Yehuda-0/+23
Fixes #57156.
2019-01-05Rollup merge of #57249 - frewsxcv:frewsxcv-second-edition, r=KodrAuskennytm-22/+22
Fix broken links to second edition TRPL. Fixes https://github.com/rust-lang/rust/issues/57104. Remove `second-edition/` from TRPL hyperlinks.
2019-01-05Rollup merge of #57229 - mikeyhew:fix-56806, r=varkorkennytm-0/+19
Fix #56806 by using `delay_span_bug` in object safety layout sanity checks It's possible that `is_object_safe` is called on a trait method that with an invalid receiver type. This caused an ICE in #56806, because `receiver_is_dispatchable` returns `true` for `self: Box<dyn Trait>`, which causes one of the layout sanity checks in object_safety.rs to fail. Replacing `bug!` with `delay_span_bug` solves this. The fact that `receiver_is_dispatchable` returns `true` here could be considered a bug. It passes the check that the method implements, though: `Box<dyn Trait>` implements `DispatchFromDyn<Box<dyn Trait>>` because `dyn Trait` implements `Unsize<dyn Trait>`. It would be good to hear what @eddyb and @nikomatsakis think. Note that I only added a test for the case encountered in #56806. I could not come up with a case that triggered an ICE from the other check, `bug!("receiver when Self = dyn Trait should be ScalarPair, found Scalar")`. There is no way, to my knowledge, that you can make `receiver_is_dispatchable` return true but still have a `Scalar` ABI when `Self = dyn Trait`. One other case I encountered while debugging #56806 was that if you have a type parameter `T` that implements `Deref<Target=Self>` and `DispatchFromDyn<T>`, and use it as a method receiver, it will cause an ICE during `is_object_safe` because `T` has no layout ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=d9b7497b3be0ca8382fa7d9497263214)): ```rust trait Trait<T: Deref<Target=Self> + DispatchFromDyn<T>> { fn foo(self: T) -> dyn Trait<T>; } ``` I don't intend to remove the ICE there because it is a pathological case, especially since there is no way to implement `DispatchFromDyn<T>` for `T` — the checks in typeck/coherence/builtin.rs do not allow that. fixes #56806 r? @varkor
2019-01-05Auto merge of #56837 - arielb1:nonprincipal-trait-objects, r=nikomatsakisbors-26/+302
Add support for trait-objects without a principal The hard-error version of #56481 - should be merged after we do something about the `traitobject` crate. Fixes #33140. Fixes #57057. r? @nikomatsakis
2019-01-04use `delay_span_bug` instead of `bug!` when doing layout sanity checkMichael Hewson-0/+19
It's possible that `is_object_safe` is called on a trait that is ill-formed, and we shouldn't ICE unless there are no errors being raised. Using `delay_span_bug` solves this. fixes #56806
2019-01-04add test for #57162Ariel Ben-Yehuda-0/+7
Fixes #57162.
2019-01-04Auto merge of #56897 - euclio:parse-fatal, r=estebankbors-10/+12
make `panictry!` private to libsyntax This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.
2019-01-04alphabetize marker traits when printedAriel Ben-Yehuda-10/+10
This makes sure they are printed in a compiler-version-independent order, avoiding ui test instability.
2019-01-04implement a hack to make traitobject 0.1.0 compileAriel Ben-Yehuda-28/+297
2019-01-03use structured suggestion for method callsAndy Russell-9/+13
Furthermore, don't suggest calling the method if it is part of a place expression, as this is invalid syntax.
2019-01-02improve handling for subtypeNiko Matsakis-21/+7
Still not great, but good enough to land this PR.
2019-01-02say "the lifetime" instead of "some lifetime" when it feels rightNiko Matsakis-4/+4
In particular, when we want to indicate that there is a connection between the self type and the other types.
2019-01-02apply the new placeholder errors even with just one placeholderNiko Matsakis-37/+20
2019-01-02WIP other test changesNiko Matsakis-1/+0
2019-01-02tests: worse diagnostics, but basically same errorsNiko Matsakis-78/+66
2019-01-02make `panictry!` private to libsyntaxAndy Russell-10/+12
This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.
2019-01-02Auto merge of #57250 - codeworm96:tyerr_msg, r=varkorbors-12/+12
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-01Auto merge of #57209 - estebank:suggest-raw-ident, r=petrochenkovbors-0/+12
Suggest using raw identifiers in 2018 edition when using keywords
2019-01-01Fix broken links to second edition TRPL.Corey Farwell-22/+22
Fixes https://github.com/rust-lang/rust/issues/57104.
2018-12-31Improve type mismatch error messagesYuning Zhang-12/+12
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-0/+3
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-01privacy: Use common `DefId` visiting infra for all privacy visitorsVadim Petrochenkov-0/+3
2018-12-31Auto merge of #57047 - euclio:field-structured-suggestions, r=estebankbors-7/+7
use structured suggestions for nonexistent fields r? @estebank
2018-12-31use structured suggestions for nonexistent fieldsAndy Russell-7/+7
2018-12-31Update tests after rebaseEsteban Küber-0/+4
2018-12-31Address review commentsEsteban Küber-0/+8
- Suggest raw ident escaping in all editions - Keep primary label in all cases
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-30Tweak E0308 error for clarityEsteban Küber-9/+7
2018-12-31Auto merge of #57044 - varkor:E0512-equal-type, r=matthewjasperbors-13/+13
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-30Point at function name spanEsteban Küber-5/+15
2018-12-30Point at the return type span on type mismatch due to missing returnEsteban Küber-25/+19
Do not point at the entire block span on fn return type mismatches caused by missing return.
2018-12-30Auto merge of #57205 - petrochenkov:extrecov, r=estebankbors-25/+4
Improve error recovery for some built-in macros Fixes https://github.com/rust-lang/rust/issues/55897
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-3/+5
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/+4
2018-12-29Auto merge of #56225 - alexreg:type_alias_enum_variants, r=petrochenkovbors-39/+69
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-29add non-copy note to stderrcsmoe-3/+5
2018-12-28Clarify wording of E0512varkor-13/+13
2018-12-27Auto merge of #56999 - petrochenkov:macrecov2, r=estebankbors-37/+86
AST/HIR: Introduce `ExprKind::Err` for better error recovery in the front-end This way we can avoid aborting compilation if expansion produces errors and generate `ExprKind::Err`s instead.