about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-12-09rollup merge of #19598: japaric/ordAlex Crichton-4/+25
cc #18755 r? @alexcrichton cc @bjz
2014-12-09auto merge of #19644 : pcwalton/rust/oibit3, r=nikomatsakisbors-7/+182
2014-12-08Revert "Register new snapshots"Alex Crichton-3/+3
This reverts commit 9b443289cf32cbcff16768614340f0c844675340.
2014-12-08Add a feature opt `opt_out_copy` that allows people to revert to the olderNiko Matsakis-0/+6
behavior temporarily. This feature will eventually transition to REJECTED.
2014-12-08librustc: Make `Copy` opt-in.Niko Matsakis-7/+176
This change makes the compiler no longer infer whether types (structures and enumerations) implement the `Copy` trait (and thus are implicitly copyable). Rather, you must implement `Copy` yourself via `impl Copy for MyType {}`. A new warning has been added, `missing_copy_implementations`, to warn you if a non-generic public type has been added that could have implemented `Copy` but didn't. For convenience, you may *temporarily* opt out of this behavior by using `#![feature(opt_out_copy)]`. Note though that this feature gate will never be accepted and will be removed by the time that 1.0 is released, so you should transition your code away from using it. This breaks code like: #[deriving(Show)] struct Point2D { x: int, y: int, } fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } Change this code to: #[deriving(Show)] struct Point2D { x: int, y: int, } impl Copy for Point2D {} fn main() { let mypoint = Point2D { x: 1, y: 1, }; let otherpoint = mypoint; println!("{}{}", mypoint, otherpoint); } This is the backwards-incompatible part of #13231. Part of RFC #3. [breaking-change]
2014-12-08auto merge of #19560 : sfackler/rust/should-fail-reason, r=alexcrichtonbors-4/+30
The test harness will make sure that the panic message contains the specified string. This is useful to help make `#[should_fail]` tests a bit less brittle by decreasing the chance that the test isn't "accidentally" passing due to a panic occurring earlier than expected. The behavior is in some ways similar to JUnit's `expected` feature: `@Test(expected=NullPointerException.class)`. Without the message assertion, this test would pass even though it's not actually reaching the intended part of the code: ```rust #[test] #[should_fail(message = "out of bounds")] fn test_oob_array_access() { let idx: uint = from_str("13o").unwrap(); // oops, this will panic [1i32, 2, 3][idx]; } ```
2014-12-08core: make the public fmt API completely safe.Eduard Burtescu-25/+8
2014-12-08auto merge of #19378 : japaric/rust/no-as-slice, r=alexcrichtonbors-45/+43
Now that we have an overloaded comparison (`==`) operator, and that `Vec`/`String` deref to `[T]`/`str` on method calls, many `as_slice()`/`as_mut_slice()`/`to_string()` calls have become redundant. This patch removes them. These were the most common patterns: - `assert_eq(test_output.as_slice(), "ground truth")` -> `assert_eq(test_output, "ground truth")` - `assert_eq(test_output, "ground truth".to_string())` -> `assert_eq(test_output, "ground truth")` - `vec.as_mut_slice().sort()` -> `vec.sort()` - `vec.as_slice().slice(from, to)` -> `vec.slice(from_to)` --- Note that e.g. `a_string.push_str(b_string.as_slice())` has been left untouched in this PR, since we first need to settle down whether we want to favor the `&*b_string` or the `b_string[]` notation. This is rebased on top of #19167 cc @alexcrichton @aturon
2014-12-07syntax: use UFCS in the expansion of `#[deriving(Ord)]`Jorge Aparicio-4/+25
cc #18755
2014-12-06libsyntax: remove unnecessary `to_string()` callsJorge Aparicio-21/+21
2014-12-06libsyntax: remove unnecessary `as_slice()` callsJorge Aparicio-24/+22
2014-12-07auto merge of #19407 : frewsxcv/rust/rm-reexports, r=cmrbors-6/+17
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::\*, Result::\*, and Ordering::\*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-06Change from message to expectedSteven Fackler-1/+1
2014-12-06Allow message specification for should_failSteven Fackler-4/+30
The test harness will make sure that the panic message contains the specified string. This is useful to help make `#[should_fail]` tests a bit less brittle by decreasing the chance that the test isn't "accidentally" passing due to a panic occurring earlier than expected. The behavior is in some ways similar to JUnit's `expected` feature: `@Test(expected=NullPointerException.class)`. Without the message assertion, this test would pass even though it's not actually reaching the intended part of the code: ```rust #[test] #[should_fail(message = "out of bounds")] fn test_oob_array_access() { let idx: uint = from_str("13o").unwrap(); // oops, this will panic [1i32, 2, 3][idx]; } ```
2014-12-05Register new snapshotsAlex Crichton-3/+3
2014-12-05Utilize fewer reexportsCorey Farwell-6/+17
In regards to: https://github.com/rust-lang/rust/issues/19253#issuecomment-64836729 This commit: * Changes the #deriving code so that it generates code that utilizes fewer reexports (in particur Option::* and Result::*), which is necessary to remove those reexports in the future * Changes other areas of the codebase so that fewer reexports are utilized
2014-12-05rollup merge of #19494: P1start/better-expectedCorey Richardson-68/+115
As an example of what this changes, the following code: ```rust let x: [int ..4]; ``` Currently spits out ‘expected `]`, found `..`’. However, a comma would also be valid there, as would a number of other tokens. This change adjusts the parser to produce more accurate errors, so that that example now produces ‘expected one of `(`, `+`, `,`, `::`, or `]`, found `..`’. (Thanks to cramer on IRC for pointing out this problem with diagnostics.)
2014-12-05rollup merge of #19492: steveklabnik/remove_outdated_commentCorey Richardson-5/+1
https://github.com/rust-lang/rust/pull/19472#issuecomment-65370278 /cc @alexcrichton
2014-12-05rollup merge of #19480: cmr/es6-escapeCorey Richardson-8/+95
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-12-05rollup merge of #19472: nick29581/ifletCorey Richardson-16/+3
Closes #19469 r?
2014-12-05rollup merge of #19413: P1start/more-trailing-commasCorey Richardson-7/+7
The only other place I know of that doesn’t allow trailing commas is closure types (#19414), and those are a bit tricky to fix (I suspect it might be impossible without infinite lookahead) so I didn’t implement that in this patch. There are other issues surrounding closure type parsing anyway, in particular #19410.
2014-12-05rollup merge of #19387: jauhien/fix-expand_quote_tyCorey Richardson-2/+1
Subj., expand_quote_ty produces wrong call to parse_ty now.
2014-12-04Modify libsyntax/diagnostics to not be so persnickety. The schemeNiko Matsakis-26/+11
doesn't work in a multi-crate context. We'll need to come up with something better.
2014-12-04Make the parser’s ‘expected <foo>, found <bar>’ errors more accurateP1start-68/+115
As an example of what this changes, the following code: let x: [int ..4]; Currently spits out ‘expected `]`, found `..`’. However, a comma would also be valid there, as would a number of other tokens. This change adjusts the parser to produce more accurate errors, so that that example now produces ‘expected one of `(`, `+`, `,`, `::`, or `]`, found `..`’.
2014-12-03syntax: support ES6-style unicode escapesCorey Richardson-8/+95
First half of bootstrapping https://github.com/rust-lang/rfcs/pull/446
2014-12-03Remove feature gates for `if let`, `while let`, and tuple indexingNick Cameron-16/+3
Closes #19469
2014-12-03Deprecate EquivJorge Aparicio-0/+1
2014-12-03Fix falloutJorge Aparicio-2/+2
2014-12-03Replace `equiv` method calls with `==` operator sugarJorge Aparicio-11/+11
2014-12-03Overload the `==` operatorJorge Aparicio-0/+22
- String == &str == CowString - Vec == &[T] == &mut [T] == [T, ..N] == CowVec - InternedString == &str
2014-12-03Remove outdated comment.Steve Klabnik-5/+1
https://github.com/rust-lang/rust/pull/19472#issuecomment-65370278
2014-12-02auto merge of #19427 : scialex/rust/doc-attr-macros, r=sfacklerbors-0/+6
this allows one to, for example, use #[doc = $macro_var ] in macros.
2014-12-01auto merge of #19405 : jfager/rust/de-match-pyramid, r=bstriebors-108/+54
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-12-01auto merge of #19418 : P1start/rust/unsafe-extern-trait, r=alexcrichtonbors-7/+8
Fixes #19398.
2014-11-30auto merge of #19415 : P1start/rust/error-message-fixes, r=alexcrichtonbors-3/+3
This is the style followed by most other error messages.
2014-11-30allow macro expansions in attributesAlexander Light-0/+6
2014-11-30Allow trailing commas in array patterns and attributesP1start-7/+7
2014-11-30Fix the ordering of `unsafe` and `extern` in methodsP1start-7/+8
This breaks code that looks like this: trait Foo { extern "C" unsafe fn foo(); } impl Foo for Bar { extern "C" unsafe fn foo() { ... } } Change such code to look like this: trait Foo { unsafe extern "C" fn foo(); } impl Foo for Bar { unsafe extern "C" fn foo() { ... } } Fixes #19398. [breaking-change]
2014-11-30Adjust some error messages to start with a lowercase letter and not finish ↵P1start-3/+3
with a full stop
2014-11-30syntax: Make `asm!` clobbers a proper vector.Kang Seonghoon-9/+9
Otherwise `--pretty expanded` diverges.
2014-11-29Replace some verbose match statements with their `if let` equivalent.jfager-108/+54
No semantic changes, no enabling `if let` where it wasn't already enabled.
2014-11-29Fix rustc panic on second compile_inputMurarth-0/+21
2014-11-29fix expand_quote_ty function as parse_ty was changed and needs no arguments nowJauhien Piatlicki-2/+1
2014-11-27auto merge of #19343 : sfackler/rust/less-special-attrs, r=alexcrichtonbors-1/+0
Descriptions and licenses are handled by Cargo now, so there's no reason to keep these attributes around.
2014-11-26rollup merge of #19329: steveklabnik/doc_style_cleanup2Alex Crichton-64/+31
2014-11-26/*! -> //!Steve Klabnik-64/+31
Sister pull request of https://github.com/rust-lang/rust/pull/19288, but for the other style of block doc comment.
2014-11-26Test fixes and rebase conflictsAlex Crichton-6/+6
2014-11-26rollup merge of #19326: huonw/safer-syntaxAlex Crichton-89/+17
This makes it correct (e.g. avoiding null pointers) and safe.
2014-11-26rollup merge of #19298: nikomatsakis/unboxed-closure-parse-the-plusAlex Crichton-166/+146
Implements RFC 438. Fixes #19092. This is a [breaking-change]: change types like `&Foo+Send` or `&'a mut Foo+'a` to `&(Foo+Send)` and `&'a mut (Foo+'a)`, respectively. r? @brson
2014-11-26rollup merge of #19288: steveklabnik/doc_style_cleanupAlex Crichton-23/+15
This is considered good convention. This is about half of them in total, I just don't want an impossible to land patch. :smile: