bors
5683791ebb
Auto merge of #112017 - Nemo157:unsafe-block-rustfix, r=eholk
...
Add MVP suggestion for `unsafe_op_in_unsafe_fn`
Rebase of https://github.com/rust-lang/rust/pull/99827
cc tracking issue https://github.com/rust-lang/rust/issues/71668
No real changes since the original PR, just migrated the new suggestion to use fluent messages and added a couple more testcases, AFAICT from the discussion there were no outstanding changes requested.
2023-06-13 15:57:59 +00:00
Wim Looman
8f3e876e52
Add note about unsafe functions body not being unsafe
2023-06-13 15:48:57 +02:00
Léo Lanteri Thauvin
975152ce30
Add MVP suggestion for unsafe_op_in_unsafe_fn
...
Nemo157 rebase notes: Migrated the changes to the lint into fluent
2023-06-13 15:46:54 +02:00
Camille GILLOT
ca4d0d4c24
Separate AnonConst from ConstBlock in HIR.
2023-06-02 21:25:18 +00:00
John Kåre Alsaker
fff20a703d
Move expansion of query macros in rustc_middle to rustc_middle::query
2023-05-15 08:49:13 +02:00
clubby789
d5bc581f5d
Migrate mir_transform
to translatable diagnostics
2023-05-02 16:24:18 +01:00
Camille GILLOT
b275d2c30b
Remove WithOptconstParam.
2023-04-20 17:48:32 +00:00
Gary Guo
e3f2edc75b
Rename Abort
terminator to Terminate
...
Unify terminology used in unwind action and terminator, and reflect
the fact that a nounwind panic is triggered instead of an immediate
abort is triggered for this terminator.
2023-04-06 09:34:16 +01:00
Camille GILLOT
bcb161def7
Wrap the whole LocalInfo in ClearCrossCrate.
2023-03-14 20:52:42 +01:00
Camille GILLOT
b34a8a294d
Pacify tidy.
2023-03-09 17:45:13 +00:00
Camille GILLOT
e107194b66
Ignore AscribeUserType in unsafeck to avoid duplicate diagnostics.
2023-03-09 17:45:13 +00:00
Camille GILLOT
4462bb54e3
Introduce a no-op PlaceMention statement for let _ =
.
2023-03-09 17:45:13 +00:00
Matthias Krüger
4e84fbf8a0
Rollup merge of #108856 - Zeegomo:remove-drop-and-rep, r=tmiasko
...
Remove DropAndReplace terminator
#107844 made DropAndReplace unused, let's remove it completely from the codebase.
2023-03-08 21:26:51 +01:00
Giacomo Pasini
c5d4e4d907
Remove DropAndReplace terminator
...
PR 107844 made DropAndReplace unused, let's remove it completely
from the codebase.
2023-03-07 14:25:22 +01:00
Michael Woerister
04e5fa3ce2
Remove last instances of HashSet in query result types.
2023-03-01 10:20:45 +01:00
Camille GILLOT
0241c29123
Put a DefId in AggregateKind.
2023-02-02 23:09:51 +00:00
bors
3cdd0197e7
Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk
...
Use stable metric for const eval limit instead of current terminator-based logic
This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only.
The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made).
Also see: #103877
2023-01-29 04:11:27 +00:00
Camille GILLOT
3175d03d3b
Take a LocalDefId in hir::Visitor::visit_fn.
2023-01-28 09:51:50 +00:00
Bryan Garza
360db516cc
Create stable metric to measure long computation in Const Eval
...
This patch adds a `MirPass` that tracks the number of back-edges and
function calls in the CFG, adds a new MIR instruction to increment a
counter every time they are encountered during Const Eval, and emit a
warning if a configured limit is breached.
2023-01-23 23:56:22 +00:00
Jeremy Stucki
3dde32ca97
rustc: Remove needless lifetimes
2022-12-20 22:10:40 +01:00
Jakob Degen
c1b27eea45
Fix unsafetyck disabling for custom MIR
2022-12-14 01:02:35 -08:00
Gary Guo
9342d1e73e
Allow unsafe through inline const
...
This is handled similar to closures
2022-12-13 01:38:38 +00:00
Jakob Degen
ba359d8a51
Add support for custom MIR parsing
2022-11-08 23:13:15 -08:00
clubby789
28819cbb7e
Formatting changes + add UI test
2022-11-04 12:58:20 +00:00
clubby789
b7360fa23f
Give a specific lint for unsafety not being inherited
2022-11-04 12:26:21 +00:00
ouz-a
a1672ad5b8
Remove bounds check with enum cast
2022-10-31 14:10:37 +03:00
Maybe Waffle
a17ccfa621
Accept TyCtxt
instead of TyCtxtAt
in Ty::is_*
functions
...
Functions in answer:
- `Ty::is_freeze`
- `Ty::is_sized`
- `Ty::is_unpin`
- `Ty::is_copy_modulo_regions`
2022-10-27 15:06:08 +04:00
Maybe Waffle
a8f7e244b7
Refactor rustc lint API
2022-10-01 10:03:06 +00:00
Oli Scherer
b7413511dc
Generalize the Assume intrinsic statement to a general Intrinsic statement
2022-09-06 14:18:32 +00:00
Oli Scherer
3f07645120
Lower the assume intrinsic to a MIR statement
2022-09-06 14:18:32 +00:00
Ralf Jung
35a35d86fd
update comment
...
Co-authored-by: Léo Lanteri Thauvin <leseulartichaut@gmail.com>
2022-08-02 18:55:43 -04:00
Ralf Jung
3e44ca95dd
remove some unused code and types
2022-08-02 17:14:17 -04:00
Ralf Jung
ee3fc9dff8
never consider unsafe blocks unused if they would be required with unsafe_op_in_unsafe_fn
2022-08-02 17:09:41 -04:00
Dylan DPC
403c1b3802
Rollup merge of #99186 - camsteffen:closure-localdefid, r=cjgillot
...
Use LocalDefId for closures more
2022-07-31 17:36:40 +05:30
Cameron Steffen
cf2433a74f
Use LocalDefId for closures more
2022-07-30 15:59:17 -05:00
Miguel Guarniz
25bdc8965e
Change maybe_body_owned_by to take local def id
...
Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
2022-07-29 18:25:58 -04:00
Michael Goulet
6d2bd541e0
use body's param-env when checking if type needs drop
2022-07-17 10:56:12 -07:00
Ralf Jung
e4593ef0f2
assigning to a union field can never drop now
2022-07-13 18:27:28 -04:00
lcnr
32b13ac928
review
2022-05-09 18:40:18 +02:00
lcnr
d371ebe117
only compute codegen_fn_attrs
where needed
2022-05-09 18:40:18 +02:00
Oli Scherer
3568bdc6cd
Revert "add DefId
to unsafety violations and display function path in E0133"
...
This reverts commit 8b8f6653cf
.
2022-04-26 14:49:28 +00:00
Emil Gardström
2e47271cb8
only show a simple description in E0133 span label
2022-04-24 18:33:07 +02:00
Emil Gardström
8b8f6653cf
add DefId
to unsafety violations and display function path in E0133
...
this enables consumers to access the function definition that was reported to be unsafe
2022-04-24 18:33:06 +02:00
Matthias Krüger
7c2d57e0fa
couple of clippy::complexity fixes
2022-04-13 22:51:34 +02:00
Jakob Degen
9b6b1a625b
Add new Deinit
statement kind
2022-04-11 08:55:03 -04:00
Yuri Astrakhan
5160f8f843
Spellchecking compiler comments
...
This PR cleans up the rest of the spelling mistakes in the compiler comments. This PR does not change any literal or code spelling issues.
2022-03-30 15:14:15 -04:00
Camille GILLOT
0b49d05ea3
Filter OnceNote in diagnostic infra.
2022-03-20 20:36:26 +01:00
codehorseman
01dbfb3eb2
resolve the conflict in compiler/rustc_session/src/parse.rs
...
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-16 20:12:30 +08:00
Nicholas Nethercote
ca5525d564
Improve AdtDef
interning.
...
This commit makes `AdtDef` use `Interned`. Much the commit is tedious
changes to introduce getter functions. The interesting changes are in
`compiler/rustc_middle/src/ty/adt.rs`.
2022-03-11 13:31:24 +11:00
lcnr
b8135fd5c8
add #[rustc_pass_by_value]
to more types
2022-03-08 15:39:52 +01:00