authorbors <bors@rust-lang.org> 2026-06-03 19:50:26 UTC
committerbors <bors@rust-lang.org> 2026-06-03 19:50:26 UTC
logb354133fb126352871bea4b40795a45739adff2b
treeedeb653458ef5340d2ad52682f8c4c8321cec34e
parent9c963eecaaa5e9ef270e235a8b35f05e33b597ed
parentc4f09d540b45d7f9135fc595e7811fbab4a2849f

Auto merge of #157398 - jhpratt:rollup-qXar4uR, r=jhpratt

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> {
126126 is_in_dyn_type: bool,
127127
128128 current_hir_id_owner: hir::OwnerId,
129 owner: &'a PerOwnerResolverData,
129 owner: &'a PerOwnerResolverData<'hir>,
130130 item_local_id_counter: hir::ItemLocalId,
131131 trait_map: ItemLocalMap<&'hir [TraitCandidate<'hir>]>,
132132
......@@ -288,11 +288,6 @@ impl<'tcx> ResolverAstLowering<'tcx> {
288288 .map(|fn_indexes| fn_indexes.iter().map(|(num, _)| *num).collect())
289289 }
290290
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
296291 /// Obtain the list of lifetimes parameters to add to an item.
297292 ///
298293 /// Extra lifetime parameters should only be added in places that can appear
......@@ -810,8 +805,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
810805 self.children.push((def_id, hir::MaybeOwner::NonOwner(hir_id)));
811806 }
812807
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);
815810 }
816811
817812 // Check whether the same `NodeId` is lowered more than once.
......@@ -856,8 +851,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
856851 }
857852
858853 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)));
861856 if per_ns.is_empty() {
862857 // Propagate the error to all namespaces, just to be sure.
863858 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;
88use crate::session_diagnostics::{
99 EmptyExportName, NakedFunctionIncompatibleAttribute, NullOnExport, NullOnObjcClass,
1010 NullOnObjcSelector, ObjcClassExpectedStringLiteral, ObjcSelectorExpectedStringLiteral,
11 SanitizeInvalidStatic,
1112};
1213use crate::target_checking::Policy::AllowSilent;
1314
......@@ -566,8 +567,18 @@ pub(crate) struct SanitizeParser;
566567
567568impl SingleAttributeParser for SanitizeParser {
568569 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 ]);
571582 const TEMPLATE: AttributeTemplate = template!(List: &[
572583 r#"address = "on|off""#,
573584 r#"kernel_address = "on|off""#,
......@@ -668,6 +679,18 @@ impl SingleAttributeParser for SanitizeParser {
668679 }
669680 }
670681
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
671694 Some(AttributeKind::Sanitize { on_set, off_set, rtsan, span: cx.attr_span })
672695 }
673696}
compiler/rustc_attr_parsing/src/session_diagnostics.rs+9
......@@ -1023,3 +1023,12 @@ pub(crate) enum InvalidMachoSectionReason {
10231023 #[note("section name `{$section}` is longer than 16 bytes")]
10241024 SectionTooLong { section: String },
10251025}
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")]
1030pub(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(
361361 Target::Method(MethodKind::Trait { body: true }),
362362 Target::Method(MethodKind::TraitImpl),
363363 ];
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 ];
364371 const METHOD_LIKE: &[Target] = &[
365372 Target::Method(MethodKind::Inherent),
366373 Target::Method(MethodKind::Trait { body: false }),
......@@ -379,6 +386,13 @@ pub(crate) fn allowed_targets_applied(
379386 target,
380387 &mut added_fake_targets,
381388 );
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 );
382396 filter_targets(&mut allowed_targets, METHOD_LIKE, "methods", target, &mut added_fake_targets);
383397 filter_targets(&mut allowed_targets, IMPL_LIKE, "impl blocks", target, &mut added_fake_targets);
384398 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() {
2222fn test_parse() {
2323 macro_rules! assert_pns_eq_sub {
2424 ($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), "!")))
2626 };
2727 }
2828
compiler/rustc_const_eval/src/interpret/eval_context.rs+16-11
......@@ -165,25 +165,30 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
165165}
166166
167167/// 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.
169168pub(super) fn mir_assign_valid_types<'tcx>(
170169 tcx: TyCtxt<'tcx>,
171170 typing_env: TypingEnv<'tcx>,
172171 src: TyAndLayout<'tcx>,
173172 dest: TyAndLayout<'tcx>,
174173) -> 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.
179179 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.
185184 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 );
187192 }
188193 true
189194 } else {
compiler/rustc_const_eval/src/interpret/step.rs+2-2
......@@ -190,8 +190,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
190190 }
191191
192192 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)?)?;
195195 let result = self.unary_op(un_op, &val)?;
196196 assert_eq!(result.layout, dest.layout, "layout mismatch for result of {un_op:?}");
197197 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 {
3838 Offset | Shl | ShlUnchecked | Shr | ShrUnchecked => false,
3939 }
4040}
41
42/// Classify whether an operator is "homogeneous", i.e., the operand has the
43/// same type as the result.
44#[inline]
45pub 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 {
717717}
718718
719719/// 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)]
721722pub struct PerNS<T> {
722723 pub value_ns: T,
723724 pub type_ns: T,
compiler/rustc_infer/src/infer/canonical/query_response.rs+1-1
......@@ -286,7 +286,7 @@ impl<'tcx> InferCtxt<'tcx> {
286286 (GenericArgKind::Lifetime(v_o), GenericArgKind::Lifetime(v_r)) => {
287287 if v_o != v_r {
288288 output_query_region_constraints.constraints.push((
289 ty::RegionEqPredicate(v_o.into(), v_r).into(),
289 ty::RegionEqPredicate(v_o, v_r).into(),
290290 constraint_category,
291291 ty::VisibleForLeakCheck::Yes,
292292 ));
compiler/rustc_middle/src/mir/interpret/queries.rs+2-3
......@@ -107,13 +107,12 @@ impl<'tcx> TyCtxt<'tcx> {
107107 Ok(Some(instance)) => GlobalId { instance, promoted: None },
108108 // For errors during resolution, we deliberately do not point at the usage site of the constant,
109109 // 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)),
111111 Err(err) => {
112112 return Err(ErrorHandled::Reported(
113113 ReportedErrorInfo::non_const_eval_error(err),
114114 DUMMY_SP,
115 )
116 .into());
115 ));
117116 }
118117 };
119118
compiler/rustc_middle/src/ty/mod.rs+11-10
......@@ -27,9 +27,9 @@ pub use intrinsic::IntrinsicDef;
2727use rustc_abi::{
2828 Align, FieldIdx, Integer, IntegerType, ReprFlags, ReprOptions, ScalableElt, VariantIdx,
2929};
30use rustc_ast as ast;
3130use rustc_ast::expand::typetree::{FncTree, Kind, Type, TypeTree};
3231use rustc_ast::node_id::NodeMap;
32use rustc_ast::{self as ast};
3333pub use rustc_ast_ir::{Movability, Mutability, try_visit};
3434use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
3535use rustc_data_structures::intern::Interned;
......@@ -204,7 +204,7 @@ pub struct ResolverGlobalCtxt {
204204}
205205
206206#[derive(Debug)]
207pub struct PerOwnerResolverData {
207pub struct PerOwnerResolverData<'tcx> {
208208 pub node_id_to_def_id: NodeMap<LocalDefId> = Default::default(),
209209 /// Whether lifetime elision was successful.
210210 pub lifetime_elision_allowed: bool = false,
......@@ -214,14 +214,19 @@ pub struct PerOwnerResolverData {
214214 /// Resolutions for lifetimes.
215215 pub lifetimes_res_map: NodeMap<LifetimeRes> = Default::default(),
216216
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
217222 /// The id of the owner
218223 pub id: ast::NodeId,
219224 /// The `DefId` of the owner, can't be found in `node_id_to_def_id`.
220225 pub def_id: LocalDefId,
221226}
222227
223impl PerOwnerResolverData {
224 pub fn new(id: ast::NodeId, def_id: LocalDefId) -> PerOwnerResolverData {
228impl<'tcx> PerOwnerResolverData<'tcx> {
229 pub fn new(id: ast::NodeId, def_id: LocalDefId) -> PerOwnerResolverData<'tcx> {
225230 PerOwnerResolverData { id, def_id, .. }
226231 }
227232
......@@ -242,16 +247,12 @@ impl PerOwnerResolverData {
242247pub struct ResolverAstLowering<'tcx> {
243248 /// Resolutions for nodes that have a single resolution.
244249 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>>>>,
247250 /// Lifetime parameters that lowering will have to introduce.
248251 pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, MissingLifetimeKind)>>,
249252
250253 pub next_node_id: ast::NodeId,
251254
252 pub owners: NodeMap<PerOwnerResolverData>,
253
254 pub trait_map: NodeMap<&'tcx [hir::TraitCandidate<'tcx>]>,
255 pub owners: NodeMap<PerOwnerResolverData<'tcx>>,
255256
256257 /// Lints that were emitted by the resolver and early lints.
257258 pub lint_buffer: Steal<LintBuffer>,
......@@ -1098,7 +1099,7 @@ impl<'tcx> TypingEnv<'tcx> {
10981099 def_id: impl IntoQueryKey<DefId>,
10991100 ) -> TypingEnv<'tcx> {
11001101 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())
11021103 }
11031104
11041105 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> {
914914 block,
915915 source_info,
916916 destination,
917 Rvalue::Reborrow(target, mutability, place.into()),
917 Rvalue::Reborrow(target, mutability, place),
918918 );
919919 block.unit()
920920 }
compiler/rustc_mir_transform/src/check_null.rs+1-1
......@@ -79,7 +79,7 @@ fn insert_null_check<'tcx>(
7979 source_info,
8080 StatementKind::Assign(Box::new((pointee_should_be_checked, rvalue))),
8181 ));
82 Operand::Copy(pointee_should_be_checked.into())
82 Operand::Copy(pointee_should_be_checked)
8383 }
8484 };
8585
compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs+1-1
......@@ -389,7 +389,7 @@ where
389389 impl_def_id,
390390 impl_args,
391391 impl_trait_ref,
392 target_container_def_id.into(),
392 target_container_def_id,
393393 )?;
394394
395395 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;
1818use rustc_hir::attrs::diagnostic::Directive;
1919use rustc_hir::attrs::{
2020 AttributeKind, DocAttribute, DocInline, EiiDecl, EiiImpl, EiiImplResolution, InlineAttr,
21 ReprAttr, SanitizerSet,
21 ReprAttr,
2222};
2323use rustc_hir::def::DefKind;
2424use rustc_hir::def_id::LocalModDefId;
......@@ -227,9 +227,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
227227 }
228228 &AttributeKind::FfiPure(attr_span) => self.check_ffi_pure(attr_span, attrs),
229229 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 }
233230 AttributeKind::Link(_, attr_span) => self.check_link(hir_id, *attr_span, target),
234231 AttributeKind::MacroExport { span, .. } => {
235232 self.check_macro_export(hir_id, *span, target)
......@@ -401,6 +398,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
401398 AttributeKind::RustcThenThisWouldNeed(..) => (),
402399 AttributeKind::RustcTrivialFieldReads => (),
403400 AttributeKind::RustcUnsafeSpecializationMarker => (),
401 AttributeKind::Sanitize { .. } => {}
404402 AttributeKind::ShouldPanic { .. } => (),
405403 AttributeKind::Stability { .. } => (),
406404 AttributeKind::TestRunner(..) => (),
......@@ -627,52 +625,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
627625 }
628626 }
629627
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
676628 /// Checks if `#[naked]` is applied to a function definition.
677629 fn check_naked(&self, hir_id: HirId, target: Target) {
678630 match target {
compiler/rustc_passes/src/errors.rs-13
......@@ -1049,19 +1049,6 @@ pub(crate) struct UnnecessaryPartialStableFeature {
10491049#[note("see issue #55436 <https://github.com/rust-lang/rust/issues/55436> for more information")]
10501050pub(crate) struct IneffectiveUnstableImpl;
10511051
1052#[derive(Diagnostic)]
1053#[diag("sanitize attribute not allowed here")]
1054pub(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
10651052// FIXME(jdonszelmann): move back to rustc_attr
10661053#[derive(Diagnostic)]
10671054#[diag(
compiler/rustc_query_impl/src/execution.rs+7-2
......@@ -14,7 +14,7 @@ use rustc_middle::query::{
1414use rustc_middle::ty::TyCtxt;
1515use rustc_middle::verify_ich::incremental_verify_ich;
1616use rustc_span::{DUMMY_SP, Span};
17use tracing::warn;
17use tracing::debug;
1818
1919use crate::dep_graph::{DepNode, DepNodeIndex};
2020use crate::handle_cycle_error;
......@@ -100,7 +100,12 @@ fn collect_active_query_jobs_inner<'tcx, C>(
100100 for shard in query.state.active.try_lock_shards() {
101101 match shard {
102102 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),
104109 }
105110 }
106111 }
compiler/rustc_resolve/src/check_unused.rs+4-6
......@@ -134,12 +134,10 @@ impl<'a, 'ra, 'tcx> UnusedImportCheckVisitor<'a, 'ra, 'tcx> {
134134 match item.kind {
135135 ast::UseTreeKind::Simple(Some(ident)) => {
136136 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 )
143141 {
144142 self.unused_import(self.base_id).add(id);
145143 }
compiler/rustc_resolve/src/imports.rs+1-1
......@@ -1642,7 +1642,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
16421642 // purposes it's good enough to just favor one over the other.
16431643 self.per_ns(|this, ns| {
16441644 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());
16461646 }
16471647 });
16481648
compiler/rustc_resolve/src/late.rs+1-1
......@@ -5388,7 +5388,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
53885388 ident.span,
53895389 Some((ident.name, ValueNS)),
53905390 );
5391 self.r.trait_map.insert(node_id, traits);
5391 self.r.current_owner.trait_map.insert(node_id, traits);
53925392 }
53935393
53945394 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> {
13641364
13651365 /// Resolutions for nodes that have a single resolution.
13661366 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(),
13691367 /// An import will be inserted into this map if it has been used.
13701368 import_use_map: FxHashMap<Import<'ra>, Used> = default::fx_hash_map(),
13711369 /// Lifetime parameters that lowering will have to introduce.
......@@ -1375,7 +1373,6 @@ pub struct Resolver<'ra, 'tcx> {
13751373 extern_crate_map: UnordMap<LocalDefId, CrateNum> = Default::default(),
13761374 module_children: LocalDefIdMap<Vec<ModChild>> = Default::default(),
13771375 ambig_module_children: LocalDefIdMap<Vec<AmbigModChild>> = Default::default(),
1378 trait_map: NodeMap<&'tcx [TraitCandidate<'tcx>]> = Default::default(),
13791376
13801377 /// A map from nodes to anonymous modules.
13811378 /// Anonymous modules are pseudo-modules that are implicitly created around items
......@@ -1490,10 +1487,10 @@ pub struct Resolver<'ra, 'tcx> {
14901487 next_node_id: NodeId = CRATE_NODE_ID,
14911488
14921489 /// Preserves per owner data once the owner is finished resolving.
1493 owners: NodeMap<PerOwnerResolverData>,
1490 owners: NodeMap<PerOwnerResolverData<'tcx>>,
14941491
14951492 /// An entry of `owners` that gets taken out and reinserted whenever an owner is handled.
1496 current_owner: PerOwnerResolverData,
1493 current_owner: PerOwnerResolverData<'tcx>,
14971494
14981495 disambiguators: LocalDefIdMap<PerParentDisambiguatorState>,
14991496
......@@ -1997,11 +1994,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
19971994 };
19981995 let ast_lowering = ty::ResolverAstLowering {
19991996 partial_res_map: self.partial_res_map,
2000 import_res_map: self.import_res_map,
20011997 extra_lifetime_params_map: self.extra_lifetime_params_map,
20021998 next_node_id: self.next_node_id,
20031999 owners: self.owners,
2004 trait_map: self.trait_map,
20052000 lint_buffer: Steal::new(self.lint_buffer),
20062001 delegation_infos: self.delegation_infos,
20072002 disambiguators,
......@@ -2658,7 +2653,7 @@ fn with_owner<'ra, 'tcx, R: AsMut<Resolver<'ra, 'tcx>>, T>(
26582653fn with_owner_tables<'ra, 'tcx, R: AsMut<Resolver<'ra, 'tcx>>, T>(
26592654 this: &mut R,
26602655 owner: NodeId,
2661 tables: PerOwnerResolverData,
2656 tables: PerOwnerResolverData<'tcx>,
26622657 work: impl FnOnce(&mut R) -> T,
26632658) -> T {
26642659 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 {
252252 };
253253 ($attr:ident, $json_name:expr) => {{
254254 let name = $json_name;
255 d.insert(name.into(), target.$attr.to_json());
255 d.insert(name.to_string(), target.$attr.to_json());
256256 }};
257257 }
258258
......@@ -262,7 +262,7 @@ impl ToJson for Target {
262262 let name = $json_name;
263263 #[allow(rustc::bad_opt_access)]
264264 if default.$attr != target.$attr {
265 d.insert(name.into(), target.$attr.to_json());
265 d.insert(name.to_string(), target.$attr.to_json());
266266 }
267267 }};
268268 (link_args - $attr:ident, $json_name:expr) => {{
......@@ -447,7 +447,6 @@ impl schemars::JsonSchema for EndianWrapper {
447447 "type": "string",
448448 "enum": ["big", "little"]
449449 })
450 .into()
451450 }
452451}
453452
......@@ -473,7 +472,6 @@ impl schemars::JsonSchema for ExternAbiWrapper {
473472 "type": "string",
474473 "enum": all,
475474 })
476 .into()
477475 }
478476}
479477
compiler/rustc_target/src/spec/mod.rs+9-10
......@@ -522,7 +522,6 @@ impl schemars::JsonSchema for LinkerFlavorCli {
522522 "type": "string",
523523 "enum": all
524524 })
525 .into()
526525 }
527526}
528527
......@@ -587,7 +586,6 @@ impl schemars::JsonSchema for LinkSelfContainedDefault {
587586 "type": "string",
588587 "enum": ["false", "true", "wasm", "musl", "mingw"]
589588 })
590 .into()
591589 }
592590}
593591
......@@ -733,7 +731,6 @@ impl schemars::JsonSchema for LinkSelfContainedComponents {
733731 "type": "string",
734732 "enum": all,
735733 })
736 .into()
737734 }
738735}
739736
......@@ -912,7 +909,6 @@ impl schemars::JsonSchema for SmallDataThresholdSupport {
912909 "type": "string",
913910 "pattern": r#"^none|default-for-arch|llvm-module-flag=.+|llvm-arg=.+$"#,
914911 })
915 .into()
916912 }
917913}
918914
......@@ -992,6 +988,8 @@ crate::target_spec_enum! {
992988 pub enum RustcAbi {
993989 /// On x86-32 only: make use of SSE and SSE2 for ABI purposes.
994990 X86Sse2 = "x86-sse2",
991 /// On PowerPC only: build for SPE.
992 PowerPcSpe = "powerpc-spe",
995993 /// On x86-32/64, aarch64, and S390x: do not use any FPU or SIMD registers for the ABI.
996994 Softfloat = "softfloat", "x86-softfloat",
997995 }
......@@ -1288,7 +1286,6 @@ impl schemars::JsonSchema for SanitizerSet {
12881286 "type": "string",
12891287 "enum": all,
12901288 })
1291 .into()
12921289 }
12931290}
12941291
......@@ -3427,13 +3424,15 @@ impl Target {
34273424 "`llvm_abiname` is unused on PowerPC"
34283425 );
34293426 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).
34333427 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,
34343435 self.cfg_abi,
3435 CfgAbi::Spe | CfgAbi::Unspecified | CfgAbi::Other(_),
3436 "invalid `target_abi` for PowerPC"
34373436 );
34383437 }
34393438 Arch::PowerPC64 => {
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs+3-2
......@@ -1,8 +1,8 @@
11use rustc_abi::Endian;
22
33use 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,
66};
77
88pub(crate) fn target() -> Target {
......@@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
2424 arch: Arch::PowerPC,
2525 options: TargetOptions {
2626 cfg_abi: CfgAbi::Spe,
27 rustc_abi: Some(RustcAbi::PowerPcSpe),
2728 endian: Endian::Big,
2829 features: "+secure-plt,+msync,+spe".into(),
2930 mcount: "_mcount".into(),
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs+3-2
......@@ -1,8 +1,8 @@
11use rustc_abi::Endian;
22
33use 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,
66};
77
88pub(crate) fn target() -> Target {
......@@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
2424 arch: Arch::PowerPC,
2525 options: TargetOptions {
2626 cfg_abi: CfgAbi::Spe,
27 rustc_abi: Some(RustcAbi::PowerPcSpe),
2728 endian: Endian::Big,
2829 features: "+msync,+spe".into(),
2930 mcount: "_mcount".into(),
compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs+3-2
......@@ -1,8 +1,8 @@
11use rustc_abi::Endian;
22
33use 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,
66};
77
88pub(crate) fn target() -> Target {
......@@ -24,6 +24,7 @@ pub(crate) fn target() -> Target {
2424 arch: Arch::PowerPC,
2525 options: TargetOptions {
2626 cfg_abi: CfgAbi::Spe,
27 rustc_abi: Some(RustcAbi::PowerPcSpe),
2728 endian: Endian::Big,
2829 // feature msync would disable instruction 'fsync' which is not supported by fsl_p1p2
2930 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)] = &[
573573];
574574
575575static 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.
576578 // tidy-alphabetical-start
577579 ("altivec", Unstable(sym::powerpc_target_feature), &[]),
580 (
581 "hard-float",
582 Forbidden { reason: "unsupported ABI-configuration feature", hard_error: false },
583 &[],
584 ),
578585 ("msync", Unstable(sym::powerpc_target_feature), &[]),
579586 ("partword-atomics", Unstable(sym::powerpc_target_feature), &[]),
580587 ("power8-altivec", Unstable(sym::powerpc_target_feature), &["altivec"]),
......@@ -584,6 +591,7 @@ static POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
584591 ("power9-vector", Unstable(sym::powerpc_target_feature), &["power8-vector", "power9-altivec"]),
585592 ("power10-vector", Unstable(sym::powerpc_target_feature), &["power9-vector"]),
586593 ("quadword-atomics", Unstable(sym::powerpc_target_feature), &[]),
594 ("spe", Forbidden { reason: "unsupported ABI-configuration feature", hard_error: false }, &[]),
587595 ("vsx", Unstable(sym::powerpc_target_feature), &["altivec"]),
588596 // tidy-alphabetical-end
589597];
......@@ -1139,12 +1147,12 @@ impl Target {
11391147 /// the first list contains target features that must be enabled for ABI reasons,
11401148 /// and the second list contains target feature that must be disabled for ABI reasons.
11411149 ///
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.
11441152 ///
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!
11481156 pub fn abi_required_features(&self) -> FeatureConstraints {
11491157 const NOTHING: FeatureConstraints = FeatureConstraints { required: &[], incompatible: &[] };
11501158 // Some architectures don't have a clean explicit ABI designation; instead, the ABI is
......@@ -1175,6 +1183,7 @@ impl Target {
11751183 // LLVM handles the rest.
11761184 FeatureConstraints { required: &["soft-float"], incompatible: &[] }
11771185 }
1186 _ => unreachable!(),
11781187 }
11791188 }
11801189 Arch::X86_64 => {
......@@ -1195,7 +1204,7 @@ impl Target {
11951204 // LLVM handles the rest.
11961205 FeatureConstraints { required: &["soft-float"], incompatible: &[] }
11971206 }
1198 Some(r) => panic!("invalid Rust ABI for x86_64: {r:?}"),
1207 _ => unreachable!(),
11991208 }
12001209 }
12011210 Arch::Arm => {
......@@ -1232,7 +1241,7 @@ impl Target {
12321241 // `FeatureConstraints` uses Rust feature names, hence only "neon" shows up.
12331242 FeatureConstraints { required: &["neon"], incompatible: &[] }
12341243 }
1235 Some(r) => panic!("invalid Rust ABI for aarch64: {r:?}"),
1244 _ => unreachable!(),
12361245 }
12371246 }
12381247 Arch::RiscV32 | Arch::RiscV64 => {
......@@ -1309,11 +1318,33 @@ impl Target {
13091318 // llvm will switch to soft-float ABI just based on this feature.
13101319 FeatureConstraints { required: &["soft-float"], incompatible: &["vector"] }
13111320 }
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"] }
13141331 }
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!(),
13151340 }
13161341 }
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 }
13171348 Arch::Avr => {
13181349 // We only support one ABI on AVR at the moment.
13191350 // 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> {
561561 // and therefore is treated as rigid.
562562 if let Some(ty::PredicateKind::AliasRelate(lhs, rhs, _)) = pred.kind().no_bound_vars() {
563563 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)),
565565 goal.depth() + 1,
566566 self,
567567 )?;
568568 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)),
570570 goal.depth() + 1,
571571 self,
572572 )?;
compiler/rustc_trait_selection/src/solve/normalize.rs+4-4
......@@ -48,8 +48,8 @@ where
4848 let delegate = <&SolverDelegate<'tcx>>::from(infcx);
4949 let infer_term = delegate.next_term_var_of_kind(alias_term, at.cause.span);
5050 let predicate = ty::PredicateKind::AliasRelate(
51 alias_term.into(),
52 infer_term.into(),
51 alias_term,
52 infer_term,
5353 ty::AliasRelationDirection::Equate,
5454 );
5555 let goal = Goal::new(infcx.tcx, at.param_env, predicate);
......@@ -92,8 +92,8 @@ impl<'me, 'tcx> ReplaceAliasWithInfer<'me, 'tcx> {
9292 self.at.cause.clone(),
9393 self.at.param_env,
9494 ty::PredicateKind::AliasRelate(
95 alias_term.into(),
96 infer_term.into(),
95 alias_term,
96 infer_term,
9797 ty::AliasRelationDirection::Equate,
9898 ),
9999 );
compiler/rustc_trait_selection/src/traits/normalize.rs+1-1
......@@ -295,7 +295,7 @@ impl<'a, 'b, 'tcx> AssocTypeNormalizer<'a, 'b, 'tcx> {
295295 let recursion_limit = self.cx().recursion_limit();
296296 if !recursion_limit.value_within_limit(self.depth) {
297297 self.selcx.infcx.err_ctxt().report_overflow_error(
298 OverflowCause::DeeplyNormalize(free.into()),
298 OverflowCause::DeeplyNormalize(free),
299299 self.cause.span,
300300 false,
301301 |diag| {
compiler/rustc_trait_selection/src/traits/project.rs+7-4
......@@ -275,10 +275,13 @@ pub fn normalize_projection_term<'a, 'b, 'tcx>(
275275 // and a deferred predicate to resolve this when more type
276276 // information is available.
277277
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 )
282285 })
283286}
284287
library/core/src/convert/num.rs+1-11
......@@ -1,17 +1,9 @@
11use crate::num::{IntErrorKind, TryFromIntError};
22
3mod 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
113/// Supporting trait for inherent methods of `f32` and `f64` such as `to_int_unchecked`.
124/// Typically doesn’t need to be used directly.
135#[unstable(feature = "convert_float_to_int", issue = "67057")]
14pub trait FloatToInt<Int>: private::Sealed + Sized {
6pub impl(self) trait FloatToInt<Int>: Sized {
157 #[unstable(feature = "convert_float_to_int", issue = "67057")]
168 #[doc(hidden)]
179 unsafe fn to_int_unchecked(self) -> Int;
......@@ -19,8 +11,6 @@ pub trait FloatToInt<Int>: private::Sealed + Sized {
1911
2012macro_rules! impl_float_to_int {
2113 ($Float:ty => $($Int:ty),+) => {
22 #[unstable(feature = "convert_float_to_int", issue = "67057")]
23 impl private::Sealed for $Float {}
2414 $(
2515 #[unstable(feature = "convert_float_to_int", issue = "67057")]
2616 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> {
279279 }
280280}
281281
282mod 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
302282/// Types that are valid to read using [`VaList::next_arg`].
303283///
304284/// This trait is implemented for primitive types that have a variable argument application-binary
......@@ -333,7 +313,7 @@ mod sealed {
333313// types with an alignment larger than 8, or with a non-scalar layout. Inline assembly can be used
334314// to accept unsupported types in the meantime.
335315#[lang = "va_arg_safe"]
336pub unsafe trait VaArgSafe: Copy + sealed::Sealed {}
316pub impl(self) unsafe trait VaArgSafe: Copy {}
337317
338318crate::cfg_select! {
339319 any(target_arch = "avr", target_arch = "msp430") => {
library/core/src/lib.rs+1-9
......@@ -111,7 +111,6 @@
111111#![feature(offset_of_enum)]
112112#![feature(panic_internals)]
113113#![feature(pattern_type_macro)]
114#![feature(sealed)]
115114#![feature(ub_checks)]
116115// tidy-alphabetical-end
117116//
......@@ -142,6 +141,7 @@
142141#![feature(freeze_impls)]
143142#![feature(fundamental)]
144143#![feature(funnel_shifts)]
144#![feature(impl_restriction)]
145145#![feature(intra_doc_pointers)]
146146#![feature(intrinsics)]
147147#![feature(lang_items)]
......@@ -219,14 +219,6 @@ pub mod from {
219219 pub use crate::macros::builtin::From;
220220}
221221
222mod 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
230222// We don't export this through #[macro_export] for now, to avoid breakage.
231223#[unstable(feature = "autodiff", issue = "124509")]
232224#[doc = include_str!("../../core/src/autodiff.md")]
library/core/src/marker/variance.rs+5-5
......@@ -30,7 +30,7 @@ macro_rules! phantom_type {
3030 }
3131 }
3232
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 {
3434 const VALUE: Self = Self::new();
3535 }
3636 impl<T> Variance for $name<T> where T: ?Sized {}
......@@ -114,7 +114,7 @@ macro_rules! phantom_lifetime {
114114 }
115115 }
116116
117 impl self::sealed::Sealed for $name<'_> {
117 impl self::private_items::PrivateItems for $name<'_> {
118118 const VALUE: Self = Self::new();
119119 }
120120 impl Variance for $name<'_> {}
......@@ -233,14 +233,14 @@ phantom_type! {
233233 pub struct PhantomInvariant<T>(PhantomData<fn(T) -> T>);
234234}
235235
236mod sealed {
237 pub trait Sealed {
236mod private_items {
237 pub trait PrivateItems {
238238 const VALUE: Self;
239239 }
240240}
241241
242242/// A marker trait for phantom variance types.
243pub trait Variance: sealed::Sealed + Default {}
243pub trait Variance: private_items::PrivateItems + Default {}
244244
245245/// Construct a variance marker; equivalent to [`Default::default`].
246246///
library/core/src/num/mod.rs-9
......@@ -1848,12 +1848,3 @@ macro_rules! from_str_int_impl {
18481848
18491849from_str_int_impl! { signed isize i8 i16 i32 i64 i128 }
18501850from_str_int_impl! { unsigned usize u8 u16 u32 u64 u128 }
1851
1852macro_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}
1859impl_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};
3131 reason = "implementation detail which may disappear or be replaced at any time",
3232 issue = "none"
3333)]
34pub unsafe trait ZeroablePrimitive: Sized + Copy + private::Sealed {
34pub impl(self) unsafe trait ZeroablePrimitive: Sized + Copy {
3535 /// A type like `Self` but with a niche that includes zero.
3636 type NonZeroInner: Sized + Copy;
3737}
3838
3939macro_rules! impl_zeroable_primitive {
4040 ($($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
5041 $(
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
5842 #[unstable(
5943 feature = "nonzero_internals",
6044 reason = "implementation detail which may disappear or be replaced at any time",
library/core/src/num/traits.rs+2-2
......@@ -4,7 +4,7 @@
44/// Trait for types that this type can be truncated to
55#[unstable(feature = "num_internals", reason = "internal implementation detail", issue = "none")]
66#[rustc_const_unstable(feature = "integer_widen_truncate", issue = "154330")]
7pub const trait TruncateTarget<Target>: crate::sealed::Sealed {
7pub impl(self) const trait TruncateTarget<Target> {
88 #[doc(hidden)]
99 fn internal_truncate(self) -> Target;
1010
......@@ -18,7 +18,7 @@ pub const trait TruncateTarget<Target>: crate::sealed::Sealed {
1818/// Trait for types that this type can be widened to
1919#[unstable(feature = "num_internals", reason = "internal implementation detail", issue = "none")]
2020#[rustc_const_unstable(feature = "integer_widen_truncate", issue = "154330")]
21pub const trait WidenTarget<Target>: crate::sealed::Sealed {
21pub impl(self) const trait WidenTarget<Target> {
2222 #[doc(hidden)]
2323 fn internal_widen(self) -> Target;
2424}
library/core/src/panic.rs+1-1
......@@ -1,4 +1,4 @@
1//! Panic support in the standard library.
1//! Panic support in core.
22
33#![stable(feature = "core_panic_info", since = "1.41.0")]
44
library/core/src/slice/index.rs+1-41
......@@ -102,46 +102,6 @@ const unsafe fn get_offset_len_mut_noubcheck<T>(
102102 crate::intrinsics::aggregate_raw_ptr(ptr, len)
103103}
104104
105mod 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
145105/// A helper trait used for indexing operations.
146106///
147107/// Implementations of this trait have to promise that if the argument
......@@ -160,7 +120,7 @@ mod private_slice_index {
160120 label = "slice indices are of type `usize` or ranges of `usize`"
161121)]
162122#[rustc_const_unstable(feature = "const_index", issue = "143775")]
163pub const unsafe trait SliceIndex<T: ?Sized>: private_slice_index::Sealed {
123pub impl(crate) const unsafe trait SliceIndex<T: ?Sized> {
164124 /// The output type returned by methods.
165125 #[stable(feature = "slice_get_slice", since = "1.28.0")]
166126 type Output: ?Sized;
library/core/src/slice/mod.rs+1-21
......@@ -5740,24 +5740,6 @@ impl fmt::Display for GetDisjointMutError {
57405740 }
57415741}
57425742
5743mod 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
57615743/// A helper trait for `<[T]>::get_disjoint_mut()`.
57625744///
57635745/// # Safety
......@@ -5765,9 +5747,7 @@ mod private_get_disjoint_mut_index {
57655747/// If `is_in_bounds()` returns `true` and `is_overlapping()` returns `false`,
57665748/// it must be safe to index the slice with the indices.
57675749#[unstable(feature = "get_disjoint_mut_helpers", issue = "none")]
5768pub unsafe trait GetDisjointMutIndex:
5769 Clone + private_get_disjoint_mut_index::Sealed
5770{
5750pub impl(self) unsafe trait GetDisjointMutIndex: Clone {
57715751 /// Returns `true` if `self` is in bounds for `len` slice elements.
57725752 #[unstable(feature = "get_disjoint_mut_helpers", issue = "none")]
57735753 fn is_in_bounds(&self, len: usize) -> bool;
library/core/src/sync/atomic.rs+1-6
......@@ -257,8 +257,6 @@ use crate::{fmt, intrinsics};
257257)]
258258#[expect(missing_debug_implementations)]
259259mod private {
260 pub(super) trait Sealed {}
261
262260 #[cfg(target_has_atomic_load_store = "8")]
263261 #[repr(C, align(1))]
264262 pub struct Align1<T>(T);
......@@ -291,8 +289,7 @@ mod private {
291289 reason = "implementation detail which may disappear or be replaced at any time",
292290 issue = "none"
293291)]
294#[expect(private_bounds)]
295pub unsafe trait AtomicPrimitive: Sized + Copy + private::Sealed {
292pub impl(self) unsafe trait AtomicPrimitive: Sized + Copy {
296293 /// Temporary implementation detail.
297294 type Storage: Sized;
298295}
......@@ -300,8 +297,6 @@ pub unsafe trait AtomicPrimitive: Sized + Copy + private::Sealed {
300297macro impl_atomic_primitive(
301298 [$($T:ident)?] $Primitive:ty as $Storage:ident<$Operand:ty>, size($size:literal)
302299) {
303 impl $(<$T>)? private::Sealed for $Primitive {}
304
305300 #[unstable(
306301 feature = "atomic_internals",
307302 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 {
9494 inner: Buf,
9595}
9696
97/// Allows extension traits within `std`.
98#[unstable(feature = "sealed", issue = "none")]
99impl crate::sealed::Sealed for OsString {}
100
10197/// Borrowed reference to an OS string (see [`OsString`]).
10298///
10399/// This type represents a borrowed reference to a string in the operating system's preferred
......@@ -120,10 +116,6 @@ pub struct OsStr {
120116 inner: Slice,
121117}
122118
123/// Allows extension traits within `std`.
124#[unstable(feature = "sealed", issue = "none")]
125impl crate::sealed::Sealed for OsStr {}
126
127119impl OsString {
128120 /// Constructs a new empty `OsString`.
129121 ///
library/std/src/fs.rs-5
......@@ -44,7 +44,6 @@ mod tests;
4444use crate::ffi::OsString;
4545use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write};
4646use crate::path::{Path, PathBuf};
47use crate::sealed::Sealed;
4847use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner, fs as fs_imp};
4948use crate::time::SystemTime;
5049use crate::{error, fmt};
......@@ -2215,10 +2214,6 @@ impl AsInnerMut<fs_imp::FileTimes> for FileTimes {
22152214 }
22162215}
22172216
2218// For implementing OS extension traits in `std::os`
2219#[stable(feature = "file_set_times", since = "1.75.0")]
2220impl Sealed for FileTimes {}
2221
22222217impl Permissions {
22232218 /// Returns `true` if these permissions describe a readonly (unwritable) file.
22242219 ///
library/std/src/io/stdio.rs+1-4
......@@ -1195,7 +1195,7 @@ pub(crate) fn attempt_print_to_stderr(args: fmt::Arguments<'_>) {
11951195
11961196/// Trait to determine if a descriptor/handle refers to a terminal/tty.
11971197#[stable(feature = "is_terminal", since = "1.70.0")]
1198pub trait IsTerminal: crate::sealed::Sealed {
1198pub impl(crate) trait IsTerminal {
11991199 /// Returns `true` if the descriptor/handle refers to a terminal/tty.
12001200 ///
12011201 /// 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 {
12501250
12511251macro_rules! impl_is_terminal {
12521252 ($($t:ty),*$(,)?) => {$(
1253 #[unstable(feature = "sealed", issue = "none")]
1254 impl crate::sealed::Sealed for $t {}
1255
12561253 #[stable(feature = "is_terminal", since = "1.70.0")]
12571254 impl IsTerminal for $t {
12581255 #[inline]
library/std/src/lib.rs+3
......@@ -291,6 +291,7 @@
291291#![feature(f128)]
292292#![feature(ffi_const)]
293293#![feature(gpu_offload)]
294#![feature(impl_restriction)]
294295#![feature(intra_doc_pointers)]
295296#![feature(lang_items)]
296297#![feature(link_cfg)]
......@@ -792,6 +793,8 @@ include!("keyword_docs.rs");
792793#[unstable(feature = "restricted_std", issue = "none")]
793794mod __restricted_std_workaround {}
794795
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.
795798mod sealed {
796799 /// This trait being unreachable from outside the crate
797800 /// prevents outside implementations of our extension traits.
library/std/src/os/darwin/fs.rs+1-2
......@@ -4,7 +4,6 @@
44#![stable(feature = "metadata_ext", since = "1.1.0")]
55
66use crate::fs::{self, Metadata};
7use crate::sealed::Sealed;
87use crate::sys::{AsInner, AsInnerMut, IntoInner};
98use crate::time::SystemTime;
109
......@@ -157,7 +156,7 @@ impl MetadataExt for Metadata {
157156
158157/// OS-specific extensions to [`fs::FileTimes`].
159158#[stable(feature = "file_set_times", since = "1.75.0")]
160pub trait FileTimesExt: Sealed {
159pub impl(self) trait FileTimesExt {
161160 /// Set the creation time of a file.
162161 #[stable(feature = "file_set_times", since = "1.75.0")]
163162 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 {
237237
238238macro_rules! impl_is_terminal {
239239 ($($t:ty),*$(,)?) => {$(
240 #[unstable(feature = "sealed", issue = "none")]
241 impl crate::sealed::Sealed for $t {}
242
243240 #[stable(feature = "is_terminal", since = "1.70.0")]
244241 impl io::IsTerminal for $t {
245242 #[inline]
......@@ -358,7 +355,7 @@ impl From<crate::net::TcpStream> for OwnedFd {
358355 /// Takes ownership of a [`TcpStream`](crate::net::TcpStream)'s socket file descriptor.
359356 #[inline]
360357 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()
362359 }
363360}
364361
......@@ -388,7 +385,7 @@ impl From<crate::net::TcpListener> for OwnedFd {
388385 /// Takes ownership of a [`TcpListener`](crate::net::TcpListener)'s socket file descriptor.
389386 #[inline]
390387 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()
392389 }
393390}
394391
......@@ -418,7 +415,7 @@ impl From<crate::net::UdpSocket> for OwnedFd {
418415 /// Takes ownership of a [`UdpSocket`](crate::net::UdpSocket)'s file descriptor.
419416 #[inline]
420417 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()
422419 }
423420}
424421
library/std/src/os/freebsd/net.rs+1-2
......@@ -5,7 +5,6 @@
55use crate::ffi::CStr;
66use crate::io;
77use crate::os::unix::net;
8use crate::sealed::Sealed;
98use crate::sys::AsInner;
109
1110/// FreeBSD-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
......@@ -14,7 +13,7 @@ use crate::sys::AsInner;
1413/// [`UnixDatagram`]: net::UnixDatagram
1514/// [`UnixStream`]: net::UnixStream
1615#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
17pub trait UnixSocketExt: Sealed {
16pub impl(self) trait UnixSocketExt {
1817 /// Query the current setting of socket option `LOCAL_CREDS_PERSISTENT`.
1918 #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
2019 fn local_creds_persistent(&self) -> io::Result<bool>;
library/std/src/os/illumos/net.rs+1-2
......@@ -4,7 +4,6 @@
44
55use crate::io;
66use crate::os::unix::net;
7use crate::sealed::Sealed;
87use crate::sys::AsInner;
98
109/// illumos-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
......@@ -13,7 +12,7 @@ use crate::sys::AsInner;
1312/// [`UnixDatagram`]: net::UnixDatagram
1413/// [`UnixStream`]: net::UnixStream
1514#[unstable(feature = "unix_socket_exclbind", issue = "123481")]
16pub trait UnixSocketExt: Sealed {
15pub impl(self) trait UnixSocketExt {
1716 /// Enables exclusive binding on the socket.
1817 ///
1918 /// 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 @@
77use crate::io::Result;
88use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
99use crate::process::{self, ExitStatus};
10use crate::sealed::Sealed;
1110use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner};
1211#[cfg(not(doc))]
1312use crate::sys::{fd::FileDesc, linux::pidfd::PidFd as InnerPidFd};
......@@ -147,7 +146,7 @@ impl From<PidFd> for OwnedFd {
147146/// Os-specific extensions for [`Child`]
148147///
149148/// [`Child`]: process::Child
150pub trait ChildExt: Sealed {
149pub impl(crate) trait ChildExt {
151150 /// Obtains a reference to the [`PidFd`] created for this [`Child`], if available.
152151 ///
153152 /// A pidfd will only be available if its creation was requested with
......@@ -186,7 +185,7 @@ pub trait ChildExt: Sealed {
186185/// Os-specific extensions for [`Command`]
187186///
188187/// [`Command`]: process::Command
189pub trait CommandExt: Sealed {
188pub impl(self) trait CommandExt {
190189 /// Sets whether a [`PidFd`](struct@PidFd) should be created for the [`Child`]
191190 /// spawned by this [`Command`].
192191 /// By default, no pidfd will be created.
library/std/src/os/motor/ffi.rs+2-3
......@@ -2,14 +2,13 @@
22#![unstable(feature = "motor_ext", issue = "147456")]
33
44use crate::ffi::{OsStr, OsString};
5use crate::sealed::Sealed;
65use crate::sys::{AsInner, IntoInner};
76
87/// Motor OS–specific extensions to [`OsString`].
98///
109/// This trait is sealed: it cannot be implemented outside the standard library.
1110/// This is so that future additional methods are not breaking changes.
12pub trait OsStringExt: Sealed {
11pub impl(self) trait OsStringExt {
1312 /// Yields the underlying UTF-8 string of this [`OsString`].
1413 ///
1514 /// OS strings on Motor OS are guaranteed to be UTF-8, so are just strings.
......@@ -27,7 +26,7 @@ impl OsStringExt for OsString {
2726///
2827/// This trait is sealed: it cannot be implemented outside the standard library.
2928/// This is so that future additional methods are not breaking changes.
30pub trait OsStrExt: Sealed {
29pub impl(self) trait OsStrExt {
3130 /// Gets the underlying UTF-8 string view of the [`OsStr`] slice.
3231 ///
3332 /// 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 @@
11#![unstable(feature = "motor_ext", issue = "147456")]
22
3use crate::sealed::Sealed;
43use crate::sys::AsInner;
54
6pub trait ChildExt: Sealed {
5pub impl(self) trait ChildExt {
76 /// Extracts the main thread raw handle, without taking ownership
87 fn sys_handle(&self) -> u64;
98}
library/std/src/os/net/linux_ext/addr.rs+1-2
......@@ -1,11 +1,10 @@
11//! Linux and Android-specific extensions to socket addresses.
22
33use crate::os::unix::net::SocketAddr;
4use crate::sealed::Sealed;
54
65/// Platform-specific extensions to [`SocketAddr`].
76#[stable(feature = "unix_socket_abstract", since = "1.70.0")]
8pub trait SocketAddrExt: Sealed {
7pub impl(in crate::os) trait SocketAddrExt {
98 /// Creates a Unix socket address in the abstract namespace.
109 ///
1110 /// 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 @@
22
33use crate::io;
44use crate::os::unix::net;
5use crate::sealed::Sealed;
65use crate::sys::AsInner;
76
87/// Linux-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
......@@ -11,7 +10,7 @@ use crate::sys::AsInner;
1110/// [`UnixDatagram`]: net::UnixDatagram
1211/// [`UnixStream`]: net::UnixStream
1312#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
14pub trait UnixSocketExt: Sealed {
13pub impl(self) trait UnixSocketExt {
1514 /// Query the current setting of socket option `SO_PASSCRED`.
1615 #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
1716 fn passcred(&self) -> io::Result<bool>;
library/std/src/os/net/linux_ext/tcp.rs+1-5
......@@ -2,7 +2,6 @@
22//!
33//! [`std::net`]: crate::net
44
5use crate::sealed::Sealed;
65use crate::sys::AsInner;
76#[cfg(target_os = "linux")]
87use crate::time::Duration;
......@@ -12,7 +11,7 @@ use crate::{io, net};
1211///
1312/// [`TcpStream`]: net::TcpStream
1413#[stable(feature = "tcp_quickack", since = "1.89.0")]
15pub trait TcpStreamExt: Sealed {
14pub impl(self) trait TcpStreamExt {
1615 /// Enable or disable `TCP_QUICKACK`.
1716 ///
1817 /// This flag causes Linux to eagerly send ACKs rather than delaying them.
......@@ -109,9 +108,6 @@ pub trait TcpStreamExt: Sealed {
109108 fn deferaccept(&self) -> io::Result<Duration>;
110109}
111110
112#[stable(feature = "tcp_quickack", since = "1.89.0")]
113impl Sealed for net::TcpStream {}
114
115111#[stable(feature = "tcp_quickack", since = "1.89.0")]
116112impl TcpStreamExt for net::TcpStream {
117113 fn set_quickack(&self, quickack: bool) -> io::Result<()> {
library/std/src/os/netbsd/net.rs+1-2
......@@ -5,7 +5,6 @@
55use crate::ffi::CStr;
66use crate::io;
77use crate::os::unix::net;
8use crate::sealed::Sealed;
98use crate::sys::AsInner;
109
1110/// NetBSD-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
......@@ -14,7 +13,7 @@ use crate::sys::AsInner;
1413/// [`UnixDatagram`]: net::UnixDatagram
1514/// [`UnixStream`]: net::UnixStream
1615#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
17pub trait UnixSocketExt: Sealed {
16pub impl(self) trait UnixSocketExt {
1817 /// Query the current setting of socket option `LOCAL_CREDS`.
1918 #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
2019 fn local_creds(&self) -> io::Result<bool>;
library/std/src/os/solaris/net.rs+1-2
......@@ -4,7 +4,6 @@
44
55use crate::io;
66use crate::os::unix::net;
7use crate::sealed::Sealed;
87use crate::sys::AsInner;
98
109/// solaris-specific functionality for `AF_UNIX` sockets [`UnixDatagram`]
......@@ -13,7 +12,7 @@ use crate::sys::AsInner;
1312/// [`UnixDatagram`]: net::UnixDatagram
1413/// [`UnixStream`]: net::UnixStream
1514#[unstable(feature = "unix_socket_exclbind", issue = "123481")]
16pub trait UnixSocketExt: Sealed {
15pub impl(self) trait UnixSocketExt {
1716 /// Enables exclusive binding on the socket.
1817 ///
1918 /// 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 {
180180
181181macro_rules! impl_is_terminal {
182182 ($($t:ty),*$(,)?) => {$(
183 #[unstable(feature = "sealed", issue = "none")]
184 impl crate::sealed::Sealed for $t {}
185
186183 #[stable(feature = "is_terminal", since = "1.70.0")]
187184 impl io::IsTerminal for $t {
188185 #[inline]
library/std/src/os/unix/ffi/os_str.rs+2-3
......@@ -1,6 +1,5 @@
11use crate::ffi::{OsStr, OsString};
22use crate::mem;
3use crate::sealed::Sealed;
43use crate::sys::os_str::Buf;
54use crate::sys::{AsInner, FromInner, IntoInner};
65
......@@ -12,7 +11,7 @@ use crate::sys::{AsInner, FromInner, IntoInner};
1211/// This trait is sealed: it cannot be implemented outside the standard library.
1312/// This is so that future additional methods are not breaking changes.
1413#[stable(feature = "rust1", since = "1.0.0")]
15pub trait OsStringExt: Sealed {
14pub impl(self) trait OsStringExt {
1615 /// Creates an [`OsString`] from a byte vector.
1716 ///
1817 /// See the module documentation for an example.
......@@ -43,7 +42,7 @@ impl OsStringExt for OsString {
4342/// This trait is sealed: it cannot be implemented outside the standard library.
4443/// This is so that future additional methods are not breaking changes.
4544#[stable(feature = "rust1", since = "1.0.0")]
46pub trait OsStrExt: Sealed {
45pub impl(self) trait OsStrExt {
4746 #[stable(feature = "rust1", since = "1.0.0")]
4847 /// Creates an [`OsStr`] from a byte slice.
4948 ///
library/std/src/os/unix/fs.rs+1-6
......@@ -14,7 +14,6 @@ use crate::fs::{self, OpenOptions, Permissions};
1414use crate::io::BorrowedCursor;
1515use crate::os::unix::io::{AsFd, AsRawFd};
1616use crate::path::Path;
17use crate::sealed::Sealed;
1817use crate::sys::{AsInner, AsInnerMut, FromInner};
1918use crate::{io, sys};
2019
......@@ -1011,7 +1010,7 @@ impl DirEntryExt for fs::DirEntry {
10111010
10121011/// Sealed Unix-specific extension methods for [`fs::DirEntry`].
10131012#[unstable(feature = "dir_entry_ext2", issue = "85573")]
1014pub trait DirEntryExt2: Sealed {
1013pub impl(self) trait DirEntryExt2 {
10151014 /// Returns a reference to the underlying `OsStr` of this entry's filename.
10161015 ///
10171016 /// # Examples
......@@ -1035,10 +1034,6 @@ pub trait DirEntryExt2: Sealed {
10351034 fn file_name_ref(&self) -> &OsStr;
10361035}
10371036
1038/// Allows extension traits within `std`.
1039#[unstable(feature = "sealed", issue = "none")]
1040impl Sealed for fs::DirEntry {}
1041
10421037#[unstable(feature = "dir_entry_ext2", issue = "85573")]
10431038impl DirEntryExt2 for fs::DirEntry {
10441039 fn file_name_ref(&self) -> &OsStr {
library/std/src/os/unix/io/mod.rs+1-1
......@@ -103,7 +103,7 @@ use crate::sys::cvt;
103103mod tests;
104104
105105#[unstable(feature = "stdio_swap", issue = "150667")]
106pub trait StdioExt: crate::sealed::Sealed {
106pub impl(self) trait StdioExt {
107107 /// Redirects the stdio file descriptor to point to the file description underpinning `fd`.
108108 ///
109109 /// 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;
44use crate::os::net::linux_ext;
55use crate::os::unix::ffi::OsStrExt;
66use crate::path::Path;
7use crate::sealed::Sealed;
87use crate::sys::cvt;
98use crate::{fmt, io, mem, ptr};
109
......@@ -253,9 +252,6 @@ impl SocketAddr {
253252 }
254253}
255254
256#[stable(feature = "unix_socket_abstract", since = "1.70.0")]
257impl Sealed for SocketAddr {}
258
259255#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "cygwin")))]
260256#[cfg(any(doc, target_os = "android", target_os = "linux", target_os = "cygwin"))]
261257#[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};
2121use crate::net::Shutdown;
2222use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
2323use crate::path::Path;
24use crate::sealed::Sealed;
2524use crate::sys::net::Socket;
2625use crate::sys::{AsInner, FromInner, IntoInner, cvt};
2726use crate::time::Duration;
......@@ -60,10 +59,6 @@ const MSG_NOSIGNAL: core::ffi::c_int = 0x0;
6059#[stable(feature = "unix_socket", since = "1.10.0")]
6160pub struct UnixDatagram(Socket);
6261
63/// Allows extension traits within `std`.
64#[unstable(feature = "sealed", issue = "none")]
65impl Sealed for UnixDatagram {}
66
6762#[stable(feature = "unix_socket", since = "1.10.0")]
6863impl fmt::Debug for UnixDatagram {
6964 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};
3535use crate::net::Shutdown;
3636use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
3737use crate::path::Path;
38use crate::sealed::Sealed;
3938use crate::sys::net::Socket;
4039use crate::sys::{AsInner, FromInner, cvt};
4140use crate::time::Duration;
......@@ -73,10 +72,6 @@ use crate::time::Duration;
7372#[stable(feature = "unix_socket", since = "1.10.0")]
7473pub struct UnixStream(pub(super) Socket);
7574
76/// Allows extension traits within `std`.
77#[unstable(feature = "sealed", issue = "none")]
78impl Sealed for UnixStream {}
79
8075#[stable(feature = "unix_socket", since = "1.10.0")]
8176impl fmt::Debug for UnixStream {
8277 fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
library/std/src/os/unix/process.rs+3-4
......@@ -7,7 +7,6 @@
77use crate::ffi::OsStr;
88use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
99use crate::path::Path;
10use crate::sealed::Sealed;
1110use crate::sys::process::ChildPipe;
1211use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner};
1312use crate::{io, process, sys};
......@@ -35,7 +34,7 @@ cfg_select! {
3534/// This trait is sealed: it cannot be implemented outside the standard library.
3635/// This is so that future additional methods are not breaking changes.
3736#[stable(feature = "rust1", since = "1.0.0")]
38pub trait CommandExt: Sealed {
37pub impl(self) trait CommandExt {
3938 /// Sets the child process's user ID. This translates to a
4039 /// `setuid` call in the child process. Failure in the `setuid`
4140 /// call will cause the spawn to fail.
......@@ -291,7 +290,7 @@ impl CommandExt for process::Command {
291290/// This trait is sealed: it cannot be implemented outside the standard library.
292291/// This is so that future additional methods are not breaking changes.
293292#[stable(feature = "rust1", since = "1.0.0")]
294pub trait ExitStatusExt: Sealed {
293pub impl(self) trait ExitStatusExt {
295294 /// Creates a new `ExitStatus` or `ExitStatusError` from the raw underlying integer status
296295 /// value from `wait`
297296 ///
......@@ -393,7 +392,7 @@ impl ExitStatusExt for process::ExitStatusError {
393392}
394393
395394#[unstable(feature = "unix_send_signal", issue = "141975")]
396pub trait ChildExt: Sealed {
395pub impl(self) trait ChildExt {
397396 /// Sends a signal to a child process.
398397 ///
399398 /// # Errors
library/std/src/os/windows/ffi.rs+2-3
......@@ -58,7 +58,6 @@ use alloc::wtf8::Wtf8Buf;
5858use crate::ffi::{OsStr, OsString};
5959use crate::fmt;
6060use crate::iter::FusedIterator;
61use crate::sealed::Sealed;
6261use crate::sys::os_str::Buf;
6362use crate::sys::{AsInner, FromInner};
6463
......@@ -67,7 +66,7 @@ use crate::sys::{AsInner, FromInner};
6766/// This trait is sealed: it cannot be implemented outside the standard library.
6867/// This is so that future additional methods are not breaking changes.
6968#[stable(feature = "rust1", since = "1.0.0")]
70pub trait OsStringExt: Sealed {
69pub impl(self) trait OsStringExt {
7170 /// Creates an `OsString` from a potentially ill-formed UTF-16 slice of
7271 /// 16-bit code units.
7372 ///
......@@ -101,7 +100,7 @@ impl OsStringExt for OsString {
101100/// This trait is sealed: it cannot be implemented outside the standard library.
102101/// This is so that future additional methods are not breaking changes.
103102#[stable(feature = "rust1", since = "1.0.0")]
104pub trait OsStrExt: Sealed {
103pub impl(self) trait OsStrExt {
105104 /// Re-encodes an `OsStr` as a wide character sequence, i.e., potentially
106105 /// ill-formed UTF-16.
107106 ///
library/std/src/os/windows/fs.rs+4-14
......@@ -7,7 +7,6 @@
77use crate::fs::{self, Metadata, OpenOptions, Permissions};
88use crate::io::BorrowedCursor;
99use crate::path::Path;
10use crate::sealed::Sealed;
1110use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner};
1211use crate::time::SystemTime;
1312use crate::{io, sys};
......@@ -338,7 +337,7 @@ impl OpenOptionsExt for OpenOptions {
338337}
339338
340339#[unstable(feature = "windows_freeze_file_times", issue = "149715")]
341pub trait OpenOptionsExt2: Sealed {
340pub impl(self) trait OpenOptionsExt2 {
342341 /// If set to `true`, prevent the "last access time" of the file from being changed.
343342 ///
344343 /// Default to `false`.
......@@ -352,9 +351,6 @@ pub trait OpenOptionsExt2: Sealed {
352351 fn freeze_last_write_time(&mut self, freeze: bool) -> &mut Self;
353352}
354353
355#[unstable(feature = "sealed", issue = "none")]
356impl Sealed for OpenOptions {}
357
358354#[unstable(feature = "windows_freeze_file_times", issue = "149715")]
359355impl OpenOptionsExt2 for OpenOptions {
360356 fn freeze_last_access_time(&mut self, freeze: bool) -> &mut Self {
......@@ -398,7 +394,7 @@ impl OpenOptionsExt2 for OpenOptions {
398394/// assert_eq!(permissions.file_attributes(), new_file_attr);
399395/// ```
400396#[unstable(feature = "windows_permissions_ext", issue = "152956")]
401pub trait PermissionsExt: Sealed {
397pub impl(self) trait PermissionsExt {
402398 /// Returns the file attribute bits.
403399 #[unstable(feature = "windows_permissions_ext", issue = "152956")]
404400 fn file_attributes(&self) -> u32;
......@@ -412,9 +408,6 @@ pub trait PermissionsExt: Sealed {
412408 fn from_file_attributes(mask: u32) -> Self;
413409}
414410
415#[unstable(feature = "windows_permissions_ext", issue = "152956")]
416impl Sealed for fs::Permissions {}
417
418411#[unstable(feature = "windows_permissions_ext", issue = "152956")]
419412impl PermissionsExt for fs::Permissions {
420413 fn file_attributes(&self) -> u32 {
......@@ -656,7 +649,7 @@ impl MetadataExt for Metadata {
656649///
657650/// On Windows, a symbolic link knows whether it is a file or directory.
658651#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
659pub trait FileTypeExt: Sealed {
652pub impl(self) trait FileTypeExt {
660653 /// Returns `true` if this file type is a symbolic link that is also a directory.
661654 #[stable(feature = "windows_file_type_ext", since = "1.64.0")]
662655 fn is_symlink_dir(&self) -> bool;
......@@ -665,9 +658,6 @@ pub trait FileTypeExt: Sealed {
665658 fn is_symlink_file(&self) -> bool;
666659}
667660
668#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
669impl Sealed for fs::FileType {}
670
671661#[stable(feature = "windows_file_type_ext", since = "1.64.0")]
672662impl FileTypeExt for fs::FileType {
673663 fn is_symlink_dir(&self) -> bool {
......@@ -680,7 +670,7 @@ impl FileTypeExt for fs::FileType {
680670
681671/// Windows-specific extensions to [`fs::FileTimes`].
682672#[stable(feature = "file_set_times", since = "1.75.0")]
683pub trait FileTimesExt: Sealed {
673pub impl(self) trait FileTimesExt {
684674 /// Set the creation time of a file.
685675 #[stable(feature = "file_set_times", since = "1.75.0")]
686676 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 {
405405
406406macro_rules! impl_is_terminal {
407407 ($($t:ty),*$(,)?) => {$(
408 #[unstable(feature = "sealed", issue = "none")]
409 impl crate::sealed::Sealed for $t {}
410
411408 #[stable(feature = "is_terminal", since = "1.70.0")]
412409 impl io::IsTerminal for $t {
413410 #[inline]
library/std/src/os/windows/process.rs+4-5
......@@ -9,7 +9,6 @@ use crate::mem::MaybeUninit;
99use crate::os::windows::io::{
1010 AsHandle, AsRawHandle, BorrowedHandle, FromRawHandle, IntoRawHandle, OwnedHandle, RawHandle,
1111};
12use crate::sealed::Sealed;
1312use crate::sys::{AsInner, AsInnerMut, FromInner, IntoInner};
1413use crate::{io, marker, process, ptr, sys};
1514
......@@ -153,7 +152,7 @@ impl From<OwnedHandle> for process::ChildStderr {
153152/// This trait is sealed: it cannot be implemented outside the standard library.
154153/// This is so that future additional methods are not breaking changes.
155154#[stable(feature = "exit_status_from", since = "1.12.0")]
156pub trait ExitStatusExt: Sealed {
155pub impl(self) trait ExitStatusExt {
157156 /// Creates a new `ExitStatus` from the raw underlying `u32` return value of
158157 /// a process.
159158 #[stable(feature = "exit_status_from", since = "1.12.0")]
......@@ -172,7 +171,7 @@ impl ExitStatusExt for process::ExitStatus {
172171/// This trait is sealed: it cannot be implemented outside the standard library.
173172/// This is so that future additional methods are not breaking changes.
174173#[stable(feature = "windows_process_extensions", since = "1.16.0")]
175pub trait CommandExt: Sealed {
174pub impl(self) trait CommandExt {
176175 /// Sets the [process creation flags][1] to be passed to `CreateProcess`.
177176 ///
178177 /// These will always be ORed with `CREATE_UNICODE_ENVIRONMENT`.
......@@ -443,7 +442,7 @@ impl CommandExt for process::Command {
443442}
444443
445444#[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")]
446pub trait ChildExt: Sealed {
445pub impl(self) trait ChildExt {
447446 /// Extracts the main thread raw handle, without taking ownership
448447 #[unstable(feature = "windows_process_extensions_main_thread_handle", issue = "96723")]
449448 fn main_thread_handle(&self) -> BorrowedHandle<'_>;
......@@ -461,7 +460,7 @@ impl ChildExt for process::Child {
461460/// This trait is sealed: it cannot be implemented outside the standard library.
462461/// This is so that future additional methods are not breaking changes.
463462#[unstable(feature = "windows_process_exit_code_from", issue = "111688")]
464pub trait ExitCodeExt: Sealed {
463pub impl(self) trait ExitCodeExt {
465464 /// Creates a new `ExitCode` from the raw underlying `u32` return value of
466465 /// a process.
467466 ///
library/std/src/process.rs-20
......@@ -256,10 +256,6 @@ pub struct Child {
256256 pub stderr: Option<ChildStderr>,
257257}
258258
259/// Allows extension traits within `std`.
260#[unstable(feature = "sealed", issue = "none")]
261impl crate::sealed::Sealed for Child {}
262
263259impl AsInner<imp::Process> for Child {
264260 #[inline]
265261 fn as_inner(&self) -> &imp::Process {
......@@ -597,10 +593,6 @@ pub struct Command {
597593 inner: imp::Command,
598594}
599595
600/// Allows extension traits within `std`.
601#[unstable(feature = "sealed", issue = "none")]
602impl crate::sealed::Sealed for Command {}
603
604596impl Command {
605597 /// Constructs a new `Command` for launching the program at
606598 /// path `program`, with the following default configuration:
......@@ -1893,10 +1885,6 @@ impl Default for ExitStatus {
18931885 }
18941886}
18951887
1896/// Allows extension traits within `std`.
1897#[unstable(feature = "sealed", issue = "none")]
1898impl crate::sealed::Sealed for ExitStatus {}
1899
19001888impl ExitStatus {
19011889 /// Was termination successful? Returns a `Result`.
19021890 ///
......@@ -1999,10 +1987,6 @@ impl fmt::Display for ExitStatus {
19991987 }
20001988}
20011989
2002/// Allows extension traits within `std`.
2003#[unstable(feature = "sealed", issue = "none")]
2004impl crate::sealed::Sealed for ExitStatusError {}
2005
20061990/// Describes the result of a process after it has failed
20071991///
20081992/// Produced by the [`.exit_ok`](ExitStatus::exit_ok) method on [`ExitStatus`].
......@@ -2171,10 +2155,6 @@ impl crate::error::Error for ExitStatusError {}
21712155#[stable(feature = "process_exitcode", since = "1.61.0")]
21722156pub struct ExitCode(imp::ExitCode);
21732157
2174/// Allows extension traits within `std`.
2175#[unstable(feature = "sealed", issue = "none")]
2176impl crate::sealed::Sealed for ExitCode {}
2177
21782158#[stable(feature = "process_exitcode", since = "1.61.0")]
21792159impl ExitCode {
21802160 /// 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 {
318318 // An alternative would be to require CAP_SETGID (in
319319 // addition to CAP_SETUID) for setting the UID.
320320 if e.raw_os_error() != Some(libc::EPERM) {
321 return Err(e.into());
321 return Err(e);
322322 }
323323 }
324324 }
library/std/src/sys/stdio/motor.rs-2
......@@ -28,8 +28,6 @@ impl Stderr {
2828 }
2929}
3030
31impl crate::sealed::Sealed for Stdin {}
32
3331impl crate::io::IsTerminal for Stdin {
3432 fn is_terminal(&self) -> bool {
3533 moto_rt::fs::is_terminal(moto_rt::FD_STDIN)
src/librustdoc/build.rs+2-5
......@@ -55,12 +55,9 @@ fn main() {
5555 let minified_path = std::path::PathBuf::from(format!("{out_dir}/{path}.min"));
5656 if path.ends_with(".js") || path.ends_with(".css") {
5757 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()
6259 } 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()
6461 };
6562 std::fs::write(&minified_path, minified.as_bytes()).expect("write to out_dir");
6663 } else {
src/librustdoc/clean/auto_trait.rs+1-1
......@@ -202,7 +202,7 @@ fn clean_param_env<'tcx>(
202202 .collect();
203203
204204 let mut generics = clean::Generics { params, where_predicates };
205 simplify::sized_bounds(cx, &mut generics);
205 simplify::sizedness_bounds(cx, &mut generics);
206206 generics.where_predicates = simplify::where_clauses(cx.tcx, generics.where_predicates);
207207 generics
208208}
src/librustdoc/clean/mod.rs+1-1
......@@ -988,7 +988,7 @@ fn clean_ty_generics_inner<'tcx>(
988988 where_predicates.into_iter().flat_map(|p| clean_predicate(*p, cx)).collect();
989989
990990 let mut generics = Generics { params, where_predicates };
991 simplify::sized_bounds(cx, &mut generics);
991 simplify::sizedness_bounds(cx, &mut generics);
992992 generics.where_predicates = simplify::where_clauses(cx.tcx, generics.where_predicates);
993993 generics
994994}
src/librustdoc/clean/simplify.rs+58-36
......@@ -13,7 +13,7 @@
1313
1414use rustc_data_structures::fx::FxIndexMap;
1515use rustc_data_structures::thin_vec::ThinVec;
16use rustc_data_structures::unord::UnordSet;
16use rustc_hir as hir;
1717use rustc_hir::def_id::DefId;
1818use rustc_middle::ty::{TyCtxt, Unnormalized};
1919
......@@ -121,50 +121,72 @@ fn trait_is_same_or_supertrait(tcx: TyCtxt<'_>, child: DefId, trait_: DefId) ->
121121 .any(|did| trait_is_same_or_supertrait(tcx, did, trait_))
122122}
123123
124pub(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`.
129pub(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();
126143
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.
139144 generics.where_predicates.retain(|pred| {
140145 let WP::BoundPredicate { ty: clean::Generic(param), bounds, .. } = pred else {
141146 return true;
142147 };
143148
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;
153171 }
172
173 false
154174 });
155175
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 });
168190 }
169191}
170192
src/librustdoc/clean/types.rs+4-7
......@@ -1201,11 +1201,8 @@ impl GenericBound {
12011201 }
12021202
12031203 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)
12091206 {
12101207 return true;
12111208 }
......@@ -1213,8 +1210,8 @@ impl GenericBound {
12131210 }
12141211
12151212 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())
12181215 } else {
12191216 None
12201217 }
src/librustdoc/html/static/css/rustdoc.css+6-6
......@@ -731,7 +731,8 @@ ul.block, .block li, .block ul {
731731}
732732
733733.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));
735736}
736737
737738.sidebar-elems a,
......@@ -740,7 +741,7 @@ ul.block, .block li, .block ul {
740741 padding: 0.25rem; /* 4px */
741742 margin-right: 0.25rem;
742743 /* 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));
744745 margin-left: calc(-0.25rem - var(--sidebar-elems-left-padding));
745746 background-clip: border-box;
746747}
......@@ -861,7 +862,7 @@ ul.block, .block li, .block ul {
861862 | └─────┘
862863 */
863864 margin-top: -16px;
864 border-top: solid 16px transparent;
865 padding-top: 16px;
865866 box-sizing: content-box;
866867 position: relative;
867868 background-clip: border-box;
......@@ -870,8 +871,6 @@ ul.block, .block li, .block ul {
870871
871872.sidebar-crate h2 a {
872873 display: block;
873 /* extend click target to far edge of screen (mile wide bar) */
874 border-left: solid var(--sidebar-elems-left-padding) transparent;
875874 background-clip: border-box;
876875 margin: 0 calc(-24px + 0.25rem) 0 calc(-0.2rem - var(--sidebar-elems-left-padding));
877876 /* Align the sidebar crate link with the search bar, which have different
......@@ -888,7 +887,8 @@ ul.block, .block li, .block ul {
888887 x = ( 16px - 0.57rem ) / 2
889888 */
890889 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));
892892}
893893
894894.sidebar-crate h2 .version {
tests/rustdoc-gui/huge-logo.goml+1-1
......@@ -7,4 +7,4 @@ set-window-size: (1280, 1024)
77assert-property: (".sidebar-crate .logo-container", {"offsetWidth": "96", "offsetHeight": 48})
88// offsetWidth = width of sidebar, offsetHeight = height + top padding
99assert-property: (".sidebar-crate .logo-container img", {"offsetWidth": "48", "offsetHeight": 64})
10assert-css: (".sidebar-crate .logo-container img", {"border-top-width": "16px", "margin-top": "-16px"})
10assert-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 @@
1pub fn sized_param<T>() {}
2
3pub fn relaxed_sized_on_param<T: ?Sized>() {}
4
5pub trait SizedOnParentParam<T: ?Sized> {
6 fn func() where T: Sized;
7}
8
9pub trait SizedSelf: Sized {}
10
11pub 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
3pub 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
14pub 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"]'
15pub use issue_24183::U;
16
17//@ has usr/trait.S.html
18//@ has - '//*[@class="rust item-decl"]' 'pub trait S: Sized {'
19pub 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
5extern 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"
13pub 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"
21pub 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"
36pub 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 {'
43pub 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"
57pub 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
1818LL | #[unsafe(naked)]
1919 | ^^^^^^^^^^^^^^^^
2020 |
21 = help: `#[naked]` can be applied to functions and methods
21 = help: `#[naked]` can only be applied to functions with a body
2222
2323error: `#[naked]` attribute cannot be used on structs
2424 --> $DIR/naked-invalid-attr.rs:14:1
......@@ -42,7 +42,7 @@ error: `#[naked]` attribute cannot be used on required trait methods
4242LL | #[unsafe(naked)]
4343 | ^^^^^^^^^^^^^^^^
4444 |
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
4646
4747error: `#[naked]` attribute cannot be used on closures
4848 --> $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
22// Regression test for https://github.com/rust-lang/rust/issues/145779
33#![warn(unused_attributes)]
4#![feature(sanitize)]
45
56fn main() {
67 #[export_name = "x"]
......@@ -72,6 +73,8 @@ fn main() {
7273 #[link_name = "x"]
7374 //~^ WARN attribute cannot be used on macro calls
7475 //~| WARN previously accepted
76 #[sanitize(address = "off")]
77 //~^ ERROR attribute cannot be used on macro calls
7578 unreachable!();
7679
7780 #[repr()]
tests/ui/attributes/attr-on-mac-call.stderr+40-32
......@@ -1,5 +1,13 @@
1error: `#[sanitize]` attribute cannot be used on macro calls
2 --> $DIR/attr-on-mac-call.rs:76:5
3 |
4LL | #[sanitize(address = "off")]
5 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6 |
7 = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics
8
19warning: `#[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
311 |
412LL | #[export_name = "x"]
513 | ^^^^^^^^^^^^^^^^^^^^
......@@ -13,7 +21,7 @@ LL | #![warn(unused_attributes)]
1321 | ^^^^^^^^^^^^^^^^^
1422
1523warning: `#[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
1725 |
1826LL | #[unsafe(naked)]
1927 | ^^^^^^^^^^^^^^^^
......@@ -22,7 +30,7 @@ LL | #[unsafe(naked)]
2230 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2331
2432warning: `#[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
2634 |
2735LL | #[track_caller]
2836 | ^^^^^^^^^^^^^^^
......@@ -31,7 +39,7 @@ LL | #[track_caller]
3139 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3240
3341warning: `#[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
3543 |
3644LL | #[used]
3745 | ^^^^^^^
......@@ -40,7 +48,7 @@ LL | #[used]
4048 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
4149
4250warning: `#[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
4452 |
4553LL | #[target_feature(enable = "x")]
4654 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -49,7 +57,7 @@ LL | #[target_feature(enable = "x")]
4957 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5058
5159warning: `#[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
5361 |
5462LL | #[deprecated]
5563 | ^^^^^^^^^^^^^
......@@ -58,7 +66,7 @@ LL | #[deprecated]
5866 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5967
6068warning: `#[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
6270 |
6371LL | #[inline]
6472 | ^^^^^^^^^
......@@ -67,7 +75,7 @@ LL | #[inline]
6775 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
6876
6977warning: `#[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
7179 |
7280LL | #[link_name = "x"]
7381 | ^^^^^^^^^^^^^^^^^^
......@@ -76,7 +84,7 @@ LL | #[link_name = "x"]
7684 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
7785
7886warning: `#[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
8088 |
8189LL | #[link_section = "__TEXT,__text"]
8290 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -85,7 +93,7 @@ LL | #[link_section = "__TEXT,__text"]
8593 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
8694
8795warning: `#[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
8997 |
9098LL | #[link_ordinal(42)]
9199 | ^^^^^^^^^^^^^^^^^^^
......@@ -94,7 +102,7 @@ LL | #[link_ordinal(42)]
94102 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
95103
96104warning: `#[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
98106 |
99107LL | #[non_exhaustive]
100108 | ^^^^^^^^^^^^^^^^^
......@@ -103,7 +111,7 @@ LL | #[non_exhaustive]
103111 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
104112
105113warning: `#[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
107115 |
108116LL | #[proc_macro]
109117 | ^^^^^^^^^^^^^
......@@ -112,7 +120,7 @@ LL | #[proc_macro]
112120 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
113121
114122warning: `#[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
116124 |
117125LL | #[cold]
118126 | ^^^^^^^
......@@ -121,7 +129,7 @@ LL | #[cold]
121129 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
122130
123131warning: `#[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
125133 |
126134LL | #[no_mangle]
127135 | ^^^^^^^^^^^^
......@@ -130,7 +138,7 @@ LL | #[no_mangle]
130138 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
131139
132140warning: `#[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
134142 |
135143LL | #[deprecated]
136144 | ^^^^^^^^^^^^^
......@@ -139,7 +147,7 @@ LL | #[deprecated]
139147 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
140148
141149warning: `#[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
143151 |
144152LL | #[automatically_derived]
145153 | ^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -148,7 +156,7 @@ LL | #[automatically_derived]
148156 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
149157
150158warning: `#[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
152160 |
153161LL | #[macro_use]
154162 | ^^^^^^^^^^^^
......@@ -157,7 +165,7 @@ LL | #[macro_use]
157165 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
158166
159167warning: `#[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
161169 |
162170LL | #[must_use]
163171 | ^^^^^^^^^^^
......@@ -166,7 +174,7 @@ LL | #[must_use]
166174 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
167175
168176warning: `#[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
170178 |
171179LL | #[no_implicit_prelude]
172180 | ^^^^^^^^^^^^^^^^^^^^^^
......@@ -175,7 +183,7 @@ LL | #[no_implicit_prelude]
175183 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
176184
177185warning: `#[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
179187 |
180188LL | #[path = ""]
181189 | ^^^^^^^^^^^^
......@@ -184,7 +192,7 @@ LL | #[path = ""]
184192 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
185193
186194warning: `#[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
188196 |
189197LL | #[ignore]
190198 | ^^^^^^^^^
......@@ -193,7 +201,7 @@ LL | #[ignore]
193201 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
194202
195203warning: `#[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
197205 |
198206LL | #[should_panic]
199207 | ^^^^^^^^^^^^^^^
......@@ -202,7 +210,7 @@ LL | #[should_panic]
202210 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
203211
204212warning: `#[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
206214 |
207215LL | #[link_name = "x"]
208216 | ^^^^^^^^^^^^^^^^^^
......@@ -211,7 +219,7 @@ LL | #[link_name = "x"]
211219 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
212220
213221warning: `#[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
215223 |
216224LL | #[repr()]
217225 | ^^^^^^^^^
......@@ -220,7 +228,7 @@ LL | #[repr()]
220228 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
221229
222230warning: unused attribute
223 --> $DIR/attr-on-mac-call.rs:77:5
231 --> $DIR/attr-on-mac-call.rs:80:5
224232 |
225233LL | #[repr()]
226234 | ^^^^^^^^^ help: remove this attribute
......@@ -228,7 +236,7 @@ LL | #[repr()]
228236 = note: using `repr` with an empty list has no effect
229237
230238warning: `#[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
232240 |
233241LL | #[repr(u8)]
234242 | ^^^^^^^^^^^
......@@ -237,7 +245,7 @@ LL | #[repr(u8)]
237245 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
238246
239247warning: `#[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
241249 |
242250LL | #[repr(align(8))]
243251 | ^^^^^^^^^^^^^^^^^
......@@ -246,7 +254,7 @@ LL | #[repr(align(8))]
246254 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
247255
248256warning: `#[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
250258 |
251259LL | #[repr(packed)]
252260 | ^^^^^^^^^^^^^^^
......@@ -255,7 +263,7 @@ LL | #[repr(packed)]
255263 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
256264
257265warning: `#[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
259267 |
260268LL | #[repr(C)]
261269 | ^^^^^^^^^^
......@@ -264,7 +272,7 @@ LL | #[repr(C)]
264272 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
265273
266274warning: `#[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
268276 |
269277LL | #[repr(Rust)]
270278 | ^^^^^^^^^^^^^
......@@ -273,7 +281,7 @@ LL | #[repr(Rust)]
273281 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
274282
275283warning: `#[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
277285 |
278286LL | #[repr(simd)]
279287 | ^^^^^^^^^^^^^
......@@ -281,5 +289,5 @@ LL | #[repr(simd)]
281289 = help: `#[repr(simd)]` can only be applied to structs
282290 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
283291
284warning: 31 warnings emitted
292error: aborting due to 1 previous error; 31 warnings emitted
285293
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
44LL | #[cold]
55 | ^^^^^^^
66 |
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
88 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
99note: the lint level is defined here
1010 --> $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
1818LL | #[link_section = "__TEXT,__text"]
1919 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020 |
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
2222 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2323
2424error: `#[linkage]` attribute cannot be used on required trait methods
......@@ -27,7 +27,7 @@ error: `#[linkage]` attribute cannot be used on required trait methods
2727LL | #[linkage = "common"]
2828 | ^^^^^^^^^^^^^^^^^^^^^
2929 |
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
3131 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
3232
3333error: 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
4646LL | #[coverage(off)]
4747 | ^^^^^^^^^^^^^^^^
4848 |
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
5050
5151error: `#[coverage]` attribute cannot be used on required trait methods
5252 --> $DIR/allowed-positions.rs:31:5
......@@ -54,7 +54,7 @@ error: `#[coverage]` attribute cannot be used on required trait methods
5454LL | #[coverage(off)]
5555 | ^^^^^^^^^^^^^^^^
5656 |
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
5858
5959error: `#[coverage]` attribute cannot be used on associated types
6060 --> $DIR/allowed-positions.rs:39:5
......@@ -110,7 +110,7 @@ error: `#[coverage]` attribute cannot be used on foreign functions
110110LL | #[coverage(off)]
111111 | ^^^^^^^^^^^^^^^^
112112 |
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
114114
115115error: `#[coverage]` attribute cannot be used on statements
116116 --> $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 {
1111 const ANOTHER_MACRO_DERIVED: () = ();
1212 };
1313 }
14 .into()
1514}
1615
1716#[proc_macro_attribute]
......@@ -24,7 +23,6 @@ pub fn pointee(
2423 const POINTEE_MACRO_ATTR_DERIVED: () = ();
2524 };
2625 }
27 .into()
2826}
2927
3028#[proc_macro_attribute]
......@@ -37,5 +35,4 @@ pub fn default(
3735 const DEFAULT_MACRO_ATTR_DERIVED: () = ();
3836 };
3937 }
40 .into()
4138}
tests/ui/extern/extern-no-mangle.stderr+1-1
......@@ -18,7 +18,7 @@ warning: `#[no_mangle]` attribute cannot be used on foreign functions
1818LL | #[no_mangle]
1919 | ^^^^^^^^^^^^
2020 |
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
2222 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2323
2424warning: `#[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
206206LL | #[export_name = "2200"] fn foo();
207207 | ^^^^^^^^^^^^^^^^^^^^^^^
208208 |
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
210210
211211error: `#[repr(C)]` attribute cannot be used on modules
212212 --> $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
447447LL | #[no_mangle] fn foo();
448448 | ^^^^^^^^^^^^
449449 |
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
451451 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
452452
453453warning: `#[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
859859LL | #[link_section = ",1800"]
860860 | ^^^^^^^^^^^^^^^^^^^^^^^^^
861861 |
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
863863 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
864864
865865warning: `#[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
134134LL | #[rustc_force_inline]
135135 | ^^^^^^^^^^^^^^^^^^^^^
136136 |
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
138138
139139error: `#[rustc_force_inline]` attribute cannot be used on type aliases
140140 --> $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
44LL | #[inline]
55 | ^^^^^^^^^
66 |
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
88 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
99note: the lint level is defined here
1010 --> $DIR/warn-unused-inline-on-fn-prototypes.rs:1:9
......@@ -18,7 +18,7 @@ error: `#[inline]` attribute cannot be used on foreign functions
1818LL | #[inline]
1919 | ^^^^^^^^^
2020 |
21 = help: `#[inline]` can be applied to closures, functions, and methods
21 = help: `#[inline]` can only be applied to functions with a body
2222 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
2323
2424error: aborting due to 2 previous errors
tests/ui/privacy/sealed-traits/auxiliary/private-trait-non-local-aux.rs created+5
......@@ -0,0 +1,5 @@
1pub 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 @@
1extern crate core;
2use core::slice::index::private_slice_index::Sealed; //~ ERROR module `index` is private
3fn main() {
4}
1//@ aux-build: private-trait-non-local-aux.rs
2
3extern crate private_trait_non_local_aux as aux;
4use aux::a::b::Sealed; //~ ERROR module `b` is private
5
6fn main() {}
tests/ui/privacy/sealed-traits/private-trait-non-local.stderr+11-6
......@@ -1,11 +1,16 @@
1error[E0603]: module `index` is private
2 --> $DIR/private-trait-non-local.rs:2:18
1error[E0603]: module `b` is private
2 --> $DIR/private-trait-non-local.rs:4:13
33 |
4LL | use core::slice::index::private_slice_index::Sealed;
5 | ^^^^^ private module ------ trait `Sealed` is not publicly re-exported
4LL | use aux::a::b::Sealed;
5 | ^ ------ trait `Sealed` is not publicly re-exported
6 | |
7 | private module
68 |
7note: the module `index` is defined here
8 --> $SRC_DIR/core/src/slice/mod.rs:LL:COL
9note: the module `b` is defined here
10 --> $DIR/auxiliary/private-trait-non-local-aux.rs:2:5
11 |
12LL | mod b {
13 | ^^^^^
914
1015error: aborting due to 1 previous error
1116
tests/ui/process/process-panic-after-fork.rs+1-1
......@@ -142,7 +142,7 @@ fn main() {
142142 let mut status: c_int = 0;
143143 let got = unsafe { libc::waitpid(child, &mut status, 0) };
144144 assert_eq!(got, child);
145 let status = ExitStatus::from_raw(status.into());
145 let status = ExitStatus::from_raw(status);
146146 status
147147 }
148148
tests/ui/resolve/proc_macro_generated_packed.rs+1-1
......@@ -1,6 +1,6 @@
11//! This test ICEs because the `repr(packed)` attribute
22//! was generated by a proc macro, so `#[derive]` didn't see it.
3//@ ignore-parallel-frontend failed to collect active jobs
3
44//@proc-macro: proc_macro_generate_packed.rs
55//@known-bug: #120873
66//@ failure-status: 101
tests/ui/sanitize-attr/valid-sanitize.rs+18-18
......@@ -12,27 +12,27 @@ mod submod {}
1212#[sanitize(address = "off")]
1313static FOO: u32 = 0;
1414
15#[sanitize(thread = "off")] //~ ERROR sanitize attribute not allowed here
15#[sanitize(thread = "off")] //~ ERROR attribute cannot be used on
1616static BAR: u32 = 0;
1717
18#[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
18#[sanitize(address = "off")] //~ ERROR attribute cannot be used on
1919type MyTypeAlias = ();
2020
21#[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
21#[sanitize(address = "off")] //~ ERROR attribute cannot be used on
2222trait MyTrait {
23 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
23 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
2424 const TRAIT_ASSOC_CONST: u32;
2525
26 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
26 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
2727 type TraitAssocType;
2828
29 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
29 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
3030 fn trait_method(&self);
3131
3232 #[sanitize(address = "off", thread = "on")]
3333 fn trait_method_with_default(&self) {}
3434
35 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
35 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
3636 fn trait_assoc_fn();
3737}
3838
......@@ -40,7 +40,7 @@ trait MyTrait {
4040impl MyTrait for () {
4141 const TRAIT_ASSOC_CONST: u32 = 0;
4242
43 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
43 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
4444 type TraitAssocType = Self;
4545
4646 #[sanitize(address = "off", thread = "on")]
......@@ -57,14 +57,14 @@ trait HasAssocType {
5757}
5858
5959impl HasAssocType for () {
60 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
60 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
6161 type T = impl Copy;
6262 fn constrain_assoc_type() -> Self::T {}
6363}
6464
65#[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
65#[sanitize(address = "off")] //~ ERROR attribute cannot be used on
6666struct MyStruct {
67 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
67 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
6868 field: u32,
6969}
7070
......@@ -77,25 +77,25 @@ impl MyStruct {
7777}
7878
7979extern "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
8181 static X: u32;
8282
83 #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here
83 #[sanitize(address = "off", thread = "on")] //~ ERROR attribute cannot be used on
8484 type T;
8585
86 #[sanitize(address = "off", thread = "on")] //~ ERROR sanitize attribute not allowed here
86 #[sanitize(address = "off", thread = "on")] //~ ERROR attribute cannot be used on
8787 fn foreign_fn();
8888}
8989
9090#[sanitize(address = "off", thread = "on")]
9191fn 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
9393 let _ = ();
9494
9595 // Currently not allowed on let statements, even if they bind to a closure.
9696 // It might be nice to support this as a special case someday, but trying
9797 // 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
9999 let _let_closure = || ();
100100
101101 // In situations where attributes can already be applied to expressions,
......@@ -106,10 +106,10 @@ fn main() {
106106 };
107107
108108 match () {
109 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
109 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
110110 () => (),
111111 }
112112
113 #[sanitize(address = "off")] //~ ERROR sanitize attribute not allowed here
113 #[sanitize(address = "off")] //~ ERROR attribute cannot be used on
114114 return ();
115115}
tests/ui/sanitize-attr/valid-sanitize.stderr+72-116
......@@ -1,190 +1,146 @@
1error: sanitize attribute not allowed here
1error: `#[sanitize(thread = ...)]` attribute cannot be used on statics
22 --> $DIR/valid-sanitize.rs:15:1
33 |
44LL | #[sanitize(thread = "off")]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6LL | static BAR: u32 = 0;
7 | -------------------- not a function, impl block, or module
86 |
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
108
11error: sanitize attribute not allowed here
9error: `#[sanitize]` attribute cannot be used on type aliases
1210 --> $DIR/valid-sanitize.rs:18:1
1311 |
1412LL | #[sanitize(address = "off")]
1513 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16LL | type MyTypeAlias = ();
17 | ---------------------- not a function, impl block, or module
1814 |
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
2016
21error: sanitize attribute not allowed here
17error: `#[sanitize]` attribute cannot be used on traits
2218 --> $DIR/valid-sanitize.rs:21:1
2319 |
24LL | #[sanitize(address = "off")]
25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26LL | / trait MyTrait {
27LL | | #[sanitize(address = "off")]
28LL | | const TRAIT_ASSOC_CONST: u32;
29... |
30LL | | fn trait_assoc_fn();
31LL | | }
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
36error: sanitize attribute not allowed here
37 --> $DIR/valid-sanitize.rs:65:1
38 |
39LL | #[sanitize(address = "off")]
40 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41LL | / struct MyStruct {
42LL | | #[sanitize(address = "off")]
43LL | | field: u32,
44LL | | }
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
49error: sanitize attribute not allowed here
50 --> $DIR/valid-sanitize.rs:67:5
51 |
52LL | #[sanitize(address = "off")]
53 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54LL | 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
59error: sanitize attribute not allowed here
60 --> $DIR/valid-sanitize.rs:92:5
61 |
62LL | #[sanitize(address = "off", thread = "on")]
63 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64LL | let _ = ();
65 | ----------- not a function, impl block, or module
20LL | #[sanitize(address = "off")]
21 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6622 |
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
6824
69error: sanitize attribute not allowed here
70 --> $DIR/valid-sanitize.rs:98:5
25error: `#[sanitize]` attribute cannot be used on associated consts
26 --> $DIR/valid-sanitize.rs:23:5
7127 |
7228LL | #[sanitize(address = "off")]
7329 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
74LL | 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
79error: sanitize attribute not allowed here
80 --> $DIR/valid-sanitize.rs:109:9
81 |
82LL | #[sanitize(address = "off")]
83 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84LL | () => (),
85 | -------- not a function, impl block, or module
8630 |
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
8832
89error: sanitize attribute not allowed here
90 --> $DIR/valid-sanitize.rs:113:5
33error: `#[sanitize]` attribute cannot be used on associated types
34 --> $DIR/valid-sanitize.rs:26:5
9135 |
9236LL | #[sanitize(address = "off")]
9337 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
94LL | return ();
95 | --------- not a function, impl block, or module
9638 |
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
9840
99error: sanitize attribute not allowed here
100 --> $DIR/valid-sanitize.rs:23:5
41error: `#[sanitize]` attribute cannot be used on required trait methods
42 --> $DIR/valid-sanitize.rs:29:5
10143 |
10244LL | #[sanitize(address = "off")]
10345 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
104LL | const TRAIT_ASSOC_CONST: u32;
105 | ----------------------------- not a function, impl block, or module
10646 |
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
10848
109error: sanitize attribute not allowed here
110 --> $DIR/valid-sanitize.rs:26:5
49error: `#[sanitize]` attribute cannot be used on required trait methods
50 --> $DIR/valid-sanitize.rs:35:5
11151 |
11252LL | #[sanitize(address = "off")]
11353 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114LL | type TraitAssocType;
115 | -------------------- not a function, impl block, or module
11654 |
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
11856
119error: sanitize attribute not allowed here
120 --> $DIR/valid-sanitize.rs:29:5
57error: `#[sanitize]` attribute cannot be used on associated types
58 --> $DIR/valid-sanitize.rs:43:5
12159 |
12260LL | #[sanitize(address = "off")]
12361 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124LL | fn trait_method(&self);
125 | ----------------------- function has no body
12662 |
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
12864
129error: sanitize attribute not allowed here
130 --> $DIR/valid-sanitize.rs:35:5
65error: `#[sanitize]` attribute cannot be used on associated types
66 --> $DIR/valid-sanitize.rs:60:5
13167 |
13268LL | #[sanitize(address = "off")]
13369 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134LL | fn trait_assoc_fn();
135 | -------------------- function has no body
13670 |
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
13872
139error: sanitize attribute not allowed here
140 --> $DIR/valid-sanitize.rs:43:5
73error: `#[sanitize]` attribute cannot be used on structs
74 --> $DIR/valid-sanitize.rs:65:1
14175 |
142LL | #[sanitize(address = "off")]
143 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144LL | type TraitAssocType = Self;
145 | --------------------------- not a function, impl block, or module
76LL | #[sanitize(address = "off")]
77 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14678 |
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
14880
149error: sanitize attribute not allowed here
150 --> $DIR/valid-sanitize.rs:60:5
81error: `#[sanitize]` attribute cannot be used on struct fields
82 --> $DIR/valid-sanitize.rs:67:5
15183 |
15284LL | #[sanitize(address = "off")]
15385 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154LL | type T = impl Copy;
155 | ------------------- not a function, impl block, or module
15686 |
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
15888
159error: sanitize attribute not allowed here
89error: `#[sanitize]` attribute cannot be used on foreign statics
16090 --> $DIR/valid-sanitize.rs:80:5
16191 |
16292LL | #[sanitize(address = "off", thread = "on")]
16393 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
164LL | static X: u32;
165 | -------------- not a function, impl block, or module
16694 |
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
16896
169error: sanitize attribute not allowed here
97error: `#[sanitize]` attribute cannot be used on foreign types
17098 --> $DIR/valid-sanitize.rs:83:5
17199 |
172100LL | #[sanitize(address = "off", thread = "on")]
173101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
174LL | type T;
175 | ------- not a function, impl block, or module
176102 |
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
178104
179error: sanitize attribute not allowed here
105error: `#[sanitize]` attribute cannot be used on foreign functions
180106 --> $DIR/valid-sanitize.rs:86:5
181107 |
182108LL | #[sanitize(address = "off", thread = "on")]
183109 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
184LL | fn foreign_fn();
185 | ---------------- function has no body
186110 |
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
113error: `#[sanitize]` attribute cannot be used on statements
114 --> $DIR/valid-sanitize.rs:92:5
115 |
116LL | #[sanitize(address = "off", thread = "on")]
117 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
118 |
119 = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics
120
121error: `#[sanitize]` attribute cannot be used on statements
122 --> $DIR/valid-sanitize.rs:98:5
123 |
124LL | #[sanitize(address = "off")]
125 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126 |
127 = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics
128
129error: `#[sanitize]` attribute cannot be used on match arms
130 --> $DIR/valid-sanitize.rs:109:9
131 |
132LL | #[sanitize(address = "off")]
133 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134 |
135 = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics
136
137error: `#[sanitize]` attribute cannot be used on expressions
138 --> $DIR/valid-sanitize.rs:113:5
139 |
140LL | #[sanitize(address = "off")]
141 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
142 |
143 = help: `#[sanitize]` can be applied to crates, functions, impl blocks, modules, and statics
188144
189145error: aborting due to 18 previous errors
190146
triagebot.toml+1
......@@ -1497,6 +1497,7 @@ libs = [
14971497 "@joboet",
14981498 "@nia-e",
14991499 "@LawnGnome",
1500 "@clarfonthey",
15001501]
15011502infra-ci = [
15021503 "@Mark-Simulacrum",