summary refs log tree commit diff
path: root/src/librustc_errors
AgeCommit message (Collapse)AuthorLines
2018-04-25Approximate -> ApplicabilityManish Goregaokar-17/+17
2018-04-24Use enum for approximate suggestionsManish Goregaokar-10/+24
2018-04-17Make Handler more thread-safeJohn Kåre Alsaker-21/+26
2018-04-16Auto merge of #49130 - smmalis37:range, r=alexcrichtonbors-2/+2
Move Range*::contains to a single default impl on RangeBounds Per the ongoing discussion in #32311. This is my first PR to Rust (woo!), so I don't know if this requires an amendment to the original range_contains RFC, or not, or if we can just do a psuedo-RFC here. While this may no longer follow the explicit decision made in that RFC, I believe this better follows its spirit by adding the new contains method to all Ranges. It also allows users to be generic over all ranges and use this method without writing it themselves (my personal desired use case). This also somewhat answers the unanswered question about Wrapping ranges in the above issue by instead just punting it to the question of what those types should return for start() & end(), or if they should implement RangeArgument at all. Those types could also implement their own contains method without implementing this trait, in which case the question remains the same. This does add a new contains method to types that already implemented RangeArgument but not contains. These types are RangeFull, (Bound<T>, Bound<T>), (Bound<&'a T>, Bound<&'a T>). No tests have been added for these types yet. No inherent method has been added either. r? @alexcrichton
2018-04-08Move deny(warnings) into rustbuildMark Simulacrum-1/+0
This permits easier iteration without having to worry about warnings being denied. Fixes #49517
2018-04-07Update based on RangeBounds trait being moved to libcore.Steven Malis-2/+2
2018-04-07Auto merge of #49661 - alexcrichton:bump-bootstrap, r=nikomatsakisbors-2/+0
Bump the bootstrap compiler to 1.26.0 beta Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language features!
2018-04-06Print query stack on ICEsJohn Kåre Alsaker-0/+5
2018-04-05Auto merge of #49045 - Zoxc:tls, r=michaelwoeristerbors-17/+8
Make queries thread safe This makes queries thread safe by removing the query stack and making queries point to their parents. Queries write to the query map when starting and cycles are detected by checking if there's already an entry in the query map. This makes cycle detection O(1) instead of O(n), where `n` is the size of the query stack. This is mostly corresponds to the method I described [here](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606). cc @rust-lang/compiler r? @michaelwoerister
2018-04-05Bump the bootstrap compiler to 1.26.0 betaAlex Crichton-2/+0
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language features!
2018-03-26Stabilize i128_typeMark Mansi-1/+1
2018-03-26Stabilize conservative_impl_traitTaylor Cramer-1/+1
2018-03-25Rollup merge of #49046 - Zoxc:error-summary, r=michaelwoeristerkennytm-16/+18
Always print `aborting due to n previous error(s)` r? @michaelwoerister
2018-03-24Make queries thread safe. Remove the query stack and make queries point to ↵John Kåre Alsaker-17/+8
their parents instead.
2018-03-16Always print `aborting due to n previous error(s)` and only print it once ↵John Kåre Alsaker-16/+18
for multi-threaded code
2018-03-15Require the code mapper to be thread-safeJohn Kåre Alsaker-11/+12
2018-03-14test for putting back check on jsonGuillaume Gomez-59/+84
2018-03-07rustc: Migrate to `termcolor` crate from `term`Alex Crichton-161/+129
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-11/+11
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-02-02Remove dead codeManish Goregaokar-24/+0
2018-02-01Auto merge of #47540 - Manishearth:suggestion, r=nrcbors-0/+53
Add approximate suggestions for rustfix This adds `span_approximate_suggestion()` that lets you emit a suggestion marked as "non-machine applicable" in the JSON output. UI users see no difference. This is for when rustc and clippy wish to emit suggestions which will make sense to the reader (e.g. they may have placeholders like `<type>`) but are not source-applicable, so that rustfix/etc can ignore these. fixes #39254
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-7/+41
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-2/+16
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).
2018-01-29Toggle span highlighting on `-Zteach`Esteban Küber-8/+15
2018-01-29Add approximate suggestions for rustfixManish Goregaokar-0/+53
This adds `span_approximate_suggestion()` that lets you emit a suggestion marked as "approximate" in the JSON output. UI users see no difference. This is for when rustc and clippy wish to emit suggestions which will make sense to the reader (e.g. they may have placeholders like `<type>`) but are not source-applicable, so that rustfix/etc can ignore these. fixes #39254
2018-01-28Highlight code on diagnostics when underlinedEsteban Küber-1/+28
2018-01-27Improve formatting of else blockvarkor-1/+3
2018-01-27Auto merge of #47690 - estebank:for-block-277, r=nikomatsakisbors-0/+1
For E0277 on `for` loops, point at the "head" expression When E0277's span points at a `for` loop, the actual issue is in the element being iterated. Instead of pointing at the entire loop, point only at the first line (when possible) so that the span ends in the element for which E0277 was triggered.
2018-01-26Don't add "in this macro invocation" label to desugared spansEsteban Küber-0/+1
2018-01-26Add line numbers and columns to error messages spanning multiple filesvarkor-2/+14
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).
2018-01-26Merge branch 'explain' of https://github.com/estebank/rust into rollupAlex Crichton-1/+23
2018-01-26Do not capture stderr in the compiler. Instead just panic silently for fatal ↵John Kåre Alsaker-1/+15
errors
2018-01-25Add description to field and methodEsteban Küber-0/+8
2018-01-23Avoid underflow in render_source_lineRyan Cumming-0/+4
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-22Only emit expanded diagnostic information onceEsteban Küber-1/+15
2018-01-18Rollup merge of #47407 - gaurikholkar:master, r=estebankkennytm-2/+2
fix mispositioned span This fixes #47377 The output now looks like this ``` error[E0369]: binary operation `+` cannot be applied to type `&str` --> h.rs:3:11 | 3 | let _a = b + ", World!"; | ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left | 3 | let _a = b.to_owned() + ", World!"; | ^^^^^^^^^ error: aborting due to previous error ``` For the case when emojis are involved, it gives the new output for proper indentation. But for an indentation as follows, ``` fn main() { let b = "hello"; let _a = b + ", World!"; } ``` it still mispositions the span ``` 3 | println!("🦀🦀🦀🦀🦀"); let _a = b + ", World!"; | ^^^^^^^^^^^^^^ `+` can't be used to concatenate two `&str` strings | 3 | println!("🦀🦀🦀🦀🦀"); let _a = b.to_owned() + ", World!"; | ^^^^^^^ error: aborting due to previous erro ``` cc @estebank @est31
2018-01-14Auto merge of #47274 - Manishearth:rustdoc-span, r=QuietMisdreavusbors-2/+3
Use correct line offsets for doctests Not yet tested. This doesn't handle char positions. It could if I collected a map of char offsets and lines, but this is a bit more work and requires hooking into the parser much more (unsure if it's possible). r? @QuietMisdreavus (fixes #45868)
2018-01-13add ui testGauri-1/+1
2018-01-13fix mispositioned spanGauri-1/+1
2018-01-10Use correct line offsets for doctests (fixes #45868)Manish Goregaokar-2/+3
2018-01-08Clean emitted diagnostics when `reset_err_count` is called.Rafael Fernández López-2/+6
When external tools like `rustfmt` calls to `reset_err_count` for handler reusing, it will set the error count on the handler to 0, but since https://github.com/rust-lang/rust/pull/47146 the handler will contain status that will prevent the error count to be bumped if this handler is reused. This caused `rustfmt` idempotency tests to fail: https://github.com/rust-lang-nursery/rustfmt/issues/2338 Fixes: https://github.com/rust-lang-nursery/rustfmt/issues/2338
2018-01-03Only bump error count when we are sure that the diagnostic is not a repetition.Rafael Fernández López-15/+9
This ensures that if we emit the same diagnostic twice, the error count will match the real number of errors shown to the user. Fixes #42106
2017-12-21Make err_count thread safeJohn Kåre Alsaker-8/+10