Jeffrey Seyfried
8dca72be9b
Optimize syntax::tokenstream::Cursor
.
2017-03-03 02:05:55 +00:00
Jeffrey Seyfried
0143774cb5
Remove lifetime parameter from syntax::tokenstream::Cursor
.
2017-03-03 01:52:48 +00:00
bors
c0b7112ba2
Auto merge of #40216 - frewsxcv:rollup, r=frewsxcv
...
Rollup of 7 pull requests
- Successful merges: #39832 , #40104 , #40110 , #40117 , #40129 , #40139 , #40166
- Failed merges:
2017-03-02 20:10:40 +00:00
Corey Farwell
c883f4f584
Rollup merge of #40129 - abonander:proc_macro_bang, r=jseyfried
...
Implement function-like procedural macros ( `#[proc_macro]`)
Adds the `#[proc_macro]` attribute, which expects bare functions of the kind `fn(TokenStream) -> TokenStream`, which can be invoked like `my_macro!()`.
cc rust-lang/rfcs#1913, #38356
r? @jseyfried
cc @nrc
2017-03-02 14:53:46 -05:00
Corey Farwell
aef07cd991
Rollup merge of #40110 - benschreiber:nostackcheck, r=brson
...
Made no_stack_check a stable_removed attribute
r? @brson
2017-03-02 14:53:43 -05:00
Philipp Oppermann
b44805875e
Add support for x86-interrupt calling convention
...
Tracking issue: https://github.com/rust-lang/rust/issues/40180
This calling convention can be used for definining interrupt handlers on
32-bit and 64-bit x86 targets. The compiler then uses `iret` instead of
`ret` for returning and ensures that all registers are restored to their
original values.
Usage:
```
extern "x86-interrupt" fn handler(stack_frame: &ExceptionStackFrame) {…}
```
for interrupts and exceptions without error code and
```
extern "x86-interrupt" fn page_fault_handler(stack_frame: &ExceptionStackFrame,
error_code: u64) {…}
```
for exceptions that push an error code (e.g., page faults or general
protection faults). The programmer must ensure that the correct version
is used for each interrupt.
For more details see the [LLVM PR][1] and the corresponding [proposal][2].
[1]: https://reviews.llvm.org/D15567
[2]: http://lists.llvm.org/pipermail/cfe-dev/2015-September/045171.html
2017-03-02 19:01:15 +01:00
bors
5907ed63d3
Auto merge of #39655 - durka:recursion-limit-suggestion, r=nikomatsakis
...
suggest doubling recursion limit in more situations
Fixes #38852 .
r? @bluss
2017-03-02 17:44:17 +00:00
Alex Burka
6e259dc778
note -> help
2017-03-02 07:11:22 +00:00
Austin Bonander
2fcbb48c72
Implement function-like procedural macros ( #[proc_macro]
)
2017-02-28 18:34:22 -08:00
Jeffrey Seyfried
61a9a14d29
Add warning cycle.
2017-02-28 22:15:12 +00:00
Jeffrey Seyfried
7f822c800d
Refactor out parser.expect_delimited_token_tree()
.
2017-02-28 22:15:11 +00:00
Jeffrey Seyfried
752413005e
Merge repeat_idx
and repeat_len
.
2017-02-28 22:15:10 +00:00
Jeffrey Seyfried
0cc7053efa
Remove Token::MatchNt
.
2017-02-28 22:15:09 +00:00
Jeffrey Seyfried
d8b34e9a74
Add syntax::ext::tt::quoted::{TokenTree, ..}
and remove tokenstream::TokenTree::Sequence
.
2017-02-28 22:14:29 +00:00
Jeffrey Seyfried
2471888033
Avoid Token::{OpenDelim, CloseDelim}
.
2017-02-28 22:13:39 +00:00
Jeffrey Seyfried
8c4960bfde
Remove ext::tt::transcribe::tt_next_token
.
2017-02-28 22:13:38 +00:00
Jeffrey Seyfried
abdc68973e
Clean up ext::tt::transcribe::TtFrame
, rename to Frame
.
2017-02-28 22:13:37 +00:00
Jeffrey Seyfried
d09e512158
Remove a loop
in ext::tt::transcribe
.
2017-02-28 22:13:34 +00:00
Eduard Burtescu
f702b20dfd
rustc_save_analysis: don't pollute the codemap with fake files.
2017-02-28 08:30:07 +02:00
Ben Schreiber
9c5e4afb17
removed unneeded comment blocks
2017-02-25 21:49:24 -06:00
Ben Schreiber
98fd50a079
teach rustc about remove_stable_features and removed no-stack-chech feature. fixes #34915
2017-02-25 21:42:22 -06:00
Eduard-Mihai Burtescu
ba11640179
rustc_typeck: hook up collect and item/body check to on-demand.
2017-02-25 18:35:25 +02:00
Eduard-Mihai Burtescu
e8d01ea4c7
rustc: store type parameter defaults outside of ty::Generics.
2017-02-25 17:07:59 +02:00
Eduard-Mihai Burtescu
69e596744f
Rollup merge of #40027 - cramertj:stabilize_static_recursion, r=nrc
...
Stabilize static_recursion
Fix #29719 .
2017-02-25 14:13:35 +02:00
Eduard-Mihai Burtescu
c3075f3d96
Rollup merge of #40025 - est31:master, r=eddyb
...
Implement non-capturing closure to fn coercion
Implements non capturing closure coercion ([RFC 1558](https://github.com/rust-lang/rfcs/blob/master/text/1558-closure-to-fn-coercion.md )).
cc tracking issue #39817
2017-02-25 14:13:33 +02:00
Eduard-Mihai Burtescu
a6a5c32e0e
Rollup merge of #39953 - keeperofdakeys:macro-error, r=jseyfried
...
Provide suggestions for unknown macros imported with `use`
cc https://github.com/rust-lang/rust/issues/30197
r? @jseyfried
2017-02-25 14:13:23 +02:00
est31
f753a6ef02
Feature gate
2017-02-23 22:32:25 +01:00
Josh Driver
4ecdc68153
Move MacroKind into Def::Macro
2017-02-23 20:12:33 +10:30
Taylor Cramer
802a826a57
Stabilize static_recursion
2017-02-21 23:41:04 -08:00
Steve Klabnik
a1301c3495
Create "The Unstable Book"
...
part of #39588
2017-02-21 21:12:52 -05:00
Guillaume Gomez
b6818be41d
Add long error explanations
2017-02-21 15:52:14 +01:00
Guillaume Gomez
ea2a684099
Add error codes for errors in libsyntax
2017-02-20 17:47:44 +01:00
bors
16c94cd673
Auto merge of #39752 - keeperofdakeys:macro-error, r=keeperofdakeys
...
Refactor macro resolution errors + add derive macro suggestions
Move legacy macro resolution error reporting to `finalize_current_module_macro_resolutions`, and provide suggestions for derive macros.
Fixes #39323
cc https://github.com/rust-lang/rust/issues/30197
r? @jseyfried
2017-02-17 04:02:18 +00:00
Josh Driver
2d91e7aab8
Refactor macro resolution errors + add derive macro suggestions
2017-02-16 22:03:15 +10:30
est31
aebd94fd3c
Stabilize field init shorthand
...
Closes #37340 .
2017-02-15 07:11:13 +01:00
Corey Farwell
c2ea734734
Rollup merge of #39730 - jseyfried:fix_empty_seq_rep_ice, r=nrc
...
macros: fix ICE on certain sequence repetitions
Fixes #39709 .
r? @nrc
2017-02-14 10:07:30 -05:00
Jeffrey Seyfried
2cc61eebb7
Allow using inert attributes from proc_macro_derive
s with #![feature(proc_macro)]
.
2017-02-12 07:20:04 +00:00
Jeffrey Seyfried
4b413bc393
Move legacy custom derives collection into resolver.find_attr_invoc()
.
2017-02-12 03:22:52 +00:00
Jeffrey Seyfried
b3d73995da
Fix ICE on certain sequence repetitions.
2017-02-10 23:58:18 +00:00
Corey Farwell
ed7f3c4635
Rollup merge of #39674 - jseyfried:fix_token_tree_parsing_ICE, r=nrc
...
parser: fix ICE when parsing token trees after an error
Fixes #39388 , fixes #39616 .
r? @nrc
2017-02-09 19:43:21 -05:00
bors
1129ce51a6
Auto merge of #39265 - est31:master, r=petrochenkov
...
Stabilize static lifetime in statics
Stabilize the "static_in_const" feature. Blockers before this PR can be merged:
* [x] The [FCP with inclination to stabilize](https://github.com/rust-lang/rust/issues/35897#issuecomment-270441437 ) needs to be over. FCP lasts roughly three weeks, so will be over at Jan 25, aka this thursday.
* [x] Documentation needs to be added (#37928 )
Closes #35897 .
2017-02-09 11:42:49 +00:00
Alex Burka
b4993ec863
suggest doubling recursion limit in more situations
2017-02-09 06:40:23 +00:00
Corey Farwell
3053494a9a
Rollup merge of #38699 - japaric:lsan, r=alexcrichton
...
LeakSanitizer, ThreadSanitizer, AddressSanitizer and MemorySanitizer support
```
$ cargo new --bin leak && cd $_
$ edit Cargo.toml && tail -n3 $_
```
``` toml
[profile.dev]
opt-level = 1
```
```
$ edit src/main.rs && cat $_
```
``` rust
use std::mem;
fn main() {
let xs = vec![0, 1, 2, 3];
mem::forget(xs);
}
```
```
$ RUSTFLAGS="-Z sanitizer=leak" cargo run --target x86_64-unknown-linux-gnu; echo $?
Finished dev [optimized + debuginfo] target(s) in 0.0 secs
Running `target/debug/leak`
=================================================================
==10848==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x557c3488db1f in __interceptor_malloc /shared/rust/checkouts/lsan/src/compiler-rt/lib/lsan/lsan_interceptors.cc:55
#1 0x557c34888aaa in alloc::heap::exchange_malloc::h68f3f8b376a0da42 /shared/rust/checkouts/lsan/src/liballoc/heap.rs:138
#2 0x557c34888afc in leak::main::hc56ab767de6d653a $PWD/src/main.rs:4
#3 0x557c348c0806 in __rust_maybe_catch_panic ($PWD/target/debug/leak+0x3d806)
SUMMARY: LeakSanitizer: 16 byte(s) leaked in 1 allocation(s).
23
```
```
$ cargo new --bin racy && cd $_
$ edit src/main.rs && cat $_
```
``` rust
use std::thread;
static mut ANSWER: i32 = 0;
fn main() {
let t1 = thread::spawn(|| unsafe { ANSWER = 42 });
unsafe {
ANSWER = 24;
}
t1.join().ok();
}
```
```
$ RUSTFLAGS="-Z sanitizer=thread" cargo run --target x86_64-unknown-linux-gnu; echo $?
==================
WARNING: ThreadSanitizer: data race (pid=12019)
Write of size 4 at 0x562105989bb4 by thread T1:
#0 racy::main::_$u7b$$u7b$closure$u7d$$u7d$::hbe13ea9e8ac73f7e $PWD/src/main.rs:6 (racy+0x000000010e3f)
#1 _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::h2e466a92accacc78 /shared/rust/checkouts/lsan/src/libstd/panic.rs:296 (racy+0x000000010cc5)
#2 std::panicking::try::do_call::h7f4d2b38069e4042 /shared/rust/checkouts/lsan/src/libstd/panicking.rs:460 (racy+0x00000000c8f2)
#3 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56)
#4 std::panic::catch_unwind::h31ca45621ad66d5a /shared/rust/checkouts/lsan/src/libstd/panic.rs:361 (racy+0x00000000b517)
#5 std:🧵 :Builder::spawn::_$u7b$$u7b$closure$u7d$$u7d$::hccfc37175dea0b01 /shared/rust/checkouts/lsan/src/libstd/thread/mod.rs:357 (racy+0x00000000c226)
#6 _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::hd880bbf91561e033 /shared/rust/checkouts/lsan/src/liballoc/boxed.rs:605 (racy+0x00000000f27e)
#7 std::sys:👿 🧵 :Thread:🆕 :thread_start::hebdfc4b3d17afc85 <null> (racy+0x0000000abd40)
Previous write of size 4 at 0x562105989bb4 by main thread:
#0 racy::main::h23e6e5ca46d085c3 $PWD/src/main.rs:8 (racy+0x000000010d7c)
#1 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56)
#2 __libc_start_main <null> (libc.so.6+0x000000020290)
Location is global 'racy::ANSWER::h543d2b139f819b19' of size 4 at 0x562105989bb4 (racy+0x0000002f8bb4)
Thread T1 (tid=12028, running) created by main thread at:
#0 pthread_create /shared/rust/checkouts/lsan/src/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc:902 (racy+0x00000001aedb)
#1 std::sys:👿 🧵 :Thread:🆕 :hce44187bf4a36222 <null> (racy+0x0000000ab9ae)
#2 std:🧵 :spawn::he382608373eb667e /shared/rust/checkouts/lsan/src/libstd/thread/mod.rs:412 (racy+0x00000000b5aa)
#3 racy::main::h23e6e5ca46d085c3 $PWD/src/main.rs:6 (racy+0x000000010d5c)
#4 __rust_maybe_catch_panic <null> (racy+0x0000000b4e56)
#5 __libc_start_main <null> (libc.so.6+0x000000020290)
SUMMARY: ThreadSanitizer: data race $PWD/src/main.rs:6 in racy::main::_$u7b$$u7b$closure$u7d$$u7d$::hbe13ea9e8ac73f7e
==================
ThreadSanitizer: reported 1 warnings
66
```
```
$ cargo new --bin oob && cd $_
$ edit src/main.rs && cat $_
```
``` rust
fn main() {
let xs = [0, 1, 2, 3];
let y = unsafe { *xs.as_ptr().offset(4) };
}
```
```
$ RUSTFLAGS="-Z sanitizer=address" cargo run --target x86_64-unknown-linux-gnu; echo $?
=================================================================
==13328==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff29f3ecd0 at pc 0x55802dc6bf7e bp 0x7fff29f3ec90 sp 0x7fff29f3ec88
READ of size 4 at 0x7fff29f3ecd0 thread T0
#0 0x55802dc6bf7d in oob::main::h0adc7b67e5feb2e7 $PWD/src/main.rs:3
#1 0x55802dd60426 in __rust_maybe_catch_panic ($PWD/target/debug/oob+0xfe426)
#2 0x55802dd58dd9 in std::rt::lang_start::hb2951fc8a59d62a7 ($PWD/target/debug/oob+0xf6dd9)
#3 0x55802dc6c002 in main ($PWD/target/debug/oob+0xa002)
#4 0x7fad8c3b3290 in __libc_start_main (/usr/lib/libc.so.6+0x20290)
#5 0x55802dc6b719 in _start ($PWD/target/debug/oob+0x9719)
Address 0x7fff29f3ecd0 is located in stack of thread T0 at offset 48 in frame
#0 0x55802dc6bd5f in oob::main::h0adc7b67e5feb2e7 $PWD/src/main.rs:1
This frame has 1 object(s):
[32, 48) 'xs' <== Memory access at offset 48 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
(longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow $PWD/src/main.rs:3 in oob::main::h0adc7b67e5feb2e7
Shadow bytes around the buggy address:
0x1000653dfd40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfd50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfd60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfd70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x1000653dfd90: 00 00 00 00 f1 f1 f1 f1 00 00[f3]f3 00 00 00 00
0x1000653dfda0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfdb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfdc0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfdd0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x1000653dfde0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==13328==ABORTING
1
```
```
$ cargo new --bin uninit && cd $_
$ edit src/main.rs && cat $_
```
``` rust
use std::mem;
fn main() {
let xs: [u8; 4] = unsafe { mem::uninitialized() };
let y = xs[0] + xs[1];
}
```
```
$ RUSTFLAGS="-Z sanitizer=memory" cargo run; echo $?
==30198==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x563f4b6867da in uninit::main::hc2731cd4f2ed48f8 $PWD/src/main.rs:5
#1 0x563f4b7033b6 in __rust_maybe_catch_panic ($PWD/target/debug/uninit+0x873b6)
#2 0x563f4b6fbd69 in std::rt::lang_start::hb2951fc8a59d62a7 ($PWD/target/debug/uninit+0x7fd69)
#3 0x563f4b6868a9 in main ($PWD/target/debug/uninit+0xa8a9)
#4 0x7fe844354290 in __libc_start_main (/usr/lib/libc.so.6+0x20290)
#5 0x563f4b6864f9 in _start ($PWD/target/debug/uninit+0xa4f9)
SUMMARY: MemorySanitizer: use-of-uninitialized-value $PWD/src/main.rs:5 in uninit::main::hc2731cd4f2ed48f8
Exiting
77
```
2017-02-08 23:55:43 -05:00
Jeffrey Seyfried
66bd8eede5
Fix ICE when parsing token trees after an error.
2017-02-09 03:01:54 +00:00
Jorge Aparicio
9af6aa3889
sanitizer support
2017-02-08 18:51:43 -05:00
Corey Farwell
75f97db367
Rollup merge of #39557 - bjorn3:pp-docs, r=jseyfried
...
A few documentation improvements for `syntax::print::pp`
* Moved algorithm explanation to module docs
* Added ``` before and after the examples
* Explanation of the `rbox`, `ibox` and `cbox` names
* Added docs about the breaking types to `Breaks`
2017-02-08 10:19:50 -05:00
est31
f8b6108deb
Stabilize static in const
...
Closes #35897 .
2017-02-08 12:33:35 +01:00
Jordi Polo
b74e668ded
Change deprecation warning to indicate custom derive support was removed from the current compiler version
2017-02-07 18:17:06 +09:00
bjorn3
1ee88e516c
A few documentation improvements for syntax::print::pp
...
* Moved algorithm explanation to module docs
* Added ``` before and after the examples
* Explanation of the `rbox`, `ibox` and `cbox` names
* Added docs about the breaking types to `Breaks`
2017-02-06 19:20:06 +01:00
Corey Farwell
0a09274e27
Rollup merge of #39552 - zackmdavis:more_struct_aliases_stabilization_version, r=petrochenkov
...
correct version in which more_struct_aliases was/will be stable
The stabilizing commit is 5056a437
, which is not in 1.14, but is (at
time of writing) on the 1.16 beta branch. [See discussion](https://github.com/rust-lang/rust/pull/39282#discussion_r99481687 ).
2017-02-05 09:14:57 -05:00