| Age | Commit message (Collapse) | Author | Lines |
|
Add some tests for buggy derive helpers
|
|
|
|
|
|
|
|
|
|
- Suggest raw ident escaping in all editions
- Keep primary label in all cases
|
|
|
|
Implement RFC 2338, "Type alias enum variants"
This PR implements [RFC 2338](https://github.com/rust-lang/rfcs/pull/2338), allowing one to write code like the following.
```rust
#![feature(type_alias_enum_variants)]
enum Foo {
Bar(i32),
Baz { i: i32 },
}
type Alias = Foo;
fn main() {
let t = Alias::Bar(0);
let t = Alias::Baz { i: 0 };
match t {
Alias::Bar(_i) => {}
Alias::Baz { i: _i } => {}
}
}
```
Since `Self` can be considered a type alias in this context, it also enables using `Self::Variant` as both a constructor and pattern.
Fixes issues #56199 and #56611.
N.B., after discussing the syntax for type arguments on enum variants with @petrochenkov and @eddyb (there are also a few comments on the [tracking issue](https://github.com/rust-lang/rust/issues/49683)), the consensus seems to be treat the syntax as follows, which ought to be backwards-compatible.
```rust
Option::<u8>::None; // OK
Option::None::<u8>; // OK, but lint in near future (hard error next edition?)
Alias::<u8>::None; // OK
Alias::None::<u8>; // Error
```
I do not know if this will need an FCP, but let's start one if so.
|
|
resolve: Fix another ICE in import validation
Imports are allowed to have ambiguous resolutions as long as all of them have same `Def`.
As it turned out, it's possible for different `Module`s to have same `Def` when `extern crate` items are involved.
Fixes https://github.com/rust-lang/rust/issues/56596
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libsyntax_pos: A few tweaks
|
|
|
|
|
|
|
|
|
|
|
|
More precise spans for ambiguities from macros
|
|
|
|
|
|
generic parameters
|
|
|
|
|
|
|
|
|
|
|
|
macro paths
|
|
edition
|
|
|
|
This commit extends existing path suggestions to link to documentation
on the changed semantics of `use` in Rust 2018.
|
|
|
|
It would be kind of embarrassing to ship with the "issue TBD" message!
|
|
|
|
Adds a test to demonstrate behaviour of suggestions in the
2015 edition.
|
|
This commit adds suggestions for unresolved imports in the cases where
there could be a missing `crate::`, `super::`, `self::` or a missing
external crate name before an import.
|
|
In the 2018 edition, when suggesting traits to import that implement a
given method that is being invoked, suggestions will now include the
`crate::` prefix if the suggested trait is local to the current crate.
|
|
in which we include attributes in unused `extern crate` suggestion spans

Resolves #54400.
r? @estebank
|
|
Don't lint non-extern-prelude extern crate's in Rust 2018.
Fixes #54381 by silencing the lint telling users to remove `extern crate` when `use` doesn't work.
r? @alexcrichton cc @petrochenkov @nikomatsakis @Centril
|
|
|
|
RFC 2093 (tracking issue #44493) lets us leave off
commonsensically inferable `T: 'a` outlives requirements. (A separate
feature-gate was split off for the case of 'static lifetimes, for
which questions still remain.) Detecting these was requested as an
idioms-2018 lint.
It turns out that issuing a correct, autofixable suggestion here is
somewhat subtle in the presence of other bounds and generic
parameters. Basically, we want to handle these three cases:
• One outlives-bound. We want to drop the bound altogether, including
the colon—
MyStruct<'a, T: 'a>
^^^^ help: remove this bound
• An outlives bound first, followed by a trait bound. We want to
delete the outlives bound and the following plus sign (and
hopefully get the whitespace right, too)—
MyStruct<'a, T: 'a + MyTrait>
^^^^^ help: remove this bound
• An outlives bound after a trait bound. We want to delete the
outlives lifetime and the preceding plus sign—
MyStruct<'a, T: MyTrait + 'a>
^^^^^ help: remove this bound
This gets (slightly) even more complicated in the case of where
clauses, where we want to drop the where clause altogether if there's
just the one bound. Hopefully the comments are enough to explain
what's going on!
A script (in Python, sorry) was used to generate the
hopefully-sufficiently-exhaustive UI test input. Some of these are
split off into a different file because rust-lang-nursery/rustfix#141
(and, causally upstream of that, #53934) prevents them from being
`run-rustfix`-tested.
We also make sure to include a UI test of a case (copied from RFC
2093) where the outlives-bound can't be inferred. Special thanks to
Niko Matsakis for pointing out the `inferred_outlives_of` query,
rather than blindly stripping outlives requirements as if we weren't a
production compiler and didn't care.
This concerns #52042.
|
|
Resolves #54400.
|
|
Make `dyn` a keyword in the 2018 edition
Proposed in https://github.com/rust-lang/rust/issues/44662#issuecomment-421596088.
|
|
|
|
|
|
|
|
|