about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2024-02-07Do not create param types that differ only by name when comparing intrinsic ↵Michael Goulet-4/+21
signatures
2024-02-07Record coroutine kind in genericsMichael Goulet-3/+10
2024-02-07hir: Remove `fn opt_hir_id` and `fn opt_span`Vadim Petrochenkov-9/+8
2024-02-07hir: Make sure all `HirId`s have corresponding HIR `Node`sVadim Petrochenkov-0/+2
2024-02-06Rollup merge of #120632 - trevyn:issue-109195, r=oli-obkMatthias Krüger-0/+53
For E0223, suggest associated functions that are similar to the path e.g. for `String::from::utf8`, suggest `String::from_utf8` Closes #109195
2024-02-05Create helper `maybe_report_similar_assoc_fn`trevyn-51/+52
2024-02-06More comments, final tweaksMichael Goulet-9/+2
2024-02-06Teach typeck/borrowck/solvers how to deal with async closuresMichael Goulet-0/+31
2024-02-06Add CoroutineClosure to TyKind, AggregateKind, UpvarArgsMichael Goulet-3/+11
2024-02-06Make async closures directly lower to ClosureKind::CoroutineClosureMichael Goulet-0/+1
2024-02-06Invert diagnostic lints.Nicholas Nethercote-0/+2
That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has be converted to use translated diagnostics. This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.
2024-02-05Make the error message betterMichael Goulet-4/+66
2024-02-05Allow desugaring async fn in trait to compatible, concrete future typesMichael Goulet-46/+0
2024-02-05Stop bailing out from compilation just because there were incoherent traitsOli Scherer-2/+14
2024-02-04Auto merge of #120649 - matthiaskrgr:rollup-ek80j61, r=matthiaskrgrbors-57/+133
Rollup of 8 pull requests Successful merges: - #119759 (Add FileCheck annotations to dataflow-const-prop tests) - #120323 (On E0277 be clearer about implicit `Sized` bounds on type params and assoc types) - #120473 (Only suggest removal of `as_*` and `to_` conversion methods on E0308) - #120540 (add test for try-block-in-match-arm) - #120547 (`#![feature(inline_const_pat)]` is no longer incomplete) - #120552 (Correctly check `never_type` feature gating) - #120555 (put pnkfelix (me) back on the review queue.) - #120556 (Improve the diagnostics for unused generic parameters) r? `@ghost` `@rustbot` modify labels: rollup
2024-02-04Rollup merge of #120556 - fmease:improve-unused-generic-param-diags, r=oli-obkMatthias Krüger-54/+122
Improve the diagnostics for unused generic parameters * Don't emit two errors (namely E0091 *and* E0392) for unused type parameters on *lazy* type aliases * Fix the diagnostic help message of E0392 for *lazy* type aliases: Don't talk about the “fields” of lazy type aliases (use the term “body” instead) and don't suggest `PhantomData` for them, it doesn't make much sense * Consolidate the diagnostics for E0091 (unused type parameters in type aliases) and E0392 (unused generic parameters due to bivariance) and make it translatable * Still keep the error codes distinct (for now) * Naturally leads to better diagnostics for E0091 r? ```@oli-obk``` (to ballast your review load :P) or compiler
2024-02-03For E0223, suggest methods that look similar to the pathtrevyn-0/+52
2024-02-03Rollup merge of #120592 - trevyn:cleanup-to-string, r=NilstriebMatthias Krüger-1/+1
Remove unnecessary `.to_string()`/`.as_str()`s
2024-02-02Remove unnecessary `.to_string()`/`.as_str()`strevyn-1/+1
2024-02-02Remove dead args from functionsMichael Goulet-23/+5
2024-02-03`Diagnostic` cleanupsNicholas Nethercote-1/+0
- `emitted_at` isn't used outside the crate. - `code` and `messages` are public fields, so there's no point have trivial getters/setters for them. - `suggestions` is public, so the comment about "functionality on `Diagnostic`" isn't needed.
2024-02-01Improve the diagnostics for unused generic parametersLeón Orell Valerian Liehr-54/+122
2024-02-01On E0277 be clearer about implicit `Sized` bounds on type params and assoc typesEsteban Küber-3/+11
``` error[E0277]: the size for values of type `[i32]` cannot be known at compilation time --> f100.rs:2:33 | 2 | let _ = std::mem::size_of::<[i32]>(); | ^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[i32]` note: required by an implicit `Sized` bound in `std::mem::size_of` --> /home/gh-estebank/rust/library/core/src/mem/mod.rs:312:22 | 312 | pub const fn size_of<T>() -> usize { | ^ required by the implicit `Sized` requirement on this bound in `size_of` ``` Fix #120178.
2024-01-31Auto merge of #120346 - petrochenkov:ownodes, r=oli-obkbors-3/+3
hir: Refactor getters for owner nodes
2024-01-30Auto merge of #119101 - compiler-errors:outlives, r=lcnrbors-22/+19
Normalize region obligation in lexical region resolution with next-gen solver This normalizes region obligations when we `resolve_regions`, since they may be unnormalized with deferred projection equality. It's pretty hard to add tests that exercise this without also triggering MIR borrowck errors (because we don't normalize there yet). I've added one test with two revisions that should test that we both 1. normalize region obligations in the param env, and 2. normalize registered region obligations during lexical region resolution.
2024-01-30hir: Remove `hir::Map::{owner,expect_owner}`Vadim Petrochenkov-3/+3
2024-01-30Rollup merge of #120400 - estebank:bound-error-cleanup, r=oli-obkGuillaume Gomez-11/+21
Bound errors span label cleanup Consolidate span labels for "this type doesn't satisfy a bound" for more compact diagnostic output.
2024-01-30Apply suggestions from reviewMichael Goulet-1/+1
2024-01-30Deeply normalize when processing registered region obligationsMichael Goulet-0/+5
2024-01-30No need to pass region bound pairs to resolve_regions_with_wf_tysMichael Goulet-22/+14
2024-01-29review commentsEsteban Küber-16/+9
2024-01-29Auto merge of #120466 - Dylan-DPC:rollup-v0or19a, r=Dylan-DPCbors-3/+3
Rollup of 9 pull requests Successful merges: - #116677 (References refer to allocated objects) - #118625 (Improve handling of expressions in patterns) - #120266 (Improve documentation for [A]Rc::into_inner) - #120373 (Adjust Behaviour of `read_dir` and `ReadDir` in Windows Implementation: Check Whether Path to Search In Exists) - #120390 (Borrow check inline const patterns) - #120420 (Stop using derivative in rustc_pattern_analysis) - #120428 (hir: Two preparatory changes for #120206) - #120453 (Fix incorrect comment in normalize_newlines) - #120462 (Clean dead code) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-29Avoid ICE in trait without `dyn` lintEsteban Küber-5/+3
Do not attempt to provide an accurate suggestion for `impl Trait` in bare trait types when linting. Instead, only do the object safety check when an E0782 is already going to be emitted in the 2021 edition. Fix #120241.
2024-01-29Rollup merge of #120428 - petrochenkov:somehir2, r=compiler-errorsDylan DPC-3/+3
hir: Two preparatory changes for #120206 cc https://github.com/rust-lang/rust/pull/120206 r? ```@compiler-errors```
2024-01-29Stop using `String` for error codes.Nicholas Nethercote-104/+110
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-28hir: Use `InferArg` in `ArrayLen::Infer`Vadim Petrochenkov-3/+3
2024-01-26Use only one label for multiple unsatisfied bounds on type (astconv)Esteban Küber-11/+28
2024-01-25Remove unused featuresclubby789-3/+0
2024-01-25Rollup merge of #119895 - oli-obk:track_errors_3, r=matthewjasperMatthias Krüger-105/+132
Remove `track_errors` entirely follow up to https://github.com/rust-lang/rust/pull/119869 r? `@matthewjasper` There are some diagnostic changes adding new diagnostics or not emitting some anymore. We can improve upon that in follow-up work imo.
2024-01-25Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obkbors-0/+2
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`
2024-01-23Auto merge of #120283 - fmease:rollup-rk0f6r5, r=fmeasebors-7/+77
Rollup of 9 pull requests Successful merges: - #112806 (Small code improvements in `collect_intra_doc_links.rs`) - #119766 (Split tait and impl trait in assoc items logic) - #120139 (Do not normalize closure signature when building `FnOnce` shim) - #120160 (Manually implement derived `NonZero` traits.) - #120171 (Fix assume and assert in jump threading) - #120183 (Add `#[coverage(off)]` to closures introduced by `#[test]` and `#[bench]`) - #120195 (add several resolution test cases) - #120259 (Split Diagnostics for Uncommon Codepoints: Add List to Display Characters Involved) - #120261 (Provide structured suggestion to use trait objects in some cases of `if` arm type divergence) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-23Rollup merge of #119766 - oli-obk:split_tait_and_atpit, r=compiler-errorsLeón Orell Valerian Liehr-7/+77
Split tait and impl trait in assoc items logic And simplify the assoc item logic where applicable. This separation shows that it is easier to reason about impl trait in assoc items compared with TAITs. See https://rust-lang.zulipchat.com/#narrow/stream/315482-t-compiler.2Fetc.2Fopaque-types/topic/impl.20trait.20in.20associated.20type for some discussion. The current plan is to try to stabilize impl trait in associated items before TAIT, as they do not have any issues with their defining scopes (see https://github.com/rust-lang/rust/issues/107645 for why this is not a trivial or uncontroversial topic).
2024-01-23Rollup merge of #120270 - compiler-errors:randos, r=lcnrLeón Orell Valerian Liehr-1/+4
A bunch of random modifications r? oli-obk Kitchen sink of changes that I didn't know where to put elsewhere. Documentation tweaks mostly, but also removing some unreachable code and simplifying the pretty printing for closures/coroutines.
2024-01-23Remove track_errors entirelyOli Scherer-105/+132
2024-01-23Random type checker changesMichael Goulet-1/+4
2024-01-23Rename `TyCtxt::emit_spanned_lint` as `TyCtxt::emit_node_span_lint`.Nicholas Nethercote-3/+3
2024-01-23Rename `TyCtxt::struct_span_lint_hir` as `TyCtxt::node_span_lint`.Nicholas Nethercote-34/+22
2024-01-22Auto merge of #120242 - matthiaskrgr:rollup-a93yj3i, r=matthiaskrgrbors-7/+9
Rollup of 10 pull requests Successful merges: - #117910 (Refactor uses of `objc_msgSend` to no longer have clashing definitions) - #118639 (Undeprecate lint `unstable_features` and make use of it in the compiler) - #119801 (Fix deallocation with wrong allocator in (A)Rc::from_box_in) - #120058 (bootstrap: improvements for compiler builds) - #120059 (Make generic const type mismatches not hide trait impls from the trait solver) - #120097 (Report unreachable subpatterns consistently) - #120137 (Validate AggregateKind types in MIR) - #120164 (`maybe_lint_impl_trait`: separate `is_downgradable` from `is_object_safe`) - #120181 (Allow any `const` expression blocks in `thread_local!`) - #120218 (rustfmt: Check that a token can begin a nonterminal kind before parsing it as a macro arg) r? `@ghost` `@rustbot` modify labels: rollup
2024-01-22Rollup merge of #120164 - trevyn:is_downgradable, r=compiler-errorsMatthias Krüger-7/+9
`maybe_lint_impl_trait`: separate `is_downgradable` from `is_object_safe` https://github.com/rust-lang/rust/pull/119752 leveraged and overloaded `is_object_safe` to prevent an ICE, but accurate object safety information is needed for precise suggestions. This separates out `is_downgradable`, used for the ICE prevention, and `is_object_safe`, which returns to its original meaning.
2024-01-22Rollup merge of #120213 - ↵Matthias Krüger-25/+9
compiler-errors:dont-make-non-lifetime-binders-in-rtn, r=fmease Don't actually make bound ty/const for RTN Avoid creating an unnecessary non-lifetime binder when we do RTN on a method that has ty/const params. Fixes #120208 r? oli-obk