about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
AgeCommit message (Collapse)AuthorLines
2023-04-21fix(error): normalize whitespace during msg_to_bufferbohan-0/+1
2023-04-19Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwcobors-1/+1
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros` Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-18Auto merge of #110083 - saethlin:encode-hashes-as-bytes, r=cjgillotbors-2/+2
Encode hashes as bytes, not varint In a few places, we store hashes as `u64` or `u128` and then apply `derive(Decodable, Encodable)` to the enclosing struct/enum. It is more efficient to encode hashes directly than try to apply some varint encoding. This PR adds two new types `Hash64` and `Hash128` which are produced by `StableHasher` and replace every use of storing a `u64` or `u128` that represents a hash. Distribution of the byte lengths of leb128 encodings, from `x build --stage 2` with `incremental = true` Before: ``` ( 1) 373418203 (53.7%, 53.7%): 1 ( 2) 196240113 (28.2%, 81.9%): 3 ( 3) 108157958 (15.6%, 97.5%): 2 ( 4) 17213120 ( 2.5%, 99.9%): 4 ( 5) 223614 ( 0.0%,100.0%): 9 ( 6) 216262 ( 0.0%,100.0%): 10 ( 7) 15447 ( 0.0%,100.0%): 5 ( 8) 3633 ( 0.0%,100.0%): 19 ( 9) 3030 ( 0.0%,100.0%): 8 ( 10) 1167 ( 0.0%,100.0%): 18 ( 11) 1032 ( 0.0%,100.0%): 7 ( 12) 1003 ( 0.0%,100.0%): 6 ( 13) 10 ( 0.0%,100.0%): 16 ( 14) 10 ( 0.0%,100.0%): 17 ( 15) 5 ( 0.0%,100.0%): 12 ( 16) 4 ( 0.0%,100.0%): 14 ``` After: ``` ( 1) 372939136 (53.7%, 53.7%): 1 ( 2) 196240140 (28.3%, 82.0%): 3 ( 3) 108014969 (15.6%, 97.5%): 2 ( 4) 17192375 ( 2.5%,100.0%): 4 ( 5) 435 ( 0.0%,100.0%): 5 ( 6) 83 ( 0.0%,100.0%): 18 ( 7) 79 ( 0.0%,100.0%): 10 ( 8) 50 ( 0.0%,100.0%): 9 ( 9) 6 ( 0.0%,100.0%): 19 ``` The remaining 9 or 10 and 18 or 19 are `u64` and `u128` respectively that have the high bits set. As far as I can tell these are coming primarily from `SwitchTargets`.
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+1
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-18Store hashes in special types so they aren't accidentally encoded as numbersBen Kimock-2/+2
2023-04-17Spelling - compilerJosh Soref-1/+1
* account * achieved * advising * always * ambiguous * analysis * annotations * appropriate * build * candidates * cascading * category * character * clarification * compound * conceptually * constituent * consts * convenience * corresponds * debruijn * debug * debugable * debuggable * deterministic * discriminant * display * documentation * doesn't * ellipsis * erroneous * evaluability * evaluate * evaluation * explicitly * fallible * fulfill * getting * has * highlighting * illustrative * imported * incompatible * infringing * initialized * into * intrinsic * introduced * javascript * liveness * metadata * monomorphization * nonexistent * nontrivial * obligation * obligations * offset * opaque * opportunities * opt-in * outlive * overlapping * paragraph * parentheses * poisson * precisely * predecessors * predicates * preexisting * propagated * really * reentrant * referent * responsibility * rustonomicon * shortcircuit * simplifiable * simplifications * specify * stabilized * structurally * suggestibility * translatable * transmuting * two * unclosed * uninhabited * visibility * volatile * workaround Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-13Rollup merge of #110072 - joshtriplett:stabilize-is-terminal, r=Mark-SimulacrumMatthias Krüger-1/+0
Stabilize IsTerminal FCP completed in https://github.com/rust-lang/rust/issues/98070 . closes: https://github.com/rust-lang/rust/issues/98070
2023-04-13Auto merge of #109786 - estebank:tweak-add-line-sugg, r=compiler-errorsbors-1/+49
Tweak output for 'add line' suggestion Closes #108174
2023-04-12Special-case item attributes in the suggestion outputEsteban Küber-1/+10
2023-04-12Tweak output for 'add line' suggestionEsteban Küber-1/+40
2023-04-12Rollup merge of #110135 - compiler-errors:revert-108031, r=davidtwcoMatthias Krüger-2/+0
Revert "Don't recover lifetimes/labels containing emojis as character literals" Reverts PR #108031 per https://github.com/rust-lang/rust/pull/109754#issuecomment-1490452045 Fixes (doesnt close until beta backported) #109746 This reverts commit e3f9db5fc319c6d8eee5d47d216ea6a426070c41. This reverts commit 98b82aedba3f3f581e89df54352914b27f42c6f7. This reverts commit 380fa264132ad481e73cbbf0f3a0feefd99a1d78.
2023-04-11Auto merge of #110092 - clubby789:builtin-macros-translatable, r=compiler-errorsbors-2/+29
Migrate most of `rustc_builtin_macros` to diagnostic impls cc #100717 This is a couple of days work, but I decided to stop for now before the PR becomes too big. There's around 50 unresolved failures when `rustc::untranslatable_diagnostic` is denied, which I'll finish addressing once this PR goes thtough A couple of outputs have changed, but in all instances I think the changes are an improvement/are more consistent with other diagnostics (although I'm happy to revert any which seem worse)
2023-04-10Migrate most of `rustc_builtin_macros` to diagnostic implsclubby789-2/+29
Co-authored-by: Joe ST <joe@fbstj.net> Co-authored-by: Michael Goulet <michael@errs.io>
2023-04-10Stabilize IsTerminalJosh Triplett-1/+0
closes: https://github.com/rust-lang/rust/issues/98070
2023-04-10Revert "Don't recover lifetimes/labels containing emojis as character literals"Michael Goulet-2/+0
Reverts PR #108031 Fixes (doesnt close until beta backported) #109746 This reverts commit e3f9db5fc319c6d8eee5d47d216ea6a426070c41. This reverts commit 98b82aedba3f3f581e89df54352914b27f42c6f7. This reverts commit 380fa264132ad481e73cbbf0f3a0feefd99a1d78.
2023-04-09Fix some clippy::complexityNilstrieb-6/+6
2023-04-01a couple clippy::complexity fixesMatthias Krüger-1/+1
map_identity filter_next option_as_ref_deref unnecessary_find_map redundant_slicing unnecessary_unwrap bool_comparison derivable_impls manual_flatten needless_borrowed_reference
2023-03-28Create AnnotationColumn struct to fix hard tab column numbers in errorspommicket-36/+85
2023-03-21Rollup merge of #109403 - chenyukang:yukang/fix-109396, r=estebankMatthias Krüger-1/+1
Avoid ICE of attempt to add with overflow in emitter Fixes #109396 r? ```@estebank```
2023-03-21Avoid ICE of attempt to add with overflow in emitteryukang-1/+1
2023-03-20migrate compiler, bootstrap, and compiletest to windows-rsAndy Russell-45/+36
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
2023-03-04Properly colorize multi-part suggestions in the same lineEsteban Küber-6/+6
Fix #108547.
2023-02-26Rollup merge of #108482 - Ezrashaw:force-error-docs, r=GuillaumeGomezMatthias Krüger-12/+6
statically guarantee that current error codes are documented Closes #61137 (that's right!) Pretty simple refactor (often just a change from `Result<Option<&str>>` to `Result<&str>`) r? `@GuillaumeGomez` (could you specially look at 53044158eff0d64673a6100f701c57b484232aca? I believe you wrote that in the first place, just want to make sure you're happy with the change)
2023-02-26Rollup merge of #108379 - compiler-errors:hir-error-guaranteed, r=cjgillotMatthias Krüger-15/+1
Add `ErrorGuaranteed` to `hir::{Expr,Ty}Kind::Err` variants First step in making the `Err` variants of `ExprKind` and `TyKind` require an `ErrorGuaranteed` during parsing. Making the corresponding AST versions require `ErrorGuaranteed` is a bit harder, whereas it was pretty easy to do this for HIR, so let's do that first. The only weird thing about this PR is that `ErrorGuaranteed` is moved to `rustc_span`. This is *certainly* not the right place to put it, but `rustc_hir` cannot depend on `rustc_error` because the latter already depends on the former. Should I just pull out some of the error machinery from `rustc_error` into an even more minimal crate that `rustc_hir` can depend on? Advice would be appreciated.
2023-02-26refactor: statically guarantee that current error codes are documentedEzra Shaw-12/+6
2023-02-26Rollup merge of #108456 - clubby789:ast-passes-diag-migrate, r=compiler-errorsMatthias Krüger-0/+1
Complete migrating `ast_passes` to derive diagnostics cc #100717 ```@rustbot``` label +A-translation
2023-02-25Add ErrorGuaranteed to HIR TyKind::ErrMichael Goulet-15/+1
2023-02-25Complete migrating `ast_passes` to derive diagnosticsclubby789-0/+1
2023-02-23Restore behavior when primary bundle is missingmejrs-4/+13
2023-02-22various: translation resources from cg backendDavid Wood-2/+2
Extend `CodegenBackend` trait with a function returning the translation resources from the codegen backend, which can be added to the complete list of resources provided to the emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: fix translation's run-make testDavid Wood-2/+11
`run-make/translation` had some targets that weren't listed in `all` and thus weren't being tested - the behaviour that should have been being tested was basically correct fortunately. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-22errors: generate typed identifiers in each crateDavid Wood-7/+8
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-18Rollup merge of #108031 - jieyouxu:issue-108019, r=estebankMatthias Krüger-0/+2
Don't recover lifetimes/labels containing emojis as character literals Fixes #108019. Note that at the time of this commit, `unic-emoji-char` seems to have data tables only up to Unicode 5.0, but Unicode is already newer than this. A newer emoji such as `🥺` will not be recognized as an emoji but older emojis such as `🐱` will. This PR leaves a couple of FIXMEs where `unic_emoji_char::is_emoji` is used.
2023-02-16Rollup merge of #108090 - WaffleLapkin:if_not_now_then_when…, r=oli-obkMatthias Krüger-16/+13
`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)` Resurrection of #108079
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-16/+13
2023-02-14rebase and review commentsEsteban Küber-2/+1
2023-02-14More accurate spans for arg removal suggestionEsteban Küber-2/+4
2023-02-14Don't recover lifetimes/labels containing emojis as character literals许杰友 Jieyou Xu (Joe)-0/+2
Note that at the time of this commit, `unic-emoji-char` seems to have data tables only up to Unicode 5.0, but Unicode is already newer than this. A newer emoji such as `🥺` will not be recognized as an emoji but older emojis such as `🐱` will.
2023-02-13Rollup merge of #107838 - estebank:terminal_hyperlinks, r=nagisaMatthias Krüger-3/+34
Introduce `-Zterminal-urls` to use OSC8 for error codes Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-09Introduce `-Zterminal-urls` to use OSC8 for error codesEsteban Küber-3/+34
Terminals supporting the OSC8 Hyperlink Extension can support inline anchors where the text is user defineable but clicking on it opens a browser to a specified URLs, just like `<a href="URL">` does in HTML. https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
2023-02-09test: snapshot for derive suggestion in diff filesbohan-11/+11
2023-02-05Clean up and comment EmitterWriter.draw_code_lineCastilloDel-59/+32
2023-02-04Fix suggestions rendering when the span is multilineCastilloDel-17/+63
2023-02-01Make "use latest edition" subdiagnostic translatableXiretza-38/+1
2023-02-01Implement IntoDiagnosticArg for ast::VisibilityXiretza-0/+8
2023-02-01Use AddToDiagnostic for "use latest edition" helpXiretza-14/+37
2023-01-31Rollup merge of #107467 - WaffleLapkin:uneq, r=oli-obkGuillaume Gomez-24/+32
Improve enum checks Some light refactoring.
2023-01-30session: diagnostic migration lint on more fnsDavid Wood-15/+99
Apply the diagnostic migration lint to more functions on `Session`. Signed-off-by: David Wood <david.wood@huawei.com>
2023-01-30errors: implement `IntoDiagnosticArg` for `&T`David Wood-0/+6
Implement `IntoDiagnosticArg` for `&'a T` when `T` implements `IntoDiagnosticArg` and `Clone`. Makes it easier to write diagnostic structs that borrow something which implements `IntoDiagnosticArg`. Signed-off-by: David Wood <david.wood@huawei.com>