about summary refs log tree commit diff
path: root/src/test/ui/traits
AgeCommit message (Collapse)AuthorLines
2021-12-10Point at return type when it introduces `'static` obligationEsteban Kuber-0/+32
2021-12-10Clean up visual output logicEsteban Kuber-9/+9
2021-12-10Point at capture points for non-`'static` reference crossing a `yield` pointEsteban Kuber-2/+64
``` error[E0759]: `self` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement --> $DIR/issue-72312.rs:10:24 | LL | pub async fn start(&self) { | ^^^^^ this data with an anonymous lifetime `'_`... ... LL | require_static(async move { | -------------- ...is required to live as long as `'static` here... LL | &self; | ----- ...and is captured here | note: `'static` lifetime requirement introduced by this trait bound --> $DIR/issue-72312.rs:2:22 | LL | fn require_static<T: 'static>(val: T) -> T { | ^^^^^^^ error: aborting due to previous error For more information about this error, try `rustc --explain E0759`. ``` Fix #72312.
2021-12-04Use multipart suggestions.Camille GILLOT-1/+6
2021-12-03Add test case that evals to `EvaluatedToOkModuloRegions`Wesley Wiser-1/+32
2021-12-03Add test with `#[rustc_evaluate_where_clauses]`Wesley Wiser-0/+150
As suggested via reviewer feedback.
2021-11-28Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives`Aaron Hill-0/+77
A global predicate is not guarnatenteed to outlive all regions. If the predicate involves late-bound regions, then it may fail to outlive other regions (e.g. `for<'b> &'b bool: 'static` does not hold) We now only produce `EvaluatedToOk` when a global predicate has no late-bound regions - in that case, the ony region that can be present in the type is 'static
2021-11-20Align multiline messages to their label (add left margin)Esteban Kuber-148/+148
2021-11-20Do not mention associated items when they introduce an obligationEsteban Kuber-93/+0
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-21/+73
Be more thorough in using `ItemObligation` and `BindingObligation` when evaluating obligations so that we can point at trait bounds that introduced unfulfilled obligations. We no longer incorrectly point at unrelated trait bounds (`substs-ppaux.verbose.stderr`). In particular, we now point at trait bounds on method calls. We no longer point at "obvious" obligation sources (we no longer have a note pointing at `Trait` saying "required by a bound in `Trait`", like in `associated-types-no-suitable-supertrait*`). Address part of #89418.
2021-11-18Move some tests to more reasonable directoriesCaio-0/+132
2021-11-16Rollup merge of #90819 - JakobDegen:issue-90804, r=petrochenkovYuki Okushi-9/+3
Fixes incorrect handling of TraitRefs when emitting suggestions. Closes #90804 , although there were more issues here that were hidden by the thing that caused this ICE. Underlying problem was that substitutions were being thrown out, which not only leads to an ICE but also incorrect diagnostics. On top of that, in some cases the self types from the root obligations were being mixed in with those from derived obligations. This makes a couple diagnostics arguable worse ("`B<C>` does not implement `Copy`" instead of "`C` does not implement `Copy`") but the worse diagnostics are at least still correct and that downside is in my opinion clearly outweighed by the benefits of fixing the ICE and unambiguously wrong diagnostics.
2021-11-14Move some tests to more reasonable directoriesCaio-0/+409
2021-11-13Fix handling of substitutions and binders when deciding whether to suggest ↵Jakob Degen-9/+3
references When suggesting references, substitutions were being forgotten and some types were misused. This led to at least one ICE and other incorrectly emitted diagnostics. This has been fixed; in some cases this leads to diagnostics changing, and tests have been adjusted.
2021-11-10no overlap errors after failing the orphan checklcnr-14/+14
2021-11-06Move some tests to more reasonable directoriesCaio-0/+248
2021-10-28Add test casesIlya Yanok-0/+41
2021-10-25fix(rustc_typeck): report function argument errors on matching typeMichael Howell-3/+3
Fixes #90101
2021-10-24Always sort suggestions before emitting themEsteban Kuber-2/+2
2021-10-24Point at overlapping impls when type annotations are neededEsteban Kuber-15/+117
2021-10-23Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakisbors-22/+13
Implement coherence checks for negative trait impls The main purpose of this PR is to be able to [move Error trait to core](https://github.com/rust-lang/project-error-handling/issues/3). This feature is necessary to handle the following from impl on box. ```rust impl From<&str> for Box<dyn Error> { ... } ``` Without having negative traits affect coherence moving the error trait into `core` and moving that `From` impl to `alloc` will cause the from impl to no longer compiler because of a potential future incompatibility. The compiler indicates that `&str` _could_ introduce an `Error` impl in the future, and thus prevents the `From` impl in `alloc` that would cause overlap with `From<E: Error> for Box<dyn Error>`. Adding `impl !Error for &str {}` with the negative trait coherence feature will disable this error by encoding a stability guarantee that `&str` will never implement `Error`, making the `From` impl compile. We would have this in `alloc`: ```rust impl From<&str> for Box<dyn Error> {} // A impl<E> From<E> for Box<dyn Error> where E: Error {} // B ``` and this in `core`: ```rust trait Error {} impl !Error for &str {} ``` r? `@nikomatsakis` This PR was built on top of `@yaahc` PR #85764. Language team proposal: to https://github.com/rust-lang/lang-team/issues/96
2021-10-22nice_region_error: Include lifetime placeholders in error outputMichael Howell-8/+8
As you can see in src/test/ui/traits/self-without-lifetime-constraint.stderr you can get very confusing type names if you don't have this. Fixes #87763
2021-10-20Only assemble_candidates_from_impls for polarity NegativeSantiago Pastorino-22/+13
2021-10-13Auto merge of #89555 - oli-obk:nll_member_constraint_diag, r=estebankbors-10/+10
Remove textual span from diagnostic string This is an unnecessary repetition, as the diagnostic prints the span anyway in the source path right below the message. I further removed the identification of the node, as that does not give any new information in any of the cases that are changed in tests. EDIT: also inserted a suggestion that other diagnostics were already emitting
2021-10-13Remove textual span from diagnostic stringOli Scherer-10/+10
2021-10-12add some more testcasesMarcel Hellwig-0/+136
2021-10-07Rollup merge of #89461 - crlf0710:dyn_upcasting_lint, r=nikomatsakisGuillaume Gomez-0/+41
Add `deref_into_dyn_supertrait` lint. Initial implementation of #89460. Resolves #89190. Maybe also worth a beta backport if necessary. r? `@nikomatsakis`
2021-10-04Rollup merge of #89494 - FabianWolff:issue-84075, r=davidtwcoJubilee-4/+4
Deny `where` clauses on `auto` traits Fixes #84075.
2021-10-04Rollup merge of #89483 - hkmatsumoto:patch-diagnostics-2, r=estebankJubilee-36/+36
Practice diagnostic message convention Detected by #89455. r? ```@estebank```
2021-10-03Deny `where` clauses on `auto` traitsFabian Wolff-4/+4
2021-10-03Practice diagnostic message conventionHirochika Matsumoto-36/+36
2021-10-03Add `deref_into_dyn_supertrait` lint.Charles Lew-0/+41
2021-10-02Consistently use 'supertrait'.Bruce Mitchener-61/+61
A subset of places referred to 'super-trait', so this changes them to all use 'supertrait'. This matches 'supertype' and some other usages. An exception is 'auto-trait' which is consistently used in that manner.
2021-09-30add regression test for issue 89119Rémy Rakic-0/+71
2021-09-28Improve help for recursion limit errorsRoss MacArthur-1/+1
2021-09-27Auto merge of #89263 - ↵bors-8/+14
TaKO8Ki:suggest-both-immutable-and-mutable-trait-implementations, r=estebank Suggest both of immutable and mutable trait implementations closes #85865
2021-09-27better suggestionsTakayuki Maeda-6/+8
2021-09-26fix the relevant testsTakayuki Maeda-4/+8
2021-09-26Remove box syntax from most places in src/test outside of the issues direst31-33/+40
2021-09-17Rollup merge of #88883 - c410-f3r:tests, r=petrochenkovYuki Okushi-0/+103
Move some tests to more reasonable directories - 7 cc #73494 r? ``@petrochenkov``
2021-09-16Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisabors-33/+60
Point at argument instead of call for their obligations When an obligation is introduced by a specific `fn` argument, point at the argument instead of the `fn` call if the obligation fails to be fulfilled. Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`. When giving an error about an obligation introduced by a function call that an argument doesn't fulfill, and that argument is a block, add a span_label pointing at the innermost tail expression. Current output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:31 | 2 | let p = Some(45).and_then({ | ______________________--------_^ | | | | | required by a bound introduced by this call 3 | | |x| println!("doubling {}", x); 4 | | Some(x * 2) | | ----------- 5 | | }); | |_____^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Previous output: ``` error[E0425]: cannot find value `x` in this scope --> f10.rs:4:14 | 4 | Some(x * 2) | ^ not found in this scope error[E0277]: expected a `FnOnce<({integer},)>` closure, found `Option<_>` --> f10.rs:2:22 | 2 | let p = Some(45).and_then({ | ^^^^^^^^ expected an `FnOnce<({integer},)>` closure, found `Option<_>` | = help: the trait `FnOnce<({integer},)>` is not implemented for `Option<_>` ``` Partially address #27300. Will require rebasing on top of #88546.
2021-09-16Remove unnecessary labelEsteban Kuber-4/+1
2021-09-16Point at call span that introduced obligation for the argEsteban Kuber-32/+62
2021-09-16Refactor `FulfillmentError` to track less dataEsteban Kuber-2/+2
Move the information about pointing at the call argument expression in an unmet obligation span from the `FulfillmentError` to a new `ObligationCauseCode`.
2021-09-15Move some tests to more reasonable directoriesCaio-0/+103
2021-09-15Move object safety suggestions to the end of the errorEsteban Kuber-7/+7
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-1/+1
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
2021-09-05Stop allocating vtable entries for non-object-safe methodsGary Guo-4/+41
2021-09-02Report cycle error using 'deepest' obligation in the cycleAaron Hill-12/+30
2021-09-02Preserve most sub-obligations in the projection cacheAaron Hill-27/+9