Commit Graph

27059 Commits

Author SHA1 Message Date
Matthias Krüger
6f36f1ffbd
Rollup merge of #114497 - taiki-e:revert-riscv-atomic, r=Amanieu
Revert #98333 "Re-enable atomic loads and stores for all RISC-V targets"

This reverts #98333.

As said in https://github.com/rust-lang/rust/pull/98333#issuecomment-1666375293, `forced-atomics` target feature is also needed to enable atomic load/store on these targets (otherwise, libcalls are generated): https://godbolt.org/z/433qeG7vd

However, `forced-atomics` target feature is currently broken (https://github.com/rust-lang/rust/issues/114153), so AFAIK, there is currently no way to enable atomic load/store (via core::intrinsics) on these targets properly.

r? `@Amanieu`
2023-08-08 03:30:55 +02:00
Matthias Krüger
42cdc7df20
Rollup merge of #114413 - CohenArthur:warn-macro-export-decl-macros, r=cjgillot
Warn when #[macro_export] is applied on decl macros

The existing code checks if `#[macro_export]` is being applied to an item other than a macro, and warns in that case, but fails to take into account macros 2.0/decl macros, despite the attribute having no effect on these macros.

This PR adds a special case for decl macros with the aforementioned attribute, so that the warning is a bit more precise. Instead of just saying "this attribute has no effect", hint towards the fact that decl macros get exported and resolved like regular items.
It also removes a `#[macro_export]` attribute which was applied on one of `core`'s decl macros.

- core: Remove #[macro_export] from `debug_assert_matches`
- check_attrs: Warn when #[macro_export] is used on macros 2.0
2023-08-08 03:30:54 +02:00
Matthias Krüger
328e9785fb
Rollup merge of #114376 - inferiorhumanorgans:rustc-codegen-ssa-duplicate-export, r=wesleywiser
Avoid exporting __rust_alloc_error_handler_should_panic more than once.

Exporting `__rust_alloc_error_handler_should_panic` multiple times causes `ld.gold` to balk with: `error: version script assignment of  to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined`

Specifically this breaks builds of 1.70.0 and newer on DragonFly and YoctoProject with `ld.gold`.  Builds with `ld.bfd` and `lld` should be unaffected.

http://errors.yoctoproject.org/Errors/Details/708194/
2023-08-08 03:30:54 +02:00
Ramon de C Valle
f837c48f0d CFI: Fix error compiling core with LLVM CFI enabled
Fix #90546 by filtering out global value function pointer types from the
type tests, and adding the LowerTypeTests pass to the rustc LTO
optimization pipelines.
2023-08-07 15:59:15 -07:00
Arthur Cohen
bdf4e3de9c check_attrs: Warn when #[macro_export] is used on macros 2.0
The compiler should emit a more specific error when the `#[macro_export]`
attribute is present on a decl macro, instead of silently ignoring it.

This commit adds the required error message in rustc_passes/messages.ftl,
 as well as a note. A new variant is added to the `errors::MacroExport`
enum, specifically for the case where the attribute is added to a macro
2.0.
2023-08-07 21:14:28 +02:00
Michael Goulet
ba4a2f7cb7 Resolve target type of coercion 2023-08-07 19:06:18 +00:00
Michael Goulet
fb9030d7dd Structurally normalize weak and inherent too 2023-08-07 19:05:59 +00:00
Nikita Popov
7867833652 Fix LLVM version check for ThinLTO import/export lists
These types changed in LLVM 18, not LLVM 17.
2023-08-07 20:36:14 +02:00
Nikita Popov
ad7ea8b7e6 Update powerpc data layouts
Function pointer alignment is specified since https://reviews.llvm.org/D147016.
2023-08-07 20:35:55 +02:00
Nikita Popov
055dd282c5 Remove no longer needed LLVM_RUSTLLVM check
The bundled version now uses the LLVM 17 code path.
2023-08-07 20:35:55 +02:00
Felix S. Klock II
a2058ddbed Review feedback: return empty iff !should_codegen, and use simpler unconditional logic otherwise. 2023-08-07 13:31:14 -04:00
Deadbeef
057be381c6 Fix ICE 2023-08-07 17:16:10 +00:00
bors
63a81b0c5a Auto merge of #114585 - matthiaskrgr:rollup-h26pvus, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #113568 (Fix spurious test failure with `panic=abort`)
 - #114196 (Bubble up nested goals from equation in `predicates_for_object_candidate`)
 - #114485 (Add trait decls to SMIR)
 - #114495 (Set max_atomic_width for AVR to 16)
 - #114496 (Set max_atomic_width for sparc-unknown-linux-gnu to 32)
 - #114510 (llvm-wrapper: adapt for LLVM API changes)
 - #114562 (stabilize abi_thiscall)
 - #114570 ([miri][typo] Fix a typo in a vector_block comment.)
 - #114573 (CI: do not hide error logs in a group)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-07 15:29:14 +00:00
Matthias Krüger
06daa9e263
Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk
stabilize abi_thiscall

Closes https://github.com/rust-lang/rust/issues/42202, stabilizing the use of the "thiscall" ABI.

FCP was substituted by a poll, and the poll has been accepted.
2023-08-07 16:47:57 +02:00
Matthias Krüger
1d82946e52
Rollup merge of #114510 - krasimirgg:llvm-17-cmi, r=nikic
llvm-wrapper: adapt for LLVM API changes

No functional changes intended.

Adapts llvm-wrapper for 65e57bbed0.

Found by our experimental rust + llvm @ HEAD CI:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/21304#0189c526-86cd-4db9-bdbc-dd0132dfc22b/197-500
2023-08-07 16:47:56 +02:00
Matthias Krüger
9b1f9433db
Rollup merge of #114496 - taiki-e:sparc32-atomic, r=Amanieu
Set max_atomic_width for sparc-unknown-linux-gnu to 32

This is currently set to 64

90f0b24ad3/compiler/rustc_target/src/spec/sparc_unknown_linux_gnu.rs (L8)

However, AFAIK, this architecture doesn't support 64-bit atomics, and LLVM generates libcalls: https://godbolt.org/z/chzThWGG1

(Currently, attempts to run `cargo test` for this target result in "undefined reference to `__sync_val_compare_and_swap_8'" error. 02efe1e74f)

r? `@Amanieu`
2023-08-07 16:47:56 +02:00
Matthias Krüger
b0a5126f06
Rollup merge of #114495 - taiki-e:avr-atomic, r=Amanieu
Set max_atomic_width for AVR to 16

This is currently set to 0

90f0b24ad3/compiler/rustc_target/src/spec/avr_gnu_base.rs (L26-L27)

However, LLVM supports {8,16}-bit atomic load/store on AVR (support for RMW is still quite incomplete and only partially supported).

https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/llvm/test/CodeGen/AVR/atomics/load8.ll#L5-L13
https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/llvm/test/CodeGen/AVR/atomics/load16.ll#L3-L12
https://github.com/llvm/llvm-project/blob/llvmorg-15.0.0/llvm/test/CodeGen/AVR/atomics/store.ll#L3-L22

cc #99668

r? `@Amanieu`
2023-08-07 16:47:55 +02:00
Matthias Krüger
7a52fe5396
Rollup merge of #114485 - spastorino:add-trait-decls, r=oli-obk
Add trait decls to SMIR

r? `@oli-obk`

Closes https://github.com/rust-lang/project-stable-mir/issues/20
2023-08-07 16:47:55 +02:00
Matthias Krüger
2a643b2dc0
Rollup merge of #114196 - compiler-errors:bubble-pls, r=lcnr
Bubble up nested goals from equation in `predicates_for_object_candidate`

This used to be needed for https://github.com/rust-lang/rust/pull/114036#discussion_r1273987510, but since it's no longer, I'm opening this as a separate PR. This also fixes one ICEing UI test: (`tests/ui/unboxed-closures/issue-53448.rs`)

r? `@lcnr`
2023-08-07 16:47:54 +02:00
León Orell Valerian Liehr
5468336d6b
Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
bors
84ec2633de Auto merge of #113902 - Enselic:lint-recursive-drop, r=oli-obk
Make `unconditional_recursion` warning detect recursive drops

Closes #55388

Also closes #50049 unless we want to keep it for the second example which this PR does not solve, but I think it is better to track that work in #57965.

r? `@oli-obk` since you are the mentor for #55388

Unresolved questions:
- [x] There are two false positives that must be fixed before merging (see diff). I suspect the best way to solve them is to perform analysis after drop elaboration instead of before, as now, but I have not explored that any further yet. Could that be an option? **Answer:** Yes, that solved the problem.

`@rustbot` label +T-compiler +C-enhancement +A-lint
2023-08-07 13:39:28 +00:00
Santiago Pastorino
6e4d7bd90e
Add TraitDef::trait_decl method 2023-08-07 10:24:12 -03:00
Santiago Pastorino
0e69a8ad20
Add all_trait_decls to SMIR 2023-08-07 10:24:11 -03:00
Santiago Pastorino
496faa857c
Convert trait declaration to SMIR 2023-08-07 10:24:08 -03:00
Santiago Pastorino
4199a3c13a
Convert unsafety using the stable method and reuse mir::Safety 2023-08-07 10:23:20 -03:00
Benedikt Radtke
3f3262e592 stabilize abi_thiscall 2023-08-07 14:11:03 +02:00
Vadim Petrochenkov
b6ac576487 rustc_interface: Dismantle register_plugins query 2023-08-07 19:33:23 +08:00
Deadbeef
1ca4bc966e Migrate a trait selection error to use diagnostic translation 2023-08-07 05:26:38 +00:00
Matthias Krüger
d804b74c6c
Rollup merge of #114549 - chenyukang:yukang-review-resolve-part, r=petrochenkov
Style fix and refactor on resolve diagnostics

- coding style
- refactor api of `span_look_ahead`
2023-08-07 05:29:13 +02:00
Matthias Krüger
cbe2522652
Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly

As discussed in #113435, this lets the backends be the place that can have the "don't call the function if n == 0" logic, if it's needed for the target.  (I didn't actually *add* those checks, though, since as I understood it we didn't actually need them on known targets?)

Doing this also let me make it `const` (unstable), which I don't think `extern "C" fn memcmp` can be.

cc `@RalfJung` `@Amanieu`
2023-08-07 05:29:12 +02:00
bors
72c6b8d36f Auto merge of #114565 - matthiaskrgr:rollup-p7cjs3m, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #114535 (bump schannel, miow to drop windows-sys 0.42)
 - #114542 (interpret: use ConstPropNonsense for more const-prop induced issues)
 - #114543 (add tests for some fixed ConstProp ICEs)
 - #114550 (Generate better function argument names in global_allocator expansion)
 - #114556 (Issue numbers are enforced on active features; remove FIXME)
 - #114558 (Remove FIXME about NLL diagnostic that is already improved)

Failed merges:

 - #114485 (Add trait decls to SMIR)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-06 23:44:08 +00:00
scottmcm
75277a6606 Apply suggestions from code review
Co-authored-by: Ralf Jung <post@ralfj.de>
2023-08-06 15:47:40 -07:00
Scott McMurray
502af03445 Add a new compare_bytes intrinsic instead of calling memcmp directly 2023-08-06 15:47:40 -07:00
Matthias Krüger
44479d1b35
Rollup merge of #114556 - Enselic:issue-numbers-enforced, r=compiler-errors
Issue numbers are enforced on active features; remove FIXME

Since https://github.com/rust-lang/rust/pull/51090 tidy enforces that active features have an issue number, so remove the FIXME.

This PR is part of #44366 which is E-help-wanted.
2023-08-07 00:06:07 +02:00
Matthias Krüger
1ea9951b43
Rollup merge of #114550 - dtolnay:globalalloc, r=compiler-errors
Generate better function argument names in global_allocator expansion

Generated code for `#[global_allocator] static ALLOCATOR: Allocator = Allocator;`&mdash;

**Before:**

```rust
const _: () = {
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc(arg0: usize, arg1: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_dealloc(arg0: *mut u8, arg1: usize, arg2: usize) -> () {
        ::core::alloc::GlobalAlloc::dealloc(
            &ALLOCATOR,
            arg0,
            ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_realloc(
        arg0: *mut u8,
        arg1: usize,
        arg2: usize,
        arg3: usize,
    ) -> *mut u8 {
        ::core::alloc::GlobalAlloc::realloc(
            &ALLOCATOR,
            arg0,
            ::core::alloc::Layout::from_size_align_unchecked(arg1, arg2),
            arg3,
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc_zeroed(arg0: usize, arg1: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc_zeroed(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(arg0, arg1),
        )
    }
};
```

**After:**

```rust
const _: () = {
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc(size: usize, align: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_dealloc(ptr: *mut u8, size: usize, align: usize) -> () {
        ::core::alloc::GlobalAlloc::dealloc(
            &ALLOCATOR,
            ptr,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_realloc(
        ptr: *mut u8,
        size: usize,
        align: usize,
        new_size: usize,
    ) -> *mut u8 {
        ::core::alloc::GlobalAlloc::realloc(
            &ALLOCATOR,
            ptr,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
            new_size,
        )
    }
    #[rustc_std_internal_symbol]
    unsafe fn __rust_alloc_zeroed(size: usize, align: usize) -> *mut u8 {
        ::core::alloc::GlobalAlloc::alloc_zeroed(
            &ALLOCATOR,
            ::core::alloc::Layout::from_size_align_unchecked(size, align),
        )
    }
};
```
2023-08-07 00:06:07 +02:00
Matthias Krüger
74dce18639
Rollup merge of #114542 - RalfJung:const-prop-nonsense, r=compiler-errors
interpret: use ConstPropNonsense for more const-prop induced issues
2023-08-07 00:06:06 +02:00
bors
f3623871cf Auto merge of #114502 - cjgillot:steal-ctfe, r=oli-obk
Steal MIR for CTFE when possible.

Some bodies, like constants, have CTFE MIR but no optimized MIR.
In that case, have `mir_for_ctfe` steal the MIR instead of cloning it.
2023-08-06 22:02:12 +00:00
bors
85fbb57149 Auto merge of #114553 - matthiaskrgr:rollup-5yddunv, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #114466 (Add Allocation to SMIR)
 - #114505 (Add documentation to has_deref)
 - #114519 (use offset_of! to calculate dirent64 field offsets)
 - #114537 (Migrate GUI colors test to original CSS color format)
 - #114539 (linkchecker: Remove unneeded FIXME about intra-doc links)

Failed merges:

 - #114485 (Add trait decls to SMIR)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-06 19:46:31 +00:00
Ralf Jung
997ec63fb1 simplify handling of valtrees for unsized types 2023-08-06 21:25:49 +02:00
Ralf Jung
b6e3bc23ef remove an unnecessary special case in valtree_into_mplace 2023-08-06 21:25:49 +02:00
bors
5973bfbd38 Auto merge of #114516 - cjgillot:direct-module-parent, r=compiler-errors
parent_module_from_def_id does not need to be a query.

r? `@ghost`
2023-08-06 18:04:04 +00:00
Martin Nordholts
2b9876bd6d Issue numbers are enforced on active features; remove FIXME 2023-08-06 20:01:23 +02:00
Matthias Krüger
13de583583
Rollup merge of #114505 - ouz-a:cleanup_mir, r=RalfJung
Add documentation to has_deref

Documentation of `has_deref` needed some polish to be more clear about where it should be used and what's it's purpose.

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

r? `@RalfJung`
2023-08-06 17:26:29 +02:00
Matthias Krüger
92c04217ba
Rollup merge of #114466 - ouz-a:smir_allocation, r=oli-obk
Add Allocation to SMIR

As it's discussed [here ](https://rust-lang.zulipchat.com/#narrow/stream/320896-project-stable-mir/topic/Representing.20Constants.20in.20smir)this is an attempt to cover Constants for smir in a different way compared to https://github.com/rust-lang/rust/pull/114342

cc https://github.com/rust-lang/project-stable-mir/issues/15

r? ``@oli-obk``
2023-08-06 17:26:28 +02:00
bors
e59540968e Auto merge of #113648 - aliemjay:opaque-binder-ice, r=oli-obk
don't replace opaque types under binders with infer vars

Fixes an ICE in the ui test code.

Fixes #109636
Fixes #109281
Fixes #86800

r? `@oli-obk`
2023-08-06 15:26:03 +00:00
yukang
eb0fcc5ad1 refactor on span_look_ahead 2023-08-06 22:44:11 +08:00
David Tolnay
704aa56ba0
Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
ouz-a
6df546281b cleanup misinformation regarding has_deref 2023-08-06 17:29:09 +03:00
Deadbeef
92f4c59e48 lower impl const to bind to host effect param 2023-08-06 13:34:53 +00:00
Ralf Jung
efd54ccf5a interpret: use ConstPropNonsense for more const-prop induced issues 2023-08-06 15:20:03 +02:00
Ali MJ Al-Nasrawy
2e83a72964 don't replace opaque types under binders with infer vars 2023-08-06 12:08:32 +00:00
ouz-a
b9a539e0a3 Add alocation to smir 2023-08-06 15:06:04 +03:00
bors
bc720ad36b Auto merge of #114487 - compiler-errors:opaques-refactoring-idk, r=cjgillot
Consolidate opaque ty and async fn lowering code

The codepaths for lowering "regular" opaques and async fn were almost identical, modulo some bookkeeping that seemed pretty easy to consolidate.

r? `@cjgillot`
2023-08-06 11:16:31 +00:00
David Tolnay
e57a89174c
Delete some useless casts from global_allocator expansion 2023-08-05 23:10:38 -07:00
Matthias Krüger
bf4b1d7805
Rollup merge of #114524 - compiler-errors:more-ice-in-uncertainty, r=jackh726
Also ICE when goals go from Ok to Err in new solver

We were just using `?` here, silently downgrading the goal's response from (presumably) maybe to error -- that seems concerning, since this whole check is for detecting goal instability 😅

r? `@lcnr` or `@BoxyUwU`
2023-08-06 03:56:10 +02:00
Matthias Krüger
83d84ffdd5
Rollup merge of #114503 - chenyukang:yukang-fix-114433-unused-qualifications, r=compiler-errors
Remove invalid lint when there is a generic argument in prefix path

Fixes #114433
2023-08-06 03:56:09 +02:00
Matthias Krüger
1305a43d0a
Rollup merge of #114486 - Urgau:const-context-nan-suggestion-114471, r=compiler-errors
Avoid invalid NaN lint machine-applicable suggestion in const context

This PR removes the machine-applicable suggestion in const context for the `invalid_nan_comparision` lint ~~and replace it with a simple help~~.

Fixes https://github.com/rust-lang/rust/issues/114471
2023-08-06 03:56:09 +02:00
bors
8236f63aba Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obk
Fix missing dependency file with `-Zunpretty`

This PR force the `output_filenames` to be run ~~in every early exits like~~ when using `-Zunpretty`, so to respect the `dep-info` flag.

Fixes https://github.com/rust-lang/rust/issues/112898
r? `@oli-obk`
2023-08-06 00:04:52 +00:00
Michael Goulet
3b3e466e36
Add FIXME as reminder to restore suggestion later 2023-08-05 17:04:30 -07:00
Urgau
b71f2becb2 Avoid invalid NaN lint machine-applicable suggestion in const context 2023-08-05 23:54:59 +02:00
Camille GILLOT
7a51b30ebd parent_module_from_def_id does not need to be a query. 2023-08-05 21:23:50 +00:00
Camille GILLOT
02e10a054e Steal MIR for CTFE when possible. 2023-08-05 21:16:55 +00:00
Michael Goulet
55bf810821 Also report when goals go from ok to error 2023-08-05 20:09:31 +00:00
Michael Goulet
169236ec8a a function is just another AnonymousCreateParameter rib 2023-08-05 16:53:13 +00:00
Michael Goulet
57a96893f6 Consolidate opaque ty and async fn lowering code 2023-08-05 16:53:13 +00:00
bors
fbc11e9690 Auto merge of #114514 - matthiaskrgr:rollup-1rv4f3h, r=matthiaskrgr
Rollup of 3 pull requests

Successful merges:

 - #114029 (Explain more clearly why `fn() -> T` can't be `#[derive(Clone)]`)
 - #114248 (Make lint missing-copy-implementations honor negative `Copy` impls)
 - #114498 (Print tidy command with bless tidy check failure)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-05 13:33:57 +00:00
Matthias Krüger
e722f6f3ac
Rollup merge of #114248 - fmease:neg-copy-rules-out-missing-copy-impl, r=b-naber
Make lint missing-copy-implementations honor negative `Copy` impls

Fixes #101980.

``@rustbot`` label A-lint F-negative_impls
2023-08-05 14:00:17 +02:00
bors
28b6607b5f Auto merge of #109348 - cjgillot:issue-109146, r=petrochenkov
Resolve visibility paths as modules not as types.

Asking for a resolution with `opt_ns = Some(TypeNS)` allows path resolution to look for type-relative paths, leaving unresolved segments behind. However, for visibility paths we really need to look for a module, so we need to pass `opt_ns = None`.

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

r? `@petrochenkov`
2023-08-05 11:52:07 +00:00
Krasimir Georgiev
9941db4512 llvm-wrapper: adapt for LLVM API changes
No functional changes intended.

Adapts llvm-wrapper for 65e57bbed0.

Found by our experimental rust + llvm @ HEAD CI:
https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/21304#0189c526-86cd-4db9-bdbc-dd0132dfc22b/197-500
2023-08-05 10:54:30 +00:00
bors
1cabb8ed23 Auto merge of #114459 - cjgillot:simplify-ctfe, r=oli-obk
Do not run ConstProp on mir_for_ctfe.

This pass does not seem to be useful any more. The const-prop lints are now run by `tcx.mir_drops_elaborated_and_const_checked`, and the const-prop opt should never emit any diagnostic.
2023-08-05 09:08:34 +00:00
yukang
c9be1a71b6 Remove invalid lint when there is a generic argument in prefix path 2023-08-05 15:58:26 +08:00
bors
67626b8e89 Auto merge of #113734 - cjgillot:no-crate-lint, r=petrochenkov
Convert builtin "global" late lints to run per module

The compiler currently has 4 non-incremental lints:
1. `clashing_extern_declarations`;
2. `missing_debug_implementations`;
3. ~`unnameable_test_items`;~ changed by https://github.com/rust-lang/rust/pull/114414
4. `missing_docs`.

Non-incremental lints get reexecuted for each compilation, which is slow. Moreover, those lints are allow-by-default, so run for nothing most of the time. This PR attempts to make them more incremental-friendly.

`clashing_extern_declarations` is moved to a standalone query.

`missing_debug_implementation` can use `non_blanket_impls_for_ty` instead of recomputing it.

`missing_docs` is harder as it needs to track if there is a `doc(hidden)` module surrounding. I hack around this using the lint level engine. That's easy to implement and allows to re-enable the lint for a re-exported module, while a more proper solution would reuse the same device as `unnameable_test_items`.
2023-08-05 07:20:16 +00:00
Taiki Endo
dddd2190b9 Remove arm crypto target feature 2023-08-05 15:23:31 +09:00
Camille GILLOT
e2230985b3 Do not run ConstProp on mir_for_ctfe. 2023-08-05 06:21:33 +00:00
Taiki Endo
b47e4a46c6 Revert "Auto merge of #98333 - SimonSapin:riscv-atomic, r=Amanieu"
This reverts commit 90f0b24ad3, reversing
changes made to e173a8e663.
2023-08-05 13:18:47 +09:00
Taiki Endo
4d4df88934 Set max_atomic_width for sparc-unknown-linux-gnu to 32 2023-08-05 13:01:15 +09:00
Taiki Endo
c9e83c02a2 Set max_atomic_width for AVR to 16 2023-08-05 12:47:46 +09:00
bors
fca59ab5f0 Auto merge of #114492 - compiler-errors:rollup-lp4sfla, r=compiler-errors
Rollup of 5 pull requests

Successful merges:

 - #114287 (update overflow handling in the new trait solver)
 - #114475 (Migrate GUI colors test to original CSS color format)
 - #114482 (Fix ui-fulldeps missing the `internal_features` lint on stage 0)
 - #114490 (Fix a typo in the error reporting for sealed traits.)
 - #114491 (Rename issue #114423 test files to include context)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-05 03:43:08 +00:00
Michael Goulet
c0231962e5
Rollup merge of #114490 - kernelmethod:error-reporting-typos, r=compiler-errors
Fix a typo in the error reporting for sealed traits.

Fixes a typo in error reporting: "implelement" -> "implement"
2023-08-04 19:47:40 -07:00
Michael Goulet
097a49867c
Rollup merge of #114287 - lcnr:overflow, r=compiler-errors
update overflow handling in the new trait solver

implements https://hackmd.io/QY0dfEOgSNWwU4oiGnVRLw?view. I want to clean up this doc and add it to the rustc-dev-guide, but I think this PR is ready for merge as is, even without the dev-guide entry.

r? `@compiler-errors`
2023-08-04 19:47:38 -07:00
bors
90f0b24ad3 Auto merge of #98333 - SimonSapin:riscv-atomic, r=Amanieu
Re-enable atomic loads and stores for all RISC-V targets

This roughly reverts PR https://github.com/rust-lang/rust/pull/66548

Atomic "CAS" are still disabled for targets without the *“A” Standard Extension for Atomic Instructions*. However this extension only adds instructions for operations more complex than simple loads and stores, which are always atomic when aligned.

In the [Unprivileged Spec v. 20191213](https://riscv.org/technical/specifications/) section 2.6 *Load and Store Instructions* of chapter 2 *RV32I Base Integer Instruction Set* (emphasis mine):

> Even when misaligned loads and stores complete successfully, these accesses might run extremely slowly depending on the implementation (e.g., when implemented via an invisible trap). Further-more, whereas **naturally aligned loads and stores are guaranteed to execute atomically**, misaligned loads and stores might not, and hence require additional synchronization to ensure atomicity.

Unfortunately PR https://github.com/rust-lang/rust/pull/66548 did not provide much details on the bug that motivated it, but https://github.com/rust-lang/rust/issues/66240 and https://github.com/rust-lang/rust/issues/85736 appear related and happen with targets that do have the A extension.
2023-08-05 01:53:32 +00:00
kernelmethod
d64968ba30 Fix a typo in the error reporting for sealed traits. 2023-08-05 00:38:52 +00:00
bors
e173a8e663 Auto merge of #112117 - bryangarza:track-caller-feature-gate, r=compiler-errors
Add separate feature gate for async fn track caller

This patch adds a feature gate `async_fn_track_caller` that is separate from `closure_track_caller`. This is to allow enabling `async_fn_track_caller` separately.

Fixes #110009
2023-08-04 22:17:59 +00:00
bors
e4c1446846 Auto merge of #114481 - matthiaskrgr:rollup-58pczpl, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #113945 (Fix wrong span for trait selection failure error reporting)
 - #114351 ([rustc_span][perf] Remove unnecessary string joins and allocs.)
 - #114418 (bump parking_lot to 0.12)
 - #114434 (Improve spans for indexing expressions)
 - #114450 (Fix ICE failed to get layout for ReferencesError)
 - #114461 (Fix unwrap on None)
 - #114462 (interpret: add mplace_to_ref helper method)
 - #114472 (Reword `confusable_idents` lint)
 - #114477 (Account for `Rc` and `Arc` when suggesting to clone)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-08-04 20:31:40 +00:00
Matthias Krüger
35b271306f
Rollup merge of #114477 - estebank:arc-clone, r=compiler-errors
Account for `Rc` and `Arc` when suggesting to clone

When suggesting to clone a reference-counted value, be less uncertain.
2023-08-04 21:32:00 +02:00
Matthias Krüger
cd5317a000
Rollup merge of #114472 - estebank:issue-76140, r=compiler-errors
Reword `confusable_idents` lint

Fix #76140.
2023-08-04 21:31:59 +02:00
Matthias Krüger
5e42a2276a
Rollup merge of #114462 - RalfJung:mplace_to_ref, r=oli-obk
interpret: add mplace_to_ref helper method
2023-08-04 21:31:59 +02:00
Matthias Krüger
b7bfffd3d1
Rollup merge of #114461 - sebastiantoh:issue-114423, r=estebank
Fix unwrap on None

Fixes #114423

r? `@estebank`
2023-08-04 21:31:58 +02:00
Matthias Krüger
a0fd747e38
Rollup merge of #114450 - chenyukang:yukang-fix-114435, r=compiler-errors
Fix ICE failed to get layout for ReferencesError

Fixes #114435

r? `@compiler-errors`
2023-08-04 21:31:57 +02:00
Matthias Krüger
99e4127d85
Rollup merge of #114434 - Nilstrieb:indexing-spans, r=est31
Improve spans for indexing expressions

fixes #114388

Indexing is similar to method calls in having an arbitrary left-hand-side and then something on the right, which is the main part of the expression. Method calls already have a span for that right part, but indexing does not. This means that long method chains that use indexing have really bad spans, especially when the indexing panics and that span in coverted into a panic location.

This does the same thing as method calls for the AST and HIR, storing an extra span which is then put into the `fn_span` field in THIR.

r? compiler-errors
2023-08-04 21:31:57 +02:00
Matthias Krüger
4669905ee6
Rollup merge of #114418 - klensy:parking_lot, r=oli-obk
bump parking_lot to 0.12

Bumps parking_lot to 0.12, replaces few explicit uses of parking_lot with rustc_data_structures::sync ones.

<strike>cc `@oli-obk` this touches recent https://github.com/rust-lang/rust/pull/114283</strike>
cc `@SparrowLii` i've checked that this builds with parallel-compiler

measureme's bump https://github.com/rust-lang/measureme/pull/209
fcf3006e01/compiler/rustc_data_structures/src/sync.rs (L18-L34)
2023-08-04 21:31:56 +02:00
Matthias Krüger
23e86f6ef8
Rollup merge of #114351 - ttsugriy:sort-by-words, r=fee1-dead
[rustc_span][perf] Remove unnecessary string joins and allocs.

Comparing vectors of string parts yields the same result but avoids unnecessary `join` and potential allocation for resulting `String`. This code is cold so it's unlikely to have any measurable impact, but considering but since it's also simpler, why not? :)
2023-08-04 21:31:56 +02:00
Matthias Krüger
5054e41b64
Rollup merge of #113945 - chenyukang:yukang-fix-113447-slice-2, r=cjgillot
Fix wrong span for trait selection failure error reporting

Fixes #113447
2023-08-04 21:31:55 +02:00
bors
fe896efa97 Auto merge of #114104 - oli-obk:syn2, r=compiler-errors
Lots of tiny incremental simplifications of `EmitterWriter` internals

ignore the first commit, it's https://github.com/rust-lang/rust/pull/114088 squashed and rebased, but it's needed to use to use `derive_setters`, as they need a newer `syn` version.

Then this PR starts out with removing many arguments that are almost always defaulted to `None` or `false` and replace them with builder methods that can set these fields in the few cases that want to set them.

After that it's one commit after the other that removes or merges things until everything becomes some very simple trait objects
2023-08-04 18:46:19 +00:00
Urgau
8229d8e251 Fix missing dependency file with -Zunpretty 2023-08-04 20:13:40 +02:00
Esteban Küber
edc3e26773 Account for Rc and Arc when suggesting to clone
When suggesting to clone a reference-counted value, be less uncertain.
2023-08-04 17:50:12 +00:00
yukang
3d25b5c7e8 Fix ICE failed to get layout for ReferencesError 2023-08-05 01:38:14 +08:00
bors
03181e0547 Auto merge of #113575 - aliemjay:opaque-hrtb-ice, r=lcnr
don't ICE on higher ranked hidden types

This shouldn't allow more code to compile, only replaces the ICE with a nicer error message.

Fixes https://github.com/rust-lang/rust/issues/97098.
Fixes https://github.com/rust-lang/rust/issues/97099.
Fixes #108399
Fixes #104196
Fixes #113481
Fixes #103186
Fixes #100818

r? `@lcnr` (because you showed interest in #100503 :)
2023-08-04 16:56:37 +00:00
Esteban Küber
553508c22e Reword confusable idents lint
Fix #76140.
2023-08-04 16:46:08 +00:00
Camille GILLOT
905b63d64f Fetch diagnostic item later. 2023-08-04 16:09:14 +00:00