Commit Graph

4064 Commits

Author SHA1 Message Date
bjorn3
fa9cce061e Sync from rust 3cdd004e55 2023-12-30 11:00:12 +00:00
Michael Goulet
6b1a3ad4a6 Remove movability from TyKind::Coroutine 2023-12-28 16:35:01 +00:00
bjorn3
1dbb249844 Rustup to rustc 1.77.0-nightly (89e2160c4 2023-12-27) 2023-12-28 16:26:57 +00:00
bjorn3
4c0ad606d0 Sync from rust 89e2160c4c 2023-12-28 15:55:42 +00:00
bjorn3
e101a1bbb7 Avoid warning about the jobserver fd not being open for recursive rustc calls for inline asm
Fixes rust-lang/rustc_codegen_cranelift#1437
2023-12-26 11:25:52 +00:00
bors
bcae781754 Auto merge of #119146 - nnethercote:rm-DiagCtxt-api-duplication, r=compiler-errors
Remove `DiagCtxt` API duplication

`DiagCtxt` defines the internal API for creating and emitting diagnostics: methods like `struct_err`, `struct_span_warn`, `note`, `create_fatal`, `emit_bug`. There are over 50 methods.

Some of these methods are then duplicated across several other types: `Session`, `ParseSess`, `Parser`, `ExtCtxt`, and `MirBorrowckCtxt`. `Session` duplicates the most, though half the ones it does are unused. Each duplicated method just calls forward to the corresponding method in `DiagCtxt`. So this duplication exists to (in the best case) shorten chains like `ecx.tcx.sess.parse_sess.dcx.emit_err()` to `ecx.emit_err()`.

This API duplication is ugly and has been bugging me for a while. And it's inconsistent: there's no real logic about which methods are duplicated, and the use of `#[rustc_lint_diagnostic]` and `#[track_caller]` attributes vary across the duplicates.

This PR removes the duplicated API methods and makes all diagnostic creation and emission go through `DiagCtxt`. It also adds `dcx` getter methods to several types to shorten chains. This approach scales *much* better than API duplication; indeed, the PR adds `dcx()` to numerous types that didn't have API duplication: `TyCtxt`, `LoweringCtxt`, `ConstCx`, `FnCtxt`, `TypeErrCtxt`, `InferCtxt`, `CrateLoader`, `CheckAttrVisitor`, and `Resolver`. These result in a lot of changes from `foo.tcx.sess.emit_err()` to `foo.dcx().emit_err()`. (You could do this with more types, but it gets into diminishing returns territory for types that don't emit many diagnostics.)

After all these changes, some call sites are more verbose, some are less verbose, and many are the same. The total number of lines is reduced, mostly because of the removed API duplication. And consistency is increased, because calls to `emit_err` and friends are always preceded with `.dcx()` or `.dcx`.

r? `@compiler-errors`
2023-12-26 02:24:39 +00:00
bjorn3
653121cd38 Fix borked subtree syncs 2023-12-24 14:38:37 +00:00
bjorn3
39f0dac77d Merge branch 'sync_from_rust' 2023-12-24 14:37:13 +00:00
bjorn3
7325d0de63 Merge commit '26c02eb2904da9a53d2220d4f3069b19a3c81d3d' into sync_cg_clif-2023-12-24 2023-12-24 14:35:19 +00:00
bjorn3
26c02eb290 Rustup to rustc 1.77.0-nightly (2d7be7393 2023-12-23) 2023-12-24 14:26:46 +00:00
bjorn3
23e26ca386 Sync from rust 2d7be73931 2023-12-24 14:20:28 +00:00
Nicholas Nethercote
93c86f78b2 Remove more Session methods that duplicate DiagCtxt methods. 2023-12-24 08:17:47 +11:00
Nicholas Nethercote
7e213fe428 Remove Session methods that duplicate DiagCtxt methods.
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
Michael Goulet
bfda19d5bd Rollup merge of #119171 - nnethercote:cleanup-errors-4, r=compiler-errors
Cleanup error handlers: round 4

More `rustc_errors` cleanups. A sequel to #118933.

r? `@compiler-errors`
2023-12-22 21:41:03 -05:00
Nicholas Nethercote
b94a2a1991 Rename EarlyDiagCtxt methods to match DiagCtxt.
- `early_error_no_abort` -> `early_err`
- `early_error` -> `early_fatal`
- `early_struct_error` -> `early_struct_fatal`
2023-12-23 13:23:28 +11:00
bjorn3
289a274036 Disable a rustc test that depends on -Cpanic=unwind 2023-12-22 11:58:54 +00:00
bjorn3
e935766d57 Ignore a rustc test that needs LTO support 2023-12-22 11:37:25 +00:00
bjorn3
3847a018d5 Update Cranelift to 0.103 2023-12-22 11:07:03 +00:00
Pietro Albini
71899c3e23 update cfg(bootstrap)s 2023-12-22 11:14:11 +01:00
bjorn3
dab8395deb Implement simd_masked_store 2023-12-19 19:04:40 +00:00
bjorn3
c7b4e03945 Merge branch 'sync_from_rust' 2023-12-19 13:51:33 +00:00
bjorn3
a4be90ed16 Merge commit '3a9bf729322fb5035518f99b9d76a742bf7c124e' into sync_cg_clif-2023-12-19 2023-12-19 12:46:39 +00:00
bjorn3
3a9bf72932 Rustup to rustc 1.76.0-nightly (3f28fe133 2023-12-18) 2023-12-19 12:37:20 +00:00
bjorn3
4a1466ad7a Sync from rust 3f28fe1334 2023-12-19 12:29:54 +00:00
bjorn3
9d98f79c53 Rustup to rustc 1.76.0-nightly (6a6287132 2023-12-17) 2023-12-18 18:31:49 +00:00
bjorn3
f6c0006b2a Sync from rust 6a62871320 2023-12-18 18:24:49 +00:00
bjorn3
973dd562e8 fix computing the offset of an unsized field in a packed struct
cc rust-lang/rust#118540
Fixes rust-lang/rustc_codegen_cranelift#1435
2023-12-18 18:12:29 +00:00
bjorn3
1ab05b6cbe fix dynamic size/align computation logic for packed types with dyn trait tail
cc rust-lang/rust#118538
2023-12-18 16:13:54 +00:00
bjorn3
c4567c1841 Implement has_ptr_meta without computing type layout
This matches type_has_metadata in cg_ssa and doesn't require computing
the layout of the type. It is also a bit faster.
2023-12-18 15:24:06 +00:00
bjorn3
697aa0a320 Fix test for size_of_val and align_of_val panicking on extern types 2023-12-18 15:15:35 +00:00
bjorn3
fdcf56c5b7 Panic for size_of_val and align_of_val of extern type
cc rust-lang/rust#118534
2023-12-18 15:09:41 +00:00
Nicholas Nethercote
eeb3db1130 Rename many DiagCtxt and EarlyDiagCtxt locals. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote
8b5a5daad4 Rename many DiagCtxt arguments. 2023-12-18 16:06:22 +11:00
Nicholas Nethercote
b60e208549 Rename Session::span_diagnostic as Session::dcx. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote
b44315c34c Rename EarlyErrorHandler as EarlyDiagCtxt. 2023-12-18 16:06:21 +11:00
Nicholas Nethercote
576b9213b3 Rename Handler as DiagCtxt. 2023-12-18 16:06:19 +11:00
lcnr
89ab75e856 update use of feature flags 2023-12-14 15:22:37 +01:00
bjorn3
b1c925ba1a Rustup to rustc 1.76.0-nightly (eeff92ad3 2023-12-13) 2023-12-14 13:49:53 +00:00
bjorn3
bb7a126ecd Sync from rust eeff92ad32 2023-12-14 13:26:46 +00:00
bjorn3
45fab3a8bb Rustup to rustc 1.76.0-nightly (3340d49d2 2023-12-12) 2023-12-13 19:10:11 +00:00
bjorn3
b1cd90a423 Sync from rust 3340d49d22 2023-12-13 18:42:21 +00:00
bors
e3d2831ff4 Auto merge of #118534 - RalfJung:extern-type-size-of-val, r=WaffleLapkin
codegen: panic when trying to compute size/align of extern type

The alignment is also computed when accessing a field of extern type at non-zero offset, so we also panic in that case.

Previously `size_of_val` worked because the code path there assumed that "thin pointer" means "sized". But that's not true any more with extern types. The returned size and align are just blatantly wrong, so it seems better to panic than returning wrong results. We use a non-unwinding panic since code probably does not expect size_of_val to panic.
2023-12-13 08:33:05 +00:00
bjorn3
7ec47d1290 Fix rustc test suite 2023-12-12 12:47:28 +00:00
bjorn3
ace694cf83 Rustup to rustc 1.76.0-nightly (06e02d5b2 2023-12-09) 2023-12-12 12:36:10 +00:00
Ralf Jung
aa3dc4c225 remove a cranelift test that doesn't make sense any more 2023-12-12 08:15:17 +01:00
bors
b5c0dd6da2 Auto merge of #117758 - Urgau:lint_pointer_trait_comparisons, r=davidtwco
Add lint against ambiguous wide pointer comparisons

This PR is the resolution of https://github.com/rust-lang/rust/issues/106447 decided in https://github.com/rust-lang/rust/issues/117717 by T-lang.

## `ambiguous_wide_pointer_comparisons`

*warn-by-default*

The `ambiguous_wide_pointer_comparisons` lint checks comparison of `*const/*mut ?Sized` as the operands.

### Example

```rust
let ab = (A, B);
let a = &ab.0 as *const dyn T;
let b = &ab.1 as *const dyn T;

let _ = a == b;
```

### Explanation

The comparison includes metadata which may not be expected.

-------

This PR also drops `clippy::vtable_address_comparisons` which is superseded by this one.

~~One thing: is the current naming right? `invalid` seems a bit too much.~~

Fixes https://github.com/rust-lang/rust/issues/117717
2023-12-11 14:33:16 +00:00
bjorn3
fc1b10c72c Sync from rust 06e02d5b25 2023-12-10 17:29:53 +00:00
surechen
e6376631cc remove redundant imports
detects redundant imports that can be eliminated.

for #117772 :

In order to facilitate review and modification, split the checking code and
removing redundant imports code into two PR.
2023-12-10 10:56:22 +08:00
Jakub Okoński
8ab225df8b Add simd_masked_{load,store} platform-intrinsics
This maps to the LLVM intrinsics: llvm.masked.load and llvm.masked.store
2023-12-09 12:36:08 +01:00
bjorn3
3ff8e7bd7c Fix rustc test suite 2023-12-07 18:23:39 +00:00