summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2015-04-14std: Remove old_io/old_path/rand modulesAlex Crichton-17/+0
This commit entirely removes the old I/O, path, and rand modules. All functionality has been deprecated and unstable for quite some time now!
2015-04-14Auto merge of #24312 - rprichard:destabilize-format-args, r=alexcrichtonbors-19/+25
Fixes #22953.
2015-04-14Add "trace-macros" as a compiler flagThomas Jespersen-4/+4
Fixes #22619
2015-04-14Auto merge of #24295 - contradictioned:master, r=alexcrichtonbors-1/+7
As i proposed in #24262 (and found acceptance in the IRC channel), added a compiler warning for wrong escaping of curly braces.
2015-04-14Expose visibility for fns in syntax::visitNick Cameron-23/+30
2015-04-13syntax: Publically expose printing where clauses, and add attr_to_stringErick Tryzelaar-1/+5
2015-04-13Added a help span which informs the user about the escaping of curly braces ↵Manuel Hoffmann-1/+7
in a format string if a wrongly escaped one is detected in a string.
2015-04-13Auto merge of #24323 - rprichard:panic-line-type, r=alexcrichtonbors-1/+1
There are syntax extensions that call `std::rt::begin_unwind` passing it a `usize`. I updated the syntax extension to instead pass `u32`, but for bootstrapping reasons, I needed to create a `#[cfg(stage0)]` version of `std::rt::begin_unwind` and therefore also `panic!`.
2015-04-12Use the ecx.call_site() span for generating refs to format_args! internalsRyan Prichard-19/+25
`format_args!` uses `#[allow_internal_unstable]` to access internal functions and structs that are marked unstable. For this to work, the spans on AST nodes referencing unstable internals must be equal (same lo/hi values) to the `format_args!` call site, so that the stability checker can recognize that the AST node was generated by the macro.
2015-04-12Auto merge of #24248 - nrc:macro-span, r=sfacklerbors-9/+11
2015-04-12Auto merge of #24003 - rprichard:span-fixes, r=huonwbors-23/+16
* 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. r? alexcrichton Addresses #23459
2015-04-12Fix spans for macrosNick Cameron-9/+11
2015-04-12Auto merge of #23011 - nagisa:the-war-of-symbol-and-symbol, r=pnkfelixbors-0/+17
We provide tools to tell what exact symbols to emit for any fn or static, but don’t quite check if that won’t cause any issues later on. Some of the issues include LLVM mangling our names again and our names pointing to wrong locations, us generating dumb foreign call wrappers, linker errors, extern functions resolving to different symbols altogether (`extern {fn fail();} fail();` in some cases calling `fail1()`), etc. Before the commit we had a function called `note_unique_llvm_symbol`, so it is clear somebody was aware of the issue at some point, but the function was barely used, mostly in irrelevant locations. Along with working on it I took liberty to start refactoring trans/base into a few smaller modules. The refactoring is incomplete and I hope I will find some motivation to carry on with it. This is possibly a [breaking-change] because it makes dumbly written code properly invalid. This fixes all those issues about incorrect use of #[no_mangle] being not reported/misreported/ICEd by the compiler. NB. This PR does not attempt to tackle the parallel codegen issue that was mentioned in https://github.com/rust-lang/rust/pull/22811, but I believe it should be very straightforward in a follow up PR by modifying `trans::declare::get_defined_value` to look at all the contexts. cc @alexcrichton @huonw @nrc because you commented on the original RFC issue. EDIT: wow, this became much bigger than I initially intended.
2015-04-11Remove the vestigial ExtCtxt::print_backtrace function.Ryan Prichard-12/+0
It was added in 2011-08-05 and reduced to a no-op ten days later.
2015-04-11Suppress the macro backtrace for `fileline_note` and `fileline_help`.Ryan Prichard-5/+4
2015-04-11Propagate macro backtraces more often, improve formatting diagnosticsRyan Prichard-6/+12
* 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-04-11Rollup merge of #24242 - nikomatsakis:escaping-closure-error-message, r=brsonManish Goregaokar-71/+235
Example showing sample inputs, old message, new message: https://gist.github.com/nikomatsakis/11126784ac678b7eb6ba Also adds infrastructure for reporting suggestions \"in situ\" and does some (minor) cleanups to `CodeMap`. r? @brson
2015-04-11Change the rt::unwind line argument type from usize to u32.Ryan Prichard-1/+1
2015-04-11Auto merge of #24155 - chris-chambers:stmt_macros, r=sfacklerbors-45/+87
Statement macros are now treated somewhat like item macros, in that a statement macro can now expand into a series of statements, rather than just a single statement. This allows statement macros to be nested inside other kinds of macros and expand properly, where previously the expansion would only work when no nesting was present. See: - `src/test/run-pass/macro-stmt_macro_in_expr_macro.rs` - `src/test/run-pass/macro-nested_stmt_macro.rs` This changes the interface of the MacResult trait. make_stmt has become make_stmts and now returns a vector, rather than a single item. Plugin writers who were implementing MacResult will have breakage, as well as anyone using MacEager::stmt. See: - `src/libsyntax/ext/base.rs` This also causes a minor difference in behavior to the diagnostics produced by certain malformed macros. See: - `src/test/compile-fail/macro-incomplete-parse.rs`
2015-04-11Moves expand_stmt's bt_pop so that it balances correctly.Christopher Chambers-3/+4
2015-04-10Simplifications to statement macro handling.Christopher Chambers-37/+12
SmallVector::pop no longer worries about converting a Many repr downward to One or Zero. expand_stmt makes use of `if let` for style purposes.
2015-04-10Eliminates a pointless is_empty test.Christopher Chambers-1/+1
2015-04-10Improves semicolon expansion efficiency, corrects bt_pop placement.Christopher Chambers-16/+51
Implements pop() on SmallVector, and uses it to expand the final semicolon in a statement macro expansion more efficiently. Corrects the placement of the call to fld.cx.bt_pop(). It must run unconditionally to reverse the corresponding push.
2015-04-10fix some comments.Felix S. Klock II-6/+7
2015-04-10Incorporate repr-attr into deriving(PartialOrd) to avoid truncation errors.Felix S. Klock II-13/+38
remove out of date fixme.
2015-04-10Re-add a fixme after some investigation into what's going on.Felix S. Klock II-0/+11
2015-04-10Change `derive` expansions to use `discriminant_value` intrinsic.Felix S. Klock II-30/+27
Fix #15523.
2015-04-10Add a new `span_suggestion` infrastructure. This lets you edit a snippetNiko Matsakis-1/+65
of text (perhaps obtained by span_snippet) and then splice that edited form back into the original file in the form of a suggestion.
2015-04-10Modify the codemap code to use more slices and to information aboutNiko Matsakis-40/+133
columns within a line, not just the line numbers. Also try to clarify and use the term `line_index` when 0-based.
2015-04-10Replace the use of the rather randomly named boolean `custom` to meanNiko Matsakis-30/+37
"highlight end" and instead add a variant to `RenderSpan`
2015-04-10Rollup merge of #24225 - nrc:for-span, r=pnkfelixManish Goregaokar-1/+1
2015-04-09Fix the span for `for` expressionsNick Cameron-1/+1
2015-04-09Debug impls for a few things in syntax::codemapNick Cameron-0/+12
2015-04-08Auto merge of #24144 - richo:ptr-formatter, r=alexcrichtonbors-0/+7
~~I believe this should fix the issue. Opening a PR to ensure noone duplicates effort, I'm running check now.~~ Closes #24091
2015-04-08Auto merge of #23998 - nrc:impl-self, r=nikomatsakisbors-41/+2
Closes #23909 r? @nikomatsakis (or anyone else, really)
2015-04-07alloc: impl fmt::Pointer for Rc, Arc and BoxRicho Healey-0/+7
Closes #24091
2015-04-07Improves handling of statement macros.Christopher Chambers-44/+75
Statement macros are now treated somewhat like item macros, in that a statement macro can now expand into a series of statements, rather than just a single statement. This allows statement macros to be nested inside other kinds of macros and expand properly, where previously the expansion would only work when no nesting was present. See: src/test/run-pass/macro-stmt_macro_in_expr_macro.rs src/test/run-pass/macro-nested_stmt_macro.rs This changes the interface of the MacResult trait. make_stmt has become make_stmts and now returns a vector, rather than a single item. Plugin writers who were implementing MacResult will have breakage, as well as anyone using MacEager::stmt. See: src/libsyntax/ext/base.rs This also causes a minor difference in behavior to the diagnostics produced by certain malformed macros. See: src/test/compile-fail/macro-incomplete-parse.rs
2015-04-06Provide context for macro expansions which result in unparsed tokens.Will Hipschman-0/+17
Issue #22425
2015-04-05Add comments suggested by NikoPhil Dawes-27/+9
2015-04-05Work towards a non-panicing parser (libsyntax)Phil Dawes-1312/+1405
- Functions in parser.rs return PResult<> rather than panicing - Other functions in libsyntax call panic! explicitly for now if they rely on panicing behaviour. - 'panictry!' macro added as scaffolding while converting panicing functions. (This does the same as 'unwrap()' but is easier to grep for and turn into try!()) - Leaves panicing wrappers for the following functions so that the quote_* macros behave the same: - parse_expr, parse_item, parse_pat, parse_arm, parse_ty, parse_stmt
2015-04-03Validate export_name attributeSimonas Kazlauskas-0/+17
2015-04-03Check uses of `Self` in impls in the compiler rather than during expansionNick Cameron-41/+2
Closes #23909
2015-04-03Auto merge of #23974 - pnkfelix:fix-23973, r=alexcrichtonbors-0/+6
Do not suggest `#![feature(...)]` if we are in beta or stable channel. Fix #23973
2015-04-02Revise logic to match `rustc::session::config::get_unstable_features_setting`Felix S. Klock II-8/+2
2015-04-02Auto merge of #23877 - richo:gardening, r=Manishearthbors-11/+22
I also wanted to unignore https://github.com/rust-lang/rust/blob/master/src/libsyntax/ext/expand.rs#L1768-L1777 since the issue it references is closed, but the test fails, and it's internals aren't super clear to me.
2015-04-02Do not suggest `#![feature(...)]` if we are in beta or stable channel.Felix S. Klock II-0/+12
Fix #23973
2015-04-02Fix parsing of patterns in macrosVadim Petrochenkov-1/+3
2015-04-02syntax: Rewrite parsing of patternsVadim Petrochenkov-225/+127
2015-04-02Tweak relese notes + rebase fixesAlex Crichton-1/+1
2015-04-01rollup merge of #23860: nikomatsakis/copy-requires-cloneAlex Crichton-27/+27
Conflicts: src/test/compile-fail/coherence-impls-copy.rs