about summary refs log tree commit diff
path: root/compiler/rustc_ast_passes/src
AgeCommit message (Collapse)AuthorLines
2024-06-26Rollup merge of #126973 - ↵Matthias Krüger-2/+2
chenyukang:yukang-fix-126756-unsafe-suggestion-error, r=spastorino Fix bad replacement for unsafe extern block suggestion Fixes #126756 r? ``@spastorino`` link #123743
2024-06-26Fix bad replacement for unsafe extern block suggestionyukang-2/+2
2024-06-23Add hard error and migration lint for unsafe attrscarbotaniuman-1/+1
2024-06-22Allow "C-unwind" fn to have C variadicsJubilee Young-0/+1
2024-06-21Do not allow safe usafe on static and fn itemsSantiago Pastorino-16/+52
2024-06-21Rollup merge of #126767 - compiler-errors:static-foreign-item, r=spastorinoMatthias Krüger-1/+1
`StaticForeignItem` and `StaticItem` are the same The struct `StaticItem` and `StaticForeignItem` are the same, so remove `StaticForeignItem`. Having them be separate is unique to `static` items -- unlike `ForeignItemKind::{Fn,TyAlias}`, which use the normal AST item. r? ``@spastorino`` or ``@oli-obk``
2024-06-20StaticForeignItem and StaticItem are the sameMichael Goulet-1/+1
2024-06-20Properly gate `safe` keyword in pre-expansionMichael Goulet-0/+4
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-8/+6
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-17Detect duplicatesMichael Goulet-2/+27
2024-06-17Add tests for illegal use bound syntaxMichael Goulet-1/+1
2024-06-17Rework precise capturing syntaxMichael Goulet-82/+106
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-1/+3
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-06-06Parse unsafe attributescarbotaniuman-0/+1
2024-06-05Make MISSING_UNSAFE_ON_EXTERN lint emit future compat info with suggestion ↵Santiago Pastorino-6/+20
to prepend unsafe
2024-06-05Add unsafe_extern_blocks feature flagSantiago Pastorino-17/+19
2024-06-04Fail when using safe/unsafe items inside unadorned extern blocksSantiago Pastorino-19/+56
2024-06-04Handle safety keyword for extern block inner itemsSantiago Pastorino-1/+1
2024-06-04Allow using unsafe on functions inside extern blocksSantiago Pastorino-5/+1
2024-06-04Make extern blocks without unsafe warn in edition 2024Santiago Pastorino-2/+13
2024-06-04Allow unsafe extern on all editionsSantiago Pastorino-4/+1
2024-05-31Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, ↵Matthias Krüger-25/+27
r=compiler-errors Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology. Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense. --- Old terminology (HIR, rustdoc): ``` `TypeBinding`: (associated) type binding ├── `Constraint`: associated type bound └── `Equality`: (associated) equality constraint (?) ├── `Ty`: (associated) type binding └── `Const`: associated const equality (constraint) ``` Old terminology (AST, abbrev.): ``` `AssocConstraint` ├── `Bound` └── `Equality` ├── `Ty` └── `Const` ``` New terminology (AST, HIR, rustdoc): ``` `AssocItemConstraint`: associated item constraint ├── `Bound`: associated type bound └── `Equality`: associated item equality constraint OR associated item binding (for short) ├── `Ty`: associated type equality constraint OR associated type binding (for short) └── `Const`: associated const equality constraint OR associated const binding (for short) ``` r? compiler-errors
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-25/+27
2024-05-26Rollup merge of #124048 - veera-sivarajan:bugfix-123773-c23-variadics, ↵Jubilee-14/+5
r=compiler-errors Support C23's Variadics Without a Named Parameter Fixes #123773 This PR removes the static check that disallowed extern functions with ellipsis (varargs) as the only parameter since this is now valid in C23. This will not break any existing code as mentioned in the proposal document: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2975.pdf. Also, adds a doc comment for `check_decl_cvariadic_pos()` and fixes the name of the function (`varadic` -> `variadic`).
2024-05-21Rename buffer_lint_with_diagnostic to buffer_lintXiretza-3/+3
2024-05-21Make early lints translatableXiretza-1/+1
2024-05-21Generate lint diagnostic message from BuiltinLintDiagXiretza-10/+7
Translation of the lint message happens when the actual diagnostic is created, not when the lint is buffered. Generating the message from BuiltinLintDiag ensures that all required data to construct the message is preserved in the LintBuffer, eventually allowing the messages to be moved to fluent. Remove the `msg` field from BufferedEarlyLint, it is either generated from the data in the BuiltinLintDiag or stored inside BuiltinLintDiag::Normal.
2024-05-20Rollup merge of #125314 - jdonszelmann:global-registration-feature-gate, ↵Matthias Krüger-0/+1
r=pnkfelix Add an experimental feature gate for global registration See #125119 for the tracking issue.
2024-05-17Rename Unsafe to SafetySantiago Pastorino-13/+13
2024-05-14create a feature gatejdonszelmann-0/+1
2024-05-02Stabilize exclusive_rangeRoss Smyth-14/+1
2024-04-30Replace item names containing an error code with something more meaningfulLeón Orell Valerian Liehr-6/+5
or inline such functions if useless.
2024-04-29Add StaticForeignItem and use it on ForeignItemKindSantiago Pastorino-2/+2
2024-04-25ast: Generalize item kind visitingVadim Petrochenkov-3/+3
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
2024-04-24Stabilise `inline_const`Gary Guo-1/+0
2024-04-21Pass translation closure to add_to_diag_with() as referenceXiretza-2/+2
2024-04-17ast_passes/validation: update attribute macro example许杰友 Jieyou Xu (Joe)-2/+9
2024-04-17ast_passes/validation: update module docs许杰友 Jieyou Xu (Joe)-7/+10
- Syntax extensions are replaced by proc macros. - Add rationale for why AST validation pass need to be run post-expansion and why the pass is needed in the first place.
2024-04-17Rename `BindingAnnotation` to `BindingMode`Jules Bertholet-2/+2
2024-04-16Support C23's Variadics Without a Named ParameterVeera-14/+5
This PR removes the static check that disallowed extern functions with ellipsis (varargs) as the only parameter since this is now valid in C23. Also, adds a doc comment for `check_decl_cvariadic_pos()` and fixes the name of the function (`varadic` -> `variadic`).
2024-04-15Parsing , pre-lowering support for precise capturesMichael Goulet-1/+2
2024-04-12Rollup merge of #123841 - Kohei316:remove_qualifier_sugg, r=wesleywiserMatthias Krüger-1/+11
Improve diagnostic by suggesting to remove visibility qualifier Resolves #123529 This PR improve diagnostic by suggesting to remove visibility qualifier.
2024-04-12Improve diagnostic by suggesting to remove visibility qualifiermorine0122-1/+11
2024-04-09Add a helper for extending a span to include any trailing whitespaceMichael Goulet-1/+1
2024-04-08Add pattern types to parserOli Scherer-0/+3
2024-04-04Rollup merge of #123397 - krtab:foreign_fn_qualif_diag, r=petrochenkovMatthias Krüger-7/+25
Fix diagnostic for qualifier in extern block Closes: https://github.com/rust-lang/rust/issues/123306
2024-04-04Fix diagnostic for qualifier in extern blockArthur Carcano-7/+25
Closes: https://github.com/rust-lang/rust/issues/123306
2024-03-29Rollup merge of #123188 - klensy:clippy-me2, r=NilstriebMatthias Krüger-1/+1
compiler: fix few unused_peekable and needless_pass_by_ref_mut clippy lints This fixes few instances of `unused_peekable` and `needless_pass_by_ref_mut`. While i expected to fix more warnings, `needless_pass_by_ref_mut` produced too much for one PR, so i stopped here. Better reviewed commit by commit, as fixes splitted by chunks.
2024-03-28compiler: fix few needless_pass_by_ref_mut clippy lintsklensy-1/+1
warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_session\src\config.rs:2013:16 | 2013 | early_dcx: &mut EarlyDiagCtxt, | ^^^^^^^^^^^^^^^^^^ help: consider changing to: `&EarlyDiagCtxt` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_ast_passes\src\ast_validation.rs:1555:11 | 1555 | this: &mut AstValidator<'_>, | ^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&AstValidator<'_>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_infer\src\infer\snapshot\fudge.rs:16:12 | 16 | table: &mut UnificationTable<'_, 'tcx, T>, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider changing to: `&UnificationTable<'_, 'tcx, T>` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut warning: this argument is a mutable reference, but not used mutably --> compiler\rustc_expand\src\expand.rs:961:13 | 961 | parser: &mut Parser<'a>, | ^^^^^^^^^^^^^^^ help: consider changing to: `&Parser<'a>` | = warning: changing this function will impact semver compatibility = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_pass_by_ref_mut
2024-03-27Feature gateJules Bertholet-0/+1