about summary refs log tree commit diff
path: root/src/test/ui
AgeCommit message (Collapse)AuthorLines
2022-08-26Erase late bound regions before comparing types in suggest_dereferencesMichael Goulet-0/+62
2022-08-26Suggest returning closure as impl FnMichael Goulet-0/+20
2022-08-26Rollup merge of #100978 - nnethercote:fix-100948, r=petrochenkovYuki Okushi-0/+29
Handle `Err` in `ast::LitKind::to_token_lit`. Fixes #100948. r? ``@petrochenkov``
2022-08-26Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebankYuki Okushi-14/+14
distinguish the method and associated function diagnostic information Methods are defined within the context of a struct and their first parameter is always self Associated functions don’t take self as a parameter ``` modified: compiler/rustc_typeck/src/check/method/suggest.rs modified: src/test/ui/auto-ref-slice-plus-ref.stderr modified: src/test/ui/block-result/issue-3563.stderr modified: src/test/ui/issues/issue-28344.stderr modified: src/test/ui/suggestions/dont-suggest-pin-array-dot-set.stderr modified: src/test/ui/suggestions/suggest-methods.stderr modified: src/test/ui/traits/trait-upcasting/subtrait-method.stderr ```
2022-08-25Attempt to normalize FnDef signature in InferCtxt::cmpMichael Goulet-0/+35
2022-08-25Do not report too many expr field candidatesMichael Goulet-16/+73
2022-08-25bless the change in note/help order due to migrating to SessionDiagnosticNathan Stocks-2/+2
2022-08-25Provide structured suggestion for `hashmap[idx] = val`Esteban Küber-10/+36
2022-08-25Add test for {:.0$} diagnostic issue.Mara Bos-1/+14
2022-08-25no unnormalized types for implied boundslcnr-0/+48
2022-08-25Auto merge of #100571 - cjgillot:mir-cost-visit, r=compiler-errorsbors-0/+30
Check projection types before inlining MIR Fixes https://github.com/rust-lang/rust/issues/100550 I'm very unhappy with this solution, having to duplicate MIR validation code, but at least it removes the ICE. r? `@compiler-errors`
2022-08-25Do not include `const_ptr_sub_ptr` in this stabilizationDeadbeef-0/+1
2022-08-25Stabilize `const_ptr_offset_from`.Deadbeef-4/+0
Stabilization has been completed [here](https://github.com/rust-lang/rust/issues/92980#issuecomment-1065644848) with a FCP.
2022-08-25Handle `Err` in `ast::LitKind::to_token_lit`.Nicholas Nethercote-0/+29
Fixes #100948.
2022-08-24Improve description againMatthew Kelly-7/+8
-- update summary based on review -- rewrite explanation to be more clear and correct
2022-08-25Rollup merge of #100188 - chenyukang:fix-issue-100165, r=estebankYuki Okushi-0/+50
Parser will not suggest invalid expression when use public Fixes #100165
2022-08-25Rollup merge of #99954 - dingxiangfei2009:break-out-let-else-higher-up, ↵Yuki Okushi-0/+11
r=oli-obk let-else: break out to one scope higher for let-else ```@est31``` This PR follows up with #99518 which is to break out to the last remainder scope. It breaks to the out-most `region_scope` of the block if the first statement is a `let-else`.
2022-08-25Rollup merge of #99332 - jyn514:stabilize-label-break-value, r=petrochenkovYuki Okushi-75/+49
Stabilize `#![feature(label_break_value)]` See the stabilization report in https://github.com/rust-lang/rust/issues/48594#issuecomment-1186213313.
2022-08-24Add test for #100414Michael Goulet-0/+44
2022-08-24Note binding obligation causes for const equate errorsMichael Goulet-0/+78
2022-08-24Call them constants instead of typesMichael Goulet-42/+42
2022-08-24Rollup merge of #100945 - ↵Matthias Krüger-2/+25
TaKO8Ki:add-missing-test-case-for-impl-generic-mismatch, r=Dylan-DPC Add a missing test case for impl generic mismatch This suggestion use different span depending on whether the method has generics or not, so I added a test case about the method with some generics.
2022-08-24Rollup merge of #100940 - ↵Matthias Krüger-0/+26
TaKO8Ki:do-not-suggest-adding-bound-to-opaque-type, r=fee1-dead Do not suggest adding a bound to a opaque type fixes #100442
2022-08-24Rollup merge of #100919 - sanxiyn:parallel-liveness, r=oli-obkMatthias Krüger-55/+55
Use par_body_owners for liveness I did this refactoring while working on something else. Liveness is about bodies, there is no reason to use par_for_each_module here. Tests are updated because things are visited in a different order. I checked diagnostics are same, just in a different (and IMO, better) order.
2022-08-24Rollup merge of #100906 - ChayimFriedman2:map-index-mut, r=davidtwcoMatthias Krüger-0/+40
Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexing The error can be quite confusing to newcomers. Fixes #100873. I'm not so sure about the message, open to wording suggestions.
2022-08-24Rollup merge of #100888 - ↵Matthias Krüger-14/+3
spastorino:coherence-negative-impls-implied-bounds, r=lcnr Coherence negative impls implied bounds Fixes #93875 This PR is rebased on top of #100789 and it would need to include that one which is already r+ed. r? ``@nikomatsakis`` cc ``@lcnr`` (which I've talked about https://github.com/rust-lang/rust/commit/3222f420d9d2312efe0735eb48160c7b070adc54, I guess after you finish your reordering of modules and work with OutlivesEnvironmentEnv this commit can just be reverted).
2022-08-24Rollup merge of #100826 - ↵Matthias Krüger-0/+31
vincenzopalazzo:macros/wrong_sugg_with_positional_arg, r=TaKO8Ki sugg: take into count the debug formatting Closes https://github.com/rust-lang/rust/issues/100648 This PR will fix a suggestion error by taking into consideration also the `:?` symbol and act in a different way ``@rustbot`` r? ``@compiler-errors`` N.B: I did not find a full way to test the change, any idea?
2022-08-25use a minimized exampleTakayuki Maeda-31/+14
2022-08-24add a missing test case for impl generic mismatchTakayuki Maeda-2/+25
2022-08-24Store blocks in `Thir`.Nicholas Nethercote-9/+12
Like expressions, statements, and match arms. This shrinks `thir::Stmt` and is a precursor to further shrinking `thir::Expr`.
2022-08-24do not suggest adding a bound to a opaque typeTakayuki Maeda-0/+43
2022-08-23Stabilize `#![feature(label_break_value)]`Joshua Nelson-75/+49
# Stabilization proposal The feature was implemented in https://github.com/rust-lang/rust/pull/50045 by est31 and has been in nightly since 2018-05-16 (over 4 years now). There are [no open issues][issue-label] other than the tracking issue. There is a strong consensus that `break` is the right keyword and we should not use `return`. There have been several concerns raised about this feature on the tracking issue (other than the one about tests, which has been fixed, and an interaction with try blocks, which has been fixed). 1. nrc's original comment about cost-benefit analysis: https://github.com/rust-lang/rust/issues/48594#issuecomment-422235234 2. joshtriplett's comments about seeing use cases: https://github.com/rust-lang/rust/issues/48594#issuecomment-422281176 3. withoutboats's comments that Rust does not need more control flow constructs: https://github.com/rust-lang/rust/issues/48594#issuecomment-450050630 Many different examples of code that's simpler using this feature have been provided: - A lexer by rpjohnst which must repeat code without label-break-value: https://github.com/rust-lang/rust/issues/48594#issuecomment-422502014 - A snippet by SergioBenitez which avoids using a new function and adding several new return points to a function: https://github.com/rust-lang/rust/issues/48594#issuecomment-427628251. This particular case would also work if `try` blocks were stabilized (at the cost of making the code harder to optimize). - Several examples by JohnBSmith: https://github.com/rust-lang/rust/issues/48594#issuecomment-434651395 - Several examples by Centril: https://github.com/rust-lang/rust/issues/48594#issuecomment-440154733 - An example by petrochenkov where this is used in the compiler itself to avoid duplicating error checking code: https://github.com/rust-lang/rust/issues/48594#issuecomment-443557569 - Amanieu recently provided another example related to complex conditions, where try blocks would not have helped: https://github.com/rust-lang/rust/issues/48594#issuecomment-1184213006 Additionally, petrochenkov notes that this is strictly more powerful than labelled loops due to macros which accidentally exit a loop instead of being consumed by the macro matchers: https://github.com/rust-lang/rust/issues/48594#issuecomment-450246249 nrc later resolved their concern, mostly because of the aforementioned macro problems. joshtriplett suggested that macros could be able to generate IR directly (https://github.com/rust-lang/rust/issues/48594#issuecomment-451685983) but there are no open RFCs, and the design space seems rather speculative. joshtriplett later resolved his concerns, due to a symmetry between this feature and existing labelled break: https://github.com/rust-lang/rust/issues/48594#issuecomment-632960804 withoutboats has regrettably left the language team. joshtriplett later posted that the lang team would consider starting an FCP given a stabilization report: https://github.com/rust-lang/rust/issues/48594#issuecomment-1111269353 [issue-label]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+label%3AF-label_break_value+ ## Report + Feature gate: - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/src/test/ui/feature-gates/feature-gate-label_break_value.rs + Diagnostics: - https://github.com/rust-lang/rust/blob/6b2d3d5f3cd1e553d87b5496632132565b6779d3/compiler/rustc_parse/src/parser/diagnostics.rs#L2629 - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L749 - https://github.com/rust-lang/rust/blob/f65bf0b2bb1a99f73095c01a118f3c37d3ee614c/compiler/rustc_resolve/src/diagnostics.rs#L1001 - https://github.com/rust-lang/rust/blob/111df9e6eda1d752233482c1309d00d20a4bbf98/compiler/rustc_passes/src/loops.rs#L254 - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L2079 - https://github.com/rust-lang/rust/blob/d695a497bbf4b20d2580b75075faa80230d41667/compiler/rustc_parse/src/parser/expr.rs#L1569 + Tests: - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_continue.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_unlabeled_break.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/label/label_break_value_illegal_uses.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/unused_labels.rs - https://github.com/rust-lang/rust/blob/master/src/test/ui/run-pass/for-loop-while/label_break_value.rs ## Interactions with other features Labels follow the hygiene of local variables. label-break-value is permitted within `try` blocks: ```rust let _: Result<(), ()> = try { 'foo: { Err(())?; break 'foo; } }; ``` label-break-value is disallowed within closures, generators, and async blocks: ```rust 'a: { || break 'a //~^ ERROR use of unreachable label `'a` //~| ERROR `break` inside of a closure } ``` label-break-value is disallowed on [_BlockExpression_]; it can only occur as a [_LoopExpression_]: ```rust fn labeled_match() { match false 'b: { //~ ERROR block label not supported here _ => {} } } macro_rules! m { ($b:block) => { 'lab: $b; //~ ERROR cannot use a `block` macro fragment here unsafe $b; //~ ERROR cannot use a `block` macro fragment here |x: u8| -> () $b; //~ ERROR cannot use a `block` macro fragment here } } fn foo() { m!({}); } ``` [_BlockExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/block-expr.html [_LoopExpression_]: https://doc.rust-lang.org/nightly/reference/expressions/loop-expr.html
2022-08-23sugg: take into count the debug formattingVincenzo Palazzo-0/+31
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-23Suggest alternatives when trying to mutate a `HashMap`/`BTreeMap` via indexingChayim Refael Friedman-0/+40
The error can be quite confusing to newcomers.
2022-08-23Rollup merge of #100309 - compiler-errors:issue-100300, r=sanxiynDylan DPC-11/+60
Extend comma suggestion to cases where fields arent missing Fixes #100300
2022-08-23Rollup merge of #99249 - cjgillot:no-reparse-fn, r=fee1-deadDylan DPC-50/+51
Do not re-parse function signatures to suggest generics This PR uses the existing resolution rib infrastructure to channel the correct span information to suggest generic parameters. This allows to avoid re-parsing a function's source code. Drive-by cleanup: this removes useless `FnItemRibKind` from late resolution ribs. All the use cases are already covered by `ItemRibKind` and `AssocItemRibKind` which have more precise semantics.
2022-08-23extra sanity check against consts pointing to mutable memoryRalf Jung-10/+10
2022-08-23Permit negative impls coherence to take advantage of implied boundsSantiago Pastorino-14/+3
2022-08-23Use par_body_owners for livenessSeo Sanghyeon-55/+55
2022-08-23parser will not give wrong help message for 'public'yukang-0/+50
2022-08-23Rollup merge of #100861 - RalfJung:const-ice, r=oli-obkMatthias Krüger-0/+20
fix ICE with extra-const-ub-checks Fixes https://github.com/rust-lang/rust/issues/100771
2022-08-23Rollup merge of #100789 - compiler-errors:issue-99662, r=spastorinoMatthias Krüger-2/+18
Use separate infcx to solve obligations during negative coherence I feel like I fixed this already but I may have fixed it then forgot to push the branch... Also fixes up some redundant param-envs being passed around (since they're already passed around in the `Obligation`) Fixes #99662 r? ``@spastorino``
2022-08-23Rollup merge of #100565 - ↵Matthias Krüger-0/+205
TaKO8Ki:suggest-adding-missing-semicolon-before-item, r=compiler-errors Suggest adding a missing semicolon before an item fixes #100533
2022-08-23Rollup merge of #100382 - jackh726:gat-self-outlives-input, r=compiler-errorsMatthias Krüger-1/+25
Make the GATS self outlives error take into GATs in the inputs Before, the reasoning was that outlives should factor in to the outlives error, because that value is produced and inputs aren't. However, this is potentially confusing, and we can just require this for now and relax it later if we need. GATs in where clauses still don't count for the self outlives error, and I've added a test for that. This now errors: ```rust trait Input { type Item<'a>; //~^ missing required fn takes_item<'a>(&'a self, item: Self::Item<'a>); } ``` I've also added a test that this does not: ```rust trait WhereClause { type Item<'a>; fn takes_item<'a>(&'a self) where Self::Item<'a>: ; } ``` r? ``@compiler-errors``
2022-08-22sugg: suggest the usage of boolean value when there is a typo in the keywordVincenzo Palazzo-0/+37
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2022-08-23Improve local generic parameter suggestions.Camille GILLOT-50/+51
2022-08-22safe transmute: use `Assume` struct to provide analysis optionsJack Wrenn-687/+1167
This was left as a TODO in #92268, and brings the trait more in line with what was defined in MCP411. `Assume::visibility` has been renamed to `Assume::safety`, as library safety is what's actually being assumed; visibility is just the mechanism by which it is currently checked (this may change). ref: https://github.com/rust-lang/compiler-team/issues/411 ref: https://github.com/rust-lang/rust/issues/99571
2022-08-22Auto merge of #100881 - Dylan-DPC:rollup-q9rr658, r=Dylan-DPCbors-0/+124
Rollup of 8 pull requests Successful merges: - #98200 (Expand potential inner `Or` pattern for THIR) - #99770 (Make some const prop mir-opt tests `unit-test`s) - #99957 (Rework Ipv6Addr::is_global to check for global reachability rather than global scope - rebase) - #100331 (Guarantee `try_reserve` preserves the contents on error) - #100336 (Fix two const_trait_impl issues) - #100713 (Convert diagnostics in parser/expr to SessionDiagnostic) - #100820 (Use pointer `is_aligned*` methods) - #100872 (Add guarantee that Vec::default() does not alloc) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-08-22Rollup merge of #100336 - fee1-dead-contrib:fix-wf-const-trait, r=oli-obkDylan DPC-0/+29
Fix two const_trait_impl issues r? ``@oli-obk`` Fixes #100222. Fixes #100543.
2022-08-22Rollup merge of #98200 - ouz-a:issue-98177, r=oli-obkDylan DPC-0/+95
Expand potential inner `Or` pattern for THIR Code assumed there wouldn't be a deeper `Or` pattern inside expanded `PatStack` this fixes it by looking for the `Or` pattern inside expanded `PatStack`. A more ideal solution would be recursively doing this but I haven't found a good way to do that. _fixes #97898_