about summary refs log tree commit diff
path: root/compiler/rustc_ast_passes
AgeCommit message (Collapse)AuthorLines
2023-03-28Add `(..)` syntax for RTNMichael Goulet-11/+23
2023-03-28Feature gateMichael Goulet-6/+15
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-8/+8
2023-03-13Auto merge of #108471 - clubby789:unbox-the-syntax, r=Nilstrieb,est31bors-9/+0
Remove `box_syntax` r? `@Nilstrieb` This removes the feature `box_syntax`, which allows the use of `box <expr>` to create a Box, and finalises removing use of the feature from the compiler. `box_patterns` (allowing the use of `box <pat>` in a pattern) is unaffected. It also removes `ast::ExprKind::Box` - the only way to create a 'box' expression now is with the rustc-internal `#[rustc_box]` attribute. As a temporary measure to help users move away, `box <expr>` now parses the inner expression, and emits a `MachineApplicable` lint to replace it with `Box::new` Closes #49733
2023-03-12Rollup merge of #109029 - compiler-errors:parse-gating, r=jackh726Matthias Krüger-11/+2
Gate usages of `dyn*` and const closures in macros We silently accepted `dyn*` and const closures in macros as long as they didn't expand to anything containing these experimental features, unlike other gated features such as `for<'a>` binders on closures, etc. Let's not do that, to make sure nobody begins relying on this.
2023-03-12Remove `box_syntax` from AST and use in toolsclubby789-9/+0
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11Gate const closures even when they appear in macrosMichael Goulet-8/+1
2023-03-11Gate all usages of dyn*, even in macrosMichael Goulet-3/+1
2023-03-04Remove `allow(potential_query_instability)` from `ast_passes`clubby789-3/+2
2023-03-03Match unmatched backticks in comments in compiler/est31-1/+1
2023-02-27avoid `&str` to `String` conversionsTakayuki Maeda-1/+1
2023-02-25Complete migrating `ast_passes` to derive diagnosticsclubby789-425/+820
2023-02-22Move associated type bounds check to ast loweringMichael Goulet-42/+1
This makes the check for when associated type bounds more accurate
2023-02-22errors: generate typed identifiers in each crateDavid Wood-7/+105
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-21Use `ThinVec` in `ast::AngleBracketedArgs`.Nicholas Nethercote-1/+2
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-6/+6
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-17Rollup merge of #107489 - compiler-errors:non_lifetime_binders, r=cjgillotMatthias Krüger-35/+54
Implement partial support for non-lifetime binders This implements support for non-lifetime binders. It's pretty useless currently, but I wanted to put this up so the implementation can be discussed. Specifically, this piggybacks off of the late-bound lifetime collection code in `rustc_hir_typeck::collect::lifetimes`. This seems like a necessary step given the fact we don't resolve late-bound regions until this point, and binders are sometimes merged. Q: I'm not sure if I should go along this route, or try to modify the earlier nameres code to compute the right bound var indices for type and const binders eagerly... If so, I'll need to rename all these queries to something more appropriate (I've done this for `resolve_lifetime::Region` -> `resolve_lifetime::ResolvedArg`) cc rust-lang/types-team#81 r? `@ghost`
2023-02-16Replace some `then`s with some `then_some`sMaybe Waffle-1/+1
2023-02-16`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`Maybe Waffle-1/+1
2023-02-16Add feature gate for non_lifetime_bindersMichael Goulet-35/+54
2023-01-19Autoderive ExternBlockSuggestionmejrs-32/+25
2023-01-12gate const closuresDeadbeef-0/+8
2022-12-15Allow `impl ~const Trait` opaque typesDeadbeef-7/+1
2022-12-13remove unnecessary uses of `clone`Takayuki Maeda-1/+1
2022-12-01Auto merge of #104861 - nnethercote:attr-cleanups, r=petrochenkovbors-1/+1
Attribute cleanups Best reviewed one commit at a time. r? `@petrochenkov`
2022-11-29`rustc_ast_passes`: remove `ref` patternsMaybe Waffle-60/+55
2022-11-29Avoid unnecessary `MetaItem`/`Attribute` conversions.Nicholas Nethercote-1/+1
`check_builtin_attribute` calls `parse_meta` to convert an `Attribute` to a `MetaItem`, which it then checks. However, many callers of `check_builtin_attribute` start with a `MetaItem`, and then convert it to an `Attribute` by calling `cx.attribute(meta_item)`. This `MetaItem` to `Attribute` to `MetaItem` conversion is silly. This commit adds a new function `check_builtin_meta_item`, which can be called instead from these call sites. `check_builtin_attribute` also now calls it. The commit also renames `check_meta` as `check_attr` to better match its arguments.
2022-11-16Use `as_deref` in compiler (but only where it makes sense)Maybe Waffle-1/+1
2022-11-08Visit attributes of trait impl items during AST validationLeón Orell Valerian Liehr-1/+2
2022-10-26Rollup merge of #95710 - ↵Dylan DPC-61/+1
fee1-dead-contrib:stabilize_arbitrary_enum_discriminant, r=joshtriplett Stabilize arbitrary_enum_discriminant, take 2 Documentation has been updated in https://github.com/rust-lang/reference/pull/1055. cc #86860 for previous stabilization report. Not yet marks https://github.com/rust-lang/rust/issues/60553 as done: need documentation in the rust reference.
2022-10-23Migrate all diagnosticsNilstrieb-30/+30
2022-10-22Stabilize arbitrary_enum_discriminant, take 2Deadbeef-61/+1
2022-10-22Rollup merge of #103351 - oli-obk:tilde_const_impls, r=fee1-deadMatthias Krüger-49/+3
Require Drop impls to have the same constness on its bounds as the bounds on the struct have r? ``@fee1-dead``
2022-10-21Remove needless special cases and dead codeOli Scherer-49/+3
2022-10-21Rollup merge of #103051 - davidtwco:translation-tidying-up, r=compiler-errorsDylan DPC-20/+6
translation: doc comments with derives, subdiagnostic-less enum variants, more derive use - Adds support for `doc` attributes in the diagnostic derives so that documentation comments don't result in the derive failing. - Adds support for enum variants in the subdiagnostic derive to not actually correspond to an addition to a diagnostic. - Made use of the derive in more places in the `rustc_ast_lowering`, `rustc_ast_passes`, `rustc_lint`, `rustc_session`, `rustc_infer` - taking advantage of recent additions like eager subdiagnostics, multispan suggestions, etc. cc #100717
2022-10-20Improve "`~const` is not allowed here" messageDeadbeef-20/+43
2022-10-17ast_passes: use derive moreDavid Wood-20/+6
Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10errors: `AddToDiagnostic::add_to_diagnostic_with`David Wood-3/+9
`AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure. Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10Rollup merge of #102868 - compiler-errors:rename-assoc-tyalias-to-ty, r=TaKO8KiDylan DPC-3/+3
Rename `AssocItemKind::TyAlias` to `AssocItemKind::Type` Thanks `@camsteffen` for catching this in ast too, cc https://github.com/rust-lang/rust/pull/102829#issuecomment-1272649247
2022-10-10Rename AssocItemKind::TyAlias to AssocItemKind::TypeMichael Goulet-3/+3
2022-10-08Split slice part of feature(half_open_range_patterns) to [...]_in_slicesUrgau-2/+5
2022-09-26Rollup merge of #102273 - woppopo:relax_const_bound, r=fee1-deadMatthias Krüger-4/+3
Allow `~const` bounds on non-const functions Makes the behavior of bound of trait-associated functions and non-associated functions consistent.
2022-09-26remove cfg(bootstrap)Pietro Albini-1/+0
2022-09-26Allow `~const` bounds on non-const functionswoppopo-4/+3
2022-09-22Improve the help message for an invalid calling conventionkhyperia-202/+18
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-1/+1
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-27/+27
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-14Auto merge of #101212 - eholk:dyn-star, r=compiler-errorsbors-0/+3
Initial implementation of dyn* This PR adds extremely basic and incomplete support for [dyn*](https://smallcultfollowing.com/babysteps//blog/2022/03/29/dyn-can-we-make-dyn-sized/). The goal is to get something in tree behind a flag to make collaboration easier, and also to make sure the implementation so far is not unreasonable. This PR does quite a few things: * Introduce `dyn_star` feature flag * Adds parsing for `dyn* Trait` types * Defines `dyn* Trait` as a sized type * Adds support for explicit casts, like `42usize as dyn* Debug` * Including const evaluation of such casts * Adds codegen for drop glue so things are cleaned up properly when a `dyn* Trait` object goes out of scope * Adds codegen for method calls, at least for methods that take `&self` Quite a bit is still missing, but this gives us a starting point. Note that this is never intended to become stable surface syntax for Rust, but rather `dyn*` is planned to be used as an implementation detail for async functions in dyn traits. Joint work with `@nikomatsakis` and `@compiler-errors.` r? `@bjorn3`