summaryrefslogtreecommitdiff
path: root/compiler/rustc_parse/src/parser
Commit message (Collapse)AuthorAgeFilesLines
* Recover `impl<T ?Sized>` correctlyMichael Goulet2023-05-151-0/+5
|
* Rollup merge of #111531 - chenyukang:yukang-fix-111416-ice, r=compiler-errorsMatthias Krüger2023-05-151-0/+4
|\ | | | | | | | | | | Fix ice caused by shorthand fields in NoFieldsForFnCall Fixes #111416
| * fmtyukang2023-05-131-6/+3
| |
| * Fix ice caused by shorthand fields in NoFieldsForFnCallyukang2023-05-131-0/+7
| |
* | improve error for `impl<..> impl Trait for Type`y212023-05-131-4/+18
|/
* Rollup merge of #111120 - chenyukang:yukang-suggest-let, r=NilstriebDylan DPC2023-05-092-13/+35
|\ | | | | | | | | | | | | | | Suggest let for possible binding with ty Origin from https://github.com/rust-lang/rust/pull/109128#discussion_r1179866137 r? `@Nilstrieb`
| * move sugg to derive session diagnosticyukang2023-05-091-9/+5
| |
| * code refactor and fix wrong suggestionyukang2023-05-082-24/+36
| |
| * fix ice in suggestingyukang2023-05-081-7/+14
| |
| * cleanupyukang2023-05-081-2/+1
| |
| * Suggest let for possible binding with tyyukang2023-05-082-9/+17
| |
* | Rollup merge of #110694 - est31:builtin, r=petrochenkovDylan DPC2023-05-093-1/+74
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement builtin # syntax and use it for offset_of!(...) Add `builtin #` syntax to the parser, as well as a generic infrastructure to support both item and expression position builtin syntaxes. The PR also uses this infrastructure for the implementation of the `offset_of!` macro, added by #106934. cc `@petrochenkov` `@DrMeepster` cc #110680 `builtin #` tracking issue cc #106655 `offset_of!` tracking issue
| * | Add feature gateest312023-05-051-0/+1
| | |
| * | Migrate offset_of from a macro to builtin # syntaxest312023-05-051-1/+19
| | |
| * | Add parsing for builtin # in expression and item contextest312023-05-053-1/+55
| | |
* | | make it more accurate by parsing tyyukang2023-05-081-9/+19
| | |
* | | suggest struct when we get colon in fileds in enumyukang2023-05-081-0/+9
| |/ |/|
* | Rollup merge of #111230 - zacklukem:eq-less-to-less-eq, r=compiler-errorsMatthias Krüger2023-05-061-1/+12
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | add hint for =< as <= Adds a compiler hint for when `=<` is typed instead of `<=` Example hint: ```rust fn foo() { if 1 =< 3 { println!("Hello, World!"); } } ``` ``` error: expected type, found `3` --> main.rs:2:13 | 2 | if 1 =< 3 { | -- ^ expected type | | | help: did you mean: `<=` ``` This PR only emits the suggestion if there is no space between the `=` and `<`. This hopefully narrows the scope of when this error is emitted, however this still allows this error to be emitted in cases such as this: ``` error: expected expression, found `;` --> main.rs:2:18 | 2 | if 1 =< [i32;; 3]>::hello() { | -- ^ expected expression | | | help: did you mean: `<=` ``` Which could be a good reason not to merge since I haven't been able to think of any other ways of narrowing the scope of this diagnostic. closes #111128
| * add hint for =< as <=Zachary Mayhew2023-05-051-1/+12
| |
* | Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errorsDylan DPC2023-05-051-0/+1
|\ \ | |/ |/| | | | | | | | | Implement RFC 3348, `c"foo"` literals RFC: https://github.com/rust-lang/rfcs/pull/3348 Tracking issue: #105723
| * try gating early, add non-ascii testDeadbeef2023-05-021-0/+1
| |
* | Rollup merge of #110791 - compiler-errors:negative-bounds, r=oli-obkDylan DPC2023-05-045-90/+53
|\ \ | | | | | | | | | | | | | | | | | | | | | Implement negative bounds for internal testing purposes Implements partial support the `!` negative polarity on trait bounds. This is incomplete, but should allow us to at least be able to play with the feature. Not even gonna consider them as a public-facing feature, but I'm implementing them because would've been nice to have in UI tests, for example in #110671.
| * | Implement negative boundsMichael Goulet2023-05-025-90/+53
| | |
* | | Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote2023-05-038-35/+35
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
* | soften the wording for removing type ascriptionyukang2023-05-013-11/+4
| |
* | fix testsyukang2023-05-014-20/+5
| |
* | fix parser sizeyukang2023-05-011-1/+1
| |
* | clean up debug codeyukang2023-05-012-15/+1
| |
* | Rip it outNilstrieb2023-05-018-192/+274
|/ | | | | | | | | | | | | | My type ascription Oh rip it out Ah If you think we live too much then You can sacrifice diagnostics Don't mix your garbage Into my syntax So many weird hacks keep diagnostics alive Yet I don't even step outside So many bad diagnostics keep tyasc alive Yet tyasc doesn't even bother to survive!
* Rollup merge of #110823 - compiler-errors:tweak-await-span, r=b-naberMatthias Krüger2023-05-012-3/+3
|\ | | | | | | | | | | | | | | | | | | Tweak await span to not contain dot Fixes a discrepancy between method calls and await expressions where the latter are desugared to have a span that *contains* the dot (i.e. `.await`) but method call identifiers don't contain the dot. This leads to weird suggestions suggestions in borrowck -- see linked issue. Fixes #110761 This mostly touches a bunch of tests to tighten their `await` span.
| * Tweak await spanMichael Goulet2023-04-272-3/+3
| |
* | Migrate trivially translatable `rustc_parse` diagnosticsclubby7892023-04-276-158/+60
|/
* Fix static string lintsclubby7892023-04-253-72/+29
|
* Rollup merge of #110404 - matthiaskrgr:mapmap, r=NilstriebMatthias Krüger2023-04-171-3/+3
|\ | | | | | | | | | | fix clippy::toplevel_ref_arg and ::manual_map r? ``@Nilstrieb``
| * fix clippy::toplevel_ref_arg and ::manual_mapMatthias Krüger2023-04-161-3/+3
| |
* | use matches! macro in more placesMatthias Krüger2023-04-162-14/+10
|/
* remove redundant clonesMatthias Krüger2023-04-151-5/+3
|
* Rollup merge of #110203 - compiler-errors:rtn-dots, r=eholkMatthias Krüger2023-04-121-9/+16
|\ | | | | | | | | | | | | | | | | | | Remove `..` from return type notation `@nikomatsakis` and I decided that using `..` in the return-type notation syntax is probably overkill. r? `@eholk` since you reviewed the last one Since this is piggybacking now totally off of a pre-existing syntax (parenthesized generics), let me know if you need any explanation of the logic here, since it's a bit more complicated now.
| * Remove `..` from return type notationMichael Goulet2023-04-101-9/+16
| |
* | Fix typos in compilerDaniPopes2023-04-101-1/+1
|/
* Fix some clippy::complexityNilstrieb2023-04-091-1/+1
|
* fix: fix regression in #109203Ezra Shaw2023-04-071-2/+2
|
* Auto merge of #109117 - oli-obk:locks, r=michaelwoeristerbors2023-04-051-2/+5
|\ | | | | | | | | | | Avoid a few locks We can use atomics or datastructures tuned for specific access patterns instead of locks. This may be an improvement for parallel rustc, but it's mostly a cleanup making various datastructures only usable in the way they are used right now (append data, never mutate), instead of having a general purpose lock.
| * Use a simpler atomic operation than the `compare_exchange` hammerOli Scherer2023-04-041-3/+1
| |
| * Replace a lock with an atomicOli Scherer2023-04-041-2/+7
| |
* | Rename `ast::Static` to `ast::StaticItem` to match `ast::ConstItem`Oli Scherer2023-04-041-3/+3
| |
* | box a bunch of large typesOli Scherer2023-04-041-6/+6
| |
* | Split out ast::ItemKind::Const into its own structOli Scherer2023-04-041-5/+9
| |
* | rust-analyzer guided tuple field to named fieldOli Scherer2023-04-041-2/+2
| |
* | rust-analyzer guided enum variant structificationOli Scherer2023-04-041-2/+3
|/