about summary refs log tree commit diff
path: root/src/librustc_errors
AgeCommit message (Collapse)AuthorLines
2017-05-31Use callsite's span for macro calls on suggestionEsteban Küber-5/+4
When suggesting an appropriate mutability for a macro call, use the call span instead of the expanded macro's span.
2017-05-30Add new error codeGuillaume Gomez-0/+6
2017-05-24Change error count messagesMichael Kohl-4/+1
See #33525 for details.
2017-05-19fix some clippy warnings in librustc_errorsAndre Bogus-8/+6
2017-05-13Auto merge of #41965 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-88/+157
Rollup of 15 pull requests - Successful merges: #41820, #41860, #41876, #41896, #41912, #41916, #41918, #41921, #41923, #41934, #41935, #41940, #41942, #41943, #41951 - Failed merges:
2017-05-12Rollup merge of #41942 - tommyip:master, r=Mark-SimulacrumMark Simulacrum-1/+4
Fix unexpected panic with the -Z treat-err-as-bug option This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option. Fixes #35886. r? @Mark-Simulacrum
2017-05-12Rollup merge of #41934 - est31:remove_unused_macros, r=nagisaMark Simulacrum-15/+0
Remove unused macros from the codebase Thanks to the lint I've implemented in #41907 I've found some unused macros inside the rustc codebase.
2017-05-12Fix unexpected panic with the -Z treat-err-as-bug optionTommy Ip-1/+4
This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option. Fixes #35886.
2017-05-12Remove some unused macros from the rust codebaseest31-15/+0
Removes unused macros from: * libcore * libcollections The last use of these two macros was removed in commit b64c9d56700e2c41207166fe8709711ff02488ff when the char_range_at_reverse function was been removed. * librustc_errors Their last use was removed by commits 2f2c3e178325dc1837badcd7573c2c0905fab979 and 11dc974a38fd533aa692cea213305056cd3a6902. * libsyntax_ext * librustc_trans Also, put the otry macro in back/msvc/mod.rs under the same cfg argument as the places that use it.
2017-05-11rustc: Remove #![unstable] annotationAlex Crichton-3/+4
These are now no longer necessary with `-Z force-unstable-if-unmarked`
2017-05-11Address PR reviewsOliver Schneider-35/+54
2017-05-10Example usage of multiple suggestionsOliver Schneider-10/+23
2017-05-10Refactor suggestion diagnostic API to allow for multiple suggestionsOliver Schneider-67/+116
2017-05-08Rollup merge of #41520 - estebank:trace-macro, r=nikomatsakisCorey Farwell-0/+8
Use diagnostics for trace_macro instead of println When using `trace_macro`, use `span_label`s instead of `println`: ```rust note: trace_macro --> $DIR/trace-macro.rs:14:5 | 14 | println!("Hello, World!"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: expands to `println! { "Hello, World!" }` = note: expands to `print! { concat ! ( "Hello, World!" , "\n" ) }` ``` Fix #22597.
2017-05-08Remove need for &format!(...) or &&"" dances in `span_label` callsOliver Schneider-5/+6
2017-05-06Group "macro expansion" notes per call spanEsteban Küber-3/+5
2017-05-05Use diagnostics for trace_macro instead of printlnEsteban Küber-0/+6
2017-05-03Fix issue #41652.kennytm-2/+9
Don't print the source code in emit_message_default() and render_source_line() if the source code is None.
2017-05-02Auto merge of #40851 - oli-obk:multisugg, r=jonathandturnerbors-23/+39
Minimize single span suggestions into a label changes ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ | help: to access tuple elements, use tuple indexing syntax as shown | println!("☃{}", tup.0); ``` into ``` 14 | println!("☃{}", tup[0]); | ^^^^^^ to access tuple elements, use `tup.0` ``` Also makes suggestions explicit in the backend in preparation of adding multiple suggestions to a single diagnostic. Currently that's already possible, but results in a full help message + modified code snippet per suggestion, and has no rate limit (might show 100+ suggestions).
2017-04-27typeck: resolve type vars before calling `try_index_step`Ariel Ben-Yehuda-0/+3
`try_index_step` does not resolve type variables by itself and would fail otherwise. Also harden the failure path in `confirm` to cause less confusing errors.
2017-04-25Rebase and address commentsOliver Schneider-1/+1
2017-04-25Improve E0178 suggestion placementOliver Schneider-3/+6
2017-04-25Address PR commentsOliver Schneider-1/+3
2017-04-25Minimize single span suggestions into a noteOliver Schneider-23/+34
2017-04-20Reduce visual clutter of multiline start when possibleEsteban Küber-21/+68
When a span starts on a line with nothing but whitespace to the left, and there are no other annotations in that line, simplify the visual representation of the span. Go from: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | struct A { | _^ starting here... 2 | | a: A, 3 | | } | |_^ ...ending here: recursive type has infinite size | ``` To: ```rust error[E0072]: recursive type `A` has infinite size --> file2.rs:1:1 | 1 | / struct A { 2 | | a: A, 3 | | } | |_^ recursive type has infinite size ``` Remove `starting here...`/`...ending here` labels from all multiline diagnostics.
2017-04-12Rollup merge of #41205 - estebank:shorter-mismatched-types-2, r=nikomatsakisTim Neumann-17/+67
Highlight and simplify mismatched types Shorten mismatched types errors by replacing subtypes that are not different with `_`, and highlighting only the subtypes that are different. Given a file ```rust struct X<T1, T2> { x: T1, y: T2, } fn foo() -> X<X<String, String>, String> { X { x: X {x: "".to_string(), y: 2}, y: "".to_string()} } fn bar() -> Option<String> { "".to_string() } ``` provide the following output ```rust error[E0308]: mismatched types --> file.rs:6:5 | 6 | X { x: X {x: "".to_string(), y: 2}, y: "".to_string()} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found {integer} | = note: expected type `X<X<_, std::string::String>, _>` ^^^^^^^^^^^^^^^^^^^ // < highlighted found type `X<X<_, {integer}>, _>` ^^^^^^^^^ // < highlighted error[E0308]: mismatched types --> file.rs:6:5 | 10 | "".to_string() | ^^^^^^^^^^^^^^ expected struct `std::option::Option`, found `std::string::String` | = note: expected type `Option<std::string::String>` ^^^^^^^ ^ // < highlighted found type `std::string::String` ``` Fix #21025. Re: #40186. Follow up to #39906. I'm looking to change how this output is accomplished so that it doesn't create list of strings to pass around, but rather add an elided `Ty` placeholder, and use the same string formatting for normal types. I'll be doing that soonish. r? @nikomatsakis
2017-04-11Highlight and simplify mismatched typesEsteban Küber-17/+67
Shorten mismatched types errors by replacing subtypes that are not different with `_`, and highlighting only the subtypes that are different. Given a file ```rust struct X<T1, T2> { x: T1, y: T2, } fn foo() -> X<X<String, String>, String> { X { x: X {x: "".to_string(), y: 2}, y: "".to_string()} } fn bar() -> Option<String> { "".to_string() } ``` provide the following output ```rust error[E0308]: mismatched types --> file.rs:6:5 | 6 | X { x: X {x: "".to_string(), y: 2}, y: "".to_string()} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `std::string::String`, found {integer} | = note: expected type `X<X<_, std::string::String>, _>` ^^^^^^^^^^^^^^^^^^^ // < highlighted found type `X<X<_, {integer}>, _>` ^^^^^^^^^ // < highlighted error[E0308]: mismatched types --> file.rs:6:5 | 10 | "".to_string() | ^^^^^^^^^^^^^^ expected struct `std::option::Option`, found `std::string::String` | = note: expected type `Option<std::string::String>` ^^^^^^^ ^ // < highlighted found type `std::string::String` ```
2017-04-09Always show end line of multiline annotationsEsteban Küber-87/+122
```rust error[E0046]: not all trait items implemented, missing: `Item` --> $DIR/issue-23729.rs:20:9 | 20 | impl Iterator for Recurrence { | _________^ starting here... 21 | | //~^ ERROR E0046 22 | | //~| NOTE missing `Item` in implementation 23 | | //~| NOTE `Item` from trait: `type Item;` ... | 36 | | } 37 | | } | |_________^ ...ending here: missing `Item` in implementation | = note: `Item` from trait: `type Item;` ``` instead of ```rust error[E0046]: not all trait items implemented, missing: `Item` --> $DIR/issue-23729.rs:20:9 | 20 | impl Iterator for Recurrence { | ^ missing `Item` in implementation | = note: `Item` from trait: `type Item;` ```
2017-03-29Merge `ExpnId` and `SyntaxContext`.Jeffrey Seyfried-14/+12
2017-03-10Rollup merge of #40287 - estebank:label-overlap, r=nrcAlex Crichton-28/+34
Fix incorrect span label formatting Fix #40157.
2017-03-10Fix incorrect span label formattingEsteban Küber-28/+34
2017-02-25Fix suggestion span error with a line containing non-ASCIIssinkuu-1/+2
2017-02-02store typeck lints in the `TypeckTables`Niko Matsakis-6/+8
Otherwise they are a "hidden output"
2017-01-24Auto merge of #39214 - estebank:fix-labels-without-msg, r=nikomatsakisbors-30/+82
Fix multiple labels when some don't have message The diagnostic emitter now accounts for labels with no text message, presenting the underline on its own, without drawing the line for the non existing message below it. Go from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | | | `b` is a good letter | ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | `b` is a good letter ``` from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ | | | | | | `a` is a good letter ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ `a` is a good letter ``` and from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ | | | | | | ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ ``` r? @nikomatsakis cc @jonathandturner, @GuillaumeGomez, @nrc
2017-01-22Remove unused `extern crate`s.Jeffrey Seyfried-7/+0
2017-01-22Warn on unused `#[macro_use]` imports.Jeffrey Seyfried-2/+0
2017-01-20Fix multiple labels when some don't have messageEsteban Küber-30/+82
The diagnostic emitter now accounts for labels with no text message, presenting the underline on its own, without drawing the line for the non existing message below it. Go from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | | | `b` is a good letter | ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ----^^^^^^^---- | | | `b` is a good letter ``` and from ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ | | | | | | `a` is a good letter ``` to ``` error: foo --> test.rs:3:6 | 3 | a { b { c } d } | ^^^^-------^^^^ `a` is a good letter ```
2017-01-17Teach Diagnostics to highlight textEsteban Küber-33/+125
2017-01-11Auto merge of #38916 - estebank:pad-suggestion-list, r=nikomatsakisbors-3/+41
Teach diagnostics to correct margin of multiline messages Make the suggestion list have a correct padding: ``` error[E0308]: mismatched types --> file.rs:3:20 | 3 | let x: usize = ""; | ^^ expected usize, found reference | = note: expected type `usize` = note: found type `&'static str` = help: here are some functions which might fulfill your needs: - .len() - .foo() - .bar() ```
2017-01-09Deduplicate and document logicEsteban Küber-6/+23
2017-01-08Remove magic numberEsteban Küber-4/+4
2017-01-08Teach diagnostics to correct margin on multiline messagesEsteban Küber-66/+24
Make any diagnostic line to have the correct margin to align with the first line: ``` error: message --> file.rs:3:20 | 3 | <CODE> | ^^^^ | = note: this is a multiline note with a correct margin = note: this is a single line note = help: here are some functions which might fulfill your needs: - .len() - .foo() - .bar() = suggestion: this is a multiline suggestion with a correct margin ```
2017-01-08Use fold instead of collect/join and add commentsEsteban Küber-10/+39
2017-01-07Teach diagnostics to have correctly padded listsEsteban Küber-2/+36
Make the suggestion list have a correct padding: ``` error[E0308]: mismatched types --> file.rs:3:20 | 3 | let x: usize = ""; | ^^ expected usize, found reference | = note: expected type `usize` = note: found type `&'static str` = help: here are some functions which might fulfill your needs: - .len() - .foo() - .bar() ```
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-12-12Auto merge of #38049 - frewsxcv:libunicode, r=alexcrichtonbors-1/+1
Rename 'librustc_unicode' crate to 'libstd_unicode'. Fixes https://github.com/rust-lang/rust/issues/26554.
2016-11-30Update the bootstrap compilerAlex Crichton-1/+0
Now that we've got a beta build, let's use it!
2016-11-30Rename 'librustc_unicode' crate to 'libstd_unicode'.Corey Farwell-1/+1
Fixes #26554.
2016-11-23review commentsEsteban Küber-106/+84
2016-11-22Show multiline spans in full if short enoughEsteban Küber-108/+479
When dealing with multiline spans that span few lines, show the complete span instead of restricting to the first character of the first line. For example, instead of: ``` % ./rustc foo.rs error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied --> foo.rs:13:9 | 13 | foo(1 + bar(x, | ^ trait `{integer}: std::ops::Add<()>` not satisfied | ``` show ``` % ./rustc foo.rs error[E0277]: the trait bound `{integer}: std::ops::Add<()>` is not satisfied --> foo.rs:13:9 | 13 | foo(1 + bar(x, | ________^ starting here... 14 | | y), | |_____________^ ...ending here: trait `{integer}: std::ops::Add<()>` not satisfied | ```