Esteban Küber
c09c73b996
Reword suggestion message
2024-11-16 20:03:31 +00:00
Michael Goulet
f2a80a0f89
A raw ref of a deref is always safe
2024-10-06 22:35:40 -04:00
Michael Goulet
12f2bcde63
Check params for unsafety in THIR
2024-09-18 16:45:48 -04:00
Ralf Jung
49316f871c
also stabilize const_refs_to_cell
2024-09-15 10:20:47 +02:00
Ralf Jung
3175cc2814
stabilize const_mut_refs
2024-09-15 09:51:32 +02:00
Veera
f003e92a5b
Don't Suggest Labeling const
and unsafe
Blocks
2024-08-06 14:50:09 -04:00
Veera
764675e01a
Add Tests
2024-08-06 14:06:29 -04:00
Esteban Küber
a5e7da0cf6
Tweak raw-pointer field access and array indexing suggestions
2024-07-04 06:06:33 +00:00
Esteban Küber
e6bd6c2044
Use parenthetical notation for Fn
traits
...
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`.
Fix #67100 :
```
error[E0277]: expected a `Fn()` closure, found `F`
--> file.rs:6:13
|
6 | call_fn(f)
| ------- ^ expected an `Fn()` closure, found `F`
| |
| required by a bound introduced by this call
|
= note: wrap the `F` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `call_fn`
--> file.rs:1:15
|
1 | fn call_fn<F: Fn() -> ()>(f: &F) {
| ^^^^^^^^^^ required by this bound in `call_fn`
help: consider further restricting this bound
|
5 | fn call_any<F: std::any::Any + Fn()>(f: &F) {
| ++++++
```
2024-05-29 22:26:54 +00:00
León Orell Valerian Liehr
ae49dbe707
Cleanup: Fix up some diagnostics
2024-05-22 22:40:34 +02:00
Santiago Pastorino
6b46a919e1
Rename Unsafe to Safety
2024-05-17 18:33:37 -03:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc
[AUTO-GENERATED] Migrate ui tests from //
to //@
directives
2024-02-16 20:02:50 +00:00
Matthew Jasper
4feec41e05
#![feature(inline_const_pat)]
is no longer incomplete
2024-02-01 10:27:54 +00:00
bors
d5fd099729
Auto merge of #120242 - matthiaskrgr:rollup-a93yj3i, r=matthiaskrgr
...
Rollup of 10 pull requests
Successful merges:
- #117910 (Refactor uses of `objc_msgSend` to no longer have clashing definitions)
- #118639 (Undeprecate lint `unstable_features` and make use of it in the compiler)
- #119801 (Fix deallocation with wrong allocator in (A)Rc::from_box_in)
- #120058 (bootstrap: improvements for compiler builds)
- #120059 (Make generic const type mismatches not hide trait impls from the trait solver)
- #120097 (Report unreachable subpatterns consistently)
- #120137 (Validate AggregateKind types in MIR)
- #120164 (`maybe_lint_impl_trait`: separate `is_downgradable` from `is_object_safe`)
- #120181 (Allow any `const` expression blocks in `thread_local!`)
- #120218 (rustfmt: Check that a token can begin a nonterminal kind before parsing it as a macro arg)
r? `@ghost`
`@rustbot` modify labels: rollup
2024-01-22 18:22:32 +00:00
Nadrieril
0a9bb97229
Consistently warn unreachable subpatterns
2024-01-18 17:29:54 +01:00
asquared31415
a8bb418ae5
make unsafe_op_in_unsafe_fn MachineApplicable and add it to 2024 compatibility
2024-01-15 23:06:39 +00:00
George-lewis
d56cdd48cb
Bless tests
...
Update tests
2024-01-13 12:46:58 -05:00
Matthew Jasper
7832ebbd4f
Handle context for const patterns correctly
2024-01-05 10:00:59 +00:00
Matthew Jasper
26f48b4cba
Stabilize THIR unsafeck
2024-01-05 10:00:59 +00:00
Matthew Jasper
982b49494e
Remove revisions for THIR unsafeck
...
This is to make the diff when stabilizing it easier to review.
2024-01-05 09:30:27 +00:00
jyn
eb53721a34
recurse into refs when comparing tys for diagnostics
2023-12-07 23:00:46 -05:00
Nilstrieb
41e8d152dc
Show number in error message even for one error
...
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-11-24 19:15:52 +01:00
Esteban Küber
4f7dddd4a1
recover primary span label
2023-11-16 17:00:23 +00:00
Matthew Jasper
868de8e76b
Visit patterns in THIR let expressions
...
This fixes some THIR unsafety checking errors not being emitted for
let expressions in these situations.
2023-11-06 16:23:09 +00:00
Matthew Jasper
2b59992736
Add suggestion to THIR unsafe_op_in_unsafe_fn lint
2023-11-06 16:23:09 +00:00
Michael Goulet
c83f642f12
Pretty print Fn traits in rustc_on_unimplemented
2023-11-02 20:57:05 +00:00
Matthew Jasper
dc3d428a8a
Make THIR unused_unsafe lint consistent with MIR
...
Updates THIR behavior to match the changes from #93678
2023-10-25 10:10:13 +00:00
bors
df63c5f140
Auto merge of #112038 - Nemo157:edition-2024-unsafe_op_in_unsafe_fn, r=RalfJung
...
Change `unsafe_op_in_unsafe_fn` to be `warn`-by-default from edition 2024
This was previously FCPed: https://github.com/rust-lang/rust/issues/71668#issuecomment-1189396886
There were two blocking requirements:
* Fix the `unused_unsafe` lint, done in https://github.com/rust-lang/rust/pull/100081
* Have `cargo fix` able to fix the lint, done in https://github.com/rust-lang/rust/pull/112017
2023-09-14 11:52:08 +00:00
mojave2
cfa2119563
add a regression test
2023-09-06 17:46:46 +08:00
Wim Looman
119e0fff8a
Change unsafe_op_in_unsafe_fn to be warn-by-default from edition 2024
2023-09-06 09:30:04 +02:00
Michael Goulet
bf66723c0e
Test and note unsafe ctor to fn ptr coercion
...
Also remove a note that I don't consider to be very useful in context.
2023-08-30 15:09:40 -07:00
Michael Goulet
0100a94231
rustc_layout_scalar_valid_range makes ctors unsafe
2023-08-30 15:01:58 -07:00
syvb
2cfe8ed37d
Implement "items do not inherit unsafety" for THIR unsafeck
2023-07-15 11:59:38 -04:00
Wim Looman
802c1d5979
Add test cases for suggestions with unsafe operations contained inside macros
2023-06-13 15:48:57 +02:00
Wim Looman
8f3e876e52
Add note about unsafe functions body not being unsafe
2023-06-13 15:48:57 +02:00
Wim Looman
62a712a8bb
Hide suggestion to wrap function in unsafe block
2023-06-13 15:48:55 +02:00
Wim Looman
aca61b2c07
Test that a couple more types of unsafe-ops get a wrapping unsafe block added
2023-06-13 15:47:02 +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
jyn
01b75e20f2
Move some UI tests into subdirectories
...
to avoid going over the existing limit now that the ui-fulldeps tests have
been moved to ui.
2023-04-02 19:42:30 -04:00
Camille GILLOT
a5ef6bac28
Also test destructuring assignment.
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
Camille GILLOT
be758ef5ab
Add ui test.
2023-03-09 17:45:13 +00:00
Albert Larsan
cf2dff2b1e
Move /src/test to /tests
2023-01-11 09:32:08 +00:00