Commit graph

258093 commits

Author SHA1 Message Date
Laurențiu Nicola 0744b36d53 Remove Changelog: XXX title from Github release notes 2024-06-22 14:55:23 +03:00
bors 9b33872c89 Auto merge of #17469 - roife:fix-issue-17425, r=Veykril
fix: use ItemInNs::Macros to convert ModuleItem to ItemInNs

fix #17425.

When converting `PathResolution` to `ItemInNs`, we should convert `ModuleDef::Macro` to `ItemInNs::Macros` to ensure that it can be found in `DefMap`.
2024-06-21 17:52:42 +00:00
bors 398e3a3c28 Auto merge of #17474 - Veykril:ty-perf-stuff, r=Veykril
internal: Remove some allocations from hir-ty
2024-06-21 17:39:45 +00:00
Lukas Wirth 619574928c Prevent re-allocation in CallableSig::from_params_and_return 2024-06-21 19:26:08 +02:00
Lukas Wirth 54f3f56ee8 Save allocations for empty generic_defaults query results 2024-06-21 19:21:27 +02:00
bors 36c37313a0 Auto merge of #17473 - Veykril:generics, r=Veykril
internal: Tidy up generics handling in hir-ty a bit
2024-06-21 17:12:35 +00:00
Lukas Wirth 2893153c34 Don't attempt to compute implict sized clauses for empty generics 2024-06-21 19:10:57 +02:00
Lukas Wirth 5cbaa3f554 Save allocations for empty generic_predicates query results 2024-06-21 19:10:45 +02:00
Lukas Wirth 873dcf4b9c Lazy generics 2024-06-21 18:38:37 +02:00
Lukas Wirth 3b97b75599 Simplify 2024-06-21 18:27:05 +02:00
Lukas Wirth 3a66230a44 There can only be one self param 2024-06-21 17:55:16 +02:00
Lukas Wirth c133c649a0 Light docs and privacy 2024-06-21 17:54:40 +02:00
roife 51b138cc79 fix: use ItemInNs::Macros to convert ModuleItem to ItemInNs 2024-06-21 21:05:14 +08:00
Lukas Wirth 7b50a5ff43 Extract generics module 2024-06-21 10:55:05 +02:00
bors 9b8b6f92b2 Auto merge of #17464 - wyatt-herkamp:fix-actix-macro, r=lnicola
Check that Expr is none before adding fixup

Closes #17463
2024-06-20 12:59:02 +00:00
Wyatt Herkamp edd66a754e
Check that Expr is none before adding fixup 2024-06-20 08:55:05 -04:00
bors 48b6f28b0e Auto merge of #17462 - Veykril:sema-attr-macro-res, r=Veykril
fix: Fix IDE features breaking in some attr macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/17453, Fixes https://github.com/rust-lang/rust-analyzer/issues/17458
2024-06-20 09:11:44 +00:00
Lukas Wirth 16a28cacc2 fix: Fix IDE features breaking in some attr macros 2024-06-20 11:00:19 +02:00
bors 1d0d439168 Auto merge of #17461 - Veykril:drop-flycheck-recv, r=Veykril
fix: Fix flycheck panicking when cancelled

Fixes https://github.com/rust-lang/rust-analyzer/issues/17445
2024-06-20 08:58:44 +00:00
bors e8717758b8 Auto merge of #17419 - ishanjain28:filter_builtin_macro_expansion, r=Veykril
Filter builtin macro expansion

This PR adds a filter on the types of built in macros that are allowed to be expanded.

Currently, This list of allowed macros contains, `stringify, cfg, core_panic, std_panic, concat, concat_bytes, include, include_str, include_bytes, env` and `option_env`.

Fixes #14177
2024-06-20 08:39:17 +00:00
Lukas Wirth e5d5c7b20a Invert matching on builtin macros in expand_allowed_builtins 2024-06-20 10:31:20 +02:00
bors a17efb9ec9 Auto merge of #17456 - panicbit:remove-cargo-extension-warning, r=Veykril
Remove panicbit.cargo extension warning

A warning was introduced regarding the incompatabilities between `rust-analyzer` and `panicbit.cargo`'s diagnostics / `cargo check` functionality.

This functionality has been removed in the latest version of the cargo extension (`0.3.0`), which is why the warning can be removed now.
2024-06-20 08:25:30 +00:00
Lukas Wirth 2f4e555407 fix: Fix flycheck panicking when cancelled 2024-06-20 10:21:58 +02:00
bors 153a2bab58 Auto merge of #17457 - roife:remove-circle, r=Veykril
fix: ensure there are no cycles in the source_root_parent_map

See #17409

We can view the connections between roots as a graph. The problem is that this graph may contain cycles, so when adding edges, it is necessary to check whether it will lead to a cycle.

Since we ensure that each node has at most one outgoing edge (because each SourceRoot can have only one parent), we can use a disjoint-set to maintain the connectivity between nodes. If an edge’s two nodes belong to the same set, they are already connected.

Additionally, this PR includes the following three changes:

1. Removed the workaround from #17409.
2. Added an optimization: If `map.contains_key(&SourceRootId(*root_id as u32))`, we can skip the current loop iteration since we have already found its parent.
3. Modified the inner loop to iterate in reverse order with `roots[..idx].iter().rev()` at line 319. This ensures that if we are looking for the parent of `a/b/c`, and both `a` and `a/b` meet the criteria, we will choose the longer match (`a/b`).
2024-06-20 07:53:57 +00:00
bors f18fe6c437 Auto merge of #17460 - lnicola:sync-from-rust, r=lnicola
minor: Sync from rust
2024-06-20 06:22:59 +00:00
roife 185971c47d fix: ensure there are no cycles in the source_root_parent_map 2024-06-20 13:46:14 +08:00
Laurențiu Nicola 9d2bb7f40f Merge from rust-lang/rust 2024-06-20 08:03:36 +03:00
Laurențiu Nicola 35d0bcd89f Preparing for merge from rust-lang/rust 2024-06-20 08:03:11 +03:00
bors 3d5d7a24f7 Auto merge of #126308 - scottmcm:ban-some-coercions, r=saethlin
Ban `ArrayToPointer` and `MutToConstPointer` from runtime MIR

Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/CastKind.3A.3APointerCoercion.20in.20Runtime.20MIR/near/443955195>

Apparently MIR borrowck cares about at least one of these for checking variance.

In runtime MIR, though, there's no need for them as `PtrToPtr` does the same thing.

(Banning them simplifies passes like GVN that no longer need to handle multiple cast possibilities.)

r? mir
2024-06-19 22:34:11 +00:00
bors d8a38b0002 Auto merge of #119127 - joboet:array_repeat, r=scottmcm
Implement `array::repeat`

See rust-lang/libs-team#310.

I've decided to make the function use the input value as last element instead of cloning it to every position and dropping it, and to make this part of the API so that callers are not surprised by this behaviour.

TODO: open a tracking issue. I'll wait for the ACP to be accepted, first.

`@rustbot` label +T-libs-api +T-libs
r? libs
2024-06-19 18:47:04 +00:00
bors e95043cf6f Auto merge of #17459 - MariaSolOs:async-compl, r=Veykril
fix(completion): complete async keyword

Fixes #17452

Not entirely confident of the fix here, but my logic is that `async` should in general be offered in similar semantic scenarios as other keywords like `static` or `pub`.
2024-06-19 18:20:20 +00:00
Maria José Solano b4952b20f4 fix(completion): complete async keyword 2024-06-19 11:12:24 -07:00
Scott McMurray e04e35133f bug! more uses of these in runtime stuff 2024-06-19 10:44:01 -07:00
Scott McMurray 4630d1b23b Ban ArrayToPointer and MutToConstPointer from runtime MIR
Apparently MIR borrowck cares about at least one of these for checking variance.

In runtime MIR, though, there's no need for them as `PtrToPtr` does the same thing.

(Banning them simplifies passes like GVN that no longer need to handle multiple cast possibilities.)
2024-06-19 10:44:01 -07:00
bors 5c8459f1ec Auto merge of #126691 - fee1-dead-contrib:rollup-v4vtowh, r=fee1-dead
Rollup of 5 pull requests

Successful merges:

 - #126668 (Remove now NOP attrs `#[rustc_dump{,_env}_program_clauses]`)
 - #126674 (Allow tracing through item_bounds query invocations on opaques)
 - #126675 (Change a `DefineOpaqueTypes::No` to `Yes` in diagnostics code)
 - #126681 (Rework doc-test attribute documentation example)
 - #126684 (Migrate `run-make/glibc-staticlib-args` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-19 16:10:30 +00:00
joboet 0aa3310a9a
update codegen test for array::repeat 2024-06-19 17:48:05 +02:00
joboet e1aacea74d
core: add tracking issue for array::repeat 2024-06-19 17:48:00 +02:00
joboet 1a8b0d7c53
add codegen test for array::repeat 2024-06-19 17:29:54 +02:00
joboet 39a918002e
core: simplify implementation of array::repeat, address other nits 2024-06-19 17:29:54 +02:00
joboet 8aa24572f0
core: implement UncheckedIterator for RepeatN 2024-06-19 17:29:54 +02:00
joboet 3d4f8b1f45
core: implement array::repeat 2024-06-19 17:29:53 +02:00
fee1-dead 9e8a7a87e4
Rollup merge of #126684 - GuillaumeGomez:migrate-run-make-glibc-staticlib-args, r=Kobzol
Migrate `run-make/glibc-staticlib-args` to `rmake.rs`

Part of https://github.com/rust-lang/rust/issues/121876.

r? ``@jieyouxu``
2024-06-19 22:51:06 +08:00
fee1-dead 69e26df5c4
Rollup merge of #126681 - Urgau:rustdoc-deny-doc, r=GuillaumeGomez
Rework doc-test attribute documentation example

This PR change the doc-test attribute documentation example to prefer a more neutral example `deny(dead_code)`, instead of `deny(warnings)`, which is less susceptible to breakage across Rust version.

r? ```@GuillaumeGomez```
2024-06-19 22:51:05 +08:00
fee1-dead e649eca1d2
Rollup merge of #126675 - oli-obk:diagnostics_opaque, r=jackh726
Change a `DefineOpaqueTypes::No` to `Yes` in diagnostics code

Explanation in comments of the function.

r? ```@compiler-errors```

cc https://github.com/rust-lang/rust/issues/116652
2024-06-19 22:51:05 +08:00
fee1-dead cc4ace33cf
Rollup merge of #126674 - oli-obk:tracing_item_bounds, r=lqd
Allow tracing through item_bounds query invocations on opaques

Previously these caused cycles when printing the result of the query.
2024-06-19 22:51:04 +08:00
fee1-dead be3b5663ae
Rollup merge of #126668 - fmease:rm-rustc_dump_program_clauses-attrs, r=fee1-dead
Remove now NOP attrs `#[rustc_dump{,_env}_program_clauses]`

Likely NOP since #113303.

r? `@fee1-dead`
2024-06-19 22:51:03 +08:00
bors 894f7a4ba6 Auto merge of #126678 - nnethercote:fix-duplicated-attrs-on-nt-expr, r=petrochenkov
Fix duplicated attributes on nonterminal expressions

This PR fixes a long-standing bug (#86055) whereby expression attributes can be duplicated when expanded through declarative macros.

First, consider how items are parsed in declarative macros:
```
Items:
- parse_nonterminal
  - parse_item(ForceCollect::Yes)
    - parse_item_
      - attrs = parse_outer_attributes
      - parse_item_common(attrs)
        - maybe_whole!
        - collect_tokens_trailing_token
```
The important thing is that the parsing of outer attributes is outside token collection, so the item's tokens don't include the attributes. This is how it's supposed to be.

Now consider how expression are parsed in declarative macros:
```
Exprs:
- parse_nonterminal
  - parse_expr_force_collect
    - collect_tokens_no_attrs
      - collect_tokens_trailing_token
        - parse_expr
          - parse_expr_res(None)
            - parse_expr_assoc_with
              - parse_expr_prefix
                - parse_or_use_outer_attributes
                - parse_expr_dot_or_call
```
The important thing is that the parsing of outer attributes is inside token collection, so the the expr's tokens do include the attributes, i.e. in `AttributesData::tokens`.

This PR fixes the bug by rearranging expression parsing to that outer attribute parsing happens outside of token collection. This requires a number of small refactorings because expression parsing is somewhat complicated. While doing so the PR makes the code a bit cleaner and simpler, by eliminating `parse_or_use_outer_attributes` and `Option<AttrWrapper>` arguments (in favour of the simpler `parse_outer_attributes` and `AttrWrapper` arguments), and simplifying `LhsExpr`.

r? `@petrochenkov`
2024-06-19 13:58:21 +00:00
panicbit 79b4dec6c4 remove panicbit.cargo extension warning 2024-06-19 15:37:09 +02:00
Guillaume Gomez 0c2bfd913e Migrate run-make/glibc-staticlib-args to rmake.rs 2024-06-19 13:57:55 +02:00
Ishan Jain a2d4e2934e
removed format_args from allowed expansions 2024-06-19 16:58:48 +05:30