summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2020-03-08Rollup merge of #69422 - JohnTitor:remove-unwrap, r=XanewokMazdak Farrokhzad-5/+8
Remove use of `unwrap()` from save-analysis Fix #69409, fix #69416
2020-03-07Rollup merge of #69727 - JohnTitor:sugg-unwrap, r=estebankMazdak Farrokhzad-0/+37
Avoid using `unwrap()` in suggestions Fixes #69725 r? @estebank
2020-03-07Rollup merge of #67741 - estebank:point-at-pat-def, r=CentrilMazdak Farrokhzad-2/+22
When encountering an Item in a pat context, point at the item def ``` error[E0308]: mismatched types --> $DIR/const-in-struct-pat.rs:8:17 | LL | struct foo; | ----------- `foo` defined here ... LL | let Thing { foo } = t; | ^^^ expected struct `std::string::String`, found struct `foo` | = note: `foo` is interpreted as a unit struct, not a new binding help: you can bind the struct field to a different name | LL | let Thing { foo: other_foo } = t; | ^^^^^^^^^^^^^^ ``` ``` error[E0308]: mismatched types --> $DIR/const.rs:14:9 | LL | const FOO: Foo = Foo{bar: 5}; | ----------------------------- constant defined here ... LL | FOO => {}, | ^^^ | | | expected `&Foo`, found struct `Foo` | `FOO` is interpreted as a constant, not a new binding | help: use different name to introduce a new binding: `other_foo` ``` Fix #55631, fix #48062, cc #42876.
2020-03-06When encountering an Item in a pat context, point at the item defEsteban Küber-2/+22
2020-03-07Add a regression testYuki Okushi-0/+37
2020-03-06Auto merge of #69614 - estebank:ice-age, r=davidtwcobors-0/+41
`delay_span_bug` when codegen cannot select obligation Fix #69602, introduced in #60126 by letting the compiler continue past type checking after encountering errors.
2020-03-02Rollup merge of #69623 - Centril:fix-69396-tmp, r=petrochenkovDylan DPC-0/+70
stash API: remove panic to fix ICE. Implements the temporary solution suggested in https://github.com/rust-lang/rust/pull/69537#issuecomment-593143975. Fixes https://github.com/rust-lang/rust/issues/69396. r? @petrochenkov
2020-03-02stash API: remove panic to fix ICE.Mazdak Farrokhzad-0/+70
2020-03-01`delay_span_bug` when codegen cannot select obligationEsteban Küber-0/+41
Fix #69602, introduced in #60126 by letting the compiler continue past type checking after encountering errors.
2020-02-29Make it build againVadim Petrochenkov-1/+1
2020-02-29Auto merge of #69255 - estebank:e0599-details, r=varkorbors-24/+50
Add more context to E0599 errors Point at the intermediary unfulfilled trait bounds. Fix #52523, fix #61661, cc #36513, fix #68131, fix #64417, fix #61768, cc #57457, cc #9082, fix #57994, cc #64934, cc #65149.
2020-02-28keep predicate order and tweak outputEsteban Küber-12/+16
2020-02-28Review comments: split requirement text to multiple lines for readabilityEsteban Küber-3/+6
2020-02-28Account for arbitrary self types in E0599Esteban Küber-4/+2
2020-02-28Tweak wordingEsteban Küber-3/+3
2020-02-28Mention the full path of the implementing traitEsteban Küber-3/+3
2020-02-28Point at closure definitionsEsteban Küber-2/+2
2020-02-28Show information of chain of bound obligationsEsteban Küber-3/+6
When the obligation that couldn't be fulfilled is specific to a nested obligation, maintain both the nested and parent obligations around for more accurate and detailed error reporting.
2020-02-28Track all predicates in errors, not just trait obligationsEsteban Küber-1/+11
Surface associated type projection bounds that could not be fulfilled in E0599 errors. Always present the list of unfulfilled trait bounds, regardless of whether we're pointing at the ADT or trait that didn't satisfy it.
2020-02-28Deduplicate information in E0599Esteban Küber-4/+1
2020-02-28On single local candidate, use span labelEsteban Küber-6/+9
2020-02-28Reduce vebosity of E0599Esteban Küber-2/+0
2020-02-28Add more context to E0599 errorsEsteban Küber-16/+26
Point at the intermediary unfullfilled trait bounds.
2020-02-28Rollup merge of #69452 - Centril:typeck-pat, r=estebankMazdak Farrokhzad-1/+16
typeck: use `Pattern` obligation cause more for better diagnostics r? @estebank
2020-02-28Rollup merge of #69384 - petrochenkov:nounnorm, r=CentrilMazdak Farrokhzad-6/+9
parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token` So, after https://github.com/rust-lang/rust/pull/69006, its follow-ups and an attempt to remove `Parser::prev_span` I came to the conclusion that the unnormalized token and its span is what you want in most cases, so it should be default. Normalization only makes difference in few cases where we are checking against `token::Ident` or `token::Lifetime` specifically. This PR uses `normalized_token` for those cases. Using normalization explicitly means that people writing code should remember about `NtIdent` and `NtLifetime` in general. (That is alleviated by the fact that `token.ident()` and `fn parse_ident_*` are already written.) Remembering about `NtIdent`, was, however, already the case, kind of, because the implicit normalization was performed only for the current/previous token, but not for things like `look_ahead`. As a result, most of token classification methods in `token.rs` already take `NtIdent` into account (this PR fixes a few pre-existing minor mistakes though). The next step is removing `normalized(_prev)_token` entirely and replacing it with `token.ident()` (mostly) and `token.normalize()` (occasionally). I want to make it a separate PR for that and run it though perf. `normalized_token` filled on every bump has both a potential to avoid repeated normalization, and to do unnecessary work in advance (it probably doesn't matter anyway, the normalization is very cheap). r? @Centril
2020-02-28Rollup merge of #69340 - Centril:self-ctor-normalize, r=nikomatsakisMazdak Farrokhzad-0/+160
instantiate_value_path: on `SelfCtor`, avoid unconstrained tyvars Fixes https://github.com/rust-lang/rust/issues/69306. On `Self(...)` (that is, a `Res::SelfCtor`), do not use `self.impl_self_ty(...)`. The problem with that method is that it creates unconstrained inference variables for type parameters in the `impl` (e.g. `impl<T> S0<T>`). These variables then eventually get substituted for something else when they come in contact with the expected type (e.g. `S0<u8>`) or merely the arguments passed to the tuple constructor (e.g. the `0` in `Self(0)`). Instead of using `self.impl_self_ty(...)`, we instead merely use `let ty = self.normalize_ty(span, tcx.at(span).type_of(impl_def_id));` to get the rewritten `res`. r? @eddyb
2020-02-26Auto merge of #67742 - mark-i-m:describe-it, r=matthewjasperbors-6/+6
Generalized article_and_description r? @matthewjasper The logic of finding the right word and article to print seems to be repeated elsewhere... this is an experimental method to unify this logic...
2020-02-26instantiate_value_path: .impl_self_ty -> .type_ofMazdak Farrokhzad-0/+160
2020-02-25check_pat_ref: use pattern_causeMazdak Farrokhzad-0/+2
2020-02-25check_pat_tuple: use pattern_causeMazdak Farrokhzad-0/+4
2020-02-25check_pat_path: use pattern_causeMazdak Farrokhzad-1/+10
2020-02-24Cherry-pick the LLVM fix for #69225Josh Stone-0/+33
2020-02-25Tweak testsYuki Okushi-5/+6
2020-02-24parser: `token` -> `normalized_token`, `nonnormalized_token` -> `token`Vadim Petrochenkov-6/+9
2020-02-24Remove use of `unwrap()` from save-analysisYuki Okushi-5/+7
2020-02-24parse: use `parse_item_common` in `parse_assoc_item_`.Mazdak Farrokhzad-10/+33
2020-02-22update some testsMark Mansi-6/+6
2020-02-20Revert "Rollup merge of #69280 - ↵Dylan MacKenzie-2/+1
ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov" This reverts commit 61d3b6dedb1ec1f3e3cbd3d66b1a3453225bc37c, reversing changes made to c6ad1e2c2a0c7e48537617d36085f866fa6a65a3.
2020-02-20Rollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obkMazdak Farrokhzad-478/+486
Unify and improve const-prop lints Add a single helper method for all lints emitted by const-prop, and make that lint different from the CTFE `const_err` lint. Also consistently check overflow on *arithmetic*, not on the assertion, to make behavior the same for debug and release builds. See [this summary comment](https://github.com/rust-lang/rust/pull/69185#issuecomment-587924754) for details and the latest status. In terms of lint formatting, I went for what seems to be the better style: have a general message above the code, and then a specific message at the span: ``` error: this arithmetic operation will overflow --> $DIR/const-err2.rs:21:18 | LL | let a_i128 = -std::i128::MIN; | ^^^^^^^^^^^^^^^ attempt to negate with overflow ``` We could also just have the specific message above and no text at the span if that is preferred. I also converted some of the existing tests to use compiletest revisions, so that the same test can check a bunch of different compile flags. Fixes https://github.com/rust-lang/rust/issues/69020. Helps with https://github.com/rust-lang/rust/issues/69021: debug/release are now consistent, but the assoc-const test in that issue still fails (there is a FIXME in the PR for this). The reason seems to be that const-prop notices the assoc const in `T::N << 42` and does not even bother calling `const_prop` on that operation. Has no effect on https://github.com/rust-lang/rust/issues/61821; the duplication there has entirely different reasons.
2020-02-20Rollup merge of #68877 - estebank:point-at-params, r=petrochenkovMazdak Farrokhzad-21/+29
On mismatched argument count point at arguments
2020-02-19Rollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, ↵Dylan DPC-1/+2
r=petrochenkov Remove special case for `simd_shuffle` arg promotion After rust-lang/stdarch#825, these intrinsics are now defined with `#[rustc_args_required_const(2)]`, so the special-case is no longer necessary.
2020-02-19avoid excessive number of revisionsRalf Jung-151/+1
2020-02-18Add `#[rustc_args_required_const]` to `simd_shuffle` testsDylan MacKenzie-1/+2
2020-02-19Auto merge of #69241 - shahn:checked_add_revert, r=Mark-Simulacrum,lqdbors-0/+31
Revert "Remove `checked_add` in `Layout::repeat`" This fixes a a segfault in safe code, a stable regression. Reported in #69225. This reverts commit a983e0590a43ed8b0f60417828efd4e79b51f494.
2020-02-18Revert "Remove `checked_add` in `Layout::repeat`"Sebastian Hahn-0/+31
This fixes a a segfault in safe code, a stable regression. Reported in \#69225. This reverts commit a983e0590a43ed8b0f60417828efd4e79b51f494. Also adds a test for the expected behaviour.
2020-02-18better lint namesRalf Jung-9/+9
2020-02-18Rollup merge of #69217 - LeSeulArtichaut:remove-lint-impl-op, r=estebankMazdak Farrokhzad-17/+0
Do not emit note suggesting to implement operation trait to foreign type When a binary operation isn't valid, you will get a lint proposing to add a trait implementation to make the operation possible. However, this cannot be done for foreign types, such as types from `core` or `std`. For example: ``` = note: an implementation of `std::ops::Add` might be missing for `std::option::Option<i8>` ``` As mentioned in https://github.com/rust-lang/rust/issues/60497#issuecomment-562665539: > The note suggesting implementing Add<i8> should only be emitted if Option<i8> were local to the current crate, which it isn't, so in this case it shouldn't be emitted. (I will use the CI to check tests for me, or my computer will just burn... and running IDEs is not possible on a pile of ashes) r? @estebank
2020-02-18Rollup merge of #69211 - petrochenkov:prevtok, r=CentrilMazdak Farrokhzad-6/+6
parser: Simplify treatment of macro variables in `Parser::bump` Follow-up to https://github.com/rust-lang/rust/pull/69006. Token normalization for `$ident` and `$lifetime` is merged directly into `bump`. Special "unknown macro variable" diagnostic for unexpected `$`s is removed as preventing legal code from compiling (as a result `bump` also doesn't call itself recursively anymore and can't make `prev_token` inconsistent). r? @Centril
2020-02-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-3/+3
parse: fuse associated and extern items up to defaultness Language changes: - The grammar of extern `type` aliases is unified with associated ones, and becomes: ```rust TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ; ``` Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`). (Work still remains to fuse this with free `type` aliases, but this can be done later.) - The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes: ```rust GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ; ``` - A semantic restriction is added to enforce the presence of the expression (the body). - A semantic restriction is added to reject `const _` in associated contexts. Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR. ----------------------- We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s. r? @petrochenkov
2020-02-17parser: Do not call `bump` recursivelyVadim Petrochenkov-6/+6
Token normalization is merged directly into `bump`. Special "unknown macro variable" diagnostic for unexpected `$`s is removed as preventing legal code from compiling.