rust/src
bors 58d2bad9f7 Auto merge of #78837 - petrochenkov:keyvalexpr, r=davidtwco
Accept arbitrary expressions in key-value attributes at parse time

Continuation of https://github.com/rust-lang/rust/pull/77271.

We now support arbitrary expressions in values of key-value attributes at parse time.
```
#[my_attr = EXPR]
```
Previously only unsuffixed literals and interpolated expressions (`$expr`) were accepted.

There are two immediate motivational cases for this:
- External doc strings (`#[doc = include_str!("my_doc.md")]`, eliminating the need in https://github.com/rust-lang/rust/issues/44732) and expanding macros in this position in general. Currently such macro expansions are supported in this position in interpolated `$expr`s (the `#[doc = $doc]` idiom).
- Paths (`#[namespace = foo::bar] extern "C++" { ... }`) like proposed in https://github.com/rust-lang/rust/pull/76734.

If the attribute in question survives expansion, then the value is still restricted to unsuffixed literals by a semantic check.
This restriction doesn't prevent the use cases listed above, so this PR keeps it in place for now.

Closes https://github.com/rust-lang/rust/issues/52607.
Previous attempt - https://github.com/rust-lang/rust/pull/67121.
Some more detailed write up on internals - https://internals.rust-lang.org/t/macro-expansion-points-in-attributes/11455.
Tracking issue - https://github.com/rust-lang/rust/issues/78835.
2020-12-10 00:42:22 +00:00
..
bootstrap don't wrap code block in Ok() (clipppy::unit_arg) 2020-12-08 20:27:48 +01:00
build_helper
ci
doc Fixes to Rust coverage 2020-12-07 17:56:19 -08:00
etc
librustdoc Rollup merge of #79862 - GuillaumeGomez:tab-lock, r=Manishearth 2020-12-09 13:38:38 -08:00
llvm-project@8d78ad1389 Update LLVM submodule 2020-12-09 00:00:00 +00:00
test Auto merge of #78837 - petrochenkov:keyvalexpr, r=davidtwco 2020-12-10 00:42:22 +00:00
tools Rollup merge of #79803 - jyn514:xsv, r=Mark-Simulacrum 2020-12-09 13:38:24 -08:00
README.md
stage0.txt
version

This directory contains the source code of the rust project, including:

  • The test suite
  • The bootstrapping build system
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc dev guide.