Commit Graph

33 Commits

Author SHA1 Message Date
Ben Kimock
f9bd7dabcf Check alignment of pointers only when read/written through 2023-11-04 13:01:32 -04:00
Nadrieril
d5070e32ea Lint overlapping ranges as a separate pass 2023-10-27 05:16:26 +02:00
Oli Scherer
e96ce20b34 s/generator/coroutine/ 2023-10-20 21:14:01 +00:00
Matthew Jasper
e324a59eb6 Address review comments
- Add doc comment to new type
- Restore "only supported directly in conditions of `if` and `while` expressions" note
- Rename variant with clearer name
2023-09-13 15:00:31 +00:00
Matthew Jasper
333388fd3c Move let expression checking to parsing
There was an incomplete version of the check in parsing and a second
version in AST validation. This meant that some, but not all, invalid
uses were allowed inside macros/disabled cfgs. It also means that later
passes have a hard time knowing when the let expression is in a valid
location, sometimes causing ICEs.

- Add a field to ExprKind::Let in AST/HIR to mark whether it's in a
  valid location.
- Suppress later errors and MIR construction for invalid let
  expressions.
2023-09-11 15:51:18 +00:00
Tomasz Miąsko
fe3cd2d194 Fix inlining with -Zalways-encode-mir
Only inline functions that are considered eligible for inlining
by the reachability pass.

This constraint was previously indirectly enforced by only exporting MIR
of eligible functions, but that approach doesn't work with
-Zalways-encode-mir enabled.
2023-08-27 23:52:27 +02:00
Camille GILLOT
c535326537 Add test. 2023-08-17 17:02:04 +00:00
Mara Bos
0e729404da Change default panic handler message format. 2023-07-29 11:42:50 +02:00
bors
a8a29070f0 Auto merge of #100036 - DrMeepster:box_free_free_box, r=oli-obk
Remove `box_free` lang item

This PR removes the `box_free` lang item, replacing it with `Box`'s `Drop` impl. Box dropping is still slightly magic because the contained value is still dropped by the compiler.
2023-06-17 16:10:57 +00:00
DrMeepster
a5c6cb888e remove box_free and replace with drop impl 2023-06-16 13:41:06 -07:00
Ben Kimock
c54672e25f Disable alignment checks on i686-pc-windows-msvc 2023-06-16 09:06:12 -04:00
许杰友 Jieyou Xu (Joe)
edafbaffb2
Adjust UI tests for unit_bindings
- Either explicitly annotate `let x: () = expr;` where `x` has unit
  type, or remove the unit binding to leave only `expr;` instead.
- Fix disjoint-capture-in-same-closure test
2023-06-12 20:24:48 +08:00
许杰友 Jieyou Xu (Joe)
55b4549602
Show note for type ascription interpreted as a constant pattern, not a new variable
Given the code

```rust
pub fn main() {
    const y: i32 = 4;
    let y: i32 = 3;
}
```

`y` in the let binding is actually interpreted as a constant pattern
and is not a new variable, causing confusing diagnostics about
refutable patterns in local binding.

This commit extends the note for type ascription as a constant pattern
to `AscribeUserType` patterns as well.
2023-06-04 20:49:30 +08:00
Michael Goulet
847d50453c Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
Ben Kimock
de4dddf155 Add a test for misaligned pointer derefs inside addr_of! 2023-05-27 14:52:14 -04:00
Camille GILLOT
a395d2a5de Give more descriptive names to queries. 2023-04-20 18:01:07 +00:00
Camille GILLOT
b275d2c30b Remove WithOptconstParam. 2023-04-20 17:48:32 +00:00
Matthias Krüger
c140e25ec8
Rollup merge of #110283 - saethlin:check-panics-before-alignment, r=bjorn3
Only emit alignment checks if we have a panic_impl

Fixes https://github.com/rust-lang/rust/issues/109996

r? `@bjorn3` because you commented that this situation could impact you as well
2023-04-13 21:58:39 +02:00
Ben Kimock
4061eb5897 Only emit alignment checks if we have a panic_impl 2023-04-13 10:58:00 -04:00
Jakob Degen
d8ed2fb0bb Fix transmute intrinsic mir validation ICE 2023-04-09 18:16:05 -07:00
Oli Scherer
b5d96d5ec5 Move a const-prop-lint specific hack from mir interpret to const-prop-lint and make it fallible 2023-04-04 10:39:26 +00:00
bors
a5a690cf4b Auto merge of #109008 - clubby789:drop-elaborate-array, r=davidtwco
Drop array patterns using subslices

Fixes #109004
Drops contiguous subslices of an array when moving elements out with a pattern, which improves perf for large arrays
r? `@compiler-errors`
2023-04-02 12:17:52 +00:00
Ben Kimock
750707801b Disable the ui panic test on wasm32-bare 2023-03-30 23:46:44 -04:00
Ben Kimock
8ccf53332e A MIR transform that checks pointers are aligned 2023-03-23 18:23:06 -04:00
clubby789
ce2d52841b Drop subslices of arrays 2023-03-17 12:26:04 +00:00
clubby789
dd7df04e16 Remove uses of box_syntax in rustc and tools 2023-03-12 13:19:46 +00:00
Camille GILLOT
5d7234abb6 Add test. 2023-03-05 20:55:29 +00:00
Camille GILLOT
9aa4f6acb2 MIR-Validate StorageLive. 2023-02-25 16:27:10 +00:00
b-naber
6e1d228285 only require sub type relation on field projection types 2023-02-12 23:18:15 +01:00
Lukas Markeffsky
e2a1a2ab79 yet another ui test 2023-02-05 22:51:37 +01:00
Lukas Markeffsky
9d110847ab ReErased regions are local 2023-02-05 15:29:07 +01:00
Tomasz Miąsko
e489971902 Fix def-use dominance check
A definition does not dominate a use in the same statement. For example
in MIR generated for compound assignment x += a (when overflow checks
are disabled).
2023-01-27 00:54:31 +01:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests 2023-01-11 09:32:08 +00:00