about summary refs log tree commit diff
path: root/src/test/ui/wf
AgeCommit message (Collapse)AuthorLines
2021-09-23Support incremental in compiletest for non-incremental modes.Eric Huss-1/+1
2021-09-15Move object safety suggestions to the end of the errorEsteban Kuber-2/+2
2021-08-16Use note to point at bound introducing requirementEsteban Küber-107/+172
2021-08-12Use a more accurate span on assoc types WF checksEsteban Kuber-10/+10
2021-08-11Modify structured suggestion outputEsteban Küber-25/+25
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-09Do not ICE on HIR based WF check when involving lifetimesEsteban Küber-0/+45
Fix #87549.
2021-08-04Remove trailing whitespace from error messagesFabian Wolff-1/+1
2021-07-28Fix ICE in `diagnostic_hir_wf_check`Fabian Wolff-0/+26
2021-07-22Extend HIR WF checking to fieldsAaron Hill-6/+6
2021-07-20Support HIR wf checking for function signaturesAaron Hill-8/+11
During function type-checking, we normalize any associated types in the function signature (argument types + return type), and then create WF obligations for each of the normalized types. The HIR wf code does not currently support this case, so any errors that we get have imprecise spans. This commit extends `ObligationCauseCode::WellFormed` to support recording a function parameter, allowing us to get the corresponding HIR type if an error occurs. Function typechecking is modified to pass this information during signature normalization and WF checking. The resulting code is fairly verbose, due to the fact that we can no longer normalize the entire signature with a single function call. As part of the refactoring, we now perform HIR-based WF checking for several other 'typed items' (statics, consts, and inherent impls). As a result, WF and projection errors in a function signature now have a precise span, which points directly at the responsible type. If a function signature is constructed via a macro, this will allow the error message to point at the code 'most responsible' for the error (e.g. a user-supplied macro argument).
2021-07-20Auto merge of #87244 - jackh726:issue-71883, r=estebankbors-7/+15
Better diagnostics with mismatched types due to implicit static lifetime Fixes #78113 I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here. I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too. This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type. r? `@estebank`
2021-07-19Better errors when we don't have implicit statics in trait objectsjackh726-1/+8
2021-07-19Better diagnostics when mismatched types due to implict static lifetimejackh726-8/+9
2021-07-18Extend HIR-based WF checking to associated type defaultsAaron Hill-4/+4
Previously, we would only look at associated types in `impl` blocks.
2021-07-16Add initial implementation of HIR-based WF checking for diagnosticsAaron Hill-2/+26
During well-formed checking, we walk through all types 'nested' in generic arguments. For example, WF-checking `Option<MyStruct<u8>>` will cause us to check `MyStruct<u8>` and `u8`. However, this is done on a `rustc_middle::ty::Ty`, which has no span information. As a result, any errors that occur will have a very general span (e.g. the definintion of an associated item). This becomes a problem when macros are involved. In general, an associated type like `type MyType = Option<MyStruct<u8>>;` may have completely different spans for each nested type in the HIR. Using the span of the entire associated item might end up pointing to a macro invocation, even though a user-provided span is available in one of the nested types. This PR adds a framework for HIR-based well formed checking. This check is only run during error reporting, and is used to obtain a more precise span for an existing error. This is accomplished by individually checking each 'nested' type in the HIR for the type, allowing us to find the most-specific type (and span) that produces a given error. The majority of the changes are to the error-reporting code. However, some of the general trait code is modified to pass through more information. Since this has no soundness implications, I've implemented a minimal version to begin with, which can be extended over time. In particular, this only works for HIR items with a corresponding `DefId` (e.g. it will not work for WF-checking performed within function bodies).
2021-07-09Replace associated item bound vars with placeholders when projecting.jackh726-2/+2
2021-05-21Adjust self-type to require equalityMark Rousskov-3/+31
2021-03-31give full path of constraint in suggest_constraining_type_paramhi-rustin-34/+34
revert file bless with nll mode
2021-03-15More precise spans for HIR pathsVadim Petrochenkov-1/+1
2021-02-03Miscellaneous small diagnostics cleanupCamelid-1/+1
2020-12-31FIx ICE on wf check for foreign fnsYuki Okushi-0/+41
2020-10-20review commentsEsteban Küber-10/+10
2020-10-20Tweak "object unsafe" errorsEsteban Küber-45/+64
Fix #77598.
2020-09-02pretty: trim paths of unique symbolsDan Aloni-120/+120
If a symbol name can only be imported from one place for a type, and as long as it was not glob-imported anywhere in the current crate, we can trim its printed path and print only the name. This has wide implications on error messages with types, for example, shortening `std::vec::Vec` to just `Vec`, as long as there is no other `Vec` importable anywhere. This adds a new '-Z trim-diagnostic-paths=false' option to control this feature. On the good path, with no diagnosis printed, we should try to avoid issuing this query, so we need to prevent trimmed_def_paths query on several cases. This change also relies on a previous commit that differentiates between `Debug` and `Display` on various rustc types, where the latter is trimmed and presented to the user and the former is not.
2020-07-27mv std libs to library/mark-1/+1
2020-07-25Use the proper span when WF-checking an impl self typeAaron Hill-0/+23
2020-07-20wf: check foreign fn decls for well-formednessDavid Wood-0/+36
This commit extends current well-formedness checking to apply to foreign function declarations, re-using the existing machinery for regular functions. In doing this, later parts of the compiler (such as the `improper_ctypes` lint) can rely on being operations not failing as a result of invalid code which would normally be caught earlier. Signed-off-by: David Wood <david@davidtw.co>
2020-07-14Remove `Sized` `on_unimplemented` noteEsteban Küber-2/+0
2020-07-14Suggest boxing or borrowing unsized fieldsEsteban Küber-18/+18
2020-06-16Provide `help` when `T: ?Sized` can't be suggestedEsteban Küber-0/+7
2020-05-30Tweak type parameter errors to reduce verbosityEsteban Küber-47/+7
2020-05-12Increase verbosity of bound restriction suggestionsEsteban Küber-22/+42
- Make the bound restriction suggestion `span_suggestion_verbose`. - Fix whitespace typo.
2020-04-08Small tweaks to required bound spanEsteban Küber-28/+28
2020-04-08Use `PredicateObligation`s instead of `Predicate`sEsteban Küber-28/+33
Keep more information about trait binding failures.
2020-03-29Tweak `suggest_constraining_type_param`Esteban Küber-72/+54
Some of the bound restriction structured suggestions were incorrect while others had subpar output.
2020-03-06fix various typosMatthias Krüger-1/+1
2020-02-19Tweak binding lifetime suggestion textEsteban Küber-6/+6
We already have a structured suggestion, but the wording made it seem like that wasn't the case. Fix #65286. r? @varkor
2020-02-09Improve reporting errors and suggestions for trait boundsPatryk Wychowaniec-50/+118
2020-02-02Use more appropriate spans on object unsafe traits and provide structured ↵Esteban Küber-1/+1
suggestions when possible
2020-02-02Wording changes to object unsafe trait errorsEsteban Küber-10/+30
Stemming from the thread at https://twitter.com/indygreg/status/1223279056398929920
2020-02-02Slight rewording of diagnostic messageEsteban Küber-9/+9
2020-02-02Use more accurate failed predicate spansEsteban Küber-93/+77
2020-02-02Tweak `Self: Sized` restriction diagnostic outputEsteban Küber-8/+0
2020-02-02Point at `Sized` boundEsteban Küber-0/+24
2020-02-02Point at arguments or output when fn obligations come from them, or ident ↵Esteban Küber-103/+72
when they don't
2020-01-05Add backticks to various diagnosticsvarkor-1/+1
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-2/+2
Specific labels when referring to "expected" and "found" types
2019-11-18Specific labels when referring to "expected" and "found" typesEsteban Küber-2/+2
2019-10-27update testsMark Mansi-0/+12
2019-10-23Auto merge of #57545 - bovinebuddha:object_safe_for_dispatch, r=nikomatsakisbors-0/+169
Object safe for dispatch cc #43561