summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2024-03-14Add produces as tidy requiresWesley Wiser-0/+2
(cherry picked from commit ae374cf04a30eac81de24c4fbdfb4d1c7f4f34e4)
2024-03-14Added an "Explanation" header and expanded that section for the newly added ↵Felix S. Klock II-0/+8
lint. (cherry picked from commit 6ca46daded8320dffe437b9008c2b353563af0a5)
2024-03-14downgrade mutable-ptr-in-final-value from hard-error to future-incompat lint ↵Felix S. Klock II-6/+49
to address issue 121610. (cherry picked from commit a8549b4152566d8fbd34c097236df1db3d9afd3c)
2024-03-14AST validation: Improve handling of inherent impls nested within functions ↵León Orell Valerian Liehr-27/+30
and anon consts (cherry picked from commit 7d428db605d305198481b2201f46f5f91d5f8369)
2024-03-04Solaris linker does not support --strip-debugPetr Sumbera-1/+1
Fixes #121381 (cherry picked from commit a17211b05c883eaeb4057f0a9207947bcbcc3688)
2024-03-04Improve wording of static_mut_refObei Sideg-71/+59
Rename `static_mut_ref` lint to `static_mut_refs`. (cherry picked from commit 408eeae59d35cbcaab2cfb345d24373954e74fc5)
2024-02-15Update jobserver-rs to 0.1.28Vadim Petrochenkov-3/+6
(cherry picked from commit 83f3bc42714250633cacadcde8b15da28bf443f0)
2024-02-13Correctly check `never_type` feature gatingGuillaume Gomez-0/+13
(cherry picked from commit 2c0030ff2cb373a31d4dfa7f7cb3596739090ff3)
2024-02-08[Beta 1.77] Fix bootstrapping from 1.76Eric Huss-2/+4
2024-02-03Bump version placeholdersMark Rousskov-6/+6
2024-01-31Rollup merge of #120495 - clubby789:remove-amdgpu-kernel, r=oli-obkNadrieril-42/+17
Remove the `abi_amdgpu_kernel` feature The tracking issue (#51575) has been closed for 3 years, with no activity for 5.
2024-01-31Rollup merge of #120490 - nnethercote:Diagnostic-hashing, r=estebankNadrieril-8/+8
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-31Rollup merge of #120472 - Nilstrieb:die, r=compiler-errorsNadrieril-1/+3
Make duplicate lang items fatal Prevents terminal spam.
2024-01-31Rollup merge of #120469 - estebank:issue-40120, r=TaKO8KiNadrieril-16/+25
Provide more context on derived obligation error primary label Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2024-01-31Rollup merge of #120321 - Nadrieril:cleanup-cx, r=compiler-errorsNadrieril-174/+166
pattern_analysis: cleanup the contexts This cleans up a bit the various `*Ctxt`s I had left lying around. As a bonus this made it possible to make `PatternColumn` public. I don't have a use for that yet but that could come useful. `UsefulnessCtxt` looks useless right now but I'll be adding a field or two in subsequent PRs. r? `````@compiler-errors`````
2024-01-31Auto merge of #120346 - petrochenkov:ownodes, r=oli-obkbors-71/+66
hir: Refactor getters for owner nodes
2024-01-31Auto merge of #120227 - nnethercote:further-improve-space_between, ↵bors-18/+33
r=petrochenkov Further improve `space_between` `space_between` is used by `print_tts` to decide when spaces should be put between tokens. This PR improves it in two ways: - avoid unnecessary spaces before semicolons, and - don't omit some necessary spaces before/after some punctuation symbols. r? `@petrochenkov`
2024-01-30Provide more context on derived obligation error primary labelEsteban Küber-16/+25
Expand the primary span of E0277 when the immediate unmet bound is not what the user wrote: ``` error[E0277]: the trait bound `i32: Bar` is not satisfied --> f100.rs:6:6 | 6 | <i32 as Foo>::foo(); | ^^^ the trait `Bar` is not implemented for `i32`, which is required by `i32: Foo` | help: this trait has no implementations, consider adding one --> f100.rs:2:1 | 2 | trait Bar {} | ^^^^^^^^^ note: required for `i32` to implement `Foo` --> f100.rs:3:14 | 3 | impl<T: Bar> Foo for T {} | --- ^^^ ^ | | | unsatisfied trait bound introduced here ``` Fix #40120.
2024-01-31Don't hash lints differently to non-lints.Nicholas Nethercote-8/+8
`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-30Auto merge of #119101 - compiler-errors:outlives, r=lcnrbors-67/+163
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-30Separate `PlaceCtxt` from `UsefulnessCtxt`Nadrieril-8/+8
2024-01-30Make `PatternColumn` part of the public APINadrieril-90/+101
2024-01-30Repurpose `MatchCtxt` for usefulness onlyNadrieril-23/+21
2024-01-30Limit the use of `PlaceCtxt`Nadrieril-52/+42
2024-01-30Rollup merge of #120485 - chenyukang:yukang-add-query-instability-check, ↵Guillaume Gomez-6/+14
r=michaelwoerister add missing potential_query_instability for keys and values in hashmap From https://github.com/rust-lang/rust/pull/120435#discussion_r1468883787, These API are also returning iterator, so we need add `potential_query_instability` for them?
2024-01-30Rollup merge of #120476 - compiler-errors:lang-items-yeet, r=NilstriebGuillaume Gomez-128/+15
Remove some unnecessary check logic for lang items in HIR typeck Obvious bugs with `#[no_core]` do not deserve customized recovery logic, since they are bugs we do not expect users to ever encounter, and if users are experimenting with `#[no_core]`, they should really be familiar with the compiler implementation. These error recoveries are implemented now only where issues have been reported in the past, rather than systematically validating lang items. See https://github.com/rust-lang/compiler-team/issues/620 > In particular, one-off fixes for particular assumptions about lang items or intrinsics that introduce additional complexity into the compiler are not accepted. r? Nilstrieb
2024-01-30Rollup merge of #120475 - Nilstrieb:cargo-build-my-a-, r=michaelwoeristerGuillaume Gomez-0/+16
Improve error message when `cargo build` is used to build the compiler Inspired by #76446. Doing it for `core` is probably higher value but also way harder because tools like cargo or rustc-build-sysroot would need to be fixed first, which I don't feel like doing.
2024-01-30Rollup merge of #120434 - fmease:revert-speeder, r=petrochenkovGuillaume Gomez-68/+1
Revert outdated version of "Add the wasm32-wasi-preview2 target" An outdated version of #119616 was merged in rollup #120309. This reverts those changes to enable #119616 to “retain the intended diff” after a rebase. ```@rylev``` has agreed that this would be the cleanest approach with respect to the history. Unblocks #119616. r? ```@petrochenkov``` or compiler or libs
2024-01-30Rollup merge of #120342 - oli-obk:track_errors6, r=nnethercoteGuillaume Gomez-165/+183
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-30Rollup merge of #120293 - estebank:issue-102629, r=nnethercoteGuillaume Gomez-10/+38
Deduplicate more sized errors on call exprs Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
2024-01-30Rollup merge of #118533 - chenyukang:yukang-fix-118455, r=petrochenkovGuillaume Gomez-18/+27
Suppress unhelpful diagnostics for unresolved top level attributes Fixes #118455, unresolved top level attribute error didn't imported prelude and already have emitted an error, report builtin macro and attributes error by the way, so `check_invalid_crate_level_attr` in can ignore them. Also fixes #89566, fixes #67107. r? `@petrochenkov`
2024-01-30Make `PatternColumn` generic in `Cx`Nadrieril-27/+20
2024-01-30Remove the `abi_amdgpu_kernel` featureclubby789-42/+17
2024-01-30hir: Remove `hir::Map::{owner,expect_owner}`Vadim Petrochenkov-17/+9
2024-01-30hir: Add non-optional `hir_owner_nodes` for real `OwnerId`sVadim Petrochenkov-46/+54
2024-01-30hir: Simplify `hir_owner_nodes` queryVadim Petrochenkov-17/+12
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-149/+143
Diagnostic lifetimes cleanups Some diagnostic simplifications. r? `@oli-obk`
2024-01-30Rollup merge of #120460 - nnethercote:fix-120397, r=compiler-errorsGuillaume Gomez-10/+25
Be more careful about interpreting a label/lifetime as a mistyped char literal. Currently the parser interprets any label/lifetime in certain positions as a mistyped char literal, on the assumption that the trailing single quote was accidentally omitted. In such cases it gives an error with a suggestion to add the trailing single quote, and then puts the appropriate char literal into the AST. This behaviour was introduced in #101293. This is reasonable for a case like this: ``` let c = 'a; ``` because `'a'` is a valid char literal. It's less reasonable for a case like this: ``` let c = 'abc; ``` because `'abc'` is not a valid char literal. Prior to #120329 this could result in some sub-optimal suggestions in error messages, but nothing else. But #120329 changed `LitKind::from_token_lit` to assume that the char/byte/string literals it receives are valid, and to assert if not. This is reasonable because the lexer does not produce invalid char/byte/string literals in general. But in this "interpret label/lifetime as unclosed char literal" case the parser can produce an invalid char literal with contents such as `abc`, which triggers an assertion failure. This PR changes the parser so it's more cautious about interpreting labels/lifetimes as unclosed char literals. Fixes #120397. r? `@compiler-errors`
2024-01-30Rollup merge of #120443 - GuillaumeGomez:footnote-def-improvement, r=fmeaseGuillaume Gomez-1/+1
Fixes footnote handling in rustdoc Fixes #100638. You can now declare footnotes like this: ```rust //! Reference to footnotes A[^1], B[^2] and C[^3]. //! //! [^1]: Footnote A. //! [^2]: Footnote B. //! [^3]: Footnote C. ``` r? `@notriddle`
2024-01-30Rollup merge of #120425 - DaniPopes:query-default-return, r=NilstriebGuillaume Gomez-14/+14
Remove unnecessary unit returns in query declarations For consistency with normal functions.
2024-01-30Rollup merge of #120402 - compiler-errors:async-closure-def-tree, r=cjgillotGuillaume Gomez-6/+12
Make the coroutine def id of an async closure the child of the closure def id Adjust def collection to make the (inner) coroutine returned by an async closure be a def id child of the (outer) closure. This makes it easy to map from coroutine -> closure by using `tcx.parent`, since currently it's not trivial to do this.
2024-01-30Rollup merge of #120400 - estebank:bound-error-cleanup, r=oli-obkGuillaume Gomez-33/+68
Bound errors span label cleanup Consolidate span labels for "this type doesn't satisfy a bound" for more compact diagnostic output.
2024-01-30Rollup merge of #120387 - RalfJung:large-array-followup, r=oli-obkGuillaume Gomez-5/+4
interpret/memory: fix safety comment for large array memset optimization Also fix the doc comment for `check_and_deref_ptr`.
2024-01-30Remove the second lifetime from `DiagnosticArg`.Nicholas Nethercote-5/+5
Because it's always static. I'm surprised the compiler allowed this unused lifetime without any complaint.
2024-01-30Remove the lifetime from `DiagnosticArgName`.Nicholas Nethercote-9/+5
Because it's always 'static.
2024-01-30Remove `DiagnosticArgName` from `rustc_codegen_ssa`.Nicholas Nethercote-10/+11
It's identical to the one in `rustc_errors`; use that instead. Also remove some `rustc_errors::` qualifiers.
2024-01-30Remove lifetimes from some diagnostics.Nicholas Nethercote-18/+18
Because the `&'a str` fields can be trivially converted to `String` without causing any extra allocations.
2024-01-30Remove the lifetime from `DiagnosticArgValue`.Nicholas Nethercote-115/+112
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-30Auto merge of #119744 - lcnr:assemble-only-rigid, r=compiler-errorsbors-196/+70
only assemble alias bound candidates for rigid aliases fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/77 This also causes `<Wrapper<?0> as Trait>::Unwrap: Trait` to always be ambig, as we now normalize the self type before checking whether it is an inference variable. I cannot think of an approach to the underlying issues here which does not require the "may-define means must-define" restriction for opaque types. Going to go ahead with this and added this restriction to the tracking issue for the new solver to make sure we don't stabilize it without getting types + lang signoff here. r? `@compiler-errors`
2024-01-30add missing potential_query_instability for keys and values in hashmapyukang-6/+14