| 1 |
commit de9b5c3ea28 |
| 2 |
Author: carbotaniuman <[email protected]> |
| 3 |
Date: 2024-08-07T01:36:28-0500 (Wednesday) |
| 4 |
|
| 5 |
Stabilize `unsafe_attributes` |
| 6 |
|
| 7 |
diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs |
| 8 |
index a353c79f12d..837cb805700 100644 |
| 9 |
--- a/compiler/rustc_ast_passes/src/ast_validation.rs |
| 10 |
+++ b/compiler/rustc_ast_passes/src/ast_validation.rs |
| 11 |
@@ -887,7 +887,7 @@ fn validate_generic_param_order(dcx: DiagCtxtHandle<'_>, generics: &[GenericPara |
| 12 |
|
| 13 |
impl<'a> Visitor<'a> for AstValidator<'a> { |
| 14 |
fn visit_attribute(&mut self, attr: &Attribute) { |
| 15 |
- validate_attr::check_attr(&self.features, &self.session.psess, attr); |
| 16 |
+ validate_attr::check_attr(&self.session.psess, attr); |
| 17 |
} |
| 18 |
|
| 19 |
fn visit_ty(&mut self, ty: &'a Ty) { |
| 20 |
diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs |
| 21 |
index 3ceb8e0711a..214a37bca03 100644 |
| 22 |
--- a/compiler/rustc_ast_passes/src/feature_gate.rs |
| 23 |
+++ b/compiler/rustc_ast_passes/src/feature_gate.rs |
| 24 |
@@ -559,7 +559,6 @@ macro_rules! gate_all { |
| 25 |
gate_all!(mut_ref, "mutable by-reference bindings are experimental"); |
| 26 |
gate_all!(precise_capturing, "precise captures on `impl Trait` are experimental"); |
| 27 |
gate_all!(global_registration, "global registration is experimental"); |
| 28 |
- gate_all!(unsafe_attributes, "`#[unsafe()]` markers for attributes are experimental"); |
| 29 |
gate_all!(return_type_notation, "return type notation is experimental"); |
| 30 |
|
| 31 |
if !visitor.features.never_patterns { |
| 32 |
diff --git a/compiler/rustc_builtin_macros/src/cfg_accessible.rs b/compiler/rustc_builtin_macros/src/cfg_accessible.rs |
| 33 |
index 006b6aa823f..3d3bd3aea05 100644 |
| 34 |
--- a/compiler/rustc_builtin_macros/src/cfg_accessible.rs |
| 35 |
+++ b/compiler/rustc_builtin_macros/src/cfg_accessible.rs |
| 36 |
@@ -47,7 +47,6 @@ fn expand( |
| 37 |
) -> ExpandResult<Vec<Annotatable>, Annotatable> { |
| 38 |
let template = AttributeTemplate { list: Some("path"), ..Default::default() }; |
| 39 |
validate_attr::check_builtin_meta_item( |
| 40 |
- &ecx.ecfg.features, |
| 41 |
&ecx.sess.psess, |
| 42 |
meta_item, |
| 43 |
ast::AttrStyle::Outer, |
| 44 |
diff --git a/compiler/rustc_builtin_macros/src/derive.rs b/compiler/rustc_builtin_macros/src/derive.rs |
| 45 |
index 57bddf0ab60..e8704bc2f63 100644 |
| 46 |
--- a/compiler/rustc_builtin_macros/src/derive.rs |
| 47 |
+++ b/compiler/rustc_builtin_macros/src/derive.rs |
| 48 |
@@ -38,7 +38,6 @@ fn expand( |
| 49 |
let template = |
| 50 |
AttributeTemplate { list: Some("Trait1, Trait2, ..."), ..Default::default() }; |
| 51 |
validate_attr::check_builtin_meta_item( |
| 52 |
- features, |
| 53 |
&sess.psess, |
| 54 |
meta_item, |
| 55 |
ast::AttrStyle::Outer, |
| 56 |
diff --git a/compiler/rustc_builtin_macros/src/util.rs b/compiler/rustc_builtin_macros/src/util.rs |
| 57 |
index 73cc8ff547d..0bcd5aef28b 100644 |
| 58 |
--- a/compiler/rustc_builtin_macros/src/util.rs |
| 59 |
+++ b/compiler/rustc_builtin_macros/src/util.rs |
| 60 |
@@ -17,7 +17,6 @@ pub(crate) fn check_builtin_macro_attribute(ecx: &ExtCtxt<'_>, meta_item: &MetaI |
| 61 |
// All the built-in macro attributes are "words" at the moment. |
| 62 |
let template = AttributeTemplate { word: true, ..Default::default() }; |
| 63 |
validate_attr::check_builtin_meta_item( |
| 64 |
- &ecx.ecfg.features, |
| 65 |
&ecx.sess.psess, |
| 66 |
meta_item, |
| 67 |
AttrStyle::Outer, |
| 68 |
diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs |
| 69 |
index f6bf9f5e89f..b0d3fecbb47 100644 |
| 70 |
--- a/compiler/rustc_expand/src/config.rs |
| 71 |
+++ b/compiler/rustc_expand/src/config.rs |
| 72 |
@@ -265,12 +265,7 @@ fn process_cfg_attr(&self, attr: &Attribute) -> Vec<Attribute> { |
| 73 |
/// is in the original source file. Gives a compiler error if the syntax of |
| 74 |
/// the attribute is incorrect. |
| 75 |
pub(crate) fn expand_cfg_attr(&self, cfg_attr: &Attribute, recursive: bool) -> Vec<Attribute> { |
| 76 |
- validate_attr::check_attribute_safety( |
| 77 |
- self.features.unwrap_or(&Features::default()), |
| 78 |
- &self.sess.psess, |
| 79 |
- AttributeSafety::Normal, |
| 80 |
- &cfg_attr, |
| 81 |
- ); |
| 82 |
+ validate_attr::check_attribute_safety(&self.sess.psess, AttributeSafety::Normal, &cfg_attr); |
| 83 |
|
| 84 |
let Some((cfg_predicate, expanded_attrs)) = |
| 85 |
rustc_parse::parse_cfg_attr(cfg_attr, &self.sess.psess) |
| 86 |
@@ -395,11 +390,7 @@ pub(crate) fn cfg_true(&self, attr: &Attribute) -> (bool, Option<MetaItem>) { |
| 87 |
} |
| 88 |
}; |
| 89 |
|
| 90 |
- validate_attr::deny_builtin_meta_unsafety( |
| 91 |
- self.features.unwrap_or(&Features::default()), |
| 92 |
- &self.sess.psess, |
| 93 |
- &meta_item, |
| 94 |
- ); |
| 95 |
+ validate_attr::deny_builtin_meta_unsafety(&self.sess.psess, &meta_item); |
| 96 |
|
| 97 |
( |
| 98 |
parse_cfg(&meta_item, self.sess).map_or(true, |meta_item| { |
| 99 |
diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs |
| 100 |
index d8cb367e3fa..61b36e15487 100644 |
| 101 |
--- a/compiler/rustc_expand/src/expand.rs |
| 102 |
+++ b/compiler/rustc_expand/src/expand.rs |
| 103 |
@@ -1883,7 +1883,7 @@ fn check_attributes(&self, attrs: &[ast::Attribute], call: &ast::MacCall) { |
| 104 |
let mut span: Option<Span> = None; |
| 105 |
while let Some(attr) = attrs.next() { |
| 106 |
rustc_ast_passes::feature_gate::check_attribute(attr, self.cx.sess, features); |
| 107 |
- validate_attr::check_attr(features, &self.cx.sess.psess, attr); |
| 108 |
+ validate_attr::check_attr(&self.cx.sess.psess, attr); |
| 109 |
|
| 110 |
let current_span = if let Some(sp) = span { sp.to(attr.span) } else { attr.span }; |
| 111 |
span = Some(current_span); |
| 112 |
diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs |
| 113 |
index e42a655531b..689e2d2771e 100644 |
| 114 |
--- a/compiler/rustc_feature/src/accepted.rs |
| 115 |
+++ b/compiler/rustc_feature/src/accepted.rs |
| 116 |
@@ -388,6 +388,8 @@ macro_rules! declare_features { |
| 117 |
(accepted, universal_impl_trait, "1.26.0", Some(34511)), |
| 118 |
/// Allows arbitrary delimited token streams in non-macro attributes. |
| 119 |
(accepted, unrestricted_attribute_tokens, "1.34.0", Some(55208)), |
| 120 |
+ /// Allows unsafe attributes. |
| 121 |
+ (accepted, unsafe_attributes, "CURRENT_RUSTC_VERSION", Some(123757)), |
| 122 |
/// The `unsafe_op_in_unsafe_fn` lint (allowed by default): no longer treat an unsafe function as an unsafe block. |
| 123 |
(accepted, unsafe_block_in_unsafe_fn, "1.52.0", Some(71668)), |
| 124 |
/// Allows unsafe on extern declarations and safety qualifiers over internal items. |
| 125 |
diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs |
| 126 |
index 88a4b5a8382..a9e9bdd6a41 100644 |
| 127 |
--- a/compiler/rustc_feature/src/unstable.rs |
| 128 |
+++ b/compiler/rustc_feature/src/unstable.rs |
| 129 |
@@ -627,8 +627,6 @@ pub fn internal(&self, feature: Symbol) -> bool { |
| 130 |
(unstable, type_changing_struct_update, "1.58.0", Some(86555)), |
| 131 |
/// Allows unnamed fields of struct and union type |
| 132 |
(incomplete, unnamed_fields, "1.74.0", Some(49804)), |
| 133 |
- /// Allows unsafe attributes. |
| 134 |
- (unstable, unsafe_attributes, "1.80.0", Some(123757)), |
| 135 |
/// Allows const generic parameters to be defined with types that |
| 136 |
/// are not `Sized`, e.g. `fn foo<const N: [u8]>() {`. |
| 137 |
(incomplete, unsized_const_params, "CURRENT_RUSTC_VERSION", Some(95174)), |
| 138 |
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs |
| 139 |
index ff0bdfcc9d2..aa281a6f67b 100644 |
| 140 |
--- a/compiler/rustc_lint_defs/src/builtin.rs |
| 141 |
+++ b/compiler/rustc_lint_defs/src/builtin.rs |
| 142 |
@@ -4937,7 +4937,6 @@ |
| 143 |
/// ### Example |
| 144 |
/// |
| 145 |
/// ```rust |
| 146 |
- /// #![feature(unsafe_attributes)] |
| 147 |
/// #![warn(unsafe_attr_outside_unsafe)] |
| 148 |
/// |
| 149 |
/// #[no_mangle] |
| 150 |
diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs |
| 151 |
index 8fdfbcee385..4fea00edebc 100644 |
| 152 |
--- a/compiler/rustc_parse/src/parser/attr.rs |
| 153 |
+++ b/compiler/rustc_parse/src/parser/attr.rs |
| 154 |
@@ -4,7 +4,7 @@ |
| 155 |
use rustc_errors::codes::*; |
| 156 |
use rustc_errors::{Diag, PResult}; |
| 157 |
use rustc_span::symbol::kw; |
| 158 |
-use rustc_span::{sym, BytePos, Span}; |
| 159 |
+use rustc_span::{BytePos, Span}; |
| 160 |
use thin_vec::ThinVec; |
| 161 |
use tracing::debug; |
| 162 |
|
| 163 |
@@ -261,7 +261,6 @@ pub fn parse_attr_item(&mut self, force_collect: ForceCollect) -> PResult<'a, as |
| 164 |
let is_unsafe = this.eat_keyword(kw::Unsafe); |
| 165 |
let unsafety = if is_unsafe { |
| 166 |
let unsafe_span = this.prev_token.span; |
| 167 |
- this.psess.gated_spans.gate(sym::unsafe_attributes, unsafe_span); |
| 168 |
this.expect(&token::OpenDelim(Delimiter::Parenthesis))?; |
| 169 |
ast::Safety::Unsafe(unsafe_span) |
| 170 |
} else { |
| 171 |
@@ -400,7 +399,6 @@ pub fn parse_meta_item( |
| 172 |
}; |
| 173 |
let unsafety = if is_unsafe { |
| 174 |
let unsafe_span = self.prev_token.span; |
| 175 |
- self.psess.gated_spans.gate(sym::unsafe_attributes, unsafe_span); |
| 176 |
self.expect(&token::OpenDelim(Delimiter::Parenthesis))?; |
| 177 |
|
| 178 |
ast::Safety::Unsafe(unsafe_span) |
| 179 |
diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs |
| 180 |
index a64c00f3b6c..fce41bd90be 100644 |
| 181 |
--- a/compiler/rustc_parse/src/validate_attr.rs |
| 182 |
+++ b/compiler/rustc_parse/src/validate_attr.rs |
| 183 |
@@ -7,9 +7,7 @@ |
| 184 |
NestedMetaItem, Safety, |
| 185 |
}; |
| 186 |
use rustc_errors::{Applicability, FatalError, PResult}; |
| 187 |
-use rustc_feature::{ |
| 188 |
- AttributeSafety, AttributeTemplate, BuiltinAttribute, Features, BUILTIN_ATTRIBUTE_MAP, |
| 189 |
-}; |
| 190 |
+use rustc_feature::{AttributeSafety, AttributeTemplate, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP}; |
| 191 |
use rustc_session::errors::report_lit_error; |
| 192 |
use rustc_session::lint::builtin::{ILL_FORMED_ATTRIBUTE_INPUT, UNSAFE_ATTR_OUTSIDE_UNSAFE}; |
| 193 |
use rustc_session::lint::BuiltinLintDiag; |
| 194 |
@@ -18,7 +16,7 @@ |
| 195 |
|
| 196 |
use crate::{errors, parse_in}; |
| 197 |
|
| 198 |
-pub fn check_attr(features: &Features, psess: &ParseSess, attr: &Attribute) { |
| 199 |
+pub fn check_attr(psess: &ParseSess, attr: &Attribute) { |
| 200 |
if attr.is_doc_comment() { |
| 201 |
return; |
| 202 |
} |
| 203 |
@@ -28,7 +26,7 @@ pub fn check_attr(features: &Features, psess: &ParseSess, attr: &Attribute) { |
| 204 |
|
| 205 |
// All non-builtin attributes are considered safe |
| 206 |
let safety = attr_info.map(|x| x.safety).unwrap_or(AttributeSafety::Normal); |
| 207 |
- check_attribute_safety(features, psess, safety, attr); |
| 208 |
+ check_attribute_safety(psess, safety, attr); |
| 209 |
|
| 210 |
// Check input tokens for built-in and key-value attributes. |
| 211 |
match attr_info { |
| 212 |
@@ -36,9 +34,9 @@ pub fn check_attr(features: &Features, psess: &ParseSess, attr: &Attribute) { |
| 213 |
Some(BuiltinAttribute { name, template, .. }) if *name != sym::rustc_dummy => { |
| 214 |
match parse_meta(psess, attr) { |
| 215 |
// Don't check safety again, we just did that |
| 216 |
- Ok(meta) => check_builtin_meta_item( |
| 217 |
- features, psess, &meta, attr.style, *name, *template, false, |
| 218 |
- ), |
| 219 |
+ Ok(meta) => { |
| 220 |
+ check_builtin_meta_item(psess, &meta, attr.style, *name, *template, false) |
| 221 |
+ } |
| 222 |
Err(err) => { |
| 223 |
err.emit(); |
| 224 |
} |
| 225 |
@@ -157,16 +155,7 @@ fn is_attr_template_compatible(template: &AttributeTemplate, meta: &ast::MetaIte |
| 226 |
} |
| 227 |
} |
| 228 |
|
| 229 |
-pub fn check_attribute_safety( |
| 230 |
- features: &Features, |
| 231 |
- psess: &ParseSess, |
| 232 |
- safety: AttributeSafety, |
| 233 |
- attr: &Attribute, |
| 234 |
-) { |
| 235 |
- if !features.unsafe_attributes { |
| 236 |
- return; |
| 237 |
- } |
| 238 |
- |
| 239 |
+pub fn check_attribute_safety(psess: &ParseSess, safety: AttributeSafety, attr: &Attribute) { |
| 240 |
let attr_item = attr.get_normal_item(); |
| 241 |
|
| 242 |
if safety == AttributeSafety::Unsafe { |
| 243 |
@@ -215,21 +204,18 @@ pub fn check_attribute_safety( |
| 244 |
|
| 245 |
// Called by `check_builtin_meta_item` and code that manually denies |
| 246 |
// `unsafe(...)` in `cfg` |
| 247 |
-pub fn deny_builtin_meta_unsafety(features: &Features, psess: &ParseSess, meta: &MetaItem) { |
| 248 |
+pub fn deny_builtin_meta_unsafety(psess: &ParseSess, meta: &MetaItem) { |
| 249 |
// This only supports denying unsafety right now - making builtin attributes |
| 250 |
// support unsafety will requite us to thread the actual `Attribute` through |
| 251 |
// for the nice diagnostics. |
| 252 |
- if features.unsafe_attributes { |
| 253 |
- if let Safety::Unsafe(unsafe_span) = meta.unsafety { |
| 254 |
- psess |
| 255 |
- .dcx() |
| 256 |
- .emit_err(errors::InvalidAttrUnsafe { span: unsafe_span, name: meta.path.clone() }); |
| 257 |
- } |
| 258 |
+ if let Safety::Unsafe(unsafe_span) = meta.unsafety { |
| 259 |
+ psess |
| 260 |
+ .dcx() |
| 261 |
+ .emit_err(errors::InvalidAttrUnsafe { span: unsafe_span, name: meta.path.clone() }); |
| 262 |
} |
| 263 |
} |
| 264 |
|
| 265 |
pub fn check_builtin_meta_item( |
| 266 |
- features: &Features, |
| 267 |
psess: &ParseSess, |
| 268 |
meta: &MetaItem, |
| 269 |
style: ast::AttrStyle, |
| 270 |
@@ -246,7 +232,7 @@ pub fn check_builtin_meta_item( |
| 271 |
} |
| 272 |
|
| 273 |
if deny_unsafety { |
| 274 |
- deny_builtin_meta_unsafety(features, psess, meta); |
| 275 |
+ deny_builtin_meta_unsafety(psess, meta); |
| 276 |
} |
| 277 |
} |
| 278 |
|
| 279 |
diff --git a/src/tools/rustfmt/tests/target/unsafe_attributes.rs b/src/tools/rustfmt/tests/target/unsafe_attributes.rs |
| 280 |
index a05bedc751a..d79c56f2147 100644 |
| 281 |
--- a/src/tools/rustfmt/tests/target/unsafe_attributes.rs |
| 282 |
+++ b/src/tools/rustfmt/tests/target/unsafe_attributes.rs |
| 283 |
@@ -1,4 +1,3 @@ |
| 284 |
-#![feature(unsafe_attributes)] |
| 285 |
// https://github.com/rust-lang/rust/issues/123757 |
| 286 |
// |
| 287 |
#![simple_ident] |
| 288 |
diff --git a/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs b/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs |
| 289 |
index ce365d1a8b1..6a9853b2f6f 100644 |
| 290 |
--- a/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs |
| 291 |
+++ b/tests/ui/attributes/unsafe/cfg-unsafe-attributes.rs |
| 292 |
@@ -1,5 +1,4 @@ |
| 293 |
//@ build-pass |
| 294 |
-#![feature(unsafe_attributes)] |
| 295 |
|
| 296 |
#[cfg_attr(all(), unsafe(no_mangle))] |
| 297 |
fn a() {} |
| 298 |
diff --git a/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs b/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs |
| 299 |
index b8edb4aab90..95fc19f506b 100644 |
| 300 |
--- a/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs |
| 301 |
+++ b/tests/ui/attributes/unsafe/derive-unsafe-attributes.rs |
| 302 |
@@ -1,5 +1,3 @@ |
| 303 |
-#![feature(unsafe_attributes)] |
| 304 |
- |
| 305 |
#[derive(unsafe(Debug))] |
| 306 |
//~^ ERROR: expected identifier, found keyword `unsafe` |
| 307 |
//~| ERROR: traits in `#[derive(...)]` don't accept arguments |
| 308 |
diff --git a/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr |
| 309 |
index c40a5512fd5..4002c930b63 100644 |
| 310 |
--- a/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr |
| 311 |
+++ b/tests/ui/attributes/unsafe/derive-unsafe-attributes.stderr |
| 312 |
@@ -1,5 +1,5 @@ |
| 313 |
error: expected identifier, found keyword `unsafe` |
| 314 |
- --> $DIR/derive-unsafe-attributes.rs:3:10 |
| 315 |
+ --> $DIR/derive-unsafe-attributes.rs:1:10 |
| 316 |
| |
| 317 |
LL | #[derive(unsafe(Debug))] |
| 318 |
| ^^^^^^ expected identifier, found keyword |
| 319 |
@@ -10,13 +10,13 @@ LL | #[derive(r#unsafe(Debug))] |
| 320 |
| ++ |
| 321 |
|
| 322 |
error: traits in `#[derive(...)]` don't accept arguments |
| 323 |
- --> $DIR/derive-unsafe-attributes.rs:3:16 |
| 324 |
+ --> $DIR/derive-unsafe-attributes.rs:1:16 |
| 325 |
| |
| 326 |
LL | #[derive(unsafe(Debug))] |
| 327 |
| ^^^^^^^ help: remove the arguments |
| 328 |
|
| 329 |
error: `derive` is not an unsafe attribute |
| 330 |
- --> $DIR/derive-unsafe-attributes.rs:12:3 |
| 331 |
+ --> $DIR/derive-unsafe-attributes.rs:10:3 |
| 332 |
| |
| 333 |
LL | #[unsafe(derive(Debug))] |
| 334 |
| ^^^^^^ this is not an unsafe attribute |
| 335 |
@@ -24,7 +24,7 @@ LL | #[unsafe(derive(Debug))] |
| 336 |
= note: extraneous unsafe is not allowed in attributes |
| 337 |
|
| 338 |
error: expected identifier, found keyword `unsafe` |
| 339 |
- --> $DIR/derive-unsafe-attributes.rs:3:10 |
| 340 |
+ --> $DIR/derive-unsafe-attributes.rs:1:10 |
| 341 |
| |
| 342 |
LL | #[derive(unsafe(Debug))] |
| 343 |
| ^^^^^^ expected identifier, found keyword |
| 344 |
@@ -36,7 +36,7 @@ LL | #[derive(r#unsafe(Debug))] |
| 345 |
| ++ |
| 346 |
|
| 347 |
error: expected identifier, found keyword `unsafe` |
| 348 |
- --> $DIR/derive-unsafe-attributes.rs:3:10 |
| 349 |
+ --> $DIR/derive-unsafe-attributes.rs:1:10 |
| 350 |
| |
| 351 |
LL | #[derive(unsafe(Debug))] |
| 352 |
| ^^^^^^ expected identifier, found keyword |
| 353 |
@@ -48,13 +48,13 @@ LL | #[derive(r#unsafe(Debug))] |
| 354 |
| ++ |
| 355 |
|
| 356 |
error: cannot find derive macro `r#unsafe` in this scope |
| 357 |
- --> $DIR/derive-unsafe-attributes.rs:3:10 |
| 358 |
+ --> $DIR/derive-unsafe-attributes.rs:1:10 |
| 359 |
| |
| 360 |
LL | #[derive(unsafe(Debug))] |
| 361 |
| ^^^^^^ |
| 362 |
|
| 363 |
error: cannot find derive macro `r#unsafe` in this scope |
| 364 |
- --> $DIR/derive-unsafe-attributes.rs:3:10 |
| 365 |
+ --> $DIR/derive-unsafe-attributes.rs:1:10 |
| 366 |
| |
| 367 |
LL | #[derive(unsafe(Debug))] |
| 368 |
| ^^^^^^ |
| 369 |
diff --git a/tests/ui/attributes/unsafe/double-unsafe-attributes.rs b/tests/ui/attributes/unsafe/double-unsafe-attributes.rs |
| 370 |
index a6c0ea578f2..894d1327da7 100644 |
| 371 |
--- a/tests/ui/attributes/unsafe/double-unsafe-attributes.rs |
| 372 |
+++ b/tests/ui/attributes/unsafe/double-unsafe-attributes.rs |
| 373 |
@@ -1,5 +1,3 @@ |
| 374 |
-#![feature(unsafe_attributes)] |
| 375 |
- |
| 376 |
#[unsafe(unsafe(no_mangle))] |
| 377 |
//~^ ERROR expected identifier, found keyword `unsafe` |
| 378 |
//~| ERROR cannot find attribute `r#unsafe` in this scope |
| 379 |
diff --git a/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr |
| 380 |
index 950b2636993..0825cf79408 100644 |
| 381 |
--- a/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr |
| 382 |
+++ b/tests/ui/attributes/unsafe/double-unsafe-attributes.stderr |
| 383 |
@@ -1,5 +1,5 @@ |
| 384 |
error: expected identifier, found keyword `unsafe` |
| 385 |
- --> $DIR/double-unsafe-attributes.rs:3:10 |
| 386 |
+ --> $DIR/double-unsafe-attributes.rs:1:10 |
| 387 |
| |
| 388 |
LL | #[unsafe(unsafe(no_mangle))] |
| 389 |
| ^^^^^^ expected identifier, found keyword |
| 390 |
@@ -10,7 +10,7 @@ LL | #[unsafe(r#unsafe(no_mangle))] |
| 391 |
| ++ |
| 392 |
|
| 393 |
error: `r#unsafe` is not an unsafe attribute |
| 394 |
- --> $DIR/double-unsafe-attributes.rs:3:3 |
| 395 |
+ --> $DIR/double-unsafe-attributes.rs:1:3 |
| 396 |
| |
| 397 |
LL | #[unsafe(unsafe(no_mangle))] |
| 398 |
| ^^^^^^ this is not an unsafe attribute |
| 399 |
@@ -18,7 +18,7 @@ LL | #[unsafe(unsafe(no_mangle))] |
| 400 |
= note: extraneous unsafe is not allowed in attributes |
| 401 |
|
| 402 |
error: cannot find attribute `r#unsafe` in this scope |
| 403 |
- --> $DIR/double-unsafe-attributes.rs:3:10 |
| 404 |
+ --> $DIR/double-unsafe-attributes.rs:1:10 |
| 405 |
| |
| 406 |
LL | #[unsafe(unsafe(no_mangle))] |
| 407 |
| ^^^^^^ |
| 408 |
diff --git a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs |
| 409 |
index 0181add843b..b561550c198 100644 |
| 410 |
--- a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs |
| 411 |
+++ b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.rs |
| 412 |
@@ -1,6 +1,5 @@ |
| 413 |
//@ edition: 2024 |
| 414 |
//@ compile-flags: -Zunstable-options |
| 415 |
-#![feature(unsafe_attributes)] |
| 416 |
|
| 417 |
#[unsafe(cfg(any()))] //~ ERROR: is not an unsafe attribute |
| 418 |
fn a() {} |
| 419 |
diff --git a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr |
| 420 |
index f39074b613d..9fb7f062b91 100644 |
| 421 |
--- a/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr |
| 422 |
+++ b/tests/ui/attributes/unsafe/extraneous-unsafe-attributes.stderr |
| 423 |
@@ -1,5 +1,5 @@ |
| 424 |
error: `cfg` is not an unsafe attribute |
| 425 |
- --> $DIR/extraneous-unsafe-attributes.rs:5:3 |
| 426 |
+ --> $DIR/extraneous-unsafe-attributes.rs:4:3 |
| 427 |
| |
| 428 |
LL | #[unsafe(cfg(any()))] |
| 429 |
| ^^^^^^ this is not an unsafe attribute |
| 430 |
@@ -7,7 +7,7 @@ LL | #[unsafe(cfg(any()))] |
| 431 |
= note: extraneous unsafe is not allowed in attributes |
| 432 |
|
| 433 |
error: `cfg_attr` is not an unsafe attribute |
| 434 |
- --> $DIR/extraneous-unsafe-attributes.rs:8:3 |
| 435 |
+ --> $DIR/extraneous-unsafe-attributes.rs:7:3 |
| 436 |
| |
| 437 |
LL | #[unsafe(cfg_attr(any(), allow(dead_code)))] |
| 438 |
| ^^^^^^ this is not an unsafe attribute |
| 439 |
@@ -15,7 +15,7 @@ LL | #[unsafe(cfg_attr(any(), allow(dead_code)))] |
| 440 |
= note: extraneous unsafe is not allowed in attributes |
| 441 |
|
| 442 |
error: `test` is not an unsafe attribute |
| 443 |
- --> $DIR/extraneous-unsafe-attributes.rs:11:3 |
| 444 |
+ --> $DIR/extraneous-unsafe-attributes.rs:10:3 |
| 445 |
| |
| 446 |
LL | #[unsafe(test)] |
| 447 |
| ^^^^^^ this is not an unsafe attribute |
| 448 |
@@ -23,7 +23,7 @@ LL | #[unsafe(test)] |
| 449 |
= note: extraneous unsafe is not allowed in attributes |
| 450 |
|
| 451 |
error: `ignore` is not an unsafe attribute |
| 452 |
- --> $DIR/extraneous-unsafe-attributes.rs:14:3 |
| 453 |
+ --> $DIR/extraneous-unsafe-attributes.rs:13:3 |
| 454 |
| |
| 455 |
LL | #[unsafe(ignore = "test")] |
| 456 |
| ^^^^^^ this is not an unsafe attribute |
| 457 |
@@ -31,7 +31,7 @@ LL | #[unsafe(ignore = "test")] |
| 458 |
= note: extraneous unsafe is not allowed in attributes |
| 459 |
|
| 460 |
error: `should_panic` is not an unsafe attribute |
| 461 |
- --> $DIR/extraneous-unsafe-attributes.rs:17:3 |
| 462 |
+ --> $DIR/extraneous-unsafe-attributes.rs:16:3 |
| 463 |
| |
| 464 |
LL | #[unsafe(should_panic(expected = "test"))] |
| 465 |
| ^^^^^^ this is not an unsafe attribute |
| 466 |
@@ -39,7 +39,7 @@ LL | #[unsafe(should_panic(expected = "test"))] |
| 467 |
= note: extraneous unsafe is not allowed in attributes |
| 468 |
|
| 469 |
error: `macro_use` is not an unsafe attribute |
| 470 |
- --> $DIR/extraneous-unsafe-attributes.rs:20:3 |
| 471 |
+ --> $DIR/extraneous-unsafe-attributes.rs:19:3 |
| 472 |
| |
| 473 |
LL | #[unsafe(macro_use)] |
| 474 |
| ^^^^^^ this is not an unsafe attribute |
| 475 |
@@ -47,7 +47,7 @@ LL | #[unsafe(macro_use)] |
| 476 |
= note: extraneous unsafe is not allowed in attributes |
| 477 |
|
| 478 |
error: `macro_export` is not an unsafe attribute |
| 479 |
- --> $DIR/extraneous-unsafe-attributes.rs:22:7 |
| 480 |
+ --> $DIR/extraneous-unsafe-attributes.rs:21:7 |
| 481 |
| |
| 482 |
LL | #[unsafe(macro_export)] |
| 483 |
| ^^^^^^ this is not an unsafe attribute |
| 484 |
@@ -55,7 +55,7 @@ LL | #[unsafe(macro_export)] |
| 485 |
= note: extraneous unsafe is not allowed in attributes |
| 486 |
|
| 487 |
error: `used` is not an unsafe attribute |
| 488 |
- --> $DIR/extraneous-unsafe-attributes.rs:28:3 |
| 489 |
+ --> $DIR/extraneous-unsafe-attributes.rs:27:3 |
| 490 |
| |
| 491 |
LL | #[unsafe(used)] |
| 492 |
| ^^^^^^ this is not an unsafe attribute |
| 493 |
diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs |
| 494 |
index f29a5b3252b..eaf8706369a 100644 |
| 495 |
--- a/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs |
| 496 |
+++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.rs |
| 497 |
@@ -1,5 +1,3 @@ |
| 498 |
-#![feature(unsafe_attributes)] |
| 499 |
- |
| 500 |
#[unsafe(proc_macro)] |
| 501 |
//~^ ERROR: is not an unsafe attribute |
| 502 |
//~| ERROR attribute is only usable with crates of the `proc-macro` crate type |
| 503 |
diff --git a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr |
| 504 |
index 79d34d458bd..9c5751c82e4 100644 |
| 505 |
--- a/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr |
| 506 |
+++ b/tests/ui/attributes/unsafe/proc-unsafe-attributes.stderr |
| 507 |
@@ -1,11 +1,11 @@ |
| 508 |
error[E0452]: malformed lint attribute input |
| 509 |
- --> $DIR/proc-unsafe-attributes.rs:28:16 |
| 510 |
+ --> $DIR/proc-unsafe-attributes.rs:26:16 |
| 511 |
| |
| 512 |
LL | #[unsafe(allow(unsafe(dead_code)))] |
| 513 |
| ^^^^^^^^^^^^^^^^^ bad attribute argument |
| 514 |
|
| 515 |
error[E0452]: malformed lint attribute input |
| 516 |
- --> $DIR/proc-unsafe-attributes.rs:28:16 |
| 517 |
+ --> $DIR/proc-unsafe-attributes.rs:26:16 |
| 518 |
| |
| 519 |
LL | #[unsafe(allow(unsafe(dead_code)))] |
| 520 |
| ^^^^^^^^^^^^^^^^^ bad attribute argument |
| 521 |
@@ -13,7 +13,7 @@ LL | #[unsafe(allow(unsafe(dead_code)))] |
| 522 |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 523 |
|
| 524 |
error: `proc_macro` is not an unsafe attribute |
| 525 |
- --> $DIR/proc-unsafe-attributes.rs:3:3 |
| 526 |
+ --> $DIR/proc-unsafe-attributes.rs:1:3 |
| 527 |
| |
| 528 |
LL | #[unsafe(proc_macro)] |
| 529 |
| ^^^^^^ this is not an unsafe attribute |
| 530 |
@@ -21,7 +21,7 @@ LL | #[unsafe(proc_macro)] |
| 531 |
= note: extraneous unsafe is not allowed in attributes |
| 532 |
|
| 533 |
error: `proc_macro_derive` is not an unsafe attribute |
| 534 |
- --> $DIR/proc-unsafe-attributes.rs:9:3 |
| 535 |
+ --> $DIR/proc-unsafe-attributes.rs:7:3 |
| 536 |
| |
| 537 |
LL | #[unsafe(proc_macro_derive(Foo))] |
| 538 |
| ^^^^^^ this is not an unsafe attribute |
| 539 |
@@ -29,7 +29,7 @@ LL | #[unsafe(proc_macro_derive(Foo))] |
| 540 |
= note: extraneous unsafe is not allowed in attributes |
| 541 |
|
| 542 |
error: expected identifier, found keyword `unsafe` |
| 543 |
- --> $DIR/proc-unsafe-attributes.rs:14:21 |
| 544 |
+ --> $DIR/proc-unsafe-attributes.rs:12:21 |
| 545 |
| |
| 546 |
LL | #[proc_macro_derive(unsafe(Foo))] |
| 547 |
| ^^^^^^ expected identifier, found keyword |
| 548 |
@@ -40,7 +40,7 @@ LL | #[proc_macro_derive(r#unsafe(Foo))] |
| 549 |
| ++ |
| 550 |
|
| 551 |
error: `proc_macro_attribute` is not an unsafe attribute |
| 552 |
- --> $DIR/proc-unsafe-attributes.rs:19:3 |
| 553 |
+ --> $DIR/proc-unsafe-attributes.rs:17:3 |
| 554 |
| |
| 555 |
LL | #[unsafe(proc_macro_attribute)] |
| 556 |
| ^^^^^^ this is not an unsafe attribute |
| 557 |
@@ -48,7 +48,7 @@ LL | #[unsafe(proc_macro_attribute)] |
| 558 |
= note: extraneous unsafe is not allowed in attributes |
| 559 |
|
| 560 |
error: `allow` is not an unsafe attribute |
| 561 |
- --> $DIR/proc-unsafe-attributes.rs:24:3 |
| 562 |
+ --> $DIR/proc-unsafe-attributes.rs:22:3 |
| 563 |
| |
| 564 |
LL | #[unsafe(allow(dead_code))] |
| 565 |
| ^^^^^^ this is not an unsafe attribute |
| 566 |
@@ -56,7 +56,7 @@ LL | #[unsafe(allow(dead_code))] |
| 567 |
= note: extraneous unsafe is not allowed in attributes |
| 568 |
|
| 569 |
error: `allow` is not an unsafe attribute |
| 570 |
- --> $DIR/proc-unsafe-attributes.rs:28:3 |
| 571 |
+ --> $DIR/proc-unsafe-attributes.rs:26:3 |
| 572 |
| |
| 573 |
LL | #[unsafe(allow(unsafe(dead_code)))] |
| 574 |
| ^^^^^^ this is not an unsafe attribute |
| 575 |
@@ -64,7 +64,7 @@ LL | #[unsafe(allow(unsafe(dead_code)))] |
| 576 |
= note: extraneous unsafe is not allowed in attributes |
| 577 |
|
| 578 |
error: expected identifier, found keyword `unsafe` |
| 579 |
- --> $DIR/proc-unsafe-attributes.rs:28:16 |
| 580 |
+ --> $DIR/proc-unsafe-attributes.rs:26:16 |
| 581 |
| |
| 582 |
LL | #[unsafe(allow(unsafe(dead_code)))] |
| 583 |
| ^^^^^^ expected identifier, found keyword |
| 584 |
@@ -75,31 +75,31 @@ LL | #[unsafe(allow(r#unsafe(dead_code)))] |
| 585 |
| ++ |
| 586 |
|
| 587 |
error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type |
| 588 |
- --> $DIR/proc-unsafe-attributes.rs:3:1 |
| 589 |
+ --> $DIR/proc-unsafe-attributes.rs:1:1 |
| 590 |
| |
| 591 |
LL | #[unsafe(proc_macro)] |
| 592 |
| ^^^^^^^^^^^^^^^^^^^^^ |
| 593 |
|
| 594 |
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type |
| 595 |
- --> $DIR/proc-unsafe-attributes.rs:9:1 |
| 596 |
+ --> $DIR/proc-unsafe-attributes.rs:7:1 |
| 597 |
| |
| 598 |
LL | #[unsafe(proc_macro_derive(Foo))] |
| 599 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 600 |
|
| 601 |
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type |
| 602 |
- --> $DIR/proc-unsafe-attributes.rs:14:1 |
| 603 |
+ --> $DIR/proc-unsafe-attributes.rs:12:1 |
| 604 |
| |
| 605 |
LL | #[proc_macro_derive(unsafe(Foo))] |
| 606 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 607 |
|
| 608 |
error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type |
| 609 |
- --> $DIR/proc-unsafe-attributes.rs:19:1 |
| 610 |
+ --> $DIR/proc-unsafe-attributes.rs:17:1 |
| 611 |
| |
| 612 |
LL | #[unsafe(proc_macro_attribute)] |
| 613 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 614 |
|
| 615 |
error[E0452]: malformed lint attribute input |
| 616 |
- --> $DIR/proc-unsafe-attributes.rs:28:16 |
| 617 |
+ --> $DIR/proc-unsafe-attributes.rs:26:16 |
| 618 |
| |
| 619 |
LL | #[unsafe(allow(unsafe(dead_code)))] |
| 620 |
| ^^^^^^^^^^^^^^^^^ bad attribute argument |
| 621 |
@@ -107,7 +107,7 @@ LL | #[unsafe(allow(unsafe(dead_code)))] |
| 622 |
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 623 |
|
| 624 |
error[E0452]: malformed lint attribute input |
| 625 |
- --> $DIR/proc-unsafe-attributes.rs:28:16 |
| 626 |
+ --> $DIR/proc-unsafe-attributes.rs:26:16 |
| 627 |
| |
| 628 |
LL | #[unsafe(allow(unsafe(dead_code)))] |
| 629 |
| ^^^^^^^^^^^^^^^^^ bad attribute argument |
| 630 |
diff --git a/tests/ui/attributes/unsafe/unsafe-attributes.rs b/tests/ui/attributes/unsafe/unsafe-attributes.rs |
| 631 |
index 33a412add50..5c57767b3b9 100644 |
| 632 |
--- a/tests/ui/attributes/unsafe/unsafe-attributes.rs |
| 633 |
+++ b/tests/ui/attributes/unsafe/unsafe-attributes.rs |
| 634 |
@@ -1,5 +1,4 @@ |
| 635 |
//@ build-pass |
| 636 |
-#![feature(unsafe_attributes)] |
| 637 |
|
| 638 |
#[unsafe(no_mangle)] |
| 639 |
fn a() {} |
| 640 |
diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs b/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs |
| 641 |
index 67db36afd2e..5af03a2b8d1 100644 |
| 642 |
--- a/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs |
| 643 |
+++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute.rs |
| 644 |
@@ -1,5 +1,3 @@ |
| 645 |
-#![feature(unsafe_attributes)] |
| 646 |
- |
| 647 |
#[unsafe(repr(C))] //~ ERROR: is not an unsafe attribute |
| 648 |
struct Foo {} |
| 649 |
|
| 650 |
diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr b/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr |
| 651 |
index 584b0ea797d..55172c91aae 100644 |
| 652 |
--- a/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr |
| 653 |
+++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute.stderr |
| 654 |
@@ -1,5 +1,5 @@ |
| 655 |
error: `repr` is not an unsafe attribute |
| 656 |
- --> $DIR/unsafe-safe-attribute.rs:3:3 |
| 657 |
+ --> $DIR/unsafe-safe-attribute.rs:1:3 |
| 658 |
| |
| 659 |
LL | #[unsafe(repr(C))] |
| 660 |
| ^^^^^^ this is not an unsafe attribute |
| 661 |
diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs |
| 662 |
index ff2eb61b405..0f241cc439f 100644 |
| 663 |
--- a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs |
| 664 |
+++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.rs |
| 665 |
@@ -1,5 +1,3 @@ |
| 666 |
-#![feature(unsafe_attributes)] |
| 667 |
- |
| 668 |
#[unsafe(diagnostic::on_unimplemented( //~ ERROR: is not an unsafe attribute |
| 669 |
message = "testing", |
| 670 |
))] |
| 671 |
diff --git a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr |
| 672 |
index 26b5e4e37b9..3bc291db5ac 100644 |
| 673 |
--- a/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr |
| 674 |
+++ b/tests/ui/attributes/unsafe/unsafe-safe-attribute_diagnostic.stderr |
| 675 |
@@ -1,5 +1,5 @@ |
| 676 |
error: `diagnostic::on_unimplemented` is not an unsafe attribute |
| 677 |
- --> $DIR/unsafe-safe-attribute_diagnostic.rs:3:3 |
| 678 |
+ --> $DIR/unsafe-safe-attribute_diagnostic.rs:1:3 |
| 679 |
| |
| 680 |
LL | #[unsafe(diagnostic::on_unimplemented( |
| 681 |
| ^^^^^^ this is not an unsafe attribute |
| 682 |
diff --git a/tests/ui/feature-gates/feature-gate-unsafe-attributes.rs b/tests/ui/feature-gates/feature-gate-unsafe-attributes.rs |
| 683 |
deleted file mode 100644 |
| 684 |
index 9eba415dda0..00000000000 |
| 685 |
--- a/tests/ui/feature-gates/feature-gate-unsafe-attributes.rs |
| 686 |
+++ /dev/null |
| 687 |
@@ -1,8 +0,0 @@ |
| 688 |
-#[unsafe(no_mangle)] //~ ERROR [E0658] |
| 689 |
-extern "C" fn foo() { |
| 690 |
- |
| 691 |
-} |
| 692 |
- |
| 693 |
-fn main() { |
| 694 |
- foo(); |
| 695 |
-} |
| 696 |
diff --git a/tests/ui/feature-gates/feature-gate-unsafe-attributes.stderr b/tests/ui/feature-gates/feature-gate-unsafe-attributes.stderr |
| 697 |
deleted file mode 100644 |
| 698 |
index dfcea756b02..00000000000 |
| 699 |
--- a/tests/ui/feature-gates/feature-gate-unsafe-attributes.stderr |
| 700 |
+++ /dev/null |
| 701 |
@@ -1,13 +0,0 @@ |
| 702 |
-error[E0658]: `#[unsafe()]` markers for attributes are experimental |
| 703 |
- --> $DIR/feature-gate-unsafe-attributes.rs:1:3 |
| 704 |
- | |
| 705 |
-LL | #[unsafe(no_mangle)] |
| 706 |
- | ^^^^^^ |
| 707 |
- | |
| 708 |
- = note: see issue #123757 <https://github.com/rust-lang/rust/issues/123757> for more information |
| 709 |
- = help: add `#![feature(unsafe_attributes)]` to the crate attributes to enable |
| 710 |
- = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 711 |
- |
| 712 |
-error: aborting due to 1 previous error |
| 713 |
- |
| 714 |
-For more information about this error, try `rustc --explain E0658`. |
| 715 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs |
| 716 |
index c6f9115cde7..f3b8645abaf 100644 |
| 717 |
--- a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs |
| 718 |
+++ b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.rs |
| 719 |
@@ -1,5 +1,4 @@ |
| 720 |
#![deny(rust_2024_compatibility)] |
| 721 |
-#![feature(unsafe_attributes)] |
| 722 |
|
| 723 |
#[no_mangle] |
| 724 |
//~^ ERROR: unsafe attribute used without unsafe |
| 725 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr |
| 726 |
index f0689d9883c..4629a154ac3 100644 |
| 727 |
--- a/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr |
| 728 |
+++ b/tests/ui/rust-2024/unsafe-attributes/in_2024_compatibility.stderr |
| 729 |
@@ -1,5 +1,5 @@ |
| 730 |
error: unsafe attribute used without unsafe |
| 731 |
- --> $DIR/in_2024_compatibility.rs:4:3 |
| 732 |
+ --> $DIR/in_2024_compatibility.rs:3:3 |
| 733 |
| |
| 734 |
LL | #[no_mangle] |
| 735 |
| ^^^^^^^^^ usage of unsafe attribute |
| 736 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs |
| 737 |
index 279ced2525a..7c919fed976 100644 |
| 738 |
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs |
| 739 |
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attribute-marked.rs |
| 740 |
@@ -4,7 +4,6 @@ |
| 741 |
//@[edition2024] compile-flags: -Zunstable-options |
| 742 |
//@ check-pass |
| 743 |
|
| 744 |
-#![feature(unsafe_attributes)] |
| 745 |
|
| 746 |
#[unsafe(no_mangle)] |
| 747 |
extern "C" fn foo() {} |
| 748 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed |
| 749 |
index 6ebdff0334c..586881d1807 100644 |
| 750 |
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed |
| 751 |
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.fixed |
| 752 |
@@ -1,5 +1,4 @@ |
| 753 |
//@ run-rustfix |
| 754 |
-#![feature(unsafe_attributes)] |
| 755 |
#![deny(unsafe_attr_outside_unsafe)] |
| 756 |
|
| 757 |
macro_rules! tt { |
| 758 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs |
| 759 |
index c78ff45ea4c..03e122c7d57 100644 |
| 760 |
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs |
| 761 |
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.rs |
| 762 |
@@ -1,5 +1,4 @@ |
| 763 |
//@ run-rustfix |
| 764 |
-#![feature(unsafe_attributes)] |
| 765 |
#![deny(unsafe_attr_outside_unsafe)] |
| 766 |
|
| 767 |
macro_rules! tt { |
| 768 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr |
| 769 |
index c95984f58ec..64debc58905 100644 |
| 770 |
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr |
| 771 |
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes-fix.stderr |
| 772 |
@@ -1,5 +1,5 @@ |
| 773 |
error: unsafe attribute used without unsafe |
| 774 |
- --> $DIR/unsafe-attributes-fix.rs:44:6 |
| 775 |
+ --> $DIR/unsafe-attributes-fix.rs:43:6 |
| 776 |
| |
| 777 |
LL | tt!([no_mangle]); |
| 778 |
| ^^^^^^^^^ usage of unsafe attribute |
| 779 |
@@ -7,7 +7,7 @@ LL | tt!([no_mangle]); |
| 780 |
= warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2024! |
| 781 |
= note: for more information, see issue #123757 <https://github.com/rust-lang/rust/issues/123757> |
| 782 |
note: the lint level is defined here |
| 783 |
- --> $DIR/unsafe-attributes-fix.rs:3:9 |
| 784 |
+ --> $DIR/unsafe-attributes-fix.rs:2:9 |
| 785 |
| |
| 786 |
LL | #![deny(unsafe_attr_outside_unsafe)] |
| 787 |
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 788 |
@@ -17,7 +17,7 @@ LL | tt!([unsafe(no_mangle)]); |
| 789 |
| +++++++ + |
| 790 |
|
| 791 |
error: unsafe attribute used without unsafe |
| 792 |
- --> $DIR/unsafe-attributes-fix.rs:14:11 |
| 793 |
+ --> $DIR/unsafe-attributes-fix.rs:13:11 |
| 794 |
| |
| 795 |
LL | #[$e] |
| 796 |
| ^^ usage of unsafe attribute |
| 797 |
@@ -34,7 +34,7 @@ LL | #[unsafe($e)] |
| 798 |
| +++++++ + |
| 799 |
|
| 800 |
error: unsafe attribute used without unsafe |
| 801 |
- --> $DIR/unsafe-attributes-fix.rs:48:7 |
| 802 |
+ --> $DIR/unsafe-attributes-fix.rs:47:7 |
| 803 |
| |
| 804 |
LL | meta!(no_mangle); |
| 805 |
| ^^^^^^^^^ usage of unsafe attribute |
| 806 |
@@ -47,7 +47,7 @@ LL | meta!(unsafe(no_mangle)); |
| 807 |
| +++++++ + |
| 808 |
|
| 809 |
error: unsafe attribute used without unsafe |
| 810 |
- --> $DIR/unsafe-attributes-fix.rs:51:8 |
| 811 |
+ --> $DIR/unsafe-attributes-fix.rs:50:8 |
| 812 |
| |
| 813 |
LL | meta2!(export_name = "baw"); |
| 814 |
| ^^^^^^^^^^^ usage of unsafe attribute |
| 815 |
@@ -60,7 +60,7 @@ LL | meta2!(unsafe(export_name = "baw")); |
| 816 |
| +++++++ + |
| 817 |
|
| 818 |
error: unsafe attribute used without unsafe |
| 819 |
- --> $DIR/unsafe-attributes-fix.rs:23:11 |
| 820 |
+ --> $DIR/unsafe-attributes-fix.rs:22:11 |
| 821 |
| |
| 822 |
LL | #[$e = $l] |
| 823 |
| ^^ usage of unsafe attribute |
| 824 |
@@ -77,7 +77,7 @@ LL | #[unsafe($e = $l)] |
| 825 |
| +++++++ + |
| 826 |
|
| 827 |
error: unsafe attribute used without unsafe |
| 828 |
- --> $DIR/unsafe-attributes-fix.rs:56:3 |
| 829 |
+ --> $DIR/unsafe-attributes-fix.rs:55:3 |
| 830 |
| |
| 831 |
LL | #[no_mangle] |
| 832 |
| ^^^^^^^^^ usage of unsafe attribute |
| 833 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr |
| 834 |
index 35475d66716..fb697e14ef1 100644 |
| 835 |
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr |
| 836 |
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.edition2024.stderr |
| 837 |
@@ -1,5 +1,5 @@ |
| 838 |
error: unsafe attribute used without unsafe |
| 839 |
- --> $DIR/unsafe-attributes.rs:9:3 |
| 840 |
+ --> $DIR/unsafe-attributes.rs:8:3 |
| 841 |
| |
| 842 |
LL | #[no_mangle] |
| 843 |
| ^^^^^^^^^ usage of unsafe attribute |
| 844 |
diff --git a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs |
| 845 |
index 3a6af9dfb2b..f6f2994bb6d 100644 |
| 846 |
--- a/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs |
| 847 |
+++ b/tests/ui/rust-2024/unsafe-attributes/unsafe-attributes.rs |
| 848 |
@@ -4,7 +4,6 @@ |
| 849 |
//@[edition2024] edition:2024 |
| 850 |
//@[edition2024] compile-flags: -Zunstable-options |
| 851 |
|
| 852 |
-#![feature(unsafe_attributes)] |
| 853 |
|
| 854 |
#[no_mangle] //[edition2024]~ ERROR: unsafe attribute used without unsafe |
| 855 |
extern "C" fn foo() {} |