summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2019-02-22update test files to reflect new outputNiko Matsakis-3/+3
One surprise: old-lub-glb-object.rs, may indicate a bug
2019-02-22make generalization code create new variables in correct universeNiko Matsakis-0/+36
In our type inference system, when we "generalize" a type T to become a suitable value for a type variable V, we sometimes wind up creating new inference variables. So, for example, if we are making V be some subtype of `&'X u32`, then we might instantiate V with `&'Y u32`. This generalized type is then related `&'Y u32 <: &'X u32`, resulting in a region constriant `'Y: 'X`. Previously, however, we were making these fresh variables like `'Y` in the "current universe", but they should be created in the universe of V. Moreover, we sometimes cheat in an invariant context and avoid creating fresh variables if we know the result must be equal -- we can only do that when the universes work out.
2019-02-17Address review comments and cleanup codeVadim Petrochenkov-14/+14
2019-02-17#56411 do not suggest a fix for a import conflict in a macroFrançois Mockers-0/+53
2019-02-04Don't panic when accessing enum variant ctor using `Self` in matchEsteban Küber-0/+24
2019-01-14Rollup merge of #57585 - estebank:trailing-semicolon, r=petrochenkovMazdak Farrokhzad-6/+12
Recover from item trailing semicolon CC https://github.com/rust-lang/rfcs/pull/2479 r? @petrochenkov
2019-01-14Rollup merge of #57477 - euclio:clarify-lev-suggestion, r=zackmdavisMazdak Farrokhzad-15/+25
clarify resolve typo suggestion Include the kind of the binding that we're suggesting, and use a structured suggestion. Fixes #53445.
2019-01-14Auto merge of #57387 - euclio:nonstandard-style-suggestions, r=oli-obkbors-11/+11
Use structured suggestions for nonstandard style lints This PR modifies the lints in the nonstandard_style group to use structured suggestions. Note that there's a bit of tricky span calculation going on for the `crate_name` attribute. It also simplifies the code a bit: I don't think the "fallback" suggestions for these lints can actually be triggered. Fixes #48103. Fixes #52414.
2019-01-13Recover from item trailing semicolonEsteban Küber-6/+12
2019-01-13Auto merge of #57580 - Centril:rollup, r=Centrilbors-0/+77
Rollup of 4 pull requests Successful merges: - #56874 (Simplify foreign type rendering.) - #57113 (Move diagnostics out from QueryJob and optimize for the case with no diagnostics) - #57366 (Point at match discriminant on type error in match arm pattern) - #57538 (librustc_mir: Fix ICE with slice patterns) Failed merges: - #57381 (Tweak output of type mismatch between "then" and `else` `if` arms) r? @ghost
2019-01-13Rollup merge of #57538 - dlrobertson:fix_57472, r=zackmdavisMazdak Farrokhzad-0/+55
librustc_mir: Fix ICE with slice patterns If a match arm does not include all fields in a structure and a later pattern includes a field that is an array, we will attempt to use the array type from the prior arm. When calculating the field type, treat a array of an unknown size as a `TyErr`. Fixes: #57472
2019-01-13Rollup merge of #57366 - estebank:point-match-discrim, r=varkorMazdak Farrokhzad-0/+22
Point at match discriminant on type error in match arm pattern ``` error[E0308]: mismatched types --> src/main.rs:5:9 | 4 | let temp: usize = match a + b { | ----- this expression has type `usize` 5 | Ok(num) => num, | ^^^^^^^ expected usize, found enum `std::result::Result` | = note: expected type `usize` found type `std::result::Result<_, _>` ``` Fix #57279.
2019-01-13Auto merge of #51487 - Zoxc:incr-passes, r=michaelwoeristerbors-0/+34
Make more passes incremental r? @michaelwoerister
2019-01-13Rollup merge of #57102 - davidtwco:issue-57100, r=nikomatsakisMazdak Farrokhzad-8/+11
NLL: Add union justifications to conflicting borrows. Fixes #57100. This PR adds justifications to error messages for conflicting borrows of union fields. Where previously an error message would say ``cannot borrow `u.b` as mutable..``, it now says ``cannot borrow `u` (via `u.b`) as mutable..``. r? @pnkfelix
2019-01-13librustc_mir: Fix ICE with slice patternsDan Robertson-0/+55
If a match arm does not include all fields in a structure and a later pattern includes a field that is an array, we will attempt to use the array type from the prior arm. When calculating the field type, treat a array of an unknown size as a TyErr.
2019-01-12Reword label as per review commentEsteban Küber-10/+10
2019-01-12Point at the match discriminant when arm pattern has a type mismatchEsteban Küber-0/+22
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-11Update testsJohn Kåre Alsaker-0/+34
2019-01-09clarify resolve typo suggestionAndy Russell-15/+25
Include the kind of the binding that we're suggesting, and use a structured suggestion.
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-08improve non_upper_case_globals diagnosticsAndy Russell-11/+11
Use a structured suggestion and tighten the span to just the identifier.
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-04Improve diagnostic labels and add note.David Wood-2/+4
This commit improves diagnostic labels to mention which field a borrow overlaps with and adds a note explaining that the fields overlap.
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