about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2015-02-03Correct one case where the inference was detecting a looser result than theNiko Matsakis-1/+1
explicit annotation, leading to "extra `mut` declaration" lint errors.
2015-02-03Remove the explicit closure kind syntax from the parser and AST;Niko Matsakis-4/+3
upgrade the inference based on expected type so that it is able to infer the fn kind in isolation even if the full signature is not available (and we could perhaps do better still in some cases, such as extracting just the types of the arguments but not the return value).
2015-02-02rollup merge of #21830: japaric/for-cleanupAlex Crichton-21/+21
Conflicts: src/librustc/metadata/filesearch.rs src/librustc_back/target/mod.rs src/libstd/os.rs src/libstd/sys/windows/os.rs src/libsyntax/ext/tt/macro_parser.rs src/libsyntax/print/pprust.rs src/test/compile-fail/issue-2149.rs
2015-02-02rollup merge of #21787: alexcrichton/std-envAlex Crichton-7/+7
Conflicts: src/libstd/sys/unix/backtrace.rs src/libstd/sys/unix/os.rs
2015-02-02`for x in xs.into_iter()` -> `for x in xs`Jorge Aparicio-3/+3
Also `for x in option.into_iter()` -> `if let Some(x) = option`
2015-02-02`for x in xs.iter_mut()` -> `for x in &mut xs`Jorge Aparicio-1/+1
Also `for x in option.iter_mut()` -> `if let Some(ref mut x) = option`
2015-02-02`for x in xs.iter()` -> `for x in &xs`Jorge Aparicio-17/+17
2015-02-02Omit integer suffix when unnecessaryAlfie John-29/+29
See PR # 21378 for context
2015-02-01std: Add a new `env` moduleAlex Crichton-7/+7
This is an implementation of [RFC 578][rfc] which adds a new `std::env` module to replace most of the functionality in the current `std::os` module. More details can be found in the RFC itself, but as a summary the following methods have all been deprecated: [rfc]: https://github.com/rust-lang/rfcs/pull/578 * `os::args_as_bytes` => `env::args` * `os::args` => `env::args` * `os::consts` => `env::consts` * `os::dll_filename` => no replacement, use `env::consts` directly * `os::page_size` => `env::page_size` * `os::make_absolute` => use `env::current_dir` + `join` instead * `os::getcwd` => `env::current_dir` * `os::change_dir` => `env::set_current_dir` * `os::homedir` => `env::home_dir` * `os::tmpdir` => `env::temp_dir` * `os::join_paths` => `env::join_paths` * `os::split_paths` => `env::split_paths` * `os::self_exe_name` => `env::current_exe` * `os::self_exe_path` => use `env::current_exe` + `pop` * `os::set_exit_status` => `env::set_exit_status` * `os::get_exit_status` => `env::get_exit_status` * `os::env` => `env::vars` * `os::env_as_bytes` => `env::vars` * `os::getenv` => `env::var` or `env::var_string` * `os::getenv_as_bytes` => `env::var` * `os::setenv` => `env::set_var` * `os::unsetenv` => `env::remove_var` Many function signatures have also been tweaked for various purposes, but the main changes were: * `Vec`-returning APIs now all return iterators instead * All APIs are now centered around `OsString` instead of `Vec<u8>` or `String`. There is currently on convenience API, `env::var_string`, which can be used to get the value of an environment variable as a unicode `String`. All old APIs are `#[deprecated]` in-place and will remain for some time to allow for migrations. The semantics of the APIs have been tweaked slightly with regard to dealing with invalid unicode (panic instead of replacement). The new `std::env` module is all contained within the `env` feature, so crates must add the following to access the new APIs: #![feature(env)] [breaking-change]
2015-01-31Fix rebase issuesAdolfo Ochagavía-9/+15
2015-01-31Replace uses of Decorator and ModifierAdolfo Ochagavía-31/+89
2015-01-31Deprecate SyntaxExtension::ModifierAdolfo Ochagavía-0/+1
Replaced by SyntaxExtension::MultiModifier [breaking-change]
2015-01-31Deprecate SyntaxExtension::DecoratorAdolfo Ochagavía-0/+1
It has been replaced by SyntaxExtension::MultiDecorator [breaking-change]
2015-01-31Add MultiDecorator variant to SyntaxExtension enumAdolfo Ochagavía-1/+27
2015-01-31Add MultiItemDecoratorAdolfo Ochagavía-0/+23
2015-01-31Deprecate ItemDecorator in favor of MultiItemDecoratorAdolfo Ochagavía-0/+1
[breaking-change]
2015-01-31Deprecate ItemModifier in favor of MultiItemModifierAdolfo Ochagavía-0/+3
[breaking-change]
2015-01-30rollup merge of #21713: alexcrichton/second-pass-fmtAlex Crichton-75/+61
2015-01-30std: Stabilize the std::fmt moduleAlex Crichton-75/+61
This commit performs a final stabilization pass over the std::fmt module, marking all necessary APIs as stable. One of the more interesting aspects of this module is that it exposes a good deal of its runtime representation to the outside world in order for `format_args!` to be able to construct the format strings. Instead of hacking the compiler to assume that these items are stable, this commit instead lays out a story for the stabilization and evolution of these APIs. There are three primary details used by the `format_args!` macro: 1. `Arguments` - an opaque package of a "compiled format string". This structure is passed around and the `write` function is the source of truth for transforming a compiled format string into a string at runtime. This must be able to be constructed in stable code. 2. `Argument` - an opaque structure representing an argument to a format string. This is *almost* a trait object as it's just a pointer/function pair, but due to the function originating from one of many traits, it's not actually a trait object. Like `Arguments`, this must be constructed from stable code. 3. `fmt::rt` - this module contains the runtime type definitions primarily for the `rt::Argument` structure. Whenever an argument is formatted with nonstandard flags, a corresponding `rt::Argument` is generated describing how the argument is being formatted. This can be used to construct an `Arguments`. The primary interface to `std::fmt` is the `Arguments` structure, and as such this type name is stabilize as-is today. It is expected for libraries to pass around an `Arguments` structure to represent a pending formatted computation. The remaining portions are largely "cruft" which would rather not be stabilized, but due to the stability checks they must be. As a result, almost all pieces have been renamed to represent that they are "version 1" of the formatting representation. The theory is that at a later date if we change the representation of these types we can add new definitions called "version 2" and corresponding constructors for `Arguments`. One of the other remaining large questions about the fmt module were how the pending I/O reform would affect the signatures of methods in the module. Due to [RFC 526][rfc], however, the writers of fmt are now incompatible with the writers of io, so this question has largely been solved. As a result the interfaces are largely stabilized as-is today. [rfc]: https://github.com/rust-lang/rfcs/blob/master/text/0526-fmt-text-writer.md Specifically, the following changes were made: * The contents of `fmt::rt` were all moved under `fmt::rt::v1` * `fmt::rt` is stable * `fmt::rt::v1` is stable * `Error` is stable * `Writer` is stable * `Writer::write_str` is stable * `Writer::write_fmt` is stable * `Formatter` is stable * `Argument` has been renamed to `ArgumentV1` and is stable * `ArgumentV1::new` is stable * `ArgumentV1::from_uint` is stable * `Arguments::new_v1` is stable (renamed from `new`) * `Arguments::new_v1_formatted` is stable (renamed from `with_placeholders`) * All formatting traits are now stable, as well as the `fmt` method. * `fmt::write` is stable * `fmt::format` is stable * `Formatter::pad_integral` is stable * `Formatter::pad` is stable * `Formatter::write_str` is stable * `Formatter::write_fmt` is stable * Some assorted top level items which were only used by `format_args!` were removed in favor of static functions on `ArgumentV1` as well. * The formatting-flag-accessing methods remain unstable Within the contents of the `fmt::rt::v1` module, the following actions were taken: * Reexports of all enum variants were removed * All prefixes on enum variants were removed * A few miscellaneous enum variants were renamed * Otherwise all structs, fields, and variants were marked stable. In addition to these actions in the `std::fmt` module, many implementations of `Show` and `String` were stabilized as well. In some other modules: * `ToString` is now stable * `ToString::to_string` is now stable * `Vec` no longer implements `fmt::Writer` (this has moved to `String`) This is a breaking change due to all of the changes to the `fmt::rt` module, but this likely will not have much impact on existing programs. Closes #20661 [breaking-change]
2015-01-30custom message for refutable patterns in for loopsJorge Aparicio-2/+2
2015-01-30implement for loop desugaringJorge Aparicio-3/+93
2015-01-29Auto merge of #21677 - japaric:no-range, r=alexcrichtonbors-14/+20
Note: Do not merge until we get a newer snapshot that includes #21374 There was some type inference fallout (see 4th commit) because type inference with `a..b` is not as good as with `range(a, b)` (see #21672). r? @alexcrichton
2015-01-29bring back `#[derive(Show)]` with a deprecation warningJorge Aparicio-0/+8
2015-01-29s/Show/Debug/gJorge Aparicio-4/+4
2015-01-29register snaphotsJorge Aparicio-2/+0
2015-01-29convert remaining `range(a, b)` to `a..b`Jorge Aparicio-4/+4
2015-01-29`for x in range(a, b)` -> `for x in a..b`Jorge Aparicio-3/+3
sed -i 's/in range(\([^,]*\), *\([^()]*\))/in \1\.\.\2/g' **/*.rs
2015-01-29`range(a, b).foo()` -> `(a..b).foo()`Jorge Aparicio-1/+1
sed -i 's/ range(\([^,]*\), *\([^()]*\))\./ (\1\.\.\2)\./g' **/*.rs
2015-01-29Rollup merge of 21681 - japaric:no-warn, r=alexcrichtonManish Goregaokar-4/+1
2015-01-28Auto merge of #21158 - alkor:issue-21131, r=nick29581bors-6/+10
Closes #21131
2015-01-27fix #[cfg(test)] warningsJorge Aparicio-4/+1
2015-01-27Merge remote-tracking branch 'rust-lang/master'Brian Anderson-5/+5
Conflicts: src/libcore/cell.rs src/librustc_driver/test.rs src/libstd/old_io/net/tcp.rs src/libstd/old_io/process.rs
2015-01-26Fallout of io => old_ioAlex Crichton-1/+1
2015-01-26Merge remote-tracking branch 'rust-lang/master'Brian Anderson-16/+65
Conflicts: src/librustc/lint/builtin.rs src/librustc/lint/context.rs
2015-01-26Auto merge of #21617 - alexcrichton:less-quotes, r=nikomatsakisbors-4/+4
This ends up propagating all the way out to the output of dep-info which then makes Cargo think that files are not existent (it thinks the files have quotes in their name) when they in fact do.
2015-01-26Auto merge of #21614 - kvark:typedef, r=huonwbors-16/+55
Fixes #21497 I don't know if this can be tested with built-in tests.
2015-01-26Auto merge of #21605 - huonw:omg-muscle-memory, r=eddybbors-0/+10
I'm beginning to suspect it's impossible to avoid accidentally writing `#[deriving]` at least once in every program, and it results in non-intuitive error messages: "Foo doesn't have any method in scope `clone`" despite there being a `#[deriv...(Clone)]` attribute! Also, lots of documentation around the internet uses `#[deriving]` so providing this guidance is very helpful (lots of people ask in #rust about this error).
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-4/+4
Conflicts: src/libcore/cmp.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/num/f32.rs src/libcore/num/f64.rs src/libcore/result.rs src/libcore/str/mod.rs src/librustc/lint/builtin.rs src/librustc/lint/context.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/poison.rs
2015-01-25Merge remote-tracking branch 'rust-lang/master'Brian Anderson-255/+242
Conflicts: mk/tests.mk src/liballoc/arc.rs src/liballoc/boxed.rs src/liballoc/rc.rs src/libcollections/bit.rs src/libcollections/btree/map.rs src/libcollections/btree/set.rs src/libcollections/dlist.rs src/libcollections/ring_buf.rs src/libcollections/slice.rs src/libcollections/str.rs src/libcollections/string.rs src/libcollections/vec.rs src/libcollections/vec_map.rs src/libcore/any.rs src/libcore/array.rs src/libcore/borrow.rs src/libcore/error.rs src/libcore/fmt/mod.rs src/libcore/iter.rs src/libcore/marker.rs src/libcore/ops.rs src/libcore/result.rs src/libcore/slice.rs src/libcore/str/mod.rs src/libregex/lib.rs src/libregex/re.rs src/librustc/lint/builtin.rs src/libstd/collections/hash/map.rs src/libstd/collections/hash/set.rs src/libstd/sync/mpsc/mod.rs src/libstd/sync/mutex.rs src/libstd/sync/poison.rs src/libstd/sync/rwlock.rs src/libsyntax/feature_gate.rs src/libsyntax/test.rs
2015-01-24syntax: Don't put quotes around filenames in codemapAlex Crichton-4/+4
This ends up propagating all the way out to the output of dep-info which then makes Cargo think that files are not existent (it thinks the files have quotes in their name) when they in fact do.
2015-01-25Associated types support for deriving::generic::TraitDefDzmitry Malyshau-16/+55
2015-01-25Tell the compiler to tell us that `deriving` is dead.Huon Wilson-0/+10
I'm beginning to suspect it's impossible to avoid accidentally writing `#[deriving]` at least once in every program, and it results in non-intuitive error messages: "Foo doesn't have any method in scope `clone`" despite there being a `#[deriv...(Clone)]` attribute! Also, lots of documentation around the internet uses `#[deriving]` so providing this guidance is very helpful (lots of people ask in #rust about this error). Fixes #21166.
2015-01-25Add the span of the operator itself to ast::BinOp.Huon Wilson-4/+4
2015-01-23Deprecated attributes don't take 'feature' names and are paired with ↵Brian Anderson-1/+2
stable/unstable Conflicts: src/libcore/atomic.rs src/libcore/finally.rs src/test/auxiliary/inherited_stability.rs src/test/auxiliary/lint_stability.rs
2015-01-23Rephrase error message on invalid fragment specifiers in macros.Alexander Korolkov-6/+10
Also, print help on valid fragment specifiers.
2015-01-21Add 'feature' and 'since' to stability attributesBrian Anderson-1/+2
2015-01-21rollup merge of #20179: eddyb/blind-itemsAlex Crichton-64/+48
Conflicts: src/librustc/diagnostics.rs src/librustdoc/clean/mod.rs src/librustdoc/html/format.rs src/libsyntax/parse/parser.rs
2015-01-21rollup merge of #21457: alexcrichton/issue-21436Alex Crichton-4/+6
Conflicts: src/liballoc/boxed.rs src/librustc/middle/traits/error_reporting.rs src/libstd/sync/mpsc/mod.rs
2015-01-21rollup merge of #21429: GuillaumeGomez/macro-fixAlex Crichton-53/+54
This is little clean code of this PR: #21366. I patched the same thing as aochagavia but too slowly obviously. This is a merge of our two codes, more "rust-like".
2015-01-21rollup merge of #21340: pshc/libsyntax-no-more-intsAlex Crichton-134/+134
Collaboration with @rylev! I didn't change `int` in the [quasi-quoter](https://github.com/pshc/rust/blob/99ae1a30f3ca28c0f7e431620560d30e44627124/src/libsyntax/ext/quote.rs#L328), because I'm not sure if there will be adverse effects. Addresses #21095.