summary refs log tree commit diff
path: root/compiler/rustc_lint/src
AgeCommit message (Collapse)AuthorLines
2023-05-25Dont check `must_use` on nested `impl Future` from fnMichael Goulet-1/+3
(cherry picked from commit 926e874fd1dccc208bf63db7a4288adf46caa3c3)
2023-04-12Rollup merge of #110153 - DaniPopes:compiler-typos, r=NilstriebMatthias Krüger-16/+16
Fix typos in compiler I ran [`typos -w compiler`](https://github.com/crate-ci/typos) to fix typos in the `compiler` directory. Refs #110150
2023-04-11Allow the elaborator to only filter to real supertraitsMichael Goulet-0/+2
2023-04-10Fix typos in compilerDaniPopes-16/+16
2023-04-09Use HashMap entry APIs moreNilstrieb-6/+6
2023-04-06Make elaborator genericMichael Goulet-19/+16
2023-04-05Auto merge of #109117 - oli-obk:locks, r=michaelwoeristerbors-1/+1
Avoid a few locks We can use atomics or datastructures tuned for specific access patterns instead of locks. This may be an improvement for parallel rustc, but it's mostly a cleanup making various datastructures only usable in the way they are used right now (append data, never mutate), instead of having a general purpose lock.
2023-04-04Auto merge of #109944 - cjgillot:lint-cstring-macro, r=Nilstriebbors-41/+8
Do not suppress temporary_cstring_as_ptr in macros. There isn't really a reason to skip the lint when part of the expression comes from an expansion. Fixes https://github.com/rust-lang/rust/issues/94694
2023-04-04Do not suppress temporary_cstring_as_ptr in macros.Camille GILLOT-41/+8
2023-04-04Rename `ast::Static` to `ast::StaticItem` to match `ast::ConstItem`Oli Scherer-1/+1
2023-04-04box a bunch of large typesOli Scherer-2/+2
2023-04-04Split out ast::ItemKind::Const into its own structOli Scherer-1/+3
2023-04-04rust-analyzer guided tuple field to named fieldOli Scherer-3/+2
2023-04-04rust-analyzer guided enum variant structificationOli Scherer-2/+3
2023-04-04Replace another lock with an append-only vecOli Scherer-1/+1
2023-03-30Update `ty::VariantDef` to use `IndexVec<FieldIdx, FieldDef>`Scott McMurray-1/+1
And while doing the updates for that, also uses `FieldIdx` in `ProjectionKind::Field` and `TypeckResults::field_indices`. There's more places that could use it (like `rustc_const_eval` and `LayoutS`), but I tried to keep this PR from exploding to *even more* places. Part 2/? of https://github.com/rust-lang/compiler-team/issues/606
2023-03-29Rollup merge of #109554 - MU001999:master, r=WaffleLapkinMatthias Krüger-14/+56
Suggest ..= when someone tries to create an overflowing range Fixes #109529
2023-03-27Rollup merge of #109354 - Swatinem:rm-closureid, r=compiler-errorsGuillaume Gomez-2/+1
Remove the `NodeId` of `ast::ExprKind::Async` This is a followup to https://github.com/rust-lang/rust/pull/104833#pullrequestreview-1314537416. In my original attempt, I was using `LoweringContext::expr`, which was not correct as it creates a fresh `DefId`. It now uses the correct `DefId` for the wrapping `Expr`, and also makes forwarding `#[track_caller]` attributes more explicit.
2023-03-27Rollup merge of #109641 - compiler-errors:dont-elaborate-non-obl, r=oli-obkMatthias Krüger-2/+2
Don't elaborate non-obligations into obligations It's suspicious to elaborate a `PolyTraitRef` or `Predicate` into an `Obligation`, since the former does not have a param-env associated with it, but the latter does. This is a footgun that, while not being misused *currently* in the compiler, easily could be misused by someone less familiar with the elaborator's inner workings. This PR just changes the API -- ideally, the elaborator wouldn't even have to deal with obligations if we're not elaborating obligations, but that would require a bit more abstraction than I could be bothered with today.
2023-03-26Don't elaborate non-obligations into obligationsMichael Goulet-2/+2
2023-03-25Refactor: `VariantIdx::from_u32(0)` -> `FIRST_VARIANT`Scott McMurray-3/+2
Since structs are always `VariantIdx(0)`, there's a bunch of files where the only reason they had `VariantIdx` or `vec::Idx` imported at all was to get the first variant. So this uses a constant for that, and adds some doc-comments to `VariantIdx` while I'm there, since it doesn't have any today.
2023-03-25Emits suggestions for expressions with parentheses or not separatelyMu001999-14/+47
2023-03-24Use independent suggestionsMu42-22/+18
2023-03-24Suggest ..= when someone tries to create an overflowing rangeMu42-7/+20
2023-03-23Rollup merge of #109487 - GuillaumeGomez:move-useless-reexport-check, ↵Matthias Krüger-93/+0
r=petrochenkov Move useless_anynous_reexport lint into unused_imports As mentioned in https://github.com/rust-lang/rust/pull/109003, this check should have been merged with `unused_imports` in the start. r? `@petrochenkov`
2023-03-23Rollup merge of #107880 - jieyouxu:issue-107563, r=petrochenkovMatthias Krüger-0/+4
Lint ambiguous glob re-exports Attempts to fix #107563. We currently already emit errors for ambiguous re-exports when two names are re-exported *specifically*, i.e. not from glob exports. This PR attempts to emit deny-by-default lints for ambiguous glob re-exports.
2023-03-23Auto merge of #108221 - petrochenkov:cratecfg, r=michaelwoeristerbors-5/+5
rustc_interface: Add a new query `pre_configure` It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes on the crate itself are then expanded normally during the main expansion pass, like attributes on any other nodes. This is a continuation of https://github.com/rust-lang/rust/pull/92473 and one more step to very unstable crate-level proc macro attributes maybe actually working. Previously crate attributes were pre-configured simultaneously with feature extraction, and then written directly into `ast::Crate`.
2023-03-23Auto merge of #109517 - matthiaskrgr:rollup-m3orqzd, r=matthiaskrgrbors-4/+19
Rollup of 7 pull requests Successful merges: - #108541 (Suppress `opaque_hidden_inferred_bound` for nested RPITs) - #109137 (resolve: Querify most cstore access methods (subset 2)) - #109380 (add `known-bug` test for unsoundness issue) - #109462 (Make alias-eq have a relation direction (and rename it to alias-relate)) - #109475 (Simpler checked shifts in MIR building) - #109504 (Stabilize `arc_into_inner` and `rc_into_inner`.) - #109506 (make param bound vars visibly bound vars with -Zverbose) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-23rustc_interface: Add a new query `pre_configure`Vadim Petrochenkov-5/+5
It partially expands crate attributes before the main expansion pass (without modifying the crate), and the produced preliminary crate attribute list is used for querying a few attributes that are required very early. Crate-level cfg attributes are then expanded normally during the main expansion pass, like attributes on any other nodes.
2023-03-23Rollup merge of #109462 - compiler-errors:alias-relate, r=BoxyUwU,lcnrMatthias Krüger-1/+1
Make alias-eq have a relation direction (and rename it to alias-relate) Emitting an "alias-eq" is too strict in some situations, since we don't always want strict equality between a projection and rigid ty. Adds a relation direction. * I could probably just reuse this [`RelationDir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/combine/enum.RelationDir.html) -- happy to uplift that struct into middle and use that instead, but I didn't feel compelled to... 🤷 * Some of the matching in `compute_alias_relate_goal` is a bit verbose -- I guess I could simplify it by using [`At::relate`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/at/struct.At.html#method.relate) and mapping the relation-dir to a variance. * Alternatively, I coulld simplify things by making more helper functions on `EvalCtxt` (e.g. `EvalCtxt::relate_with_direction(T, T)` that also does the nested goal registration). No preference. r? ```@lcnr``` cc ```@BoxyUwU``` though boxy can claim it if she wants NOTE: first commit is all the changes, the second is just renaming stuff
2023-03-23Nested impl traits trigger opaque_hidden_inferred_bound too muchMichael Goulet-3/+18
2023-03-23Rename AliasEq -> AliasRelateMichael Goulet-1/+1
2023-03-22Move useless_anynous_reexport lint into unused_importsGuillaume Gomez-93/+0
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-17/+15
2023-03-22Auto merge of #109119 - lcnr:trait-system-cleanup, r=compiler-errorsbors-4/+7
a general type system cleanup removes the helper functions `traits::fully_solve_X` as they add more complexity then they are worth. It's confusing which of these helpers should be used in which context. changes the way we deal with overflow to always add depth in `evaluate_predicates_recursively`. It may make sense to actually fully transition to not have `recursion_depth` on obligations but that's probably a bit too much for this PR. also removes some other small - and imo unnecessary - helpers. r? types
2023-03-21Use local key in providersMichael Goulet-10/+5
2023-03-21use the correct param envlcnr-2/+1
2023-03-21remove some trait solver helperslcnr-3/+7
they add more complexity then they are worth. It's confusing which of these helpers should be used in which context.
2023-03-20remove bad commentDaniPopes-1/+0
2023-03-20fix ClashingExternDeclarations lint ICEDaniPopes-13/+11
2023-03-20Lint ambiguous glob re-exports许杰友 Jieyou Xu (Joe)-0/+4
2023-03-19Remove the `NodeId` of `ast::ExprKind::Async`Arpad Borsos-2/+1
2023-03-19Rollup merge of #109003 - GuillaumeGomez:useless-anonymous-reexport-lint, ↵Dylan DPC-0/+93
r=cjgillot Add `useless_anonymous_reexport` lint This is a follow-up of https://github.com/rust-lang/rust/pull/108936. We once again show all anonymous re-exports in rustdoc, however we also wanted to add a lint to let users know that it very likely doesn't have the effect they think it has.
2023-03-16Rollup merge of #109158 - Ezrashaw:expand-sugg-for-unused-lint, r=NilstriebMatthias Krüger-31/+22
error-msg: expand suggestion for `unused_def` lint Fixes #108885 Expands `let _ = ..` suggestion into more positions.
2023-03-15error-msg: expand suggestion for unused lintEzra Shaw-31/+22
2023-03-15Fix #109152, fix the scenario that we may can not get span of funcyukang-2/+9
2023-03-12Add test for useless_anonymous_reexport lintGuillaume Gomez-0/+1
2023-03-12Add lint for useless anonymous reexportsGuillaume Gomez-0/+92
2023-03-12Remove uses of `box_syntax` in rustc and toolsclubby789-1/+0
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done