Commit Graph

48059 Commits

Author SHA1 Message Date
Ravi Shankar
7f63c7cf4c Detect confusing unicode characters and show the alternative 2015-11-17 12:14:28 +05:30
bors
929ca3cb51 Auto merge of #29825 - KyleMayes:move-parse-panic, r=sanxiyn
Since these functions are only used by the AST quoting syntax extensions, they should be there instead of in the parser.
2015-11-14 08:03:14 +00:00
bors
45087f36ce Auto merge of #29817 - michaelwoerister:mir-ty-closure-fields, r=nikomatsakis
Add a missing case in LvalueTy::projection_ty() that popped up earlier today.

cc @rust-lang/compiler @nikomatsakis
2015-11-14 06:08:09 +00:00
bors
32202cca27 Auto merge of #29820 - wthrowe:makefile-fixes, r=brson
The first commit fixes the "jobserver unavailable" warning reported at gentoo/gentoo-rust#29.  I don't think the warning is related to the compilation failure shown there.

The remaining commits are minor fixes I noticed while investigating the jobserver warning.
2015-11-14 04:14:22 +00:00
Kyle Mayes
44d8abcc0f Move the panicking parse functions out of the parser
Since these functions are only used by the AST quoting syntax extensions, they should be there instead of in the parser.
2015-11-13 22:18:59 -05:00
bors
b6b17c9899 Auto merge of #29816 - nikomatsakis:incr-comp-visitor-refactor-hir-folder, r=nrc
Simplify HIR folder so that it only maps 1 item to 1 item, removing a bunch of asserts. This is a small refactoring on the way to my larger branch for moving items out of line in the tree and isolating attempts to access them.

r? @nrc
2015-11-14 02:05:05 +00:00
Niko Matsakis
37795baf5f simplify HIR folder so that it only maps 1 item to 1 item,
removing a bunch of asserts
2015-11-13 20:22:07 -05:00
bors
bdfb13518e Auto merge of #29781 - arielb1:mir-casts, r=nikomatsakis
I am also planning to implement casts, but I will probably do it in a separate PR.

r? @nikomatsakis
2015-11-14 00:10:28 +00:00
bors
c10569cac5 Auto merge of #29808 - aphistic:trait-debug-example-fix, r=steveklabnik
The example given for the manual implementation of the core::fmt::Debug trait doesn't match the output after the code sample. This updates it so it matches.
2015-11-13 22:12:51 +00:00
Ariel Ben-Yehuda
b9b45a0e96 address review comments 2015-11-14 00:09:36 +02:00
Ariel Ben-Yehuda
e82f5d4f54 implement coercions in MIR 2015-11-14 00:09:36 +02:00
Ariel Ben-Yehuda
cd1585ffb3 rustc_mir: don't miss the autoref when doing an unsize 2015-11-13 22:47:02 +02:00
Ariel Ben-Yehuda
c1bfd0ca6b implement lvalue_len
no tests - sorry
2015-11-13 22:47:02 +02:00
Ariel Ben-Yehuda
dcb64b52a2 represent fat ptr operands as 2 separate pointers
this does add some complexity, but to do otherwise would require unsized
lvalues to have their own allocas, which would be ugly.
2015-11-13 22:47:02 +02:00
Ariel Ben-Yehuda
602cf7ec3c MIR: implement fat raw pointer comparisons
The implementation itself only requires changes to trans, but
a few additional bugs concerning the handling of fat pointers
had to be fixed.
2015-11-13 22:47:02 +02:00
bors
5f2ffe0066 Auto merge of #29806 - tsion:compile-state-mir_map, r=nikomatsakis
This allows "rustc drop-in replacement" programs like https://github.com/nrc/stupid-stats to access the MIR map.

Working toy example: https://gist.github.com/tsion/288423389e32eb73bb39

r? @nikomatsakis
2015-11-13 20:18:18 +00:00
William Throwe
8d105dd852 Remove extra eval call in snap.mk 2015-11-13 15:15:51 -05:00
William Throwe
a0e10b249e Clean up some "suspicious" whitespace in target.mk
Emacs warns that makefile lines that start with spaces followed by
tabs are "suspicious".  These were harmless since they were
continuation lines, but getting rid of the warning is nice and this
version looks better.
2015-11-13 15:15:51 -05:00
William Throwe
876c33051a Escape some variables in llvm.mk
The important one is $(MAKE).  make handles recipes containing the
literal string "$(MAKE)" specially, so it is important to make sure it
isn't evaluated until recipe invocation time.
2015-11-13 15:15:51 -05:00
bors
3beb159809 Auto merge of #29759 - nagisa:mir-static, r=nikomatsakis
Fixes #29578

r? @nikomatsakis

My own observations are posted inline as comments.
2015-11-13 17:10:25 +00:00
Michael Woerister
9211883e54 MIR: Support closure up-vars in LvalueTy::projection_ty() 2015-11-13 17:01:37 +01:00
bors
ec8ae4b0eb Auto merge of #29811 - bluss:binary-heap-sift-less, r=gankro
BinaryHeap: Simplify sift down

Sift down was doing all too much work: it can stop directly when the
current element obeys the heap property in relation to its children.

In the old code, sift down didn't compare the element to sift down at
all, so it was maximally sifted down and relied on the sift up call to
put it in the correct location.

This should speed up heapify and .pop().

Also rename Hole::removed() to Hole::element()
2015-11-13 14:28:57 +00:00
Ulrik Sverdrup
81fcdd4af9 BinaryHeap: Simplify sift down
Sift down was doing all too much work: it can stop directly when the
current element obeys the heap property in relation to its children.

In the old code, sift down didn't compare the element to sift down at
all, so it was maximally sifted down and relied on the sift up call to
put it in the correct location.

This should speed up heapify and .pop().

Also rename Hole::removed() to Hole::element()
2015-11-13 13:13:23 +01:00
bors
b12a3582b1 Auto merge of #29761 - eefriedman:rename-nopanic, r=sanxiyn
Just `sed s/_nopanic//g`.  Hopefully makes libsyntax a bit more
readable.
2015-11-13 10:28:25 +00:00
bors
82251354ff Auto merge of #29800 - Detegr:master, r=nikomatsakis
Fundamental attribute was missing a feature gate test.
2015-11-13 08:41:50 +00:00
bors
8a813e088c Auto merge of #29675 - bluss:merge-sort-fastpath, r=huonw
sort: Fast path for already sorted data

When merging two sorted blocks `left` and `right` if the last element in
`left` is <= the first in `right`, the blocks are already in sorted order.

Add this as an additional fast path by simply copying the whole left
block into the output and advancing the left pointer. The right block is
then treated the same way by the already present logic in the merge
loop.

Can reduce runtime of .sort() to less than 50% of the previous, if the data
was already perfectly sorted. Sorted data with a few swaps are also
sorted quicker than before. The overhead of one comparison per merge
seems to be negligible.
2015-11-13 01:44:58 +00:00
bors
d5fde83ae7 Auto merge of #29807 - nrc:op_span, r=brson
cc @nagisa
2015-11-12 23:48:56 +00:00
Erik Davidson
83c3125383 Fix the manual implementation example for the Debug trait so it matches the given output 2015-11-12 15:03:36 -06:00
Nick Cameron
224c789ef2 Fix a bad span for binops 2015-11-13 09:34:41 +13:00
bors
5a872880bd Auto merge of #29780 - KyleMayes:quote-ext, r=nrc
This is my first code contribution to Rust, so I'm sure there are some issues with the changes I've made.

I've added the `quote_arg!`, `quote_block!`, `quote_path!`, and `quote_meta_item!` quasiquoting macros. From my experience trying to build AST in compiler plugins, I would like to be able to build any AST piece with a quasiquoting macro (e.g., `quote_struct_field!` or `quote_variant!`) and then use those AST pieces in other quasiquoting macros, but this pull request just adds some of the low-hanging fruit.

I'm not sure if these additions are desirable, and I'm sure these macros can be implemented in an external crate if not.
2015-11-12 20:31:12 +00:00
Scott Olson
83af140b40 Make the mir_map available to the after_analysis CompileController step. 2015-11-12 14:18:11 -06:00
bors
15e7824f1c Auto merge of #29712 - Toby-S:patch-1, r=steveklabnik
Adds `Example` sections to the rest of the integer methods.

cc @steveklabnik
2015-11-12 18:00:27 +00:00
bors
098ea17556 Auto merge of #29757 - dotdash:mir_simplify_cfg, r=nikomatsakis
For now, this pass does some easy transformations, like eliminating
empty blocks that just jump to another block, some trivial
conversion of If terminators into Gotos and removal of dead blocks.

r? @nikomatsakis
2015-11-12 15:48:34 +00:00
Antti Keränen
39c50f74e1 Add feature gate test for #[fundamental] attribute 2015-11-12 16:05:56 +02:00
Björn Steinbrink
a4e5c0fe84 Add a MIR pass to simplify the control flow graph
For now, this pass does some easy transformations, like eliminating
empty blocks that just jump to another block, some trivial
conversion of If terminators into Gotos and removal of dead blocks.
2015-11-12 14:39:23 +01:00
bors
8c9c9513cf Auto merge of #29544 - Ryman:reduce_doc_warnings, r=steveklabnik
Did this alphabetically, so I didn't see [how `std` was doing things](https://dxr.mozilla.org/rust/source/src/libstd/lib.rs#215) till I was nearly finished. If you prefer to add crate-level-whitelists like std instead of test-level, I can rebase with that strategy.

A number of these commits can probably be dropped as the crates don't have much to test, and are deprecated. Let me know which if any to drop! (can also squash after review if desired)

r? @steveklabnik
2015-11-12 13:07:45 +00:00
bors
0bd708461b Auto merge of #29770 - ollie27:assert_eq_unsized, r=alexcrichton
`format_args!` doesn't support none Sized types so we should just pass it the references to `left_val` and `right_val`.

The following works:
```rust
assert!([1, 2, 3][..] == vec![1, 2, 3][..])
```
So I would expect this to as well:
```rust
assert_eq!([1, 2, 3][..], vec![1, 2, 3][..])
```
But it fails with "error: the trait `core::marker::Sized` is not implemented for the type `[_]` [E0277]"
I don't know if this change will have any nasty side effects I don't understand.
2015-11-12 10:38:48 +00:00
bors
afd4a5420c Auto merge of #29795 - Manishearth:rollup, r=Manishearth
- Successful merges: #29776, #29785, #29786, #29787
- Failed merges:
2015-11-12 08:02:43 +00:00
Manish Goregaokar
d1d573d8a8 Fixup #29785 2015-11-12 13:20:48 +05:30
Manish Goregaokar
4f655382c8 Fixup #29776 2015-11-12 13:20:16 +05:30
Manish Goregaokar
8844190801 Rollup merge of #29787 - dbrgn:docs-fix, r=steveklabnik
Fix usage of wrong article in `Result` docs.

This is my first rust PR, if something about the process is wrong let me know.

As this is a documentation change, I believe the correct highfive line to use is the following:

r? @steveklabnik
2015-11-12 13:18:51 +05:30
Manish Goregaokar
a8b6697a32 Rollup merge of #29786 - steveklabnik:stage0fix, r=brson 2015-11-12 13:18:51 +05:30
Manish Goregaokar
5b55b8d2e5 Rollup merge of #29785 - steveklabnik:doc_prelude, r=nikomatsakis
This mostly brings them in line with existing linking convention, but
also has some minor re-wording.

The text at the top has been re-focused, by starting out with what the
prelude does, rather than starting from injecting std.

Also, it now mentions that other preludes exist.

Part of https://github.com/rust-lang/rust/issues/29369
2015-11-12 13:18:51 +05:30
Manish Goregaokar
b7f6d7239b Rollup merge of #29776 - nikomatsakis:mir-29740, r=nrc
In previous PRs, I changed the match desugaring to generate more efficient code for ints/chars and the like. But this doesn't help when you're matching strings, ranges, or other crazy complex things (leading to #29740). This commit restructures match desugaring *yet again* to handle that case better -- basically we now degenerate to an if-else-if chain in such cases.

~~Note that this builds on https://github.com/rust-lang/rust/pull/29763 which will hopefully land soon. So ignore the first few commits.~~ landed now

r? @Aatch since he's been reviewing the other commits in this series
2015-11-12 13:18:51 +05:30
Kevin Butler
5ae1937129 trpl: add a small section outlining doctest configuration 2015-11-12 05:17:11 +00:00
Kevin Butler
8e23e2fbcb libtest: deny warnings in doctests 2015-11-12 05:17:07 +00:00
Kevin Butler
c0fc402ab6 libterm: deny warnings in doctests 2015-11-12 05:17:02 +00:00
Kevin Butler
d64e551248 libsyntax: deny warnings in doctests 2015-11-12 05:16:57 +00:00
Kevin Butler
a17f81b4b7 libserialize: deny warnings in doctests 2015-11-12 05:16:53 +00:00
Kevin Butler
7ee329ac6e librustc_unicode: deny warnings in doctests 2015-11-12 05:16:48 +00:00