| author | bors <bors@rust-lang.org> 2026-06-03 19:50:26 UTC |
| committer | bors <bors@rust-lang.org> 2026-06-03 19:50:26 UTC |
| log | b354133fb126352871bea4b40795a45739adff2b |
| tree | edeb653458ef5340d2ad52682f8c4c8321cec34e |
| parent | 9c963eecaaa5e9ef270e235a8b35f05e33b597ed |
| parent | c4f09d540b45d7f9135fc595e7811fbab4a2849f |
Rollup of 12 pull requests
Successful merges:
- rust-lang/rust#157085 (powerpc: warn against incorrect values for ABI-relevant target features)
- rust-lang/rust#157170 (Use `impl` restrictions in `std`, `core`)
- rust-lang/rust#157217 ([tiny] remove unecessary `.into()` calls)
- rust-lang/rust#157262 (rustdoc: IXCRE: Preserve sizedness bounds on type params belonging to the parent item)
- rust-lang/rust#157379 (Some more simple per-owner resolver changes)
- rust-lang/rust#157381 (librustdoc: fix CSS border issue to support Firefox high contrast mode)
- rust-lang/rust#155512 (interpreter: improve comments and error message in mir_assign_valid_types)
- rust-lang/rust#157254 (Correct description of panic.rs)
- rust-lang/rust#157290 (interpret: fix mir::UnOp layout computation)
- rust-lang/rust#157332 (Rewrite target checking for `#[sanitize]`)
- rust-lang/rust#157351 (Avoid leaking the query-job collection warning into the panic query stack)
- rust-lang/rust#157389 (Add @clarfonthey to libs review rotation)105 files changed, 568 insertions(+), 725 deletions(-)
compiler/rustc_ast_lowering/src/lib.rs+5-10| ... | ... | @@ -126,7 +126,7 @@ struct LoweringContext<'a, 'hir> { |
| 126 | 126 | is_in_dyn_type: bool, |
| 127 | 127 | |
| 128 | 128 | current_hir_id_owner: hir::OwnerId, |
| 129 | owner: &'a PerOwnerResolverData, | |
| 129 | owner: &'a PerOwnerResolverData<'hir>, | |
| 130 | 130 | item_local_id_counter: hir::ItemLocalId, |
| 131 | 131 | trait_map: ItemLocalMap<&'hir [TraitCandidate<'hir>]>, |
| 132 | 132 | |
| ... | ... | @@ -288,11 +288,6 @@ impl<'tcx> ResolverAstLowering<'tcx> { |
| 288 | 288 | .map(|fn_indexes| fn_indexes.iter().map(|(num, _)| *num).collect()) |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | /// Obtains per-namespace resolutions for `use` statement with the given `NodeId`. | |
| 292 | fn get_import_res(&self, id: NodeId) -> PerNS<Option<Res<NodeId>>> { | |
| 293 | self.import_res_map.get(&id).copied().unwrap_or_default() | |
| 294 | } | |
| 295 | ||
| 296 | 291 | /// Obtain the list of lifetimes parameters to add to an item. |
| 297 | 292 | /// |
| 298 | 293 | /// Extra lifetime parameters should only be added in places that can appear |
| ... | ... | @@ -810,8 +805,8 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 810 | 805 | self.children.push((def_id, hir::MaybeOwner::NonOwner(hir_id))); |
| 811 | 806 | } |
| 812 | 807 | |
| 813 | if let Some(traits) = self.resolver.trait_map.get(&ast_node_id) { | |
| 814 | self.trait_map.insert(hir_id.local_id, &traits[..]); | |
| 808 | if let Some(traits) = self.owner.trait_map.get(&ast_node_id) { | |
| 809 | self.trait_map.insert(hir_id.local_id, *traits); | |
| 815 | 810 | } |
| 816 | 811 | |
| 817 | 812 | // Check whether the same `NodeId` is lowered more than once. |
| ... | ... | @@ -856,8 +851,8 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 856 | 851 | } |
| 857 | 852 | |
| 858 | 853 | fn lower_import_res(&mut self, id: NodeId, span: Span) -> PerNS<Option<Res>> { |
| 859 | let per_ns = self.resolver.get_import_res(id); | |
| 860 | let per_ns = per_ns.map(|res| res.map(|res| self.lower_res(res))); | |
| 854 | debug_assert_eq!(id, self.owner.id); | |
| 855 | let per_ns = self.owner.import_res.map(|res| res.map(|res| self.lower_res(res))); | |
| 861 | 856 | if per_ns.is_empty() { |
| 862 | 857 | // Propagate the error to all namespaces, just to be sure. |
| 863 | 858 | self.dcx().span_delayed_bug(span, "no resolution for an import"); |
compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs+25-2| ... | ... | @@ -8,6 +8,7 @@ use crate::attributes::AttributeSafety; |
| 8 | 8 | use crate::session_diagnostics::{ |
| 9 | 9 | EmptyExportName, NakedFunctionIncompatibleAttribute, NullOnExport, NullOnObjcClass, |
| 10 | 10 | NullOnObjcSelector, ObjcClassExpectedStringLiteral, ObjcSelectorExpectedStringLiteral, |
| 11 | SanitizeInvalidStatic, | |
| 11 | 12 | }; |
| 12 | 13 | use crate::target_checking::Policy::AllowSilent; |
| 13 | 14 | |
| ... | ... | @@ -566,8 +567,18 @@ pub(crate) struct SanitizeParser; |
| 566 | 567 | |
| 567 | 568 | impl SingleAttributeParser for SanitizeParser { |
| 568 | 569 | const PATH: &[Symbol] = &[sym::sanitize]; |
| 569 | // FIXME: still checked in check_attrs.rs | |
| 570 | const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(ALL_TARGETS); | |
| 570 | const ALLOWED_TARGETS: AllowedTargets = AllowedTargets::AllowList(&[ | |
| 571 | Allow(Target::Fn), | |
| 572 | Allow(Target::Closure), | |
| 573 | Allow(Target::Method(MethodKind::Inherent)), | |
| 574 | Allow(Target::Method(MethodKind::Trait { body: true })), | |
| 575 | Allow(Target::Method(MethodKind::TraitImpl)), | |
| 576 | Allow(Target::Impl { of_trait: false }), | |
| 577 | Allow(Target::Impl { of_trait: true }), | |
| 578 | Allow(Target::Mod), | |
| 579 | Allow(Target::Crate), | |
| 580 | Allow(Target::Static), | |
| 581 | ]); | |
| 571 | 582 | const TEMPLATE: AttributeTemplate = template!(List: &[ |
| 572 | 583 | r#"address = "on|off""#, |
| 573 | 584 | r#"kernel_address = "on|off""#, |
| ... | ... | @@ -668,6 +679,18 @@ impl SingleAttributeParser for SanitizeParser { |
| 668 | 679 | } |
| 669 | 680 | } |
| 670 | 681 | |
| 682 | // The sanitizer attribute is only allowed on statics, if only address bits are set | |
| 683 | let all_set_except_address = | |
| 684 | (on_set | off_set) & !(SanitizerSet::ADDRESS | SanitizerSet::KERNELADDRESS); | |
| 685 | if cx.target == Target::Static | |
| 686 | && let Some(set) = all_set_except_address.iter().next() | |
| 687 | { | |
| 688 | cx.emit_err(SanitizeInvalidStatic { | |
| 689 | span: cx.attr_span, | |
| 690 | field: set.as_str().expect("Since this `SanitizerSet` is returned from an iterator, exactly one field is set") | |
| 691 | }); | |
| 692 | } | |
| 693 | ||
| 671 | 694 | Some(AttributeKind::Sanitize { on_set, off_set, rtsan, span: cx.attr_span }) |
| 672 | 695 | } |
| 673 | 696 | } |
compiler/rustc_attr_parsing/src/session_diagnostics.rs+9| ... | ... | @@ -1023,3 +1023,12 @@ pub(crate) enum InvalidMachoSectionReason { |
| 1023 | 1023 | #[note("section name `{$section}` is longer than 16 bytes")] |
| 1024 | 1024 | SectionTooLong { section: String }, |
| 1025 | 1025 | } |
| 1026 | ||
| 1027 | #[derive(Diagnostic)] | |
| 1028 | #[diag("`#[sanitize({$field} = ...)]` attribute cannot be used on statics")] | |
| 1029 | #[help("`#[sanitize]` can be used on statics if only the address is sanitized")] | |
| 1030 | pub(crate) struct SanitizeInvalidStatic { | |
| 1031 | #[primary_span] | |
| 1032 | pub span: Span, | |
| 1033 | pub field: &'static str, | |
| 1034 | } |
compiler/rustc_attr_parsing/src/target_checking.rs+14| ... | ... | @@ -361,6 +361,13 @@ pub(crate) fn allowed_targets_applied( |
| 361 | 361 | Target::Method(MethodKind::Trait { body: true }), |
| 362 | 362 | Target::Method(MethodKind::TraitImpl), |
| 363 | 363 | ]; |
| 364 | const FUNCTION_WITH_BODY_LIKE: &[Target] = &[ | |
| 365 | Target::Fn, | |
| 366 | Target::Closure, | |
| 367 | Target::Method(MethodKind::Inherent), | |
| 368 | Target::Method(MethodKind::Trait { body: true }), | |
| 369 | Target::Method(MethodKind::TraitImpl), | |
| 370 | ]; | |
| 364 | 371 | const METHOD_LIKE: &[Target] = &[ |
| 365 | 372 | Target::Method(MethodKind::Inherent), |
| 366 | 373 | Target::Method(MethodKind::Trait { body: false }), |
| ... | ... | @@ -379,6 +386,13 @@ pub(crate) fn allowed_targets_applied( |
| 379 | 386 | target, |
| 380 | 387 | &mut added_fake_targets, |
| 381 | 388 | ); |
| 389 | filter_targets( | |
| 390 | &mut allowed_targets, | |
| 391 | FUNCTION_WITH_BODY_LIKE, | |
| 392 | "functions with a body", | |
| 393 | target, | |
| 394 | &mut added_fake_targets, | |
| 395 | ); | |
| 382 | 396 | filter_targets(&mut allowed_targets, METHOD_LIKE, "methods", target, &mut added_fake_targets); |
| 383 | 397 | filter_targets(&mut allowed_targets, IMPL_LIKE, "impl blocks", target, &mut added_fake_targets); |
| 384 | 398 | filter_targets(&mut allowed_targets, ADT_LIKE, "data types", target, &mut added_fake_targets); |
compiler/rustc_builtin_macros/src/format_foreign/shell/tests.rs+1-1| ... | ... | @@ -22,7 +22,7 @@ fn test_escape() { |
| 22 | 22 | fn test_parse() { |
| 23 | 23 | macro_rules! assert_pns_eq_sub { |
| 24 | 24 | ($in_:expr, $kind:ident($arg:expr, $pos:expr)) => { |
| 25 | assert_eq!(pns(concat!($in_, "!")), Some((S::$kind($arg.into(), $pos), "!"))) | |
| 25 | assert_eq!(pns(concat!($in_, "!")), Some((S::$kind($arg, $pos), "!"))) | |
| 26 | 26 | }; |
| 27 | 27 | } |
| 28 | 28 |
compiler/rustc_const_eval/src/interpret/eval_context.rs+16-11| ... | ... | @@ -165,25 +165,30 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /// Test if it is valid for a MIR assignment to assign `src`-typed place to `dest`-typed value. |
| 168 | /// This test should be symmetric, as it is primarily about layout compatibility. | |
| 169 | 168 | pub(super) fn mir_assign_valid_types<'tcx>( |
| 170 | 169 | tcx: TyCtxt<'tcx>, |
| 171 | 170 | typing_env: TypingEnv<'tcx>, |
| 172 | 171 | src: TyAndLayout<'tcx>, |
| 173 | 172 | dest: TyAndLayout<'tcx>, |
| 174 | 173 | ) -> bool { |
| 175 | // Type-changing assignments can happen when subtyping is used. While | |
| 176 | // all normal lifetimes are erased, higher-ranked types with their | |
| 177 | // late-bound lifetimes are still around and can lead to type | |
| 178 | // differences. | |
| 174 | // We *could* check `Invariant` here since all subtyping must be explicit post-borrowck. | |
| 175 | // However, this check is also used by the interpreter to figure out if a transmute can be | |
| 176 | // turned into a regular assignment (which has a more efficient codepath), so we want the check | |
| 177 | // to consider as many assignments as possible to be valid. Therefore we are happy to accept | |
| 178 | // one-way subtyping. | |
| 179 | 179 | if util::relate_types(tcx, typing_env, Variance::Covariant, src.ty, dest.ty) { |
| 180 | // Make sure the layout is equal, too -- just to be safe. Miri really | |
| 181 | // needs layout equality. For performance reason we skip this check when | |
| 182 | // the types are equal. Equal types *can* have different layouts when | |
| 183 | // enum downcast is involved (as enum variants carry the type of the | |
| 184 | // enum), but those should never occur in assignments. | |
| 180 | // Make sure the layout is equal, too -- just to be safe. Miri really needs layout equality. | |
| 181 | // For performance reason we skip this check when the types are equal. Equal types *can* | |
| 182 | // have different layouts when enum downcast is involved (as enum variants carry the type of | |
| 183 | // the enum), but those should never occur in assignments. | |
| 185 | 184 | if cfg!(debug_assertions) || src.ty != dest.ty { |
| 186 | assert_eq!(src.layout, dest.layout); | |
| 185 | assert_eq!( | |
| 186 | src.layout, | |
| 187 | dest.layout, | |
| 188 | "{src} is a subtype of {dest} but they have different layout", | |
| 189 | src = src.ty, | |
| 190 | dest = dest.ty, | |
| 191 | ); | |
| 187 | 192 | } |
| 188 | 193 | true |
| 189 | 194 | } else { |
compiler/rustc_const_eval/src/interpret/step.rs+2-2| ... | ... | @@ -190,8 +190,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | UnaryOp(un_op, ref operand) => { |
| 193 | // The operand always has the same type as the result. | |
| 194 | let val = self.read_immediate(&self.eval_operand(operand, Some(dest.layout))?)?; | |
| 193 | let layout = util::unop_homogeneous(un_op).then_some(dest.layout); | |
| 194 | let val = self.read_immediate(&self.eval_operand(operand, layout)?)?; | |
| 195 | 195 | let result = self.unary_op(un_op, &val)?; |
| 196 | 196 | assert_eq!(result.layout, dest.layout, "layout mismatch for result of {un_op:?}"); |
| 197 | 197 | self.write_immediate(*result, &dest)?; |
compiler/rustc_const_eval/src/util/mod.rs+10| ... | ... | @@ -38,3 +38,13 @@ pub fn binop_right_homogeneous(op: mir::BinOp) -> bool { |
| 38 | 38 | Offset | Shl | ShlUnchecked | Shr | ShrUnchecked => false, |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | ||
| 42 | /// Classify whether an operator is "homogeneous", i.e., the operand has the | |
| 43 | /// same type as the result. | |
| 44 | #[inline] | |
| 45 | pub fn unop_homogeneous(op: mir::UnOp) -> bool { | |
| 46 | match op { | |
| 47 | mir::UnOp::Not | mir::UnOp::Neg => true, | |
| 48 | mir::UnOp::PtrMetadata => false, | |
| 49 | } | |
| 50 | } |
compiler/rustc_hir/src/def.rs+2-1| ... | ... | @@ -717,7 +717,8 @@ impl IntoDiagArg for Namespace { |
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | /// Just a helper ‒ separate structure for each namespace. |
| 720 | #[derive(Copy, Clone, Default, Debug, StableHash)] | |
| 720 | #[derive(Copy, Clone, Debug, StableHash)] | |
| 721 | #[derive_const(Default)] | |
| 721 | 722 | pub struct PerNS<T> { |
| 722 | 723 | pub value_ns: T, |
| 723 | 724 | pub type_ns: T, |
compiler/rustc_infer/src/infer/canonical/query_response.rs+1-1| ... | ... | @@ -286,7 +286,7 @@ impl<'tcx> InferCtxt<'tcx> { |
| 286 | 286 | (GenericArgKind::Lifetime(v_o), GenericArgKind::Lifetime(v_r)) => { |
| 287 | 287 | if v_o != v_r { |
| 288 | 288 | output_query_region_constraints.constraints.push(( |
| 289 | ty::RegionEqPredicate(v_o.into(), v_r).into(), | |
| 289 | ty::RegionEqPredicate(v_o, v_r).into(), | |
| 290 | 290 | constraint_category, |
| 291 | 291 | ty::VisibleForLeakCheck::Yes, |
| 292 | 292 | )); |
compiler/rustc_middle/src/mir/interpret/queries.rs+2-3| ... | ... | @@ -107,13 +107,12 @@ impl<'tcx> TyCtxt<'tcx> { |
| 107 | 107 | Ok(Some(instance)) => GlobalId { instance, promoted: None }, |
| 108 | 108 | // For errors during resolution, we deliberately do not point at the usage site of the constant, |
| 109 | 109 | // since for these errors the place the constant is used shouldn't matter. |
| 110 | Ok(None) => return Err(ErrorHandled::TooGeneric(DUMMY_SP).into()), | |
| 110 | Ok(None) => return Err(ErrorHandled::TooGeneric(DUMMY_SP)), | |
| 111 | 111 | Err(err) => { |
| 112 | 112 | return Err(ErrorHandled::Reported( |
| 113 | 113 | ReportedErrorInfo::non_const_eval_error(err), |
| 114 | 114 | DUMMY_SP, |
| 115 | ) | |
| 116 | .into()); | |
| 115 | )); | |
| 117 | 116 | } |
| 118 | 117 | }; |
| 119 | 118 |
compiler/rustc_middle/src/ty/mod.rs+11-10| ... | ... | @@ -27,9 +27,9 @@ pub use intrinsic::IntrinsicDef; |
| 27 | 27 | use rustc_abi::{ |
| 28 | 28 | Align, FieldIdx, Integer, IntegerType, ReprFlags, ReprOptions, ScalableElt, VariantIdx, |
| 29 | 29 | }; |
| 30 | use rustc_ast as ast; | |
| 31 | 30 | use rustc_ast::expand::typetree::{FncTree, Kind, Type, TypeTree}; |
| 32 | 31 | use rustc_ast::node_id::NodeMap; |
| 32 | use rustc_ast::{self as ast}; | |
| 33 | 33 | pub use rustc_ast_ir::{Movability, Mutability, try_visit}; |
| 34 | 34 | use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; |
| 35 | 35 | use rustc_data_structures::intern::Interned; |
| ... | ... | @@ -204,7 +204,7 @@ pub struct ResolverGlobalCtxt { |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | #[derive(Debug)] |
| 207 | pub struct PerOwnerResolverData { | |
| 207 | pub struct PerOwnerResolverData<'tcx> { | |
| 208 | 208 | pub node_id_to_def_id: NodeMap<LocalDefId> = Default::default(), |
| 209 | 209 | /// Whether lifetime elision was successful. |
| 210 | 210 | pub lifetime_elision_allowed: bool = false, |
| ... | ... | @@ -214,14 +214,19 @@ pub struct PerOwnerResolverData { |
| 214 | 214 | /// Resolutions for lifetimes. |
| 215 | 215 | pub lifetimes_res_map: NodeMap<LifetimeRes> = Default::default(), |
| 216 | 216 | |
| 217 | pub trait_map: NodeMap<&'tcx [hir::TraitCandidate<'tcx>]> = Default::default(), | |
| 218 | ||
| 219 | /// Resolution for import nodes, which have multiple resolutions in different namespaces. | |
| 220 | pub import_res: hir::def::PerNS<Option<Res<ast::NodeId>>> = Default::default(), | |
| 221 | ||
| 217 | 222 | /// The id of the owner |
| 218 | 223 | pub id: ast::NodeId, |
| 219 | 224 | /// The `DefId` of the owner, can't be found in `node_id_to_def_id`. |
| 220 | 225 | pub def_id: LocalDefId, |
| 221 | 226 | } |
| 222 | 227 | |
| 223 | impl PerOwnerResolverData { | |
| 224 | pub fn new(id: ast::NodeId, def_id: LocalDefId) -> PerOwnerResolverData { | |
| 228 | impl<'tcx> PerOwnerResolverData<'tcx> { | |
| 229 | pub fn new(id: ast::NodeId, def_id: LocalDefId) -> PerOwnerResolverData<'tcx> { | |
| 225 | 230 | PerOwnerResolverData { id, def_id, .. } |
| 226 | 231 | } |
| 227 | 232 | |
| ... | ... | @@ -242,16 +247,12 @@ impl PerOwnerResolverData { |
| 242 | 247 | pub struct ResolverAstLowering<'tcx> { |
| 243 | 248 | /// Resolutions for nodes that have a single resolution. |
| 244 | 249 | pub partial_res_map: NodeMap<hir::def::PartialRes>, |
| 245 | /// Resolutions for import nodes, which have multiple resolutions in different namespaces. | |
| 246 | pub import_res_map: NodeMap<hir::def::PerNS<Option<Res<ast::NodeId>>>>, | |
| 247 | 250 | /// Lifetime parameters that lowering will have to introduce. |
| 248 | 251 | pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, MissingLifetimeKind)>>, |
| 249 | 252 | |
| 250 | 253 | pub next_node_id: ast::NodeId, |
| 251 | 254 | |
| 252 | pub owners: NodeMap<PerOwnerResolverData>, | |
| 253 | ||
| 254 | pub trait_map: NodeMap<&'tcx [hir::TraitCandidate<'tcx>]>, | |
| 255 | pub owners: NodeMap<PerOwnerResolverData<'tcx>>, | |
| 255 | 256 | |
| 256 | 257 | /// Lints that were emitted by the resolver and early lints. |
| 257 | 258 | pub lint_buffer: Steal<LintBuffer>, |
| ... | ... | @@ -1098,7 +1099,7 @@ impl<'tcx> TypingEnv<'tcx> { |
| 1098 | 1099 | def_id: impl IntoQueryKey<DefId>, |
| 1099 | 1100 | ) -> TypingEnv<'tcx> { |
| 1100 | 1101 | let def_id = def_id.into_query_key(); |
| 1101 | Self::new(tcx.param_env(def_id), TypingMode::non_body_analysis().into()) | |
| 1102 | Self::new(tcx.param_env(def_id), TypingMode::non_body_analysis()) | |
| 1102 | 1103 | } |
| 1103 | 1104 | |
| 1104 | 1105 | pub fn post_analysis(tcx: TyCtxt<'tcx>, def_id: impl IntoQueryKey<DefId>) -> TypingEnv<'tcx> { |
compiler/rustc_mir_build/src/builder/expr/into.rs+1-1| ... | ... | @@ -914,7 +914,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { |
| 914 | 914 | block, |
| 915 | 915 | source_info, |
| 916 | 916 | destination, |
| 917 | Rvalue::Reborrow(target, mutability, place.into()), | |
| 917 | Rvalue::Reborrow(target, mutability, place), | |
| 918 | 918 | ); |
| 919 | 919 | block.unit() |
| 920 | 920 | } |
compiler/rustc_mir_transform/src/check_null.rs+1-1| ... | ... | @@ -79,7 +79,7 @@ fn insert_null_check<'tcx>( |
| 79 | 79 | source_info, |
| 80 | 80 | StatementKind::Assign(Box::new((pointee_should_be_checked, rvalue))), |
| 81 | 81 | )); |
| 82 | Operand::Copy(pointee_should_be_checked.into()) | |
| 82 | Operand::Copy(pointee_should_be_checked) | |
| 83 | 83 | } |
| 84 | 84 | }; |
| 85 | 85 |
compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs+1-1| ... | ... | @@ -389,7 +389,7 @@ where |
| 389 | 389 | impl_def_id, |
| 390 | 390 | impl_args, |
| 391 | 391 | impl_trait_ref, |
| 392 | target_container_def_id.into(), | |
| 392 | target_container_def_id, | |
| 393 | 393 | )?; |
| 394 | 394 | |
| 395 | 395 | if !cx.check_args_compatible(target_item_def_id.into(), target_args) { |
compiler/rustc_passes/src/check_attr.rs+2-50| ... | ... | @@ -18,7 +18,7 @@ use rustc_feature::BUILTIN_ATTRIBUTE_MAP; |
| 18 | 18 | use rustc_hir::attrs::diagnostic::Directive; |
| 19 | 19 | use rustc_hir::attrs::{ |
| 20 | 20 | AttributeKind, DocAttribute, DocInline, EiiDecl, EiiImpl, EiiImplResolution, InlineAttr, |
| 21 | ReprAttr, SanitizerSet, | |
| 21 | ReprAttr, | |
| 22 | 22 | }; |
| 23 | 23 | use rustc_hir::def::DefKind; |
| 24 | 24 | use rustc_hir::def_id::LocalModDefId; |
| ... | ... | @@ -227,9 +227,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 227 | 227 | } |
| 228 | 228 | &AttributeKind::FfiPure(attr_span) => self.check_ffi_pure(attr_span, attrs), |
| 229 | 229 | AttributeKind::MayDangle(attr_span) => self.check_may_dangle(hir_id, *attr_span), |
| 230 | &AttributeKind::Sanitize { on_set, off_set, rtsan: _, span: attr_span } => { | |
| 231 | self.check_sanitize(attr_span, on_set | off_set, span, target); | |
| 232 | } | |
| 233 | 230 | AttributeKind::Link(_, attr_span) => self.check_link(hir_id, *attr_span, target), |
| 234 | 231 | AttributeKind::MacroExport { span, .. } => { |
| 235 | 232 | self.check_macro_export(hir_id, *span, target) |
| ... | ... | @@ -401,6 +398,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 401 | 398 | AttributeKind::RustcThenThisWouldNeed(..) => (), |
| 402 | 399 | AttributeKind::RustcTrivialFieldReads => (), |
| 403 | 400 | AttributeKind::RustcUnsafeSpecializationMarker => (), |
| 401 | AttributeKind::Sanitize { .. } => {} | |
| 404 | 402 | AttributeKind::ShouldPanic { .. } => (), |
| 405 | 403 | AttributeKind::Stability { .. } => (), |
| 406 | 404 | AttributeKind::TestRunner(..) => (), |
| ... | ... | @@ -627,52 +625,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 627 | 625 | } |
| 628 | 626 | } |
| 629 | 627 | |
| 630 | /// Checks that the `#[sanitize(..)]` attribute is applied to a | |
| 631 | /// function/closure/method, or to an impl block or module. | |
| 632 | fn check_sanitize( | |
| 633 | &self, | |
| 634 | attr_span: Span, | |
| 635 | set: SanitizerSet, | |
| 636 | target_span: Span, | |
| 637 | target: Target, | |
| 638 | ) { | |
| 639 | let mut not_fn_impl_mod = None; | |
| 640 | let mut no_body = None; | |
| 641 | ||
| 642 | match target { | |
| 643 | Target::Fn | |
| 644 | | Target::Closure | |
| 645 | | Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent) | |
| 646 | | Target::Impl { .. } | |
| 647 | | Target::Mod => return, | |
| 648 | Target::Static | |
| 649 | // if we mask out the address bits, i.e. *only* address was set, | |
| 650 | // we allow it | |
| 651 | if set & !(SanitizerSet::ADDRESS | SanitizerSet::KERNELADDRESS) | |
| 652 | == SanitizerSet::empty() => | |
| 653 | { | |
| 654 | return; | |
| 655 | } | |
| 656 | ||
| 657 | // These are "functions", but they aren't allowed because they don't | |
| 658 | // have a body, so the usual explanation would be confusing. | |
| 659 | Target::Method(MethodKind::Trait { body: false }) | Target::ForeignFn => { | |
| 660 | no_body = Some(target_span); | |
| 661 | } | |
| 662 | ||
| 663 | _ => { | |
| 664 | not_fn_impl_mod = Some(target_span); | |
| 665 | } | |
| 666 | } | |
| 667 | ||
| 668 | self.dcx().emit_err(errors::SanitizeAttributeNotAllowed { | |
| 669 | attr_span, | |
| 670 | not_fn_impl_mod, | |
| 671 | no_body, | |
| 672 | help: (), | |
| 673 | }); | |
| 674 | } | |
| 675 | ||
| 676 | 628 | /// Checks if `#[naked]` is applied to a function definition. |
| 677 | 629 | fn check_naked(&self, hir_id: HirId, target: Target) { |
| 678 | 630 | match target { |
compiler/rustc_passes/src/errors.rs-13| ... | ... | @@ -1049,19 +1049,6 @@ pub(crate) struct UnnecessaryPartialStableFeature { |
| 1049 | 1049 | #[note("see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information")] |
| 1050 | 1050 | pub(crate) struct IneffectiveUnstableImpl; |
| 1051 | 1051 | |
| 1052 | #[derive(Diagnostic)] | |
| 1053 | #[diag("sanitize attribute not allowed here")] | |
| 1054 | pub(crate) struct SanitizeAttributeNotAllowed { | |
| 1055 | #[primary_span] | |
| 1056 | pub attr_span: Span, | |
| 1057 | #[label("not a function, impl block, or module")] | |
| 1058 | pub not_fn_impl_mod: Option<Span>, | |
| 1059 | #[label("function has no body")] | |
| 1060 | pub no_body: Option<Span>, | |
| 1061 | #[help("sanitize attribute can be applied to a function (with body), impl block, or module")] | |
| 1062 | pub help: (), | |
| 1063 | } | |
| 1064 | ||
| 1065 | 1052 | // FIXME(jdonszelmann): move back to rustc_attr |
| 1066 | 1053 | #[derive(Diagnostic)] |
| 1067 | 1054 | #[diag( |
compiler/rustc_query_impl/src/execution.rs+7-2| ... | ... | @@ -14,7 +14,7 @@ use rustc_middle::query::{ |
| 14 | 14 | use rustc_middle::ty::TyCtxt; |
| 15 | 15 | use rustc_middle::verify_ich::incremental_verify_ich; |
| 16 | 16 | use rustc_span::{DUMMY_SP, Span}; |
| 17 | use tracing::warn; | |
| 17 | use tracing::debug; | |
| 18 | 18 | |
| 19 | 19 | use crate::dep_graph::{DepNode, DepNodeIndex}; |
| 20 | 20 | use crate::handle_cycle_error; |
| ... | ... | @@ -100,7 +100,12 @@ fn collect_active_query_jobs_inner<'tcx, C>( |
| 100 | 100 | for shard in query.state.active.try_lock_shards() { |
| 101 | 101 | match shard { |
| 102 | 102 | Some(shard) => collect_shard_jobs(&shard), |
| 103 | None => warn!("Failed to collect active jobs for query `{}`!", query.name), | |
| 103 | // This collection is best-effort (it is only used to print the query | |
| 104 | // stack on panic), so a contended shard is expected and fine to skip. | |
| 105 | // Emitting this at `warn!` would leak nondeterministically into the | |
| 106 | // panic output under the parallel front-end, where another thread may | |
| 107 | // still hold a shard lock, so keep it at `debug!`. | |
| 108 | None => debug!("Failed to collect active jobs for query `{}`!", query.name), | |
| 104 | 109 | } |
| 105 | 110 | } |
| 106 | 111 | } |
compiler/rustc_resolve/src/check_unused.rs+4-6| ... | ... | @@ -134,12 +134,10 @@ impl<'a, 'ra, 'tcx> UnusedImportCheckVisitor<'a, 'ra, 'tcx> { |
| 134 | 134 | match item.kind { |
| 135 | 135 | ast::UseTreeKind::Simple(Some(ident)) => { |
| 136 | 136 | if ident.name == kw::Underscore |
| 137 | && !self.r.import_res_map.get(&id).is_some_and(|per_ns| { | |
| 138 | matches!( | |
| 139 | per_ns.type_ns, | |
| 140 | Some(Res::Def(DefKind::Trait | DefKind::TraitAlias, _)) | |
| 141 | ) | |
| 142 | }) | |
| 137 | && !matches!( | |
| 138 | self.r.owners[&id].import_res.type_ns, | |
| 139 | Some(Res::Def(DefKind::Trait | DefKind::TraitAlias, _)) | |
| 140 | ) | |
| 143 | 141 | { |
| 144 | 142 | self.unused_import(self.base_id).add(id); |
| 145 | 143 | } |
compiler/rustc_resolve/src/imports.rs+1-1| ... | ... | @@ -1642,7 +1642,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1642 | 1642 | // purposes it's good enough to just favor one over the other. |
| 1643 | 1643 | self.per_ns(|this, ns| { |
| 1644 | 1644 | if let Some(binding) = bindings[ns].get().decl().map(|b| b.import_source()) { |
| 1645 | this.import_res_map.entry(import_id).or_default()[ns] = Some(binding.res()); | |
| 1645 | this.owners.get_mut(&import_id).unwrap().import_res[ns] = Some(binding.res()); | |
| 1646 | 1646 | } |
| 1647 | 1647 | }); |
| 1648 | 1648 |
compiler/rustc_resolve/src/late.rs+1-1| ... | ... | @@ -5388,7 +5388,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { |
| 5388 | 5388 | ident.span, |
| 5389 | 5389 | Some((ident.name, ValueNS)), |
| 5390 | 5390 | ); |
| 5391 | self.r.trait_map.insert(node_id, traits); | |
| 5391 | self.r.current_owner.trait_map.insert(node_id, traits); | |
| 5392 | 5392 | } |
| 5393 | 5393 | |
| 5394 | 5394 | fn resolve_and_cache_rustdoc_path(&mut self, path_str: &str, ns: Namespace) -> Option<Res> { |
compiler/rustc_resolve/src/lib.rs+3-8| ... | ... | @@ -1364,8 +1364,6 @@ pub struct Resolver<'ra, 'tcx> { |
| 1364 | 1364 | |
| 1365 | 1365 | /// Resolutions for nodes that have a single resolution. |
| 1366 | 1366 | partial_res_map: NodeMap<PartialRes> = Default::default(), |
| 1367 | /// Resolutions for import nodes, which have multiple resolutions in different namespaces. | |
| 1368 | import_res_map: NodeMap<PerNS<Option<Res>>> = Default::default(), | |
| 1369 | 1367 | /// An import will be inserted into this map if it has been used. |
| 1370 | 1368 | import_use_map: FxHashMap<Import<'ra>, Used> = default::fx_hash_map(), |
| 1371 | 1369 | /// Lifetime parameters that lowering will have to introduce. |
| ... | ... | @@ -1375,7 +1373,6 @@ pub struct Resolver<'ra, 'tcx> { |
| 1375 | 1373 | extern_crate_map: UnordMap<LocalDefId, CrateNum> = Default::default(), |
| 1376 | 1374 | module_children: LocalDefIdMap<Vec<ModChild>> = Default::default(), |
| 1377 | 1375 | ambig_module_children: LocalDefIdMap<Vec<AmbigModChild>> = Default::default(), |
| 1378 | trait_map: NodeMap<&'tcx [TraitCandidate<'tcx>]> = Default::default(), | |
| 1379 | 1376 | |
| 1380 | 1377 | /// A map from nodes to anonymous modules. |
| 1381 | 1378 | /// Anonymous modules are pseudo-modules that are implicitly created around items |
| ... | ... | @@ -1490,10 +1487,10 @@ pub struct Resolver<'ra, 'tcx> { |
| 1490 | 1487 | next_node_id: NodeId = CRATE_NODE_ID, |
| 1491 | 1488 | |
| 1492 | 1489 | /// Preserves per owner data once the owner is finished resolving. |
| 1493 | owners: NodeMap<PerOwnerResolverData>, | |
| 1490 | owners: NodeMap<PerOwnerResolverData<'tcx>>, | |
| 1494 | 1491 | |
| 1495 | 1492 | /// An entry of `owners` that gets taken out and reinserted whenever an owner is handled. |
| 1496 | current_owner: PerOwnerResolverData, | |
| 1493 | current_owner: PerOwnerResolverData<'tcx>, | |
| 1497 | 1494 | |
| 1498 | 1495 | disambiguators: LocalDefIdMap<PerParentDisambiguatorState>, |
| 1499 | 1496 | |
| ... | ... | @@ -1997,11 +1994,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { |
| 1997 | 1994 | }; |
| 1998 | 1995 | let ast_lowering = ty::ResolverAstLowering { |
| 1999 | 1996 | partial_res_map: self.partial_res_map, |
| 2000 | import_res_map: self.import_res_map, | |
| 2001 | 1997 | extra_lifetime_params_map: self.extra_lifetime_params_map, |
| 2002 | 1998 | next_node_id: self.next_node_id, |
| 2003 | 1999 | owners: self.owners, |
| 2004 | trait_map: self.trait_map, | |
| 2005 | 2000 | lint_buffer: Steal::new(self.lint_buffer), |
| 2006 | 2001 | delegation_infos: self.delegation_infos, |
| 2007 | 2002 | disambiguators, |
| ... | ... | @@ -2658,7 +2653,7 @@ fn with_owner<'ra, 'tcx, R: AsMut<Resolver<'ra, 'tcx>>, T>( |
| 2658 | 2653 | fn with_owner_tables<'ra, 'tcx, R: AsMut<Resolver<'ra, 'tcx>>, T>( |
| 2659 | 2654 | this: &mut R, |
| 2660 | 2655 | owner: NodeId, |
| 2661 | tables: PerOwnerResolverData, | |
| 2656 | tables: PerOwnerResolverData<'tcx>, | |
| 2662 | 2657 | work: impl FnOnce(&mut R) -> T, |
| 2663 | 2658 | ) -> T { |
| 2664 | 2659 | debug_assert!(!this.as_mut().owners.contains_key(&owner)); |
compiler/rustc_target/src/spec/json.rs+2-4| ... | ... | @@ -252,7 +252,7 @@ impl ToJson for Target { |
| 252 | 252 | }; |
| 253 | 253 | ($attr:ident, $json_name:expr) => {{ |
| 254 | 254 | let name = $json_name; |
| 255 | d.insert(name.into(), target.$attr.to_json()); | |
| 255 | d.insert(name.to_string(), target.$attr.to_json()); | |
| 256 | 256 | }}; |
| 257 | 257 | } |
| 258 | 258 | |
| ... | ... | @@ -262,7 +262,7 @@ impl ToJson for Target { |
| 262 | 262 | let name = $json_name; |
| 263 | 263 | #[allow(rustc::bad_opt_access)] |
| 264 | 264 | if default.$attr != target.$attr { |
| 265 | d.insert(name.into(), target.$attr.to_json()); | |
| 265 | d.insert(name.to_string(), target.$attr.to_json()); | |
| 266 | 266 | } |
| 267 | 267 | }}; |
| 268 | 268 | (link_args - $attr:ident, $json_name:expr) => {{ |
| ... | ... | @@ -447,7 +447,6 @@ impl schemars::JsonSchema for EndianWrapper { |
| 447 | 447 | "type": "string", |
| 448 | 448 | "enum": ["big", "little"] |
| 449 | 449 | }) |
| 450 | .into() | |
| 451 | 450 | } |
| 452 | 451 | } |
| 453 | 452 | |
| ... | ... | @@ -473,7 +472,6 @@ impl schemars::JsonSchema for ExternAbiWrapper { |
| 473 | 472 | "type": "string", |
| 474 | 473 | "enum": all, |
| 475 | 474 | }) |
| 476 | .into() | |
| 477 | 475 | } |
| 478 | 476 | } |
| 479 | 477 |
compiler/rustc_target/src/spec/mod.rs+9-10| ... | ... | @@ -522,7 +522,6 @@ impl schemars::JsonSchema for LinkerFlavorCli { |
| 522 | 522 | "type": "string", |
| 523 | 523 | "enum": all |
| 524 | 524 | }) |
| 525 | .into() | |
| 526 | 525 | } |
| 527 | 526 | } |
| 528 | 527 | |
| ... | ... | @@ -587,7 +586,6 @@ impl schemars::JsonSchema for LinkSelfContainedDefault { |
| 587 | 586 | "type": "string", |
| 588 | 587 | "enum": ["false", "true", "wasm", "musl", "mingw"] |
| 589 | 588 | }) |
| 590 | .into() | |
| 591 | 589 | } |
| 592 | 590 | } |
| 593 | 591 | |
| ... | ... | @@ -733,7 +731,6 @@ impl schemars::JsonSchema for LinkSelfContainedComponents { |
| 733 | 731 | "type": "string", |
| 734 | 732 | "enum": all, |
| 735 | 733 | }) |
| 736 | .into() | |
| 737 | 734 | } |
| 738 | 735 | } |
| 739 | 736 | |
| ... | ... | @@ -912,7 +909,6 @@ impl schemars::JsonSchema for SmallDataThresholdSupport { |
| 912 | 909 | "type": "string", |
| 913 | 910 | "pattern": r#"^none|default-for-arch|llvm-module-flag=.+|llvm-arg=.+$"#, |
| 914 | 911 | }) |
| 915 | .into() | |
| 916 | 912 | } |
| 917 | 913 | } |
| 918 | 914 | |
| ... | ... | @@ -992,6 +988,8 @@ crate::target_spec_enum! { |
| 992 | 988 | pub enum RustcAbi { |
| 993 | 989 | /// On x86-32 only: make use of SSE and SSE2 for ABI purposes. |
| 994 | 990 | X86Sse2 = "x86-sse2", |
| 991 | /// On PowerPC only: build for SPE. | |
| 992 | PowerPcSpe = "powerpc-spe", | |
| 995 | 993 | /// On x86-32/64, aarch64, and S390x: do not use any FPU or SIMD registers for the ABI. |
| 996 | 994 | Softfloat = "softfloat", "x86-softfloat", |
| 997 | 995 | } |
| ... | ... | @@ -1288,7 +1286,6 @@ impl schemars::JsonSchema for SanitizerSet { |
| 1288 | 1286 | "type": "string", |
| 1289 | 1287 | "enum": all, |
| 1290 | 1288 | }) |
| 1291 | .into() | |
| 1292 | 1289 | } |
| 1293 | 1290 | } |
| 1294 | 1291 | |
| ... | ... | @@ -3427,13 +3424,15 @@ impl Target { |
| 3427 | 3424 | "`llvm_abiname` is unused on PowerPC" |
| 3428 | 3425 | ); |
| 3429 | 3426 | check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on PowerPC"); |
| 3430 | check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on PowerPC"); | |
| 3431 | // FIXME: Check that `target_abi` matches the actually configured ABI (with or | |
| 3432 | // without SPE). | |
| 3433 | 3427 | check_matches!( |
| 3428 | (&self.rustc_abi, &self.cfg_abi), | |
| 3429 | (Some(RustcAbi::PowerPcSpe), CfgAbi::Spe) | |
| 3430 | | (None, CfgAbi::Unspecified | CfgAbi::Other(_)), | |
| 3431 | "invalid PowerPC Rust-specific ABI and `cfg(target_abi)` combination:\n\ | |
| 3432 | Rust-specific ABI: {:?}\n\ | |
| 3433 | cfg(target_abi): {}", | |
| 3434 | self.rustc_abi, | |
| 3434 | 3435 | self.cfg_abi, |
| 3435 | CfgAbi::Spe | CfgAbi::Unspecified | CfgAbi::Other(_), | |
| 3436 | "invalid `target_abi` for PowerPC" | |
| 3437 | 3436 | ); |
| 3438 | 3437 | } |
| 3439 | 3438 | Arch::PowerPC64 => { |
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs+3-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, | |
| 5 | base, | |
| 4 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, | |
| 5 | TargetOptions, base, | |
| 6 | 6 | }; |
| 7 | 7 | |
| 8 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -24,6 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | arch: Arch::PowerPC, |
| 25 | 25 | options: TargetOptions { |
| 26 | 26 | cfg_abi: CfgAbi::Spe, |
| 27 | rustc_abi: Some(RustcAbi::PowerPcSpe), | |
| 27 | 28 | endian: Endian::Big, |
| 28 | 29 | features: "+secure-plt,+msync,+spe".into(), |
| 29 | 30 | mcount: "_mcount".into(), |
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs+3-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, | |
| 5 | base, | |
| 4 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, | |
| 5 | TargetOptions, base, | |
| 6 | 6 | }; |
| 7 | 7 | |
| 8 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -24,6 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | arch: Arch::PowerPC, |
| 25 | 25 | options: TargetOptions { |
| 26 | 26 | cfg_abi: CfgAbi::Spe, |
| 27 | rustc_abi: Some(RustcAbi::PowerPcSpe), | |
| 27 | 28 | endian: Endian::Big, |
| 28 | 29 | features: "+msync,+spe".into(), |
| 29 | 30 | mcount: "_mcount".into(), |
compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs+3-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | use rustc_abi::Endian; |
| 2 | 2 | |
| 3 | 3 | use crate::spec::{ |
| 4 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, StackProbeType, Target, TargetMetadata, TargetOptions, | |
| 5 | base, | |
| 4 | Arch, Cc, CfgAbi, LinkerFlavor, Lld, RustcAbi, StackProbeType, Target, TargetMetadata, | |
| 5 | TargetOptions, base, | |
| 6 | 6 | }; |
| 7 | 7 | |
| 8 | 8 | pub(crate) fn target() -> Target { |
| ... | ... | @@ -24,6 +24,7 @@ pub(crate) fn target() -> Target { |
| 24 | 24 | arch: Arch::PowerPC, |
| 25 | 25 | options: TargetOptions { |
| 26 | 26 | cfg_abi: CfgAbi::Spe, |
| 27 | rustc_abi: Some(RustcAbi::PowerPcSpe), | |
| 27 | 28 | endian: Endian::Big, |
| 28 | 29 | // feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2 |
| 29 | 30 | features: "+secure-plt,+msync,+spe".into(), |
compiler/rustc_target/src/target_features.rs+40-9| ... | ... | @@ -573,8 +573,15 @@ const HEXAGON_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ |
| 573 | 573 | ]; |
| 574 | 574 | |
| 575 | 575 | static POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ |
| 576 | // If you are thinking of adding "efpu2" here, please double-check that it really does not | |
| 577 | // affect the ABI. | |
| 576 | 578 | // tidy-alphabetical-start |
| 577 | 579 | ("altivec", Unstable(sym::powerpc_target_feature), &[]), |
| 580 | ( | |
| 581 | "hard-float", | |
| 582 | Forbidden { reason: "unsupported ABI-configuration feature", hard_error: false }, | |
| 583 | &[], | |
| 584 | ), | |
| 578 | 585 | ("msync", Unstable(sym::powerpc_target_feature), &[]), |
| 579 | 586 | ("partword-atomics", Unstable(sym::powerpc_target_feature), &[]), |
| 580 | 587 | ("power8-altivec", Unstable(sym::powerpc_target_feature), &["altivec"]), |
| ... | ... | @@ -584,6 +591,7 @@ static POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[ |
| 584 | 591 | ("power9-vector", Unstable(sym::powerpc_target_feature), &["power8-vector", "power9-altivec"]), |
| 585 | 592 | ("power10-vector", Unstable(sym::powerpc_target_feature), &["power9-vector"]), |
| 586 | 593 | ("quadword-atomics", Unstable(sym::powerpc_target_feature), &[]), |
| 594 | ("spe", Forbidden { reason: "unsupported ABI-configuration feature", hard_error: false }, &[]), | |
| 587 | 595 | ("vsx", Unstable(sym::powerpc_target_feature), &["altivec"]), |
| 588 | 596 | // tidy-alphabetical-end |
| 589 | 597 | ]; |
| ... | ... | @@ -1139,12 +1147,12 @@ impl Target { |
| 1139 | 1147 | /// the first list contains target features that must be enabled for ABI reasons, |
| 1140 | 1148 | /// and the second list contains target feature that must be disabled for ABI reasons. |
| 1141 | 1149 | /// |
| 1142 | /// These features are automatically appended to whatever the target spec sets as default | |
| 1143 | /// features for the target. | |
| 1150 | /// These features are checked against the target features reported by LLVM based on | |
| 1151 | /// `-Ctarget-cpu` and `-Ctarget-features`. Constraint violations result in a warning. | |
| 1144 | 1152 | /// |
| 1145 | /// All features enabled/disabled via `-Ctarget-features` and `#[target_features]` are checked | |
| 1146 | /// against this. We also check any implied features, based on the information above. If LLVM | |
| 1147 | /// implicitly enables more implied features than we do, that could bypass this check! | |
| 1153 | /// We also check features enabled via `#[target_features]` (and here, constraint violations | |
| 1154 | /// emit a hard error), including features enabled indirectly via implications -- but if LLVM | |
| 1155 | /// considers more features to be implied than we do, that could bypass this check! | |
| 1148 | 1156 | pub fn abi_required_features(&self) -> FeatureConstraints { |
| 1149 | 1157 | const NOTHING: FeatureConstraints = FeatureConstraints { required: &[], incompatible: &[] }; |
| 1150 | 1158 | // Some architectures don't have a clean explicit ABI designation; instead, the ABI is |
| ... | ... | @@ -1175,6 +1183,7 @@ impl Target { |
| 1175 | 1183 | // LLVM handles the rest. |
| 1176 | 1184 | FeatureConstraints { required: &["soft-float"], incompatible: &[] } |
| 1177 | 1185 | } |
| 1186 | _ => unreachable!(), | |
| 1178 | 1187 | } |
| 1179 | 1188 | } |
| 1180 | 1189 | Arch::X86_64 => { |
| ... | ... | @@ -1195,7 +1204,7 @@ impl Target { |
| 1195 | 1204 | // LLVM handles the rest. |
| 1196 | 1205 | FeatureConstraints { required: &["soft-float"], incompatible: &[] } |
| 1197 | 1206 | } |
| 1198 | Some(r) => panic!("invalid Rust ABI for x86_64: {r:?}"), | |
| 1207 | _ => unreachable!(), | |
| 1199 | 1208 | } |
| 1200 | 1209 | } |
| 1201 | 1210 | Arch::Arm => { |
| ... | ... | @@ -1232,7 +1241,7 @@ impl Target { |
| 1232 | 1241 | // `FeatureConstraints` uses Rust feature names, hence only "neon" shows up. |
| 1233 | 1242 | FeatureConstraints { required: &["neon"], incompatible: &[] } |
| 1234 | 1243 | } |
| 1235 | Some(r) => panic!("invalid Rust ABI for aarch64: {r:?}"), | |
| 1244 | _ => unreachable!(), | |
| 1236 | 1245 | } |
| 1237 | 1246 | } |
| 1238 | 1247 | Arch::RiscV32 | Arch::RiscV64 => { |
| ... | ... | @@ -1309,11 +1318,33 @@ impl Target { |
| 1309 | 1318 | // llvm will switch to soft-float ABI just based on this feature. |
| 1310 | 1319 | FeatureConstraints { required: &["soft-float"], incompatible: &["vector"] } |
| 1311 | 1320 | } |
| 1312 | Some(r) => { | |
| 1313 | panic!("invalid Rust ABI for s390x: {r:?}"); | |
| 1321 | _ => unreachable!(), | |
| 1322 | } | |
| 1323 | } | |
| 1324 | Arch::PowerPC => { | |
| 1325 | // The main ABI-relevant target features are "hard-float" and "spe". We use our own | |
| 1326 | // ABI indicator here. | |
| 1327 | match self.rustc_abi { | |
| 1328 | None => { | |
| 1329 | // Default hardfloat ABI. | |
| 1330 | FeatureConstraints { required: &["hard-float"], incompatible: &["spe"] } | |
| 1314 | 1331 | } |
| 1332 | Some(RustcAbi::PowerPcSpe) => { | |
| 1333 | // "efpu2" (which disables some register use in LLVM) *should* be okay | |
| 1334 | // because SPE uses soft-float ABI's parameter passing rules and passes | |
| 1335 | // floats via GPRs. | |
| 1336 | // <https://github.com/rust-lang/rust/pull/157085#discussion_r3349260222> | |
| 1337 | FeatureConstraints { required: &["hard-float", "spe"], incompatible: &[] } | |
| 1338 | } | |
| 1339 | _ => unreachable!(), | |
| 1315 | 1340 | } |
| 1316 | 1341 | } |
| 1342 | Arch::PowerPC64 => { | |
| 1343 | // There's no SPE for PowerPC64, and we currently don't support any soft-float | |
| 1344 | // targets. (If we ever add one, we need to match on `RustcAbi::Softfloat` similar | |
| 1345 | // to other targets above.) | |
| 1346 | FeatureConstraints { required: &["hard-float"], incompatible: &["spe"] } | |
| 1347 | } | |
| 1317 | 1348 | Arch::Avr => { |
| 1318 | 1349 | // We only support one ABI on AVR at the moment. |
| 1319 | 1350 | // SRAM is minimum requirement for C/C++ in both avr-gcc and Clang, |
compiler/rustc_trait_selection/src/solve/fulfill/derive_errors.rs+2-2| ... | ... | @@ -561,12 +561,12 @@ impl<'tcx> ProofTreeVisitor<'tcx> for BestObligation<'tcx> { |
| 561 | 561 | // and therefore is treated as rigid. |
| 562 | 562 | if let Some(ty::PredicateKind::AliasRelate(lhs, rhs, _)) = pred.kind().no_bound_vars() { |
| 563 | 563 | goal.infcx().visit_proof_tree_at_depth( |
| 564 | goal.goal().with(tcx, ty::ClauseKind::WellFormed(lhs.into())), | |
| 564 | goal.goal().with(tcx, ty::ClauseKind::WellFormed(lhs)), | |
| 565 | 565 | goal.depth() + 1, |
| 566 | 566 | self, |
| 567 | 567 | )?; |
| 568 | 568 | goal.infcx().visit_proof_tree_at_depth( |
| 569 | goal.goal().with(tcx, ty::ClauseKind::WellFormed(rhs.into())), | |
| 569 | goal.goal().with(tcx, ty::ClauseKind::WellFormed(rhs)), | |
| 570 | 570 | goal.depth() + 1, |
| 571 | 571 | self, |
| 572 | 572 | )?; |
compiler/rustc_trait_selection/src/solve/normalize.rs+4-4| ... | ... | @@ -48,8 +48,8 @@ where |
| 48 | 48 | let delegate = <&SolverDelegate<'tcx>>::from(infcx); |
| 49 | 49 | let infer_term = delegate.next_term_var_of_kind(alias_term, at.cause.span); |
| 50 | 50 | let predicate = ty::PredicateKind::AliasRelate( |
| 51 | alias_term.into(), | |
| 52 | infer_term.into(), | |
| 51 | alias_term, | |
| 52 | infer_term, | |
| 53 | 53 | ty::AliasRelationDirection::Equate, |
| 54 | 54 | ); |
| 55 | 55 | let goal = Goal::new(infcx.tcx, at.param_env, predicate); |
| ... | ... | @@ -92,8 +92,8 @@ impl<'me, 'tcx> ReplaceAliasWithInfer<'me, 'tcx> { |
| 92 | 92 | self.at.cause.clone(), |
| 93 | 93 | self.at.param_env, |
| 94 | 94 | ty::PredicateKind::AliasRelate( |
| 95 | alias_term.into(), | |
| 96 | infer_term.into(), | |
| 95 | alias_term, | |
| 96 | infer_term, | |
| 97 | 97 | ty::AliasRelationDirection::Equate, |
| 98 | 98 | ), |
| 99 | 99 | ); |
compiler/rustc_trait_selection/src/traits/normalize.rs+1-1| ... | ... | @@ -295,7 +295,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> { |
| 295 | 295 | let recursion_limit = self.cx().recursion_limit(); |
| 296 | 296 | if !recursion_limit.value_within_limit(self.depth) { |
| 297 | 297 | self.selcx.infcx.err_ctxt().report_overflow_error( |
| 298 | OverflowCause::DeeplyNormalize(free.into()), | |
| 298 | OverflowCause::DeeplyNormalize(free), | |
| 299 | 299 | self.cause.span, |
| 300 | 300 | false, |
| 301 | 301 | |diag| { |
compiler/rustc_trait_selection/src/traits/project.rs+7-4| ... | ... | @@ -275,10 +275,13 @@ pub fn normalize_projection_term<'a, 'b, 'tcx>( |
| 275 | 275 | // and a deferred predicate to resolve this when more type |
| 276 | 276 | // information is available. |
| 277 | 277 | |
| 278 | selcx | |
| 279 | .infcx | |
| 280 | .projection_term_to_infer(param_env, alias_term, cause, depth + 1, obligations) | |
| 281 | .into() | |
| 278 | selcx.infcx.projection_term_to_infer( | |
| 279 | param_env, | |
| 280 | alias_term, | |
| 281 | cause, | |
| 282 | depth + 1, | |
| 283 | obligations, | |
| 284 | ) | |
| 282 | 285 | }) |
| 283 | 286 | } |
| 284 | 287 |
library/core/src/convert/num.rs+1-11| ... | ... | @@ -1,17 +1,9 @@ |
| 1 | 1 | use crate::num::{IntErrorKind, TryFromIntError}; |
| 2 | 2 | |
| 3 | mod private { | |
| 4 | /// This trait being unreachable from outside the crate | |
| 5 | /// prevents other implementations of the `FloatToInt` trait, | |
| 6 | /// which allows potentially adding more trait methods after the trait is `#[stable]`. | |
| 7 | #[unstable(feature = "convert_float_to_int", issue = "67057")] | |
| 8 | pub trait Sealed {} | |
| 9 | } | |
| 10 | ||
| 11 | 3 | /// Supporting trait for inherent methods of `f32` and `f64` such as `to_int_unchecked`. |
| 12 | 4 | /// Typically doesn’t need to be used directly. |
| 13 | 5 | #[unstable(feature = "convert_float_to_int", issue = "67057")] |
| 14 | pub trait FloatToInt<Int>: private::Sealed + Sized { | |
| 6 | pub impl(self) trait FloatToInt<Int>: Sized { | |
| 15 | 7 | #[unstable(feature = "convert_float_to_int", issue = "67057")] |
| 16 | 8 | #[doc(hidden)] |
| 17 | 9 | unsafe fn to_int_unchecked(self) -> Int; |
| ... | ... | @@ -19,8 +11,6 @@ pub trait FloatToInt<Int>: private::Sealed + Sized { |
| 19 | 11 | |
| 20 | 12 | macro_rules! impl_float_to_int { |
| 21 | 13 | ($Float:ty => $($Int:ty),+) => { |
| 22 | #[unstable(feature = "convert_float_to_int", issue = "67057")] | |
| 23 | impl private::Sealed for $Float {} | |
| 24 | 14 | $( |
| 25 | 15 | #[unstable(feature = "convert_float_to_int", issue = "67057")] |
| 26 | 16 | impl FloatToInt<$Int> for $Float { |
library/core/src/ffi/va_list.rs+1-21| ... | ... | @@ -279,26 +279,6 @@ const impl<'f> Drop for VaList<'f> { |
| 279 | 279 | } |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | mod sealed { | |
| 283 | pub trait Sealed {} | |
| 284 | ||
| 285 | impl Sealed for i16 {} | |
| 286 | impl Sealed for i32 {} | |
| 287 | impl Sealed for i64 {} | |
| 288 | impl Sealed for isize {} | |
| 289 | ||
| 290 | impl Sealed for u16 {} | |
| 291 | impl Sealed for u32 {} | |
| 292 | impl Sealed for u64 {} | |
| 293 | impl Sealed for usize {} | |
| 294 | ||
| 295 | impl Sealed for f32 {} | |
| 296 | impl Sealed for f64 {} | |
| 297 | ||
| 298 | impl<T> Sealed for *mut T {} | |
| 299 | impl<T> Sealed for *const T {} | |
| 300 | } | |
| 301 | ||
| 302 | 282 | /// Types that are valid to read using [`VaList::next_arg`]. |
| 303 | 283 | /// |
| 304 | 284 | /// This trait is implemented for primitive types that have a variable argument application-binary |
| ... | ... | @@ -333,7 +313,7 @@ mod sealed { |
| 333 | 313 | // types with an alignment larger than 8, or with a non-scalar layout. Inline assembly can be used |
| 334 | 314 | // to accept unsupported types in the meantime. |
| 335 | 315 | #[lang = "va_arg_safe"] |
| 336 | pub unsafe trait VaArgSafe: Copy + sealed::Sealed {} | |
| 316 | pub impl(self) unsafe trait VaArgSafe: Copy {} | |
| 337 | 317 | |
| 338 | 318 | crate::cfg_select! { |
| 339 | 319 | any(target_arch = "avr", target_arch = "msp430") => { |
library/core/src/lib.rs+1-9| ... | ... | @@ -111,7 +111,6 @@ |
| 111 | 111 | #![feature(offset_of_enum)] |
| 112 | 112 | #![feature(panic_internals)] |
| 113 | 113 | #![feature(pattern_type_macro)] |
| 114 | #![feature(sealed)] | |
| 115 | 114 | #![feature(ub_checks)] |
| 116 | 115 | // tidy-alphabetical-end |
| 117 | 116 | // |
| ... | ... | @@ -142,6 +141,7 @@ |
| 142 | 141 | #![feature(freeze_impls)] |
| 143 | 142 | #![feature(fundamental)] |
| 144 | 143 | #![feature(funnel_shifts)] |
| 144 | #![feature(impl_restriction)] | |
| 145 | 145 | #![feature(intra_doc_pointers)] |
| 146 | 146 | #![feature(intrinsics)] |
| 147 | 147 | #![feature(lang_items)] |
| ... | ... | @@ -219,14 +219,6 @@ pub mod from { |
| 219 | 219 | pub use crate::macros::builtin::From; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | mod sealed { | |
| 223 | /// This trait being unreachable from outside the crate | |
| 224 | /// prevents outside implementations of our extension traits. | |
| 225 | /// This allows adding more trait methods in the future. | |
| 226 | #[unstable(feature = "sealed", issue = "none")] | |
| 227 | pub trait Sealed {} | |
| 228 | } | |
| 229 | ||
| 230 | 222 | // We don't export this through #[macro_export] for now, to avoid breakage. |
| 231 | 223 | #[unstable(feature = "autodiff", issue = "124509")] |
| 232 | 224 | #[doc = include_str!("../../core/src/autodiff.md")] |
library/core/src/marker/variance.rs+5-5| ... | ... | @@ -30,7 +30,7 @@ macro_rules! phantom_type { |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | impl<T> self::sealed::Sealed for $name<T> where T: ?Sized { | |
| 33 | impl<T> self::private_items::PrivateItems for $name<T> where T: ?Sized { | |
| 34 | 34 | const VALUE: Self = Self::new(); |
| 35 | 35 | } |
| 36 | 36 | impl<T> Variance for $name<T> where T: ?Sized {} |
| ... | ... | @@ -114,7 +114,7 @@ macro_rules! phantom_lifetime { |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | impl self::sealed::Sealed for $name<'_> { | |
| 117 | impl self::private_items::PrivateItems for $name<'_> { | |
| 118 | 118 | const VALUE: Self = Self::new(); |
| 119 | 119 | } |
| 120 | 120 | impl Variance for $name<'_> {} |
| ... | ... | @@ -233,14 +233,14 @@ phantom_type! { |
| 233 | 233 | pub struct PhantomInvariant<T>(PhantomData<fn(T) -> T>); |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | mod sealed { | |
| 237 | pub trait Sealed { | |
| 236 | mod private_items { | |
| 237 | pub trait PrivateItems { | |
| 238 | 238 | const VALUE: Self; |
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /// A marker trait for phantom variance types. |
| 243 | pub trait Variance: sealed::Sealed + Default {} | |
| 243 | pub trait Variance: private_items::PrivateItems + Default {} | |
| 244 | 244 | |
| 245 | 245 | /// Construct a variance marker; equivalent to [`Default::default`]. |
| 246 | 246 | /// |
library/core/src/num/mod.rs-9| ... | ... | @@ -1848,12 +1848,3 @@ macro_rules! from_str_int_impl { |
| 1848 | 1848 | |
| 1849 | 1849 | from_str_int_impl! { signed isize i8 i16 i32 i64 i128 } |
| 1850 | 1850 | from_str_int_impl! { unsigned usize u8 u16 u32 u64 u128 } |
| 1851 | ||
| 1852 | macro_rules! impl_sealed { | |
| 1853 | ($($t:ty)*) => {$( | |
| 1854 | /// Allows extension traits within `core`. | |
| 1855 | #[unstable(feature = "sealed", issue = "none")] | |
| 1856 | impl crate::sealed::Sealed for $t {} | |
| 1857 | )*} | |
| 1858 | } | |
| 1859 | impl_sealed! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 } |
library/core/src/num/nonzero.rs+1-17| ... | ... | @@ -31,30 +31,14 @@ use crate::{fmt, intrinsics, ptr, ub_checks}; |
| 31 | 31 | reason = "implementation detail which may disappear or be replaced at any time", |
| 32 | 32 | issue = "none" |
| 33 | 33 | )] |
| 34 | pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed { | |
| 34 | pub impl(self) unsafe trait ZeroablePrimitive: Sized + Copy { | |
| 35 | 35 | /// A type like `Self` but with a niche that includes zero. |
| 36 | 36 | type NonZeroInner: Sized + Copy; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | macro_rules! impl_zeroable_primitive { |
| 40 | 40 | ($($NonZeroInner:ident ( $primitive:ty )),+ $(,)?) => { |
| 41 | mod private { | |
| 42 | #[unstable( | |
| 43 | feature = "nonzero_internals", | |
| 44 | reason = "implementation detail which may disappear or be replaced at any time", | |
| 45 | issue = "none" | |
| 46 | )] | |
| 47 | pub trait Sealed {} | |
| 48 | } | |
| 49 | ||
| 50 | 41 | $( |
| 51 | #[unstable( | |
| 52 | feature = "nonzero_internals", | |
| 53 | reason = "implementation detail which may disappear or be replaced at any time", | |
| 54 | issue = "none" | |
| 55 | )] | |
| 56 | impl private::Sealed for $primitive {} | |
| 57 | ||
| 58 | 42 | #[unstable( |
| 59 | 43 | feature = "nonzero_internals", |
| 60 | 44 | reason = "implementation detail which may disappear or be replaced at any time", |
library/core/src/num/traits.rs+2-2| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | /// Trait for types that this type can be truncated to |
| 5 | 5 | #[unstable(feature = "num_internals", reason = "internal implementation detail", issue = "none")] |
| 6 | 6 | #[rustc_const_unstable(feature = "integer_widen_truncate", issue = "154330")] |
| 7 | pub const trait TruncateTarget<Target>: crate::sealed::Sealed { | |
| 7 | pub impl(self) const trait TruncateTarget<Target> { | |
| 8 | 8 | #[doc(hidden)] |
| 9 | 9 | fn internal_truncate(self) -> Target; |
| 10 | 10 | |
| ... | ... | @@ -18,7 +18,7 @@ pub const trait TruncateTarget<Target>: crate::sealed::Sealed { |
| 18 | 18 | /// Trait for types that this type can be widened to |
| 19 | 19 | #[unstable(feature = "num_internals", reason = "internal implementation detail", issue = "none")] |
| 20 | 20 | #[rustc_const_unstable(feature = "integer_widen_truncate", issue = "154330")] |
| 21 | pub const trait WidenTarget<Target>: crate::sealed::Sealed { | |
| 21 | pub impl(self) const trait WidenTarget<Target> { | |
| 22 | 22 | #[doc(hidden)] |
| 23 | 23 | fn internal_widen(self) -> Target; |
| 24 | 24 | } |
library/core/src/panic.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | //! Panic support in the standard library. | |
| 1 | //! Panic support in core. | |
| 2 | 2 | |
| 3 | 3 | #![stable(feature = "core_panic_info", since = "1.41.0")] |
| 4 | 4 |
library/core/src/slice/index.rs+1-41| ... | ... | @@ -102,46 +102,6 @@ const unsafe fn get_offset_len_mut_noubcheck<T>( |
| 102 | 102 | crate::intrinsics::aggregate_raw_ptr(ptr, len) |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | mod private_slice_index { | |
| 106 | use super::{ops, range}; | |
| 107 | ||
| 108 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 109 | pub trait Sealed {} | |
| 110 | ||
| 111 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 112 | impl Sealed for usize {} | |
| 113 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 114 | impl Sealed for ops::Range<usize> {} | |
| 115 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 116 | impl Sealed for ops::RangeTo<usize> {} | |
| 117 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 118 | impl Sealed for ops::RangeFrom<usize> {} | |
| 119 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 120 | impl Sealed for ops::RangeFull {} | |
| 121 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 122 | impl Sealed for ops::RangeInclusive<usize> {} | |
| 123 | #[stable(feature = "slice_get_slice", since = "1.28.0")] | |
| 124 | impl Sealed for ops::RangeToInclusive<usize> {} | |
| 125 | #[stable(feature = "slice_index_with_ops_bound_pair", since = "1.53.0")] | |
| 126 | impl Sealed for (ops::Bound<usize>, ops::Bound<usize>) {} | |
| 127 | ||
| 128 | #[stable(feature = "new_range_api", since = "1.96.0")] | |
| 129 | impl Sealed for range::Range<usize> {} | |
| 130 | #[stable(feature = "new_range_inclusive_api", since = "1.95.0")] | |
| 131 | impl Sealed for range::RangeInclusive<usize> {} | |
| 132 | #[stable(feature = "new_range_to_inclusive_api", since = "1.96.0")] | |
| 133 | impl Sealed for range::RangeToInclusive<usize> {} | |
| 134 | #[stable(feature = "new_range_from_api", since = "1.96.0")] | |
| 135 | impl Sealed for range::RangeFrom<usize> {} | |
| 136 | ||
| 137 | impl Sealed for ops::IndexRange {} | |
| 138 | ||
| 139 | #[unstable(feature = "sliceindex_wrappers", issue = "146179")] | |
| 140 | impl Sealed for crate::index::Last {} | |
| 141 | #[unstable(feature = "sliceindex_wrappers", issue = "146179")] | |
| 142 | impl<T> Sealed for crate::index::Clamp<T> where T: Sealed {} | |
| 143 | } | |
| 144 | ||
| 145 | 105 | /// A helper trait used for indexing operations. |
| 146 | 106 | /// |
| 147 | 107 | /// Implementations of this trait have to promise that if the argument |
| ... | ... | @@ -160,7 +120,7 @@ mod private_slice_index { |
| 160 | 120 | label = "slice indices are of type `usize` or ranges of `usize`" |
| 161 | 121 | )] |
| 162 | 122 | #[rustc_const_unstable(feature = "const_index", issue = "143775")] |
| 163 | pub const unsafe trait SliceIndex<T: ?Sized>: private_slice_index::Sealed { | |
| 123 | pub impl(crate) const unsafe trait SliceIndex<T: ?Sized> { | |
| 164 | 124 | /// The output type returned by methods. |
| 165 | 125 | #[stable(feature = "slice_get_slice", since = "1.28.0")] |
| 166 | 126 | type Output: ?Sized; |
library/core/src/slice/mod.rs+1-21| ... | ... | @@ -5740,24 +5740,6 @@ impl fmt::Display for GetDisjointMutError { |
| 5740 | 5740 | } |
| 5741 | 5741 | } |
| 5742 | 5742 | |
| 5743 | mod private_get_disjoint_mut_index { | |
| 5744 | use super::{Range, RangeInclusive, range}; | |
| 5745 | ||
| 5746 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] | |
| 5747 | pub trait Sealed {} | |
| 5748 | ||
| 5749 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] | |
| 5750 | impl Sealed for usize {} | |
| 5751 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] | |
| 5752 | impl Sealed for Range<usize> {} | |
| 5753 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] | |
| 5754 | impl Sealed for RangeInclusive<usize> {} | |
| 5755 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] | |
| 5756 | impl Sealed for range::Range<usize> {} | |
| 5757 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] | |
| 5758 | impl Sealed for range::RangeInclusive<usize> {} | |
| 5759 | } | |
| 5760 | ||
| 5761 | 5743 | /// A helper trait for `<[T]>::get_disjoint_mut()`. |
| 5762 | 5744 | /// |
| 5763 | 5745 | /// # Safety |
| ... | ... | @@ -5765,9 +5747,7 @@ mod private_get_disjoint_mut_index { |
| 5765 | 5747 | /// If `is_in_bounds()` returns `true` and `is_overlapping()` returns `false`, |
| 5766 | 5748 | /// it must be safe to index the slice with the indices. |
| 5767 | 5749 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] |
| 5768 | pub unsafe trait GetDisjointMutIndex: | |
| 5769 | Clone + private_get_disjoint_mut_index::Sealed | |
| 5770 | { | |
| 5750 | pub impl(self) unsafe trait GetDisjointMutIndex: Clone { | |
| 5771 | 5751 | /// Returns `true` if `self` is in bounds for `len` slice elements. |
| 5772 | 5752 | #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")] |
| 5773 | 5753 | fn is_in_bounds(&self, len: usize) -> bool; |
library/core/src/sync/atomic.rs+1-6| ... | ... | @@ -257,8 +257,6 @@ use crate::{fmt, intrinsics}; |
| 257 | 257 | )] |
| 258 | 258 | #[expect(missing_debug_implementations)] |
| 259 | 259 | mod private { |
| 260 | pub(super) trait Sealed {} | |
| 261 | ||
| 262 | 260 | #[cfg(target_has_atomic_load_store = "8")] |
| 263 | 261 | #[repr(C, align(1))] |
| 264 | 262 | pub struct Align1<T>(T); |
| ... | ... | @@ -291,8 +289,7 @@ mod private { |
| 291 | 289 | reason = "implementation detail which may disappear or be replaced at any time", |
| 292 | 290 | issue = "none" |
| 293 | 291 | )] |
| 294 | #[expect(private_bounds)] | |
| 295 | pub unsafe trait AtomicPrimitive: Sized + Copy + private::Sealed { | |
| 292 | pub impl(self) unsafe trait AtomicPrimitive: Sized + Copy { | |
| 296 | 293 | /// Temporary implementation detail. |
| 297 | 294 | type Storage: Sized; |
| 298 | 295 | } |
| ... | ... | @@ -300,8 +297,6 @@ pub unsafe trait AtomicPrimitive: Sized + Copy + private::Sealed { |
| 300 | 297 | macro impl_atomic_primitive( |
| 301 | 298 | [$($T:ident)?] $Primitive:ty as $Storage:ident<$Operand:ty>, size($size:literal) |
| 302 | 299 | ) { |
| 303 | impl $(<$T>)? private::Sealed for $Primitive {} | |
| 304 | ||
| 305 | 300 | #[unstable( |
| 306 | 301 | feature = "atomic_internals", |
| 307 | 302 | reason = "implementation detail which may disappear or be replaced at any time", |
library/std/src/ffi/os_str.rs-8| ... | ... | @@ -94,10 +94,6 @@ pub struct OsString { |
| 94 | 94 | inner: Buf, |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | /// Allows extension traits within `std`. | |
| 98 | #[unstable(feature = "sealed", issue = "none")] | |
| 99 | impl crate::sealed::Sealed for OsString {} | |
| 100 | ||
| 101 | 97 | /// Borrowed reference to an OS string (see [`OsString`]). |
| 102 | 98 | /// |
| 103 | 99 | /// This type represents a borrowed reference to a string in the operating system's preferred |
| ... | ... | @@ -120,10 +116,6 @@ pub struct OsStr { |
| 120 | 116 | inner: Slice, |
| 121 | 117 | } |
| 122 | 118 | |
| 123 | /// Allows extension traits within `std`. | |
| 124 | #[unstable(feature = "sealed", issue = "none")] | |
| 125 | impl crate::sealed::Sealed for OsStr {} | |
| 126 | ||
| 127 | 119 | impl OsString { |
| 128 | 120 | /// Constructs a new empty `OsString`. |
| 129 | 121 | /// |
library/std/src/fs.rs-5| ... | ... | @@ -44,7 +44,6 @@ mod tests; |
| 44 | 44 | use crate::ffi::OsString; |
| 45 | 45 | use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write}; |
| 46 | 46 | use crate::path::{Path, PathBuf}; |
| 47 | use crate::sealed::Sealed; | |
| 48 | 47 | use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner, fs as fs_imp}; |
| 49 | 48 | use crate::time::SystemTime; |
| 50 | 49 | use crate::{error, fmt}; |
| ... | ... | @@ -2215,10 +2214,6 @@ impl AsInnerMut<fs_imp::FileTimes> for FileTimes { |
| 2215 | 2214 | } |
| 2216 | 2215 | } |
| 2217 | 2216 | |
| 2218 | // For implementing OS extension traits in `std::os` | |
| 2219 | #[stable(feature = "file_set_times", since = "1.75.0")] | |
| 2220 | impl Sealed for FileTimes {} | |
| 2221 | ||
| 2222 | 2217 | impl Permissions { |
| 2223 | 2218 | /// Returns `true` if these permissions describe a readonly (unwritable) file. |
| 2224 | 2219 | /// |
library/std/src/io/stdio.rs+1-4| ... | ... | @@ -1195,7 +1195,7 @@ pub(crate) fn attempt_print_to_stderr(args: fmt::Arguments<'_>) { |
| 1195 | 1195 | |
| 1196 | 1196 | /// Trait to determine if a descriptor/handle refers to a terminal/tty. |
| 1197 | 1197 | #[stable(feature = "is_terminal", since = "1.70.0")] |
| 1198 | pub trait IsTerminal: crate::sealed::Sealed { | |
| 1198 | pub impl(crate) trait IsTerminal { | |
| 1199 | 1199 | /// Returns `true` if the descriptor/handle refers to a terminal/tty. |
| 1200 | 1200 | /// |
| 1201 | 1201 | /// On platforms where Rust does not know how to detect a terminal yet, this will return |
| ... | ... | @@ -1250,9 +1250,6 @@ pub trait IsTerminal: crate::sealed::Sealed { |
| 1250 | 1250 | |
| 1251 | 1251 | macro_rules! impl_is_terminal { |
| 1252 | 1252 | ($($t:ty),*$(,)?) => {$( |
| 1253 | #[unstable(feature = "sealed", issue = "none")] | |
| 1254 | impl crate::sealed::Sealed for $t {} | |
| 1255 | ||
| 1256 | 1253 | #[stable(feature = "is_terminal", since = "1.70.0")] |
| 1257 | 1254 | impl IsTerminal for $t { |
| 1258 | 1255 | #[inline] |
library/std/src/lib.rs+3| ... | ... | @@ -291,6 +291,7 @@ |
| 291 | 291 | #![feature(f128)] |
| 292 | 292 | #![feature(ffi_const)] |
| 293 | 293 | #![feature(gpu_offload)] |
| 294 | #![feature(impl_restriction)] | |
| 294 | 295 | #![feature(intra_doc_pointers)] |
| 295 | 296 | #![feature(lang_items)] |
| 296 | 297 | #![feature(link_cfg)] |
| ... | ... | @@ -792,6 +793,8 @@ include!("keyword_docs.rs"); |
| 792 | 793 | #[unstable(feature = "restricted_std", issue = "none")] |
| 793 | 794 | mod __restricted_std_workaround {} |
| 794 | 795 | |
| 796 | // FIXME(jhpratt) This is currently only used by portable SIMD. Once rust-lang/portable-simd#529 is | |
| 797 | // merged, this should be able to be removed. | |
| 795 | 798 | mod sealed { |
| 796 | 799 | /// This trait being unreachable from outside the crate |
| 797 | 800 | /// prevents outside implementations of our extension traits. |
library/std/src/os/darwin/fs.rs+1-2| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | #![stable(feature = "metadata_ext", since = "1.1.0")] |
| 5 | 5 | |
| 6 | 6 | use crate::fs::{self, Metadata}; |
| 7 | use crate::sealed::Sealed; | |
| 8 | 7 | use crate::sys::{AsInner, AsInnerMut, IntoInner}; |
| 9 | 8 | use crate::time::SystemTime; |
| 10 | 9 | |
| ... | ... | @@ -157,7 +156,7 @@ impl MetadataExt for Metadata { |
| 157 | 156 | |
| 158 | 157 | /// OS-specific extensions to [`fs::FileTimes`]. |
| 159 | 158 | #[stable(feature = "file_set_times", since = "1.75.0")] |
| 160 | pub trait FileTimesExt: Sealed { | |
| 159 | pub impl(self) trait FileTimesExt { | |
| 161 | 160 | /// Set the creation time of a file. |
| 162 | 161 | #[stable(feature = "file_set_times", since = "1.75.0")] |
| 163 | 162 | fn set_created(self, t: SystemTime) -> Self; |
library/std/src/os/fd/owned.rs+3-6| ... | ... | @@ -237,9 +237,6 @@ impl fmt::Debug for OwnedFd { |
| 237 | 237 | |
| 238 | 238 | macro_rules! impl_is_terminal { |
| 239 | 239 | ($($t:ty),*$(,)?) => {$( |
| 240 | #[unstable(feature = "sealed", issue = "none")] | |
| 241 | impl crate::sealed::Sealed for $t {} | |
| 242 | ||
| 243 | 240 | #[stable(feature = "is_terminal", since = "1.70.0")] |
| 244 | 241 | impl io::IsTerminal for $t { |
| 245 | 242 | #[inline] |
| ... | ... | @@ -358,7 +355,7 @@ impl From<crate::net::TcpStream> for OwnedFd { |
| 358 | 355 | /// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor. |
| 359 | 356 | #[inline] |
| 360 | 357 | fn from(tcp_stream: crate::net::TcpStream) -> OwnedFd { |
| 361 | tcp_stream.into_inner().into_socket().into_inner().into_inner().into() | |
| 358 | tcp_stream.into_inner().into_socket().into_inner().into_inner() | |
| 362 | 359 | } |
| 363 | 360 | } |
| 364 | 361 | |
| ... | ... | @@ -388,7 +385,7 @@ impl From<crate::net::TcpListener> for OwnedFd { |
| 388 | 385 | /// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor. |
| 389 | 386 | #[inline] |
| 390 | 387 | fn from(tcp_listener: crate::net::TcpListener) -> OwnedFd { |
| 391 | tcp_listener.into_inner().into_socket().into_inner().into_inner().into() | |
| 388 | tcp_listener.into_inner().into_socket().into_inner().into_inner() | |
| 392 | 389 | } |
| 393 | 390 | } |
| 394 | 391 | |
| ... | ... | @@ -418,7 +415,7 @@ impl From<crate::net::UdpSocket> for OwnedFd { |
| 418 | 415 | /// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor. |
| 419 | 416 | #[inline] |
| 420 | 417 | fn from(udp_socket: crate::net::UdpSocket) -> OwnedFd { |
| 421 | udp_socket.into_inner().into_socket().into_inner().into_inner().into() | |
| 418 | udp_socket.into_inner().into_socket().into_inner().into_inner() | |
| 422 | 419 | } |
| 423 | 420 | } |
| 424 | 421 |
library/std/src/os/freebsd/net.rs+1-2| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | use crate::ffi::CStr; |
| 6 | 6 | use crate::io; |
| 7 | 7 | use crate::os::unix::net; |
| 8 | use crate::sealed::Sealed; | |
| 9 | 8 | use crate::sys::AsInner; |
| 10 | 9 | |
| 11 | 10 | /// FreeBSD-specific functionality for `AF_UNIX` sockets [`UnixDatagram`] |
| ... | ... | @@ -14,7 +13,7 @@ use crate::sys::AsInner; |
| 14 | 13 | /// [`UnixDatagram`]: net::UnixDatagram |
| 15 | 14 | /// [`UnixStream`]: net::UnixStream |
| 16 | 15 | #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")] |
| 17 | pub trait UnixSocketExt: Sealed { | |
| 16 | pub impl(self) trait UnixSocketExt { | |
| 18 | 17 | /// Query the current setting of socket option `LOCAL_CREDS_PERSISTENT`. |
| 19 | 18 | #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")] |
| 20 | 19 | fn local_creds_persistent(&self) -> io::Result<bool>; |
library/std/src/os/illumos/net.rs+1-2| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | |
| 5 | 5 | use crate::io; |
| 6 | 6 | use crate::os::unix::net; |
| 7 | use crate::sealed::Sealed; | |
| 8 | 7 | use crate::sys::AsInner; |
| 9 | 8 | |
| 10 | 9 | /// illumos-specific functionality for `AF_UNIX` sockets [`UnixDatagram`] |
| ... | ... | @@ -13,7 +12,7 @@ use crate::sys::AsInner; |
| 13 | 12 | /// [`UnixDatagram`]: net::UnixDatagram |
| 14 | 13 | /// [`UnixStream`]: net::UnixStream |
| 15 | 14 | #[unstable(feature = "unix_socket_exclbind", issue = "123481")] |
| 16 | pub trait UnixSocketExt: Sealed { | |
| 15 | pub impl(self) trait UnixSocketExt { | |
| 17 | 16 | /// Enables exclusive binding on the socket. |
| 18 | 17 | /// |
| 19 | 18 | /// If true and if the socket had been set with `SO_REUSEADDR`, |
library/std/src/os/linux/process.rs+2-3| ... | ... | @@ -7,7 +7,6 @@ |
| 7 | 7 | use crate::io::Result; |
| 8 | 8 | use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}; |
| 9 | 9 | use crate::process::{self, ExitStatus}; |
| 10 | use crate::sealed::Sealed; | |
| 11 | 10 | use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner}; |
| 12 | 11 | #[cfg(not(doc))] |
| 13 | 12 | use crate::sys::{fd::FileDesc, linux::pidfd::PidFd as InnerPidFd}; |
| ... | ... | @@ -147,7 +146,7 @@ impl From<PidFd> for OwnedFd { |
| 147 | 146 | /// Os-specific extensions for [`Child`] |
| 148 | 147 | /// |
| 149 | 148 | /// [`Child`]: process::Child |
| 150 | pub trait ChildExt: Sealed { | |
| 149 | pub impl(crate) trait ChildExt { | |
| 151 | 150 | /// Obtains a reference to the [`PidFd`] created for this [`Child`], if available. |
| 152 | 151 | /// |
| 153 | 152 | /// A pidfd will only be available if its creation was requested with |
| ... | ... | @@ -186,7 +185,7 @@ pub trait ChildExt: Sealed { |
| 186 | 185 | /// Os-specific extensions for [`Command`] |
| 187 | 186 | /// |
| 188 | 187 | /// [`Command`]: process::Command |
| 189 | pub trait CommandExt: Sealed { | |
| 188 | pub impl(self) trait CommandExt { | |
| 190 | 189 | /// Sets whether a [`PidFd`](struct@PidFd) should be created for the [`Child`] |
| 191 | 190 | /// spawned by this [`Command`]. |
| 192 | 191 | /// By default, no pidfd will be created. |
library/std/src/os/motor/ffi.rs+2-3| ... | ... | @@ -2,14 +2,13 @@ |
| 2 | 2 | #![unstable(feature = "motor_ext", issue = "147456")] |
| 3 | 3 | |
| 4 | 4 | use crate::ffi::{OsStr, OsString}; |
| 5 | use crate::sealed::Sealed; | |
| 6 | 5 | use crate::sys::{AsInner, IntoInner}; |
| 7 | 6 | |
| 8 | 7 | /// Motor OS–specific extensions to [`OsString`]. |
| 9 | 8 | /// |
| 10 | 9 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 11 | 10 | /// This is so that future additional methods are not breaking changes. |
| 12 | pub trait OsStringExt: Sealed { | |
| 11 | pub impl(self) trait OsStringExt { | |
| 13 | 12 | /// Yields the underlying UTF-8 string of this [`OsString`]. |
| 14 | 13 | /// |
| 15 | 14 | /// OS strings on Motor OS are guaranteed to be UTF-8, so are just strings. |
| ... | ... | @@ -27,7 +26,7 @@ impl OsStringExt for OsString { |
| 27 | 26 | /// |
| 28 | 27 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 29 | 28 | /// This is so that future additional methods are not breaking changes. |
| 30 | pub trait OsStrExt: Sealed { | |
| 29 | pub impl(self) trait OsStrExt { | |
| 31 | 30 | /// Gets the underlying UTF-8 string view of the [`OsStr`] slice. |
| 32 | 31 | /// |
| 33 | 32 | /// OS strings on Motor OS are guaranteed to be UTF-8, so are just strings. |
library/std/src/os/motor/process.rs+1-2| ... | ... | @@ -1,9 +1,8 @@ |
| 1 | 1 | #![unstable(feature = "motor_ext", issue = "147456")] |
| 2 | 2 | |
| 3 | use crate::sealed::Sealed; | |
| 4 | 3 | use crate::sys::AsInner; |
| 5 | 4 | |
| 6 | pub trait ChildExt: Sealed { | |
| 5 | pub impl(self) trait ChildExt { | |
| 7 | 6 | /// Extracts the main thread raw handle, without taking ownership |
| 8 | 7 | fn sys_handle(&self) -> u64; |
| 9 | 8 | } |
library/std/src/os/net/linux_ext/addr.rs+1-2| ... | ... | @@ -1,11 +1,10 @@ |
| 1 | 1 | //! Linux and Android-specific extensions to socket addresses. |
| 2 | 2 | |
| 3 | 3 | use crate::os::unix::net::SocketAddr; |
| 4 | use crate::sealed::Sealed; | |
| 5 | 4 | |
| 6 | 5 | /// Platform-specific extensions to [`SocketAddr`]. |
| 7 | 6 | #[stable(feature = "unix_socket_abstract", since = "1.70.0")] |
| 8 | pub trait SocketAddrExt: Sealed { | |
| 7 | pub impl(in crate::os) trait SocketAddrExt { | |
| 9 | 8 | /// Creates a Unix socket address in the abstract namespace. |
| 10 | 9 | /// |
| 11 | 10 | /// The abstract namespace is a Linux-specific extension that allows Unix |
library/std/src/os/net/linux_ext/socket.rs+1-2| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | |
| 3 | 3 | use crate::io; |
| 4 | 4 | use crate::os::unix::net; |
| 5 | use crate::sealed::Sealed; | |
| 6 | 5 | use crate::sys::AsInner; |
| 7 | 6 | |
| 8 | 7 | /// Linux-specific functionality for `AF_UNIX` sockets [`UnixDatagram`] |
| ... | ... | @@ -11,7 +10,7 @@ use crate::sys::AsInner; |
| 11 | 10 | /// [`UnixDatagram`]: net::UnixDatagram |
| 12 | 11 | /// [`UnixStream`]: net::UnixStream |
| 13 | 12 | #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")] |
| 14 | pub trait UnixSocketExt: Sealed { | |
| 13 | pub impl(self) trait UnixSocketExt { | |
| 15 | 14 | /// Query the current setting of socket option `SO_PASSCRED`. |
| 16 | 15 | #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")] |
| 17 | 16 | fn passcred(&self) -> io::Result<bool>; |
library/std/src/os/net/linux_ext/tcp.rs+1-5| ... | ... | @@ -2,7 +2,6 @@ |
| 2 | 2 | //! |
| 3 | 3 | //! [`std::net`]: crate::net |
| 4 | 4 | |
| 5 | use crate::sealed::Sealed; | |
| 6 | 5 | use crate::sys::AsInner; |
| 7 | 6 | #[cfg(target_os = "linux")] |
| 8 | 7 | use crate::time::Duration; |
| ... | ... | @@ -12,7 +11,7 @@ use crate::{io, net}; |
| 12 | 11 | /// |
| 13 | 12 | /// [`TcpStream`]: net::TcpStream |
| 14 | 13 | #[stable(feature = "tcp_quickack", since = "1.89.0")] |
| 15 | pub trait TcpStreamExt: Sealed { | |
| 14 | pub impl(self) trait TcpStreamExt { | |
| 16 | 15 | /// Enable or disable `TCP_QUICKACK`. |
| 17 | 16 | /// |
| 18 | 17 | /// This flag causes Linux to eagerly send ACKs rather than delaying them. |
| ... | ... | @@ -109,9 +108,6 @@ pub trait TcpStreamExt: Sealed { |
| 109 | 108 | fn deferaccept(&self) -> io::Result<Duration>; |
| 110 | 109 | } |
| 111 | 110 | |
| 112 | #[stable(feature = "tcp_quickack", since = "1.89.0")] | |
| 113 | impl Sealed for net::TcpStream {} | |
| 114 | ||
| 115 | 111 | #[stable(feature = "tcp_quickack", since = "1.89.0")] |
| 116 | 112 | impl TcpStreamExt for net::TcpStream { |
| 117 | 113 | fn set_quickack(&self, quickack: bool) -> io::Result<()> { |
library/std/src/os/netbsd/net.rs+1-2| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | use crate::ffi::CStr; |
| 6 | 6 | use crate::io; |
| 7 | 7 | use crate::os::unix::net; |
| 8 | use crate::sealed::Sealed; | |
| 9 | 8 | use crate::sys::AsInner; |
| 10 | 9 | |
| 11 | 10 | /// NetBSD-specific functionality for `AF_UNIX` sockets [`UnixDatagram`] |
| ... | ... | @@ -14,7 +13,7 @@ use crate::sys::AsInner; |
| 14 | 13 | /// [`UnixDatagram`]: net::UnixDatagram |
| 15 | 14 | /// [`UnixStream`]: net::UnixStream |
| 16 | 15 | #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")] |
| 17 | pub trait UnixSocketExt: Sealed { | |
| 16 | pub impl(self) trait UnixSocketExt { | |
| 18 | 17 | /// Query the current setting of socket option `LOCAL_CREDS`. |
| 19 | 18 | #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")] |
| 20 | 19 | fn local_creds(&self) -> io::Result<bool>; |
library/std/src/os/solaris/net.rs+1-2| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | |
| 5 | 5 | use crate::io; |
| 6 | 6 | use crate::os::unix::net; |
| 7 | use crate::sealed::Sealed; | |
| 8 | 7 | use crate::sys::AsInner; |
| 9 | 8 | |
| 10 | 9 | /// solaris-specific functionality for `AF_UNIX` sockets [`UnixDatagram`] |
| ... | ... | @@ -13,7 +12,7 @@ use crate::sys::AsInner; |
| 13 | 12 | /// [`UnixDatagram`]: net::UnixDatagram |
| 14 | 13 | /// [`UnixStream`]: net::UnixStream |
| 15 | 14 | #[unstable(feature = "unix_socket_exclbind", issue = "123481")] |
| 16 | pub trait UnixSocketExt: Sealed { | |
| 15 | pub impl(self) trait UnixSocketExt { | |
| 17 | 16 | /// Enables exclusive binding on the socket. |
| 18 | 17 | /// |
| 19 | 18 | /// If true and if the socket had been set with `SO_REUSEADDR`, |
library/std/src/os/solid/io.rs-3| ... | ... | @@ -180,9 +180,6 @@ impl fmt::Debug for OwnedFd { |
| 180 | 180 | |
| 181 | 181 | macro_rules! impl_is_terminal { |
| 182 | 182 | ($($t:ty),*$(,)?) => {$( |
| 183 | #[unstable(feature = "sealed", issue = "none")] | |
| 184 | impl crate::sealed::Sealed for $t {} | |
| 185 | ||
| 186 | 183 | #[stable(feature = "is_terminal", since = "1.70.0")] |
| 187 | 184 | impl io::IsTerminal for $t { |
| 188 | 185 | #[inline] |
library/std/src/os/unix/ffi/os_str.rs+2-3| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | use crate::ffi::{OsStr, OsString}; |
| 2 | 2 | use crate::mem; |
| 3 | use crate::sealed::Sealed; | |
| 4 | 3 | use crate::sys::os_str::Buf; |
| 5 | 4 | use crate::sys::{AsInner, FromInner, IntoInner}; |
| 6 | 5 | |
| ... | ... | @@ -12,7 +11,7 @@ use crate::sys::{AsInner, FromInner, IntoInner}; |
| 12 | 11 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 13 | 12 | /// This is so that future additional methods are not breaking changes. |
| 14 | 13 | #[stable(feature = "rust1", since = "1.0.0")] |
| 15 | pub trait OsStringExt: Sealed { | |
| 14 | pub impl(self) trait OsStringExt { | |
| 16 | 15 | /// Creates an [`OsString`] from a byte vector. |
| 17 | 16 | /// |
| 18 | 17 | /// See the module documentation for an example. |
| ... | ... | @@ -43,7 +42,7 @@ impl OsStringExt for OsString { |
| 43 | 42 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 44 | 43 | /// This is so that future additional methods are not breaking changes. |
| 45 | 44 | #[stable(feature = "rust1", since = "1.0.0")] |
| 46 | pub trait OsStrExt: Sealed { | |
| 45 | pub impl(self) trait OsStrExt { | |
| 47 | 46 | #[stable(feature = "rust1", since = "1.0.0")] |
| 48 | 47 | /// Creates an [`OsStr`] from a byte slice. |
| 49 | 48 | /// |
library/std/src/os/unix/fs.rs+1-6| ... | ... | @@ -14,7 +14,6 @@ use crate::fs::{self, OpenOptions, Permissions}; |
| 14 | 14 | use crate::io::BorrowedCursor; |
| 15 | 15 | use crate::os::unix::io::{AsFd, AsRawFd}; |
| 16 | 16 | use crate::path::Path; |
| 17 | use crate::sealed::Sealed; | |
| 18 | 17 | use crate::sys::{AsInner, AsInnerMut, FromInner}; |
| 19 | 18 | use crate::{io, sys}; |
| 20 | 19 | |
| ... | ... | @@ -1011,7 +1010,7 @@ impl DirEntryExt for fs::DirEntry { |
| 1011 | 1010 | |
| 1012 | 1011 | /// Sealed Unix-specific extension methods for [`fs::DirEntry`]. |
| 1013 | 1012 | #[unstable(feature = "dir_entry_ext2", issue = "85573")] |
| 1014 | pub trait DirEntryExt2: Sealed { | |
| 1013 | pub impl(self) trait DirEntryExt2 { | |
| 1015 | 1014 | /// Returns a reference to the underlying `OsStr` of this entry's filename. |
| 1016 | 1015 | /// |
| 1017 | 1016 | /// # Examples |
| ... | ... | @@ -1035,10 +1034,6 @@ pub trait DirEntryExt2: Sealed { |
| 1035 | 1034 | fn file_name_ref(&self) -> &OsStr; |
| 1036 | 1035 | } |
| 1037 | 1036 | |
| 1038 | /// Allows extension traits within `std`. | |
| 1039 | #[unstable(feature = "sealed", issue = "none")] | |
| 1040 | impl Sealed for fs::DirEntry {} | |
| 1041 | ||
| 1042 | 1037 | #[unstable(feature = "dir_entry_ext2", issue = "85573")] |
| 1043 | 1038 | impl DirEntryExt2 for fs::DirEntry { |
| 1044 | 1039 | fn file_name_ref(&self) -> &OsStr { |
library/std/src/os/unix/io/mod.rs+1-1| ... | ... | @@ -103,7 +103,7 @@ use crate::sys::cvt; |
| 103 | 103 | mod tests; |
| 104 | 104 | |
| 105 | 105 | #[unstable(feature = "stdio_swap", issue = "150667")] |
| 106 | pub trait StdioExt: crate::sealed::Sealed { | |
| 106 | pub impl(self) trait StdioExt { | |
| 107 | 107 | /// Redirects the stdio file descriptor to point to the file description underpinning `fd`. |
| 108 | 108 | /// |
| 109 | 109 | /// Rust std::io write buffers (if any) are flushed, but other runtimes |
library/std/src/os/unix/net/addr.rs-4| ... | ... | @@ -4,7 +4,6 @@ use crate::ffi::OsStr; |
| 4 | 4 | use crate::os::net::linux_ext; |
| 5 | 5 | use crate::os::unix::ffi::OsStrExt; |
| 6 | 6 | use crate::path::Path; |
| 7 | use crate::sealed::Sealed; | |
| 8 | 7 | use crate::sys::cvt; |
| 9 | 8 | use crate::{fmt, io, mem, ptr}; |
| 10 | 9 | |
| ... | ... | @@ -253,9 +252,6 @@ impl SocketAddr { |
| 253 | 252 | } |
| 254 | 253 | } |
| 255 | 254 | |
| 256 | #[stable(feature = "unix_socket_abstract", since = "1.70.0")] | |
| 257 | impl Sealed for SocketAddr {} | |
| 258 | ||
| 259 | 255 | #[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "cygwin")))] |
| 260 | 256 | #[cfg(any(doc, target_os = "android", target_os = "linux", target_os = "cygwin"))] |
| 261 | 257 | #[stable(feature = "unix_socket_abstract", since = "1.70.0")] |
library/std/src/os/unix/net/datagram.rs-5| ... | ... | @@ -21,7 +21,6 @@ use crate::io::{IoSlice, IoSliceMut}; |
| 21 | 21 | use crate::net::Shutdown; |
| 22 | 22 | use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}; |
| 23 | 23 | use crate::path::Path; |
| 24 | use crate::sealed::Sealed; | |
| 25 | 24 | use crate::sys::net::Socket; |
| 26 | 25 | use crate::sys::{AsInner, FromInner, IntoInner, cvt}; |
| 27 | 26 | use crate::time::Duration; |
| ... | ... | @@ -60,10 +59,6 @@ const MSG_NOSIGNAL: core::ffi::c_int = 0x0; |
| 60 | 59 | #[stable(feature = "unix_socket", since = "1.10.0")] |
| 61 | 60 | pub struct UnixDatagram(Socket); |
| 62 | 61 | |
| 63 | /// Allows extension traits within `std`. | |
| 64 | #[unstable(feature = "sealed", issue = "none")] | |
| 65 | impl Sealed for UnixDatagram {} | |
| 66 | ||
| 67 | 62 | #[stable(feature = "unix_socket", since = "1.10.0")] |
| 68 | 63 | impl fmt::Debug for UnixDatagram { |
| 69 | 64 | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
library/std/src/os/unix/net/stream.rs-5| ... | ... | @@ -35,7 +35,6 @@ use crate::io::{self, IoSlice, IoSliceMut}; |
| 35 | 35 | use crate::net::Shutdown; |
| 36 | 36 | use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}; |
| 37 | 37 | use crate::path::Path; |
| 38 | use crate::sealed::Sealed; | |
| 39 | 38 | use crate::sys::net::Socket; |
| 40 | 39 | use crate::sys::{AsInner, FromInner, cvt}; |
| 41 | 40 | use crate::time::Duration; |
| ... | ... | @@ -73,10 +72,6 @@ use crate::time::Duration; |
| 73 | 72 | #[stable(feature = "unix_socket", since = "1.10.0")] |
| 74 | 73 | pub struct UnixStream(pub(super) Socket); |
| 75 | 74 | |
| 76 | /// Allows extension traits within `std`. | |
| 77 | #[unstable(feature = "sealed", issue = "none")] | |
| 78 | impl Sealed for UnixStream {} | |
| 79 | ||
| 80 | 75 | #[stable(feature = "unix_socket", since = "1.10.0")] |
| 81 | 76 | impl fmt::Debug for UnixStream { |
| 82 | 77 | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { |
library/std/src/os/unix/process.rs+3-4| ... | ... | @@ -7,7 +7,6 @@ |
| 7 | 7 | use crate::ffi::OsStr; |
| 8 | 8 | use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd}; |
| 9 | 9 | use crate::path::Path; |
| 10 | use crate::sealed::Sealed; | |
| 11 | 10 | use crate::sys::process::ChildPipe; |
| 12 | 11 | use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner}; |
| 13 | 12 | use crate::{io, process, sys}; |
| ... | ... | @@ -35,7 +34,7 @@ cfg_select! { |
| 35 | 34 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 36 | 35 | /// This is so that future additional methods are not breaking changes. |
| 37 | 36 | #[stable(feature = "rust1", since = "1.0.0")] |
| 38 | pub trait CommandExt: Sealed { | |
| 37 | pub impl(self) trait CommandExt { | |
| 39 | 38 | /// Sets the child process's user ID. This translates to a |
| 40 | 39 | /// `setuid` call in the child process. Failure in the `setuid` |
| 41 | 40 | /// call will cause the spawn to fail. |
| ... | ... | @@ -291,7 +290,7 @@ impl CommandExt for process::Command { |
| 291 | 290 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 292 | 291 | /// This is so that future additional methods are not breaking changes. |
| 293 | 292 | #[stable(feature = "rust1", since = "1.0.0")] |
| 294 | pub trait ExitStatusExt: Sealed { | |
| 293 | pub impl(self) trait ExitStatusExt { | |
| 295 | 294 | /// Creates a new `ExitStatus` or `ExitStatusError` from the raw underlying integer status |
| 296 | 295 | /// value from `wait` |
| 297 | 296 | /// |
| ... | ... | @@ -393,7 +392,7 @@ impl ExitStatusExt for process::ExitStatusError { |
| 393 | 392 | } |
| 394 | 393 | |
| 395 | 394 | #[unstable(feature = "unix_send_signal", issue = "141975")] |
| 396 | pub trait ChildExt: Sealed { | |
| 395 | pub impl(self) trait ChildExt { | |
| 397 | 396 | /// Sends a signal to a child process. |
| 398 | 397 | /// |
| 399 | 398 | /// # Errors |
library/std/src/os/windows/ffi.rs+2-3| ... | ... | @@ -58,7 +58,6 @@ use alloc::wtf8::Wtf8Buf; |
| 58 | 58 | use crate::ffi::{OsStr, OsString}; |
| 59 | 59 | use crate::fmt; |
| 60 | 60 | use crate::iter::FusedIterator; |
| 61 | use crate::sealed::Sealed; | |
| 62 | 61 | use crate::sys::os_str::Buf; |
| 63 | 62 | use crate::sys::{AsInner, FromInner}; |
| 64 | 63 | |
| ... | ... | @@ -67,7 +66,7 @@ use crate::sys::{AsInner, FromInner}; |
| 67 | 66 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 68 | 67 | /// This is so that future additional methods are not breaking changes. |
| 69 | 68 | #[stable(feature = "rust1", since = "1.0.0")] |
| 70 | pub trait OsStringExt: Sealed { | |
| 69 | pub impl(self) trait OsStringExt { | |
| 71 | 70 | /// Creates an `OsString` from a potentially ill-formed UTF-16 slice of |
| 72 | 71 | /// 16-bit code units. |
| 73 | 72 | /// |
| ... | ... | @@ -101,7 +100,7 @@ impl OsStringExt for OsString { |
| 101 | 100 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 102 | 101 | /// This is so that future additional methods are not breaking changes. |
| 103 | 102 | #[stable(feature = "rust1", since = "1.0.0")] |
| 104 | pub trait OsStrExt: Sealed { | |
| 103 | pub impl(self) trait OsStrExt { | |
| 105 | 104 | /// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially |
| 106 | 105 | /// ill-formed UTF-16. |
| 107 | 106 | /// |
library/std/src/os/windows/fs.rs+4-14| ... | ... | @@ -7,7 +7,6 @@ |
| 7 | 7 | use crate::fs::{self, Metadata, OpenOptions, Permissions}; |
| 8 | 8 | use crate::io::BorrowedCursor; |
| 9 | 9 | use crate::path::Path; |
| 10 | use crate::sealed::Sealed; | |
| 11 | 10 | use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner}; |
| 12 | 11 | use crate::time::SystemTime; |
| 13 | 12 | use crate::{io, sys}; |
| ... | ... | @@ -338,7 +337,7 @@ impl OpenOptionsExt for OpenOptions { |
| 338 | 337 | } |
| 339 | 338 | |
| 340 | 339 | #[unstable(feature = "windows_freeze_file_times", issue = "149715")] |
| 341 | pub trait OpenOptionsExt2: Sealed { | |
| 340 | pub impl(self) trait OpenOptionsExt2 { | |
| 342 | 341 | /// If set to `true`, prevent the "last access time" of the file from being changed. |
| 343 | 342 | /// |
| 344 | 343 | /// Default to `false`. |
| ... | ... | @@ -352,9 +351,6 @@ pub trait OpenOptionsExt2: Sealed { |
| 352 | 351 | fn freeze_last_write_time(&mut self, freeze: bool) -> &mut Self; |
| 353 | 352 | } |
| 354 | 353 | |
| 355 | #[unstable(feature = "sealed", issue = "none")] | |
| 356 | impl Sealed for OpenOptions {} | |
| 357 | ||
| 358 | 354 | #[unstable(feature = "windows_freeze_file_times", issue = "149715")] |
| 359 | 355 | impl OpenOptionsExt2 for OpenOptions { |
| 360 | 356 | fn freeze_last_access_time(&mut self, freeze: bool) -> &mut Self { |
| ... | ... | @@ -398,7 +394,7 @@ impl OpenOptionsExt2 for OpenOptions { |
| 398 | 394 | /// assert_eq!(permissions.file_attributes(), new_file_attr); |
| 399 | 395 | /// ``` |
| 400 | 396 | #[unstable(feature = "windows_permissions_ext", issue = "152956")] |
| 401 | pub trait PermissionsExt: Sealed { | |
| 397 | pub impl(self) trait PermissionsExt { | |
| 402 | 398 | /// Returns the file attribute bits. |
| 403 | 399 | #[unstable(feature = "windows_permissions_ext", issue = "152956")] |
| 404 | 400 | fn file_attributes(&self) -> u32; |
| ... | ... | @@ -412,9 +408,6 @@ pub trait PermissionsExt: Sealed { |
| 412 | 408 | fn from_file_attributes(mask: u32) -> Self; |
| 413 | 409 | } |
| 414 | 410 | |
| 415 | #[unstable(feature = "windows_permissions_ext", issue = "152956")] | |
| 416 | impl Sealed for fs::Permissions {} | |
| 417 | ||
| 418 | 411 | #[unstable(feature = "windows_permissions_ext", issue = "152956")] |
| 419 | 412 | impl PermissionsExt for fs::Permissions { |
| 420 | 413 | fn file_attributes(&self) -> u32 { |
| ... | ... | @@ -656,7 +649,7 @@ impl MetadataExt for Metadata { |
| 656 | 649 | /// |
| 657 | 650 | /// On Windows, a symbolic link knows whether it is a file or directory. |
| 658 | 651 | #[stable(feature = "windows_file_type_ext", since = "1.64.0")] |
| 659 | pub trait FileTypeExt: Sealed { | |
| 652 | pub impl(self) trait FileTypeExt { | |
| 660 | 653 | /// Returns `true` if this file type is a symbolic link that is also a directory. |
| 661 | 654 | #[stable(feature = "windows_file_type_ext", since = "1.64.0")] |
| 662 | 655 | fn is_symlink_dir(&self) -> bool; |
| ... | ... | @@ -665,9 +658,6 @@ pub trait FileTypeExt: Sealed { |
| 665 | 658 | fn is_symlink_file(&self) -> bool; |
| 666 | 659 | } |
| 667 | 660 | |
| 668 | #[stable(feature = "windows_file_type_ext", since = "1.64.0")] | |
| 669 | impl Sealed for fs::FileType {} | |
| 670 | ||
| 671 | 661 | #[stable(feature = "windows_file_type_ext", since = "1.64.0")] |
| 672 | 662 | impl FileTypeExt for fs::FileType { |
| 673 | 663 | fn is_symlink_dir(&self) -> bool { |
| ... | ... | @@ -680,7 +670,7 @@ impl FileTypeExt for fs::FileType { |
| 680 | 670 | |
| 681 | 671 | /// Windows-specific extensions to [`fs::FileTimes`]. |
| 682 | 672 | #[stable(feature = "file_set_times", since = "1.75.0")] |
| 683 | pub trait FileTimesExt: Sealed { | |
| 673 | pub impl(self) trait FileTimesExt { | |
| 684 | 674 | /// Set the creation time of a file. |
| 685 | 675 | #[stable(feature = "file_set_times", since = "1.75.0")] |
| 686 | 676 | fn set_created(self, t: SystemTime) -> Self; |
library/std/src/os/windows/io/handle.rs-3| ... | ... | @@ -405,9 +405,6 @@ impl fmt::Debug for OwnedHandle { |
| 405 | 405 | |
| 406 | 406 | macro_rules! impl_is_terminal { |
| 407 | 407 | ($($t:ty),*$(,)?) => {$( |
| 408 | #[unstable(feature = "sealed", issue = "none")] | |
| 409 | impl crate::sealed::Sealed for $t {} | |
| 410 | ||
| 411 | 408 | #[stable(feature = "is_terminal", since = "1.70.0")] |
| 412 | 409 | impl io::IsTerminal for $t { |
| 413 | 410 | #[inline] |
library/std/src/os/windows/process.rs+4-5| ... | ... | @@ -9,7 +9,6 @@ use crate::mem::MaybeUninit; |
| 9 | 9 | use crate::os::windows::io::{ |
| 10 | 10 | AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle, |
| 11 | 11 | }; |
| 12 | use crate::sealed::Sealed; | |
| 13 | 12 | use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner}; |
| 14 | 13 | use crate::{io, marker, process, ptr, sys}; |
| 15 | 14 | |
| ... | ... | @@ -153,7 +152,7 @@ impl From<OwnedHandle> for process::ChildStderr { |
| 153 | 152 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 154 | 153 | /// This is so that future additional methods are not breaking changes. |
| 155 | 154 | #[stable(feature = "exit_status_from", since = "1.12.0")] |
| 156 | pub trait ExitStatusExt: Sealed { | |
| 155 | pub impl(self) trait ExitStatusExt { | |
| 157 | 156 | /// Creates a new `ExitStatus` from the raw underlying `u32` return value of |
| 158 | 157 | /// a process. |
| 159 | 158 | #[stable(feature = "exit_status_from", since = "1.12.0")] |
| ... | ... | @@ -172,7 +171,7 @@ impl ExitStatusExt for process::ExitStatus { |
| 172 | 171 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 173 | 172 | /// This is so that future additional methods are not breaking changes. |
| 174 | 173 | #[stable(feature = "windows_process_extensions", since = "1.16.0")] |
| 175 | pub trait CommandExt: Sealed { | |
| 174 | pub impl(self) trait CommandExt { | |
| 176 | 175 | /// Sets the [process creation flags][1] to be passed to `CreateProcess`. |
| 177 | 176 | /// |
| 178 | 177 | /// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`. |
| ... | ... | @@ -443,7 +442,7 @@ impl CommandExt for process::Command { |
| 443 | 442 | } |
| 444 | 443 | |
| 445 | 444 | #[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")] |
| 446 | pub trait ChildExt: Sealed { | |
| 445 | pub impl(self) trait ChildExt { | |
| 447 | 446 | /// Extracts the main thread raw handle, without taking ownership |
| 448 | 447 | #[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")] |
| 449 | 448 | fn main_thread_handle(&self) -> BorrowedHandle<'_>; |
| ... | ... | @@ -461,7 +460,7 @@ impl ChildExt for process::Child { |
| 461 | 460 | /// This trait is sealed: it cannot be implemented outside the standard library. |
| 462 | 461 | /// This is so that future additional methods are not breaking changes. |
| 463 | 462 | #[unstable(feature = "windows_process_exit_code_from", issue = "111688")] |
| 464 | pub trait ExitCodeExt: Sealed { | |
| 463 | pub impl(self) trait ExitCodeExt { | |
| 465 | 464 | /// Creates a new `ExitCode` from the raw underlying `u32` return value of |
| 466 | 465 | /// a process. |
| 467 | 466 | /// |
library/std/src/process.rs-20| ... | ... | @@ -256,10 +256,6 @@ pub struct Child { |
| 256 | 256 | pub stderr: Option<ChildStderr>, |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | /// Allows extension traits within `std`. | |
| 260 | #[unstable(feature = "sealed", issue = "none")] | |
| 261 | impl crate::sealed::Sealed for Child {} | |
| 262 | ||
| 263 | 259 | impl AsInner<imp::Process> for Child { |
| 264 | 260 | #[inline] |
| 265 | 261 | fn as_inner(&self) -> &imp::Process { |
| ... | ... | @@ -597,10 +593,6 @@ pub struct Command { |
| 597 | 593 | inner: imp::Command, |
| 598 | 594 | } |
| 599 | 595 | |
| 600 | /// Allows extension traits within `std`. | |
| 601 | #[unstable(feature = "sealed", issue = "none")] | |
| 602 | impl crate::sealed::Sealed for Command {} | |
| 603 | ||
| 604 | 596 | impl Command { |
| 605 | 597 | /// Constructs a new `Command` for launching the program at |
| 606 | 598 | /// path `program`, with the following default configuration: |
| ... | ... | @@ -1893,10 +1885,6 @@ impl Default for ExitStatus { |
| 1893 | 1885 | } |
| 1894 | 1886 | } |
| 1895 | 1887 | |
| 1896 | /// Allows extension traits within `std`. | |
| 1897 | #[unstable(feature = "sealed", issue = "none")] | |
| 1898 | impl crate::sealed::Sealed for ExitStatus {} | |
| 1899 | ||
| 1900 | 1888 | impl ExitStatus { |
| 1901 | 1889 | /// Was termination successful? Returns a `Result`. |
| 1902 | 1890 | /// |
| ... | ... | @@ -1999,10 +1987,6 @@ impl fmt::Display for ExitStatus { |
| 1999 | 1987 | } |
| 2000 | 1988 | } |
| 2001 | 1989 | |
| 2002 | /// Allows extension traits within `std`. | |
| 2003 | #[unstable(feature = "sealed", issue = "none")] | |
| 2004 | impl crate::sealed::Sealed for ExitStatusError {} | |
| 2005 | ||
| 2006 | 1990 | /// Describes the result of a process after it has failed |
| 2007 | 1991 | /// |
| 2008 | 1992 | /// Produced by the [`.exit_ok`](ExitStatus::exit_ok) method on [`ExitStatus`]. |
| ... | ... | @@ -2171,10 +2155,6 @@ impl crate::error::Error for ExitStatusError {} |
| 2171 | 2155 | #[stable(feature = "process_exitcode", since = "1.61.0")] |
| 2172 | 2156 | pub struct ExitCode(imp::ExitCode); |
| 2173 | 2157 | |
| 2174 | /// Allows extension traits within `std`. | |
| 2175 | #[unstable(feature = "sealed", issue = "none")] | |
| 2176 | impl crate::sealed::Sealed for ExitCode {} | |
| 2177 | ||
| 2178 | 2158 | #[stable(feature = "process_exitcode", since = "1.61.0")] |
| 2179 | 2159 | impl ExitCode { |
| 2180 | 2160 | /// The canonical `ExitCode` for successful termination on this platform. |
library/std/src/sys/process/unix/unix.rs+1-1| ... | ... | @@ -318,7 +318,7 @@ impl Command { |
| 318 | 318 | // An alternative would be to require CAP_SETGID (in |
| 319 | 319 | // addition to CAP_SETUID) for setting the UID. |
| 320 | 320 | if e.raw_os_error() != Some(libc::EPERM) { |
| 321 | return Err(e.into()); | |
| 321 | return Err(e); | |
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | } |
library/std/src/sys/stdio/motor.rs-2| ... | ... | @@ -28,8 +28,6 @@ impl Stderr { |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | impl crate::sealed::Sealed for Stdin {} | |
| 32 | ||
| 33 | 31 | impl crate::io::IsTerminal for Stdin { |
| 34 | 32 | fn is_terminal(&self) -> bool { |
| 35 | 33 | moto_rt::fs::is_terminal(moto_rt::FD_STDIN) |
src/librustdoc/build.rs+2-5| ... | ... | @@ -55,12 +55,9 @@ fn main() { |
| 55 | 55 | let minified_path = std::path::PathBuf::from(format!("{out_dir}/{path}.min")); |
| 56 | 56 | if path.ends_with(".js") || path.ends_with(".css") { |
| 57 | 57 | let minified: String = if path.ends_with(".css") { |
| 58 | minifier::css::minify(str::from_utf8(&data_bytes).unwrap()) | |
| 59 | .unwrap() | |
| 60 | .to_string() | |
| 61 | .into() | |
| 58 | minifier::css::minify(str::from_utf8(&data_bytes).unwrap()).unwrap().to_string() | |
| 62 | 59 | } else { |
| 63 | minifier::js::minify(str::from_utf8(&data_bytes).unwrap()).to_string().into() | |
| 60 | minifier::js::minify(str::from_utf8(&data_bytes).unwrap()).to_string() | |
| 64 | 61 | }; |
| 65 | 62 | std::fs::write(&minified_path, minified.as_bytes()).expect("write to out_dir"); |
| 66 | 63 | } else { |
src/librustdoc/clean/auto_trait.rs+1-1| ... | ... | @@ -202,7 +202,7 @@ fn clean_param_env<'tcx>( |
| 202 | 202 | .collect(); |
| 203 | 203 | |
| 204 | 204 | let mut generics = clean::Generics { params, where_predicates }; |
| 205 | simplify::sized_bounds(cx, &mut generics); | |
| 205 | simplify::sizedness_bounds(cx, &mut generics); | |
| 206 | 206 | generics.where_predicates = simplify::where_clauses(cx.tcx, generics.where_predicates); |
| 207 | 207 | generics |
| 208 | 208 | } |
src/librustdoc/clean/mod.rs+1-1| ... | ... | @@ -988,7 +988,7 @@ fn clean_ty_generics_inner<'tcx>( |
| 988 | 988 | where_predicates.into_iter().flat_map(|p| clean_predicate(*p, cx)).collect(); |
| 989 | 989 | |
| 990 | 990 | let mut generics = Generics { params, where_predicates }; |
| 991 | simplify::sized_bounds(cx, &mut generics); | |
| 991 | simplify::sizedness_bounds(cx, &mut generics); | |
| 992 | 992 | generics.where_predicates = simplify::where_clauses(cx.tcx, generics.where_predicates); |
| 993 | 993 | generics |
| 994 | 994 | } |
src/librustdoc/clean/simplify.rs+58-36| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | |
| 14 | 14 | use rustc_data_structures::fx::FxIndexMap; |
| 15 | 15 | use rustc_data_structures::thin_vec::ThinVec; |
| 16 | use rustc_data_structures::unord::UnordSet; | |
| 16 | use rustc_hir as hir; | |
| 17 | 17 | use rustc_hir::def_id::DefId; |
| 18 | 18 | use rustc_middle::ty::{TyCtxt, Unnormalized}; |
| 19 | 19 | |
| ... | ... | @@ -121,50 +121,72 @@ fn trait_is_same_or_supertrait(tcx: TyCtxt<'_>, child: DefId, trait_: DefId) -> |
| 121 | 121 | .any(|did| trait_is_same_or_supertrait(tcx, did, trait_)) |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | pub(crate) fn sized_bounds(cx: &mut DocContext<'_>, generics: &mut clean::Generics) { | |
| 125 | let mut sized_params = UnordSet::new(); | |
| 124 | /// Reconstruct all sizedness bounds on non-`Self` type parameters as they appear in the surface | |
| 125 | /// language given generics that were cleaned from the middle::ty IR. | |
| 126 | /// | |
| 127 | /// For example, assuming `T` is a type parameter of the owner of `generics`, | |
| 128 | /// `T: Sized` gets dropped and `T: MetaSized` gets rewritten to `T: ?Sized`. | |
| 129 | pub(crate) fn sizedness_bounds(cx: &mut DocContext<'_>, generics: &mut clean::Generics) { | |
| 130 | #[derive(PartialEq, Eq, PartialOrd, Ord)] | |
| 131 | enum Sizedness { | |
| 132 | PointeeSized, | |
| 133 | MetaSized, | |
| 134 | Sized, | |
| 135 | } | |
| 136 | ||
| 137 | let mut type_params: FxIndexMap<_, _> = generics | |
| 138 | .params | |
| 139 | .iter() | |
| 140 | .filter(|param| matches!(param.kind, clean::GenericParamDefKind::Type { .. })) | |
| 141 | .map(|param| (param.name, Sizedness::PointeeSized)) | |
| 142 | .collect(); | |
| 126 | 143 | |
| 127 | // In the surface language, all type parameters except `Self` have an | |
| 128 | // implicit `Sized` bound unless removed with `?Sized`. | |
| 129 | // However, in the list of where-predicates below, `Sized` appears like a | |
| 130 | // normal bound: It's either present (the type is sized) or | |
| 131 | // absent (the type might be unsized) but never *maybe* (i.e. `?Sized`). | |
| 132 | // | |
| 133 | // This is unsuitable for rendering. | |
| 134 | // Thus, as a first step remove all `Sized` bounds that should be implicit. | |
| 135 | // | |
| 136 | // Note that associated types also have an implicit `Sized` bound but we | |
| 137 | // don't actually know the set of associated types right here so that | |
| 138 | // should be handled when cleaning associated types. | |
| 139 | 144 | generics.where_predicates.retain(|pred| { |
| 140 | 145 | let WP::BoundPredicate { ty: clean::Generic(param), bounds, .. } = pred else { |
| 141 | 146 | return true; |
| 142 | 147 | }; |
| 143 | 148 | |
| 144 | if bounds.iter().any(|b| b.is_sized_bound(cx.tcx)) { | |
| 145 | sized_params.insert(*param); | |
| 146 | false | |
| 147 | } else if bounds.iter().any(|b| b.is_meta_sized_bound(cx.tcx)) { | |
| 148 | // FIXME(sized-hierarchy): Always skip `MetaSized` bounds so that only `?Sized` | |
| 149 | // is shown and none of the new sizedness traits leak into documentation. | |
| 150 | false | |
| 151 | } else { | |
| 152 | true | |
| 149 | // We require the caller to pass generics that were cleaned from the middle::ty IR. | |
| 150 | // We know that that cleaning process never generates more than one bound per predicate. | |
| 151 | let [bound] = &*bounds else { unreachable!() }; | |
| 152 | ||
| 153 | let clean::GenericBound::TraitBound(trait_ref, hir::TraitBoundModifiers::NONE) = bound | |
| 154 | else { | |
| 155 | return true; | |
| 156 | }; | |
| 157 | ||
| 158 | // This transformation is only valid on type parameters defined on the closest item. | |
| 159 | // If the parameter was defined by the parent item we know that the sizedness bound | |
| 160 | // *has* to be user-written in which case we have to preserve it as is. | |
| 161 | let Some(param_sizedness) = type_params.get_mut(param) else { return true }; | |
| 162 | ||
| 163 | let sizedness = match cx.tcx.as_lang_item(trait_ref.trait_.def_id()) { | |
| 164 | Some(hir::LangItem::Sized) => Sizedness::Sized, | |
| 165 | Some(hir::LangItem::MetaSized) => Sizedness::MetaSized, | |
| 166 | _ => return true, | |
| 167 | }; | |
| 168 | ||
| 169 | if sizedness > *param_sizedness { | |
| 170 | *param_sizedness = sizedness; | |
| 153 | 171 | } |
| 172 | ||
| 173 | false | |
| 154 | 174 | }); |
| 155 | 175 | |
| 156 | // As a final step, go through the type parameters again and insert a | |
| 157 | // `?Sized` bound for each one we didn't find to be `Sized`. | |
| 158 | for param in &generics.params { | |
| 159 | if let clean::GenericParamDefKind::Type { .. } = param.kind | |
| 160 | && !sized_params.contains(&param.name) | |
| 161 | { | |
| 162 | generics.where_predicates.push(WP::BoundPredicate { | |
| 163 | ty: clean::Type::Generic(param.name), | |
| 164 | bounds: vec![clean::GenericBound::maybe_sized(cx)], | |
| 165 | bound_params: Vec::new(), | |
| 166 | }) | |
| 167 | } | |
| 176 | for (param, sizedness) in type_params { | |
| 177 | generics.where_predicates.push(WP::BoundPredicate { | |
| 178 | ty: clean::Type::Generic(param), | |
| 179 | bounds: vec![match sizedness { | |
| 180 | // FIXME(sized-hierarchy, #157247): Actually render `MetaSized` as `MetaSized` and | |
| 181 | // `PointeeSized` as `PointeeSized` instead of `?Sized` if the crate enables | |
| 182 | // `sized_hierarchy` and doesn't set `#![doc(dont_leak…)]`. | |
| 183 | Sizedness::MetaSized | Sizedness::PointeeSized => { | |
| 184 | clean::GenericBound::maybe_sized(cx) | |
| 185 | } | |
| 186 | Sizedness::Sized => continue, | |
| 187 | }], | |
| 188 | bound_params: Vec::new(), | |
| 189 | }); | |
| 168 | 190 | } |
| 169 | 191 | } |
| 170 | 192 |
src/librustdoc/clean/types.rs+4-7| ... | ... | @@ -1201,11 +1201,8 @@ impl GenericBound { |
| 1201 | 1201 | } |
| 1202 | 1202 | |
| 1203 | 1203 | fn is_bounded_by_lang_item(&self, tcx: TyCtxt<'_>, lang_item: LangItem) -> bool { |
| 1204 | if let GenericBound::TraitBound( | |
| 1205 | PolyTrait { ref trait_, .. }, | |
| 1206 | rustc_hir::TraitBoundModifiers::NONE, | |
| 1207 | ) = *self | |
| 1208 | && tcx.is_lang_item(trait_.def_id(), lang_item) | |
| 1204 | if let GenericBound::TraitBound(poly_trait_ref, rustc_hir::TraitBoundModifiers::NONE) = self | |
| 1205 | && tcx.is_lang_item(poly_trait_ref.trait_.def_id(), lang_item) | |
| 1209 | 1206 | { |
| 1210 | 1207 | return true; |
| 1211 | 1208 | } |
| ... | ... | @@ -1213,8 +1210,8 @@ impl GenericBound { |
| 1213 | 1210 | } |
| 1214 | 1211 | |
| 1215 | 1212 | pub(crate) fn get_trait_path(&self) -> Option<Path> { |
| 1216 | if let GenericBound::TraitBound(PolyTrait { ref trait_, .. }, _) = *self { | |
| 1217 | Some(trait_.clone()) | |
| 1213 | if let GenericBound::TraitBound(poly_trait_ref, _) = self { | |
| 1214 | Some(poly_trait_ref.trait_.clone()) | |
| 1218 | 1215 | } else { |
| 1219 | 1216 | None |
| 1220 | 1217 | } |
src/librustdoc/html/static/css/rustdoc.css+6-6| ... | ... | @@ -731,7 +731,8 @@ ul.block, .block li, .block ul { |
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | .block ul a { |
| 734 | 	padding-left: 1rem; | |
| 734 | 	/* extend click target to far edge of screen (mile wide bar) */ | |
| 735 | 	padding-left: calc(1rem + var(--sidebar-elems-left-padding)); | |
| 735 | 736 | } |
| 736 | 737 | |
| 737 | 738 | .sidebar-elems a, |
| ... | ... | @@ -740,7 +741,7 @@ ul.block, .block li, .block ul { |
| 740 | 741 | 	padding: 0.25rem; /* 4px */ |
| 741 | 742 | 	margin-right: 0.25rem; |
| 742 | 743 | 	/* extend click target to far edge of screen (mile wide bar) */ |
| 743 | 	border-left: solid var(--sidebar-elems-left-padding) transparent; | |
| 744 | 	padding-left: calc(0.25rem + var(--sidebar-elems-left-padding)); | |
| 744 | 745 | 	margin-left: calc(-0.25rem - var(--sidebar-elems-left-padding)); |
| 745 | 746 | 	background-clip: border-box; |
| 746 | 747 | } |
| ... | ... | @@ -861,7 +862,7 @@ ul.block, .block li, .block ul { |
| 861 | 862 | 		| └─────┘ |
| 862 | 863 | 		*/ |
| 863 | 864 | 	margin-top: -16px; |
| 864 | 	border-top: solid 16px transparent; | |
| 865 | 	padding-top: 16px; | |
| 865 | 866 | 	box-sizing: content-box; |
| 866 | 867 | 	position: relative; |
| 867 | 868 | 	background-clip: border-box; |
| ... | ... | @@ -870,8 +871,6 @@ ul.block, .block li, .block ul { |
| 870 | 871 | |
| 871 | 872 | .sidebar-crate h2 a { |
| 872 | 873 | 	display: block; |
| 873 | 	/* extend click target to far edge of screen (mile wide bar) */ | |
| 874 | 	border-left: solid var(--sidebar-elems-left-padding) transparent; | |
| 875 | 874 | 	background-clip: border-box; |
| 876 | 875 | 	margin: 0 calc(-24px + 0.25rem) 0 calc(-0.2rem - var(--sidebar-elems-left-padding)); |
| 877 | 876 | 	/* Align the sidebar crate link with the search bar, which have different |
| ... | ... | @@ -888,7 +887,8 @@ ul.block, .block li, .block ul { |
| 888 | 887 | 		x = ( 16px - 0.57rem ) / 2 |
| 889 | 888 | 	*/ |
| 890 | 889 | 	padding: calc( ( 16px - 0.57rem ) / 2 ) 0.25rem; |
| 891 | 	padding-left: 0.2rem; | |
| 890 | 	/* extend click target to far edge of screen (mile wide bar) */ | |
| 891 | 	padding-left: calc(0.2rem + var(--sidebar-elems-left-padding)); | |
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | .sidebar-crate h2 .version { |
tests/rustdoc-gui/huge-logo.goml+1-1| ... | ... | @@ -7,4 +7,4 @@ set-window-size: (1280, 1024) |
| 7 | 7 | assert-property: (".sidebar-crate .logo-container", {"offsetWidth": "96", "offsetHeight": 48}) |
| 8 | 8 | // offsetWidth = width of sidebar, offsetHeight = height + top padding |
| 9 | 9 | assert-property: (".sidebar-crate .logo-container img", {"offsetWidth": "48", "offsetHeight": 64}) |
| 10 | assert-css: (".sidebar-crate .logo-container img", {"border-top-width": "16px", "margin-top": "-16px"}) | |
| 10 | assert-css: (".sidebar-crate .logo-container img", {"padding-top": "16px", "margin-top": "-16px"}) |
tests/rustdoc-html/inline_cross/auxiliary/ext-sized-bounds.rs created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | pub fn sized_param<T>() {} | |
| 2 | ||
| 3 | pub fn relaxed_sized_on_param<T: ?Sized>() {} | |
| 4 | ||
| 5 | pub trait SizedOnParentParam<T: ?Sized> { | |
| 6 | fn func() where T: Sized; | |
| 7 | } | |
| 8 | ||
| 9 | pub trait SizedSelf: Sized {} | |
| 10 | ||
| 11 | pub trait SizedOnParentSelf { | |
| 12 | fn func(self) -> Self | |
| 13 | where | |
| 14 | Self: Sized | |
| 15 | { | |
| 16 | self | |
| 17 | } | |
| 18 | } |
tests/rustdoc-html/inline_cross/auxiliary/issue-24183.rs deleted-14| ... | ... | @@ -1,14 +0,0 @@ |
| 1 | #![crate_type = "lib"] | |
| 2 | ||
| 3 | pub trait U/*: ?Sized */ { | |
| 4 | fn modified(self) -> Self | |
| 5 | where | |
| 6 | Self: Sized | |
| 7 | { | |
| 8 | self | |
| 9 | } | |
| 10 | ||
| 11 | fn touch(&self)/* where Self: ?Sized */{} | |
| 12 | } | |
| 13 | ||
| 14 | pub trait S: Sized {} |
tests/rustdoc-html/inline_cross/self-sized-bounds-24183.method_no_where_self_sized.html deleted-1| ... | ... | @@ -1 +0,0 @@ |
| 1 | <h4 class="code-header">fn <a href="#method.touch" class="fn">touch</a>(&amp;self)</h4> | |
| \ No newline at end of file |
tests/rustdoc-html/inline_cross/self-sized-bounds-24183.rs deleted-19| ... | ... | @@ -1,19 +0,0 @@ |
| 1 | // https://github.com/rust-lang/rust/issues/24183 | |
| 2 | #![crate_type = "lib"] | |
| 3 | #![crate_name = "usr"] | |
| 4 | ||
| 5 | //@ aux-crate:issue_24183=issue-24183.rs | |
| 6 | //@ edition: 2021 | |
| 7 | ||
| 8 | //@ has usr/trait.U.html | |
| 9 | //@ has - '//*[@class="rust item-decl"]' "pub trait U {" | |
| 10 | //@ has - '//*[@id="method.modified"]' \ | |
| 11 | // "fn modified(self) -> Self\ | |
| 12 | // where \ | |
| 13 | // Self: Sized" | |
| 14 | //@ snapshot method_no_where_self_sized - '//*[@id="method.touch"]/*[@class="code-header"]' | |
| 15 | pub use issue_24183::U; | |
| 16 | ||
| 17 | //@ has usr/trait.S.html | |
| 18 | //@ has - '//*[@class="rust item-decl"]' 'pub trait S: Sized {' | |
| 19 | pub use issue_24183::S; |
tests/rustdoc-html/inline_cross/sized-bounds.rs created+57| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | // Check that we properly reconstruct sized bounds from the middle::ty IR to the surface syntax. | |
| 2 | ||
| 3 | #![crate_name = "it"] | |
| 4 | //@ aux-build: ext-sized-bounds.rs | |
| 5 | extern crate ext_sized_bounds as ext; | |
| 6 | ||
| 7 | // Ensure that we translate [<T as Sized>] to ``. | |
| 8 | // Non-`Self` type params are implicitly `Sized`, so we can hide it. | |
| 9 | // | |
| 10 | //@ has it/fn.sized_param.html | |
| 11 | //@ has - '//pre[@class="rust item-decl"]' "fn sized_param<T>()" | |
| 12 | //@ !has - '//pre[@class="rust item-decl"]' "T: Sized" | |
| 13 | pub use ext::sized_param; | |
| 14 | ||
| 15 | // Ensure that we translate [<T as MetaSized>] to `T: ?Sized`. | |
| 16 | // On stable, the user must've opted out of the implicit `Sized` bound using relaxed bound `?Sized` | |
| 17 | // which will implicitly add the `MetaSized` bound (which is unstable in the surface language). | |
| 18 | // | |
| 19 | //@ has it/fn.relaxed_sized_on_param.html | |
| 20 | //@ has - '//pre[@class="rust item-decl"]' "fn relaxed_sized_on_param<T>()where T: ?Sized" | |
| 21 | pub use ext::relaxed_sized_on_param; | |
| 22 | ||
| 23 | // Ensure that we don't drop the `T: Sized` bound on `func`. Previously, we didn't check if `T` | |
| 24 | // actually belongs to the closest item and thought that it was an implicit bound which it isn't. | |
| 25 | // issue: <https://github.com/rust-lang/rust/issues/144015> | |
| 26 | // | |
| 27 | //@ has it/trait.SizedOnParentParam.html | |
| 28 | //@ has - '//*[@class="rust item-decl"]' \ | |
| 29 | // "trait SizedOnParentParam<T>\ | |
| 30 | // where \ | |
| 31 | // T: ?Sized" | |
| 32 | //@ has - '//*[@id="tymethod.func"]' \ | |
| 33 | // "fn func()\ | |
| 34 | // where \ | |
| 35 | // T: Sized" | |
| 36 | pub use ext::SizedOnParentParam; | |
| 37 | ||
| 38 | // Ensure that we don't drop the `Self: Sized` bound on traits. | |
| 39 | // Traits are *not* implicitly bounded by `Sized`. They're only implicitly bounded by `MetaSized`. | |
| 40 | // | |
| 41 | //@ has it/trait.SizedSelf.html | |
| 42 | //@ has - '//*[@class="rust item-decl"]' 'trait SizedSelf: Sized {' | |
| 43 | pub use ext::SizedSelf; | |
| 44 | ||
| 45 | // Ensure that we don't drop the `Self: Sized` bound. | |
| 46 | // First of all, `Self` type params of traits are not implicitly bounded by `Self`. | |
| 47 | // Second of all, `Self` appears in a bound on an assoc item but `Self` belongs to the parent item, | |
| 48 | // the trait meaning it's definitely user-written and not implicit. | |
| 49 | // issue: <https://github.com/rust-lang/rust/issues/24183> | |
| 50 | // | |
| 51 | //@ has it/trait.SizedOnParentSelf.html | |
| 52 | //@ has - '//*[@class="rust item-decl"]' "trait SizedOnParentSelf {" | |
| 53 | //@ has - '//*[@id="method.func"]' \ | |
| 54 | // "fn func(self) -> Self\ | |
| 55 | // where \ | |
| 56 | // Self: Sized" | |
| 57 | pub use ext::SizedOnParentSelf; |
tests/ui/asm/naked-invalid-attr.stderr+2-2| ... | ... | @@ -18,7 +18,7 @@ error: `#[naked]` attribute cannot be used on foreign functions |
| 18 | 18 | LL | #[unsafe(naked)] |
| 19 | 19 | | ^^^^^^^^^^^^^^^^ |
| 20 | 20 | | |
| 21 | = help: `#[naked]` can be applied to functions and methods | |
| 21 | = help: `#[naked]` can only be applied to functions with a body | |
| 22 | 22 | |
| 23 | 23 | error: `#[naked]` attribute cannot be used on structs |
| 24 | 24 | --> $DIR/naked-invalid-attr.rs:14:1 |
| ... | ... | @@ -42,7 +42,7 @@ error: `#[naked]` attribute cannot be used on required trait methods |
| 42 | 42 | LL | #[unsafe(naked)] |
| 43 | 43 | | ^^^^^^^^^^^^^^^^ |
| 44 | 44 | | |
| 45 | = help: `#[naked]` can be applied to functions, inherent methods, provided trait methods, and trait methods in impl blocks | |
| 45 | = help: `#[naked]` can only be applied to functions with a body | |
| 46 | 46 | |
| 47 | 47 | error: `#[naked]` attribute cannot be used on closures |
| 48 | 48 | --> $DIR/naked-invalid-attr.rs:52:5 |
tests/ui/attributes/attr-on-mac-call.rs+4-1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | //@ check-pass | |
| 1 | //@ check-fail | |
| 2 | 2 | // Regression test for https://github.com/rust-lang/rust/issues/145779 |
| 3 | 3 | #![warn(unused_attributes)] |
| 4 | #![feature(sanitize)] | |
| 4 | 5 | |
| 5 | 6 | fn main() { |
| 6 | 7 | #[export_name = "x"] |
| ... | ... | @@ -72,6 +73,8 @@ fn main() { |
| 72 | 73 | #[link_name = "x"] |
| 73 | 74 | //~^ WARN attribute cannot be used on macro calls |
| 74 | 75 | //~| WARN previously accepted |
| 76 | #[sanitize(address = "off")] | |
| 77 | //~^ ERROR attribute cannot be used on macro calls | |
| 75 | 78 | unreachable!(); |
| 76 | 79 | |
| 77 | 80 | #[repr()] |
tests/ui/attributes/attr-on-mac-call.stderr+40-32| ... | ... | @@ -1,5 +1,13 @@ |
| 1 | error: `#[sanitize]` attribute cannot be used on macro calls | |
| 2 | --> $DIR/attr-on-mac-call.rs:76:5 | |
| 3 | | | |
| 4 | LL | #[sanitize(address = "off")] | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 6 | | | |
| 7 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 8 | ||
| 1 | 9 | warning: `#[export_name]` attribute cannot be used on macro calls |
| 2 | --> $DIR/attr-on-mac-call.rs:6:5 | |
| 10 | --> $DIR/attr-on-mac-call.rs:7:5 | |
| 3 | 11 | | |
| 4 | 12 | LL | #[export_name = "x"] |
| 5 | 13 | | ^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -13,7 +21,7 @@ LL | #![warn(unused_attributes)] |
| 13 | 21 | | ^^^^^^^^^^^^^^^^^ |
| 14 | 22 | |
| 15 | 23 | warning: `#[naked]` attribute cannot be used on macro calls |
| 16 | --> $DIR/attr-on-mac-call.rs:9:5 | |
| 24 | --> $DIR/attr-on-mac-call.rs:10:5 | |
| 17 | 25 | | |
| 18 | 26 | LL | #[unsafe(naked)] |
| 19 | 27 | | ^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -22,7 +30,7 @@ LL | #[unsafe(naked)] |
| 22 | 30 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 23 | 31 | |
| 24 | 32 | warning: `#[track_caller]` attribute cannot be used on macro calls |
| 25 | --> $DIR/attr-on-mac-call.rs:12:5 | |
| 33 | --> $DIR/attr-on-mac-call.rs:13:5 | |
| 26 | 34 | | |
| 27 | 35 | LL | #[track_caller] |
| 28 | 36 | | ^^^^^^^^^^^^^^^ |
| ... | ... | @@ -31,7 +39,7 @@ LL | #[track_caller] |
| 31 | 39 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 32 | 40 | |
| 33 | 41 | warning: `#[used]` attribute cannot be used on macro calls |
| 34 | --> $DIR/attr-on-mac-call.rs:15:5 | |
| 42 | --> $DIR/attr-on-mac-call.rs:16:5 | |
| 35 | 43 | | |
| 36 | 44 | LL | #[used] |
| 37 | 45 | | ^^^^^^^ |
| ... | ... | @@ -40,7 +48,7 @@ LL | #[used] |
| 40 | 48 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 41 | 49 | |
| 42 | 50 | warning: `#[target_feature]` attribute cannot be used on macro calls |
| 43 | --> $DIR/attr-on-mac-call.rs:18:5 | |
| 51 | --> $DIR/attr-on-mac-call.rs:19:5 | |
| 44 | 52 | | |
| 45 | 53 | LL | #[target_feature(enable = "x")] |
| 46 | 54 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -49,7 +57,7 @@ LL | #[target_feature(enable = "x")] |
| 49 | 57 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 50 | 58 | |
| 51 | 59 | warning: `#[deprecated]` attribute cannot be used on macro calls |
| 52 | --> $DIR/attr-on-mac-call.rs:21:5 | |
| 60 | --> $DIR/attr-on-mac-call.rs:22:5 | |
| 53 | 61 | | |
| 54 | 62 | LL | #[deprecated] |
| 55 | 63 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -58,7 +66,7 @@ LL | #[deprecated] |
| 58 | 66 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 59 | 67 | |
| 60 | 68 | warning: `#[inline]` attribute cannot be used on macro calls |
| 61 | --> $DIR/attr-on-mac-call.rs:24:5 | |
| 69 | --> $DIR/attr-on-mac-call.rs:25:5 | |
| 62 | 70 | | |
| 63 | 71 | LL | #[inline] |
| 64 | 72 | | ^^^^^^^^^ |
| ... | ... | @@ -67,7 +75,7 @@ LL | #[inline] |
| 67 | 75 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 68 | 76 | |
| 69 | 77 | warning: `#[link_name]` attribute cannot be used on macro calls |
| 70 | --> $DIR/attr-on-mac-call.rs:27:5 | |
| 78 | --> $DIR/attr-on-mac-call.rs:28:5 | |
| 71 | 79 | | |
| 72 | 80 | LL | #[link_name = "x"] |
| 73 | 81 | | ^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -76,7 +84,7 @@ LL | #[link_name = "x"] |
| 76 | 84 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 77 | 85 | |
| 78 | 86 | warning: `#[link_section]` attribute cannot be used on macro calls |
| 79 | --> $DIR/attr-on-mac-call.rs:30:5 | |
| 87 | --> $DIR/attr-on-mac-call.rs:31:5 | |
| 80 | 88 | | |
| 81 | 89 | LL | #[link_section = "__TEXT,__text"] |
| 82 | 90 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -85,7 +93,7 @@ LL | #[link_section = "__TEXT,__text"] |
| 85 | 93 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 86 | 94 | |
| 87 | 95 | warning: `#[link_ordinal]` attribute cannot be used on macro calls |
| 88 | --> $DIR/attr-on-mac-call.rs:33:5 | |
| 96 | --> $DIR/attr-on-mac-call.rs:34:5 | |
| 89 | 97 | | |
| 90 | 98 | LL | #[link_ordinal(42)] |
| 91 | 99 | | ^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -94,7 +102,7 @@ LL | #[link_ordinal(42)] |
| 94 | 102 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 95 | 103 | |
| 96 | 104 | warning: `#[non_exhaustive]` attribute cannot be used on macro calls |
| 97 | --> $DIR/attr-on-mac-call.rs:36:5 | |
| 105 | --> $DIR/attr-on-mac-call.rs:37:5 | |
| 98 | 106 | | |
| 99 | 107 | LL | #[non_exhaustive] |
| 100 | 108 | | ^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -103,7 +111,7 @@ LL | #[non_exhaustive] |
| 103 | 111 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 104 | 112 | |
| 105 | 113 | warning: `#[proc_macro]` attribute cannot be used on macro calls |
| 106 | --> $DIR/attr-on-mac-call.rs:39:5 | |
| 114 | --> $DIR/attr-on-mac-call.rs:40:5 | |
| 107 | 115 | | |
| 108 | 116 | LL | #[proc_macro] |
| 109 | 117 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -112,7 +120,7 @@ LL | #[proc_macro] |
| 112 | 120 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 113 | 121 | |
| 114 | 122 | warning: `#[cold]` attribute cannot be used on macro calls |
| 115 | --> $DIR/attr-on-mac-call.rs:42:5 | |
| 123 | --> $DIR/attr-on-mac-call.rs:43:5 | |
| 116 | 124 | | |
| 117 | 125 | LL | #[cold] |
| 118 | 126 | | ^^^^^^^ |
| ... | ... | @@ -121,7 +129,7 @@ LL | #[cold] |
| 121 | 129 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 122 | 130 | |
| 123 | 131 | warning: `#[no_mangle]` attribute cannot be used on macro calls |
| 124 | --> $DIR/attr-on-mac-call.rs:45:5 | |
| 132 | --> $DIR/attr-on-mac-call.rs:46:5 | |
| 125 | 133 | | |
| 126 | 134 | LL | #[no_mangle] |
| 127 | 135 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -130,7 +138,7 @@ LL | #[no_mangle] |
| 130 | 138 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 131 | 139 | |
| 132 | 140 | warning: `#[deprecated]` attribute cannot be used on macro calls |
| 133 | --> $DIR/attr-on-mac-call.rs:48:5 | |
| 141 | --> $DIR/attr-on-mac-call.rs:49:5 | |
| 134 | 142 | | |
| 135 | 143 | LL | #[deprecated] |
| 136 | 144 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -139,7 +147,7 @@ LL | #[deprecated] |
| 139 | 147 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 140 | 148 | |
| 141 | 149 | warning: `#[automatically_derived]` attribute cannot be used on macro calls |
| 142 | --> $DIR/attr-on-mac-call.rs:51:5 | |
| 150 | --> $DIR/attr-on-mac-call.rs:52:5 | |
| 143 | 151 | | |
| 144 | 152 | LL | #[automatically_derived] |
| 145 | 153 | | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -148,7 +156,7 @@ LL | #[automatically_derived] |
| 148 | 156 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 149 | 157 | |
| 150 | 158 | warning: `#[macro_use]` attribute cannot be used on macro calls |
| 151 | --> $DIR/attr-on-mac-call.rs:54:5 | |
| 159 | --> $DIR/attr-on-mac-call.rs:55:5 | |
| 152 | 160 | | |
| 153 | 161 | LL | #[macro_use] |
| 154 | 162 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -157,7 +165,7 @@ LL | #[macro_use] |
| 157 | 165 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 158 | 166 | |
| 159 | 167 | warning: `#[must_use]` attribute cannot be used on macro calls |
| 160 | --> $DIR/attr-on-mac-call.rs:57:5 | |
| 168 | --> $DIR/attr-on-mac-call.rs:58:5 | |
| 161 | 169 | | |
| 162 | 170 | LL | #[must_use] |
| 163 | 171 | | ^^^^^^^^^^^ |
| ... | ... | @@ -166,7 +174,7 @@ LL | #[must_use] |
| 166 | 174 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 167 | 175 | |
| 168 | 176 | warning: `#[no_implicit_prelude]` attribute cannot be used on macro calls |
| 169 | --> $DIR/attr-on-mac-call.rs:60:5 | |
| 177 | --> $DIR/attr-on-mac-call.rs:61:5 | |
| 170 | 178 | | |
| 171 | 179 | LL | #[no_implicit_prelude] |
| 172 | 180 | | ^^^^^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -175,7 +183,7 @@ LL | #[no_implicit_prelude] |
| 175 | 183 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 176 | 184 | |
| 177 | 185 | warning: `#[path]` attribute cannot be used on macro calls |
| 178 | --> $DIR/attr-on-mac-call.rs:63:5 | |
| 186 | --> $DIR/attr-on-mac-call.rs:64:5 | |
| 179 | 187 | | |
| 180 | 188 | LL | #[path = ""] |
| 181 | 189 | | ^^^^^^^^^^^^ |
| ... | ... | @@ -184,7 +192,7 @@ LL | #[path = ""] |
| 184 | 192 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 185 | 193 | |
| 186 | 194 | warning: `#[ignore]` attribute cannot be used on macro calls |
| 187 | --> $DIR/attr-on-mac-call.rs:66:5 | |
| 195 | --> $DIR/attr-on-mac-call.rs:67:5 | |
| 188 | 196 | | |
| 189 | 197 | LL | #[ignore] |
| 190 | 198 | | ^^^^^^^^^ |
| ... | ... | @@ -193,7 +201,7 @@ LL | #[ignore] |
| 193 | 201 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 194 | 202 | |
| 195 | 203 | warning: `#[should_panic]` attribute cannot be used on macro calls |
| 196 | --> $DIR/attr-on-mac-call.rs:69:5 | |
| 204 | --> $DIR/attr-on-mac-call.rs:70:5 | |
| 197 | 205 | | |
| 198 | 206 | LL | #[should_panic] |
| 199 | 207 | | ^^^^^^^^^^^^^^^ |
| ... | ... | @@ -202,7 +210,7 @@ LL | #[should_panic] |
| 202 | 210 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 203 | 211 | |
| 204 | 212 | warning: `#[link_name]` attribute cannot be used on macro calls |
| 205 | --> $DIR/attr-on-mac-call.rs:72:5 | |
| 213 | --> $DIR/attr-on-mac-call.rs:73:5 | |
| 206 | 214 | | |
| 207 | 215 | LL | #[link_name = "x"] |
| 208 | 216 | | ^^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -211,7 +219,7 @@ LL | #[link_name = "x"] |
| 211 | 219 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 212 | 220 | |
| 213 | 221 | warning: `#[repr()]` attribute cannot be used on macro calls |
| 214 | --> $DIR/attr-on-mac-call.rs:77:5 | |
| 222 | --> $DIR/attr-on-mac-call.rs:80:5 | |
| 215 | 223 | | |
| 216 | 224 | LL | #[repr()] |
| 217 | 225 | | ^^^^^^^^^ |
| ... | ... | @@ -220,7 +228,7 @@ LL | #[repr()] |
| 220 | 228 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 221 | 229 | |
| 222 | 230 | warning: unused attribute |
| 223 | --> $DIR/attr-on-mac-call.rs:77:5 | |
| 231 | --> $DIR/attr-on-mac-call.rs:80:5 | |
| 224 | 232 | | |
| 225 | 233 | LL | #[repr()] |
| 226 | 234 | | ^^^^^^^^^ help: remove this attribute |
| ... | ... | @@ -228,7 +236,7 @@ LL | #[repr()] |
| 228 | 236 | = note: using `repr` with an empty list has no effect |
| 229 | 237 | |
| 230 | 238 | warning: `#[repr(u8)]` attribute cannot be used on macro calls |
| 231 | --> $DIR/attr-on-mac-call.rs:82:5 | |
| 239 | --> $DIR/attr-on-mac-call.rs:85:5 | |
| 232 | 240 | | |
| 233 | 241 | LL | #[repr(u8)] |
| 234 | 242 | | ^^^^^^^^^^^ |
| ... | ... | @@ -237,7 +245,7 @@ LL | #[repr(u8)] |
| 237 | 245 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 238 | 246 | |
| 239 | 247 | warning: `#[repr(align(...))]` attribute cannot be used on macro calls |
| 240 | --> $DIR/attr-on-mac-call.rs:86:5 | |
| 248 | --> $DIR/attr-on-mac-call.rs:89:5 | |
| 241 | 249 | | |
| 242 | 250 | LL | #[repr(align(8))] |
| 243 | 251 | | ^^^^^^^^^^^^^^^^^ |
| ... | ... | @@ -246,7 +254,7 @@ LL | #[repr(align(8))] |
| 246 | 254 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 247 | 255 | |
| 248 | 256 | warning: `#[repr(packed)]` attribute cannot be used on macro calls |
| 249 | --> $DIR/attr-on-mac-call.rs:90:5 | |
| 257 | --> $DIR/attr-on-mac-call.rs:93:5 | |
| 250 | 258 | | |
| 251 | 259 | LL | #[repr(packed)] |
| 252 | 260 | | ^^^^^^^^^^^^^^^ |
| ... | ... | @@ -255,7 +263,7 @@ LL | #[repr(packed)] |
| 255 | 263 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 256 | 264 | |
| 257 | 265 | warning: `#[repr(C)]` attribute cannot be used on macro calls |
| 258 | --> $DIR/attr-on-mac-call.rs:94:5 | |
| 266 | --> $DIR/attr-on-mac-call.rs:97:5 | |
| 259 | 267 | | |
| 260 | 268 | LL | #[repr(C)] |
| 261 | 269 | | ^^^^^^^^^^ |
| ... | ... | @@ -264,7 +272,7 @@ LL | #[repr(C)] |
| 264 | 272 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 265 | 273 | |
| 266 | 274 | warning: `#[repr(Rust)]` attribute cannot be used on macro calls |
| 267 | --> $DIR/attr-on-mac-call.rs:98:5 | |
| 275 | --> $DIR/attr-on-mac-call.rs:101:5 | |
| 268 | 276 | | |
| 269 | 277 | LL | #[repr(Rust)] |
| 270 | 278 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -273,7 +281,7 @@ LL | #[repr(Rust)] |
| 273 | 281 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 274 | 282 | |
| 275 | 283 | warning: `#[repr(simd)]` attribute cannot be used on macro calls |
| 276 | --> $DIR/attr-on-mac-call.rs:102:5 | |
| 284 | --> $DIR/attr-on-mac-call.rs:105:5 | |
| 277 | 285 | | |
| 278 | 286 | LL | #[repr(simd)] |
| 279 | 287 | | ^^^^^^^^^^^^^ |
| ... | ... | @@ -281,5 +289,5 @@ LL | #[repr(simd)] |
| 281 | 289 | = help: `#[repr(simd)]` can only be applied to structs |
| 282 | 290 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 283 | 291 | |
| 284 | warning: 31 warnings emitted | |
| 292 | error: aborting due to 1 previous error; 31 warnings emitted | |
| 285 | 293 |
tests/ui/attributes/codegen_attr_on_required_trait_method.stderr+3-3| ... | ... | @@ -4,7 +4,7 @@ error: `#[cold]` attribute cannot be used on required trait methods |
| 4 | 4 | LL | #[cold] |
| 5 | 5 | | ^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: `#[cold]` can be applied to closures, foreign functions, functions, inherent methods, provided trait methods, and trait methods in impl blocks | |
| 7 | = help: `#[cold]` can be applied to foreign functions and functions with a body | |
| 8 | 8 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 9 | 9 | note: the lint level is defined here |
| 10 | 10 | --> $DIR/codegen_attr_on_required_trait_method.rs:1:9 |
| ... | ... | @@ -18,7 +18,7 @@ error: `#[link_section]` attribute cannot be used on required trait methods |
| 18 | 18 | LL | #[link_section = "__TEXT,__text"] |
| 19 | 19 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 20 | 20 | | |
| 21 | = help: `#[link_section]` can be applied to functions, inherent methods, provided trait methods, statics, and trait methods in impl blocks | |
| 21 | = help: `#[link_section]` can be applied to functions with a body and statics | |
| 22 | 22 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 23 | 23 | |
| 24 | 24 | error: `#[linkage]` attribute cannot be used on required trait methods |
| ... | ... | @@ -27,7 +27,7 @@ error: `#[linkage]` attribute cannot be used on required trait methods |
| 27 | 27 | LL | #[linkage = "common"] |
| 28 | 28 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 29 | 29 | | |
| 30 | = help: `#[linkage]` can be applied to foreign functions, foreign statics, functions, inherent methods, provided trait methods, statics, and trait methods in impl blocks | |
| 30 | = help: `#[linkage]` can be applied to foreign functions, foreign statics, functions with a body, and statics | |
| 31 | 31 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 32 | 32 | |
| 33 | 33 | error: aborting due to 3 previous errors |
tests/ui/coverage-attr/allowed-positions.stderr+3-3| ... | ... | @@ -46,7 +46,7 @@ error: `#[coverage]` attribute cannot be used on required trait methods |
| 46 | 46 | LL | #[coverage(off)] |
| 47 | 47 | | ^^^^^^^^^^^^^^^^ |
| 48 | 48 | | |
| 49 | = help: `#[coverage]` can be applied to closures, crates, functions, impl blocks, inherent methods, modules, provided trait methods, and trait methods in impl blocks | |
| 49 | = help: `#[coverage]` can be applied to crates, functions with a body, impl blocks, and modules | |
| 50 | 50 | |
| 51 | 51 | error: `#[coverage]` attribute cannot be used on required trait methods |
| 52 | 52 | --> $DIR/allowed-positions.rs:31:5 |
| ... | ... | @@ -54,7 +54,7 @@ error: `#[coverage]` attribute cannot be used on required trait methods |
| 54 | 54 | LL | #[coverage(off)] |
| 55 | 55 | | ^^^^^^^^^^^^^^^^ |
| 56 | 56 | | |
| 57 | = help: `#[coverage]` can be applied to closures, crates, functions, impl blocks, inherent methods, modules, provided trait methods, and trait methods in impl blocks | |
| 57 | = help: `#[coverage]` can be applied to crates, functions with a body, impl blocks, and modules | |
| 58 | 58 | |
| 59 | 59 | error: `#[coverage]` attribute cannot be used on associated types |
| 60 | 60 | --> $DIR/allowed-positions.rs:39:5 |
| ... | ... | @@ -110,7 +110,7 @@ error: `#[coverage]` attribute cannot be used on foreign functions |
| 110 | 110 | LL | #[coverage(off)] |
| 111 | 111 | | ^^^^^^^^^^^^^^^^ |
| 112 | 112 | | |
| 113 | = help: `#[coverage]` can be applied to closures, crates, functions, impl blocks, methods, and modules | |
| 113 | = help: `#[coverage]` can be applied to crates, functions with a body, impl blocks, and modules | |
| 114 | 114 | |
| 115 | 115 | error: `#[coverage]` attribute cannot be used on statements |
| 116 | 116 | --> $DIR/allowed-positions.rs:88:5 |
tests/ui/derives/coercepointee/auxiliary/another-proc-macro.rs-3| ... | ... | @@ -11,7 +11,6 @@ pub fn derive(_input: TokenStream) -> TokenStream { |
| 11 | 11 | const ANOTHER_MACRO_DERIVED: () = (); |
| 12 | 12 | }; |
| 13 | 13 | } |
| 14 | .into() | |
| 15 | 14 | } |
| 16 | 15 | |
| 17 | 16 | #[proc_macro_attribute] |
| ... | ... | @@ -24,7 +23,6 @@ pub fn pointee( |
| 24 | 23 | const POINTEE_MACRO_ATTR_DERIVED: () = (); |
| 25 | 24 | }; |
| 26 | 25 | } |
| 27 | .into() | |
| 28 | 26 | } |
| 29 | 27 | |
| 30 | 28 | #[proc_macro_attribute] |
| ... | ... | @@ -37,5 +35,4 @@ pub fn default( |
| 37 | 35 | const DEFAULT_MACRO_ATTR_DERIVED: () = (); |
| 38 | 36 | }; |
| 39 | 37 | } |
| 40 | .into() | |
| 41 | 38 | } |
tests/ui/extern/extern-no-mangle.stderr+1-1| ... | ... | @@ -18,7 +18,7 @@ warning: `#[no_mangle]` attribute cannot be used on foreign functions |
| 18 | 18 | LL | #[no_mangle] |
| 19 | 19 | | ^^^^^^^^^^^^ |
| 20 | 20 | | |
| 21 | = help: `#[no_mangle]` can be applied to functions, methods, and statics | |
| 21 | = help: `#[no_mangle]` can be applied to functions with a body and statics | |
| 22 | 22 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 23 | 23 | |
| 24 | 24 | warning: `#[no_mangle]` attribute cannot be used on statements |
tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr+1-1| ... | ... | @@ -206,7 +206,7 @@ error: `#[export_name]` attribute cannot be used on required trait methods |
| 206 | 206 | LL | #[export_name = "2200"] fn foo(); |
| 207 | 207 | | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 208 | 208 | | |
| 209 | = help: `#[export_name]` can be applied to functions, inherent methods, provided trait methods, statics, and trait methods in impl blocks | |
| 209 | = help: `#[export_name]` can be applied to functions with a body and statics | |
| 210 | 210 | |
| 211 | 211 | error: `#[repr(C)]` attribute cannot be used on modules |
| 212 | 212 | --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:121:1 |
tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr+2-2| ... | ... | @@ -447,7 +447,7 @@ warning: `#[no_mangle]` attribute cannot be used on required trait methods |
| 447 | 447 | LL | #[no_mangle] fn foo(); |
| 448 | 448 | | ^^^^^^^^^^^^ |
| 449 | 449 | | |
| 450 | = help: `#[no_mangle]` can be applied to functions, inherent methods, statics, and trait methods in impl blocks | |
| 450 | = help: `#[no_mangle]` can be applied to functions with a body and statics | |
| 451 | 451 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 452 | 452 | |
| 453 | 453 | warning: `#[no_mangle]` attribute cannot be used on provided trait methods |
| ... | ... | @@ -859,7 +859,7 @@ warning: `#[link_section]` attribute cannot be used on required trait methods |
| 859 | 859 | LL | #[link_section = ",1800"] |
| 860 | 860 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 861 | 861 | | |
| 862 | = help: `#[link_section]` can be applied to functions, inherent methods, provided trait methods, statics, and trait methods in impl blocks | |
| 862 | = help: `#[link_section]` can be applied to functions with a body and statics | |
| 863 | 863 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 864 | 864 | |
| 865 | 865 | warning: `#[link]` attribute cannot be used on modules |
tests/ui/force-inlining/invalid.stderr+1-1| ... | ... | @@ -134,7 +134,7 @@ error: `#[rustc_force_inline]` attribute cannot be used on foreign functions |
| 134 | 134 | LL | #[rustc_force_inline] |
| 135 | 135 | | ^^^^^^^^^^^^^^^^^^^^^ |
| 136 | 136 | | |
| 137 | = help: `#[rustc_force_inline]` can be applied to functions and inherent methods | |
| 137 | = help: `#[rustc_force_inline]` can only be applied to functions with a body | |
| 138 | 138 | |
| 139 | 139 | error: `#[rustc_force_inline]` attribute cannot be used on type aliases |
| 140 | 140 | --> $DIR/invalid.rs:66:1 |
tests/ui/lint/warn-unused-inline-on-fn-prototypes.stderr+2-2| ... | ... | @@ -4,7 +4,7 @@ error: `#[inline]` attribute cannot be used on required trait methods |
| 4 | 4 | LL | #[inline] |
| 5 | 5 | | ^^^^^^^^^ |
| 6 | 6 | | |
| 7 | = help: `#[inline]` can be applied to closures, functions, inherent methods, provided trait methods, and trait methods in impl blocks | |
| 7 | = help: `#[inline]` can only be applied to functions with a body | |
| 8 | 8 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 9 | 9 | note: the lint level is defined here |
| 10 | 10 | --> $DIR/warn-unused-inline-on-fn-prototypes.rs:1:9 |
| ... | ... | @@ -18,7 +18,7 @@ error: `#[inline]` attribute cannot be used on foreign functions |
| 18 | 18 | LL | #[inline] |
| 19 | 19 | | ^^^^^^^^^ |
| 20 | 20 | | |
| 21 | = help: `#[inline]` can be applied to closures, functions, and methods | |
| 21 | = help: `#[inline]` can only be applied to functions with a body | |
| 22 | 22 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 23 | 23 | |
| 24 | 24 | error: aborting due to 2 previous errors |
tests/ui/privacy/sealed-traits/auxiliary/private-trait-non-local-aux.rs created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | pub mod a { | |
| 2 | mod b { | |
| 3 | pub trait Sealed {} | |
| 4 | } | |
| 5 | } |
tests/ui/privacy/sealed-traits/private-trait-non-local.rs+6-4| ... | ... | @@ -1,4 +1,6 @@ |
| 1 | extern crate core; | |
| 2 | use core::slice::index::private_slice_index::Sealed; //~ ERROR module `index` is private | |
| 3 | fn main() { | |
| 4 | } | |
| 1 | //@ aux-build: private-trait-non-local-aux.rs | |
| 2 | ||
| 3 | extern crate private_trait_non_local_aux as aux; | |
| 4 | use aux::a::b::Sealed; //~ ERROR module `b` is private | |
| 5 | ||
| 6 | fn main() {} |
tests/ui/privacy/sealed-traits/private-trait-non-local.stderr+11-6| ... | ... | @@ -1,11 +1,16 @@ |
| 1 | error[E0603]: module `index` is private | |
| 2 | --> $DIR/private-trait-non-local.rs:2:18 | |
| 1 | error[E0603]: module `b` is private | |
| 2 | --> $DIR/private-trait-non-local.rs:4:13 | |
| 3 | 3 | | |
| 4 | LL | use core::slice::index::private_slice_index::Sealed; | |
| 5 | | ^^^^^ private module ------ trait `Sealed` is not publicly re-exported | |
| 4 | LL | use aux::a::b::Sealed; | |
| 5 | | ^ ------ trait `Sealed` is not publicly re-exported | |
| 6 | | | | |
| 7 | | private module | |
| 6 | 8 | | |
| 7 | note: the module `index` is defined here | |
| 8 | --> $SRC_DIR/core/src/slice/mod.rs:LL:COL | |
| 9 | note: the module `b` is defined here | |
| 10 | --> $DIR/auxiliary/private-trait-non-local-aux.rs:2:5 | |
| 11 | | | |
| 12 | LL | mod b { | |
| 13 | | ^^^^^ | |
| 9 | 14 | |
| 10 | 15 | error: aborting due to 1 previous error |
| 11 | 16 |
tests/ui/process/process-panic-after-fork.rs+1-1| ... | ... | @@ -142,7 +142,7 @@ fn main() { |
| 142 | 142 | let mut status: c_int = 0; |
| 143 | 143 | let got = unsafe { libc::waitpid(child, &mut status, 0) }; |
| 144 | 144 | assert_eq!(got, child); |
| 145 | let status = ExitStatus::from_raw(status.into()); | |
| 145 | let status = ExitStatus::from_raw(status); | |
| 146 | 146 | status |
| 147 | 147 | } |
| 148 | 148 |
tests/ui/resolve/proc_macro_generated_packed.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //! This test ICEs because the `repr(packed)` attribute |
| 2 | 2 | //! was generated by a proc macro, so `#[derive]` didn't see it. |
| 3 | //@ ignore-parallel-frontend failed to collect active jobs | |
| 3 | ||
| 4 | 4 | //@proc-macro: proc_macro_generate_packed.rs |
| 5 | 5 | //@known-bug: #120873 |
| 6 | 6 | //@ failure-status: 101 |
tests/ui/sanitize-attr/valid-sanitize.rs+18-18| ... | ... | @@ -12,27 +12,27 @@ mod submod {} |
| 12 | 12 | #[sanitize(address = "off")] |
| 13 | 13 | static FOO: u32 = 0; |
| 14 | 14 | |
| 15 | #[sanitize(thread = "off")] //~ ERROR sanitize attribute not allowed here | |
| 15 | #[sanitize(thread = "off")] //~ ERROR attribute cannot be used on | |
| 16 | 16 | static BAR: u32 = 0; |
| 17 | 17 | |
| 18 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 18 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 19 | 19 | type MyTypeAlias = (); |
| 20 | 20 | |
| 21 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 21 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 22 | 22 | trait MyTrait { |
| 23 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 23 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 24 | 24 | const TRAIT_ASSOC_CONST: u32; |
| 25 | 25 | |
| 26 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 26 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 27 | 27 | type TraitAssocType; |
| 28 | 28 | |
| 29 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 29 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 30 | 30 | fn trait_method(&self); |
| 31 | 31 | |
| 32 | 32 | #[sanitize(address = "off", thread = "on")] |
| 33 | 33 | fn trait_method_with_default(&self) {} |
| 34 | 34 | |
| 35 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 35 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 36 | 36 | fn trait_assoc_fn(); |
| 37 | 37 | } |
| 38 | 38 | |
| ... | ... | @@ -40,7 +40,7 @@ trait MyTrait { |
| 40 | 40 | impl MyTrait for () { |
| 41 | 41 | const TRAIT_ASSOC_CONST: u32 = 0; |
| 42 | 42 | |
| 43 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 43 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 44 | 44 | type TraitAssocType = Self; |
| 45 | 45 | |
| 46 | 46 | #[sanitize(address = "off", thread = "on")] |
| ... | ... | @@ -57,14 +57,14 @@ trait HasAssocType { |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | impl HasAssocType for () { |
| 60 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 60 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 61 | 61 | type T = impl Copy; |
| 62 | 62 | fn constrain_assoc_type() -> Self::T {} |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 65 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 66 | 66 | struct MyStruct { |
| 67 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 67 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 68 | 68 | field: u32, |
| 69 | 69 | } |
| 70 | 70 | |
| ... | ... | @@ -77,25 +77,25 @@ impl MyStruct { |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | extern "C" { |
| 80 | #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here | |
| 80 | #[sanitize(address = "off", thread = "on")] //~ ERROR attribute cannot be used on | |
| 81 | 81 | static X: u32; |
| 82 | 82 | |
| 83 | #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here | |
| 83 | #[sanitize(address = "off", thread = "on")] //~ ERROR attribute cannot be used on | |
| 84 | 84 | type T; |
| 85 | 85 | |
| 86 | #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here | |
| 86 | #[sanitize(address = "off", thread = "on")] //~ ERROR attribute cannot be used on | |
| 87 | 87 | fn foreign_fn(); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | #[sanitize(address = "off", thread = "on")] |
| 91 | 91 | fn main() { |
| 92 | #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here | |
| 92 | #[sanitize(address = "off", thread = "on")] //~ ERROR attribute cannot be used on | |
| 93 | 93 | let _ = (); |
| 94 | 94 | |
| 95 | 95 | // Currently not allowed on let statements, even if they bind to a closure. |
| 96 | 96 | // It might be nice to support this as a special case someday, but trying |
| 97 | 97 | // to define the precise boundaries of that special case might be tricky. |
| 98 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 98 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 99 | 99 | let _let_closure = || (); |
| 100 | 100 | |
| 101 | 101 | // In situations where attributes can already be applied to expressions, |
| ... | ... | @@ -106,10 +106,10 @@ fn main() { |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | 108 | match () { |
| 109 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 109 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 110 | 110 | () => (), |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here | |
| 113 | #[sanitize(address = "off")] //~ ERROR attribute cannot be used on | |
| 114 | 114 | return (); |
| 115 | 115 | } |
tests/ui/sanitize-attr/valid-sanitize.stderr+72-116| ... | ... | @@ -1,190 +1,146 @@ |
| 1 | error: sanitize attribute not allowed here | |
| 1 | error: `#[sanitize(thread = ...)]` attribute cannot be used on statics | |
| 2 | 2 | --> $DIR/valid-sanitize.rs:15:1 |
| 3 | 3 | | |
| 4 | 4 | LL | #[sanitize(thread = "off")] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | LL | static BAR: u32 = 0; | |
| 7 | | -------------------- not a function, impl block, or module | |
| 8 | 6 | | |
| 9 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 7 | = help: `#[sanitize]` can be used on statics if only the address is sanitized | |
| 10 | 8 | |
| 11 | error: sanitize attribute not allowed here | |
| 9 | error: `#[sanitize]` attribute cannot be used on type aliases | |
| 12 | 10 | --> $DIR/valid-sanitize.rs:18:1 |
| 13 | 11 | | |
| 14 | 12 | LL | #[sanitize(address = "off")] |
| 15 | 13 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 16 | LL | type MyTypeAlias = (); | |
| 17 | | ---------------------- not a function, impl block, or module | |
| 18 | 14 | | |
| 19 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 15 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 20 | 16 | |
| 21 | error: sanitize attribute not allowed here | |
| 17 | error: `#[sanitize]` attribute cannot be used on traits | |
| 22 | 18 | --> $DIR/valid-sanitize.rs:21:1 |
| 23 | 19 | | |
| 24 | LL | #[sanitize(address = "off")] | |
| 25 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 26 | LL | / trait MyTrait { | |
| 27 | LL | | #[sanitize(address = "off")] | |
| 28 | LL | | const TRAIT_ASSOC_CONST: u32; | |
| 29 | ... | | |
| 30 | LL | | fn trait_assoc_fn(); | |
| 31 | LL | | } | |
| 32 | | |_- not a function, impl block, or module | |
| 33 | | | |
| 34 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 35 | ||
| 36 | error: sanitize attribute not allowed here | |
| 37 | --> $DIR/valid-sanitize.rs:65:1 | |
| 38 | | | |
| 39 | LL | #[sanitize(address = "off")] | |
| 40 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 41 | LL | / struct MyStruct { | |
| 42 | LL | | #[sanitize(address = "off")] | |
| 43 | LL | | field: u32, | |
| 44 | LL | | } | |
| 45 | | |_- not a function, impl block, or module | |
| 46 | | | |
| 47 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 48 | ||
| 49 | error: sanitize attribute not allowed here | |
| 50 | --> $DIR/valid-sanitize.rs:67:5 | |
| 51 | | | |
| 52 | LL | #[sanitize(address = "off")] | |
| 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 54 | LL | field: u32, | |
| 55 | | ---------- not a function, impl block, or module | |
| 56 | | | |
| 57 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 58 | ||
| 59 | error: sanitize attribute not allowed here | |
| 60 | --> $DIR/valid-sanitize.rs:92:5 | |
| 61 | | | |
| 62 | LL | #[sanitize(address = "off", thread = "on")] | |
| 63 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 64 | LL | let _ = (); | |
| 65 | | ----------- not a function, impl block, or module | |
| 20 | LL | #[sanitize(address = "off")] | |
| 21 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 66 | 22 | | |
| 67 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 23 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 68 | 24 | |
| 69 | error: sanitize attribute not allowed here | |
| 70 | --> $DIR/valid-sanitize.rs:98:5 | |
| 25 | error: `#[sanitize]` attribute cannot be used on associated consts | |
| 26 | --> $DIR/valid-sanitize.rs:23:5 | |
| 71 | 27 | | |
| 72 | 28 | LL | #[sanitize(address = "off")] |
| 73 | 29 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 74 | LL | let _let_closure = || (); | |
| 75 | | ------------------------- not a function, impl block, or module | |
| 76 | | | |
| 77 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 78 | ||
| 79 | error: sanitize attribute not allowed here | |
| 80 | --> $DIR/valid-sanitize.rs:109:9 | |
| 81 | | | |
| 82 | LL | #[sanitize(address = "off")] | |
| 83 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 84 | LL | () => (), | |
| 85 | | -------- not a function, impl block, or module | |
| 86 | 30 | | |
| 87 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 31 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 88 | 32 | |
| 89 | error: sanitize attribute not allowed here | |
| 90 | --> $DIR/valid-sanitize.rs:113:5 | |
| 33 | error: `#[sanitize]` attribute cannot be used on associated types | |
| 34 | --> $DIR/valid-sanitize.rs:26:5 | |
| 91 | 35 | | |
| 92 | 36 | LL | #[sanitize(address = "off")] |
| 93 | 37 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 94 | LL | return (); | |
| 95 | | --------- not a function, impl block, or module | |
| 96 | 38 | | |
| 97 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 39 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 98 | 40 | |
| 99 | error: sanitize attribute not allowed here | |
| 100 | --> $DIR/valid-sanitize.rs:23:5 | |
| 41 | error: `#[sanitize]` attribute cannot be used on required trait methods | |
| 42 | --> $DIR/valid-sanitize.rs:29:5 | |
| 101 | 43 | | |
| 102 | 44 | LL | #[sanitize(address = "off")] |
| 103 | 45 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 104 | LL | const TRAIT_ASSOC_CONST: u32; | |
| 105 | | ----------------------------- not a function, impl block, or module | |
| 106 | 46 | | |
| 107 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 47 | = help: `#[sanitize]` can be applied to crates, functions with a body, impl blocks, modules, and statics | |
| 108 | 48 | |
| 109 | error: sanitize attribute not allowed here | |
| 110 | --> $DIR/valid-sanitize.rs:26:5 | |
| 49 | error: `#[sanitize]` attribute cannot be used on required trait methods | |
| 50 | --> $DIR/valid-sanitize.rs:35:5 | |
| 111 | 51 | | |
| 112 | 52 | LL | #[sanitize(address = "off")] |
| 113 | 53 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 114 | LL | type TraitAssocType; | |
| 115 | | -------------------- not a function, impl block, or module | |
| 116 | 54 | | |
| 117 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 55 | = help: `#[sanitize]` can be applied to crates, functions with a body, impl blocks, modules, and statics | |
| 118 | 56 | |
| 119 | error: sanitize attribute not allowed here | |
| 120 | --> $DIR/valid-sanitize.rs:29:5 | |
| 57 | error: `#[sanitize]` attribute cannot be used on associated types | |
| 58 | --> $DIR/valid-sanitize.rs:43:5 | |
| 121 | 59 | | |
| 122 | 60 | LL | #[sanitize(address = "off")] |
| 123 | 61 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 124 | LL | fn trait_method(&self); | |
| 125 | | ----------------------- function has no body | |
| 126 | 62 | | |
| 127 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 63 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 128 | 64 | |
| 129 | error: sanitize attribute not allowed here | |
| 130 | --> $DIR/valid-sanitize.rs:35:5 | |
| 65 | error: `#[sanitize]` attribute cannot be used on associated types | |
| 66 | --> $DIR/valid-sanitize.rs:60:5 | |
| 131 | 67 | | |
| 132 | 68 | LL | #[sanitize(address = "off")] |
| 133 | 69 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 134 | LL | fn trait_assoc_fn(); | |
| 135 | | -------------------- function has no body | |
| 136 | 70 | | |
| 137 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 71 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 138 | 72 | |
| 139 | error: sanitize attribute not allowed here | |
| 140 | --> $DIR/valid-sanitize.rs:43:5 | |
| 73 | error: `#[sanitize]` attribute cannot be used on structs | |
| 74 | --> $DIR/valid-sanitize.rs:65:1 | |
| 141 | 75 | | |
| 142 | LL | #[sanitize(address = "off")] | |
| 143 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 144 | LL | type TraitAssocType = Self; | |
| 145 | | --------------------------- not a function, impl block, or module | |
| 76 | LL | #[sanitize(address = "off")] | |
| 77 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 146 | 78 | | |
| 147 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 79 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 148 | 80 | |
| 149 | error: sanitize attribute not allowed here | |
| 150 | --> $DIR/valid-sanitize.rs:60:5 | |
| 81 | error: `#[sanitize]` attribute cannot be used on struct fields | |
| 82 | --> $DIR/valid-sanitize.rs:67:5 | |
| 151 | 83 | | |
| 152 | 84 | LL | #[sanitize(address = "off")] |
| 153 | 85 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 154 | LL | type T = impl Copy; | |
| 155 | | ------------------- not a function, impl block, or module | |
| 156 | 86 | | |
| 157 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 87 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 158 | 88 | |
| 159 | error: sanitize attribute not allowed here | |
| 89 | error: `#[sanitize]` attribute cannot be used on foreign statics | |
| 160 | 90 | --> $DIR/valid-sanitize.rs:80:5 |
| 161 | 91 | | |
| 162 | 92 | LL | #[sanitize(address = "off", thread = "on")] |
| 163 | 93 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 164 | LL | static X: u32; | |
| 165 | | -------------- not a function, impl block, or module | |
| 166 | 94 | | |
| 167 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 95 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 168 | 96 | |
| 169 | error: sanitize attribute not allowed here | |
| 97 | error: `#[sanitize]` attribute cannot be used on foreign types | |
| 170 | 98 | --> $DIR/valid-sanitize.rs:83:5 |
| 171 | 99 | | |
| 172 | 100 | LL | #[sanitize(address = "off", thread = "on")] |
| 173 | 101 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 174 | LL | type T; | |
| 175 | | ------- not a function, impl block, or module | |
| 176 | 102 | | |
| 177 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 103 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 178 | 104 | |
| 179 | error: sanitize attribute not allowed here | |
| 105 | error: `#[sanitize]` attribute cannot be used on foreign functions | |
| 180 | 106 | --> $DIR/valid-sanitize.rs:86:5 |
| 181 | 107 | | |
| 182 | 108 | LL | #[sanitize(address = "off", thread = "on")] |
| 183 | 109 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 184 | LL | fn foreign_fn(); | |
| 185 | | ---------------- function has no body | |
| 186 | 110 | | |
| 187 | = help: sanitize attribute can be applied to a function (with body), impl block, or module | |
| 111 | = help: `#[sanitize]` can be applied to crates, functions with a body, impl blocks, modules, and statics | |
| 112 | ||
| 113 | error: `#[sanitize]` attribute cannot be used on statements | |
| 114 | --> $DIR/valid-sanitize.rs:92:5 | |
| 115 | | | |
| 116 | LL | #[sanitize(address = "off", thread = "on")] | |
| 117 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 118 | | | |
| 119 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 120 | ||
| 121 | error: `#[sanitize]` attribute cannot be used on statements | |
| 122 | --> $DIR/valid-sanitize.rs:98:5 | |
| 123 | | | |
| 124 | LL | #[sanitize(address = "off")] | |
| 125 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 126 | | | |
| 127 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 128 | ||
| 129 | error: `#[sanitize]` attribute cannot be used on match arms | |
| 130 | --> $DIR/valid-sanitize.rs:109:9 | |
| 131 | | | |
| 132 | LL | #[sanitize(address = "off")] | |
| 133 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 134 | | | |
| 135 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 136 | ||
| 137 | error: `#[sanitize]` attribute cannot be used on expressions | |
| 138 | --> $DIR/valid-sanitize.rs:113:5 | |
| 139 | | | |
| 140 | LL | #[sanitize(address = "off")] | |
| 141 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 142 | | | |
| 143 | = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics | |
| 188 | 144 | |
| 189 | 145 | error: aborting due to 18 previous errors |
| 190 | 146 |
triagebot.toml+1| ... | ... | @@ -1497,6 +1497,7 @@ libs = [ |
| 1497 | 1497 | "@joboet", |
| 1498 | 1498 | "@nia-e", |
| 1499 | 1499 | "@LawnGnome", |
| 1500 | "@clarfonthey", | |
| 1500 | 1501 | ] |
| 1501 | 1502 | infra-ci = [ |
| 1502 | 1503 | "@Mark-Simulacrum", |