about summary refs log tree commit diff
path: root/src/test/ui/dropck
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-1663/+0
2023-01-04Move testsCaio-0/+30
2023-01-01reduce spans for `unsafe impl` errorsLukas Markeffsky-14/+4
2022-12-17docs: add long error explanation for error E0320Ezra Shaw-0/+3
2022-11-05Move some tests to more reasonable directoriesCaio-0/+29
2022-10-28Rollup merge of #103283 - nbarrios1337:unsafe-impl-suggestions, r=cjgillotMatthias Krüger-0/+12
Add suggestions for unsafe impl error codes Adds suggestions for users to add `unsafe` to trait impls that should be `unsafe`, and remove `unsafe` from trait impls that do not require `unsafe` With the folllowing code: ```rust struct Foo {} struct Bar {} trait Safe {} unsafe trait Unsafe {} impl Safe for Foo {} // ok impl Unsafe for Foo {} // E0200 unsafe impl Safe for Bar {} // E0199 unsafe impl Unsafe for Bar {} // ok // omitted empty main fn ``` The current rustc output is: ``` error[E0199]: implementing the trait `Safe` is not unsafe --> e0200.rs:13:1 | 13 | unsafe impl Safe for Bar {} // E0199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration --> e0200.rs:11:1 | 11 | impl Unsafe for Foo {} // E0200 | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors Some errors have detailed explanations: E0199, E0200. For more information about an error, try `rustc --explain E0199`. ``` With this PR, the future rustc output would be: ``` error[E0199]: implementing the trait `Safe` is not unsafe --> ../../temp/e0200.rs:13:1 | 13 | unsafe impl Safe for Bar {} // E0199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: remove `unsafe` from this trait implementation | 13 - unsafe impl Safe for Bar {} // E0199 13 + impl Safe for Bar {} // E0199 | error[E0200]: the trait `Unsafe` requires an `unsafe impl` declaration --> ../../temp/e0200.rs:11:1 | 11 | impl Unsafe for Foo {} // E0200 | ^^^^^^^^^^^^^^^^^^^^^^ | = note: the trait `Unsafe` enforces invariants that the compiler can't check. Review the trait documentation and make sure this implementation upholds those invariants before adding the `unsafe` keyword help: add `unsafe` to this trait implementation | 11 | unsafe impl Unsafe for Foo {} // E0200 | ++++++ error: aborting due to 2 previous errors Some errors have detailed explanations: E0199, E0200. For more information about an error, try `rustc --explain E0199`. ``` ``@rustbot`` label +T-compiler +A-diagnostics +A-suggestion-diagnostics
2022-10-20Add fix suggestions for E0199, E0200, and E0569Nicolas Barrios-0/+12
2022-10-20Move some tests for more reasonable placesCaio-0/+77
2022-08-16Do not allow Drop impl on foreign fundamental typesMichael Goulet-6/+5
2022-08-03Warn about dead tuple struct fieldsFabian Wolff-1/+1
2022-07-19feat: omit suffixes in const generics (e.g. `1_i32`)Artur Sinila-1/+1
Closes #99255
2022-07-04fully move dropck to mirlcnr-31/+4
2022-07-01Shorten def_span for more items.Camille GILLOT-33/+25
2022-05-20update error messagelcnr-7/+7
2022-05-20rewrite `ensure_drop_params_and_item_params_correspond`lcnr-40/+30
2022-02-17Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"Oli Scherer-2/+3
This reverts commit 3cfa4def7c87d571bd46d92fed608edf8fad236e, reversing changes made to 5d8767cb229b097fedb1dd4bd9420d463c37774f.
2022-02-12Bless nll tests.Camille GILLOT-3/+2
2021-11-18Move some tests to more reasonable directoriesCaio-0/+39
2021-11-12oops...Ellen-0/+30
2021-11-10no overlap errors after failing the orphan checklcnr-6/+6
2021-11-06Move some tests to more reasonable directoriesCaio-0/+46
2021-10-13Remove textual span from diagnostic stringOli Scherer-3/+3
2021-09-25Use larger span for adjustments on method callsAaron Hill-2/+2
Currently, we use a relatively 'small' span for THIR expressions generated by an 'adjustment' (e.g. an autoderef, autoborrow, unsizing). As a result, if a borrow generated by an adustment ends up causing a borrowcheck error, for example: ```rust let mut my_var = String::new(); let my_ref = &my_var my_var.push('a'); my_ref; ``` then the span for the mutable borrow may end up referring to only the base expression (e.g. `my_var`), rather than the method call which triggered the mutable borrow (e.g. `my_var.push('a')`) Due to a quirk of the MIR borrowck implementation, this doesn't always get exposed in migration mode, but it does in many cases. This commit makes THIR building consistently use 'larger' spans for adjustment expressions The intent of this change it make it clearer to users when it's the specific way in which a variable is used (for example, in a method call) that produdes a borrowcheck error. For example, an error message claiming that a 'mutable borrow occurs here' might be confusing if it just points at a usage of a variable (e.g. `my_var`), when no `&mut` is in sight. Pointing at the entire expression should help to emphasize that the method call itself is responsible for the mutable borrow. In several cases, this makes the `#![feature(nll)]` diagnostic output match up exactly with the default (migration mode) output. As a result, several `.nll.stderr` files end up getting removed entirely.
2021-01-16Move some tests to more reasonable directories - 2Caio-0/+103
Address comments Update limits
2020-12-29Remove `compile-fail` test suiteVadim Petrochenkov-1/+1
2020-12-26update testsBastian Kauschke-33/+31
2020-11-12check `Drop` specialization of const paramsBastian Kauschke-28/+61
2020-11-12move dropck tests from ui -> ui/dropckBastian Kauschke-0/+255
2020-10-16stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union'Ralf Jung-3/+1
2020-09-02pretty: trim paths of unique symbolsDan Aloni-6/+6
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-05-28standardize limit comparisons with `Limit` typeDavid Wood-7/+7
This commit introduces a `Limit` type which is used to ensure that all comparisons against limits within the compiler are consistent (which can result in ICEs if they aren't). Signed-off-by: David Wood <david@davidtw.co>
2020-01-03clarify that `Drop` can be implemented for enums and unions tooAndy Russell-5/+16
2019-12-05Add regression testsTommaso Bianchi-0/+88
2019-10-28Talk about specific types and remove lifetimes from outputEsteban Küber-1/+1
2019-10-28Use more targeted spans for orphan rule errorsEsteban Küber-2/+4
2019-10-28Call out the types that are non local on E0117Esteban Küber-1/+1
2019-10-02Calculate liveness for the same locals with and without -ZpoloniusMatthew Jasper-78/+0
This fixes some test differences and also avoids overflow in issue-38591.rs.
2019-09-17Update expectations of test ui/dropck/dropck_trait_cycle_checked.rs for Poloniuslqd-4/+8
as its output was changed by https://github.com/rust-lang/rust/commit/2ff337a8e286a5b472f71b3bbdc3d4b6b840870f#diff-bd3f80b956148a5d1567aa8698b8a507
2019-08-16rustc_mir: use the right type for associated const literals.Eduard-Mihai Burtescu-5/+5
2019-07-22Bless output of test dropck/dropck_trait_cycle_checked.rs for Poloniuslqd-0/+74
2019-07-07Raise the default recursion limit to 128Simonas Kazlauskas-7/+7
2019-05-29Update ui test suite to use dynmemoryruins-20/+20
2019-04-22update tests for migrate mode by defaultMatthew Jasper-567/+329
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-4/+1
2019-03-11Update NLL testsVadim Petrochenkov-10/+10
2019-03-11Update testsVadim Petrochenkov-15/+15
2019-01-08Improve the wordingYuki Okushi-1/+1
2018-12-25Remove licensesMark Rousskov-131/+31
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-1/+1
2018-11-05Use `// revisions` in the dropck-eyepatch tests instead of relying on ↵Felix S. Klock II-51/+60
compare-mode=nll. NLL has increased precision in its analysis of drop order, and we want the test annotations to deliberately reflect this by having fewer ERROR annotations for NLL than for AST-borrowck. The best way to get this effect is via `// revisions`. As a drive-by, also added uses of all the borrows just to make it clear that NLL isn't somehow sidestepping things by using shorter borrows than you might have otherwise expected. (Of course, the added uses do not make all that much difference since the relevant types all declare `impl Drop` and thus those drops have implicit uses anyway.)