about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2018-01-13Rollup merge of #47343 - goffrie:master, r=jseyfriedkennytm-6/+24
Glued tokens can themselves be joint. When gluing two tokens, the second of which is joint, the result should also be joint. This fixes an issue with joining three `Dot` tokens to make a `DotDotDot` - the intermediate `DotDot` would not be joint and therefore we would not attempt to glue the last `Dot` token, yielding `.. .` instead of `...`. r? @jseyfried
2018-01-13Rollup merge of #47298 - cramertj:path-as-modrs, r=nikomatsakiskennytm-4/+8
Treat #[path] files as mod.rs files Fixes https://github.com/rust-lang/rust/issues/46936, cc @briansmith, @SergioBenitez, @nikomatsakis. This (insta-stable) change treats files included via `#[path = "bla.rs"] mod foo;` as though they were `mod.rs` files. Namely, it allows them to include `mod` statements and looks for the child modules in sibling directories, rather than in relative `modname/childmodule.rs` files as happens for non-`mod.rs` files. This change makes the `non_modrs_mods` feature backwards compatible with the existing usage in https://github.com/briansmith/ring, several versions of which are currently broken in beta. If we decide to merge, this change should be backported to beta. cc https://github.com/rust-lang/rust/issues/37872 r? @jseyfried
2018-01-10Glued tokens can themselves be joint.Geoffry Song-6/+24
When gluing two tokens, the second of which is joint, the result should also be joint. This fixes an issue with joining three `Dot` tokens to make a `DotDotDot` - the intermediate `DotDot` would not be joint and therefore we would not attempt to glue the last `Dot` token, yielding `.. .` instead of `...`.
2018-01-09Treat #[path] files as mod.rs filesTaylor Cramer-4/+8
2018-01-09Rollup merge of #47256 - rkruppe:misc-cleanup, r=eddybkennytm-3/+2
Rename ReprExtern to ReprC … and similarily rename a few other field and locals that mentioned "extern repr".
2018-01-09Rollup merge of #47210 - ↵kennytm-1/+1
zackmdavis:the_3rd_of_2_hardest_problems_in_computer_science, r=QuietMisdreavus fix the doc-comment-decoration-trimming edge-case rustdoc ICE This `horizontal_trim` function strips the leading whitespace from doc-comments that have a left-asterisk-margin: ``` /** * You know what I mean— * * comments like this! */ ``` The index of the column of asterisks is `i`, and if trimming is deemed possible, we slice each line from `i+1` to the end of the line. But if, in particular, `i` was 0 _and_ there was an empty line (as in the example given in the reporting issue), we ended up panicking trying to slice an empty string from 0+1 (== 1). Let's tighten our check to say that we can't trim when `i` is even the same as the length of the line, not just when it's greater. (Any such cases would panic trying to slice `line` from `line.len()+1`.) Resolves #47197.
2018-01-08Auto merge of #47232 - keatinge:master, r=petrochenkovbors-2/+14
Add help message for incorrect pattern syntax When I was getting started with rust I often made the mistake of using `||` instead of `|` to match multiple patterns and spent a long time staring at my code wondering what was wrong. for example: ``` fn main() { let x = 1; match x { 1 || 2 => println!("1 or 2"), _ => println!("Something else"), } } ``` If you compile this with current rustc you will see ``` error: expected one of `...`, `..=`, `..`, `=>`, `if`, or `|`, found `||` --> test.rs:5:11 | 5 | 1 || 2 => println!("1 or 2"), | -^^ unexpected token | | | expected one of `...`, `..=`, `..`, `=>`, `if`, or `|` here error: aborting due to previous error ``` With my proposed change it will show: ``` error: unexpected token `||` after pattern --> test.rs:5:11 | 5 | 1 || 2 => println!("1 or 2"), | ^^ | = help: did you mean to use `|` to specify multiple patterns instead? error: aborting due to previous error ```
2018-01-07Rename ReprExtern to ReprC, and similarily rename a few other fields and ↵Robin Kruppe-3/+2
locals that mentioned "extern repr"
2018-01-07Try to fix a perf regression by updating logMalo Jaffré-1/+1
Upgrade `log` to `0.4` in multiple crates.
2018-01-07Auto merge of #47156 - petrochenkov:extpath, r=nikomatsakisbors-4/+18
Support `extern` in paths Implement the primary alternative to https://github.com/rust-lang/rust/pull/46613 + https://github.com/rust-lang/rust/pull/45771, achieving the same effect without requiring changes to other imports. Both need to be experimentally evaluated before making further progress. The PR also adds docs for all these related features into the unstable book. cc https://github.com/rust-lang/rust/issues/44660 r? @nikomatsakis
2018-01-06Fix tidy errorkeatinge-2/+5
2018-01-06Use span_suggestion instead of span_err_helpkeatinge-3/+3
2018-01-06wherein careful doc-decoration arithmetic proves quite the ICE-breakerZack M. Davis-1/+1
This `horizontal_trim` function strips the leading whitespace from doc-comments that have a left-asterisk-margin: /** * You know what I mean— * * comments like this! */ The index of the column of asterisks is `i`, and if trimming is deemed possible, we slice each line from `i+1` to the end of the line. But if, in particular, `i` was 0 _and_ there was an empty line (as in the example given in the reporting issue), we ended up panicking trying to slice an empty string from 0+1 (== 1). Let's tighten our check to say that we can't trim when `i` is even the same as the length of the line, not just when it's greater. (Any such cases would panic trying to slice `line` from `line.len()+1`.) Resolves #47197.
2018-01-07Rollup merge of #47170 - eddyb:us-vs-usize, r=nikomatsakiskennytm-15/+15
rustc: use {U,I}size instead of {U,I}s shorthands. `Us`/`Is` come from a time when `us` and `is` were the literal suffixes that are now `usize` / `isize`. r? @nikomatsakis
2018-01-06fix stylekeatinge-4/+2
2018-01-06Emit non-fatal error insteadkeatinge-8/+10
2018-01-06fix capitalizationkeatinge-2/+2
2018-01-06Add help message for incorrect pattern syntaxkeatinge-1/+10
2018-01-04rustc: Don't use relative paths for extended errorsAlex Crichton-5/+7
These no longer work now that Cargo changes the cwd of rustc while it's running. Instead use an absolute path that's set by rustbuild.
2018-01-04rustc: use {U,I}size instead of {U,I}s shorthands.Eduard-Mihai Burtescu-15/+15
2018-01-03Support `extern` in pathsVadim Petrochenkov-4/+18
2018-01-01Fix docs for future pulldown migrationMalo Jaffré-5/+7
2018-01-01Auto merge of #46895 - ricochet1k:macro-lifetimes, r=jseyfriedbors-21/+69
Allow lifetimes in macros This is a resurrection of PR #41927 which was a resurrection of #33135, which is intended to fix #34303. In short, this allows macros_rules! to use :lifetime as a matcher to match 'lifetimes. Still to do: - [x] Feature gate
2017-12-30in which leading zeroes on tuple-struct accesses are abjuredZack M. Davis-3/+12
Resolves #47073.
2017-12-30refactor lifetime out of is_lifetimeMatt Peterson-19/+20
2017-12-28CleanupMatt Peterson-5/+5
2017-12-28Add feature gate macro_lifetime_matcherMatt Peterson-2/+20
2017-12-28CleanupMatt Peterson-4/+3
2017-12-28Fix testsMatt Peterson-9/+27
2017-12-28Fix build and add a macro lifetime labels testMatt Peterson-2/+1
2017-12-28replace parse_lifetime with expect_lifetimeMichael Hewson-2/+2
made `parser::Parser::expect_lifetime` public, so it can be called from `macro_parser::parse_nt`
2017-12-28Resurrecting #33135Michael Hewson-7/+20
Started rebasing @sgrif's PR #33135 off of current master. (Well, actually merging it into a new branch based off current master.) The following files still need to be fixed or at least reviewed: - `src/libsyntax/ext/tt/macro_parser.rs`: calls `Parser::parse_lifetime`, which doesn't exist anymore - `src/libsyntax/parse/parser.rs`: @sgrif added an error message to `Parser::parse_lifetime`. Code has since been refactored, so I just took it out for now. - `src/libsyntax/ext/tt/transcribe.rs`: This code has been refactored bigtime. Not sure whether @sgrif's changes here are still necessary. Took it out for this commit.
2017-12-28Auto merge of #47013 - topecongiro:issue-46655, r=petrochenkovbors-82/+106
Do not expand a derive invocation when derive is not allowed Closes #46655. The first commit is what actually closes #46655. The second one is just a refactoring I have done while waiting on a test.
2017-12-28Prefer to use attr::contains_name() and attr::find_by_name()Seiichi Uchida-3/+3
2017-12-28Auto merge of #47017 - topecongiro:issue-33469, r=estebankbors-1/+5
Do not panic on interpolated token inside quote macro Closes #33469.
2017-12-27Auto merge of #46479 - bkchr:termination_trait, r=arielb1bors-0/+3
Implements RFC 1937: `?` in `main` This is the first part of the RFC 1937 that supports new `Termination` trait in the rust `main` function. Thanks @nikomatsakis, @arielb1 and all other people in the gitter channel for all your help! The support for doctest and `#[test]` is still missing, bu as @nikomatsakis said, smaller pull requests are better :)
2017-12-27Auto merge of #46977 - est31:column_fix, r=dtolnaybors-1/+1
Make the output of the column! macro 1 based Fixes #46868. I didn't add any regression tests as the change already had to change tests inside the codebase. r? @dtolnay
2017-12-27Auto merge of #46803 - estebank:non-ascii-def-span, r=petrochenkovbors-1/+3
Use def span for non-ascii ident feature gate error
2017-12-26Do not panic on interpolated token inside quote macroSeiichi Uchida-1/+5
2017-12-26Adds termination_trait feature gateBastian Köcher-0/+3
2017-12-26Do not expand a derive invocation when derive is not allowedSeiichi Uchida-79/+103
1. Change the return type of `expand_invoc()` and its subroutines to `Option<Expansion>` from `Expansion`. 2. Return `None` when expanding a derive invocation if the item cannot have derive on it (in `expand_derive_invoc()`).
2017-12-25"incompatible arm" diagnostic span tweakEsteban Küber-0/+6
Use span label instead of span note for single line spans in "incompatible arm" diagnostic.
2017-12-24Auto merge of #46888 - cramertj:nested-impl-trait-error, r=nikomatsakisbors-2/+70
Add a feature gate for nested uses of `impl Trait` This allows us to delay stabilization of nested `impl Trait` until we have a plan to solve the problem posed [here](https://github.com/rust-lang/rust/issues/34511#issuecomment-350715858). r? @nikomatsakis
2017-12-24Make column macro output 1 based and document itest31-1/+1
2017-12-22Auto merge of #46779 - Zoxc:par-merge-without-sync, r=arielb1bors-9/+8
Work towards thread safety in rustc This PR is split out from https://github.com/rust-lang/rust/pull/45912. It contains changes which do not require the `sync` module.
2017-12-22Auto merge of #46732 - estebank:silence-recovered-blocks, r=petrochenkovbors-3/+10
Do not emit type errors on recovered blocks When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user. Fix #44579.
2017-12-21Auto merge of #46922 - kennytm:rollup, r=kennytmbors-7/+13
Rollup of 14 pull requests - Successful merges: #46636, #46780, #46784, #46809, #46814, #46820, #46839, #46847, #46858, #46878, #46884, #46890, #46898, #46918 - Failed merges:
2017-12-21Do not emit type errors on recovered blocksEsteban Küber-3/+10
When a parse error occurs on a block, the parser will recover and create a block with the statements collected until that point. Now a flag stating that a recovery has been performed in this block is propagated so that the type checker knows that the type of the block (which will be identified as `()`) shouldn't be checked against the expectation to reduce the amount of irrelevant diagnostic errors shown to the user.
2017-12-21Auto merge of #45930 - jplatte:generics_refactoring, r=eddybbors-161/+184
Generics refactoring (groundwork for const generics) These changes were suggested by @eddyb. After this change, the `Generics` contain one `Vec` of an enum for the generic parameters, rather than two separate `Vec`s for lifetime and type parameters. Type params and const params will need to be in a shared `Vec` to preserve their ordering, and moving lifetimes into the same `Vec` should simplify the code that processes `Generics`.
2017-12-22Rollup merge of #46858 - QuietMisdreavus:external-doc-error, r=estebankkennytm-7/+11
tweaks and fixes for doc(include) This PR makes a handful of changes around `#[doc(include="file.md")]` (https://github.com/rust-lang/rust/issues/44732): * Turns errors when loading files into full errors. This matches the original RFC text. * Makes the `missing_docs` lint check for `#[doc(include="file.md")]` as well as regular `#[doc="text"]` attributes. * Loads files included by `#[doc(include="file.md")]` into dep-info, mirroring the behavior of `include_str!()` and friends. * Adds or modifies tests to check for all of these.