95 Commits

Author SHA1 Message Date
Steve Klabnik
74d24ad6af Rollup merge of #24966 - ruud-v-a:explain, r=pnkfelix
The error message was misleading, so I adjusted it, and I also added the long diagnostics for this error (resolves one point in #24407).

I was unsure about how to phrase the error message. Is “generic parameter binding” the correct term for this?
2015-05-07 12:21:01 +02:00
Steve Klabnik
52174305a0 Rollup merge of #24576 - cactorium:errorcodes, r=pnkfelix
For https://github.com/rust-lang/rust/issues/24407
2015-05-07 12:21:01 +02:00
Kelvin Ly
4174aa40f4 Reword with pnkfelix's suggestion 2015-05-06 05:43:05 -04:00
Michael Sproul
68f5c8475a Markdown edits for diagnostic errors. 2015-05-05 21:38:06 +10:00
bors
e962870420 Auto merge of #24975 - michaelsproul:enum-diagnostics, r=pnkfelix
Explanations for E0079, E0080, E0081, E0082, E0083 and E0084 as part of #24407.

All the errors concern the use of `#[repr(X)]` with enum types.

I also updated the short description for E0079 so that it takes sign into account.
2015-04-30 18:59:11 +00:00
bors
f9ecc6e888 Auto merge of #24892 - robinst:issue-24407-E0010, r=pnkfelix
Part of #24407.
2015-04-30 12:01:44 +00:00
Michael Sproul
63e63218a1 Add long diagnostics for enum repr errors. 2015-04-30 20:24:30 +10:00
Ruud van Asseldonk
414dfb13df rustc: Improve long diagnostics for E0282
The new example uses a `char` iterator instead of `i32`, to avoid interplay
between type inference and the default type for integer literals.
2015-04-30 11:51:40 +02:00
bors
ac5f595d0a Auto merge of #24884 - michaelsproul:extended-errors, r=nrc
I've been working on improving the diagnostic registration system so that it can:

* Check uniqueness of error codes *across the whole compiler*. The current method using `errorck.py` is prone to failure as it relies on simple text search - I found that it breaks when referencing an error's ident within a string (e.g. `"See also E0303"`).
* Provide JSON output of error metadata, to eventually facilitate HTML output, as well as tracking of which errors need descriptions. The current schema is:

```
<error code>: {
    "description": <long description>,
    "use_site": {
        "filename": <filename where error is used>,
        "line": <line in file where error is used>
    }
}
```

[Here's][metadata-dump] a pretty-printed sample dump for `librustc`.

One thing to note is that I had to move the diagnostics arrays out of the diagnostics modules. I really wanted to be able to capture error usage information, which only becomes available as a crate is compiled. Hence all invocations of `__build_diagnostics_array!` have been moved to the ends of their respective `lib.rs` files. I tried to avoid moving the array by making a plugin that expands to nothing but couldn't invoke it in item position and gave up on hackily generating a fake item. I also briefly considered using a lint, but it seemed like it would impossible to get access to the data stored in the thread-local storage.

The next step will be to generate a web page that lists each error with its rendered description and use site. Simple mapping and filtering of the metadata files also allows us to work out which error numbers are absent, which errors are unused and which need descriptions.

[metadata-dump]: https://gist.github.com/michaelsproul/3246846ff1bea71bd049
2015-04-30 02:03:27 +00:00
Robin Stocker
95ad630187 Add error explanation for E0010 2015-04-30 11:21:04 +10:00
Michael Sproul
d27230bb6d Add metadata output to the diagnostics system.
Diagnostic errors are now checked for uniqueness across the compiler and
error metadata is written to JSON files.
2015-04-30 08:59:53 +10:00
Ruud van Asseldonk
6b292cd4c4 rustc: Add long diagnostics for E0282 2015-04-30 00:58:43 +02:00
Alex Crichton
4ff558cdba rollup merge of #24894: bguiz/diagnostic-E0267
This error indicates that a constant references itself.
All constants need to resolve to a value in an acyclic manner.

For example, neither of the following can be sensibly compiled:

```
const X: u32 = X;
```

```
const X: u32 = Y;
const Y: u32 = X;
```
2015-04-29 15:45:43 -07:00
Robin Stocker
6cdb57d4b6 Add error explanation for E0013 2015-04-28 20:46:24 +10:00
Brendan Graetz
1335be33e4 =BG= change definition to use 'statics' as well as 'constants' 2015-04-28 20:22:26 +10:00
Brendan Graetz
8933253f2b =BG= Add detailed error message for E0265
This error indicates that a constant references itself.
All constants need to resolve to a value in an acyclic manner.

For example, neither of the following can be sensibly compiled:

```
const X: u32 = X;
```

```
const X: u32 = Y;
const Y: u32 = X;
```
2015-04-28 20:09:38 +10:00
Manish Goregaokar
50833a3f83 Rollup merge of #24523 - GuillaumeGomez:clean-error-codes, r=Manishearth 2015-04-24 19:21:12 +05:30
Guillaume Gomez
2ddc8f5eb5 Update diagnostics.rs 2015-04-23 18:43:58 +02:00
Steve Klabnik
9cc0af8d69 Refocus unsafe code chapter on unsafe itself. 2015-04-21 08:28:06 -04:00
bors
fe11393172 Auto merge of #24525 - GuillaumeGomez:check-const, r=pnkfelix
Part of #24407.
2015-04-20 10:26:17 +00:00
Guillaume Gomez
737005a110 Fix typos 2015-04-20 12:01:56 +02:00
Guillaume Gomez
8a6980c553 Add long explanation for E0018 2015-04-20 00:49:53 +02:00
Kelvin Ly
4420f31808 Fix trailing whitespaces 2015-04-19 01:59:29 -04:00
Kelvin Ly
99d2552c4e Fix typo 2015-04-18 20:25:24 -04:00
Ricardo Martins
5c7a0ba06e Add long diagnostics for E0133. 2015-04-19 00:36:59 +01:00
Guillaume Gomez
1d7d0192d2 Add backquotes to have better looking rust code 2015-04-19 00:01:58 +02:00
Kelvin Ly
d6227dcd6e Added error explanations for E0308, E0309, and E0310 2015-04-18 08:28:49 -04:00
Guillaume Gomez
50f75f3e2a Add long diagnostics for "bind by-ref and by-move" 2015-04-18 08:45:50 +10:00
Nick Hamann
017bc44712 Add long diagnostics for E0015 2015-04-18 08:41:20 +10:00
Nick Hamann
22ce069c7e Add long diagnostics for E0020 2015-04-18 08:40:57 +10:00
Michael Sproul
6d2b6d5a19 Enforce 80 char lines in extended errors. 2015-04-17 21:35:24 +10:00
Michael Sproul
c54f43a5d1 Update/add messages for E0{267,268,296,303}. 2015-04-17 21:35:24 +10:00
Chris Wong
0e4a77bbfe rustc: Add long diagnostics for E0306 and E0307 2015-04-16 22:23:36 -04:00
Chris Wong
77e8ddfaf3 rustc: Add long diagnostics for E0170 2015-04-16 22:23:36 -04:00
Chris Wong
aaf92f04d1 rustc: Add long diagnostics for E0161 2015-04-16 22:23:36 -04:00
Chris Wong
c08facfcfd rustc: Add long diagnostics for E0158 2015-04-16 22:23:36 -04:00
Chris Wong
521ae488db rustc: Add long diagnostics for E0152 2015-04-16 22:23:36 -04:00
Ruud van Asseldonk
33dca5e3ad rustc: Add long diagnostics for E0165 2015-04-14 20:11:04 +02:00
Ruud van Asseldonk
c45eacdbc6 rustc: Add long diagnostics for E0162 2015-04-14 20:00:17 +02:00
Ruud van Asseldonk
48a376da18 rustc: Add long diagnostics for E0302 2015-04-14 19:39:58 +02:00
Ruud van Asseldonk
ab1723b670 rustc: Add long diagnostics for E0301 2015-04-14 19:32:01 +02:00
Ruud van Asseldonk
9c6f4b6d1d rustc: Add long diagnostics for E0297 2015-04-14 19:31:54 +02:00
Michael Sproul
039a553998 Add more extended error messages for match exprs. 2015-04-07 11:16:32 -07:00
Michael Sproul
19e9828fb8 Fix printing of extended errors. 2015-04-04 12:37:25 -07:00
Felix S. Klock II
4e04d57efa Added type-specific overflow checks when computing enum discriminant values.
Moved such overflow checking into one place (in `rustc::middle::ty`,
since it needs to be run on-demand during `const_eval` in some
scenarios), and revised `rustc_typeck` accordingly.

(Note that we only check for overflow if program did not provide a
discriminant value explicitly.)

Fix #23030

Fix #23221

Fix #23235
2015-04-01 02:55:13 +02:00
Tamir Duberstein
d51047ded0 Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
Eduard Burtescu
03295a715f rustc: qualify expressions in check_const for potential promotion. 2015-02-16 17:13:42 +02:00
Nick Cameron
8122ce81d0 Accept quantification of lifetimes outside the self type in where clauses.
Closes #20022
2015-02-09 09:29:53 +13:00
Joseph Crail
dc2e444e50 Fix for misspelled comments.
The spelling corrections were made in both documentation comments and
regular comments.
2015-02-04 23:00:02 -05:00
Alex Crichton
90af72378d Make diagnostic ordering deterministic 2015-01-21 20:25:19 -08:00