Commit graph

14888 commits

Author SHA1 Message Date
León Orell Valerian Liehr
5bd9602e33
Rollup merge of #133583 - tbu-:pr_fix_typo2, r=compiler-errors
Fix type (exit → exist)
2024-12-10 20:16:00 +01:00
Tobias Bucher
bab1fcb30c Fix type (exit → exist) 2024-12-10 16:20:29 +01:00
bors
33c245b9e9 Auto merge of #134125 - fmease:rollup-u38o3ob, r=fmease
Rollup of 11 pull requests

Successful merges:

 - #133478 (jsondocck: Parse, don't validate commands.)
 - #133967 ([AIX] Pass -bnoipath when adding rust upstream dynamic crates)
 - #133970 ([AIX] Replace sa_sigaction with sa_union.__su_sigaction for AIX)
 - #133980 ([AIX] Remove option "-n" from AIX "ln" command)
 - #134008 (Make `Copy` unsafe to implement for ADTs with `unsafe` fields)
 - #134017 (Don't use `AsyncFnOnce::CallOnceFuture` bounds for signature deduction)
 - #134023 (handle cygwin environment in `install::sanitize_sh`)
 - #134041 (Use SourceMap to load debugger visualizer files)
 - #134065 (Move `write_graphviz_results`)
 - #134106 (Add compiler-maintainers who requested to be on review rotation)
 - #134123 (bootstrap: Forward cargo JSON output to stdout, not stderr)

Failed merges:

 - #134120 (Remove Felix from ping groups and review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-10 13:16:09 +00:00
León Orell Valerian Liehr
193a95d30b
Rollup merge of #134017 - compiler-errors:call-once-deduction, r=jieyouxu
Don't use `AsyncFnOnce::CallOnceFuture` bounds for signature deduction

We shouldn't be using `AsyncFnOnce::CallOnceFuture` projection bounds to deduce anything about the return type of an async closure, **only** `AsyncFnOnce::Output`. This was accidental b/c all we were looking at was the def id of the trait, rather than the projection. This PR fixes that.

This doesn't affect stable code, since `CallOnceFuture` bounds cannot be written on stable.

Fixes #134015
2024-12-10 13:51:10 +01:00
León Orell Valerian Liehr
3eaa785daa
Rollup merge of #134008 - jswrenn:unsafe-fields-copy, r=compiler-errors
Make `Copy` unsafe to implement for ADTs with `unsafe` fields

As a rule, the application of `unsafe` to a declaration requires that use-sites of that declaration also entail `unsafe`. For example, a field declared `unsafe` may only be read in the lexical context of an `unsafe` block.

For nearly all safe traits, the safety obligations of fields are explicitly discharged when they are mentioned in method definitions. For example, idiomatically implementing `Clone` (a safe trait) for a type with unsafe fields will require `unsafe` to clone those fields.

Prior to this commit, `Copy` violated this rule. The trait is marked safe, and although it has no explicit methods, its implementation permits reads of `Self`.

This commit resolves this by making `Copy` conditionally safe to implement. It remains safe to implement for ADTs without unsafe fields, but unsafe to implement for ADTs with unsafe fields.

Tracking: #132922

r? ```@compiler-errors```
2024-12-10 13:51:10 +01:00
León Orell Valerian Liehr
ceaca6be47
Rollup merge of #133980 - xingxue-ibm:ln-option-aix, r=jieyouxu
[AIX] Remove option "-n" from AIX "ln" command

The option `-n` for the AIX `ln` command has a different purpose than it does on Linux. On Linux, the `-n` option is used to treat the destination path as normal file if it is a symbolic link to a directory, which is the default behavior of the AIX `ln` command.
2024-12-10 13:51:09 +01:00
León Orell Valerian Liehr
0ff8ee6d7e
Rollup merge of #133970 - xingxue-ibm:sigaction, r=nnethercote
[AIX] Replace sa_sigaction with sa_union.__su_sigaction for AIX

On AIX, the `sa_sigaction` member of `struct sigaction` is accessed as the union member `sa_union.__su_sigaction`.
2024-12-10 13:51:08 +01:00
León Orell Valerian Liehr
4d544d9443
Rollup merge of #134010 - RalfJung:promoted-type-error-ice, r=oli-obk
fix ICE on type error in promoted

Fixes https://github.com/rust-lang/rust/issues/133968

Ensure that when we turn a type error into a "this promoted failed to evaluate" error, we do record this as something that may happen even in "infallible" promoteds.
2024-12-10 08:55:59 +01:00
León Orell Valerian Liehr
b493369df8
Rollup merge of #133946 - Zalathar:ready-first, r=oli-obk
coverage: Prefer to visit nodes whose predecessors have been visited

In coverage instrumentation, we need to traverse the control-flow graph and decide what kind of counter (physical counter or counter-expression) should be used for each node that needs a counter.

The existing traversal order is complex and hard to tweak. This new traversal order tries to be a bit more principled, by always preferring to visit nodes whose predecessors have already been visited, which is a good match for how the counter-creation code ends up dealing with a node's in-edges and out-edges.

For several of the coverage tests, this ends up being a strict improvement in reducing the size of the coverage metadata, and also reducing the number of physical counters needed.

(The new traversal should hopefully also allow some further code simplifications in the future.)

---

This is made possible by the separate simplification pass introduced by #133849. Without that, almost any change to the traversal order ends up increasing the size of the expression table or the number of physical counters.
2024-12-10 08:55:58 +01:00
León Orell Valerian Liehr
94d780d647
Rollup merge of #131558 - sassman:feat/warnin-for-no-mangle-together-with-export-name, r=Urgau
Lint on combining `#[no_mangle]` and `#[export_name]`

This is my very first contribution to the compiler, even though I read the [chapter about lints](https://rustc-dev-guide.rust-lang.org/diagnostics.html) I'm not very certain that this ~~new lint is done right as a builtin lint~~ PR is right. I appreciate any guidance on how to improve the code.

- Add test for issue #47446
- ~~Implement the new lint `mixed_export_name_and_no_mangle` as a builtin lint (not sure if that is the right way to go)~~ Extend `unused_attributes` lint
- Add suggestion how to fix it

<details>

<summary>Old proposed new lint</summary>

> The `mixed_export_name_and_no_mangle` lint detects usage of both `#[export_name]` and `#[no_mangle]` on the same item which results on `#[no_mangle]` being ignored.
>
> *warn-by-default*
>
> ### Example
>
> ```rust
> #[no_mangle] // ignored
> #[export_name = "foo"] // takes precedences
> pub fn bar() {}
> ```
>
> ### Explanation
>
> The compiler will not respect the `#[no_mangle]` attribute when generating the symbol name for the function, as the `#[export_name]` attribute takes precedence. This can lead to confusion and is unnecessary.

</details>
2024-12-10 08:55:54 +01:00
bors
ff7906bfe1 Auto merge of #134096 - fmease:rollup-0asgoo8, r=fmease
Rollup of 9 pull requests

Successful merges:

 - #133996 (Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`)
 - #134012 (Grammar fixes)
 - #134032 (docs: better examples for `std::ops::ControlFlow`)
 - #134040 (bootstrap: print{ln}! -> eprint{ln}! (take 2))
 - #134043 (Add test to check unicode identifier version)
 - #134053 (rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 10))
 - #134055 (interpret: clean up deduplicating allocation functions)
 - #134073 (dataflow_const_prop: do not eval a ptr address in SwitchInt)
 - #134084 (Fix typo in RFC mention 3598 -> 3593)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-10 03:48:20 +00:00
bors
974ccc12e6 Auto merge of #129514 - estebank:default-field-values, r=compiler-errors
Introduce `default_field_values` feature

Initial implementation of `#[feature(default_field_values]`, proposed in https://github.com/rust-lang/rfcs/pull/3681.

We now parse const expressions after a `=` in a field definition, to specify a `struct` field default value.

We now allow `Struct { field, .. }` where there's no base after `..`.

`#[derive(Default)]` now uses the default value if present, continuing to use `Default::default()` if not.

```rust
#[derive(Debug)]
pub struct S;

#[derive(Debug, Default)]
pub struct Foo {
    pub bar: S = S,
    pub baz: i32 = 42 + 3,
}

fn main () {
    let x = Foo { .. };
    let y = Foo::default();
    let z = Foo { baz: 1, .. };

    assert_eq!(45, x.baz);
    assert_eq!(45, y.baz);
    assert_eq!(1, z.baz);
}
```
2024-12-10 00:07:00 +00:00
León Orell Valerian Liehr
cb5f03cbce
Rollup merge of #134073 - DianQK:fix-131227, r=oli-obk
dataflow_const_prop: do not eval a ptr address in SwitchInt

Fixes #131227.
2024-12-09 23:39:07 +01:00
León Orell Valerian Liehr
76fbe8d503
Rollup merge of #134053 - notriddle:notriddle/issue-d, r=GuillaumeGomez
rustdoc: rename `issue-\d+.rs` tests to have meaningful names (part 10)

Follow up https://github.com/rust-lang/rust/pull/130287 et al

As always, it's easier to review the commits one at a time. Don't use the Files Changed tab. It's confusing.
2024-12-09 23:39:06 +01:00
León Orell Valerian Liehr
0cb12f9e84
Rollup merge of #134043 - ehuss:unicode-version, r=jieyouxu
Add test to check unicode identifier version

This adds a test to verify which version of Unicode is used for identifiers. This is part of the language, documented at https://doc.rust-lang.org/nightly/reference/identifiers.html#r-ident.unicode. The version here often changes implicitly due to dependency updates pulling in new versions, and thus we often don't notice it has changed leaving the documentation out of date. The intent here is to have a canary to give us a notification when it changes so that we can update the documentation.
2024-12-09 23:39:05 +01:00
León Orell Valerian Liehr
df5ec039fa
Rollup merge of #133996 - Zalathar:ui-link-native-libs, r=jieyouxu
Move most tests for `-l` and `#[link(..)]` into `tests/ui/link-native-libs`

Tests for the closely-related `-l` flag and `#[link(..)]` attribute are spread across a few different directories, and in some cases have ended up in a test directory intended for other linker-related functionality.

This PR moves most of them into a single `tests/ui/link-native-libs` directory.

---

Part of #133895.

try-job: i686-mingw

r? jieyouxu
2024-12-09 23:39:03 +01:00
Esteban Küber
fa331f4d0d Support x-crate default fields 2024-12-09 21:58:07 +00:00
Esteban Küber
0757641f4d Unconditionally error at definition if default field value has const errors
Emit E0080 always on struct definition with default fields that have unconditional const errors and remove `default_field_always_invalid_const` lint.
2024-12-09 21:58:00 +00:00
Esteban Küber
2d6e763cc6 Disallow #[default] Variant {} regardless of feature flag 2024-12-09 21:55:13 +00:00
Esteban Küber
148a77dfde review comments: rewordings 2024-12-09 21:55:13 +00:00
Esteban Küber
e0752ad257 Provide diagnostic for Struct(a, .., z) expression
People might extrapolate from `Struct { .. }` that `Struct(..)` would work, but it doesn't.
2024-12-09 21:55:12 +00:00
Esteban Küber
550bcae8aa Detect struct S(ty = val);
Emit a specific error for unsupported default field value syntax in tuple structs.
2024-12-09 21:55:12 +00:00
Esteban Küber
9ac95c10c0 Introduce default_field_values feature
Initial implementation of `#[feature(default_field_values]`, proposed in https://github.com/rust-lang/rfcs/pull/3681.

Support default fields in enum struct variant

Allow default values in an enum struct variant definition:

```rust
pub enum Bar {
    Foo {
        bar: S = S,
        baz: i32 = 42 + 3,
    }
}
```

Allow using `..` without a base on an enum struct variant

```rust
Bar::Foo { .. }
```

`#[derive(Default)]` doesn't account for these as it is still gating `#[default]` only being allowed on unit variants.

Support `#[derive(Default)]` on enum struct variants with all defaulted fields

```rust
pub enum Bar {
    #[default]
    Foo {
        bar: S = S,
        baz: i32 = 42 + 3,
    }
}
```

Check for missing fields in typeck instead of mir_build.

Expand test with `const` param case (needs `generic_const_exprs` enabled).

Properly instantiate MIR const

The following works:

```rust
struct S<A> {
    a: Vec<A> = Vec::new(),
}
S::<i32> { .. }
```

Add lint for default fields that will always fail const-eval

We *allow* this to happen for API writers that might want to rely on users'
getting a compile error when using the default field, different to the error
that they would get when the field isn't default. We could change this to
*always* error instead of being a lint, if we wanted.

This will *not* catch errors for partially evaluated consts, like when the
expression relies on a const parameter.

Suggestions when encountering `Foo { .. }` without `#[feature(default_field_values)]`:

 - Suggest adding a base expression if there are missing fields.
 - Suggest enabling the feature if all the missing fields have optional values.
 - Suggest removing `..` if there are no missing fields.
2024-12-09 21:55:01 +00:00
Eric Huss
a97404eee3 Add test to check unicode identifier version 2024-12-09 06:23:59 -08:00
Ralf Jung
ed8ee39930 fix ICE on type error in promoted 2024-12-09 15:17:26 +01:00
DianQK
d0986f45e0
dataflow_const_prop: do not eval a ptr address in SwitchInt 2024-12-09 21:06:29 +08:00
许杰友 Jieyou Xu (Joe)
38bfd88db7 Add regression test for #134060
Mostly just to check that the lint impl doesn't ICE from an easy case.
2024-12-09 17:39:08 +08:00
许杰友 Jieyou Xu (Joe)
1fcbb1e338 Revert #131669 due to ICEs
Revert <https://github.com/rust-lang/rust/pull/131669> due to ICE
reports:

- <https://github.com/rust-lang/rust/issues/134059> (real-world)
- <https://github.com/rust-lang/rust/issues/134060> (fuzzing)

The changes can be re-landed with those cases addressed.

This reverts commit 703bb98230, reversing
changes made to f415c07494.
2024-12-09 17:31:16 +08:00
Michael Howell
b5318549c7 rustdoc: rename issue-\d+.rs tests to have meaningful names 2024-12-08 21:59:23 -07:00
Michael Howell
999aed4bff Add URL to test cases 2024-12-08 21:39:48 -07:00
bors
1b3fb31675 Auto merge of #134052 - matthiaskrgr:rollup-puxwqrk, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #133567 (A bunch of cleanups)
 - #133789 (Add doc alias 'then_with' for `then` method on `bool`)
 - #133880 (Expand home_dir docs)
 - #134036 (crash tests: use individual mir opts instead of mir-opt-level where easily possible)
 - #134045 (Fix some triagebot mentions paths)
 - #134046 (Remove ignored tests for hangs w/ new solver)
 - #134050 (Miri subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-12-09 03:24:24 +00:00
Matthias Krüger
86f3ed3e11
Rollup merge of #134046 - lqd:new-solver-hangs, r=compiler-errors
Remove ignored tests for hangs w/ new solver

As asked on zulip [here](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/needs_help.3A.20look.20through.20compare-mode.20hangs).

As far as I can tell there are no more UI tests that hang anymore, so this removes the ignore directives for the compare mode.

(As I was using `--compare-mode new-solver` and that failed in an obscure way without any info about what to do, I've also fixed its error handling in `compiletest`: it didn't show the invalid `--compare-mode`, nor the valid values one can pass).

r? lcnr
2024-12-09 01:56:35 +01:00
Matthias Krüger
273a359b90
Rollup merge of #134036 - matthiaskrgr:opppt, r=saethlin
crash tests: use individual mir opts instead of mir-opt-level where easily possible

r? `@saethlin`
2024-12-09 01:56:34 +01:00
Matthias Krüger
d2881e4eb5
Rollup merge of #133567 - bjorn3:various_cleanups, r=cjgillot
A bunch of cleanups

These are all extracted from a branch I have to get rid of driver queries. Most of the commits are not directly necessary for this, but were found in the process of implementing the removal of driver queries.

Previous PR: https://github.com/rust-lang/rust/pull/132410
2024-12-09 01:56:32 +01:00
Rémy Rakic
91cf0cb729 bless test expectations
(in a separate commit for easier review, one of them is huge)
2024-12-08 20:21:46 +00:00
Rémy Rakic
95a1351c4a mark previously hanging tests as good to go 2024-12-08 20:21:46 +00:00
Matthias Krüger
1aab767324
Rollup merge of #134024 - jieyouxu:ui-cleanup-2, r=Nadrieril
Advent of `tests/ui` (misc cleanups and improvements) [2/N]

Part of #133895.

Misc improvements to some ui tests immediately under `tests/ui/`.

Best reviewed commit-by-commit. Please see individual commit messages for some further rationale and change summaries.

r? compiler
2024-12-08 17:18:53 +01:00
Matthias Krüger
1868c8f66f
Rollup merge of #133424 - Nadrieril:guard-patterns-parsing, r=fee1-dead
Parse guard patterns

This implements the parsing of [RFC3637 Guard Patterns](https://rust-lang.github.io/rfcs/3637-guard-patterns.html) (see also [tracking issue](https://github.com/rust-lang/rust/issues/129967)). This PR is extracted from https://github.com/rust-lang/rust/pull/129996 with minor modifications.

cc `@max-niederman`
2024-12-08 17:18:50 +01:00
Matthias Krüger
8d5236fa1c crash tests: use individual mir opts instead of mir-opt-level where easily possible 2024-12-08 16:52:32 +01:00
Matthias Krüger
d4b5345248
Rollup merge of #133992 - compiler-errors:walk-fully, r=jieyouxu
Actually walk into lifetimes and attrs in `EarlyContextAndPass`

Visitors that don't also call `walk_*` are kinda a footgun...

I believe all the other early lint functions walk into their types correctly at this point.
2024-12-08 14:28:26 +01:00
Matthias Krüger
a369714a29
Rollup merge of #133767 - estebank:multiple-dep-version-tests, r=Nadrieril
Add more info on type/trait mismatches for different crate versions

When encountering a type or trait mismatch for two types coming from two different crates with the same name, detect if it is either mixing two types/traits from the same crate on different versions:

```
error[E0308]: mismatched types
  --> replaced
   |
LL |     do_something_type(Type);
   |     ----------------- ^^^^ expected `dependency::Type`, found `dep_2_reexport::Type`
   |     |
   |     arguments to this function are incorrect
   |
note: two different versions of crate `dependency` are being used; two types coming from two different versions of the same crate are different types even if they look the same
  --> replaced
   |
LL | pub struct Type(pub i32);
   | ^^^^^^^^^^^^^^^ this is the expected type `dependency::Type`
   |
  ::: replaced
   |
LL | pub struct Type;
   | ^^^^^^^^^^^^^^^ this is the found type `dep_2_reexport::Type`
   |
  ::: replaced
   |
LL | extern crate dep_2_reexport;
   | ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo`
LL | extern crate dependency;
   | ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate
   = help: you can use `cargo tree` to explore your dependency tree
note: function defined here
  --> replaced
   |
LL | pub fn do_something_type(_: Type) {}
   |        ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
  --> replaced
   |
LL |     do_something_trait(Box::new(Type) as Box<dyn Trait2>);
   |     ------------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `dependency::Trait2`, found trait `dep_2_reexport::Trait2`
   |     |
   |     arguments to this function are incorrect
   |
note: two different versions of crate `dependency` are being used; two types coming from two different versions of the same crate are different types even if they look the same
  --> replaced
   |
LL | pub trait Trait2 {}
   | ^^^^^^^^^^^^^^^^ this is the expected trait `dependency::Trait2`
   |
  ::: replaced
   |
LL | pub trait Trait2 {}
   | ^^^^^^^^^^^^^^^^ this is the found trait `dep_2_reexport::Trait2`
   |
  ::: replaced
   |
LL | extern crate dep_2_reexport;
   | ---------------------------- one version of crate `dependency` is used here, as a dependency of crate `foo`
LL | extern crate dependency;
   | ------------------------ one version of crate `dependency` is used here, as a direct dependency of the current crate
   = help: you can use `cargo tree` to explore your dependency tree
note: function defined here
  --> replaced
   |
LL | pub fn do_something_trait(_: Box<dyn Trait2>) {}
   |        ^^^^^^^^^^^^^^^^^^
```

or if it is different crates that were renamed to the same name:

```
error[E0308]: mismatched types
  --> $DIR/type-mismatch-same-crate-name.rs:21:20
   |
LL |         a::try_foo(foo2);
   |         ---------- ^^^^ expected `main:🅰️:Foo`, found a different `main:🅰️:Foo`
   |         |
   |         arguments to this function are incorrect
   |
note: two types coming from two different crates are different types even if they look the same
  --> $DIR/auxiliary/crate_a2.rs:1:1
   |
LL | pub struct Foo;
   | ^^^^^^^^^^^^^^ this is the found type `crate_a2::Foo`
   |
  ::: $DIR/auxiliary/crate_a1.rs:1:1
   |
LL | pub struct Foo;
   | ^^^^^^^^^^^^^^ this is the expected type `crate_a1::Foo`
   |
  ::: $DIR/type-mismatch-same-crate-name.rs:13:17
   |
LL |     let foo2 = {extern crate crate_a2 as a; a::Foo};
   |                 --------------------------- one type comes from crate `crate_a2` is used here, which is renamed locally to `a`
...
LL |         extern crate crate_a1 as a;
   |         --------------------------- one type comes from crate `crate_a1` is used here, which is renamed locally to `a`
note: function defined here
  --> $DIR/auxiliary/crate_a1.rs:10:8
   |
LL | pub fn try_foo(x: Foo){}
   |        ^^^^^^^

error[E0308]: mismatched types
  --> $DIR/type-mismatch-same-crate-name.rs:27:20
   |
LL |         a::try_bar(bar2);
   |         ---------- ^^^^ expected trait `main:🅰️:Bar`, found a different trait `main:🅰️:Bar`
   |         |
   |         arguments to this function are incorrect
   |
note: two types coming from two different crates are different types even if they look the same
  --> $DIR/auxiliary/crate_a2.rs:3:1
   |
LL | pub trait Bar {}
   | ^^^^^^^^^^^^^ this is the found trait `crate_a2::Bar`
   |
  ::: $DIR/auxiliary/crate_a1.rs:3:1
   |
LL | pub trait Bar {}
   | ^^^^^^^^^^^^^ this is the expected trait `crate_a1::Bar`
   |
  ::: $DIR/type-mismatch-same-crate-name.rs:13:17
   |
LL |     let foo2 = {extern crate crate_a2 as a; a::Foo};
   |                 --------------------------- one trait comes from crate `crate_a2` is used here, which is renamed locally to `a`
...
LL |         extern crate crate_a1 as a;
   |         --------------------------- one trait comes from crate `crate_a1` is used here, which is renamed locally to `a`
note: function defined here
  --> $DIR/auxiliary/crate_a1.rs:11:8
   |
LL | pub fn try_bar(x: Box<Bar>){}
   |        ^^^^^^^
```

This new output unifies the E0308 errors detail with the pre-existing E0277 errors, and better differentiates the "`extern crate` renamed" and "same crate, different versions" cases.
2024-12-08 14:28:24 +01:00
Matthias Krüger
5101833d7a
Rollup merge of #133104 - matthiaskrgr:crashtest_debugass_131451.rs, r=saethlin
crashes: add test for #131451

r? `@saethlin`
How do I find out which mir opts are involved here? 😅
2024-12-08 14:28:23 +01:00
Matthias Krüger
703bb98230
Rollup merge of #131669 - niacdoial:linting-ptrdyn-ffi, r=workingjubilee
lint: change help for pointers to dyn types in FFI

### Context
while playing around, I encountered the warning for dyn types in `extern "C"` functions, but even after that I assumed that a (rust) raw pointer could be interpreted in C ('s ABI) as a `void *`... to be fair part of why I ignored the warning is because I wanted to poke at the generated assembly, not make useful code.

### Example

```rust
extern "C"
fn caller(callee: *const dyn Fn(i32)->i32){
    // -- snip --
}
```

old warning:
```
warning: `extern` fn uses type `dyn Fn(i32) -> i32`, which is not FFI-safe
 --> file/name.rs:42:19
   |
42 | fn caller(callee: *const dyn Fn(i32)->i32) {
   |                   ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
  = note: trait objects have no C equivalent
  = note: `#[warn(improper_ctypes_definitions)]` on by default
  ```

new warning:
```
warning: `extern` fn uses type `dyn Fn(i32) -> i32`, which is not FFI-safe
 --> file/name.rs:42:19
   |
42 | fn caller(callee: *const dyn Fn(i32)->i32) -> (){
   |                   ^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
   |
  = note: this pointer to an unsized type contains metadata, which makes it incompatible with a C pointer
  = note: `#[warn(improper_ctypes_definitions)]` on by default
```
2024-12-08 14:28:22 +01:00
Matthias Krüger
159ed85d24 crashes: add test for #131451 2024-12-08 13:09:46 +01:00
许杰友 Jieyou Xu (Joe)
754dec3fbc Adjust atomic-from-mut-not-available.rs
- Introduce two revisions: one for 32-bit x86 vs one for 64-bit x86_64
  and compare & contrast the errors.
- Document the test intention and note its limitations.
2024-12-08 15:32:04 +08:00
许杰友 Jieyou Xu (Joe)
1247f01a3c Move atomic-from-mut-not-available.rs to tests/ui/stdlib-unit-tests/
This test exercises the combined effect of the
`cfg(target_has_atomic_equal_alignment = "...")` implementation in the
compiler as well as the usage of said
`cfg(target_has_atomic_equal_alignment)` in `core`.
2024-12-08 15:32:04 +08:00
许杰友 Jieyou Xu (Joe)
3a33522ca8 Adjust assoc-oddities-3.rs
- Include the original MCVE as reported in
  <https://github.com/rust-lang/rust/issues/28777>.
- Document the intention of the test.
2024-12-08 15:32:04 +08:00
许杰友 Jieyou Xu (Joe)
b815a93614 Move assoc-oddities-3.rs under tests/ui/parser/assoc/
This is where `assoc-oddities-{1,2}.rs` are located, reunite them!
2024-12-08 15:32:04 +08:00
许杰友 Jieyou Xu (Joe)
6959582ac6 Move assoc-lang-items.rs to tests/ui/lang-items/ 2024-12-08 15:32:04 +08:00
许杰友 Jieyou Xu (Joe)
1e3328dd72 Document assoc-lang-items.rs 2024-12-08 15:32:04 +08:00