Commit Graph

52809 Commits

Author SHA1 Message Date
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
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
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
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
Jeffrey Seyfried
ca88c44a90 Avoid using the lowering context in librustc_save_analysis 2016-05-01 23:30:18 +00:00
Jeffrey Seyfried
02df9f32b1 Remove idempotent lowering test 2016-05-01 23:30:14 +00:00
bors
adda14a033 Auto merge of #33298 - drbo:patch-1, r=alexcrichton
Note that later versions of G++ are okay

G++ 4.7 is the minimum requirement, but later versions are also okay.
2016-05-01 16:17:29 -07:00
Georg Brandl
ffba7b7254 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-01 22:24:39 +02:00
bors
a4b0481d1c Auto merge of #33317 - michaelwoerister:fix-partitioning-tests-race, r=alexcrichton
Fix a race condition caused by concurrently executed codegen unit tests.

This hopefully fixes issue #33315.

This short-term solution just makes sure that every test uses its own directory so they can't get into conflict with each other.

As a more long-term solution, I'd probably prefer to make the partitioning scheme specifiable via `-Ccodegen-units` (e.g. like `-Ccodegen-units=per-module`) so that we don't have to rely on `-Zincremental` in these test cases.

r? @alexcrichton
2016-05-01 12:59:25 -07:00
Georg Brandl
b51698ad60 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-01 21:58:46 +02:00
Michael Woerister
a4128e5950 Fix a race condition caused by concurrently executed codegen unit tests. 2016-05-01 13:53:39 -04:00
Oliver Middleton
e8cbcef86e 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-01 13:16:06 +01:00
Georg Brandl
41861691eb libsyntax/pp: replace manual ring buffer with a VecDeque 2016-05-01 12:26:34 +02:00
Georg Brandl
3eef0831cb libsyntax/pp: minor modernizations
* implement Display on Token instead of custom tok_str() fn
* use expression returns
* remove redundant parens in asserts
* remove "/* bad */" comments that appear to be related to early
  changes in memory management
* and a few individual idiomatic changes
2016-05-01 12:26:34 +02:00
James Miller
3906aef5c6 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
2016-05-01 17:56:07 +12:00
Jeffrey Seyfried
0649942a46 Panic on relowering an AST node with a cached node id 2016-04-30 21:33:27 +00:00
Demetri Obenour
08207c9b52 Note that later versions of G++ are okay
G++ 4.7 is the minimum requirement, but later versions are also okay.
2016-04-30 17:21:18 -04:00
bors
2a815a26c8 Auto merge of #33276 - bwinterton:btreeset-insert-doc-fix, r=GuillaumeGomez
Make BTreeSet::Insert docs more consistent

Made the BTreeSet::Insert documentation consistent with the HashSet::Insert documentation by using the term 'value' instead of 'key'.

r? @steveklabnik
2016-04-30 08:59:46 -07:00
bors
9e17622449 Auto merge of #33279 - brson:insert-diatribe-against-github-here, r=alexcrichton
configure: Add a sanity check for tarballs without submodules

Because GitHub publishes broken tarballs on our behalf that we can't
disable, this adds a check that src/liblibc exists, and then
complains if not.

Tested.
2016-04-30 04:55:28 -07:00
Georg Brandl
e6201cfb5c Implement find() on Chain iterators
This results in a roughly 2x speedup compared to the default impl
"inherited" from Iterator.
2016-04-30 11:16:35 +02:00
bors
b0aefff714 Auto merge of #32846 - jseyfried:allow_unconfigured_gated_expanded_items, r=nrc
Avoid gated feature checking unconfigured expanded items

Avoid gated feature checking unconfigured macro-expanded items (fixes #32840).
Unconfigured items that are not macro-expanded are already not gated feature checked.
r? @nrc
2016-04-30 02:07:33 -07:00
Brandon Edens
16eaecbe43 Emit warning to user when attempting to use optimize for size on non-nightly builds. 2016-04-29 22:45:24 -07:00
bors
46504e9a9d Auto merge of #33148 - sfackler:entry-key, r=alexcrichton
Add Entry::key

This method was present on both variants of Entry, but not the enum

cc #32281

r? @alexcrichton
2016-04-29 18:11:25 -07:00
Simonas Kazlauskas
04f8ba2ece Impl int/uint::MIN/MAX in terms of min/max_value 2016-04-30 03:40:34 +03:00
Simonas Kazlauskas
5f956103c8 Fix patterns of the constants that are const meth
See the regression test for the sample code this fixes
2016-04-30 03:40:09 +03:00
bors
9b63263d0d Auto merge of #33229 - timothy-mcroy:master, r=guillaumegomez
Explain E0434
2016-04-29 12:59:39 -07:00