don't suggest placing `use` statements into expanded code
r? @nrc
fixes#44210
```rust
#[derive(Debug)]
struct Foo;
type X = Path;
```
will try to place `use std::path::Path;` between `#[derive(Debug)]` and `struct Foo;`
I am not sure how to obtain a span before the first attribute, because derive attributes are removed during expansion.
It would be trivial to detect this case and place the `use` after the item, but that would be somewhat weird I think.
If config.toml doesn't exist, then an IOError will be raised
on the `with open(...)` line. Prior to e788fa7, this was
caught because the `except` clause didn't specify what
exceptions it caught, so both IOError and OSError were
caught
This commit fixes a regression from #44601 where lowering attribute to HIR now
involves expanding interpolated tokens to their actual tokens. In that commit
all interpolated tokens were surrounded with a `DelimToken::None` group of
tokens, but this ended up causing regressions like #44730 where the various
attribute parsers in `syntax/attr.rs` weren't ready to cope with
`DelimToken::None`. Instead of fixing the parser in `attr.rs` this commit
instead opts to just avoid the `DelimToken::None` in the first place, ensuring
that the token stream should look the same as it did before where possible.
Closes#44730
Add clippy to `toolstate.toml`
r? @alexcrichton
cc @Manishearth
I have no idea how to get clippy working... it needs proc macros, and I think I did everything right (I just did what the cargo step is doing), but it's not working:
```
error: libproc_macro-6210e4b46662ec28.so: cannot open shared object file: No such file or directory
--> src/tools/clippy/clippy_lints/src/lib.rs:47:1
|
47 | extern crate serde_derive;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: libproc_macro-6210e4b46662ec28.so: cannot open shared object file: No such file or directory
--> src/tools/clippy/clippy_lints/src/lib.rs:47:1
|
47 | extern crate serde_derive;
| ^
```
It's especially weird since it used to work
Anyway. Fixing it can be left for a future PR, this one adds it to CI, but marks it as "broken"
`--cap-lints allow` switches off `can_emit_warnings`
This boolean field on the error `Handler` is toggled to silence
warnings when `-A warnings` is passed. (This is actually a separate
mechanism from the global lint level—whether there's some redundancy
to be factored away here is an important question, but not one we
concern ourselves with in this commit.) But the same rationale
applies for `--cap-lints allow`. In particular, this makes the "soft"
feature-gate warning introduced in 8492ad24 (which is not a lint, but
just calls `struct_span_warn`) not pollute the builds of dependent
crates.
Thanks to @kennytm for pointing out the potential of
`can_emit_warnings` for this purpose.
Resolves#44213.
Implement `Copy`/`Clone` for closures
Implement RFC [#2132](https://github.com/rust-lang/rfcs/pull/2132) (tracking issue: #44490).
NB: I'm not totally sure about the whole feature gates thing, that's my first PR of this kind...
Only consider yields coming after the expressions when computing generator interiors
When looking at the scopes which temporaries of expressions can live for during computation of generator interiors, only consider yields which appear after the expression in question in the HIR.
Correctly bubble up errors from libbacktrace
Previously the first part of this code didn't check for a null pointer and blindly passed it back down, causing a segfault if libbacktrace failed to initialise. I've changed this to check and bubble up the error if relevant.
Suggested diff view: https://github.com/rust-lang/rust/pull/44525/files?w=1
Optimize drain_filter
This PR cuts out two copies from each iteration of `drain_filter` by exchanging the swap operation for a copy_nonoverlapping function call instead. Since the data being swapped is not needed anymore we can just overwrite it instead.