Commit Graph

3974 Commits

Author SHA1 Message Date
bjorn3
3669dba8e8 Rustup to rustc 1.78.0-nightly (1a648b397 2024-02-11) 2024-02-12 16:58:51 +00:00
bjorn3
c98301d3b2 Sync from rust 1a648b397d 2024-02-12 15:49:31 +00:00
bors
f90a0b9a18 Auto merge of #120843 - matthiaskrgr:rollup-med37z5, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #113671 (Make privacy visitor use types more (instead of HIR))
 - #120308 (core/time: avoid divisions in Duration::new)
 - #120693 (Invert diagnostic lints.)
 - #120704 (A drive-by rewrite of `give_region_a_name()`)
 - #120809 (Use `transmute_unchecked` in `NonZero::new`.)
 - #120817 (Fix more `ty::Error` ICEs in MIR passes)
 - #120828 (Fix `ErrorGuaranteed` unsoundness with stash/steal.)
 - #120831 (Startup objects disappearing from sysroot)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-02-09 15:34:48 +00:00
Matthias Krüger
55b32315be Rollup merge of #120693 - nnethercote:invert-diagnostic-lints, r=davidtwco
Invert diagnostic lints.

That is, change `diagnostic_outside_of_impl` and `untranslatable_diagnostic` from `allow` to `deny`, because more than half of the compiler has been converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow` attributes, which proves that this change is warranted.

r? ````@davidtwco````
2024-02-09 14:41:50 +01:00
Ben Kimock
caa23f103c Add a new debug_assertions instrinsic (compiler)
And in clippy
2024-02-08 11:49:08 -05:00
Nicholas Nethercote
515ee70efa Invert diagnostic lints.
That is, change `diagnostic_outside_of_impl` and
`untranslatable_diagnostic` from `allow` to `deny`, because more than
half of the compiler has be converted to use translated diagnostics.

This commit removes more `deny` attributes than it adds `allow`
attributes, which proves that this change is warranted.
2024-02-06 13:12:33 +11:00
bors
d631662a56 Auto merge of #117372 - Amanieu:stdarch_update, r=Mark-Simulacrum
Update stdarch submodule

Splits up #27731 into multiple tracking issues.

Closes #27731
2024-02-05 15:41:40 +00:00
bjorn3
cdae185e30 Implement SHA-1 x86 vendor intrinsics 2024-02-01 10:29:51 +00:00
clubby789
b2ff1231dd Remove the abi_amdgpu_kernel feature 2024-01-30 15:46:40 +00:00
Amanieu d'Antras
be4d3fb261 Update ahash dependency to 0.8.7 2024-01-30 03:34:28 +00:00
bjorn3
82d08913d8 Rustup to rustc 1.77.0-nightly (e7bbe8ce9 2024-01-26) 2024-01-27 10:53:32 +00:00
bjorn3
c71356c462 Sync from rust e7bbe8ce93 2024-01-27 10:39:20 +00:00
bjorn3
0061bb7faf Merge commit '3e50cf65025f96854d6597e80449b0d64ad89589' into sync_cg_clif-2024-01-26 2024-01-26 18:33:45 +00:00
bjorn3
3e50cf6502 Rustup to rustc 1.77.0-nightly (5bd5d214e 2024-01-25) 2024-01-26 18:24:04 +00:00
bjorn3
dff600d1d3 Sync from rust 5bd5d214ef 2024-01-26 18:11:31 +00:00
bjorn3
f78617994a Update rand test
This contains a fix for a recently introduced warning.
2024-01-26 18:08:00 +00:00
bjorn3
604c8a7cf8 Accept [u8; N] bitmasks in simd_select_bitmask
Fixes rust-lang/rustc_codegen_cranelift#1446
2024-01-26 14:19:11 +00:00
bjorn3
dc7ed1680c Update to Cranelift 0.104 2024-01-26 11:18:14 +00:00
bjorn3
1fba58ed94 Update actions/checkout and actions/cache 2024-01-26 11:06:55 +00:00
David Tolnay
b192f911d5 Rebase slice_group_by stabilization PR 2024-01-25 22:20:59 -08:00
bors
e8d600fd23 Auto merge of #116167 - RalfJung:structural-eq, r=lcnr
remove StructuralEq trait

The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more.

One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust https://github.com/rust-lang/rust/pull/115893 to check for `Eq`, and rule out float matching for good.

Fixes https://github.com/rust-lang/rust/issues/115881
2024-01-26 00:17:00 +00:00
bjorn3
7d3b29399d Use sess.cfg_version instead of rustc_version_str()
This makes it easier to patch cg_clif to be statically linked as part of
rustc.
2024-01-25 21:21:27 +00:00
bors
50a067d7f8 Auto merge of #119911 - NCGThompson:is-statically-known, r=oli-obk
Replacement of #114390: Add new intrinsic `is_var_statically_known` and optimize pow for powers of two

This adds a new intrinsic `is_val_statically_known` that lowers to [``@llvm.is.constant.*`](https://llvm.org/docs/LangRef.html#llvm-is-constant-intrinsic).` It also applies the intrinsic in the int_pow methods to recognize and optimize the idiom `2isize.pow(x)`. See #114390 for more discussion.

While I have extended the scope of the power of two optimization from #114390, I haven't added any new uses for the intrinsic. That can be done in later pull requests.

Note: When testing or using the library, be sure to use `--stage 1` or higher. Otherwise, the intrinsic will be a noop and the doctests will be skipped. If you are trying out edits, you may be interested in [`--keep-stage 0`](https://rustc-dev-guide.rust-lang.org/building/suggested.html#faster-builds-with---keep-stage).

Fixes #47234
Resolves #114390
`@Centri3`
2024-01-25 05:16:53 +00:00
Ralf Jung
adbc67664b remove StructuralEq trait 2024-01-24 07:56:23 +01:00
Nicholas Thompson
55e04d5236 Further Implement is_val_statically_known 2024-01-23 12:02:31 -05:00
Michael Goulet
0c83e434e1 Do not normalize closure signature when building FnOnce shim 2024-01-22 16:50:30 +00:00
bjorn3
24361a1b99 Fix portable-simd tests 2024-01-21 11:38:13 +00:00
bjorn3
60ef392a2a Rustup to rustc 1.77.0-nightly (4cb17b4e7 2024-01-20) 2024-01-21 11:16:00 +00:00
bjorn3
9ab85888b3 Sync from rust 4cb17b4e78 2024-01-21 10:51:49 +00:00
Matthias Krüger
d390c002ae Rollup merge of #119815 - nagisa:nagisa/polishes-libloading-use-somewhat, r=bjorn3
Format sources into the error message when loading codegen backends

cc https://github.com/rust-lang/rustc_codegen_cranelift/issues/1447
cc `@bjorn3`
2024-01-19 19:27:00 +01:00
Martin Nordholts
f40f996562 compiler: Lower fn call arg spans down to MIR
To enable improved accuracy of diagnostics in upcoming commits.
2024-01-15 19:07:11 +01:00
Simonas Kazlauskas
be1b86fef4 Format sources into the error message when loading codegen backends
cc https://github.com/rust-lang/rustc_codegen_cranelift/issues/1447
2024-01-10 18:00:38 +02:00
Simonas Kazlauskas
c8875309b8 deps: deduplicate the version of libloading used
The changelog can be found here:
https://docs.rs/libloading/latest/libloading/changelog/r0_8_0/index.html
2024-01-10 17:18:10 +02:00
bjorn3
0dc13d7acb Implement _mm_prefetch as nop 2024-01-09 23:38:55 +01:00
Guillaume Gomez
18e12dcf6b Rollup merge of #117556 - obeis:static-mut-ref-lint, r=davidtwco
Disallow reference to `static mut` and adding `static_mut_ref` lint

Closes #114447

r? `@scottmcm`
2024-01-09 13:23:15 +01:00
Matthias Krüger
a2a9032d1b Rollup merge of #118903 - azhogin:azhogin/skip_second_stmt_debuginfo.rs, r=petrochenkov
Improved support of collapse_debuginfo attribute for macros.

Added walk_chain_collapsed function to consider collapse_debuginfo attribute in parent macros in call chain.
Fixed collapse_debuginfo attribute processing for cranelift (there was if/else branches error swap).

cc https://github.com/rust-lang/rust/issues/100758
2024-01-09 00:19:32 +01:00
Andrew Zhogin
2b3cd46832 Improved support of collapse_debuginfo attribute for macros. 2024-01-08 17:47:18 +07:00
Nicholas Nethercote
e6570dcccc Use chaining for DiagnosticBuilder construction and emit.
To avoid the use of a mutable local variable, and because it reads more
nicely.
2024-01-08 15:45:29 +11:00
Obei Sideg
837c0305c6 Update test for E0796 and static_mut_ref lint 2024-01-07 17:29:25 +03:00
bjorn3
f69c2e768f
Merge pull request #1445 from matthiaskrgr/clippy_jan2024
fix a couple of clippy warnings
2024-01-06 15:50:43 +01:00
Matthias Krüger
74987d04fc fix a couple of clippy warnings 2024-01-05 22:40:25 +01:00
bjorn3
b0250fca19
Merge pull request #1444 from Nilstrieb/ra-rustc
Use `rust-analyzer.rustc.source` to get r-a working with rustc
2024-01-04 15:28:36 +01:00
Nilstrieb
6fea128f8c Use rust-analyzer.rustc.source to get r-a working with rustc 2024-01-04 15:24:51 +01:00
bjorn3
b3b36e91c6
Merge pull request #1443 from Nilstrieb/x86-signed-pack
Restructure x86 signed pack instructions
2024-01-03 20:43:24 +01:00
Nilstrieb
22019dbac8 Mention correctness test 2024-01-03 20:28:08 +01:00
Nilstrieb
c8f5d35508 Restructure x86 signed pack instructions
This reduces the amount of duplicated code and the chance for bugs.

I validated the new code for correctness against LLVM using the
following script. It found many bugs in the implementation until I was
finally able to get it correct and passing.

```rust
//! Test for x86 pack instructions. Prints deterministic results, use it to compare backends.
use std::arch::x86_64::{self, __m128i, __m256i};
use rand::{rngs::SmallRng, Rng, SeedableRng};
fn main() {
    let rng = &mut SmallRng::seed_from_u64(123);
    for _ in 0..100_000 {
        unsafe {
            sse_test(rng);
            avx_test(rng);
        }
    }
}
unsafe fn sse_test(rng: &mut SmallRng) {
    print_sse_8(x86_64::_mm_packus_epi16(sse16(rng), sse16(rng)));
    print_sse_8(x86_64::_mm_packs_epi16(sse16(rng), sse16(rng)));
    print_sse_16(x86_64::_mm_packus_epi32(sse32(rng), sse32(rng)));
    print_sse_16(x86_64::_mm_packs_epi32(sse32(rng), sse32(rng)));
}
unsafe fn avx_test(rng: &mut SmallRng) {
    print_avx_8(x86_64::_mm256_packs_epi16(avx16(rng), avx16(rng)));
    print_avx_8(x86_64::_mm256_packs_epi16(avx16(rng), avx16(rng)));
    print_avx_16(x86_64::_mm256_packus_epi32(avx32(rng), avx32(rng)));
    print_avx_16(x86_64::_mm256_packs_epi32(avx32(rng), avx32(rng)));
}
fn print_sse_8(t: __m128i) {
    let ints = unsafe { std::mem::transmute::<_, [i8; 16]>(t) };
    println!("{ints:?}");
}
fn print_sse_16(t: __m128i) {
    let ints = unsafe { std::mem::transmute::<_, [i16; 8]>(t) };
    println!("{ints:?}");
}
fn print_avx_8(t: __m256i) {
    let ints = unsafe { std::mem::transmute::<_, [i8; 32]>(t) };
    println!("{ints:?}");
}
fn print_avx_16(t: __m256i) {
    let ints = unsafe { std::mem::transmute::<_, [i16; 16]>(t) };
    println!("{ints:?}");
}
fn sse16(rand: &mut SmallRng) -> __m128i {
    unsafe { std::mem::transmute([(); 8].map(|()| i16(rand))) }
}
fn sse32(rand: &mut SmallRng) -> __m128i {
    unsafe { std::mem::transmute([(); 4].map(|()| i32(rand))) }
}
fn avx16(rand: &mut SmallRng) -> __m256i {
    unsafe { std::mem::transmute([(); 16].map(|()| i16(rand))) }
}
fn avx32(rand: &mut SmallRng) -> __m256i {
    unsafe { std::mem::transmute([(); 8].map(|()| i32(rand))) }
}
fn i16(rand: &mut SmallRng) -> i16 {
    if rand.gen() {
        rand.gen::<i16>()
    } else {
        rand.gen::<i8>() as i16
    }
}
fn i32(rand: &mut SmallRng) -> i32 {
    if rand.gen() {
        rand.gen::<i32>()
    } else {
        rand.gen::<i16>() as i32
    }
}
```
2024-01-03 20:25:44 +01:00
bjorn3
3b8794edf4 Fix xmm operands in inline assembly 2024-01-03 11:08:32 +00:00
bjorn3
45d8c121ba Return architecturally mandated target features to rustc
In the future the actual target features that Cranelift enables should
be returned here, but for now this works.

Fixes rust-lang/rustc_codegen_cranelift#1438
2024-01-02 21:17:00 +00:00
bjorn3
c427754b52 Add platform support matrix
Fixes rust-lang/rustc_codegen_cranelift#1441
2024-01-02 20:39:31 +00:00
bjorn3
0c72b43614 Merge branch 'sync_from_rust' 2023-12-31 13:31:46 +00:00