Commit Graph

53340 Commits

Author SHA1 Message Date
Manish Goregaokar
0ee84c71fc
Rollup merge of #33325 - birkenfeld:issue-31341, r=jseyfried
typeck: remove confusing suggestion for calling a fn type

* It is not clear what a "base function" is.
* The suggestion just adds parens, so suggests calling without args.

The second point could be fixed with e.g. `(...)` instead of `()`,
but the preceding "note: X is a function, perhaps you wish to call it"
should already be clear enough.

Fixes: #31341
2016-05-03 08:05:28 +05:30
Manish Goregaokar
68c29e0904
Rollup merge of #33324 - birkenfeld:issue-30497, r=GuillaumeGomez
E0269: add suggestion to check for trailing semicolons

In situations where the value of the last expression must be inferred,
rustc will not emit the "you might need to remove the semicolon" warning,
so at least note this in the extended description.

Fixes: #30497
2016-05-03 08:05:28 +05:30
Manish Goregaokar
c4d950d6d5
Rollup merge of #33323 - birkenfeld:issue-31221, r=Manishearth
match check: note "catchall" patterns in unreachable error

Caught as catchall patterns are:

* unconditional name bindings
* references to them
* tuple bindings with catchall elements

Fixes #31221.
2016-05-03 08:05:27 +05:30
Manish Goregaokar
1d6cc191fc
Rollup merge of #33320 - birkenfeld:issue31573, r=arielb1
diagnostics for E0432: imports are relative to crate root

This is curiously missing from both the short message and this long diagnostic.

Refs #31573 (not sure if it should be considered "fixed" as the short message still only refers to extern crates).
2016-05-03 08:05:27 +05:30
Manish Goregaokar
308f10cdf5
Rollup merge of #33309 - birkenfeld:pp, r=nrc
Make libsyntax::print::pp more idiomatic

Minor cleanup, and using VecDeque as a ring buffer instead of a vector.
2016-05-03 08:05:26 +05:30
Manish Goregaokar
40199f68d9
Rollup merge of #32756 - nikomatsakis:borrowck-snippet, r=nrc
Overhaul borrowck error messages and compiler error formatting generally

This is a major overhaul of how the compiler reports errors. The primary goal is to be able to give many spans within the same overall context, such as this:

```
./borrow-errors.rs:73:17: 73:20: error: cannot borrow `*vec` as immutable because previous closure requires unique access [E0501]
70     let append = |e| {
                    ~~~ closure construction occurs here
71         vec.push(e)
           ~~~ previous borrow occurs due to use of `vec` in closure
72     };
73     let data = &vec[3];
                   ~~~ borrow occurs here
74 }
   ~ borrow from closure ends here
```

However, in the process we made a number of other changes:

- Removed the repetitive filenames from snippets and just give the line number.
- Color the line numbers blue so they "fade away"
- Remove the file name and line number from the error code suggestions since they don't seem to fit anymore. (This should probably happen in more places, like existing notes.)
- Newlines in between errors to help group them better.

This PR is not quite ready to land, but we thought it made sense to stop here and get some feedback from people at large. It'd be great if people can check out the branch and play with it. We'd be especially interested in hearing about cases that don't look good with the new formatting (I suspect they exist).

Here is a checklist of some pending work items for this PR. Some of them may be best left for follow-up PRs:

- [x] Accommodate multiple files in a `MultiSpan` (this should be easy)
  - In this case, we want to print filenames though.
- [x] Remove duplicate E0500 code.
- [x] Make the header message bold, rather than current hack that makes all errors/warnings bold
- [x] Update warning text color (yellow is hard to read w/ a white background)

Moved numerous follow-ups to: https://github.com/rust-lang/rust/issues/33240

Joint work with @jonathandturner.

Fixes https://github.com/rust-lang/rust/issues/3533
2016-05-03 08:05:26 +05:30
bors
44b3cd8c46 Auto merge of #32756 - nikomatsakis:borrowck-snippet, r=nrc
Overhaul borrowck error messages and compiler error formatting generally

This is a major overhaul of how the compiler reports errors. The primary goal is to be able to give many spans within the same overall context, such as this:

```
./borrow-errors.rs:73:17: 73:20: error: cannot borrow `*vec` as immutable because previous closure requires unique access [E0501]
70     let append = |e| {
                    ~~~ closure construction occurs here
71         vec.push(e)
           ~~~ previous borrow occurs due to use of `vec` in closure
72     };
73     let data = &vec[3];
                   ~~~ borrow occurs here
74 }
   ~ borrow from closure ends here
```

However, in the process we made a number of other changes:

- Removed the repetitive filenames from snippets and just give the line number.
- Color the line numbers blue so they "fade away"
- Remove the file name and line number from the error code suggestions since they don't seem to fit anymore. (This should probably happen in more places, like existing notes.)
- Newlines in between errors to help group them better.

This PR is not quite ready to land, but we thought it made sense to stop here and get some feedback from people at large. It'd be great if people can check out the branch and play with it. We'd be especially interested in hearing about cases that don't look good with the new formatting (I suspect they exist).

Here is a checklist of some pending work items for this PR. Some of them may be best left for follow-up PRs:

- [x] Accommodate multiple files in a `MultiSpan` (this should be easy)
  - In this case, we want to print filenames though.
- [x] Remove duplicate E0500 code.
- [x] Make the header message bold, rather than current hack that makes all errors/warnings bold
- [x] Update warning text color (yellow is hard to read w/ a white background)

Moved numerous follow-ups to: https://github.com/rust-lang/rust/issues/33240

Joint work with @jonathandturner.

Fixes https://github.com/rust-lang/rust/issues/3533
2016-05-02 19:21:56 -07:00
mrmiywj
201d9ed0bb add help on pattern guard
fix too long column

fix typo of help on pattern guard

one nit

fix compile fail
2016-05-03 10:00:51 +08:00
Nick Cameron
c1c6e99bfd rebasing
Note that this whole PR is a [breaking-change] for clients of the Compiler API.
2016-05-03 11:15:09 +12:00
Nick Cameron
aaf56d7086 Fix tests 2016-05-03 10:51:01 +12:00
Nick Cameron
52a2b33a4b Refactor pretty printing to use more of the driver 2016-05-03 10:51:01 +12:00
Nick Cameron
7ee02d9f4d Use the compiler API to run pretty printing.
This commit still does a lot of building in pretty because we always run after parsing.
2016-05-03 10:49:47 +12:00
Nick Cameron
a4000cbbf8 Make pretty printer take Session by ref 2016-05-03 10:48:22 +12:00
Tamir Duberstein
728cd03c57 rustc_back: use a common musl base 2016-05-02 17:38:16 -04:00
Patrick Walton
237eb7285e libcore: Inline mem::forget().
Was causing severe performance problems in WebRender.
2016-05-02 13:57:53 -07:00
Georg Brandl
4ba6bf44bd resolve: print location of static for "static in pattern" error
The implementation mirrors the one for "constant defined here" annotation
used for constant patterns in the irrefutable-pattern case.

Fixes: #23716
2016-05-02 22:02:07 +02:00
bors
9a003b0ef2 Auto merge of #32386 - brandonedens:llvm_min_size, r=alexcrichton
Add CodeGen options to optimize for size.

Add CodeGen options to annotate functions with the attributes OptimizeSize and/or MinSize used by LLVM to reduce .text size.
Closes #32296
2016-05-02 11:27:20 -07:00
Niko Matsakis
9355a91224 assert we get at least two rendered lines back 2016-05-02 13:05:14 -04:00
Alex Crichton
71e63296a2 rustc: Handle concurrent create_dir requests
The compiler created a directory as part of `-Z incremental` but that may be
hierarchically used concurrently so we need to protect ourselves against that.
2016-05-02 09:38:07 -07:00
bors
d80497e628 Auto merge of #33308 - ollie27:wingnu_jemalloc, r=alexcrichton
Fix alloc_jemalloc on windows gnu targets

jemalloc prefixes the symbols by default on Windows so we need to account
for that to avoid link errors such as: `undefined reference to 'mallocx'`
when using alloc_jemalloc.
2016-05-02 09:16:23 -07:00
Niko Matsakis
db8a9a92b3 avoid double panic 2016-05-02 11:49:26 -04:00
Niko Matsakis
9d151a71c0 do not fail if len(rendered_lines) is == 1
also handle more rendered-lines
2016-05-02 11:49:26 -04:00
jonathandturner
f359aa2762 Fix unicode test to use original error format 2016-05-02 11:49:26 -04:00
Niko Matsakis
64e0819fc2 patch travis failure 2016-05-02 11:49:26 -04:00
Niko Matsakis
95576b8ec4 update unit tests 2016-05-02 11:49:26 -04:00
Niko Matsakis
2ba5fac1a4 fix rebase flaws 2016-05-02 11:49:26 -04:00
Jonathan Turner
5974e5b294 Fix up error-pattern style test 2016-05-02 11:49:26 -04:00
Jonathan Turner
79f61a4532 Finish up with 'old school' error mode 2016-05-02 11:49:25 -04:00
Jonathan Turner
84cb56f8ee Add back in a 'old school' error format 2016-05-02 11:49:25 -04:00
Niko Matsakis
49dfac4872 move "lint level defined here" into secondary note
It does not help you to understand the error, just explains why you are
seeing it, so it is clearly secondary.
2016-05-02 11:49:25 -04:00
Niko Matsakis
89d086be74 change color of warning to YELLOW 2016-05-02 11:49:25 -04:00
Niko Matsakis
790043b44e fix snippet tests MORE! 2016-05-02 11:49:25 -04:00
Niko Matsakis
8a9ad72c1d Nit: use Range::contains 2016-05-02 11:49:25 -04:00
Niko Matsakis
ba12ed06ed fix tests better 2016-05-02 11:49:25 -04:00
Niko Matsakis
5db4d620f2 Nit: remove push_primary_span, which was never called 2016-05-02 11:49:25 -04:00
Niko Matsakis
883b969909 Nit: add comment 2016-05-02 11:49:25 -04:00
Niko Matsakis
1fdbfcdbd0 only emit ^ at the start of a multi-line error
as a result, simplify elision code
2016-05-02 11:49:25 -04:00
Niko Matsakis
24f4b151b1 Nit: use last_mut better 2016-05-02 11:49:25 -04:00
Niko Matsakis
94841bea7b Nit: in emitter.rs 2016-05-02 11:49:25 -04:00
Niko Matsakis
f6496cd370 Nit: address various style nits 2016-05-02 11:49:24 -04:00
Niko Matsakis
d5529f000d Nit: do not use RLK 2016-05-02 11:49:24 -04:00
Niko Matsakis
d58a4becf3 Nit: do not import variants from Style 2016-05-02 11:49:24 -04:00
Niko Matsakis
e56121c584 Do not import variants from RenderedLineKind 2016-05-02 11:49:24 -04:00
Niko Matsakis
9a9c9afbe2 Fix whitespace 2016-05-02 11:49:24 -04:00
Niko Matsakis
5adfe5bffe Nit: comments should be uppercase letter 2016-05-02 11:49:24 -04:00
Niko Matsakis
8013eebf2c fix error message in librustc_driver tests 2016-05-02 11:49:24 -04:00
Niko Matsakis
1067850e6a refactor the Emitter trait
There is now a CoreEmitter that everything desugars to, but without
losing any information. Also remove RenderSpan::FileLine. This lets the
rustc_driver tests build.
2016-05-02 11:49:24 -04:00
Niko Matsakis
9d022f2993 rewrite span-length to include strings
It is way easier to copy-and-paste strings from the output
than to figure out how to reproduce them from first
principles.
2016-05-02 11:49:24 -04:00
Niko Matsakis
47143945cc delete the json-errors test
It's primary purpose was to check that json worked at all,
but compiletest does that now.
2016-05-02 11:49:24 -04:00
Niko Matsakis
71c6f81309 change errors from Yellow to Magenta
The Yellow text is very hard to read with a white background.
2016-05-02 11:49:24 -04:00