about summary refs log tree commit diff
path: root/tests/ui/issues
AgeCommit message (Collapse)AuthorLines
2023-03-27Use the FnPtr trait to avoid implementing common traits via macrosOli Scherer-20/+0
2023-03-21evaluate: improve and fix recursion depth handlinglcnr-17/+17
2023-03-15error-msg: impl better suggestion for `E0532`Ezra Shaw-1/+1
2023-03-11Rollup merge of #104363 - WaffleLapkin:bonk_box_new, r=NilstriebMatthias Krüger-2/+0
Make `unused_allocation` lint against `Box::new` too Previously it only linted against `box` syntax, which likely won't ever be stabilized, which is pretty useless. Even now I'm not sure if it's a meaningful lint, but it's at least something :shrug: This means that code like the following will be linted against: ```rust Box::new([1, 2, 3]).len(); f(&Box::new(1)); // where f : &i32 -> () ``` The lint works by checking if a `Box::new` (or `box`) expression has an a borrow adjustment, meaning that the code that first stores the box in a variable won't be linted against: ```rust let boxed = Box::new([1, 2, 3]); // no lint boxed.len(); ```
2023-03-09Propagate expected return type instead of real return type in check_binopMichael Goulet-5/+32
2023-03-08may not => cannotMichael Goulet-2/+2
2023-03-06Bless the remaining ui testsMu42-1/+19
2023-03-03Remove some useless `#[allow()]`s in testsMaybe Waffle-2/+0
2023-02-25Rollup merge of #107675 - jsgf:link-directives, r=davidtwcoMichael Goulet-0/+10
Implement -Zlink-directives=yes/no `-Zlink-directives=no` will ignored `#[link]` directives while compiling a crate, so nothing is emitted into the crate's metadata. The assumption is that the build system already knows about the crate's native dependencies and can provide them at link time without these directives. This is another way to address issue # #70093, which is currently addressed by `-Zlink-native-libraries` (implemented in #70095). The latter is implemented at link time, which has the effect of ignoring `#[link]` in *every* crate. This makes it a very large hammer as it requires all native dependencies to be known to the build system to be at all usable, including those in sysroot libraries. I think this means its effectively unused, and definitely under-used. Being able to control this on a crate-by-crate basis should make it much easier to apply when needed. I'm not sure if we need both mechanisms, but we can decide that later. cc `@pcwalton` `@cramertj`
2023-02-24Rollup merge of #108401 - notriddle:notriddle/diagnostics-article, ↵Dylan DPC-10/+10
r=compiler-errors diagnostics: remove inconsistent English article "this" from E0107 Consider [`tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`][issue-102768.stderr], the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in [`tests/ui/lint/dead-code/issue-85255.stderr`][issue-85255.stderr]. They don't have articles, so it seems unnecessary to have one here. [issue-102768.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/const-generics/generic_const_exprs/issue-102768.stderr [issue-85255.stderr]: https://github.com/rust-lang/rust/blob/07c993eba8b76eae497e98433ae075b00f01be10/tests/ui/lint/dead-code/issue-85255.stderr
2023-02-24Rollup merge of #106923 - mejrs:fluent_err, r=davidtwcoDylan DPC-0/+41
Restore behavior when primary bundle is missing Fixes https://github.com/rust-lang/rust/issues/106755 by restoring some of the behavior prior to https://github.com/rust-lang/rust/pull/106427 Still, I have no idea how this debug assertion can even hit while using `en-US` as primary bundle. r? ```@davidtwco```
2023-02-23diagnostics: remove inconsistent English article "this" from E0107Michael Howell-10/+10
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`, the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have articles, so it seems unnecessary to have one here.
2023-02-23Rollup merge of #108063 - ↵Matthias Krüger-4/+4
compiler-errors:associated-type-bounds-in-bad-position, r=cjgillot Ban associated type bounds in bad positions We should not try to lower associated type bounds into TAITs in positions where `impl Trait` is not allowed (except for in `where` clauses, like `where T: Trait<Assoc: Bound>`). This is achieved by using the same `rustc_ast_lowering` machinery as impl-trait does to characterize positions as universal/existential/disallowed. Fixes #106077 Split out the first commit into #108066, since it's not really related.
2023-02-23Add stderrmejrs-0/+22
2023-02-23Test that choosing the default bundle does not icemejrs-0/+19
2023-02-22pluralize stuffMichael Goulet-4/+4
2023-02-22Implement -Zlink-directives=yes/noJeremy Fitzhardinge-0/+10
`-Zlink-directives=no` will ignored `#[link]` directives while compiling a crate, so nothing is emitted into the crate's metadata. The assumption is that the build system already knows about the crate's native dependencies and can provide them at link time without these directives. This is another way to address issue # #70093, which is currently addressed by `-Zlink-native-libraries` (implemented in #70095). The latter is implemented at link time, which has the effect of ignoring `#[link]` in *every* crate. This makes it a very large hammer as it requires all native dependencies to be known to the build system to be at all usable, including those in sysroot libraries. I think this means its effectively unused, and definitely under-used. Being able to control this on a crate-by-crate basis should make it much easier to apply when needed. I'm not sure if we need both mechanisms, but we can decide that later.
2023-02-22diagnostics: update test cases to refer to assoc fn with `self` as methodMichael Howell-28/+28
2023-02-22Rollup merge of #108239 - clubby789:overlapping-spans, r=compiler-errorsGuillaume Gomez-7/+3
Fix overlapping spans in removing extra arguments Fixes #108225 Each span is already extended to include the previous comma, so extending to the *next* comma is unecessary and causes an ICE with assertions on. ``@rustbot`` label +A-diagnostics
2023-02-22Rollup merge of #108230 - LittleFall:enhance/warning, r=estebankGuillaume Gomez-11/+2
Convert a hard-warning about named static lifetimes into lint "unused_lifetimes" Fixes https://github.com/rust-lang/rust/issues/96956. Some changes are ported from https://github.com/rust-lang/rust/pull/98079, thanks to jeremydavis519. r? `@estebank` `@petrochenkov` Any feedback is appreciated! ## Actions - [x] resolve conflicts - [x] fix build - [x] address review comments in last pr - [x] update tests
2023-02-22Convert a hard-warning about named static lifetimes into lint "unused_lifetimes"Zhi Qi-11/+2
Define the `named_static_lifetimes` lint This lint will replace the existing hard-warning. Replace the named static lifetime hard-warning with the new lint Update the UI tests for the `named_static_lifetimes` lint Remove the direct dependency on `rustc_lint_defs` fix build Signed-off-by: Zhi Qi <qizhi@pingcap.com> use "UNUSED_LIFETIMES" instead Signed-off-by: Zhi Qi <qizhi@pingcap.com> update 1 test and fix typo Signed-off-by: Zhi Qi <qizhi@pingcap.com> update tests Signed-off-by: Zhi Qi <qizhi@pingcap.com> fix tests: add extra blank line Signed-off-by: Zhi Qi <qizhi@pingcap.com>
2023-02-21Fix overlapping spans in removing extra argumentsclubby789-7/+3
2023-02-21Specify what 'this' actually isMichael Goulet-2/+2
2023-02-17Rollup merge of #108009 - c410-f3r:moar-tests, r=petrochenkovMatthias Krüger-630/+0
Move some tests r? `@petrochenkov`
2023-02-16Rollup merge of #106347 - estebank:removal-suggestion, r=TaKO8KiMatthias Krüger-16/+13
More accurate spans for arg removal suggestion Partially address #106304.
2023-02-16Move testsCaio-630/+0
2023-02-16Remove save-analysis.Nicholas Nethercote-7/+6
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-14Make removal suggestion not verboseEsteban Küber-18/+12
2023-02-14rebase and review commentsEsteban Küber-4/+4
2023-02-14More accurate spans for arg removal suggestionEsteban Küber-6/+9
2023-02-10Rollup merge of #107789 - jieyouxu:issue-107745, r=lcnrMatthias Krüger-4/+2
Avoid exposing type parameters and implementation details sourced from macro expansions Fixes #107745. ~~I would like to **request some guidance** for this issue, because I don't think this is a good fix (a band-aid at best).~~ ### The Problem The code ```rust fn main() { println!("{:?}", []); } ``` gets desugared into (`rustc +nightly --edition=2018 issue-107745.rs -Z unpretty=hir`): ```rust #[prelude_import] use std::prelude::rust_2018::*; #[macro_use] extern crate std; fn main() { { ::std::io::_print(<#[lang = "format_arguments"]>::new_v1(&["", "\n"], &[<#[lang = "format_argument"]>::new_debug(&[])])); }; } ``` so the diagnostics code tries to be as specific and helpful as possible, and I think it finds that `[]` needs a type parameter and so does `new_debug`. But since `[]` doesn't have an origin for the type parameter definition, it points to `new_debug` instead and leaks the internal implementation detail since all `[]` has is an type inference variable. ### ~~The Bad Fix~~ ~~This PR currently tries to fix the problem by bypassing the generated function `<#[lang = "format_argument"]>::new_debug` to avoid its generic parameter (I think it is auto-generated from the argument `[_; 0]`?) from getting collected as an `InsertableGenericArg`. This is problematic because it also prevents the help from getting displayed.~~ ~~I think this fix is not ideal and hard-codes the format generated code pattern, but I can't think of a better fix. I have tried asking on Zulip but no responses there yet.~~
2023-02-09Introduce `ReError`Esteban Küber-1/+0
CC #69314
2023-02-09Don't expose type parameters and implementation details from macro expansion许杰友 Jieyou Xu (Joe)-4/+2
2023-02-07Auto merge of #107671 - CastilloDel:master, r=estebankbors-0/+79
Fix suggestions rendering when the diff span is multiline Fixes #92741 cc `@estebank` I think, I finally fixed. I still want to go back and try to clean up the code a bit. I'm open to suggestions. Some examples of the new suggestions: ``` help: consider removing the borrow | 2 - & | ``` ``` help: consider removing the borrow | 2 - & 3 - mut | ``` ``` help: consider removing the borrow | 2 - & 3 - mut if true { true } else { false } 2 + if true { true } else { false } | ``` Should we add a test to ensure this behavior doesn't disappear in the future?
2023-02-06Add `run-rustfix` to tests/ui/issues/issue-92741.rsCastilloDel-15/+29
2023-02-06Add more test cases to tests/ui/issues/issue-92741.rsCastilloDel-1/+41
2023-02-05Add UI test for issue #92741CastilloDel-0/+25
2023-02-03Provide structured suggestion for binding needing type on E0594Esteban Küber-3/+7
Partially address #45405.
2023-01-30Mention fn coercion rules (needs to be expanded)Esteban Küber-3/+4
2023-01-30Tweak use of trimmed pathsEsteban Küber-2/+2
2023-01-30Do not mention lifetime names in force trimmed pathsEsteban Küber-6/+6
2023-01-30Don't show `for<'lt>` in force trimmed pathsEsteban Küber-4/+4
2023-01-30Modify primary span label for E0308Esteban Küber-81/+81
The previous output was unintuitive to users.
2023-01-25Rollup merge of #106944 - Nilstrieb:there-once-was-a-diagnostic, r=WaffleLapkinMatthias Krüger-0/+1
Suggest using a lock for `*Cell: Sync` bounds I mostly did this for `OnceCell<T>` at first because users will be confused to see that the `OnceCell<T>` in `std` isn't `Sync` but then extended it to `Cell<T>` and `RefCell<T>` as well.
2023-01-25Rollup merge of #106897 - estebank:issue-99430, r=davidtwcoMatthias Krüger-12/+13
Tweak E0597 CC #99430
2023-01-20Rollup merge of #104154 - ↵Michael Goulet-12/+10
timrobertsdev:deny-by-default-bindings_with_variant_name, r=scottmcm Change `bindings_with_variant_name` to deny-by-default Changed the `bindings_with_variant_name` lint to deny-by-default and fixed up the affected tests. Addresses #103442.
2023-01-20Change `bindings_with_variant_name` to deny-by-default--global-12/+10
2023-01-19Add `rustc_on_unimplemented` on `Sync` for cell typesNilstrieb-0/+1
Suggest using a lock instead.
2023-01-20add raw identifier for keyword in suggestionbohan-5/+36
2023-01-17Account for method call and indexing when looking for inner-most path in ↵Esteban Küber-0/+2
expression