about summary refs log tree commit diff
path: root/src/test/ui/traits
AgeCommit message (Collapse)AuthorLines
2021-05-04Auto merge of #83213 - rylev:update-lints-to-errors, r=nikomatsakisbors-2/+5
Update BARE_TRAIT_OBJECT and ELLIPSIS_INCLUSIVE_RANGE_PATTERNS to errors in Rust 2021 This addresses https://github.com/rust-lang/rust/pull/81244 by updating two lints to errors in the Rust 2021 edition. r? `@estebank`
2021-05-04Auto merge of #84472 - Aaron1011:conservative-paramenv-and, r=lcnrbors-0/+55
Be more conservative about discarding caller_bound in `ParamEnv::and`
2021-05-02Change 'NULL' to 'null'Brent Kerby-1/+1
2021-05-01Add regression testAaron Hill-0/+55
2021-04-25Rollup merge of #84499 - estebank:issue-84272, r=jackh726Dylan DPC-0/+3
Tweak trait not `use`d suggestion Fix #84272. Follow up to #83667.
2021-04-23Tweak suggestion outputEsteban Küber-0/+3
2021-04-23Auto merge of #83729 - JohnTitor:issue-43913, r=estebankbors-0/+40
Add a suggestion when using a type alias instead of trait alias Fixes #43913 r? `@estebank`
2021-04-19fix suggestion for unsized function parameterslcnr-2/+2
2021-04-18Auto merge of #84065 - c410-f3r:tests-tests-tests, r=petrochenkovbors-0/+87
Move some tests to more reasonable directories - 6 cc #73494 r? `@petrochenkov` git mv bad/bad-const-type.* static/ git mv bad/bad-crate-name.* extern git mv bad/bad-env-capture* fn/ git mv bad/bad-expr-lhs.* expr/ git mv bad/bad-expr-path* expr/ git mv bad/bad-extern-link-attrs.* extern/ git mv bad/bad-intrinsic-monomorphization.* intrinsics/ git mv bad/bad-lint-cap* lint/ git mv bad/bad-main.* fn git mv bad/bad-method-typaram-kind.* type/ git mv bad/bad-mid-path-type-params.* fn git mv bad/bad-module.* modules/ git mv bad/bad-sized.* type/ git mv bad/bad-type-env-capture.* fn
2021-04-17Move some tests to more reasonable directories - 6Caio-0/+87
2021-04-16Fix testsRyan Levick-2/+5
2021-04-11Auto merge of #83806 - JohnTitor:issue-51446, r=estebankbors-0/+34
Add a regression test for issue-51446 Closes #51446 r? `@estebank`
2021-04-08Rollup merge of #83689 - estebank:cool-bears-hot-tip, r=davidtwcoDylan DPC-11/+46
Add more info for common trait resolution and async/await errors * Suggest `Pin::new`/`Box::new`/`Arc::new`/`Box::pin` in more cases * Point at `impl` and type defs introducing requirements on E0277
2021-04-06Point at `impl` and type defs introducing requirements on E0277Esteban Küber-11/+46
2021-04-06Do not ICE when closure is involved in TAITEsteban Küber-0/+36
Fix #83613.
2021-04-06Remove trailing `:` from E0119 messageEsteban Küber-12/+12
2021-04-03Add a regression test for issue-51446Yuki Okushi-0/+34
2021-04-01Add a suggestion when using a type alias instead of trait aliasYuki Okushi-0/+40
2021-03-31give full path of constraint in suggest_constraining_type_paramhi-rustin-4/+4
revert file bless with nll mode
2021-03-29Suggest box/pin/arc ing receiver on method callsEsteban Küber-8/+0
2021-03-20Move some tests to more reasonable directories - 5Caio-0/+76
2021-03-18Fix use of bare trait objects everywhereVadim Petrochenkov-20/+20
2021-03-15More precise spans for HIR pathsVadim Petrochenkov-1/+1
2021-03-13Avoid sorting predicates by `DefId`Aaron Hill-1/+1
Fixes issue #82920 Even if an item does not change between compilation sessions, it may end up with a different `DefId`, since inserting/deleting an item affects the `DefId`s of all subsequent items. Therefore, we use a `DefPathHash` in the incremental compilation system, which is stable in the face of changes to unrelated items. In particular, the query system will consider the inputs to a query to be unchanged if any `DefId`s in the inputs have their `DefPathHash`es unchanged. Queries are pure functions, so the query result should be unchanged if the query inputs are unchanged. Unfortunately, it's possible to inadvertantly make a query result incorrectly change across compilations, by relying on the specific value of a `DefId`. Specifically, if the query result is a slice that gets sorted by `DefId`, the precise order will depend on how the `DefId`s got assigned in a particular compilation session. If some definitions end up with different `DefId`s (but the same `DefPathHash`es) in a subsequent compilation session, we will end up re-computing a *different* value for the query, even though the query system expects the result to unchanged due to the unchanged inputs. It turns out that we have been sorting the predicates computed during `astconv` by their `DefId`. These predicates make their way into the `super_predicates_that_define_assoc_type`, which ends up getting used to compute the vtables of trait objects. This, re-ordering these predicates between compilation sessions can lead to undefined behavior at runtime - the query system will re-use code built with a *differently ordered* vtable, resulting in the wrong method being invoked at runtime. This PR avoids sorting by `DefId` in `astconv`, fixing the miscompilation. However, it's possible that other instances of this issue exist - they could also be easily introduced in the future. To fully fix this issue, we should 1. Turn on `-Z incremental-verify-ich` by default. This will cause the compiler to ICE whenver an 'unchanged' query result changes between compilation sessions, instead of causing a miscompilation. 2. Remove the `Ord` impls for `CrateNum` and `DefId`. This will make it difficult to introduce ICEs in the first place.
2021-03-06Move some tests to more suitable subdirsYuki Okushi-0/+285
2021-02-17In some limited cases, suggest `where` bounds for non-type paramsEsteban Küber-0/+8
Partially address #81971.
2021-02-09Organize trait test filesBram van den Heuvel-285/+285
2021-02-06path trimming: ignore type aliasesDan Aloni-4/+4
2021-01-31Move some tests to more reasonable directoriesCaio-0/+244
2021-01-21Rollup merge of #80429 - JulianKnodt:ob_forest, r=Mark-SimulacrumYuki Okushi-0/+31
Add regression test for mutual recursion in obligation forest Add regression test for #75860 with a slightly smaller example. I was looking at what caused the issue and was surprised when it errors out on nightly, so I just added a regression test which should effectively close the issue, altho it would be nice to find the fix for reference. Also I found that 80066 is not fixed by whatever fixed 75860.
2021-01-16Move some tests to more reasonable directories - 2Caio-0/+134
Address comments Update limits
2021-01-10Rework diagnostics for wrong number of generic argsPatryk Wychowaniec-17/+53
2020-12-29Remove `compile-fail` test suiteVadim Petrochenkov-1/+1
2020-12-29Add regr. test for mutual recursionkadmin-0/+31
2020-12-17Revert change to evaluation orderMatthew Jasper-0/+39
This change breaks some code and doesn't appear to enable any new code.
2020-12-16Take into account negative impls in "trait item not found" suggestionsLeSeulArtichaut-0/+113
2020-12-01Add regression test for #79458ThePuzzlemaker-0/+25
2020-11-24Use the name "auto traits" everywhere in the compilerCamelid-4/+4
Goodbye, OIBIT!
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-1/+1
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-11-16improve error message for const ty param mismatchBastian Kauschke-2/+0
2020-10-27Add unsized_fn_params featureSantiago Pastorino-3/+3
2020-10-22Normalize when finding trait object candidatesMatthew Jasper-0/+37
2020-10-21Rollup merge of #78063 - camelid:improve-cannot-multiply-error, r=estebankYuki Okushi-2/+2
Improve wording of "cannot multiply" type error For example, if you had this code: fn foo(x: i32, y: f32) -> f32 { x * y } You would get this error: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` However, that's not usually how people describe multiplication. People usually describe multiplication like how the division error words it: error[E0277]: cannot divide `i32` by `f32` --> src/lib.rs:2:7 | 2 | x / y | ^ no implementation for `i32 / f32` | = help: the trait `Div<f32>` is not implemented for `i32` So that's what this change does. It changes this: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` To this: error[E0277]: cannot multiply `i32` by `f32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32`
2020-10-20review commentsEsteban Küber-9/+9
2020-10-20Tweak "object unsafe" errorsEsteban Küber-39/+66
Fix #77598.
2020-10-19don't assume trait ambiguity happens in `Self`SNCPlay42-0/+84
2020-10-17Improve wording of "cannot multiply" type errorCamelid-2/+2
For example, if you had this code: fn foo(x: i32, y: f32) -> f32 { x * y } You would get this error: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` However, that's not usually how people describe multiplication. People usually describe multiplication like how the division error words it: error[E0277]: cannot divide `i32` by `f32` --> src/lib.rs:2:7 | 2 | x / y | ^ no implementation for `i32 / f32` | = help: the trait `Div<f32>` is not implemented for `i32` So that's what this change does. It changes this: error[E0277]: cannot multiply `f32` to `i32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32` To this: error[E0277]: cannot multiply `i32` by `f32` --> src/lib.rs:2:7 | 2 | x * y | ^ no implementation for `i32 * f32` | = help: the trait `Mul<f32>` is not implemented for `i32`
2020-10-18Add test for issue-75983Yuki Okushi-0/+17
2020-10-18Add test for issue-70944Yuki Okushi-0/+23
2020-10-17Suggest minimal subset features in `incomplete_features` lintYuki Okushi-0/+5