Matthias Krüger
3837df2992
don't clone types that are copy (clippy::clone_on_copy)
2020-04-16 00:17:38 +02:00
Matthias Krüger
9bba047c2e
Use if let instead of match when only matching a single variant (clippy::single_match)
...
Makes code more compact and reduces nestig.
2020-03-30 10:52:29 +02:00
Amanieu d'Antras
d162d096dd
Rename asm! to llvm_asm!
...
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26 15:49:22 +00:00
Esteban Küber
f18a6dcec0
Rename def_span
to guess_head_span
2020-03-25 16:45:12 -07:00
Mazdak Farrokhzad
3979964200
defatalize expand_test_or_bench
2020-03-24 06:28:56 +01:00
Mazdak Farrokhzad
0e0f9311da
defatalize get_test_runner
2020-03-24 06:28:56 +01:00
Mazdak Farrokhzad
b7909b22b5
nix remaining rustc_expand::panictry! uses.
2020-03-24 06:28:55 +01:00
Mazdak Farrokhzad
c984a96189
Rollup merge of #70269 - matthiaskrgr:clippy_closures, r=Dylan-DPC
...
remove redundant closures (clippy::redundant_closure)
2020-03-23 04:26:15 +01:00
Mazdak Farrokhzad
8dda61792b
Rollup merge of #70248 - Centril:unroot, r=petrochenkov
...
parser: simplify & remove unused field
r? @petrochenkov
2020-03-23 04:26:12 +01:00
Dylan DPC
69c0bcd3d5
Rollup merge of #70266 - petrochenkov:prochead, r=varkor
...
proc_macro_harness: Use item header spans for errors
Addresses https://github.com/rust-lang/rust/pull/70233#discussion_r396043004 .
2020-03-22 15:48:43 +01:00
Matthias Krüger
263cbd1bbe
remove redundant closures (clippy::redundant_closure)
2020-03-22 12:43:19 +01:00
Vadim Petrochenkov
bdd07f932b
proc_macro_harness: Use item header spans for errors
2020-03-22 12:59:32 +03:00
Mazdak Farrokhzad
eaa0ae503f
parse: nix new_sub_parser_from_file
2020-03-22 00:35:20 +01:00
Mazdak Farrokhzad
d18ed205c9
parse: nix unused root_module_name
.
2020-03-21 22:51:03 +01:00
Matthias Krüger
1dcbdbdf4f
use let instead of match for matches with single bindings (clippy::match_single_binding)
2020-03-21 15:54:14 +01:00
Mazdak Farrokhzad
3e6b1ac964
Rollup merge of #70187 - matthiaskrgr:cl2ppy, r=Mark-Simulacrum
...
more clippy fixes
* remove redundant returns (clippy::needless_return)
* remove redundant import (clippy::single_component_path_imports)
* remove redundant format!() call (clippy::useless_format)
* don't use ok() before calling expect() (clippy::ok_expect)
2020-03-21 05:33:31 +01:00
Matthias Krüger
ad00e91887
remove redundant returns (clippy::needless_return)
2020-03-20 20:23:03 +01:00
Mazdak Farrokhzad
0d018a5755
expand_include: set .directory
to dir of included file.
2020-03-20 17:39:29 +01:00
Mazdak Farrokhzad
5ee4f6f660
fix pre-expansion linting infra
2020-03-18 15:08:25 +01:00
Mazdak Farrokhzad
83a757a9ca
outline modules: parse -> expand.
2020-03-18 15:08:25 +01:00
Mazdak Farrokhzad
9fc5c2d00d
Rollup merge of #69870 - petrochenkov:cfgacc, r=matthewjasper
...
expand: Implement something similar to `#[cfg(accessible(path))]`
cc https://github.com/rust-lang/rust/issues/64797
The feature is implemented as a `#[cfg_accessible(path)]` attribute macro rather than as `#[cfg(accessible(path))]` because it needs to wait until `path` becomes resolvable, and `cfg` cannot wait, but macros can wait.
Later we can think about desugaring or not desugaring `#[cfg(accessible(path))]` into `#[cfg_accessible(path)]`.
This implementation is also incomplete in the sense that it never returns "false" from `cfg_accessible(path)`, it requires some tweaks to resolve, which is not quite ready to answer queries like this during early resolution.
However, the most important part of this PR is not `cfg_accessible` itself, but expansion infrastructure for retrying expansions.
Before this PR we could say "we cannot resolve this macro path, let's try it later", with this PR we can say "we cannot expand this macro, let's try it later" as well.
This is a pre-requisite for
- turning `#[derive(...)]` into a regular attribute macro,
- properly supporting eager expansion for macros that cannot yet be resolved like
```
fn main() {
println!(not_available_yet!());
}
macro_rules! make_available {
() => { #[macro_export] macro_rules! not_available_yet { () => { "Hello world!" } }}
}
make_available!();
```
2020-03-17 03:05:12 +01:00
Vadim Petrochenkov
e809e0214e
ast: Mac
/Macro
-> MacCall
2020-03-12 22:26:52 +03:00
Vadim Petrochenkov
2e6528961c
builtin_macros: Add attribute macro #[cfg_accessible(path)]
2020-03-10 01:02:13 +03:00
Vadim Petrochenkov
552a8875bd
expand: Implement support for retrying macro expansions
2020-03-10 00:56:09 +03:00
Vadim Petrochenkov
eafeb9a267
expand/builtin_macros: Minor cleanup
2020-03-09 20:50:48 +03:00
Vadim Petrochenkov
925e9a2188
rustc_parse: Use Token::ident
where possible
2020-03-09 12:42:41 +03:00
Mazdak Farrokhzad
24757a82f1
Rollup merge of #69548 - LeSeulArtichaut:assert-errors, r=petrochenkov
...
Turn trailing tokens in `assert!()` into hard errors
I didn't have time to build the compiler and thus edited the tests manually, I hope it will still pass.
Closes #69531
r? @Centril do you want to queue the Crater experiment?
2020-03-08 11:51:09 +01:00
Mazdak Farrokhzad
10f999b72d
Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkov
...
fix various typos
2020-03-07 17:27:32 +01:00
LeSeulArtichaut
33ebc20513
Turn trailing tokens in assert!()
into hard errors
2020-03-06 22:02:20 +01:00
Matthias Krüger
83980aca20
Don't redundantly repeat field names (clippy::redundant_field_names)
2020-03-06 19:42:18 +01:00
Matthias Krüger
136ad015b6
fix various typos
2020-03-06 15:19:31 +01:00
Matthias Krüger
8ba92d9ce4
Use more efficient &&str to String conversion (clippy::inefficient_to_string)
2020-03-05 16:39:20 +01:00
Matthias Krüger
3fc5c118dd
Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg)
2020-03-05 16:39:12 +01:00
Matthias Krüger
21affdd00d
use values() or keys() respectively when iterating only over keys or values of maps.
2020-03-02 13:01:05 +01:00
Yuki Okushi
680a0e1dd5
Rollup merge of #69580 - matthiaskrgr:map_clone, r=Centril
...
use .copied() instead of .map(|x| *x) on iterators
2020-03-01 19:28:12 +09:00
Yuki Okushi
4439bb09aa
Rollup merge of #69579 - petrochenkov:noprevspan, r=Centril
...
parser: Remove `Parser::prev_span`
Follow-up to https://github.com/rust-lang/rust/pull/69384 .
r? @Centril
2020-03-01 19:28:10 +09:00
bors
2917d99302
Auto merge of #69592 - petrochenkov:nosyntax, r=Centril
...
Rename `libsyntax` to `librustc_ast`
This was the last rustc crate that wasn't following the `rustc_*` naming convention.
Follow-up to https://github.com/rust-lang/rust/pull/67763 .
2020-03-01 01:36:58 +00:00
Vadim Petrochenkov
e08c279eac
Rename syntax
to rustc_ast
in source code
2020-02-29 21:59:09 +03:00
Dylan DPC
7d43997053
Rollup merge of #69572 - matthiaskrgr:try_err_and_iter_on_ref, r=Centril
...
use .iter() instead of .into_iter() on references
2020-02-29 18:54:01 +01:00
Vadim Petrochenkov
6054a30370
Make it build again
2020-02-29 20:47:10 +03:00
Matthias Krüger
c9a02c2e42
use .copied() instead of .map(|x| *x) on iterators
2020-02-29 15:23:13 +01:00
Vadim Petrochenkov
d0ba4387c2
parser: prev_span
-> prev_token.span
2020-02-29 14:57:14 +03:00
Matthias Krüger
de7c40c168
use .iter() instead of .into_iter() on references.
2020-02-29 03:14:01 +01:00
Dylan DPC
c8db7dcc1c
Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-Simulacrum
...
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-29 02:16:21 +01:00
Dylan DPC
ba2df27525
Rollup merge of #69546 - matthiaskrgr:slice_to_vec, r=davidtwco,nagisa
...
use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.
2020-02-29 02:16:20 +01:00
Mazdak Farrokhzad
07d9ed2c09
Rollup merge of #69481 - matthiaskrgr:single_char, r=ecstatic-morse
...
use char instead of &str for single char patterns
2020-02-28 17:17:30 +01:00
Matthias Krüger
9523c89f18
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-28 15:16:27 +01:00
Matthias Krüger
0c5d497603
use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.
2020-02-28 13:21:25 +01:00
Matthias Krüger
7c84ba1124
use char instead of &str for single char patterns
2020-02-27 14:57:22 +01:00
Vadim Petrochenkov
b2605c118d
parser: token
-> normalized_token
, nonnormalized_token
-> token
2020-02-24 13:04:13 +03:00