about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-12-12Implement `#[deprecated]` attribute (RFC 1270)Vadim Petrochenkov-10/+88
2015-12-08Auto merge of #29995 - DanielJCampbell:Expanded-Span-Printing, r=nrcbors-0/+204
r? @nrc
2015-12-08Added pretty-printing for span expansion chains through span_to_expanded_string.Daniel Campbell-0/+204
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-13/+8
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-11/+29
2015-12-05Add proper support for indirect output constraints in inline asmAmanieu d'Antras-8/+9
2015-12-04Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelixbors-421/+1234
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-12-03libterm: bring across changes from termBryce Van Dyk-8/+8
This brings across changes made to the term library to libterm. This includes removing instances or unwrap, fixing format string handling, and removing a TODO. This fix does not bring all changes across, as term now relies on cargo deps that cannot be brought into the rust build at this stage, but has attempted as best to cross port changes not relying on this. This notably limits extra functionality since implemented int he Terminal trait in Term. This is in partly in response to rust issue #29992.
2015-12-01Auto merge of #25570 - oli-obk:const_indexing, r=nikomatsakisbors-0/+6
This PR allows the constant evaluation of index operations on constant arrays and repeat expressions. This allows index expressions to appear in the expression path of the length expression of a repeat expression or an array type. An example is ```rust const ARR: [usize; 5] = [1, 2, 3, 4, 5]; const ARR2: [usize; ARR[1]] = [42, 99]; ``` In most other locations llvm's const evaluator figures it out already. This is not specific to index expressions and could be remedied in the future.
2015-11-30Improved comments around dropped attributes in the macro expanderMarvin Löbel-2/+2
2015-11-30Simplyfied map_thin_attrs()Marvin Löbel-19/+3
2015-11-29Auto merge of #30075 - kyeah:mac-span, r=sanxiynbors-5/+9
Fixes #28424 (item macros), #30067 (impl item macros), and pattern macros.
2015-11-28Use last_span for macro spansKevin Yeh-3/+4
2015-11-27Auto merge of #30064 - fhartwig:macro-suggestions, r=sanxiynbors-0/+88
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/+10
2015-11-26Added stmt_expr_attribute feature gateMarvin Löbel-63/+291
2015-11-26Some TLC for the MoveMap traitMarvin Löbel-56/+120
2015-11-26Fixed macro expander not folding attributes (though I'm not sure if that is ↵Marvin Löbel-16/+18
actually neccessary)
2015-11-26Moved and refactored ThinAttributesMarvin Löbel-130/+132
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-312/+845
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-26Fix spans for macrosKevin Yeh-3/+6
2015-11-26Add '!' to macro name suggestion, use fileline_help instead of span_helpFlorian Hartwig-1/+1
2015-11-26Auto merge of #30015 - petrochenkov:staged, r=brsonbors-3/+4
Closes https://github.com/rust-lang/rust/issues/30008 `#[stable]`, `#[unstable]` and `#[rustc_deprecated]` are now guarded by `#[feature(staged_api)]` r? @brson
2015-11-26Add suggestion of similar macro names to `macro undefined` error messageFlorian Hartwig-0/+82
2015-11-25Fix "Cannot fill in a NT" ICEJonas Schievink-12/+23
2015-11-25Remove all uses of `#[staged_api]`Vadim Petrochenkov-1/+1
2015-11-25Remove `#[staged_api]`Vadim Petrochenkov-2/+3
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-24Rollup merge of #30004 - michaelwoerister:primitive-ty-to-str, r=alexcrichtonSteve Klabnik-29/+23
Good candidate for a rollup, this one.
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-8/+10
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-23Avoid some code duplication around getting names of numeric types.Michael Woerister-29/+23
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-8/+10
2015-11-20add feature gate `const_indexing`Oliver Schneider-0/+6
tracking issue is #29947
2015-11-18Rework the `IdVisitor` so that it only visits item contents (and doesn'tNiko Matsakis-18/+10
visit nested items). This is what all clients wanted anyhow.
2015-11-18Add some unicode aliases for ".Huon Wilson-0/+17
2015-11-17Auto merge of #29887 - sanxiyn:match-ref-pats, r=sfacklerbors-57/+57
2015-11-17Auto merge of #29766 - oli-obk:impl_item, r=nikomatsakisbors-38/+37
[breaking change] I'm not sure if those renames are ok. [TokenType::Tt* to TokenType::*](https://github.com/rust-lang/rust/pull/29582) was obvious, but for all those Item-enums it's less obvious to me what the right way forward is due to the underscore.
2015-11-17Fix match_ref_pats flagged by ClippySeo Sanghyeon-57/+57
2015-11-17Auto merge of #29837 - Wafflespeanut:unicode_chars, r=Manishearthbors-1/+193
fixes #25957
2015-11-17Detect confusing unicode characters and show the alternativeRavi Shankar-1/+193
2015-11-16rename `ast::ImplItem_::*ImplItem` to `ast::ImplItemKind::*`Oliver Schneider-38/+37
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