Skip to content

Commit aa76491

Browse files
committed
Fix
1 parent 56aa312 commit aa76491

File tree

10 files changed

+62
-73
lines changed

10 files changed

+62
-73
lines changed

compiler/rustc_mir_transform/src/mono_checks/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,12 @@ pub(super) fn check_mono_item<'tcx>(
1919
}
2020

2121
pub(super) fn provide(providers: &mut Providers) {
22-
*providers = Providers { skip_move_check_fns: move_check::skip_move_check_fns, ..*providers }
22+
*providers = Providers {
23+
skip_move_check_fns: move_check::skip_move_check_fns,
24+
check_mono_item: |tcx, instance| {
25+
let body = tcx.codegen_mir(instance);
26+
check_mono_item(tcx, instance, body)
27+
},
28+
..*providers
29+
}
2330
}

compiler/rustc_monomorphize/src/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,7 @@ fn collect_items_of_instance<'tcx>(
12321232
mode: CollectionMode,
12331233
) -> (MonoItems<'tcx>, MonoItems<'tcx>) {
12341234
// This item is getting monomorphized, do mono-time checks.
1235-
tcx.ensure_ok().check_mono_item(instance);
1235+
//tcx.ensure_ok().check_mono_item(instance);
12361236

12371237
let body = tcx.instance_mir(instance.def);
12381238
// Naively, in "used" collection mode, all functions get added to *both* `used_items` and

tests/ui/abi/simd-abi-checks-avx.stderr

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,35 @@
1+
error: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
2+
--> $DIR/simd-abi-checks-avx.rs:14:1
3+
|
4+
LL | unsafe extern "C" fn w(_: Wrapper) {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
6+
|
7+
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
8+
9+
error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
10+
--> $DIR/simd-abi-checks-avx.rs:19:1
11+
|
12+
LL | unsafe extern "C" fn f(_: __m256) {
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
14+
|
15+
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
16+
17+
error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
18+
--> $DIR/simd-abi-checks-avx.rs:24:1
19+
|
20+
LL | unsafe extern "C" fn g() -> __m256 {
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
22+
|
23+
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
24+
25+
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
26+
--> $DIR/simd-abi-checks-avx.rs:53:8
27+
|
28+
LL | || g()
29+
| ^^^ function called here
30+
|
31+
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
32+
133
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
234
--> $DIR/simd-abi-checks-avx.rs:59:11
335
|
@@ -54,43 +86,5 @@ LL | some_extern();
5486
|
5587
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
5688

57-
error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
58-
--> $DIR/simd-abi-checks-avx.rs:24:1
59-
|
60-
LL | unsafe extern "C" fn g() -> __m256 {
61-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
62-
|
63-
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
64-
65-
error: this function definition uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
66-
--> $DIR/simd-abi-checks-avx.rs:19:1
67-
|
68-
LL | unsafe extern "C" fn f(_: __m256) {
69-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
70-
|
71-
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
72-
73-
error: this function definition uses SIMD vector type `Wrapper` which (with the chosen ABI) requires the `avx` target feature, which is not enabled
74-
--> $DIR/simd-abi-checks-avx.rs:14:1
75-
|
76-
LL | unsafe extern "C" fn w(_: Wrapper) {
77-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function defined here
78-
|
79-
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
80-
81-
error: this function call uses SIMD vector type `std::arch::x86_64::__m256` which (with the chosen ABI) requires the `avx` target feature, which is not enabled in the caller
82-
--> $DIR/simd-abi-checks-avx.rs:53:8
83-
|
84-
LL | || g()
85-
| ^^^ function called here
86-
|
87-
= help: consider enabling it globally (`-C target-feature=+avx`) or locally (`#[target_feature(enable="avx")]`)
88-
89-
note: the above error was encountered while instantiating `fn in_closure::{closure#0}`
90-
--> $DIR/simd-abi-checks-avx.rs:81:9
91-
|
92-
LL | in_closure()();
93-
| ^^^^^^^^^^^^^^
94-
9589
error: aborting due to 11 previous errors
9690

tests/ui/abi/simd-abi-checks-s390x.z13_no_vector.stderr

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
warning: unstable feature specified for `-Ctarget-feature`: `vector`
2+
|
3+
= note: this feature is not stably supported; its behavior can change in the future
4+
15
error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
26
--> $DIR/simd-abi-checks-s390x.rs:38:1
37
|
@@ -82,5 +86,5 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>)
8286
|
8387
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
8488

85-
error: aborting due to 10 previous errors
89+
error: aborting due to 10 previous errors; 1 warning emitted
8690

tests/ui/abi/simd-abi-checks-s390x.z13_soft_float.stderr

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
warning: unstable feature specified for `-Ctarget-feature`: `vector`
2+
|
3+
= note: this feature is not stably supported; its behavior can change in the future
4+
5+
warning: unknown and unstable feature specified for `-Ctarget-feature`: `soft-float`
6+
|
7+
= note: it is still passed through to the codegen backend, but use of this feature might be unsound and the behavior of this feature can change in the future
8+
= help: consider filing a feature request
9+
110
error: this function definition uses SIMD vector type `i8x8` which (with the chosen ABI) requires the `vector` target feature, which is not enabled
211
--> $DIR/simd-abi-checks-s390x.rs:38:1
312
|
@@ -82,5 +91,5 @@ LL | extern "C" fn vector_transparent_wrapper_arg(x: TransparentWrapper<i8x16>)
8291
|
8392
= help: consider enabling it globally (`-C target-feature=+vector`) or locally (`#[target_feature(enable="vector")]`)
8493

85-
error: aborting due to 10 previous errors
94+
error: aborting due to 10 previous errors; 2 warnings emitted
8695

tests/ui/consts/mono-reachable-invalid-const.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@ error[E0080]: evaluation of `Bar::<0>::ASSERT` failed
44
LL | ["oops"][b];
55
| ^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
66

7-
note: erroneous constant encountered
8-
--> $DIR/mono-reachable-invalid-const.rs:9:9
9-
|
10-
LL | ["oops"][b];
11-
| ^^^^^^^^^^^
12-
137
note: erroneous constant encountered
148
--> $DIR/mono-reachable-invalid-const.rs:14:19
159
|

tests/ui/inline-const/const-expr-generic-err.stderr

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ error[E0080]: evaluation of `bar::<0>::{constant#0}` failed
2222
LL | const { N - 1 }
2323
| ^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow
2424

25-
note: erroneous constant encountered
26-
--> $DIR/const-expr-generic-err.rs:9:13
27-
|
28-
LL | const { N - 1 }
29-
| ^^^^^
30-
3125
note: erroneous constant encountered
3226
--> $DIR/const-expr-generic-err.rs:9:5
3327
|

tests/ui/layout/post-mono-layout-cycle.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct Wrapper<T: Trait> {
1414
}
1515

1616
fn abi<T: Trait>(_: Option<Wrapper<T>>) {}
17+
//~^ ERROR: a cycle occurred during layout computation
1718

1819
fn indirect<T: Trait>() {
1920
abi::<T>(None);

tests/ui/layout/post-mono-layout-cycle.stderr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ error[E0391]: cycle detected when computing layout of `Wrapper<()>`
55
= note: cycle used when computing layout of `core::option::Option<Wrapper<()>>`
66
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
77

8-
note: the above error was encountered while instantiating `fn abi::<()>`
9-
--> $DIR/post-mono-layout-cycle.rs:19:5
8+
error: a cycle occurred during layout computation
9+
--> $DIR/post-mono-layout-cycle.rs:16:1
1010
|
11-
LL | abi::<T>(None);
12-
| ^^^^^^^^^^^^^^
11+
LL | fn abi<T: Trait>(_: Option<Wrapper<T>>) {}
12+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1313

14-
error: aborting due to 1 previous error
14+
error: aborting due to 2 previous errors
1515

1616
For more information about this error, try `rustc --explain E0391`.

tests/ui/structs/default-field-values/post-mono.indirect.stderr

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,6 @@ error[E0080]: evaluation of `Z::<1>::post_mono::{constant#0}` failed
44
LL | post_mono: usize = X / 0,
55
| ^^^^^ attempt to divide `1_usize` by zero
66

7-
note: erroneous constant encountered
8-
--> $DIR/post-mono.rs:7:24
9-
|
10-
LL | post_mono: usize = X / 0,
11-
| ^^^^^
12-
13-
note: erroneous constant encountered
14-
--> $DIR/post-mono.rs:7:24
15-
|
16-
LL | post_mono: usize = X / 0,
17-
| ^^^^^
18-
|
19-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
20-
217
note: erroneous constant encountered
228
--> $DIR/post-mono.rs:12:19
239
|

0 commit comments

Comments
 (0)