summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
AgeCommit message (Collapse)AuthorLines
2024-04-29Don't trigger `unused_qualifications` on global paths许杰友 Jieyou Xu (Joe)-0/+7
2024-04-18Silence unused_imports lint for redundant importsMichael Goulet-1/+3
(cherry picked from commit 0db2a4010a5a7a57372e9135d327da8c7d92c8ab)
2024-04-04Fix f16 and f128 feature gates in editions other than 2015Trevor Gross-0/+2
Fixes https://github.com/rust-lang/rust/issues/123282 Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> (cherry picked from commit 5afe072ead1154f9817ee610e3e60345507c7625)
2024-03-16Auto merge of #121926 - tgross35:f16-f128-step3-feature-gate, ↵bors-1/+51
r=compiler-errors,petrochenkov `f16` and `f128` step 3: compiler support & feature gate Continuation of https://github.com/rust-lang/rust/pull/121841, another portion of https://github.com/rust-lang/rust/pull/114607 This PR exposes the new types to the world and adds a feature gate. Marking this as a draft because I need some feedback on where I did the feature gate check. It also does not yet catch type via suffixed literals (so the feature gate test will fail, probably some others too because I haven't belssed). If there is a better place to check all types after resolution, I can do that. If not, I figure maybe I can add a second gate location in AST when it checks numeric suffixes. Unfortunately I still don't think there is much testing to be done for correctness (codegen tests or parsed value checks) until we have basic library support. I think that will be the next step. Tracking issue: https://github.com/rust-lang/rust/issues/116909 r? `@compiler-errors` cc `@Nilstrieb` `@rustbot` label +F-f16_and_f128
2024-03-15Rollup merge of #122530 - klensy:as_str, r=fee1-deadGuillaume Gomez-3/+4
less symbol interner locks This reduces instructions under 1% (in rustdoc run), but essentially free.
2024-03-15less symbols interner locksklensy-3/+4
2024-03-14Rollup merge of #122373 - surechen:fix_121331, r=petrochenkovMatthias Krüger-22/+85
Fix the conflict problem between the diagnostics fixes of lint `unnecessary_qualification` and `unused_imports` fixes #121331 For an `item` that triggers lint unnecessary_qualification, if the `use item` which imports this item is also trigger unused import, fixing the two lints at the same time may lead to the problem that the `item` cannot be found. This PR will avoid reporting lint unnecessary_qualification when conflict occurs. r? ``@petrochenkov``
2024-03-14Add feature gates for `f16` and `f128`Trevor Gross-1/+51
Includes related tests and documentation pages. Michael Goulet: Don't issue feature error in resolver for f16/f128 unless finalize Co-authored-by: Michael Goulet <michael@errs.io>
2024-03-14fixes #121331surechen-22/+85
2024-03-13delay expand macro bang when there has indeterminate pathbohan-34/+51
2024-03-12Manual rustfmtOli Scherer-2/+2
2024-03-12s/mt/mutability/Oli Scherer-2/+4
2024-03-12Add `nested` bool to `DefKind::Static`.Oli Scherer-2/+2
Will be used in the next commit
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-6/+6
2024-03-11Rename `IntoDiagnosticArg` as `IntoDiagArg`.Nicholas Nethercote-3/+3
Also rename `into_diagnostic_arg` as `into_diag_arg`, and `NotIntoDiagnosticArg` as `NotInotDiagArg`.
2024-03-11Remove `Default` derive from `MacroExpectedFound`.Nicholas Nethercote-2/+3
It's the only diagnostic in the entire project that impls `Default`, and the code is clearer without it.
2024-03-08Rollup merge of #119365 - nbdd0121:asm-goto, r=AmanieuMatthias Krüger-0/+1
Add asm goto support to `asm!` Tracking issue: #119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2024-03-07Rollup merge of #121089 - oli-obk:create_def_feed, r=petrochenkovGuillaume Gomez-54/+89
Remove `feed_local_def_id` best reviewed commit by commit Basically I returned `TyCtxtFeed` from `create_def` and then preserved that in the local caches based on https://github.com/rust-lang/rust/pull/121084 r? ````@petrochenkov````
2024-03-07Merge `check_mod_impl_wf` and `check_mod_type_wf`Oli Scherer-4/+13
2024-03-07Auto merge of #122113 - matthiaskrgr:rollup-5d1jnwi, r=matthiaskrgrbors-71/+77
Rollup of 9 pull requests Successful merges: - #121958 (Fix redundant import errors for preload extern crate) - #121976 (Add an option to have an external download/bootstrap cache) - #122022 (loongarch: add frecipe and relax target feature) - #122026 (Do not try to format removed files) - #122027 (Uplift some feeding out of `associated_type_for_impl_trait_in_impl` and into queries) - #122063 (Make the lowering of `thir::ExprKind::If` easier to follow) - #122074 (Add missing PartialOrd trait implementation doc for array) - #122082 (remove outdated fixme comment) - #122091 (Note why we're using a new thread in `test_get_os_named_thread`) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-06Rollup merge of #122038 - Alexendoo:unused-qualifications, r=petrochenkovMatthias Krüger-33/+37
Fix linting paths with qself in `unused_qualifications` Fixes #121999 `resolve_qpath` ends up being called again with `qself` set to `None` to check trait items from fully qualified paths. To avoid this the lint is moved to a place that accounts for this already https://github.com/rust-lang/rust/blob/96561a8fd134e8f2b205769a4fca03b392d9f484/compiler/rustc_resolve/src/late.rs#L4074-L4088 r? `````@petrochenkov`````
2024-03-06Fix redundant import errors for preload extern crateyukang-71/+77
2024-03-06avoid overlapping privacy suggestion for single nested importsbohan-25/+44
2024-03-06Auto merge of #122041 - matthiaskrgr:rollup-imsmdke, r=matthiaskrgrbors-4/+6
Rollup of 8 pull requests Successful merges: - #121202 (Limit the number of names and values in check-cfg diagnostics) - #121301 (errors: share `SilentEmitter` between rustc and rustfmt) - #121658 (Hint user to update nightly on ICEs produced from outdated nightly) - #121846 (only compare ambiguity item that have hard error) - #121961 (add test for #78894 #71450) - #121975 (hir_analysis: enums return `None` in `find_field`) - #121978 (Fix duplicated path in the "not found dylib" error) - #121991 (Merge impl_trait_in_assoc_types_defined_by query back into `opaque_types_defined_by`) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-05Rollup merge of #121846 - bvanjoi:fix-121760, r=petrochenkovMatthias Krüger-4/+6
only compare ambiguity item that have hard error Fixes #121760 An easy fix, r? ``@petrochenkov``
2024-03-05Fix linting paths with qself in `unused_qualifications`Alex Macleod-33/+37
2024-03-05Move visitor utils to `rustc_ast_ir`Jason Newcomb-1/+1
2024-03-05Remove a use of feed_local_crate and make it fail if used within queriesOli Scherer-7/+11
2024-03-05Prevent feeding `CRATE_DEF_ID` queries outside the resolverOli Scherer-2/+5
2024-03-05Get rid of `feed_local_def_id`Oli Scherer-1/+1
2024-03-05Eliminate all non-CRATE_DEF_ID uses of `feed_def_id`Oli Scherer-28/+39
2024-03-05Preserve the `Feed` in local tablesOli Scherer-9/+23
2024-03-05Bubble up the TyCtxtFeedOli Scherer-12/+15
2024-03-05Rename `DiagnosticMetadata` as `DiagMetadata`.Nicholas Nethercote-92/+86
2024-03-05Rename `BuiltinLintDiagnostics` as `BuiltinLintDiag`.Nicholas Nethercote-22/+22
Not the dropping of the trailing `s` -- this type describes a single diagnostic and its name should be singular.
2024-03-05Rename `DiagnosticMode` as `DiagMode`.Nicholas Nethercote-22/+19
2024-03-04Rollup merge of #121969 - nnethercote:ParseSess-cleanups, r=wesleywiserMatthias Krüger-2/+2
`ParseSess` cleanups The main change here is to rename all `ParseSess` values as `psess`. Plus a few other small cleanups. r? `@wesleywiser`
2024-03-05Rename all `ParseSess` variables/fields/lifetimes as `psess`.Nicholas Nethercote-2/+2
Existing names for values of this type are `sess`, `parse_sess`, `parse_session`, and `ps`. `sess` is particularly annoying because that's also used for `Session` values, which are often co-located, and it can be difficult to know which type a value named `sess` refers to. (That annoyance is the main motivation for this change.) `psess` is nice and short, which is good for a name used this much. The commit also renames some `parse_sess_created` values as `psess_created`.
2024-03-04Rollup merge of #121130 - chenyukang:yukang-fix-121061-macro-later, ↵Matthias Krüger-1/+37
r=matthiaskrgr Suggest moving definition if non-found macro_rules! is defined later Fixes #121061
2024-03-03Rollup merge of #121528 - Alexendoo:unused_qualifications, r=petrochenkovMatthias Krüger-22/+24
Consider middle segments of paths in `unused_qualifications` Currently `unused_qualifications` looks at the last segment of a path to see if it can be trimmed, this PR extends the check to the middle segments also ```rust // currently linted use std::env::args(); std::env::args(); // Removes `std::env::` ``` ```rust // newly linted use std::env; std::env::args(); // Removes `std::` ``` Paths with generics in them are now linted as long as the part being trimmed is before any generic args, e.g. it will now suggest trimming `std::vec::` from `std::vec::Vec<usize>` Paths with any segments that are from an expansion are no longer linted Fixes #100979 Fixes #96698
2024-03-03Consider middle segments of paths in `unused_qualifications`Alex Macleod-22/+24
2024-03-02avoid collecting into vecs in some placesMatthias Krüger-4/+1
2024-03-01only compare ambiguity item that have hard errorbohan-4/+6
2024-02-29Rollup merge of #121792 - GuillaumeGomez:improve-suggestion, r=michaelwoeristerGuillaume Gomez-2/+3
Improve renaming suggestion when item starts with underscore Fixes https://github.com/rust-lang/rust/issues/121776. It goes from: ```terminal error[E0433]: failed to resolve: use of undeclared type `Foo` --> src/foo.rs:6:13 | 6 | let _ = Foo::Bar; | ^^^ use of undeclared type `Foo` | help: an enum with a similar name exists, consider changing it | 1 | enum Foo { | ~~~ ``` to: ```terminal error[E0433]: failed to resolve: use of undeclared type `Foo` --> foo.rs:6:13 | 6 | let _ = Foo::Bar; | ^^^ use of undeclared type `Foo` | help: an enum with a similar name exists, consider renaming `_Foo` into `Foo` | 1 | enum Foo { | ~~~ error: aborting due to 1 previous error ```
2024-02-29Improve suggestion to rename type starting with underscore to make it more ↵Guillaume Gomez-2/+3
obvious what is actually suggested
2024-02-29Suggest moving if non-found macro_rules! is defined lateryukang-1/+37
2024-02-29Remove unused diagnostic structr0cky-39/+0
2024-02-28Auto merge of #121489 - nnethercote:diag-renaming, r=davidtwcobors-94/+79
Diagnostic renaming Renaming various diagnostic types from `Diagnostic*` to `Diag*`. Part of https://github.com/rust-lang/compiler-team/issues/722. There are more to do but this is enough for one PR. r? `@davidtwco`
2024-02-28Rollup merge of #121226 - chenyukang:yukang-fix-import-alias, r=davidtwcoGuillaume Gomez-1/+11
Fix issues in suggesting importing extern crate paths Fixes #121168 r? ``@petrochenkov``
2024-02-28Rename `DiagnosticArg{,Map,Name,Value}` as `DiagArg{,Map,Name,Value}`.Nicholas Nethercote-3/+3