| author | bors <bors@rust-lang.org> 2026-03-27 22:53:19 UTC |
| committer | bors <bors@rust-lang.org> 2026-03-27 22:53:19 UTC |
| log | e1613686e0efc80a1a18b1263625450a8de3fb04 |
| tree | eba27badc93efacc91107f23de91f7448eb35e82 |
| parent | fda6d37bb88ee12fd50fa54d15859f1f91b74f55 |
| parent | 59d86097fe1a0c48eb9384afe8af09e7812d0991 |
Rollup of 10 pull requests
Successful merges:
- rust-lang/rust#154070 (Unstable book options parser)
- rust-lang/rust#154371 (Use LocalDefId for more tcx method calls)
- rust-lang/rust#154405 (Improve doc comment unicode guidance)
- rust-lang/rust#154431 (Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…)
- rust-lang/rust#153528 (Fix LegacyKeyValueFormat report from docker build: mips)
- rust-lang/rust#154246 (Add test for issue rust-lang/rust#101532: dead code warnings in const _)
- rust-lang/rust#154421 (Rustdoc rejects html emits with json output)
- rust-lang/rust#154428 (bootstrap: `-Zjson-target-spec` for synthetic targets)
- rust-lang/rust#154437 (bootstrap.example.toml: Hint how to allow `build.warnings`)
- rust-lang/rust#154454 (fix: [rustfmt] prevent panic when rewritng associated item delegations)
Failed merges:
- rust-lang/rust#154450 (Use the normal arg-parsing machinery for `-Zassert-incr-state`)55 files changed, 1163 insertions(+), 692 deletions(-)
Cargo.lock+2| ... | ... | @@ -6088,6 +6088,8 @@ name = "unstable-book-gen" |
| 6088 | 6088 | version = "0.1.0" |
| 6089 | 6089 | dependencies = [ |
| 6090 | 6090 | "num-traits", |
| 6091 | "proc-macro2", | |
| 6092 | "syn 2.0.110", | |
| 6091 | 6093 | "tidy", |
| 6092 | 6094 | ] |
| 6093 | 6095 |
bootstrap.example.toml+2-1| ... | ... | @@ -826,7 +826,8 @@ |
| 826 | 826 | # in the sysroot. It is required for running nvptx tests. |
| 827 | 827 | #rust.llvm-bitcode-linker = false |
| 828 | 828 | |
| 829 | # Whether to deny warnings in crates | |
| 829 | # Whether to deny warnings in crates. Set to `false` to avoid | |
| 830 | # error: warnings are denied by `build.warnings` configuration | |
| 830 | 831 | #rust.deny-warnings = true |
| 831 | 832 | |
| 832 | 833 | # Print backtrace on internal compiler errors during bootstrap |
compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs+2-4| ... | ... | @@ -1569,10 +1569,8 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { |
| 1569 | 1569 | let tcx = self.infcx.tcx; |
| 1570 | 1570 | let generics = tcx.generics_of(self.mir_def_id()); |
| 1571 | 1571 | |
| 1572 | let Some(hir_generics) = tcx | |
| 1573 | .typeck_root_def_id(self.mir_def_id().to_def_id()) | |
| 1574 | .as_local() | |
| 1575 | .and_then(|def_id| tcx.hir_get_generics(def_id)) | |
| 1572 | let Some(hir_generics) = | |
| 1573 | tcx.hir_get_generics(tcx.typeck_root_def_id_local(self.mir_def_id())) | |
| 1576 | 1574 | else { |
| 1577 | 1575 | return; |
| 1578 | 1576 | }; |
compiler/rustc_borrowck/src/diagnostics/mod.rs+3-6| ... | ... | @@ -1274,12 +1274,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> { |
| 1274 | 1274 | if let ty::Param(param_ty) = *self_ty.kind() |
| 1275 | 1275 | && let generics = self.infcx.tcx.generics_of(self.mir_def_id()) |
| 1276 | 1276 | && let param = generics.type_param(param_ty, self.infcx.tcx) |
| 1277 | && let Some(hir_generics) = self | |
| 1278 | .infcx | |
| 1279 | .tcx | |
| 1280 | .typeck_root_def_id(self.mir_def_id().to_def_id()) | |
| 1281 | .as_local() | |
| 1282 | .and_then(|def_id| self.infcx.tcx.hir_get_generics(def_id)) | |
| 1277 | && let Some(hir_generics) = self.infcx.tcx.hir_get_generics( | |
| 1278 | self.infcx.tcx.typeck_root_def_id_local(self.mir_def_id()), | |
| 1279 | ) | |
| 1283 | 1280 | && let spans = hir_generics |
| 1284 | 1281 | .predicates |
| 1285 | 1282 | .iter() |
compiler/rustc_borrowck/src/universal_regions.rs+7-11| ... | ... | @@ -476,12 +476,10 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { |
| 476 | 476 | let mut indices = self.compute_indices(fr_static, defining_ty); |
| 477 | 477 | debug!("build: indices={:?}", indices); |
| 478 | 478 | |
| 479 | let typeck_root_def_id = self.infcx.tcx.typeck_root_def_id(self.mir_def.to_def_id()); | |
| 480 | ||
| 481 | 479 | // If this is a 'root' body (not a closure/coroutine/inline const), then |
| 482 | 480 | // there are no extern regions, so the local regions start at the same |
| 483 | 481 | // position as the (empty) sub-list of extern regions |
| 484 | let first_local_index = if self.mir_def.to_def_id() == typeck_root_def_id { | |
| 482 | let first_local_index = if !self.infcx.tcx.is_typeck_child(self.mir_def.to_def_id()) { | |
| 485 | 483 | first_extern_index |
| 486 | 484 | } else { |
| 487 | 485 | // If this is a closure, coroutine, or inline-const, then the late-bound regions from the enclosing |
| ... | ... | @@ -583,7 +581,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { |
| 583 | 581 | /// see `DefiningTy` for details. |
| 584 | 582 | fn defining_ty(&self) -> DefiningTy<'tcx> { |
| 585 | 583 | let tcx = self.infcx.tcx; |
| 586 | let typeck_root_def_id = tcx.typeck_root_def_id(self.mir_def.to_def_id()); | |
| 584 | let typeck_root_def_id = tcx.typeck_root_def_id_local(self.mir_def); | |
| 587 | 585 | |
| 588 | 586 | match tcx.hir_body_owner_kind(self.mir_def) { |
| 589 | 587 | BodyOwnerKind::Closure | BodyOwnerKind::Fn => { |
| ... | ... | @@ -614,7 +612,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { |
| 614 | 612 | |
| 615 | 613 | BodyOwnerKind::Const { .. } | BodyOwnerKind::Static(..) => { |
| 616 | 614 | let identity_args = GenericArgs::identity_for_item(tcx, typeck_root_def_id); |
| 617 | if self.mir_def.to_def_id() == typeck_root_def_id { | |
| 615 | if self.mir_def == typeck_root_def_id { | |
| 618 | 616 | let args = self.infcx.replace_free_regions_with_nll_infer_vars( |
| 619 | 617 | NllRegionVariableOrigin::FreeRegion, |
| 620 | 618 | identity_args, |
| ... | ... | @@ -660,7 +658,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> { |
| 660 | 658 | defining_ty: DefiningTy<'tcx>, |
| 661 | 659 | ) -> UniversalRegionIndices<'tcx> { |
| 662 | 660 | let tcx = self.infcx.tcx; |
| 663 | let typeck_root_def_id = tcx.typeck_root_def_id(self.mir_def.to_def_id()); | |
| 661 | let typeck_root_def_id = tcx.typeck_root_def_id_local(self.mir_def); | |
| 664 | 662 | let identity_args = GenericArgs::identity_for_item(tcx, typeck_root_def_id); |
| 665 | 663 | let renumbered_args = defining_ty.args(); |
| 666 | 664 | |
| ... | ... | @@ -948,16 +946,14 @@ fn for_each_late_bound_region_in_recursive_scope<'tcx>( |
| 948 | 946 | mut mir_def_id: LocalDefId, |
| 949 | 947 | mut f: impl FnMut(ty::Region<'tcx>), |
| 950 | 948 | ) { |
| 951 | let typeck_root_def_id = tcx.typeck_root_def_id(mir_def_id.to_def_id()); | |
| 952 | ||
| 953 | 949 | // Walk up the tree, collecting late-bound regions until we hit the typeck root |
| 954 | 950 | loop { |
| 955 | 951 | for_each_late_bound_region_in_item(tcx, mir_def_id, &mut f); |
| 956 | 952 | |
| 957 | if mir_def_id.to_def_id() == typeck_root_def_id { | |
| 958 | break; | |
| 959 | } else { | |
| 953 | if tcx.is_typeck_child(mir_def_id.to_def_id()) { | |
| 960 | 954 | mir_def_id = tcx.local_parent(mir_def_id); |
| 955 | } else { | |
| 956 | break; | |
| 961 | 957 | } |
| 962 | 958 | } |
| 963 | 959 | } |
compiler/rustc_hir_analysis/src/check/region.rs+4-4| ... | ... | @@ -11,7 +11,7 @@ use std::mem; |
| 11 | 11 | use rustc_data_structures::fx::FxHashMap; |
| 12 | 12 | use rustc_hir as hir; |
| 13 | 13 | use rustc_hir::def::{CtorKind, DefKind, Res}; |
| 14 | use rustc_hir::def_id::DefId; | |
| 14 | use rustc_hir::def_id::LocalDefId; | |
| 15 | 15 | use rustc_hir::intravisit::{self, Visitor}; |
| 16 | 16 | use rustc_hir::{Arm, Block, Expr, LetStmt, Pat, PatKind, Stmt}; |
| 17 | 17 | use rustc_index::Idx; |
| ... | ... | @@ -849,13 +849,13 @@ impl<'tcx> Visitor<'tcx> for ScopeResolutionVisitor<'tcx> { |
| 849 | 849 | /// re-use in incremental scenarios. We may sometimes need to rerun the |
| 850 | 850 | /// type checker even when the HIR hasn't changed, and in those cases |
| 851 | 851 | /// we can avoid reconstructing the region scope tree. |
| 852 | pub(crate) fn region_scope_tree(tcx: TyCtxt<'_>, def_id: DefId) -> &ScopeTree { | |
| 853 | let typeck_root_def_id = tcx.typeck_root_def_id(def_id); | |
| 852 | pub(crate) fn region_scope_tree(tcx: TyCtxt<'_>, def_id: LocalDefId) -> &ScopeTree { | |
| 853 | let typeck_root_def_id = tcx.typeck_root_def_id_local(def_id); | |
| 854 | 854 | if typeck_root_def_id != def_id { |
| 855 | 855 | return tcx.region_scope_tree(typeck_root_def_id); |
| 856 | 856 | } |
| 857 | 857 | |
| 858 | let scope_tree = if let Some(body) = tcx.hir_maybe_body_owned_by(def_id.expect_local()) { | |
| 858 | let scope_tree = if let Some(body) = tcx.hir_maybe_body_owned_by(def_id) { | |
| 859 | 859 | let mut visitor = ScopeResolutionVisitor { |
| 860 | 860 | tcx, |
| 861 | 861 | scope_tree: ScopeTree::default(), |
compiler/rustc_hir_analysis/src/collect/generics_of.rs+6-6| ... | ... | @@ -76,12 +76,12 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { |
| 76 | 76 | | Node::Ctor(..) |
| 77 | 77 | | Node::Field(_) => { |
| 78 | 78 | let parent_id = tcx.hir_get_parent_item(hir_id); |
| 79 | Some(parent_id.to_def_id()) | |
| 79 | Some(parent_id.def_id) | |
| 80 | 80 | } |
| 81 | 81 | // FIXME(#43408) always enable this once `lazy_normalization` is |
| 82 | 82 | // stable enough and does not need a feature gate anymore. |
| 83 | 83 | Node::AnonConst(_) => { |
| 84 | let parent_did = tcx.parent(def_id.to_def_id()); | |
| 84 | let parent_did = tcx.local_parent(def_id); | |
| 85 | 85 | debug!(?parent_did); |
| 86 | 86 | |
| 87 | 87 | let mut in_param_ty = false; |
| ... | ... | @@ -175,7 +175,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { |
| 175 | 175 | } |
| 176 | 176 | Node::ConstBlock(_) |
| 177 | 177 | | Node::Expr(&hir::Expr { kind: hir::ExprKind::Closure { .. }, .. }) => { |
| 178 | Some(tcx.typeck_root_def_id(def_id.to_def_id())) | |
| 178 | Some(tcx.typeck_root_def_id_local(def_id)) | |
| 179 | 179 | } |
| 180 | 180 | Node::OpaqueTy(&hir::OpaqueTy { |
| 181 | 181 | origin: |
| ... | ... | @@ -188,7 +188,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { |
| 188 | 188 | } else { |
| 189 | 189 | assert_matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn | DefKind::Fn); |
| 190 | 190 | } |
| 191 | Some(fn_def_id.to_def_id()) | |
| 191 | Some(fn_def_id) | |
| 192 | 192 | } |
| 193 | 193 | Node::OpaqueTy(&hir::OpaqueTy { |
| 194 | 194 | origin: hir::OpaqueTyOrigin::TyAlias { parent, in_assoc_ty }, |
| ... | ... | @@ -202,7 +202,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { |
| 202 | 202 | debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent); |
| 203 | 203 | // Opaque types are always nested within another item, and |
| 204 | 204 | // inherit the generics of the item. |
| 205 | Some(parent.to_def_id()) | |
| 205 | Some(parent) | |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // All of these nodes have no parent from which to inherit generics. |
| ... | ... | @@ -380,7 +380,7 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { |
| 380 | 380 | own_params.iter().map(|param| (param.def_id, param.index)).collect(); |
| 381 | 381 | |
| 382 | 382 | ty::Generics { |
| 383 | parent: parent_def_id, | |
| 383 | parent: parent_def_id.map(LocalDefId::to_def_id), | |
| 384 | 384 | parent_count, |
| 385 | 385 | own_params, |
| 386 | 386 | param_def_id_to_index, |
compiler/rustc_hir_analysis/src/collect/predicates_of.rs+1-1| ... | ... | @@ -107,7 +107,7 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen |
| 107 | 107 | ); |
| 108 | 108 | |
| 109 | 109 | return ty::GenericPredicates { |
| 110 | parent: Some(tcx.parent(def_id.to_def_id())), | |
| 110 | parent: Some(tcx.local_parent(def_id).to_def_id()), | |
| 111 | 111 | predicates: tcx.arena.alloc_from_iter(predicates), |
| 112 | 112 | }; |
| 113 | 113 | } |
compiler/rustc_hir_typeck/src/closure.rs+1-1| ... | ... | @@ -72,7 +72,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { |
| 72 | 72 | debug!(?bound_sig, ?liberated_sig); |
| 73 | 73 | |
| 74 | 74 | let parent_args = |
| 75 | GenericArgs::identity_for_item(tcx, tcx.typeck_root_def_id(expr_def_id.to_def_id())); | |
| 75 | GenericArgs::identity_for_item(tcx, tcx.typeck_root_def_id_local(expr_def_id)); | |
| 76 | 76 | |
| 77 | 77 | let tupled_upvars_ty = self.next_ty_var(expr_span); |
| 78 | 78 |
compiler/rustc_hir_typeck/src/lib.rs+1-1| ... | ... | @@ -106,7 +106,7 @@ fn typeck_with_inspect<'tcx>( |
| 106 | 106 | ) -> &'tcx ty::TypeckResults<'tcx> { |
| 107 | 107 | // Closures' typeck results come from their outermost function, |
| 108 | 108 | // as they are part of the same "inference environment". |
| 109 | let typeck_root_def_id = tcx.typeck_root_def_id(def_id.to_def_id()).expect_local(); | |
| 109 | let typeck_root_def_id = tcx.typeck_root_def_id_local(def_id); | |
| 110 | 110 | if typeck_root_def_id != def_id { |
| 111 | 111 | return tcx.typeck(typeck_root_def_id); |
| 112 | 112 | } |
compiler/rustc_metadata/src/rmeta/encoder.rs+1-1| ... | ... | @@ -727,7 +727,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { |
| 727 | 727 | is_stub: false, |
| 728 | 728 | }, |
| 729 | 729 | extra_filename: tcx.sess.opts.cg.extra_filename.clone(), |
| 730 | stable_crate_id: tcx.def_path_hash(LOCAL_CRATE.as_def_id()).stable_crate_id(), | |
| 730 | stable_crate_id: tcx.stable_crate_id(LOCAL_CRATE), | |
| 731 | 731 | required_panic_strategy: tcx.required_panic_strategy(LOCAL_CRATE), |
| 732 | 732 | panic_in_drop_strategy: tcx.sess.opts.unstable_opts.panic_in_drop, |
| 733 | 733 | edition: tcx.sess.edition(), |
compiler/rustc_middle/src/queries.rs+1-1| ... | ... | @@ -1413,7 +1413,7 @@ rustc_queries! { |
| 1413 | 1413 | |
| 1414 | 1414 | /// Per-body `region::ScopeTree`. The `DefId` should be the owner `DefId` for the body; |
| 1415 | 1415 | /// in the case of closures, this will be redirected to the enclosing function. |
| 1416 | query region_scope_tree(def_id: DefId) -> &'tcx crate::middle::region::ScopeTree { | |
| 1416 | query region_scope_tree(def_id: LocalDefId) -> &'tcx crate::middle::region::ScopeTree { | |
| 1417 | 1417 | desc { "computing drop scopes for `{}`", tcx.def_path_str(def_id) } |
| 1418 | 1418 | } |
| 1419 | 1419 |
compiler/rustc_middle/src/ty/context.rs+2-6| ... | ... | @@ -899,12 +899,8 @@ impl<'tcx> TyCtxt<'tcx> { |
| 899 | 899 | pub fn has_typeck_results(self, def_id: LocalDefId) -> bool { |
| 900 | 900 | // Closures' typeck results come from their outermost function, |
| 901 | 901 | // as they are part of the same "inference environment". |
| 902 | let typeck_root_def_id = self.typeck_root_def_id(def_id.to_def_id()); | |
| 903 | if typeck_root_def_id != def_id.to_def_id() { | |
| 904 | return self.has_typeck_results(typeck_root_def_id.expect_local()); | |
| 905 | } | |
| 906 | ||
| 907 | self.hir_node_by_def_id(def_id).body_id().is_some() | |
| 902 | let root = self.typeck_root_def_id_local(def_id); | |
| 903 | self.hir_node_by_def_id(root).body_id().is_some() | |
| 908 | 904 | } |
| 909 | 905 | |
| 910 | 906 | /// Expects a body and returns its codegen attributes. |
compiler/rustc_middle/src/ty/util.rs+14| ... | ... | @@ -650,6 +650,20 @@ impl<'tcx> TyCtxt<'tcx> { |
| 650 | 650 | def_id |
| 651 | 651 | } |
| 652 | 652 | |
| 653 | /// Given the `LocalDefId`, returns the `LocalDefId` of the innermost item that | |
| 654 | /// has its own type-checking context or "inference environment". | |
| 655 | /// | |
| 656 | /// For example, a closure has its own `LocalDefId`, but it is type-checked | |
| 657 | /// with the containing item. Therefore, when we fetch the `typeck` of the closure, | |
| 658 | /// for example, we really wind up fetching the `typeck` of the enclosing fn item. | |
| 659 | pub fn typeck_root_def_id_local(self, def_id: LocalDefId) -> LocalDefId { | |
| 660 | let mut def_id = def_id; | |
| 661 | while self.is_typeck_child(def_id.to_def_id()) { | |
| 662 | def_id = self.local_parent(def_id); | |
| 663 | } | |
| 664 | def_id | |
| 665 | } | |
| 666 | ||
| 653 | 667 | /// Given the `DefId` and args a closure, creates the type of |
| 654 | 668 | /// `self` argument that the closure expects. For example, for a |
| 655 | 669 | /// `Fn` closure, this would return a reference type `&T` where |
compiler/rustc_mir_build/src/thir/cx/expr.rs+6-6| ... | ... | @@ -816,8 +816,8 @@ impl<'tcx> ThirBuildCx<'tcx> { |
| 816 | 816 | } |
| 817 | 817 | hir::InlineAsmOperand::Const { ref anon_const } => { |
| 818 | 818 | let ty = self.typeck_results.node_type(anon_const.hir_id); |
| 819 | let did = anon_const.def_id.to_def_id(); | |
| 820 | let typeck_root_def_id = tcx.typeck_root_def_id(did); | |
| 819 | let did = anon_const.def_id; | |
| 820 | let typeck_root_def_id = tcx.typeck_root_def_id_local(did); | |
| 821 | 821 | let parent_args = tcx.erase_and_anonymize_regions( |
| 822 | 822 | GenericArgs::identity_for_item(tcx, typeck_root_def_id), |
| 823 | 823 | ); |
| ... | ... | @@ -825,7 +825,7 @@ impl<'tcx> ThirBuildCx<'tcx> { |
| 825 | 825 | InlineConstArgs::new(tcx, InlineConstArgsParts { parent_args, ty }) |
| 826 | 826 | .args; |
| 827 | 827 | |
| 828 | let uneval = mir::UnevaluatedConst::new(did, args); | |
| 828 | let uneval = mir::UnevaluatedConst::new(did.to_def_id(), args); | |
| 829 | 829 | let value = mir::Const::Unevaluated(uneval, ty); |
| 830 | 830 | InlineAsmOperand::Const { value, span: tcx.def_span(did) } |
| 831 | 831 | } |
| ... | ... | @@ -895,15 +895,15 @@ impl<'tcx> ThirBuildCx<'tcx> { |
| 895 | 895 | |
| 896 | 896 | hir::ExprKind::ConstBlock(ref anon_const) => { |
| 897 | 897 | let ty = self.typeck_results.node_type(anon_const.hir_id); |
| 898 | let did = anon_const.def_id.to_def_id(); | |
| 899 | let typeck_root_def_id = tcx.typeck_root_def_id(did); | |
| 898 | let did = anon_const.def_id; | |
| 899 | let typeck_root_def_id = tcx.typeck_root_def_id_local(did); | |
| 900 | 900 | let parent_args = tcx.erase_and_anonymize_regions(GenericArgs::identity_for_item( |
| 901 | 901 | tcx, |
| 902 | 902 | typeck_root_def_id, |
| 903 | 903 | )); |
| 904 | 904 | let args = InlineConstArgs::new(tcx, InlineConstArgsParts { parent_args, ty }).args; |
| 905 | 905 | |
| 906 | ExprKind::ConstBlock { did, args } | |
| 906 | ExprKind::ConstBlock { did: did.to_def_id(), args } | |
| 907 | 907 | } |
| 908 | 908 | // Now comes the rote stuff: |
| 909 | 909 | hir::ExprKind::Repeat(v, _) => { |
compiler/rustc_mir_transform/src/lib.rs+4-4| ... | ... | @@ -526,7 +526,7 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> & |
| 526 | 526 | |
| 527 | 527 | // We only need to borrowck non-synthetic MIR. |
| 528 | 528 | let tainted_by_errors = if !tcx.is_synthetic_mir(def) { |
| 529 | tcx.mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local()).err() | |
| 529 | tcx.mir_borrowck(tcx.typeck_root_def_id_local(def)).err() | |
| 530 | 530 | } else { |
| 531 | 531 | None |
| 532 | 532 | }; |
| ... | ... | @@ -554,14 +554,14 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> & |
| 554 | 554 | // |
| 555 | 555 | // We do this check here and not during `mir_promoted` because that may result |
| 556 | 556 | // in borrowck cycles if WF requires looking into an opaque hidden type. |
| 557 | let root = tcx.typeck_root_def_id(def.to_def_id()); | |
| 557 | let root = tcx.typeck_root_def_id_local(def); | |
| 558 | 558 | match tcx.def_kind(root) { |
| 559 | 559 | DefKind::Fn |
| 560 | 560 | | DefKind::AssocFn |
| 561 | 561 | | DefKind::Static { .. } |
| 562 | 562 | | DefKind::Const { .. } |
| 563 | 563 | | DefKind::AssocConst { .. } => { |
| 564 | if let Err(guar) = tcx.ensure_result().check_well_formed(root.expect_local()) { | |
| 564 | if let Err(guar) = tcx.ensure_result().check_well_formed(root) { | |
| 565 | 565 | body.tainted_by_errors = Some(guar); |
| 566 | 566 | } |
| 567 | 567 | } |
| ... | ... | @@ -840,7 +840,7 @@ fn promoted_mir(tcx: TyCtxt<'_>, def: LocalDefId) -> &IndexVec<Promoted, Body<'_ |
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | if !tcx.is_synthetic_mir(def) { |
| 843 | tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id(def.to_def_id()).expect_local()); | |
| 843 | tcx.ensure_done().mir_borrowck(tcx.typeck_root_def_id_local(def)); | |
| 844 | 844 | } |
| 845 | 845 | let mut promoted = tcx.mir_promoted(def).1.steal(); |
| 846 | 846 |
compiler/rustc_mir_transform/src/liveness.rs+1-1| ... | ... | @@ -67,7 +67,7 @@ pub(crate) fn check_liveness<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Den |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | // Don't run unused pass for #[derive] |
| 70 | let parent = tcx.parent(tcx.typeck_root_def_id(def_id.to_def_id())); | |
| 70 | let parent = tcx.local_parent(tcx.typeck_root_def_id_local(def_id)); | |
| 71 | 71 | if let DefKind::Impl { of_trait: true } = tcx.def_kind(parent) |
| 72 | 72 | && find_attr!(tcx, parent, AutomaticallyDerived(..)) |
| 73 | 73 | { |
compiler/rustc_monomorphize/src/collector.rs+1-1| ... | ... | @@ -1615,7 +1615,7 @@ impl<'v> RootCollector<'_, 'v> { |
| 1615 | 1615 | if (self.strategy == MonoItemCollectionStrategy::Eager || is_pub_fn_coroutine) |
| 1616 | 1616 | && !self |
| 1617 | 1617 | .tcx |
| 1618 | .generics_of(self.tcx.typeck_root_def_id(def_id.to_def_id())) | |
| 1618 | .generics_of(self.tcx.typeck_root_def_id_local(def_id)) | |
| 1619 | 1619 | .requires_monomorphization(self.tcx) |
| 1620 | 1620 | { |
| 1621 | 1621 | let instance = match *self.tcx.type_of(def_id).instantiate_identity().kind() { |
compiler/rustc_parse/src/errors.rs+7-3| ... | ... | @@ -4344,7 +4344,7 @@ impl Subdiagnostic for HiddenUnicodeCodepointsDiagLabels { |
| 4344 | 4344 | |
| 4345 | 4345 | pub(crate) enum HiddenUnicodeCodepointsDiagSub { |
| 4346 | 4346 | Escape { spans: Vec<(char, Span)> }, |
| 4347 | NoEscape { spans: Vec<(char, Span)> }, | |
| 4347 | NoEscape { spans: Vec<(char, Span)>, is_doc_comment: bool }, | |
| 4348 | 4348 | } |
| 4349 | 4349 | |
| 4350 | 4350 | // Used because of multiple multipart_suggestion and note |
| ... | ... | @@ -4370,7 +4370,7 @@ impl Subdiagnostic for HiddenUnicodeCodepointsDiagSub { |
| 4370 | 4370 | Applicability::MachineApplicable, |
| 4371 | 4371 | ); |
| 4372 | 4372 | } |
| 4373 | HiddenUnicodeCodepointsDiagSub::NoEscape { spans } => { | |
| 4373 | HiddenUnicodeCodepointsDiagSub::NoEscape { spans, is_doc_comment } => { | |
| 4374 | 4374 | // FIXME: in other suggestions we've reversed the inner spans of doc comments. We |
| 4375 | 4375 | // should do the same here to provide the same good suggestions as we do for |
| 4376 | 4376 | // literals above. |
| ... | ... | @@ -4383,7 +4383,11 @@ impl Subdiagnostic for HiddenUnicodeCodepointsDiagSub { |
| 4383 | 4383 | .join(", "), |
| 4384 | 4384 | ); |
| 4385 | 4385 | diag.note(msg!("if their presence wasn't intentional, you can remove them")); |
| 4386 | diag.note(msg!("if you want to keep them but make them visible in your source code, you can escape them: {$escaped}")); | |
| 4386 | if is_doc_comment { | |
| 4387 | diag.note(msg!(r#"if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as {$escaped}"#)); | |
| 4388 | } else { | |
| 4389 | diag.note(msg!("if you want to keep them but make them visible in your source code, you can escape them: {$escaped}")); | |
| 4390 | } | |
| 4387 | 4391 | } |
| 4388 | 4392 | } |
| 4389 | 4393 | } |
compiler/rustc_parse/src/lexer/mod.rs+4-1| ... | ... | @@ -546,6 +546,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { |
| 546 | 546 | self.mk_sp(start, self.pos), |
| 547 | 547 | 0, |
| 548 | 548 | false, |
| 549 | true, | |
| 549 | 550 | "doc comment", |
| 550 | 551 | ); |
| 551 | 552 | } |
| ... | ... | @@ -580,6 +581,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { |
| 580 | 581 | span, |
| 581 | 582 | padding, |
| 582 | 583 | point_at_inner_spans, |
| 584 | false, | |
| 583 | 585 | label, |
| 584 | 586 | ); |
| 585 | 587 | } |
| ... | ... | @@ -590,6 +592,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { |
| 590 | 592 | span: Span, |
| 591 | 593 | padding: u32, |
| 592 | 594 | point_at_inner_spans: bool, |
| 595 | is_doc_comment: bool, | |
| 593 | 596 | label: &str, |
| 594 | 597 | ) { |
| 595 | 598 | // Obtain the `Span`s for each of the forbidden chars. |
| ... | ... | @@ -610,7 +613,7 @@ impl<'psess, 'src> Lexer<'psess, 'src> { |
| 610 | 613 | let sub = if point_at_inner_spans && !spans.is_empty() { |
| 611 | 614 | errors::HiddenUnicodeCodepointsDiagSub::Escape { spans } |
| 612 | 615 | } else { |
| 613 | errors::HiddenUnicodeCodepointsDiagSub::NoEscape { spans } | |
| 616 | errors::HiddenUnicodeCodepointsDiagSub::NoEscape { spans, is_doc_comment } | |
| 614 | 617 | }; |
| 615 | 618 | |
| 616 | 619 | self.psess.buffer_lint( |
compiler/rustc_passes/src/dead.rs+2-2| ... | ... | @@ -380,8 +380,8 @@ impl<'tcx> MarkSymbolVisitor<'tcx> { |
| 380 | 380 | /// for discussion). |
| 381 | 381 | fn should_ignore_impl_item(&mut self, impl_item: &hir::ImplItem<'_>) -> bool { |
| 382 | 382 | if let hir::ImplItemImplKind::Trait { .. } = impl_item.impl_kind |
| 383 | && let impl_of = self.tcx.parent(impl_item.owner_id.to_def_id()) | |
| 384 | && self.tcx.is_automatically_derived(impl_of) | |
| 383 | && let impl_of = self.tcx.local_parent(impl_item.owner_id.def_id) | |
| 384 | && self.tcx.is_automatically_derived(impl_of.to_def_id()) | |
| 385 | 385 | && let trait_ref = self.tcx.impl_trait_ref(impl_of).instantiate_identity() |
| 386 | 386 | && find_attr!(self.tcx, trait_ref.def_id, RustcTrivialFieldReads) |
| 387 | 387 | { |
compiler/rustc_session/src/options.rs+5-585| ... | ... | @@ -605,6 +605,10 @@ macro_rules! tmod_enum { |
| 605 | 605 | /// necessary code. The main gotcha of this macro is the `cgsetters` module which is a bunch of |
| 606 | 606 | /// generated code to parse an option into its respective field in the struct. There are a few |
| 607 | 607 | /// hand-written parsers for parsing specific types of values in this module. |
| 608 | /// | |
| 609 | /// Note: this macro's invocation is also parsed by a `syn`-based parser in | |
| 610 | /// `src/tools/unstable-book-gen/src/main.rs` to extract unstable option names and descriptions. | |
| 611 | /// If the format of this macro changes, that parser may need to be updated as well. | |
| 608 | 612 | macro_rules! options { |
| 609 | 613 | ($struct_name:ident, $tmod_enum_name:ident, $stat:ident, $optmod:ident, $prefix:expr, $outputname:expr, |
| 610 | 614 | $($( #[$attr:meta] )* $opt:ident : $t:ty = ( |
| ... | ... | @@ -2215,588 +2219,4 @@ options! { |
| 2215 | 2219 | // - src/doc/rustc/src/codegen-options/index.md |
| 2216 | 2220 | } |
| 2217 | 2221 | |
| 2218 | options! { | |
| 2219 | UnstableOptions, UnstableOptionsTargetModifiers, Z_OPTIONS, dbopts, "Z", "unstable", | |
| 2220 | ||
| 2221 | // If you add a new option, please update: | |
| 2222 | // - compiler/rustc_interface/src/tests.rs | |
| 2223 | // - src/doc/unstable-book/src/compiler-flags | |
| 2224 | ||
| 2225 | // tidy-alphabetical-start | |
| 2226 | allow_features: Option<Vec<String>> = (None, parse_opt_comma_list, [TRACKED], | |
| 2227 | "only allow the listed language features to be enabled in code (comma separated)"), | |
| 2228 | always_encode_mir: bool = (false, parse_bool, [TRACKED], | |
| 2229 | "encode MIR of all functions into the crate metadata (default: no)"), | |
| 2230 | annotate_moves: AnnotateMoves = (AnnotateMoves::Disabled, parse_annotate_moves, [TRACKED], | |
| 2231 | "emit debug info for compiler-generated move and copy operations \ | |
| 2232 | to make them visible in profilers. Can be a boolean or a size limit in bytes (default: disabled)"), | |
| 2233 | assert_incr_state: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| 2234 | "assert that the incremental cache is in given state: \ | |
| 2235 | either `loaded` or `not-loaded`."), | |
| 2236 | assume_incomplete_release: bool = (false, parse_bool, [TRACKED], | |
| 2237 | "make cfg(version) treat the current version as incomplete (default: no)"), | |
| 2238 | autodiff: Vec<crate::config::AutoDiff> = (Vec::new(), parse_autodiff, [TRACKED], | |
| 2239 | "a list of autodiff flags to enable | |
| 2240 | Mandatory setting: | |
| 2241 | `=Enable` | |
| 2242 | Optional extra settings: | |
| 2243 | `=PrintTA` | |
| 2244 | `=PrintAA` | |
| 2245 | `=PrintPerf` | |
| 2246 | `=PrintSteps` | |
| 2247 | `=PrintModBefore` | |
| 2248 | `=PrintModAfter` | |
| 2249 | `=PrintModFinal` | |
| 2250 | `=PrintPasses`, | |
| 2251 | `=NoPostopt` | |
| 2252 | `=LooseTypes` | |
| 2253 | `=Inline` | |
| 2254 | Multiple options can be combined with commas."), | |
| 2255 | #[rustc_lint_opt_deny_field_access("use `Session::binary_dep_depinfo` instead of this field")] | |
| 2256 | binary_dep_depinfo: bool = (false, parse_bool, [TRACKED], | |
| 2257 | "include artifacts (sysroot, crate dependencies) used during compilation in dep-info \ | |
| 2258 | (default: no)"), | |
| 2259 | box_noalias: bool = (true, parse_bool, [TRACKED], | |
| 2260 | "emit noalias metadata for box (default: yes)"), | |
| 2261 | branch_protection: Option<BranchProtection> = (None, parse_branch_protection, [TRACKED TARGET_MODIFIER], | |
| 2262 | "set options for branch target identification and pointer authentication on AArch64"), | |
| 2263 | build_sdylib_interface: bool = (false, parse_bool, [UNTRACKED], | |
| 2264 | "whether the stable interface is being built"), | |
| 2265 | cache_proc_macros: bool = (false, parse_bool, [TRACKED], | |
| 2266 | "cache the results of derive proc macro invocations (potentially unsound!) (default: no"), | |
| 2267 | cf_protection: CFProtection = (CFProtection::None, parse_cfprotection, [TRACKED], | |
| 2268 | "instrument control-flow architecture protection"), | |
| 2269 | check_cfg_all_expected: bool = (false, parse_bool, [UNTRACKED], | |
| 2270 | "show all expected values in check-cfg diagnostics (default: no)"), | |
| 2271 | checksum_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_cargo_src_file_hash, [TRACKED], | |
| 2272 | "hash algorithm of source files used to check freshness in cargo (`blake3` or `sha256`)"), | |
| 2273 | codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED], | |
| 2274 | "the backend to use"), | |
| 2275 | codegen_source_order: bool = (false, parse_bool, [UNTRACKED], | |
| 2276 | "emit mono items in the order of spans in source files (default: no)"), | |
| 2277 | contract_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2278 | "emit runtime checks for contract pre- and post-conditions (default: no)"), | |
| 2279 | coverage_options: CoverageOptions = (CoverageOptions::default(), parse_coverage_options, [TRACKED], | |
| 2280 | "control details of coverage instrumentation"), | |
| 2281 | crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED], | |
| 2282 | "inject the given attribute in the crate"), | |
| 2283 | cross_crate_inline_threshold: InliningThreshold = (InliningThreshold::Sometimes(100), parse_inlining_threshold, [TRACKED], | |
| 2284 | "threshold to allow cross crate inlining of functions"), | |
| 2285 | debug_info_for_profiling: bool = (false, parse_bool, [TRACKED], | |
| 2286 | "emit discriminators and other data necessary for AutoFDO"), | |
| 2287 | debug_info_type_line_numbers: bool = (false, parse_bool, [TRACKED], | |
| 2288 | "emit type and line information for additional data types (default: no)"), | |
| 2289 | debuginfo_compression: DebugInfoCompression = (DebugInfoCompression::None, parse_debuginfo_compression, [TRACKED], | |
| 2290 | "compress debug info sections (none, zlib, zstd, default: none)"), | |
| 2291 | deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED], | |
| 2292 | "deduplicate identical diagnostics (default: yes)"), | |
| 2293 | default_visibility: Option<SymbolVisibility> = (None, parse_opt_symbol_visibility, [TRACKED], | |
| 2294 | "overrides the `default_visibility` setting of the target"), | |
| 2295 | dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED], | |
| 2296 | "in dep-info output, omit targets for tracking dependencies of the dep-info files \ | |
| 2297 | themselves (default: no)"), | |
| 2298 | direct_access_external_data: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2299 | "Direct or use GOT indirect to reference external data symbols"), | |
| 2300 | dual_proc_macros: bool = (false, parse_bool, [TRACKED], | |
| 2301 | "load proc macros for both target and host, but only link to the target (default: no)"), | |
| 2302 | dump_dep_graph: bool = (false, parse_bool, [UNTRACKED], | |
| 2303 | "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) \ | |
| 2304 | (default: no)"), | |
| 2305 | dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| 2306 | "dump MIR state to file. | |
| 2307 | `val` is used to select which passes and functions to dump. For example: | |
| 2308 | `all` matches all passes and functions, | |
| 2309 | `foo` matches all passes for functions whose name contains 'foo', | |
| 2310 | `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo', | |
| 2311 | `foo | bar` all passes for function names containing 'foo' or 'bar'."), | |
| 2312 | dump_mir_dataflow: bool = (false, parse_bool, [UNTRACKED], | |
| 2313 | "in addition to `.mir` files, create graphviz `.dot` files with dataflow results \ | |
| 2314 | (default: no)"), | |
| 2315 | dump_mir_dir: String = ("mir_dump".to_string(), parse_string, [UNTRACKED], | |
| 2316 | "the directory the MIR is dumped into (default: `mir_dump`)"), | |
| 2317 | dump_mir_exclude_alloc_bytes: bool = (false, parse_bool, [UNTRACKED], | |
| 2318 | "exclude the raw bytes of allocations when dumping MIR (used in tests) (default: no)"), | |
| 2319 | dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED], | |
| 2320 | "exclude the pass number when dumping MIR (used in tests) (default: no)"), | |
| 2321 | dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED], | |
| 2322 | "in addition to `.mir` files, create graphviz `.dot` files (default: no)"), | |
| 2323 | dump_mono_stats: SwitchWithOptPath = (SwitchWithOptPath::Disabled, | |
| 2324 | parse_switch_with_opt_path, [UNTRACKED], | |
| 2325 | "output statistics about monomorphization collection"), | |
| 2326 | dump_mono_stats_format: DumpMonoStatsFormat = (DumpMonoStatsFormat::Markdown, parse_dump_mono_stats, [UNTRACKED], | |
| 2327 | "the format to use for -Z dump-mono-stats (`markdown` (default) or `json`)"), | |
| 2328 | #[rustc_lint_opt_deny_field_access("use `Session::dwarf_version` instead of this field")] | |
| 2329 | dwarf_version: Option<u32> = (None, parse_opt_number, [TRACKED], | |
| 2330 | "version of DWARF debug information to emit (default: 2 or 4, depending on platform)"), | |
| 2331 | dylib_lto: bool = (false, parse_bool, [UNTRACKED], | |
| 2332 | "enables LTO for dylib crate type"), | |
| 2333 | eagerly_emit_delayed_bugs: bool = (false, parse_bool, [UNTRACKED], | |
| 2334 | "emit delayed bugs eagerly as errors instead of stashing them and emitting \ | |
| 2335 | them only if an error has not been emitted"), | |
| 2336 | ehcont_guard: bool = (false, parse_bool, [TRACKED], | |
| 2337 | "generate Windows EHCont Guard tables"), | |
| 2338 | embed_metadata: bool = (true, parse_bool, [TRACKED], | |
| 2339 | "embed metadata in rlibs and dylibs (default: yes)"), | |
| 2340 | embed_source: bool = (false, parse_bool, [TRACKED], | |
| 2341 | "embed source text in DWARF debug sections (default: no)"), | |
| 2342 | emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED], | |
| 2343 | "emit a section containing stack size metadata (default: no)"), | |
| 2344 | emscripten_wasm_eh: bool = (true, parse_bool, [TRACKED], | |
| 2345 | "Use WebAssembly error handling for wasm32-unknown-emscripten"), | |
| 2346 | enforce_type_length_limit: bool = (false, parse_bool, [TRACKED], | |
| 2347 | "enforce the type length limit when monomorphizing instances in codegen"), | |
| 2348 | experimental_default_bounds: bool = (false, parse_bool, [TRACKED], | |
| 2349 | "enable default bounds for experimental group of auto traits"), | |
| 2350 | export_executable_symbols: bool = (false, parse_bool, [TRACKED], | |
| 2351 | "export symbols from executables, as if they were dynamic libraries"), | |
| 2352 | external_clangrt: bool = (false, parse_bool, [UNTRACKED], | |
| 2353 | "rely on user specified linker commands to find clangrt"), | |
| 2354 | extra_const_ub_checks: bool = (false, parse_bool, [TRACKED], | |
| 2355 | "turns on more checks to detect const UB, which can be slow (default: no)"), | |
| 2356 | #[rustc_lint_opt_deny_field_access("use `Session::fewer_names` instead of this field")] | |
| 2357 | fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2358 | "reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \ | |
| 2359 | (default: no)"), | |
| 2360 | fixed_x18: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 2361 | "make the x18 register reserved on AArch64 (default: no)"), | |
| 2362 | flatten_format_args: bool = (true, parse_bool, [TRACKED], | |
| 2363 | "flatten nested format_args!() and literals into a simplified format_args!() call \ | |
| 2364 | (default: yes)"), | |
| 2365 | fmt_debug: FmtDebug = (FmtDebug::Full, parse_fmt_debug, [TRACKED], | |
| 2366 | "how detailed `#[derive(Debug)]` should be. `full` prints types recursively, \ | |
| 2367 | `shallow` prints only type names, `none` prints nothing and disables `{:?}`. (default: `full`)"), | |
| 2368 | force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED], | |
| 2369 | "force all crates to be `rustc_private` unstable (default: no)"), | |
| 2370 | function_return: FunctionReturn = (FunctionReturn::default(), parse_function_return, [TRACKED], | |
| 2371 | "replace returns with jumps to `__x86_return_thunk` (default: `keep`)"), | |
| 2372 | function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2373 | "whether each function should go in its own section"), | |
| 2374 | future_incompat_test: bool = (false, parse_bool, [UNTRACKED], | |
| 2375 | "forces all lints to be future incompatible, used for internal testing (default: no)"), | |
| 2376 | graphviz_dark_mode: bool = (false, parse_bool, [UNTRACKED], | |
| 2377 | "use dark-themed colors in graphviz output (default: no)"), | |
| 2378 | graphviz_font: String = ("Courier, monospace".to_string(), parse_string, [UNTRACKED], | |
| 2379 | "use the given `fontname` in graphviz output; can be overridden by setting \ | |
| 2380 | environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`)"), | |
| 2381 | has_thread_local: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2382 | "explicitly enable the `cfg(target_thread_local)` directive"), | |
| 2383 | help: bool = (false, parse_no_value, [UNTRACKED], "Print unstable compiler options"), | |
| 2384 | higher_ranked_assumptions: bool = (false, parse_bool, [TRACKED], | |
| 2385 | "allow deducing higher-ranked outlives assumptions from coroutines when proving auto traits"), | |
| 2386 | hint_mostly_unused: bool = (false, parse_bool, [TRACKED], | |
| 2387 | "hint that most of this crate will go unused, to minimize work for uncalled functions"), | |
| 2388 | human_readable_cgu_names: bool = (false, parse_bool, [TRACKED], | |
| 2389 | "generate human-readable, predictable names for codegen units (default: no)"), | |
| 2390 | identify_regions: bool = (false, parse_bool, [UNTRACKED], | |
| 2391 | "display unnamed regions as `'<id>`, using a non-ident unique id (default: no)"), | |
| 2392 | ignore_directory_in_diagnostics_source_blocks: Vec<String> = (Vec::new(), parse_string_push, [UNTRACKED], | |
| 2393 | "do not display the source code block in diagnostics for files in the directory"), | |
| 2394 | incremental_ignore_spans: bool = (false, parse_bool, [TRACKED], | |
| 2395 | "ignore spans during ICH computation -- used for testing (default: no)"), | |
| 2396 | incremental_info: bool = (false, parse_bool, [UNTRACKED], | |
| 2397 | "print high-level information about incremental reuse (or the lack thereof) \ | |
| 2398 | (default: no)"), | |
| 2399 | incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED], | |
| 2400 | "verify extended properties for incr. comp. (default: no): | |
| 2401 | - hashes of green query instances | |
| 2402 | - hash collisions of query keys | |
| 2403 | - hash collisions when creating dep-nodes"), | |
| 2404 | indirect_branch_cs_prefix: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 2405 | "add `cs` prefix to `call` and `jmp` to indirect thunks (default: no)"), | |
| 2406 | inline_llvm: bool = (true, parse_bool, [TRACKED], | |
| 2407 | "enable LLVM inlining (default: yes)"), | |
| 2408 | inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2409 | "enable MIR inlining (default: no)"), | |
| 2410 | inline_mir_forwarder_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2411 | "inlining threshold when the caller is a simple forwarding function (default: 30)"), | |
| 2412 | inline_mir_hint_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2413 | "inlining threshold for functions with inline hint (default: 100)"), | |
| 2414 | inline_mir_preserve_debug: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2415 | "when MIR inlining, whether to preserve debug info for callee variables \ | |
| 2416 | (default: preserve for debuginfo != None, otherwise remove)"), | |
| 2417 | inline_mir_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2418 | "a default MIR inlining threshold (default: 50)"), | |
| 2419 | input_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 2420 | "print some statistics about AST and HIR (default: no)"), | |
| 2421 | instrument_mcount: bool = (false, parse_bool, [TRACKED], | |
| 2422 | "insert function instrument code for mcount-based tracing (default: no)"), | |
| 2423 | instrument_xray: Option<InstrumentXRay> = (None, parse_instrument_xray, [TRACKED], | |
| 2424 | "insert function instrument code for XRay-based tracing (default: no) | |
| 2425 | Optional extra settings: | |
| 2426 | `=always` | |
| 2427 | `=never` | |
| 2428 | `=ignore-loops` | |
| 2429 | `=instruction-threshold=N` | |
| 2430 | `=skip-entry` | |
| 2431 | `=skip-exit` | |
| 2432 | Multiple options can be combined with commas."), | |
| 2433 | large_data_threshold: Option<u64> = (None, parse_opt_number, [TRACKED], | |
| 2434 | "set the threshold for objects to be stored in a \"large data\" section \ | |
| 2435 | (only effective with -Ccode-model=medium, default: 65536)"), | |
| 2436 | layout_seed: Option<u64> = (None, parse_opt_number, [TRACKED], | |
| 2437 | "seed layout randomization"), | |
| 2438 | link_directives: bool = (true, parse_bool, [TRACKED], | |
| 2439 | "honor #[link] directives in the compiled crate (default: yes)"), | |
| 2440 | link_native_libraries: bool = (true, parse_bool, [UNTRACKED], | |
| 2441 | "link native libraries in the linker invocation (default: yes)"), | |
| 2442 | link_only: bool = (false, parse_bool, [TRACKED], | |
| 2443 | "link the `.rlink` file generated by `-Z no-link` (default: no)"), | |
| 2444 | lint_llvm_ir: bool = (false, parse_bool, [TRACKED], | |
| 2445 | "lint LLVM IR (default: no)"), | |
| 2446 | lint_mir: bool = (false, parse_bool, [UNTRACKED], | |
| 2447 | "lint MIR before and after each transformation"), | |
| 2448 | llvm_module_flag: Vec<(String, u32, String)> = (Vec::new(), parse_llvm_module_flag, [TRACKED], | |
| 2449 | "a list of module flags to pass to LLVM (space separated)"), | |
| 2450 | llvm_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED], | |
| 2451 | "a list LLVM plugins to enable (space separated)"), | |
| 2452 | llvm_time_trace: bool = (false, parse_bool, [UNTRACKED], | |
| 2453 | "generate JSON tracing data file from LLVM data (default: no)"), | |
| 2454 | location_detail: LocationDetail = (LocationDetail::all(), parse_location_detail, [TRACKED], | |
| 2455 | "what location details should be tracked when using caller_location, either \ | |
| 2456 | `none`, or a comma separated list of location details, for which \ | |
| 2457 | valid options are `file`, `line`, and `column` (default: `file,line,column`)"), | |
| 2458 | ls: Vec<String> = (Vec::new(), parse_list, [UNTRACKED], | |
| 2459 | "decode and print various parts of the crate metadata for a library crate \ | |
| 2460 | (space separated)"), | |
| 2461 | macro_backtrace: bool = (false, parse_bool, [UNTRACKED], | |
| 2462 | "show macro backtraces (default: no)"), | |
| 2463 | macro_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 2464 | "print some statistics about macro expansions (default: no)"), | |
| 2465 | maximal_hir_to_mir_coverage: bool = (false, parse_bool, [TRACKED], | |
| 2466 | "save as much information as possible about the correspondence between MIR and HIR \ | |
| 2467 | as source scopes (default: no)"), | |
| 2468 | merge_functions: Option<MergeFunctions> = (None, parse_merge_functions, [TRACKED], | |
| 2469 | "control the operation of the MergeFunctions LLVM pass, taking \ | |
| 2470 | the same values as the target option of the same name"), | |
| 2471 | meta_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 2472 | "gather metadata statistics (default: no)"), | |
| 2473 | metrics_dir: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED], | |
| 2474 | "the directory metrics emitted by rustc are dumped into (implicitly enables default set of metrics)"), | |
| 2475 | min_function_alignment: Option<Align> = (None, parse_align, [TRACKED], | |
| 2476 | "align all functions to at least this many bytes. Must be a power of 2"), | |
| 2477 | min_recursion_limit: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2478 | "set a minimum recursion limit (final limit = max(this, recursion_limit_from_crate))"), | |
| 2479 | mir_emit_retag: bool = (false, parse_bool, [TRACKED], | |
| 2480 | "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \ | |
| 2481 | (default: no)"), | |
| 2482 | mir_enable_passes: Vec<(String, bool)> = (Vec::new(), parse_list_with_polarity, [TRACKED], | |
| 2483 | "use like `-Zmir-enable-passes=+DestinationPropagation,-InstSimplify`. Forces the \ | |
| 2484 | specified passes to be enabled, overriding all other checks. In particular, this will \ | |
| 2485 | enable unsound (known-buggy and hence usually disabled) passes without further warning! \ | |
| 2486 | Passes that are not specified are enabled or disabled by other flags as usual."), | |
| 2487 | mir_include_spans: MirIncludeSpans = (MirIncludeSpans::default(), parse_mir_include_spans, [UNTRACKED], | |
| 2488 | "include extra comments in mir pretty printing, like line numbers and statement indices, \ | |
| 2489 | details about types, etc. (boolean for all passes, 'nll' to enable in NLL MIR only, default: 'nll')"), | |
| 2490 | mir_opt_bisect_limit: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2491 | "limit the number of MIR optimization pass executions (global across all bodies). \ | |
| 2492 | Pass executions after this limit are skipped and reported. (default: no limit)"), | |
| 2493 | #[rustc_lint_opt_deny_field_access("use `Session::mir_opt_level` instead of this field")] | |
| 2494 | mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2495 | "MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"), | |
| 2496 | mir_preserve_ub: bool = (false, parse_bool, [TRACKED], | |
| 2497 | "keep place mention statements and reads in trivial SwitchInt terminators, which are interpreted \ | |
| 2498 | e.g., by miri; implies -Zmir-opt-level=0 (default: no)"), | |
| 2499 | mir_strip_debuginfo: MirStripDebugInfo = (MirStripDebugInfo::None, parse_mir_strip_debuginfo, [TRACKED], | |
| 2500 | "Whether to remove some of the MIR debug info from methods. Default: None"), | |
| 2501 | move_size_limit: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2502 | "the size at which the `large_assignments` lint starts to be emitted"), | |
| 2503 | mutable_noalias: bool = (true, parse_bool, [TRACKED], | |
| 2504 | "emit noalias metadata for mutable references (default: yes)"), | |
| 2505 | namespaced_crates: bool = (false, parse_bool, [TRACKED], | |
| 2506 | "allow crates to be namespaced by other crates (default: no)"), | |
| 2507 | next_solver: NextSolverConfig = (NextSolverConfig::default(), parse_next_solver_config, [TRACKED], | |
| 2508 | "enable and configure the next generation trait solver used by rustc"), | |
| 2509 | nll_facts: bool = (false, parse_bool, [UNTRACKED], | |
| 2510 | "dump facts from NLL analysis into side files (default: no)"), | |
| 2511 | nll_facts_dir: String = ("nll-facts".to_string(), parse_string, [UNTRACKED], | |
| 2512 | "the directory the NLL facts are dumped into (default: `nll-facts`)"), | |
| 2513 | no_analysis: bool = (false, parse_no_value, [UNTRACKED], | |
| 2514 | "parse and expand the source, but run no analysis"), | |
| 2515 | no_codegen: bool = (false, parse_no_value, [TRACKED_NO_CRATE_HASH], | |
| 2516 | "run all passes except codegen; no output"), | |
| 2517 | no_generate_arange_section: bool = (false, parse_no_value, [TRACKED], | |
| 2518 | "omit DWARF address ranges that give faster lookups"), | |
| 2519 | no_implied_bounds_compat: bool = (false, parse_bool, [TRACKED], | |
| 2520 | "disable the compatibility version of the `implied_bounds_ty` query"), | |
| 2521 | no_leak_check: bool = (false, parse_no_value, [UNTRACKED], | |
| 2522 | "disable the 'leak check' for subtyping; unsound, but useful for tests"), | |
| 2523 | no_link: bool = (false, parse_no_value, [TRACKED], | |
| 2524 | "compile without linking"), | |
| 2525 | no_parallel_backend: bool = (false, parse_no_value, [UNTRACKED], | |
| 2526 | "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"), | |
| 2527 | no_profiler_runtime: bool = (false, parse_no_value, [TRACKED], | |
| 2528 | "prevent automatic injection of the profiler_builtins crate"), | |
| 2529 | no_steal_thir: bool = (false, parse_bool, [UNTRACKED], | |
| 2530 | "don't steal the THIR when we're done with it; useful for rustc drivers (default: no)"), | |
| 2531 | no_trait_vptr: bool = (false, parse_no_value, [TRACKED], | |
| 2532 | "disable generation of trait vptr in vtable for upcasting"), | |
| 2533 | no_unique_section_names: bool = (false, parse_bool, [TRACKED], | |
| 2534 | "do not use unique names for text and data sections when -Z function-sections is used"), | |
| 2535 | normalize_docs: bool = (false, parse_bool, [TRACKED], | |
| 2536 | "normalize associated items in rustdoc when generating documentation"), | |
| 2537 | offload: Vec<crate::config::Offload> = (Vec::new(), parse_offload, [TRACKED], | |
| 2538 | "a list of offload flags to enable | |
| 2539 | Mandatory setting: | |
| 2540 | `=Enable` | |
| 2541 | Currently the only option available"), | |
| 2542 | on_broken_pipe: OnBrokenPipe = (OnBrokenPipe::Default, parse_on_broken_pipe, [TRACKED], | |
| 2543 | "behavior of std::io::ErrorKind::BrokenPipe (SIGPIPE)"), | |
| 2544 | osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], | |
| 2545 | "pass `-install_name @rpath/...` to the macOS linker (default: no)"), | |
| 2546 | packed_bundled_libs: bool = (false, parse_bool, [TRACKED], | |
| 2547 | "change rlib format to store native libraries as archives"), | |
| 2548 | panic_abort_tests: bool = (false, parse_bool, [TRACKED], | |
| 2549 | "support compiling tests with panic=abort (default: no)"), | |
| 2550 | panic_in_drop: PanicStrategy = (PanicStrategy::Unwind, parse_panic_strategy, [TRACKED], | |
| 2551 | "panic strategy for panics in drops"), | |
| 2552 | parse_crate_root_only: bool = (false, parse_bool, [UNTRACKED], | |
| 2553 | "parse the crate root file only; do not parse other files, compile, assemble, or link \ | |
| 2554 | (default: no)"), | |
| 2555 | patchable_function_entry: PatchableFunctionEntry = (PatchableFunctionEntry::default(), parse_patchable_function_entry, [TRACKED], | |
| 2556 | "nop padding at function entry"), | |
| 2557 | plt: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2558 | "whether to use the PLT when calling into shared libraries; | |
| 2559 | only has effect for PIC code on systems with ELF binaries | |
| 2560 | (default: PLT is disabled if full relro is enabled on x86_64)"), | |
| 2561 | polonius: Polonius = (Polonius::default(), parse_polonius, [TRACKED], | |
| 2562 | "enable polonius-based borrow-checker (default: no)"), | |
| 2563 | pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED], | |
| 2564 | "a single extra argument to prepend the linker invocation (can be used several times)"), | |
| 2565 | pre_link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED], | |
| 2566 | "extra arguments to prepend to the linker invocation (space separated)"), | |
| 2567 | precise_enum_drop_elaboration: bool = (true, parse_bool, [TRACKED], | |
| 2568 | "use a more precise version of drop elaboration for matches on enums (default: yes). \ | |
| 2569 | This results in better codegen, but has caused miscompilations on some tier 2 platforms. \ | |
| 2570 | See #77382 and #74551."), | |
| 2571 | #[rustc_lint_opt_deny_field_access("use `Session::print_codegen_stats` instead of this field")] | |
| 2572 | print_codegen_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 2573 | "print codegen statistics (default: no)"), | |
| 2574 | print_llvm_passes: bool = (false, parse_bool, [UNTRACKED], | |
| 2575 | "print the LLVM optimization passes being run (default: no)"), | |
| 2576 | print_mono_items: bool = (false, parse_bool, [UNTRACKED], | |
| 2577 | "print the result of the monomorphization collection pass (default: no)"), | |
| 2578 | print_type_sizes: bool = (false, parse_bool, [UNTRACKED], | |
| 2579 | "print layout information for each type encountered (default: no)"), | |
| 2580 | proc_macro_backtrace: bool = (false, parse_bool, [UNTRACKED], | |
| 2581 | "show backtraces for panics during proc-macro execution (default: no)"), | |
| 2582 | proc_macro_execution_strategy: ProcMacroExecutionStrategy = (ProcMacroExecutionStrategy::SameThread, | |
| 2583 | parse_proc_macro_execution_strategy, [UNTRACKED], | |
| 2584 | "how to run proc-macro code (default: same-thread)"), | |
| 2585 | profile_closures: bool = (false, parse_no_value, [UNTRACKED], | |
| 2586 | "profile size of closures"), | |
| 2587 | profile_sample_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 2588 | "use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)"), | |
| 2589 | profiler_runtime: String = (String::from("profiler_builtins"), parse_string, [TRACKED], | |
| 2590 | "name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)"), | |
| 2591 | query_dep_graph: bool = (false, parse_bool, [UNTRACKED], | |
| 2592 | "enable queries of the dependency graph for regression testing (default: no)"), | |
| 2593 | randomize_layout: bool = (false, parse_bool, [TRACKED], | |
| 2594 | "randomize the layout of types (default: no)"), | |
| 2595 | reg_struct_return: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 2596 | "On x86-32 targets, it overrides the default ABI to return small structs in registers. | |
| 2597 | It is UNSOUND to link together crates that use different values for this flag!"), | |
| 2598 | regparm: Option<u32> = (None, parse_opt_number, [TRACKED TARGET_MODIFIER], | |
| 2599 | "On x86-32 targets, setting this to N causes the compiler to pass N arguments \ | |
| 2600 | in registers EAX, EDX, and ECX instead of on the stack for\ | |
| 2601 | \"C\", \"cdecl\", and \"stdcall\" fn.\ | |
| 2602 | It is UNSOUND to link together crates that use different values for this flag!"), | |
| 2603 | relax_elf_relocations: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2604 | "whether ELF relocations can be relaxed"), | |
| 2605 | remap_cwd_prefix: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 2606 | "remap paths under the current working directory to this path prefix"), | |
| 2607 | remark_dir: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED], | |
| 2608 | "directory into which to write optimization remarks (if not specified, they will be \ | |
| 2609 | written to standard error output)"), | |
| 2610 | retpoline: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 2611 | "enables retpoline-indirect-branches and retpoline-indirect-calls target features (default: no)"), | |
| 2612 | retpoline_external_thunk: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 2613 | "enables retpoline-external-thunk, retpoline-indirect-branches and retpoline-indirect-calls \ | |
| 2614 | target features (default: no)"), | |
| 2615 | #[rustc_lint_opt_deny_field_access("use `Session::sanitizers()` instead of this field")] | |
| 2616 | sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED TARGET_MODIFIER], | |
| 2617 | "use a sanitizer"), | |
| 2618 | sanitizer_cfi_canonical_jump_tables: Option<bool> = (Some(true), parse_opt_bool, [TRACKED], | |
| 2619 | "enable canonical jump tables (default: yes)"), | |
| 2620 | sanitizer_cfi_generalize_pointers: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2621 | "enable generalizing pointer types (default: no)"), | |
| 2622 | sanitizer_cfi_normalize_integers: Option<bool> = (None, parse_opt_bool, [TRACKED TARGET_MODIFIER], | |
| 2623 | "enable normalizing integer types (default: no)"), | |
| 2624 | sanitizer_dataflow_abilist: Vec<String> = (Vec::new(), parse_comma_list, [TRACKED], | |
| 2625 | "additional ABI list files that control how shadow parameters are passed (comma separated)"), | |
| 2626 | sanitizer_kcfi_arity: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2627 | "enable KCFI arity indicator (default: no)"), | |
| 2628 | sanitizer_memory_track_origins: usize = (0, parse_sanitizer_memory_track_origins, [TRACKED], | |
| 2629 | "enable origins tracking in MemorySanitizer"), | |
| 2630 | sanitizer_recover: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED], | |
| 2631 | "enable recovery for selected sanitizers"), | |
| 2632 | saturating_float_casts: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2633 | "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ | |
| 2634 | the max/min integer respectively, and NaN is mapped to 0 (default: yes)"), | |
| 2635 | self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled, | |
| 2636 | parse_switch_with_opt_path, [UNTRACKED], | |
| 2637 | "run the self profiler and output the raw event data"), | |
| 2638 | self_profile_counter: String = ("wall-time".to_string(), parse_string, [UNTRACKED], | |
| 2639 | "counter used by the self profiler (default: `wall-time`), one of: | |
| 2640 | `wall-time` (monotonic clock, i.e. `std::time::Instant`) | |
| 2641 | `instructions:u` (retired instructions, userspace-only) | |
| 2642 | `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy)" | |
| 2643 | ), | |
| 2644 | /// keep this in sync with the event filter names in librustc_data_structures/profiling.rs | |
| 2645 | self_profile_events: Option<Vec<String>> = (None, parse_opt_comma_list, [UNTRACKED], | |
| 2646 | "specify the events recorded by the self profiler; | |
| 2647 | for example: `-Z self-profile-events=default,query-keys` | |
| 2648 | all options: none, all, default, generic-activity, query-provider, query-cache-hit | |
| 2649 | query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes"), | |
| 2650 | share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2651 | "make the current crate share its generic instantiations"), | |
| 2652 | shell_argfiles: bool = (false, parse_bool, [UNTRACKED], | |
| 2653 | "allow argument files to be specified with POSIX \"shell-style\" argument quoting"), | |
| 2654 | simulate_remapped_rust_src_base: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 2655 | "simulate the effect of remap-debuginfo = true at bootstrapping by remapping path \ | |
| 2656 | to rust's source base directory. only meant for testing purposes"), | |
| 2657 | small_data_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 2658 | "Set the threshold for objects to be stored in a \"small data\" section"), | |
| 2659 | span_debug: bool = (false, parse_bool, [UNTRACKED], | |
| 2660 | "forward proc_macro::Span's `Debug` impl to `Span`"), | |
| 2661 | /// o/w tests have closure@path | |
| 2662 | span_free_formats: bool = (false, parse_bool, [UNTRACKED], | |
| 2663 | "exclude spans when debug-printing compiler state (default: no)"), | |
| 2664 | split_dwarf_inlining: bool = (false, parse_bool, [TRACKED], | |
| 2665 | "provide minimal debug info in the object/executable to facilitate online \ | |
| 2666 | symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF"), | |
| 2667 | split_dwarf_kind: SplitDwarfKind = (SplitDwarfKind::Split, parse_split_dwarf_kind, [TRACKED], | |
| 2668 | "split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform) | |
| 2669 | (default: `split`) | |
| 2670 | ||
| 2671 | `split`: sections which do not require relocation are written into a DWARF object (`.dwo`) | |
| 2672 | file which is ignored by the linker | |
| 2673 | `single`: sections which do not require relocation are written into object file but ignored | |
| 2674 | by the linker"), | |
| 2675 | split_dwarf_out_dir : Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 2676 | "location for writing split DWARF objects (`.dwo`) if enabled"), | |
| 2677 | split_lto_unit: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2678 | "enable LTO unit splitting (default: no)"), | |
| 2679 | src_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_src_file_hash, [TRACKED], | |
| 2680 | "hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`)"), | |
| 2681 | #[rustc_lint_opt_deny_field_access("use `Session::stack_protector` instead of this field")] | |
| 2682 | stack_protector: StackProtector = (StackProtector::None, parse_stack_protector, [TRACKED], | |
| 2683 | "control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)"), | |
| 2684 | staticlib_allow_rdylib_deps: bool = (false, parse_bool, [TRACKED], | |
| 2685 | "allow staticlibs to have rust dylib dependencies"), | |
| 2686 | staticlib_prefer_dynamic: bool = (false, parse_bool, [TRACKED], | |
| 2687 | "prefer dynamic linking to static linking for staticlibs (default: no)"), | |
| 2688 | strict_init_checks: bool = (false, parse_bool, [TRACKED], | |
| 2689 | "control if mem::uninitialized and mem::zeroed panic on more UB"), | |
| 2690 | #[rustc_lint_opt_deny_field_access("use `Session::teach` instead of this field")] | |
| 2691 | teach: bool = (false, parse_bool, [TRACKED], | |
| 2692 | "show extended diagnostic help (default: no)"), | |
| 2693 | temps_dir: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| 2694 | "the directory the intermediate files are written to"), | |
| 2695 | terminal_urls: TerminalUrl = (TerminalUrl::No, parse_terminal_url, [UNTRACKED], | |
| 2696 | "use the OSC 8 hyperlink terminal specification to print hyperlinks in the compiler output"), | |
| 2697 | #[rustc_lint_opt_deny_field_access("use `Session::lto` instead of this field")] | |
| 2698 | thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2699 | "enable ThinLTO when possible"), | |
| 2700 | /// We default to 1 here since we want to behave like | |
| 2701 | /// a sequential compiler for now. This'll likely be adjusted | |
| 2702 | /// in the future. Note that -Zthreads=0 is the way to get | |
| 2703 | /// the num_cpus behavior. | |
| 2704 | #[rustc_lint_opt_deny_field_access("use `Session::threads` instead of this field")] | |
| 2705 | threads: usize = (1, parse_threads, [UNTRACKED], | |
| 2706 | "use a thread pool with N threads"), | |
| 2707 | time_llvm_passes: bool = (false, parse_bool, [UNTRACKED], | |
| 2708 | "measure time of each LLVM pass (default: no)"), | |
| 2709 | time_passes: bool = (false, parse_bool, [UNTRACKED], | |
| 2710 | "measure time of each rustc pass (default: no)"), | |
| 2711 | time_passes_format: TimePassesFormat = (TimePassesFormat::Text, parse_time_passes_format, [UNTRACKED], | |
| 2712 | "the format to use for -Z time-passes (`text` (default) or `json`)"), | |
| 2713 | tiny_const_eval_limit: bool = (false, parse_bool, [TRACKED], | |
| 2714 | "sets a tiny, non-configurable limit for const eval; useful for compiler tests"), | |
| 2715 | #[rustc_lint_opt_deny_field_access("use `Session::tls_model` instead of this field")] | |
| 2716 | tls_model: Option<TlsModel> = (None, parse_tls_model, [TRACKED], | |
| 2717 | "choose the TLS model to use (`rustc --print tls-models` for details)"), | |
| 2718 | trace_macros: bool = (false, parse_bool, [UNTRACKED], | |
| 2719 | "for every macro invocation, print its name and arguments (default: no)"), | |
| 2720 | track_diagnostics: bool = (false, parse_bool, [UNTRACKED], | |
| 2721 | "tracks where in rustc a diagnostic was emitted"), | |
| 2722 | translate_remapped_path_to_local_path: bool = (true, parse_bool, [TRACKED], | |
| 2723 | "translate remapped paths into local paths when possible (default: yes)"), | |
| 2724 | trap_unreachable: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2725 | "generate trap instructions for unreachable intrinsics (default: use target setting, usually yes)"), | |
| 2726 | treat_err_as_bug: Option<NonZero<usize>> = (None, parse_treat_err_as_bug, [TRACKED], | |
| 2727 | "treat the `val`th error that occurs as bug (default if not specified: 0 - don't treat errors as bugs. \ | |
| 2728 | default if specified without a value: 1 - treat the first error as bug)"), | |
| 2729 | trim_diagnostic_paths: bool = (true, parse_bool, [UNTRACKED], | |
| 2730 | "in diagnostics, use heuristics to shorten paths referring to items"), | |
| 2731 | tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED], | |
| 2732 | "select processor to schedule for (`rustc --print target-cpus` for details)"), | |
| 2733 | #[rustc_lint_opt_deny_field_access("use `TyCtxt::use_typing_mode_borrowck` instead of this field")] | |
| 2734 | typing_mode_borrowck: bool = (false, parse_bool, [TRACKED], | |
| 2735 | "enable `TypingMode::Borrowck`, changing the way opaque types are handled during MIR borrowck"), | |
| 2736 | #[rustc_lint_opt_deny_field_access("use `Session::ub_checks` instead of this field")] | |
| 2737 | ub_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2738 | "emit runtime checks for Undefined Behavior (default: -Cdebug-assertions)"), | |
| 2739 | ui_testing: bool = (false, parse_bool, [UNTRACKED], | |
| 2740 | "emit compiler diagnostics in a form suitable for UI testing (default: no)"), | |
| 2741 | uninit_const_chunk_threshold: usize = (16, parse_number, [TRACKED], | |
| 2742 | "allow generating const initializers with mixed init/uninit chunks, \ | |
| 2743 | and set the maximum number of chunks for which this is allowed (default: 16)"), | |
| 2744 | unleash_the_miri_inside_of_you: bool = (false, parse_bool, [TRACKED], | |
| 2745 | "take the brakes off const evaluation. NOTE: this is unsound (default: no)"), | |
| 2746 | unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED], | |
| 2747 | "present the input source, unstable (and less-pretty) variants; | |
| 2748 | `normal`, `identified`, | |
| 2749 | `expanded`, `expanded,identified`, | |
| 2750 | `expanded,hygiene` (with internal representations), | |
| 2751 | `ast-tree` (raw AST before expansion), | |
| 2752 | `ast-tree,expanded` (raw AST after expansion), | |
| 2753 | `hir` (the HIR), `hir,identified`, | |
| 2754 | `hir,typed` (HIR with types for each node), | |
| 2755 | `hir-tree` (dump the raw HIR), | |
| 2756 | `thir-tree`, `thir-flat`, | |
| 2757 | `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)"), | |
| 2758 | unsound_mir_opts: bool = (false, parse_bool, [TRACKED], | |
| 2759 | "enable unsound and buggy MIR optimizations (default: no)"), | |
| 2760 | /// This name is kind of confusing: Most unstable options enable something themselves, while | |
| 2761 | /// this just allows "normal" options to be feature-gated. | |
| 2762 | /// | |
| 2763 | /// The main check for `-Zunstable-options` takes place separately from the | |
| 2764 | /// usual parsing of `-Z` options (see [`crate::config::nightly_options`]), | |
| 2765 | /// so this boolean value is mostly used for enabling unstable _values_ of | |
| 2766 | /// stable options. That separate check doesn't handle boolean values, so | |
| 2767 | /// to avoid an inconsistent state we also forbid them here. | |
| 2768 | #[rustc_lint_opt_deny_field_access("use `Session::unstable_options` instead of this field")] | |
| 2769 | unstable_options: bool = (false, parse_no_value, [UNTRACKED], | |
| 2770 | "adds unstable command line options to rustc interface (default: no)"), | |
| 2771 | use_ctors_section: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2772 | "use legacy .ctors section for initializers rather than .init_array"), | |
| 2773 | use_sync_unwind: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 2774 | "Generate sync unwind tables instead of async unwind tables (default: no)"), | |
| 2775 | validate_mir: bool = (false, parse_bool, [UNTRACKED], | |
| 2776 | "validate MIR after each transformation"), | |
| 2777 | verbose_asm: bool = (false, parse_bool, [TRACKED], | |
| 2778 | "add descriptive comments from LLVM to the assembly (may change behavior) (default: no)"), | |
| 2779 | #[rustc_lint_opt_deny_field_access("use `Session::verbose_internals` instead of this field")] | |
| 2780 | verbose_internals: bool = (false, parse_bool, [TRACKED_NO_CRATE_HASH], | |
| 2781 | "in general, enable more debug printouts (default: no)"), | |
| 2782 | #[rustc_lint_opt_deny_field_access("use `Session::verify_llvm_ir` instead of this field")] | |
| 2783 | verify_llvm_ir: bool = (false, parse_bool, [TRACKED], | |
| 2784 | "verify LLVM IR (default: no)"), | |
| 2785 | virtual_function_elimination: bool = (false, parse_bool, [TRACKED], | |
| 2786 | "enables dead virtual function elimination optimization. \ | |
| 2787 | Requires `-Clto[=[fat,yes]]`"), | |
| 2788 | wasi_exec_model: Option<WasiExecModel> = (None, parse_wasi_exec_model, [TRACKED], | |
| 2789 | "whether to build a wasi command or reactor"), | |
| 2790 | // This option only still exists to provide a more gradual transition path for people who need | |
| 2791 | // the spec-complaint C ABI to be used. | |
| 2792 | // FIXME remove this after a couple releases | |
| 2793 | wasm_c_abi: () = ((), parse_wasm_c_abi, [TRACKED], | |
| 2794 | "use spec-compliant C ABI for `wasm32-unknown-unknown` (deprecated, always enabled)"), | |
| 2795 | write_long_types_to_disk: bool = (true, parse_bool, [UNTRACKED], | |
| 2796 | "whether long type names should be written to files instead of being printed in errors"), | |
| 2797 | // tidy-alphabetical-end | |
| 2798 | ||
| 2799 | // If you add a new option, please update: | |
| 2800 | // - compiler/rustc_interface/src/tests.rs | |
| 2801 | // - src/doc/unstable-book/src/compiler-flags | |
| 2802 | } | |
| 2222 | include!("options/unstable.rs"); |
compiler/rustc_session/src/options/unstable.rs created+585| ... | ... | @@ -0,0 +1,585 @@ |
| 1 | options! { | |
| 2 | UnstableOptions, UnstableOptionsTargetModifiers, Z_OPTIONS, dbopts, "Z", "unstable", | |
| 3 | ||
| 4 | // If you add a new option, please update: | |
| 5 | // - compiler/rustc_interface/src/tests.rs | |
| 6 | // - src/doc/unstable-book/src/compiler-flags | |
| 7 | ||
| 8 | // tidy-alphabetical-start | |
| 9 | allow_features: Option<Vec<String>> = (None, parse_opt_comma_list, [TRACKED], | |
| 10 | "only allow the listed language features to be enabled in code (comma separated)"), | |
| 11 | always_encode_mir: bool = (false, parse_bool, [TRACKED], | |
| 12 | "encode MIR of all functions into the crate metadata (default: no)"), | |
| 13 | annotate_moves: AnnotateMoves = (AnnotateMoves::Disabled, parse_annotate_moves, [TRACKED], | |
| 14 | "emit debug info for compiler-generated move and copy operations \ | |
| 15 | to make them visible in profilers. Can be a boolean or a size limit in bytes (default: disabled)"), | |
| 16 | assert_incr_state: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| 17 | "assert that the incremental cache is in given state: \ | |
| 18 | either `loaded` or `not-loaded`."), | |
| 19 | assume_incomplete_release: bool = (false, parse_bool, [TRACKED], | |
| 20 | "make cfg(version) treat the current version as incomplete (default: no)"), | |
| 21 | autodiff: Vec<crate::config::AutoDiff> = (Vec::new(), parse_autodiff, [TRACKED], | |
| 22 | "a list of autodiff flags to enable | |
| 23 | Mandatory setting: | |
| 24 | `=Enable` | |
| 25 | Optional extra settings: | |
| 26 | `=PrintTA` | |
| 27 | `=PrintAA` | |
| 28 | `=PrintPerf` | |
| 29 | `=PrintSteps` | |
| 30 | `=PrintModBefore` | |
| 31 | `=PrintModAfter` | |
| 32 | `=PrintModFinal` | |
| 33 | `=PrintPasses`, | |
| 34 | `=NoPostopt` | |
| 35 | `=LooseTypes` | |
| 36 | `=Inline` | |
| 37 | Multiple options can be combined with commas."), | |
| 38 | #[rustc_lint_opt_deny_field_access("use `Session::binary_dep_depinfo` instead of this field")] | |
| 39 | binary_dep_depinfo: bool = (false, parse_bool, [TRACKED], | |
| 40 | "include artifacts (sysroot, crate dependencies) used during compilation in dep-info \ | |
| 41 | (default: no)"), | |
| 42 | box_noalias: bool = (true, parse_bool, [TRACKED], | |
| 43 | "emit noalias metadata for box (default: yes)"), | |
| 44 | branch_protection: Option<BranchProtection> = (None, parse_branch_protection, [TRACKED TARGET_MODIFIER], | |
| 45 | "set options for branch target identification and pointer authentication on AArch64"), | |
| 46 | build_sdylib_interface: bool = (false, parse_bool, [UNTRACKED], | |
| 47 | "whether the stable interface is being built"), | |
| 48 | cache_proc_macros: bool = (false, parse_bool, [TRACKED], | |
| 49 | "cache the results of derive proc macro invocations (potentially unsound!) (default: no"), | |
| 50 | cf_protection: CFProtection = (CFProtection::None, parse_cfprotection, [TRACKED], | |
| 51 | "instrument control-flow architecture protection"), | |
| 52 | check_cfg_all_expected: bool = (false, parse_bool, [UNTRACKED], | |
| 53 | "show all expected values in check-cfg diagnostics (default: no)"), | |
| 54 | checksum_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_cargo_src_file_hash, [TRACKED], | |
| 55 | "hash algorithm of source files used to check freshness in cargo (`blake3` or `sha256`)"), | |
| 56 | codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED], | |
| 57 | "the backend to use"), | |
| 58 | codegen_source_order: bool = (false, parse_bool, [UNTRACKED], | |
| 59 | "emit mono items in the order of spans in source files (default: no)"), | |
| 60 | contract_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 61 | "emit runtime checks for contract pre- and post-conditions (default: no)"), | |
| 62 | coverage_options: CoverageOptions = (CoverageOptions::default(), parse_coverage_options, [TRACKED], | |
| 63 | "control details of coverage instrumentation"), | |
| 64 | crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED], | |
| 65 | "inject the given attribute in the crate"), | |
| 66 | cross_crate_inline_threshold: InliningThreshold = (InliningThreshold::Sometimes(100), parse_inlining_threshold, [TRACKED], | |
| 67 | "threshold to allow cross crate inlining of functions"), | |
| 68 | debug_info_for_profiling: bool = (false, parse_bool, [TRACKED], | |
| 69 | "emit discriminators and other data necessary for AutoFDO"), | |
| 70 | debug_info_type_line_numbers: bool = (false, parse_bool, [TRACKED], | |
| 71 | "emit type and line information for additional data types (default: no)"), | |
| 72 | debuginfo_compression: DebugInfoCompression = (DebugInfoCompression::None, parse_debuginfo_compression, [TRACKED], | |
| 73 | "compress debug info sections (none, zlib, zstd, default: none)"), | |
| 74 | deduplicate_diagnostics: bool = (true, parse_bool, [UNTRACKED], | |
| 75 | "deduplicate identical diagnostics (default: yes)"), | |
| 76 | default_visibility: Option<SymbolVisibility> = (None, parse_opt_symbol_visibility, [TRACKED], | |
| 77 | "overrides the `default_visibility` setting of the target"), | |
| 78 | dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED], | |
| 79 | "in dep-info output, omit targets for tracking dependencies of the dep-info files \ | |
| 80 | themselves (default: no)"), | |
| 81 | direct_access_external_data: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 82 | "Direct or use GOT indirect to reference external data symbols"), | |
| 83 | dual_proc_macros: bool = (false, parse_bool, [TRACKED], | |
| 84 | "load proc macros for both target and host, but only link to the target (default: no)"), | |
| 85 | dump_dep_graph: bool = (false, parse_bool, [UNTRACKED], | |
| 86 | "dump the dependency graph to $RUST_DEP_GRAPH (default: /tmp/dep_graph.gv) \ | |
| 87 | (default: no)"), | |
| 88 | dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| 89 | "dump MIR state to file. | |
| 90 | `val` is used to select which passes and functions to dump. For example: | |
| 91 | `all` matches all passes and functions, | |
| 92 | `foo` matches all passes for functions whose name contains 'foo', | |
| 93 | `foo & ConstProp` only the 'ConstProp' pass for function names containing 'foo', | |
| 94 | `foo | bar` all passes for function names containing 'foo' or 'bar'."), | |
| 95 | dump_mir_dataflow: bool = (false, parse_bool, [UNTRACKED], | |
| 96 | "in addition to `.mir` files, create graphviz `.dot` files with dataflow results \ | |
| 97 | (default: no)"), | |
| 98 | dump_mir_dir: String = ("mir_dump".to_string(), parse_string, [UNTRACKED], | |
| 99 | "the directory the MIR is dumped into (default: `mir_dump`)"), | |
| 100 | dump_mir_exclude_alloc_bytes: bool = (false, parse_bool, [UNTRACKED], | |
| 101 | "exclude the raw bytes of allocations when dumping MIR (used in tests) (default: no)"), | |
| 102 | dump_mir_exclude_pass_number: bool = (false, parse_bool, [UNTRACKED], | |
| 103 | "exclude the pass number when dumping MIR (used in tests) (default: no)"), | |
| 104 | dump_mir_graphviz: bool = (false, parse_bool, [UNTRACKED], | |
| 105 | "in addition to `.mir` files, create graphviz `.dot` files (default: no)"), | |
| 106 | dump_mono_stats: SwitchWithOptPath = (SwitchWithOptPath::Disabled, | |
| 107 | parse_switch_with_opt_path, [UNTRACKED], | |
| 108 | "output statistics about monomorphization collection"), | |
| 109 | dump_mono_stats_format: DumpMonoStatsFormat = (DumpMonoStatsFormat::Markdown, parse_dump_mono_stats, [UNTRACKED], | |
| 110 | "the format to use for -Z dump-mono-stats (`markdown` (default) or `json`)"), | |
| 111 | #[rustc_lint_opt_deny_field_access("use `Session::dwarf_version` instead of this field")] | |
| 112 | dwarf_version: Option<u32> = (None, parse_opt_number, [TRACKED], | |
| 113 | "version of DWARF debug information to emit (default: 2 or 4, depending on platform)"), | |
| 114 | dylib_lto: bool = (false, parse_bool, [UNTRACKED], | |
| 115 | "enables LTO for dylib crate type"), | |
| 116 | eagerly_emit_delayed_bugs: bool = (false, parse_bool, [UNTRACKED], | |
| 117 | "emit delayed bugs eagerly as errors instead of stashing them and emitting \ | |
| 118 | them only if an error has not been emitted"), | |
| 119 | ehcont_guard: bool = (false, parse_bool, [TRACKED], | |
| 120 | "generate Windows EHCont Guard tables"), | |
| 121 | embed_metadata: bool = (true, parse_bool, [TRACKED], | |
| 122 | "embed metadata in rlibs and dylibs (default: yes)"), | |
| 123 | embed_source: bool = (false, parse_bool, [TRACKED], | |
| 124 | "embed source text in DWARF debug sections (default: no)"), | |
| 125 | emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED], | |
| 126 | "emit a section containing stack size metadata (default: no)"), | |
| 127 | emscripten_wasm_eh: bool = (true, parse_bool, [TRACKED], | |
| 128 | "Use WebAssembly error handling for wasm32-unknown-emscripten"), | |
| 129 | enforce_type_length_limit: bool = (false, parse_bool, [TRACKED], | |
| 130 | "enforce the type length limit when monomorphizing instances in codegen"), | |
| 131 | experimental_default_bounds: bool = (false, parse_bool, [TRACKED], | |
| 132 | "enable default bounds for experimental group of auto traits"), | |
| 133 | export_executable_symbols: bool = (false, parse_bool, [TRACKED], | |
| 134 | "export symbols from executables, as if they were dynamic libraries"), | |
| 135 | external_clangrt: bool = (false, parse_bool, [UNTRACKED], | |
| 136 | "rely on user specified linker commands to find clangrt"), | |
| 137 | extra_const_ub_checks: bool = (false, parse_bool, [TRACKED], | |
| 138 | "turns on more checks to detect const UB, which can be slow (default: no)"), | |
| 139 | #[rustc_lint_opt_deny_field_access("use `Session::fewer_names` instead of this field")] | |
| 140 | fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 141 | "reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \ | |
| 142 | (default: no)"), | |
| 143 | fixed_x18: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 144 | "make the x18 register reserved on AArch64 (default: no)"), | |
| 145 | flatten_format_args: bool = (true, parse_bool, [TRACKED], | |
| 146 | "flatten nested format_args!() and literals into a simplified format_args!() call \ | |
| 147 | (default: yes)"), | |
| 148 | fmt_debug: FmtDebug = (FmtDebug::Full, parse_fmt_debug, [TRACKED], | |
| 149 | "how detailed `#[derive(Debug)]` should be. `full` prints types recursively, \ | |
| 150 | `shallow` prints only type names, `none` prints nothing and disables `{:?}`. (default: `full`)"), | |
| 151 | force_unstable_if_unmarked: bool = (false, parse_bool, [TRACKED], | |
| 152 | "force all crates to be `rustc_private` unstable (default: no)"), | |
| 153 | function_return: FunctionReturn = (FunctionReturn::default(), parse_function_return, [TRACKED], | |
| 154 | "replace returns with jumps to `__x86_return_thunk` (default: `keep`)"), | |
| 155 | function_sections: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 156 | "whether each function should go in its own section"), | |
| 157 | future_incompat_test: bool = (false, parse_bool, [UNTRACKED], | |
| 158 | "forces all lints to be future incompatible, used for internal testing (default: no)"), | |
| 159 | graphviz_dark_mode: bool = (false, parse_bool, [UNTRACKED], | |
| 160 | "use dark-themed colors in graphviz output (default: no)"), | |
| 161 | graphviz_font: String = ("Courier, monospace".to_string(), parse_string, [UNTRACKED], | |
| 162 | "use the given `fontname` in graphviz output; can be overridden by setting \ | |
| 163 | environment variable `RUSTC_GRAPHVIZ_FONT` (default: `Courier, monospace`)"), | |
| 164 | has_thread_local: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 165 | "explicitly enable the `cfg(target_thread_local)` directive"), | |
| 166 | help: bool = (false, parse_no_value, [UNTRACKED], "Print unstable compiler options"), | |
| 167 | higher_ranked_assumptions: bool = (false, parse_bool, [TRACKED], | |
| 168 | "allow deducing higher-ranked outlives assumptions from coroutines when proving auto traits"), | |
| 169 | hint_mostly_unused: bool = (false, parse_bool, [TRACKED], | |
| 170 | "hint that most of this crate will go unused, to minimize work for uncalled functions"), | |
| 171 | human_readable_cgu_names: bool = (false, parse_bool, [TRACKED], | |
| 172 | "generate human-readable, predictable names for codegen units (default: no)"), | |
| 173 | identify_regions: bool = (false, parse_bool, [UNTRACKED], | |
| 174 | "display unnamed regions as `'<id>`, using a non-ident unique id (default: no)"), | |
| 175 | ignore_directory_in_diagnostics_source_blocks: Vec<String> = (Vec::new(), parse_string_push, [UNTRACKED], | |
| 176 | "do not display the source code block in diagnostics for files in the directory"), | |
| 177 | incremental_ignore_spans: bool = (false, parse_bool, [TRACKED], | |
| 178 | "ignore spans during ICH computation -- used for testing (default: no)"), | |
| 179 | incremental_info: bool = (false, parse_bool, [UNTRACKED], | |
| 180 | "print high-level information about incremental reuse (or the lack thereof) \ | |
| 181 | (default: no)"), | |
| 182 | incremental_verify_ich: bool = (false, parse_bool, [UNTRACKED], | |
| 183 | "verify extended properties for incr. comp. (default: no): | |
| 184 | - hashes of green query instances | |
| 185 | - hash collisions of query keys | |
| 186 | - hash collisions when creating dep-nodes"), | |
| 187 | indirect_branch_cs_prefix: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 188 | "add `cs` prefix to `call` and `jmp` to indirect thunks (default: no)"), | |
| 189 | inline_llvm: bool = (true, parse_bool, [TRACKED], | |
| 190 | "enable LLVM inlining (default: yes)"), | |
| 191 | inline_mir: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 192 | "enable MIR inlining (default: no)"), | |
| 193 | inline_mir_forwarder_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 194 | "inlining threshold when the caller is a simple forwarding function (default: 30)"), | |
| 195 | inline_mir_hint_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 196 | "inlining threshold for functions with inline hint (default: 100)"), | |
| 197 | inline_mir_preserve_debug: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 198 | "when MIR inlining, whether to preserve debug info for callee variables \ | |
| 199 | (default: preserve for debuginfo != None, otherwise remove)"), | |
| 200 | inline_mir_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 201 | "a default MIR inlining threshold (default: 50)"), | |
| 202 | input_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 203 | "print some statistics about AST and HIR (default: no)"), | |
| 204 | instrument_mcount: bool = (false, parse_bool, [TRACKED], | |
| 205 | "insert function instrument code for mcount-based tracing (default: no)"), | |
| 206 | instrument_xray: Option<InstrumentXRay> = (None, parse_instrument_xray, [TRACKED], | |
| 207 | "insert function instrument code for XRay-based tracing (default: no) | |
| 208 | Optional extra settings: | |
| 209 | `=always` | |
| 210 | `=never` | |
| 211 | `=ignore-loops` | |
| 212 | `=instruction-threshold=N` | |
| 213 | `=skip-entry` | |
| 214 | `=skip-exit` | |
| 215 | Multiple options can be combined with commas."), | |
| 216 | large_data_threshold: Option<u64> = (None, parse_opt_number, [TRACKED], | |
| 217 | "set the threshold for objects to be stored in a \"large data\" section \ | |
| 218 | (only effective with -Ccode-model=medium, default: 65536)"), | |
| 219 | layout_seed: Option<u64> = (None, parse_opt_number, [TRACKED], | |
| 220 | "seed layout randomization"), | |
| 221 | link_directives: bool = (true, parse_bool, [TRACKED], | |
| 222 | "honor #[link] directives in the compiled crate (default: yes)"), | |
| 223 | link_native_libraries: bool = (true, parse_bool, [UNTRACKED], | |
| 224 | "link native libraries in the linker invocation (default: yes)"), | |
| 225 | link_only: bool = (false, parse_bool, [TRACKED], | |
| 226 | "link the `.rlink` file generated by `-Z no-link` (default: no)"), | |
| 227 | lint_llvm_ir: bool = (false, parse_bool, [TRACKED], | |
| 228 | "lint LLVM IR (default: no)"), | |
| 229 | lint_mir: bool = (false, parse_bool, [UNTRACKED], | |
| 230 | "lint MIR before and after each transformation"), | |
| 231 | llvm_module_flag: Vec<(String, u32, String)> = (Vec::new(), parse_llvm_module_flag, [TRACKED], | |
| 232 | "a list of module flags to pass to LLVM (space separated)"), | |
| 233 | llvm_plugins: Vec<String> = (Vec::new(), parse_list, [TRACKED], | |
| 234 | "a list LLVM plugins to enable (space separated)"), | |
| 235 | llvm_time_trace: bool = (false, parse_bool, [UNTRACKED], | |
| 236 | "generate JSON tracing data file from LLVM data (default: no)"), | |
| 237 | location_detail: LocationDetail = (LocationDetail::all(), parse_location_detail, [TRACKED], | |
| 238 | "what location details should be tracked when using caller_location, either \ | |
| 239 | `none`, or a comma separated list of location details, for which \ | |
| 240 | valid options are `file`, `line`, and `column` (default: `file,line,column`)"), | |
| 241 | ls: Vec<String> = (Vec::new(), parse_list, [UNTRACKED], | |
| 242 | "decode and print various parts of the crate metadata for a library crate \ | |
| 243 | (space separated)"), | |
| 244 | macro_backtrace: bool = (false, parse_bool, [UNTRACKED], | |
| 245 | "show macro backtraces (default: no)"), | |
| 246 | macro_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 247 | "print some statistics about macro expansions (default: no)"), | |
| 248 | maximal_hir_to_mir_coverage: bool = (false, parse_bool, [TRACKED], | |
| 249 | "save as much information as possible about the correspondence between MIR and HIR \ | |
| 250 | as source scopes (default: no)"), | |
| 251 | merge_functions: Option<MergeFunctions> = (None, parse_merge_functions, [TRACKED], | |
| 252 | "control the operation of the MergeFunctions LLVM pass, taking \ | |
| 253 | the same values as the target option of the same name"), | |
| 254 | meta_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 255 | "gather metadata statistics (default: no)"), | |
| 256 | metrics_dir: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED], | |
| 257 | "the directory metrics emitted by rustc are dumped into (implicitly enables default set of metrics)"), | |
| 258 | min_function_alignment: Option<Align> = (None, parse_align, [TRACKED], | |
| 259 | "align all functions to at least this many bytes. Must be a power of 2"), | |
| 260 | min_recursion_limit: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 261 | "set a minimum recursion limit (final limit = max(this, recursion_limit_from_crate))"), | |
| 262 | mir_emit_retag: bool = (false, parse_bool, [TRACKED], | |
| 263 | "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \ | |
| 264 | (default: no)"), | |
| 265 | mir_enable_passes: Vec<(String, bool)> = (Vec::new(), parse_list_with_polarity, [TRACKED], | |
| 266 | "use like `-Zmir-enable-passes=+DestinationPropagation,-InstSimplify`. Forces the \ | |
| 267 | specified passes to be enabled, overriding all other checks. In particular, this will \ | |
| 268 | enable unsound (known-buggy and hence usually disabled) passes without further warning! \ | |
| 269 | Passes that are not specified are enabled or disabled by other flags as usual."), | |
| 270 | mir_include_spans: MirIncludeSpans = (MirIncludeSpans::default(), parse_mir_include_spans, [UNTRACKED], | |
| 271 | "include extra comments in mir pretty printing, like line numbers and statement indices, \ | |
| 272 | details about types, etc. (boolean for all passes, 'nll' to enable in NLL MIR only, default: 'nll')"), | |
| 273 | mir_opt_bisect_limit: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 274 | "limit the number of MIR optimization pass executions (global across all bodies). \ | |
| 275 | Pass executions after this limit are skipped and reported. (default: no limit)"), | |
| 276 | #[rustc_lint_opt_deny_field_access("use `Session::mir_opt_level` instead of this field")] | |
| 277 | mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 278 | "MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"), | |
| 279 | mir_preserve_ub: bool = (false, parse_bool, [TRACKED], | |
| 280 | "keep place mention statements and reads in trivial SwitchInt terminators, which are interpreted \ | |
| 281 | e.g., by miri; implies -Zmir-opt-level=0 (default: no)"), | |
| 282 | mir_strip_debuginfo: MirStripDebugInfo = (MirStripDebugInfo::None, parse_mir_strip_debuginfo, [TRACKED], | |
| 283 | "Whether to remove some of the MIR debug info from methods. Default: None"), | |
| 284 | move_size_limit: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 285 | "the size at which the `large_assignments` lint starts to be emitted"), | |
| 286 | mutable_noalias: bool = (true, parse_bool, [TRACKED], | |
| 287 | "emit noalias metadata for mutable references (default: yes)"), | |
| 288 | namespaced_crates: bool = (false, parse_bool, [TRACKED], | |
| 289 | "allow crates to be namespaced by other crates (default: no)"), | |
| 290 | next_solver: NextSolverConfig = (NextSolverConfig::default(), parse_next_solver_config, [TRACKED], | |
| 291 | "enable and configure the next generation trait solver used by rustc"), | |
| 292 | nll_facts: bool = (false, parse_bool, [UNTRACKED], | |
| 293 | "dump facts from NLL analysis into side files (default: no)"), | |
| 294 | nll_facts_dir: String = ("nll-facts".to_string(), parse_string, [UNTRACKED], | |
| 295 | "the directory the NLL facts are dumped into (default: `nll-facts`)"), | |
| 296 | no_analysis: bool = (false, parse_no_value, [UNTRACKED], | |
| 297 | "parse and expand the source, but run no analysis"), | |
| 298 | no_codegen: bool = (false, parse_no_value, [TRACKED_NO_CRATE_HASH], | |
| 299 | "run all passes except codegen; no output"), | |
| 300 | no_generate_arange_section: bool = (false, parse_no_value, [TRACKED], | |
| 301 | "omit DWARF address ranges that give faster lookups"), | |
| 302 | no_implied_bounds_compat: bool = (false, parse_bool, [TRACKED], | |
| 303 | "disable the compatibility version of the `implied_bounds_ty` query"), | |
| 304 | no_leak_check: bool = (false, parse_no_value, [UNTRACKED], | |
| 305 | "disable the 'leak check' for subtyping; unsound, but useful for tests"), | |
| 306 | no_link: bool = (false, parse_no_value, [TRACKED], | |
| 307 | "compile without linking"), | |
| 308 | no_parallel_backend: bool = (false, parse_no_value, [UNTRACKED], | |
| 309 | "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"), | |
| 310 | no_profiler_runtime: bool = (false, parse_no_value, [TRACKED], | |
| 311 | "prevent automatic injection of the profiler_builtins crate"), | |
| 312 | no_steal_thir: bool = (false, parse_bool, [UNTRACKED], | |
| 313 | "don't steal the THIR when we're done with it; useful for rustc drivers (default: no)"), | |
| 314 | no_trait_vptr: bool = (false, parse_no_value, [TRACKED], | |
| 315 | "disable generation of trait vptr in vtable for upcasting"), | |
| 316 | no_unique_section_names: bool = (false, parse_bool, [TRACKED], | |
| 317 | "do not use unique names for text and data sections when -Z function-sections is used"), | |
| 318 | normalize_docs: bool = (false, parse_bool, [TRACKED], | |
| 319 | "normalize associated items in rustdoc when generating documentation"), | |
| 320 | offload: Vec<crate::config::Offload> = (Vec::new(), parse_offload, [TRACKED], | |
| 321 | "a list of offload flags to enable | |
| 322 | Mandatory setting: | |
| 323 | `=Enable` | |
| 324 | Currently the only option available"), | |
| 325 | on_broken_pipe: OnBrokenPipe = (OnBrokenPipe::Default, parse_on_broken_pipe, [TRACKED], | |
| 326 | "behavior of std::io::ErrorKind::BrokenPipe (SIGPIPE)"), | |
| 327 | osx_rpath_install_name: bool = (false, parse_bool, [TRACKED], | |
| 328 | "pass `-install_name @rpath/...` to the macOS linker (default: no)"), | |
| 329 | packed_bundled_libs: bool = (false, parse_bool, [TRACKED], | |
| 330 | "change rlib format to store native libraries as archives"), | |
| 331 | panic_abort_tests: bool = (false, parse_bool, [TRACKED], | |
| 332 | "support compiling tests with panic=abort (default: no)"), | |
| 333 | panic_in_drop: PanicStrategy = (PanicStrategy::Unwind, parse_panic_strategy, [TRACKED], | |
| 334 | "panic strategy for panics in drops"), | |
| 335 | parse_crate_root_only: bool = (false, parse_bool, [UNTRACKED], | |
| 336 | "parse the crate root file only; do not parse other files, compile, assemble, or link \ | |
| 337 | (default: no)"), | |
| 338 | patchable_function_entry: PatchableFunctionEntry = (PatchableFunctionEntry::default(), parse_patchable_function_entry, [TRACKED], | |
| 339 | "nop padding at function entry"), | |
| 340 | plt: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 341 | "whether to use the PLT when calling into shared libraries; | |
| 342 | only has effect for PIC code on systems with ELF binaries | |
| 343 | (default: PLT is disabled if full relro is enabled on x86_64)"), | |
| 344 | polonius: Polonius = (Polonius::default(), parse_polonius, [TRACKED], | |
| 345 | "enable polonius-based borrow-checker (default: no)"), | |
| 346 | pre_link_arg: (/* redirected to pre_link_args */) = ((), parse_string_push, [UNTRACKED], | |
| 347 | "a single extra argument to prepend the linker invocation (can be used several times)"), | |
| 348 | pre_link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED], | |
| 349 | "extra arguments to prepend to the linker invocation (space separated)"), | |
| 350 | precise_enum_drop_elaboration: bool = (true, parse_bool, [TRACKED], | |
| 351 | "use a more precise version of drop elaboration for matches on enums (default: yes). \ | |
| 352 | This results in better codegen, but has caused miscompilations on some tier 2 platforms. \ | |
| 353 | See #77382 and #74551."), | |
| 354 | #[rustc_lint_opt_deny_field_access("use `Session::print_codegen_stats` instead of this field")] | |
| 355 | print_codegen_stats: bool = (false, parse_bool, [UNTRACKED], | |
| 356 | "print codegen statistics (default: no)"), | |
| 357 | print_llvm_passes: bool = (false, parse_bool, [UNTRACKED], | |
| 358 | "print the LLVM optimization passes being run (default: no)"), | |
| 359 | print_mono_items: bool = (false, parse_bool, [UNTRACKED], | |
| 360 | "print the result of the monomorphization collection pass (default: no)"), | |
| 361 | print_type_sizes: bool = (false, parse_bool, [UNTRACKED], | |
| 362 | "print layout information for each type encountered (default: no)"), | |
| 363 | proc_macro_backtrace: bool = (false, parse_bool, [UNTRACKED], | |
| 364 | "show backtraces for panics during proc-macro execution (default: no)"), | |
| 365 | proc_macro_execution_strategy: ProcMacroExecutionStrategy = (ProcMacroExecutionStrategy::SameThread, | |
| 366 | parse_proc_macro_execution_strategy, [UNTRACKED], | |
| 367 | "how to run proc-macro code (default: same-thread)"), | |
| 368 | profile_closures: bool = (false, parse_no_value, [UNTRACKED], | |
| 369 | "profile size of closures"), | |
| 370 | profile_sample_use: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 371 | "use the given `.prof` file for sampled profile-guided optimization (also known as AutoFDO)"), | |
| 372 | profiler_runtime: String = (String::from("profiler_builtins"), parse_string, [TRACKED], | |
| 373 | "name of the profiler runtime crate to automatically inject (default: `profiler_builtins`)"), | |
| 374 | query_dep_graph: bool = (false, parse_bool, [UNTRACKED], | |
| 375 | "enable queries of the dependency graph for regression testing (default: no)"), | |
| 376 | randomize_layout: bool = (false, parse_bool, [TRACKED], | |
| 377 | "randomize the layout of types (default: no)"), | |
| 378 | reg_struct_return: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 379 | "On x86-32 targets, it overrides the default ABI to return small structs in registers. | |
| 380 | It is UNSOUND to link together crates that use different values for this flag!"), | |
| 381 | regparm: Option<u32> = (None, parse_opt_number, [TRACKED TARGET_MODIFIER], | |
| 382 | "On x86-32 targets, setting this to N causes the compiler to pass N arguments \ | |
| 383 | in registers EAX, EDX, and ECX instead of on the stack for\ | |
| 384 | \"C\", \"cdecl\", and \"stdcall\" fn.\ | |
| 385 | It is UNSOUND to link together crates that use different values for this flag!"), | |
| 386 | relax_elf_relocations: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 387 | "whether ELF relocations can be relaxed"), | |
| 388 | remap_cwd_prefix: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 389 | "remap paths under the current working directory to this path prefix"), | |
| 390 | remark_dir: Option<PathBuf> = (None, parse_opt_pathbuf, [UNTRACKED], | |
| 391 | "directory into which to write optimization remarks (if not specified, they will be \ | |
| 392 | written to standard error output)"), | |
| 393 | retpoline: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 394 | "enables retpoline-indirect-branches and retpoline-indirect-calls target features (default: no)"), | |
| 395 | retpoline_external_thunk: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], | |
| 396 | "enables retpoline-external-thunk, retpoline-indirect-branches and retpoline-indirect-calls \ | |
| 397 | target features (default: no)"), | |
| 398 | #[rustc_lint_opt_deny_field_access("use `Session::sanitizers()` instead of this field")] | |
| 399 | sanitizer: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED TARGET_MODIFIER], | |
| 400 | "use a sanitizer"), | |
| 401 | sanitizer_cfi_canonical_jump_tables: Option<bool> = (Some(true), parse_opt_bool, [TRACKED], | |
| 402 | "enable canonical jump tables (default: yes)"), | |
| 403 | sanitizer_cfi_generalize_pointers: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 404 | "enable generalizing pointer types (default: no)"), | |
| 405 | sanitizer_cfi_normalize_integers: Option<bool> = (None, parse_opt_bool, [TRACKED TARGET_MODIFIER], | |
| 406 | "enable normalizing integer types (default: no)"), | |
| 407 | sanitizer_dataflow_abilist: Vec<String> = (Vec::new(), parse_comma_list, [TRACKED], | |
| 408 | "additional ABI list files that control how shadow parameters are passed (comma separated)"), | |
| 409 | sanitizer_kcfi_arity: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 410 | "enable KCFI arity indicator (default: no)"), | |
| 411 | sanitizer_memory_track_origins: usize = (0, parse_sanitizer_memory_track_origins, [TRACKED], | |
| 412 | "enable origins tracking in MemorySanitizer"), | |
| 413 | sanitizer_recover: SanitizerSet = (SanitizerSet::empty(), parse_sanitizers, [TRACKED], | |
| 414 | "enable recovery for selected sanitizers"), | |
| 415 | saturating_float_casts: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 416 | "make float->int casts UB-free: numbers outside the integer type's range are clipped to \ | |
| 417 | the max/min integer respectively, and NaN is mapped to 0 (default: yes)"), | |
| 418 | self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled, | |
| 419 | parse_switch_with_opt_path, [UNTRACKED], | |
| 420 | "run the self profiler and output the raw event data"), | |
| 421 | self_profile_counter: String = ("wall-time".to_string(), parse_string, [UNTRACKED], | |
| 422 | "counter used by the self profiler (default: `wall-time`), one of: | |
| 423 | `wall-time` (monotonic clock, i.e. `std::time::Instant`) | |
| 424 | `instructions:u` (retired instructions, userspace-only) | |
| 425 | `instructions-minus-irqs:u` (subtracting hardware interrupt counts for extra accuracy)" | |
| 426 | ), | |
| 427 | /// keep this in sync with the event filter names in librustc_data_structures/profiling.rs | |
| 428 | self_profile_events: Option<Vec<String>> = (None, parse_opt_comma_list, [UNTRACKED], | |
| 429 | "specify the events recorded by the self profiler; | |
| 430 | for example: `-Z self-profile-events=default,query-keys` | |
| 431 | all options: none, all, default, generic-activity, query-provider, query-cache-hit | |
| 432 | query-blocked, incr-cache-load, incr-result-hashing, query-keys, function-args, args, llvm, artifact-sizes"), | |
| 433 | share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 434 | "make the current crate share its generic instantiations"), | |
| 435 | shell_argfiles: bool = (false, parse_bool, [UNTRACKED], | |
| 436 | "allow argument files to be specified with POSIX \"shell-style\" argument quoting"), | |
| 437 | simulate_remapped_rust_src_base: Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 438 | "simulate the effect of remap-debuginfo = true at bootstrapping by remapping path \ | |
| 439 | to rust's source base directory. only meant for testing purposes"), | |
| 440 | small_data_threshold: Option<usize> = (None, parse_opt_number, [TRACKED], | |
| 441 | "Set the threshold for objects to be stored in a \"small data\" section"), | |
| 442 | span_debug: bool = (false, parse_bool, [UNTRACKED], | |
| 443 | "forward proc_macro::Span's `Debug` impl to `Span`"), | |
| 444 | /// o/w tests have closure@path | |
| 445 | span_free_formats: bool = (false, parse_bool, [UNTRACKED], | |
| 446 | "exclude spans when debug-printing compiler state (default: no)"), | |
| 447 | split_dwarf_inlining: bool = (false, parse_bool, [TRACKED], | |
| 448 | "provide minimal debug info in the object/executable to facilitate online \ | |
| 449 | symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF"), | |
| 450 | split_dwarf_kind: SplitDwarfKind = (SplitDwarfKind::Split, parse_split_dwarf_kind, [TRACKED], | |
| 451 | "split dwarf variant (only if -Csplit-debuginfo is enabled and on relevant platform) | |
| 452 | (default: `split`) | |
| 453 | ||
| 454 | `split`: sections which do not require relocation are written into a DWARF object (`.dwo`) | |
| 455 | file which is ignored by the linker | |
| 456 | `single`: sections which do not require relocation are written into object file but ignored | |
| 457 | by the linker"), | |
| 458 | split_dwarf_out_dir : Option<PathBuf> = (None, parse_opt_pathbuf, [TRACKED], | |
| 459 | "location for writing split DWARF objects (`.dwo`) if enabled"), | |
| 460 | split_lto_unit: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 461 | "enable LTO unit splitting (default: no)"), | |
| 462 | src_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_src_file_hash, [TRACKED], | |
| 463 | "hash algorithm of source files in debug info (`md5`, `sha1`, or `sha256`)"), | |
| 464 | #[rustc_lint_opt_deny_field_access("use `Session::stack_protector` instead of this field")] | |
| 465 | stack_protector: StackProtector = (StackProtector::None, parse_stack_protector, [TRACKED], | |
| 466 | "control stack smash protection strategy (`rustc --print stack-protector-strategies` for details)"), | |
| 467 | staticlib_allow_rdylib_deps: bool = (false, parse_bool, [TRACKED], | |
| 468 | "allow staticlibs to have rust dylib dependencies"), | |
| 469 | staticlib_prefer_dynamic: bool = (false, parse_bool, [TRACKED], | |
| 470 | "prefer dynamic linking to static linking for staticlibs (default: no)"), | |
| 471 | strict_init_checks: bool = (false, parse_bool, [TRACKED], | |
| 472 | "control if mem::uninitialized and mem::zeroed panic on more UB"), | |
| 473 | #[rustc_lint_opt_deny_field_access("use `Session::teach` instead of this field")] | |
| 474 | teach: bool = (false, parse_bool, [TRACKED], | |
| 475 | "show extended diagnostic help (default: no)"), | |
| 476 | temps_dir: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| 477 | "the directory the intermediate files are written to"), | |
| 478 | terminal_urls: TerminalUrl = (TerminalUrl::No, parse_terminal_url, [UNTRACKED], | |
| 479 | "use the OSC 8 hyperlink terminal specification to print hyperlinks in the compiler output"), | |
| 480 | #[rustc_lint_opt_deny_field_access("use `Session::lto` instead of this field")] | |
| 481 | thinlto: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 482 | "enable ThinLTO when possible"), | |
| 483 | /// We default to 1 here since we want to behave like | |
| 484 | /// a sequential compiler for now. This'll likely be adjusted | |
| 485 | /// in the future. Note that -Zthreads=0 is the way to get | |
| 486 | /// the num_cpus behavior. | |
| 487 | #[rustc_lint_opt_deny_field_access("use `Session::threads` instead of this field")] | |
| 488 | threads: usize = (1, parse_threads, [UNTRACKED], | |
| 489 | "use a thread pool with N threads"), | |
| 490 | time_llvm_passes: bool = (false, parse_bool, [UNTRACKED], | |
| 491 | "measure time of each LLVM pass (default: no)"), | |
| 492 | time_passes: bool = (false, parse_bool, [UNTRACKED], | |
| 493 | "measure time of each rustc pass (default: no)"), | |
| 494 | time_passes_format: TimePassesFormat = (TimePassesFormat::Text, parse_time_passes_format, [UNTRACKED], | |
| 495 | "the format to use for -Z time-passes (`text` (default) or `json`)"), | |
| 496 | tiny_const_eval_limit: bool = (false, parse_bool, [TRACKED], | |
| 497 | "sets a tiny, non-configurable limit for const eval; useful for compiler tests"), | |
| 498 | #[rustc_lint_opt_deny_field_access("use `Session::tls_model` instead of this field")] | |
| 499 | tls_model: Option<TlsModel> = (None, parse_tls_model, [TRACKED], | |
| 500 | "choose the TLS model to use (`rustc --print tls-models` for details)"), | |
| 501 | trace_macros: bool = (false, parse_bool, [UNTRACKED], | |
| 502 | "for every macro invocation, print its name and arguments (default: no)"), | |
| 503 | track_diagnostics: bool = (false, parse_bool, [UNTRACKED], | |
| 504 | "tracks where in rustc a diagnostic was emitted"), | |
| 505 | translate_remapped_path_to_local_path: bool = (true, parse_bool, [TRACKED], | |
| 506 | "translate remapped paths into local paths when possible (default: yes)"), | |
| 507 | trap_unreachable: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 508 | "generate trap instructions for unreachable intrinsics (default: use target setting, usually yes)"), | |
| 509 | treat_err_as_bug: Option<NonZero<usize>> = (None, parse_treat_err_as_bug, [TRACKED], | |
| 510 | "treat the `val`th error that occurs as bug (default if not specified: 0 - don't treat errors as bugs. \ | |
| 511 | default if specified without a value: 1 - treat the first error as bug)"), | |
| 512 | trim_diagnostic_paths: bool = (true, parse_bool, [UNTRACKED], | |
| 513 | "in diagnostics, use heuristics to shorten paths referring to items"), | |
| 514 | tune_cpu: Option<String> = (None, parse_opt_string, [TRACKED], | |
| 515 | "select processor to schedule for (`rustc --print target-cpus` for details)"), | |
| 516 | #[rustc_lint_opt_deny_field_access("use `TyCtxt::use_typing_mode_borrowck` instead of this field")] | |
| 517 | typing_mode_borrowck: bool = (false, parse_bool, [TRACKED], | |
| 518 | "enable `TypingMode::Borrowck`, changing the way opaque types are handled during MIR borrowck"), | |
| 519 | #[rustc_lint_opt_deny_field_access("use `Session::ub_checks` instead of this field")] | |
| 520 | ub_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 521 | "emit runtime checks for Undefined Behavior (default: -Cdebug-assertions)"), | |
| 522 | ui_testing: bool = (false, parse_bool, [UNTRACKED], | |
| 523 | "emit compiler diagnostics in a form suitable for UI testing (default: no)"), | |
| 524 | uninit_const_chunk_threshold: usize = (16, parse_number, [TRACKED], | |
| 525 | "allow generating const initializers with mixed init/uninit chunks, \ | |
| 526 | and set the maximum number of chunks for which this is allowed (default: 16)"), | |
| 527 | unleash_the_miri_inside_of_you: bool = (false, parse_bool, [TRACKED], | |
| 528 | "take the brakes off const evaluation. NOTE: this is unsound (default: no)"), | |
| 529 | unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED], | |
| 530 | "present the input source, unstable (and less-pretty) variants; | |
| 531 | `normal`, `identified`, | |
| 532 | `expanded`, `expanded,identified`, | |
| 533 | `expanded,hygiene` (with internal representations), | |
| 534 | `ast-tree` (raw AST before expansion), | |
| 535 | `ast-tree,expanded` (raw AST after expansion), | |
| 536 | `hir` (the HIR), `hir,identified`, | |
| 537 | `hir,typed` (HIR with types for each node), | |
| 538 | `hir-tree` (dump the raw HIR), | |
| 539 | `thir-tree`, `thir-flat`, | |
| 540 | `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)"), | |
| 541 | unsound_mir_opts: bool = (false, parse_bool, [TRACKED], | |
| 542 | "enable unsound and buggy MIR optimizations (default: no)"), | |
| 543 | /// This name is kind of confusing: Most unstable options enable something themselves, while | |
| 544 | /// this just allows "normal" options to be feature-gated. | |
| 545 | /// | |
| 546 | /// The main check for `-Zunstable-options` takes place separately from the | |
| 547 | /// usual parsing of `-Z` options (see [`crate::config::nightly_options`]), | |
| 548 | /// so this boolean value is mostly used for enabling unstable _values_ of | |
| 549 | /// stable options. That separate check doesn't handle boolean values, so | |
| 550 | /// to avoid an inconsistent state we also forbid them here. | |
| 551 | #[rustc_lint_opt_deny_field_access("use `Session::unstable_options` instead of this field")] | |
| 552 | unstable_options: bool = (false, parse_no_value, [UNTRACKED], | |
| 553 | "adds unstable command line options to rustc interface (default: no)"), | |
| 554 | use_ctors_section: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 555 | "use legacy .ctors section for initializers rather than .init_array"), | |
| 556 | use_sync_unwind: Option<bool> = (None, parse_opt_bool, [TRACKED], | |
| 557 | "Generate sync unwind tables instead of async unwind tables (default: no)"), | |
| 558 | validate_mir: bool = (false, parse_bool, [UNTRACKED], | |
| 559 | "validate MIR after each transformation"), | |
| 560 | verbose_asm: bool = (false, parse_bool, [TRACKED], | |
| 561 | "add descriptive comments from LLVM to the assembly (may change behavior) (default: no)"), | |
| 562 | #[rustc_lint_opt_deny_field_access("use `Session::verbose_internals` instead of this field")] | |
| 563 | verbose_internals: bool = (false, parse_bool, [TRACKED_NO_CRATE_HASH], | |
| 564 | "in general, enable more debug printouts (default: no)"), | |
| 565 | #[rustc_lint_opt_deny_field_access("use `Session::verify_llvm_ir` instead of this field")] | |
| 566 | verify_llvm_ir: bool = (false, parse_bool, [TRACKED], | |
| 567 | "verify LLVM IR (default: no)"), | |
| 568 | virtual_function_elimination: bool = (false, parse_bool, [TRACKED], | |
| 569 | "enables dead virtual function elimination optimization. \ | |
| 570 | Requires `-Clto[=[fat,yes]]`"), | |
| 571 | wasi_exec_model: Option<WasiExecModel> = (None, parse_wasi_exec_model, [TRACKED], | |
| 572 | "whether to build a wasi command or reactor"), | |
| 573 | // This option only still exists to provide a more gradual transition path for people who need | |
| 574 | // the spec-complaint C ABI to be used. | |
| 575 | // FIXME remove this after a couple releases | |
| 576 | wasm_c_abi: () = ((), parse_wasm_c_abi, [TRACKED], | |
| 577 | "use spec-compliant C ABI for `wasm32-unknown-unknown` (deprecated, always enabled)"), | |
| 578 | write_long_types_to_disk: bool = (true, parse_bool, [UNTRACKED], | |
| 579 | "whether long type names should be written to files instead of being printed in errors"), | |
| 580 | // tidy-alphabetical-end | |
| 581 | ||
| 582 | // If you add a new option, please update: | |
| 583 | // - compiler/rustc_interface/src/tests.rs | |
| 584 | // - src/doc/unstable-book/src/compiler-flags | |
| 585 | } |
compiler/rustc_symbol_mangling/src/legacy.rs+1-3| ... | ... | @@ -155,9 +155,7 @@ fn get_symbol_hash<'tcx>( |
| 155 | 155 | args.hash_stable(hcx, &mut hasher); |
| 156 | 156 | |
| 157 | 157 | if let Some(instantiating_crate) = instantiating_crate { |
| 158 | tcx.def_path_hash(instantiating_crate.as_def_id()) | |
| 159 | .stable_crate_id() | |
| 160 | .hash_stable(hcx, &mut hasher); | |
| 158 | tcx.stable_crate_id(instantiating_crate).hash_stable(hcx, &mut hasher); | |
| 161 | 159 | } |
| 162 | 160 | |
| 163 | 161 | // We want to avoid accidental collision between different types of instances. |
compiler/rustc_symbol_mangling/src/v0.rs+1-1| ... | ... | @@ -841,7 +841,7 @@ impl<'tcx> Printer<'tcx> for V0SymbolMangler<'tcx> { |
| 841 | 841 | fn print_crate_name(&mut self, cnum: CrateNum) -> Result<(), PrintError> { |
| 842 | 842 | self.push("C"); |
| 843 | 843 | if !self.is_exportable { |
| 844 | let stable_crate_id = self.tcx.def_path_hash(cnum.as_def_id()).stable_crate_id(); | |
| 844 | let stable_crate_id = self.tcx.stable_crate_id(cnum); | |
| 845 | 845 | self.push_disambiguator(stable_crate_id.as_u64()); |
| 846 | 846 | } |
| 847 | 847 | let name = self.tcx.crate_name(cnum); |
compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs+5-6| ... | ... | @@ -507,18 +507,17 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 507 | 507 | }; |
| 508 | 508 | |
| 509 | 509 | let mut local_visitor = FindInferSourceVisitor::new(self, typeck_results, term, ty); |
| 510 | if let Some(body) = self.tcx.hir_maybe_body_owned_by( | |
| 511 | self.tcx.typeck_root_def_id(body_def_id.to_def_id()).expect_local(), | |
| 512 | ) { | |
| 510 | if let Some(body) = | |
| 511 | self.tcx.hir_maybe_body_owned_by(self.tcx.typeck_root_def_id_local(body_def_id)) | |
| 512 | { | |
| 513 | 513 | let expr = body.value; |
| 514 | 514 | local_visitor.visit_expr(expr); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | let Some(InferSource { span, kind }) = local_visitor.infer_source else { |
| 518 | 518 | let silence = if let DefKind::AssocFn = self.tcx.def_kind(body_def_id) |
| 519 | && let parent = self.tcx.parent(body_def_id.into()) | |
| 520 | && self.tcx.is_automatically_derived(parent) | |
| 521 | && let Some(parent) = parent.as_local() | |
| 519 | && let parent = self.tcx.local_parent(body_def_id) | |
| 520 | && self.tcx.is_automatically_derived(parent.to_def_id()) | |
| 522 | 521 | && let hir::Node::Item(item) = self.tcx.hir_node_by_def_id(parent) |
| 523 | 522 | && let hir::ItemKind::Impl(imp) = item.kind |
| 524 | 523 | && let hir::TyKind::Path(hir::QPath::Resolved(_, path)) = imp.self_ty.kind |
compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs+7-5| ... | ... | @@ -285,14 +285,16 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 285 | 285 | let mut err = struct_span_code_err!(self.dcx(), span, E0277, "{}", err_msg); |
| 286 | 286 | |
| 287 | 287 | let trait_def_id = main_trait_predicate.def_id(); |
| 288 | if self.tcx.is_diagnostic_item(sym::From, trait_def_id) | |
| 289 | || self.tcx.is_diagnostic_item(sym::TryFrom, trait_def_id) | |
| 288 | let leaf_trait_def_id = leaf_trait_predicate.def_id(); | |
| 289 | if (self.tcx.is_diagnostic_item(sym::From, trait_def_id) | |
| 290 | || self.tcx.is_diagnostic_item(sym::TryFrom, trait_def_id)) | |
| 291 | && (self.tcx.is_diagnostic_item(sym::From, leaf_trait_def_id) | |
| 292 | || self.tcx.is_diagnostic_item(sym::TryFrom, leaf_trait_def_id)) | |
| 290 | 293 | { |
| 291 | 294 | let trait_ref = leaf_trait_predicate.skip_binder().trait_ref; |
| 292 | 295 | |
| 293 | // Defensive: next-solver may produce fewer args than expected. | |
| 294 | if trait_ref.args.len() > 1 { | |
| 295 | let found_ty = trait_ref.args.type_at(1); | |
| 296 | if let Some(found_ty) = trait_ref.args.get(1).and_then(|arg| arg.as_type()) | |
| 297 | { | |
| 296 | 298 | let ty = main_trait_predicate.skip_binder().self_ty(); |
| 297 | 299 | |
| 298 | 300 | if let Some(cast_ty) = self.find_explicit_cast_type( |
compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs+1-2| ... | ... | @@ -1966,10 +1966,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { |
| 1966 | 1966 | |
| 1967 | 1967 | let mut span = obligation.cause.span; |
| 1968 | 1968 | if let DefKind::Closure = self.tcx.def_kind(obligation.cause.body_id) |
| 1969 | && let parent = self.tcx.parent(obligation.cause.body_id.into()) | |
| 1969 | && let parent = self.tcx.local_parent(obligation.cause.body_id) | |
| 1970 | 1970 | && let DefKind::Fn | DefKind::AssocFn = self.tcx.def_kind(parent) |
| 1971 | 1971 | && self.tcx.asyncness(parent).is_async() |
| 1972 | && let Some(parent) = parent.as_local() | |
| 1973 | 1972 | && let Node::Item(hir::Item { kind: hir::ItemKind::Fn { sig: fn_sig, .. }, .. }) |
| 1974 | 1973 | | Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Fn(fn_sig, _), .. }) |
| 1975 | 1974 | | Node::TraitItem(hir::TraitItem { |
compiler/rustc_ty_utils/src/nested_bodies.rs+4-5| ... | ... | @@ -1,27 +1,26 @@ |
| 1 | 1 | use rustc_hir as hir; |
| 2 | use rustc_hir::def_id::{DefId, LocalDefId}; | |
| 2 | use rustc_hir::def_id::LocalDefId; | |
| 3 | 3 | use rustc_hir::intravisit::Visitor; |
| 4 | 4 | use rustc_middle::query::Providers; |
| 5 | 5 | use rustc_middle::ty::{self, TyCtxt}; |
| 6 | 6 | |
| 7 | 7 | fn nested_bodies_within<'tcx>(tcx: TyCtxt<'tcx>, item: LocalDefId) -> &'tcx ty::List<LocalDefId> { |
| 8 | 8 | let body = tcx.hir_body_owned_by(item); |
| 9 | let mut collector = | |
| 10 | NestedBodiesVisitor { tcx, root_def_id: item.to_def_id(), nested_bodies: vec![] }; | |
| 9 | let mut collector = NestedBodiesVisitor { tcx, root_def_id: item, nested_bodies: vec![] }; | |
| 11 | 10 | collector.visit_body(body); |
| 12 | 11 | tcx.mk_local_def_ids(&collector.nested_bodies) |
| 13 | 12 | } |
| 14 | 13 | |
| 15 | 14 | struct NestedBodiesVisitor<'tcx> { |
| 16 | 15 | tcx: TyCtxt<'tcx>, |
| 17 | root_def_id: DefId, | |
| 16 | root_def_id: LocalDefId, | |
| 18 | 17 | nested_bodies: Vec<LocalDefId>, |
| 19 | 18 | } |
| 20 | 19 | |
| 21 | 20 | impl<'tcx> Visitor<'tcx> for NestedBodiesVisitor<'tcx> { |
| 22 | 21 | fn visit_nested_body(&mut self, id: hir::BodyId) { |
| 23 | 22 | let body_def_id = self.tcx.hir_body_owner_def_id(id); |
| 24 | if self.tcx.typeck_root_def_id(body_def_id.to_def_id()) == self.root_def_id { | |
| 23 | if self.tcx.typeck_root_def_id_local(body_def_id) == self.root_def_id { | |
| 25 | 24 | // We visit nested bodies before adding the current body. This |
| 26 | 25 | // means that nested bodies are always stored before their parent. |
| 27 | 26 | let body = self.tcx.hir_body(id); |
src/bootstrap/src/core/builder/cargo.rs+8-1| ... | ... | @@ -122,6 +122,9 @@ impl Cargo { |
| 122 | 122 | cmd_kind: Kind, |
| 123 | 123 | ) -> Cargo { |
| 124 | 124 | let mut cargo = builder.cargo(compiler, mode, source_type, target, cmd_kind); |
| 125 | if target.synthetic { | |
| 126 | cargo.arg("-Zjson-target-spec"); | |
| 127 | } | |
| 125 | 128 | |
| 126 | 129 | match cmd_kind { |
| 127 | 130 | // No need to configure the target linker for these command types. |
| ... | ... | @@ -165,7 +168,11 @@ impl Cargo { |
| 165 | 168 | target: TargetSelection, |
| 166 | 169 | cmd_kind: Kind, |
| 167 | 170 | ) -> Cargo { |
| 168 | builder.cargo(compiler, mode, source_type, target, cmd_kind) | |
| 171 | let mut cargo = builder.cargo(compiler, mode, source_type, target, cmd_kind); | |
| 172 | if target.synthetic { | |
| 173 | cargo.arg("-Zjson-target-spec"); | |
| 174 | } | |
| 175 | cargo | |
| 169 | 176 | } |
| 170 | 177 | |
| 171 | 178 | pub fn rustdocflag(&mut self, arg: &str) -> &mut Cargo { |
src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile+2-2| ... | ... | @@ -26,5 +26,5 @@ ENV \ |
| 26 | 26 | |
| 27 | 27 | ENV HOSTS=mips-unknown-linux-gnu |
| 28 | 28 | |
| 29 | ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs | |
| 30 | ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS | |
| 29 | ENV RUST_CONFIGURE_ARGS="--enable-extended --disable-docs" | |
| 30 | ENV SCRIPT="python3 ../x.py dist --host $HOSTS --target $HOSTS" |
src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile+2-2| ... | ... | @@ -26,5 +26,5 @@ ENV \ |
| 26 | 26 | |
| 27 | 27 | ENV HOSTS=mips64-unknown-linux-gnuabi64 |
| 28 | 28 | |
| 29 | ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs | |
| 30 | ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS | |
| 29 | ENV RUST_CONFIGURE_ARGS="--enable-extended --disable-docs" | |
| 30 | ENV SCRIPT="python3 ../x.py dist --host $HOSTS --target $HOSTS" |
src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile+2-2| ... | ... | @@ -26,5 +26,5 @@ ENV \ |
| 26 | 26 | |
| 27 | 27 | ENV HOSTS=mips64el-unknown-linux-gnuabi64 |
| 28 | 28 | |
| 29 | ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs | |
| 30 | ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS | |
| 29 | ENV RUST_CONFIGURE_ARGS="--enable-extended --disable-docs" | |
| 30 | ENV SCRIPT="python3 ../x.py dist --host $HOSTS --target $HOSTS" |
src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile+2-2| ... | ... | @@ -26,5 +26,5 @@ ENV \ |
| 26 | 26 | |
| 27 | 27 | ENV HOSTS=mipsel-unknown-linux-gnu |
| 28 | 28 | |
| 29 | ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs | |
| 30 | ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS | |
| 29 | ENV RUST_CONFIGURE_ARGS="--enable-extended --disable-docs" | |
| 30 | ENV SCRIPT="python3 ../x.py dist --host $HOSTS --target $HOSTS" |
src/librustdoc/config.rs+12| ... | ... | @@ -522,6 +522,18 @@ impl Options { |
| 522 | 522 | } |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | if output_format == OutputFormat::Json { | |
| 526 | if let Some(emit_flag) = emit.iter().find_map(|emit| match emit { | |
| 527 | EmitType::HtmlStaticFiles => Some("html-static-files"), | |
| 528 | EmitType::HtmlNonStaticFiles => Some("html-non-static-files"), | |
| 529 | EmitType::DepInfo(_) => None, | |
| 530 | }) { | |
| 531 | dcx.fatal(format!( | |
| 532 | "the `--emit={emit_flag}` flag is not supported with `--output-format=json`", | |
| 533 | )); | |
| 534 | } | |
| 535 | } | |
| 536 | ||
| 525 | 537 | let to_check = matches.opt_strs("check-theme"); |
| 526 | 538 | if !to_check.is_empty() { |
| 527 | 539 | let mut content = |
src/tools/clippy/clippy_lints/src/only_used_in_recursion.rs+1-1| ... | ... | @@ -332,7 +332,7 @@ impl<'tcx> LateLintPass<'tcx> for OnlyUsedInRecursion { |
| 332 | 332 | if let ImplItemImplKind::Trait { trait_item_def_id, .. } = impl_kind |
| 333 | 333 | && let Ok(trait_item_id) = trait_item_def_id |
| 334 | 334 | { |
| 335 | let impl_id = cx.tcx.parent(owner_id.into()); | |
| 335 | let impl_id = cx.tcx.local_parent(owner_id.def_id); | |
| 336 | 336 | let trait_ref = cx.tcx.impl_trait_ref(impl_id).instantiate_identity(); |
| 337 | 337 | ( |
| 338 | 338 | trait_item_id, |
src/tools/clippy/clippy_lints/src/shadow.rs+1-1| ... | ... | @@ -179,7 +179,7 @@ impl<'tcx> LateLintPass<'tcx> for Shadow { |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | fn is_shadow(cx: &LateContext<'_>, owner: LocalDefId, first: ItemLocalId, second: ItemLocalId) -> bool { |
| 182 | let scope_tree = cx.tcx.region_scope_tree(owner.to_def_id()); | |
| 182 | let scope_tree = cx.tcx.region_scope_tree(owner); | |
| 183 | 183 | if let Some(first_scope) = scope_tree.var_scope(first) |
| 184 | 184 | && let Some(second_scope) = scope_tree.var_scope(second) |
| 185 | 185 | { |
src/tools/rustfmt/src/visitor.rs+8-4| ... | ... | @@ -665,11 +665,11 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | // TODO(calebcartwright): consider enabling box_patterns feature gate |
| 668 | match (&ai.kind, visitor_kind) { | |
| 669 | (ast::AssocItemKind::Const(c), AssocTraitItem) => { | |
| 668 | match (&ai.kind, assoc_ctxt) { | |
| 669 | (ast::AssocItemKind::Const(c), visit::AssocCtxt::Trait) => { | |
| 670 | 670 | self.visit_static(&StaticParts::from_trait_item(ai, c.ident)) |
| 671 | 671 | } |
| 672 | (ast::AssocItemKind::Const(c), AssocImplItem) => { | |
| 672 | (ast::AssocItemKind::Const(c), visit::AssocCtxt::Impl { .. }) => { | |
| 673 | 673 | self.visit_static(&StaticParts::from_impl_item(ai, c.ident)) |
| 674 | 674 | } |
| 675 | 675 | (ast::AssocItemKind::Fn(ref fn_kind), _) => { |
| ... | ... | @@ -714,7 +714,11 @@ impl<'b, 'a: 'b> FmtVisitor<'a> { |
| 714 | 714 | (ast::AssocItemKind::MacCall(ref mac), _) => { |
| 715 | 715 | self.visit_mac(mac, MacroPosition::Item); |
| 716 | 716 | } |
| 717 | _ => unreachable!(), | |
| 717 | (ast::AssocItemKind::Delegation(_) | ast::AssocItemKind::DelegationMac(_), _) => { | |
| 718 | // TODO(ytmimi) #![feature(fn_delegation)] | |
| 719 | // add formatting for `AssocItemKind::Delegation` and `AssocItemKind::DelegationMac` | |
| 720 | self.push_rewrite(ai.span, None); | |
| 721 | } | |
| 718 | 722 | } |
| 719 | 723 | } |
| 720 | 724 |
src/tools/rustfmt/tests/target/issue_6513.rs created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | #![feature(fn_delegation)] | |
| 2 | ||
| 3 | struct Ty; | |
| 4 | impl Ty { | |
| 5 | reuse std::convert::identity; | |
| 6 | } | |
| 7 | ||
| 8 | trait Trait { | |
| 9 | reuse std::convert::identity; | |
| 10 | } |
src/tools/unstable-book-gen/Cargo.toml+2| ... | ... | @@ -6,6 +6,8 @@ edition = "2021" |
| 6 | 6 | |
| 7 | 7 | [dependencies] |
| 8 | 8 | tidy = { path = "../tidy" } |
| 9 | proc-macro2 = { version = "1.0", features = ["span-locations"] } | |
| 10 | syn = { version = "2.0", features = ["full", "parsing"] } | |
| 9 | 11 | |
| 10 | 12 | # not actually needed but required for now to unify the feature selection of |
| 11 | 13 | # `num-traits` between this and `rustbook` |
src/tools/unstable-book-gen/src/main.rs+198-2| ... | ... | @@ -5,11 +5,16 @@ use std::env; |
| 5 | 5 | use std::fs::{self, write}; |
| 6 | 6 | use std::path::Path; |
| 7 | 7 | |
| 8 | use proc_macro2::{Span, TokenStream, TokenTree}; | |
| 9 | use syn::parse::{Parse, ParseStream}; | |
| 10 | use syn::{Attribute, Ident, Item, LitStr, Token, parenthesized}; | |
| 8 | 11 | use tidy::diagnostics::RunningCheck; |
| 9 | use tidy::features::{Features, collect_env_vars, collect_lang_features, collect_lib_features}; | |
| 12 | use tidy::features::{ | |
| 13 | Feature, Features, Status, collect_env_vars, collect_lang_features, collect_lib_features, | |
| 14 | }; | |
| 10 | 15 | use tidy::t; |
| 11 | 16 | use tidy::unstable_book::{ |
| 12 | ENV_VARS_DIR, LANG_FEATURES_DIR, LIB_FEATURES_DIR, PATH_STR, | |
| 17 | COMPILER_FLAGS_DIR, ENV_VARS_DIR, LANG_FEATURES_DIR, LIB_FEATURES_DIR, PATH_STR, | |
| 13 | 18 | collect_unstable_book_section_file_names, collect_unstable_feature_names, |
| 14 | 19 | }; |
| 15 | 20 | |
| ... | ... | @@ -113,6 +118,188 @@ fn copy_recursive(from: &Path, to: &Path) { |
| 113 | 118 | } |
| 114 | 119 | } |
| 115 | 120 | |
| 121 | fn collect_compiler_flags(compiler_path: &Path) -> Features { | |
| 122 | let options_path = compiler_path.join("rustc_session/src/options/unstable.rs"); | |
| 123 | let options_rs = t!(fs::read_to_string(&options_path), options_path); | |
| 124 | parse_compiler_flags(&options_rs, &options_path) | |
| 125 | } | |
| 126 | ||
| 127 | const DESCRIPTION_FIELD: usize = 3; | |
| 128 | const REQUIRED_FIELDS: usize = 4; | |
| 129 | const OPTIONAL_FIELDS: usize = 5; | |
| 130 | ||
| 131 | struct ParsedOptionEntry { | |
| 132 | name: String, | |
| 133 | line: usize, | |
| 134 | description: String, | |
| 135 | } | |
| 136 | ||
| 137 | struct UnstableOptionsInput { | |
| 138 | struct_name: Ident, | |
| 139 | entries: Vec<ParsedOptionEntry>, | |
| 140 | } | |
| 141 | ||
| 142 | impl Parse for ParsedOptionEntry { | |
| 143 | fn parse(input: ParseStream<'_>) -> syn::Result<Self> { | |
| 144 | let _attrs = input.call(Attribute::parse_outer)?; | |
| 145 | ||
| 146 | let name: Ident = input.parse()?; | |
| 147 | let line = name.span().start().line; | |
| 148 | input.parse::<Token![:]>()?; | |
| 149 | let _ty: syn::Type = input.parse()?; | |
| 150 | input.parse::<Token![=]>()?; | |
| 151 | ||
| 152 | let tuple_content; | |
| 153 | parenthesized!(tuple_content in input); | |
| 154 | let tuple_tokens: TokenStream = tuple_content.parse()?; | |
| 155 | let tuple_fields = split_tuple_fields(tuple_tokens); | |
| 156 | ||
| 157 | if !matches!(tuple_fields.len(), REQUIRED_FIELDS | OPTIONAL_FIELDS) { | |
| 158 | return Err(syn::Error::new( | |
| 159 | name.span(), | |
| 160 | format!( | |
| 161 | "unexpected field count for option `{name}`: expected {REQUIRED_FIELDS} or {OPTIONAL_FIELDS}, found {}", | |
| 162 | tuple_fields.len() | |
| 163 | ), | |
| 164 | )); | |
| 165 | } | |
| 166 | ||
| 167 | if tuple_fields.len() == OPTIONAL_FIELDS | |
| 168 | && !is_deprecated_marker_field(&tuple_fields[REQUIRED_FIELDS]) | |
| 169 | { | |
| 170 | return Err(syn::Error::new( | |
| 171 | name.span(), | |
| 172 | format!( | |
| 173 | "unexpected trailing field in option `{name}`: expected `is_deprecated_and_do_nothing: ...`" | |
| 174 | ), | |
| 175 | )); | |
| 176 | } | |
| 177 | ||
| 178 | let description = parse_description_field(&tuple_fields[DESCRIPTION_FIELD], &name)?; | |
| 179 | Ok(Self { name: name.to_string(), line, description }) | |
| 180 | } | |
| 181 | } | |
| 182 | ||
| 183 | impl Parse for UnstableOptionsInput { | |
| 184 | fn parse(input: ParseStream<'_>) -> syn::Result<Self> { | |
| 185 | let struct_name: Ident = input.parse()?; | |
| 186 | input.parse::<Token![,]>()?; | |
| 187 | let _tmod_enum_name: Ident = input.parse()?; | |
| 188 | input.parse::<Token![,]>()?; | |
| 189 | let _stat_name: Ident = input.parse()?; | |
| 190 | input.parse::<Token![,]>()?; | |
| 191 | let _opt_module_name: Ident = input.parse()?; | |
| 192 | input.parse::<Token![,]>()?; | |
| 193 | let _prefix: LitStr = input.parse()?; | |
| 194 | input.parse::<Token![,]>()?; | |
| 195 | let _output_name: LitStr = input.parse()?; | |
| 196 | input.parse::<Token![,]>()?; | |
| 197 | ||
| 198 | let entries = | |
| 199 | syn::punctuated::Punctuated::<ParsedOptionEntry, Token![,]>::parse_terminated(input)? | |
| 200 | .into_iter() | |
| 201 | .collect(); | |
| 202 | ||
| 203 | Ok(Self { struct_name, entries }) | |
| 204 | } | |
| 205 | } | |
| 206 | ||
| 207 | fn parse_compiler_flags(options_rs: &str, options_path: &Path) -> Features { | |
| 208 | let options_input = parse_unstable_options_macro(options_rs).unwrap_or_else(|error| { | |
| 209 | panic!("failed to parse unstable options from `{}`: {error}", options_path.display()) | |
| 210 | }); | |
| 211 | ||
| 212 | let mut features = Features::new(); | |
| 213 | for entry in options_input.entries { | |
| 214 | if entry.name == "help" { | |
| 215 | continue; | |
| 216 | } | |
| 217 | ||
| 218 | features.insert( | |
| 219 | entry.name, | |
| 220 | Feature { | |
| 221 | level: Status::Unstable, | |
| 222 | since: None, | |
| 223 | has_gate_test: false, | |
| 224 | tracking_issue: None, | |
| 225 | file: options_path.to_path_buf(), | |
| 226 | line: entry.line, | |
| 227 | description: Some(entry.description), | |
| 228 | }, | |
| 229 | ); | |
| 230 | } | |
| 231 | ||
| 232 | features | |
| 233 | } | |
| 234 | ||
| 235 | fn parse_unstable_options_macro(source: &str) -> syn::Result<UnstableOptionsInput> { | |
| 236 | let ast = syn::parse_file(source)?; | |
| 237 | ||
| 238 | for item in ast.items { | |
| 239 | let Item::Macro(item_macro) = item else { | |
| 240 | continue; | |
| 241 | }; | |
| 242 | ||
| 243 | if !item_macro.mac.path.is_ident("options") { | |
| 244 | continue; | |
| 245 | } | |
| 246 | ||
| 247 | let parsed = syn::parse2::<UnstableOptionsInput>(item_macro.mac.tokens)?; | |
| 248 | if parsed.struct_name == "UnstableOptions" { | |
| 249 | return Ok(parsed); | |
| 250 | } | |
| 251 | } | |
| 252 | ||
| 253 | Err(syn::Error::new( | |
| 254 | Span::call_site(), | |
| 255 | "could not find `options!` invocation for `UnstableOptions`", | |
| 256 | )) | |
| 257 | } | |
| 258 | ||
| 259 | fn parse_description_field(field: &TokenStream, option_name: &Ident) -> syn::Result<String> { | |
| 260 | let lit = syn::parse2::<LitStr>(field.clone()).map_err(|_| { | |
| 261 | syn::Error::new_spanned( | |
| 262 | field.clone(), | |
| 263 | format!("expected description string literal in option `{option_name}`"), | |
| 264 | ) | |
| 265 | })?; | |
| 266 | Ok(lit.value()) | |
| 267 | } | |
| 268 | ||
| 269 | fn split_tuple_fields(tuple_tokens: TokenStream) -> Vec<TokenStream> { | |
| 270 | let mut fields = Vec::new(); | |
| 271 | let mut current = TokenStream::new(); | |
| 272 | ||
| 273 | for token in tuple_tokens { | |
| 274 | if let TokenTree::Punct(punct) = &token { | |
| 275 | if punct.as_char() == ',' { | |
| 276 | fields.push(current); | |
| 277 | current = TokenStream::new(); | |
| 278 | continue; | |
| 279 | } | |
| 280 | } | |
| 281 | current.extend([token]); | |
| 282 | } | |
| 283 | fields.push(current); | |
| 284 | ||
| 285 | while matches!(fields.last(), Some(field) if field.is_empty()) { | |
| 286 | fields.pop(); | |
| 287 | } | |
| 288 | ||
| 289 | fields | |
| 290 | } | |
| 291 | ||
| 292 | fn is_deprecated_marker_field(field: &TokenStream) -> bool { | |
| 293 | let mut tokens = field.clone().into_iter(); | |
| 294 | let Some(TokenTree::Ident(name)) = tokens.next() else { | |
| 295 | return false; | |
| 296 | }; | |
| 297 | let Some(TokenTree::Punct(colon)) = tokens.next() else { | |
| 298 | return false; | |
| 299 | }; | |
| 300 | name == "is_deprecated_and_do_nothing" && colon.as_char() == ':' | |
| 301 | } | |
| 302 | ||
| 116 | 303 | fn main() { |
| 117 | 304 | let library_path_str = env::args_os().nth(1).expect("library/ path required"); |
| 118 | 305 | let compiler_path_str = env::args_os().nth(2).expect("compiler/ path required"); |
| ... | ... | @@ -129,6 +316,7 @@ fn main() { |
| 129 | 316 | .filter(|&(ref name, _)| !lang_features.contains_key(name)) |
| 130 | 317 | .collect(); |
| 131 | 318 | let env_vars = collect_env_vars(compiler_path); |
| 319 | let compiler_flags = collect_compiler_flags(compiler_path); | |
| 132 | 320 | |
| 133 | 321 | let doc_src_path = src_path.join(PATH_STR); |
| 134 | 322 | |
| ... | ... | @@ -144,9 +332,17 @@ fn main() { |
| 144 | 332 | &dest_path.join(LIB_FEATURES_DIR), |
| 145 | 333 | &lib_features, |
| 146 | 334 | ); |
| 335 | generate_feature_files( | |
| 336 | &doc_src_path.join(COMPILER_FLAGS_DIR), | |
| 337 | &dest_path.join(COMPILER_FLAGS_DIR), | |
| 338 | &compiler_flags, | |
| 339 | ); | |
| 147 | 340 | generate_env_files(&doc_src_path.join(ENV_VARS_DIR), &dest_path.join(ENV_VARS_DIR), &env_vars); |
| 148 | 341 | |
| 149 | 342 | copy_recursive(&doc_src_path, &dest_path); |
| 150 | 343 | |
| 151 | 344 | generate_summary(&dest_path, &lang_features, &lib_features); |
| 152 | 345 | } |
| 346 | ||
| 347 | #[cfg(test)] | |
| 348 | mod tests; |
src/tools/unstable-book-gen/src/tests.rs created+73| ... | ... | @@ -0,0 +1,73 @@ |
| 1 | use std::path::{Path, PathBuf}; | |
| 2 | ||
| 3 | use super::parse_compiler_flags; | |
| 4 | ||
| 5 | #[test] | |
| 6 | fn parses_unstable_options_entries() { | |
| 7 | let options_rs = r#"options! { | |
| 8 | UnstableOptions, UnstableOptionsTargetModifiers, Z_OPTIONS, dbopts, "Z", "unstable", | |
| 9 | ||
| 10 | #[rustc_lint_opt_deny_field_access("test attr")] | |
| 11 | allow_features: Option<Vec<String>> = (None, parse_opt_comma_list, [TRACKED], | |
| 12 | "only allow the listed language features to be enabled in code (comma separated)"), | |
| 13 | dump_mir: Option<String> = (None, parse_opt_string, [UNTRACKED], | |
| 14 | "dump MIR state to file.\n\ | |
| 15 | `val` is used to select which passes and functions to dump."), | |
| 16 | join_lines: bool = (false, parse_bool, [TRACKED], | |
| 17 | "join \ | |
| 18 | continued lines"), | |
| 19 | help: bool = (false, parse_no_value, [UNTRACKED], "Print unstable compiler options"), | |
| 20 | }"#; | |
| 21 | ||
| 22 | let features = parse_compiler_flags(options_rs, Path::new("options/unstable.rs")); | |
| 23 | ||
| 24 | assert!(features.contains_key("allow_features")); | |
| 25 | assert!(features.contains_key("dump_mir")); | |
| 26 | assert!(features.contains_key("join_lines")); | |
| 27 | assert!(!features.contains_key("help")); | |
| 28 | ||
| 29 | assert!( | |
| 30 | features["dump_mir"] | |
| 31 | .description | |
| 32 | .as_deref() | |
| 33 | .expect("dump_mir description should exist") | |
| 34 | .starts_with("dump MIR state to file.\n"), | |
| 35 | ); | |
| 36 | assert_eq!(features["join_lines"].description.as_deref(), Some("join continued lines")); | |
| 37 | assert_eq!( | |
| 38 | features["allow_features"].description.as_deref(), | |
| 39 | Some("only allow the listed language features to be enabled in code (comma separated)"), | |
| 40 | ); | |
| 41 | assert_eq!(features["allow_features"].file, PathBuf::from("options/unstable.rs")); | |
| 42 | assert_eq!(features["allow_features"].line, 5); | |
| 43 | } | |
| 44 | ||
| 45 | #[test] | |
| 46 | fn parser_accepts_optional_trailing_metadata() { | |
| 47 | let options_rs = r##"options! { | |
| 48 | UnstableOptions, UnstableOptionsTargetModifiers, Z_OPTIONS, dbopts, "Z", "unstable", | |
| 49 | ||
| 50 | deprecated_flag: bool = (false, parse_no_value, [UNTRACKED], "deprecated flag", | |
| 51 | is_deprecated_and_do_nothing: true), | |
| 52 | raw_description: bool = (false, parse_no_value, [UNTRACKED], r#"raw "quoted" text"#), | |
| 53 | }"##; | |
| 54 | ||
| 55 | let features = parse_compiler_flags(options_rs, Path::new("options/unstable.rs")); | |
| 56 | assert_eq!(features["deprecated_flag"].description.as_deref(), Some("deprecated flag")); | |
| 57 | assert_eq!(features["raw_description"].description.as_deref(), Some("raw \"quoted\" text"),); | |
| 58 | } | |
| 59 | ||
| 60 | #[test] | |
| 61 | fn parses_real_unstable_options_file() { | |
| 62 | let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR")); | |
| 63 | let options_path = manifest_dir.join("../../../compiler/rustc_session/src/options/unstable.rs"); | |
| 64 | let options_rs = std::fs::read_to_string(&options_path).unwrap(); | |
| 65 | let features = parse_compiler_flags(&options_rs, &options_path); | |
| 66 | ||
| 67 | assert!(features.contains_key("allow_features")); | |
| 68 | assert!(features.contains_key("dump_mir")); | |
| 69 | assert!(features.contains_key("unstable_options")); | |
| 70 | assert!(!features.contains_key("help")); | |
| 71 | assert!(features["dump_mir"].line > 0); | |
| 72 | assert!(features["dump_mir"].description.as_deref().unwrap().starts_with("dump MIR state")); | |
| 73 | } |
tests/rustdoc-ui/output-format-json-emit-html.html_non_static.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: the `--emit=html-non-static-files` flag is not supported with `--output-format=json` | |
| 2 |
tests/rustdoc-ui/output-format-json-emit-html.html_static.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: the `--emit=html-static-files` flag is not supported with `--output-format=json` | |
| 2 |
tests/rustdoc-ui/output-format-json-emit-html.rs created+8| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | //@ revisions: html_static html_non_static | |
| 2 | //@ check-fail | |
| 3 | //@[html_static] compile-flags: -Z unstable-options --output-format=json --emit=html-static-files | |
| 4 | //@[html_non_static] compile-flags: -Z unstable-options --output-format=json --emit=html-non-static-files | |
| 5 | //[html_static]~? ERROR the `--emit=html-static-files` flag is not supported with `--output-format=json` | |
| 6 | //[html_non_static]~? ERROR the `--emit=html-non-static-files` flag is not supported with `--output-format=json` | |
| 7 | ||
| 8 | pub struct Foo; |
tests/rustdoc-ui/show-coverage-json-emit-html-non-static.rs created+5| ... | ... | @@ -0,0 +1,5 @@ |
| 1 | //@ compile-flags: -Z unstable-options --show-coverage --output-format=json --emit=html-non-static-files | |
| 2 | //@ check-fail | |
| 3 | //~? ERROR the `--emit=html-non-static-files` flag is not supported with `--output-format=json` | |
| 4 | ||
| 5 | pub struct Foo; |
tests/rustdoc-ui/show-coverage-json-emit-html-non-static.stderr created+2| ... | ... | @@ -0,0 +1,2 @@ |
| 1 | error: the `--emit=html-non-static-files` flag is not supported with `--output-format=json` | |
| 2 |
tests/ui/lint/dead-code/const-underscore-issue-101532.rs created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | //@ check-pass | |
| 2 | // Test for issue #101532 - dead code warnings should work inside const _ | |
| 3 | ||
| 4 | #![warn(dead_code)] | |
| 5 | ||
| 6 | const _: () = { | |
| 7 | let a: (); | |
| 8 | struct B {} //~ WARN struct `B` is never constructed | |
| 9 | enum C {} //~ WARN enum `C` is never used | |
| 10 | fn d() {} //~ WARN function `d` is never used | |
| 11 | const E: () = {}; //~ WARN constant `E` is never used | |
| 12 | }; | |
| 13 | ||
| 14 | fn main() {} |
tests/ui/lint/dead-code/const-underscore-issue-101532.stderr created+32| ... | ... | @@ -0,0 +1,32 @@ |
| 1 | warning: struct `B` is never constructed | |
| 2 | --> $DIR/const-underscore-issue-101532.rs:8:12 | |
| 3 | | | |
| 4 | LL | struct B {} | |
| 5 | | ^ | |
| 6 | | | |
| 7 | note: the lint level is defined here | |
| 8 | --> $DIR/const-underscore-issue-101532.rs:4:9 | |
| 9 | | | |
| 10 | LL | #![warn(dead_code)] | |
| 11 | | ^^^^^^^^^ | |
| 12 | ||
| 13 | warning: enum `C` is never used | |
| 14 | --> $DIR/const-underscore-issue-101532.rs:9:10 | |
| 15 | | | |
| 16 | LL | enum C {} | |
| 17 | | ^ | |
| 18 | ||
| 19 | warning: function `d` is never used | |
| 20 | --> $DIR/const-underscore-issue-101532.rs:10:8 | |
| 21 | | | |
| 22 | LL | fn d() {} | |
| 23 | | ^ | |
| 24 | ||
| 25 | warning: constant `E` is never used | |
| 26 | --> $DIR/const-underscore-issue-101532.rs:11:11 | |
| 27 | | | |
| 28 | LL | const E: () = {}; | |
| 29 | | ^ | |
| 30 | ||
| 31 | warning: 4 warnings emitted | |
| 32 |
tests/ui/parser/macro/unicode-control-codepoints-macros.stderr+5-5| ... | ... | @@ -6,7 +6,7 @@ LL | /// �test� RTL in doc in vec |
| 6 | 6 | | |
| 7 | 7 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen |
| 8 | 8 | = note: if their presence wasn't intentional, you can remove them |
| 9 | = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}', '\u{2066}' | |
| 9 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' | |
| 10 | 10 | = note: `#[deny(text_direction_codepoint_in_literal)]` on by default |
| 11 | 11 | |
| 12 | 12 | error: unicode codepoint changing visible direction of text present in doc comment |
| ... | ... | @@ -19,7 +19,7 @@ LL | | */ |
| 19 | 19 | | |
| 20 | 20 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen |
| 21 | 21 | = note: if their presence wasn't intentional, you can remove them |
| 22 | = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}', '\u{2066}' | |
| 22 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' | |
| 23 | 23 | |
| 24 | 24 | error: unicode codepoint changing visible direction of text present in doc comment |
| 25 | 25 | --> $DIR/unicode-control-codepoints-macros.rs:33:9 |
| ... | ... | @@ -31,7 +31,7 @@ LL | | */ |
| 31 | 31 | | |
| 32 | 32 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen |
| 33 | 33 | = note: if their presence wasn't intentional, you can remove them |
| 34 | = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}', '\u{2066}' | |
| 34 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' | |
| 35 | 35 | |
| 36 | 36 | error: unicode codepoint changing visible direction of text present in doc comment |
| 37 | 37 | --> $DIR/unicode-control-codepoints-macros.rs:41:9 |
| ... | ... | @@ -41,7 +41,7 @@ LL | /// �test� RTL in doc in proc macro |
| 41 | 41 | | |
| 42 | 42 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen |
| 43 | 43 | = note: if their presence wasn't intentional, you can remove them |
| 44 | = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}', '\u{2066}' | |
| 44 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' | |
| 45 | 45 | |
| 46 | 46 | error: unicode codepoint changing visible direction of text present in doc comment |
| 47 | 47 | --> $DIR/unicode-control-codepoints-macros.rs:46:9 |
| ... | ... | @@ -51,7 +51,7 @@ LL | /// �test� RTL in doc in proc macro |
| 51 | 51 | | |
| 52 | 52 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen |
| 53 | 53 | = note: if their presence wasn't intentional, you can remove them |
| 54 | = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}', '\u{2066}' | |
| 54 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}', '\u{2066}' | |
| 55 | 55 | |
| 56 | 56 | error: aborting due to 5 previous errors |
| 57 | 57 |
tests/ui/parser/unicode-control-codepoints.stderr+2-2| ... | ... | @@ -232,7 +232,7 @@ LL | /** '�'); */fn foo() {} |
| 232 | 232 | | |
| 233 | 233 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen |
| 234 | 234 | = note: if their presence wasn't intentional, you can remove them |
| 235 | = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}' | |
| 235 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}' | |
| 236 | 236 | |
| 237 | 237 | error: unicode codepoint changing visible direction of text present in doc comment |
| 238 | 238 | --> $DIR/unicode-control-codepoints.rs:46:1 |
| ... | ... | @@ -244,7 +244,7 @@ LL | | * '�'); */fn bar() {} |
| 244 | 244 | | |
| 245 | 245 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen |
| 246 | 246 | = note: if their presence wasn't intentional, you can remove them |
| 247 | = note: if you want to keep them but make them visible in your source code, you can escape them: '\u{202e}' | |
| 247 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{202e}' | |
| 248 | 248 | |
| 249 | 249 | error: aborting due to 20 previous errors |
| 250 | 250 |
tests/ui/parser/unicode-control-doc-comment-issue-153096.rs created+8| ... | ... | @@ -0,0 +1,8 @@ |
| 1 | //@ edition: 2024 | |
| 2 | ||
| 3 | #[allow(unused)] | |
| 4 | /// א, ב, ג, ד, ה | |
| 5 | //~^ ERROR unicode codepoint changing visible direction of text present in doc comment | |
| 6 | fn foo() {} | |
| 7 | ||
| 8 | fn main() {} |
tests/ui/parser/unicode-control-doc-comment-issue-153096.stderr created+13| ... | ... | @@ -0,0 +1,13 @@ |
| 1 | error: unicode codepoint changing visible direction of text present in doc comment | |
| 2 | --> $DIR/unicode-control-doc-comment-issue-153096.rs:4:1 | |
| 3 | | | |
| 4 | LL | /// �א�, �ב�, �ג�, �ד�, �ה� | |
| 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ this doc comment contains invisible unicode text flow control codepoints | |
| 6 | | | |
| 7 | = note: these kind of unicode codepoints change the way text flows on applications that support them, but can cause confusion because they change the order of characters on the screen | |
| 8 | = note: if their presence wasn't intentional, you can remove them | |
| 9 | = note: if you need to keep them and make them explicit in source, rewrite this doc comment as a `#[doc = "..."]` attribute and use Unicode escapes such as '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}', '\u{2068}', '\u{2069}' | |
| 10 | = note: `#[deny(text_direction_codepoint_in_literal)]` on by default | |
| 11 | ||
| 12 | error: aborting due to 1 previous error | |
| 13 |
tests/ui/traits/explicit-reference-cast-unrelated-leaf.rs created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | trait Output<'a> { | |
| 2 | type Type; | |
| 3 | } | |
| 4 | ||
| 5 | struct Wrapper; | |
| 6 | ||
| 7 | impl Wrapper { | |
| 8 | fn do_something_wrapper<O, F>(self, _: F) | |
| 9 | where | |
| 10 | for<'a> F: Output<'a>, | |
| 11 | for<'a> O: From<<F as Output<'a>>::Type>, | |
| 12 | { | |
| 13 | } | |
| 14 | } | |
| 15 | ||
| 16 | fn main() { | |
| 17 | let wrapper = Wrapper; | |
| 18 | wrapper.do_something_wrapper(|value| ()); | |
| 19 | //~^ ERROR the trait bound `for<'a> {closure@ | |
| 20 | //~| ERROR the trait bound `for<'a> _: From<<{closure@ | |
| 21 | } |
tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr created+47| ... | ... | @@ -0,0 +1,47 @@ |
| 1 | error[E0277]: the trait bound `for<'a> {closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}: Output<'a>` is not satisfied | |
| 2 | --> $DIR/explicit-reference-cast-unrelated-leaf.rs:18:34 | |
| 3 | | | |
| 4 | LL | wrapper.do_something_wrapper(|value| ()); | |
| 5 | | -------------------- ^^^^^^^^^^ unsatisfied trait bound | |
| 6 | | | | |
| 7 | | required by a bound introduced by this call | |
| 8 | | | |
| 9 | = help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}` | |
| 10 | help: this trait has no implementations, consider adding one | |
| 11 | --> $DIR/explicit-reference-cast-unrelated-leaf.rs:1:1 | |
| 12 | | | |
| 13 | LL | trait Output<'a> { | |
| 14 | | ^^^^^^^^^^^^^^^^ | |
| 15 | note: required by a bound in `Wrapper::do_something_wrapper` | |
| 16 | --> $DIR/explicit-reference-cast-unrelated-leaf.rs:10:20 | |
| 17 | | | |
| 18 | LL | fn do_something_wrapper<O, F>(self, _: F) | |
| 19 | | -------------------- required by a bound in this associated function | |
| 20 | LL | where | |
| 21 | LL | for<'a> F: Output<'a>, | |
| 22 | | ^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper` | |
| 23 | ||
| 24 | error[E0277]: the trait bound `for<'a> _: From<<{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41} as Output<'a>>::Type>` is not satisfied | |
| 25 | --> $DIR/explicit-reference-cast-unrelated-leaf.rs:18:13 | |
| 26 | | | |
| 27 | LL | wrapper.do_something_wrapper(|value| ()); | |
| 28 | | ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | |
| 29 | | | |
| 30 | = help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}` | |
| 31 | help: this trait has no implementations, consider adding one | |
| 32 | --> $DIR/explicit-reference-cast-unrelated-leaf.rs:1:1 | |
| 33 | | | |
| 34 | LL | trait Output<'a> { | |
| 35 | | ^^^^^^^^^^^^^^^^ | |
| 36 | note: required by a bound in `Wrapper::do_something_wrapper` | |
| 37 | --> $DIR/explicit-reference-cast-unrelated-leaf.rs:11:20 | |
| 38 | | | |
| 39 | LL | fn do_something_wrapper<O, F>(self, _: F) | |
| 40 | | -------------------- required by a bound in this associated function | |
| 41 | ... | |
| 42 | LL | for<'a> O: From<<F as Output<'a>>::Type>, | |
| 43 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper` | |
| 44 | ||
| 45 | error: aborting due to 2 previous errors | |
| 46 | ||
| 47 | For more information about this error, try `rustc --explain E0277`. |