summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2017-04-20rustc_trans: do not treat byval as using up registers.Eduard-Mihai Burtescu-0/+23
2017-04-20Properly adjust filenames when multiple emissionsSimonas Kazlauskas-0/+18
Fixes #40993
2017-04-20Avoid type-checking addition and indexing twice.Eduard-Mihai Burtescu-0/+32
2017-04-04Fix ICE with nested macros in certain situations.Jeffrey Seyfried-0/+19
2017-04-04Ensure that macro resolutions in trait positions get finalized.Jeffrey Seyfried-0/+16
2017-04-02keep the AST node-id when lowering ExprKind::RangeAriel Ben-Yehuda-0/+16
When the Range expression is the root of a constant, its node-id is used for the def-id of the body, so it has to be preserved in the AST -> HIR lowering. Fixes #40749.
2017-04-01update LLVM with fix for PR32379Ariel Ben-Yehuda-0/+38
Fixes #40593.
2017-04-01store a copy of the Issue32230 info within TypeErrorAriel Ben-Yehuda-0/+21
The data can't be looked up from the region variable directly, because the region variable might have been destroyed at the end of a snapshot. Fixes #40000. Fixes #40743.
2017-03-31add regression test for #39984Niko Matsakis-0/+21
Fixes #39984
2017-03-31Revert "Auto merge of #39485 - canndrew:inference-fix-39297, r=nikomatsakis"Niko Matsakis-11/+25
This reverts commit dc0bb3f2839c13ab42feacd423f728fbfd2f2f7a, reversing changes made to e879aa43ef63962f8e4d797292194a9f40a22a13. This is a temporary step intended to fix regressions. A more comprehensive fix for type inference and dead-code is in the works.
2017-03-20Regression test for rust-lang/rust#40535Austin Bonander-0/+49
2017-03-20Propagate expected type hints through struct literals.Eduard-Mihai Burtescu-0/+20
2017-03-20Fix regression when `include!()`ing a `macro_rules!` containing a `$crate::` ↵Jeffrey Seyfried-0/+29
path.
2017-03-13Auto merge of #40385 - arielb1:packed-again, r=eddybbors-0/+33
emit !align attributes on stores of operand pairs This avoids another case of missing-align UB. cc #40373 r? @eddyb
2017-03-13emit !align attributes on stores of operand pairsAriel Ben-Yehuda-0/+33
cc #40373
2017-03-12Rollup merge of #40369 - petrochenkov:segspan, r=eddybCorey Farwell-21/+39
Give spans to individual path segments in AST And use these spans in path resolution diagnostics. The spans are spans of identifiers in segments, not whole segments. I'm not sure what spans are more useful in general, but identifier spans are a better fit for resolve errors. HIR still doesn't have spans. Fixes https://github.com/rust-lang/rust/pull/38927#discussion_r95336667 https://github.com/rust-lang/rust/pull/38890#issuecomment-271731008 r? @nrc @eddyb
2017-03-12Auto merge of #40340 - petrochenkov:restricted, r=nikomatsakisbors-22/+17
Update syntax for `pub(restricted)` Update the syntax before stabilization. cc https://github.com/rust-lang/rust/issues/32409 r? @nikomatsakis
2017-03-12Auto merge of #40446 - arielb1:rollup, r=alexcrichtonbors-33/+235
Rollup of 12 pull requests - Successful merges: #40146, #40299, #40315, #40319, #40344, #40345, #40372, #40373, #40400, #40404, #40419, #40431 - Failed merges:
2017-03-11Auto merge of #40220 - jseyfried:ast_macro_def, r=nrcbors-0/+1
syntax: add `ast::ItemKind::MacroDef`, simplify hygiene info This PR - adds a new variant `MacroDef` to `ast::ItemKind` for `macro_rules!` and eventually `macro` items, - [breaking-change] forbids macro defs without a name (`macro_rules! { () => {} }` compiles today), - removes `ast::MacroDef`, and - no longer uses `Mark` and `Invocation` to identify and characterize macro definitions. - We used to apply (at least) two `Mark`s to an expanded identifier's `SyntaxContext` -- the definition mark(s) and the expansion mark(s). We now only apply the latter. r? @nrc
2017-03-11Rollup merge of #40404 - cengizIO:master, r=nikomatsakisAriel Ben-Yehuda-0/+38
fix #40294 obligation cause.body_id is not always a NodeExpr Hello! This fixes #40294 and moves tests related to #38812 to a much more sensible directory. Thanks to @nikomatsakis and @eddyb
2017-03-11Rollup merge of #40400 - TimNN:gdbr-updates, r=alexcrichtonAriel Ben-Yehuda-17/+22
Update gdbr tests gdb will now reliably detect the lanugage as rust even before any code is run.
2017-03-11Rollup merge of #40373 - TimNN:test-ub-packed, r=arielb1Ariel Ben-Yehuda-2/+43
Fix UB in repr(packed) tests r? @arielb1 cc #37609 and #27060
2017-03-11Rollup merge of #40372 - nagisa:never-drop, r=eddybAriel Ben-Yehuda-1/+0
Do not bother creating StorageLive for TyNever Keeps MIR cleaner, `StorageLive(_: !)` makes no sense anyway. r? @eddyb
2017-03-11Rollup merge of #40319 - eddyb:it's-"unsize"-not-"unsound", r=nikomatsakisAriel Ben-Yehuda-13/+132
Disallow subtyping between T and U in T: Unsize<U>. Because `&mut T` can be coerced to `&mut U`, `T` and `U` must be unified invariantly. Fixes #40288. E.g. coercing `&mut [&'a X; N]` to `&mut [&'b X]` must require `'a` be equal to `'b`, otherwise you can convert between `&'a X` and `&'b X` (in either direction), potentially unsoundly lengthening lifetimes. Subtyping here was introduced with `Unsize` in #24619 (landed in 1.1, original PR is #23785).
2017-03-10Rollup merge of #40336 - alexcrichton:fast-dep-info, r=nrcAlex Crichton-0/+19
rustc: Exit quickly on only `--emit dep-info` This commit alters the compiler to exit quickly if the only output being emitted is `dep-info`, which doesn't need a lot of other information to generate. Closes #40328
2017-03-10Rollup merge of #40287 - estebank:label-overlap, r=nrcAlex Crichton-0/+27
Fix incorrect span label formatting Fix #40157.
2017-03-10Rollup merge of #40239 - nagisa:death-to-plugins, r=nikomatsakisAlex Crichton-78/+0
Remove ability for plugins to register a MIR pass In recent months there have been a few different people investigating how to make a plugin that registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper. The interface to register MIR passes was added primarily for miri (& later was found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use this interface anymore it seems like a good time to remove this "feature". For prototyping purposes a similar interface can be added by developers themselves in their custom rustc build. cc @nikomatsakis
2017-03-10Rollup merge of #40092 - sinkuu:fix_suggestion_index, r=pnkfelixAlex Crichton-0/+27
Fix suggestion span error with a line containing multibyte characters This PR fixes broken suggestions caused by multibyte characters. e.g. for this code, rustc provides a broken suggestion ([playground](https://is.gd/DWGLu7)): ```rust fn main() { let tup = (1,); println!("☃{}", tup[0]); } ``` ``` error: cannot index a value of type `({integer},)` --> <anon>:3:21 | 3 | println!("☃{}", tup[0]); | ^^^^^^ | help: to access tuple elements, use tuple indexing syntax as shown | println!("☃{}"tup.00]); error: aborting due to previous error ``` `CodeSuggestion::splice_lines` is misusing `Loc.col` (`CharPos`) as a byte offset when slicing source.
2017-03-10resolve: Use path segment spans in smart_resolve_pathVadim Petrochenkov-21/+39
2017-03-10Update syntax for `pub(restricted)`Vadim Petrochenkov-22/+17
2017-03-10rustc: Exit quickly on only `--emit dep-info`Alex Crichton-0/+19
This commit alters the compiler to exit quickly if the only output being emitted is `dep-info`, which doesn't need a lot of other information to generate. Closes #40328
2017-03-10Fix incorrect span label formattingEsteban Küber-0/+27
2017-03-10Remove ability for plugins to register a MIR passSimonas Kazlauskas-78/+0
In recent months there have been a few different people investigating how to make a plugin that registers a MIR-pass – one that isn’t intended to be eventually merged into rustc proper. The interface to register MIR passes was added primarily for miri (& later was found to make prototyping of rustc-proper MIR passes a tiny bit faster). Since miri does not use this interface anymore it seems like a good time to remove this "feature". For prototyping purposes a similar interface can be added by developers themselves in their custom rustc build.
2017-03-10Refactor out `ast::ItemKind::MacroDef`.Jeffrey Seyfried-0/+1
2017-03-10Point to enclosing block/fn on nested unsafeEsteban Küber-0/+116
When declaring nested unsafe blocks (`unsafe {unsafe {}}`) that trigger the "unnecessary `unsafe` block" error, point out the enclosing `unsafe block` or `unsafe fn` that makes it unnecessary.
2017-03-10move related tests to type-check ui test directoryCengiz Can-0/+0
2017-03-10fix #40294 obligation cause.body_id is not always a NodeExprCengiz Can-0/+38
2017-03-09update gdbr testsTim Neumann-17/+22
gdb will now reliably detect the lanugage as rust even before any code is run.
2017-03-09Use subtyping on the target of unsizing coercions.Eduard-Mihai Burtescu-13/+61
2017-03-09Do not bother creating StorageLive for TyNeverSimonas Kazlauskas-1/+0
Keeps MIR cleaner, `StorageLive(_: !)` makes no sense anyway.
2017-03-08fix UB in repr(packed) testsTim Neumann-2/+43
2017-03-08Rollup merge of #40296 - topecongiro:add-missing-tests, r=alexcrichtonAriel Ben-Yehuda-0/+130
Add tests for issues with the 'E-needtest' label. This PR adds tests for the following issues:
2017-03-08Rollup merge of #40279 - gibfahn:test-unwind, r=est31Ariel Ben-Yehuda-0/+72
Add compile-fail tests for remaining items in whitelist and remove it Add compile-fail tests for `cfg_target_thread_local` and `unwind_attributes`, and remove the whitelist. Let me know if I should clean up the tests (or if I've done anything else wrong, this is my first contribution to rust). cc/ @est31
2017-03-08Disallow subtyping between T and U in T: Unsize<U>.Eduard-Mihai Burtescu-0/+71
2017-03-08Auto merge of #39713 - estebank:issue-39698, r=jonathandturnerbors-9/+77
Clean up "pattern doesn't bind x" messages Group "missing variable bind" spans in `or` matches and clarify wording for the two possible cases: when a variable from the first pattern is not in any of the subsequent patterns, and when a variable in any of the other patterns is not in the first one. Before: ```rust error[E0408]: variable `a` from pattern #1 is not bound in pattern #2 --> file.rs:10:23 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^^^^ pattern doesn't bind `a` error[E0408]: variable `b` from pattern #2 is not bound in pattern #1 --> file.rs:10:32 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^ pattern doesn't bind `b` error[E0408]: variable `a` from pattern #1 is not bound in pattern #3 --> file.rs:10:37 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^ pattern doesn't bind `a` error[E0408]: variable `d` from pattern #1 is not bound in pattern #3 --> file.rs:10:37 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^ pattern doesn't bind `d` error[E0408]: variable `c` from pattern #3 is not bound in pattern #1 --> file.rs:10:43 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^ pattern doesn't bind `c` error[E0408]: variable `d` from pattern #1 is not bound in pattern #4 --> file.rs:10:48 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^ pattern doesn't bind `d` error: aborting due to 6 previous errors ``` After: ```rust error[E0408]: variable `d` is not bound in all patterns --> $DIR/issue-39698.rs:20:37 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | - - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `d` | | | | | | | pattern doesn't bind `d` | | variable not in all patterns | variable not in all patterns error[E0408]: variable `c` is not bound in all patterns --> $DIR/issue-39698.rs:20:48 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^^^^ ^^^^^^^^^^^ - ^^^^^^^^ pattern doesn't bind `c` | | | | | | | variable not in all patterns | | pattern doesn't bind `c` | pattern doesn't bind `c` error[E0408]: variable `a` is not bound in all patterns --> $DIR/issue-39698.rs:20:37 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | - ^^^^^^^^^^^ ^^^^^^^^ - variable not in all patterns | | | | | | | pattern doesn't bind `a` | | pattern doesn't bind `a` | variable not in all patterns error[E0408]: variable `b` is not bound in all patterns --> $DIR/issue-39698.rs:20:37 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern doesn't bind `b` | | | | | | | pattern doesn't bind `b` | | variable not in all patterns | pattern doesn't bind `b` error: aborting due to 4 previous errors ``` Fixes #39698.
2017-03-07Add tests for issues with the 'E-needtest' label.topecongiro-0/+130
2017-03-06Auto merge of #40272 - jseyfried:fix_const_macro_invocations, r=petrochenkovbors-0/+24
macros: fix const expression invocations Fixes #40136. r? @nrc
2017-03-06Auto merge of #40276 - topecongiro:add-test, r=petrochenkovbors-0/+118
Add missing tests for 'E-needstest' labeled issues This PR adds missing tests for issue #35988, #19712, ~~#18627~~, #24947, #28600 and #34751.
2017-03-06Add missing tests for 'E-needstest' labeled issuestopecongiro-0/+118
2017-03-06Clean up "pattern doesn't bind x" messagesEsteban Küber-9/+77
Group "missing variable bind" spans in `or` matches and clarify wording for the two possible cases: when a variable from the first pattern is not in any of the subsequent patterns, and when a variable in any of the other patterns is not in the first one. Before: ``` error[E0408]: variable `a` from pattern #1 is not bound in pattern #2 --> file.rs:10:23 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^^^^ pattern doesn't bind `a` error[E0408]: variable `b` from pattern #2 is not bound in pattern #1 --> file.rs:10:32 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^ pattern doesn't bind `b` error[E0408]: variable `a` from pattern #1 is not bound in pattern #3 --> file.rs:10:37 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^ pattern doesn't bind `a` error[E0408]: variable `d` from pattern #1 is not bound in pattern #3 --> file.rs:10:37 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^ pattern doesn't bind `d` error[E0408]: variable `c` from pattern #3 is not bound in pattern #1 --> file.rs:10:43 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^ pattern doesn't bind `c` error[E0408]: variable `d` from pattern #1 is not bound in pattern #4 --> file.rs:10:48 | 10 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { println!("{:?}", a); } | ^^^^^^^^ pattern doesn't bind `d` error: aborting due to 6 previous errors ``` After: ``` error[E0408]: variable `a` is not bound in all patterns --> file.rs:20:37 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { intln!("{:?}", a); } | - ^^^^^^^^^^^ ^^^^^^^^ - variable t in all patterns | | | | | | | pattern doesn't bind `a` | | pattern doesn't bind `a` | variable not in all patterns error[E0408]: variable `d` is not bound in all patterns --> file.rs:20:37 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { intln!("{:?}", a); } | - - ^^^^^^^^ ^^^^^^^^ pattern esn't bind `d` | | | | | | | pattern doesn't bind `d` | | variable not in all patterns | variable not in all patterns error[E0408]: variable `b` is not bound in all patterns --> file.rs:20:37 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { intln!("{:?}", a); } | ^^^^^^^^^^^ - ^^^^^^^^ ^^^^^^^^ pattern esn't bind `b` | | | | | | | pattern doesn't bind `b` | | variable not in all patterns | pattern doesn't bind `b` error[E0408]: variable `c` is not bound in all patterns --> file.rs:20:48 | 20 | T::T1(a, d) | T::T2(d, b) | T::T3(c) | T::T4(a) => { intln!("{:?}", a); } | ^^^^^^^^^^^ ^^^^^^^^^^^ - ^^^^^^^^ pattern esn't bind `c` | | | | | | | variable not in all tterns | | pattern doesn't bind `c` | pattern doesn't bind `c` error: aborting due to 4 previous errors ``` * Have only one presentation for binding consistency errors * Point to same binding in multiple patterns when possible * Check inconsistent bindings in all arms * Simplify wording of diagnostic message * Sort emition and spans of binding errors for deterministic output