about summary refs log tree commit diff
path: root/compiler/rustc_errors/src
AgeCommit message (Collapse)AuthorLines
2021-03-27Fix compiler docsJoshua Nelson-0/+9
2021-03-27Remove (lots of) dead codeJoshua Nelson-82/+8
Found with https://github.com/est31/warnalyzer. Dubious changes: - Is anyone else using rustc_apfloat? I feel weird completely deleting x87 support. - Maybe some of the dead code in rustc_data_structures, in case someone wants to use it in the future? - Don't change rustc_serialize I plan to scrap most of the json module in the near future (see https://github.com/rust-lang/compiler-team/issues/418) and fixing the tests needed more work than I expected. TODO: check if any of the comments on the deleted code should be kept.
2021-03-27Remove unused `DiagnosticBuilder::sub` functionJoshua Nelson-13/+2
`Diagnostic::sub` is only ever used directly; it doesn't need to be included in the builder.
2021-03-27Rollup merge of #82917 - cuviper:iter-zip, r=m-ou-seDylan DPC-5/+5
Add function core::iter::zip This makes it a little easier to `zip` iterators: ```rust for (x, y) in zip(xs, ys) {} // vs. for (x, y) in xs.into_iter().zip(ys) {} ``` You can `zip(&mut xs, &ys)` for the conventional `iter_mut()` and `iter()`, respectively. This can also support arbitrary nesting, where it's easier to see the item layout than with arbitrary `zip` chains: ```rust for ((x, y), z) in zip(zip(xs, ys), zs) {} for (x, (y, z)) in zip(xs, zip(ys, zs)) {} // vs. for ((x, y), z) in xs.into_iter().zip(ys).zip(xz) {} for (x, (y, z)) in xs.into_iter().zip((ys.into_iter().zip(xz)) {} ``` It may also format more nicely, especially when the first iterator is a longer chain of methods -- for example: ```rust iter::zip( trait_ref.substs.types().skip(1), impl_trait_ref.substs.types().skip(1), ) // vs. trait_ref .substs .types() .skip(1) .zip(impl_trait_ref.substs.types().skip(1)) ``` This replaces the tuple-pair `IntoIterator` in #78204. There is prior art for the utility of this in [`itertools::zip`]. [`itertools::zip`]: https://docs.rs/itertools/0.10.0/itertools/fn.zip.html
2021-03-27lazily calls some fnsklensy-1/+1
2021-03-26Use iter::zip in compiler/Josh Stone-5/+5
2021-03-24small cleanups in rustc_errors / emitterAndre Bogus-20/+14
2021-03-17Remove unnecessary `forward_inner_docs` hackJoshua Nelson-15/+7
and replace it with `extended_key_value_attributes` feature.
2021-03-06Change x64 size checks to not apply to x32.Harald van Dijk-1/+1
Rust contains various size checks conditional on target_arch = "x86_64", but these checks were never intended to apply to x86_64-unknown-linux-gnux32. Add target_pointer_width = "64" to the conditions.
2021-02-27Even faster counting of digits for error line numbersAndre Bogus-12/+26
2021-02-25Rollup merge of #82087 - estebank:abolish-ice, r=oli-obkDylan DPC-0/+6
Fix ICE caused by suggestion with no code substitutions Change suggestion logic to filter and checking _before_ creating specific resolution suggestion. Assert earlier that suggestions contain code substitions to make it easier in the future to debug invalid uses. If we find this becomes too noisy in the wild, we can always make the emitter resilient to these cases and remove the assertions. Fix #78651.
2021-02-23Rollup merge of #82255 - nhwn:nonzero-err-as-bug, r=davidtwcoDylan DPC-6/+7
Make `treat_err_as_bug` Option<NonZeroUsize> `rustc -Z treat-err-as-bug=N` already requires `N` to be nonzero when the argument is parsed, so changing the type from `Option<usize>` to `Option<NonZeroUsize>` is a low-hanging fruit in terms of layout optimization.
2021-02-18nhwn: optimize counting digits in line numbersNathan Nguyen-1/+12
2021-02-18nhwn: make treat_err_as_bug Option<NonZeroUsize>Nathan Nguyen-6/+7
2021-02-13Fix ICE caused by suggestion with no code substitutionsEsteban Küber-0/+6
Change suggestion logic to filter and checking _before_ creating specific resolution suggestion. Assert earlier that suggestions contain code substitions to make it easier in the future to debug invalid uses. If we find this becomes too noisy in the wild, we can always make the emitter resilient to these cases and remove the assertions. Fix #78651.
2021-02-07Make sure all fields are accounted for in `encode_fields!`Jeremy Fitzhardinge-4/+31
This will make sure the encoder will get updated if any new fields are added to Diagnostic.
2021-02-07Implement Encoder for Diagnostic manuallyJeremy Fitzhardinge-1/+37
...so we can skip serializing `tool_metadata` if it hasn't been set. This makes the output a bit cleaner, and avoiding having to update a bunch of unrelated tests.
2021-02-07Add `--extern-loc` to augment unused crate dependency diagnosticsJeremy Fitzhardinge-1/+64
This allows a build system to indicate a location in its own dependency specification files (eg Cargo's `Cargo.toml`) which can be reported along side any unused crate dependency. This supports several types of location: - 'json' - provide some json-structured data, which is included in the json diagnostics in a `tool_metadata` field - 'raw' - emit the provided string into the output. This also appears as a json string in `tool_metadata`. If no `--extern-location` is explicitly provided then a default json entry of the form `"tool_metadata":{"name":<cratename>,"path":<cratepath>}` is emitted.
2021-02-03Make panic/assert calls in rustc compatible with Rust 2021.Mara Bos-2/+2
2021-02-03Reduce tab formatting assertions to debug onlyJ. Ryan Stinnett-2/+2
The tab replacement for diagnostics added in #79757 included a few assertions to ensure all tab characters are handled appropriately. We've started getting reports of these assertions firing (#81614). Since it's only a cosmetic issue, this downgrades the assertions to debug only, so we at least continue compiling even if the diagnostics might be a tad wonky. Fixes #81614
2021-02-02Bump rustfmt versionMark Rousskov-6/+11
Also switches on formatting of the mir build module
2021-01-26Avoid describing a method as 'not found' when bounds are unsatisfiedAaron Hill-4/+4
Fixes #76267 When there is a single applicable method candidate, but its trait bounds are not satisfied, we avoid saying that the method is "not found". Insted, we update the error message to directly mention which bounds are not satisfied, rather than mentioning them in a note.
2021-01-14Use Option::map_or instead of `.map(..).unwrap_or(..)`LingMan-2/+2
2021-01-12Rollup merge of #79757 - jryans:long-line-tab-handling-early-expand, r=estebankYuki Okushi-29/+23
Replace tabs earlier in diagnostics This replaces tabs earlier in the diagnostics emitting process, which allows various margin calculations to ignore the existence of tabs. It does add a string copy for the source lines that are emitted. Fixes https://github.com/rust-lang/rust/issues/78438 r? `@estebank`
2020-12-18Switch compiler/ to intra-doc linksJoshua Nelson-2/+0
rustc_lint and rustc_lint_defs weren't switched because they're included in the compiler book and so can't use intra-doc links.
2020-12-16Fix typo in method nameCamelid-2/+2
unsuccessfull -> unsuccessful
2020-12-16Add more documentation to `Diagnostic` and `DiagnosticBuilder`Camelid-11/+50
2020-12-09Replace tabs earlier in diagnosticsJ. Ryan Stinnett-29/+23
This replaces tabs earlier in the diagnostics emitting process, which allows various margin calculations to ignore the existence of tabs. It does add a string copy for the source lines that are emitted.
2020-11-17Rollup merge of #74293 - GuillaumeGomez:rustdoc-test-compiler-output-color, ↵Mara Bos-0/+17
r=jyn514 Rustdoc test compiler output color Fixes #72915 We just need to be sure it doesn't break rustdoc doctests' compilation checks. Maybe some other unforeseen consequences too? r? `@ehuss` cc `@rust-lang/rustdoc`
2020-11-17Simplfy color availability checkGuillaume Gomez-0/+17
2020-11-16clarify `span_label` documentationAndy Russell-8/+10
2020-11-03Auto merge of #76931 - oli-obk:const_prop_inline_lint_madness, r=wesleywiserbors-2/+5
Properly handle lint spans after MIR inlining The first commit shows what happens when we apply mir inlining and then cause lints on the inlined MIR. The second commit fixes that. r? `@wesleywiser`
2020-10-30Some workAaron Hill-2/+8
2020-10-30Implement rustc side of report-future-incompatAaron Hill-39/+136
2020-10-30Fix even more clippy warningsJoshua Nelson-16/+4
2020-10-29Fix typosDániel Buga-2/+2
2020-10-27Address review commentoli-1/+2
2020-10-27Show the inline stack of MIR lints that only occur after inliningOliver Scherer-2/+4
2020-10-14Remove unused code from remaining compiler cratesest31-15/+0
2020-09-23/nightly/nightly-rustcErik Hofmayer-1/+1
2020-09-23Updated html_root_url for compiler cratesErik Hofmayer-1/+1
2020-09-21Rollup merge of #76846 - botika:master, r=davidtwcoRalf Jung-21/+13
Avoiding unnecesary allocations at rustc_errors Simplify the code avoiding allocations with easy alternative
2020-09-18use matches!() macro for simple if let conditionsMatthias Krüger-5/+3
2020-09-18Simplify panic_if_treat_err_as_bug avoiding allocationsJuan Aguilar Santillana-7/+5
2020-09-17Remove redundant to_stringJuan Aguilar Santillana-14/+8
2020-09-11replacing sub's that can wrap by saturating_sub'sAurélien Deharbe-3/+3
2020-09-02rustc_{errors,session}: add `delay_good_path_bug`Dan Aloni-7/+48
The first use case of this detection of regression for trimmed paths computation, that is in the case of rustc, which should be computed only in case of errors or warnings. Our current user of this method is deeply nested, being a side effect from `Display` formatting on lots of rustc types. So taking only the caller to the error message is not enough - we should collect the traceback instead.
2020-08-30mv compiler to compiler/mark-0/+5529