summary refs log tree commit diff
path: root/src/librustc_errors/emitter.rs
AgeCommit message (Collapse)AuthorLines
2019-02-14Rollup merge of #58296 - estebank:hidden-suggestion, r=oli-obkMazdak Farrokhzad-32/+64
Hidden suggestion support Add way to hide suggestion snippet window from cli output to avoid cluttered spans that don't enhance understanding. r? @pietroalbini CC @zackmdavis
2019-02-11Use hidden suggestions for unused imports lintEsteban Küber-1/+3
2019-02-11Add way to completely hide suggestion from cli outputEsteban Küber-1/+3
2019-02-11Never inline HideCodeAlways suggestionsEsteban Küber-1/+4
2019-02-11Add way to hide suggestion snippet window from cli outputEsteban Küber-31/+56
2019-02-10rustc: doc commentsAlexander Regueiro-3/+3
2019-02-09Auto merge of #57944 - estebank:unclosed-delim-the-quickening, r=oli-obkbors-2/+2
Deduplicate mismatched delimiter errors Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently. Second attempt at #54029, follow up to #53949. Fix #31528.
2019-02-07Deduplicate mismatched delimiter errorsEsteban Küber-2/+2
Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently.
2019-02-07librustc_errors => 2018Taiki Endo-9/+7
2019-01-20Remove unnecessary dummy span checksEsteban Küber-1/+1
The emitter already verifies wether a given span note or span label can be emitted to the output. If it can't, because it is a dummy span, it will be either elided for labels or emitted as an unspanned note/help when applicable.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-12Bump to 1.33.0Alex Crichton-1/+1
* Update bootstrap compiler * Update version to 1.33.0 * Remove some `#[cfg(stage0)]` annotations Actually updating the version number is blocked on updating Cargo
2018-12-07Rollup merge of #56516 - frewsxcv:frewsxcv-eq, r=Mark-Simulacrumkennytm-3/+3
Replace usages of `..i + 1` ranges with `..=i`. Before this change we were using old computer code techniques. After this change we use the new and improved computer code techniques.
2018-12-04adds DocTest filename variant, refactors doctest_offset out of source_map, ↵Matthew Russo-3/+4
fixes remaining test failures
2018-12-04Replace usages of `..i + 1` ranges with `..=i`.Corey Farwell-3/+3
2018-11-08rustc: Request ansi colors if stderr isn't a ttyAlex Crichton-1/+7
Currently Cargo will always capture the output of rustc meaning that rustc is never hooked up to a tty. To retain colors Cargo uses the `fwdansi` crate to ensure that ansi color codes are translated to windows terminal methods (and ansi codes otherwise just go their natural route on Unix). Cargo passes `--color always` to rustc to ensure that using a pipe doesn't trick it into not emitting colors at all. It turns out, however, that `--color always` ends up still accidentally using the native shell api on native windows shells. The fix here is to instead pass `AlwaysAnsi` to `termcolor` instead of `Always`, ensuring that when `--color always` is passed to rustc and its output isn't a terminal, we're always generating ansi colors regardless of the platform. Closes #55769
2018-10-29Rename other occs of (Code/File)Map to Source(Map/File) #51574David Lavati-28/+28
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-3/+3
2018-08-23use String::new() instead of String::from(""), "".to_string(), "".to_owned() ↵Matthias Krüger-3/+3
or "".into()
2018-08-19mv filemap source_fileDonato Sciarra-1/+1
2018-08-19mv FileMap SourceFileDonato Sciarra-4/+4
2018-08-19mv CodeMap SourceMapDonato Sciarra-4/+4
2018-08-07Avoid unnecessary pattern matching against Option and Resultljedrz-1/+1
2018-07-29Auto merge of #52764 - sinkuu:cleanup, r=nikomatsakisbors-6/+2
Misc cleanups
2018-07-27Use slices where a vector is not necessaryljedrz-5/+5
2018-07-27Remove unnecessary `.collect()`Shotaro Yamada-3/+1
2018-07-27Use str::repeatShotaro Yamada-3/+1
2018-07-25Improve readability in a few sortsljedrz-5/+3
2018-07-21Auto merge of #51485 - estebank:dehighlight-secondary-msgs, r=GuillaumeGomezbors-4/+10
Remove highlighting from secondary messages Deemphasize the secondary messages so that all other highlights stand out more. <img width="684" alt="" src="https://user-images.githubusercontent.com/1606434/41261199-7b4fe96e-6d8f-11e8-8619-04d170617df2.png">
2018-07-14Deny bare trait objects in src/librustc_errorsljedrz-3/+3
Enforce `#![deny(bare_trait_objects)]` in `src/librustc_errors`.
2018-06-30Fortify dummy span checkingVadim Petrochenkov-8/+8
2018-06-11Remove highlighting from secondary messagesEsteban Küber-4/+10
Deemphasize the secondary messages so that all other highlights stand out more.
2018-06-03Also prevent overflow in debug buildsOliver Schneider-1/+1
2018-05-31Make short-error format GNU compatibleGuillaume Gomez-1/+1
2018-05-24Account for negative offsets in suggestionsEsteban Küber-15/+20
When suggesting code that has a shorter span than the current code, account for this by keeping the offset as a signed value.
2018-05-24Underline multiple suggested replacements in the same lineEsteban Küber-18/+47
Follow up to #50943. Fix #50977.
2018-04-07Update based on RangeBounds trait being moved to libcore.Steven Malis-2/+2
2018-03-15Require the code mapper to be thread-safeJohn Kåre Alsaker-7/+5
2018-03-14test for putting back check on jsonGuillaume Gomez-54/+35
2018-03-07rustc: Migrate to `termcolor` crate from `term`Alex Crichton-151/+106
This crate moves the compiler's error reporting to using the `termcolor` crate from crates.io. Previously rustc used a super-old version of the `term` crate in-tree which is basically unmaintained at this point, but Cargo has been using `termcolor` for some time now and tools like `rg` are using `termcolor` as well, so it seems like a good strategy to take! Note that the `term` crate remains in-tree for libtest. Changing libtest will be a bit tricky due to how the build works, but we can always tackle that later. cc #45728
2018-03-02Replace Rc with Lrc for shared dataJohn Kåre Alsaker-7/+7
2018-02-26Fix rebaseVadim Petrochenkov-2/+3
2018-02-26Anonymize remaining line numbers at line startsVadim Petrochenkov-9/+12
2018-02-26Support flag `-Z ui-testing` for tweaking diagnostic output for UI testsVadim Petrochenkov-3/+21
2018-02-25Reduce error codes length when too much are thrownGuillaume Gomez-2/+5
2018-02-25Add rustc --explain backGuillaume Gomez-7/+43
2018-01-31Auto merge of #47900 - kennytm:rollup, r=kennytmbors-0/+4
Rollup of 16 pull requests - Successful merges: #47838, #47840, #47844, #47874, #47875, #47876, #47884, #47886, #47889, #47890, #47891, #47795, #47677, #47893, #47895, #47552 - Failed merges:
2018-02-01Rollup merge of #47677 - etaoins:avoid-underflow-in-rennder-source-line, ↵kennytm-0/+4
r=estebank Avoid underflow in render_source_line While testing rust-lang/rust#47655 I was able to make the compiler panic when it's compiled with debug assertions: ```shell > rustc /dev/null --crate-type proc-macro error: internal compiler error: unexpected panic note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.25.0-dev running on x86_64-apple-darwin note: run with `RUST_BACKTRACE=1` for a backtrace thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49 ``` Without debug assertions the following warning is emitted: ```shell > rustc /dev/null --crate-type proc-macro warning: unused variable: `registrar` --> /dev/null:0:1 | | = note: #[warn(unused_variables)] on by default = note: to avoid this warning, consider using `_registrar` instead ``` The panic is due to the unused variable warning being spanned to `/dev/null:0:1`. When `render_source_line` subtracts 1 from the line number to look up the source line it panics due to underflow. Without debug assertions this would wrap and cause us to return a blank string instead. Fix by explicitly testing for 0 and exiting early. I'm unsure how to automatically test this now that rust-lang/rust#46655 has been approved.
2018-01-31Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakisbors-6/+19
Highlight code on diagnostics when underlined Highlight the label's span with the respective color: <img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png"> Fix #42112.
2018-01-30Rollup merge of #47780 - varkor:cross-file-errors-line-col, r=estebankkennytm-1/+14
Add line numbers and columns to error messages spanning multiple files If an error message is emitted that spans several files, only the primary file currently has line and column data attached. This is useful information, even in files other than the one in which the error occurs. We can often work out which line and column the error corresponds to in other files — in this case it is helpful to add them (in the case of ambiguity, the first relevant line/column is picked, which is still helpful than none).