Commit Graph

286 Commits

Author SHA1 Message Date
sayantn 1fd0311eab Added the `xop` target feature and `xop_target_feature` gate 2024-07-12 23:30:22 +05:30
sayantn ec05c4ea3f Add the feature gate and target-features 2024-07-11 19:00:49 -07:00
Nikita Popov 8a50bcbdce Remove extern "wasm" ABI
Remove the unstable `extern "wasm"` ABI (`wasm_abi` feature tracked
in #83788).

As discussed in https://github.com/rust-lang/rust/pull/127513#issuecomment-2220410679
and following, this ABI is a failed experiment that did not end
up being used for anything. Keeping support for this ABI in LLVM 19
would require us to switch wasm targets to the `experimental-mv`
ABI, which we do not want to do.

It should be noted that `Abi::Wasm` was internally used for two
things: The `-Z wasm-c-abi=legacy` ABI that is still used by
default on some wasm targets, and the `extern "wasm"` ABI. Despite
both being `Abi::Wasm` internally, they were not the same. An
explicit `extern "wasm"` additionally enabled the `+multivalue`
feature.

I've opted to remove `Abi::Wasm` in this patch entirely, instead
of keeping it as an ABI with only internal usage. Both
`-Z wasm-c-abi` variants are now treated as part of the normal
C ABI, just with different different treatment in
adjust_for_foreign_abi.
2024-07-11 12:20:26 +02:00
yukang 81c86ddf8e show fnsig's output when there is difference 2024-07-06 23:29:58 +08:00
Jubilee 853148752f
Rollup merge of #127392 - estebank:arg-type, r=jieyouxu
Use verbose suggestion for changing arg type
2024-07-05 23:23:36 -07:00
Esteban Küber 75692056e1 Use verbose suggestion for changing arg type 2024-07-05 20:58:33 +00:00
Esteban Küber 86a19467c1 Tweak `-1 as usize` suggestion
When writing a negative unsigned integer literal, use a verbose suggestion and account for `as` casting.
2024-07-05 00:52:01 +00:00
Ding Xiang Fei 0b4edb2487
reject SmartPointer constructions not serving the purpose 2024-07-04 16:41:23 +08:00
Matthias Krüger 33e9f25e91
Rollup merge of #127092 - compiler-errors:rtn-dots-redux, r=estebank
Change return-type-notation to use `(..)`

Aligns the syntax with the current wording of [RFC 3654](https://github.com/rust-lang/rfcs/pull/3654). Also implements rustfmt support (along with making a match exhaustive).

Tracking:
* https://github.com/rust-lang/rust/issues/109417
2024-07-03 23:30:07 +02:00
Santiago Pastorino a62cbda57e
Add feature diagnostic for unsafe_extern_blocks 2024-06-28 23:13:33 -03:00
Michael Goulet b1a0c0b123 Change RTN to use .. again 2024-06-28 14:20:43 -04:00
Matthias Krüger 02629325f6
Rollup merge of #124741 - nebulark:patchable-function-entries-pr, r=estebank,workingjubilee
patchable-function-entry: Add unstable compiler flag and attribute

Tracking issue: #123115

Add the -Z patchable-function-entry compiler flag and the #[patchable_function_entry(prefix_nops = m, entry_nops = n)] attribute.
Rebased and adjusted the canditate implementation to match changes in the RFC.
2024-06-28 08:34:07 +02:00
Florian Schmiderer 7c56398e91 Updated code for changes to RFC, added additional error handling, added
tests
2024-06-25 19:00:02 +02:00
Matthew Maurer 9b0ae75ecc Support `#[patchable_function_entries]`
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered)

TODO before submission:
* Needs an RFC
* Improve error reporting for malformed attributes
2024-06-25 18:23:41 +02:00
xFrednet 8b14e23dce
RFC 2383: Stabilize `lint_reasons` 🎉 2024-06-25 17:22:22 +02:00
bors d929a42a66 Auto merge of #125741 - petrochenkov:atvisord, r=davidtwco
ast: Standardize visiting order for attributes and node IDs

This should only affect `macro_rules` scopes and order of diagnostics.

Also add a deprecation lint for `macro_rules` called outside of their scope, like in https://github.com/rust-lang/rust/issues/124535.
2024-06-25 11:48:14 +00:00
Vadim Petrochenkov c4c7859e40 resolve: Implement a lint for out-of-scope use of `macro_rules` 2024-06-24 17:12:08 +03:00
Vadim Petrochenkov 0195758c1a ast: Standardize visiting order for attributes and node IDs 2024-06-24 16:08:51 +03:00
Xiangfei Ding f1be59fa72
SmartPointer derive-macro
Co-authored-by: Wedson Almeida Filho <walmeida@microsoft.com>
2024-06-24 03:03:34 +08:00
Michael Goulet ffd72b1700 Fix remaining cases 2024-06-21 19:00:18 -04:00
Michael Goulet 108b3f214a Properly gate `safe` keyword in pre-expansion 2024-06-20 14:14:49 -04:00
许杰友 Jieyou Xu (Joe) 8eb2e5f4c8
Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco
Place tail expression behind terminating scope

This PR implements #123739 so that we can do further experiments in nightly.

A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following.
```rust
match into_async_iter($iter_expr) {
  ref mut iter => match unsafe { Pin::unchecked_new(iter) } {
    ...
  }
}
```
2024-06-19 01:51:38 +01:00
Michael Goulet b1efe1ab5d Rework precise capturing syntax 2024-06-17 22:35:25 -04:00
Ding Xiang Fei 0f8c3f7882
tail expression behind terminating scope 2024-06-18 04:14:43 +08:00
Caio 4b82afb40c Add a new concat metavar expr 2024-06-13 22:12:26 -03:00
Matthias Krüger 246fc285de
Rollup merge of #126155 - Zalathar:run-make-fulldeps, r=onur-ozkan
Remove empty test suite `tests/run-make-fulldeps`

After #109770, there were only a handful of tests left in the run-make-fulldeps suite.

As of #126111, there are no longer *any* run-make-fulldeps tests, so now we can:

- Remove the directory
- Remove related bootstrap/compiletest code
- Remove various other references in CI scripts and documentation.

By removing this suite, we also no longer need to worry about discrepancies between it and ui-fulldeps, and we don't have to worry about porting tests from Makefile to [rmake](https://github.com/rust-lang/rust/issues/121876) (or whether rmake even works with fulldeps).
2024-06-09 10:17:09 +02:00
Zalathar 92a56ff291 Remove useless feature gate test for `#[feature(extern_prelude)]`
This test never actually checked anything useful, so presumably it only existed
to silence the tidy check for feature gate tests, with the real checks being
performed elsewhere (in tests that have since been deleted).
2024-06-09 12:49:49 +10:00
Ralf Jung eb584a23bf offset_of: allow (unstably) taking the offset of slice tail fields 2024-06-08 18:17:55 +02:00
carbotaniuman 67f5dd1ef1 Parse unsafe attributes 2024-06-06 20:26:27 -05:00
bors 2d28b6384e Auto merge of #124482 - spastorino:unsafe-extern-blocks, r=oli-obk
Unsafe extern blocks

This implements RFC 3484.

Tracking issue #123743 and RFC https://github.com/rust-lang/rfcs/pull/3484

This is better reviewed commit by commit.
2024-06-06 08:14:58 +00:00
Matthias Krüger 2611b292c4
Rollup merge of #125168 - Jules-Bertholet:match-ergonomics-2024-align-with-rfc, r=Nadrieril
Match ergonomics 2024: align implementation with RFC

- Remove eat-two-layers (`ref_pat_everywhere`)
- Consolidate `mut_preserve_binding_mode_2024` into `ref_pat_eat_one_layer_2024`
- `&mut` no longer peels off `&`
- Apply "no `ref mut` behind `&`" rule on all editions with `ref_pat_eat_one_layer_2024`
- Require `mut_ref` feature gate for all mutable by-reference bindings

r? ``@Nadrieril``

cc https://github.com/rust-lang/rust/issues/123076

``@rustbot`` label A-edition-2024 A-patterns
2024-06-06 04:17:26 +02:00
Santiago Pastorino 0380321e78
Add unsafe_extern_blocks feature flag 2024-06-05 09:35:57 -03:00
许杰友 Jieyou Xu (Joe) aa13b892c7
Rollup merge of #124486 - beetrees:vectorcall-tracking-issue, r=ehuss
Add tracking issue and unstable book page for `"vectorcall"` ABI

Originally added in 2015 by #30567, the Windows `"vectorcall"` ABI didn't have a tracking issue until now.

Tracking issue: #124485
2024-06-04 08:25:46 +01:00
bors 1d52972dd8 Auto merge of #125778 - estebank:issue-67100, r=compiler-errors
Use parenthetical notation for `Fn` traits

Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`.

Address #67100:

```
error[E0277]: expected a `Fn()` closure, found `F`
 --> file.rs:6:13
  |
6 |     call_fn(f)
  |     ------- ^ expected an `Fn()` closure, found `F`
  |     |
  |     required by a bound introduced by this call
  |
  = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `call_fn`
 --> file.rs:1:15
  |
1 | fn call_fn<F: Fn() -> ()>(f: &F) {
  |               ^^^^^^^^^^ required by this bound in `call_fn`
help: consider further restricting this bound
  |
5 | fn call_any<F: std::any::Any + Fn()>(f: &F) {
  |                              ++++++
```
2024-06-03 08:14:03 +00:00
Matthias Krüger 379233242b
Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, 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-31 08:50:22 +02:00
León Orell Valerian Liehr 34c56c45cf
Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup 2024-05-30 22:52:33 +02:00
Esteban Küber e6bd6c2044 Use parenthetical notation for `Fn` traits
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`.

Fix #67100:

```
error[E0277]: expected a `Fn()` closure, found `F`
 --> file.rs:6:13
  |
6 |     call_fn(f)
  |     ------- ^ expected an `Fn()` closure, found `F`
  |     |
  |     required by a bound introduced by this call
  |
  = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `call_fn`
 --> file.rs:1:15
  |
1 | fn call_fn<F: Fn() -> ()>(f: &F) {
  |               ^^^^^^^^^^ required by this bound in `call_fn`
help: consider further restricting this bound
  |
5 | fn call_any<F: std::any::Any + Fn()>(f: &F) {
  |                              ++++++
```
2024-05-29 22:26:54 +00:00
Vadim Petrochenkov 6e67eaa311 ast: Revert a breaking attribute visiting order change 2024-05-29 21:55:24 +03:00
许杰友 Jieyou Xu (Joe) 7e441a11a1
Rollup merge of #124320 - Urgau:print-check-cfg, r=petrochenkov
Add `--print=check-cfg` to get the expected configs

This PR adds a new `--print` variant `check-cfg` to get the expected configs.

Details and rational can be found on the MCP: https://github.com/rust-lang/compiler-team/issues/743

``@rustbot`` label +F-check-cfg +S-waiting-on-MCP
r? ``@petrochenkov``
2024-05-29 03:25:07 +01:00
bors 791adf759c Auto merge of #124417 - Xiretza:translate-early-lints, r=fmease
Make early lints translatable

<del>Requires https://github.com/projectfluent/fluent-rs/pull/353.</del> 5134a04eaa

r? diagnostics
2024-05-21 21:36:09 +00:00
Xiretza 8004e6a379 Make early lints translatable 2024-05-21 20:16:39 +00:00
Jubilee Young d89500843c Move 100 entries from tests/ui into subdirs
- Move super-fast-paren-parsing test into ui/parser
- Move stmt_expr_attrs test into ui/feature-gates
- Move macro tests into ui/macros
- Move global_asm tests into ui/asm
- Move env tests into ui/process
- Move xcrate tests into ui/cross-crate
- Move unop tests into ui/unop
- Move backtrace tests into ui/backtrace
- Move check-static tests into ui/statics
- Move expr tests into ui/expr
- Move optimization fuel tests into ui/fuel
- Move ffi attribute tests into ui/ffi-attrs
- Move suggestion tests into ui/suggestions
- Move main tests into ui/fn-main
- Move lint tests into ui/lint
- Move repr tests into ui/repr
- Move intrinsics tests into ui/intrinsics
- Move tool lint tests into ui/tool-attributes
- Move return tests into ui/return
- Move pattern tests into ui/patttern
- Move range tests into ui/range
- Move foreign-fn tests into ui/foreign
- Move orphan-check tests into ui/coherence
- Move inference tests into ui/inference
- Reduce ROOT_ENTRY_LIMIT
2024-05-20 19:55:59 -07:00
Matthias Krüger 8903de31ca
Rollup merge of #124050 - saethlin:less-sysroot-libc, r=ChrisDenton
Remove libc from MSVC targets

``@ChrisDenton`` started working on a project to remove libc from Windows MSVC targets. I'm completing that work here.

The primary change is to cfg out the dependency in `library/`. And then there's a lot of test patching. Happy to separate this more if people want.
2024-05-21 00:47:00 +02:00
Matthias Krüger a79737c3f0
Rollup merge of #125314 - jdonszelmann:global-registration-feature-gate, r=pnkfelix
Add an experimental feature gate for global registration

See #125119 for the tracking issue.
2024-05-20 18:13:49 +02:00
Ben Kimock f45a7a291c Fix feature-gates/rustc-private.rs 2024-05-20 11:13:10 -04:00
jdonszelmann 1d9757cd84
add todo test for feature gate 2024-05-20 09:18:49 +02:00
Matthias Krüger e62688eb96
Rollup merge of #123694 - Xiretza:expand-diagnostics, r=compiler-errors
expand: fix minor diagnostics bug

The error mentions `///`, when it's actually `//!`:

```
error[E0658]: attributes on expressions are experimental
 --> test.rs:4:9
  |
4 |         //! wah
  |         ^^^^^^^
  |
  = note: see issue https://github.com/rust-lang/rust/issues/15701 <https://github.com/rust-lang/rust/issues/15701> for more information
  = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
  = help: `///` is for documentation comments. For a plain comment, use `//`.
```
2024-05-17 07:20:56 +02:00
Jules Bertholet a32fb2f8aa
Remove `ref_pat_everywhere` 2024-05-15 16:06:04 -04:00
jdonszelmann 42119ff45c
create a feature gate 2024-05-14 16:11:26 +02:00
bors 80420a693f Auto merge of #124747 - MasterAwesome:master, r=davidtwco
Support Result<T, E> across FFI when niche optimization can be used (v2)

This PR is identical to #122253, which was approved and merged but then removed from master by a force-push due to a [CI bug](https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/ci.20broken.3F).

r? ghost

Original PR description:

---

Allow allow enums like `Result<T, E>` to be used across FFI if the T/E can be niche optimized and the non-niche-optimized type is FFI safe.

Implementation of https://github.com/rust-lang/rfcs/pull/3391
Tracking issue: https://github.com/rust-lang/rust/issues/110503

Additional ABI and codegen tests were added in https://github.com/rust-lang/rust/pull/115372
2024-05-06 00:55:49 +00:00