about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-06-21Parse async fn header.Without Boats-103/+160
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-22Auto merge of #51463 - estebank:error-codes, r=nikomatsakisbors-17/+34
Various changes to existing diagnostics * [Add code to `invalid ABI` error, add span label, move list to help to make message shorter](https://github.com/rust-lang/rust/pull/51463/commits/23ae5af274defa9ff884f593e44a2bbcaf814a02): ``` error[E0697]: invalid ABI: found `路濫狼á́́` --> $DIR/unicode.rs:11:8 | LL | extern "路濫狼á́́" fn foo() {} //~ ERROR invalid ABI | ^^^^^^^^^ invalid ABI | = help: valid ABIs: cdecl, stdcall, fastcall, vectorcall, thiscall, aapcs, win64, sysv64, ptx-kernel, msp430-interrupt, x86-interrupt, Rust, C, system, rust-intrinsic, rust-call, platform-intrinsic, unadjusted ``` * [Add code to incorrect `pub` restriction error](https://github.com/rust-lang/rust/pull/51463/commits/e96fdea8a38f39f99f8b9a4000a689187a457e08) * [Add message to `rustc_on_unimplemented` attributes in core to have them set a custom message _and_ label](https://github.com/rust-lang/rust/pull/51463/commits/2cc7e5ed307aee936c20479cfdc7409d6b52a464): ``` error[E0277]: `W` does not have a constant size known at compile-time --> $DIR/unsized-enum2.rs:33:8 | LL | VA(W), | ^ `W` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `W` = help: consider adding a `where W: std::marker::Sized` bound = note: no field of an enum variant may have a dynamically sized type ``` ``` error[E0277]: `Foo` cannot be sent between threads safely --> $DIR/E0277-2.rs:26:5 | LL | is_send::<Foo>(); | ^^^^^^^^^^^^^^ `Foo` cannot be sent between threads safely | = help: the trait `std::marker::Send` is not implemented for `Foo` ``` ``` error[E0277]: can't compare `{integer}` with `std::string::String` --> $DIR/binops.rs:16:7 | LL | 5 < String::new(); | ^ no implementation for `{integer} < std::string::String` and `{integer} > std::string::String` | = help: the trait `std::cmp::PartialOrd<std::string::String>` is not implemented for `{integer}` ``` ``` error[E0277]: can't compare `{integer}` with `std::result::Result<{integer}, _>` --> $DIR/binops.rs:17:7 | LL | 6 == Ok(1); | ^^ no implementation for `{integer} == std::result::Result<{integer}, _>` | = help: the trait `std::cmp::PartialEq<std::result::Result<{integer}, _>>` is not implemented for `{integer}` ``` ``` error[E0277]: a collection of type `i32` cannot be built from an iterator over elements of type `i32` --> $DIR/type-check-defaults.rs:16:19 | LL | struct WellFormed<Z = Foo<i32, i32>>(Z); | ^ a collection of type `i32` cannot be built from `std::iter::Iterator<Item=i32>` | = help: the trait `std::iter::FromIterator<i32>` is not implemented for `i32` note: required by `Foo` --> $DIR/type-check-defaults.rs:15:1 | LL | struct Foo<T, U: FromIterator<T>>(T, U); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` * [Add link to book for `Sized` errors](https://github.com/rust-lang/rust/pull/51463/commits/1244dc7c283323aea1a3457a4458d590a3e160c8): ``` error[E0277]: `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time --> $DIR/const-unsized.rs:13:29 | LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync)); | ^^^^^^^^^^^^^^^^^^^^^^ `std::fmt::Debug + std::marker::Sync + 'static` does not have a constant size known at compile-time | = help: the trait `std::marker::Sized` is not implemented for `std::fmt::Debug + std::marker::Sync + 'static` = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types--sized> = note: constant expressions must have a statically known size ``` * [Point to previous line for single expected token not found](https://github.com/rust-lang/rust/pull/51463/commits/48165168fb0f059d8536cd4a2276b609d4a7f721) (if the current token is in a different line)
2018-06-20make `parse_seq_to_before_end`, `mk_mac_expr`, and `parse_optional_str` ↵jeb-3/+3
public in libsyntax
2018-06-20Rename ParenthesizedArgData to ParenthesisedArgsvarkor-11/+11
2018-06-20Rename ty_param_bound to generic_boundvarkor-13/+13
2018-06-20Fix additional commentsvarkor-1/+1
2018-06-20Rename ty_param_bound to trait_boundvarkor-2/+2
2018-06-20Make GenericBound explicitvarkor-25/+23
2018-06-20Rename ParamBound(s) to GenericBound(s)varkor-41/+41
2018-06-20Rename TraitTyParamBound to ParamBound::Traitvarkor-15/+15
2018-06-20Fix HasAttrs support for GenericParamvarkor-11/+6
2018-06-20Take advantage of the lifetime refactoringvarkor-40/+33
2018-06-20Remove name from GenericParamKind::Lifetimevarkor-31/+18
2018-06-20Use ParamBounds in WhereRegionPredicatevarkor-35/+31
2018-06-20Lift bounds into GenericParamvarkor-69/+73
2018-06-20Simply joint lifetime/type iterationvarkor-1/+1
2018-06-20Refactor counting methodsvarkor-2/+2
2018-06-20Rename structures in astvarkor-67/+67
2018-06-20Remove AngleBracketedArgs implvarkor-22/+0
2018-06-20Remove methods from ast::GenericParam and ast::Genericsvarkor-43/+4
2018-06-20Refactor ast::GenericParam as a structvarkor-109/+96
2018-06-20Refactor hir::GenericParam as a structvarkor-1/+3
2018-06-20Rename ast::GenericParam and ast::GenericArgvarkor-60/+59
It's so confusing to have everything having the same name, at least while refactoring.
2018-06-20Make method and variable names more consistentvarkor-39/+45
2018-06-20Rename "parameter" to "arg"varkor-82/+82
2018-06-20Rename PathParameter(s) to GenericArg(s)varkor-59/+55
2018-06-20Rename *Parameter to *Paramvarkor-24/+24
2018-06-20Consolidate PathParameters and AngleBracketedParameterDatavarkor-56/+86
2018-06-19Update error code numbersEsteban Küber-4/+4
2018-06-19Fix tidy and remove unused methodEsteban Küber-2/+2
2018-06-19Point to previous line for single expected tokenEsteban Küber-1/+20
2018-06-19Add message to `rustc_on_unimplemented` attributes in coreEsteban Küber-8/+0
2018-06-19Add code to incorrect `pub` restriction errorEsteban Küber-3/+5
2018-06-19Add code to `invalid ABI` errorEsteban Küber-5/+9
2018-06-19Do not consume semicolon twice while parsing local statementSeiichi Uchida-1/+1
2018-06-19Auto merge of #51278 - EPashkin:fix_mod_with_multilevel_paths_on_windows, ↵bors-1/+13
r=nikomatsakis Fix processing mod with multi-level path on Windows Fix error in [rustfmt](https://github.com/rust-lang-nursery/rustfmt/issues/1754) because libsyntax can not handle `mod` with multilevel path on Windows. Alternative is do almost same in https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/fs.rs#L717 to allow work on paths with different separators, Ex. "\\\\?\\c:\\windows/temp"
2018-06-17Auto merge of #51549 - PSeitz:patch-1, r=kennytmbors-2/+2
Follow up to #51508, make parse_block public instead parse_block_expr This is an follow up to #51508 I mistakenly made parse_block_expr public instead of parse_block. This fixes this.
2018-06-17Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, ↵bors-13/+18
r=petrochenkov refactor: create multiple HIR items for imports When lowering `use` statements into HIR, they get a `Def` of the thing they're pointing at. This is great for things that need to know what was just pulled into scope. However, this is a bit misleading, because a `use` statement can pull things from multiple namespaces if their names collide. This is a problem for rustdoc, because if there are a module and a function with the same name (for example) then it will only document the module import, because that's that the lowered `use` statement points to. The current version of this PR does the following: * Whenever the resolver comes across a `use` statement, it loads the definitions into a new `import_map` instead of the existing `def_map`. This keeps the resolutions per-namespace so that all the target definitions are available. * When lowering `use` statements, it looks up the resolutions in the `import_map` and creates multiple `Item`s if there is more than one resolution. * To ensure the `NodeId`s are properly tracked in the lowered module, they need to be created in the AST, and pulled out as needed if multiple resolutions are available. Fixes https://github.com/rust-lang/rust/issues/34843
2018-06-16Auto merge of #51562 - SimonSapin:transparent, r=cramertjbors-8/+2
Stabilize #[repr(transparent)] Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-16Follow up on https://github.com/rust-lang/rust/pull/51508, make parse_block ↵PSeitz-2/+2
public instead parse_block_expr This is an follow up to #51508 I mistakenly made parse_block_expr public instead of parse_block. This fixes this.
2018-06-15Auto merge of #50296 - cmdd:master, r=nikomatsakisbors-0/+14
Add error message for using >= 65535 hashes for raw string literal escapes Fixes #50111.
2018-06-14create multiple HIR items for a use statementQuietMisdreavus-13/+18
2018-06-12update wording, do not change parserNiko Matsakis-1/+1
2018-06-12Auto merge of #51521 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-3/+32
Rollup of 3 pull requests Successful merges: - #51261 (Updated RELEASES.md for 1.27.0) - #51502 (Make parse_seq_to_end and parse_path public) - #51510 (Long diagnostic for E0538) Failed merges:
2018-06-12Rollup merge of #51510 - Havvy:diagnostic-list, r=GuillaumeGomezMark Rousskov-1/+30
Long diagnostic for E0538 r? @GuillaumeGomez
2018-06-12Rollup merge of #51502 - jebrosen:pub_parse_methods, r=Mark-SimulacrumMark Rousskov-2/+2
Make parse_seq_to_end and parse_path public (see SergioBenitez/Rocket#660, rust-lang/rust#51265) Rocket currently uses `parse_seq_to_end` and `parse_path` in its codegen macros. Assuming I tested correctly, this is the minimal set of methods that are currently necessary to build Rocket again. I would be happy to add documentation of this and Rocket's other usages, if desired.
2018-06-12Auto merge of #51519 - ExpHP:issue-51331-b, r=petrochenkovbors-25/+24
Fix for $crate var normalization in proc macro for externally defined macros Fixes #51331, a bug that has existed in at least *some* form for a year and a half. The PR includes the addition of a `fold_qpath` method to `syntax::fold::Folder`. Overriding this method is useful for folds that modify paths in a way that invalidates indices (insertion or removal of a component), as it provides the opportunity to update `qself.position` in `<A as B>::C` paths. I added it because the bugfix is messy without it. (unfortunately, grepping around the codebase, I did not see anything else that could use it.)
2018-06-12add fold::Folder::fold_qpathMichael Lamparski-25/+24
2018-06-12Auto merge of #51508 - PSeitz:master, r=Mark-Simulacrumbors-2/+2
Make span_fatal and parse_block public span_fatal and parse_block were made private in #51265. These methods are used in stainless. Related #51498 #51504
2018-06-12Stabilize #[repr(transparent)]Simon Sapin-8/+2
Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353