transpile: upgrade most things for edition 2024#1643
Conversation
f86aec4 to
d1ae9eb
Compare
19c6138 to
db5a90e
Compare
d1ae9eb to
02b9ca2
Compare
73c45e4 to
1a4774e
Compare
|
In the 2024 edition, the |
9af29df to
43f7566
Compare
02b9ca2 to
b3ab33d
Compare
5ecf3f2 to
6d4cba2
Compare
kkysen
left a comment
There was a problem hiding this comment.
In the 2024 edition, the
unsafe-op-in-unsafe-fnlint now also warns by default. A simple fix could be to just add an extraunsafe { }block to each function, but ultimately marking only the actual unsafe operations as unsafe could be preferred.
It's still just a warning, and we have plenty of warnings already, so I don't think I'll fix it as part of this PR, but you're right, we should fix it. We can do an outer unsafe {} block first, and if possible, narrow it.
2273281 to
a70695c
Compare
2050f67 to
9bbfccc
Compare
dc3a8b4 to
220a2dd
Compare
…f `-` in `.rs` names
…e suffixes so that related files are next to each
…r `c-decls`, too
This easy to do, gives better test coverage, and allows us to see the failing snapshots on edition 2024 for tests that haven't been converted yet.
…e `fn use_feature`
… in edition 2024
…hind `edition < 2021`
…`test_*.rs` files This allows us to move individual test directories to edition 2024.
…package.edition`
…unsafe` blocks in each `unsafe fn`
`Edition2024` more closely matches what we normally call it.
…st, too This comments out the `__APPLE__`-specific behavior so that the snapshot remains platform-independent. We're mostly interested in testing the other attributes, so this should be fine for now. This tests that `271228774` is working as intended.
220a2dd to
79cae37
Compare
| } | ||
|
|
||
| /// Whether attributes can be `unsafe` in this edition. | ||
| fn attr_unsafety(edition: RustEdition) -> Unsafety { |
There was a problem hiding this comment.
Could be named slightly better, e.g., attr_needs_unsafe.
There was a problem hiding this comment.
Hmm, I feel like attr_needs_unsafe implies it'll return a bool, whereas this returns Unsafety. I'm going to merge this now as-is, but I can come back and change this later.
This fixes the following differences with edition 2024:
#[unsafe(no_mangle)]#[unsafe(export_name = "")]#[unsafe(link_section = "")]unsafe extern "C" {extern "C" {fnsunsafeby default in edition 2024 #1663)unsafe fns andsafe fns inunsafe extern "C" {}sunsafe fns#![feature(stdsimd)]removed and split up#![feature(raw_ref_op)]removed#![feature(label_break_value)]removed#![feature(asm)]removed[profile.release] strip = "debuginfo"being the defaultatomics.c)genreserved keyword (keywords.c)VaListImpl(varargs.c)unsafe {}blocks inunsafe fns and add#![deny(unsafe_op_in_unsafe_fn)]#1662)#[warn(unsafe_op_in_unsafe_fn)]enabled by defaulttests/unit/, we add#![allow(unsafe_op_in_unsafe_fn)]for now.unsafeblock inunsafe fns (or finer-grained ones) we can do later.pref_align_ofwithalign_ofin edition 2024 #1656)pref_align_ofremoved (Remove rustc's notion of "preferred" alignment AKA__alignofrust-lang/rust#141803)__alignofThis also runs the correct
rustfmt, as we were previously just picking up whichever onerustupresolved.#![feature(stdsimd)]was split up and removed in 1.78, so stop emitting it when we upgrade past 1.65 #1298.This updates all of the transpiler snapshot tests and
tests/unit/tests that work on edition 2024 with the above fixes. The remaining fixes I'll fix in separate PRs, as they might be trickier.