Commit Graph

29952 Commits

Author SHA1 Message Date
Kevin Ballard
8a8e497ae7 Handle CRLF properly in the lexer
The lexer already ignores CRLF in between tokens, but it doesn't
properly handle carriage returns inside strings and doc comments. Teach
it to treat CRLF as LF inside these tokens, and to disallow carriage
returns that are not followed by linefeeds. This includes handling an
escaped CRLF inside a regular string token the same way it handles an
escaped LF.

This is technically a breaking change, as bare carriage returns are no
longer allowed, and CRLF sequences are now treated as LF inside strings
and doc comments, but it's very unlikely to actually affect any
real-world code.

This change is necessary to have Rust code compile on Windows the same
way it does on Unix. The mozilla/rust repository explicitly sets eol=lf
for Rust source files, but other Rust repositories don't. Notably,
rust-http cannot be compiled on Windows without converting the CRLF line
endings back to LF.

[breaking-change]
2014-06-18 21:07:58 -07:00
bors
f05cd6e04e auto merge of #15014 : brson/rust/all-crates-experimental, r=cmr
This creates a stability baseline for all crates that we distribute that are not `std`. In general, all library code must start as experimental and progress in stages to become stable.
2014-06-19 03:31:18 +00:00
bors
3770c42a49 auto merge of #15025 : alexcrichton/rust/rollup, r=alexcrichton 2014-06-19 01:41:43 +00:00
Alex Crichton
2c3bf8836f Merge conflicts from the rollup
Closes #14480 (vim: Add :RustRun and associated commands)
Closes #14917 (Deprecate free-standing endian conversions in favor of methods on Int. Merge Bitwise into Int and add more bit operations.)
Closes #14981 (librustc: Use expr_ty_adjusted in trans_overloaded_call.)
Closes #14989 (std::task - Revamp TaskBuilder API)
Closes #14997 (Reject double moves out of array elements)
Closes #14998 (Vim: highlight escapes for byte literals.)
Closes #15002 (Fix FIXME #5275)
Closes #15004 (Fix #14865)
Closes #15007 (debuginfo: Add test case for issue #14411.)
Closes #15012 ((doc) Change search placeholder text.)
Closes #15013 (Update compiler-rt.)
Closes #15017 (Deprecate the bytes!() macro.)
2014-06-18 17:23:03 -07:00
Simon Sapin
72f0d45357 Revert bytes!() docstring change, and fix a typo. 2014-06-18 17:02:23 -07:00
Simon Sapin
108b8b6dc7 Deprecate the bytes!() macro.
Replace its usage with byte string literals, except in `bytes!()` tests.
Also add a new snapshot, to be able to use the new b"foo" syntax.

The src/etc/2014-06-rewrite-bytes-macros.py script automatically
rewrites `bytes!()` invocations into byte string literals.
Pass it filenames as arguments to generate a diff that you can inspect,
or `--apply` followed by filenames to apply the changes in place.
Diffs can be piped into `tip` or `pygmentize -l diff` for coloring.
2014-06-18 17:02:22 -07:00
Luqman Aden
abf7e933df Update compiler-rt to work for non-v7 arm. 2014-06-18 17:02:08 -07:00
Zach Pomerantz
ba863c8167 (doc) Change search placeholder text.
Update placeholder text to make keyboard shortcuts more apparent.
2014-06-18 17:02:06 -07:00
Michael Woerister
7cfdfa6ef6 debuginfo: Add test case for issue 14411. 2014-06-18 17:02:02 -07:00
Edward Wang
b1df9aa16f Fix #14865
Fixes a codegen bug which generates illegal non-terminated LLVM block
when there are wildcard pattern with guard and enum patterns in a match
expression. Also refactors the code a little.

Closes #14865
2014-06-18 17:01:58 -07:00
Piotr Jawniak
bde851e969 Fix FIXME #5275
Issue #5275 was closed, but there still was a FIXME for it.
2014-06-18 17:01:56 -07:00
Chris Morgan
b0dff7a191 Vim: highlight invalid characters in char literals. 2014-06-18 17:01:52 -07:00
Chris Morgan
31dfcf9dc1 Vim: highlight escapes for byte literals. 2014-06-18 17:01:52 -07:00
Cameron Zwarich
90f7e3a644 Reject double moves out of array elements
Fixes #14986.
2014-06-18 17:01:50 -07:00
Aaron Turon
f993495560 Fallout from TaskBuilder changes
This commit brings code downstream of libstd up to date with the new
TaskBuilder API.
2014-06-18 17:01:45 -07:00
Aaron Turon
a23511a65d Revamp TaskBuilder API
This patch consolidates and cleans up the task spawning APIs:

* Removes the problematic `future_result` method from `std::task::TaskBuilder`,
  and adds a `try_future` that both spawns the task and returns a future
  representing its eventual result (or failure).

* Removes the public `opts` field from `TaskBuilder`, instead adding appropriate
  builder methods to configure the task.

* Adds extension traits to libgreen and libnative that add methods to
  `TaskBuilder` for spawning the task as a green or native thread.

Previously, there was no way to benefit from the `TaskBuilder` functionality and
also set the scheduler to spawn within.

With this change, all task spawning scenarios are supported through the
`TaskBuilder` interface.

Closes #3725.

[breaking-change]
2014-06-18 17:01:45 -07:00
Luqman Aden
8e9e17d188 librustc: Use expr_ty_adjusted in trans_overloaded_call. 2014-06-18 17:01:41 -07:00
Brendan Zabarauskas
ae7006e373 Update doc comment for Int trait 2014-06-18 17:01:34 -07:00
Brendan Zabarauskas
cb8ca2dafd Shorten endian conversion method names
The consensus on #14917 was that the proposed names were too long.
2014-06-18 17:01:34 -07:00
Brendan Zabarauskas
779ca97525 Remove #[stable] attribute from free-standing endian conversions and mark them as deprecated 2014-06-18 17:01:34 -07:00
Brendan Zabarauskas
ff9f92ce52 Merge the Bitwise and ByteOrder traits into the Int trait
This reduces the complexity of the trait hierarchy.
2014-06-18 17:01:34 -07:00
Brendan Zabarauskas
4c0f8f49f6 Fix comment formatting 2014-06-18 17:01:34 -07:00
Brendan Zabarauskas
b84d17d4d7 Use ByteOrder methods instead of free-standing functions 2014-06-18 17:01:34 -07:00
Brendan Zabarauskas
87c529c43a Add a ByteOrder trait for abstracting over endian conversions
The `Bitwise::swap_bytes` method was also moved into the `ByteOrder` trait. This was because it works on the byte level rather than the bit level.
2014-06-18 17:01:34 -07:00
Kevin Ballard
1273f94cbb Add commands :RustEmitIr and :RustEmitAsm 2014-06-18 17:01:22 -07:00
Kevin Ballard
918eda59be Write documentation for the Rust vim plugin 2014-06-18 17:01:22 -07:00
Kevin Ballard
bd3bebcf60 Rename :Run and :Expand to :RustRun and :RustExpand 2014-06-18 17:01:22 -07:00
Kevin Ballard
303cadfbb3 vim: Add :Run and :Expand commands
Define a command :Run to compile and run the current file. This supports
unnamed buffers (by writing to a temporary file). See the comment above
the command definition for notes on usage.

Define <D-r> and <D-R> mappings for :Run to make it easier to invoke in
MacVim.

Define a command :Expand to display the --pretty expanded output for the
current file. This can be configured to use different pretty types. See
the comment above the command definition for notes on usage.

Create an autoload file and put function definitions there to speed up
load time.
2014-06-18 17:01:21 -07:00
bors
0dcc955459 auto merge of #15006 : alexcrichton/rust/fix-nightly, r=brson
The nightly builds on linux have been failing over the past few days due to a
malformed LD_LIBRARY_PATH. It appears that the underlying cause is that one of
the tests, dep-info-custom, recursively invokes make but the RUSTC variable
passed down has the string "$LD_LIBRARY_PATH". This is intended to read the
host's original LD_LIBRARY_PATH, but it appears that the makefile is eagerly
expanding the "$L" to nothing, causing the original host's LD_LIBRARY_PATH to be
ignored.

This fix removes passing the string "$LD_LIBRARY_PATH" and rather expands it
eagerly to ensure that escaping doesn't happen at a later stage. I'm still not
entirely sure why the makefile is interpreting the dollar as a variable, but
this seems to fix the issue.
2014-06-18 22:41:40 +00:00
bors
6ca454f12c auto merge of #14854 : jakub-/rust/issue-10991, r=pcwalton
Fixes #10991.
2014-06-18 20:51:46 +00:00
Alex Crichton
91c7687f03 test: Attempt to fix nightly-linux
The nightly builds on linux have been failing over the past few days due to a
malformed LD_LIBRARY_PATH. It appears that the underlying cause is that one of
the tests, dep-info-custom, recursively invokes make but the RUSTC variable
passed down has the string "$LD_LIBRARY_PATH". This is intended to read the
host's original LD_LIBRARY_PATH, but it appears that the makefile is eagerly
expanding the "$L" to nothing, causing the original host's LD_LIBRARY_PATH to be
ignored.

This fix removes passing the string "$LD_LIBRARY_PATH" and rather expands it
eagerly to ensure that escaping doesn't happen at a later stage. I'm still not
entirely sure why the makefile is interpreting the dollar as a variable, but
this seems to fix the issue.
2014-06-18 13:50:45 -07:00
Kevin Ballard
d41058ed39 Don't require mutable StringReader to emit lexer errors
Teach StringReader how to emit errors for arbitrary spans, so we don't
need to modify peek_span. This allows for emitting errors without having
a &mut borrow of the StringReader.
2014-06-18 12:06:46 -07:00
Piotr Jawniak
80d8214f95 Remove obsolete test
This test was added long time ago and marked as ignored.
The same test was added later in #8485 as run-fail/issue-3907.rs,
but the old one was not deleted.
2014-06-18 20:50:27 +02:00
bors
557b9e7f0f auto merge of #14879 : Ryman/rust/resolve_super_hint_cut, r=alexcrichton 2014-06-18 18:06:42 +00:00
Kevin Ballard
0f481db211 Fix spans for doc comments 2014-06-18 10:51:27 -07:00
bors
4416b32768 auto merge of #14873 : pnkfelix/rust/fsk-dataflow-revisions, r=nikomatsakis
Fix #6298.  Fix  #13767.

This also includes some drive by fixes for some other issues, noted in the commits.

I still need to integrate regression tests for some cases that I noticed were missing from our unit test suite (i.e. things that compiling rustc exposes that should have been exposed when doing `make check-stage1`).  So do not land this yet, until I get the chance to add those tests.

I just wanted to get the review process started soon, since this has been long in the coming.
2014-06-18 16:16:42 +00:00
Felix S. Klock II
4c2a8bbc09 Adapt test case to match current set of emitted warnings. (or lack
thereof.)

PR 14739 injected the new message that this removes from one test
case: borrowck-vec-pattern-loan-from-mut.rs

When reviewing the test case, I was not able to convince myself that
the error message was a legitimate thing to start emitting.  Niko did
not see an obvious reason for it either, so I am going to remove it
and wait for someone (maybe Cameron Zwarich) to explain to me why we
should be emitting it.
2014-06-18 16:44:21 +02:00
Felix S. Klock II
3ddb987f45 Regression tests for flowgraph construction bug on ExprWhile. 2014-06-18 16:42:57 +02:00
Felix S. Klock II
373b0fc569 some extra test cases to cover in the borrow checker. 2014-06-18 16:42:57 +02:00
Felix S. Klock II
95fdbeee48 fix typo in borrowck doc. 2014-06-18 16:42:57 +02:00
Felix S. Klock II
263a433f19 Ensure dataflow of a proc never looks at blocks from closed-over context.
Details: in a program like:
```
type T = proc(int) -> int; /* 4 */

pub fn outer(captured /* pat 16 */: T) -> T {
    (proc(x /* pat 23 */) {
        ((captured /* 29 */).foo((x /* 30 */)) /* 28 */)
    } /* block 27 */ /* 20 */)
} /* block 19 */ /* 12 */
```
the `captured` arg is moved from the outer fn into the inner proc (id=20).

The old dataflow analysis for flowed_move_data_moves, when looking at
the inner proc, would attempt to add a kill bit for `captured` at the
end of its scope; the problem is that it thought the end of the
`captured` arg's scope was the outer fn (id=12), even though at that
point in the analysis, the `captured` arg's scope should now be
restricted to the proc itself (id=20).

This patch fixes handling of upvars so that dataflow of a fn/proc
should never attempts to add a gen or kill bit to any NodeId outside
of the current fn/proc.  It accomplishes this by adding an `LpUpvar`
variant to `borrowck::LoanPath`, so for cases like `captured` above
will carry both their original `var_id`, as before, as well as the
`NodeId` for the closure that is capturing them.

As a drive-by fix to another occurrence of a similar bug that
nikomatsakis pointed out to me earlier, this also fixes
`gather_loans::compute_kill_scope` so that it computes the kill scope
of the `captured` arg to be block 27; that is, the block for the proc
itself (id=20).

(This is an updated version that generalizes the new loan path variant
to cover all upvars, and thus renamed the variant from `LpCopiedUpvar`
to just `LpUpvar`.)
2014-06-18 16:41:53 +02:00
Felix S. Klock II
4d82456f69 middle::cfg code cleanup.
Namely:

 1. Now that cfg mod is used for dataflow, we do not need to turn on
    the `allow(deadcode)` to placate the linter.

 2. remove dead struct defn.
2014-06-18 16:41:52 +02:00
Felix S. Klock II
75340f4176 Revise dataflow to do a cfg-driven walk.
Fix #6298.

This is instead of the prior approach of emulating cfg traversal
privately by traversing AST in same way).

Of special note, this removes a special case handling of `ExprParen`
that was actually injecting a bug (since it was acting like an
expression like `(*func)()` was consuming `*func` *twice*: once from
`(*func)` and again from `*func`).  nikomatsakis was the first one to
point out that it might suffice to simply have the outer `ExprParen`
do the consumption of the contents (alone).

(This version has been updated to incorporate feedback from Niko's
review of PR 14873.)
2014-06-18 16:38:23 +02:00
Felix S. Klock II
fef63e2f23 NodeIndex should derive Show. 2014-06-18 16:36:25 +02:00
Felix S. Klock II
be9c2d1381 Bug fixes for flowgraph construction.
1. After recursively processing an ExprWhile, need to pop loop_scopes
   the same way we do for ExprLoop.

2. Proposed fix for flowgraph handling of ExprInlineAsm: we need to
   represent the flow into the subexpressions of an `asm!` block.
2014-06-18 16:36:25 +02:00
bors
78cb2f5bc0 auto merge of #14984 : thestinger/rust/libc, r=alexcrichton 2014-06-18 14:26:42 +00:00
bors
34e3232705 auto merge of #14990 : tomjakubowski/rust/emacs-fix-attribute-highlight, r=pnkfelix
This addresses the font lock regression introduced by the earlier pull
request #14818 - attributes are no longer be highligted inside of comments
and strings.

Also add some font lock test infrastructure and some tests for attribute
font locking and fix some minor nits.
2014-06-18 12:36:42 +00:00
bors
fe931c00cc auto merge of #15000 : alexcrichton/rust/fix-rustdoc-tests, r=huonw
Commits have the descriptions.
2014-06-18 10:46:41 +00:00
bors
af622a491a auto merge of #14994 : nick29581/rust/comments, r=bstrie
Plus a few other misc style things.
2014-06-18 08:56:43 +00:00
Alex Crichton
e710653a3b std: Remove dual export of Show
Closes #14996
2014-06-18 01:13:53 -07:00