Nadrieril
1baf8bf54d
Fix range overflow checking
2023-10-11 04:55:55 +02:00
Nadrieril
1e1174b034
Rework error handling when lowering range endpoints
2023-10-11 04:54:49 +02:00
bors
5c3a0e932b
Auto merge of #116427 - cjgillot:no-internal, r=oli-obk
...
Remove mir::LocalDecl::internal.
It does not serve any purpose, as we don't have typeck-based generator witnesses any more.
2023-10-05 09:59:14 +00:00
Jubilee
ea3454eabb
Rollup merge of #116223 - catandcoder:master, r=cjgillot
...
Fix misuses of a vs an
Fixes the misuse of "a" vs "an", according to English grammatical
expectations and using https://www.a-or-an.com/
2023-10-05 00:56:29 -07:00
Nadrieril
c1b29b338d
Fix handling slices of empty types
2023-10-05 00:58:14 +02:00
Camille GILLOT
e63d19c4dd
Remove mir::LocalDecl::internal.
2023-10-04 17:55:15 +00:00
Nadrieril
edf6a2d337
Clarify for review
2023-10-04 15:59:16 +02:00
cui fliter
f44d116e1f
Fix misuses of a vs an
...
Signed-off-by: cui fliter <imcusg@gmail.com >
2023-10-04 08:01:11 +08:00
Nadrieril
fda0301b33
Don't collect seen if not needed
2023-10-03 19:58:47 +02:00
Nadrieril
2f4cab4d21
Clarify handling of hidden variants
2023-10-03 19:58:47 +02:00
Nadrieril
c1800ef93f
Replace SplitWildcard with a cleaner ConstructorSet abstraction
2023-10-03 19:58:47 +02:00
Nadrieril
429770a48e
Splitting ensures subrange comparison is all we need
2023-10-03 16:33:23 +02:00
Nadrieril
590edee320
Rework slice splitting api
2023-10-03 16:02:36 +02:00
Nadrieril
8f9cd3d1e8
Rework range splitting api
2023-10-03 15:17:52 +02:00
bors
eb0f3ed59c
Auto merge of #115025 - ouz-a:ouz_testing, r=lcnr
...
Make subtyping explicit in MIR
This adds new mir-opt that pushes new `ProjectionElem` called `ProjectionElem::Subtype(T)` to `Rvalue` of a subtyped assignment so we can unsoundness issues like https://github.com/rust-lang/rust/issues/107205
Addresses https://github.com/rust-lang/rust/issues/112651
r? `@lcnr`
2023-10-03 10:02:52 +00:00
ouz-a
3148e6a993
subtyping_projections
2023-10-02 23:37:49 +03:00
Nadrieril
eac7bcde5f
Move eval_bits optimization upstream
2023-10-01 21:12:24 +02:00
Nadrieril
0a6d794d0b
Cleanup number literal evaluation
2023-10-01 00:00:38 +02:00
Nadrieril
d6e9b321b3
No need to carry bias in IntRange
2023-10-01 00:00:38 +02:00
Nadrieril
fac50e8fb3
Evaluate float consts eagerly
2023-10-01 00:00:37 +02:00
Matthias Krüger
fd95627134
fix clippy::{redundant_guards, useless_format}
2023-09-27 23:49:15 +02:00
bors
c4ce33cfbc
Auto merge of #115887 - RalfJung:pat, r=oli-obk
...
thir::pattern: update some comments and error type names
Follow-up to [these comments](https://github.com/rust-lang/rust/pull/105750#pullrequestreview-1629697578 ). Please carefully fact-check, I'm new to this area of the compiler!
2023-09-27 13:20:53 +00:00
bors
6b99cf1d35
Auto merge of #116163 - compiler-errors:lazyness, r=oli-obk
...
Don't store lazyness in `DefKind::TyAlias`
1. Don't store lazyness of a type alias in its `DefKind`, but instead via a query.
2. This allows us to treat type aliases as lazy if `#[feature(lazy_type_alias)]` *OR* if the alias contains a TAIT, rather than having checks for both in separate parts of the codebase.
r? `@oli-obk` cc `@fmease`
2023-09-27 01:48:53 +00:00
Michael Goulet
d6ce9ce115
Don't store lazyness in DefKind
2023-09-26 02:53:59 +00:00
Ralf Jung
a1d6fc4340
rename lint; add tracking issue
2023-09-25 19:05:10 +02:00
Ralf Jung
b589976606
use a must_hold variant for checking PartialEq
2023-09-24 16:59:47 +02:00
Ralf Jung
c3ed0c454e
make sure we always emit the no-PartialEq lint, even if there were other lints
2023-09-24 16:36:26 +02:00
Ralf Jung
c5fccb98ea
work towards rejecting consts in patterns that do not implement PartialEq
2023-09-24 16:36:26 +02:00
Guillaume Gomez
208f6ed95c
Rollup merge of #115972 - RalfJung:const-consistency, r=oli-obk
...
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const
Also, be more consistent with the `to/eval_bits` methods... we had some that take a type and some that take a size, and then sometimes the one that takes a type is called `bits_for_ty`.
Turns out that `ty::Const`/`mir::ConstKind` carry their type with them, so we don't need to even pass the type to those `eval_bits` functions at all.
However this is not properly consistent yet: in `ty` we have most of the methods on `ty::Const`, but in `mir` we have them on `mir::ConstKind`. And indeed those two types are the ones that correspond to each other. So `mir::ConstantKind` should actually be renamed to `mir::Const`. But what to do with `mir::Constant`? It carries around a span, that's really more like a constant operand that appears as a MIR operand... it's more suited for `syntax.rs` than `consts.rs`, but the bigger question is, which name should it get if we want to align the `mir` and `ty` types? `ConstOperand`? `ConstOp`? `Literal`? It's not a literal but it has a field called `literal` so it would at least be consistently wrong-ish...
``@oli-obk`` any ideas?
2023-09-21 13:25:39 +02:00
Oli Scherer
9c762b58ba
Prevent promotion of const fn calls in inline consts
2023-09-21 09:00:22 +00:00
Ralf Jung
c94410c145
rename mir::Constant -> mir::ConstOperand, mir::ConstKind -> mir::Const
2023-09-21 08:12:30 +02:00
Ralf Jung
a2374e65aa
the Const::eval_bits methods don't need to be given the Ty
2023-09-20 07:27:21 +02:00
Ralf Jung
ea22adbabd
adjust constValue::Slice to work for arbitrary slice types
2023-09-19 20:17:43 +02:00
Ralf Jung
5a0a1ff0cd
move ConstValue into mir
...
this way we have mir::ConstValue and ty::ValTree as reasonably parallel
2023-09-19 11:11:02 +02:00
Ralf Jung
12a1b55afd
better ICE than sorry
2023-09-18 07:42:35 +02:00
Ralf Jung
d34e15e740
thir::pattern: update some comments and error type names
2023-09-16 12:25:33 +02:00
Ralf Jung
89ac57db4d
move required_consts check to general post-mono-check function
2023-09-14 22:30:42 +02:00
Ralf Jung
430c386821
make it more clear which functions create fresh AllocId
2023-09-14 07:27:31 +02:00
Ralf Jung
11a4a24d8e
make the set of methods between our two Const types more consistent
2023-09-13 07:29:34 +02:00
Ralf Jung
6e4779ab17
make the eval() functions on our const types return the resulting value
2023-09-13 07:29:34 +02:00
Camille GILLOT
26c48e6f95
Refactor how MIR represents composite debuginfo.
2023-09-05 17:20:07 +00:00
Matthias Krüger
9381e5bf58
Rollup merge of #115540 - cjgillot:custom-debuginfo, r=oli-obk
...
Support debuginfo for custom MIR.
2023-09-05 15:16:51 +02:00
bors
21305f4d5f
Auto merge of #115270 - sebastiantoh:issue-105479, r=Nadrieril
...
Add note on non-exhaustiveness when matching on str and nested non-exhaustive enums
Fixes https://github.com/rust-lang/rust/issues/105479
r? `@Nadrieril`
2023-09-03 19:31:47 +00:00
Sebastian Toh
d87b87d10e
Improve clarity of diagnostic message on non-exhaustive matches
2023-09-03 19:55:11 +08:00
Gurinder Singh
a0a71732f9
Fix code that now emits unused doc comment warning for expr field
2023-09-03 08:38:17 +05:30
Camille GILLOT
6cec91d647
Support debuginfo for custom MIR.
2023-09-01 16:16:31 +00:00
Ding Xiang Fei
39cf0b5dd5
use if only on lhs of binary logical exprs
2023-08-30 17:24:11 +08:00
Ding Xiang Fei
d9ed11872f
lower bare boolean expression with if-construct
2023-08-30 17:24:11 +08:00
Ding Xiang Fei
e5453b4806
lower ExprKind::Use, LogicalOp::Or and UnOp::Not
...
Co-authored-by: Abdulaziz Ghuloum <aghuloum@gmail.com >
2023-08-30 17:24:10 +08:00
Sebastian Toh
43dd8613a3
Add note when matching on nested non-exhaustive enums
2023-08-28 14:50:32 +08:00