about summary refs log tree commit diff
path: root/src/libsyntax/fold.rs
AgeCommit message (Collapse)AuthorLines
2015-04-21syntax: remove #![feature(box_syntax, box_patterns)]Erick Tryzelaar-3/+3
2015-04-11Propagate macro backtraces more often, improve formatting diagnosticsRyan Prichard-3/+5
* In noop_fold_expr, call new_span in these cases: - ExprMethodCall's identifier - ExprField's identifier - ExprTupField's integer Calling new_span for ExprMethodCall's identifier is necessary to print an acceptable diagnostic for write!(&2, ""). We see this error: <std macros>:2:20: 2:66 error: type `&mut _` does not implement any method in scope named `write_fmt` <std macros>:2 ( & mut * $ dst ) . write_fmt ( format_args ! ( $ ( $ arg ) * ) ) ) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ With this change, we also see a macro expansion backtrace leading to the write!(&2, "") call site. * After fully expanding a macro, we replace the expansion expression's span with the original span. Call fld.new_span to add a backtrace to this span. (Note that I'm call new_span after bt.pop(), so the macro just expanded isn't on the backtrace.) The motivating example for this change is println!("{}"). The format string literal is concat!($fmt, "arg") and is inside the libstd macro. We need to see the backtrace to find the println! call site. * Add a backtrace to the format_args! format expression span. Addresses #23459
2015-03-26Switch drop-flag to `u8` to allow special tags to instrument state.Felix S. Klock II-1/+1
Refactored code so that the drop-flag values for initialized (`DTOR_NEEDED`) versus dropped (`DTOR_DONE`) are given explicit names. Add `mem::dropped()` (which with `DTOR_DONE == 0` is semantically the same as `mem::zeroed`, but the point is that it abstracts away from the particular choice of value for `DTOR_DONE`). Filling-drop needs to use something other than `ptr::read_and_zero`, so I added such a function: `ptr::read_and_drop`. But, libraries should not use it if they can otherwise avoid it. Fixes to tests to accommodate filling-drop.
2015-03-11syntax: move MethMac to MacImplItem and combine {Provided,Required}Method ↵Eduard Burtescu-19/+10
into MethodTraitItem.
2015-03-11syntax: rename TypeMethod to MethodSig and use it in MethDecl.Eduard Burtescu-20/+13
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-118/+47
2015-03-11syntax: move indirection around {Trait,Impl}Item, from within.Eduard Burtescu-26/+23
2015-03-04std: Deprecate std::old_io::fsAlex Crichton-2/+2
This commit deprecates the majority of std::old_io::fs in favor of std::fs and its new functionality. Some functions remain non-deprecated but are now behind a feature gate called `old_fs`. These functions will be deprecated once suitable replacements have been implemented. The compiler has been migrated to new `std::fs` and `std::path` APIs where appropriate as part of this change.
2015-02-24Implement `<T>::method` UFCS expression syntax.Eduard Burtescu-11/+17
2015-02-24syntax: use a single Path for Trait::Item in QPath.Eduard Burtescu-19/+8
2015-02-24syntax: don't use TraitRef in QPath.Eduard Burtescu-4/+4
2015-02-24syntax: don't store a secondary NodeId for TyPath.Eduard Burtescu-4/+1
2015-02-22Rename DefTrait to DefaultImplFlavio Percoco-2/+2
2015-02-22Add support for default trait impls in libsyntaxFlavio Percoco-1/+4
2015-02-10rollup merge of #22116: kmcallister/cfg_attrAlex Crichton-14/+18
Fixes #22070. Fixes #19372. r? @sfackler
2015-02-09syntax::fold: Allow removing attributesKeegan McAllister-14/+18
2015-02-09Accept quantification of lifetimes outside the self type in where clauses.Nick Cameron-2/+5
Closes #20022
2015-02-05cleanup: replace `as[_mut]_slice()` calls with deref coercionsJorge Aparicio-5/+5
2015-02-03Remove the explicit closure kind syntax from the parser and AST;Niko Matsakis-2/+1
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-02`for x in xs.iter_mut()` -> `for x in &mut xs`Jorge Aparicio-2/+2
Also `for x in option.iter_mut()` -> `if let Some(ref mut x) = option`
2015-01-28Move return type an associated type of the `Fn*` traits. Mostly this ↵Niko Matsakis-2/+3
involves tweaking things in the compiler that assumed two input types to assume two ouputs; we also have to teach `project.rs` to project `Output` from the unboxed closure and fn traits.
2015-01-26Fallout of io => old_ioAlex Crichton-2/+2
2015-01-21rollup merge of #20179: eddyb/blind-itemsAlex Crichton-41/+15
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 #21340: pshc/libsyntax-no-more-intsAlex Crichton-4/+4
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.
2015-01-21syntax: fix fallout of merging ast::ViewItem into ast::Item.Eduard Burtescu-41/+15
2015-01-18Make output type in ast::FnDecl optionalSeo Sanghyeon-8/+2
2015-01-17libsyntax: rename functions from uint to usizePaul Collier-4/+4
2015-01-17libsyntax: uint types to usizePaul Collier-2/+2
2015-01-15auto merge of #21052 : nick29581/rust/methods-ext, r=sfacklerbors-42/+45
Allows modifiers to be used on methods, associated types, etc. r? @sfackler
2015-01-15syntax: add fully qualified UFCS expressions.Eduard Burtescu-1/+5
2015-01-15Syntax extensions on trait and impl items.Nick Cameron-42/+45
Allows modifiers to be used on methods, associated types, etc.
2015-01-05rollup merge of #20482: kmcallister/macro-reformAlex Crichton-5/+9
Conflicts: src/libflate/lib.rs src/libstd/lib.rs src/libstd/macros.rs src/libsyntax/feature_gate.rs src/libsyntax/parse/parser.rs src/libsyntax/show_span.rs src/test/auxiliary/macro_crate_test.rs src/test/compile-fail/lint-stability.rs src/test/run-pass/intrinsics-math.rs src/test/run-pass/tcp-connect-timeouts.rs
2015-01-05rollup merge of #20554: huonw/mut-patternAlex Crichton-1/+1
Conflicts: src/librustc_typeck/check/_match.rs
2015-01-05Reserve the keyword 'macro'Keegan McAllister-4/+4
2015-01-05remove TyClosureJorge Aparicio-11/+0
2015-01-05Reformat metadata for exported macrosKeegan McAllister-1/+5
Instead of copy-pasting the whole macro_rules! item from the original .rs file, we serialize a separate name, attributes list, and body, the latter as pretty-printed TTs. The compilation of macro_rules! macros is decoupled somewhat from the expansion of macros in item position. This filters out comments, and facilitates selective imports.
2015-01-05Change `&` pat to only work with &T, and `&mut` with &mut T.Huon Wilson-1/+1
This implements RFC 179 by making the pattern `&<pat>` require matching against a variable of type `&T`, and introducing the pattern `&mut <pat>` which only works with variables of type `&mut T`. The pattern `&mut x` currently parses as `&(mut x)` i.e. a pattern match through a `&T` or a `&mut T` that binds the variable `x` to have type `T` and to be mutable. This should be rewritten as follows, for example, for &mut x in slice.iter() { becomes for &x in slice.iter() { let mut x = x; Due to this, this is a [breaking-change] Closes #20496.
2015-01-04Add syntax for negative implementations of traitsFlavio Percoco-2/+3
This commit introduces the syntax for negative implmenetations of traits as shown below: `impl !Trait for Type {}` cc #13231 Part of RFC #3
2015-01-02rollup merge of #20341: nikomatsakis/impl-trait-for-trait-2Alex Crichton-1/+1
Conflicts: src/librustc/middle/traits/mod.rs src/libstd/io/mod.rs src/test/run-pass/builtin-superkinds-self-type.rs
2015-01-02Fix fallout from change, adding explicit `Sized` annotations where necessary.Niko Matsakis-1/+1
2015-01-02Make type in ast::Local optionalSeo Sanghyeon-1/+1
2014-12-29rollup merge of #20194: nick29581/dst-syntaxAlex Crichton-5/+3
Part of #19607. r? @nikomatsakis
2014-12-30Remove ExprSlice by hacking the compilerNick Cameron-6/+0
[breaking-change] The `mut` in slices is now redundant. Mutability is 'inferred' from position. This means that if mutability is only obvious from the type, you will need to use explicit calls to the slicing methods.
2014-12-30Add hypothetical support for ranges with only an upper boundNick Cameron-1/+1
Note that this doesn't add the surface syntax.
2014-12-29Slash the ast::Stmt type from 104 to 24 bytes.Huon Wilson-1/+1
(on platforms with 64-bit pointers.) The StmtMac variant is rather large and also fairly rare, so let's optimise the common case.
2014-12-26Accept `?Sized` as well as `Sized?`Nick Cameron-5/+3
Includes a bit of refactoring to store `?` unbounds as bounds with a modifier, rather than in their own world, in the AST at least.
2014-12-24Add syntax for rangesNick Cameron-0/+4
2014-12-20Add support for multiple region bounds in where clausesJared Roesch-2/+2
2014-12-20Add parser support for generalized where clausesJared Roesch-4/+11
Implement support in the parser for generalized where clauses, as well as the conversion of ast::WherePredicates to ty::Predicate in `collect.rs`.
2014-12-18librustc: Always parse `macro!()`/`macro![]` as expressions if notPatrick Walton-3/+3
followed by a semicolon. This allows code like `vec![1i, 2, 3].len();` to work. This breaks code that uses macros as statements without putting semicolons after them, such as: fn main() { ... assert!(a == b) assert!(c == d) println(...); } It also breaks code that uses macros as items without semicolons: local_data_key!(foo) fn main() { println("hello world") } Add semicolons to fix this code. Those two examples can be fixed as follows: fn main() { ... assert!(a == b); assert!(c == d); println(...); } local_data_key!(foo); fn main() { println("hello world") } RFC #378. Closes #18635. [breaking-change]