about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-04-23auto merge of #13704 : edwardw/rust/doc-hidden, r=alexcrichtonbors-37/+52
Closes #13698
2014-04-24Calibrate span for method call error messagesEdward Wang-7/+14
Specifically, the method parameter cardinality mismatch or missing method error message span now gets method itself exactly. It was the whole expression. Closes #9390 Closes #13684 Closes #13709
2014-04-23auto merge of #13686 : alexcrichton/rust/issue-12224, r=nikomatsakisbors-19/+55
This alters the borrow checker's requirements on invoking closures from requiring an immutable borrow to requiring a unique immutable borrow. This means that it is illegal to invoke a closure through a `&` pointer because there is no guarantee that is not aliased. This does not mean that a closure is required to be in a mutable location, but rather a location which can be proven to be unique (often through a mutable pointer). For example, the following code is unsound and is no longer allowed: type Fn<'a> = ||:'a; fn call(f: |Fn|) { f(|| { f(|| {}) }); } fn main() { call(|a| { a(); }); } There is no replacement for this pattern. For all closures which are stored in structures, it was previously allowed to invoke the closure through `&self` but it now requires invocation through `&mut self`. The standard library has a good number of violations of this new rule, but the fixes will be separated into multiple breaking change commits. Closes #12224
2014-04-23Fix other bugs with new closure borrowingAlex Crichton-19/+55
This fixes various issues throughout the standard distribution and tests.
2014-04-23syntax: fix de-@rooting falloutFlavio Percoco-18/+18
2014-04-23Honor hidden doc attribute of derivable trait methodsEdward Wang-37/+52
Closes #13698
2014-04-22auto merge of #13398 : nick29581/rust/unsized-enum, r=nikomatsakisbors-22/+103
Now with proper checking of enums and allows unsized fields as the last field in a struct or variant. This PR only checks passing of unsized types and distinguishing them from sized ones. To be safe we also need to control storage. Closes issues #12969 and #13121, supersedes #13375 (all the discussion there is valid here too).
2014-04-23Review changesNick Cameron-1/+2
2014-04-22Apply lint attrs to individual "use" declarationsDavid Creswick-2/+10
Fixes #10534
2014-04-22add support for quadruple precision floating pointDaniel Micay-5/+12
This currently requires linking against a library like libquadmath (or libgcc), because compiler-rt barely has any support for this and most hardware does not yet have 128-bit precision floating point. For this reason, it's currently hidden behind a feature gate. When compiler-rt is updated to trunk, some tests can be added for constant evaluation since there will be support for the comparison operators. Closes #13381
2014-04-23Check for unsized types in enums.Nick Cameron-0/+7
And allow the last field of a struct or variant to be unsized.
2014-04-23Support unsized types with the `type` keywordNick Cameron-19/+85
2014-04-23Add a span to ast::TyParamNick Cameron-6/+13
2014-04-22rustc: de-@ middle::ty.Eduard Burtescu-0/+9
2014-04-21auto merge of #13435 : edwardw/rust/span, r=brsonbors-14/+23
When reporting "consider removing this semicolon" hint message, the offending semicolon may come from macro call site instead of macro itself. Using the more appropriate span makes the hint more helpful. Closes #13428.
2014-04-20Allow inheritance between structs.Nick Cameron-21/+73
No subtyping, no interaction with traits. Partially addresses #9912.
2014-04-18Replace all ~"" with "".to_owned()Richo Healey-219/+220
2014-04-18Update the rest of the compiler with ~[T] changesAlex Crichton-3/+2
2014-04-18Use more precise span when reporting semicolon hintEdward Wang-14/+23
When reporting "consider removing this semicolon" hint message, the offending semicolon may come from macro call site instead of macro itself. Using the more appropriate span makes the hint more helpful. Closes #13428.
2014-04-17auto merge of #13576 : lifthrasiir/rust/double-ref, r=alexcrichtonbors-38/+54
Uses the same strategy as `||` and `>>`. Closes #11227.
2014-04-17Drive-by: `pprust::*_to_str` for TypeMethod, Method, and FnDecl.Felix S. Klock II-0/+12
2014-04-17Extended `syntax::{fold, ast_map}` to include lifetimes.Felix S. Klock II-33/+85
Part of this required added an override of `fold_type_method` in the Folder for Ctx impl; it follows the same pattern as `fold_method`. Also, as a drive-by fix, I moved all of the calls to `folder.new_id` in syntax::fold's no-op default traversal to really be the first statement in each function. * This is to uphold the invariant that `folder.new_id` is always called first (an unfortunate requirement of the current `ast_map` code), an invariant that we seemingly were breaking in e.g. the previous `noop_fold_block`. * Now it should be easier to see when adding new code that this invariant must be upheld. * (note that the breakage in `noop_fold_block` may not have mattered so much previously, since the only thing that blocks can bind are lifetimes, which I am only adding support for now.)
2014-04-17syntax: Parses `&&` as `& &` whenever appropriate.Kang Seonghoon-38/+54
Closes #11227.
2014-04-16auto merge of #13547 : alexcrichton/rust/remove-priv, r=huonwbors-53/+54
See [RFC 6](https://github.com/rust-lang/rfcs/blob/e0c741f1c6e372d0fd31c5978fcf8c7bd7c3e973/active/0006-remove-priv.md)
2014-04-16syntax: Demote `priv` to a reserved keywordAlex Crichton-18/+18
It is no longer used in rust anywhere. RFC: 0006-remove-priv
2014-04-16rustc: Remove private enum variantsAlex Crichton-10/+2
This removes the `priv` keyword from the language and removes private enum variants as a result. The remaining use cases of private enum variants were all updated to be a struct with one private field that is a private enum. RFC: 0006-remove-priv Closes #13535
2014-04-16auto merge of #13544 : klutzy/rust/pprust, r=alexcrichtonbors-11/+14
Fixes #12685
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-161/+232
There's now one unified way to return things from a macro, instead of being able to choose the `AnyMacro` trait or the `MRItem`/`MRExpr` variants of the `MacResult` enum. This does simplify the logic handling the expansions, but the biggest value of this is it makes macros in (for example) type position easier to implement, as there's this single thing to modify. By my measurements (using `-Z time-passes` on libstd and librustc etc.), this appears to have little-to-no impact on expansion speed. There are presumably larger costs than the small number of extra allocations and virtual calls this adds (notably, all `macro_rules!`-defined macros have not changed in behaviour, since they had to use the `AnyMacro` trait anyway).
2014-04-16pprust: Handle multi-stmt/no-expr `ExprFnBlock`klutzy-11/+14
Fixes #12685
2014-04-15Remove usage of private enum variantsAlex Crichton-25/+34
This replaces all uses of private enum variants with a struct that has one private field pointing at a private enum. RFC: 0006-remove-priv
2014-04-14auto merge of #13496 : alexcrichton/rust/issue-13495, r=sfacklerbors-5/+2
This bug was introduced in #13384 by accident, and this commit continues the work of #13384 by finishing support for loading a syntax extension crate without registering it with the local cstore. Closes #13495
2014-04-13rustc: Don't link in syntax extensionsAlex Crichton-5/+2
This bug was introduced in #13384 by accident, and this commit continues the work of #13384 by finishing support for loading a syntax extension crate without registering it with the local cstore. Closes #13495
2014-04-13auto merge of #13452 : Ryman/rust/fix_uint_as_u, r=alexcrichtonbors-24/+36
Fixes #13359.
2014-04-13libsyntax: update helper to stringify TyU* and TyI* to take into account ↵Kevin Butler-24/+36
having a value. Fixes #13359.
2014-04-11syntax: remove ast::Sigil.Eduard Burtescu-78/+52
2014-04-10auto merge of #13440 : huonw/rust/strbuf, r=alexcrichtonbors-75/+118
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and port all code over to use it. Rebased & tests-fixed version of https://github.com/mozilla/rust/pull/13269
2014-04-10Renamed ast::Purity to ast::FnStyle and ast::ImpureFn to ast::NormalFn and ↵Kasey Carrothers-72/+72
updated associated variable and function names.
2014-04-10std,syntax: make std::fmt::parse use `Vec`s.Huon Wilson-4/+4
2014-04-10libstd: Implement `StrBuf`, a new string buffer type like `Vec`, andPatrick Walton-75/+118
port all code over to use it.
2014-04-08Test fixes from rollupAlex Crichton-8/+0
Closes #13394 (sync: remove unsafe and add Send+Share to Deref (enabled by autoderef vtables)) Closes #13389 (Made libflate functions return Options instead of outright failing) Closes #13388 (doc: Document flavorful variations of paths) Closes #13387 (Register new snapshots) Closes #13386 (std: Add more docs for ptr mod) Closes #13384 (Tweak crate loading to load less metadata) Closes #13382 (fix ~ZeroSizeType rvalues) Closes #13378 (Update tidy script, replace XXX with FIXME) Closes #13377 (std: User a smaller stdin buffer on windows) Closes #13369 (Fix spelling errors in comments.) Closes #13314 (Made 'make install' include libs for additional targets) Closes #13278 (std: make vec!() macro handle a trailing comma) Closes #13276 (Add test for #11881)
2014-04-08rustc: Never register syntax crates in CStoreAlex Crichton-7/+6
When linking, all crates in the local CStore are used to link the final product. With #[phase(syntax)], crates want to be omitted from this linkage phase, and this was achieved by dumping the entire CStore after loading crates. This causes crates like the standard library to get loaded twice. This loading process is a fairly expensive operation when dealing with decompressing metadata. This commit alters the loading process to never register syntax crates in CStore. Instead, only phase(link) crates ever make their way into the map of crates. The CrateLoader trait was altered to return everything in one method instead of having separate methods for finding information.
2014-04-08Register new snapshotsAlex Crichton-36/+21
2014-04-06auto merge of #13165 : sfackler/rust/io-vec, r=alexcrichtonbors-6/+7
`Reader`, `Writer`, `MemReader`, `MemWriter`, and `MultiWriter` now work with `Vec<u8>` instead of `~[u8]`. This does introduce some extra copies since `from_utf8_owned` isn't usable anymore, but I think that can't be helped until `~str`'s representation changes.
2014-04-06De-~[] Reader and WriterSteven Fackler-6/+7
There's a little more allocation here and there now since from_utf8_owned can't be used with Vec.
2014-04-06auto merge of #13315 : alexcrichton/rust/libc, r=alexcrichton,mebors-0/+2
Rebasing of #12526 with a very obscure bug fixed on windows.
2014-04-06syntax: Tweak parsing lifetime bounds on closuresAlex Crichton-137/+133
In summary these are some example transitions this change makes: 'a || => ||: 'a proc:Send() => proc():Send The intended syntax for closures is to put the lifetime bound not at the front but rather in the list of bounds. Currently there is no official support in the AST for bounds that are not 'static, so this case is currently specially handled in the parser to desugar to what the AST is expecting. Additionally, this moves the bounds on procedures to the correct position, which is after the argument list. The current grammar for closures and procedures is: procedure := 'proc' [ '<' lifetime-list '>' ] '(' arg-list ')' [ ':' bound-list ] [ '->' type ] closure := [ 'unsafe' ] ['<' lifetime-list '>' ] '|' arg-list '|' [ ':' bound-list ] [ '->' type ] lifetime-list := lifetime | lifetime ',' lifetime-list arg-list := ident ':' type | ident ':' type ',' arg-list bound-list := bound | bound '+' bound-list bound := path | lifetime This does not currently handle the << ambiguity in `Option<<'a>||>`, I am deferring that to a later patch. Additionally, this removes the support for the obsolete syntaxes of ~fn and &fn. Closes #10553 Closes #10767 Closes #11209 Closes #11210 Closes #11211
2014-04-04auto merge of #13284 : pnkfelix/rust/more-fs-info-on-crate-mismatch, ↵bors-8/+42
r=alexcrichton Fix #13266. There is a little bit of acrobatics in the definition of `crate_paths` to avoid calling `clone()` on the dylib/rlib unless we actually are going to need them. The other oddity is that I have replaced the `root_ident: Option<&str>` parameter with a `root: &Option<CratePaths>`, which may surprise one who was expecting to see something like: `root: Option<&CratePaths>`. I went with the approach here because I could not come up with code for the alternative that was acceptable to the borrow checker.
2014-04-05Added session.fileline_note() method and support infrastucture for it.Felix S. Klock II-8/+42
Add way to print notes with just file:linenum prefix (preserving integration with source lookup for e.g. vi and emacs) but don't repeat the other span info.
2014-04-04Test fixes from rollupAlex Crichton-4/+4
2014-04-04Register new snapshotsAlex Crichton-2/+0