about summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2020-03-16Rollup merge of #69995 - contrun:add-context-to-literal-overflow, ↵Dylan DPC-0/+1
r=ecstatic-morse Add more context to the literal overflow message related to issue https://github.com/rust-lang/rust/issues/63733
2020-03-15Add more context to the literal overflow messageYI-0/+1
2020-03-14increase slack for stack size testRalf Jung-2/+2
2020-03-12update testsMark Mansi-22/+22
2020-03-12Rollup merge of #69722 - estebank:negative-impl-span-ast, r=CentrilMazdak Farrokhzad-18/+12
Tweak output for invalid negative impl AST errors Use more accurate spans for negative `impl` errors. r? @Centril
2020-03-11Fix cycle error when emitting suggestion for mismatched `fn` typeAaron Hill-0/+71
Fixes #66667 Previously, we called `tcx.typeck_tables_of` when determining whether or not to emit a suggestion for a type error. However, we might already be type-checking the `DefId` we pass to `typeck_tables_of` (it could be anywhere in the query stack). Fortunately, we only need the function signature, not the entire `TypeckTables`. By using `tcx.fn_sig`, we avoid the possibility of cycle errors while retaining the ability to emit a suggestion.
2020-03-11Rollup merge of #69760 - Centril:parse-expr-improve, r=estebankMazdak Farrokhzad-6/+6
Improve expression & attribute parsing This PR includes misc improvements to expression and attribute parsing. 1. Some code simplifications 2. Better recovery for various block forms, e.g. `loop statements }` (missing `{` after `loop`). (See e.g., `block-no-opening-brace.rs` among others for examples.) 3. Added recovery for e.g., `unsafe $b` where `$b` refers to a `block` macro fragment. (See `bad-interpolated-block.rs` for examples.) 4. ^--- These are done so that code sharing in block parsing is increased. 5. Added recovery for e.g., `'label: loop { ... }` (See `labeled-no-colon-expr.rs`.) 6. Added recovery for e.g., `&'lifetime expr` (See `regions-out-of-scope-slice.rs`.) 7. Added recovery for e.g., `fn foo() = expr;` (See `fn-body-eq-expr-semi.rs`.) 8. Simplified attribute parsing code & slightly improved diagnostics. 9. Added recovery for e.g., `Box<('a) + Trait>`. 10. Added recovery for e.g, `if true #[attr] {} else #[attr] {} else #[attr] if true {}`. r? @estebank
2020-03-10unify/improve/simplify attribute parsingMazdak Farrokhzad-6/+6
2020-03-10fix test failure due to earlier emitted errorYI-1/+8
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-06Further tweak spans in ast validation errorsEsteban Küber-18/+12
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