about summary refs log tree commit diff
path: root/src/test/ui/traits
AgeCommit message (Collapse)AuthorLines
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
2021-08-27Don't use `guess_head_span` in `predicates_of` for foreign spanAaron Hill-2/+6
Previously, the result of `predicates_of` for a foreign trait would depend on the *current* state of the corresponding source file in the foreign crate. This could lead to ICEs during incremental compilation, since the on-disk contents of the upstream source file could potentially change without the upstream crate being recompiled. Additionally, this ensure that that the metadata we produce for a crate only depends on its *compiled* upstream dependencies (e.g an rlib or rmeta file), *not* the current on-disk state of the upstream crate source files.
2021-08-22Fix typos “a”→“an”Frank Steffahn-2/+2
2021-08-21Auto merge of #88135 - crlf0710:trait_upcasting_part_3, r=nikomatsakisbors-96/+51
Trait upcasting coercion (part 3) By using separate candidates for each possible choice, this fixes type-checking issues in previous commits. r? `@nikomatsakis`
2021-08-18Add a new test case to verify behavior.Charles Lew-0/+39
2021-08-18Auto merge of #87738 - lqd:polonius-master, r=nikomatsakisbors-0/+55
Update `polonius-engine` to 0.13.0 This PR updates the use of `polonius-engine` to the recently released 0.13.0: - this version renamed a lot of relations to match the current terminology - "illegal subset relationships errors" (AKA "subset errors" or "universal region errors" in rustc parlance) have been implemented in all variants, and therefore the `Hybrid` variant can be the rustc default once again - some of the blessed expectations were updated: new tests have been added since the last time I updated the tests, diagnostics have changed, etc. In particular: - a few tests had trivial expectations changes such as basic diagnostics changes for the migrate-mode and full NLLs - others were recursion and lengths limits which emits a file, and under the polonius compare-mode, the folder has a different name - a few tests were ignored in the NLL compare-mode for reasons that obviously also apply to Polonius - some diagnostics were unified so that older expectations no longer made sense: the NLL and Polonius outputs were identical. - in a few cases Polonius gets a chance to emit more errors than NLLs A few tests in the compare-mode still are super slow and trigger the 60s warning, or OOM rustc during fact generation, and I've detailed these [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/186049-t-compiler.2Fwg-polonius/topic/Challenges.20for.20move.2Finit.2C.20liveness.2C.20and.20.60Location.3A.3AAll.60): - `src/test/ui/numbers-arithmetic/saturating-float-casts.rs` -> OOM during rustc fact generation - `src/test/ui/numbers-arithmetic/num-wrapping.rs` - `src/test/ui/issues/issue-72933-match-stack-overflow.rs` - `src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs` - `src/test/ui/repr/repr-no-niche.rs` In addition, 2 tests don't currently pass and I didn't want to bless them now: they deal with HRTBs and miss errors that NLLs emit. We're currently trying to see if we need chalk to deal with HRTB errors (as we thought we would have to) but during the recent sprint, we discovered that we may be able to detect some of these errors in a way that resembles subset errors: - `ui/hrtb/hrtb-just-for-static.rs` -> 3 errors in NLL, 2 in polonius: a missing error about HRTB + needing to outlive 'static - `ui/issues/issue-26217.rs` -> missing HRTB that makes the test compile instead of emitting an error We'll keep talking about this at the next sprint as well. cc `@rust-lang/wg-polonius` r? `@nikomatsakis`
2021-08-18Properly generate multiple candidates for trait upcasting coercion.Charles Lew-96/+12
2021-08-16Use note to point at bound introducing requirementEsteban Küber-170/+267
2021-08-12Rollup merge of #87885 - m-ou-se:edition-guide-links, r=rylevGuillaume Gomez-1/+1
Link to edition guide instead of issues for 2021 lints. This changes the 2021 lints to not link to github issues, but to the edition guide instead. Fixes #86996
2021-08-12Use smaller spans for some structured suggestionsEsteban Kuber-1/+1
Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts * E0212
2021-08-11Modify structured suggestion outputEsteban Küber-59/+68
* On suggestions that include deletions, use a diff inspired output format * When suggesting addition, use `+` as underline * Color highlight modified span
2021-08-09Link to edition guide instead of issues for 2021 lints.Mara Bos-1/+1
2021-08-04Remove trailing whitespace from error messagesFabian Wolff-20/+20
2021-08-03Auto merge of #86400 - FabianWolff:issue-85735, r=estebankbors-0/+29
Remove invalid suggestion involving `Fn` trait bound This pull request closes #85735. The actual issue is a duplicate of #21974, but #85735 contains a further problem, which is an invalid suggestion if `Fn`/`FnMut`/`FnOnce` trait bounds are involved: The suggestion code checks whether the trait bound ends with `>` to determine whether it has any generic arguments, but the `Fn*` traits have a special syntax for generic arguments that doesn't involve angle brackets. The example given in #85735: ```rust trait Foo {} impl<'a, 'b, T> Foo for T where T: FnMut(&'a ()), T: FnMut(&'b ()), { } ``` currently produces: ``` error[E0283]: type annotations needed --> src/lib.rs:4:8 | 4 | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` | = note: cannot satisfy `T: FnMut<(&'a (),)>` help: consider specifying the type arguments in the function call | 4 | T: FnMut(&'a ())::<Self, Args>, | ^^^^^^^^^^^^^^ error: aborting due to previous error ``` which is incorrect, because there is no function call, and applying the suggestion would lead to a parse error. With my changes, I get: ``` error[E0283]: type annotations needed --> test.rs:4:8 | 4 | T: FnMut(&'a ()), | ^^^^^^^^^^^^^ cannot infer type for type parameter `T` | ::: [...]/library/core/src/ops/function.rs:147:1 | 147 | pub trait FnMut<Args>: FnOnce<Args> { | ----------------------------------- required by this bound in `FnMut` | = note: cannot satisfy `T: FnMut<(&'a (),)>` error: aborting due to previous error ``` i.e. I have added a check to prevent the invalid suggestion from being issued for `Fn*` bounds, while the underlying issue #21974 remains for now.
2021-08-03Remove invalid suggestion involving Fn trait boundFabian Wolff-0/+29
2021-08-03bless trait upcasting tests under poloniusRémy Rakic-0/+55
The diagnostics are different from the NLL ones but the same errors are emitted.
2021-08-03Various adjustments to historic tests and documents.Charles Lew-192/+327
2021-08-03Added tests.Alexander Regueiro-0/+764
2021-08-03Implement pointer casting.Charles Lew-0/+49
2021-07-31Auto merge of #86264 - crlf0710:trait_upcasting_part1, r=nikomatsakisbors-0/+391
Trait upcasting coercion (part1) This revives the first part of earlier PR #60900 . It's not very clear to me which parts of that pr was design decisions, so i decide to cut it into pieces and land them incrementally. This allows more eyes on the details. This is the first part, it adds feature gates, adds feature gates tests, and implemented the unsize conversion part. (I hope i have dealt with the `ExistentialTraitRef` values correctly...) The next part will be implementing the pointer casting.
2021-07-31Add more tests to cover more corner cases of type-checking.Charles Lew-0/+342
2021-07-31Implement trait upcasting coercion type-checking.Charles Lew-0/+49
2021-07-30Do not discard `?Sized` type params and suggest their removalEsteban Küber-0/+9
2021-07-27Make all tests use type_alias_impl_trait feature instead of minSantiago Pastorino-1/+1
2021-07-22Add comment and more tests.Charles Lew-0/+384
2021-07-20Switch to store `Instance` directly within `VtblEntry`, fix `TraitVPtr` ↵Charles Lew-80/+48
representation.
2021-07-20Add internal attribute and tests.Charles Lew-0/+170