about summary refs log tree commit diff
path: root/src/test/compile-fail
AgeCommit message (Collapse)AuthorLines
2017-02-20Add tests for newly added error codesGuillaume Gomez-0/+42
2017-02-19Use ARM instead of SystemZ for testing not installed targetsVadim Petrochenkov-2/+2
2017-02-19Avoid ICE in Self::Assoc in impl headersVadim Petrochenkov-0/+3
2017-02-19Privatize fields of PathResolutionVadim Petrochenkov-0/+31
Ensure Def::Err has depth == 0
2017-02-18Add tests for control flow in while conditionTaylor Cramer-2/+56
2017-02-17remove vestiges of the old suggestion machineryNiko Matsakis-4/+1
2017-02-17Properly display note/expected detailsEsteban Küber-4/+4
2017-02-17Auto merge of #39485 - canndrew:inference-fix-39297, r=nikomatsakisbors-36/+0
Ignore expected type in diverging blocks As per comment: https://github.com/rust-lang/rust/issues/39297#issuecomment-276810343
2017-02-17Auto merge of #39752 - keeperofdakeys:macro-error, r=keeperofdakeysbors-33/+54
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-16Refactor macro resolution errors + add derive macro suggestionsJosh Driver-33/+54
2017-02-16Auto merge of #39876 - frewsxcv:rollup, r=frewsxcvbors-0/+49
Rollup of 12 pull requests - Successful merges: #39775, #39793, #39804, #39834, #39836, #39839, #39840, #39843, #39844, #39846, #39857, #39861 - Failed merges:
2017-02-15static recursion test added to compile-fail test suiteColm Seale-0/+49
Issue #39059 r? @est31
2017-02-15Stabilize field init shorthandest31-28/+0
Closes #37340.
2017-02-14Rollup merge of #39772 - cseale:staged_api_whitelist_removal, r=est31Corey Farwell-0/+24
Adding compile fail test for staged_api feature Issue #39059 r? @est31 @est31 running the tests for this feature fails. Is that expected since this is the `compile-fail`suite? I copied this test from the run-pass suite: `rust/src/test/run-pass/reachable-unnameable-type-alias.rs`. What are the differences between these suites in operation and why they are used?
2017-02-14Rollup merge of #39730 - jseyfried:fix_empty_seq_rep_ice, r=nrcCorey Farwell-0/+15
macros: fix ICE on certain sequence repetitions Fixes #39709. r? @nrc
2017-02-14Adding compile fail test for staged_api featureColm Seale-0/+24
Issue #39059 r? @est31
2017-02-13Standardize lifetime and type parameter count mismatch errorsJake Goulding-11/+18
They now always say how many lifetime / type parameters were expected and are explicit about stating "lifetime" or "type" instead of just "parameter".
2017-02-13Remove duplicated "parameter" in E0089 textJake Goulding-3/+2
Closes #39732
2017-02-13Auto merge of #39456 - nagisa:mir-switchint-everywhere, r=nikomatsakisbors-12/+12
[MIR] SwitchInt Everywhere Something I've been meaning to do for a very long while. This PR essentially gets rid of 3 kinds of conditional branching and only keeps the most general one - `SwitchInt`. Primary benefits are such that dealing with MIR now does not involve dealing with 3 different ways to do conditional control flow. On the other hand, constructing a `SwitchInt` currently requires more code than what previously was necessary to build an equivalent `If` terminator. Something trivially "fixable" with some constructor methods somewhere (MIR needs stuff like that badly in general). Some timings (tl;dr: slightly faster^1 (unexpected), but also uses slightly more memory at peak (expected)): ^1: Not sure if the speed benefits are because of LLVM liking the generated code better or the compiler itself getting compiled better. Either way, its a net benefit. The CORE and SYNTAX timings done for compilation without optimisation. ``` AFTER: Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 31.50 secs Finished release [optimized] target(s) in 31.42 secs Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 439.56 secs Finished release [optimized] target(s) in 435.15 secs CORE: 99% (24.81 real, 0.13 kernel, 24.57 user); 358536k resident CORE: 99% (24.56 real, 0.15 kernel, 24.36 user); 359168k resident SYNTAX: 99% (49.98 real, 0.48 kernel, 49.42 user); 653416k resident SYNTAX: 99% (50.07 real, 0.58 kernel, 49.43 user); 653604k resident BEFORE: Building stage1 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 31.84 secs Building stage1 compiler artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu) Finished release [optimized] target(s) in 451.17 secs CORE: 99% (24.66 real, 0.20 kernel, 24.38 user); 351096k resident CORE: 99% (24.36 real, 0.17 kernel, 24.18 user); 352284k resident SYNTAX: 99% (52.24 real, 0.56 kernel, 51.66 user); 645544k resident SYNTAX: 99% (51.55 real, 0.48 kernel, 50.99 user); 646428k resident ``` cc @nikomatsakis @eddyb
2017-02-12Auto merge of #39572 - jseyfried:fix_inert_attributes, r=nrcbors-10/+10
macros: fix inert attributes from `proc_macro_derives` with `#![feature(proc_macro)]` This PR refactors collection of `proc_macro_derive` invocations to fix #39347. After this PR, the input to a `#[proc_macro_derive]` function no longer sees `#[derive]`s on the underlying item. For example, consider: ```rust extern crate my_derives; use my_derives::{Trait, Trait2}; #[derive(Copy, Clone)] #[derive(Trait)] #[derive(Trait2)] struct S; ``` Today, the input to the `Trait` derive is `#[derive(Copy, Clone, Trait2)] struct S;`, and the input to the `Trait2` derive is `#[derive(Copy, Clone)] struct S;`. More generally, a `proc_macro_derive` sees all builtin derives, as well as all `proc_macro_derive`s listed *after* the one being invoked. After this PR, both `Trait` and `Trait2` will see `struct S;`. This is a [breaking-change], but I believe it is highly unlikely to cause breakage in practice. r? @nrc
2017-02-12Auto merge of #39680 - canndrew:uninhabited_from-infinite-loop, r=arielb1bors-0/+25
Add recursion limit to inhabitedness check Fixes #39489. Add test aswell.
2017-02-12Allow using inert attributes from `proc_macro_derive`s with ↵Jeffrey Seyfried-10/+10
`#![feature(proc_macro)]`.
2017-02-10Fix ICE on certain sequence repetitions.Jeffrey Seyfried-0/+15
2017-02-10Fix testsSimonas Kazlauskas-12/+12
2017-02-09Rollup merge of #39707 - durka:parsimonious-span-note, r=jonathandturnerCorey Farwell-1/+1
change span_notes to notes in E0368/E0369 Fixes #39650. All the uses of `span_note` in these errors were reusing the same span as the original error, which causes unnecessary repetition. For an example, see the changes to [src/test/ui/span/issue-39018.stderr](https://github.com/rust-lang/rust/pull/39707/files?diff=unified#diff-46336f62958fdb34233db414cb9914a1R4). r? @jonathandturner
2017-02-09Rollup merge of #39700 - msopena:master, r=est31Corey Farwell-0/+17
Adding compile fail test for const_indexing feature First attempt at contributing to rust. Picked up an easy feature to test. Issue #39059 r? @est31
2017-02-09Rollup merge of #39674 - jseyfried:fix_token_tree_parsing_ICE, r=nrcCorey Farwell-0/+32
parser: fix ICE when parsing token trees after an error Fixes #39388, fixes #39616. r? @nrc
2017-02-09change span_notes to notes in E0368/E0369Alex Burka-1/+1
2017-02-09Adding compile fail test for const_indexing featureMario-0/+17
2017-02-10Use global recursion limit when evaluating inhabitednessAndrew Cann-1/+2
2017-02-09Auto merge of #39265 - est31:master, r=petrochenkovbors-15/+0
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-09Add recursion limit to inhabitedness checkAndrew Cann-0/+24
Fixes #39489. Add test aswell.
2017-02-09Small inference fixAndrew Cann-36/+0
As per comment: https://github.com/rust-lang/rust/issues/39297#issuecomment-276810343
2017-02-09suggest doubling recursion limit in more situationsAlex Burka-57/+0
2017-02-08Rollup merge of #39653 - JanZerebecki:test-issue-27433, r=alexcrichtonCorey Farwell-0/+15
Add test for #27433
2017-02-08Rollup merge of #38699 - japaric:lsan, r=alexcrichtonCorey Farwell-0/+13
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::thread::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::imp::thread::Thread::new::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::imp::thread::Thread::new::hce44187bf4a36222 <null> (racy+0x0000000ab9ae) #2 std::thread::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-09Fix ICE when parsing token trees after an error.Jeffrey Seyfried-0/+32
2017-02-08sanitizer supportJorge Aparicio-0/+13
2017-02-08Add test for #27433Jan Zerebecki-0/+15
2017-02-08Rollup merge of #39462 - emilio:improper-ctypes, r=nikomatsakisCorey Farwell-0/+6
lint/ctypes: Don't warn on sized structs with PhantomData. Fixes #34798
2017-02-08Stabilize static in constest31-15/+0
Closes #35897.
2017-02-07Rollup merge of #39361 - cengizIO:master, r=arielb1Corey Farwell-27/+19
Improve error message for uninferrable types #38812 Hello, I tried to improve the error message for uninferrable types. The error code is `E0282`. ```rust error[E0282]: type annotations needed --> /home/cengizIO/issue38812.rs:2:11 | 2 | let x = vec![]; | - ^^^^^^ cannot infer type for `T` | | | consider giving `x` a type | = note: this error originates in a macro outside of the current crate ``` and ```rust error[E0282]: type annotations needed --> /home/cengizIO/issue38812.rs:2:15 | 2 | let (x,) = (vec![],); | ---- ^^^^^^ cannot infer type for `T` | | | consider giving a type to pattern | = note: this error originates in a macro outside of the current crate ``` Rust compiler now tries to find uninferred `local`s with type `_` and adds them into the error message. I'm probably wrong on wording that I used. Please feel free to suggest better alternatives. Thanks @nikomatsakis for mentoring 🍺 Any comments/feedback is more than welcome! Thank you
2017-02-05Auto merge of #38897 - nikomatsakis:issue-32330-followup, r=arielb1bors-30/+18
make lifetimes that only appear in return type early-bound This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the `ui` test), sending users over to the tracking issue for a fuller explanation and offering a `--explain` message in some cases. This needs a crater run before we land. r? @arielb1
2017-02-05make lifetimes that only appear in return type early-boundNiko Matsakis-30/+18
This is the full and proper fix for #32330. This also makes some effort to give a nice error message (as evidenced by the `ui` test), sending users over to the tracking issue for a full explanation.
2017-02-05Rollup merge of #39526 - canndrew:uninhabited-while-let-fix, r=arielb1Corey Farwell-0/+8
Uninhabited while-let pattern fix This fix makes it so while-let with an unsatisfiable pattern raises a correct warning rather than an incorrect error.
2017-02-05Rollup merge of #39442 - keeperofdakeys:expand-derives, r=jseyfriedCorey Farwell-7/+9
Expand derive macros in the MacroExpander This removes the expand_derives function, and sprinkles the functionality throughout the Invocation Collector, Expander and Resolver. Fixes https://github.com/rust-lang/rust/issues/39326 r? @jseyfried
2017-02-05Rollup merge of #39009 - canndrew:default-unit-warnings, r=nikomatsakisCorey Farwell-0/+51
Add warning for () to ! switch With feature(never_type) enabled diverging type variables will default to `!` instead of `()`. This can cause breakages where a trait is resolved on such a type. This PR emits a future-compatibility warning when it sees this happen.
2017-02-05Auto merge of #38103 - ↵bors-45/+12
zackmdavis:lint_errors_resulting_from_lint_groups_or_warnings_meta-lint_obscure_the_original_lint_name, r=nikomatsakis note individual lint name in messages set via lint group attribute ![lint_errors_resulting_from_lint_groups_obscure](https://cloud.githubusercontent.com/assets/1076988/20783614/c107d5c8-b749-11e6-85de-eada7f67c986.png) Resolves #36846. r? @jonathandturner ----- ***Update*** 16 December (new commits): ![lint_group_makeover_party](https://cloud.githubusercontent.com/assets/1076988/21284540/ff1ae2fc-c3d2-11e6-93be-d0689f5fa7a8.png)
2017-02-05Move derive macro expansion into the MacroExpanderJosh Driver-6/+8
This removes the expand_derives function, and sprinkles the functionality throughout the Invocation Collector, Expander and Resolver.
2017-02-05Rename CustomDerive to ProcMacroDerive for macros 1.1Josh Driver-1/+1