summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2024-04-09allow the test bat files in tidyPietro Albini-0/+3
2024-03-26[stable-1.77] cargo backportWeihang Lo-0/+0
2024-03-14add a test for rust-lang/rust-clippy#12181y21-0/+24
2024-03-14[`unconditional_recursion`]: compare by types instead of `DefId`sy21-39/+82
2024-03-14fix: ICE when array index exceeds usizegranddaifuku-0/+6
2024-03-14Added msrv to threadlocal initializerQuinn Sinclair-2/+18
2024-03-14Fixed FP for `thread_local_initializer_can_be_made_const` for `os_local`Quinn Sinclair-21/+71
`os_local` impl of `thread_local` — regardless of whether it is const and unlike other implementations — includes an `fn __init(): EXPR`. Existing implementation of the lint checked for the presence of said function and whether the expr can be made const. Because for `os_local` we always have an `__init()`, it triggers for const implementations. The solution is to check whether the `__init()` function is already const. If it is `const`, there is nothing to do. Otherwise, we verify that we can make it const. Co-authored-by: Alejandra González <blyxyas@gmail.com>
2024-03-04Improve wording of static_mut_refObei Sideg-6/+6
Rename `static_mut_ref` lint to `static_mut_refs`. (cherry picked from commit 408eeae59d35cbcaab2cfb345d24373954e74fc5)
2024-02-28[beta-1.77.0] backport cargoWeihang Lo-0/+0
2024-02-16Update cargoWeihang Lo-0/+0
2024-02-12Auto merge of #120821 - ehuss:fix-c-str-lit-bootstrap, r=Mark-Simulacrumbors-1/+1
[Beta 1.77] Fix bootstrapping from 1.76 Due to the timing of the revert for stabilization of c_str_literal (https://github.com/rust-lang/rust/pull/119528 which reverted in 1.76) and trait_upcasting (https://github.com/rust-lang/rust/pull/120269 which reverted in 1.76), which happened after https://github.com/rust-lang/rust/pull/119211 (Bump stage0 to 1.76 beta), this resulted in some of the feature attributes not being restored which are needed to be able to bootstrap from 1.76. This restores those features. This also includes a stage0 bump to the just released stable. This is necessary because stage0 was currently pointing at an old beta which did not contain the reverts. Fixes #120810
2024-02-08[Beta 1.77] Fix bootstrapping from 1.76Eric Huss-1/+1
2024-02-07[beta-1.77.0] backport cargoWeihang Lo-0/+0
2024-02-01Auto merge of #120447 - lnicola:sync-from-ra, r=lnicolabors-2796/+1391
Subtree update of `rust-analyzer` r? ghost
2024-01-31Rollup merge of #120490 - nnethercote:Diagnostic-hashing, r=estebankNadrieril-2/+15
Don't hash lints differently to non-lints. `Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in #88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more. This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:79:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ ``` and with this change we also get this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:81:9 | LL | impl T2 for S {} | ``` I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar. r? `@estebank`
2024-01-31Auto merge of #120346 - petrochenkov:ownodes, r=oli-obkbors-5/+3
hir: Refactor getters for owner nodes
2024-01-31Don't hash lints differently to non-lints.Nicholas Nethercote-2/+15
`Diagnostic::keys`, which is used for hashing and equating diagnostics, has a surprising behaviour: it ignores children, but only for lints. This was added in #88493 to fix some duplicated diagnostics, but it doesn't seem necessary any more. This commit removes the special case and only four tests have changed output, with additional errors. And those additional errors aren't exact duplicates, they're just similar. For example, in src/tools/clippy/tests/ui/same_name_method.rs we currently have this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:79:9 | LL | impl T1 for S {} | ^^^^^^^^^^^^^^^^ ``` and with this change we also get this error: ``` error: method's name is the same as an existing method in a trait --> $DIR/same_name_method.rs:75:13 | LL | fn foo() {} | ^^^^^^^^^^^ | note: existing `foo` defined here --> $DIR/same_name_method.rs:81:9 | LL | impl T2 for S {} | ^^^^^^^^^^^^^^^^ ``` I think printing this second argument is reasonable, possibly even preferable to hiding it. And the other cases are similar.
2024-01-30Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercoteGuillaume Gomez-17/+1
Remove various `has_errors` or `err_count` uses follow up to https://github.com/rust-lang/rust/pull/119895 r? `@nnethercote` since you recently did something similar. There are so many more of these, but I wanted to get a PR out instead of growing the commit list indefinitely. The commits all work on their own and can be reviewed commit by commit.
2024-01-30hir: Remove `hir::Map::{owner,expect_owner}`Vadim Petrochenkov-2/+2
2024-01-30hir: Add non-optional `hir_owner_nodes` for real `OwnerId`sVadim Petrochenkov-3/+1
2024-01-30hir: Simplify `hir_owner_nodes` queryVadim Petrochenkov-1/+1
The query accept arbitrary DefIds, not just owner DefIds. The return can be an `Option` because if there are no nodes, then it doesn't matter whether it's due to NonOwner or Phantom. Also rename the query to `opt_hir_owner_nodes`.
2024-01-30Rollup merge of #120488 - nnethercote:diag-lifetimes, r=oli-obkGuillaume Gomez-1/+1
Diagnostic lifetimes cleanups Some diagnostic simplifications. r? `@oli-obk`
2024-01-30Rollup merge of #120439 - seqre-contrib:moving-ui-tests, r=nnethercoteGuillaume Gomez-2/+5
Move UI issue tests to subdirectories I've moved issue tests numbered 1920, 3668, 5997, 23302, 32122, 40510, 57741, 71676, and 76077 to relevant better-named subdirectories (tracking issue #73494). The issues were chosen by having the highest number of files per issue. I adjusted the `ISSUES_ENTRY_LIMIT` because `tidy` was shouting at me.
2024-01-30Remove the lifetime from `DiagnosticArgValue`.Nicholas Nethercote-1/+1
Because it's almost always static. This makes `impl IntoDiagnosticArg for DiagnosticArgValue` trivial, which is nice. There are a few diagnostics constructed in `compiler/rustc_mir_build/src/check_unsafety.rs` and `compiler/rustc_mir_transform/src/errors.rs` that now need symbols converted to `String` with `to_string` instead of `&str` with `as_str`, but that' no big deal, and worth it for the simplifications elsewhere.
2024-01-29Move multiple UI issue tests to subdirectoriesMarek 'seqre' Grzelak-2/+5
Issue tests numbered 1920, 3668, 5997, 23302, 32122, 40510, 57741, 71676, and 76077 were moved to relevant better-named subdirectories. ISSUES_ENTRY_LIMIT was adjusted to match new number of files and FIXME note was expanded.
2024-01-29Auto merge of #120165 - reitermarkus:nonzero-switch-alias-direction, r=dtolnaybors-42/+64
Switch `NonZero` alias direction. Step 4 mentioned in https://github.com/rust-lang/rust/pull/100428#pullrequestreview-1767139731. Depends on https://github.com/rust-lang/rust/pull/120160. r? `@dtolnay`
2024-01-29Auto merge of #120451 - RalfJung:miri, r=RalfJungbors-172/+235
Miri subtree update r? `@ghost`
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-21/+22
Error codes are integers, but `String` is used everywhere to represent them. Gross! This commit introduces `ErrCode`, an integral newtype for error codes, replacing `String`. It also introduces a constant for every error code, e.g. `E0123`, and removes the `error_code!` macro. The constants are imported wherever used with `use rustc_errors::codes::*`. With the old code, we have three different ways to specify an error code at a use point: ``` error_code!(E0123) // macro call struct_span_code_err!(dcx, span, E0123, "msg"); // bare ident arg to macro call \#[diag(name, code = "E0123")] // string struct Diag; ``` With the new code, they all use the `E0123` constant. ``` E0123 // constant struct_span_code_err!(dcx, span, E0123, "msg"); // constant \#[diag(name, code = E0123)] // constant struct Diag; ``` The commit also changes the structure of the error code definitions: - `rustc_error_codes` now just defines a higher-order macro listing the used error codes and nothing else. - Because that's now the only thing in the `rustc_error_codes` crate, I moved it into the `lib.rs` file and removed the `error_codes.rs` file. - `rustc_errors` uses that macro to define everything, e.g. the error code constants and the `DIAGNOSTIC_TABLES`. This is in its new `codes.rs` file.
2024-01-28Add rustc_apfloat license exception for RALaurențiu Nicola-0/+1
2024-01-28Auto merge of #3181 - devnexen:stat_calls_fbsd, r=RalfJungbors-41/+118
freebsd add *stat calls interception support
2024-01-28tweak commentsRalf Jung-2/+2
2024-01-28Merge commit '7219414e81810fd4d967136c4a0650523892c157' into sync-from-raLaurențiu Nicola-2796/+1390
2024-01-27Fix `NonZero` clippy lints.Markus Reiter-42/+64
2024-01-27Auto merge of #120201 - clubby789:dep-update, r=dtolnaybors-2/+0
Bump some deps with syn 1.0 dependencies cc #109302 `cargo update`ing `unic-langid` and `object` removes two dependencies on Syn 1.0.
2024-01-27Auto merge of #120062 - davidtwco:llvm-data-layout-check, r=wesleywiserbors-3/+4
llvm: change data layout bug to an error and make it trigger more Fixes #33446. Don't skip the inconsistent data layout check for custom LLVMs or non-built-in targets. With #118708, all targets will have a simple test that would trigger this error if LLVM's data layouts do change - so data layouts would be corrected during the LLVM upgrade. Therefore, with builtin targets, this error won't happen with our LLVM because each target will have been confirmed to work. With non-builtin targets, this error is probably useful to have because you can change the data layout in your target and if it is wrong then that could lead to bugs. When using a custom LLVM, the same justification makes sense for non-builtin targets as with our LLVM, the user can update their target to match their LLVM and that's probably a good thing to do. However, with a custom LLVM, the user cannot change the builtin target data layouts if they don't match - though given that the compiler's data layout is used for layout computation and a bunch of other things - you could get some bugs because of the mismatch and probably want to know about that. I'm not sure if this is something that people do and is okay, but I doubt it? `CFG_LLVM_ROOT` was also always set during local development with `download-ci-llvm` so this bug would never trigger locally. In #33446, two points are raised: - In the issue itself, changing this from a `bug!` to a proper error is what is suggested, by using `isCompatibleDataLayout` from LLVM, but that function still just does the same thing that we do and check for equality, so I've avoided the additional code necessary to do that FFI call. - `@Mark-Simulacrum` suggests a different check is necessary to maintain backwards compatibility with old LLVM versions. I don't know how often this comes up, but we can do that with some simple string manipulation + LLVM version checks as happens already for LLVM 17 just above this diff.
2024-01-27fix typo in operator.rsRalf Jung-1/+1
2024-01-26Auto merge of #120375 - matthiaskrgr:rollup-ueakvms, r=matthiaskrgrbors-1019/+2858
Rollup of 9 pull requests Successful merges: - #117420 (Make `#![allow_internal_unstable(..)]` work with `stmt_expr_attributes`) - #117678 (Stabilize `slice_group_by`) - #119917 (Remove special-case handling of `vec.split_off(0)`) - #120117 (Update `std::io::Error::downcast` return type) - #120329 (RFC 3349 precursors) - #120339 (privacy: Refactor top-level visiting in `NamePrivacyVisitor`) - #120345 (Clippy subtree update) - #120360 (Don't fire `OPAQUE_HIDDEN_INFERRED_BOUND` on sized return of AFIT) - #120372 (Fix outdated comment on Box) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-26Rollup merge of #120345 - flip1995:clippy-subtree-update, r=ManishearthMatthias Krüger-1000/+2840
Clippy subtree update r? `@Manishearth` Closes https://github.com/rust-lang/rust-clippy/issues/12148
2024-01-26Rollup merge of #120329 - nnethercote:3349-precursors, r=fee1-deadMatthias Krüger-19/+18
RFC 3349 precursors Some cleanups I found while working on RFC 3349 that are worth landing separately. r? `@fee1-dead`
2024-01-26Clippy: Fix empty suggestion in from_over_intoPhilipp Krones-5/+5
Co-authored-by: y21 <30553356+y21@users.noreply.github.com>
2024-01-26interpret: project_downcast: do not ICE for uninhabited variantsRalf Jung-0/+16
2024-01-26alidate the operand passed to is_val_statically_knownRalf Jung-1/+2
2024-01-26fmtThe Miri Conjob Bot-3/+5
2024-01-26Merge from rustcThe Miri Conjob Bot-40/+129
2024-01-26Preparing for merge from rustcThe Miri Conjob Bot-1/+1
2024-01-26Auto merge of #116167 - RalfJung:structural-eq, r=lcnrbors-17/+0
remove StructuralEq trait The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more. One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust https://github.com/rust-lang/rust/pull/115893 to check for `Eq`, and rule out float matching for good. Fixes https://github.com/rust-lang/rust/issues/115881
2024-01-25Merge commit '66c29b973b3b10278bd39f4e26b08522a379c2c9' into ↵Philipp Krones-999/+2839
clippy-subtree-update
2024-01-25Remove an unused error count checkOli Scherer-17/+1
2024-01-25Auto merge of #3233 - RalfJung:trophy, r=RalfJungbors-0/+1
Add portable-atomic-util bug to "bugs found" list At least, reading https://notgull.net/cautionary-unsafe-tale/ it seems fair to say Miri found this bug. `@notgull` please let me know if you are okay with having this listed here.
2024-01-25Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obkbors-0/+27
Replacement of #114390: Add new intrinsic `is_var_statically_known` and optimize pow for powers of two This adds a new intrinsic `is_val_statically_known` that lowers to [``@llvm.is.constant.*`](https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic).` It also applies the intrinsic in the int_pow methods to recognize and optimize the idiom `2isize.pow(x)`. See #114390 for more discussion. While I have extended the scope of the power of two optimization from #114390, I haven't added any new uses for the intrinsic. That can be done in later pull requests. Note: When testing or using the library, be sure to use `--stage 1` or higher. Otherwise, the intrinsic will be a noop and the doctests will be skipped. If you are trying out edits, you may be interested in [`--keep-stage 0`](https://rustc-dev-guide.rust-lang.org/building/suggested.html#faster-builds-with---keep-stage). Fixes #47234 Resolves #114390 `@Centri3`