about summary refs log tree commit diff
path: root/src/libsyntax/parse
AgeCommit message (Collapse)AuthorLines
2019-03-09Expose new_sub_parser_from_filetopecongiro-1/+1
This function is useful when external tools like rustfmt want to parse internal files without parsing a whole crate.
2019-03-09Auto merge of #59012 - pietroalbini:rollup, r=pietroalbinibors-28/+32
Rollup of 24 pull requests Successful merges: - #58080 (Add FreeBSD armv6 and armv7 targets) - #58204 (On return type `impl Trait` for block with no expr point at last semi) - #58269 (Add librustc and libsyntax to rust-src distribution.) - #58369 (Make the Entry API of HashMap<K, V> Sync and Send) - #58861 (Expand where negative supertrait specific error is shown) - #58877 (Suggest removal of `&` when borrowing macro and appropriate) - #58883 (Suggest appropriate code for unused field when destructuring pattern) - #58891 (Remove stray ` in the docs for the FromIterator implementation for Option) - #58893 (race condition in thread local storage example) - #58906 (Monomorphize generator field types for debuginfo) - #58911 (Regression test for #58435.) - #58912 (Regression test for #58813) - #58916 (Fix release note problems noticed after merging.) - #58918 (Regression test added for an async ICE.) - #58921 (Add an explicit test for issue #50582) - #58926 (Make the lifetime parameters of tcx consistent.) - #58931 (Elide invalid method receiver error when it contains TyErr) - #58940 (Remove JSBackend from config.toml) - #58950 (Add self to mailmap) - #58961 (On incorrect cfg literal/identifier, point at the right span) - #58963 (libstd: implement Error::source for io::Error) - #58970 (delay_span_bug in wfcheck's ty.lift_to_tcx unwrap) - #58984 (Teach `-Z treat-err-as-bug` to take a number of errors to emit) - #59007 (Add a test for invalid const arguments) Failed merges: - #58959 (Add release notes for PR #56243) r? @ghost
2019-03-08Rollup merge of #58984 - estebank:multi-treat-err-as-bug, r=oli-obkPietro Albini-2/+2
Teach `-Z treat-err-as-bug` to take a number of errors to emit `-Z treat-err-as-bug` will cause `rustc` to panic after the first error is reported, like previously. `-Z treat-err-as-bug=2` will cause `rustc` to panic after 2 errors have been reported. Fix #58983.
2019-03-08Rollup merge of #58961 - estebank:issue-58462, r=varkorPietro Albini-2/+2
On incorrect cfg literal/identifier, point at the right span CC #58462
2019-03-07Fix with_emitter callersEsteban Küber-1/+1
2019-03-06Make `-Z treat-err-as-bug` take a number of errors to be emittedEsteban Küber-1/+1
`-Z treat-err-as-bug=0` will cause `rustc` to panic after the first error is reported. `-Z treat-err-as-bug=2` will cause `rustc` to panic after 3 errors have been reported.
2019-03-06Rely on drop to emit unclosed delimsEsteban Küber-1/+0
2019-03-06Simplify codeEsteban Küber-24/+14
2019-03-06Always emit mismatched delim errors, never panicEsteban Küber-3/+2
2019-03-06Collect unclosed delimiters in parent parserEsteban Küber-4/+13
2019-03-06Emit missing unclosed delimiter errorsEsteban Küber-11/+15
2019-03-06Panic when unmatched delimiters aren't emittedEsteban Küber-0/+7
2019-03-06Emit unclosed delimiters during recoveryEsteban Küber-0/+1
2019-03-06Bail when encountering a second unexpected token in the same spanEsteban Küber-4/+10
2019-03-06Do not panic on missing close parenEsteban Küber-1/+3
Fix #58856.
2019-03-06Surround found token with `Esteban Küber-1/+1
2019-03-05On incorrect cfg literal/identifier, point at the right spanEsteban Küber-1/+1
2019-03-01Expand where negative supertrait specific error is shownEsteban Küber-24/+28
Fix #58857.
2019-02-28Auto merge of #57760 - dlrobertson:varargs1, r=alexregbors-60/+70
Support defining C compatible variadic functions ## Summary Add support for defining C compatible variadic functions in unsafe rust with `extern "C"` according to [RFC 2137]. ## Details ### Parsing When parsing a user defined function that is `unsafe` and `extern "C"` allow variadic signatures and inject a "spoofed" `VaList` in the new functions signature. This allows the user to interact with the variadic arguments via a `VaList` instead of manually using `va_start` and `va_end` (See [RFC 2137] for details). ### Codegen When running codegen for a variadic function, remove the "spoofed" `VaList` from the function signature and inject `va_start` when the arg local references are created for the function and `va_end` on return. ## TODO - [x] Get feedback on injecting `va_start/va_end` in MIR vs codegen - [x] Properly inject `va_end` - It seems like it should be possible to inject `va_end` on the `TerminatorKind::Return`. I just need to figure out how to get the `LocalRef` here. - [x] Properly call Rust defined C variadic functions in Rust - The spoofed `VaList` causes problems here. Related to: #44930 r? @ghost [RFC 2137]: https://github.com/rust-lang/rfcs/blob/master/text/2137-variadic.md
2019-02-27Rename variadic to c_variadicDan Robertson-24/+24
Function signatures with the `variadic` member set are actually C-variadic functions. Make this a little more explicit by renaming the `variadic` boolean value, `c_variadic`.
2019-02-27Support defining C compatible variadic functionsDan Robertson-48/+58
Add support for defining C compatible variadic functions in unsafe rust with extern "C".
2019-02-27Rollup merge of #58678 - doctorn:refuse-async-fn-2015-edition, r=varkorMazdak Farrokhzad-11/+28
Deny `async fn` in 2015 edition This commit prevents code using `async fn` from being compiled in Rust 2015 edition. Compiling code of the form: ```rust async fn foo() {} ``` Will now result in the error: ``` error[E0670]: `async fn` is not permitted in the 2015 edition --> async.rs:1:1 | 1 | async fn foo() {} | ^^^^^ error: aborting due to error For more information about an error, try `rustc --explain E0670`. ``` This resolves #58652 and also resolves #53714. r? @varkor
2019-02-25Restrict value in key-value attributes to literalsVadim Petrochenkov-4/+14
2019-02-24Deny `async fn` in 2015 editionNathan Corbyn-11/+28
Fix style issues and update diagnostic messages Update src/librustc_passes/diagnostics.rs Co-Authored-By: doctorn <me@nathancorbyn.com> Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition Deny nested `async fn` in Rust 2015 edition
2019-02-24Rollup merge of #57364 - hdhoang:33418_negative_bounds, r=estebankMazdak Farrokhzad-21/+59
Improve parsing diagnostic for negative supertrait bounds closes #33418 r? @estebank
2019-02-23Rollup merge of #58654 - estebank:underflow, r=nikomatsakisMazdak Farrokhzad-4/+8
Do not underflow after resetting unmatched braces count Fix #58638. r? @oli-obk
2019-02-23Rollup merge of #58526 - pmccarter:master, r=estebankMazdak Farrokhzad-9/+44
Special suggestion for illegal unicode curly quote pairs Fixes #58436 Did not end up expanding the error message span to include the full string literal since I figured the start of the token was the issue, while the help suggestion span would include up to the closing quotation mark. The look ahead logic does not affect the reader position, not sure if that is an issue (if eg it should still continue to parse after the closing quote without erroring out).
2019-02-23Rollup merge of #58476 - nnethercote:rm-LazyTokenStream, r=petrochenkovMazdak Farrokhzad-166/+102
Remove `LazyTokenStream`. `LazyTokenStream` was added in #40939. Perhaps it was an effective optimization then, but no longer. This PR removes it, making the code both simpler and faster. r? @alexcrichton
2019-02-23Improve parsing diagnostic for negative supertrait boundsHoàng Đức Hiếu-21/+59
2019-02-22Do not underflow after resetting unmatched braces countEsteban Küber-4/+8
Fix #58638.
2019-02-22Rollup merge of #58198 - ↵Mazdak Farrokhzad-2/+15
igorsdv:suggest-removing-parentheses-surrounding-lifetimes, r=estebank Suggest removing parentheses surrounding lifetimes Fixes #57386. r? @estebank
2019-02-18Fix style nitsDan Robertson-1/+2
Fix style nits discovered in reading code.
2019-02-18Make `interpolated_to_tokenstream` a method on `Nonterminal`.Nicholas Nethercote-82/+81
2019-02-18Remove `LazyTokenStream`.Nicholas Nethercote-95/+38
It's present within `Token::Interpolated` as an optimization, so that if a nonterminal is converted to a `TokenStream` multiple times, the first-computed value is saved and reused. But in practice it's not needed. `interpolated_to_tokenstream()` is a cold function: it's only called a few dozen times while compiling rustc itself, and a few hundred times across the entire `rustc-perf` suite. Furthermore, when it is called, it is almost always the first conversion, so no benefit is gained from it. So this commit removes `LazyTokenStream`, along with the now-unnecessary `Token::interpolated()`. As well as a significant simplification, the removal speeds things up slightly, mostly due to not having to `drop` the `LazyTokenStream` instances.
2019-02-18Change `Token::interpolated_to_tokenstream()`.Nicholas Nethercote-9/+3
It is currently a method of `Token`, but it only is valid to call if `self` is a `Token::Interpolated`. This commit eliminates the possibility of misuse by changing it to an associated function that takes a `Nonterminal`, which also simplifies the call sites. This requires splitting out a new function, `nonterminal_to_string`.
2019-02-16help suggestion when trying to delimit string literals with directed unicode ↵Patrick McCarter-9/+44
quotes #58436
2019-02-13Rollup merge of #58387 - alexreg:fix-trait-alias-2, r=centrilMazdak Farrokhzad-1/+7
Disallow `auto` trait alias syntax See https://github.com/rust-lang/rust/issues/41517#issuecomment-462567679. r? @Centril CC @topecongiro @nikomatsakis
2019-02-13Rollup merge of #58273 - taiki-e:rename-dependency, r=matthewjasperMazdak Farrokhzad-7/+6
Rename rustc_errors dependency in rust 2018 crates I think this is a better solution than `use rustc_errors as errors` in `lib.rs` and `use crate::errors` in modules. Related: rust-lang/cargo#5653 cc #58099 r? @Centril
2019-02-13Cleanup importsTaiki Endo-5/+5
2019-02-13Rename rustc_errors dependency in rust 2018 cratesTaiki Endo-5/+4
2019-02-12Disallow `auto` trait alias syntax.Alexander Regueiro-1/+7
2019-02-10rustc: doc commentsAlexander Regueiro-194/+206
2019-02-09Auto merge of #57944 - estebank:unclosed-delim-the-quickening, r=oli-obkbors-101/+281
Deduplicate mismatched delimiter errors Delay unmatched delimiter errors until after the parser has run to deduplicate them when parsing and attempt recovering intelligently. Second attempt at #54029, follow up to #53949. Fix #31528.
2019-02-07Suggest removing parentheses surrounding lifetimesIgor Sadikov-2/+15
2019-02-07Add fixmeEsteban Küber-1/+3
2019-02-07Make name resolution handle consts in GenericParamsFromOuterFunction properlyvarkor-1/+2
2019-02-07Parse negative literals in const generic argumentsvarkor-2/+1
2019-02-07Add warning for a parameter list with an attribute but no parametersvarkor-7/+19
2019-02-07Adjust parser generic parameter errorsvarkor-28/+26
2019-02-07Parse const genericsvarkor-178/+112
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>