about summary refs log tree commit diff
path: root/src/libsyntax/ext
AgeCommit message (Collapse)AuthorLines
2015-12-31Cut out a bunch of Result and panictry! boilerplate from libsyntax.Nick Cameron-6/+6
[breaking-change] if you use any of the changed functions, you'll need to remove a try! or panictry!
2015-12-30Auto merge of #30526 - Ms2ger:PathParameters, r=brsonbors-2/+2
2015-12-30use structured errorsNick Cameron-37/+67
2015-12-23Auto merge of #30377 - Wafflespeanut:levenshtein, r=Manishearthbors-10/+3
fixes part of #30197
2015-12-22Stop re-exporting PathParameters's variants.Ms2ger-2/+2
2015-12-21Auto merge of #30460 - Ms2ger:BindingMode, r=alexcrichtonbors-3/+3
2015-12-20Stop re-exporting the ast::BindingMode variants.Ms2ger-3/+3
2015-12-18Rollup merge of #30420 - petrochenkov:owned2, r=nrcManish Goregaokar-13/+12
Part of https://github.com/rust-lang/rust/pull/30095 not causing mysterious segfaults. r? @nrc
2015-12-18Rollup merge of #30384 - nrc:diagnostics, r=@nikomatsakisManish Goregaokar-6/+6
Should make it possible to add JSON or HTML errors. Also tidies up a lot.
2015-12-18Deprecate name `OwnedSlice` and don't use itVadim Petrochenkov-13/+12
2015-12-17Remove unused importsJeffrey Seyfried-5/+5
2015-12-17move error handling from libsyntax/diagnostics.rs to libsyntax/errors/*Nick Cameron-6/+6
Also split out emitters into their own module.
2015-12-16Rollup merge of #30388 - DanielJCampbell:macro-ident-spans, r=nrcManish Goregaokar-5/+8
r? @nrc
2015-12-16Modify the Levenshtein-based suggestions to include importsRavi Shankar-10/+3
2015-12-15Fix expansion testsSeo Sanghyeon-4/+13
2015-12-15Move built-in syntax extensions to a separate crateSeo Sanghyeon-5243/+7
2015-12-15Generated code spans now point to callsite parameters (where applicable)Daniel Campbell-5/+8
2015-12-14[breaking-change] move ast_util functions to methodsfaineance-5/+4
2015-12-14Auto merge of #29735 - Amanieu:asm_indirect_constraint, r=pnkfelixbors-3/+9
This PR reverts #29543 and instead implements proper support for "=*m" and "+*m" indirect output operands. This provides a framework on top of which support for plain memory operands ("m", "=m" and "+m") can be implemented. This also fixes the liveness analysis pass not handling read/write operands correctly.
2015-12-13remove deprecated APIs missed in #30182Tamir Duberstein-7/+0
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-1/+1
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-12-05Use a struct instead of a tuple for inline asm output operandsAmanieu d'Antras-1/+6
2015-12-05Add proper support for indirect output constraints in inline asmAmanieu d'Antras-3/+4
2015-12-04Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelixbors-17/+49
See https://github.com/rust-lang/rfcs/pull/16 and https://github.com/rust-lang/rust/issues/15701 - Added syntax support for attributes on expressions and all syntax nodes in statement position. - Extended `#[cfg]` folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. - Extended lint checker to recognize lint levels on expressions and locals. - As per RFC, attributes are not yet accepted on `if` expressions. Examples: ```rust let x = y; { ... } assert_eq!((1, #[cfg(unset)] 2, 3), (1, 3)); let FOO = 0; ``` Implementation wise, there are a few rough corners and open questions: - The parser work ended up a bit ugly. - The pretty printer change was based mostly on guessing. - Similar to the `if` case, there are some places in the grammar where a new `Expr` node starts, but where it seemed weird to accept attributes and hence the parser doesn't. This includes: - const expressions in patterns - in the middle of an postfix operator chain (that is, after `.`, before indexing, before calls) - on range expressions, since `#[attr] x .. y` parses as `(#[attr] x) .. y`, which is inconsistent with `#[attr] .. y` which would parse as `#[attr] (.. y)` - Attributes are added as additional `Option<Box<Vec<Attribute>>>` fields in expressions and locals. - Memory impact has not been measured yet. - A cfg-away trailing expression in a block does not currently promote the previous `StmtExpr` in a block to a new trailing expr. That is to say, this won't work: ```rust let x = { #[cfg(foo)] Foo { data: x } #[cfg(not(foo))] Foo { data: y } }; ``` - One-element tuples can have their inner expression removed to become Unit, but just Parenthesis can't. Eg, `(#[cfg(unset)] x,) == ()` but `(#[cfg(unset)] x) == error`. This seemed reasonable to me since tuples and unit are type constructors, but could probably be argued either way. - Attributes on macro nodes are currently unconditionally dropped during macro expansion, which seemed fine since macro disappear at that point? - Attributes on `ast::ExprParens` will be prepend-ed to the inner expression in the hir folder. - The work on pretty printer tests for this did trigger, but not fix errors regarding macros: - expression `foo![]` prints as `foo!()` - expression `foo!{}` prints as `foo!()` - statement `foo![];` prints as `foo!();` - statement `foo!{};` prints as `foo!();` - statement `foo!{}` triggers a `None` unwrap ICE.
2015-11-30Improved comments around dropped attributes in the macro expanderMarvin Löbel-2/+2
2015-11-27Auto merge of #30064 - fhartwig:macro-suggestions, r=sanxiynbors-0/+16
Fixes #13677 This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers. Example. Compiling this program: ```rust macro_rules! foo { ($e:expr) => ( $e ) } fn main() { fob!("hello!"); } ``` gives the following error message: ``` /Users/mcp/temp/test.rs:7:5: 7:8 error: macro undefined: 'fob!' /Users/mcp/temp/test.rs:7 fob!("hello!"); ^~~ /Users/mcp/temp/test.rs:7:5: 7:8 help: did you mean `foo`? /Users/mcp/temp/test.rs:7 fob!("hello!"); ``` I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.
2015-11-27Introduce max_suggestion_distance function to avoid duplicating the heuristicFlorian Hartwig-4/+2
2015-11-26Added stmt_expr_attribute feature gateMarvin Löbel-8/+14
2015-11-26Some TLC for the MoveMap traitMarvin Löbel-1/+2
2015-11-26Fixed macro expander not folding attributes (though I'm not sure if that is ↵Marvin Löbel-15/+13
actually neccessary)
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-10/+37
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-26Add '!' to macro name suggestion, use fileline_help instead of span_helpFlorian Hartwig-1/+1
2015-11-26Add suggestion of similar macro names to `macro undefined` error messageFlorian Hartwig-0/+18
2015-11-25Fix "Cannot fill in a NT" ICEJonas Schievink-12/+23
2015-11-25Auto merge of #30011 - jonas-schievink:macro-context, r=nrcbors-10/+10
Fixes #22425 Also fixes #30007, since it's just a change from `true` to `false`.
2015-11-24Remove "this"Jonas Schievink-1/+1
2015-11-24Auto merge of #30000 - Manishearth:unreachable-call, r=nrcbors-4/+4
Fixes #1889
2015-11-24Fix unreachable code in libsyntaxManish Goregaokar-4/+4
2015-11-23Auto merge of #29952 - petrochenkov:depr, r=brsonbors-1/+1
Part of https://github.com/rust-lang/rust/issues/29935 The deprecation lint is still called "deprecated", so people can continue using `#[allow(deprecated)]` and similar things.
2015-11-23Print the macro context name on incomplete parseJonas Schievink-10/+10
Fixes #22425 Also fixes #30007, since it's just a change from `true` to `false`.
2015-11-22Look up macro names as well when suggesting replacements for function ↵Manish Goregaokar-18/+28
resolve errors fixes #5780
2015-11-20Rename #[deprecated] to #[rustc_deprecated]Vadim Petrochenkov-1/+1
2015-11-17Auto merge of #29887 - sanxiyn:match-ref-pats, r=sfacklerbors-22/+22
2015-11-17Fix match_ref_pats flagged by ClippySeo Sanghyeon-22/+22
2015-11-16rename `ast::ImplItem_::*ImplItem` to `ast::ImplItemKind::*`Oliver Schneider-7/+7
2015-11-16Auto merge of #29828 - sanxiyn:check-macro, r=nrcbors-49/+63
Fix #27409.
2015-11-14Check macro definition and do not expand invalid macrosSeo Sanghyeon-3/+22
2015-11-14Reindent codeSeo Sanghyeon-22/+22
2015-11-14Store TokenTree in MacroRulesMacroExpanderSeo Sanghyeon-28/+23
2015-11-13Move the panicking parse functions out of the parserKyle Mayes-3/+52
Since these functions are only used by the AST quoting syntax extensions, they should be there instead of in the parser.