about summary refs log tree commit diff
path: root/src/test/ui/coherence
AgeCommit message (Collapse)AuthorLines
2022-02-14Add failing test that should passSantiago Pastorino-0/+23
2022-02-14Properly check regions on negative overlap checkSantiago Pastorino-2/+19
2022-01-31Move overlap_mode into trait level attribute + feature flagSantiago Pastorino-12/+9
2022-01-21Implement stable with negative coherence modeSantiago Pastorino-0/+26
2021-12-10manually implement `Hash` for `DefId`Andre Bogus-11/+11
This also reorders the fields to reduce the assembly operations for hashing and changes two UI tests that depended on the former ordering because of hashmap iteration order.
2021-11-20Point at source of trait bound obligations in more placesEsteban Kuber-5/+0
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-10no overlap errors after failing the orphan checklcnr-153/+108
2021-10-24Point at overlapping impls when type annotations are neededEsteban Kuber-1/+8
2021-10-22Hide negative coherence checks under negative_impls feature flagSantiago Pastorino-0/+32
2021-10-22Be sure that we do not allow too muchSantiago Pastorino-0/+36
2021-10-22Add rustc_strict_coherence attribute and use it to check overlapSantiago Pastorino-0/+49
2021-10-20Test that if we promise to not impl what would overlap it doesn't actually ↵Santiago Pastorino-0/+19
overlap
2021-09-20Don't use projection cache or candidate cache in intercrate modeAaron Hill-0/+1
Fixes #88969 It appears that *just* disabling the evaluation cache (in #88994) leads to other issues involving intercrate mode caching. I suspect that since we now always end up performing the full evaluation in intercrate mode, we end up 'polluting' the candidate and projection caches with results that depend on being in intercrate mode in some way. Previously, we might have hit a cached evaluation (stored during non-intercrate mode), and skipped doing this extra work in intercrate mode. The whole situation with intercrate mode caching is turning into a mess. Ideally, we would remove intercrate mode entirely - however, this might require waiting on Chalk.
2021-09-16Auto merge of #88719 - estebank:point-at-arg-for-obligation, r=nagisabors-1/+3
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-16Point at call span that introduced obligation for the argEsteban Kuber-1/+3
2021-09-15Move object safety suggestions to the end of the errorEsteban Kuber-1/+1
2021-09-02Bless tests.Camille GILLOT-4/+8
2021-09-01Rollup merge of #88525 - notriddle:notriddle/coherence-dyn-auto-trait, ↵Mara Bos-0/+29
r=petrochenkov fix(rustc_typeck): produce better errors for dyn auto trait Fixes #85026
2021-08-31Change wording to less jaron-y "non-auto trait"Michael Howell-2/+2
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2021-08-30fix(rustc_typeck): produce better errors for dyn auto traitMichael Howell-0/+29
Fixes #85026
2021-08-21Improve errors for recursive type aliasesNoah Lev-1/+1
2021-08-16Use note to point at bound introducing requirementEsteban Küber-3/+6
2021-07-18When pretty printing, name placeholders as bound regionsjackh726-2/+2
2021-04-06Remove trailing `:` from E0119 messageEsteban Küber-36/+36
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-3/+3
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-10-25Merge remote-tracking branch 'upstream/master' into box-allocTim Diekmann-28/+32
2020-10-20review commentsEsteban Küber-1/+1
2020-10-20Tweak "object unsafe" errorsEsteban Küber-4/+7
Fix #77598.
2020-10-18Rollup merge of #78043 - willcrozi:e0210-error-note-fix, r=lcnrYuki Okushi-23/+23
Fix grammar in note for orphan-rule error [E0210] Fixes the grammar in the error note for [E0210] from: _"= note: implementing a foreign trait is only possible if at least one of the types for which **is it** implemented is local"_ to: _"= note: implementing a foreign trait is only possible if at least one of the types for which **it is** implemented is local"_ The content of this commit is the result of running the following command at the repository root: `find . \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i 's/which is it implemented/which it is implemented/g'`
2020-10-17Fix grammar in note for orphan-rule error [E0210]Will Crozier-23/+23
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+1
2020-10-07Support custom allocators in `Box`Tim Diekmann-6/+11
Remove `Box::leak_with_alloc` Add leak-test for box with allocator Rename `AllocErr` to `AllocError` in leak-test Add `Box::alloc` and adjust examples to use the new API
2020-09-09Rollup merge of #75984 - kornelski:typeormodule, r=matthewjasperTyler Mandry-4/+4
Improve unresolved use error message "use of undeclared type or module `foo`" doesn't mention that it could be a crate. This error can happen when users forget to add a dependency to `Cargo.toml`, so I think it's important to mention that it could be a missing crate. I've used a heuristic based on Rust's naming conventions. It complains about an unknown type if the ident starts with an upper-case letter, and crate or module otherwise. It seems to work very well. The expanded error help covers both an unknown type and a missing crate case.
2020-09-03specialization_graph: avoid trimmed paths for OverlapErrorDan Aloni-18/+18
2020-09-02pretty: trim paths of unique symbolsDan Aloni-55/+55
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-09-01Clarify message about unresolved useKornel-4/+4
2020-08-22Use smaller def span for functionsAaron Hill-12/+12
Currently, the def span of a funtion encompasses the entire function signature and body. However, this is usually unnecessarily verbose - when we are pointing at an entire function in a diagnostic, we almost always want to point at the signature. The actual contents of the body tends to be irrelevant to the diagnostic we are emitting, and just takes up additional screen space. This commit changes the `def_span` of all function items (freestanding functions, `impl`-block methods, and `trait`-block methods) to be the span of the signature. For example, the function ```rust pub fn foo<T>(val: T) -> T { val } ``` now has a `def_span` corresponding to `pub fn foo<T>(val: T) -> T` (everything before the opening curly brace). Trait methods without a body have a `def_span` which includes the trailing semicolon. For example: ```rust trait Foo { fn bar(); }``` the function definition `Foo::bar` has a `def_span` of `fn bar();` This makes our diagnostic output much shorter, and emphasizes information that is relevant to whatever diagnostic we are reporting. We continue to use the full span (including the body) in a few of places: * MIR building uses the full span when building source scopes. * 'Outlives suggestions' use the full span to sort the diagnostics being emitted. * The `#[rustc_on_unimplemented(enclosing_scope="in this scope")]` attribute points the entire scope body. * The 'unconditional recursion' lint uses the full span to show additional context for the recursive call. All of these cases work only with local items, so we don't need to add anything extra to crate metadata.
2020-07-25Use the proper span when WF-checking an impl self typeAaron Hill-2/+2
2020-06-22WIP bless test and compare-mode=nllNiko Matsakis-3/+3
2020-06-22add new coherence tests and update the documentationNiko Matsakis-4/+53
2020-06-22add new tests from MCP and the tracking issueNiko Matsakis-0/+184
2020-06-21Auto merge of #72936 - jackh726:chalk-more, r=nikomatsakisbors-22/+3
Upgrade Chalk Things done in this PR: - Upgrade Chalk to `0.11.0` - Added compare-mode=chalk - Bump rustc-hash in `librustc_data_structures` to `1.1.0` to match Chalk - Removed `RustDefId` since the builtin type support is there - Add a few more `FIXME(chalk)`s for problem spots I hit when running all tests with chalk - Added some more implementation code for some newer builtin Chalk types (e.g. `FnDef`, `Array`) - Lower `RegionOutlives` and `ObjectSafe` predicates - Lower `Dyn` without the region - Handle `Int`/`Float` `CanonicalVarKind`s - Uncomment some Chalk tests that actually work now - Remove the revisions in `src/test/ui/coherence/coherence-subtyping.rs` since they aren't doing anything different r? @nikomatsakis
2020-06-19Add compare-mode=chalk and add a little bit more implementations and fixmesJack Huey-22/+3
2020-06-16bless allRalf Jung-3/+13
2020-04-23fix error code for E0751YI-2/+2
2020-04-11rustc: Add a warning count upon completionRoccoDev-0/+4
2020-04-08Small tweaks to required bound spanEsteban Küber-1/+1
2020-04-06traits/coherence: stop using `Ty::walk_shallow`.Eduard-Mihai Burtescu-2/+2
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-22/+24
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-03-26make a custom error for overlap with negative implsNiko Matsakis-15/+14