summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2014-05-23Improve error message for lifetimes after type params.Kevin Butler-1/+13
Closes #14303.
2014-05-23auto merge of #14360 : alexcrichton/rust/remove-deprecated, r=kballardbors-248/+51
These have all been deprecated for awhile now, so it's likely time to start removing them.
2014-05-23syntax: Clean out obsolete syntax parsingAlex Crichton-248/+51
All of these features have been obsolete since February 2014, where most have been obsolete since 2013. There shouldn't be any more need to keep around the parser hacks after this length of time.
2014-05-22auto merge of #14357 : huonw/rust/spelling, r=pnkfelixbors-4/+4
The span on a inner doc-comment would point to the next token, e.g. the span for the `a` line points to the `b` line, and the span of `b` points to the `fn`. ```rust //! a //! b fn bar() {} ```
2014-05-22auto merge of #14314 : alexcrichton/rust/deriving-hash, r=brsonbors-1/+2
One of the long-term goals of the libstd facade is to move the collections library underneath the standard library. This would imply that libcollections today would invert its dependency with libstd. One of the primary blockers for doing this is the HashMap collection. Of its two major dependencies, hashing and randomness, this commit is the first step in dealing with hashing. When moving the hash module beneath libstd, it must break its primary dependence on the io::Writer trait (used as the hashing state). The proposed strategy for breaking this dependence is taking a similar path as core::fmt, which is to have the hash module define its own "writer trait". This trait would be similar to std::io::Writer, except that it would not return errors and it would have fewer convenience methods. The Hash trait today has its type parameter behind a feature gate (default type parameters), so this pending change will likely break no code which hasn't opted in to the feature gate. The SipState struct will lose its implementation of io::Writer, but it will regain similar methods for dealing with writing data. This change specifically prepares for the hash migration by modifying deriving(Hash) to use the std::hash::Writer bound instead of the std::io::Writer bound. This bound is currently wired to std::io::Writer, but after a snapshot it will have no need to be wired to the io writer trait.
2014-05-22auto merge of #14348 : alexcrichton/rust/doc.rust-lang.org, r=huonwbors-3/+3
2014-05-22libcore: Remove all uses of `~str` from `libcore`.Patrick Walton-5/+14
[breaking-change]
2014-05-22libstd: Remove all uses of `~str` from `libstd`Patrick Walton-24/+32
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-170/+275
2014-05-22syntax: put the correct span on doc-comments inside a module.Huon Wilson-4/+4
The position of the .bump call (before extracting the span fields) was causing a doc-comment to have the span of the next token, not itself.
2014-05-21auto merge of #14321 : alexcrichton/rust/ices, r=pcwaltonbors-1/+1
Also adding tests for fixed ICEs
2014-05-21doc: Fix some broken linksAlex Crichton-1/+1
2014-05-21Change static.rust-lang.org to doc.rust-lang.orgAlex Crichton-2/+2
The new documentation site has shorter urls, gzip'd content, and index.html redirecting functionality.
2014-05-21auto merge of #14320 : kballard/rust/fix_stdlib_inject_attrs, r=alexcrichtonbors-2/+16
The #[phase(syntax,link)] attribute on `extern crate std` needs to be an outer attribute so it can pretty-print properly. Also add `#![no_std]` and `#[feature(phase)]` so compiling the pretty-printed source will work.
2014-05-21std: Change hash to reexport its own WriterAlex Crichton-1/+2
One of the long-term goals of the libstd facade is to move the collections library underneath the standard library. This would imply that libcollections today would invert its dependency with libstd. One of the primary blockers for doing this is the HashMap collection. Of its two major dependencies, hashing and randomness, this commit is the first step in dealing with hashing. When moving the hash module beneath libstd, it must break its primary dependence on the io::Writer trait (used as the hashing state). The proposed strategy for breaking this dependence is taking a similar path as core::fmt, which is to have the hash module define its own "writer trait". This trait would be similar to std::io::Writer, except that it would not return errors and it would have fewer convenience methods. The Hash trait today has its type parameter behind a feature gate (default type parameters), so this pending change will likely break no code which hasn't opted in to the feature gate. The SipState struct will lose its implementation of io::Writer, but it will regain similar methods for dealing with writing data. This change specifically prepares for the hash migration by modifying deriving(Hash) to use the std::hash::Writer bound instead of the std::io::Writer bound. This bound is currently wired to std::io::Writer, but after a snapshot it will have no need to be wired to the io writer trait.
2014-05-21rustc: improve error messages from wrong --pretty flowgraph use.Huon Wilson-4/+10
This defers to .fatal and .span_fatal for errors (rather than `fail!` which prints the ICE message). It also adds the span lookup when an id doesn't correspond to a block, to show what it is pointing at. It also makes the argument parser slightly looser, so that passing `--pretty flowgraph` recognises the `flowgraph` part and suggests to use an integer.
2014-05-20Change std inject attributes to outer attributesKevin Ballard-2/+16
The #[phase(syntax,link)] attribute on `extern crate std` needs to be an outer attribute so it can pretty-print properly. Also add `#![no_std]` and `#[feature(phase)]` so compiling the pretty-printed source will work.
2014-05-20syntax: Parse global paths in patternsAlex Crichton-1/+1
Closes #6449
2014-05-19Reset the terminal color before the newline for diagnosticsKevin Ballard-2/+21
When printing colored diagnostics, we need to reset the terminal before emitting the newline, not after. Otherwise it gets line-buffered and the color won't reset until the next line is printed or the compiler exits. Normally this isn't a problem, but when running rustc in parallel with other processes (e.g. `make -j4`) this can cause the color to leak to other lines.
2014-05-19auto merge of #14251 : alexcrichton/rust/hierarchy, r=huonwbors-7/+52
This is an implementation of RFC 16. A module can now only be loaded if the module declaring `mod name;` "owns" the current directory. A module is considered as owning its directory if it meets one of the following criteria: * It is the top-level crate file * It is a `mod.rs` file * It was loaded via `#[path]` * It was loaded via `include!` * The module was declared via an inline `mod foo { ... }` statement For example, this directory structure is now invalid // lib.rs mod foo; // foo.rs mod bar; // bar.rs; fn bar() {} With this change `foo.rs` must be renamed to `foo/mod.rs`, and `bar.rs` must be renamed to `foo/bar.rs`. This makes it clear that `bar` is a submodule of `foo`, and can only be accessed through `foo`. RFC: 0016-module-file-system-hierarchy Closes #14180 [breaking-change]
2014-05-18auto merge of #14000 : pnkfelix/rust/fsk-fix-issue13732, r=alexcrichtonbors-0/+3
Fix #13732. This is a revised, much less hacky form of PR #13753 The changes here: * add instrumentation to aid debugging of linkage errors, * fine tune some things in the Makefile where we are telling binaries to use a host-oriented path for finding dynamic libraries, when it should be feeding the binaries a target-oriented path for dynamic libraries. * pass along the current stage number to run-make tests, and * skip certain tests when running atop stage1. Fix #13746 as well.
2014-05-18Output debug info on how `#[phase] extern crate foo;` gets resolved.Felix S. Klock II-0/+3
2014-05-18Make bytes!() return 'staticKevin Ballard-6/+27
Change `bytes!()` to return { static BYTES: &'static [u8] = &[...]; BYTES } This gives it the `'static` lifetime, whereas before it had an rvalue lifetime. Until recently this would have prevented assigning `bytes!()` to a static, as in static FOO: &'static [u8] = bytes!(1,2,3); but #14183 fixed it so blocks are now allowed in constant expressions (with restrictions). Fixes #11641.
2014-05-17syntax: Tighten search paths for inner modulesAlex Crichton-7/+52
This is an implementation of RFC 16. A module can now only be loaded if the module declaring `mod name;` "owns" the current directory. A module is considered as owning its directory if it meets one of the following criteria: * It is the top-level crate file * It is a `mod.rs` file * It was loaded via `#[path]` * It was loaded via `include!` * The module was declared via an inline `mod foo { ... }` statement For example, this directory structure is now invalid // lib.rs mod foo; // foo.rs mod bar; // bar.rs; fn bar() {} With this change `foo.rs` must be renamed to `foo/mod.rs`, and `bar.rs` must be renamed to `foo/bar.rs`. This makes it clear that `bar` is a submodule of `foo`, and can only be accessed through `foo`. RFC: 0016-module-file-system-hierarchy Closes #14180 [breaking-change]
2014-05-16auto merge of #14233 : pcwalton/rust/detildestr-morelibs, r=alexcrichtonbors-3/+6
r? @alexcrichton
2014-05-16libserialize: Remove all uses of `~str` from `libserialize`.Patrick Walton-2/+3
Had to make `struct Tm` in `libtime` not serializable for now.
2014-05-16libfmt_macros: Remove all uses of `~str` from `libfmt_macros`Patrick Walton-1/+3
2014-05-16Update for BoxCorey Richardson-1/+1
2014-05-16syntax: update for libterm falloutCorey Richardson-4/+4
2014-05-15Updates with core::fmt changesAlex Crichton-9/+9
1. Wherever the `buf` field of a `Formatter` was used, the `Formatter` is used instead. 2. The usage of `write_fmt` is minimized as much as possible, the `write!` macro is preferred wherever possible. 3. Usage of `fmt::write` is minimized, favoring the `write!` macro instead.
2014-05-15syntax: Add a macro, format_args_method!()Alex Crichton-29/+62
Currently, the format_args!() macro takes as its first argument an expression which is the callee of an ExprCall. This means that if format_args!() is used with calling a method a closure must be used. Consider this code, however: format_args!(|args| { foo.writer.write_fmt(args) }, "{}", foo.field) The closure borrows the entire `foo` structure, disallowing the later borrow of `foo.field`. To preserve the semantics of the `write!` macro, it is also impossible to borrow specifically the `writer` field of the `foo` structure because it must be borrowed mutably, but the `foo` structure is not guaranteed to be mutable itself. This new macro is invoked like: format_args_method!(foo.writer, write_fmt, "{}", foo.field) This macro will generate an ExprMethodCall which allows the borrow checker to understand that `writer` and `field` should be borrowed separately. This macro is not strictly necessary, with DST or possibly UFCS other workarounds could be used. For now, though, it looks like this is required to implement the `write!` macro.
2014-05-15auto merge of #14234 : alexcrichton/rust/rollup, r=alexcrichtonbors-1/+11
Let's try this again!
2014-05-15Add `EntryPat` and `NodePat` variants to ast_map.Felix S. Klock II-1/+11
Add `EntryPat` and `NodePat` variants to ast_map, so that lookups for id 1 in `let S{val: _x /* pat 2 */} /* pat 1 */ = ...` will actually resolve to the pattern `S{ ... }`, rather than "unknown node", in a function like `node_id_to_str`.
2014-05-15auto merge of #14040 : hannobraun/rust/force-color-output, r=alexcrichtonbors-6/+20
This pull request fixes #12881. Two caveats: 1. As explained in the commit message, this doesn't include a regression test. If this is unacceptable, please let me know, I'll see what I can do. 1. I'm getting some test failures on make check, all from debuginfo. I suspect this is due to #13680 and not related to my changes (I have GDB 7.7). This is the list of failed tests: > [debuginfo-gdb] debuginfo/basic-types-globals.rs > [debuginfo-gdb] debuginfo/basic-types-mut-globals.rs > [debuginfo-gdb] debuginfo/basic-types.rs > [debuginfo-gdb] debuginfo/borrowed-basic.rs > [debuginfo-gdb] debuginfo/borrowed-managed-basic.rs > [debuginfo-gdb] debuginfo/borrowed-struct.rs > [debuginfo-gdb] debuginfo/borrowed-unique-basic.rs > [debuginfo-gdb] debuginfo/box.rs > [debuginfo-gdb] debuginfo/by-value-non-immediate-argument.rs > [debuginfo-gdb] debuginfo/by-value-self-argument-in-trait-impl.rs > [debuginfo-gdb] debuginfo/closure-in-generic-function.rs > [debuginfo-gdb] debuginfo/evec-in-struct.rs > [debuginfo-gdb] debuginfo/function-arg-initialization.rs > [debuginfo-gdb] debuginfo/function-prologue-stepping-no-split-stack.rs > [debuginfo-gdb] debuginfo/generic-function.rs > [debuginfo-gdb] debuginfo/generic-functions-nested.rs > [debuginfo-gdb] debuginfo/generic-method-on-generic-struct.rs > [debuginfo-gdb] debuginfo/generic-static-method-on-struct-and-enum.rs > [debuginfo-gdb] debuginfo/generic-struct.rs > [debuginfo-gdb] debuginfo/lexical-scope-in-stack-closure.rs > [debuginfo-gdb] debuginfo/lexical-scope-in-unique-closure.rs > [debuginfo-gdb] debuginfo/method-on-generic-struct.rs > [debuginfo-gdb] debuginfo/method-on-tuple-struct.rs > [debuginfo-gdb] debuginfo/name-shadowing-and-scope-nesting.rs > [debuginfo-gdb] debuginfo/recursive-struct.rs > [debuginfo-gdb] debuginfo/self-in-generic-default-method.rs > [debuginfo-gdb] debuginfo/shadowed-argument.rs > [debuginfo-gdb] debuginfo/shadowed-variable.rs > [debuginfo-gdb] debuginfo/simd.rs > [debuginfo-gdb] debuginfo/simple-lexical-scope.rs > [debuginfo-gdb] debuginfo/simple-struct.rs > [debuginfo-gdb] debuginfo/simple-tuple.rs > [debuginfo-gdb] debuginfo/static-method-on-struct-and-enum.rs > [debuginfo-gdb] debuginfo/tuple-struct.rs > [debuginfo-gdb] debuginfo/var-captured-in-nested-closure.rs > [debuginfo-gdb] debuginfo/var-captured-in-sendable-closure.rs > [debuginfo-gdb] debuginfo/var-captured-in-stack-closure.rs I can provide the full output on request.
2014-05-15Add compiler flag to configure output coloringHanno Braun-6/+20
This adds the flag --color, which allows the user to force coloring or turn it off. The default behavior stays the same as before (colorize, if output goes to tty). Why this is beneficial is explained in issue #12881. Please note that this commit doesn't include any regression tests. I thought about how I'd write a test for this and it doesn't seem to be worth the effort to me for a UI change like this. Fixes #12881.
2014-05-15syntax::visit: pub `walk_explicit_self` so impls can call it as defaults do.Felix S. Klock II-3/+13
drive-by: added some doc.
2014-05-14Removed unnecessary arguments for walk_* functionsMichael Darakananda-12/+7
2014-05-13syntax: Improve --pretty normal slightlyAlex Crichton-2/+8
When printing doc comments, always put a newline after them in a macro invocation to ensure that a line-doc-comment doesn't consume remaining tokens on the line.
2014-05-13syntax: Preserve attributes in #[deriving]Alex Crichton-11/+25
Now that the #[deriving] attribute is removed, the raw_pointers_deriving lint was broken. This commit restores the lint by preserving lint attributes across #[deriving] to the implementations and using #[automatically_derived] as the trigger for activating the lint.
2014-05-13syntax: Print suffixed token literals correctlyAlex Crichton-0/+3
Previously, literals "1i" were printed as "1". This fixes the numeric-method-autoexport test for pretty printing.
2014-05-13syntax: Fix parsing << with closure typesAlex Crichton-6/+54
This uses the trick of replacing the << token with a < token to parse closure types correctly. Closes #13324
2014-05-13syntax: Fix printing INT64_MINAlex Crichton-12/+29
Integers are always parsed as a u64 in libsyntax, but they're stored as i64. The parser and pretty printer both printed an i64 instead of u64, sometimes introducing an extra negative sign.
2014-05-13Touch up and rebase previous commitsAlex Crichton-29/+13
* Added `// no-pretty-expanded` to pretty-print a test, but not run it through the `expanded` variant. * Removed #[deriving] and other expanded attributes after they are expanded * Removed hacks around &str and &&str and friends (from both the parser and the pretty printer). * Un-ignored a bunch of tests
2014-05-13libsyntax: Workaround pprust `for` issueklutzy-1/+1
2014-05-13pprust: Remove unnecessary && of `print_tt`klutzy-4/+4
2014-05-13pprust: Print `&&e` instead of `& &e`klutzy-5/+0
2014-05-13pprust: Fix asm outputklutzy-14/+19
2014-05-13pprust: Add parentheses to some Exprklutzy-3/+45
Some `Expr` needs parentheses when printed. For example, without parentheses, `ExprUnary(UnNeg, ExprBinary(BiAdd, ..))` becomes `-lhs + rhs` which is wrong. Those cases don't appear in ordinary code (since parentheses are explicitly added) but they can appear in manually crafted ast by extensions.
2014-05-12Cleanup some ugly variable names, now that we have `let`-hygiene.Paul Stansifer-14/+14
2014-05-12Add some long-overdue documentation on the INTERPOLATED helper macros.Paul Stansifer-1/+6