about summary refs log tree commit diff
path: root/src/libsyntax/ext/env.rs
AgeCommit message (Collapse)AuthorLines
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-106/+0
2015-08-03syntax: Implement #![no_core]Alex Crichton-8/+2
This commit is an implementation of [RFC 1184][rfc] which tweaks the behavior of the `#![no_std]` attribute and adds a new `#![no_core]` attribute. The `#![no_std]` attribute now injects `extern crate core` at the top of the crate as well as the libcore prelude into all modules (in the same manner as the standard library's prelude). The `#![no_core]` attribute disables both std and core injection. [rfc]: https://github.com/rust-lang/rfcs/pull/1184
2015-04-14Positive case of `len()` -> `is_empty()`Tamir Duberstein-1/+1
`s/(?<!\{ self)(?<=\.)len\(\) == 0/is_empty()/g`
2015-02-27Replace MacExpr / MacPat / MacItems with MacEagerKeegan McAllister-2/+2
MacEager is a MacResult implementation for the common case where you've already built each form of AST that you might return. Fixes #17637. Based on #18814. This is a [breaking-change] for syntax extensions: * MacExpr::new becomes MacEager::expr. * MacPat::new becomes MacEager::pat. * MacItems::new becomes MacEager::items. It takes a SmallVector directly, not an iterator.
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-1/+1
where possible.
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-3/+3
2015-02-11std: Tweak the std::env OsString/String interfaceAlex Crichton-2/+2
This commit tweaks the interface of the `std::env` module to make it more ergonomic for common usage: * `env::var` was renamed to `env::var_os` * `env::var_string` was renamed to `env::var` * `env::args` was renamed to `env::args_os` * `env::args` was re-added as a panicking iterator over string values * `env::vars` was renamed to `env::vars_os` * `env::vars` was re-added as a panicking iterator over string values. This should make common usage (e.g. unicode values everywhere) more ergonomic as well as "the default". This is also a breaking change due to the differences of what's yielded from each of these functions, but migration should be fairly easy as the defaults operate over `String` which is a common type to use. [breaking-change]
2015-02-07Don't use std:: paths in syntax extensions when compiling a #![no_std] crateKeegan McAllister-2/+2
Fixes #16803. Fixes #14342. Fixes half of #21827 -- slice syntax is still broken.
2015-02-06Remove getenv warningGuillaumeGomez-4/+3
2015-02-06Update to last version, remove "[]" as much as possibleGuillaumeGomez-3/+3
2015-02-06Libsyntax has been updatedGuillaumeGomez-3/+2
2015-02-06Update HEAD:masterGuillaumeGomez-1/+1
2015-02-06Replace the get method by the deref one on InternedStringGuillaumeGomez-3/+5
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-17libsyntax: rename functions from uint to usizePaul Collier-1/+1
2015-01-07use slicing sugarJorge Aparicio-5/+5
2015-01-07Replace full slice notation with index callsNick Cameron-4/+4
2014-12-21Fallout of std::str stabilizationAlex Crichton-4/+4
2014-12-12Add support for equality constraints on associated typesNick Cameron-1/+2
2014-12-05Utilize fewer reexportsCorey Farwell-0/+2
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-09-16Fallout from renamingAaron Turon-1/+1
2014-09-14syntax: fix fallout from using ptr::P.Eduard Burtescu-9/+13
2014-08-27Implement generalized object and type parameter bounds (Fixes #16462)Niko Matsakis-4/+4
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-2/+2
[breaking-change]
2014-06-13librustc: Fix the issue with labels shadowing variable names by makingPatrick Walton-1/+1
the leading quote part of the identifier for the purposes of hygiene. This adopts @jbclements' solution to #14539. I'm not sure if this is a breaking change or not. Closes #12512. [breaking-change]
2014-05-22libstd: Remove `~str` from all `libstd` modules except `fmt` and `str`.Patrick Walton-3/+3
2014-05-08libsyntax: Remove uses of `~str` from libsyntax, and fix falloutPatrick Walton-1/+1
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-2/+2
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-04-16syntax: unify all MacResult's into a single trait.Huon Wilson-10/+10
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-03-20Removing imports of std::vec_ng::VecAlex Crichton-1/+0
It's now in the prelude.
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-12Changed lists of lifetimes in ast and ty to use Vec instead of OptVec.Felix S. Klock II-2/+2
There is a broader revision (that does this across the board) pending in #12675, but that is awaiting the arrival of more data (to decide whether to keep OptVec alive by using a non-Vec internally). For this code, the representation of lifetime lists needs to be the same in both ScopeChain and in the ast and ty structures. So it seemed cleanest to just use `vec_ng::Vec`, now that it has a cheaper empty representation than the current `vec` code.
2014-03-01libsyntax: Fix errors arising from the automated `~[T]` conversionPatrick Walton-4/+29
2014-02-19librustc: Remove unique vector patterns from the language.Patrick Walton-1/+1
Preparatory work for removing unique vectors from the language, which is itself preparatory work for dynamically sized types.
2014-02-18Avoid returning original macro if expansion fails.Douglas Young-6/+6
Closes #11692. Instead of returning the original expression, a dummy expression (with identical span) is returned. This prevents infinite loops of failed expansions as well as odd double error messages in certain situations.
2014-02-02libsyntax: De-`@str` literal strings in the ASTPatrick Walton-4/+9
2014-01-18syntax::ext: replace span_fatal with span_err in many places.Huon Wilson-11/+28
This means that compilation continues for longer, and so we can see more errors per compile. This is mildly more user-friendly because it stops users having to run rustc n times to see n macro errors: just run it once to see all of them.
2014-01-10rustc: Fix formatting of env! error messageBrian Anderson-1/+1
Death to caps.
2014-01-09libsyntax: Renamed types, traits and enum variants to CamelCase.Eduard Burtescu-2/+2
2013-12-29Start passing around &mut ExtCtxtSteven Fackler-2/+2
2013-12-28Stop using @ExtCtxtSteven Fackler-2/+2
2013-10-08add new enum ast::StrStyle as field to ast::lit_strBenjamin Herr-2/+5
For the benefit of the pretty printer we want to keep track of how string literals in the ast were originally represented in the source code. This commit changes parser functions so they don't extract strings from the token stream without at least also returning what style of string literal it was. This is stored in the resulting ast node for string literals, obviously, for the package id in `extern mod = r"package id"` view items, for the inline asm in `asm!()` invocations. For `asm!()`'s other arguments or for `extern "Rust" fn()` items, I just the style of string, because it seemed disproportionally cumbersome to thread that information through the string processing that happens with those string literals, given the limited advantage raw string literals would provide in these positions. The other syntax extensions don't seem to store passed string literals in the ast, so they also discard the style of strings they parse.
2013-09-30syntax: Remove usage of fmt!Alex Crichton-1/+1
2013-09-18Register new snapshotsAlex Crichton-12/+0
2013-09-01Modernized a few type names in rustc and syntaxMarvin Löbel-4/+4
2013-08-18quote_*! macros take an ExtCtxSteven Fackler-8/+20
They previously required one called "ext_cx" to be in scope. Fixes part of #7727
2013-08-11Fixed option_env! typeSteven Fackler-1/+1
The type of the result of option_env! was not fully specified in the None case, leading to type check failures in the case where the variable was not defined (e.g. option_env!("FOO").is_none()).
2013-08-08env! syntax extension changesSteven Fackler-7/+25
env! aborts compilation of the specified environment variable is not defined and takes an optional second argument containing a custom error message. option_env! creates an Option<&'static str> containing the value of the environment variable. There are no run-pass tests that check the behavior when the environment variable is defined since the test framework doesn't support setting environment variables at compile time as opposed to runtime. However, both env! and option_env! are used inside of rustc itself, which should act as a sufficient test. Close #2248
2013-06-25great renaming propagation: syntaxCorey Richardson-3/+1
2013-06-13Use @str instead of @~str in libsyntax and librustc. Fixes #5048.Huon Wilson-2/+2
This almost removes the StringRef wrapper, since all strings are Equiv-alent now. Removes a lot of `/* bad */ copy *`'s, and converts several things to be &'static str (the lint table and the intrinsics table). There are many instances of .to_managed(), unfortunately.