Commit Graph

52836 Commits

Author SHA1 Message Date
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
Niko Matsakis
41a652e094 WIP factor out RudimentaryEmitter 2016-05-02 11:49:24 -04:00
Niko Matsakis
489a6c95bf replace fileline_{help,note} with {help,note}
The extra filename and line was mainly there to keep the indentation
relative to the main snippet; now that this doesn't include
filename/line-number as a prefix, it is distracted.
2016-05-02 11:49:23 -04:00
Niko Matsakis
1ff1887cc9 thread tighter span for closures around
Track the span corresponding to the `|...|` part of the closure.
2016-05-02 11:47:10 -04:00
Niko Matsakis
e416518e68 update test cases to reflect new messages 2016-05-02 11:47:10 -04:00
Niko Matsakis
d9a947ce8f use new note_expected_found API
This API pulls the "expected type foo, found type bar" out after the
main snippet. There are some other places where it makes sense, but this
is a start.
2016-05-02 11:47:10 -04:00
Niko Matsakis
11dc974a38 refactor to use new snippet code and model
Major changes:
- Remove old snippet rendering code and use the new stuff.
- Introduce `span_label` method to add a label
- Remove EndSpan mode and replace with a fn to get the last
  character of a span.
- Stop using `Option<MultiSpan>` and just use an empty `MultiSpan`
- and probably a bunch of other stuff :)
2016-05-02 11:47:10 -04:00
Niko Matsakis
5b150cf0ca add borrowck info inline in main snippet
This uses the new `span_label` APIs
2016-05-02 11:47:10 -04:00
Niko Matsakis
e7c7a18d94 adapt JSON to new model
Each Span now carries a `is_primary` boolean along with an optional
label. If there are multiple labels for a span, it will appear multiple
times.
2016-05-02 11:47:10 -04:00
Niko Matsakis
a20ee76b56 revamp MultiSpan and introduce new snippet code
MultiSpan model is now:

- set of primary spans
- set of span+label pairs

Primary spans render with `^^^`, secondary spans with `---`.

Labels are placed next to the `^^^` or `---` marker as appropriate.
2016-05-02 11:47:09 -04:00
Ryman
9fe3c065b0 libstd: correct the link to functions in io module documentation
Currently the link refers to it's own section of the documentation rather than the list of functions generated by rustdoc.
2016-05-02 15:54:54 +01:00
Oliver Schneider
ce6ea47d43 refactor infer function
There was no span available in the cast function, but we need to infer the `x` in `x as char` to `u8`.
The spans are now removed from all functions using `infer` and instead added in `eval_const_expr_partial`
2016-05-02 16:40:40 +02:00
Oliver Schneider
f080b13c6b tests 2016-05-02 16:38:49 +02:00
Oliver Schneider
10737a5a45 * as char assumes * to be of type u8 2016-05-02 16:38:33 +02:00
bors
0eb575c702 Auto merge of #33303 - Aatch:mir-coercion-cast, r=arielb1
[MIR] Handle coercion casts properly when building the MIR

Coercion casts (`expr as T` where the type of `expr` can be coerced to
`T`) are essentially no-ops, as the actual work is done by a coercion.
Previously a check for type equality was used to avoid emitting the
redundant cast in the MIR, but this failed for coercion casts of
function items that had lifetime parameters. The MIR trans code doesn't
handle `FnPtr -> FnPtr` casts and produced an error.

Also fixes a bug with type ascription expressions not having any
adjustments applied.

Fixes #33295

/cc @eddyb
2016-05-02 06:58:11 -07:00
Georg Brandl
98d991fac5 parser: change warning into an error on T<A=B, C>
Fixes: #32214
2016-05-02 15:10:28 +02:00
bors
e1a575cb07 Auto merge of #33289 - birkenfeld:chain-find, r=bluss
Implement find() on Chain iterators

This results in a roughly 2x speedup compared to the default impl
"inherited" from Iterator.

Benchmark: https://gist.github.com/birkenfeld/aa9b92cb7d55666dd4821207527eaf5b
2016-05-02 04:46:58 -07:00
bors
d3c2c71988 Auto merge of #33284 - nagisa:mir-fix-constfn-pats, r=alexcrichton
Fix patterns of the constants that are const methods
2016-05-02 02:33:33 -07:00
Oliver Schneider
bf51eafbef check for wrong const_err warnings 2016-05-02 11:26:29 +02:00
Oliver Schneider
12c4a1951e remove unused constant error variants 2016-05-02 11:02:44 +02:00
Taylor Cramer
38c8836051 docs: Changed docs for size_of to describe size as a stride offset
Current description of `std::mem::size_of` is ambiguous, and the
`std::intrinsics::size_of` description incorrectly defines size
as the number of bytes necessary to exactly overwrite a value,
not including the padding between elements necessary in a vector
or structure.
2016-05-01 23:38:01 -07:00
Georg Brandl
9e2300015b lexer: do not display char confusingly in error message
Current code leads to messages like "... use a \xHH escape: \u{e4}"
which is confusing.

The printed span already points to the offending character, which
should be enough to identify the non-ASCII problem.

Fixes: #29088
2016-05-02 07:45:57 +02:00
Georg Brandl
d20b4067fd 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-02 06:14:09 +02:00
Georg Brandl
0e89f55982 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-02 06:10:10 +02:00
bors
700d3e2374 Auto merge of #33190 - jseyfried:improve_diagnostics, r=nrc
resolve: improve diagnostics and lay groundwork for resolving before ast->hir

This PR improves diagnostics in `resolve` and lays some groundwork for resolving before ast->hir.

More specifically,
 - It removes an API in `resolve` intended for external refactoring tools (see #27493) that appears not to be in active use. The API is incompatible with resolving before ast->hir, but could be rewritten in a more compatible and less intrusive way.
 - It improves the diagnostics for pattern bindings that conflict with `const`s.
 - It improves the diagnostics for modules used as expressions (fixes #33186).
 - It refactors away some uses of the hir map, which is unavavailable before ast->hir lowering.

r? @eddyb
2016-05-01 20:39:33 -07:00
bors
855fb61922 Auto merge of #33296 - jseyfried:non_idempotent_lowering, r=nrc
Remove the requirement that ast->hir lowering be reproducible

This PR changes the ast->hir lowerer to be non-reproducible, and it removes the lowering context's id cache.

If the `hir` of an `ast` node needs to be reproduced, we can use the hir map instead of the lowerer -- for example, `tcx.map.expect_expr(expr.id)` instead of `lower_expr(lcx, expr)`.

r? @nrc
2016-05-01 18:28:24 -07:00
Jeffrey Seyfried
ef69ef81e3 Remove outdated comment 2016-05-02 00:43:02 +00:00
Jeffrey Seyfried
522b6ed8a7 Avoid keeping MTWT tables for save-analysis 2016-05-02 00:19:22 +00:00
Jeffrey Seyfried
298a1c056f Cleanup formatting 2016-05-02 00:19:19 +00:00
Jeffrey Seyfried
b8dc2a7c76 Remove the lowering context's id caching system 2016-05-01 23:49:12 +00:00