summary refs log tree commit diff
path: root/src/test/ui/traits
AgeCommit message (Collapse)AuthorLines
2021-07-19Auto merge of #87225 - estebank:cleanup, r=oli-obkbors-29/+95
Various diagnostics clean ups/tweaks * Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-19Various diagnostics clean ups/tweaksEsteban Küber-29/+95
* Always point at macros, including derive macros * Point at non-local items that introduce a trait requirement * On private associated item, point at definition
2021-07-18Add `#![allow(dyn_drop)]` to test cases with `dyn Drop` in themMichael Howell-3/+4
These are all testing corner-cases in the compiler. Adding a new warning broke these test cases, but --cap-lints stops it from actually breaking things in production.
2021-06-29Return `EvaluatedToOk` when type in outlives predicate is globalAaron Hill-15/+15
A global type doesn't reference any local regions or types, so it's guaranteed to outlive any region.
2021-06-26Auto merge of #86586 - Smittyvb:https-everywhere, r=petrochenkovbors-1/+1
Use HTTPS links where possible While looking at #86583, I wondered how many other (insecure) HTTP links were in `rustc`. This changes most other `http` links to `https`. While most of the links are in comments or documentation, there are a few other HTTP links that are used by CI that are changed to HTTPS. Notes: - I didn't change any to or in licences - Some links don't support HTTPS :( - Some `http` links were dead, in those cases I upgraded them to their new places (all of which used HTTPS)
2021-06-25Address PR feedbackRyan Levick-2/+2
2021-06-25Change how edition based future compatibility warnings are handledRyan Levick-2/+2
2021-06-23Use HTTPS links where possibleSmitty-1/+1
2021-06-22Rollup merge of #86393 - yerke:add-test-for-issue-52025, r=JohnTitorYuki Okushi-0/+57
Add regression test for issue #52025 Closes #52025 Took the test from #52025
2021-06-22add regression test for issue #52025Yerkebulan Tulibergenov-0/+57
2021-06-15add regression test for issue #78632Yerkebulan Tulibergenov-0/+59
2021-05-26Lint against non-camelCase trait alias namesSmitty-0/+18
Type aliases are linted as such, so (unstable) trait aliases should be treated the same way.
2021-05-24Replace more "NULL" with "null"LeSeulArtichaut-1/+1
2021-05-20Check for raw pointer dereference in THIR unsafeckLeSeulArtichaut-1/+15
2021-05-15Revert to only using opportunistic_resolve_vars for existing placesJack Huey-2/+6
2021-05-14Store Option<Region> as value for RegionVidJack Huey-6/+2
2021-05-14Make the UnifyValue for RegionVid ()Jack Huey-1/+5
2021-05-13Auto merge of #85186 - nikomatsakis:issue-83538-polluted-cache, r=jackh726bors-0/+160
have on_completion record subcycles have on_completion record subcycles Rework `on_completion` method so that it removes all provisional cache entries that are "below" a completed node (while leaving those entries that are not below the node). This corrects an imprecise result that could in turn lead to an incremental compilation failure. Under the old scheme, if you had: * A depends on... * B depends on A * C depends on... * D depends on C * T: 'static then the provisional results for A, B, C, and D would all be entangled. Thus, if A was `EvaluatedToOkModuloRegions` (because of that final condition), then the result for C and D would also be demoted to "ok modulo regions". In reality, though, the result for C depends only on C and itself, and is not dependent on regions. If we happen to evaluate the cycle starting from C, we would never reach A, and hence the result would be "ok". Under the new scheme, the provisional results for C and D are moved to the permanent cache immediately and are not affected by the result of A. Fixes #83538 r? `@Aaron1011`
2021-05-13have on_completion record subcyclesNiko Matsakis-5/+61
Rework `on_completion` method so that it removes all provisional cache entries that are "below" a completed node (while leaving those entries that are not below the node). This corrects an imprecise result that could in turn lead to an incremental compilation failure. Under the old scheme, if you had: * A depends on... * B depends on A * C depends on... * D depends on C * T: 'static then the provisional results for A, B, C, and D would all be entangled. Thus, if A was `EvaluatedToOkModuloRegions` (because of that final condition), then the result for C and D would also be demoted to "ok modulo regions". In reality, though, the result for C depends only on C and itself, and is not dependent on regions. If we happen to evaluate the cycle starting from C, we would never reach A, and hence the result would be "ok". Under the new scheme, the provisional results for C and D are moved to the permanent cache immediately and are not affected by the result of A.
2021-05-13introduce a unit testing feature `rustc_evaluate_where_clauses`Niko Matsakis-0/+104
This attribute will cause us to invoke evaluate on every where clause of an invoked function and to generate an error with the result. Without this, it is very difficult to observe the effects of invoking the trait evaluator.
2021-05-13Auto merge of #85041 - mibac138:suggest-generics, r=estebankbors-2/+13
Suggest adding a type parameter for impls Add a new suggestion upon encountering an unknown type in a `impl` that suggests adding a new type parameter. This diagnostic suggests to add a new type parameter even though it may be a const parameter, however after adding the parameter and running rustc again a follow up error steers the user to change the type parameter to a const parameter. ```rust struct X<const C: ()>(); impl X<C> {} ``` suggests ``` error[E0412]: cannot find type `C` in this scope --> bar.rs:2:8 | 1 | struct X<const C: ()>(); | ------------------------ similarly named struct `X` defined here 2 | impl X<C> {} | ^ | help: a struct with a similar name exists | 2 | impl X<X> {} | ^ help: you might be missing a type parameter | 2 | impl<C> X<C> {} | ^^^ ``` After adding a type parameter the code now becomes ```rust struct X<const C: ()>(); impl<C> X<C> {} ``` and the error now fully steers the user towards the correct code ``` error[E0747]: type provided when a constant was expected --> bar.rs:2:11 | 2 | impl<C> X<C> {} | ^ | help: consider changing this type parameter to be a `const` generic | 2 | impl<const C: ()> X<C> {} | ^^^^^^^^^^^ ``` r? `@estebank` Somewhat related #84946
2021-05-12Show macro name in 'this error originates in macro' messageAaron Hill-2/+2
When there are multiple macros in use, it can be difficult to tell which one was responsible for producing an error.
2021-05-11improve diagnosts for GATsb-naber-15/+15
2021-05-05Suggest adding a type parameter for implsmibac138-2/+13
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.