Commit Graph

195847 Commits

Author SHA1 Message Date
Eric Huss
d2cd32c7da Update books 2022-07-21 20:41:44 -07:00
León Orell Valerian Liehr
c98399f5eb Don't suggest unnameable generic arguments 2022-07-22 04:55:31 +02:00
bors
aa01891700 Auto merge of #99420 - RalfJung:vtable, r=oli-obk
make vtable pointers entirely opaque

This implements the scheme discussed in https://github.com/rust-lang/unsafe-code-guidelines/issues/338: vtable pointers should be considered entirely opaque and not even readable by Rust code, similar to function pointers.

- We have a new kind of `GlobalAlloc` that symbolically refers to a vtable.
- Miri uses that kind of allocation when generating a vtable.
- The codegen backends, upon encountering such an allocation, call `vtable_allocation` to obtain an actually dataful allocation for this vtable.
- We need new intrinsics to obtain the size and align from a vtable (for some `ptr::metadata` APIs), since direct accesses are UB now.

I had to touch quite a bit of code that I am not very familiar with, so some of this might not make much sense...
r? `@oli-obk`
2022-07-22 01:33:49 +00:00
Nathan Stocks
7ba0be832a add same warning to Result::expect as Result::unwrap 2022-07-21 18:15:24 -06:00
bors
31b9b012bb Auto merge of #99530 - RalfJung:miri, r=oli-obk
update Miri

Fixes https://github.com/rust-lang/rust/issues/99461
r? `@oli-obk` because of lockfile changes (seems like serde is getting implicitly bumped)
2022-07-21 22:24:06 +00:00
Ralf Jung
c2df1c21f8 update Miri 2022-07-21 16:04:37 -04:00
klensy
b38c94857d avoid embedding StabilityLevel::Unstable reason string into metadata multiple times 2022-07-21 22:53:02 +03:00
bors
62b272d25c Auto merge of #99501 - lcnr:check-regions-infcx, r=oli-obk
move `considering_regions` to the infcx

it seems weird to prove some obligations which constrain inference vars while ignoring regions  in a context which considers regions. This is especially weird because even for a fulfillment context with ignored regions, we still added region outlives bounds when directly relating regions.

tbh our handling of regions is still very weird, but at least this is a step in the right direction imo.

r? rust-lang/types
2022-07-21 19:43:21 +00:00
Amos Wenger
39db9cdb7d Use std::panic::resume_unwind 2022-07-21 21:35:15 +02:00
Amos Wenger
48bcc229bf Move interner methods to Symbol, return SmolStr directly since it's ref-counted 2022-07-21 21:32:46 +02:00
Amos Wenger
246947b779 Fix raw ident handling (a little) 2022-07-21 19:13:44 +02:00
bors
af7ab34470 Auto merge of #99567 - matthiaskrgr:rollup-08hh3r4, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #98707 (std: use futex-based locks on Fuchsia)
 - #99413 (Add `PhantomData` marker for dropck to `BTreeMap`)
 - #99454 (Add map_continue and continue_value combinators to ControlFlow)
 - #99523 (Fix the stable version of `AsFd for Arc<T>` and `Box<T>`)
 - #99526 (Normalize the arg spans to be within the call span)
 - #99528 (couple of clippy::perf fixes)
 - #99549 (Add regression test for #52304)
 - #99552 (Rewrite `orphan_check_trait_ref` to use a `TypeVisitor`)
 - #99557 (Edit `rustc_index::vec::IndexVec::pick3_mut` docs)
 - #99558 (Fix `remap_constness`)
 - #99559 (Remove unused field in ItemKind::KeywordItem)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-07-21 17:02:31 +00:00
Amos Wenger
941416a1d6 Add test for idents incl. raw idents 2022-07-21 18:48:19 +02:00
Amos Wenger
9cf99a9c71 Stringify literals create client-side properly 2022-07-21 18:44:41 +02:00
Michael Goulet
3eef023da0 Address more nits 2022-07-21 16:43:10 +00:00
Matthias Krüger
af64d93dbb
Rollup merge of #99559 - GuillaumeGomez:rm-unused-field-keyword, r=notriddle
Remove unused field in ItemKind::KeywordItem

For the keyword name, we use `Item::name` directly everywhere so there is no point into keeping it.

r? ``@notriddle``
2022-07-21 18:42:12 +02:00
Matthias Krüger
b068dc7392
Rollup merge of #99558 - fee1-dead-contrib:remap_constness_fix, r=oli-obk
Fix `remap_constness`

`~const Drop` was renamed to `~const Destruct` and this special case should
be removed
2022-07-21 18:42:11 +02:00
Matthias Krüger
14c385d3d6
Rollup merge of #99557 - pierwill:patch-6, r=tmiasko
Edit `rustc_index::vec::IndexVec::pick3_mut` docs

Clarify when this method will panic.

Part of #93792.
2022-07-21 18:42:10 +02:00
Matthias Krüger
31284d2ef2
Rollup merge of #99552 - lcnr:orphan_check-rework, r=oli-obk
Rewrite `orphan_check_trait_ref` to use a `TypeVisitor`

The current impl is far more confusing than it has any right to be 

r? rust-lang/types
2022-07-21 18:42:09 +02:00
Matthias Krüger
d425fe8fb3
Rollup merge of #99549 - JohnTitor:issue-52304, r=compiler-errors
Add regression test for #52304

Closes #52304
r? ```@compiler-errors```

Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-21 18:42:08 +02:00
Matthias Krüger
230b775719
Rollup merge of #99528 - matthiaskrgr:2022_07_perf, r=estebank
couple of clippy::perf fixes
2022-07-21 18:42:07 +02:00
Matthias Krüger
da18bd18ca
Rollup merge of #99526 - compiler-errors:normalize-arg-spans, r=oli-obk
Normalize the arg spans to be within the call span

Makes more sense to point out the arg's span, and not the expression inside the macro
2022-07-21 18:42:06 +02:00
Matthias Krüger
84a7b23fd7
Rollup merge of #99523 - cuviper:asfd_ptrs-1.64, r=jyn514
Fix the stable version of `AsFd for Arc<T>` and `Box<T>`

These merged in #97437 for 1.64.0, apart from the main `io_safety`
feature that stabilized in 1.63.0.
2022-07-21 18:42:05 +02:00
Matthias Krüger
9610c71b1e
Rollup merge of #99454 - benluelo:control-flow/continue-combinators, r=scottmcm
Add map_continue and continue_value combinators to ControlFlow

As suggested in this comment: https://github.com/rust-lang/rust/issues/75744#issuecomment-1188549494

Related tracking issue: https://github.com/rust-lang/rust/issues/75744

r? ``````@scottmcm``````
2022-07-21 18:42:04 +02:00
Matthias Krüger
43783b80ee
Rollup merge of #99413 - steffahn:btree_dropck, r=m-ou-se
Add `PhantomData` marker for dropck to `BTreeMap`

closes #99408
2022-07-21 18:42:02 +02:00
Matthias Krüger
c5df2f02d3
Rollup merge of #98707 - joboet:fuchsia_locks, r=m-ou-se
std: use futex-based locks on Fuchsia

This switches `Condvar` and `RwLock` to the futex-based implementation currently used on Linux and some BSDs. Additionally, `Mutex` now has its own, priority-inheriting implementation based on the mutex in Fuchsia's `libsync`. It differs from the original in that it panics instead of aborting when reentrant locking is detected.

````@rustbot```` ping fuchsia
r? ````@m-ou-se````
2022-07-21 18:42:02 +02:00
Martin Habovstiak
eb5acc9b9b Rename <*{mut,const} T>::as_{const,mut} to cast_
This renames the methods to use the `cast_` prefix instead of `as_` to
make it more readable and avoid confusion with `<*mut T>::as_mut()`
which is `unsafe` and returns a reference.

See #92675
2022-07-21 18:30:05 +02:00
Amos Wenger
36d825fd5d Add test for literals created client-side 2022-07-21 18:29:28 +02:00
Amos Wenger
32ee097580 Run proc macro expansion in a separate thread (for the thread-local interner) 2022-07-21 18:11:50 +02:00
Wesley Wiser
9473141253
Update compiler/rustc_mir_transform/src/simplify.rs 2022-07-21 11:51:40 -04:00
Michael Goulet
cd89978d86 Generalize same_type_modulo_infer 2022-07-21 15:45:35 +00:00
Guillaume Gomez
8e150816c2 Remove unused field in ItemKind::KeywordItem 2022-07-21 16:05:17 +02:00
Deadbeef
b7de175ffe Fix remap_constness
`~const Drop` was renamed to `~const Destruct` and this special case should
be removed
2022-07-21 14:02:38 +00:00
pierwill
aad1aa3408 Edit rustc_index::vec::IndexVec::pick3_mut docs
Clarify when this method will panic.

Also fix formatting for `pick2_mut`.
2022-07-21 08:52:18 -05:00
bors
1673f1450e Auto merge of #99059 - Amanieu:fix-96797, r=Mark-Simulacrum
Add test for #96797

This was fixed in LLVM which was updated in #98285.

https://reviews.llvm.org/D127751

Fixes #96797
2022-07-21 13:40:28 +00:00
Amos Wenger
05d8f5fee7 Use a thread-local for the symbol interner (1/2) 2022-07-21 14:57:09 +02:00
Amos Wenger
30769598a4 Move version string to RustcInfo, read '.rustc' section only once 2022-07-21 13:57:36 +02:00
Amanieu d'Antras
4423341263 Add test for #96797
This was fixed in LLVM which was updated in #98285.

https://reviews.llvm.org/D127751

Fixes #96797
2022-07-21 12:41:09 +01:00
Amos Wenger
bbaf4daca0 Pass tidy checks 2022-07-21 13:37:41 +02:00
Amos Wenger
fdddd83224 Assert that sysroot ABI version matches exactly
Otherwise, fall back to the multi ABI scheme, except in testing, where
it becomes a hard error.

This should make it possible to use a rustup-provided rust-analyzer with
proc macro dylibs compiled by older rustcs, and it'll also catch changes
to the format of `rustc --version` or the `.rustc` section that would
make them impossible to compare for equality.
2022-07-21 13:13:25 +02:00
lcnr
43ccacf89b region_outlives_predicate no snapshot 2022-07-21 13:09:01 +02:00
lcnr
608625dae9 move considering_regions to the infcx 2022-07-21 13:08:56 +02:00
bors
74f600b990 Auto merge of #98162 - nextsilicon:support_lto_embed_bitcode, r=davidtwco
Allow to disable thinLTO buffer to support lto-embed-bitcode lld feature

Hello
This change is to fix issue (https://github.com/rust-lang/rust/issues/84395) in which passing "-lto-embed-bitcode=optimized" to lld when linking rust code via linker-plugin-lto doesn't produce the expected result.

Instead of emitting a single unified module into a llvmbc section of the linked elf, it emits multiple submodules.
This is caused because rustc emits the BC modules after running llvm `createWriteThinLTOBitcodePass` pass.
Which in turn triggers a thinLTO linkage and causes the said issue.

This patch allows via compiler flag (-Cemit-thin-lto=<bool>) to select between running `createWriteThinLTOBitcodePass` and `createBitcodeWriterPass`.
Note this pattern of selecting between those 2 passes is common inside of LLVM code.
The default is to match the old behavior.
2022-07-21 10:13:59 +00:00
joboet
8ba02f18b8
remove unused import 2022-07-21 11:51:26 +02:00
lcnr
84c3fcd2a0 rewrite the orphan check to use a type visitor 2022-07-21 11:51:09 +02:00
lcnr
7d0a18239e orphan check: opaque types are an error 2022-07-21 10:53:54 +02:00
bors
84a6fac37a Auto merge of #12841 - Veykril:query-fix, r=Veykril
fix: Fix `trait_impls_in_deps_query` being called directly instead of as a query

Fixes the inlay hint performance regression introdcuced by https://github.com/rust-analyzer/rust-analyzer/issues/12549
2022-07-21 08:23:19 +00:00
Lukas Wirth
cfad882745 fix: Fix trait_impls_in_deps_query being called directly instead of as a query 2022-07-21 10:23:07 +02:00
Yuki Okushi
5249183480
Add regression test for #52304
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-07-21 17:08:41 +09:00
Deadbeef
a0ebb2ed8b change map_bound(|_| x to rebind(x 2022-07-21 07:45:49 +00:00