1
Fork 0

Rollup merge of #137333 - compiler-errors:edition-2024-fresh, r=Nadrieril

Use `edition = "2024"` in the compiler (redux)

Most of this is binding mode changes, which I fixed by running `x.py fix`.

Also adds some miscellaneous `unsafe` blocks for new unsafe standard library functions (the setenv ones), and a missing `unsafe extern` block in some enzyme codegen code, and fixes some precise capturing lifetime changes (but only when they led to errors).

cc ``@ehuss`` ``@traviscross``
This commit is contained in:
Matthias Krüger 2025-02-22 11:36:43 +01:00 committed by GitHub
commit 37e0d138cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
149 changed files with 259 additions and 280 deletions

View file

@ -975,10 +975,8 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #[no_mangle]
/// fn foo<T>(t: T) {
///
/// }
/// #[unsafe(no_mangle)]
/// fn foo<T>(t: T) {}
/// ```
///
/// {{produces}}

View file

@ -35,12 +35,12 @@ declare_lint! {
///
/// ```rust
/// mod m {
/// extern "C" {
/// unsafe extern "C" {
/// fn foo();
/// }
/// }
///
/// extern "C" {
/// unsafe extern "C" {
/// fn foo(_: u32);
/// }
/// ```

View file

@ -183,7 +183,7 @@ impl EarlyLintPass for NonAsciiIdents {
#[allow(rustc::potential_query_instability)]
let mut symbols: Vec<_> = symbols.iter().collect();
symbols.sort_by_key(|k| k.1);
for (symbol, &sp) in symbols.iter() {
for &(ref symbol, &sp) in symbols.iter() {
let symbol_str = symbol.as_str();
if symbol_str.is_ascii() {
continue;
@ -242,7 +242,7 @@ impl EarlyLintPass for NonAsciiIdents {
UnordMap::with_capacity(symbols.len());
let mut skeleton_buf = String::new();
for (&symbol, &sp) in symbols.iter() {
for &(&symbol, &sp) in symbols.iter() {
use unicode_security::confusable_detection::skeleton;
let symbol_str = symbol.as_str();
@ -298,7 +298,7 @@ impl EarlyLintPass for NonAsciiIdents {
script_states.insert(latin_augmented_script_set, ScriptSetUsage::Verified);
let mut has_suspicious = false;
for (symbol, &sp) in symbols.iter() {
for &(ref symbol, &sp) in symbols.iter() {
let symbol_str = symbol.as_str();
for ch in symbol_str.chars() {
if ch.is_ascii() {

View file

@ -344,7 +344,7 @@ impl<'tcx> LateLintPass<'tcx> for NonSnakeCase {
ast::attr::find_by_name(cx.tcx.hir().attrs(hir::CRATE_HIR_ID), sym::crate_name)
.and_then(|attr| {
if let AttrKind::Normal(n) = &attr.kind
&& let AttrItem { args: AttrArgs::Eq { eq_span: _, expr: ref lit }, .. } =
&& let AttrItem { args: AttrArgs::Eq { eq_span: _, expr: lit }, .. } =
n.as_ref()
&& let ast::LitKind::Str(name, ..) = lit.kind
{

View file

@ -696,7 +696,7 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// extern "C" {
/// unsafe extern "C" {
/// static STATIC: String;
/// }
/// ```
@ -1791,7 +1791,7 @@ impl<'tcx> LateLintPass<'tcx> for VariantSizeDifferences {
let t = cx.tcx.type_of(it.owner_id).instantiate_identity();
let ty = cx.tcx.erase_regions(t);
let Ok(layout) = cx.layout_of(ty) else { return };
let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, ref variants, .. } =
let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag, variants, .. } =
&layout.variants
else {
return;