Deadbeef
9654d5ceaf
add is_host_effect
to GenericParamDefKind::Const
and address review
2023-09-11 13:18:36 +00:00
Deadbeef
84a490712a
Implement fallback for effect param
2023-09-10 07:48:47 +00:00
bors
b14b0745ad
Auto merge of #115391 - saethlin:depkind-discrim, r=nnethercote
...
Encode DepKind as u16
The derived Encodable/Decodable impls serialize/deserialize as a varint, which results in a lot of code size around the encoding/decoding of these types which isn't justified: The full range of values here is rather small but doesn't quite fit in to a `u8`. Growing _all_ serialized `DepKind` to 2 bytes costs us on average 1% size in the incr comp dep graph, which I plan to recoup in https://github.com/rust-lang/rust/pull/110050 by taking advantage of the unused bits in all the serialized `DepKind`.
r? `@nnethercote`
2023-09-04 04:27:00 +00:00
Ben Kimock
9867023f4f
Encode DepKind as u16
2023-09-03 18:48:23 -04:00
bors
9dc11a13fa
Auto merge of #115422 - Zoxc:cache-once-lock, r=cjgillot
...
Use `OnceLock` for `SingleCache`
This uses `OnceLock` for `SingleCache` instead of `Lock<Option<T>>` so lookups are lock-free.
r? `@cjgillot`
2023-09-02 03:06:11 +00:00
bors
1accf068d8
Auto merge of #113126 - Bryanskiy:delete_old, r=petrochenkov
...
Replace old private-in-public diagnostic with type privacy lints
Next part of RFC https://github.com/rust-lang/rust/issues/48054 .
r? `@petrochenkov`
2023-09-01 12:40:01 +00:00
John Kåre Alsaker
90f5f94699
Use OnceLock
for SingleCache
2023-09-01 03:11:51 +02:00
Michael Goulet
4647aea7aa
Don't record spans for predicates in coherence
2023-08-30 18:24:18 +00:00
Ralf Jung
a09df43d9f
move marking-locals-live out of push_stack_frame, so it happens with argument passing
...
this entirely avoids even creating unsized locals in Immediate::Uninitialized state
2023-08-30 13:46:54 +02:00
Matthias Krüger
2128efd87f
Rollup merge of #115313 - gurry:issue-114918-cycle-detected, r=compiler-errors
...
Make `get_return_block()` return `Some` only for HIR nodes in body
Fixes #114918
The issue occurred while compiling the following input:
```rust
fn uwu() -> [(); { () }] {
loop {}
}
```
It was caused by the code below trying to suggest a missing return type which resulted in a const eval cycle: 1bd043098e/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs (L68-L75)
The root cause was `get_return_block()` returning an `Fn` node for a node in the return type (i.e. the second `()` in the return type `[(); { () }]` of the input) although it is supposed to do so only for nodes that lie in the body of the function and return `None` otherwise (at least as per my understanding).
The PR fixes the issue by fixing this behaviour of `get_return_block()`.
2023-08-30 07:18:11 +02:00
Gurinder Singh
136f0579d8
Make get_return_block() return Some only for HIR nodes in body
...
Fixes # 114918
2023-08-30 07:40:08 +05:30
Matthias Krüger
56d7d93a4b
Rollup merge of #111580 - atsuzaki:layout-ice, r=oli-obk
...
Don't ICE on layout computation failure
Fixes #111176 regression.
r? `@oli-obk`
2023-08-29 20:49:02 +02:00
bors
6d32b298ed
Auto merge of #114894 - Zoxc:sharded-cfg-cleanup2, r=cjgillot
...
Remove conditional use of `Sharded` from query state
`Sharded` is already a zero cost abstraction, so it shouldn't affect the performance of the single thread compiler if LLVM does its job.
r? `@cjgillot`
2023-08-29 12:04:37 +00:00
Katherine Philip
56b767322b
Don't ICE on layout computation failure
2023-08-28 12:40:39 -07:00
Michael Goulet
bf53598828
More precisely detect cycle errors from type_of on opaque
2023-08-27 22:03:16 +00:00
Michael Goulet
e7b3c94b0e
Pass ErrorGuaranteed to cycle error
2023-08-27 22:03:00 +00:00
bors
b60f7b51a2
Auto merge of #115045 - RalfJung:unwind-terminate-reason, r=davidtwco
...
when terminating during unwinding, show the reason why
With this, the output on double-panic becomes something like that:
```
thread 'main' panicked at src/tools/miri/tests/fail/panic/double_panic.rs:15:5:
first
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at src/tools/miri/tests/fail/panic/double_panic.rs:10:9:
second
stack backtrace:
0: 0xbe273a - std::backtrace_rs::backtrace::miri::trace_unsynchronized::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:99:5
1: 0xbe22e6 - std::backtrace_rs::backtrace::miri::trace::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:62:14
2: 0xbe1086 - std::backtrace_rs::backtrace::trace_unsynchronized::<[closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
3: 0xba3afd - std::sys_common::backtrace::_print_fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:67:5
4: 0xba2471 - <std::sys_common::backtrace::_print::DisplayBacktrace as std::fmt::Display>::fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:44:22
5: 0xbcf754 - core::fmt::rt::Argument::<'_>::fmt
at /home/r/src/rust/rustc.3/library/core/src/fmt/rt.rs:138:9
6: 0x9b8f81 - std::fmt::write
at /home/r/src/rust/rustc.3/library/core/src/fmt/mod.rs:1094:17
7: 0x21391d - <std::sys::unix::stdio::Stderr as std::io::Write>::write_fmt
at /home/r/src/rust/rustc.3/library/std/src/io/mod.rs:1714:15
8: 0xba37b1 - std::sys_common::backtrace::_print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:47:5
9: 0xba365b - std::sys_common::backtrace::print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:34:9
10: 0x143c67 - std::panic_hook_with_disk_dump::{closure#1}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:278:22
11: 0x144187 - std::panic_hook_with_disk_dump
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:312:9
12: 0x143659 - std::panicking::default_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:239:5
13: 0x1482a7 - std::panicking::rust_panic_with_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:729:13
14: 0x1475d5 - std::rt::begin_panic::<&str>::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:650:9
15: 0xba496a - std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::rt::begin_panic<&str>::{closure#0}], !>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:170:18
16: 0x147599 - std::rt::begin_panic::<&str>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:649:12
17: 0x31916 - <Foo as std::ops::Drop>::drop
at src/tools/miri/tests/fail/panic/double_panic.rs:10:9
18: 0x1a2b5e - std::ptr::drop_in_place::<Foo> - shim(Some(Foo))
at /home/r/src/rust/rustc.3/library/core/src/ptr/mod.rs:497:1
19: 0x202bf - main
at src/tools/miri/tests/fail/panic/double_panic.rs:16:1
20: 0xcc6a8 - <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:250:5
21: 0xba47d9 - std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:154:18
22: 0x141a6a - std::rt::lang_start::<()>::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:166:18
23: 0xcca18 - std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:284:13
24: 0x146469 - std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
25: 0x145e09 - std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
26: 0x7b0ac - std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
27: 0x14189b - std::rt::lang_start_internal::{closure#2}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:48
28: 0x146481 - std::panicking::try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
29: 0x145e2c - std::panicking::try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
30: 0x7b0d5 - std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
31: 0x1418b0 - std::rt::lang_start_internal
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:20
32: 0x141a97 - std::rt::lang_start::<()>
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:165:17
thread 'main' panicked at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:126:5:
panic in a destructor during cleanup
stack backtrace:
0: 0xe9f6d7 - std::backtrace_rs::backtrace::miri::trace_unsynchronized::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:99:5
1: 0xe9f27d - std::backtrace_rs::backtrace::miri::trace::<&mut [closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/miri.rs:62:14
2: 0xe9e016 - std::backtrace_rs::backtrace::trace_unsynchronized::<[closure@std::sys_common::backtrace::_print_fmt::{closure#1}]>
at /home/r/src/rust/rustc.3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
3: 0xba3afd - std::sys_common::backtrace::_print_fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:67:5
4: 0xba2471 - <std::sys_common::backtrace::_print::DisplayBacktrace as std::fmt::Display>::fmt
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:44:22
5: 0xbcf754 - core::fmt::rt::Argument::<'_>::fmt
at /home/r/src/rust/rustc.3/library/core/src/fmt/rt.rs:138:9
6: 0x9b8f81 - std::fmt::write
at /home/r/src/rust/rustc.3/library/core/src/fmt/mod.rs:1094:17
7: 0x4d0895 - <std::sys::unix::stdio::Stderr as std::io::Write>::write_fmt
at /home/r/src/rust/rustc.3/library/std/src/io/mod.rs:1714:15
8: 0xba37b1 - std::sys_common::backtrace::_print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:47:5
9: 0xba365b - std::sys_common::backtrace::print
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:34:9
10: 0x400bd4 - std::panic_hook_with_disk_dump::{closure#1}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:278:22
11: 0x144187 - std::panic_hook_with_disk_dump
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:312:9
12: 0x143659 - std::panicking::default_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:239:5
13: 0x1482a7 - std::panicking::rust_panic_with_hook
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:729:13
14: 0x40403b - std::panicking::begin_panic_handler::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:619:13
15: 0xe618b3 - std::sys_common::backtrace::__rust_end_short_backtrace::<[closure@std::panicking::begin_panic_handler::{closure#0}], !>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:170:18
16: 0x403fc8 - std::panicking::begin_panic_handler
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:617:5
17: 0xee23e9 - core::panicking::panic_nounwind_fmt
at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:96:14
18: 0xee29e6 - core::panicking::panic_nounwind
at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:126:5
19: 0xee365e - core::panicking::panic_in_cleanup
at /home/r/src/rust/rustc.3/library/core/src/panicking.rs:206:5
20: 0x2028a - main
at src/tools/miri/tests/fail/panic/double_panic.rs:13:1
21: 0x3895ee - <fn() as std::ops::FnOnce<()>>::call_once - shim(fn())
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:250:5
22: 0xe61725 - std::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
at /home/r/src/rust/rustc.3/library/std/src/sys_common/backtrace.rs:154:18
23: 0x3fe9aa - std::rt::lang_start::<()>::{closure#0}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:166:18
24: 0x389962 - std::ops::function::impls::<impl std::ops::FnOnce<()> for &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>::call_once
at /home/r/src/rust/rustc.3/library/core/src/ops/function.rs:284:13
25: 0x4033b9 - std::panicking::try::do_call::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
26: 0x402d58 - std::panicking::try::<i32, &dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
27: 0x337ff7 - std::panic::catch_unwind::<&dyn std::ops::Fn() -> i32 + std::marker::Sync + std::panic::RefUnwindSafe, i32>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
28: 0x3fe7e7 - std::rt::lang_start_internal::{closure#2}
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:48
29: 0x4033d6 - std::panicking::try::do_call::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:524:40
30: 0x402d7f - std::panicking::try::<isize, [closure@std::rt::lang_start_internal::{closure#2}]>
at /home/r/src/rust/rustc.3/library/std/src/panicking.rs:488:19
31: 0x338028 - std::panic::catch_unwind::<[closure@std::rt::lang_start_internal::{closure#2}], isize>
at /home/r/src/rust/rustc.3/library/std/src/panic.rs:142:14
32: 0x1418b0 - std::rt::lang_start_internal
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:148:20
33: 0x3fe9dc - std::rt::lang_start::<()>
at /home/r/src/rust/rustc.3/library/std/src/rt.rs:165:17
thread caused non-unwinding panic. aborting.
```
If we also land https://github.com/rust-lang/rust/pull/115020 , the 2nd backtrace disappears, hopefully making the "panic in a destructor during cleanup" easier to see.
Fixes https://github.com/rust-lang/rust/issues/114954 .
2023-08-25 08:47:18 +00:00
bors
4354192429
Auto merge of #114201 - Centri3:explicit-repr-rust, r=WaffleLapkin
...
Allow explicit `#[repr(Rust)]`
This is identical to no `repr()` at all. For `Rust, packed` and `Rust, align(x)`, it should be the same as no `Rust` at all (as, afaik, `#[repr(align(16))]` uses the Rust ABI.)
The main use case for this is being able to explicitly say "I want to use the Rust ABI" in very very rare circumstances where the first obvious choice would be the C ABI yet is undesirable, which is already possible with functions as `extern "Rust"`. This would be useful for silencing https://github.com/rust-lang/rust-clippy/pull/11253 . It's also more consistent with `extern`.
The lack of this also tripped me up a bit when I was new to Rust, as I expected this to be possible.
2023-08-25 00:02:54 +00:00
John Kåre Alsaker
f458b112f8
Optimize lock_shards
2023-08-24 23:29:48 +02:00
Ralf Jung
6f8ae03f9b
make MIR less verbose
2023-08-24 14:26:26 +02:00
Ralf Jung
114fde6ac7
cache the terminate block with the last reason that we saw
2023-08-24 13:28:26 +02:00
Ralf Jung
ddea3f981e
document more things as needing to stay in sync
2023-08-24 13:28:26 +02:00
Ralf Jung
4c53783f3c
when terminating during unwinding, show the reason why
2023-08-24 13:28:26 +02:00
Mark Rousskov
0a916062aa
Bump cfg(bootstrap)
2023-08-23 20:05:14 -04:00
bors
5c6a7e71cd
Auto merge of #114993 - RalfJung:panic-nounwind, r=fee1-dead
...
interpret/miri: call the panic_nounwind machinery the same way codegen does
2023-08-20 22:01:18 +00:00
Ralf Jung
49b5701df6
sync printing of MIR terminators with their new names (and dedup some to-str logic)
2023-08-20 15:52:40 +02:00
Ralf Jung
818ec8e23a
give some unwind-related terminators a more clear name
2023-08-20 15:52:38 +02:00
Zalathar
fbab055e77
coverage: Give the instrumentor its own counter type, separate from MIR
...
This splits off `BcbCounter` from MIR's `CoverageKind`, allowing the two types
to evolve in different directions as necessary.
2023-08-20 12:02:40 +10:00
Matthias Krüger
d49b1aba80
Rollup merge of #115001 - matthiaskrgr:perf_clippy, r=cjgillot
...
clippy::perf stuff
2023-08-20 00:28:34 +02:00
Matthias Krüger
76efd398ba
instead of collecting newly formatted Strings into one String, only create a single String and write!() to it (clippy::format_collect)
2023-08-19 17:08:09 +02:00
Matthias Krüger
269803ee56
remove redundant var rebindings
2023-08-19 14:09:30 +02:00
Camille GILLOT
933b618360
Revert "Implement references VarDebugInfo."
...
This reverts commit 2ec0071913
.
2023-08-17 17:02:04 +00:00
Matthias Krüger
084c87dfea
Rollup merge of #114876 - compiler-errors:non-lifetime-binders-sized, r=wesleywiser
...
Don't ICE in `is_trivially_sized` when encountering late-bound self ty
We can see a bound ty var here:
b531630f42/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs (L13-L34)
Fixes #114872
2023-08-17 08:39:21 +02:00
Camille GILLOT
388f6a6413
Make TerminatorEdge plural.
2023-08-16 18:12:18 +00:00
Camille GILLOT
5173d85043
Allow apply_terminator_effect to customize edges.
2023-08-16 18:12:17 +00:00
bors
4e3ce0e782
Auto merge of #114536 - cjgillot:eval-lint-levels, r=TaKO8Ki
...
Do not mark shallow_lint_levels_on as eval_always.
It does not need it. Removing it allows to skip recomputation.
2023-08-16 04:26:12 +00:00
bors
656ee47db3
Auto merge of #114689 - m-ou-se:stabilize-thread-local-cell-methods, r=thomcc
...
Stabilize thread local cell methods.
Closes #92122 .
2023-08-16 02:37:29 +00:00
Michael Goulet
c31aedf47f
Don't ICE in is_trivially_sized when encountering late-bound self ty
2023-08-16 01:57:33 +00:00
Matthias Krüger
8db5a6d8ee
Rollup merge of #114819 - estebank:issue-78124, r=compiler-errors
...
Point at return type when it influences non-first `match` arm
When encountering code like
```rust
fn foo() -> i32 {
match 0 {
1 => return 0,
2 => "",
_ => 1,
}
}
```
Point at the return type and not at the prior arm, as that arm has type `!` which isn't influencing the arm corresponding to arm `2`.
Fix #78124 .
2023-08-15 20:34:25 +02:00
Guillaume Gomez
f0987ab45b
Rollup merge of #114772 - fee1-dead-contrib:typed-did, r=b-naber
...
Add `{Local}ModDefId` to more strongly type DefIds`
Based on #110862 by `@Nilstrieb`
2023-08-15 14:29:45 +02:00
Michael Goulet
2ae4bedd85
more span info
2023-08-15 03:40:19 +00:00
bors
ffaa32b7b6
Auto merge of #114803 - bjorn3:less_session_mutable_state, r=fee1-dead
...
Couple of global state and driver refactors
* Remove some unused global mutable state
* Remove a couple of unnecessary queries (both driver and `TyCtxt` queries)
* Remove an unnecessary use of `FxIndexMap`
2023-08-15 01:31:56 +00:00
Esteban Küber
5021dde1a0
Move scrutinee HirId
into MatchSource::TryDesugar
2023-08-14 21:43:56 +00:00
Esteban Küber
55f8c66a60
Point at return type when it influences non-first match
arm
...
When encountering code like
```rust
fn foo() -> i32 {
match 0 {
1 => return 0,
2 => "",
_ => 1,
}
}
```
Point at the return type and not at the prior arm, as that arm has type
`!` which isn't influencing the arm corresponding to arm `2`.
Fix #78124 .
2023-08-14 21:43:56 +00:00
bors
475be26d99
Auto merge of #114781 - fee1-dead-contrib:param-impl-source, r=davidtwco
...
Remove constness from `ImplSource::Param`
2023-08-14 15:24:41 +00:00
Nilstrieb
c75fc573aa
Use {Local}ModDefId
in many queries
2023-08-14 07:22:48 +00:00
Deadbeef
f441fa08da
Remove constness from ImplSource::Param
2023-08-14 02:17:30 +00:00
bjorn3
c6247387b4
Remove metadata_loader query
...
It is only used by CrateLoader. We can store the metadata loader in
CStore instead which CrateLoader has access to.
2023-08-13 16:38:50 +00:00
bjorn3
980143b50c
Pass WorkProductMap to build_dep_graph instead of FxIndexMap
...
Constructing an FxIndexMap is useless work as the iteration order never
matters.
2023-08-13 16:07:48 +00:00
Nilstrieb
40de40e094
Add typed {Local}DefId
for modules
...
This allows for better type safety in the compiler and also improves the
documentation for many things, making it clear that they expect modules.
2023-08-13 05:54:50 +00:00