| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Gate if-let guard feature
Enhanced on #74315. That PR is in crater queue so I don't want to push to it.
Close #74232
cc #51114
|
|
|
|
|
|
Remove restriction on type parameters preceding consts w/ feature const-generics
Removed the restriction on type parameters preceding const parameters when the feature const-generics is enabled.
Builds on #74676, which deals with unsorted generic parameters. This just lifts the check in lowering the AST to HIR that permits consts and types to be reordered with respect to each other. Lifetimes still must precede both
This change is not intended for min-const-generics, and is gated behind the `#![feature(const_generics)]`.
One thing is that it also permits type parameters without a default to come after consts, which I expected to not work, and was hoping to get more guidance on whether that should be permitted or how to prevent it otherwise.
I did not go through the RFC process for this pull request because there was prior work to get this feature added. In the previous PR that was cited, work was done to enable this change.
r? @lcnr
|
|
Updated tests and error msgs
Update stderr from test
Update w/ lcnr comments
Change some tests around, and also updated Ord implementation for ParamKindOrd
Update w/ nits from lcnr
|
|
Run fmt
|
|
|
|
Added minor fmt change to ast_validation
|
|
Added more complex test and changed error message
|
|
Added this test to ensure that reordering the parameters only works with the feature const
generics enabled.
Fixed nits
Also added another test to verify that intermixed lifetimes are forbidden
|
|
|
|
Remove `librustc_ast` session globals
By moving the data onto `Session`.
r? @petrochenkov
|
|
|
|
|
|
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This
means they are accessed via the `Session`, rather than via TLS. A few
`Attr` methods and `librustc_ast` functions are now methods of
`Session`.
All of this required passing a `Session` to lots of functions that didn't
already have one. Some of these functions also had arguments removed, because
those arguments could be accessed directly via the `Session` argument.
`contains_feature_attr()` was dead, and is removed.
Some functions were moved from `librustc_ast` elsewhere because they now need
to access `Session`, which isn't available in that crate.
- `entry_point_type()` --> `librustc_builtin_macros`
- `global_allocator_spans()` --> `librustc_metadata`
- `is_proc_macro_attr()` --> `Session`
|
|
|
|
|
|
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.
Replace all uses of `check_name` with `has_name` outside of rustc
|
|
librustc_ast_passes, librustc_ast_pretty
|
|
|
|
Co-authored-by: varkor <github@varkor.com>
|
|
as if this is currently possible. HA!
|
|
This reverts commit 13c6d5819aae3c0de6a90e7f17ea967bf4487cbb.
|
|
Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263,
which currently records the span of a const generic param incorrectly
because the location of the `const` kw is not known.
I am not sure how to add tests for this; any guidance in how to do so
would be appreciated :slightly_smiling_face:
|
|
|
|
|
|
* In 'src/librustc_ast_passes/node_count.rs'
* typo fix ('rought' -> 'rough')
* In 'src/librustc_middle/middle/region.rs',
* fixed broken link to 'rustc-dev-guide'
* typo fix ('aluded' -> 'alluded')
Thank you for reviewing this PR :)
|
|
|
|
|
|
appropriate syntax
When encountering `where <A as Foo>::Bar = B`, it is possible that `Bar`
is an associated type. If so, suggest `where A: Foo<Bar = B>`.
CC #20041.
|
|
|
|
Tweak output of type params and constraints in the wrong order
r? @Centril @varkor
|
|
Using a single label for constraints and generic arguments.
|
|
|
|
(clippy::single_match)
Makes code more compact and reduces nestig.
|
|
|
|
When encountering constraints before type arguments or lifetimes,
suggest the correct order.
|
|
|
|
|
|
|
|
|
|
|
|
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
|
|
simplify match stmt
We actually have a surprising amount of
```rust
match expr {
$($p:pat)|+ => true,
_ => false,
}
```
While I would prefer this to be replaced with `matches!`, most cases are
fairly readable anyway so we can just let them be for now.
|
|
They used to be covered by `optin_builtin_traits` but negative impls
are now applicable to all traits, not just auto traits.
This also adds docs in the unstable book for the current state of auto traits.
|
|
|
|
|
|
put type params in front of const params in generics_of
fixes #69970
r? @varkor
|
|
|