about summary refs log tree commit diff
path: root/compiler/rustc_errors
AgeCommit message (Collapse)AuthorLines
2025-02-25Auto merge of #137571 - tgross35:rollup-i1tcnv1, r=tgross35bors-1/+0
Rollup of 8 pull requests Successful merges: - #134655 (Stabilize `hash_extract_if`) - #135933 (Explain how Vec::with_capacity is faithful) - #136668 (Stabilize `core::str::from_utf8_mut` as `const`) - #136775 (Update `String::from_raw_parts` safety requirements) - #137109 (stabilize extract_if) - #137349 (Implement `read_buf` for zkVM stdin) - #137493 (configure.py: don't instruct user to run nonexistent program) - #137516 (remove some unnecessary rustc_const_unstable) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-24Introduce new-style attribute parsers for several attributesJana Dönszelmann-0/+8
note: compiler compiles but librustdoc and clippy don't
2025-02-23stabilize extract_ifbendn-1/+0
2025-02-22Rollup merge of #137333 - compiler-errors:edition-2024-fresh, r=NadrierilMatthias Krüger-1/+1
Use `edition = "2024"` in the compiler (redux) Most of this is binding mode changes, which I fixed by running `x.py fix`. Also adds some miscellaneous `unsafe` blocks for new unsafe standard library functions (the setenv ones), and a missing `unsafe extern` block in some enzyme codegen code, and fixes some precise capturing lifetime changes (but only when they led to errors). cc ``@ehuss`` ``@traviscross``
2025-02-22Remove MaybeForgetReturn suggestionMichael Goulet-1/+0
2025-02-22Upgrade the compiler to edition 2024Michael Goulet-1/+1
2025-02-21Trim suggestion part before generating highlightsMichael Goulet-7/+7
2025-02-21More sophisticated span trimmingMichael Goulet-11/+34
2025-02-16Move hashes from rustc_data_structure to rustc_hashes so they can be shared ↵Ben Kimock-1/+3
with rust-analyzer
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-6/+34
2025-02-14Consider add-prefix replacements tooMichael Goulet-3/+4
2025-02-14Use underline suggestions for purely 'additive' replacementsMichael Goulet-1/+13
2025-02-11compiler: replace ExternAbi::name calls with formattersJubilee Young-0/+1
Most of these just format the ABI string, so... just format ExternAbi? This makes it more consistent and less jank when we can do it.
2025-02-11Rollup merge of #136847 - nnethercote:simplify-intra-crate-quals, r=oli-obkMatthias Krüger-2/+2
Simplify intra-crate qualifiers. The following is a weird pattern for a file within `rustc_middle`: ``` use rustc_middle::aaa; use crate::bbb; ``` More sensible and standard would be this: ``` use crate::{aaa, bbb}; ``` I.e. we generally prefer using `crate::` to using a crate's own name. (Exceptions are things like in macros where `crate::` doesn't work because the macro is used in multiple crates.) This commit fixes a bunch of these weird qualifiers. r? `@jieyouxu`
2025-02-11Simplify intra-crate qualifiers.Nicholas Nethercote-2/+2
The following is a weird pattern for a file within `rustc_middle`: ``` use rustc_middle::aaa; use crate::bbb; ``` More sensible and standard would be this: ``` use crate::{aaa, bbb}; ``` I.e. we generally prefer using `crate::` to using a crate's own name. (Exceptions are things like in macros where `crate::` doesn't work because the macro is used in multiple crates.) This commit fixes a bunch of these weird qualifiers.
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-1/+1
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-08Rustfmtbjorn3-64/+96
2025-02-06Rollup merge of #136636 - bjorn3:error_cleanup, r=compiler-errorsMatthias Krüger-2/+2
Couple of minor cleanups to the diagnostic infrastructure
2025-02-06Rollup merge of #136580 - bjorn3:miri_fixes, r=lqdMatthias Krüger-1/+1
Couple of changes to run rustc in miri This is not the full set of patches required to run rustc in miri, but it is the fast majority of the changes to rustc itself. There is also a change to the jobserver crate necessary and on arm64 a change to the memchr crate. Running rustc in miri has already found some UB: https://github.com/rust-lang/rust/pull/136579 cc https://github.com/rust-lang/rust/issues/135870#issuecomment-2612470540
2025-02-06Avoid manually producing FatalError in a couple of placesbjorn3-2/+2
2025-02-05Couple of changes to run rustc in miribjorn3-1/+1
2025-02-03tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`Askar Safin-24/+26
2025-02-02Rollup merge of #136445 - bjorn3:diag_ctxt_cleanup, r=oli-obkMatthias Krüger-43/+27
Couple of cleanups to DiagCtxt and EarlyDiagCtxt
2025-02-02Rollup merge of #136415 - estebank:highlight-clarification, r=compiler-errorsMatthias Krüger-5/+15
Highlight clarifying information in "expected/found" error When the expected and found types have the same textual representation, we add clarifying in parentheses. We now visually highlight it in the output. Detect a corner case where the clarifying information would be the same for both types and skip it, as it doesn't add anything useful. ![Screenshot of the rustc highlighted output on the terminal](https://github.com/user-attachments/assets/aa4b9433-5332-4941-b2c2-1a43e5cadff7)
2025-02-02Replace ParseSess::set_dcx with DiagCtxt::set_emitterbjorn3-0/+4
Replacing the error emitter doesn't accidentally clear the error count.
2025-02-02Use fallback fluent bundle from inner emitter in SilentEmitterbjorn3-11/+2
2025-02-02Slightly simplify DiagCtxt::make_silentbjorn3-33/+22
2025-02-02Rollup merge of #136368 - estebank:listify, r=fee1-deadMatthias Krüger-13/+1
Make comma separated lists of anything easier to make for errors Provide a new function `listify`, meant to be used in cases similar to `pluralize!`. When you have a slice of arbitrary elements that need to be presented to the user, `listify` allows you to turn that into a list of comma separated strings. This reduces a lot of redundant logic that happens often in diagnostics.
2025-02-02Highlight clarifying information in "expected/found" errorEsteban Küber-5/+15
When the expected and found types have the same textual representation, we add clarifying in parentheses. We now visually highlight it in the output. Detect a corner case where the clarifying information would be the same for both types and skip it, as it doesn't add anything useful.
2025-01-31Rework "long type names" printing logicEsteban Küber-0/+31
Make it so more type-system types can be printed in a shortened version (like `Predicate`s). Centralize printing the information about the "full type name path". Make the "long type path" for the file where long types are written part of `Diag`, so that it becomes easier to keep track of it, and ensure it will always will be printed out last in the diagnostic by making its addition to the output implicit. Tweak the shortening of types in "expected/found" labels. Remove dead file `note.rs`.
2025-01-31Make comma separated lists of anything easier to make for errorsEsteban Küber-13/+1
Provide a new function `listify`, meant to be used in cases similar to `pluralize!`. When you have a slice of arbitrary elements that need to be presented to the user, `listify` allows you to turn that into a list of comma separated strings. This reduces a lot of redundant logic that happens often in diagnostics.
2025-01-25Auto merge of #119286 - jyn514:linker-output, r=bjorn3bors-18/+31
show linker output even if the linker succeeds Show stderr and stderr by default, controlled by a new `linker_messages` lint. fixes https://github.com/rust-lang/rust/issues/83436. fixes https://github.com/rust-lang/rust/issues/38206. cc https://rust-lang.zulipchat.com/#narrow/stream/233931-t-compiler.2Fmajor-changes/topic/uplift.20some.20-Zverbose.20calls.20and.20rename.20to.E2.80.A6.20compiler-team.23706/near/408986134 <!-- try-job: dist-x86_64-msvc --> try-job: aarch64-apple r? `@bjorn3`
2025-01-21bumpt compiler and tools to windows 0.59klensy-1/+1
2025-01-20don't ICE when emitting linker errors during `-Z link-only`jyn-18/+31
note that this still ICEs when passed `-Z link-only --error-format json` because i can't be bothered to fix it right now
2025-01-19Manual cleanup of some `is_{or_none|some_and}` usagesYotam Ofek-2/+4
2025-01-19Run `clippy --fix` for `unnecessary_map_or` lintYotam Ofek-3/+3
2025-01-12Auto merge of #135402 - matthiaskrgr:rollup-cz7hs13, r=matthiaskrgrbors-2/+0
Rollup of 6 pull requests Successful merges: - #129259 (Add inherent versions of MaybeUninit methods for slices) - #135374 (Suggest typo fix when trait path expression is typo'ed) - #135377 (Make MIR cleanup for functions with impossible predicates into a real MIR pass) - #135378 (Remove a bunch of diagnostic stashing that doesn't do anything) - #135397 (compiletest: add erroneous variant to `string_enum`s conversions error) - #135398 (add more crash tests) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-11Remove a bunch of diagnostic stashing that doesn't do anythingMichael Goulet-2/+0
2025-01-11fix `it's` -> `its` in doc commentYotam Ofek-1/+1
2024-12-31Convert some Into impls into From implsMichael Goulet-3/+3
2024-12-26Account for removal of multiline span in suggestionEsteban Küber-7/+79
When highlighting the removed parts of a suggestion, properly account for spans that cover more than one line. Fix #134485.
2024-12-20Rollup merge of #134366 - harrisonkaiser:no-break-space, r=davidtwcoDianQK-2/+9
Fix logical error with what text is considered whitespace. There appears to be a logical issue around what counts as leading white-space. There is code which does a subtraction assuming that no errors will be reported inside the leading whitespace. However we compute the length of that whitespace with std::char::is_whitespace and not rustc_lexer::is_whitespace. The former will include a no-break space while later will excluded it. We can only safely make the assumption that no errors will be reported in whitespace if it is all "Rust Standard" whitespace. Indeed an error does occur in unicode whitespace if it contains a no-break space. In that case the subtraction will cause a ICE (for a compiler in debug mode) as described in https://github.com/rust-lang/rust/issues/132918.
2024-12-18chore: fix some typosacceptacross-2/+2
Signed-off-by: acceptacross <csqcqs@gmail.com>
2024-12-18Auto merge of #134243 - nnethercote:re-export-more-rustc_span, r=jieyouxubors-4/+2
Re-export more `rustc_span::symbol` things from `rustc_span`. `rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers to `rustc_span::`. This is a 300+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one. r? `@jieyouxu`
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-4/+2
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-16Fix logical error with what text is considered whitespace.Harrison Kaiser-2/+9
There is a logical issue around what counts as leading white-space. There is code which does a subtraction assuming that no errors will be reported inside the leading whitespace. However we compute the length of that whitespace with std::char::is_whitespace and not rustc_lexer::is_whitespace. The former will include a no-break space while later will excluded it. We can only safely make the assumption that no errors will be reported in whitespace if it is all "Rust Standard" whitespace. Indeed an error does occur in unicode whitespace if it contains a no-break space.
2024-12-16update uses of extract_if in the compilerThe 8472-4/+4
2024-12-14Rollup merge of #134181 - estebank:trim-render, r=oli-obkMatthias Krüger-3/+12
Tweak multispan rendering to reduce output length Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments. We do that check not only on the first 4 lines of the multispan, but now also on the previous to last line as well.
2024-12-13Account for `///` when rendering multiline spansEsteban Küber-8/+9
Don't consider `///` and `//!` docstrings to be empty for the purposes of multiline span rendering.
2024-12-12Filter empty lines, comments and delimiters from previous to last multiline ↵Esteban Küber-1/+5
span rendering