]> git.lizzy.rs Git - rust.git/log
rust.git
8 years agoAdd `get_mut` methods to the `RefCell` and `Cell`
Tobias Bucher [Thu, 5 May 2016 22:39:25 +0000 (00:39 +0200)]
Add `get_mut` methods to the `RefCell` and `Cell`

This is safe since the borrow checker ensures that we have the only
mutable reference to the struct, thus we can safely borrow its interior.

Tracking issue is #33444.

8 years agoAuto merge of #33128 - xen0n:more-confusing-unicode-chars, r=nagisa
bors [Thu, 5 May 2016 15:50:23 +0000 (08:50 -0700)]
Auto merge of #33128 - xen0n:more-confusing-unicode-chars, r=nagisa

Add more aliases for Unicode confusable chars

Building upon #29837, this PR:

* added aliases for space characters,
* distinguished square brackets from parens, and
* added common CJK punctuation characters as aliases.

This will especially help CJK users who may have forgotten to switch off IME when coding.

8 years agoAuto merge of #33067 - notriddle:wrapping_neg, r=alexcrichton
bors [Thu, 5 May 2016 07:37:56 +0000 (00:37 -0700)]
Auto merge of #33067 - notriddle:wrapping_neg, r=alexcrichton

Implement negation for wrapping numerals.

Fixes #33037

8 years agoAuto merge of #33381 - alexcrichton:fix-nightlies, r=nikomatsakis
bors [Thu, 5 May 2016 00:38:39 +0000 (17:38 -0700)]
Auto merge of #33381 - alexcrichton:fix-nightlies, r=nikomatsakis

mk: Pass CFLAGS for target, not host

This changes the CFLAGS and related variables passed to compiletest to be passed
for the target, not the host, so we can correctly test 32-bit cross compiles on
64-bit host machines.

Hopefuly fixes #33379

8 years agoAuto merge of #33376 - Manishearth:rollup, r=Manishearth
bors [Wed, 4 May 2016 21:26:28 +0000 (14:26 -0700)]
Auto merge of #33376 - Manishearth:rollup, r=Manishearth

Rollup of 14 pull requests

- Successful merges: #33277, #33294, #33314, #33322, #33333, #33338, #33339, #33340, #33343, #33357, #33363, #33365, #33371, #33372
- Failed merges:

8 years agomk: Pass CFLAGS for target, not host
Alex Crichton [Tue, 3 May 2016 16:34:35 +0000 (09:34 -0700)]
mk: Pass CFLAGS for target, not host

This changes the CFLAGS and related variables passed to compiletest to be passed
for the target, not the host, so we can correctly test 32-bit cross compiles on
64-bit host machines.

Hopefuly fixes #33379

8 years agoRollup merge of #33372 - birkenfeld:rustdoc-escape-code, r=cmr
Manish Goregaokar [Tue, 3 May 2016 13:39:09 +0000 (19:09 +0530)]
Rollup merge of #33372 - birkenfeld:rustdoc-escape-code, r=cmr

rustdoc: HTML-escape Rust code (from constants)

Especially in cases like the one in the test file, this can blow up the rendering big time if string constants in the code contain HTML.

But also other constants can contain special chars (e.g. `&` as an operator in constant expressions).

8 years agoRollup merge of #33371 - birkenfeld:issue-33302, r=cmr
Manish Goregaokar [Tue, 3 May 2016 13:39:09 +0000 (19:09 +0530)]
Rollup merge of #33371 - birkenfeld:issue-33302, r=cmr

rustdoc: fix inserting source code spans for constant values

This will go wrong when the constants partially result from macro expansion.
Instead, use the expressions and pretty-print them as Rust code.

Fixes: #33302
8 years agoRollup merge of #33357 - pcwalton:inline-mem-forget, r=brson
Manish Goregaokar [Tue, 3 May 2016 13:39:09 +0000 (19:09 +0530)]
Rollup merge of #33357 - pcwalton:inline-mem-forget, r=brson

libcore: Inline `mem::forget()`.

Was causing severe performance problems in WebRender.

r? @brson

8 years agoRollup merge of #33343 - birkenfeld:issue-32214, r=Manishearth
Manish Goregaokar [Tue, 3 May 2016 13:39:08 +0000 (19:09 +0530)]
Rollup merge of #33343 - birkenfeld:issue-32214, r=Manishearth

parser: change warning into an error on `T<A=B, C>`

part of #32214

This seems to be the obvious fix, and the error message is consistent with all the other parser errors ("expected x, found y").

8 years agoRollup merge of #33340 - birkenfeld:issue-23716, r=Manishearth
Manish Goregaokar [Tue, 3 May 2016 13:39:08 +0000 (19:09 +0530)]
Rollup merge of #33340 - birkenfeld:issue-23716, r=Manishearth

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
8 years agoRollup merge of #33339 - oli-obk:fix/const_eval, r=japaric
Manish Goregaokar [Tue, 3 May 2016 13:39:08 +0000 (19:09 +0530)]
Rollup merge of #33339 - oli-obk:fix/const_eval, r=japaric

fix various const eval errors

These were found after const_evaluating arbitrary expressions and linting if the const evaluator failed

fixes #33275 (int -> float casts for negative ints)
fixes #33291 (int -> char casts (new! wasn't allowed in constants until this PR))

r? @eddyb

cc @bluss @japaric

8 years agoRollup merge of #33322 - justsostephen:master, r=steveklabnik
Manish Goregaokar [Tue, 3 May 2016 13:39:07 +0000 (19:09 +0530)]
Rollup merge of #33322 - justsostephen:master, r=steveklabnik

doc/book/getting-started.md: Spelling correction and revised wording.

The word 'Internet' was spelt with both an uppercase and a lowercase 'I'. The correct spelling seems to be a matter of some debate these days, however the first occurrence in the file has an uppercase 'I', so I've changed the second occurrence to suit for consistency.

Under the section titled 'Converting to Cargo', there's mention of creating a new executable. This, however, is not part of the process described. I've revised the wording to reflect as much.

Small changes, but I hope they are of benefit! :-)

r? @steveklabnik

8 years agoRollup merge of #33294 - timothy-mcroy:E0501, r=GuillaumeGomez
Manish Goregaokar [Tue, 3 May 2016 13:39:07 +0000 (19:09 +0530)]
Rollup merge of #33294 - timothy-mcroy:E0501, r=GuillaumeGomez

Add detailed error explanation for E0501

r? @GuillaumeGomez

Bring on the nits!

8 years agoRollup merge of #33277 - birkenfeld:fmt-named-dollar-args, r=steveklabnik
Manish Goregaokar [Tue, 3 May 2016 13:39:06 +0000 (19:09 +0530)]
Rollup merge of #33277 - birkenfeld:fmt-named-dollar-args, r=steveklabnik

Fix std::fmt format spec: named args are allowed with "$" syntax

8 years agorustdoc: HTML-escape Rust code (from constants)
Georg Brandl [Tue, 3 May 2016 11:31:12 +0000 (13:31 +0200)]
rustdoc: HTML-escape Rust code (from constants)

Especially in cases like the one in the test file, this can blow
up the docs big time if string constants in the code contain HTML.

But also other constants can contain special chars (e.g. `&` as an
operator in constant expressions).

8 years agoAuto merge of #33330 - birkenfeld:issue-29121, r=Manishearth
bors [Tue, 3 May 2016 11:23:13 +0000 (04:23 -0700)]
Auto merge of #33330 - birkenfeld:issue-29121, r=Manishearth

typeck: when suggesting associated fns, do not show call site as fallback

In case we cannot produce a span for the location of the definition, just do not show a span at all.

cc: #29121

8 years agorustdoc: fix inserting source code spans for constant values
Georg Brandl [Tue, 3 May 2016 11:09:42 +0000 (13:09 +0200)]
rustdoc: fix inserting source code spans for constant values

This will go wrong when the constants partially result from macro expansion.
Instead, use the expressions and pretty-print them as Rust code.

Fixes: #33302
8 years agoAuto merge of #33119 - nrc:pretty, r=pnkfelix
bors [Tue, 3 May 2016 06:56:48 +0000 (23:56 -0700)]
Auto merge of #33119 - nrc:pretty, r=pnkfelix

Refactor pretty printing to use the compiler API

8 years agotypeck: when suggesting associated fns, do not show call site as fallback
Georg Brandl [Mon, 2 May 2016 05:23:56 +0000 (07:23 +0200)]
typeck: when suggesting associated fns, do not show call site as fallback

In case we cannot produce a span for the location of the definition,
just do not show a span at all.

cc: #29121

8 years agoAuto merge of #33354 - Manishearth:rollup, r=Manishearth
bors [Tue, 3 May 2016 04:37:18 +0000 (21:37 -0700)]
Auto merge of #33354 - Manishearth:rollup, r=Manishearth

Rollup of 14 pull requests

- Successful merges: #32756, #33129, #33225, #33260, #33309, #33320, #33323, #33324, #33325, #33330, #33332, #33334, #33335, #33346
- Failed merges:

8 years agoRollup merge of #33346 - Ryman:patch-4, r=alexcrichton
Manish Goregaokar [Mon, 2 May 2016 19:32:45 +0000 (01:02 +0530)]
Rollup merge of #33346 - Ryman:patch-4, r=alexcrichton

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.

i.e. [this](http://doc.rust-lang.org/std/io/index.html#functions) should link to [this](http://doc.rust-lang.org/std/io/index.html#functions-1)

8 years agoRollup merge of #33335 - cramertj:master, r=alexcrichton
Manish Goregaokar [Mon, 2 May 2016 19:32:45 +0000 (01:02 +0530)]
Rollup merge of #33335 - cramertj:master, r=alexcrichton

docs: Changed docs for `size_of` to describe size as a stride offset

Current documentation for `std::mem::size_of` is ambiguous, and the documentation for `std::intrinsics::size_of` incorrectly defines size.

This fix re-defines size as the offset in bytes between successive instances of a type, as described in LLVM's [getTypeAllocSize](http://llvm.org/docs/doxygen/html/classllvm_1_1DataLayout.html#a1d6fcc02e91ba24510aba42660c90e29).

Fixes: #33266
8 years agoRollup merge of #33334 - birkenfeld:issue29088, r=Manishearth
Manish Goregaokar [Mon, 2 May 2016 19:32:45 +0000 (01:02 +0530)]
Rollup merge of #33334 - birkenfeld:issue29088, r=Manishearth

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
8 years agoRollup merge of #33332 - alexcrichton:handle-more-races, r=michaelwoerister
Manish Goregaokar [Mon, 2 May 2016 19:32:44 +0000 (01:02 +0530)]
Rollup merge of #33332 - alexcrichton:handle-more-races, r=michaelwoerister

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.

8 years agoRollup merge of #33325 - birkenfeld:issue-31341, r=jseyfried
Manish Goregaokar [Mon, 2 May 2016 19:32:44 +0000 (01:02 +0530)]
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
8 years agoRollup merge of #33324 - birkenfeld:issue-30497, r=GuillaumeGomez
Manish Goregaokar [Mon, 2 May 2016 19:32:44 +0000 (01:02 +0530)]
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
8 years agoRollup merge of #33323 - birkenfeld:issue-31221, r=Manishearth
Manish Goregaokar [Mon, 2 May 2016 19:32:44 +0000 (01:02 +0530)]
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.

8 years agoRollup merge of #33320 - birkenfeld:issue31573, r=arielb1
Manish Goregaokar [Mon, 2 May 2016 19:32:43 +0000 (01:02 +0530)]
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).

8 years agoRollup merge of #33309 - birkenfeld:pp, r=nrc
Manish Goregaokar [Mon, 2 May 2016 19:32:43 +0000 (01:02 +0530)]
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.

8 years agoRollup merge of #32756 - nikomatsakis:borrowck-snippet, r=nrc
Manish Goregaokar [Mon, 2 May 2016 19:32:42 +0000 (01:02 +0530)]
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

8 years agoAuto merge of #32756 - nikomatsakis:borrowck-snippet, r=nrc
bors [Tue, 3 May 2016 02:21:56 +0000 (19:21 -0700)]
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

8 years agorebasing
Nick Cameron [Tue, 26 Apr 2016 02:06:24 +0000 (14:06 +1200)]
rebasing

Note that this whole PR is a [breaking-change] for clients of the Compiler API.

8 years agoFix tests
Nick Cameron [Thu, 21 Apr 2016 05:28:25 +0000 (17:28 +1200)]
Fix tests

8 years agoRefactor pretty printing to use more of the driver
Nick Cameron [Wed, 20 Apr 2016 22:29:49 +0000 (10:29 +1200)]
Refactor pretty printing to use more of the driver

8 years agoUse the compiler API to run pretty printing.
Nick Cameron [Wed, 20 Apr 2016 04:24:14 +0000 (16:24 +1200)]
Use the compiler API to run pretty printing.

This commit still does a lot of building in pretty because we always run after parsing.

8 years agoMake pretty printer take Session by ref
Nick Cameron [Tue, 19 Apr 2016 23:48:52 +0000 (11:48 +1200)]
Make pretty printer take Session by ref

8 years agolibcore: Inline `mem::forget()`.
Patrick Walton [Mon, 2 May 2016 20:57:53 +0000 (13:57 -0700)]
libcore: Inline `mem::forget()`.

Was causing severe performance problems in WebRender.

8 years agoresolve: print location of static for "static in pattern" error
Georg Brandl [Mon, 2 May 2016 09:26:34 +0000 (11:26 +0200)]
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
8 years agoAuto merge of #32386 - brandonedens:llvm_min_size, r=alexcrichton
bors [Mon, 2 May 2016 18:27:20 +0000 (11:27 -0700)]
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

8 years agoassert we get at least two rendered lines back
Niko Matsakis [Mon, 2 May 2016 17:05:14 +0000 (13:05 -0400)]
assert we get at least two rendered lines back

8 years agorustc: Handle concurrent `create_dir` requests
Alex Crichton [Mon, 2 May 2016 05:33:22 +0000 (22:33 -0700)]
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.

8 years agoAuto merge of #33308 - ollie27:wingnu_jemalloc, r=alexcrichton
bors [Mon, 2 May 2016 16:16:23 +0000 (09:16 -0700)]
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.

8 years agoavoid double panic
Niko Matsakis [Mon, 2 May 2016 15:44:25 +0000 (11:44 -0400)]
avoid double panic

8 years agodo not fail if len(rendered_lines) is == 1
Niko Matsakis [Mon, 2 May 2016 15:37:59 +0000 (11:37 -0400)]
do not fail if len(rendered_lines) is == 1

also handle more rendered-lines

8 years agoFix unicode test to use original error format
jonathandturner [Sat, 30 Apr 2016 16:06:01 +0000 (09:06 -0700)]
Fix unicode test to use original error format

8 years agopatch travis failure
Niko Matsakis [Sat, 30 Apr 2016 13:54:48 +0000 (09:54 -0400)]
patch travis failure

8 years agoupdate unit tests
Niko Matsakis [Sat, 30 Apr 2016 01:13:42 +0000 (21:13 -0400)]
update unit tests

8 years agofix rebase flaws
Niko Matsakis [Fri, 29 Apr 2016 22:08:02 +0000 (18:08 -0400)]
fix rebase flaws

8 years agoFix up error-pattern style test
Jonathan Turner [Fri, 29 Apr 2016 21:06:20 +0000 (14:06 -0700)]
Fix up error-pattern style test

8 years agoFinish up with 'old school' error mode
Jonathan Turner [Fri, 29 Apr 2016 20:27:40 +0000 (13:27 -0700)]
Finish up with 'old school' error mode

8 years agoAdd back in a 'old school' error format
Jonathan Turner [Thu, 28 Apr 2016 23:39:59 +0000 (16:39 -0700)]
Add back in a 'old school' error format

8 years agomove "lint level defined here" into secondary note
Niko Matsakis [Wed, 27 Apr 2016 23:59:57 +0000 (19:59 -0400)]
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.

8 years agochange color of warning to YELLOW
Niko Matsakis [Wed, 27 Apr 2016 23:51:12 +0000 (19:51 -0400)]
change color of warning to YELLOW

8 years agofix snippet tests MORE!
Niko Matsakis [Wed, 27 Apr 2016 14:45:35 +0000 (10:45 -0400)]
fix snippet tests MORE!

8 years agoNit: use Range::contains
Niko Matsakis [Wed, 27 Apr 2016 02:59:15 +0000 (22:59 -0400)]
Nit: use Range::contains

8 years agofix tests better
Niko Matsakis [Wed, 27 Apr 2016 02:52:56 +0000 (22:52 -0400)]
fix tests better

8 years agoNit: remove push_primary_span, which was never called
Niko Matsakis [Wed, 27 Apr 2016 01:08:54 +0000 (21:08 -0400)]
Nit: remove push_primary_span, which was never called

8 years agoNit: add comment
Niko Matsakis [Wed, 27 Apr 2016 01:06:53 +0000 (21:06 -0400)]
Nit: add comment

8 years agoonly emit `^` at the start of a multi-line error
Niko Matsakis [Tue, 26 Apr 2016 16:33:38 +0000 (09:33 -0700)]
only emit `^` at the start of a multi-line error

as a result, simplify elision code

8 years agoNit: use last_mut better
Niko Matsakis [Tue, 26 Apr 2016 17:36:30 +0000 (13:36 -0400)]
Nit: use last_mut better

8 years agoNit: in emitter.rs
Niko Matsakis [Tue, 26 Apr 2016 17:36:19 +0000 (13:36 -0400)]
Nit: in emitter.rs

8 years agoNit: address various style nits
Niko Matsakis [Tue, 26 Apr 2016 17:06:28 +0000 (13:06 -0400)]
Nit: address various style nits

8 years agoNit: do not use RLK
Niko Matsakis [Tue, 26 Apr 2016 16:53:20 +0000 (12:53 -0400)]
Nit: do not use RLK

8 years agoNit: do not import variants from Style
Niko Matsakis [Tue, 26 Apr 2016 16:52:28 +0000 (12:52 -0400)]
Nit: do not import variants from Style

8 years agoDo not import variants from RenderedLineKind
Niko Matsakis [Tue, 26 Apr 2016 16:49:10 +0000 (12:49 -0400)]
Do not import variants from RenderedLineKind

8 years agoFix whitespace
Niko Matsakis [Tue, 26 Apr 2016 16:49:05 +0000 (12:49 -0400)]
Fix whitespace

8 years agoNit: comments should be uppercase letter
Niko Matsakis [Tue, 26 Apr 2016 16:48:54 +0000 (12:48 -0400)]
Nit: comments should be uppercase letter

8 years agofix error message in librustc_driver tests
Niko Matsakis [Thu, 21 Apr 2016 08:47:01 +0000 (04:47 -0400)]
fix error message in librustc_driver tests

8 years agorefactor the Emitter trait
Niko Matsakis [Thu, 21 Apr 2016 00:00:25 +0000 (20:00 -0400)]
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.

8 years agorewrite span-length to include strings
Niko Matsakis [Wed, 20 Apr 2016 21:47:42 +0000 (17:47 -0400)]
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.

8 years agodelete the json-errors test
Niko Matsakis [Wed, 20 Apr 2016 21:35:32 +0000 (17:35 -0400)]
delete the json-errors test

It's primary purpose was to check that json worked at all,
but compiletest does that now.

8 years agochange errors from Yellow to Magenta
Niko Matsakis [Wed, 20 Apr 2016 20:08:51 +0000 (16:08 -0400)]
change errors from Yellow to Magenta

The Yellow text is very hard to read with a white background.

8 years agoWIP factor out RudimentaryEmitter
Niko Matsakis [Wed, 20 Apr 2016 19:52:52 +0000 (15:52 -0400)]
WIP factor out RudimentaryEmitter

8 years agoreplace fileline_{help,note} with {help,note}
Niko Matsakis [Wed, 20 Apr 2016 18:49:16 +0000 (14:49 -0400)]
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.

8 years agothread tighter span for closures around
Niko Matsakis [Wed, 20 Apr 2016 18:44:07 +0000 (14:44 -0400)]
thread tighter span for closures around

Track the span corresponding to the `|...|` part of the closure.

8 years agoupdate test cases to reflect new messages
Niko Matsakis [Wed, 20 Apr 2016 18:42:13 +0000 (14:42 -0400)]
update test cases to reflect new messages

8 years agouse new `note_expected_found` API
Niko Matsakis [Wed, 20 Apr 2016 19:00:05 +0000 (15:00 -0400)]
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.

8 years agorefactor to use new snippet code and model
Niko Matsakis [Wed, 20 Apr 2016 18:56:01 +0000 (14:56 -0400)]
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 :)

8 years agoadd borrowck info inline in main snippet
Niko Matsakis [Wed, 20 Apr 2016 18:45:28 +0000 (14:45 -0400)]
add borrowck info inline in main snippet

This uses the new `span_label` APIs

8 years agoadapt JSON to new model
Niko Matsakis [Wed, 20 Apr 2016 18:57:20 +0000 (14:57 -0400)]
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.

8 years agorevamp MultiSpan and introduce new snippet code
Niko Matsakis [Wed, 20 Apr 2016 18:52:31 +0000 (14:52 -0400)]
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.

8 years agolibstd: correct the link to functions in io module documentation
Ryman [Mon, 2 May 2016 14:54:54 +0000 (15:54 +0100)]
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.

8 years agorefactor infer function
Oliver Schneider [Mon, 2 May 2016 14:40:40 +0000 (16:40 +0200)]
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`

8 years agotests
Oliver Schneider [Mon, 2 May 2016 14:38:49 +0000 (16:38 +0200)]
tests

8 years ago`* as char` assumes `*` to be of type `u8`
Oliver Schneider [Mon, 2 May 2016 14:38:33 +0000 (16:38 +0200)]
`* as char` assumes `*` to be of type `u8`

8 years agoAuto merge of #33303 - Aatch:mir-coercion-cast, r=arielb1
bors [Mon, 2 May 2016 13:58:11 +0000 (06:58 -0700)]
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

8 years agoparser: change warning into an error on `T<A=B, C>`
Georg Brandl [Mon, 2 May 2016 13:09:36 +0000 (15:09 +0200)]
parser: change warning into an error on `T<A=B, C>`

Fixes: #32214
8 years agoAuto merge of #33289 - birkenfeld:chain-find, r=bluss
bors [Mon, 2 May 2016 11:46:58 +0000 (04:46 -0700)]
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

8 years agoAuto merge of #33284 - nagisa:mir-fix-constfn-pats, r=alexcrichton
bors [Mon, 2 May 2016 09:33:33 +0000 (02:33 -0700)]
Auto merge of #33284 - nagisa:mir-fix-constfn-pats, r=alexcrichton

Fix patterns of the constants that are const methods

8 years agocheck for wrong const_err warnings
Oliver Schneider [Mon, 2 May 2016 09:26:29 +0000 (11:26 +0200)]
check for wrong const_err warnings

8 years agoremove unused constant error variants
Oliver Schneider [Mon, 2 May 2016 09:02:44 +0000 (11:02 +0200)]
remove unused constant error variants

8 years agodocs: Changed docs for `size_of` to describe size as a stride offset
Taylor Cramer [Mon, 2 May 2016 06:30:12 +0000 (23:30 -0700)]
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.

8 years agolexer: do not display char confusingly in error message
Georg Brandl [Mon, 2 May 2016 05:44:21 +0000 (07:44 +0200)]
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
8 years agodiagnostics for E0432: imports are relative to crate root
Georg Brandl [Sun, 1 May 2016 18:40:16 +0000 (20:40 +0200)]
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).

8 years agoE0269: add suggestion to check for trailing semicolons
Georg Brandl [Sun, 1 May 2016 20:12:48 +0000 (22:12 +0200)]
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
8 years agoAuto merge of #33190 - jseyfried:improve_diagnostics, r=nrc
bors [Mon, 2 May 2016 03:39:33 +0000 (20:39 -0700)]
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

8 years agoAuto merge of #33296 - jseyfried:non_idempotent_lowering, r=nrc
bors [Mon, 2 May 2016 01:28:24 +0000 (18:28 -0700)]
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

8 years agoRemove outdated comment
Jeffrey Seyfried [Mon, 2 May 2016 00:43:02 +0000 (00:43 +0000)]
Remove outdated comment

8 years agoAvoid keeping MTWT tables for save-analysis
Jeffrey Seyfried [Sun, 1 May 2016 23:49:26 +0000 (23:49 +0000)]
Avoid keeping MTWT tables for save-analysis