summary refs log tree commit diff
path: root/src/test/ui/issues
AgeCommit message (Collapse)AuthorLines
2020-01-17Add ICE regression testsEsteban Küber-0/+34
(cherry picked from commit f6e9fd037a7b55f8f4fe78694b77d9788b18dfeb)
2020-01-17Do not ICE on unicode next pointEsteban Küber-0/+23
Use `shrink_to_hi` instead of `next_point` Fix #68000. (cherry picked from commit fcd850fc5db2501d14b2e0cbfac8aa890d700e55)
2019-12-15Auto merge of #67216 - ecstatic-morse:const-loop, r=oli-obkbors-2/+6
Enable `loop` and `while` in constants behind a feature flag This PR is an initial implementation of #52000. It adds a `const_loop` feature gate, which allows `while` and `loop` expressions through both HIR and MIR const-checkers if enabled. `for` expressions remain forbidden by the HIR const-checker, since they desugar to a call to `IntoIterator::into_iter`, which will be rejected anyways. `while` loops also require [`#![feature(const_if_match)]`](https://github.com/rust-lang/rust/pull/66507), since they have a conditional built into them. The diagnostics from the HIR const checker will suggest this to the user. r? @oli-obk cc @rust-lang/wg-const-eval
2019-12-13Auto merge of #65951 - estebank:type-inference-error, r=nikomatsakisbors-23/+38
Point at method call when type annotations are needed - Point at method call instead of whole expression when type annotations are needed. - Suggest use of turbofish on function and methods. Fix #49391, fix #46333, fix #48089. CC #58517, #63502, #63082. Fixes https://github.com/rust-lang/rust/issues/40015 r? @nikomatsakis
2019-12-13Rollup merge of #67026 - Nadrieril:improve-usefulness-empty, ↵Mazdak Farrokhzad-2/+2
r=varkor,Centril,estebank Improve diagnostics and code for exhaustiveness of empty matches There was a completely separate check and diagnostics for the case of an empty match. This led to slightly different error messages and duplicated code. This improves code reuse and generally clarifies what happens for empty matches. This also clarifies the action of the `exhaustive_patterns` feature, and ensures that this feature doesn't change diagnostics in places it doesn't need to.
2019-12-13Bless unrelated tests with new help messageDylan MacKenzie-2/+6
2019-12-11Add more context for type parametersEsteban Küber-12/+12
2019-12-10Avoid invalid suggestion by checking the snippet in const fn callEsteban Küber-4/+1
2019-12-10missing test change, bad suggestionEsteban Küber-1/+4
2019-12-10Use the appropriate number of type arguments in suggestionEsteban Küber-4/+4
2019-12-10Deduplicate logicEsteban Küber-13/+23
2019-12-10Point at method call when type annotations are neededEsteban Küber-3/+8
2019-12-10Auto merge of #67039 - xfix:manually-implement-pin-traits, r=nikomatsakisbors-0/+40
Use deref target in Pin trait implementations Using deref target instead of pointer itself avoids providing access to `&Rc<T>` for malicious implementations, which would allow calling `Rc::get_mut`. This is a breaking change necessary due to unsoundness, however the impact of it should be minimal. This only fixes the issue with malicious `PartialEq` implementations, other `Pin` soundness issues are still here. See <https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73> for more details.
2019-12-08Rollup merge of #66325 - BartMassey:master, r=joshtriplettMazdak Farrokhzad-1/+1
Change unused_labels from allow to warn Fixes #66324, making the unused_labels lint warn instead of allow by default. I'm told @rust-lang/lang will need to review this, and perhaps will want to do a crater run.
2019-12-07Auto merge of #66927 - RalfJung:engines-dont-panic, r=oli-obkbors-191/+37
Miri core engine: use throw_ub instead of throw_panic See https://github.com/rust-lang/rust/issues/66902 for context: panicking is not really an "interpreter error", but just part of a normal Rust execution. This is a first step towards removing the `InterpError::Panic` variant: the core Miri engine does not use it any more. ConstProp and ConstEval still use it, though. This will be addressed in future PRs. From what I can tell, all the error messages this removes are actually duplicates. r? @oli-obk @wesleywiser
2019-12-06Rollup merge of #67009 - Aaron1011:fix/coerce-suggestion, r=CentrilMazdak Farrokhzad-8/+22
Emit coercion suggestions in more places Fixes #66910 We have several different kinds of suggestions we can try to make when type coercion fails. However, we were previously only emitting these suggestions from `demand_coerce_diag`. This resulted in the compiler failing to emit applicable suggestions in several different cases, such as when the implicit return value of a function had the wrong type. This commit adds a new `emit_coerce_suggestions` method, which tries to emit a number of related suggestions. This method is called from both `demand_coerce_diag` and `CoerceMany::coerce_inner`, which covers a much wider range of cases than before. We now suggest using `.await` in more cases where it is applicable, among other improvements. I'm not happy about disabling the `issue-59756`, but from what I can tell, the suggestion infrastructure in rustc lacks any way of indicating mutually exclusive suggestions (and compiletest lacks a way to only apply a subset of available suggestions).
2019-12-06Rollup merge of #66606 - christianpoveda:mut-refs-in-const-fn, r=oli-obkMazdak Farrokhzad-7/+16
Add feature gate for mut refs in const fn r? @oli-obk
2019-12-06Rollup merge of #66979 - reese:E0631-long-error, r=GuillaumeGomezYuki Okushi-2/+4
Add long error for E0631 and update ui tests. This PR adds a long error for `E0631`, which covers errors where closure argument types are mismatched. It also updates UI tests where this error is applicable. Part of #61137
2019-12-05Rollup merge of #67044 - Centril:67037, r=estebankMazdak Farrokhzad-0/+43
E0023: handle expected != tuple pattern type Fixes #67037. r? @estebank
2019-12-05Rollup merge of #67011 - Aaron1011:fix/expected-found-span, r=Dylan-DPCMazdak Farrokhzad-18/+48
Include a span in more `expected...found` notes In most places, we use a span when emitting `expected...found` errors. However, there were a couple of places where we didn't use any span, resulting in hard-to-interpret error messages. This commit attaches the relevant span to these notes, and additionally switches over to using `note_expected_found` instead of manually formatting the message
2019-12-05Rollup merge of #67010 - estebank:raw-idents, r=CentrilMazdak Farrokhzad-0/+44
Accurately portray raw identifiers in error messages When refering to or suggesting raw identifiers, refer to them with `r#`. Fix #65634.
2019-12-05Rollup merge of #66863 - osa1:fix_66702, r=cramertjMazdak Farrokhzad-0/+18
Check break target availability when checking breaks with values Fixes #66702 I'll be adding a regression test.
2019-12-05Add UI test for Pin PartialEq unsoundnessKonrad Borowski-0/+40
2019-12-05E0023: handle expected != pat-tup-typeMazdak Farrokhzad-0/+43
2019-12-04Forgot to update some test outputsNadrieril-2/+2
2019-12-03review comments: move testEsteban Küber-0/+44
2019-12-03Include a span in more `expected...found` notesAaron Hill-18/+48
In most places, we use a span when emitting `expected...found` errors. However, there were a couple of places where we didn't use any span, resulting in hard-to-interpret error messages. This commit attaches the relevant span to these notes, and additionally switches over to using `note_expected_found` instead of manually formatting the message
2019-12-03Disable issue-59756 test for nowAaron Hill-0/+4
Currently, rustfix has no notion of mutually exclusive suggestions. When it processes issue-59756, it will attempt to apply two mutually exclusive suggestions for the same span, causing an error.
2019-12-03Emit coercion suggestions in more placesAaron Hill-8/+18
Fixes #66910 We have several different kinds of suggestions we can try to make when type coercion fails. However, we were previously only emitting these suggestions from `demand_coerce_diag`. This resulted in the compiler failing to emit applicable suggestions in several different cases, such as when the implicit return value of a function had the wrong type. This commit adds a new `emit_coerce_suggestions` method, which tries to emit a number of related suggestions. This method is called from both `demand_coerce_diag` and `CoerceMany::coerce_inner`, which covers a much wider range of cases than before. We now suggest using `.await` in more cases where it is applicable, among other improvements.
2019-12-03Check break target availability when checking breaks with valuesÖmer Sinan Ağacan-0/+18
Fixes #66702
2019-12-02Add long error for E0631 and update ui tests.Reese Williams-2/+4
2019-12-02syntax: Introduce a struct `MacArgs` for macro argumentsVadim Petrochenkov-6/+6
2019-12-02Correct other tests related to const_mut_refsChristian Poveda-7/+16
2019-12-01Miri core engine: use throw_ub instead of throw_panicRalf Jung-191/+37
2019-11-30Rollup merge of #66870 - tmiasko:simplify-ty, r=oli-obkMazdak Farrokhzad-0/+20
SimplifyArmIdentity only for locals with the same type Fixes #66856 Fixes #66851
2019-11-29Bless ui test for libstd reformatDavid Tolnay-2/+2
2019-11-29SimplifyArmIdentity only for locals with the same typeTomasz Miąsko-0/+20
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-11-28Deduplicate type param constraint suggestion codeEsteban Küber-2/+2
2019-11-28Use structured suggestion when requiring `Copy` constraint in type paramEsteban Küber-3/+39
2019-11-27Simplify `mem_categorization`Matthew Jasper-23/+3
* `Place` is no longer recursive. * The `cmt` type alias is removed * `Upvar` places no longer include the dereferences of the environment closure or of by reference captures. * All non-dereference projections are combined to a single variant. * Various unnecessary types and methods have been removed.
2019-11-26Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPCTyler Mandry-21/+3
Various tweaks to diagnostic output
2019-11-25Tweak move error due to non-CopyEsteban Küber-21/+3
2019-11-25Auto merge of #66682 - estebank:fn-type-err, r=davidtwcobors-8/+8
Highlight parts of fn in type errors When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each. Examples: <img width="699" alt="" src="https://user-images.githubusercontent.com/1606434/69487597-ab561600-0e11-11ea-9b4e-d4fd9e91d5dc.png"> <img width="528" alt="" src="https://user-images.githubusercontent.com/1606434/69487207-9033d800-0e0a-11ea-93e3-8c4d002411a5.png"> <img width="468" alt="" src="https://user-images.githubusercontent.com/1606434/69487208-9033d800-0e0a-11ea-92e3-2b2cee120335.png"> <img width="775" alt="" src="https://user-images.githubusercontent.com/1606434/69487209-9033d800-0e0a-11ea-9e68-7f6ed5c8cb08.png">
2019-11-23Highlight parts of fn in type errorsEsteban Küber-8/+8
When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each.
2019-11-23Rollup merge of #66539 - estebank:let-ty, r=CentrilMazdak Farrokhzad-16/+38
Point at type in `let` assignment on type errors Fix #61067.
2019-11-23Auto merge of #66507 - ecstatic-morse:const-if-match, r=oli-obkbors-79/+2
Enable `if` and `match` in constants behind a feature flag This PR is an initial implementation of #49146. It introduces a `const_if_match` feature flag and does the following if it is enabled: - Allows `Downcast` projections, `SwitchInt` terminators and `FakeRead`s for matched places through the MIR const-checker. - Allows `if` and `match` expressions through the HIR const-checker. - Stops converting `&&` to `&` and `||` to `|` in `const` and `static` items. As a result, the following operations are now allowed in a const context behind the feature flag: - `if` and `match` - short circuiting logic operators (`&&` and `||`) - the `assert` and `debug_assert` macros (if the `const_panic` feature flag is also enabled) However, the following operations remain forbidden: - `while`, `loop` and `for` (see #52000) - the `?` operator (calls `From::from` on its error variant) - the `assert_eq` and `assert_ne` macros, along with their `debug` variants (calls `fmt::Debug`) This PR is possible now that we use dataflow for const qualification (see #64470 and #66385). r? @oli-obk cc @rust-lang/wg-const-eval @eddyb
2019-11-22Rollup merge of #66587 - matthewjasper:handle-static-as-const, r=oli-obkMazdak Farrokhzad-9/+9
Handle statics in MIR as const pointers This is the first PR towards the goal of removing `PlaceBase::Static`. In this PR: * Statics are lowered to dereferencing a const pointer. * The temporaries holding such pointers are tracked in MIR, for the most part this is only used for diagnostics. There are two exceptions: * The borrow checker has some checks for thread-locals that directly use this data. * Const checking will suppress "cannot dereference raw pointer" diagnostics for pointers to `static mut`/`extern static`. This is to maintain the current behaviour (12 tests fail otherwise). The following are left to future PRs (I think that @spastorino will be working on the first 3): * Applying the same treatments to promoted statics. * Removing `PlaceBase::Static`. * Replacing `PlaceBase` with `Local`. * Moving the ever growing collection of metadata that we have for diagnostics in MIR passes somewhere more appropriate. r? @oli-obk
2019-11-22Rollup merge of #66183 - Centril:empty-vis-trait-decl, r=petrochenkovMazdak Farrokhzad-6/+7
*Syntactically* permit visibilities on trait items & enum variants Fixes #65041 Suppose we have `$vis trait_item` or `$vis enum_variant` and `$vis` is a `:vis` macro fragment. Before this PR, this would fail to parse. This is now instead allowed as per language team consensus in https://github.com/rust-lang/rust/issues/65041#issuecomment-538105286. (See added tests for elaboration.) Moreover, we now also permit visibility modifiers on trait items & enum variants *syntactically* but reject them with semantic checks (in `ast_validation`): ```rust #[cfg(FALSE)] trait Foo { pub fn bar(); } // OK #[cfg(FALSE)] enum E { pub U } // OK ```
2019-11-21Point at type in `let` assignment on type errorsEsteban Küber-16/+38
2019-11-21Reorganize, bless and add tests for const control flowDylan MacKenzie-79/+2
This creates a new test directory, `ui/consts/control-flow` to hold tests related to control flow in a const context. It also blesses all existing tests with the new error messages, and adds new tests for the `const_if_match` feature.