about summary refs log tree commit diff
path: root/src/librustc_errors
AgeCommit message (Collapse)AuthorLines
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 | ```
2016-11-05Merge branch 'new-rustbuild' into rollupAlex Crichton-1/+1
2016-11-02rustbuild: Rewrite user-facing interfaceAlex Crichton-1/+1
This commit is a rewrite of the user-facing interface to the rustbuild build system. The intention here is to make it much easier to compile/test the project without having to remember weird rule names and such. An overall view of the new interface is: # build everything ./x.py build # document everyting ./x.py doc # test everything ./x.py test # test libstd ./x.py test src/libstd # build libcore stage0 ./x.py build src/libcore --stage 0 # run stage1 run-pass tests ./x.py test src/test/run-pass --stage 1 The `src/bootstrap/bootstrap.py` script is now aliased as a top-level `x.py` script. This `x` was chosen to be both short and easily tab-completable (no collisions in that namespace!). The build system now accepts a "subcommand" of what to do next, the main ones being build/doc/test. Each subcommand then receives an optional list of arguments. These arguments are paths in the source repo of what to work with. That is, if you want to test a directory, you just pass that directory as an argument. The purpose of this rewrite is to do away with all of the arcane renames like "rpass" is the "run-pass" suite, "cfail" is the "compile-fail" suite, etc. By simply working with directories and files it's much more intuitive of how to run a test (just pass it as an argument). The rustbuild step/dependency management was also rewritten along the way to make this easy to work with and define, but that's largely just a refactoring of what was there before. The *intention* is that this support is extended for arbitrary files (e.g. `src/test/run-pass/my-test-case.rs`), but that isn't quite implemented just yet. Instead directories work for now but we can follow up with stricter path filtering logic to plumb through all the arguments.
2016-11-01pacify the mercilous tidyNiko Matsakis-0/+20
2016-11-01improve early lint to use multispan from diagnosticNiko Matsakis-4/+4
2016-11-01compare-method lintNiko Matsakis-30/+26
2016-11-01retool EarlyLint to track a DiagnosticNiko Matsakis-0/+8
2016-11-01separate Diagnostic from DiagnosticBuilderNiko Matsakis-215/+358
2016-10-18run rustfmt on librustc_errors folderSrinivas Reddy Thatiparthy-181/+173
2016-10-12Stabilise `?`Nick Cameron-1/+1
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-09-28Allow supplying an error destination via the compiler driverNick Cameron-2/+4
Allows replacing stderr with a buffer from the client. Also, some refactoring around run_compiler.
2016-09-24Rollup merge of #36498 - jonathandturner:macro_std_lib, r=nikomatsakisGuillaume Gomez-1/+2
Fix wording for out-of-crate macro error This fixes the wording of the note for out-of-crate macro errors to fix https://github.com/rust-lang/rust/issues/36469 The previous wording came from older logic in the PR that was replaced without updating the note.
2016-09-19Add the ability to merge spans to codemapJonathan Turner-0/+1
2016-09-16Auto merge of #36338 - estebank:primitive-shadow, r=jseyfriedbors-3/+14
Be more specific when type parameter shadows primitive type When a type parameter shadows a primitive type, the error message was non obvious. For example, given the file `file.rs`: ```rust trait Parser<T> { fn parse(text: &str) -> Option<T>; } impl<bool> Parser<bool> for bool { fn parse(text: &str) -> Option<bool> { Some(true) } } fn main() { println!("{}", bool::parse("ok").unwrap_or(false)); } ``` The output was: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool a | = note: expected type `bool` = note: found type `bool` error: aborting due to previous error ``` We now show extra information about the type: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool a | = note: expected type `bool` (type parameter) = note: found type `bool` (bool) error: aborting due to previous error ``` Fixes #35030
2016-09-15Specify when type parameter shadows primitive typeEsteban Küber-3/+14
When a type parameter shadows a primitive type, the error message was non obvious. For example, given the file `file.rs`: ```rust trait Parser<T> { fn parse(text: &str) -> Option<T>; } impl<bool> Parser<bool> for bool { fn parse(text: &str) -> Option<bool> { Some(true) } } fn main() { println!("{}", bool::parse("ok").unwrap_or(false)); } ``` The output was: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` = note: found type `bool` error: aborting due to previous error ``` We now show extra information about the type: ```bash % rustc file.rs error[E0308]: mismatched types --> file.rs:7:14 | 7 | Some(true) | ^^^^ expected type parameter, found bool | = note: expected type `bool` (type parameter) = note: found type `bool` (bool) error: aborting due to previous error ``` Fixes #35030
2016-09-15Fix wording for out-of-crate macro errorJonathan Turner-1/+2
2016-09-11Use question_mark feature in librustc_errors.Ahmed Charles-17/+17
2016-08-31Special case a few colors for WindowsJonathan Turner-3/+20
2016-08-25prevent error message interleaving on win/unixJonathan Turner-2/+198
2016-08-20Rollup merge of #35839 - jonathandturner:error_touchup, r=AatchJonathan Turner-1/+3
Wording fixes in error messages This PR is largely wording fixes to existing PRs that I found going back through the ones that have already been updated. Sometimes seeing the message in context made me think "oh there's a better wording!" There's one additional fix. This will also prevent the secondary underlining of derive call (since they look like macros to the system in the way I was using): ``` error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> src/test/compile-fail/E0184.rs:11:10 | 11 | #[derive(Copy)] //~ ERROR E0184 | ^^^^ | | | in this macro invocation ``` Is now just: ``` error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor --> src/test/compile-fail/E0184.rs:11:10 | 11 | #[derive(Copy)] //~ ERROR E0184 | ^^^^ ```
2016-08-19Auto merge of #33922 - estebank:doc-comment, r=alexcrichtonbors-0/+9
Specific error message for missplaced doc comments Identify when documetation comments have been missplaced in the following places: * After a struct element: ```rust // file.rs: struct X { a: u8 /** document a */, } ``` ```bash $ rustc file.rs file.rs:2:11: 2:28 error: found documentation comment that doesn't document anything file.rs:2 a: u8 /** document a */, ^~~~~~~~~~~~~~~~~ file.rs:2:11: 2:28 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a struct: ```rust // file.rs: struct X { a: u8, /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a `fn`: ```rust // file.rs: fn main() { let x = 1; /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` Fix #27429, #30322
2016-08-19wording fixes in error messagesJonathan Turner-1/+3
2016-08-17Rebase. Fix mutable iteration nit.Jonathan Turner-1/+1
2016-08-17Replace local backtrace with def-use, repair std macro spansJonathan Turner-41/+103
2016-08-07Turn on new errors, json mode. Remove duplicate unicode testJonathan Turner-314/+11
2016-07-22rustc_errors: fix a few bugsAriel Ben-Yehuda-3/+5
2016-07-15Nudge travis by commenting a littleJonathan Turner-0/+1
2016-07-14Teach EmitterWriter about the dangers of quasi-quotingJonathan Turner-7/+20
2016-07-14Add fix for tabs. Move error unit tests->ui testsJonathan Turner-6/+19
2016-07-14Add in styled_buffer.rs and remove some unused codeJonathan Turner-54/+156
2016-07-14Fix up some tidy-unfriendly spacingJonathan Turner-3/+7
2016-07-14DCE and fixing some internal testsJonathan Turner-1115/+34
2016-07-14Fix a couple UI test failuresJonathan Turner-11/+16
2016-07-14Add back in old school modeJonathan Turner-26/+265
2016-07-14Implement latest rfc style using simpler renderingJonathan Turner-192/+691
2016-07-14Remove CoreEmitter and focus on EmitterJonathan Turner-43/+36
2016-07-14Rename emit_struct->emitJonathan Turner-5/+5
2016-07-14Remove emit from emitter, leaving emit_structJonathan Turner-29/+44
2016-07-14Remove BasicEmitterJonathan Turner-74/+64
2016-07-05Specific error message for missplaced doc commentsEsteban Küber-0/+9
Identify when documetation comments have been missplaced in the following places: * After a struct element: ```rust // file.rs: struct X { a: u8 /** document a */, } ``` ```bash $ rustc file.rs file.rs:2:11: 2:28 error: found documentation comment that doesn't document anything file.rs:2 a: u8 /** document a */, ^~~~~~~~~~~~~~~~~ file.rs:2:11: 2:28 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a struct: ```rust // file.rs: struct X { a: u8, /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` * As the last line of a `fn`: ```rust // file.rs: fn main() { let x = 1; /// incorrect documentation } ``` ```bash $ rustc file.rs file.rs:3:5: 3:27 error: found a documentation comment that doesn't document anything file.rs:3 /// incorrect documentation ^~~~~~~~~~~~~~~~~~~~~~ file.rs:3:5: 3:27 help: doc comments must come before what they document, maybe a comment was intended with `//`? ``` Fix #27429, #30322
2016-06-23make old school mode a bit more configurableJonathan Turner-24/+68