Commit Graph

235606 Commits

Author SHA1 Message Date
Ralf Jung
16cde069fc allow dyn_sym in the files where they are defined; remove unreachable android code 2023-10-06 09:38:50 +02:00
Ralf Jung
099311ba5a make some things on foreign_items private 2023-10-06 09:23:56 +02:00
Ralf Jung
bc8d4dfa95 refactor dlsym: dispatch symbols via the normal shim mechanism 2023-10-06 09:23:35 +02:00
scottmcm
e300847864
Add a wishlist FIXME 2023-10-06 07:05:09 +00:00
Scott McMurray
1651f1f4b8 Elaborate some caveats to lossless 2023-10-05 23:03:02 -07:00
bors
f9003c08ab Auto merge of #3098 - BlackHoleFox:apple-entropy, r=RalfJung
Support getentropy on macOS as a foreign item

Prior this was always assumed to be accessed via `dlsym` shim, but in `std` I'm attempting to start [unconditionally linking](https://github.com/rust-lang/rust/pull/116319) to `getentropy` on macOS now that Rust's platform version support allows it.

This just moves the main logic of the previous `dlsym` handler into an eval context extension so it can be used via both call paths. The `dlsym` handler is still needed as `getrandom` uses it.
2023-10-06 05:52:07 +00:00
BlackHoleFox
dff7d5aa2f Move getentropy handling to a shared location for foreign item implementation 2023-10-06 00:37:42 -05:00
bors
ff057893b8 Auto merge of #116472 - matthiaskrgr:rollup-1mz0qrp, r=matthiaskrgr
Rollup of 2 pull requests

Successful merges:

 - #116421 (Clarify `invalid_reference_casting` lint around interior mutable types)
 - #116469 (Fix typo in README.md)

r? `@ghost`
`@rustbot` modify labels: rollup
2023-10-06 05:34:36 +00:00
Michael Howell
1eb2a76641 rustdoc-search: fix bug with multi-item impl trait 2023-10-05 22:32:37 -07:00
scottmcm
44f92c1f80
Don't mention "recover the original" in From docs
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2023-10-06 05:31:54 +00:00
Scott McMurray
b80e653ca1 Attempt to describe the intent behind the From trait further 2023-10-05 22:21:45 -07:00
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
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
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