about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2024-01-12Rollup merge of #119819 - chenyukang:yukang-fix-118183-lint, r=davidtwcoGuillaume Gomez-5/+25
Check rust lints when an unknown lint is detected Fixes #118183
2024-01-12check rust lints when an unknown lint is detectedyukang-5/+25
2024-01-11Merge commit '26ac6aab023393c94edf42f38f6ad31196009643'Philipp Krones-435/+3413
2024-01-05Rollup merge of #119151 - Jules-Bertholet:no-foreign-doc-hidden-suggest, ↵Matthias Krüger-2/+0
r=davidtwco Hide foreign `#[doc(hidden)]` paths in import suggestions Stops the compiler from suggesting to import foreign `#[doc(hidden)]` paths. ```@rustbot``` label A-suggestion-diagnostics
2024-01-05Rollup merge of #119148 - estebank:bare-traits, r=davidtwcoMichael Goulet-1/+1
Tweak suggestions for bare trait used as a type ``` error[E0782]: trait objects must include the `dyn` keyword --> $DIR/not-on-bare-trait-2021.rs:11:11 | LL | fn bar(x: Foo) -> Foo { | ^^^ | help: use a generic type parameter, constrained by the trait `Foo` | LL | fn bar<T: Foo>(x: T) -> Foo { | ++++++++ ~ help: you can also use `impl Foo`, but users won't be able to specify the type paramer when calling the `fn`, having to rely exclusively on type inference | LL | fn bar(x: impl Foo) -> Foo { | ++++ help: alternatively, use a trait object to accept any type that implements `Foo`, accessing its methods at runtime using dynamic dispatch | LL | fn bar(x: &dyn Foo) -> Foo { | ++++ error[E0782]: trait objects must include the `dyn` keyword --> $DIR/not-on-bare-trait-2021.rs:11:19 | LL | fn bar(x: Foo) -> Foo { | ^^^ | help: use `impl Foo` to return an opaque type, as long as you return a single underlying type | LL | fn bar(x: Foo) -> impl Foo { | ++++ help: alternatively, you can return an owned trait object | LL | fn bar(x: Foo) -> Box<dyn Foo> { | +++++++ + ``` Fix #119525: ``` error[E0038]: the trait `Ord` cannot be made into an object --> $DIR/bare-trait-dont-suggest-dyn.rs:3:33 | LL | fn ord_prefer_dot(s: String) -> Ord { | ^^^ `Ord` cannot be made into an object | note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety> --> $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait cannot be made into an object because it uses `Self` as a type parameter ::: $SRC_DIR/core/src/cmp.rs:LL:COL | = note: the trait cannot be made into an object because it uses `Self` as a type parameter help: consider using an opaque type instead | LL | fn ord_prefer_dot(s: String) -> impl Ord { | ++++ ```
2024-01-03Track `HirId` instead of `Span` in `ObligationCauseCode::SizedArgumentType`Esteban Küber-1/+1
This gets us more accurate suggestions.
2024-01-02Remove #[allow(unused_tuple_struct_fields)] from Clippy testsJake Goulding-70/+59
2023-12-28Merge commit 'ac4c2094a6030530661bee3876e0228ddfeb6b8b' into clippy-subtree-syncPhilipp Krones-161/+1536
2023-12-26Rollup merge of #119240 - compiler-errors:lang-item-more, r=petrochenkovMichael Goulet-0/+4
Make some non-diagnostic-affecting `QPath::LangItem` into regular `QPath`s The rest of 'em affect diagnostics, so leave them alone... for now. cc #115178
2023-12-26Make some non-diagnostic-affecting QPath::LangItem into regular qpathsMichael Goulet-0/+4
2023-12-25Fix clippy's usage of Body's coroutine_kindMichael Goulet-4/+18
Also fixes a bug where we weren't peeling blocks from async bodies
2023-12-20Hide foreign `#[doc(hidden)]` paths in import suggestionsJules Bertholet-2/+0
2023-12-16Merge commit 'a859e5cc1ce100df22346a1005da30532d04de59' into clippyupPhilipp Krones-235/+2028
2023-12-06Drop clippy::vtable_address_comparisonsUrgau-177/+67
2023-12-02Auto merge of #118507 - flip1995:clippy-subtree-sync, r=matthiaskrgrbors-267/+1947
Clippy subtree sync r? `@Manishearth`
2023-12-02Auto merge of #118470 - nnethercote:cleanup-error-handlers, r=compiler-errorsbors-4/+4
Cleanup error handlers Mostly by making function naming more consistent. More to do after this, but this is enough for one PR. r? compiler-errors
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-4/+4
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-12-01Merge commit 'f0cdee4a3f094416189261481eae374b76792af1' into clippy-subtree-syncPhilipp Krones-267/+1947
2023-12-01Auto merge of #117472 - jmillikin:stable-c-str-literals, r=Nilstriebbors-26/+22
Stabilize C string literals RFC: https://rust-lang.github.io/rfcs/3348-c-str-literal.html Tracking issue: https://github.com/rust-lang/rust/issues/105723 Documentation PR (reference manual): https://github.com/rust-lang/reference/pull/1423 # Stabilization report Stabilizes C string and raw C string literals (`c"..."` and `cr#"..."#`), which are expressions of type [`&CStr`](https://doc.rust-lang.org/stable/core/ffi/struct.CStr.html). Both new literals require Rust edition 2021 or later. ```rust const HELLO: &core::ffi::CStr = c"Hello, world!"; ``` C strings may contain any byte other than `NUL` (`b'\x00'`), and their in-memory representation is guaranteed to end with `NUL`. ## Implementation Originally implemented by PR https://github.com/rust-lang/rust/pull/108801, which was reverted due to unintentional changes to lexer behavior in Rust editions < 2021. The current implementation landed in PR https://github.com/rust-lang/rust/pull/113476, which restricts C string literals to Rust edition >= 2021. ## Resolutions to open questions from the RFC * Adding C character literals (`c'.'`) of type `c_char` is not part of this feature. * Support for `c"..."` literals does not prevent `c'.'` literals from being added in the future. * C string literals should not be blocked on making `&CStr` a thin pointer. * It's possible to declare constant expressions of type `&'static CStr` in stable Rust (as of v1.59), so C string literals are not adding additional coupling on the internal representation of `CStr`. * The unstable `concat_bytes!` macro should not accept `c"..."` literals. * C strings have two equally valid `&[u8]` representations (with or without terminal `NUL`), so allowing them to be used in `concat_bytes!` would be ambiguous. * Adding a type to represent C strings containing valid UTF-8 is not part of this feature. * Support for a hypothetical `&Utf8CStr` may be explored in the future, should such a type be added to Rust.
2023-11-24Manual find replace updatesNilstrieb-4/+4
2023-11-24Bless clippy testsNilstrieb-117/+117
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-17Move `lint_store` from `GlobalCtxt` to `Session`.Nicholas Nethercote-6/+6
This was made possible by the removal of plugin support, which simplified lint store creation. This simplifies the places in rustc and rustdoc that call `describe_lints`, which are early on. The lint store is now built before those places, so they don't have to create their own lint store for temporary use, they can just use the main one.
2023-11-16Merge commit 'edb720b199083f4107b858a8761648065bf38d86' into clippyupPhilipp Krones-430/+1016
2023-11-04fix clippy author and failing testDinu Blanovschi-2/+2
2023-11-04Warn when lint level is set on a match armNadrieril-1/+1
2023-11-02Merge commit '09ac14c901abc43bd0d617ae4a44e8a4fed98d9c' into clippyupPhilipp Krones-540/+1199
2023-11-01Stabilize C string literalsJohn Millikin-26/+22
2023-10-25Work around the fact that `check_mod_type_wf` may spuriously return ↵Oli Scherer-2/+12
`ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
2023-10-24Auto merge of #116773 - dtolnay:validatestable, r=compiler-errorsbors-2/+2
Validate `feature` and `since` values inside `#[stable(…)]` Previously the string passed to `#[unstable(feature = "...")]` would be validated as an identifier, but not `#[stable(feature = "...")]`. In the standard library there were `stable` attributes containing the empty string, and kebab-case string, neither of which should be allowed. Pre-existing validation of `unstable`: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![unstable(feature = "kebab-case", issue = "none")] #[unstable(feature = "kebab-case", issue = "none")] pub struct Struct; ``` ```console error[E0546]: 'feature' is not an identifier --> src/lib.rs:5:1 | 5 | #![unstable(feature = "kebab-case", issue = "none")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` For an `unstable` attribute, the need for an identifier is obvious because the downstream code needs to write a `#![feature(...)]` attribute containing that identifier. `#![feature(kebab-case)]` is not valid syntax and `#![feature(kebab_case)]` would not work if that is not the name of the feature. Having a valid identifier even in `stable` is less essential but still useful because it allows for informative diagnostic about the stabilization of a feature. Compare: ```rust // src/lib.rs #![allow(internal_features)] #![feature(staged_api)] #![stable(feature = "kebab-case", since = "1.0.0")] #[stable(feature = "kebab-case", since = "1.0.0")] pub struct Struct; ``` ```rust // src/main.rs #![feature(kebab_case)] use repro::Struct; fn main() {} ``` ```console error[E0635]: unknown feature `kebab_case` --> src/main.rs:3:12 | 3 | #![feature(kebab_case)] | ^^^^^^^^^^ ``` vs the situation if we correctly use `feature = "snake_case"` and `#![feature(snake_case)]`, as enforced by this PR: ```console warning: the feature `snake_case` has been stable since 1.0.0 and no longer requires an attribute to enable --> src/main.rs:3:12 | 3 | #![feature(snake_case)] | ^^^^^^^^^^ | = note: `#[warn(stable_features)]` on by default ```
2023-10-23Auto merge of #116033 - bvanjoi:fix-116032, r=petrochenkovbors-0/+2
report `unused_import` for empty reexports even it is pub Fixes #116032 An easy fix. r? `@petrochenkov` (Discovered this issue while reviewing #115993.)
2023-10-23Fix stable feature names in testsDavid Tolnay-2/+2
2023-10-23Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillotbors-12/+2
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-22use visibility to check unused imports and delete some stmtsbohan-0/+2
2023-10-21Merge commit '2b030eb03d9e5837440b1ee0b98c50b97c0c5889' into clippyupPhilipp Krones-335/+1352
2023-10-20s/generator/coroutine/Oli Scherer-3/+3
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-12/+2
2023-10-18Tweak wording of type errors involving type paramsEsteban Küber-1/+1
Fix #78206.
2023-10-13Stabilize AFIT and RPITITMichael Goulet-24/+21
2023-10-09Extend impl's def_span to include where clausesMichael Goulet-1/+1
2023-10-06Merge commit 'b105fb4c39bc1a010807a6c076193cef8d93c109' into clippyupPhilipp Krones-473/+1633
2023-10-05Add more diagnostic items for clippyJason Newcomb-4/+4
2023-10-04Point to closure return instead of output if defaultedMichael Goulet-2/+2
2023-10-04Fix clippyMichael Goulet-12/+12
2023-10-03Point to full async fn for futureMichael Goulet-19/+22
2023-10-01Auto merge of #115670 - Zoxc:outline-panic-macro-1, r=Mark-Simulacrumbors-16/+20
Partially outline code inside the panic! macro This outlines code inside the panic! macro in some cases. This is split out from https://github.com/rust-lang/rust/pull/115562 to exclude changes to rustc.
2023-09-25Merge commit '7671c283a50b5d1168841f3014b14000f01dd204' into clippyupPhilipp Krones-1417/+2587
2023-09-23Bless clippy.Camille GILLOT-166/+87
2023-09-21adjust how closure/generator types and rvalues are printedRalf Jung-3/+3
2023-09-18Auto merge of #115748 - RalfJung:post-mono, r=oli-obkbors-2/+2
move required_consts check to general post-mono-check function This factors some code that is common between the interpreter and the codegen backends into shared helper functions. Also as a side-effect the interpreter now uses the same `eval` functions as everyone else to get the evaluated MIR constants. Also this is in preparation for another post-mono check that will be needed for (the current hackfix for) https://github.com/rust-lang/rust/issues/115709: ensuring that all locals are dynamically sized. I didn't expect this to change diagnostics, but it's just cycle errors that change. r? `@oli-obk`
2023-09-17Rollup merge of #115477 - kellerkindt:stabilized_int_impl, r=dtolnayDylan DPC-1/+1
Stabilize the `Saturating` type Closes #87920 Closes #92354 Stabilization report https://github.com/rust-lang/rust/issues/87920#issuecomment-1652346124 FCP https://github.com/rust-lang/rust/issues/87920#issuecomment-1676438885