summary refs log tree commit diff
path: root/src/test/ui/traits
AgeCommit message (Collapse)AuthorLines
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-7/+7
2022-07-28Remove guess_head_span.Camille GILLOT-6/+5
2022-07-22Auto merge of #99420 - RalfJung:vtable, r=oli-obkbors-15/+68
make vtable pointers entirely opaque This implements the scheme discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/338: vtable pointers should be considered entirely opaque and not even readable by Rust code, similar to function pointers. - We have a new kind of `GlobalAlloc` that symbolically refers to a vtable. - Miri uses that kind of allocation when generating a vtable. - The codegen backends, upon encountering such an allocation, call `vtable_allocation` to obtain an actually dataful allocation for this vtable. - We need new intrinsics to obtain the size and align from a vtable (for some `ptr::metadata` APIs), since direct accesses are UB now. I had to touch quite a bit of code that I am not very familiar with, so some of this might not make much sense... r? `@oli-obk`
2022-07-20we seem to monomorphize fewer vtables by default now, so adjust some testsRalf Jung-15/+68
2022-07-20Rollup merge of #99352 - compiler-errors:tighter-spans-on-generic-call, ↵Matthias Krüger-17/+5
r=spastorino Use `typeck_results` to avoid duplicate `ast_ty_to_ty` call Comes with a bunch of improvements in spans :heart_eyes:
2022-07-19Add E0790 as more specific variant of E0283aticu-5/+11
2022-07-16Use typeck_results to avoid duplicate ast_ty_to_ty callMichael Goulet-17/+5
2022-07-16Rollup merge of #99290 - compiler-errors:revert-98794, r=lcnrMatthias Krüger-8/+1
Revert "Highlight conflicting param-env candidates" This reverts #98794, commit 08135254dcf22be0d5661ea8f75e703b29a83514. Seems to have caused an incremental compilation bug. The root cause of the incr comp bug is somewhat unrelated but is triggered by this PR, so I don't feel comfortable with having this PR in the codebase until it can be investigated further. Fixes #99233.
2022-07-15Revert "Highlight conflicting param-env candidates"Michael Goulet-8/+1
This reverts commit 08135254dcf22be0d5661ea8f75e703b29a83514.
2022-07-15passes: migrate half of `check_attr`David Wood-4/+4
Migrate half of the `rustc_passes::check_attr` diagnostics to using diagnostic derives and being translatable.
2022-07-11Rollup merge of #99075 - danobi:dup_type_hint_sugg, r=petrochenkovMatthias Krüger-8/+0
Fix duplicated type annotation suggestion Before, there was more or less duplicated suggestions to add type hints. Fix by clearing more generic suggestions when a more specific suggestion is possible. This fixes #93506 .
2022-07-11Rollup merge of #99147 - compiler-errors:issue-55673, r=lcnrDylan DPC-2/+2
Mention similarly named associated type even if it's not clearly in supertrait Due to query cycle avoidance, we sometimes restrict the candidates in `complain_about_assoc_type_not_found` too much so that we can't detect typo replacements from just supertraits. This creates a more general note of the existence of a similarly named associated type from _all_ visible traits when possible. Fixes #55673
2022-07-11Do not mention private Self types from other cratesMichael Goulet-1/+0
2022-07-11Mention similarly named associated type even if it's not clearly in supertraitMichael Goulet-2/+2
2022-07-08Fix duplicated type annotation suggestionDaniel Xu-8/+0
Before, there was more or less duplicated suggestions to add type hints. Fix by clearing more generic suggestions when a more specific suggestion is possible. This fixes #93506 .
2022-07-08Auto merge of #98816 - estebank:implicit-sized, r=oli-obkbors-9/+9
Track implicit `Sized` obligations in type params When we evaluate `ty::GenericPredicates` we introduce the implicit `Sized` predicate of type params, but we do so with only the `Predicate` its `Span` as context, we don't have an `Obligation` or `ObligationCauseCode` we could influence. To try and carry this information through, we add a new field to `ty::GenericPredicates` that tracks both which predicates come from a type param and whether that param has any bounds already (to use in suggestions). We also suggest adding a `?Sized` bound if appropriate on E0599. Address part of #98539.
2022-07-08Rollup merge of #98794 - compiler-errors:conflicting-param-env, ↵Dylan DPC-1/+8
r=michaelwoerister Highlight conflicting param-env candidates This could probably be further improved by noting _why_ equivalent param-env candidates (modulo regions) leads to ambiguity. Fixes #98786
2022-07-08Highlight conflicting param-env candidatesMichael Goulet-1/+8
2022-07-07Track implicit `Sized` obligations in type paramsEsteban Küber-9/+9
Suggest adding a `?Sized` bound if appropriate on E0599 by inspecting the HIR Generics. (Fix #98539)
2022-07-07Shorten span for closures.Camille GILLOT-1/+1
2022-07-02Auto merge of #91743 - cjgillot:enable_mir_inlining_inline_all, r=oli-obkbors-2/+3
Enable MIR inlining Continuation of https://github.com/rust-lang/rust/pull/82280 by `@wesleywiser.` #82280 has shown nice compile time wins could be obtained by enabling MIR inlining. Most of the issues in https://github.com/rust-lang/rust/issues/81567 are now fixed, except the interaction with polymorphization which is worked around specifically. I believe we can proceed with enabling MIR inlining in the near future (preferably just after beta branching, in case we discover new issues). Steps before merging: - [x] figure out the interaction with polymorphization; - [x] figure out how miri should deal with extern types; - [x] silence the extra arithmetic overflow warnings; - [x] remove the codegen fulfilment ICE; - [x] remove the type normalization ICEs while compiling nalgebra; - [ ] tweak the inlining threshold.
2022-07-01Auto merge of #98781 - GuillaumeGomez:rollup-798kb8u, r=GuillaumeGomezbors-7/+11
Rollup of 5 pull requests Successful merges: - #97249 (`<details>`/`<summary>` UI fixes) - #98418 (Allow macOS to build LLVM as shared library) - #98460 (Use CSS variables to handle theming) - #98497 (Improve some inference diagnostics) - #98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests) Failed merges: - #98761 (more `need_type_info` improvements) r? `@ghost` `@rustbot` modify labels: rollup
2022-07-01Don't point at Self type if we can't find an infer variable in ambiguous ↵Michael Goulet-3/+3
trait predicate
2022-07-01Show source of ambiguity in a few more placesMichael Goulet-4/+8
2022-07-01Bless recursion test.Camille GILLOT-2/+3
2022-07-01Shorten def_span for more items.Camille GILLOT-99/+47
2022-06-28Note concrete type being coerced into objectMichael Goulet-5/+5
2022-06-28Auto merge of #98396 - cjgillot:iwfchir, r=petrochenkovbors-2/+2
Do not access HIR to check impl wf. r? `@ghost`
2022-06-27Auto merge of #98221 - cjgillot:single-coh, r=lcnrbors-21/+11
Perform coherence checking per impl. r? `@ghost`
2022-06-26add regression test for #87558Takayuki Maeda-0/+33
2022-06-25Rollup merge of #98298 - TaKO8Ki:point-to-type-param-definition, ↵Matthias Krüger-9/+13
r=compiler-errors Point to type parameter definition when not finding variant, method and associated item fixes #77391
2022-06-24Bless ui tests.Camille GILLOT-2/+2
2022-06-22Perform coherence checking per impl.Camille GILLOT-21/+11
2022-06-22point to type param definition when not finding variant, method and assoc typeTakayuki Maeda-9/+13
use `def_ident_span` , `body_owner_def_id` instead of `in_progress_typeck_results`, `guess_head_span` use `body_id.owner` directly add description to label
2022-06-21Move some tests to more reasonable directoriesCaio-0/+79
2022-06-16 fix one more case of trailing spaceklensy-7/+7
2022-06-16diagnostics: fix trailing spaceklensy-10/+10
2022-06-13Move testsCaio-0/+162
2022-06-11Handle empty where-clause betterMichael Goulet-3/+3
2022-06-08Rollup merge of #97595 - ouz-a:issue-97381, r=compiler-errorsDylan DPC-0/+45
Remove unwrap from get_vtable This avoids ICE on issue #97381 I think the bug is a bit deeper though, it compiles fine when `v` is `&v` which makes me think `Deref` is causing some issue with borrowck but it's fine I guess since this thing crashes since `nightly-2020-09-17` 😅
2022-06-07Auto merge of #95565 - jackh726:remove-borrowck-mode, r=nikomatsakisbors-212/+19
Remove migrate borrowck mode Closes #58781 Closes #43234 # Stabilization proposal This PR proposes the stabilization of `#![feature(nll)]` and the removal of `-Z borrowck`. Current borrow checking behavior of item bodies is currently done by first infering regions *lexically* and reporting any errors during HIR type checking. If there *are* any errors, then MIR borrowck (NLL) never occurs. If there *aren't* any errors, then MIR borrowck happens and any errors there would be reported. This PR removes the lexical region check of item bodies entirely and only uses MIR borrowck. Because MIR borrowck could never *not* be run for a compiled program, this should not break any programs. It does, however, change diagnostics significantly and allows a slightly larger set of programs to compile. Tracking issue: #43234 RFC: https://github.com/rust-lang/rfcs/blob/master/text/2094-nll.md Version: 1.63 (2022-06-30 => beta, 2022-08-11 => stable). ## Motivation Over time, the Rust borrow checker has become "smarter" and thus allowed more programs to compile. There have been three different implementations: AST borrowck, MIR borrowck, and polonius (well, in progress). Additionally, there is the "lexical region resolver", which (roughly) solves the constraints generated through HIR typeck. It is not a full borrow checker, but does emit some errors. The AST borrowck was the original implementation of the borrow checker and was part of the initially stabilized Rust 1.0. In mid 2017, work began to implement the current MIR borrow checker and that effort ompleted by the end of 2017, for the most part. During 2018, efforts were made to migrate away from the AST borrow checker to the MIR borrow checker - eventually culminating into "migrate" mode - where HIR typeck with lexical region resolving following by MIR borrow checking - being active by default in the 2018 edition. In early 2019, migrate mode was turned on by default in the 2015 edition as well, but with MIR borrowck errors emitted as warnings. By late 2019, these warnings were upgraded to full errors. This was followed by the complete removal of the AST borrow checker. In the period since, various errors emitted by the MIR borrow checker have been improved to the point that they are mostly the same or better than those emitted by the lexical region resolver. While there do remain some degradations in errors (tracked under the [NLL-diagnostics tag](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-diagnostics), those are sufficiently small and rare enough that increased flexibility of MIR borrow check-only is now a worthwhile tradeoff. ## What is stabilized As said previously, this does not fundamentally change the landscape of accepted programs. However, there are a [few](https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3ANLL-fixed-by-NLL) cases where programs can compile under `feature(nll)`, but not otherwise. There are two notable patterns that are "fixed" by this stabilization. First, the `scoped_threads` feature, which is a continutation of a pre-1.0 API, can sometimes emit a [weird lifetime error](https://github.com/rust-lang/rust/issues/95527) without NLL. Second, actually seen in the standard library. In the `Extend` impl for `HashMap`, there is an implied bound of `K: 'a` that is available with NLL on but not without - this is utilized in the impl. As mentioned before, there are a large number of diagnostic differences. Most of them are better, but some are worse. None are serious or happen often enough to need to block this PR. The biggest change is the loss of error code for a number of lifetime errors in favor of more general "lifetime may not live long enough" error. While this may *seem* bad, the former error codes were just attempts to somewhat-arbitrarily bin together lifetime errors of the same type; however, on paper, they end up being roughly the same with roughly the same kinds of solutions. ## What isn't stabilized This PR does not completely remove the lexical region resolver. In the future, it may be possible to remove that (while still keeping HIR typeck) or to remove it together with HIR typeck. ## Tests Many test outputs get updated by this PR. However, there are number of tests specifically geared towards NLL under `src/test/ui/nll` ## History * On 2017-07-14, [tracking issue opened](https://github.com/rust-lang/rust/issues/43234) * On 2017-07-20, [initial empty MIR pass added](https://github.com/rust-lang/rust/pull/43271) * On 2017-08-29, [RFC opened](https://github.com/rust-lang/rfcs/pull/2094) * On 2017-11-16, [Integrate MIR type-checker with NLL](https://github.com/rust-lang/rust/pull/45825) * On 2017-12-20, [NLL feature complete](https://github.com/rust-lang/rust/pull/46862) * On 2018-07-07, [Don't run AST borrowck on mir mode](https://github.com/rust-lang/rust/pull/52083) * On 2018-07-27, [Add migrate mode](https://github.com/rust-lang/rust/pull/52681) * On 2019-04-22, [Enable migrate mode on 2015 edition](https://github.com/rust-lang/rust/pull/59114) * On 2019-08-26, [Don't downgrade errors on 2015 edition](https://github.com/rust-lang/rust/pull/64221) * On 2019-08-27, [Remove AST borrowck](https://github.com/rust-lang/rust/pull/64790)
2022-06-05get_vtable returns opt instd of unwrppingouz-a-0/+45
2022-06-04Rollup merge of #97696 - cjgillot:normalize-inline, r=compiler-errorsMatthias Krüger-0/+24
Do not ICE when failing to normalize during inlining. Fixes https://github.com/rust-lang/rust/issues/97695
2022-06-03Fully stabilize NLLJack Huey-212/+19
2022-06-03Do not ICE when failing to normalize during inlining.Camille GILLOT-0/+24
2022-06-03Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebankbors-153/+593
rewrite error handling for unresolved inference vars Pretty much completely rewrites `fn emit_inference_failure_err`. This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments. Because this is a rewrite there are still some parts which are lacking, these are tracked in #94483 and will be fixed in later PRs. r? `@estebank` `@petrochenkov`
2022-06-03Auto merge of #97497 - c410-f3r:z-errors, r=petrochenkovbors-0/+27
Move some tests to more reasonable places r? `@petrochenkov`
2022-06-02fix wrong suggestion for adding where clausesTakayuki Maeda-0/+24
2022-06-02add new `emit_inference_failure_err`lcnr-153/+593
2022-05-28Move some tests to more reasonable placesCaio-0/+27