Commit graph

301 commits

Author SHA1 Message Date
Mark Rousskov db3e2bacb6 Bump cfg(bootstrap)s 2023-11-15 19:41:28 -05:00
Nicholas Nethercote 783d4b8b26 Clarify space_between.
To avoid `!matches!(...)`, which is hard to think about. Instead every
case now uses direct pattern matching and returns true or false.

Also add a couple of cases to the `stringify.rs` test that currently
print badly.
2023-11-08 14:39:59 +11:00
Dinu Blanovschi 241a654c07 Fix remaining uses of CaptureBy::Value 2023-11-04 19:48:44 +01:00
Nicholas Nethercote 8ff624a9f2 Clean up rustc_*/Cargo.toml.
- Sort dependencies and features sections.
- Add `tidy` markers to the sorted sections so they stay sorted.
- Remove empty `[lib`] sections.
- Remove "See more keys..." comments.

Excluded files:
- rustc_codegen_{cranelift,gcc}, because they're external.
- rustc_lexer, because it has external use.
- stable_mir, because it has external use.
2023-10-30 08:46:02 +11:00
Oli Scherer 621494382d Add gen blocks to ast and do some broken ast lowering 2023-10-27 13:05:48 +00:00
bors 631a116cd3 Auto merge of #116822 - notriddle:notriddle/rust-logo, r=fmease
docs: add Rust logo to more compiler crates

c6e6ecb1af added it to some of the compiler's crates, but avoided adding it to all of them to reduce bit-rot. This commit adds to more.

r? `@GuillaumeGomez`
2023-10-17 04:41:20 +00:00
Michael Howell 2ff2624722 docs: add Rust logo to more compiler crates
c6e6ecb1af added it to some of the
compiler's crates, but avoided adding it to all of them to reduce
bit-rot. This commit adds to more.
2023-10-16 15:38:08 -07:00
Paul Gey 587899e9ca Preserve unicode escapes in format string literals when pretty-printing AST 2023-10-16 21:20:21 +02:00
Nicholas Nethercote 66c2b77a4a Rename tt_prepend_space as space_between.
And reorder the arguments. I find it easier to think about this way.
2023-10-12 08:50:42 +11:00
Matthew Jasper 333388fd3c Move let expression checking to parsing
There was an incomplete version of the check in parsing and a second
version in AST validation. This meant that some, but not all, invalid
uses were allowed inside macros/disabled cfgs. It also means that later
passes have a hard time knowing when the let expression is in a valid
location, sometimes causing ICEs.

- Add a field to ExprKind::Let in AST/HIR to mark whether it's in a
  valid location.
- Suppress later errors and MIR construction for invalid let
  expressions.
2023-09-11 15:51:18 +00:00
bors 18be2728bd Auto merge of #115131 - frank-king:feature/unnamed-fields-lite, r=petrochenkov
Parse unnamed fields and anonymous structs or unions (no-recovery)

It is part of #114782 which implements #49804. Only parse anonymous structs or unions in struct field definition positions.

r? `@petrochenkov`
2023-08-24 12:52:35 +00:00
Frank King 868706d9b5 Parse unnamed fields and anonymous structs or unions
Anonymous structs or unions are only allowed in struct field
definitions.

Co-authored-by: carbotaniuman <41451839+carbotaniuman@users.noreply.github.com>
2023-08-24 11:17:54 +08:00
Nicholas Nethercote 3bb85b73b5 Add helpful comments to tt_prepend_space. 2023-08-17 09:01:05 +10:00
Nilstrieb 5706be1854 Improve spans for indexing expressions
Indexing is similar to method calls in having an arbitrary
left-hand-side and then something on the right, which is the main part
of the expression. Method calls already have a span for that right part,
but indexing does not. This means that long method chains that use
indexing have really bad spans, especially when the indexing panics and
that span in coverted into a panic location.

This does the same thing as method calls for the AST and HIR, storing an
extra span which is then put into the `fn_span` field in THIR.
2023-08-04 13:17:39 +02:00
Nicholas Nethercote d75ee2a6bc Remove MacDelimiter.
It's the same as `Delimiter`, minus the `Invisible` variant. I'm
generally in favour of using types to make impossible states
unrepresentable, but this one feels very low-value, and the conversions
between the two types are annoying and confusing.

Look at the change in `src/tools/rustfmt/src/expr.rs` for an example:
the old code converted from `MacDelimiter` to `Delimiter` and back
again, for no good reason. This suggests the author was confused about
the types.
2023-08-03 09:03:30 +10:00
León Orell Valerian Liehr afd009a8d8
Parse generic const items 2023-07-28 22:21:33 +02:00
Matthias Krüger af2b370100 more clippy::style fixes:
get_first
single_char_add_str
unnecessary_mut_passed
manual_map
manual_is_ascii_check
2023-07-23 23:39:04 +02:00
Maybe Waffle d7713feb99 Syntatically accept become expressions 2023-06-19 12:54:34 +00:00
许杰友 Jieyou Xu (Joe) 32ae8810fc
Fix suggestion for E0404 not dealing with multiple generics 2023-06-15 18:19:09 +08:00
est31 5eb29c7f49 Migrate offset_of from a macro to builtin # syntax 2023-05-05 21:44:13 +02:00
Dylan DPC 4891f02cff
Rollup merge of #108801 - fee1-dead-contrib:c-str, r=compiler-errors
Implement RFC 3348, `c"foo"` literals

RFC: https://github.com/rust-lang/rfcs/pull/3348
Tracking issue: #105723
2023-05-05 18:40:33 +05:30
Michael Goulet 6e01e910cb Implement negative bounds 2023-05-02 22:36:24 +00:00
Deadbeef a49570fd20 fix TODO comments 2023-05-02 10:32:07 +00:00
Deadbeef 8ff3903643 initial step towards implementing C string literals 2023-05-02 10:30:09 +00:00
Nilstrieb c63b6a437e Rip it out
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!
2023-05-01 16:15:13 +08:00
Matthias Krüger 9de14d894b
Rollup merge of #111037 - Nilstrieb:close-the-offsetof, r=compiler-errors
Close parentheses for `offset_of` in AST pretty printing

HIR pretty printing already handles it correctly.

This will conflict with #110694 but it seems like that PR is gonna take bit more time.
2023-05-01 01:09:50 +02:00
Matthias Krüger 1b262b8b56
Rollup merge of #110823 - compiler-errors:tweak-await-span, r=b-naber
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.
2023-05-01 01:09:47 +02:00
Nilstrieb 0dbea7ad54 Close parentheses for offset_of in AST pretty printing
HIR pretty printing already handles it correctly.
2023-04-30 23:29:40 +02:00
Lukas Markeffsky fc63926e18 remove unused muts 2023-04-28 20:19:48 +02:00
Michael Goulet f0fc4f9acf Tweak await span 2023-04-27 17:18:11 +00:00
DrMeepster 3206960ec6 minor tweaks 2023-04-21 02:14:04 -07:00
DrMeepster 511e457c4b offset_of 2023-04-21 02:14:02 -07:00
Michael Goulet 24cbf81b85 Remove .. from return type notation 2023-04-10 22:19:46 +00:00
Nilstrieb 4b4948c2e3 Remove identity casts 2023-04-09 23:22:14 +02:00
Nilstrieb 81c320ea77 Fix some clippy::complexity 2023-04-09 23:22:14 +02:00
Oli Scherer 373807a95c Rename ast::Static to ast::StaticItem to match ast::ConstItem 2023-04-04 15:34:40 +00:00
Oli Scherer 4bebdd7104 box a bunch of large types 2023-04-04 13:58:50 +00:00
Oli Scherer ec74653652 Split out ast::ItemKind::Const into its own struct 2023-04-04 09:44:50 +00:00
Oli Scherer e3828777a6 rust-analyzer guided tuple field to named field 2023-04-04 09:44:50 +00:00
Oli Scherer b08a557f80 rust-analyzer guided enum variant structification 2023-04-04 09:44:45 +00:00
Michael Goulet 8b592db27a Add (..) syntax for RTN 2023-03-28 01:14:28 +00:00
Arpad Borsos c8ead2e693
Remove the NodeId of ast::ExprKind::Async 2023-03-19 19:01:31 +01:00
clubby789 0932452fa4 Remove box_syntax from AST and use in tools 2023-03-12 13:19:46 +00:00
bwmf2 832b33e6b1 Force parentheses around match expression in binary expression 2023-03-02 21:58:49 +01:00
Nicholas Nethercote 4143b101f9 Use ThinVec in various AST types.
This commit changes the sequence parsers to produce `ThinVec`, which
triggers numerous conversions.
2023-02-21 11:51:56 +11:00
Nicholas Nethercote 068db466e8 Use ThinVec in ast::WhereClause. 2023-02-21 11:51:55 +11:00
Nicholas Nethercote dd7aff5cc5 Use ThinVec in ast::Generics and related types. 2023-02-21 11:51:55 +11:00
Michael Goulet 56bf28d4f4 Expand const-if-const trait bounds correctly 2023-02-07 21:00:12 +00:00
klensy 4f5f9f0a13 remove unused imports 2023-02-06 17:40:18 +03:00
Maybe Waffle 9fe8ae792e Rename rust_2015 => is_rust_2015 2023-02-02 08:17:13 +00:00