about summary refs log tree commit diff
path: root/src/librustc/front
AgeCommit message (Collapse)AuthorLines
2015-10-01build up a set of node-ids that we can construct def-ids fromNiko Matsakis-214/+336
2015-10-01move direct accesses of `node` to go through `as_local_node_id`, unlessNiko Matsakis-3/+11
they are being used as an opaque "position identifier"
2015-10-01move job of creating local-def-ids to ast-map (with a few stragglers)Niko Matsakis-1/+15
2015-09-29Fill in some missing parts in the default HIR visitorVadim Petrochenkov-2/+2
2015-09-22Use Names in the remaining HIR structures with exception of...Vadim Petrochenkov-2/+2
PathSegment, PatIdent, ExprWhile, ExprLoop, ExprBreak and ExprAgain - they need Idents for resolve
2015-09-22Use Names in HIR ItemsVadim Petrochenkov-28/+28
2015-09-22Use Names in HIR visitors and foldersVadim Petrochenkov-3/+3
2015-09-16Use ast attributes every where (remove HIR attributes).Nick Cameron-2/+2
This could be a [breaking-change] if your lint or syntax extension (is that even possible?) uses HIR attributes or literals.
2015-09-03Add an intital HIR and lowering stepNick Cameron-0/+1391
2014-09-17move feature_gate to libsyntaxNick Cameron-465/+0
2014-09-17move std_inject to libsyntaxNick Cameron-237/+0
2014-09-17move most of front to libsyntaxNick Cameron-861/+0
2014-09-16Fallout from renamingAaron Turon-19/+19
2014-09-14rustc: fix fallout from using ptr::P.Eduard Burtescu-241/+210
2014-09-12Track the visited AST's lifetime throughout Visitor.Eduard Burtescu-7/+7
2014-09-12Remove largely unused context from Visitor.Eduard Burtescu-28/+27
2014-09-11auto merge of #17142 : sfackler/rust/issue-17115, r=alexcrichtonbors-0/+4
Closes #17115
2014-09-09Don't ICE on macros with -Z show-spanSteven Fackler-0/+4
Closes #17115
2014-09-10Implement tuple and tuple struct indexingP1start-0/+6
This allows code to access the fields of tuples and tuple structs: let x = (1i, 2i); assert_eq!(x.1, 2); struct Point(int, int); let origin = Point(0, 0); assert_eq!(origin.0, 0); assert_eq!(origin.1, 0);
2014-09-09rollup merge of #17052 : pcwalton/feature-gate-subslicesAlex Crichton-0/+15
2014-09-08quote: Explicitly borrow the ExtCtxtKeegan McAllister-5/+4
Fixes #16992.
2014-09-08librustc: Feature gate subslice matching in non-tail positions.Patrick Walton-0/+15
This breaks code that uses the `..xs` form anywhere but at the end of a slice. For example: match foo { [ 1, ..xs, 2 ] [ ..xs, 1, 2 ] } Add the `#![feature(advanced_slice_patterns)]` gate to reenable the syntax. RFC #54. Closes #16951. [breaking-change]
2014-09-04auto merge of #16923 : wickerwaka/rust/crate-as-fixup, r=alexcrichtonbors-1/+1
Changed occurances of: extern crate foo = "bar"; to: extern crate "bar" as foo; Added warning for old deprecated syntax
2014-09-03auto merge of #16892 : andrew-d/rust/andrew-fix-test-reexports, r=sfacklerbors-13/+32
Fixes #16597 I'm not 100% sure this is the correct way to handle this - but I wasn't able to find a better way without doing way more refactoring of the code that I was comfortable with. Comments and criticism are appreciated :smile:
2014-09-01Updated to new extern crate syntax.wickerwaka-1/+1
Added warning for old deprecated syntax
2014-08-30Address review comments, add testsAndrew Dunham-2/+1
2014-08-30rollup merge of #16840 : huonw/feature-has-addedAlex Crichton-1/+1
2014-08-30gensym each test re-export module individuallyAndrew Dunham-13/+33
Fixes #16597
2014-08-31Fix grammar of the accepted feature warning.Huon Wilson-1/+1
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-5/+2
2014-08-26Rebasing changesNick Cameron-2/+2
2014-08-26DST coercions and DST structsNick Cameron-5/+6
[breaking-change] 1. The internal layout for traits has changed from (vtable, data) to (data, vtable). If you were relying on this in unsafe transmutes, you might get some very weird and apparently unrelated errors. You should not be doing this! Prefer not to do this at all, but if you must, you should use raw::TraitObject rather than hardcoding rustc's internal representation into your code. 2. The minimal type of reference-to-vec-literals (e.g., `&[1, 2, 3]`) is now a fixed size vec (e.g., `&[int, ..3]`) where it used to be an unsized vec (e.g., `&[int]`). If you want the unszied type, you must explicitly give the type (e.g., `let x: &[_] = &[1, 2, 3]`). Note in particular where multiple blocks must have the same type (e.g., if and else clauses, vec elements), the compiler will not coerce to the unsized type without a hint. E.g., `[&[1], &[1, 2]]` used to be a valid expression of type '[&[int]]'. It no longer type checks since the first element now has type `&[int, ..1]` and the second has type &[int, ..2]` which are incompatible. 3. The type of blocks (including functions) must be coercible to the expected type (used to be a subtype). Mostly this makes things more flexible and not less (in particular, in the case of coercing function bodies to the return type). However, in some rare cases, this is less flexible. TBH, I'm not exactly sure of the exact effects. I think the change causes us to resolve inferred type variables slightly earlier which might make us slightly more restrictive. Possibly it only affects blocks with unreachable code. E.g., `if ... { fail!(); "Hello" }` used to type check, it no longer does. The fix is to add a semicolon after the string.
2014-08-16librustc: Forbid external crates, imports, and/or items from beingPatrick Walton-3/+21
declared with the same name in the same scope. This breaks several common patterns. First are unused imports: use foo::bar; use baz::bar; Change this code to the following: use baz::bar; Second, this patch breaks globs that import names that are shadowed by subsequent imports. For example: use foo::*; // including `bar` use baz::bar; Change this code to remove the glob: use foo::{boo, quux}; use baz::bar; Or qualify all uses of `bar`: use foo::{boo, quux}; use baz; ... baz::bar ... Finally, this patch breaks code that, at top level, explicitly imports `std` and doesn't disable the prelude. extern crate std; Because the prelude imports `std` implicitly, there is no need to explicitly import it; just remove such directives. The old behavior can be opted into via the `import_shadowing` feature gate. Use of this feature gate is discouraged. This implements RFC #116. Closes #16464. [breaking-change]
2014-08-14librustc: Stop assuming that implementations and traits only containPatrick Walton-10/+16
methods. This paves the way to associated items by introducing an extra level of abstraction ("impl-or-trait item") between traits/implementations and methods. This new abstraction is encoded in the metadata and used throughout the compiler where appropriate. There are no functional changes; this is purely a refactoring.
2014-08-14auto merge of #16122 : pcwalton/rust/lifetimes-in-unboxed-closures, r=pnkfelixbors-1/+1
This patch primarily does two things: (1) it prevents lifetimes from leaking out of unboxed closures; (2) it allows unboxed closure type notation, call notation, and construction notation to construct closures matching any of the three traits. This breaks code that looked like: let mut f; { let x = &5i; f = |&mut:| *x + 10; } Change this code to avoid having a reference escape. For example: { let x = &5i; let mut f; // <-- move here to avoid dangling reference f = |&mut:| *x + 10; } I believe this is enough to consider unboxed closures essentially implemented. Further issues (for example, higher-rank lifetimes) should be filed as followups. Closes #14449. [breaking-change] r? @pnkfelix
2014-08-14librustc: Tie up loose ends in unboxed closures.Patrick Walton-1/+1
This patch primarily does two things: (1) it prevents lifetimes from leaking out of unboxed closures; (2) it allows unboxed closure type notation, call notation, and construction notation to construct closures matching any of the three traits. This breaks code that looked like: let mut f; { let x = &5i; f = |&mut:| *x + 10; } Change this code to avoid having a reference escape. For example: { let x = &5i; let mut f; // <-- move here to avoid dangling reference f = |&mut:| *x + 10; } I believe this is enough to consider unboxed closures essentially implemented. Further issues (for example, higher-rank lifetimes) should be filed as followups. Closes #14449. [breaking-change]
2014-08-13std: Rename slice::Vector to SliceBrian Anderson-1/+1
This required some contortions because importing both raw::Slice and slice::Slice makes rustc crash. Since `Slice` is in the prelude, this renaming is unlikely to casue breakage. [breaking-change]
2014-08-09testsuite: implement #[reexport_test_harness_name] to get access to theHuon Wilson-18/+43
default entrypoint of the --test binary. This allows one to, e.g., run tests under libgreen by starting it manually, passing in the test entrypoint.
2014-08-07rustc: gensym the module names for --test to avoid introducing ↵Huon Wilson-50/+65
user-accessible names. This requires avoiding `quote_...!` for constructing the parts of the __test module, since that stringifies and reinterns the idents, losing the special gensym'd nature of them. (#15962.)
2014-07-31auto merge of #15999 : Kimundi/rust/fix_folder, r=nikomatsakisbors-1/+1
Note: This PR is motivated by an attempt to write an custom syntax extension that tried to use `syntax::fold`, and that could only do so by fixing bugs in it and copying out private functions. --- Refactored `syntax::fold` Prior to this, the code there had a few issues: - Default implementations inconsistenly either had the prefix `noop_` or not. - Some default methods where implemented in terms of a public noop function for user code to call, others where implemented directly on the trait and did not allow users of the trait to reuse the code. - Some of the default implementations where private, and thus not reusable for other implementors. - There where some bugs where default implemntations called other default implementations directly, rather than to the underlying Folder, with the result of some ast nodes never being visted even if the user implemented that method. (For example, the current Folder never folded struct fields) This commit solves this situation somewhat radically by making __all__ `fold_...` functions in the module into Folder methods, and implementing them all in terms of public `noop_...` functions for other implementors to call out to. Some public functions had to be renamed to fit the new system, so this is a breaking change. --- Also added a few trait implementations to `ast` types
2014-07-29manual: update list of feature gates, add phase attributeCorey Richardson-0/+2
2014-07-29Refactored syntax::fold.Marvin Löbel-1/+1
Prior to this, the code there had a few issues: - Default implementations inconsistently either had the prefix `noop_` or not. - Some default methods where implemented in terms of a public noop function for user code to call, others where implemented directly on the trait and did not allow users of the trait to reuse the code. - Some of the default implementations where private, and thus not reusable for other implementors. - There where some bugs where default implementations called other default implementations directly, rather than to the underlying Folder, with the result of some AST nodes never being visited even if the user implemented that method. (For example, the current Folder never folded struct fields) This commit solves this situation somewhat radically by making _all_ `fold_...` functions in the module into Folder methods, and implementing them all in terms of public `noop_...` functions for other implementors to call out to. Some public functions had to be renamed to fit the new system, so this is a breaking change. [breaking-change]
2014-07-27Make test expansion induce less reachabilitySteven Fackler-18/+31
We previously reexported entire modules, which caused private things to become reachable and trip the dead code and private items in public API lints. Closes #15912
2014-07-25rustc: Future proof runtime injectionBrian Anderson-2/+8
Rename and gensym the runtime on import, so that users can't refer to the `native` crate. This is unlikely to break code, but users should import the "native" crate directly. [breaking-change]
2014-07-21Don't create reexport module if there are noneSteven Fackler-2/+4
2014-07-21Restructure test harnessSteven Fackler-32/+53
We now build up a set of modules that reexport everything the test framework needs, instead of turning off privacy.
2014-07-21Remove useless RefCellsSteven Fackler-12/+11
2014-07-21rustc: Allow the crate linked to as 'std' to be customizedBrian Anderson-1/+8
This adds the alt_std_name field to the Session's Options type. I'm using this in an external tool to control which libraries a crate links to.
2014-07-18librustc: Implement unboxed closures with mutable receiversPatrick Walton-0/+7
2014-07-12auto merge of #15601 : jbclements/rust/disable-default-macro-behavior, ↵bors-0/+5
r=alexcrichton Our AST definition can include macro invocations, which can expand into all kinds of things. Macro invocations are expanded away during expansion time, and the rest of the compiler doesn't have to deal with them. However, we have no way of enforcing this. This patch adds two protective mechanisms. First, it adds a (quick) explicit check that ensures there are no macro invocations remaining in the AST after expansion. Second, it updates the visit and fold mechanisms so that by default, they will not traverse macro invocations. It's easy enough to add this, if desired (it's documented in the source, and examples appear, e.g. in the IdentFinder. Along the way, I also consulted with @sfackler to refactor the macro export mechanism so that it stores macro text spans in a side table, rather than leaving them in the AST.