Commit Graph

235774 Commits

Author SHA1 Message Date
Matthias Krüger b29777a186
Rollup merge of #116469 - prakashAditya639:master, r=workingjubilee
Fix typo in README.md

 the word "programatically" should be corrected to "programmatically."
2023-10-06 06:23:48 +02:00
Matthias Krüger 7d7004d3e6
Rollup merge of #116421 - Urgau:inter-mut-invalid_ref_casting, r=oli-obk
Clarify `invalid_reference_casting` lint around interior mutable types

This is PR intends to clarify the `invalid_reference_casting` lint around interior mutable types by adding a note for them saying that they should go through `UnsafeCell::get`.

So for this code:
```rust
let cell = &std::cell::UnsafeCell::new(0);
let _num = &mut *(cell as *const _ as *mut i32);
```

the following note will be added to the lint output:

```diff
 error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused,  consider instead using an `UnsafeCell`
   --> $DIR/reference_casting.rs:68:16
    |
 LL |     let _num = &mut *(cell as *const _ as *mut i32);
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: for more information, visit <https://doc.rust-lang.org/book/ch15-05-interior-mutability.html>
+   = note: even for types with interior mutability, the only legal way to obtain a mutable pointer from a shared reference is through `UnsafeCell::get`
```

Suggestion are welcome around the note contents.

Fixes https://github.com/rust-lang/rust/issues/116410
cc `@RalfJung`
2023-10-06 06:23:48 +02:00
Nicholas Nethercote e7dabc9f87 Remove unnecessary `pub`. 2023-10-06 14:59:11 +11:00
Nicholas Nethercote 093b435b78 Remove unneeded features. 2023-10-06 14:58:01 +11:00
Nicholas Nethercote 4b51a3eb52 Remove unneeded dependency.
Also sort them.
2023-10-06 14:57:25 +11:00
Nicholas Nethercote e49a1470ba Factor out `insert_or_error`.
It appears identically as a closure in two functions.

Also change its return type from `bool` to `Option<()>` so it can be
used with `?`.
2023-10-06 14:57:09 +11:00
Nicholas Nethercote 108e541cc2 Remove unused `FileName::CfgSpec`. 2023-10-06 14:57:09 +11:00
Nicholas Nethercote 442a66d385 Remove unneeded dependency. 2023-10-06 14:57:09 +11:00
bors fd80c02c16 Auto merge of #116463 - ChrisDenton:nlibc, r=workingjubilee
Remove libc

We don't use much libc on Windows and it seemed silly to keep if for the sake of [two well documented constants](https://learn.microsoft.com/en-us/cpp/c-runtime-library/exit-success-exit-failure?view=msvc-170).
2023-10-06 03:39:22 +00:00
AdityaPrakash 6ff3c3a421
typo in README.md 2023-10-06 09:05:38 +05:30
bors 579be69de9 Auto merge of #101150 - jethrogb:jb/cleanup-sgx-user-memory-copies, r=workingjubilee
Clean up SGX user memory copies

Follow-up on #98126 and #100383

r? `@cuviper`
cc `@raoulstrackx`
2023-10-06 01:50:10 +00:00
Nicholas Nethercote 29ed8e492a Remove the `MaybeTransmutableQuery<&'l Dfa<...>, C>` impl.
Because there is also a `MaybeTransmutableQuery<Dfa<...>, C>` impl, and
we don't need both.
2023-10-06 11:25:32 +11:00
Nicholas Nethercote 73420fc13b Fix a comment.
It was duplicated from the method above.
2023-10-06 11:22:06 +11:00
Nicholas Nethercote 449b84cb99 Remove `map_layouts`.
As per the `FIXME` comment, it's an abstraction that makes the code
harder to read.
2023-10-06 11:21:08 +11:00
bors 2c9b0de8ea Auto merge of #116269 - Veykril:rustc-abi, r=WaffleLapkin
Bring back generic parameters for indices in rustc_abi and make it compile on stable

This effectively reverses https://github.com/rust-lang/rust/pull/107163, allowing rust-analyzer to depend on this crate again,

It also moves some glob imports / expands them in the first commit because they made it more difficult for me to reason about things.
2023-10-06 00:03:56 +00:00
Chris Denton c8f3aa451a
Remove libc
We don't use much libc on Windows.
2023-10-06 00:35:00 +01:00
Nicholas Nethercote ad8271dd56 Use `collect` to decode `Vec`.
It's hyper-optimized, we don't need our own unsafe code here.

This requires getting rid of all the `Allocator` stuff, which isn't
needed anyway.
2023-10-06 10:30:03 +11:00
Nicholas Nethercote 1d71971973 Streamline some `Encodable` impls.
Making them consistent with similar impls.
2023-10-06 10:30:03 +11:00
Nicholas Nethercote 2db1d59830 Use `collect` for decoding more collection types. 2023-10-06 10:30:03 +11:00
Nicholas Nethercote 5f69ca62f2 rustc_serialize: merge `collection_impls.rs` into `serialize.rs`.
`serialize.rs` has the `Encodable`/`Decodable` impls for lots of basic
types, including `Vec`. `collection_impls` has it for lots of collection
types. The distinction isn't really meaningful, and it's simpler to have
them all in a single file.
2023-10-06 10:30:01 +11:00
Nicholas Nethercote 409193654d Make the comment order match variant declaration order. 2023-10-06 10:17:29 +11:00
Nicholas Nethercote 80bf6883be Remove an unnecessary `pub(crate)`. 2023-10-06 10:16:54 +11:00
Jason Newcomb d464b72970 Add more diagnostic items for clippy 2023-10-05 18:21:47 -04:00
Nicholas Nethercote f703475b4e Remove unused serialization support for `LinkedList`. 2023-10-06 09:13:54 +11:00
Nicholas Nethercote 3ee67475b2 rustc_serialize: Remove unneeded feature decls.
I.e. `maybe_uninit_slice` and `new_uninit`.

Also sort the remaining features and remove an ugly, low-value comment.
2023-10-06 09:13:54 +11:00
bors 1a6ab015d0 Auto merge of #3107 - eduardosm:update-deps, r=RalfJung
Update dependencies
2023-10-05 22:07:09 +00:00
Tomasz Miąsko eaafb256f8 Replace LocationExtended with DefLocation in SsaLocals 2023-10-05 23:45:59 +02:00
Tomasz Miąsko 4357482bfd Move DefLocation from rustc_codegen_ssa to rustc_middle 2023-10-05 23:45:59 +02:00
Tomasz Miąsko 6c348b77fe Remove small dominators optimization from SsaLocals
The optimization is now part of the general implementation.
2023-10-05 23:45:59 +02:00
Tomasz Miąsko 0528d378b6 Optimize dominators for small path graphs
Generalizes the small dominators approach from #107449.
2023-10-05 23:45:59 +02:00
Tomasz Miąsko ba694e301c Remove redundant Dominators::start_node field 2023-10-05 23:45:58 +02:00
Tomasz Miąsko a8ec7ddf0e Test immediate dominators using public API 2023-10-05 23:45:58 +02:00
Ralf Jung cbe892fd65 fix fast-path for try_eval_scalar_int 2023-10-05 22:00:24 +02:00
bjorn3 e825497b7d
Merge pull request #1396 from bjorn3/aarch64_asm
Support inline asm on AArch64
2023-10-05 21:47:15 +02:00
bjorn3 9facf0bf72 Properly export function defined in test which uses global_asm!()
Currently the test passes with the LLVM backend as the codegen unit
partitioning logic happens to place both the global_asm!() and the
function which calls the function defined by the global_asm!() in the
same CGU. With the Cranelift backend it breaks however as it will place
all assembly in separate codegen units to be passed to an external
linker.
2023-10-05 19:42:25 +00:00
bors cae0791da4 Auto merge of #116417 - ouz-a:trait_type_detective, r=compiler-errors
Remove is global hack

In attempt to fix https://github.com/rust-lang/rust/issues/114057 we found several issues with how compiler computes layouts, this change removes `is_global` from `and` to stop impl from being shadowed.

In depth conversation can be read here https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Getting.20different.20types.20from.20almost.20same.20inputs

This is a fix candidate opened for performance run.

r? `@lcnr`
2023-10-05 19:42:05 +00:00
bjorn3 4577c1dc05 Temporarily remove riscv64 inline asm support
Riscv support is not currently being tested so it is likely broken.
Removing it may avoid confusion in the future.
2023-10-05 19:23:40 +00:00
bjorn3 b1421dea1d Support inline asm on AArch64
Also stop changing the frame pointer on x86_64. This confuses unwinders.
2023-10-05 19:06:08 +00:00
bjorn3 a47b9fd2e6 Remove stub support for 32bit inline assembly
Cranelift doesn't support any 32bit target yet and this helps with
keeping everything in sync.
2023-10-05 18:55:18 +00:00
Oğuz Ağcayazı e30d27be00 remove is global hack 2023-10-05 21:38:12 +03:00
Martin Nordholts 8a1be9942d Allow file names to end with '>'
The `rustc_span::FileName` enum already differentiates between real
files and "fake" files such as `<anon>`. We do not need to artificially
forbid real file names from ending in `>`.
2023-10-05 20:17:48 +02:00
bors cdca82c2c8 Auto merge of #116455 - matthiaskrgr:rollup-p226a5u, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #116220 (stabilize `Option::as_`(`mut_`)`slice`)
 - #116288 (Add Span to various smir types)
 - #116415 (Move subtyper below reveal_all and change reveal_all)
 - #116428 (Add a note to duplicate diagnostics)
 - #116452 (Do not assert that hidden types don't have erased regions.)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-05 17:50:50 +00:00
Eduardo Sánchez Muñoz 11afb99b4f Update test dependencies 2023-10-05 19:30:31 +02:00
Eduardo Sánchez Muñoz bbebfa7186 Update miri-script dependencies 2023-10-05 19:29:27 +02:00
Eduardo Sánchez Muñoz f49d325f9d Update cargo-miri dependencies 2023-10-05 19:29:02 +02:00
Eduardo Sánchez Muñoz 95c4590988 Update miri dependencies 2023-10-05 19:28:26 +02:00
Matthias Krüger 76d0b794cb
Rollup merge of #116452 - cjgillot:noassert-erased, r=oli-obk
Do not assert that hidden types don't have erased regions.

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

`args` can have erased regions.
In the linked issue, this is reached by computing whether a large type is `Freeze` to compute its ABI.

I do not have a minimized test to include.
2023-10-05 19:24:35 +02:00
Matthias Krüger c1c5ab717e
Rollup merge of #116428 - Alexendoo:note-duplicate-diagnostics, r=compiler-errors,estebank
Add a note to duplicate diagnostics

Helps explain why there may be a difference between manual testing and the test suite output and highlights them as something to potentially look into

For existing duplicate diagnostics I just blessed them other than a few files that had other `NOTE` annotations in
2023-10-05 19:24:35 +02:00
Matthias Krüger 08cc7428d9
Rollup merge of #116415 - ouz-a:move_subtyper, r=oli-obk
Move subtyper below reveal_all and change reveal_all

In previous attempt https://github.com/rust-lang/rust/pull/116378 we tried to handle `Opaque` in few different places, but this isn't necessary, after moving subtyper below reveal_all and calling `super_place` on reveal_all, issues cease to exist.

r? ``@oli-obk``

Fixes https://github.com/rust-lang/rust/issues/116332
Fixes https://github.com/rust-lang/rust/issues/116265
Fixes https://github.com/rust-lang/rust/issues/116383
Fixes https://github.com/rust-lang/rust/issues/116333
2023-10-05 19:24:34 +02:00
Matthias Krüger b301bd4220
Rollup merge of #116288 - ouz-a:smir_spans, r=spastorino
Add Span to various smir types

Had to make few extra changes to few structs to attach spans to them.

r? ``@oli-obk``
2023-10-05 19:24:34 +02:00