authorbors <bors@rust-lang.org> 2024-09-23 02:02:22 UTC
committerbors <bors@rust-lang.org> 2024-09-23 02:02:22 UTC
log66b0b29e65c77e5801c308e725a233c0728df300
tree8c72f79e844035a65c7153b21dd8ef3cacacdbfa
parentd14c1c75ab284d382bd1e9c499596c274f1abe58
parent9132770c8f920fea72af23b56acb67c1f1d6928d

Auto merge of #130724 - compiler-errors:bump, r=Mark-Simulacrum

Bump stage0 to beta-2024-09-22 and rustfmt to nightly-2024-09-22 I'm doing this to apply the changes to version sorting (https://github.com/rust-lang/rustfmt/pull/6284) that have occurred since rustfmt last upgraded (and a few other miscellaneous changes, like changes to expression overflowing: https://github.com/rust-lang/rustfmt/pull/6260). Eagerly updating rustfmt and formatting-the-world will ideally move some of the pressure off of the beta bump which will happen at the beginning of the next release cycle. You can verify this is correct by checking out the changes, reverting the last commit, reapplying them, and diffing the changes: ``` git fetch git@github.com:compiler-errors/rust.git bump git checkout -b bump FETCH_HEAD git reset --hard HEAD~5 ./x.py fmt --all git diff FETCH_HEAD # ignore the changes to stage0, and rustfmt.toml, # and test file changes in rustdoc-js-std, run-make. ``` Or just take my word for it? Up to the reviewer. r? release

1459 files changed, 7616 insertions(+), 8848 deletions(-)

compiler/rustc_abi/src/layout.rs+1-1
......@@ -999,8 +999,8 @@ impl<Cx: HasDataLayout> LayoutCalculator<Cx> {
999999 if repr.can_randomize_type_layout() && cfg!(feature = "randomize") {
10001000 #[cfg(feature = "randomize")]
10011001 {
1002 use rand::seq::SliceRandom;
10031002 use rand::SeedableRng;
1003 use rand::seq::SliceRandom;
10041004 // `ReprOptions.field_shuffle_seed` is a deterministic seed we can use to randomize field
10051005 // ordering.
10061006 let mut rng =
compiler/rustc_abi/src/lib.rs+4-7
......@@ -1138,13 +1138,10 @@ impl Scalar {
11381138 #[inline]
11391139 pub fn is_bool(&self) -> bool {
11401140 use Integer::*;
1141 matches!(
1142 self,
1143 Scalar::Initialized {
1144 value: Primitive::Int(I8, false),
1145 valid_range: WrappingRange { start: 0, end: 1 }
1146 }
1147 )
1141 matches!(self, Scalar::Initialized {
1142 value: Primitive::Int(I8, false),
1143 valid_range: WrappingRange { start: 0, end: 1 }
1144 })
11481145 }
11491146
11501147 /// Get the primitive representation of this type, ignoring the valid range and whether the
compiler/rustc_ast/src/ast.rs+7-7
......@@ -21,19 +21,19 @@
2121use std::borrow::Cow;
2222use std::{cmp, fmt, mem};
2323
24pub use GenericArgs::*;
25pub use UnsafeSource::*;
2426pub use rustc_ast_ir::{Movability, Mutability};
2527use rustc_data_structures::packed::Pu128;
2628use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2729use rustc_data_structures::stack::ensure_sufficient_stack;
2830use rustc_data_structures::sync::Lrc;
2931use rustc_macros::{Decodable, Encodable, HashStable_Generic};
30use rustc_span::source_map::{respan, Spanned};
31use rustc_span::symbol::{kw, sym, Ident, Symbol};
3232pub use rustc_span::AttrId;
33use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
34use thin_vec::{thin_vec, ThinVec};
35pub use GenericArgs::*;
36pub use UnsafeSource::*;
33use rustc_span::source_map::{Spanned, respan};
34use rustc_span::symbol::{Ident, Symbol, kw, sym};
35use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
36use thin_vec::{ThinVec, thin_vec};
3737
3838pub use crate::format::*;
3939use crate::ptr::P;
......@@ -288,7 +288,7 @@ impl ParenthesizedArgs {
288288 }
289289}
290290
291pub use crate::node_id::{NodeId, CRATE_NODE_ID, DUMMY_NODE_ID};
291pub use crate::node_id::{CRATE_NODE_ID, DUMMY_NODE_ID, NodeId};
292292
293293/// Modifiers on a trait bound like `~const`, `?` and `!`.
294294#[derive(Copy, Clone, PartialEq, Eq, Encodable, Decodable, Debug)]
compiler/rustc_ast/src/attr/mod.rs+6-6
......@@ -4,15 +4,15 @@ use std::iter;
44use std::sync::atomic::{AtomicU32, Ordering};
55
66use rustc_index::bit_set::GrowableBitSet;
7use rustc_span::symbol::{sym, Ident, Symbol};
87use rustc_span::Span;
9use smallvec::{smallvec, SmallVec};
10use thin_vec::{thin_vec, ThinVec};
8use rustc_span::symbol::{Ident, Symbol, sym};
9use smallvec::{SmallVec, smallvec};
10use thin_vec::{ThinVec, thin_vec};
1111
1212use crate::ast::{
13 AttrArgs, AttrArgsEq, AttrId, AttrItem, AttrKind, AttrStyle, AttrVec, Attribute, DelimArgs,
14 Expr, ExprKind, LitKind, MetaItem, MetaItemKind, MetaItemLit, NestedMetaItem, NormalAttr, Path,
15 PathSegment, Safety, DUMMY_NODE_ID,
13 AttrArgs, AttrArgsEq, AttrId, AttrItem, AttrKind, AttrStyle, AttrVec, Attribute, DUMMY_NODE_ID,
14 DelimArgs, Expr, ExprKind, LitKind, MetaItem, MetaItemKind, MetaItemLit, NestedMetaItem,
15 NormalAttr, Path, PathSegment, Safety,
1616};
1717use crate::ptr::P;
1818use crate::token::{self, CommentKind, Delimiter, Token};
compiler/rustc_ast/src/entry.rs+2-2
......@@ -1,7 +1,7 @@
1use rustc_span::symbol::sym;
21use rustc_span::Symbol;
2use rustc_span::symbol::sym;
33
4use crate::{attr, Attribute};
4use crate::{Attribute, attr};
55
66#[derive(Debug)]
77pub enum EntryPointType {
compiler/rustc_ast/src/expand/allocator.rs+1-1
......@@ -1,5 +1,5 @@
11use rustc_macros::HashStable_Generic;
2use rustc_span::symbol::{sym, Symbol};
2use rustc_span::symbol::{Symbol, sym};
33
44#[derive(Clone, Debug, Copy, Eq, PartialEq, HashStable_Generic)]
55pub enum AllocatorKind {
compiler/rustc_ast/src/format.rs+2-2
......@@ -1,10 +1,10 @@
11use rustc_data_structures::fx::FxHashMap;
22use rustc_macros::{Decodable, Encodable};
3use rustc_span::symbol::{Ident, Symbol};
43use rustc_span::Span;
4use rustc_span::symbol::{Ident, Symbol};
55
6use crate::ptr::P;
76use crate::Expr;
7use crate::ptr::P;
88
99// Definitions:
1010//
compiler/rustc_ast/src/mut_visit.rs+2-2
......@@ -13,10 +13,10 @@ use std::panic;
1313use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1414use rustc_data_structures::stack::ensure_sufficient_stack;
1515use rustc_data_structures::sync::Lrc;
16use rustc_span::Span;
1617use rustc_span::source_map::Spanned;
1718use rustc_span::symbol::Ident;
18use rustc_span::Span;
19use smallvec::{smallvec, Array, SmallVec};
19use smallvec::{Array, SmallVec, smallvec};
2020use thin_vec::ThinVec;
2121
2222use crate::ast::*;
compiler/rustc_ast/src/token.rs+8-8
......@@ -1,21 +1,21 @@
11use std::borrow::Cow;
22use std::fmt;
33
4pub use BinOpToken::*;
5pub use LitKind::*;
6pub use Nonterminal::*;
7pub use NtExprKind::*;
8pub use NtPatKind::*;
9pub use TokenKind::*;
410use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
511use rustc_data_structures::sync::Lrc;
612use rustc_macros::{Decodable, Encodable, HashStable_Generic};
713use rustc_span::edition::Edition;
8use rustc_span::symbol::{kw, sym};
914#[allow(clippy::useless_attribute)] // FIXME: following use of `hidden_glob_reexports` incorrectly triggers `useless_attribute` lint.
1015#[allow(hidden_glob_reexports)]
1116use rustc_span::symbol::{Ident, Symbol};
12use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
13pub use BinOpToken::*;
14pub use LitKind::*;
15pub use Nonterminal::*;
16pub use NtExprKind::*;
17pub use NtPatKind::*;
18pub use TokenKind::*;
17use rustc_span::symbol::{kw, sym};
18use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
1919
2020use crate::ast;
2121use crate::ptr::P;
compiler/rustc_ast/src/tokenstream.rs+1-1
......@@ -20,7 +20,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2020use rustc_data_structures::sync::{self, Lrc};
2121use rustc_macros::{Decodable, Encodable, HashStable_Generic};
2222use rustc_serialize::{Decodable, Encodable};
23use rustc_span::{sym, Span, SpanDecoder, SpanEncoder, Symbol, DUMMY_SP};
23use rustc_span::{DUMMY_SP, Span, SpanDecoder, SpanEncoder, Symbol, sym};
2424
2525use crate::ast::{AttrStyle, StmtKind};
2626use crate::ast_traits::{HasAttrs, HasTokens};
compiler/rustc_ast/src/util/literal.rs+2-2
......@@ -3,10 +3,10 @@
33use std::{ascii, fmt, str};
44
55use rustc_lexer::unescape::{
6 byte_from_char, unescape_byte, unescape_char, unescape_mixed, unescape_unicode, MixedUnit, Mode,
6 MixedUnit, Mode, byte_from_char, unescape_byte, unescape_char, unescape_mixed, unescape_unicode,
77};
8use rustc_span::symbol::{kw, sym, Symbol};
98use rustc_span::Span;
9use rustc_span::symbol::{Symbol, kw, sym};
1010use tracing::debug;
1111
1212use crate::ast::{self, LitKind, MetaItemLit, StrStyle};
compiler/rustc_ast/src/visit.rs+1-1
......@@ -15,8 +15,8 @@
1515
1616pub use rustc_ast_ir::visit::VisitorResult;
1717pub use rustc_ast_ir::{try_visit, visit_opt, walk_list, walk_visitable_list};
18use rustc_span::symbol::Ident;
1918use rustc_span::Span;
19use rustc_span::symbol::Ident;
2020
2121use crate::ast::*;
2222use crate::ptr::P;
compiler/rustc_ast_lowering/src/asm.rs+4-4
......@@ -8,9 +8,10 @@ use rustc_hir as hir;
88use rustc_hir::def::{DefKind, Res};
99use rustc_session::parse::feature_err;
1010use rustc_span::symbol::kw;
11use rustc_span::{sym, Span};
11use rustc_span::{Span, sym};
1212use rustc_target::asm;
1313
14use super::LoweringContext;
1415use super::errors::{
1516 AbiSpecifiedMultipleTimes, AttSyntaxOnlyX86, ClobberAbiNotSupported,
1617 InlineAsmUnsupportedTarget, InvalidAbiClobberAbi, InvalidAsmTemplateModifierConst,
......@@ -18,10 +19,9 @@ use super::errors::{
1819 InvalidAsmTemplateModifierRegClassSub, InvalidAsmTemplateModifierSym, InvalidRegister,
1920 InvalidRegisterClass, RegisterClassOnlyClobber, RegisterConflict,
2021};
21use super::LoweringContext;
2222use crate::{
23 fluent_generated as fluent, AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition,
24 ParamMode, ResolverAstLoweringExt,
23 AllowReturnTypeNotation, ImplTraitContext, ImplTraitPosition, ParamMode,
24 ResolverAstLoweringExt, fluent_generated as fluent,
2525};
2626
2727impl<'a, 'hir> LoweringContext<'a, 'hir> {
compiler/rustc_ast_lowering/src/delegation.rs+1-1
......@@ -46,8 +46,8 @@ use rustc_errors::ErrorGuaranteed;
4646use rustc_hir::def_id::DefId;
4747use rustc_middle::span_bug;
4848use rustc_middle::ty::{Asyncness, ResolverAstLowering};
49use rustc_span::symbol::Ident;
5049use rustc_span::Span;
50use rustc_span::symbol::Ident;
5151use rustc_target::spec::abi;
5252use {rustc_ast as ast, rustc_hir as hir};
5353
compiler/rustc_ast_lowering/src/expr.rs+15-18
......@@ -4,14 +4,14 @@ use rustc_ast::ptr::P as AstP;
44use rustc_ast::*;
55use rustc_data_structures::stack::ensure_sufficient_stack;
66use rustc_hir as hir;
7use rustc_hir::def::{DefKind, Res};
87use rustc_hir::HirId;
8use rustc_hir::def::{DefKind, Res};
99use rustc_middle::span_bug;
1010use rustc_session::errors::report_lit_error;
11use rustc_span::source_map::{respan, Spanned};
12use rustc_span::symbol::{kw, sym, Ident, Symbol};
13use rustc_span::{DesugaringKind, Span, DUMMY_SP};
14use thin_vec::{thin_vec, ThinVec};
11use rustc_span::source_map::{Spanned, respan};
12use rustc_span::symbol::{Ident, Symbol, kw, sym};
13use rustc_span::{DUMMY_SP, DesugaringKind, Span};
14use thin_vec::{ThinVec, thin_vec};
1515
1616use super::errors::{
1717 AsyncCoroutinesNotSupported, AwaitOnlyInAsyncFnAndBlocks, BaseExpressionDoubleDot,
......@@ -23,7 +23,7 @@ use super::{
2323 GenericArgsMode, ImplTraitContext, LoweringContext, ParamMode, ResolverAstLoweringExt,
2424};
2525use crate::errors::YieldInClosure;
26use crate::{fluent_generated, AllowReturnTypeNotation, FnDeclKind, ImplTraitPosition};
26use crate::{AllowReturnTypeNotation, FnDeclKind, ImplTraitPosition, fluent_generated};
2727
2828impl<'hir> LoweringContext<'_, 'hir> {
2929 fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] {
......@@ -725,18 +725,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
725725 span,
726726 Some(self.allow_gen_future.clone()),
727727 );
728 self.lower_attrs(
729 inner_hir_id,
730 &[Attribute {
731 kind: AttrKind::Normal(ptr::P(NormalAttr::from_ident(Ident::new(
732 sym::track_caller,
733 span,
734 )))),
735 id: self.tcx.sess.psess.attr_id_generator.mk_attr_id(),
736 style: AttrStyle::Outer,
737 span: unstable_span,
738 }],
739 );
728 self.lower_attrs(inner_hir_id, &[Attribute {
729 kind: AttrKind::Normal(ptr::P(NormalAttr::from_ident(Ident::new(
730 sym::track_caller,
731 span,
732 )))),
733 id: self.tcx.sess.psess.attr_id_generator.mk_attr_id(),
734 style: AttrStyle::Outer,
735 span: unstable_span,
736 }]);
740737 }
741738 }
742739
compiler/rustc_ast_lowering/src/format.rs+5-8
......@@ -6,8 +6,8 @@ use rustc_ast::*;
66use rustc_data_structures::fx::FxIndexMap;
77use rustc_hir as hir;
88use rustc_session::config::FmtDebug;
9use rustc_span::symbol::{kw, Ident};
10use rustc_span::{sym, Span, Symbol};
9use rustc_span::symbol::{Ident, kw};
10use rustc_span::{Span, Symbol, sym};
1111
1212use super::LoweringContext;
1313
......@@ -363,16 +363,13 @@ fn make_format_spec<'hir>(
363363 debug_hex,
364364 } = &placeholder.format_options;
365365 let fill = ctx.expr_char(sp, fill.unwrap_or(' '));
366 let align = ctx.expr_lang_item_type_relative(
367 sp,
368 hir::LangItem::FormatAlignment,
369 match alignment {
366 let align =
367 ctx.expr_lang_item_type_relative(sp, hir::LangItem::FormatAlignment, match alignment {
370368 Some(FormatAlignment::Left) => sym::Left,
371369 Some(FormatAlignment::Right) => sym::Right,
372370 Some(FormatAlignment::Center) => sym::Center,
373371 None => sym::Unknown,
374 },
375 );
372 });
376373 // This needs to match `Flag` in library/core/src/fmt/rt.rs.
377374 let flags: u32 = ((sign == Some(FormatSign::Plus)) as u32)
378375 | ((sign == Some(FormatSign::Minus)) as u32) << 1
compiler/rustc_ast_lowering/src/index.rs+1-1
......@@ -6,7 +6,7 @@ use rustc_hir::*;
66use rustc_index::IndexVec;
77use rustc_middle::span_bug;
88use rustc_middle::ty::TyCtxt;
9use rustc_span::{Span, DUMMY_SP};
9use rustc_span::{DUMMY_SP, Span};
1010use tracing::{debug, instrument};
1111
1212/// A visitor that walks over the HIR and collects `Node`s into a HIR map.
compiler/rustc_ast_lowering/src/item.rs+31-43
......@@ -3,17 +3,17 @@ use rustc_ast::visit::AssocCtxt;
33use rustc_ast::*;
44use rustc_errors::ErrorGuaranteed;
55use rustc_hir as hir;
6use rustc_hir::def::{DefKind, Res};
7use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
86use rustc_hir::PredicateOrigin;
7use rustc_hir::def::{DefKind, Res};
8use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
99use rustc_index::{IndexSlice, IndexVec};
1010use rustc_middle::span_bug;
1111use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
1212use rustc_span::edit_distance::find_best_match_for_name;
13use rustc_span::symbol::{kw, sym, Ident};
13use rustc_span::symbol::{Ident, kw, sym};
1414use rustc_span::{DesugaringKind, Span, Symbol};
1515use rustc_target::spec::abi;
16use smallvec::{smallvec, SmallVec};
16use smallvec::{SmallVec, smallvec};
1717use thin_vec::ThinVec;
1818use tracing::instrument;
1919
......@@ -281,16 +281,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
281281 );
282282 this.arena.alloc(this.ty(span, hir::TyKind::Err(guar)))
283283 }
284 Some(ty) => this.lower_ty(
285 ty,
286 ImplTraitContext::OpaqueTy {
287 origin: hir::OpaqueTyOrigin::TyAlias {
288 parent: this.local_def_id(id),
289 in_assoc_ty: false,
290 },
291 fn_kind: None,
284 Some(ty) => this.lower_ty(ty, ImplTraitContext::OpaqueTy {
285 origin: hir::OpaqueTyOrigin::TyAlias {
286 parent: this.local_def_id(id),
287 in_assoc_ty: false,
292288 },
293 ),
289 fn_kind: None,
290 }),
294291 },
295292 );
296293 hir::ItemKind::TyAlias(ty, generics)
......@@ -981,16 +978,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
981978 hir::ImplItemKind::Type(ty)
982979 }
983980 Some(ty) => {
984 let ty = this.lower_ty(
985 ty,
986 ImplTraitContext::OpaqueTy {
987 origin: hir::OpaqueTyOrigin::TyAlias {
988 parent: this.local_def_id(i.id),
989 in_assoc_ty: true,
990 },
991 fn_kind: None,
981 let ty = this.lower_ty(ty, ImplTraitContext::OpaqueTy {
982 origin: hir::OpaqueTyOrigin::TyAlias {
983 parent: this.local_def_id(i.id),
984 in_assoc_ty: true,
992985 },
993 );
986 fn_kind: None,
987 });
994988 hir::ImplItemKind::Type(ty)
995989 }
996990 },
......@@ -1129,13 +1123,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
11291123
11301124 pub(super) fn lower_const_body(&mut self, span: Span, expr: Option<&Expr>) -> hir::BodyId {
11311125 self.lower_body(|this| {
1132 (
1133 &[],
1134 match expr {
1135 Some(expr) => this.lower_expr_mut(expr),
1136 None => this.expr_err(span, this.dcx().span_delayed_bug(span, "no block")),
1137 },
1138 )
1126 (&[], match expr {
1127 Some(expr) => this.lower_expr_mut(expr),
1128 None => this.expr_err(span, this.dcx().span_delayed_bug(span, "no block")),
1129 })
11391130 })
11401131 }
11411132
......@@ -1515,10 +1506,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
15151506 for bound in &bound_pred.bounds {
15161507 if !matches!(
15171508 *bound,
1518 GenericBound::Trait(
1519 _,
1520 TraitBoundModifiers { polarity: BoundPolarity::Maybe(_), .. }
1521 )
1509 GenericBound::Trait(_, TraitBoundModifiers {
1510 polarity: BoundPolarity::Maybe(_),
1511 ..
1512 })
15221513 ) {
15231514 continue;
15241515 }
......@@ -1619,16 +1610,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
16191610 self.children.push((anon_const_did, hir::MaybeOwner::NonOwner(const_id)));
16201611
16211612 let const_body = self.lower_body(|this| {
1622 (
1623 &[],
1624 hir::Expr {
1625 hir_id: const_expr_id,
1626 kind: hir::ExprKind::Lit(
1627 this.arena.alloc(hir::Lit { node: LitKind::Bool(true), span }),
1628 ),
1629 span,
1630 },
1631 )
1613 (&[], hir::Expr {
1614 hir_id: const_expr_id,
1615 kind: hir::ExprKind::Lit(
1616 this.arena.alloc(hir::Lit { node: LitKind::Bool(true), span }),
1617 ),
1618 span,
1619 })
16321620 });
16331621
16341622 let default_ac = self.arena.alloc(hir::AnonConst {
compiler/rustc_ast_lowering/src/lib.rs+4-4
......@@ -53,7 +53,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
5353use rustc_data_structures::sync::Lrc;
5454use rustc_errors::{DiagArgFromDisplay, DiagCtxtHandle, StashKey};
5555use rustc_hir::def::{DefKind, LifetimeRes, Namespace, PartialRes, PerNS, Res};
56use rustc_hir::def_id::{LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE};
56use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId, LocalDefIdMap};
5757use rustc_hir::{
5858 self as hir, ConstArg, GenericArg, HirId, ItemLocalMap, MissingLifetimeKind, ParamName,
5959 TraitCandidate,
......@@ -63,9 +63,9 @@ use rustc_macros::extension;
6363use rustc_middle::span_bug;
6464use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
6565use rustc_session::parse::{add_feature_diagnostics, feature_err};
66use rustc_span::symbol::{kw, sym, Ident, Symbol};
67use rustc_span::{DesugaringKind, Span, DUMMY_SP};
68use smallvec::{smallvec, SmallVec};
66use rustc_span::symbol::{Ident, Symbol, kw, sym};
67use rustc_span::{DUMMY_SP, DesugaringKind, Span};
68use smallvec::{SmallVec, smallvec};
6969use thin_vec::ThinVec;
7070use tracing::{debug, instrument, trace};
7171
compiler/rustc_ast_lowering/src/lifetime_collector.rs+1-1
......@@ -4,8 +4,8 @@ use rustc_data_structures::fx::FxIndexSet;
44use rustc_hir::def::{DefKind, LifetimeRes, Res};
55use rustc_middle::span_bug;
66use rustc_middle::ty::ResolverAstLowering;
7use rustc_span::symbol::{kw, Ident};
87use rustc_span::Span;
8use rustc_span::symbol::{Ident, kw};
99
1010use super::ResolverAstLoweringExt;
1111
compiler/rustc_ast_lowering/src/pat.rs+1-1
......@@ -3,9 +3,9 @@ use rustc_ast::*;
33use rustc_data_structures::stack::ensure_sufficient_stack;
44use rustc_hir as hir;
55use rustc_hir::def::Res;
6use rustc_span::Span;
67use rustc_span::source_map::Spanned;
78use rustc_span::symbol::Ident;
8use rustc_span::Span;
99
1010use super::errors::{
1111 ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding,
compiler/rustc_ast_lowering/src/path.rs+4-4
......@@ -1,14 +1,14 @@
11use rustc_ast::{self as ast, *};
22use rustc_data_structures::sync::Lrc;
33use rustc_hir as hir;
4use rustc_hir::GenericArg;
45use rustc_hir::def::{DefKind, PartialRes, Res};
56use rustc_hir::def_id::DefId;
6use rustc_hir::GenericArg;
77use rustc_middle::span_bug;
88use rustc_session::parse::add_feature_diagnostics;
9use rustc_span::symbol::{kw, sym, Ident};
10use rustc_span::{BytePos, DesugaringKind, Span, Symbol, DUMMY_SP};
11use smallvec::{smallvec, SmallVec};
9use rustc_span::symbol::{Ident, kw, sym};
10use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Span, Symbol};
11use smallvec::{SmallVec, smallvec};
1212use tracing::{debug, instrument};
1313
1414use super::errors::{
compiler/rustc_ast_passes/src/ast_validation.rs+3-3
......@@ -21,21 +21,21 @@ use std::ops::{Deref, DerefMut};
2121
2222use itertools::{Either, Itertools};
2323use rustc_ast::ptr::P;
24use rustc_ast::visit::{walk_list, AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor};
24use rustc_ast::visit::{AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, walk_list};
2525use rustc_ast::*;
2626use rustc_ast_pretty::pprust::{self, State};
2727use rustc_data_structures::fx::FxIndexMap;
2828use rustc_errors::DiagCtxtHandle;
2929use rustc_feature::Features;
3030use rustc_parse::validate_attr;
31use rustc_session::Session;
3132use rustc_session::lint::builtin::{
3233 DEPRECATED_WHERE_CLAUSE_LOCATION, MISSING_ABI, MISSING_UNSAFE_ON_EXTERN,
3334 PATTERNS_IN_FNS_WITHOUT_BODY,
3435};
3536use rustc_session::lint::{BuiltinLintDiag, LintBuffer};
36use rustc_session::Session;
37use rustc_span::symbol::{kw, sym, Ident};
3837use rustc_span::Span;
38use rustc_span::symbol::{Ident, kw, sym};
3939use rustc_target::spec::abi;
4040use thin_vec::thin_vec;
4141
compiler/rustc_ast_passes/src/feature_gate.rs+4-4
......@@ -1,12 +1,12 @@
11use rustc_ast as ast;
22use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
3use rustc_ast::{attr, token, NodeId, PatKind};
4use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP};
5use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
3use rustc_ast::{NodeId, PatKind, attr, token};
4use rustc_feature::{AttributeGate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute, Features, GateIssue};
65use rustc_session::Session;
6use rustc_session::parse::{feature_err, feature_err_issue, feature_warn};
7use rustc_span::Span;
78use rustc_span::source_map::Spanned;
89use rustc_span::symbol::sym;
9use rustc_span::Span;
1010use rustc_target::spec::abi;
1111use thin_vec::ThinVec;
1212
compiler/rustc_ast_passes/src/node_count.rs+1-1
......@@ -2,8 +2,8 @@
22
33use rustc_ast::visit::*;
44use rustc_ast::*;
5use rustc_span::symbol::Ident;
65use rustc_span::Span;
6use rustc_span::symbol::Ident;
77
88pub struct NodeCounter {
99 pub count: usize,
compiler/rustc_ast_pretty/src/pp/convenience.rs+1-1
......@@ -1,6 +1,6 @@
11use std::borrow::Cow;
22
3use crate::pp::{BeginToken, BreakToken, Breaks, IndentStyle, Printer, Token, SIZE_INFINITY};
3use crate::pp::{BeginToken, BreakToken, Breaks, IndentStyle, Printer, SIZE_INFINITY, Token};
44
55impl Printer {
66 /// "raw box"
compiler/rustc_ast_pretty/src/pprust/mod.rs+1-1
......@@ -7,7 +7,7 @@ use std::borrow::Cow;
77use rustc_ast as ast;
88use rustc_ast::token::{Nonterminal, Token, TokenKind};
99use rustc_ast::tokenstream::{TokenStream, TokenTree};
10pub use state::{print_crate, AnnNode, Comments, PpAnn, PrintState, State};
10pub use state::{AnnNode, Comments, PpAnn, PrintState, State, print_crate};
1111
1212pub fn nonterminal_to_string(nt: &Nonterminal) -> String {
1313 State::new().nonterminal_to_string(nt)
compiler/rustc_ast_pretty/src/pprust/state.rs+6-6
......@@ -18,14 +18,14 @@ use rustc_ast::tokenstream::{Spacing, TokenStream, TokenTree};
1818use rustc_ast::util::classify;
1919use rustc_ast::util::comments::{Comment, CommentStyle};
2020use rustc_ast::{
21 self as ast, attr, AttrArgs, AttrArgsEq, BindingMode, BlockCheckMode, ByRef, DelimArgs,
22 GenericArg, GenericBound, InlineAsmOperand, InlineAsmOptions, InlineAsmRegOrRegClass,
23 InlineAsmTemplatePiece, PatKind, RangeEnd, RangeSyntax, Safety, SelfKind, Term,
21 self as ast, AttrArgs, AttrArgsEq, BindingMode, BlockCheckMode, ByRef, DelimArgs, GenericArg,
22 GenericBound, InlineAsmOperand, InlineAsmOptions, InlineAsmRegOrRegClass,
23 InlineAsmTemplatePiece, PatKind, RangeEnd, RangeSyntax, Safety, SelfKind, Term, attr,
2424};
2525use rustc_span::edition::Edition;
2626use rustc_span::source_map::{SourceMap, Spanned};
27use rustc_span::symbol::{kw, sym, Ident, IdentPrinter, Symbol};
28use rustc_span::{BytePos, CharPos, FileName, Pos, Span, DUMMY_SP};
27use rustc_span::symbol::{Ident, IdentPrinter, Symbol, kw, sym};
28use rustc_span::{BytePos, CharPos, DUMMY_SP, FileName, Pos, Span};
2929use thin_vec::ThinVec;
3030
3131use crate::pp::Breaks::{Consistent, Inconsistent};
......@@ -292,9 +292,9 @@ pub fn print_crate<'a>(
292292/// - #73345: `#[allow(unused)]` must be printed rather than `# [allow(unused)]`
293293///
294294fn space_between(tt1: &TokenTree, tt2: &TokenTree) -> bool {
295 use token::*;
296295 use Delimiter::*;
297296 use TokenTree::{Delimited as Del, Token as Tok};
297 use token::*;
298298
299299 fn is_punct(tt: &TokenTree) -> bool {
300300 matches!(tt, TokenTree::Token(tok, _) if tok.is_punct())
compiler/rustc_ast_pretty/src/pprust/state/expr.rs+3-3
......@@ -7,13 +7,13 @@ use rustc_ast::util::classify;
77use rustc_ast::util::literal::escape_byte_str_symbol;
88use rustc_ast::util::parser::{self, AssocOp, Fixity};
99use rustc_ast::{
10 self as ast, token, BlockCheckMode, FormatAlignment, FormatArgPosition, FormatArgsPiece,
11 FormatCount, FormatDebugHex, FormatSign, FormatTrait,
10 self as ast, BlockCheckMode, FormatAlignment, FormatArgPosition, FormatArgsPiece, FormatCount,
11 FormatDebugHex, FormatSign, FormatTrait, token,
1212};
1313
1414use crate::pp::Breaks::Inconsistent;
1515use crate::pprust::state::fixup::FixupContext;
16use crate::pprust::state::{AnnNode, PrintState, State, INDENT_UNIT};
16use crate::pprust::state::{AnnNode, INDENT_UNIT, PrintState, State};
1717
1818impl<'a> State<'a> {
1919 fn print_else(&mut self, els: Option<&ast::Expr>) {
compiler/rustc_ast_pretty/src/pprust/state/fixup.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_ast::util::{classify, parser};
21use rustc_ast::Expr;
2use rustc_ast::util::{classify, parser};
33
44#[derive(Copy, Clone, Debug)]
55pub(crate) struct FixupContext {
compiler/rustc_ast_pretty/src/pprust/state/item.rs+2-2
......@@ -1,13 +1,13 @@
11use ast::StaticItem;
22use itertools::{Itertools, Position};
33use rustc_ast as ast;
4use rustc_ast::ptr::P;
54use rustc_ast::ModKind;
5use rustc_ast::ptr::P;
66use rustc_span::symbol::Ident;
77
88use crate::pp::Breaks::Inconsistent;
99use crate::pprust::state::fixup::FixupContext;
10use crate::pprust::state::{AnnNode, PrintState, State, INDENT_UNIT};
10use crate::pprust::state::{AnnNode, INDENT_UNIT, PrintState, State};
1111
1212enum DelegationKind<'a> {
1313 Single,
compiler/rustc_ast_pretty/src/pprust/tests.rs+1-1
......@@ -1,6 +1,6 @@
11use rustc_ast as ast;
22use rustc_span::symbol::Ident;
3use rustc_span::{create_default_session_globals_then, DUMMY_SP};
3use rustc_span::{DUMMY_SP, create_default_session_globals_then};
44use thin_vec::ThinVec;
55
66use super::*;
compiler/rustc_attr/src/builtin.rs+6-6
......@@ -4,21 +4,21 @@ use std::num::NonZero;
44
55use rustc_abi::Align;
66use rustc_ast::{
7 self as ast, attr, Attribute, LitKind, MetaItem, MetaItemKind, MetaItemLit, NestedMetaItem,
8 NodeId,
7 self as ast, Attribute, LitKind, MetaItem, MetaItemKind, MetaItemLit, NestedMetaItem, NodeId,
8 attr,
99};
1010use rustc_ast_pretty::pprust;
1111use rustc_errors::ErrorGuaranteed;
12use rustc_feature::{find_gated_cfg, is_builtin_attr_name, Features, GatedCfg};
12use rustc_feature::{Features, GatedCfg, find_gated_cfg, is_builtin_attr_name};
1313use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1414use rustc_session::config::ExpectedValues;
15use rustc_session::lint::builtin::UNEXPECTED_CFGS;
1615use rustc_session::lint::BuiltinLintDiag;
16use rustc_session::lint::builtin::UNEXPECTED_CFGS;
1717use rustc_session::parse::feature_err;
1818use rustc_session::{RustcVersion, Session};
19use rustc_span::hygiene::Transparency;
20use rustc_span::symbol::{sym, Symbol};
2119use rustc_span::Span;
20use rustc_span::hygiene::Transparency;
21use rustc_span::symbol::{Symbol, sym};
2222
2323use crate::fluent_generated;
2424use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause};
compiler/rustc_attr/src/lib.rs+3-3
......@@ -15,11 +15,11 @@
1515mod builtin;
1616mod session_diagnostics;
1717
18pub use builtin::*;
19pub use rustc_ast::attr::*;
20pub(crate) use rustc_session::HashStableContext;
2118pub use IntType::*;
2219pub use ReprAttr::*;
2320pub use StabilityLevel::*;
21pub use builtin::*;
22pub use rustc_ast::attr::*;
23pub(crate) use rustc_session::HashStableContext;
2424
2525rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
compiler/rustc_attr/src/session_diagnostics.rs+11-15
......@@ -6,7 +6,7 @@ use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, EmissionGuar
66use rustc_macros::{Diagnostic, Subdiagnostic};
77use rustc_span::{Span, Symbol};
88
9use crate::{fluent_generated as fluent, UnsupportedLiteralReason};
9use crate::{UnsupportedLiteralReason, fluent_generated as fluent};
1010
1111#[derive(Diagnostic)]
1212#[diag(attr_expected_one_cfg_pattern, code = E0536)]
......@@ -203,20 +203,16 @@ pub(crate) struct UnsupportedLiteral {
203203
204204impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for UnsupportedLiteral {
205205 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
206 let mut diag = Diag::new(
207 dcx,
208 level,
209 match self.reason {
210 UnsupportedLiteralReason::Generic => fluent::attr_unsupported_literal_generic,
211 UnsupportedLiteralReason::CfgString => fluent::attr_unsupported_literal_cfg_string,
212 UnsupportedLiteralReason::DeprecatedString => {
213 fluent::attr_unsupported_literal_deprecated_string
214 }
215 UnsupportedLiteralReason::DeprecatedKvPair => {
216 fluent::attr_unsupported_literal_deprecated_kv_pair
217 }
218 },
219 );
206 let mut diag = Diag::new(dcx, level, match self.reason {
207 UnsupportedLiteralReason::Generic => fluent::attr_unsupported_literal_generic,
208 UnsupportedLiteralReason::CfgString => fluent::attr_unsupported_literal_cfg_string,
209 UnsupportedLiteralReason::DeprecatedString => {
210 fluent::attr_unsupported_literal_deprecated_string
211 }
212 UnsupportedLiteralReason::DeprecatedKvPair => {
213 fluent::attr_unsupported_literal_deprecated_kv_pair
214 }
215 });
220216 diag.span(self.span);
221217 diag.code(E0565);
222218 if self.is_bytestr {
compiler/rustc_borrowck/src/borrow_set.rs+2-2
......@@ -4,15 +4,15 @@ use std::ops::Index;
44use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
55use rustc_index::bit_set::BitSet;
66use rustc_middle::mir::visit::{MutatingUseContext, NonUseContext, PlaceContext, Visitor};
7use rustc_middle::mir::{self, traversal, Body, Local, Location};
7use rustc_middle::mir::{self, Body, Local, Location, traversal};
88use rustc_middle::span_bug;
99use rustc_middle::ty::{RegionVid, TyCtxt};
1010use rustc_mir_dataflow::move_paths::MoveData;
1111use tracing::debug;
1212
13use crate::BorrowIndex;
1314use crate::path_utils::allow_two_phase_borrow;
1415use crate::place_ext::PlaceExt;
15use crate::BorrowIndex;
1616
1717pub struct BorrowSet<'tcx> {
1818 /// The fundamental map relating bitvector indexes to the borrows
compiler/rustc_borrowck/src/borrowck_errors.rs+1-1
......@@ -2,7 +2,7 @@
22#![allow(rustc::untranslatable_diagnostic)]
33
44use rustc_errors::codes::*;
5use rustc_errors::{struct_span_code_err, Applicability, Diag, DiagCtxtHandle};
5use rustc_errors::{Applicability, Diag, DiagCtxtHandle, struct_span_code_err};
66use rustc_hir as hir;
77use rustc_middle::span_bug;
88use rustc_middle::ty::{self, Ty, TyCtxt};
compiler/rustc_borrowck/src/consumers.rs+2-2
......@@ -8,12 +8,12 @@ use rustc_middle::mir::{Body, Promoted};
88use rustc_middle::ty::TyCtxt;
99
1010pub use super::constraints::OutlivesConstraint;
11pub use super::dataflow::{calculate_borrows_out_of_scope_at_location, BorrowIndex, Borrows};
11pub use super::dataflow::{BorrowIndex, Borrows, calculate_borrows_out_of_scope_at_location};
1212pub use super::facts::{AllFacts as PoloniusInput, RustcFacts};
1313pub use super::location::{LocationTable, RichLocation};
1414pub use super::nll::PoloniusOutput;
1515pub use super::place_ext::PlaceExt;
16pub use super::places_conflict::{places_conflict, PlaceConflictBias};
16pub use super::places_conflict::{PlaceConflictBias, places_conflict};
1717pub use super::region_infer::RegionInferenceContext;
1818use crate::borrow_set::BorrowSet;
1919
compiler/rustc_borrowck/src/dataflow.rs+1-1
......@@ -12,7 +12,7 @@ use rustc_mir_dataflow::impls::{EverInitializedPlaces, MaybeUninitializedPlaces}
1212use rustc_mir_dataflow::{Analysis, AnalysisDomain, Forward, GenKill, Results, ResultsVisitable};
1313use tracing::debug;
1414
15use crate::{places_conflict, BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext};
15use crate::{BorrowSet, PlaceConflictBias, PlaceExt, RegionInferenceContext, places_conflict};
1616
1717/// The results of the dataflow analyses used by the borrow checker.
1818pub(crate) struct BorrowckResults<'a, 'tcx> {
compiler/rustc_borrowck/src/diagnostics/bound_region_errors.rs+21-22
......@@ -14,18 +14,18 @@ use rustc_middle::ty::{
1414 self, RePlaceholder, Region, RegionVid, Ty, TyCtxt, TypeFoldable, UniverseIndex,
1515};
1616use rustc_span::Span;
17use rustc_trait_selection::error_reporting::infer::nice_region_error::NiceRegionError;
1817use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
19use rustc_trait_selection::traits::query::type_op;
18use rustc_trait_selection::error_reporting::infer::nice_region_error::NiceRegionError;
2019use rustc_trait_selection::traits::ObligationCtxt;
20use rustc_trait_selection::traits::query::type_op;
2121use rustc_traits::{type_op_ascribe_user_type_with_span, type_op_prove_predicate_with_cause};
2222use tracing::{debug, instrument};
2323
24use crate::MirBorrowckCtxt;
2425use crate::region_infer::values::RegionElement;
2526use crate::session_diagnostics::{
2627 HigherRankedErrorCause, HigherRankedLifetimeError, HigherRankedSubtypeError,
2728};
28use crate::MirBorrowckCtxt;
2929
3030#[derive(Clone)]
3131pub(crate) struct UniverseInfo<'tcx>(UniverseInfoInner<'tcx>);
......@@ -176,25 +176,24 @@ trait TypeOpInfo<'tcx> {
176176 return;
177177 };
178178
179 let placeholder_region = ty::Region::new_placeholder(
180 tcx,
181 ty::Placeholder { universe: adjusted_universe.into(), bound: placeholder.bound },
182 );
183
184 let error_region = if let RegionElement::PlaceholderRegion(error_placeholder) =
185 error_element
186 {
187 let adjusted_universe =
188 error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
189 adjusted_universe.map(|adjusted| {
190 ty::Region::new_placeholder(
191 tcx,
192 ty::Placeholder { universe: adjusted.into(), bound: error_placeholder.bound },
193 )
194 })
195 } else {
196 None
197 };
179 let placeholder_region = ty::Region::new_placeholder(tcx, ty::Placeholder {
180 universe: adjusted_universe.into(),
181 bound: placeholder.bound,
182 });
183
184 let error_region =
185 if let RegionElement::PlaceholderRegion(error_placeholder) = error_element {
186 let adjusted_universe =
187 error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
188 adjusted_universe.map(|adjusted| {
189 ty::Region::new_placeholder(tcx, ty::Placeholder {
190 universe: adjusted.into(),
191 bound: error_placeholder.bound,
192 })
193 })
194 } else {
195 None
196 };
198197
199198 debug!(?placeholder_region);
200199
compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs+24-24
......@@ -11,10 +11,10 @@ use hir::{ClosureKind, Path};
1111use rustc_data_structures::captures::Captures;
1212use rustc_data_structures::fx::FxIndexSet;
1313use rustc_errors::codes::*;
14use rustc_errors::{struct_span_code_err, Applicability, Diag, MultiSpan};
14use rustc_errors::{Applicability, Diag, MultiSpan, struct_span_code_err};
1515use rustc_hir as hir;
1616use rustc_hir::def::{DefKind, Res};
17use rustc_hir::intravisit::{walk_block, walk_expr, Map, Visitor};
17use rustc_hir::intravisit::{Map, Visitor, walk_block, walk_expr};
1818use rustc_hir::{CoroutineDesugaring, CoroutineKind, CoroutineSource, LangItem, PatField};
1919use rustc_middle::bug;
2020use rustc_middle::hir::nested_filter::OnlyBodies;
......@@ -27,17 +27,17 @@ use rustc_middle::mir::{
2727};
2828use rustc_middle::ty::print::PrintTraitRefExt as _;
2929use rustc_middle::ty::{
30 self, suggest_constraining_type_params, PredicateKind, Ty, TyCtxt, TypeSuperVisitable,
31 TypeVisitor, Upcast,
30 self, PredicateKind, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor, Upcast,
31 suggest_constraining_type_params,
3232};
3333use rustc_middle::util::CallKind;
3434use rustc_mir_dataflow::move_paths::{InitKind, MoveOutIndex, MovePathIndex};
3535use rustc_span::def_id::{DefId, LocalDefId};
3636use rustc_span::hygiene::DesugaringKind;
37use rustc_span::symbol::{kw, sym, Ident};
37use rustc_span::symbol::{Ident, kw, sym};
3838use rustc_span::{BytePos, Span, Symbol};
39use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
4039use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
40use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
4141use rustc_trait_selection::infer::InferCtxtExt;
4242use rustc_trait_selection::traits::{Obligation, ObligationCause, ObligationCtxt};
4343use tracing::{debug, instrument};
......@@ -46,9 +46,9 @@ use super::explain_borrow::{BorrowExplanation, LaterUseKind};
4646use super::{DescribePlaceOpt, RegionName, RegionNameSource, UseSpans};
4747use crate::borrow_set::{BorrowData, TwoPhaseActivation};
4848use crate::diagnostics::conflict_errors::StorageDeadOrDrop::LocalStorageDead;
49use crate::diagnostics::{find_all_local_uses, CapturedMessageOpt, Instance};
49use crate::diagnostics::{CapturedMessageOpt, Instance, find_all_local_uses};
5050use crate::prefixes::IsPrefixOf;
51use crate::{borrowck_errors, InitializationRequiringAction, MirBorrowckCtxt, WriteKind};
51use crate::{InitializationRequiringAction, MirBorrowckCtxt, WriteKind, borrowck_errors};
5252
5353#[derive(Debug)]
5454struct MoveSite {
......@@ -145,10 +145,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
145145 span,
146146 desired_action.as_noun(),
147147 partially_str,
148 self.describe_place_with_options(
149 moved_place,
150 DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
151 ),
148 self.describe_place_with_options(moved_place, DescribePlaceOpt {
149 including_downcast: true,
150 including_tuple_field: true,
151 }),
152152 );
153153
154154 let reinit_spans = maybe_reinitialized_locations
......@@ -266,10 +266,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
266266 }
267267 }
268268
269 let opt_name = self.describe_place_with_options(
270 place.as_ref(),
271 DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
272 );
269 let opt_name = self.describe_place_with_options(place.as_ref(), DescribePlaceOpt {
270 including_downcast: true,
271 including_tuple_field: true,
272 });
273273 let note_msg = match opt_name {
274274 Some(name) => format!("`{name}`"),
275275 None => "value".to_owned(),
......@@ -689,17 +689,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
689689 }
690690 let spans: Vec<_> = spans_set.into_iter().collect();
691691
692 let (name, desc) = match self.describe_place_with_options(
693 moved_place,
694 DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
695 ) {
692 let (name, desc) = match self.describe_place_with_options(moved_place, DescribePlaceOpt {
693 including_downcast: true,
694 including_tuple_field: true,
695 }) {
696696 Some(name) => (format!("`{name}`"), format!("`{name}` ")),
697697 None => ("the variable".to_string(), String::new()),
698698 };
699 let path = match self.describe_place_with_options(
700 used_place,
701 DescribePlaceOpt { including_downcast: true, including_tuple_field: true },
702 ) {
699 let path = match self.describe_place_with_options(used_place, DescribePlaceOpt {
700 including_downcast: true,
701 including_tuple_field: true,
702 }) {
703703 Some(name) => format!("`{name}`"),
704704 None => "value".to_string(),
705705 };
compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs+3-3
......@@ -17,12 +17,12 @@ use rustc_middle::mir::{
1717};
1818use rustc_middle::ty::adjustment::PointerCoercion;
1919use rustc_middle::ty::{self, RegionVid, Ty, TyCtxt};
20use rustc_span::symbol::{kw, Symbol};
21use rustc_span::{sym, DesugaringKind, Span};
20use rustc_span::symbol::{Symbol, kw};
21use rustc_span::{DesugaringKind, Span, sym};
2222use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
2323use tracing::{debug, instrument};
2424
25use super::{find_use, RegionName, UseSpans};
25use super::{RegionName, UseSpans, find_use};
2626use crate::borrow_set::BorrowData;
2727use crate::nll::ConstraintDescription;
2828use crate::region_infer::{BlameConstraint, Cause, ExtraConstraintInfo};
compiler/rustc_borrowck/src/diagnostics/mod.rs+8-8
......@@ -15,22 +15,22 @@ use rustc_middle::mir::{
1515};
1616use rustc_middle::ty::print::Print;
1717use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
18use rustc_middle::util::{call_kind, CallDesugaringKind};
18use rustc_middle::util::{CallDesugaringKind, call_kind};
1919use rustc_mir_dataflow::move_paths::{InitLocation, LookupResult};
2020use rustc_span::def_id::LocalDefId;
2121use rustc_span::source_map::Spanned;
2222use rustc_span::symbol::sym;
23use rustc_span::{Span, Symbol, DUMMY_SP};
23use rustc_span::{DUMMY_SP, Span, Symbol};
2424use rustc_target::abi::{FieldIdx, VariantIdx};
2525use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2626use rustc_trait_selection::infer::InferCtxtExt;
2727use rustc_trait_selection::traits::{
28 type_known_to_meet_bound_modulo_regions, FulfillmentErrorCode,
28 FulfillmentErrorCode, type_known_to_meet_bound_modulo_regions,
2929};
3030use tracing::debug;
3131
32use super::borrow_set::BorrowData;
3332use super::MirBorrowckCtxt;
33use super::borrow_set::BorrowData;
3434use crate::fluent_generated as fluent;
3535use crate::session_diagnostics::{
3636 CaptureArgLabel, CaptureReasonLabel, CaptureReasonNote, CaptureReasonSuggest, CaptureVarCause,
......@@ -177,10 +177,10 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
177177 /// End-user visible description of `place` if one can be found.
178178 /// If the place is a temporary for instance, `None` will be returned.
179179 pub(super) fn describe_place(&self, place_ref: PlaceRef<'tcx>) -> Option<String> {
180 self.describe_place_with_options(
181 place_ref,
182 DescribePlaceOpt { including_downcast: false, including_tuple_field: true },
183 )
180 self.describe_place_with_options(place_ref, DescribePlaceOpt {
181 including_downcast: false,
182 including_tuple_field: true,
183 })
184184 }
185185
186186 /// End-user visible description of `place` if one can be found. If the place is a temporary
compiler/rustc_borrowck/src/diagnostics/move_errors.rs+1-1
......@@ -12,9 +12,9 @@ use rustc_span::{BytePos, ExpnKind, MacroKind, Span};
1212use rustc_trait_selection::error_reporting::traits::FindExprBySpan;
1313use tracing::debug;
1414
15use crate::MirBorrowckCtxt;
1516use crate::diagnostics::{CapturedMessageOpt, DescribePlaceOpt, UseSpans};
1617use crate::prefixes::PrefixSet;
17use crate::MirBorrowckCtxt;
1818
1919#[derive(Debug)]
2020pub(crate) enum IllegalMoveOriginKind<'tcx> {
compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs+3-3
......@@ -14,8 +14,8 @@ use rustc_middle::mir::{
1414 PlaceRef, ProjectionElem,
1515};
1616use rustc_middle::ty::{self, InstanceKind, Ty, TyCtxt, Upcast};
17use rustc_span::symbol::{kw, Symbol};
18use rustc_span::{sym, BytePos, DesugaringKind, Span};
17use rustc_span::symbol::{Symbol, kw};
18use rustc_span::{BytePos, DesugaringKind, Span, sym};
1919use rustc_target::abi::FieldIdx;
2020use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2121use rustc_trait_selection::infer::InferCtxtExt;
......@@ -24,7 +24,7 @@ use tracing::debug;
2424
2525use crate::diagnostics::BorrowedContentSource;
2626use crate::util::FindAssignments;
27use crate::{session_diagnostics, MirBorrowckCtxt};
27use crate::{MirBorrowckCtxt, session_diagnostics};
2828
2929#[derive(Copy, Clone, Debug, Eq, PartialEq)]
3030pub(crate) enum AccessKind {
compiler/rustc_borrowck/src/diagnostics/region_errors.rs+14-17
......@@ -3,26 +3,26 @@
33use rustc_data_structures::fx::FxIndexSet;
44use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan};
55use rustc_hir as hir;
6use rustc_hir::def::Res::Def;
7use rustc_hir::def_id::DefId;
8use rustc_hir::intravisit::Visitor;
96use rustc_hir::GenericBound::Trait;
107use rustc_hir::QPath::Resolved;
118use rustc_hir::WherePredicate::BoundPredicate;
9use rustc_hir::def::Res::Def;
10use rustc_hir::def_id::DefId;
11use rustc_hir::intravisit::Visitor;
1212use rustc_hir::{PolyTraitRef, TyKind, WhereBoundPredicate};
1313use rustc_infer::infer::{NllRegionVariableOrigin, RelateParamBound};
1414use rustc_middle::bug;
1515use rustc_middle::hir::place::PlaceBase;
1616use rustc_middle::mir::{ConstraintCategory, ReturnConstraint};
1717use rustc_middle::ty::{self, GenericArgs, Region, RegionVid, Ty, TyCtxt, TypeVisitor};
18use rustc_span::symbol::{kw, Ident};
1918use rustc_span::Span;
19use rustc_span::symbol::{Ident, kw};
20use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2021use rustc_trait_selection::error_reporting::infer::nice_region_error::{
21 self, find_anon_type, find_param_with_region, suggest_adding_lifetime_params,
22 HirTraitObjectVisitor, NiceRegionError, TraitObjectVisitor,
22 self, HirTraitObjectVisitor, NiceRegionError, TraitObjectVisitor, find_anon_type,
23 find_param_with_region, suggest_adding_lifetime_params,
2324};
2425use rustc_trait_selection::error_reporting::infer::region::unexpected_hidden_region_diagnostic;
25use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2626use rustc_trait_selection::infer::InferCtxtExt;
2727use rustc_trait_selection::traits::{Obligation, ObligationCtxt};
2828use tracing::{debug, instrument, trace};
......@@ -36,7 +36,7 @@ use crate::session_diagnostics::{
3636 LifetimeReturnCategoryErr, RequireStaticErr, VarHereDenote,
3737};
3838use crate::universal_regions::DefiningTy;
39use crate::{borrowck_errors, fluent_generated as fluent, MirBorrowckCtxt};
39use crate::{MirBorrowckCtxt, borrowck_errors, fluent_generated as fluent};
4040
4141impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> {
4242 fn description(&self) -> &'static str {
......@@ -1108,15 +1108,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
11081108 let closure_ty = Ty::new_closure(
11091109 tcx,
11101110 closure_def_id.to_def_id(),
1111 ty::ClosureArgs::new(
1112 tcx,
1113 ty::ClosureArgsParts {
1114 parent_args: args.parent_args(),
1115 closure_kind_ty: args.kind_ty(),
1116 tupled_upvars_ty: args.tupled_upvars_ty(),
1117 closure_sig_as_fn_ptr_ty,
1118 },
1119 )
1111 ty::ClosureArgs::new(tcx, ty::ClosureArgsParts {
1112 parent_args: args.parent_args(),
1113 closure_kind_ty: args.kind_ty(),
1114 tupled_upvars_ty: args.tupled_upvars_ty(),
1115 closure_sig_as_fn_ptr_ty,
1116 })
11201117 .args,
11211118 );
11221119
compiler/rustc_borrowck/src/diagnostics/region_name.rs+3-3
......@@ -11,13 +11,13 @@ use rustc_hir::def::{DefKind, Res};
1111use rustc_middle::ty::print::RegionHighlightMode;
1212use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, RegionVid, Ty};
1313use rustc_middle::{bug, span_bug};
14use rustc_span::symbol::{kw, sym, Symbol};
15use rustc_span::{Span, DUMMY_SP};
14use rustc_span::symbol::{Symbol, kw, sym};
15use rustc_span::{DUMMY_SP, Span};
1616use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
1717use tracing::{debug, instrument};
1818
19use crate::universal_regions::DefiningTy;
2019use crate::MirBorrowckCtxt;
20use crate::universal_regions::DefiningTy;
2121
2222/// A name for a particular region used in emitting diagnostics. This name could be a generated
2323/// name like `'1`, a name used by the user like `'a`, or a name like `'static`.
compiler/rustc_borrowck/src/diagnostics/var_name.rs+1-1
......@@ -1,8 +1,8 @@
11use rustc_index::IndexSlice;
22use rustc_middle::mir::{Body, Local};
33use rustc_middle::ty::{self, RegionVid, TyCtxt};
4use rustc_span::symbol::Symbol;
54use rustc_span::Span;
5use rustc_span::symbol::Symbol;
66use tracing::debug;
77
88use crate::region_infer::RegionInferenceContext;
compiler/rustc_borrowck/src/facts.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_middle::mir::Local;
1010use rustc_middle::ty::{RegionVid, TyCtxt};
1111use rustc_mir_dataflow::move_paths::MovePathIndex;
1212
13use crate::location::{LocationIndex, LocationTable};
1413use crate::BorrowIndex;
14use crate::location::{LocationIndex, LocationTable};
1515
1616#[derive(Copy, Clone, Debug)]
1717pub struct RustcFacts;
compiler/rustc_borrowck/src/lib.rs+5-9
......@@ -37,13 +37,13 @@ use rustc_middle::mir::*;
3737use rustc_middle::query::Providers;
3838use rustc_middle::ty::{self, ParamEnv, RegionVid, TyCtxt};
3939use rustc_middle::{bug, span_bug};
40use rustc_mir_dataflow::Analysis;
4041use rustc_mir_dataflow::impls::{
4142 EverInitializedPlaces, MaybeInitializedPlaces, MaybeUninitializedPlaces,
4243};
4344use rustc_mir_dataflow::move_paths::{
4445 InitIndex, InitLocation, LookupResult, MoveData, MoveOutIndex, MovePathIndex,
4546};
46use rustc_mir_dataflow::Analysis;
4747use rustc_session::lint::builtin::UNUSED_MUT;
4848use rustc_span::{Span, Symbol};
4949use rustc_target::abi::FieldIdx;
......@@ -86,7 +86,7 @@ use borrow_set::{BorrowData, BorrowSet};
8686use dataflow::{BorrowIndex, BorrowckDomain, BorrowckResults, Borrows};
8787use nll::PoloniusOutput;
8888use place_ext::PlaceExt;
89use places_conflict::{places_conflict, PlaceConflictBias};
89use places_conflict::{PlaceConflictBias, places_conflict};
9090use region_infer::RegionInferenceContext;
9191use renumber::RegionCtxt;
9292
......@@ -1612,13 +1612,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> {
16121612 match elem {
16131613 ProjectionElem::Deref => match place_ty.ty.kind() {
16141614 ty::Ref(..) | ty::RawPtr(..) => {
1615 self.move_errors.push(MoveError::new(
1616 place,
1617 location,
1618 BorrowedContent {
1619 target_place: place_ref.project_deeper(&[elem], tcx),
1620 },
1621 ));
1615 self.move_errors.push(MoveError::new(place, location, BorrowedContent {
1616 target_place: place_ref.project_deeper(&[elem], tcx),
1617 }));
16221618 return;
16231619 }
16241620 ty::Adt(adt, _) => {
compiler/rustc_borrowck/src/nll.rs+5-5
......@@ -9,17 +9,17 @@ use polonius_engine::{Algorithm, Output};
99use rustc_data_structures::fx::FxIndexMap;
1010use rustc_hir::def_id::LocalDefId;
1111use rustc_index::IndexSlice;
12use rustc_middle::mir::pretty::{dump_mir_with_options, PrettyPrintMirOptions};
12use rustc_middle::mir::pretty::{PrettyPrintMirOptions, dump_mir_with_options};
1313use rustc_middle::mir::{
14 create_dump_file, dump_enabled, dump_mir, Body, ClosureOutlivesSubject,
15 ClosureRegionRequirements, PassWhere, Promoted,
14 Body, ClosureOutlivesSubject, ClosureRegionRequirements, PassWhere, Promoted, create_dump_file,
15 dump_enabled, dump_mir,
1616};
1717use rustc_middle::ty::print::with_no_trimmed_paths;
1818use rustc_middle::ty::{self, OpaqueHiddenType, TyCtxt};
19use rustc_mir_dataflow::ResultsCursor;
1920use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
2021use rustc_mir_dataflow::move_paths::MoveData;
2122use rustc_mir_dataflow::points::DenseLocationMap;
22use rustc_mir_dataflow::ResultsCursor;
2323use rustc_session::config::MirIncludeSpans;
2424use rustc_span::symbol::sym;
2525use tracing::{debug, instrument};
......@@ -32,7 +32,7 @@ use crate::location::LocationTable;
3232use crate::region_infer::RegionInferenceContext;
3333use crate::type_check::{self, MirTypeckRegionConstraints, MirTypeckResults};
3434use crate::universal_regions::UniversalRegions;
35use crate::{polonius, renumber, BorrowckInferCtxt};
35use crate::{BorrowckInferCtxt, polonius, renumber};
3636
3737pub type PoloniusOutput = Output<RustcFacts>;
3838
compiler/rustc_borrowck/src/path_utils.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_target::abi::FieldIdx;
55use tracing::debug;
66
77use crate::borrow_set::{BorrowData, BorrowSet, TwoPhaseActivation};
8use crate::{places_conflict, AccessDepth, BorrowIndex};
8use crate::{AccessDepth, BorrowIndex, places_conflict};
99
1010/// Returns `true` if the borrow represented by `kind` is
1111/// allowed to be split into separate Reservation and
compiler/rustc_borrowck/src/region_infer/mod.rs+2-2
......@@ -23,6 +23,7 @@ use rustc_mir_dataflow::points::DenseLocationMap;
2323use rustc_span::Span;
2424use tracing::{debug, instrument, trace};
2525
26use crate::BorrowckInferCtxt;
2627use crate::constraints::graph::{self, NormalConstraintGraph, RegionGraph};
2728use crate::constraints::{ConstraintSccIndex, OutlivesConstraint, OutlivesConstraintSet};
2829use crate::dataflow::BorrowIndex;
......@@ -33,10 +34,9 @@ use crate::region_infer::reverse_sccs::ReverseSccGraph;
3334use crate::region_infer::values::{
3435 LivenessValues, PlaceholderIndices, RegionElement, RegionValues, ToElementIndex,
3536};
36use crate::type_check::free_region_relations::UniversalRegionRelations;
3737use crate::type_check::Locations;
38use crate::type_check::free_region_relations::UniversalRegionRelations;
3839use crate::universal_regions::UniversalRegions;
39use crate::BorrowckInferCtxt;
4040
4141mod dump_mir;
4242mod graphviz;
compiler/rustc_borrowck/src/region_infer/opaque_types.rs+5-5
......@@ -1,8 +1,8 @@
11use rustc_data_structures::fx::FxIndexMap;
22use rustc_errors::ErrorGuaranteed;
3use rustc_hir::OpaqueTyOrigin;
34use rustc_hir::def::DefKind;
45use rustc_hir::def_id::LocalDefId;
5use rustc_hir::OpaqueTyOrigin;
66use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin, TyCtxtInferExt as _};
77use rustc_infer::traits::{Obligation, ObligationCause};
88use rustc_macros::extension;
......@@ -165,10 +165,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
165165 // FIXME(oli-obk): collect multiple spans for better diagnostics down the road.
166166 prev.span = prev.span.substitute_dummy(concrete_type.span);
167167 } else {
168 result.insert(
169 opaque_type_key.def_id,
170 OpaqueHiddenType { ty, span: concrete_type.span },
171 );
168 result.insert(opaque_type_key.def_id, OpaqueHiddenType {
169 ty,
170 span: concrete_type.span,
171 });
172172 }
173173
174174 // Check that all opaque types have the same region parameters if they have the same
compiler/rustc_borrowck/src/region_infer/reverse_sccs.rs+1-1
......@@ -5,8 +5,8 @@ use rustc_data_structures::graph;
55use rustc_data_structures::graph::vec_graph::VecGraph;
66use rustc_middle::ty::RegionVid;
77
8use crate::constraints::ConstraintSccIndex;
98use crate::RegionInferenceContext;
9use crate::constraints::ConstraintSccIndex;
1010
1111pub(crate) struct ReverseSccGraph {
1212 graph: VecGraph<ConstraintSccIndex>,
compiler/rustc_borrowck/src/region_infer/values.rs+1-1
......@@ -2,9 +2,9 @@ use std::fmt::Debug;
22use std::rc::Rc;
33
44use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
5use rustc_index::Idx;
56use rustc_index::bit_set::SparseBitMatrix;
67use rustc_index::interval::{IntervalSet, SparseIntervalMatrix};
7use rustc_index::Idx;
88use rustc_middle::mir::{BasicBlock, Location};
99use rustc_middle::ty::{self, RegionVid};
1010use rustc_mir_dataflow::points::{DenseLocationMap, PointIndex};
compiler/rustc_borrowck/src/session_diagnostics.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_errors::codes::*;
21use rustc_errors::MultiSpan;
2use rustc_errors::codes::*;
33use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
44use rustc_middle::ty::{GenericArg, Ty};
55use rustc_span::Span;
compiler/rustc_borrowck/src/type_check/canonical.rs+2-2
......@@ -5,11 +5,11 @@ use rustc_infer::infer::canonical::Canonical;
55use rustc_middle::bug;
66use rustc_middle::mir::ConstraintCategory;
77use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, Upcast};
8use rustc_span::def_id::DefId;
98use rustc_span::Span;
9use rustc_span::def_id::DefId;
10use rustc_trait_selection::traits::ObligationCause;
1011use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
1112use rustc_trait_selection::traits::query::type_op::{self, TypeOpOutput};
12use rustc_trait_selection::traits::ObligationCause;
1313use tracing::{debug, instrument};
1414
1515use super::{Locations, NormalizeLocation, TypeChecker};
compiler/rustc_borrowck/src/type_check/constraint_conversion.rs+2-2
......@@ -6,13 +6,13 @@ use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
66use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
77use rustc_middle::bug;
88use rustc_middle::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, ConstraintCategory};
9use rustc_middle::traits::query::NoSolution;
109use rustc_middle::traits::ObligationCause;
10use rustc_middle::traits::query::NoSolution;
1111use rustc_middle::ty::{self, GenericArgKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
1212use rustc_span::Span;
13use rustc_trait_selection::traits::ScrubbedTraitError;
1314use rustc_trait_selection::traits::query::type_op::custom::CustomTypeOp;
1415use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
15use rustc_trait_selection::traits::ScrubbedTraitError;
1616use tracing::{debug, instrument};
1717
1818use crate::constraints::OutlivesConstraint;
compiler/rustc_borrowck/src/type_check/free_region_relations.rs+3-3
......@@ -6,10 +6,10 @@ use rustc_hir::def::DefKind;
66use rustc_infer::infer::canonical::QueryRegionConstraints;
77use rustc_infer::infer::outlives::env::RegionBoundPairs;
88use rustc_infer::infer::region_constraints::GenericKind;
9use rustc_infer::infer::{outlives, InferCtxt};
9use rustc_infer::infer::{InferCtxt, outlives};
1010use rustc_middle::mir::ConstraintCategory;
11use rustc_middle::traits::query::OutlivesBound;
1211use rustc_middle::traits::ObligationCause;
12use rustc_middle::traits::query::OutlivesBound;
1313use rustc_middle::ty::{self, RegionVid, Ty, TypeVisitableExt};
1414use rustc_span::{ErrorGuaranteed, Span};
1515use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
......@@ -18,7 +18,7 @@ use rustc_trait_selection::traits::query::type_op::{self, TypeOp};
1818use tracing::{debug, instrument};
1919use type_op::TypeOpOutput;
2020
21use crate::type_check::{constraint_conversion, Locations, MirTypeckRegionConstraints};
21use crate::type_check::{Locations, MirTypeckRegionConstraints, constraint_conversion};
2222use crate::universal_regions::UniversalRegions;
2323
2424#[derive(Debug)]
compiler/rustc_borrowck/src/type_check/input_output.rs+11-14
......@@ -77,20 +77,17 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
7777 let output_ty = Ty::new_coroutine(
7878 self.tcx(),
7979 self.tcx().coroutine_for_closure(mir_def_id),
80 ty::CoroutineArgs::new(
81 self.tcx(),
82 ty::CoroutineArgsParts {
83 parent_args: args.parent_args(),
84 kind_ty: Ty::from_coroutine_closure_kind(self.tcx(), args.kind()),
85 return_ty: user_provided_sig.output(),
86 tupled_upvars_ty,
87 // For async closures, none of these can be annotated, so just fill
88 // them with fresh ty vars.
89 resume_ty: next_ty_var(),
90 yield_ty: next_ty_var(),
91 witness: next_ty_var(),
92 },
93 )
80 ty::CoroutineArgs::new(self.tcx(), ty::CoroutineArgsParts {
81 parent_args: args.parent_args(),
82 kind_ty: Ty::from_coroutine_closure_kind(self.tcx(), args.kind()),
83 return_ty: user_provided_sig.output(),
84 tupled_upvars_ty,
85 // For async closures, none of these can be annotated, so just fill
86 // them with fresh ty vars.
87 resume_ty: next_ty_var(),
88 yield_ty: next_ty_var(),
89 witness: next_ty_var(),
90 })
9491 .args,
9592 );
9693
compiler/rustc_borrowck/src/type_check/liveness/mod.rs+1-1
......@@ -7,10 +7,10 @@ use rustc_middle::mir::{Body, Local, Location, SourceInfo};
77use rustc_middle::span_bug;
88use rustc_middle::ty::visit::TypeVisitable;
99use rustc_middle::ty::{GenericArgsRef, Region, RegionVid, Ty, TyCtxt};
10use rustc_mir_dataflow::ResultsCursor;
1011use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
1112use rustc_mir_dataflow::move_paths::MoveData;
1213use rustc_mir_dataflow::points::DenseLocationMap;
13use rustc_mir_dataflow::ResultsCursor;
1414use tracing::debug;
1515
1616use super::TypeChecker;
compiler/rustc_borrowck/src/type_check/liveness/trace.rs+1-1
......@@ -8,10 +8,10 @@ use rustc_infer::infer::outlives::for_liveness;
88use rustc_middle::mir::{BasicBlock, Body, ConstraintCategory, Local, Location};
99use rustc_middle::traits::query::DropckOutlivesResult;
1010use rustc_middle::ty::{Ty, TyCtxt, TypeVisitable, TypeVisitableExt};
11use rustc_mir_dataflow::ResultsCursor;
1112use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
1213use rustc_mir_dataflow::move_paths::{HasMoveData, MoveData, MovePathIndex};
1314use rustc_mir_dataflow::points::{DenseLocationMap, PointIndex};
14use rustc_mir_dataflow::ResultsCursor;
1515use rustc_span::DUMMY_SP;
1616use rustc_trait_selection::traits::query::type_op::outlives::DropckOutlives;
1717use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
compiler/rustc_borrowck/src/type_check/mod.rs+15-17
......@@ -31,20 +31,20 @@ use rustc_middle::ty::{
3131 UserType, UserTypeAnnotationIndex,
3232};
3333use rustc_middle::{bug, span_bug};
34use rustc_mir_dataflow::ResultsCursor;
3435use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
3536use rustc_mir_dataflow::move_paths::MoveData;
3637use rustc_mir_dataflow::points::DenseLocationMap;
37use rustc_mir_dataflow::ResultsCursor;
3838use rustc_span::def_id::CRATE_DEF_ID;
3939use rustc_span::source_map::Spanned;
4040use rustc_span::symbol::sym;
41use rustc_span::{Span, DUMMY_SP};
42use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
41use rustc_span::{DUMMY_SP, Span};
42use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
43use rustc_trait_selection::traits::PredicateObligation;
4344use rustc_trait_selection::traits::query::type_op::custom::{
44 scrape_region_constraints, CustomTypeOp,
45 CustomTypeOp, scrape_region_constraints,
4546};
4647use rustc_trait_selection::traits::query::type_op::{TypeOp, TypeOpOutput};
47use rustc_trait_selection::traits::PredicateObligation;
4848use tracing::{debug, instrument, trace};
4949
5050use crate::borrow_set::BorrowSet;
......@@ -53,13 +53,13 @@ use crate::diagnostics::UniverseInfo;
5353use crate::facts::AllFacts;
5454use crate::location::LocationTable;
5555use crate::member_constraints::MemberConstraintSet;
56use crate::region_infer::values::{LivenessValues, PlaceholderIndex, PlaceholderIndices};
5756use crate::region_infer::TypeTest;
57use crate::region_infer::values::{LivenessValues, PlaceholderIndex, PlaceholderIndices};
5858use crate::renumber::RegionCtxt;
5959use crate::session_diagnostics::{MoveUnsized, SimdIntrinsicArgConst};
6060use crate::type_check::free_region_relations::{CreateResult, UniversalRegionRelations};
6161use crate::universal_regions::{DefiningTy, UniversalRegions};
62use crate::{path_utils, BorrowckInferCtxt};
62use crate::{BorrowckInferCtxt, path_utils};
6363
6464macro_rules! span_mirbug {
6565 ($context:expr, $elem:expr, $($message:tt)*) => ({
......@@ -1944,11 +1944,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19441944 }
19451945
19461946 &Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf, ty) => {
1947 let trait_ref = ty::TraitRef::new(
1948 tcx,
1949 tcx.require_lang_item(LangItem::Sized, Some(span)),
1950 [ty],
1951 );
1947 let trait_ref =
1948 ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::Sized, Some(span)), [
1949 ty,
1950 ]);
19521951
19531952 self.prove_trait_ref(
19541953 trait_ref,
......@@ -1961,11 +1960,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19611960 Rvalue::ShallowInitBox(operand, ty) => {
19621961 self.check_operand(operand, location);
19631962
1964 let trait_ref = ty::TraitRef::new(
1965 tcx,
1966 tcx.require_lang_item(LangItem::Sized, Some(span)),
1967 [*ty],
1968 );
1963 let trait_ref =
1964 ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::Sized, Some(span)), [
1965 *ty,
1966 ]);
19691967
19701968 self.prove_trait_ref(
19711969 trait_ref,
compiler/rustc_borrowck/src/type_check/relate_tys.rs+2-2
......@@ -4,12 +4,12 @@ use rustc_infer::infer::relate::{
44 PredicateEmittingRelation, Relate, RelateResult, StructurallyRelateAliases, TypeRelation,
55};
66use rustc_infer::infer::{InferCtxt, NllRegionVariableOrigin};
7use rustc_infer::traits::solve::Goal;
87use rustc_infer::traits::Obligation;
8use rustc_infer::traits::solve::Goal;
99use rustc_middle::mir::ConstraintCategory;
1010use rustc_middle::span_bug;
11use rustc_middle::traits::query::NoSolution;
1211use rustc_middle::traits::ObligationCause;
12use rustc_middle::traits::query::NoSolution;
1313use rustc_middle::ty::fold::FnMutDelegate;
1414use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
1515use rustc_span::symbol::sym;
compiler/rustc_borrowck/src/universal_regions.rs+6-6
......@@ -20,9 +20,9 @@ use std::iter;
2020
2121use rustc_data_structures::fx::FxIndexMap;
2222use rustc_errors::Diag;
23use rustc_hir::BodyOwnerKind;
2324use rustc_hir::def_id::{DefId, LocalDefId};
2425use rustc_hir::lang_items::LangItem;
25use rustc_hir::BodyOwnerKind;
2626use rustc_index::IndexVec;
2727use rustc_infer::infer::NllRegionVariableOrigin;
2828use rustc_macros::extension;
......@@ -37,8 +37,8 @@ use rustc_span::symbol::{kw, sym};
3737use rustc_span::{ErrorGuaranteed, Symbol};
3838use tracing::{debug, instrument};
3939
40use crate::renumber::RegionCtxt;
4140use crate::BorrowckInferCtxt;
41use crate::renumber::RegionCtxt;
4242
4343#[derive(Debug)]
4444pub(crate) struct UniversalRegions<'tcx> {
......@@ -629,10 +629,10 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
629629 let ty = tcx
630630 .typeck(self.mir_def)
631631 .node_type(tcx.local_def_id_to_hir_id(self.mir_def));
632 let args = InlineConstArgs::new(
633 tcx,
634 InlineConstArgsParts { parent_args: identity_args, ty },
635 )
632 let args = InlineConstArgs::new(tcx, InlineConstArgsParts {
633 parent_args: identity_args,
634 ty,
635 })
636636 .args;
637637 let args = self.infcx.replace_free_regions_with_nll_infer_vars(FR, args);
638638 DefiningTy::InlineConst(self.mir_def.to_def_id(), args)
compiler/rustc_builtin_macros/src/alloc_error_handler.rs+6-7
......@@ -3,9 +3,9 @@ use rustc_ast::{
33 self as ast, Fn, FnHeader, FnSig, Generics, ItemKind, Safety, Stmt, StmtKind, TyKind,
44};
55use rustc_expand::base::{Annotatable, ExtCtxt};
6use rustc_span::symbol::{kw, sym, Ident};
76use rustc_span::Span;
8use thin_vec::{thin_vec, ThinVec};
7use rustc_span::symbol::{Ident, kw, sym};
8use thin_vec::{ThinVec, thin_vec};
99
1010use crate::errors;
1111use crate::util::check_builtin_macro_attribute;
......@@ -68,11 +68,10 @@ fn generate_handler(cx: &ExtCtxt<'_>, handler: Ident, span: Span, sig_span: Span
6868
6969 let layout_new = cx.std_path(&[sym::alloc, sym::Layout, sym::from_size_align_unchecked]);
7070 let layout_new = cx.expr_path(cx.path(span, layout_new));
71 let layout = cx.expr_call(
72 span,
73 layout_new,
74 thin_vec![cx.expr_ident(span, size), cx.expr_ident(span, align)],
75 );
71 let layout = cx.expr_call(span, layout_new, thin_vec![
72 cx.expr_ident(span, size),
73 cx.expr_ident(span, align)
74 ]);
7675
7776 let call = cx.expr_call_ident(sig_span, handler, thin_vec![layout]);
7877
compiler/rustc_builtin_macros/src/asm.rs+2-2
......@@ -1,16 +1,16 @@
11use ast::token::IdentIsRaw;
22use lint::BuiltinLintDiag;
3use rustc_ast::AsmMacro;
34use rustc_ast::ptr::P;
45use rustc_ast::token::{self, Delimiter};
56use rustc_ast::tokenstream::TokenStream;
6use rustc_ast::AsmMacro;
77use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
88use rustc_errors::PResult;
99use rustc_expand::base::*;
1010use rustc_index::bit_set::GrowableBitSet;
1111use rustc_parse::parser::Parser;
1212use rustc_session::lint;
13use rustc_span::symbol::{kw, sym, Ident, Symbol};
13use rustc_span::symbol::{Ident, Symbol, kw, sym};
1414use rustc_span::{ErrorGuaranteed, InnerSpan, Span};
1515use rustc_target::asm::InlineAsmArch;
1616use smallvec::smallvec;
compiler/rustc_builtin_macros/src/assert.rs+3-3
......@@ -3,13 +3,13 @@ mod context;
33use rustc_ast::ptr::P;
44use rustc_ast::token::Delimiter;
55use rustc_ast::tokenstream::{DelimSpan, TokenStream};
6use rustc_ast::{token, DelimArgs, Expr, ExprKind, MacCall, Path, PathSegment, UnOp};
6use rustc_ast::{DelimArgs, Expr, ExprKind, MacCall, Path, PathSegment, UnOp, token};
77use rustc_ast_pretty::pprust;
88use rustc_errors::PResult;
99use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
1010use rustc_parse::parser::Parser;
11use rustc_span::symbol::{sym, Ident, Symbol};
12use rustc_span::{Span, DUMMY_SP};
11use rustc_span::symbol::{Ident, Symbol, sym};
12use rustc_span::{DUMMY_SP, Span};
1313use thin_vec::thin_vec;
1414
1515use crate::edition_panic::use_panic_2021;
compiler/rustc_builtin_macros/src/assert/context.rs+4-4
......@@ -2,15 +2,15 @@ use rustc_ast::ptr::P;
22use rustc_ast::token::{self, Delimiter, IdentIsRaw};
33use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
44use rustc_ast::{
5 BinOpKind, BorrowKind, DelimArgs, Expr, ExprKind, ItemKind, MacCall, MethodCall, Mutability,
6 Path, PathSegment, Stmt, StructRest, UnOp, UseTree, UseTreeKind, DUMMY_NODE_ID,
5 BinOpKind, BorrowKind, DUMMY_NODE_ID, DelimArgs, Expr, ExprKind, ItemKind, MacCall, MethodCall,
6 Mutability, Path, PathSegment, Stmt, StructRest, UnOp, UseTree, UseTreeKind,
77};
88use rustc_ast_pretty::pprust;
99use rustc_data_structures::fx::FxHashSet;
1010use rustc_expand::base::ExtCtxt;
11use rustc_span::symbol::{sym, Ident, Symbol};
1211use rustc_span::Span;
13use thin_vec::{thin_vec, ThinVec};
12use rustc_span::symbol::{Ident, Symbol, sym};
13use thin_vec::{ThinVec, thin_vec};
1414
1515pub(super) struct Context<'cx, 'a> {
1616 // An optimization.
compiler/rustc_builtin_macros/src/cfg_accessible.rs+1-1
......@@ -4,8 +4,8 @@ use rustc_ast as ast;
44use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier};
55use rustc_feature::AttributeTemplate;
66use rustc_parse::validate_attr;
7use rustc_span::symbol::sym;
87use rustc_span::Span;
8use rustc_span::symbol::sym;
99
1010use crate::errors;
1111
compiler/rustc_builtin_macros/src/cfg_eval.rs+2-2
......@@ -4,7 +4,7 @@ use rustc_ast as ast;
44use rustc_ast::mut_visit::MutVisitor;
55use rustc_ast::ptr::P;
66use rustc_ast::visit::{AssocCtxt, Visitor};
7use rustc_ast::{mut_visit, visit, Attribute, HasAttrs, HasTokens, NodeId};
7use rustc_ast::{Attribute, HasAttrs, HasTokens, NodeId, mut_visit, visit};
88use rustc_errors::PResult;
99use rustc_expand::base::{Annotatable, ExtCtxt};
1010use rustc_expand::config::StripUnconfigured;
......@@ -12,8 +12,8 @@ use rustc_expand::configure;
1212use rustc_feature::Features;
1313use rustc_parse::parser::{ForceCollect, Parser};
1414use rustc_session::Session;
15use rustc_span::symbol::sym;
1615use rustc_span::Span;
16use rustc_span::symbol::sym;
1717use smallvec::SmallVec;
1818use tracing::instrument;
1919
compiler/rustc_builtin_macros/src/cmdline_attrs.rs+1-1
......@@ -1,7 +1,7 @@
11//! Attributes injected into the crate root from command line using `-Z crate-attr`.
22
33use rustc_ast::attr::mk_attr;
4use rustc_ast::{self as ast, token, AttrItem, AttrStyle};
4use rustc_ast::{self as ast, AttrItem, AttrStyle, token};
55use rustc_parse::parser::ForceCollect;
66use rustc_parse::{new_parser_from_source_str, unwrap_or_emit_fatal};
77use rustc_session::parse::ParseSess;
compiler/rustc_builtin_macros/src/concat_bytes.rs+1-1
......@@ -1,6 +1,6 @@
11use rustc_ast::ptr::P;
22use rustc_ast::tokenstream::TokenStream;
3use rustc_ast::{token, ExprKind, LitIntType, LitKind, UintTy};
3use rustc_ast::{ExprKind, LitIntType, LitKind, UintTy, token};
44use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
55use rustc_session::errors::report_lit_error;
66use rustc_span::{ErrorGuaranteed, Span};
compiler/rustc_builtin_macros/src/concat_idents.rs+2-2
......@@ -1,10 +1,10 @@
11use rustc_ast::ptr::P;
22use rustc_ast::token::{self, Token};
33use rustc_ast::tokenstream::{TokenStream, TokenTree};
4use rustc_ast::{AttrVec, Expr, ExprKind, Path, Ty, TyKind, DUMMY_NODE_ID};
4use rustc_ast::{AttrVec, DUMMY_NODE_ID, Expr, ExprKind, Path, Ty, TyKind};
55use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult};
6use rustc_span::symbol::{Ident, Symbol};
76use rustc_span::Span;
7use rustc_span::symbol::{Ident, Symbol};
88
99use crate::errors;
1010
compiler/rustc_builtin_macros/src/derive.rs+1-1
......@@ -6,7 +6,7 @@ use rustc_expand::base::{
66use rustc_feature::AttributeTemplate;
77use rustc_parse::validate_attr;
88use rustc_session::Session;
9use rustc_span::symbol::{sym, Ident};
9use rustc_span::symbol::{Ident, sym};
1010use rustc_span::{ErrorGuaranteed, Span};
1111
1212use crate::cfg_eval::cfg_eval;
compiler/rustc_builtin_macros/src/deriving/clone.rs+10-16
......@@ -1,9 +1,9 @@
11use rustc_ast::{self as ast, Generics, ItemKind, MetaItem, VariantData};
22use rustc_data_structures::fx::FxHashSet;
33use rustc_expand::base::{Annotatable, ExtCtxt};
4use rustc_span::symbol::{kw, sym, Ident};
54use rustc_span::Span;
6use thin_vec::{thin_vec, ThinVec};
5use rustc_span::symbol::{Ident, kw, sym};
6use thin_vec::{ThinVec, thin_vec};
77
88use crate::deriving::generic::ty::*;
99use crate::deriving::generic::*;
......@@ -115,13 +115,10 @@ fn cs_clone_simple(
115115 // type parameters.
116116 } else if !field.ty.kind.is_anon_adt() {
117117 // let _: AssertParamIsClone<FieldTy>;
118 super::assert_ty_bounds(
119 cx,
120 &mut stmts,
121 field.ty.clone(),
122 field.span,
123 &[sym::clone, sym::AssertParamIsClone],
124 );
118 super::assert_ty_bounds(cx, &mut stmts, field.ty.clone(), field.span, &[
119 sym::clone,
120 sym::AssertParamIsClone,
121 ]);
125122 }
126123 }
127124 };
......@@ -130,13 +127,10 @@ fn cs_clone_simple(
130127 // Just a single assertion for unions, that the union impls `Copy`.
131128 // let _: AssertParamIsCopy<Self>;
132129 let self_ty = cx.ty_path(cx.path_ident(trait_span, Ident::with_dummy_span(kw::SelfUpper)));
133 super::assert_ty_bounds(
134 cx,
135 &mut stmts,
136 self_ty,
137 trait_span,
138 &[sym::clone, sym::AssertParamIsCopy],
139 );
130 super::assert_ty_bounds(cx, &mut stmts, self_ty, trait_span, &[
131 sym::clone,
132 sym::AssertParamIsCopy,
133 ]);
140134 } else {
141135 match *substr.fields {
142136 StaticStruct(vdata, ..) => {
compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs+6-9
......@@ -1,9 +1,9 @@
11use rustc_ast::{self as ast, MetaItem};
22use rustc_data_structures::fx::FxHashSet;
33use rustc_expand::base::{Annotatable, ExtCtxt};
4use rustc_span::symbol::sym;
54use rustc_span::Span;
6use thin_vec::{thin_vec, ThinVec};
5use rustc_span::symbol::sym;
6use thin_vec::{ThinVec, thin_vec};
77
88use crate::deriving::generic::ty::*;
99use crate::deriving::generic::*;
......@@ -66,13 +66,10 @@ fn cs_total_eq_assert(
6666 // Already produced an assertion for this type.
6767 } else {
6868 // let _: AssertParamIsEq<FieldTy>;
69 super::assert_ty_bounds(
70 cx,
71 &mut stmts,
72 field.ty.clone(),
73 field.span,
74 &[sym::cmp, sym::AssertParamIsEq],
75 );
69 super::assert_ty_bounds(cx, &mut stmts, field.ty.clone(), field.span, &[
70 sym::cmp,
71 sym::AssertParamIsEq,
72 ]);
7673 }
7774 }
7875 };
compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_ast::MetaItem;
22use rustc_expand::base::{Annotatable, ExtCtxt};
3use rustc_span::symbol::{sym, Ident};
43use rustc_span::Span;
4use rustc_span::symbol::{Ident, sym};
55use thin_vec::thin_vec;
66
77use crate::deriving::generic::ty::*;
compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs+1-1
......@@ -1,8 +1,8 @@
11use rustc_ast::ptr::P;
22use rustc_ast::{BinOpKind, BorrowKind, Expr, ExprKind, MetaItem, Mutability};
33use rustc_expand::base::{Annotatable, ExtCtxt};
4use rustc_span::symbol::sym;
54use rustc_span::Span;
5use rustc_span::symbol::sym;
66use thin_vec::thin_vec;
77
88use crate::deriving::generic::ty::*;
compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_ast::{ExprKind, ItemKind, MetaItem, PatKind};
22use rustc_expand::base::{Annotatable, ExtCtxt};
3use rustc_span::symbol::{sym, Ident};
43use rustc_span::Span;
4use rustc_span::symbol::{Ident, sym};
55use thin_vec::thin_vec;
66
77use crate::deriving::generic::ty::*;
compiler/rustc_builtin_macros/src/deriving/debug.rs+2-2
......@@ -1,9 +1,9 @@
11use rustc_ast::{self as ast, EnumDef, MetaItem};
22use rustc_expand::base::{Annotatable, ExtCtxt};
33use rustc_session::config::FmtDebug;
4use rustc_span::symbol::{sym, Ident, Symbol};
54use rustc_span::Span;
6use thin_vec::{thin_vec, ThinVec};
5use rustc_span::symbol::{Ident, Symbol, sym};
6use thin_vec::{ThinVec, thin_vec};
77
88use crate::deriving::generic::ty::*;
99use crate::deriving::generic::*;
compiler/rustc_builtin_macros/src/deriving/decodable.rs+29-40
......@@ -3,9 +3,9 @@
33use rustc_ast::ptr::P;
44use rustc_ast::{self as ast, Expr, MetaItem, Mutability};
55use rustc_expand::base::{Annotatable, ExtCtxt};
6use rustc_span::symbol::{sym, Ident, Symbol};
76use rustc_span::Span;
8use thin_vec::{thin_vec, ThinVec};
7use rustc_span::symbol::{Ident, Symbol, sym};
8use thin_vec::{ThinVec, thin_vec};
99
1010use crate::deriving::generic::ty::*;
1111use crate::deriving::generic::*;
......@@ -32,10 +32,11 @@ pub(crate) fn expand_deriving_rustc_decodable(
3232 methods: vec![MethodDef {
3333 name: sym::decode,
3434 generics: Bounds {
35 bounds: vec![(
36 typaram,
37 vec![Path::new_(vec![krate, sym::Decoder], vec![], PathKind::Global)],
38 )],
35 bounds: vec![(typaram, vec![Path::new_(
36 vec![krate, sym::Decoder],
37 vec![],
38 PathKind::Global,
39 )])],
3940 },
4041 explicit_self: false,
4142 nonself_args: vec![(
......@@ -94,32 +95,24 @@ fn decodable_substructure(
9495 decode_static_fields(cx, trait_span, path, summary, |cx, span, name, field| {
9596 cx.expr_try(
9697 span,
97 cx.expr_call_global(
98 span,
99 fn_read_struct_field_path.clone(),
100 thin_vec![
101 blkdecoder.clone(),
102 cx.expr_str(span, name),
103 cx.expr_usize(span, field),
104 exprdecode.clone(),
105 ],
106 ),
98 cx.expr_call_global(span, fn_read_struct_field_path.clone(), thin_vec![
99 blkdecoder.clone(),
100 cx.expr_str(span, name),
101 cx.expr_usize(span, field),
102 exprdecode.clone(),
103 ]),
107104 )
108105 });
109106 let result = cx.expr_ok(trait_span, result);
110107 let fn_read_struct_path: Vec<_> =
111108 cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_struct]);
112109
113 cx.expr_call_global(
114 trait_span,
115 fn_read_struct_path,
116 thin_vec![
117 decoder,
118 cx.expr_str(trait_span, substr.type_ident.name),
119 cx.expr_usize(trait_span, nfields),
120 cx.lambda1(trait_span, result, blkarg),
121 ],
122 )
110 cx.expr_call_global(trait_span, fn_read_struct_path, thin_vec![
111 decoder,
112 cx.expr_str(trait_span, substr.type_ident.name),
113 cx.expr_usize(trait_span, nfields),
114 cx.lambda1(trait_span, result, blkarg),
115 ])
123116 }
124117 StaticEnum(_, fields) => {
125118 let variant = Ident::new(sym::i, trait_span);
......@@ -160,23 +153,19 @@ fn decodable_substructure(
160153 let variant_array_ref = cx.expr_array_ref(trait_span, variants);
161154 let fn_read_enum_variant_path: Vec<_> =
162155 cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_enum_variant]);
163 let result = cx.expr_call_global(
164 trait_span,
165 fn_read_enum_variant_path,
166 thin_vec![blkdecoder, variant_array_ref, lambda],
167 );
156 let result = cx.expr_call_global(trait_span, fn_read_enum_variant_path, thin_vec![
157 blkdecoder,
158 variant_array_ref,
159 lambda
160 ]);
168161 let fn_read_enum_path: Vec<_> =
169162 cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_enum]);
170163
171 cx.expr_call_global(
172 trait_span,
173 fn_read_enum_path,
174 thin_vec![
175 decoder,
176 cx.expr_str(trait_span, substr.type_ident.name),
177 cx.lambda1(trait_span, result, blkarg),
178 ],
179 )
164 cx.expr_call_global(trait_span, fn_read_enum_path, thin_vec![
165 decoder,
166 cx.expr_str(trait_span, substr.type_ident.name),
167 cx.lambda1(trait_span, result, blkarg),
168 ])
180169 }
181170 _ => cx.dcx().bug("expected StaticEnum or StaticStruct in derive(Decodable)"),
182171 };
compiler/rustc_builtin_macros/src/deriving/default.rs+7-7
......@@ -2,12 +2,12 @@ use core::ops::ControlFlow;
22
33use rustc_ast as ast;
44use rustc_ast::visit::visit_opt;
5use rustc_ast::{attr, EnumDef, VariantData};
5use rustc_ast::{EnumDef, VariantData, attr};
66use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt};
7use rustc_span::symbol::{kw, sym, Ident};
7use rustc_span::symbol::{Ident, kw, sym};
88use rustc_span::{ErrorGuaranteed, Span};
99use smallvec::SmallVec;
10use thin_vec::{thin_vec, ThinVec};
10use thin_vec::{ThinVec, thin_vec};
1111
1212use crate::deriving::generic::ty::*;
1313use crate::deriving::generic::*;
......@@ -93,10 +93,10 @@ fn default_enum_substructure(
9393 } {
9494 Ok(default_variant) => {
9595 // We now know there is exactly one unit variant with exactly one `#[default]` attribute.
96 cx.expr_path(cx.path(
97 default_variant.span,
98 vec![Ident::new(kw::SelfUpper, default_variant.span), default_variant.ident],
99 ))
96 cx.expr_path(cx.path(default_variant.span, vec![
97 Ident::new(kw::SelfUpper, default_variant.span),
98 default_variant.ident,
99 ]))
100100 }
101101 Err(guar) => DummyResult::raw_expr(trait_span, Some(guar)),
102102 };
compiler/rustc_builtin_macros/src/deriving/encodable.rs+38-55
......@@ -87,9 +87,9 @@
8787
8888use rustc_ast::{AttrVec, ExprKind, MetaItem, Mutability};
8989use rustc_expand::base::{Annotatable, ExtCtxt};
90use rustc_span::symbol::{sym, Ident, Symbol};
9190use rustc_span::Span;
92use thin_vec::{thin_vec, ThinVec};
91use rustc_span::symbol::{Ident, Symbol, sym};
92use thin_vec::{ThinVec, thin_vec};
9393
9494use crate::deriving::generic::ty::*;
9595use crate::deriving::generic::*;
......@@ -116,10 +116,11 @@ pub(crate) fn expand_deriving_rustc_encodable(
116116 methods: vec![MethodDef {
117117 name: sym::encode,
118118 generics: Bounds {
119 bounds: vec![(
120 typaram,
121 vec![Path::new_(vec![krate, sym::Encoder], vec![], PathKind::Global)],
122 )],
119 bounds: vec![(typaram, vec![Path::new_(
120 vec![krate, sym::Encoder],
121 vec![],
122 PathKind::Global,
123 )])],
123124 },
124125 explicit_self: true,
125126 nonself_args: vec![(
......@@ -157,14 +158,11 @@ fn encodable_substructure(
157158 // throw an underscore in front to suppress unused variable warnings
158159 let blkarg = Ident::new(sym::_e, trait_span);
159160 let blkencoder = cx.expr_ident(trait_span, blkarg);
160 let fn_path = cx.expr_path(cx.path_global(
161 trait_span,
162 vec![
163 Ident::new(krate, trait_span),
164 Ident::new(sym::Encodable, trait_span),
165 Ident::new(sym::encode, trait_span),
166 ],
167 ));
161 let fn_path = cx.expr_path(cx.path_global(trait_span, vec![
162 Ident::new(krate, trait_span),
163 Ident::new(sym::Encodable, trait_span),
164 Ident::new(sym::encode, trait_span),
165 ]));
168166
169167 match substr.fields {
170168 Struct(_, fields) => {
......@@ -180,16 +178,12 @@ fn encodable_substructure(
180178 let enc =
181179 cx.expr_call(span, fn_path.clone(), thin_vec![self_ref, blkencoder.clone()]);
182180 let lambda = cx.lambda1(span, enc, blkarg);
183 let call = cx.expr_call_global(
184 span,
185 fn_emit_struct_field_path.clone(),
186 thin_vec![
187 blkencoder.clone(),
188 cx.expr_str(span, name),
189 cx.expr_usize(span, i),
190 lambda,
191 ],
192 );
181 let call = cx.expr_call_global(span, fn_emit_struct_field_path.clone(), thin_vec![
182 blkencoder.clone(),
183 cx.expr_str(span, name),
184 cx.expr_usize(span, i),
185 lambda,
186 ]);
193187
194188 // last call doesn't need a try!
195189 let last = fields.len() - 1;
......@@ -214,16 +208,12 @@ fn encodable_substructure(
214208 let fn_emit_struct_path =
215209 cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_struct]);
216210
217 let expr = cx.expr_call_global(
218 trait_span,
219 fn_emit_struct_path,
220 thin_vec![
221 encoder,
222 cx.expr_str(trait_span, substr.type_ident.name),
223 cx.expr_usize(trait_span, fields.len()),
224 blk,
225 ],
226 );
211 let expr = cx.expr_call_global(trait_span, fn_emit_struct_path, thin_vec![
212 encoder,
213 cx.expr_str(trait_span, substr.type_ident.name),
214 cx.expr_usize(trait_span, fields.len()),
215 blk,
216 ]);
227217 BlockOrExpr::new_expr(expr)
228218 }
229219
......@@ -243,11 +233,8 @@ fn encodable_substructure(
243233 let last = fields.len() - 1;
244234 for (i, &FieldInfo { ref self_expr, span, .. }) in fields.iter().enumerate() {
245235 let self_ref = cx.expr_addr_of(span, self_expr.clone());
246 let enc = cx.expr_call(
247 span,
248 fn_path.clone(),
249 thin_vec![self_ref, blkencoder.clone()],
250 );
236 let enc = cx
237 .expr_call(span, fn_path.clone(), thin_vec![self_ref, blkencoder.clone()]);
251238 let lambda = cx.lambda1(span, enc, blkarg);
252239
253240 let call = cx.expr_call_global(
......@@ -274,26 +261,22 @@ fn encodable_substructure(
274261 let fn_emit_enum_variant_path: Vec<_> =
275262 cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_enum_variant]);
276263
277 let call = cx.expr_call_global(
278 trait_span,
279 fn_emit_enum_variant_path,
280 thin_vec![
281 blkencoder,
282 name,
283 cx.expr_usize(trait_span, *idx),
284 cx.expr_usize(trait_span, fields.len()),
285 blk,
286 ],
287 );
264 let call = cx.expr_call_global(trait_span, fn_emit_enum_variant_path, thin_vec![
265 blkencoder,
266 name,
267 cx.expr_usize(trait_span, *idx),
268 cx.expr_usize(trait_span, fields.len()),
269 blk,
270 ]);
288271
289272 let blk = cx.lambda1(trait_span, call, blkarg);
290273 let fn_emit_enum_path: Vec<_> =
291274 cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_enum]);
292 let expr = cx.expr_call_global(
293 trait_span,
294 fn_emit_enum_path,
295 thin_vec![encoder, cx.expr_str(trait_span, substr.type_ident.name), blk],
296 );
275 let expr = cx.expr_call_global(trait_span, fn_emit_enum_path, thin_vec![
276 encoder,
277 cx.expr_str(trait_span, substr.type_ident.name),
278 blk
279 ]);
297280 BlockOrExpr::new_mixed(thin_vec![me], Some(expr))
298281 }
299282
compiler/rustc_builtin_macros/src/deriving/generic/mod.rs+9-11
......@@ -178,6 +178,8 @@ use std::cell::RefCell;
178178use std::ops::Not;
179179use std::{iter, vec};
180180
181pub(crate) use StaticFields::*;
182pub(crate) use SubstructureFields::*;
181183use rustc_ast::ptr::P;
182184use rustc_ast::{
183185 self as ast, BindingMode, ByRef, EnumDef, Expr, GenericArg, GenericParamKind, Generics,
......@@ -185,12 +187,10 @@ use rustc_ast::{
185187};
186188use rustc_attr as attr;
187189use rustc_expand::base::{Annotatable, ExtCtxt};
188use rustc_span::symbol::{kw, sym, Ident, Symbol};
189use rustc_span::{Span, DUMMY_SP};
190use thin_vec::{thin_vec, ThinVec};
190use rustc_span::symbol::{Ident, Symbol, kw, sym};
191use rustc_span::{DUMMY_SP, Span};
192use thin_vec::{ThinVec, thin_vec};
191193use ty::{Bounds, Path, Ref, Self_, Ty};
192pub(crate) use StaticFields::*;
193pub(crate) use SubstructureFields::*;
194194
195195use crate::{deriving, errors};
196196
......@@ -1228,12 +1228,10 @@ impl<'a> MethodDef<'a> {
12281228
12291229 let discr_let_stmts: ThinVec<_> = iter::zip(&discr_idents, &selflike_args)
12301230 .map(|(&ident, selflike_arg)| {
1231 let variant_value = deriving::call_intrinsic(
1232 cx,
1233 span,
1234 sym::discriminant_value,
1235 thin_vec![selflike_arg.clone()],
1236 );
1231 let variant_value =
1232 deriving::call_intrinsic(cx, span, sym::discriminant_value, thin_vec![
1233 selflike_arg.clone()
1234 ]);
12371235 cx.stmt_let(span, false, ident, variant_value)
12381236 })
12391237 .collect();
compiler/rustc_builtin_macros/src/deriving/generic/ty.rs+3-3
......@@ -1,14 +1,14 @@
11//! A mini version of ast::Ty, which is easier to use, and features an explicit `Self` type to use
22//! when specifying impls to be derived.
33
4pub(crate) use Ty::*;
45use rustc_ast::ptr::P;
56use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, SelfKind};
67use rustc_expand::base::ExtCtxt;
78use rustc_span::source_map::respan;
8use rustc_span::symbol::{kw, Ident, Symbol};
9use rustc_span::{Span, DUMMY_SP};
9use rustc_span::symbol::{Ident, Symbol, kw};
10use rustc_span::{DUMMY_SP, Span};
1011use thin_vec::ThinVec;
11pub(crate) use Ty::*;
1212
1313/// A path, e.g., `::std::option::Option::<i32>` (global). Has support
1414/// for type parameters.
compiler/rustc_builtin_macros/src/deriving/hash.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_ast::{MetaItem, Mutability};
22use rustc_expand::base::{Annotatable, ExtCtxt};
3use rustc_span::symbol::sym;
43use rustc_span::Span;
4use rustc_span::symbol::sym;
55use thin_vec::thin_vec;
66
77use crate::deriving::generic::ty::*;
compiler/rustc_builtin_macros/src/deriving/mod.rs+2-2
......@@ -4,9 +4,9 @@ use rustc_ast as ast;
44use rustc_ast::ptr::P;
55use rustc_ast::{GenericArg, MetaItem};
66use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier};
7use rustc_span::symbol::{sym, Symbol};
87use rustc_span::Span;
9use thin_vec::{thin_vec, ThinVec};
8use rustc_span::symbol::{Symbol, sym};
9use thin_vec::{ThinVec, thin_vec};
1010
1111macro path_local($x:ident) {
1212 generic::ty::Path::new_local(sym::$x)
compiler/rustc_builtin_macros/src/deriving/smart_ptr.rs+3-3
......@@ -1,5 +1,5 @@
1use ast::ptr::P;
21use ast::HasAttrs;
2use ast::ptr::P;
33use rustc_ast::mut_visit::MutVisitor;
44use rustc_ast::visit::BoundKind;
55use rustc_ast::{
......@@ -9,9 +9,9 @@ use rustc_ast::{
99use rustc_attr as attr;
1010use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1111use rustc_expand::base::{Annotatable, ExtCtxt};
12use rustc_span::symbol::{sym, Ident};
12use rustc_span::symbol::{Ident, sym};
1313use rustc_span::{Span, Symbol};
14use thin_vec::{thin_vec, ThinVec};
14use thin_vec::{ThinVec, thin_vec};
1515
1616macro_rules! path {
1717 ($span:expr, $($part:ident)::*) => { vec![$(Ident::new(sym::$part, $span),)*] }
compiler/rustc_builtin_macros/src/edition_panic.rs+1-1
......@@ -3,9 +3,9 @@ use rustc_ast::token::Delimiter;
33use rustc_ast::tokenstream::{DelimSpan, TokenStream};
44use rustc_ast::*;
55use rustc_expand::base::*;
6use rustc_span::Span;
67use rustc_span::edition::Edition;
78use rustc_span::symbol::sym;
8use rustc_span::Span;
99
1010/// This expands to either
1111/// - `$crate::panic::panic_2015!(...)` or
compiler/rustc_builtin_macros/src/env.rs+6-6
......@@ -10,8 +10,8 @@ use rustc_ast::token::{self, LitKind};
1010use rustc_ast::tokenstream::TokenStream;
1111use rustc_ast::{AstDeref, ExprKind, GenericArg, Mutability};
1212use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
13use rustc_span::symbol::{kw, sym, Ident, Symbol};
1413use rustc_span::Span;
14use rustc_span::symbol::{Ident, Symbol, kw, sym};
1515use thin_vec::thin_vec;
1616
1717use crate::errors;
......@@ -58,11 +58,11 @@ pub(crate) fn expand_option_env<'cx>(
5858 ))],
5959 ))
6060 }
61 Some(value) => cx.expr_call_global(
62 sp,
63 cx.std_path(&[sym::option, sym::Option, sym::Some]),
64 thin_vec![cx.expr_str(sp, value)],
65 ),
61 Some(value) => {
62 cx.expr_call_global(sp, cx.std_path(&[sym::option, sym::Option, sym::Some]), thin_vec![
63 cx.expr_str(sp, value)
64 ])
65 }
6666 };
6767 ExpandResult::Ready(MacEager::expr(e))
6868}
compiler/rustc_builtin_macros/src/format.rs+2-1
......@@ -2,9 +2,10 @@ use parse::Position::ArgumentNamed;
22use rustc_ast::ptr::P;
33use rustc_ast::tokenstream::TokenStream;
44use rustc_ast::{
5 token, Expr, ExprKind, FormatAlignment, FormatArgPosition, FormatArgPositionKind, FormatArgs,
5 Expr, ExprKind, FormatAlignment, FormatArgPosition, FormatArgPositionKind, FormatArgs,
66 FormatArgsPiece, FormatArgument, FormatArgumentKind, FormatArguments, FormatCount,
77 FormatDebugHex, FormatOptions, FormatPlaceholder, FormatSign, FormatTrait, Recovered, StmtKind,
8 token,
89};
910use rustc_data_structures::fx::FxHashSet;
1011use rustc_errors::{Applicability, Diag, MultiSpan, PResult, SingleLabelManySpans};
compiler/rustc_builtin_macros/src/format_foreign.rs+4-8
......@@ -183,14 +183,10 @@ pub(crate) mod printf {
183183 s.push('{');
184184
185185 if let Some(arg) = self.parameter {
186 match write!(
187 s,
188 "{}",
189 match arg.checked_sub(1) {
190 Some(a) => a,
191 None => return Err(None),
192 }
193 ) {
186 match write!(s, "{}", match arg.checked_sub(1) {
187 Some(a) => a,
188 None => return Err(None),
189 }) {
194190 Err(_) => return Err(None),
195191 _ => {}
196192 }
compiler/rustc_builtin_macros/src/format_foreign/printf/tests.rs+7-5
......@@ -1,4 +1,4 @@
1use super::{iter_subs, parse_next_substitution as pns, Format as F, Num as N, Substitution as S};
1use super::{Format as F, Num as N, Substitution as S, iter_subs, parse_next_substitution as pns};
22
33macro_rules! assert_eq_pnsat {
44 ($lhs:expr, $rhs:expr) => {
......@@ -99,10 +99,12 @@ fn test_parse() {
9999fn test_iter() {
100100 let s = "The %d'th word %% is: `%.*s` %!\n";
101101 let subs: Vec<_> = iter_subs(s, 0).map(|sub| sub.translate().ok()).collect();
102 assert_eq!(
103 subs.iter().map(Option::as_deref).collect::<Vec<_>>(),
104 vec![Some("{}"), None, Some("{:.*}"), None]
105 );
102 assert_eq!(subs.iter().map(Option::as_deref).collect::<Vec<_>>(), vec![
103 Some("{}"),
104 None,
105 Some("{:.*}"),
106 None
107 ]);
106108}
107109
108110/// Checks that the translations are what we expect.
compiler/rustc_builtin_macros/src/format_foreign/shell/tests.rs+6-5
......@@ -1,4 +1,4 @@
1use super::{parse_next_substitution as pns, Substitution as S};
1use super::{Substitution as S, parse_next_substitution as pns};
22
33macro_rules! assert_eq_pnsat {
44 ($lhs:expr, $rhs:expr) => {
......@@ -38,10 +38,11 @@ fn test_iter() {
3838 use super::iter_subs;
3939 let s = "The $0'th word $$ is: `$WORD` $!\n";
4040 let subs: Vec<_> = iter_subs(s, 0).map(|sub| sub.translate().ok()).collect();
41 assert_eq!(
42 subs.iter().map(Option::as_deref).collect::<Vec<_>>(),
43 vec![Some("{0}"), None, Some("{WORD}")]
44 );
41 assert_eq!(subs.iter().map(Option::as_deref).collect::<Vec<_>>(), vec![
42 Some("{0}"),
43 None,
44 Some("{WORD}")
45 ]);
4546}
4647
4748#[test]
compiler/rustc_builtin_macros/src/global_allocator.rs+3-3
......@@ -1,5 +1,5 @@
11use rustc_ast::expand::allocator::{
2 global_fn_name, AllocatorMethod, AllocatorMethodInput, AllocatorTy, ALLOCATOR_METHODS,
2 ALLOCATOR_METHODS, AllocatorMethod, AllocatorMethodInput, AllocatorTy, global_fn_name,
33};
44use rustc_ast::ptr::P;
55use rustc_ast::{
......@@ -7,9 +7,9 @@ use rustc_ast::{
77 Stmt, StmtKind, Ty, TyKind,
88};
99use rustc_expand::base::{Annotatable, ExtCtxt};
10use rustc_span::symbol::{kw, sym, Ident, Symbol};
1110use rustc_span::Span;
12use thin_vec::{thin_vec, ThinVec};
11use rustc_span::symbol::{Ident, Symbol, kw, sym};
12use thin_vec::{ThinVec, thin_vec};
1313
1414use crate::errors;
1515use crate::util::check_builtin_macro_attribute;
compiler/rustc_builtin_macros/src/pattern_type.rs+2-2
......@@ -1,9 +1,9 @@
11use rustc_ast::ptr::P;
22use rustc_ast::tokenstream::TokenStream;
3use rustc_ast::{ast, Pat, Ty};
3use rustc_ast::{Pat, Ty, ast};
44use rustc_errors::PResult;
55use rustc_expand::base::{self, DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
6use rustc_span::{sym, Span};
6use rustc_span::{Span, sym};
77
88pub(crate) fn expand<'cx>(
99 cx: &'cx mut ExtCtxt<'_>,
compiler/rustc_builtin_macros/src/proc_macro_harness.rs+30-35
......@@ -2,19 +2,19 @@ use std::mem;
22
33use rustc_ast::ptr::P;
44use rustc_ast::visit::{self, Visitor};
5use rustc_ast::{self as ast, attr, NodeId};
5use rustc_ast::{self as ast, NodeId, attr};
66use rustc_ast_pretty::pprust;
77use rustc_errors::DiagCtxtHandle;
8use rustc_expand::base::{parse_macro_name_and_helper_attrs, ExtCtxt, ResolverExpand};
8use rustc_expand::base::{ExtCtxt, ResolverExpand, parse_macro_name_and_helper_attrs};
99use rustc_expand::expand::{AstFragment, ExpansionConfig};
1010use rustc_feature::Features;
1111use rustc_session::Session;
1212use rustc_span::hygiene::AstPass;
1313use rustc_span::source_map::SourceMap;
14use rustc_span::symbol::{kw, sym, Ident, Symbol};
15use rustc_span::{Span, DUMMY_SP};
14use rustc_span::symbol::{Ident, Symbol, kw, sym};
15use rustc_span::{DUMMY_SP, Span};
1616use smallvec::smallvec;
17use thin_vec::{thin_vec, ThinVec};
17use thin_vec::{ThinVec, thin_vec};
1818
1919use crate::errors;
2020
......@@ -302,29 +302,25 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
302302 };
303303 let local_path = |cx: &ExtCtxt<'_>, name| cx.expr_path(cx.path(span, vec![name]));
304304 let proc_macro_ty_method_path = |cx: &ExtCtxt<'_>, method| {
305 cx.expr_path(cx.path(
306 span.with_ctxt(harness_span.ctxt()),
307 vec![proc_macro, bridge, client, proc_macro_ty, method],
308 ))
305 cx.expr_path(cx.path(span.with_ctxt(harness_span.ctxt()), vec![
306 proc_macro,
307 bridge,
308 client,
309 proc_macro_ty,
310 method,
311 ]))
309312 };
310313 match m {
311314 ProcMacro::Derive(cd) => {
312315 cx.resolver.declare_proc_macro(cd.id);
313 cx.expr_call(
314 span,
315 proc_macro_ty_method_path(cx, custom_derive),
316 thin_vec![
317 cx.expr_str(span, cd.trait_name),
318 cx.expr_array_ref(
319 span,
320 cd.attrs
321 .iter()
322 .map(|&s| cx.expr_str(span, s))
323 .collect::<ThinVec<_>>(),
324 ),
325 local_path(cx, cd.function_name),
326 ],
327 )
316 cx.expr_call(span, proc_macro_ty_method_path(cx, custom_derive), thin_vec![
317 cx.expr_str(span, cd.trait_name),
318 cx.expr_array_ref(
319 span,
320 cd.attrs.iter().map(|&s| cx.expr_str(span, s)).collect::<ThinVec<_>>(),
321 ),
322 local_path(cx, cd.function_name),
323 ])
328324 }
329325 ProcMacro::Attr(ca) | ProcMacro::Bang(ca) => {
330326 cx.resolver.declare_proc_macro(ca.id);
......@@ -334,14 +330,10 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
334330 ProcMacro::Derive(_) => unreachable!(),
335331 };
336332
337 cx.expr_call(
338 span,
339 proc_macro_ty_method_path(cx, ident),
340 thin_vec![
341 cx.expr_str(span, ca.function_name.name),
342 local_path(cx, ca.function_name),
343 ],
344 )
333 cx.expr_call(span, proc_macro_ty_method_path(cx, ident), thin_vec![
334 cx.expr_str(span, ca.function_name.name),
335 local_path(cx, ca.function_name),
336 ])
345337 }
346338 }
347339 })
......@@ -355,9 +347,12 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
355347 span,
356348 cx.ty(
357349 span,
358 ast::TyKind::Slice(
359 cx.ty_path(cx.path(span, vec![proc_macro, bridge, client, proc_macro_ty])),
360 ),
350 ast::TyKind::Slice(cx.ty_path(cx.path(span, vec![
351 proc_macro,
352 bridge,
353 client,
354 proc_macro_ty,
355 ]))),
361356 ),
362357 None,
363358 ast::Mutability::Not,
compiler/rustc_builtin_macros/src/source_util.rs+2-2
......@@ -8,7 +8,7 @@ use rustc_ast::tokenstream::TokenStream;
88use rustc_ast_pretty::pprust;
99use rustc_data_structures::sync::Lrc;
1010use rustc_expand::base::{
11 resolve_path, DummyResult, ExpandResult, ExtCtxt, MacEager, MacResult, MacroExpanderResult,
11 DummyResult, ExpandResult, ExtCtxt, MacEager, MacResult, MacroExpanderResult, resolve_path,
1212};
1313use rustc_expand::module::DirOwnership;
1414use rustc_lint_defs::BuiltinLintDiag;
......@@ -73,8 +73,8 @@ pub(crate) fn expand_file(
7373 let topmost = cx.expansion_cause().unwrap_or(sp);
7474 let loc = cx.source_map().lookup_char_pos(topmost.lo());
7575
76 use rustc_session::config::RemapPathScopeComponents;
7776 use rustc_session::RemapFileNameExt;
77 use rustc_session::config::RemapPathScopeComponents;
7878 ExpandResult::Ready(MacEager::expr(cx.expr_str(
7979 topmost,
8080 Symbol::intern(
compiler/rustc_builtin_macros/src/standard_library_imports.rs+2-2
......@@ -3,10 +3,10 @@ use rustc_expand::base::{ExtCtxt, ResolverExpand};
33use rustc_expand::expand::ExpansionConfig;
44use rustc_feature::Features;
55use rustc_session::Session;
6use rustc_span::DUMMY_SP;
67use rustc_span::edition::Edition::*;
78use rustc_span::hygiene::AstPass;
8use rustc_span::symbol::{kw, sym, Ident, Symbol};
9use rustc_span::DUMMY_SP;
9use rustc_span::symbol::{Ident, Symbol, kw, sym};
1010use thin_vec::thin_vec;
1111
1212pub fn inject(
compiler/rustc_builtin_macros/src/test.rs+135-172
......@@ -5,13 +5,13 @@ use std::assert_matches::assert_matches;
55use std::iter;
66
77use rustc_ast::ptr::P;
8use rustc_ast::{self as ast, attr, GenericParamKind};
8use rustc_ast::{self as ast, GenericParamKind, attr};
99use rustc_ast_pretty::pprust;
1010use rustc_errors::{Applicability, Diag, Level};
1111use rustc_expand::base::*;
12use rustc_span::symbol::{sym, Ident, Symbol};
12use rustc_span::symbol::{Ident, Symbol, sym};
1313use rustc_span::{ErrorGuaranteed, FileNameDisplayPreference, Span};
14use thin_vec::{thin_vec, ThinVec};
14use thin_vec::{ThinVec, thin_vec};
1515use tracing::debug;
1616
1717use crate::errors;
......@@ -170,26 +170,20 @@ pub(crate) fn expand_test_or_bench(
170170
171171 // creates test::ShouldPanic::$name
172172 let should_panic_path = |name| {
173 cx.path(
174 sp,
175 vec![
176 test_id,
177 Ident::from_str_and_span("ShouldPanic", sp),
178 Ident::from_str_and_span(name, sp),
179 ],
180 )
173 cx.path(sp, vec![
174 test_id,
175 Ident::from_str_and_span("ShouldPanic", sp),
176 Ident::from_str_and_span(name, sp),
177 ])
181178 };
182179
183180 // creates test::TestType::$name
184181 let test_type_path = |name| {
185 cx.path(
186 sp,
187 vec![
188 test_id,
189 Ident::from_str_and_span("TestType", sp),
190 Ident::from_str_and_span(name, sp),
191 ],
192 )
182 cx.path(sp, vec![
183 test_id,
184 Ident::from_str_and_span("TestType", sp),
185 Ident::from_str_and_span(name, sp),
186 ])
193187 };
194188
195189 // creates $name: $expr
......@@ -209,55 +203,39 @@ pub(crate) fn expand_test_or_bench(
209203 // A simple ident for a lambda
210204 let b = Ident::from_str_and_span("b", attr_sp);
211205
212 cx.expr_call(
213 sp,
214 cx.expr_path(test_path("StaticBenchFn")),
215 thin_vec![
216 // #[coverage(off)]
217 // |b| self::test::assert_test_result(
218 coverage_off(cx.lambda1(
219 sp,
206 cx.expr_call(sp, cx.expr_path(test_path("StaticBenchFn")), thin_vec![
207 // #[coverage(off)]
208 // |b| self::test::assert_test_result(
209 coverage_off(cx.lambda1(
210 sp,
211 cx.expr_call(sp, cx.expr_path(test_path("assert_test_result")), thin_vec![
212 // super::$test_fn(b)
220213 cx.expr_call(
221 sp,
222 cx.expr_path(test_path("assert_test_result")),
223 thin_vec![
224 // super::$test_fn(b)
225 cx.expr_call(
226 ret_ty_sp,
227 cx.expr_path(cx.path(sp, vec![item.ident])),
228 thin_vec![cx.expr_ident(sp, b)],
229 ),
230 ],
214 ret_ty_sp,
215 cx.expr_path(cx.path(sp, vec![item.ident])),
216 thin_vec![cx.expr_ident(sp, b)],
231217 ),
232 b,
233 )), // )
234 ],
235 )
218 ],),
219 b,
220 )), // )
221 ])
236222 } else {
237 cx.expr_call(
238 sp,
239 cx.expr_path(test_path("StaticTestFn")),
240 thin_vec![
241 // #[coverage(off)]
242 // || {
243 coverage_off(cx.lambda0(
244 sp,
245 // test::assert_test_result(
223 cx.expr_call(sp, cx.expr_path(test_path("StaticTestFn")), thin_vec![
224 // #[coverage(off)]
225 // || {
226 coverage_off(cx.lambda0(
227 sp,
228 // test::assert_test_result(
229 cx.expr_call(sp, cx.expr_path(test_path("assert_test_result")), thin_vec![
230 // $test_fn()
246231 cx.expr_call(
247 sp,
248 cx.expr_path(test_path("assert_test_result")),
249 thin_vec![
250 // $test_fn()
251 cx.expr_call(
252 ret_ty_sp,
253 cx.expr_path(cx.path(sp, vec![item.ident])),
254 ThinVec::new(),
255 ), // )
256 ],
257 ), // }
258 )), // )
259 ],
260 )
232 ret_ty_sp,
233 cx.expr_path(cx.path(sp, vec![item.ident])),
234 ThinVec::new(),
235 ), // )
236 ],), // }
237 )), // )
238 ])
261239 };
262240
263241 let test_path_symbol = Symbol::intern(&item_path(
......@@ -268,122 +246,107 @@ pub(crate) fn expand_test_or_bench(
268246
269247 let location_info = get_location_info(cx, &item);
270248
271 let mut test_const =
272 cx.item(
273 sp,
274 Ident::new(item.ident.name, sp),
275 thin_vec![
276 // #[cfg(test)]
277 cx.attr_nested_word(sym::cfg, sym::test, attr_sp),
278 // #[rustc_test_marker = "test_case_sort_key"]
279 cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp),
280 // #[doc(hidden)]
281 cx.attr_nested_word(sym::doc, sym::hidden, attr_sp),
282 ],
283 // const $ident: test::TestDescAndFn =
284 ast::ItemKind::Const(
285 ast::ConstItem {
286 defaultness: ast::Defaultness::Final,
287 generics: ast::Generics::default(),
288 ty: cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
289 // test::TestDescAndFn {
290 expr: Some(
291 cx.expr_struct(
292 sp,
293 test_path("TestDescAndFn"),
294 thin_vec![
249 let mut test_const = cx.item(
250 sp,
251 Ident::new(item.ident.name, sp),
252 thin_vec![
253 // #[cfg(test)]
254 cx.attr_nested_word(sym::cfg, sym::test, attr_sp),
255 // #[rustc_test_marker = "test_case_sort_key"]
256 cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp),
257 // #[doc(hidden)]
258 cx.attr_nested_word(sym::doc, sym::hidden, attr_sp),
259 ],
260 // const $ident: test::TestDescAndFn =
261 ast::ItemKind::Const(
262 ast::ConstItem {
263 defaultness: ast::Defaultness::Final,
264 generics: ast::Generics::default(),
265 ty: cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
266 // test::TestDescAndFn {
267 expr: Some(
268 cx.expr_struct(sp, test_path("TestDescAndFn"), thin_vec![
295269 // desc: test::TestDesc {
296270 field(
297271 "desc",
298 cx.expr_struct(
299 sp,
300 test_path("TestDesc"),
301 thin_vec![
302 // name: "path::to::test"
303 field(
304 "name",
305 cx.expr_call(
306 sp,
307 cx.expr_path(test_path("StaticTestName")),
308 thin_vec![cx.expr_str(sp, test_path_symbol)],
309 ),
272 cx.expr_struct(sp, test_path("TestDesc"), thin_vec![
273 // name: "path::to::test"
274 field(
275 "name",
276 cx.expr_call(
277 sp,
278 cx.expr_path(test_path("StaticTestName")),
279 thin_vec![cx.expr_str(sp, test_path_symbol)],
310280 ),
311 // ignore: true | false
312 field("ignore", cx.expr_bool(sp, should_ignore(&item)),),
313 // ignore_message: Some("...") | None
314 field(
315 "ignore_message",
316 if let Some(msg) = should_ignore_message(&item) {
317 cx.expr_some(sp, cx.expr_str(sp, msg))
318 } else {
319 cx.expr_none(sp)
320 },
281 ),
282 // ignore: true | false
283 field("ignore", cx.expr_bool(sp, should_ignore(&item)),),
284 // ignore_message: Some("...") | None
285 field(
286 "ignore_message",
287 if let Some(msg) = should_ignore_message(&item) {
288 cx.expr_some(sp, cx.expr_str(sp, msg))
289 } else {
290 cx.expr_none(sp)
291 },
292 ),
293 // source_file: <relative_path_of_source_file>
294 field("source_file", cx.expr_str(sp, location_info.0)),
295 // start_line: start line of the test fn identifier.
296 field("start_line", cx.expr_usize(sp, location_info.1)),
297 // start_col: start column of the test fn identifier.
298 field("start_col", cx.expr_usize(sp, location_info.2)),
299 // end_line: end line of the test fn identifier.
300 field("end_line", cx.expr_usize(sp, location_info.3)),
301 // end_col: end column of the test fn identifier.
302 field("end_col", cx.expr_usize(sp, location_info.4)),
303 // compile_fail: true | false
304 field("compile_fail", cx.expr_bool(sp, false)),
305 // no_run: true | false
306 field("no_run", cx.expr_bool(sp, false)),
307 // should_panic: ...
308 field("should_panic", match should_panic(cx, &item) {
309 // test::ShouldPanic::No
310 ShouldPanic::No => {
311 cx.expr_path(should_panic_path("No"))
312 }
313 // test::ShouldPanic::Yes
314 ShouldPanic::Yes(None) => {
315 cx.expr_path(should_panic_path("Yes"))
316 }
317 // test::ShouldPanic::YesWithMessage("...")
318 ShouldPanic::Yes(Some(sym)) => cx.expr_call(
319 sp,
320 cx.expr_path(should_panic_path("YesWithMessage")),
321 thin_vec![cx.expr_str(sp, sym)],
321322 ),
322 // source_file: <relative_path_of_source_file>
323 field("source_file", cx.expr_str(sp, location_info.0)),
324 // start_line: start line of the test fn identifier.
325 field("start_line", cx.expr_usize(sp, location_info.1)),
326 // start_col: start column of the test fn identifier.
327 field("start_col", cx.expr_usize(sp, location_info.2)),
328 // end_line: end line of the test fn identifier.
329 field("end_line", cx.expr_usize(sp, location_info.3)),
330 // end_col: end column of the test fn identifier.
331 field("end_col", cx.expr_usize(sp, location_info.4)),
332 // compile_fail: true | false
333 field("compile_fail", cx.expr_bool(sp, false)),
334 // no_run: true | false
335 field("no_run", cx.expr_bool(sp, false)),
336 // should_panic: ...
337 field(
338 "should_panic",
339 match should_panic(cx, &item) {
340 // test::ShouldPanic::No
341 ShouldPanic::No => {
342 cx.expr_path(should_panic_path("No"))
343 }
344 // test::ShouldPanic::Yes
345 ShouldPanic::Yes(None) => {
346 cx.expr_path(should_panic_path("Yes"))
347 }
348 // test::ShouldPanic::YesWithMessage("...")
349 ShouldPanic::Yes(Some(sym)) => cx.expr_call(
350 sp,
351 cx.expr_path(should_panic_path("YesWithMessage")),
352 thin_vec![cx.expr_str(sp, sym)],
353 ),
354 },
355 ),
356 // test_type: ...
357 field(
358 "test_type",
359 match test_type(cx) {
360 // test::TestType::UnitTest
361 TestType::UnitTest => {
362 cx.expr_path(test_type_path("UnitTest"))
363 }
364 // test::TestType::IntegrationTest
365 TestType::IntegrationTest => {
366 cx.expr_path(test_type_path("IntegrationTest"))
367 }
368 // test::TestPath::Unknown
369 TestType::Unknown => {
370 cx.expr_path(test_type_path("Unknown"))
371 }
372 },
373 ),
374 // },
375 ],
376 ),
323 },),
324 // test_type: ...
325 field("test_type", match test_type(cx) {
326 // test::TestType::UnitTest
327 TestType::UnitTest => {
328 cx.expr_path(test_type_path("UnitTest"))
329 }
330 // test::TestType::IntegrationTest
331 TestType::IntegrationTest => {
332 cx.expr_path(test_type_path("IntegrationTest"))
333 }
334 // test::TestPath::Unknown
335 TestType::Unknown => {
336 cx.expr_path(test_type_path("Unknown"))
337 }
338 },),
339 // },
340 ],),
377341 ),
378342 // testfn: test::StaticTestFn(...) | test::StaticBenchFn(...)
379343 field("testfn", test_fn), // }
380 ],
381 ), // }
382 ),
383 }
384 .into(),
385 ),
386 );
344 ]), // }
345 ),
346 }
347 .into(),
348 ),
349 );
387350 test_const = test_const.map(|mut tc| {
388351 tc.vis.kind = ast::VisibilityKind::Public;
389352 tc
compiler/rustc_builtin_macros/src/test_harness.rs+7-7
......@@ -6,21 +6,21 @@ use rustc_ast as ast;
66use rustc_ast::entry::EntryPointType;
77use rustc_ast::mut_visit::*;
88use rustc_ast::ptr::P;
9use rustc_ast::visit::{walk_item, Visitor};
10use rustc_ast::{attr, ModKind};
9use rustc_ast::visit::{Visitor, walk_item};
10use rustc_ast::{ModKind, attr};
1111use rustc_errors::DiagCtxtHandle;
1212use rustc_expand::base::{ExtCtxt, ResolverExpand};
1313use rustc_expand::expand::{AstFragment, ExpansionConfig};
1414use rustc_feature::Features;
1515use rustc_lint_defs::BuiltinLintDiag;
16use rustc_session::lint::builtin::UNNAMEABLE_TEST_ITEMS;
1716use rustc_session::Session;
17use rustc_session::lint::builtin::UNNAMEABLE_TEST_ITEMS;
1818use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency};
19use rustc_span::symbol::{sym, Ident, Symbol};
20use rustc_span::{Span, DUMMY_SP};
19use rustc_span::symbol::{Ident, Symbol, sym};
20use rustc_span::{DUMMY_SP, Span};
2121use rustc_target::spec::PanicStrategy;
22use smallvec::{smallvec, SmallVec};
23use thin_vec::{thin_vec, ThinVec};
22use smallvec::{SmallVec, smallvec};
23use thin_vec::{ThinVec, thin_vec};
2424use tracing::debug;
2525
2626use crate::errors;
compiler/rustc_builtin_macros/src/trace_macros.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_ast::tokenstream::{TokenStream, TokenTree};
22use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
3use rustc_span::symbol::kw;
43use rustc_span::Span;
4use rustc_span::symbol::kw;
55
66use crate::errors;
77
compiler/rustc_builtin_macros/src/util.rs+2-2
......@@ -1,12 +1,12 @@
11use rustc_ast::ptr::P;
22use rustc_ast::tokenstream::TokenStream;
3use rustc_ast::{self as ast, attr, token, AttrStyle, Attribute, MetaItem};
3use rustc_ast::{self as ast, AttrStyle, Attribute, MetaItem, attr, token};
44use rustc_errors::{Applicability, Diag, ErrorGuaranteed};
55use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt};
66use rustc_expand::expand::AstFragment;
77use rustc_feature::AttributeTemplate;
8use rustc_lint_defs::builtin::DUPLICATE_MACRO_ATTRIBUTES;
98use rustc_lint_defs::BuiltinLintDiag;
9use rustc_lint_defs::builtin::DUPLICATE_MACRO_ATTRIBUTES;
1010use rustc_parse::{parser, validate_attr};
1111use rustc_session::errors::report_lit_error;
1212use rustc_span::{BytePos, Span, Symbol};
compiler/rustc_codegen_cranelift/build_system/abi_cafe.rs+2-2
......@@ -1,7 +1,7 @@
11use crate::path::{Dirs, RelPath};
22use crate::prepare::GitRepo;
3use crate::utils::{spawn_and_wait, CargoProject, Compiler};
4use crate::{build_sysroot, CodegenBackend, SysrootKind};
3use crate::utils::{CargoProject, Compiler, spawn_and_wait};
4use crate::{CodegenBackend, SysrootKind, build_sysroot};
55
66static ABI_CAFE_REPO: GitRepo = GitRepo::github(
77 "Gankra",
compiler/rustc_codegen_cranelift/build_system/bench.rs+1-1
......@@ -5,7 +5,7 @@ use std::path::Path;
55use crate::path::{Dirs, RelPath};
66use crate::prepare::GitRepo;
77use crate::rustc_info::get_file_name;
8use crate::utils::{hyperfine_command, spawn_and_wait, Compiler};
8use crate::utils::{Compiler, hyperfine_command, spawn_and_wait};
99
1010static SIMPLE_RAYTRACER_REPO: GitRepo = GitRepo::github(
1111 "ebobby",
compiler/rustc_codegen_cranelift/build_system/build_sysroot.rs+2-2
......@@ -5,9 +5,9 @@ use std::{env, fs};
55use crate::path::{Dirs, RelPath};
66use crate::rustc_info::get_file_name;
77use crate::utils::{
8 remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler, LogGroup,
8 CargoProject, Compiler, LogGroup, remove_dir_if_exists, spawn_and_wait, try_hard_link,
99};
10use crate::{config, CodegenBackend, SysrootKind};
10use crate::{CodegenBackend, SysrootKind, config};
1111
1212static DIST_DIR: RelPath = RelPath::DIST;
1313static BIN_DIR: RelPath = RelPath::DIST.join("bin");
compiler/rustc_codegen_cranelift/build_system/tests.rs+3-3
......@@ -4,11 +4,11 @@ use std::path::PathBuf;
44use std::process::Command;
55
66use crate::path::{Dirs, RelPath};
7use crate::prepare::{apply_patches, GitRepo};
7use crate::prepare::{GitRepo, apply_patches};
88use crate::rustc_info::get_default_sysroot;
99use crate::shared_utils::rustflags_from_env;
10use crate::utils::{spawn_and_wait, CargoProject, Compiler, LogGroup};
11use crate::{build_sysroot, config, CodegenBackend, SysrootKind};
10use crate::utils::{CargoProject, Compiler, LogGroup, spawn_and_wait};
11use crate::{CodegenBackend, SysrootKind, build_sysroot, config};
1212
1313static BUILD_EXAMPLE_OUT_DIR: RelPath = RelPath::BUILD.join("example");
1414
compiler/rustc_codegen_cranelift/example/std_example.rs+3-4
......@@ -238,10 +238,9 @@ unsafe fn test_simd() {
238238 let (zero0, zero1) = std::mem::transmute::<_, (u64, u64)>(x);
239239 assert_eq!((zero0, zero1), (0, 0));
240240 assert_eq!(std::mem::transmute::<_, [u16; 8]>(or), [7, 7, 7, 7, 7, 7, 7, 7]);
241 assert_eq!(
242 std::mem::transmute::<_, [u16; 8]>(cmp_eq),
243 [0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff]
244 );
241 assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_eq), [
242 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff
243 ]);
245244 assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_lt), [0, 0, 0, 0, 0, 0, 0, 0]);
246245
247246 test_mm_slli_si128();
compiler/rustc_codegen_cranelift/src/abi/mod.rs+1-1
......@@ -13,9 +13,9 @@ use cranelift_module::ModuleError;
1313use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
1414use rustc_codegen_ssa::errors::CompilerBuiltinsCannotCall;
1515use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
16use rustc_middle::ty::TypeVisitableExt;
1617use rustc_middle::ty::layout::FnAbiOf;
1718use rustc_middle::ty::print::with_no_trimmed_paths;
18use rustc_middle::ty::TypeVisitableExt;
1919use rustc_session::Session;
2020use rustc_span::source_map::Spanned;
2121use rustc_target::abi::call::{Conv, FnAbi, PassMode};
compiler/rustc_codegen_cranelift/src/abi/pass_mode.rs+1-1
......@@ -4,7 +4,7 @@ use cranelift_codegen::ir::{ArgumentExtension, ArgumentPurpose};
44use rustc_target::abi::call::{
55 ArgAbi, ArgAttributes, ArgExtension as RustcArgExtension, CastTarget, PassMode, Reg, RegKind,
66};
7use smallvec::{smallvec, SmallVec};
7use smallvec::{SmallVec, smallvec};
88
99use crate::prelude::*;
1010use crate::value_and_place::assert_assignable;
compiler/rustc_codegen_cranelift/src/abi/returning.rs+1-1
......@@ -1,7 +1,7 @@
11//! Return value handling
22
33use rustc_target::abi::call::{ArgAbi, PassMode};
4use smallvec::{smallvec, SmallVec};
4use smallvec::{SmallVec, smallvec};
55
66use crate::prelude::*;
77
compiler/rustc_codegen_cranelift/src/allocator.rs+2-2
......@@ -2,8 +2,8 @@
22// Adapted from rustc
33
44use rustc_ast::expand::allocator::{
5 alloc_error_handler_name, default_fn_name, global_fn_name, AllocatorKind, AllocatorTy,
6 ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE,
5 ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE,
6 alloc_error_handler_name, default_fn_name, global_fn_name,
77};
88use rustc_codegen_ssa::base::allocator_kind_for_codegen;
99use rustc_session::config::OomStrategy;
compiler/rustc_codegen_cranelift/src/base.rs+2-2
......@@ -1,17 +1,17 @@
11//! Codegen of a single function
22
3use cranelift_codegen::ir::UserFuncName;
43use cranelift_codegen::CodegenError;
4use cranelift_codegen::ir::UserFuncName;
55use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
66use cranelift_module::ModuleError;
77use rustc_ast::InlineAsmOptions;
88use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
99use rustc_index::IndexVec;
1010use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
11use rustc_middle::ty::TypeVisitableExt;
1112use rustc_middle::ty::adjustment::PointerCoercion;
1213use rustc_middle::ty::layout::FnAbiOf;
1314use rustc_middle::ty::print::with_no_trimmed_paths;
14use rustc_middle::ty::TypeVisitableExt;
1515
1616use crate::constant::ConstantCx;
1717use crate::debuginfo::{FunctionDebugContext, TypeDebugContext};
compiler/rustc_codegen_cranelift/src/common.rs+1-1
......@@ -1,10 +1,10 @@
11use cranelift_codegen::isa::TargetFrontendConfig;
22use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
33use rustc_index::IndexVec;
4use rustc_middle::ty::TypeFoldable;
45use rustc_middle::ty::layout::{
56 self, FnAbiError, FnAbiOfHelpers, FnAbiRequest, LayoutError, LayoutOfHelpers,
67};
7use rustc_middle::ty::TypeFoldable;
88use rustc_span::source_map::Spanned;
99use rustc_target::abi::call::FnAbi;
1010use rustc_target::abi::{Float, Integer, Primitive};
compiler/rustc_codegen_cranelift/src/constant.rs+1-1
......@@ -5,7 +5,7 @@ use std::cmp::Ordering;
55use cranelift_module::*;
66use rustc_data_structures::fx::FxHashSet;
77use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
8use rustc_middle::mir::interpret::{read_target_uint, AllocId, GlobalAlloc, Scalar};
8use rustc_middle::mir::interpret::{AllocId, GlobalAlloc, Scalar, read_target_uint};
99use rustc_middle::ty::{Binder, ExistentialTraitRef, ScalarInt};
1010
1111use crate::prelude::*;
compiler/rustc_codegen_cranelift/src/debuginfo/emit.rs+1-1
......@@ -6,8 +6,8 @@ use gimli::write::{Address, AttributeValue, EndianVec, Result, Sections, Writer}
66use gimli::{RunTimeEndian, SectionId};
77use rustc_data_structures::fx::FxHashMap;
88
9use super::object::WriteDebugInfo;
109use super::DebugContext;
10use super::object::WriteDebugInfo;
1111
1212pub(super) fn address_for_func(func_id: FuncId) -> Address {
1313 let symbol = func_id.as_u32();
compiler/rustc_codegen_cranelift/src/debuginfo/line_info.rs+3-3
......@@ -3,15 +3,15 @@
33use std::ffi::OsStr;
44use std::path::{Component, Path};
55
6use cranelift_codegen::binemit::CodeOffset;
76use cranelift_codegen::MachSrcLoc;
7use cranelift_codegen::binemit::CodeOffset;
88use gimli::write::{AttributeValue, FileId, FileInfo, LineProgram, LineString, LineStringTable};
99use rustc_span::{
10 hygiene, FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm,
10 FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm, hygiene,
1111};
1212
13use crate::debuginfo::emit::address_for_func;
1413use crate::debuginfo::FunctionDebugContext;
14use crate::debuginfo::emit::address_for_func;
1515use crate::prelude::*;
1616
1717// OPTIMIZATION: It is cheaper to do this in one pass than using `.parent()` and `.file_name()`.
compiler/rustc_codegen_cranelift/src/debuginfo/object.rs+9-12
......@@ -73,19 +73,16 @@ impl WriteDebugInfo for ObjectProduct {
7373 }
7474 };
7575 self.object
76 .add_relocation(
77 from.0,
78 Relocation {
79 offset: u64::from(reloc.offset),
80 symbol,
81 flags: RelocationFlags::Generic {
82 kind: reloc.kind,
83 encoding: RelocationEncoding::Generic,
84 size: reloc.size * 8,
85 },
86 addend: i64::try_from(symbol_offset).unwrap() + reloc.addend,
76 .add_relocation(from.0, Relocation {
77 offset: u64::from(reloc.offset),
78 symbol,
79 flags: RelocationFlags::Generic {
80 kind: reloc.kind,
81 encoding: RelocationEncoding::Generic,
82 size: reloc.size * 8,
8783 },
88 )
84 addend: i64::try_from(symbol_offset).unwrap() + reloc.addend,
85 })
8986 .unwrap();
9087 }
9188}
compiler/rustc_codegen_cranelift/src/debuginfo/types.rs+1-1
......@@ -6,7 +6,7 @@ use rustc_data_structures::fx::FxHashMap;
66use rustc_middle::ty::layout::LayoutOf;
77use rustc_middle::ty::{self, Ty, TyCtxt};
88
9use crate::{has_ptr_meta, DebugContext, RevealAllLayoutCx};
9use crate::{DebugContext, RevealAllLayoutCx, has_ptr_meta};
1010
1111#[derive(Default)]
1212pub(crate) struct TypeDebugContext<'tcx> {
compiler/rustc_codegen_cranelift/src/debuginfo/unwind.rs+2-2
......@@ -1,11 +1,11 @@
11//! Unwind info generation (`.eh_frame`)
22
33use cranelift_codegen::ir::Endianness;
4use cranelift_codegen::isa::unwind::UnwindInfo;
54use cranelift_codegen::isa::TargetIsa;
5use cranelift_codegen::isa::unwind::UnwindInfo;
66use cranelift_object::ObjectProduct;
7use gimli::write::{CieId, EhFrame, FrameTable, Section};
87use gimli::RunTimeEndian;
8use gimli::write::{CieId, EhFrame, FrameTable, Section};
99
1010use super::emit::address_for_func;
1111use super::object::WriteDebugInfo;
compiler/rustc_codegen_cranelift/src/driver/aot.rs+5-5
......@@ -12,24 +12,24 @@ use rustc_codegen_ssa::back::link::ensure_removed;
1212use rustc_codegen_ssa::back::metadata::create_compressed_metadata_file;
1313use rustc_codegen_ssa::base::determine_cgu_reuse;
1414use rustc_codegen_ssa::{
15 errors as ssa_errors, CodegenResults, CompiledModule, CrateInfo, ModuleKind,
15 CodegenResults, CompiledModule, CrateInfo, ModuleKind, errors as ssa_errors,
1616};
1717use rustc_data_structures::profiling::SelfProfilerRef;
1818use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
19use rustc_data_structures::sync::{par_map, IntoDynSyncSend};
20use rustc_metadata::fs::copy_to_stdout;
19use rustc_data_structures::sync::{IntoDynSyncSend, par_map};
2120use rustc_metadata::EncodedMetadata;
21use rustc_metadata::fs::copy_to_stdout;
2222use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
2323use rustc_middle::mir::mono::{CodegenUnit, MonoItem};
24use rustc_session::config::{DebugInfo, OutFileName, OutputFilenames, OutputType};
2524use rustc_session::Session;
25use rustc_session::config::{DebugInfo, OutFileName, OutputFilenames, OutputType};
2626
27use crate::BackendConfig;
2728use crate::concurrency_limiter::{ConcurrencyLimiter, ConcurrencyLimiterToken};
2829use crate::debuginfo::TypeDebugContext;
2930use crate::global_asm::GlobalAsmConfig;
3031use crate::prelude::*;
3132use crate::unwind_module::UnwindModule;
32use crate::BackendConfig;
3333
3434struct ModuleCodegenResult {
3535 module_regular: CompiledModule,
compiler/rustc_codegen_cranelift/src/driver/jit.rs+6-10
......@@ -4,7 +4,7 @@
44use std::cell::RefCell;
55use std::ffi::CString;
66use std::os::raw::{c_char, c_int};
7use std::sync::{mpsc, Mutex, OnceLock};
7use std::sync::{Mutex, OnceLock, mpsc};
88
99use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
1010use cranelift_jit::{JITBuilder, JITModule};
......@@ -359,15 +359,11 @@ fn codegen_shim<'tcx>(
359359 let instance_ptr = Box::into_raw(Box::new(inst));
360360
361361 let jit_fn = module
362 .declare_function(
363 "__clif_jit_fn",
364 Linkage::Import,
365 &Signature {
366 call_conv: module.target_config().default_call_conv,
367 params: vec![AbiParam::new(pointer_type), AbiParam::new(pointer_type)],
368 returns: vec![AbiParam::new(pointer_type)],
369 },
370 )
362 .declare_function("__clif_jit_fn", Linkage::Import, &Signature {
363 call_conv: module.target_config().default_call_conv,
364 params: vec![AbiParam::new(pointer_type), AbiParam::new(pointer_type)],
365 returns: vec![AbiParam::new(pointer_type)],
366 })
371367 .unwrap();
372368
373369 let context = cached_context;
compiler/rustc_codegen_cranelift/src/inline_asm.rs+5-9
......@@ -869,15 +869,11 @@ fn call_inline_asm<'tcx>(
869869
870870 let inline_asm_func = fx
871871 .module
872 .declare_function(
873 asm_name,
874 Linkage::Import,
875 &Signature {
876 call_conv: CallConv::SystemV,
877 params: vec![AbiParam::new(fx.pointer_type)],
878 returns: vec![],
879 },
880 )
872 .declare_function(asm_name, Linkage::Import, &Signature {
873 call_conv: CallConv::SystemV,
874 params: vec![AbiParam::new(fx.pointer_type)],
875 returns: vec![],
876 })
881877 .unwrap();
882878 let inline_asm_func = fx.module.declare_func_in_func(inline_asm_func, fx.bcx.func);
883879 if fx.clif_comments.enabled() {
compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs+1-1
......@@ -3,7 +3,7 @@
33use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece};
44use rustc_target::asm::*;
55
6use crate::inline_asm::{codegen_inline_asm_inner, CInlineAsmOperand};
6use crate::inline_asm::{CInlineAsmOperand, codegen_inline_asm_inner};
77use crate::intrinsics::*;
88use crate::prelude::*;
99
compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs+2-2
......@@ -19,11 +19,11 @@ mod simd;
1919
2020use cranelift_codegen::ir::AtomicRmwOp;
2121use rustc_middle::ty;
22use rustc_middle::ty::GenericArgsRef;
2223use rustc_middle::ty::layout::{HasParamEnv, ValidityRequirement};
2324use rustc_middle::ty::print::{with_no_trimmed_paths, with_no_visible_paths};
24use rustc_middle::ty::GenericArgsRef;
2525use rustc_span::source_map::Spanned;
26use rustc_span::symbol::{sym, Symbol};
26use rustc_span::symbol::{Symbol, sym};
2727
2828pub(crate) use self::llvm::codegen_llvm_intrinsic_call;
2929use crate::cast::clif_intcast;
compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs+3-6
......@@ -574,12 +574,9 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
574574 (sym::simd_round, types::F64) => "round",
575575 _ => unreachable!("{:?}", intrinsic),
576576 };
577 fx.lib_call(
578 name,
579 vec![AbiParam::new(lane_ty)],
580 vec![AbiParam::new(lane_ty)],
581 &[lane],
582 )[0]
577 fx.lib_call(name, vec![AbiParam::new(lane_ty)], vec![AbiParam::new(lane_ty)], &[
578 lane,
579 ])[0]
583580 });
584581 }
585582
compiler/rustc_codegen_cranelift/src/lib.rs+7-7
......@@ -38,15 +38,15 @@ use std::sync::Arc;
3838
3939use cranelift_codegen::isa::TargetIsa;
4040use cranelift_codegen::settings::{self, Configurable};
41use rustc_codegen_ssa::traits::CodegenBackend;
4241use rustc_codegen_ssa::CodegenResults;
42use rustc_codegen_ssa::traits::CodegenBackend;
4343use rustc_data_structures::profiling::SelfProfilerRef;
4444use rustc_errors::ErrorGuaranteed;
4545use rustc_metadata::EncodedMetadata;
4646use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
47use rustc_session::config::OutputFilenames;
4847use rustc_session::Session;
49use rustc_span::{sym, Symbol};
48use rustc_session::config::OutputFilenames;
49use rustc_span::{Symbol, sym};
5050
5151pub use crate::config::*;
5252use crate::prelude::*;
......@@ -83,13 +83,13 @@ mod value_and_place;
8383mod vtable;
8484
8585mod prelude {
86 pub(crate) use cranelift_codegen::Context;
8687 pub(crate) use cranelift_codegen::ir::condcodes::{FloatCC, IntCC};
8788 pub(crate) use cranelift_codegen::ir::function::Function;
8889 pub(crate) use cranelift_codegen::ir::{
89 types, AbiParam, Block, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc,
90 StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value,
90 AbiParam, Block, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot,
91 StackSlotData, StackSlotKind, TrapCode, Type, Value, types,
9192 };
92 pub(crate) use cranelift_codegen::Context;
9393 pub(crate) use cranelift_module::{self, DataDescription, FuncId, Linkage, Module};
9494 pub(crate) use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
9595 pub(crate) use rustc_hir::def_id::{DefId, LOCAL_CRATE};
......@@ -100,7 +100,7 @@ mod prelude {
100100 self, FloatTy, Instance, InstanceKind, IntTy, ParamEnv, Ty, TyCtxt, UintTy,
101101 };
102102 pub(crate) use rustc_span::Span;
103 pub(crate) use rustc_target::abi::{Abi, FieldIdx, Scalar, Size, VariantIdx, FIRST_VARIANT};
103 pub(crate) use rustc_target::abi::{Abi, FIRST_VARIANT, FieldIdx, Scalar, Size, VariantIdx};
104104
105105 pub(crate) use crate::abi::*;
106106 pub(crate) use crate::base::{codegen_operand, codegen_place};
compiler/rustc_codegen_cranelift/src/main_shim.rs+6-9
......@@ -1,9 +1,9 @@
11use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext};
22use rustc_hir::LangItem;
33use rustc_middle::ty::{AssocKind, GenericArg};
4use rustc_session::config::{sigpipe, EntryFnType};
5use rustc_span::symbol::Ident;
4use rustc_session::config::{EntryFnType, sigpipe};
65use rustc_span::DUMMY_SP;
6use rustc_span::symbol::Ident;
77
88use crate::prelude::*;
99
......@@ -16,13 +16,10 @@ pub(crate) fn maybe_create_entry_wrapper(
1616 is_primary_cgu: bool,
1717) {
1818 let (main_def_id, (is_main_fn, sigpipe)) = match tcx.entry_fn(()) {
19 Some((def_id, entry_ty)) => (
20 def_id,
21 match entry_ty {
22 EntryFnType::Main { sigpipe } => (true, sigpipe),
23 EntryFnType::Start => (false, sigpipe::DEFAULT),
24 },
25 ),
19 Some((def_id, entry_ty)) => (def_id, match entry_ty {
20 EntryFnType::Main { sigpipe } => (true, sigpipe),
21 EntryFnType::Start => (false, sigpipe::DEFAULT),
22 }),
2623 None => return,
2724 };
2825
compiler/rustc_codegen_cranelift/src/pretty_clif.rs+1-1
......@@ -59,8 +59,8 @@ use std::fmt;
5959use std::io::Write;
6060
6161use cranelift_codegen::entity::SecondaryMap;
62use cranelift_codegen::ir::entities::AnyEntity;
6362use cranelift_codegen::ir::Fact;
63use cranelift_codegen::ir::entities::AnyEntity;
6464use cranelift_codegen::write::{FuncWriter, PlainWriter};
6565use rustc_middle::ty::layout::FnAbiOf;
6666use rustc_middle::ty::print::with_no_trimmed_paths;
compiler/rustc_codegen_cranelift/src/trap.rs+5-9
......@@ -5,15 +5,11 @@ use crate::prelude::*;
55fn codegen_print(fx: &mut FunctionCx<'_, '_, '_>, msg: &str) {
66 let puts = fx
77 .module
8 .declare_function(
9 "puts",
10 Linkage::Import,
11 &Signature {
12 call_conv: fx.target_config.default_call_conv,
13 params: vec![AbiParam::new(fx.pointer_type)],
14 returns: vec![AbiParam::new(types::I32)],
15 },
16 )
8 .declare_function("puts", Linkage::Import, &Signature {
9 call_conv: fx.target_config.default_call_conv,
10 params: vec![AbiParam::new(fx.pointer_type)],
11 returns: vec![AbiParam::new(types::I32)],
12 })
1713 .unwrap();
1814 let puts = fx.module.declare_func_in_func(puts, &mut fx.bcx.func);
1915 if fx.clif_comments.enabled() {
compiler/rustc_codegen_gcc/build_system/src/config.rs+1-1
......@@ -3,8 +3,8 @@ use std::ffi::OsStr;
33use std::path::{Path, PathBuf};
44use std::{env as std_env, fs};
55
6use boml::types::TomlValue;
76use boml::Toml;
7use boml::types::TomlValue;
88
99use crate::utils::{
1010 create_dir, create_symlink, get_os_name, get_sysroot_dir, run_command_with_output,
compiler/rustc_codegen_gcc/build_system/src/test.rs+1-1
......@@ -1,6 +1,6 @@
11use std::collections::HashMap;
22use std::ffi::OsStr;
3use std::fs::{remove_dir_all, File};
3use std::fs::{File, remove_dir_all};
44use std::io::{BufRead, BufReader};
55use std::path::{Path, PathBuf};
66use std::str::FromStr;
compiler/rustc_codegen_gcc/build_system/src/utils.rs+1-1
......@@ -1,7 +1,7 @@
11use std::collections::HashMap;
2use std::ffi::OsStr;
23#[cfg(unix)]
34use std::ffi::c_int;
4use std::ffi::OsStr;
55use std::fmt::Debug;
66use std::fs;
77#[cfg(unix)]
compiler/rustc_codegen_gcc/src/abi.rs+1-1
......@@ -4,8 +4,8 @@ use gccjit::{ToLValue, ToRValue, Type};
44use rustc_codegen_ssa::traits::{AbiBuilderMethods, BaseTypeCodegenMethods};
55use rustc_data_structures::fx::FxHashSet;
66use rustc_middle::bug;
7use rustc_middle::ty::layout::LayoutOf;
87use rustc_middle::ty::Ty;
8use rustc_middle::ty::layout::LayoutOf;
99#[cfg(feature = "master")]
1010use rustc_session::config;
1111use rustc_target::abi::call::{ArgAttributes, CastTarget, FnAbi, PassMode, Reg, RegKind};
compiler/rustc_codegen_gcc/src/allocator.rs+2-2
......@@ -2,8 +2,8 @@
22use gccjit::FnAttribute;
33use gccjit::{Context, FunctionType, GlobalKind, ToRValue, Type};
44use rustc_ast::expand::allocator::{
5 alloc_error_handler_name, default_fn_name, global_fn_name, AllocatorKind, AllocatorTy,
6 ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE,
5 ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE,
6 alloc_error_handler_name, default_fn_name, global_fn_name,
77};
88use rustc_middle::bug;
99use rustc_middle::ty::TyCtxt;
compiler/rustc_codegen_gcc/src/back/lto.rs+3-3
......@@ -27,7 +27,7 @@ use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModul
2727use rustc_codegen_ssa::back::symbol_export;
2828use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput};
2929use rustc_codegen_ssa::traits::*;
30use rustc_codegen_ssa::{looks_like_rust_object_file, ModuleCodegen, ModuleKind};
30use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file};
3131use rustc_data_structures::memmap::Mmap;
3232use rustc_errors::{DiagCtxtHandle, FatalError};
3333use rustc_hir::def_id::LOCAL_CRATE;
......@@ -35,11 +35,11 @@ use rustc_middle::bug;
3535use rustc_middle::dep_graph::WorkProduct;
3636use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel};
3737use rustc_session::config::{CrateType, Lto};
38use tempfile::{tempdir, TempDir};
38use tempfile::{TempDir, tempdir};
3939
4040use crate::back::write::save_temp_bitcode;
4141use crate::errors::{DynamicLinkingWithLTO, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib};
42use crate::{to_gcc_opt_level, GccCodegenBackend, GccContext, SyncContext};
42use crate::{GccCodegenBackend, GccContext, SyncContext, to_gcc_opt_level};
4343
4444/// We keep track of the computed LTO cache keys from the previous
4545/// session to determine which CGUs we can reuse.
compiler/rustc_codegen_gcc/src/base.rs+1-1
......@@ -19,7 +19,7 @@ use rustc_target::spec::PanicStrategy;
1919
2020use crate::builder::Builder;
2121use crate::context::CodegenCx;
22use crate::{gcc_util, new_context, GccContext, LockedTargetInfo, SyncContext};
22use crate::{GccContext, LockedTargetInfo, SyncContext, gcc_util, new_context};
2323
2424#[cfg(feature = "master")]
2525pub fn visibility_to_gcc(linkage: Visibility) -> gccjit::Visibility {
compiler/rustc_codegen_gcc/src/builder.rs+15-14
......@@ -7,7 +7,8 @@ use gccjit::{
77 BinaryOp, Block, ComparisonOp, Context, Function, LValue, Location, RValue, ToRValue, Type,
88 UnaryOp,
99};
10use rustc_apfloat::{ieee, Float, Round, Status};
10use rustc_apfloat::{Float, Round, Status, ieee};
11use rustc_codegen_ssa::MemFlags;
1112use rustc_codegen_ssa::common::{
1213 AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope, TypeKind,
1314};
......@@ -17,7 +18,6 @@ use rustc_codegen_ssa::traits::{
1718 BackendTypes, BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods,
1819 LayoutTypeCodegenMethods, OverflowOp, StaticBuilderMethods,
1920};
20use rustc_codegen_ssa::MemFlags;
2121use rustc_data_structures::fx::FxHashSet;
2222use rustc_middle::bug;
2323use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
......@@ -25,13 +25,13 @@ use rustc_middle::ty::layout::{
2525 FnAbiError, FnAbiOfHelpers, FnAbiRequest, HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers,
2626};
2727use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt};
28use rustc_span::def_id::DefId;
2928use rustc_span::Span;
29use rustc_span::def_id::DefId;
3030use rustc_target::abi::call::FnAbi;
3131use rustc_target::abi::{self, Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
3232use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, WasmCAbi};
3333
34use crate::common::{type_is_pointer, SignType, TypeReflection};
34use crate::common::{SignType, TypeReflection, type_is_pointer};
3535use crate::context::CodegenCx;
3636use crate::intrinsic::llvm;
3737use crate::type_of::LayoutGccExt;
......@@ -152,11 +152,14 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
152152 // NOTE: not sure why, but we have the wrong type here.
153153 let int_type = compare_exchange.get_param(2).to_rvalue().get_type();
154154 let src = self.context.new_bitcast(self.location, src, int_type);
155 self.context.new_call(
156 self.location,
157 compare_exchange,
158 &[dst, expected, src, weak, order, failure_order],
159 )
155 self.context.new_call(self.location, compare_exchange, &[
156 dst,
157 expected,
158 src,
159 weak,
160 order,
161 failure_order,
162 ])
160163 }
161164
162165 pub fn assign(&self, lvalue: LValue<'gcc>, value: RValue<'gcc>) {
......@@ -1079,11 +1082,9 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10791082 let align = dest.val.align.restrict_for_offset(dest.layout.field(self.cx(), 0).size);
10801083 cg_elem.val.store(self, PlaceRef::new_sized_aligned(current_val, cg_elem.layout, align));
10811084
1082 let next = self.inbounds_gep(
1083 self.backend_type(cg_elem.layout),
1084 current.to_rvalue(),
1085 &[self.const_usize(1)],
1086 );
1085 let next = self.inbounds_gep(self.backend_type(cg_elem.layout), current.to_rvalue(), &[
1086 self.const_usize(1),
1087 ]);
10871088 self.llbb().add_assignment(self.location, current, next);
10881089 self.br(header_bb);
10891090
compiler/rustc_codegen_gcc/src/common.rs+1-1
......@@ -2,8 +2,8 @@ use gccjit::{LValue, RValue, ToRValue, Type};
22use rustc_codegen_ssa::traits::{
33 BaseTypeCodegenMethods, ConstCodegenMethods, MiscCodegenMethods, StaticCodegenMethods,
44};
5use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
65use rustc_middle::mir::Mutability;
6use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
77use rustc_middle::ty::layout::LayoutOf;
88use rustc_target::abi::{self, HasDataLayout, Pointer};
99
compiler/rustc_codegen_gcc/src/consts.rs+1-1
......@@ -7,7 +7,7 @@ use rustc_codegen_ssa::traits::{
77use rustc_hir::def::DefKind;
88use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
99use rustc_middle::mir::interpret::{
10 self, read_target_uint, ConstAllocation, ErrorHandled, Scalar as InterpScalar,
10 self, ConstAllocation, ErrorHandled, Scalar as InterpScalar, read_target_uint,
1111};
1212use rustc_middle::ty::layout::LayoutOf;
1313use rustc_middle::ty::{self, Instance};
compiler/rustc_codegen_gcc/src/context.rs+2-2
......@@ -6,7 +6,7 @@ use gccjit::{
66use rustc_codegen_ssa::base::wants_msvc_seh;
77use rustc_codegen_ssa::errors as ssa_errors;
88use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeCodegenMethods, MiscCodegenMethods};
9use rustc_data_structures::base_n::{ToBaseN, ALPHANUMERIC_ONLY};
9use rustc_data_structures::base_n::{ALPHANUMERIC_ONLY, ToBaseN};
1010use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1111use rustc_middle::mir::mono::CodegenUnit;
1212use rustc_middle::span_bug;
......@@ -17,7 +17,7 @@ use rustc_middle::ty::layout::{
1717use rustc_middle::ty::{self, Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
1818use rustc_session::Session;
1919use rustc_span::source_map::respan;
20use rustc_span::{Span, DUMMY_SP};
20use rustc_span::{DUMMY_SP, Span};
2121use rustc_target::abi::{HasDataLayout, PointeeInfo, Size, TargetDataLayout, VariantIdx};
2222use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, TlsModel, WasmCAbi};
2323
compiler/rustc_codegen_gcc/src/debuginfo.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_middle::mir::{self, Body, SourceScope};
1010use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
1111use rustc_session::config::DebugInfo;
1212use rustc_span::{BytePos, Pos, SourceFile, SourceFileAndLine, Span, Symbol};
13use rustc_target::abi::call::FnAbi;
1413use rustc_target::abi::Size;
14use rustc_target::abi::call::FnAbi;
1515
1616use crate::builder::Builder;
1717use crate::context::CodegenCx;
compiler/rustc_codegen_gcc/src/gcc_util.rs+1-1
......@@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxHashMap;
44use rustc_middle::bug;
55use rustc_session::Session;
66use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES;
7use smallvec::{smallvec, SmallVec};
7use smallvec::{SmallVec, smallvec};
88
99use crate::errors::{
1010 PossibleFeature, TargetFeatureDisableOrEnable, UnknownCTargetFeature,
compiler/rustc_codegen_gcc/src/int.rs+9-11
......@@ -6,8 +6,8 @@ use gccjit::{BinaryOp, ComparisonOp, FunctionType, Location, RValue, ToRValue, T
66use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
77use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeCodegenMethods, BuilderMethods, OverflowOp};
88use rustc_middle::ty::{ParamEnv, Ty};
9use rustc_target::abi::call::{ArgAbi, ArgAttributes, Conv, FnAbi, PassMode};
109use rustc_target::abi::Endian;
10use rustc_target::abi::call::{ArgAbi, ArgAttributes, Conv, FnAbi, PassMode};
1111use rustc_target::spec;
1212
1313use crate::builder::{Builder, ToGccComp};
......@@ -395,11 +395,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
395395
396396 let indirect = matches!(fn_abi.ret.mode, PassMode::Indirect { .. });
397397
398 let return_type = self.context.new_struct_type(
399 self.location,
400 "result_overflow",
401 &[result_field, overflow_field],
402 );
398 let return_type = self
399 .context
400 .new_struct_type(self.location, "result_overflow", &[result_field, overflow_field]);
403401 let result = if indirect {
404402 let return_value =
405403 self.current_func().new_local(self.location, return_type.as_type(), "return_value");
......@@ -416,11 +414,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
416414 );
417415 self.llbb().add_eval(
418416 self.location,
419 self.context.new_call(
420 self.location,
421 func,
422 &[return_value.get_address(self.location), lhs, rhs],
423 ),
417 self.context.new_call(self.location, func, &[
418 return_value.get_address(self.location),
419 lhs,
420 rhs,
421 ]),
424422 );
425423 return_value.to_rvalue()
426424 } else {
compiler/rustc_codegen_gcc/src/intrinsic/llvm.rs+10-12
......@@ -511,12 +511,11 @@ pub fn adjust_intrinsic_return_value<'a, 'gcc, 'tcx>(
511511 let field2 = builder.context.new_field(None, args[1].get_type(), "carryResult");
512512 let struct_type =
513513 builder.context.new_struct_type(None, "addcarryResult", &[field1, field2]);
514 return_value = builder.context.new_struct_constructor(
515 None,
516 struct_type.as_type(),
517 None,
518 &[return_value, last_arg.dereference(None).to_rvalue()],
519 );
514 return_value =
515 builder.context.new_struct_constructor(None, struct_type.as_type(), None, &[
516 return_value,
517 last_arg.dereference(None).to_rvalue(),
518 ]);
520519 }
521520 }
522521 "__builtin_ia32_stmxcsr" => {
......@@ -541,12 +540,11 @@ pub fn adjust_intrinsic_return_value<'a, 'gcc, 'tcx>(
541540 let field2 = builder.context.new_field(None, return_value.get_type(), "success");
542541 let struct_type =
543542 builder.context.new_struct_type(None, "rdrand_result", &[field1, field2]);
544 return_value = builder.context.new_struct_constructor(
545 None,
546 struct_type.as_type(),
547 None,
548 &[random_number, success_variable.to_rvalue()],
549 );
543 return_value =
544 builder.context.new_struct_constructor(None, struct_type.as_type(), None, &[
545 random_number,
546 success_variable.to_rvalue(),
547 ]);
550548 }
551549 _ => (),
552550 }
compiler/rustc_codegen_gcc/src/intrinsic/mod.rs+4-4
......@@ -7,6 +7,7 @@ use std::iter;
77#[cfg(feature = "master")]
88use gccjit::FunctionType;
99use gccjit::{ComparisonOp, Function, RValue, ToRValue, Type, UnaryOp};
10use rustc_codegen_ssa::MemFlags;
1011use rustc_codegen_ssa::base::wants_msvc_seh;
1112use rustc_codegen_ssa::common::IntPredicate;
1213use rustc_codegen_ssa::errors::InvalidMonomorphization;
......@@ -17,18 +18,17 @@ use rustc_codegen_ssa::traits::{
1718};
1819#[cfg(feature = "master")]
1920use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, MiscCodegenMethods};
20use rustc_codegen_ssa::MemFlags;
2121use rustc_middle::bug;
2222use rustc_middle::ty::layout::LayoutOf;
2323#[cfg(feature = "master")]
2424use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt};
2525use rustc_middle::ty::{self, Instance, Ty};
26use rustc_span::{sym, Span, Symbol};
27use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
26use rustc_span::{Span, Symbol, sym};
2827use rustc_target::abi::HasDataLayout;
28use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode};
29use rustc_target::spec::PanicStrategy;
2930#[cfg(feature = "master")]
3031use rustc_target::spec::abi::Abi;
31use rustc_target::spec::PanicStrategy;
3232
3333#[cfg(feature = "master")]
3434use crate::abi::FnAbiGccExt;
compiler/rustc_codegen_gcc/src/intrinsic/simd.rs+230-238
......@@ -16,7 +16,7 @@ use rustc_hir as hir;
1616use rustc_middle::mir::BinOp;
1717use rustc_middle::ty::layout::HasTyCtxt;
1818use rustc_middle::ty::{self, Ty};
19use rustc_span::{sym, Span, Symbol};
19use rustc_span::{Span, Symbol, sym};
2020use rustc_target::abi::{Align, Size};
2121
2222use crate::builder::Builder;
......@@ -60,10 +60,11 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
6060 let arg_tys = sig.inputs();
6161
6262 if name == sym::simd_select_bitmask {
63 require_simd!(
64 arg_tys[1],
65 InvalidMonomorphization::SimdArgument { span, name, ty: arg_tys[1] }
66 );
63 require_simd!(arg_tys[1], InvalidMonomorphization::SimdArgument {
64 span,
65 name,
66 ty: arg_tys[1]
67 });
6768 let (len, _) = arg_tys[1].simd_size_and_type(bx.tcx());
6869
6970 let expected_int_bits = (len.max(8) - 1).next_power_of_two();
......@@ -135,17 +136,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
135136 require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty });
136137
137138 let (out_len, out_ty) = ret_ty.simd_size_and_type(bx.tcx());
138 require!(
139 in_len == out_len,
140 InvalidMonomorphization::ReturnLengthInputType {
141 span,
142 name,
143 in_len,
144 in_ty,
145 ret_ty,
146 out_len
147 }
148 );
139 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
140 span,
141 name,
142 in_len,
143 in_ty,
144 ret_ty,
145 out_len
146 });
149147 require!(
150148 bx.type_kind(bx.element_type(llret_ty)) == TypeKind::Integer,
151149 InvalidMonomorphization::ReturnIntegerType { span, name, ret_ty, out_ty }
......@@ -251,17 +249,23 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
251249 let lo_nibble =
252250 bx.context.new_rvalue_from_vector(None, long_byte_vector_type, &lo_nibble_elements);
253251
254 let mask = bx.context.new_rvalue_from_vector(
255 None,
256 long_byte_vector_type,
257 &vec![bx.context.new_rvalue_from_int(bx.u8_type, 0x0f); byte_vector_type_size as _],
258 );
259
260 let four_vec = bx.context.new_rvalue_from_vector(
261 None,
262 long_byte_vector_type,
263 &vec![bx.context.new_rvalue_from_int(bx.u8_type, 4); byte_vector_type_size as _],
264 );
252 let mask = bx.context.new_rvalue_from_vector(None, long_byte_vector_type, &vec![
253 bx.context
254 .new_rvalue_from_int(
255 bx.u8_type, 0x0f
256 );
257 byte_vector_type_size
258 as _
259 ]);
260
261 let four_vec = bx.context.new_rvalue_from_vector(None, long_byte_vector_type, &vec![
262 bx.context
263 .new_rvalue_from_int(
264 bx.u8_type, 4
265 );
266 byte_vector_type_size
267 as _
268 ]);
265269
266270 // Step 2: Byte-swap the input.
267271 let swapped = simd_bswap(bx, args[0].immediate());
......@@ -364,14 +368,21 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
364368 require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty });
365369
366370 let (out_len, out_ty) = ret_ty.simd_size_and_type(bx.tcx());
367 require!(
368 out_len == n,
369 InvalidMonomorphization::ReturnLength { span, name, in_len: n, ret_ty, out_len }
370 );
371 require!(
372 in_elem == out_ty,
373 InvalidMonomorphization::ReturnElement { span, name, in_elem, in_ty, ret_ty, out_ty }
374 );
371 require!(out_len == n, InvalidMonomorphization::ReturnLength {
372 span,
373 name,
374 in_len: n,
375 ret_ty,
376 out_len
377 });
378 require!(in_elem == out_ty, InvalidMonomorphization::ReturnElement {
379 span,
380 name,
381 in_elem,
382 in_ty,
383 ret_ty,
384 out_ty
385 });
375386
376387 let vector = args[2].immediate();
377388
......@@ -380,16 +391,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
380391
381392 #[cfg(feature = "master")]
382393 if name == sym::simd_insert {
383 require!(
384 in_elem == arg_tys[2],
385 InvalidMonomorphization::InsertedType {
386 span,
387 name,
388 in_elem,
389 in_ty,
390 out_ty: arg_tys[2]
391 }
392 );
394 require!(in_elem == arg_tys[2], InvalidMonomorphization::InsertedType {
395 span,
396 name,
397 in_elem,
398 in_ty,
399 out_ty: arg_tys[2]
400 });
393401 let vector = args[0].immediate();
394402 let index = args[1].immediate();
395403 let value = args[2].immediate();
......@@ -403,10 +411,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
403411
404412 #[cfg(feature = "master")]
405413 if name == sym::simd_extract {
406 require!(
407 ret_ty == in_elem,
408 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
409 );
414 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
415 span,
416 name,
417 in_elem,
418 in_ty,
419 ret_ty
420 });
410421 let vector = args[0].immediate();
411422 return Ok(bx.context.new_vector_access(None, vector, args[1].immediate()).to_rvalue());
412423 }
......@@ -414,15 +425,18 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
414425 if name == sym::simd_select {
415426 let m_elem_ty = in_elem;
416427 let m_len = in_len;
417 require_simd!(
418 arg_tys[1],
419 InvalidMonomorphization::SimdArgument { span, name, ty: arg_tys[1] }
420 );
428 require_simd!(arg_tys[1], InvalidMonomorphization::SimdArgument {
429 span,
430 name,
431 ty: arg_tys[1]
432 });
421433 let (v_len, _) = arg_tys[1].simd_size_and_type(bx.tcx());
422 require!(
423 m_len == v_len,
424 InvalidMonomorphization::MismatchedLengths { span, name, m_len, v_len }
425 );
434 require!(m_len == v_len, InvalidMonomorphization::MismatchedLengths {
435 span,
436 name,
437 m_len,
438 v_len
439 });
426440 match *m_elem_ty.kind() {
427441 ty::Int(_) => {}
428442 _ => return_error!(InvalidMonomorphization::MaskType { span, name, ty: m_elem_ty }),
......@@ -434,27 +448,25 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
434448 require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty });
435449 let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
436450
437 require!(
438 in_len == out_len,
439 InvalidMonomorphization::ReturnLengthInputType {
440 span,
441 name,
442 in_len,
443 in_ty,
444 ret_ty,
445 out_len
446 }
447 );
451 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
452 span,
453 name,
454 in_len,
455 in_ty,
456 ret_ty,
457 out_len
458 });
448459
449460 match *in_elem.kind() {
450461 ty::RawPtr(p_ty, _) => {
451462 let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
452463 bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
453464 });
454 require!(
455 metadata.is_unit(),
456 InvalidMonomorphization::CastFatPointer { span, name, ty: in_elem }
457 );
465 require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
466 span,
467 name,
468 ty: in_elem
469 });
458470 }
459471 _ => {
460472 return_error!(InvalidMonomorphization::ExpectedPointer { span, name, ty: in_elem })
......@@ -465,10 +477,11 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
465477 let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
466478 bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
467479 });
468 require!(
469 metadata.is_unit(),
470 InvalidMonomorphization::CastFatPointer { span, name, ty: out_elem }
471 );
480 require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
481 span,
482 name,
483 ty: out_elem
484 });
472485 }
473486 _ => {
474487 return_error!(InvalidMonomorphization::ExpectedPointer { span, name, ty: out_elem })
......@@ -491,17 +504,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
491504 require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty });
492505 let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
493506
494 require!(
495 in_len == out_len,
496 InvalidMonomorphization::ReturnLengthInputType {
497 span,
498 name,
499 in_len,
500 in_ty,
501 ret_ty,
502 out_len
503 }
504 );
507 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
508 span,
509 name,
510 in_len,
511 in_ty,
512 ret_ty,
513 out_len
514 });
505515
506516 match *in_elem.kind() {
507517 ty::RawPtr(_, _) => {}
......@@ -530,17 +540,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
530540 require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty });
531541 let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
532542
533 require!(
534 in_len == out_len,
535 InvalidMonomorphization::ReturnLengthInputType {
536 span,
537 name,
538 in_len,
539 in_ty,
540 ret_ty,
541 out_len
542 }
543 );
543 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
544 span,
545 name,
546 in_len,
547 in_ty,
548 ret_ty,
549 out_len
550 });
544551
545552 match *in_elem.kind() {
546553 ty::Uint(ty::UintTy::Usize) => {}
......@@ -569,17 +576,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
569576 if name == sym::simd_cast || name == sym::simd_as {
570577 require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty });
571578 let (out_len, out_elem) = ret_ty.simd_size_and_type(bx.tcx());
572 require!(
573 in_len == out_len,
574 InvalidMonomorphization::ReturnLengthInputType {
575 span,
576 name,
577 in_len,
578 in_ty,
579 ret_ty,
580 out_len
581 }
582 );
579 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
580 span,
581 name,
582 in_len,
583 in_ty,
584 ret_ty,
585 out_len
586 });
583587 // casting cares about nominal type, not just structural type
584588 if in_elem == out_elem {
585589 return Ok(args[0].immediate());
......@@ -605,17 +609,14 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
605609
606610 match (in_style, out_style) {
607611 (Style::Unsupported, Style::Unsupported) => {
608 require!(
609 false,
610 InvalidMonomorphization::UnsupportedCast {
611 span,
612 name,
613 in_ty,
614 in_elem,
615 ret_ty,
616 out_elem
617 }
618 );
612 require!(false, InvalidMonomorphization::UnsupportedCast {
613 span,
614 name,
615 in_ty,
616 in_elem,
617 ret_ty,
618 out_elem
619 });
619620 }
620621 _ => return Ok(bx.context.convert_vector(None, args[0].immediate(), llret_ty)),
621622 }
......@@ -880,47 +881,45 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
880881
881882 // All types must be simd vector types
882883 require_simd!(in_ty, InvalidMonomorphization::SimdFirst { span, name, ty: in_ty });
883 require_simd!(
884 arg_tys[1],
885 InvalidMonomorphization::SimdSecond { span, name, ty: arg_tys[1] }
886 );
887 require_simd!(
888 arg_tys[2],
889 InvalidMonomorphization::SimdThird { span, name, ty: arg_tys[2] }
890 );
884 require_simd!(arg_tys[1], InvalidMonomorphization::SimdSecond {
885 span,
886 name,
887 ty: arg_tys[1]
888 });
889 require_simd!(arg_tys[2], InvalidMonomorphization::SimdThird {
890 span,
891 name,
892 ty: arg_tys[2]
893 });
891894 require_simd!(ret_ty, InvalidMonomorphization::SimdReturn { span, name, ty: ret_ty });
892895
893896 // Of the same length:
894897 let (out_len, _) = arg_tys[1].simd_size_and_type(bx.tcx());
895898 let (out_len2, _) = arg_tys[2].simd_size_and_type(bx.tcx());
896 require!(
897 in_len == out_len,
898 InvalidMonomorphization::SecondArgumentLength {
899 span,
900 name,
901 in_len,
902 in_ty,
903 arg_ty: arg_tys[1],
904 out_len
905 }
906 );
907 require!(
908 in_len == out_len2,
909 InvalidMonomorphization::ThirdArgumentLength {
910 span,
911 name,
912 in_len,
913 in_ty,
914 arg_ty: arg_tys[2],
915 out_len: out_len2
916 }
917 );
899 require!(in_len == out_len, InvalidMonomorphization::SecondArgumentLength {
900 span,
901 name,
902 in_len,
903 in_ty,
904 arg_ty: arg_tys[1],
905 out_len
906 });
907 require!(in_len == out_len2, InvalidMonomorphization::ThirdArgumentLength {
908 span,
909 name,
910 in_len,
911 in_ty,
912 arg_ty: arg_tys[2],
913 out_len: out_len2
914 });
918915
919916 // The return type must match the first argument type
920 require!(
921 ret_ty == in_ty,
922 InvalidMonomorphization::ExpectedReturnType { span, name, in_ty, ret_ty }
923 );
917 require!(ret_ty == in_ty, InvalidMonomorphization::ExpectedReturnType {
918 span,
919 name,
920 in_ty,
921 ret_ty
922 });
924923
925924 // This counts how many pointers
926925 fn ptr_count(t: Ty<'_>) -> usize {
......@@ -947,18 +946,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
947946 (ptr_count(element_ty1), non_ptr(element_ty1))
948947 }
949948 _ => {
950 require!(
951 false,
952 InvalidMonomorphization::ExpectedElementType {
953 span,
954 name,
955 expected_element: element_ty1,
956 second_arg: arg_tys[1],
957 in_elem,
958 in_ty,
959 mutability: ExpectedPointerMutability::Not,
960 }
961 );
949 require!(false, InvalidMonomorphization::ExpectedElementType {
950 span,
951 name,
952 expected_element: element_ty1,
953 second_arg: arg_tys[1],
954 in_elem,
955 in_ty,
956 mutability: ExpectedPointerMutability::Not,
957 });
962958 unreachable!();
963959 }
964960 };
......@@ -971,15 +967,12 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
971967 match *element_ty2.kind() {
972968 ty::Int(_) => (),
973969 _ => {
974 require!(
975 false,
976 InvalidMonomorphization::ThirdArgElementType {
977 span,
978 name,
979 expected_element: element_ty2,
980 third_arg: arg_tys[2]
981 }
982 );
970 require!(false, InvalidMonomorphization::ThirdArgElementType {
971 span,
972 name,
973 expected_element: element_ty2,
974 third_arg: arg_tys[2]
975 });
983976 }
984977 }
985978
......@@ -1003,40 +996,36 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
1003996
1004997 // All types must be simd vector types
1005998 require_simd!(in_ty, InvalidMonomorphization::SimdFirst { span, name, ty: in_ty });
1006 require_simd!(
1007 arg_tys[1],
1008 InvalidMonomorphization::SimdSecond { span, name, ty: arg_tys[1] }
1009 );
1010 require_simd!(
1011 arg_tys[2],
1012 InvalidMonomorphization::SimdThird { span, name, ty: arg_tys[2] }
1013 );
999 require_simd!(arg_tys[1], InvalidMonomorphization::SimdSecond {
1000 span,
1001 name,
1002 ty: arg_tys[1]
1003 });
1004 require_simd!(arg_tys[2], InvalidMonomorphization::SimdThird {
1005 span,
1006 name,
1007 ty: arg_tys[2]
1008 });
10141009
10151010 // Of the same length:
10161011 let (element_len1, _) = arg_tys[1].simd_size_and_type(bx.tcx());
10171012 let (element_len2, _) = arg_tys[2].simd_size_and_type(bx.tcx());
1018 require!(
1019 in_len == element_len1,
1020 InvalidMonomorphization::SecondArgumentLength {
1021 span,
1022 name,
1023 in_len,
1024 in_ty,
1025 arg_ty: arg_tys[1],
1026 out_len: element_len1
1027 }
1028 );
1029 require!(
1030 in_len == element_len2,
1031 InvalidMonomorphization::ThirdArgumentLength {
1032 span,
1033 name,
1034 in_len,
1035 in_ty,
1036 arg_ty: arg_tys[2],
1037 out_len: element_len2
1038 }
1039 );
1013 require!(in_len == element_len1, InvalidMonomorphization::SecondArgumentLength {
1014 span,
1015 name,
1016 in_len,
1017 in_ty,
1018 arg_ty: arg_tys[1],
1019 out_len: element_len1
1020 });
1021 require!(in_len == element_len2, InvalidMonomorphization::ThirdArgumentLength {
1022 span,
1023 name,
1024 in_len,
1025 in_ty,
1026 arg_ty: arg_tys[2],
1027 out_len: element_len2
1028 });
10401029
10411030 // This counts how many pointers
10421031 fn ptr_count(t: Ty<'_>) -> usize {
......@@ -1064,18 +1053,15 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
10641053 (ptr_count(element_ty1), non_ptr(element_ty1))
10651054 }
10661055 _ => {
1067 require!(
1068 false,
1069 InvalidMonomorphization::ExpectedElementType {
1070 span,
1071 name,
1072 expected_element: element_ty1,
1073 second_arg: arg_tys[1],
1074 in_elem,
1075 in_ty,
1076 mutability: ExpectedPointerMutability::Mut,
1077 }
1078 );
1056 require!(false, InvalidMonomorphization::ExpectedElementType {
1057 span,
1058 name,
1059 expected_element: element_ty1,
1060 second_arg: arg_tys[1],
1061 in_elem,
1062 in_ty,
1063 mutability: ExpectedPointerMutability::Mut,
1064 });
10791065 unreachable!();
10801066 }
10811067 };
......@@ -1087,15 +1073,12 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
10871073 match *element_ty2.kind() {
10881074 ty::Int(_) => (),
10891075 _ => {
1090 require!(
1091 false,
1092 InvalidMonomorphization::ThirdArgElementType {
1093 span,
1094 name,
1095 expected_element: element_ty2,
1096 third_arg: arg_tys[2]
1097 }
1098 );
1076 require!(false, InvalidMonomorphization::ThirdArgElementType {
1077 span,
1078 name,
1079 expected_element: element_ty2,
1080 third_arg: arg_tys[2]
1081 });
10991082 }
11001083 }
11011084
......@@ -1262,10 +1245,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
12621245 ($name:ident : $vec_op:expr, $float_reduce:ident, $ordered:expr, $op:ident,
12631246 $identity:expr) => {
12641247 if name == sym::$name {
1265 require!(
1266 ret_ty == in_elem,
1267 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
1268 );
1248 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
1249 span,
1250 name,
1251 in_elem,
1252 in_ty,
1253 ret_ty
1254 });
12691255 return match *in_elem.kind() {
12701256 ty::Int(_) | ty::Uint(_) => {
12711257 let r = bx.vector_reduce_op(args[0].immediate(), $vec_op);
......@@ -1331,10 +1317,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
13311317 macro_rules! minmax_red {
13321318 ($name:ident: $int_red:ident, $float_red:ident) => {
13331319 if name == sym::$name {
1334 require!(
1335 ret_ty == in_elem,
1336 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
1337 );
1320 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
1321 span,
1322 name,
1323 in_elem,
1324 in_ty,
1325 ret_ty
1326 });
13381327 return match *in_elem.kind() {
13391328 ty::Int(_) | ty::Uint(_) => Ok(bx.$int_red(args[0].immediate())),
13401329 ty::Float(_) => Ok(bx.$float_red(args[0].immediate())),
......@@ -1358,10 +1347,13 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
13581347 ($name:ident : $op:expr, $boolean:expr) => {
13591348 if name == sym::$name {
13601349 let input = if !$boolean {
1361 require!(
1362 ret_ty == in_elem,
1363 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
1364 );
1350 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
1351 span,
1352 name,
1353 in_elem,
1354 in_ty,
1355 ret_ty
1356 });
13651357 args[0].immediate()
13661358 } else {
13671359 match *in_elem.kind() {
compiler/rustc_codegen_gcc/src/lib.rs+2-2
......@@ -107,10 +107,10 @@ use rustc_metadata::EncodedMetadata;
107107use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
108108use rustc_middle::ty::TyCtxt;
109109use rustc_middle::util::Providers;
110use rustc_session::config::{Lto, OptLevel, OutputFilenames};
111110use rustc_session::Session;
112use rustc_span::fatal_error::FatalError;
111use rustc_session::config::{Lto, OptLevel, OutputFilenames};
113112use rustc_span::Symbol;
113use rustc_span::fatal_error::FatalError;
114114use tempfile::TempDir;
115115
116116use crate::back::lto::ModuleBuffer;
compiler/rustc_codegen_llvm/src/abi.rs+18-26
......@@ -1,19 +1,19 @@
11use std::cmp;
22
33use libc::c_uint;
4use rustc_codegen_ssa::MemFlags;
45use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
56use rustc_codegen_ssa::mir::place::{PlaceRef, PlaceValue};
67use rustc_codegen_ssa::traits::*;
7use rustc_codegen_ssa::MemFlags;
8use rustc_middle::ty::Ty;
89use rustc_middle::ty::layout::LayoutOf;
910pub(crate) use rustc_middle::ty::layout::{FAT_PTR_ADDR, FAT_PTR_EXTRA};
10use rustc_middle::ty::Ty;
1111use rustc_middle::{bug, ty};
1212use rustc_session::config;
1313pub(crate) use rustc_target::abi::call::*;
1414use rustc_target::abi::{self, HasDataLayout, Int, Size};
15pub(crate) use rustc_target::spec::abi::Abi;
1615use rustc_target::spec::SanitizerSet;
16pub(crate) use rustc_target::spec::abi::Abi;
1717use smallvec::SmallVec;
1818
1919use crate::attributes::llfn_attrs_from_instance;
......@@ -445,11 +445,11 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
445445 // LLVM also rejects full range.
446446 && !scalar.is_always_valid(cx)
447447 {
448 attributes::apply_to_llfn(
449 llfn,
450 idx,
451 &[llvm::CreateRangeAttr(cx.llcx, scalar.size(cx), scalar.valid_range(cx))],
452 );
448 attributes::apply_to_llfn(llfn, idx, &[llvm::CreateRangeAttr(
449 cx.llcx,
450 scalar.size(cx),
451 scalar.valid_range(cx),
452 )]);
453453 }
454454 };
455455
......@@ -469,14 +469,10 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
469469 );
470470 attributes::apply_to_llfn(llfn, llvm::AttributePlace::Argument(i), &[sret]);
471471 if cx.sess().opts.optimize != config::OptLevel::No {
472 attributes::apply_to_llfn(
473 llfn,
474 llvm::AttributePlace::Argument(i),
475 &[
476 llvm::AttributeKind::Writable.create_attr(cx.llcx),
477 llvm::AttributeKind::DeadOnUnwind.create_attr(cx.llcx),
478 ],
479 );
472 attributes::apply_to_llfn(llfn, llvm::AttributePlace::Argument(i), &[
473 llvm::AttributeKind::Writable.create_attr(cx.llcx),
474 llvm::AttributeKind::DeadOnUnwind.create_attr(cx.llcx),
475 ]);
480476 }
481477 }
482478 PassMode::Cast { cast, pad_i32: _ } => {
......@@ -592,11 +588,9 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
592588 bx.cx.llcx,
593589 bx.cx.type_array(bx.cx.type_i8(), arg.layout.size.bytes()),
594590 );
595 attributes::apply_to_callsite(
596 callsite,
597 llvm::AttributePlace::Argument(i),
598 &[byval],
599 );
591 attributes::apply_to_callsite(callsite, llvm::AttributePlace::Argument(i), &[
592 byval,
593 ]);
600594 }
601595 PassMode::Direct(attrs)
602596 | PassMode::Indirect { attrs, meta_attrs: None, on_stack: false } => {
......@@ -628,11 +622,9 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
628622 // This will probably get ignored on all targets but those supporting the TrustZone-M
629623 // extension (thumbv8m targets).
630624 let cmse_nonsecure_call = llvm::CreateAttrString(bx.cx.llcx, "cmse_nonsecure_call");
631 attributes::apply_to_callsite(
632 callsite,
633 llvm::AttributePlace::Function,
634 &[cmse_nonsecure_call],
635 );
625 attributes::apply_to_callsite(callsite, llvm::AttributePlace::Function, &[
626 cmse_nonsecure_call,
627 ]);
636628 }
637629
638630 // Some intrinsics require that an elementtype attribute (with the pointee type of a
compiler/rustc_codegen_llvm/src/allocator.rs+3-3
......@@ -1,14 +1,14 @@
11use libc::c_uint;
22use rustc_ast::expand::allocator::{
3 alloc_error_handler_name, default_fn_name, global_fn_name, AllocatorKind, AllocatorTy,
4 ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE,
3 ALLOCATOR_METHODS, AllocatorKind, AllocatorTy, NO_ALLOC_SHIM_IS_UNSTABLE,
4 alloc_error_handler_name, default_fn_name, global_fn_name,
55};
66use rustc_middle::bug;
77use rustc_middle::ty::TyCtxt;
88use rustc_session::config::{DebugInfo, OomStrategy};
99
1010use crate::llvm::{self, Context, False, Module, True, Type};
11use crate::{attributes, debuginfo, ModuleLlvm};
11use crate::{ModuleLlvm, attributes, debuginfo};
1212
1313pub(crate) unsafe fn codegen(
1414 tcx: TyCtxt<'_>,
compiler/rustc_codegen_llvm/src/asm.rs+2-2
......@@ -5,10 +5,10 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
55use rustc_codegen_ssa::mir::operand::OperandValue;
66use rustc_codegen_ssa::traits::*;
77use rustc_data_structures::fx::FxHashMap;
8use rustc_middle::ty::layout::TyAndLayout;
98use rustc_middle::ty::Instance;
9use rustc_middle::ty::layout::TyAndLayout;
1010use rustc_middle::{bug, span_bug};
11use rustc_span::{sym, Pos, Span, Symbol};
11use rustc_span::{Pos, Span, Symbol, sym};
1212use rustc_target::abi::*;
1313use rustc_target::asm::*;
1414use smallvec::SmallVec;
compiler/rustc_codegen_llvm/src/back/archive.rs+3-3
......@@ -1,12 +1,12 @@
11//! A helper class for dealing with static archives
22
3use std::ffi::{c_char, c_void, CStr, CString};
3use std::ffi::{CStr, CString, c_char, c_void};
44use std::path::{Path, PathBuf};
55use std::{io, mem, ptr, str};
66
77use rustc_codegen_ssa::back::archive::{
8 try_extract_macho_fat_archive, ArArchiveBuilder, ArchiveBuildFailure, ArchiveBuilder,
9 ArchiveBuilderBuilder, ObjectReader, UnknownArchiveKind, DEFAULT_OBJECT_READER,
8 ArArchiveBuilder, ArchiveBuildFailure, ArchiveBuilder, ArchiveBuilderBuilder,
9 DEFAULT_OBJECT_READER, ObjectReader, UnknownArchiveKind, try_extract_macho_fat_archive,
1010};
1111use rustc_session::Session;
1212
compiler/rustc_codegen_llvm/src/back/lto.rs+2-2
......@@ -11,7 +11,7 @@ use rustc_codegen_ssa::back::lto::{LtoModuleCodegen, SerializedModule, ThinModul
1111use rustc_codegen_ssa::back::symbol_export;
1212use rustc_codegen_ssa::back::write::{CodegenContext, FatLtoInput, TargetMachineFactoryConfig};
1313use rustc_codegen_ssa::traits::*;
14use rustc_codegen_ssa::{looks_like_rust_object_file, ModuleCodegen, ModuleKind};
14use rustc_codegen_ssa::{ModuleCodegen, ModuleKind, looks_like_rust_object_file};
1515use rustc_data_structures::fx::FxHashMap;
1616use rustc_data_structures::memmap::Mmap;
1717use rustc_errors::{DiagCtxtHandle, FatalError};
......@@ -23,7 +23,7 @@ use rustc_session::config::{self, CrateType, Lto};
2323use tracing::{debug, info};
2424
2525use crate::back::write::{
26 self, bitcode_section_name, save_temp_bitcode, CodegenDiagnosticsStage, DiagnosticHandlers,
26 self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
2727};
2828use crate::errors::{
2929 DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
compiler/rustc_codegen_llvm/src/back/owned_target_machine.rs+1-1
......@@ -1,4 +1,4 @@
1use std::ffi::{c_char, CStr};
1use std::ffi::{CStr, c_char};
22use std::marker::PhantomData;
33use std::ops::Deref;
44use std::ptr::NonNull;
compiler/rustc_codegen_llvm/src/back/profiling.rs+1-1
......@@ -1,4 +1,4 @@
1use std::ffi::{c_void, CStr};
1use std::ffi::{CStr, c_void};
22use std::os::raw::c_char;
33use std::sync::Arc;
44
compiler/rustc_codegen_llvm/src/back/write.rs+4-4
......@@ -20,19 +20,19 @@ use rustc_data_structures::small_c_str::SmallCStr;
2020use rustc_errors::{DiagCtxtHandle, FatalError, Level};
2121use rustc_fs_util::{link_or_copy, path_to_c_string};
2222use rustc_middle::ty::TyCtxt;
23use rustc_session::Session;
2324use rustc_session::config::{
2425 self, Lto, OutputType, Passes, RemapPathScopeComponents, SplitDwarfKind, SwitchWithOptPath,
2526};
26use rustc_session::Session;
27use rustc_span::symbol::sym;
2827use rustc_span::InnerSpan;
28use rustc_span::symbol::sym;
2929use rustc_target::spec::{CodeModel, RelocModel, SanitizerSet, SplitDebuginfo, TlsModel};
3030use tracing::debug;
3131
3232use crate::back::lto::ThinBuffer;
3333use crate::back::owned_target_machine::OwnedTargetMachine;
3434use crate::back::profiling::{
35 selfprofile_after_pass_callback, selfprofile_before_pass_callback, LlvmSelfProfiler,
35 LlvmSelfProfiler, selfprofile_after_pass_callback, selfprofile_before_pass_callback,
3636};
3737use crate::errors::{
3838 CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, UnknownCompression,
......@@ -41,7 +41,7 @@ use crate::errors::{
4141use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
4242use crate::llvm::{self, DiagnosticInfo, PassManager};
4343use crate::type_::Type;
44use crate::{base, common, llvm_util, LlvmCodegenBackend, ModuleLlvm};
44use crate::{LlvmCodegenBackend, ModuleLlvm, base, common, llvm_util};
4545
4646pub(crate) fn llvm_err<'a>(dcx: DiagCtxtHandle<'_>, err: LlvmError<'a>) -> FatalError {
4747 match llvm::last_error() {
compiler/rustc_codegen_llvm/src/builder.rs+1-1
......@@ -3,11 +3,11 @@ use std::ops::Deref;
33use std::{iter, ptr};
44
55use libc::{c_char, c_uint};
6use rustc_codegen_ssa::MemFlags;
67use rustc_codegen_ssa::common::{IntPredicate, RealPredicate, SynchronizationScope, TypeKind};
78use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue};
89use rustc_codegen_ssa::mir::place::PlaceRef;
910use rustc_codegen_ssa::traits::*;
10use rustc_codegen_ssa::MemFlags;
1111use rustc_data_structures::small_c_str::SmallCStr;
1212use rustc_hir::def_id::DefId;
1313use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
compiler/rustc_codegen_llvm/src/consts.rs+2-2
......@@ -6,8 +6,8 @@ use rustc_hir::def::DefKind;
66use rustc_hir::def_id::DefId;
77use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
88use rustc_middle::mir::interpret::{
9 read_target_uint, Allocation, ConstAllocation, ErrorHandled, InitChunk, Pointer,
10 Scalar as InterpScalar,
9 Allocation, ConstAllocation, ErrorHandled, InitChunk, Pointer, Scalar as InterpScalar,
10 read_target_uint,
1111};
1212use rustc_middle::mir::mono::MonoItem;
1313use rustc_middle::ty::layout::LayoutOf;
compiler/rustc_codegen_llvm/src/context.rs+3-3
......@@ -7,7 +7,7 @@ use libc::c_uint;
77use rustc_codegen_ssa::base::{wants_msvc_seh, wants_wasm_eh};
88use rustc_codegen_ssa::errors as ssa_errors;
99use rustc_codegen_ssa::traits::*;
10use rustc_data_structures::base_n::{ToBaseN, ALPHANUMERIC_ONLY};
10use rustc_data_structures::base_n::{ALPHANUMERIC_ONLY, ToBaseN};
1111use rustc_data_structures::fx::FxHashMap;
1212use rustc_data_structures::small_c_str::SmallCStr;
1313use rustc_hir::def_id::DefId;
......@@ -18,12 +18,12 @@ use rustc_middle::ty::layout::{
1818};
1919use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
2020use rustc_middle::{bug, span_bug};
21use rustc_session::Session;
2122use rustc_session::config::{
2223 BranchProtection, CFGuard, CFProtection, CrateType, DebugInfo, PAuthKey, PacRet,
2324};
24use rustc_session::Session;
2525use rustc_span::source_map::Spanned;
26use rustc_span::{Span, DUMMY_SP};
26use rustc_span::{DUMMY_SP, Span};
2727use rustc_target::abi::{HasDataLayout, TargetDataLayout, VariantIdx};
2828use rustc_target::spec::{HasTargetSpec, RelocModel, SmallDataThresholdSupport, Target, TlsModel};
2929use smallvec::SmallVec;
compiler/rustc_codegen_llvm/src/coverageinfo/mapgen.rs+2-2
......@@ -5,8 +5,8 @@ use rustc_hir::def_id::{DefId, LocalDefId};
55use rustc_index::IndexVec;
66use rustc_middle::ty::{self, TyCtxt};
77use rustc_middle::{bug, mir};
8use rustc_span::def_id::DefIdSet;
98use rustc_span::Symbol;
9use rustc_span::def_id::DefIdSet;
1010use tracing::debug;
1111
1212use crate::common::CodegenCx;
......@@ -183,8 +183,8 @@ impl GlobalFileTable {
183183 // Since rustc generates coverage maps with relative paths, the
184184 // compilation directory can be combined with the relative paths
185185 // to get absolute paths, if needed.
186 use rustc_session::config::RemapPathScopeComponents;
187186 use rustc_session::RemapFileNameExt;
187 use rustc_session::config::RemapPathScopeComponents;
188188 let working_dir: &str = &tcx
189189 .sess
190190 .opts
compiler/rustc_codegen_llvm/src/coverageinfo/mod.rs+1-1
......@@ -9,8 +9,8 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
99use rustc_llvm::RustString;
1010use rustc_middle::bug;
1111use rustc_middle::mir::coverage::CoverageKind;
12use rustc_middle::ty::layout::HasTyCtxt;
1312use rustc_middle::ty::Instance;
13use rustc_middle::ty::layout::HasTyCtxt;
1414use rustc_target::abi::{Align, Size};
1515use tracing::{debug, instrument};
1616
compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext};
22use rustc_codegen_ssa::traits::*;
3use rustc_index::bit_set::BitSet;
43use rustc_index::Idx;
4use rustc_index::bit_set::BitSet;
55use rustc_middle::mir::{Body, SourceScope};
66use rustc_middle::ty::layout::FnAbiOf;
77use rustc_middle::ty::{self, Instance};
compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs+6-6
......@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
55use std::{iter, ptr};
66
77use libc::{c_char, c_longlong, c_uint};
8use rustc_codegen_ssa::debuginfo::type_names::{cpp_like_debuginfo, VTableNameKind};
8use rustc_codegen_ssa::debuginfo::type_names::{VTableNameKind, cpp_like_debuginfo};
99use rustc_codegen_ssa::traits::*;
1010use rustc_fs_util::path_to_c_string;
1111use rustc_hir::def::{CtorKind, DefKind};
......@@ -18,7 +18,7 @@ use rustc_middle::ty::{
1818};
1919use rustc_session::config::{self, DebugInfo, Lto};
2020use rustc_span::symbol::Symbol;
21use rustc_span::{hygiene, FileName, FileNameDisplayPreference, SourceFile, DUMMY_SP};
21use rustc_span::{DUMMY_SP, FileName, FileNameDisplayPreference, SourceFile, hygiene};
2222use rustc_symbol_mangling::typeid_for_trait_ref;
2323use rustc_target::abi::{Align, Size};
2424use rustc_target::spec::DebuginfoKind;
......@@ -26,15 +26,15 @@ use smallvec::smallvec;
2626use tracing::{debug, instrument};
2727
2828use self::type_map::{DINodeCreationResult, Stub, UniqueTypeId};
29use super::CodegenUnitDebugContext;
2930use super::namespace::mangled_name_of_instance;
3031use super::type_names::{compute_debuginfo_type_name, compute_debuginfo_vtable_name};
3132use super::utils::{
32 create_DIArray, debug_context, get_namespace_for_item, is_node_local_to_unit, DIB,
33 DIB, create_DIArray, debug_context, get_namespace_for_item, is_node_local_to_unit,
3334};
34use super::CodegenUnitDebugContext;
3535use crate::common::CodegenCx;
3636use crate::debuginfo::metadata::type_map::build_type_with_children;
37use crate::debuginfo::utils::{fat_pointer_kind, FatPtrKind};
37use crate::debuginfo::utils::{FatPtrKind, fat_pointer_kind};
3838use crate::llvm::debuginfo::{
3939 DIDescriptor, DIFile, DIFlags, DILexicalBlock, DIScope, DIType, DebugEmissionKind,
4040 DebugNameTableKind,
......@@ -875,8 +875,8 @@ pub(crate) fn build_compile_unit_di_node<'ll, 'tcx>(
875875 codegen_unit_name: &str,
876876 debug_context: &CodegenUnitDebugContext<'ll, 'tcx>,
877877) -> &'ll DIDescriptor {
878 use rustc_session::config::RemapPathScopeComponents;
879878 use rustc_session::RemapFileNameExt;
879 use rustc_session::config::RemapPathScopeComponents;
880880 let mut name_in_debuginfo = tcx
881881 .sess
882882 .local_crate_source_file()
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs+2-2
......@@ -15,9 +15,9 @@ use crate::common::CodegenCx;
1515use crate::debuginfo::metadata::enums::DiscrResult;
1616use crate::debuginfo::metadata::type_map::{self, Stub, UniqueTypeId};
1717use crate::debuginfo::metadata::{
18 DINodeCreationResult, NO_GENERICS, NO_SCOPE_METADATA, SmallVec, UNKNOWN_LINE_NUMBER,
1819 build_field_di_node, file_metadata, size_and_align_of, type_di_node, unknown_file_metadata,
19 visibility_di_flags, DINodeCreationResult, SmallVec, NO_GENERICS, NO_SCOPE_METADATA,
20 UNKNOWN_LINE_NUMBER,
20 visibility_di_flags,
2121};
2222use crate::debuginfo::utils::DIB;
2323use crate::llvm::debuginfo::{DIFile, DIFlags, DIType};
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs+4-4
......@@ -12,14 +12,14 @@ use rustc_span::Symbol;
1212use rustc_target::abi::{FieldIdx, TagEncoding, VariantIdx, Variants};
1313
1414use super::type_map::{DINodeCreationResult, UniqueTypeId};
15use super::{size_and_align_of, SmallVec};
15use super::{SmallVec, size_and_align_of};
1616use crate::common::CodegenCx;
1717use crate::debuginfo::metadata::type_map::{self, Stub};
1818use crate::debuginfo::metadata::{
19 build_field_di_node, build_generic_type_param_di_nodes, type_di_node, unknown_file_metadata,
20 UNKNOWN_LINE_NUMBER,
19 UNKNOWN_LINE_NUMBER, build_field_di_node, build_generic_type_param_di_nodes, type_di_node,
20 unknown_file_metadata,
2121};
22use crate::debuginfo::utils::{create_DIArray, get_namespace_for_item, DIB};
22use crate::debuginfo::utils::{DIB, create_DIArray, get_namespace_for_item};
2323use crate::llvm::debuginfo::{DIFlags, DIType};
2424use crate::llvm::{self};
2525
compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/native.rs+3-3
......@@ -13,10 +13,10 @@ use smallvec::smallvec;
1313use crate::common::CodegenCx;
1414use crate::debuginfo::metadata::type_map::{self, Stub, StubInfo, UniqueTypeId};
1515use crate::debuginfo::metadata::{
16 file_metadata, size_and_align_of, type_di_node, unknown_file_metadata, visibility_di_flags,
17 DINodeCreationResult, SmallVec, NO_GENERICS, UNKNOWN_LINE_NUMBER,
16 DINodeCreationResult, NO_GENERICS, SmallVec, UNKNOWN_LINE_NUMBER, file_metadata,
17 size_and_align_of, type_di_node, unknown_file_metadata, visibility_di_flags,
1818};
19use crate::debuginfo::utils::{create_DIArray, get_namespace_for_item, DIB};
19use crate::debuginfo::utils::{DIB, create_DIArray, get_namespace_for_item};
2020use crate::llvm::debuginfo::{DIFile, DIFlags, DIType};
2121use crate::llvm::{self};
2222
compiler/rustc_codegen_llvm/src/debuginfo/metadata/type_map.rs+2-2
......@@ -8,9 +8,9 @@ use rustc_middle::bug;
88use rustc_middle::ty::{ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
99use rustc_target::abi::{Align, Size, VariantIdx};
1010
11use super::{unknown_file_metadata, SmallVec, UNKNOWN_LINE_NUMBER};
11use super::{SmallVec, UNKNOWN_LINE_NUMBER, unknown_file_metadata};
1212use crate::common::CodegenCx;
13use crate::debuginfo::utils::{create_DIArray, debug_context, DIB};
13use crate::debuginfo::utils::{DIB, create_DIArray, debug_context};
1414use crate::llvm::debuginfo::{DIFlags, DIScope, DIType};
1515use crate::llvm::{self};
1616
compiler/rustc_codegen_llvm/src/debuginfo/mod.rs+11-14
......@@ -16,8 +16,8 @@ use rustc_index::IndexVec;
1616use rustc_middle::mir;
1717use rustc_middle::ty::layout::LayoutOf;
1818use rustc_middle::ty::{self, GenericArgsRef, Instance, ParamEnv, Ty, TypeVisitableExt};
19use rustc_session::config::{self, DebugInfo};
2019use rustc_session::Session;
20use rustc_session::config::{self, DebugInfo};
2121use rustc_span::symbol::Symbol;
2222use rustc_span::{
2323 BytePos, Pos, SourceFile, SourceFileAndLine, SourceFileHash, Span, StableSourceFileId,
......@@ -26,9 +26,9 @@ use rustc_target::abi::Size;
2626use smallvec::SmallVec;
2727use tracing::debug;
2828
29use self::metadata::{file_metadata, type_di_node, UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER};
29use self::metadata::{UNKNOWN_COLUMN_NUMBER, UNKNOWN_LINE_NUMBER, file_metadata, type_di_node};
3030use self::namespace::mangled_name_of_instance;
31use self::utils::{create_DIArray, is_node_local_to_unit, DIB};
31use self::utils::{DIB, create_DIArray, is_node_local_to_unit};
3232use crate::abi::FnAbi;
3333use crate::builder::Builder;
3434use crate::common::CodegenCx;
......@@ -555,17 +555,14 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
555555 }
556556 }
557557
558 let scope = namespace::item_namespace(
559 cx,
560 DefId {
561 krate: instance.def_id().krate,
562 index: cx
563 .tcx
564 .def_key(instance.def_id())
565 .parent
566 .expect("get_containing_scope: missing parent?"),
567 },
568 );
558 let scope = namespace::item_namespace(cx, DefId {
559 krate: instance.def_id().krate,
560 index: cx
561 .tcx
562 .def_key(instance.def_id())
563 .parent
564 .expect("get_containing_scope: missing parent?"),
565 });
569566 (scope, false)
570567 }
571568 }
compiler/rustc_codegen_llvm/src/debuginfo/namespace.rs+1-1
......@@ -4,7 +4,7 @@ use rustc_codegen_ssa::debuginfo::type_names;
44use rustc_hir::def_id::DefId;
55use rustc_middle::ty::{self, Instance};
66
7use super::utils::{debug_context, DIB};
7use super::utils::{DIB, debug_context};
88use crate::common::CodegenCx;
99use crate::llvm;
1010use crate::llvm::debuginfo::DIScope;
compiler/rustc_codegen_llvm/src/debuginfo/utils.rs+1-1
......@@ -5,8 +5,8 @@ use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
55use rustc_middle::ty::{self, Ty};
66use tracing::trace;
77
8use super::namespace::item_namespace;
98use super::CodegenUnitDebugContext;
9use super::namespace::item_namespace;
1010use crate::common::CodegenCx;
1111use crate::llvm;
1212use crate::llvm::debuginfo::{DIArray, DIBuilder, DIDescriptor, DIScope};
compiler/rustc_codegen_llvm/src/intrinsic.rs+207-213
......@@ -12,7 +12,7 @@ use rustc_middle::mir::BinOp;
1212use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, LayoutOf};
1313use rustc_middle::ty::{self, GenericArgsRef, Ty};
1414use rustc_middle::{bug, span_bug};
15use rustc_span::{sym, Span, Symbol};
15use rustc_span::{Span, Symbol, sym};
1616use rustc_target::abi::{self, Align, Float, HasDataLayout, Primitive, Size};
1717use rustc_target::spec::{HasTargetSpec, PanicStrategy};
1818use tracing::debug;
......@@ -330,15 +330,12 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
330330 sym::prefetch_write_instruction => (1, 0),
331331 _ => bug!(),
332332 };
333 self.call_intrinsic(
334 "llvm.prefetch",
335 &[
336 args[0].immediate(),
337 self.const_i32(rw),
338 args[1].immediate(),
339 self.const_i32(cache_type),
340 ],
341 )
333 self.call_intrinsic("llvm.prefetch", &[
334 args[0].immediate(),
335 self.const_i32(rw),
336 args[1].immediate(),
337 self.const_i32(cache_type),
338 ])
342339 }
343340 sym::ctlz
344341 | sym::ctlz_nonzero
......@@ -356,10 +353,10 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
356353 Some((width, signed)) => match name {
357354 sym::ctlz | sym::cttz => {
358355 let y = self.const_bool(false);
359 let ret = self.call_intrinsic(
360 &format!("llvm.{name}.i{width}"),
361 &[args[0].immediate(), y],
362 );
356 let ret = self.call_intrinsic(&format!("llvm.{name}.i{width}"), &[
357 args[0].immediate(),
358 y,
359 ]);
363360
364361 self.intcast(ret, llret_ty, false)
365362 }
......@@ -376,26 +373,24 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
376373 self.intcast(ret, llret_ty, false)
377374 }
378375 sym::ctpop => {
379 let ret = self.call_intrinsic(
380 &format!("llvm.ctpop.i{width}"),
381 &[args[0].immediate()],
382 );
376 let ret = self.call_intrinsic(&format!("llvm.ctpop.i{width}"), &[args
377 [0]
378 .immediate()]);
383379 self.intcast(ret, llret_ty, false)
384380 }
385381 sym::bswap => {
386382 if width == 8 {
387383 args[0].immediate() // byte swap a u8/i8 is just a no-op
388384 } else {
389 self.call_intrinsic(
390 &format!("llvm.bswap.i{width}"),
391 &[args[0].immediate()],
392 )
385 self.call_intrinsic(&format!("llvm.bswap.i{width}"), &[
386 args[0].immediate()
387 ])
393388 }
394389 }
395 sym::bitreverse => self.call_intrinsic(
396 &format!("llvm.bitreverse.i{width}"),
397 &[args[0].immediate()],
398 ),
390 sym::bitreverse => self
391 .call_intrinsic(&format!("llvm.bitreverse.i{width}"), &[
392 args[0].immediate()
393 ]),
399394 sym::rotate_left | sym::rotate_right => {
400395 let is_left = name == sym::rotate_left;
401396 let val = args[0].immediate();
......@@ -471,10 +466,11 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
471466
472467 sym::compare_bytes => {
473468 // Here we assume that the `memcmp` provided by the target is a NOP for size 0.
474 let cmp = self.call_intrinsic(
475 "memcmp",
476 &[args[0].immediate(), args[1].immediate(), args[2].immediate()],
477 );
469 let cmp = self.call_intrinsic("memcmp", &[
470 args[0].immediate(),
471 args[1].immediate(),
472 args[2].immediate(),
473 ]);
478474 // Some targets have `memcmp` returning `i16`, but the intrinsic is always `i32`.
479475 self.sext(cmp, self.type_ix(32))
480476 }
......@@ -1216,17 +1212,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
12161212 if let Some(cmp_op) = comparison {
12171213 let (out_len, out_ty) = require_simd!(ret_ty, SimdReturn);
12181214
1219 require!(
1220 in_len == out_len,
1221 InvalidMonomorphization::ReturnLengthInputType {
1222 span,
1223 name,
1224 in_len,
1225 in_ty,
1226 ret_ty,
1227 out_len
1228 }
1229 );
1215 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
1216 span,
1217 name,
1218 in_len,
1219 in_ty,
1220 ret_ty,
1221 out_len
1222 });
12301223 require!(
12311224 bx.type_kind(bx.element_type(llret_ty)) == TypeKind::Integer,
12321225 InvalidMonomorphization::ReturnIntegerType { span, name, ret_ty, out_ty }
......@@ -1252,14 +1245,21 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
12521245 let n = idx.len() as u64;
12531246
12541247 let (out_len, out_ty) = require_simd!(ret_ty, SimdReturn);
1255 require!(
1256 out_len == n,
1257 InvalidMonomorphization::ReturnLength { span, name, in_len: n, ret_ty, out_len }
1258 );
1259 require!(
1260 in_elem == out_ty,
1261 InvalidMonomorphization::ReturnElement { span, name, in_elem, in_ty, ret_ty, out_ty }
1262 );
1248 require!(out_len == n, InvalidMonomorphization::ReturnLength {
1249 span,
1250 name,
1251 in_len: n,
1252 ret_ty,
1253 out_len
1254 });
1255 require!(in_elem == out_ty, InvalidMonomorphization::ReturnElement {
1256 span,
1257 name,
1258 in_elem,
1259 in_ty,
1260 ret_ty,
1261 out_ty
1262 });
12631263
12641264 let total_len = in_len * 2;
12651265
......@@ -1304,14 +1304,21 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
13041304 };
13051305
13061306 let (out_len, out_ty) = require_simd!(ret_ty, SimdReturn);
1307 require!(
1308 out_len == n,
1309 InvalidMonomorphization::ReturnLength { span, name, in_len: n, ret_ty, out_len }
1310 );
1311 require!(
1312 in_elem == out_ty,
1313 InvalidMonomorphization::ReturnElement { span, name, in_elem, in_ty, ret_ty, out_ty }
1314 );
1307 require!(out_len == n, InvalidMonomorphization::ReturnLength {
1308 span,
1309 name,
1310 in_len: n,
1311 ret_ty,
1312 out_len
1313 });
1314 require!(in_elem == out_ty, InvalidMonomorphization::ReturnElement {
1315 span,
1316 name,
1317 in_elem,
1318 in_ty,
1319 ret_ty,
1320 out_ty
1321 });
13151322
13161323 let total_len = u128::from(in_len) * 2;
13171324
......@@ -1336,16 +1343,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
13361343 }
13371344
13381345 if name == sym::simd_insert {
1339 require!(
1340 in_elem == arg_tys[2],
1341 InvalidMonomorphization::InsertedType {
1342 span,
1343 name,
1344 in_elem,
1345 in_ty,
1346 out_ty: arg_tys[2]
1347 }
1348 );
1346 require!(in_elem == arg_tys[2], InvalidMonomorphization::InsertedType {
1347 span,
1348 name,
1349 in_elem,
1350 in_ty,
1351 out_ty: arg_tys[2]
1352 });
13491353 let idx = bx
13501354 .const_to_opt_u128(args[1].immediate(), false)
13511355 .expect("typeck should have ensure that this is a const");
......@@ -1364,10 +1368,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
13641368 ));
13651369 }
13661370 if name == sym::simd_extract {
1367 require!(
1368 ret_ty == in_elem,
1369 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
1370 );
1371 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
1372 span,
1373 name,
1374 in_elem,
1375 in_ty,
1376 ret_ty
1377 });
13711378 let idx = bx
13721379 .const_to_opt_u128(args[1].immediate(), false)
13731380 .expect("typeck should have ensure that this is a const");
......@@ -1386,10 +1393,12 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
13861393 let m_elem_ty = in_elem;
13871394 let m_len = in_len;
13881395 let (v_len, _) = require_simd!(arg_tys[1], SimdArgument);
1389 require!(
1390 m_len == v_len,
1391 InvalidMonomorphization::MismatchedLengths { span, name, m_len, v_len }
1392 );
1396 require!(m_len == v_len, InvalidMonomorphization::MismatchedLengths {
1397 span,
1398 name,
1399 m_len,
1400 v_len
1401 });
13931402 match m_elem_ty.kind() {
13941403 ty::Int(_) => {}
13951404 _ => return_error!(InvalidMonomorphization::MaskType { span, name, ty: m_elem_ty }),
......@@ -1616,34 +1625,30 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
16161625 require_simd!(ret_ty, SimdReturn);
16171626
16181627 // Of the same length:
1619 require!(
1620 in_len == out_len,
1621 InvalidMonomorphization::SecondArgumentLength {
1622 span,
1623 name,
1624 in_len,
1625 in_ty,
1626 arg_ty: arg_tys[1],
1627 out_len
1628 }
1629 );
1630 require!(
1631 in_len == out_len2,
1632 InvalidMonomorphization::ThirdArgumentLength {
1633 span,
1634 name,
1635 in_len,
1636 in_ty,
1637 arg_ty: arg_tys[2],
1638 out_len: out_len2
1639 }
1640 );
1628 require!(in_len == out_len, InvalidMonomorphization::SecondArgumentLength {
1629 span,
1630 name,
1631 in_len,
1632 in_ty,
1633 arg_ty: arg_tys[1],
1634 out_len
1635 });
1636 require!(in_len == out_len2, InvalidMonomorphization::ThirdArgumentLength {
1637 span,
1638 name,
1639 in_len,
1640 in_ty,
1641 arg_ty: arg_tys[2],
1642 out_len: out_len2
1643 });
16411644
16421645 // The return type must match the first argument type
1643 require!(
1644 ret_ty == in_ty,
1645 InvalidMonomorphization::ExpectedReturnType { span, name, in_ty, ret_ty }
1646 );
1646 require!(ret_ty == in_ty, InvalidMonomorphization::ExpectedReturnType {
1647 span,
1648 name,
1649 in_ty,
1650 ret_ty
1651 });
16471652
16481653 require!(
16491654 matches!(
......@@ -1734,23 +1739,22 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
17341739 require_simd!(ret_ty, SimdReturn);
17351740
17361741 // Of the same length:
1737 require!(
1738 values_len == mask_len,
1739 InvalidMonomorphization::ThirdArgumentLength {
1740 span,
1741 name,
1742 in_len: mask_len,
1743 in_ty: mask_ty,
1744 arg_ty: values_ty,
1745 out_len: values_len
1746 }
1747 );
1742 require!(values_len == mask_len, InvalidMonomorphization::ThirdArgumentLength {
1743 span,
1744 name,
1745 in_len: mask_len,
1746 in_ty: mask_ty,
1747 arg_ty: values_ty,
1748 out_len: values_len
1749 });
17481750
17491751 // The return type must match the last argument type
1750 require!(
1751 ret_ty == values_ty,
1752 InvalidMonomorphization::ExpectedReturnType { span, name, in_ty: values_ty, ret_ty }
1753 );
1752 require!(ret_ty == values_ty, InvalidMonomorphization::ExpectedReturnType {
1753 span,
1754 name,
1755 in_ty: values_ty,
1756 ret_ty
1757 });
17541758
17551759 require!(
17561760 matches!(
......@@ -1832,17 +1836,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
18321836 let (values_len, values_elem) = require_simd!(values_ty, SimdThird);
18331837
18341838 // Of the same length:
1835 require!(
1836 values_len == mask_len,
1837 InvalidMonomorphization::ThirdArgumentLength {
1838 span,
1839 name,
1840 in_len: mask_len,
1841 in_ty: mask_ty,
1842 arg_ty: values_ty,
1843 out_len: values_len
1844 }
1845 );
1839 require!(values_len == mask_len, InvalidMonomorphization::ThirdArgumentLength {
1840 span,
1841 name,
1842 in_len: mask_len,
1843 in_ty: mask_ty,
1844 arg_ty: values_ty,
1845 out_len: values_len
1846 });
18461847
18471848 // The second argument must be a mutable pointer type matching the element type
18481849 require!(
......@@ -1921,28 +1922,22 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
19211922 let (element_len2, element_ty2) = require_simd!(arg_tys[2], SimdThird);
19221923
19231924 // Of the same length:
1924 require!(
1925 in_len == element_len1,
1926 InvalidMonomorphization::SecondArgumentLength {
1927 span,
1928 name,
1929 in_len,
1930 in_ty,
1931 arg_ty: arg_tys[1],
1932 out_len: element_len1
1933 }
1934 );
1935 require!(
1936 in_len == element_len2,
1937 InvalidMonomorphization::ThirdArgumentLength {
1938 span,
1939 name,
1940 in_len,
1941 in_ty,
1942 arg_ty: arg_tys[2],
1943 out_len: element_len2
1944 }
1945 );
1925 require!(in_len == element_len1, InvalidMonomorphization::SecondArgumentLength {
1926 span,
1927 name,
1928 in_len,
1929 in_ty,
1930 arg_ty: arg_tys[1],
1931 out_len: element_len1
1932 });
1933 require!(in_len == element_len2, InvalidMonomorphization::ThirdArgumentLength {
1934 span,
1935 name,
1936 in_len,
1937 in_ty,
1938 arg_ty: arg_tys[2],
1939 out_len: element_len2
1940 });
19461941
19471942 require!(
19481943 matches!(
......@@ -2016,10 +2011,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
20162011 ($name:ident : $integer_reduce:ident, $float_reduce:ident, $ordered:expr, $op:ident,
20172012 $identity:expr) => {
20182013 if name == sym::$name {
2019 require!(
2020 ret_ty == in_elem,
2021 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
2022 );
2014 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
2015 span,
2016 name,
2017 in_elem,
2018 in_ty,
2019 ret_ty
2020 });
20232021 return match in_elem.kind() {
20242022 ty::Int(_) | ty::Uint(_) => {
20252023 let r = bx.$integer_reduce(args[0].immediate());
......@@ -2088,10 +2086,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
20882086 macro_rules! minmax_red {
20892087 ($name:ident: $int_red:ident, $float_red:ident) => {
20902088 if name == sym::$name {
2091 require!(
2092 ret_ty == in_elem,
2093 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
2094 );
2089 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
2090 span,
2091 name,
2092 in_elem,
2093 in_ty,
2094 ret_ty
2095 });
20952096 return match in_elem.kind() {
20962097 ty::Int(_i) => Ok(bx.$int_red(args[0].immediate(), true)),
20972098 ty::Uint(_u) => Ok(bx.$int_red(args[0].immediate(), false)),
......@@ -2116,10 +2117,13 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
21162117 ($name:ident : $red:ident, $boolean:expr) => {
21172118 if name == sym::$name {
21182119 let input = if !$boolean {
2119 require!(
2120 ret_ty == in_elem,
2121 InvalidMonomorphization::ReturnType { span, name, in_elem, in_ty, ret_ty }
2122 );
2120 require!(ret_ty == in_elem, InvalidMonomorphization::ReturnType {
2121 span,
2122 name,
2123 in_elem,
2124 in_ty,
2125 ret_ty
2126 });
21232127 args[0].immediate()
21242128 } else {
21252129 match in_elem.kind() {
......@@ -2165,27 +2169,25 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
21652169
21662170 if name == sym::simd_cast_ptr {
21672171 let (out_len, out_elem) = require_simd!(ret_ty, SimdReturn);
2168 require!(
2169 in_len == out_len,
2170 InvalidMonomorphization::ReturnLengthInputType {
2171 span,
2172 name,
2173 in_len,
2174 in_ty,
2175 ret_ty,
2176 out_len
2177 }
2178 );
2172 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
2173 span,
2174 name,
2175 in_len,
2176 in_ty,
2177 ret_ty,
2178 out_len
2179 });
21792180
21802181 match in_elem.kind() {
21812182 ty::RawPtr(p_ty, _) => {
21822183 let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
21832184 bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
21842185 });
2185 require!(
2186 metadata.is_unit(),
2187 InvalidMonomorphization::CastFatPointer { span, name, ty: in_elem }
2188 );
2186 require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
2187 span,
2188 name,
2189 ty: in_elem
2190 });
21892191 }
21902192 _ => {
21912193 return_error!(InvalidMonomorphization::ExpectedPointer { span, name, ty: in_elem })
......@@ -2196,10 +2198,11 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
21962198 let metadata = p_ty.ptr_metadata_ty(bx.tcx, |ty| {
21972199 bx.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), ty)
21982200 });
2199 require!(
2200 metadata.is_unit(),
2201 InvalidMonomorphization::CastFatPointer { span, name, ty: out_elem }
2202 );
2201 require!(metadata.is_unit(), InvalidMonomorphization::CastFatPointer {
2202 span,
2203 name,
2204 ty: out_elem
2205 });
22032206 }
22042207 _ => {
22052208 return_error!(InvalidMonomorphization::ExpectedPointer { span, name, ty: out_elem })
......@@ -2211,17 +2214,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
22112214
22122215 if name == sym::simd_expose_provenance {
22132216 let (out_len, out_elem) = require_simd!(ret_ty, SimdReturn);
2214 require!(
2215 in_len == out_len,
2216 InvalidMonomorphization::ReturnLengthInputType {
2217 span,
2218 name,
2219 in_len,
2220 in_ty,
2221 ret_ty,
2222 out_len
2223 }
2224 );
2217 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
2218 span,
2219 name,
2220 in_len,
2221 in_ty,
2222 ret_ty,
2223 out_len
2224 });
22252225
22262226 match in_elem.kind() {
22272227 ty::RawPtr(_, _) => {}
......@@ -2239,17 +2239,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
22392239
22402240 if name == sym::simd_with_exposed_provenance {
22412241 let (out_len, out_elem) = require_simd!(ret_ty, SimdReturn);
2242 require!(
2243 in_len == out_len,
2244 InvalidMonomorphization::ReturnLengthInputType {
2245 span,
2246 name,
2247 in_len,
2248 in_ty,
2249 ret_ty,
2250 out_len
2251 }
2252 );
2242 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
2243 span,
2244 name,
2245 in_len,
2246 in_ty,
2247 ret_ty,
2248 out_len
2249 });
22532250
22542251 match in_elem.kind() {
22552252 ty::Uint(ty::UintTy::Usize) => {}
......@@ -2267,17 +2264,14 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
22672264
22682265 if name == sym::simd_cast || name == sym::simd_as {
22692266 let (out_len, out_elem) = require_simd!(ret_ty, SimdReturn);
2270 require!(
2271 in_len == out_len,
2272 InvalidMonomorphization::ReturnLengthInputType {
2273 span,
2274 name,
2275 in_len,
2276 in_ty,
2277 ret_ty,
2278 out_len
2279 }
2280 );
2267 require!(in_len == out_len, InvalidMonomorphization::ReturnLengthInputType {
2268 span,
2269 name,
2270 in_len,
2271 in_ty,
2272 ret_ty,
2273 out_len
2274 });
22812275 // casting cares about nominal type, not just structural type
22822276 if in_elem == out_elem {
22832277 return Ok(args[0].immediate());
compiler/rustc_codegen_llvm/src/lib.rs+1-1
......@@ -41,8 +41,8 @@ use rustc_metadata::EncodedMetadata;
4141use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
4242use rustc_middle::ty::TyCtxt;
4343use rustc_middle::util::Providers;
44use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest};
4544use rustc_session::Session;
45use rustc_session::config::{OptLevel, OutputFilenames, PrintKind, PrintRequest};
4646use rustc_span::symbol::Symbol;
4747
4848mod back {
compiler/rustc_codegen_llvm/src/llvm/ffi.rs+1-1
......@@ -5,13 +5,13 @@ use std::marker::PhantomData;
55
66use libc::{c_char, c_int, c_uint, c_ulonglong, c_void, size_t};
77
8use super::RustString;
89use super::debuginfo::{
910 DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
1011 DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DINameSpace,
1112 DISPFlags, DIScope, DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable,
1213 DebugEmissionKind, DebugNameTableKind,
1314};
14use super::RustString;
1515
1616pub type Bool = c_uint;
1717
compiler/rustc_codegen_llvm/src/llvm_util.rs+2-2
......@@ -1,4 +1,4 @@
1use std::ffi::{c_char, c_void, CStr, CString};
1use std::ffi::{CStr, CString, c_char, c_void};
22use std::fmt::Write;
33use std::path::Path;
44use std::sync::Once;
......@@ -11,8 +11,8 @@ use rustc_data_structures::small_c_str::SmallCStr;
1111use rustc_data_structures::unord::UnordSet;
1212use rustc_fs_util::path_to_c_string;
1313use rustc_middle::bug;
14use rustc_session::config::{PrintKind, PrintRequest};
1514use rustc_session::Session;
15use rustc_session::config::{PrintKind, PrintRequest};
1616use rustc_span::symbol::Symbol;
1717use rustc_target::spec::{MergeFunctions, PanicStrategy, SmallDataThresholdSupport};
1818use rustc_target::target_features::{RUSTC_SPECIAL_FEATURES, RUSTC_SPECIFIC_FEATURES};
compiler/rustc_codegen_llvm/src/va_arg.rs+1-1
......@@ -1,8 +1,8 @@
11use rustc_codegen_ssa::common::IntPredicate;
22use rustc_codegen_ssa::mir::operand::OperandRef;
33use rustc_codegen_ssa::traits::{BaseTypeCodegenMethods, BuilderMethods, ConstCodegenMethods};
4use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
54use rustc_middle::ty::Ty;
5use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
66use rustc_target::abi::{Align, Endian, HasDataLayout, Size};
77
88use crate::builder::Builder;
compiler/rustc_codegen_ssa/src/back/archive.rs+6-6
......@@ -6,9 +6,9 @@ use std::io::{self, Write};
66use std::path::{Path, PathBuf};
77
88use ar_archive_writer::{
9 write_archive_to_stream, ArchiveKind, COFFShortExport, MachineTypes, NewArchiveMember,
9 ArchiveKind, COFFShortExport, MachineTypes, NewArchiveMember, write_archive_to_stream,
1010};
11pub use ar_archive_writer::{ObjectReader, DEFAULT_OBJECT_READER};
11pub use ar_archive_writer::{DEFAULT_OBJECT_READER, ObjectReader};
1212use object::read::archive::ArchiveFile;
1313use object::read::macho::FatArch;
1414use rustc_data_structures::fx::FxIndexSet;
......@@ -395,10 +395,10 @@ impl<'a> ArchiveBuilder for ArArchiveBuilder<'a> {
395395 let member_path = archive_path.parent().unwrap().join(Path::new(&file_name));
396396 self.entries.push((file_name.into_bytes(), ArchiveEntry::File(member_path)));
397397 } else {
398 self.entries.push((
399 file_name.into_bytes(),
400 ArchiveEntry::FromArchive { archive_index, file_range: entry.file_range() },
401 ));
398 self.entries.push((file_name.into_bytes(), ArchiveEntry::FromArchive {
399 archive_index,
400 file_range: entry.file_range(),
401 }));
402402 }
403403 }
404404 }
compiler/rustc_codegen_ssa/src/back/link.rs+8-8
......@@ -1,6 +1,6 @@
11use std::collections::BTreeSet;
22use std::ffi::OsString;
3use std::fs::{read, File, OpenOptions};
3use std::fs::{File, OpenOptions, read};
44use std::io::{BufWriter, Write};
55use std::ops::{ControlFlow, Deref};
66use std::path::{Path, PathBuf};
......@@ -18,7 +18,7 @@ use rustc_data_structures::temp_dir::MaybeTempDir;
1818use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, FatalError};
1919use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
2020use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
21use rustc_metadata::fs::{copy_to_stdout, emit_wrapper_file, METADATA_FILENAME};
21use rustc_metadata::fs::{METADATA_FILENAME, copy_to_stdout, emit_wrapper_file};
2222use rustc_metadata::{find_native_static_library, walk_native_lib_search_dirs};
2323use rustc_middle::bug;
2424use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
......@@ -34,7 +34,7 @@ use rustc_session::search_paths::PathKind;
3434use rustc_session::utils::NativeLibKind;
3535/// For all the linkers we support, and information they might
3636/// need out of the shared crate context before we get rid of it.
37use rustc_session::{filesearch, Session};
37use rustc_session::{Session, filesearch};
3838use rustc_span::symbol::Symbol;
3939use rustc_target::spec::crt_objects::CrtObjects;
4040use rustc_target::spec::{
......@@ -48,11 +48,11 @@ use tracing::{debug, info, warn};
4848use super::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
4949use super::command::Command;
5050use super::linker::{self, Linker};
51use super::metadata::{create_wrapper_file, MetadataPosition};
51use super::metadata::{MetadataPosition, create_wrapper_file};
5252use super::rpath::{self, RPathConfig};
5353use crate::{
54 common, errors, looks_like_rust_object_file, CodegenResults, CompiledModule, CrateInfo,
55 NativeLib,
54 CodegenResults, CompiledModule, CrateInfo, NativeLib, common, errors,
55 looks_like_rust_object_file,
5656};
5757
5858pub fn ensure_removed(dcx: DiagCtxtHandle<'_>, path: &Path) {
......@@ -1197,8 +1197,8 @@ fn escape_linker_output(s: &[u8], flavour: LinkerFlavor) -> String {
11971197#[cfg(windows)]
11981198mod win {
11991199 use windows::Win32::Globalization::{
1200 GetLocaleInfoEx, MultiByteToWideChar, CP_OEMCP, LOCALE_IUSEUTF8LEGACYOEMCP,
1201 LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_RETURN_NUMBER, MB_ERR_INVALID_CHARS,
1200 CP_OEMCP, GetLocaleInfoEx, LOCALE_IUSEUTF8LEGACYOEMCP, LOCALE_NAME_SYSTEM_DEFAULT,
1201 LOCALE_RETURN_NUMBER, MB_ERR_INVALID_CHARS, MultiByteToWideChar,
12021202 };
12031203
12041204 /// Get the Windows system OEM code page. This is most notably the code page
compiler/rustc_codegen_ssa/src/back/linker.rs+1-1
......@@ -15,8 +15,8 @@ use rustc_middle::middle::dependency_format::Linkage;
1515use rustc_middle::middle::exported_symbols;
1616use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo, SymbolExportKind};
1717use rustc_middle::ty::TyCtxt;
18use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
1918use rustc_session::Session;
19use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
2020use rustc_span::symbol::sym;
2121use rustc_target::spec::{Cc, LinkOutputKind, LinkerFlavor, Lld};
2222use tracing::{debug, warn};
compiler/rustc_codegen_ssa/src/back/lto.rs+1-1
......@@ -5,8 +5,8 @@ use rustc_data_structures::memmap::Mmap;
55use rustc_errors::FatalError;
66
77use super::write::CodegenContext;
8use crate::traits::*;
98use crate::ModuleCodegen;
9use crate::traits::*;
1010
1111pub struct ThinModule<B: WriteBackendMethods> {
1212 pub shared: Arc<ThinShared<B>>,
compiler/rustc_codegen_ssa/src/back/metadata.rs+13-16
......@@ -7,19 +7,20 @@ use std::path::Path;
77
88use object::write::{self, StandardSegment, Symbol, SymbolSection};
99use object::{
10 elf, pe, xcoff, Architecture, BinaryFormat, Endianness, FileFlags, Object, ObjectSection,
11 ObjectSymbol, SectionFlags, SectionKind, SubArchitecture, SymbolFlags, SymbolKind, SymbolScope,
10 Architecture, BinaryFormat, Endianness, FileFlags, Object, ObjectSection, ObjectSymbol,
11 SectionFlags, SectionKind, SubArchitecture, SymbolFlags, SymbolKind, SymbolScope, elf, pe,
12 xcoff,
1213};
1314use rustc_data_structures::memmap::Mmap;
14use rustc_data_structures::owned_slice::{try_slice_owned, OwnedSlice};
15use rustc_data_structures::owned_slice::{OwnedSlice, try_slice_owned};
16use rustc_metadata::EncodedMetadata;
1517use rustc_metadata::creader::MetadataLoader;
1618use rustc_metadata::fs::METADATA_FILENAME;
17use rustc_metadata::EncodedMetadata;
1819use rustc_middle::bug;
1920use rustc_session::Session;
2021use rustc_span::sym;
2122use rustc_target::abi::Endian;
22use rustc_target::spec::{ef_avr_arch, RelocModel, Target};
23use rustc_target::spec::{RelocModel, Target, ef_avr_arch};
2324
2425/// The default metadata loader. This is used by cg_llvm and cg_clif.
2526///
......@@ -668,17 +669,13 @@ pub fn create_metadata_file_for_wasm(sess: &Session, data: &[u8], section_name:
668669 let mut imports = wasm_encoder::ImportSection::new();
669670
670671 if sess.target.pointer_width == 64 {
671 imports.import(
672 "env",
673 "__linear_memory",
674 wasm_encoder::MemoryType {
675 minimum: 0,
676 maximum: None,
677 memory64: true,
678 shared: false,
679 page_size_log2: None,
680 },
681 );
672 imports.import("env", "__linear_memory", wasm_encoder::MemoryType {
673 minimum: 0,
674 maximum: None,
675 memory64: true,
676 shared: false,
677 page_size_log2: None,
678 });
682679 }
683680
684681 if imports.len() > 0 {
compiler/rustc_codegen_ssa/src/back/rpath/tests.rs+7-10
......@@ -1,7 +1,7 @@
11use std::ffi::OsString;
22use std::path::{Path, PathBuf};
33
4use super::{get_rpath_relative_to_output, minimize_rpaths, rpaths_to_flags, RPathConfig};
4use super::{RPathConfig, get_rpath_relative_to_output, minimize_rpaths, rpaths_to_flags};
55
66#[test]
77fn test_rpaths_to_flags() {
......@@ -74,13 +74,10 @@ fn test_rpath_relative_issue_119571() {
7474fn test_xlinker() {
7575 let args = rpaths_to_flags(vec!["a/normal/path".into(), "a,comma,path".into()]);
7676
77 assert_eq!(
78 args,
79 vec![
80 OsString::from("-Wl,-rpath,a/normal/path"),
81 OsString::from("-Wl,-rpath"),
82 OsString::from("-Xlinker"),
83 OsString::from("a,comma,path")
84 ]
85 );
77 assert_eq!(args, vec![
78 OsString::from("-Wl,-rpath,a/normal/path"),
79 OsString::from("-Wl,-rpath"),
80 OsString::from("-Xlinker"),
81 OsString::from("a,comma,path")
82 ]);
8683}
compiler/rustc_codegen_ssa/src/back/symbol_export.rs+57-90
......@@ -3,11 +3,11 @@ use std::collections::hash_map::Entry::*;
33use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, NO_ALLOC_SHIM_IS_UNSTABLE};
44use rustc_data_structures::unord::UnordMap;
55use rustc_hir::def::DefKind;
6use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LOCAL_CRATE};
6use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE, LocalDefId};
77use rustc_middle::bug;
88use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
99use rustc_middle::middle::exported_symbols::{
10 metadata_symbol_name, ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel,
10 ExportedSymbol, SymbolExportInfo, SymbolExportKind, SymbolExportLevel, metadata_symbol_name,
1111};
1212use rustc_middle::query::LocalCrate;
1313use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, Instance, SymbolName, TyCtxt};
......@@ -140,14 +140,11 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
140140 .into();
141141
142142 if let Some(id) = tcx.proc_macro_decls_static(()) {
143 reachable_non_generics.insert(
144 id.to_def_id(),
145 SymbolExportInfo {
146 level: SymbolExportLevel::C,
147 kind: SymbolExportKind::Data,
148 used: false,
149 },
150 );
143 reachable_non_generics.insert(id.to_def_id(), SymbolExportInfo {
144 level: SymbolExportLevel::C,
145 kind: SymbolExportKind::Data,
146 used: false,
147 });
151148 }
152149
153150 reachable_non_generics
......@@ -188,14 +185,11 @@ fn exported_symbols_provider_local(
188185 if !tcx.sess.target.dll_tls_export {
189186 symbols.extend(sorted.iter().filter_map(|(&def_id, &info)| {
190187 tcx.needs_thread_local_shim(def_id).then(|| {
191 (
192 ExportedSymbol::ThreadLocalShim(def_id),
193 SymbolExportInfo {
194 level: info.level,
195 kind: SymbolExportKind::Text,
196 used: info.used,
197 },
198 )
188 (ExportedSymbol::ThreadLocalShim(def_id), SymbolExportInfo {
189 level: info.level,
190 kind: SymbolExportKind::Text,
191 used: info.used,
192 })
199193 })
200194 }))
201195 }
......@@ -204,14 +198,11 @@ fn exported_symbols_provider_local(
204198 let exported_symbol =
205199 ExportedSymbol::NoDefId(SymbolName::new(tcx, tcx.sess.target.entry_name.as_ref()));
206200
207 symbols.push((
208 exported_symbol,
209 SymbolExportInfo {
210 level: SymbolExportLevel::C,
211 kind: SymbolExportKind::Text,
212 used: false,
213 },
214 ));
201 symbols.push((exported_symbol, SymbolExportInfo {
202 level: SymbolExportLevel::C,
203 kind: SymbolExportKind::Text,
204 used: false,
205 }));
215206 }
216207
217208 // Mark allocator shim symbols as exported only if they were generated.
......@@ -223,26 +214,20 @@ fn exported_symbols_provider_local(
223214 {
224215 let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, &symbol_name));
225216
226 symbols.push((
227 exported_symbol,
228 SymbolExportInfo {
229 level: SymbolExportLevel::Rust,
230 kind: SymbolExportKind::Text,
231 used: false,
232 },
233 ));
217 symbols.push((exported_symbol, SymbolExportInfo {
218 level: SymbolExportLevel::Rust,
219 kind: SymbolExportKind::Text,
220 used: false,
221 }));
234222 }
235223
236224 let exported_symbol =
237225 ExportedSymbol::NoDefId(SymbolName::new(tcx, NO_ALLOC_SHIM_IS_UNSTABLE));
238 symbols.push((
239 exported_symbol,
240 SymbolExportInfo {
241 level: SymbolExportLevel::Rust,
242 kind: SymbolExportKind::Data,
243 used: false,
244 },
245 ))
226 symbols.push((exported_symbol, SymbolExportInfo {
227 level: SymbolExportLevel::Rust,
228 kind: SymbolExportKind::Data,
229 used: false,
230 }))
246231 }
247232
248233 if tcx.sess.instrument_coverage() || tcx.sess.opts.cg.profile_generate.enabled() {
......@@ -254,14 +239,11 @@ fn exported_symbols_provider_local(
254239
255240 symbols.extend(PROFILER_WEAK_SYMBOLS.iter().map(|sym| {
256241 let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, sym));
257 (
258 exported_symbol,
259 SymbolExportInfo {
260 level: SymbolExportLevel::C,
261 kind: SymbolExportKind::Data,
262 used: false,
263 },
264 )
242 (exported_symbol, SymbolExportInfo {
243 level: SymbolExportLevel::C,
244 kind: SymbolExportKind::Data,
245 used: false,
246 })
265247 }));
266248 }
267249
......@@ -279,14 +261,11 @@ fn exported_symbols_provider_local(
279261
280262 symbols.extend(msan_weak_symbols.into_iter().map(|sym| {
281263 let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, sym));
282 (
283 exported_symbol,
284 SymbolExportInfo {
285 level: SymbolExportLevel::C,
286 kind: SymbolExportKind::Data,
287 used: false,
288 },
289 )
264 (exported_symbol, SymbolExportInfo {
265 level: SymbolExportLevel::C,
266 kind: SymbolExportKind::Data,
267 used: false,
268 })
290269 }));
291270 }
292271
......@@ -296,14 +275,11 @@ fn exported_symbols_provider_local(
296275 let symbol_name = metadata_symbol_name(tcx);
297276 let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(tcx, &symbol_name));
298277
299 symbols.push((
300 exported_symbol,
301 SymbolExportInfo {
302 level: SymbolExportLevel::C,
303 kind: SymbolExportKind::Data,
304 used: true,
305 },
306 ));
278 symbols.push((exported_symbol, SymbolExportInfo {
279 level: SymbolExportLevel::C,
280 kind: SymbolExportKind::Data,
281 used: true,
282 }));
307283 }
308284
309285 if tcx.sess.opts.share_generics() && tcx.local_crate_exports_generics() {
......@@ -338,14 +314,11 @@ fn exported_symbols_provider_local(
338314 MonoItem::Fn(Instance { def: InstanceKind::Item(def), args }) => {
339315 if args.non_erasable_generics(tcx, def).next().is_some() {
340316 let symbol = ExportedSymbol::Generic(def, args);
341 symbols.push((
342 symbol,
343 SymbolExportInfo {
344 level: SymbolExportLevel::Rust,
345 kind: SymbolExportKind::Text,
346 used: false,
347 },
348 ));
317 symbols.push((symbol, SymbolExportInfo {
318 level: SymbolExportLevel::Rust,
319 kind: SymbolExportKind::Text,
320 used: false,
321 }));
349322 }
350323 }
351324 MonoItem::Fn(Instance { def: InstanceKind::DropGlue(def_id, Some(ty)), args }) => {
......@@ -354,14 +327,11 @@ fn exported_symbols_provider_local(
354327 args.non_erasable_generics(tcx, def_id).next(),
355328 Some(GenericArgKind::Type(ty))
356329 );
357 symbols.push((
358 ExportedSymbol::DropGlue(ty),
359 SymbolExportInfo {
360 level: SymbolExportLevel::Rust,
361 kind: SymbolExportKind::Text,
362 used: false,
363 },
364 ));
330 symbols.push((ExportedSymbol::DropGlue(ty), SymbolExportInfo {
331 level: SymbolExportLevel::Rust,
332 kind: SymbolExportKind::Text,
333 used: false,
334 }));
365335 }
366336 MonoItem::Fn(Instance {
367337 def: InstanceKind::AsyncDropGlueCtorShim(def_id, Some(ty)),
......@@ -372,14 +342,11 @@ fn exported_symbols_provider_local(
372342 args.non_erasable_generics(tcx, def_id).next(),
373343 Some(GenericArgKind::Type(ty))
374344 );
375 symbols.push((
376 ExportedSymbol::AsyncDropGlueCtorShim(ty),
377 SymbolExportInfo {
378 level: SymbolExportLevel::Rust,
379 kind: SymbolExportKind::Text,
380 used: false,
381 },
382 ));
345 symbols.push((ExportedSymbol::AsyncDropGlueCtorShim(ty), SymbolExportInfo {
346 level: SymbolExportLevel::Rust,
347 kind: SymbolExportKind::Text,
348 used: false,
349 }));
383350 }
384351 _ => {
385352 // Any other symbols don't qualify for sharing
compiler/rustc_codegen_ssa/src/back/write.rs+5-5
......@@ -2,8 +2,8 @@ use std::any::Any;
22use std::assert_matches::assert_matches;
33use std::marker::PhantomData;
44use std::path::{Path, PathBuf};
5use std::sync::mpsc::{channel, Receiver, Sender};
65use std::sync::Arc;
6use std::sync::mpsc::{Receiver, Sender, channel};
77use std::{fs, io, mem, str, thread};
88
99use jobserver::{Acquired, Client};
......@@ -23,16 +23,16 @@ use rustc_hir::def_id::{CrateNum, LOCAL_CRATE};
2323use rustc_incremental::{
2424 copy_cgu_workproduct_to_incr_comp_cache_dir, in_incr_comp_dir, in_incr_comp_dir_sess,
2525};
26use rustc_metadata::fs::copy_to_stdout;
2726use rustc_metadata::EncodedMetadata;
27use rustc_metadata::fs::copy_to_stdout;
2828use rustc_middle::bug;
2929use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
3030use rustc_middle::middle::exported_symbols::SymbolExportInfo;
3131use rustc_middle::ty::TyCtxt;
32use rustc_session::Session;
3233use rustc_session::config::{
3334 self, CrateType, Lto, OutFileName, OutputFilenames, OutputType, Passes, SwitchWithOptPath,
3435};
35use rustc_session::Session;
3636use rustc_span::source_map::SourceMap;
3737use rustc_span::symbol::sym;
3838use rustc_span::{BytePos, FileName, InnerSpan, Pos, Span};
......@@ -45,8 +45,8 @@ use super::symbol_export::symbol_name_for_instance_in_crate;
4545use crate::errors::ErrorCreatingRemarkDir;
4646use crate::traits::*;
4747use crate::{
48 errors, CachedModuleCodegen, CodegenResults, CompiledModule, CrateInfo, ModuleCodegen,
49 ModuleKind,
48 CachedModuleCodegen, CodegenResults, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind,
49 errors,
5050};
5151
5252const PRE_LTO_BC_EXT: &str = "pre-lto.bc";
compiler/rustc_codegen_ssa/src/base.rs+7-7
......@@ -3,7 +3,7 @@ use std::collections::BTreeSet;
33use std::time::{Duration, Instant};
44
55use itertools::Itertools;
6use rustc_ast::expand::allocator::{global_fn_name, AllocatorKind, ALLOCATOR_METHODS};
6use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, AllocatorKind, global_fn_name};
77use rustc_attr as attr;
88use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
99use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
......@@ -17,15 +17,15 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
1717use rustc_middle::middle::debugger_visualizer::{DebuggerVisualizerFile, DebuggerVisualizerType};
1818use rustc_middle::middle::exported_symbols::SymbolExportKind;
1919use rustc_middle::middle::{exported_symbols, lang_items};
20use rustc_middle::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem};
2120use rustc_middle::mir::BinOp;
21use rustc_middle::mir::mono::{CodegenUnit, CodegenUnitNameBuilder, MonoItem};
2222use rustc_middle::query::Providers;
2323use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
2424use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
25use rustc_session::config::{self, CrateType, EntryFnType, OptLevel, OutputType};
2625use rustc_session::Session;
26use rustc_session::config::{self, CrateType, EntryFnType, OptLevel, OutputType};
2727use rustc_span::symbol::sym;
28use rustc_span::{Symbol, DUMMY_SP};
28use rustc_span::{DUMMY_SP, Symbol};
2929use rustc_target::abi::FIRST_VARIANT;
3030use tracing::{debug, info};
3131
......@@ -33,15 +33,15 @@ use crate::assert_module_sources::CguReuse;
3333use crate::back::link::are_upstream_rust_objects_already_included;
3434use crate::back::metadata::create_compressed_metadata_file;
3535use crate::back::write::{
36 compute_per_cgu_lto_type, start_async_codegen, submit_codegened_module_to_llvm,
37 submit_post_lto_module_to_llvm, submit_pre_lto_module_to_llvm, ComputedLtoType, OngoingCodegen,
36 ComputedLtoType, OngoingCodegen, compute_per_cgu_lto_type, start_async_codegen,
37 submit_codegened_module_to_llvm, submit_post_lto_module_to_llvm, submit_pre_lto_module_to_llvm,
3838};
3939use crate::common::{self, IntPredicate, RealPredicate, TypeKind};
4040use crate::mir::operand::OperandValue;
4141use crate::mir::place::PlaceRef;
4242use crate::traits::*;
4343use crate::{
44 errors, meth, mir, CachedModuleCodegen, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind,
44 CachedModuleCodegen, CompiledModule, CrateInfo, ModuleCodegen, ModuleKind, errors, meth, mir,
4545};
4646
4747pub(crate) fn bin_op_to_icmp_predicate(op: BinOp, signed: bool) -> IntPredicate {
compiler/rustc_codegen_ssa/src/codegen_attrs.rs+7-7
......@@ -1,12 +1,12 @@
1use rustc_ast::{ast, attr, MetaItemKind, NestedMetaItem};
2use rustc_attr::{list_contains_name, InlineAttr, InstructionSetAttr, OptimizeAttr};
1use rustc_ast::{MetaItemKind, NestedMetaItem, ast, attr};
2use rustc_attr::{InlineAttr, InstructionSetAttr, OptimizeAttr, list_contains_name};
33use rustc_errors::codes::*;
4use rustc_errors::{struct_span_code_err, DiagMessage, SubdiagMessage};
4use rustc_errors::{DiagMessage, SubdiagMessage, struct_span_code_err};
55use rustc_hir as hir;
66use rustc_hir::def::DefKind;
7use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
7use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
88use rustc_hir::weak_lang_items::WEAK_LANG_ITEMS;
9use rustc_hir::{lang_items, LangItem};
9use rustc_hir::{LangItem, lang_items};
1010use rustc_middle::middle::codegen_fn_attrs::{
1111 CodegenFnAttrFlags, CodegenFnAttrs, PatchableFunctionEntry,
1212};
......@@ -16,8 +16,8 @@ use rustc_middle::ty::{self as ty, TyCtxt};
1616use rustc_session::lint;
1717use rustc_session::parse::feature_err;
1818use rustc_span::symbol::Ident;
19use rustc_span::{sym, Span};
20use rustc_target::spec::{abi, SanitizerSet};
19use rustc_span::{Span, sym};
20use rustc_target::spec::{SanitizerSet, abi};
2121
2222use crate::errors;
2323use crate::target_features::{check_target_feature_trait_unsafe, from_target_feature};
compiler/rustc_codegen_ssa/src/errors.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_errors::{
1010 Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
1111};
1212use rustc_macros::Diagnostic;
13use rustc_middle::ty::layout::LayoutError;
1413use rustc_middle::ty::Ty;
14use rustc_middle::ty::layout::LayoutError;
1515use rustc_span::{Span, Symbol};
1616use rustc_type_ir::FloatTy;
1717
compiler/rustc_codegen_ssa/src/lib.rs+1-1
......@@ -37,10 +37,10 @@ use rustc_middle::middle::exported_symbols::SymbolExportKind;
3737use rustc_middle::util::Providers;
3838use rustc_serialize::opaque::{FileEncoder, MemDecoder};
3939use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
40use rustc_session::Session;
4041use rustc_session::config::{CrateType, OutputFilenames, OutputType, RUST_CGU_EXT};
4142use rustc_session::cstore::{self, CrateSource};
4243use rustc_session::utils::NativeLibKind;
43use rustc_session::Session;
4444use rustc_span::symbol::Symbol;
4545
4646pub mod assert_module_sources;
compiler/rustc_codegen_ssa/src/mir/analyze.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_data_structures::graph::dominators::Dominators;
55use rustc_index::bit_set::BitSet;
66use rustc_index::{IndexSlice, IndexVec};
77use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
8use rustc_middle::mir::{self, traversal, DefLocation, Location, TerminatorKind};
8use rustc_middle::mir::{self, DefLocation, Location, TerminatorKind, traversal};
99use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
1010use rustc_middle::{bug, span_bug};
1111use tracing::debug;
compiler/rustc_codegen_ssa/src/mir/block.rs+6-6
......@@ -10,7 +10,7 @@ use rustc_middle::ty::{self, Instance, Ty};
1010use rustc_middle::{bug, span_bug};
1111use rustc_session::config::OptLevel;
1212use rustc_span::source_map::Spanned;
13use rustc_span::{sym, Span};
13use rustc_span::{Span, sym};
1414use rustc_target::abi::call::{ArgAbi, FnAbi, PassMode, Reg};
1515use rustc_target::abi::{self, HasDataLayout, WrappingRange};
1616use rustc_target::spec::abi::Abi;
......@@ -24,7 +24,7 @@ use crate::base::{self, is_call_from_compiler_builtins_to_upstream_monomorphizat
2424use crate::common::{self, IntPredicate};
2525use crate::errors::CompilerBuiltinsCannotCall;
2626use crate::traits::*;
27use crate::{meth, MemFlags};
27use crate::{MemFlags, meth};
2828
2929// Indicates if we are in the middle of merging a BB's successor into it. This
3030// can happen when BB jumps directly to its successor and the successor has no
......@@ -1590,10 +1590,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
15901590 if let Some(slot) = self.personality_slot {
15911591 slot
15921592 } else {
1593 let layout = cx.layout_of(Ty::new_tup(
1594 cx.tcx(),
1595 &[Ty::new_mut_ptr(cx.tcx(), cx.tcx().types.u8), cx.tcx().types.i32],
1596 ));
1593 let layout = cx.layout_of(Ty::new_tup(cx.tcx(), &[
1594 Ty::new_mut_ptr(cx.tcx(), cx.tcx().types.u8),
1595 cx.tcx().types.i32,
1596 ]));
15971597 let slot = PlaceRef::alloca(bx, layout);
15981598 self.personality_slot = Some(slot);
15991599 slot
compiler/rustc_codegen_ssa/src/mir/coverageinfo.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_middle::mir::coverage::CoverageKind;
21use rustc_middle::mir::SourceScope;
2use rustc_middle::mir::coverage::CoverageKind;
33
44use super::FunctionCx;
55use crate::traits::*;
compiler/rustc_codegen_ssa/src/mir/debuginfo.rs+2-2
......@@ -8,8 +8,8 @@ use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
88use rustc_middle::ty::{Instance, Ty};
99use rustc_middle::{bug, mir, ty};
1010use rustc_session::config::DebugInfo;
11use rustc_span::symbol::{kw, Symbol};
12use rustc_span::{hygiene, BytePos, Span};
11use rustc_span::symbol::{Symbol, kw};
12use rustc_span::{BytePos, Span, hygiene};
1313use rustc_target::abi::{Abi, FieldIdx, FieldsShape, Size, VariantIdx};
1414
1515use super::operand::{OperandRef, OperandValue};
compiler/rustc_codegen_ssa/src/mir/intrinsic.rs+4-4
......@@ -1,16 +1,16 @@
11use rustc_middle::ty::{self, Ty, TyCtxt};
22use rustc_middle::{bug, span_bug};
33use rustc_session::config::OptLevel;
4use rustc_span::{sym, Span};
5use rustc_target::abi::call::{FnAbi, PassMode};
4use rustc_span::{Span, sym};
65use rustc_target::abi::WrappingRange;
6use rustc_target::abi::call::{FnAbi, PassMode};
77
8use super::FunctionCx;
89use super::operand::OperandRef;
910use super::place::PlaceRef;
10use super::FunctionCx;
1111use crate::errors::InvalidMonomorphization;
1212use crate::traits::*;
13use crate::{errors, meth, size_of_val, MemFlags};
13use crate::{MemFlags, errors, meth, size_of_val};
1414
1515fn copy_intrinsic<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
1616 bx: &mut Bx,
compiler/rustc_codegen_ssa/src/mir/mod.rs+2-2
......@@ -1,9 +1,9 @@
11use std::iter;
22
3use rustc_index::bit_set::BitSet;
43use rustc_index::IndexVec;
4use rustc_index::bit_set::BitSet;
55use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
6use rustc_middle::mir::{traversal, UnwindTerminateReason};
6use rustc_middle::mir::{UnwindTerminateReason, traversal};
77use rustc_middle::ty::layout::{FnAbiOf, HasTyCtxt, TyAndLayout};
88use rustc_middle::ty::{self, Instance, Ty, TyCtxt, TypeFoldable, TypeVisitableExt};
99use rustc_middle::{bug, mir, span_bug};
compiler/rustc_codegen_ssa/src/mir/operand.rs+3-3
......@@ -4,17 +4,17 @@ use std::fmt;
44use arrayvec::ArrayVec;
55use either::Either;
66use rustc_middle::bug;
7use rustc_middle::mir::interpret::{alloc_range, Pointer, Scalar};
7use rustc_middle::mir::interpret::{Pointer, Scalar, alloc_range};
88use rustc_middle::mir::{self, ConstValue};
9use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
109use rustc_middle::ty::Ty;
10use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1111use rustc_target::abi::{self, Abi, Align, Size};
1212use tracing::debug;
1313
1414use super::place::{PlaceRef, PlaceValue};
1515use super::{FunctionCx, LocalRef};
1616use crate::traits::*;
17use crate::{size_of_val, MemFlags};
17use crate::{MemFlags, size_of_val};
1818
1919/// The representation of a Rust value. The enum variant is in fact
2020/// uniquely determined by the value's type, but is kept as a
compiler/rustc_codegen_ssa/src/mir/place.rs+8-9
......@@ -415,11 +415,10 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
415415 layout.size
416416 };
417417
418 let llval = bx.inbounds_gep(
419 bx.cx().backend_type(self.layout),
420 self.val.llval,
421 &[bx.cx().const_usize(0), llindex],
422 );
418 let llval = bx.inbounds_gep(bx.cx().backend_type(self.layout), self.val.llval, &[
419 bx.cx().const_usize(0),
420 llindex,
421 ]);
423422 let align = self.val.align.restrict_for_offset(offset);
424423 PlaceValue::new_sized(llval, align).with_type(layout)
425424 }
......@@ -470,10 +469,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
470469 LocalRef::Operand(..) => {
471470 if place_ref.is_indirect_first_projection() {
472471 base = 1;
473 let cg_base = self.codegen_consume(
474 bx,
475 mir::PlaceRef { projection: &place_ref.projection[..0], ..place_ref },
476 );
472 let cg_base = self.codegen_consume(bx, mir::PlaceRef {
473 projection: &place_ref.projection[..0],
474 ..place_ref
475 });
477476 cg_base.deref(bx.cx())
478477 } else {
479478 bug!("using operand local {:?} as place", place_ref);
compiler/rustc_codegen_ssa/src/mir/rvalue.rs+3-3
......@@ -6,8 +6,8 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
66use rustc_middle::ty::{self, Instance, Ty, TyCtxt};
77use rustc_middle::{bug, mir, span_bug};
88use rustc_session::config::OptLevel;
9use rustc_span::{Span, DUMMY_SP};
10use rustc_target::abi::{self, FieldIdx, FIRST_VARIANT};
9use rustc_span::{DUMMY_SP, Span};
10use rustc_target::abi::{self, FIRST_VARIANT, FieldIdx};
1111use tracing::{debug, instrument};
1212
1313use super::operand::{OperandRef, OperandValue};
......@@ -15,7 +15,7 @@ use super::place::PlaceRef;
1515use super::{FunctionCx, LocalRef};
1616use crate::common::IntPredicate;
1717use crate::traits::*;
18use crate::{base, MemFlags};
18use crate::{MemFlags, base};
1919
2020impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
2121 #[instrument(level = "trace", skip(self, bx))]
compiler/rustc_codegen_ssa/src/mono_item.rs+1-1
......@@ -1,8 +1,8 @@
11use rustc_hir as hir;
22use rustc_middle::mir::interpret::ErrorHandled;
33use rustc_middle::mir::mono::{Linkage, MonoItem, Visibility};
4use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
54use rustc_middle::ty::Instance;
5use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf};
66use rustc_middle::{span_bug, ty};
77use tracing::debug;
88
compiler/rustc_codegen_ssa/src/target_features.rs+2-2
......@@ -4,14 +4,14 @@ use rustc_data_structures::fx::FxIndexSet;
44use rustc_data_structures::unord::{UnordMap, UnordSet};
55use rustc_errors::Applicability;
66use rustc_hir::def::DefKind;
7use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
7use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
88use rustc_middle::bug;
99use rustc_middle::middle::codegen_fn_attrs::TargetFeature;
1010use rustc_middle::query::Providers;
1111use rustc_middle::ty::TyCtxt;
1212use rustc_session::parse::feature_err;
13use rustc_span::symbol::{sym, Symbol};
1413use rustc_span::Span;
14use rustc_span::symbol::{Symbol, sym};
1515
1616use crate::errors;
1717
compiler/rustc_codegen_ssa/src/traits/backend.rs+3-3
......@@ -5,17 +5,17 @@ use rustc_ast::expand::allocator::AllocatorKind;
55use rustc_data_structures::fx::FxIndexMap;
66use rustc_data_structures::sync::{DynSend, DynSync};
77use rustc_errors::ErrorGuaranteed;
8use rustc_metadata::creader::MetadataLoaderDyn;
98use rustc_metadata::EncodedMetadata;
9use rustc_metadata::creader::MetadataLoaderDyn;
1010use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
1111use rustc_middle::ty::TyCtxt;
1212use rustc_middle::util::Providers;
13use rustc_session::config::{self, OutputFilenames, PrintRequest};
1413use rustc_session::Session;
14use rustc_session::config::{self, OutputFilenames, PrintRequest};
1515use rustc_span::symbol::Symbol;
1616
17use super::write::WriteBackendMethods;
1817use super::CodegenObject;
18use super::write::WriteBackendMethods;
1919use crate::back::write::TargetMachineFactoryFn;
2020use crate::{CodegenResults, ModuleCodegen};
2121
compiler/rustc_codegen_ssa/src/traits/builder.rs+1-1
......@@ -18,12 +18,12 @@ use super::intrinsic::IntrinsicCallBuilderMethods;
1818use super::misc::MiscCodegenMethods;
1919use super::type_::{ArgAbiBuilderMethods, BaseTypeCodegenMethods, LayoutTypeCodegenMethods};
2020use super::{CodegenMethods, StaticBuilderMethods};
21use crate::MemFlags;
2122use crate::common::{
2223 AtomicOrdering, AtomicRmwBinOp, IntPredicate, RealPredicate, SynchronizationScope, TypeKind,
2324};
2425use crate::mir::operand::{OperandRef, OperandValue};
2526use crate::mir::place::{PlaceRef, PlaceValue};
26use crate::MemFlags;
2727
2828#[derive(Copy, Clone, Debug)]
2929pub enum OverflowOp {
compiler/rustc_codegen_ssa/src/traits/debuginfo.rs+1-1
......@@ -3,8 +3,8 @@ use std::ops::Range;
33use rustc_middle::mir;
44use rustc_middle::ty::{Instance, PolyExistentialTraitRef, Ty};
55use rustc_span::{SourceFile, Span, Symbol};
6use rustc_target::abi::call::FnAbi;
76use rustc_target::abi::Size;
7use rustc_target::abi::call::FnAbi;
88
99use super::BackendTypes;
1010use crate::mir::debuginfo::{FunctionDebugContext, VariableKind};
compiler/rustc_codegen_ssa/src/traits/mod.rs+1-1
......@@ -27,8 +27,8 @@ mod write;
2727
2828use std::fmt;
2929
30use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
3130use rustc_middle::ty::Ty;
31use rustc_middle::ty::layout::{FnAbiOf, LayoutOf, TyAndLayout};
3232use rustc_target::abi::call::FnAbi;
3333
3434pub use self::abi::AbiBuilderMethods;
compiler/rustc_codegen_ssa/src/traits/type_.rs+1-1
......@@ -4,8 +4,8 @@ use rustc_middle::ty::{self, Ty};
44use rustc_target::abi::call::{ArgAbi, CastTarget, FnAbi, Reg};
55use rustc_target::abi::{AddressSpace, Float, Integer};
66
7use super::misc::MiscCodegenMethods;
87use super::BackendTypes;
8use super::misc::MiscCodegenMethods;
99use crate::common::TypeKind;
1010use crate::mir::place::PlaceRef;
1111
compiler/rustc_const_eval/src/check_consts/check.rs+2-2
......@@ -16,10 +16,10 @@ use rustc_middle::mir::*;
1616use rustc_middle::span_bug;
1717use rustc_middle::ty::adjustment::PointerCoercion;
1818use rustc_middle::ty::{self, Instance, InstanceKind, Ty, TypeVisitableExt};
19use rustc_mir_dataflow::Analysis;
1920use rustc_mir_dataflow::impls::MaybeStorageLive;
2021use rustc_mir_dataflow::storage::always_storage_live_locals;
21use rustc_mir_dataflow::Analysis;
22use rustc_span::{sym, Span, Symbol, DUMMY_SP};
22use rustc_span::{DUMMY_SP, Span, Symbol, sym};
2323use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2424use rustc_trait_selection::traits::{self, ObligationCauseCode, ObligationCtxt};
2525use tracing::{debug, instrument, trace};
compiler/rustc_const_eval/src/check_consts/ops.rs+5-5
......@@ -2,20 +2,20 @@
22
33use hir::def_id::LocalDefId;
44use hir::{ConstContext, LangItem};
5use rustc_errors::codes::*;
65use rustc_errors::Diag;
6use rustc_errors::codes::*;
77use rustc_hir as hir;
88use rustc_hir::def_id::DefId;
99use rustc_infer::infer::TyCtxtInferExt;
1010use rustc_infer::traits::{ImplSource, Obligation, ObligationCause};
1111use rustc_middle::mir::CallSource;
1212use rustc_middle::span_bug;
13use rustc_middle::ty::print::{with_no_trimmed_paths, PrintTraitRefExt as _};
13use rustc_middle::ty::print::{PrintTraitRefExt as _, with_no_trimmed_paths};
1414use rustc_middle::ty::{
15 self, suggest_constraining_type_param, Closure, FnDef, FnPtr, GenericArgKind, GenericArgsRef,
16 Param, TraitRef, Ty,
15 self, Closure, FnDef, FnPtr, GenericArgKind, GenericArgsRef, Param, TraitRef, Ty,
16 suggest_constraining_type_param,
1717};
18use rustc_middle::util::{call_kind, CallDesugaringKind, CallKind};
18use rustc_middle::util::{CallDesugaringKind, CallKind, call_kind};
1919use rustc_session::parse::feature_err;
2020use rustc_span::symbol::sym;
2121use rustc_span::{BytePos, Pos, Span, Symbol};
compiler/rustc_const_eval/src/check_consts/post_drop_elaboration.rs+2-2
......@@ -1,14 +1,14 @@
11use rustc_middle::mir::visit::Visitor;
22use rustc_middle::mir::{self, BasicBlock, Location};
33use rustc_middle::ty::{Ty, TyCtxt};
4use rustc_span::symbol::sym;
54use rustc_span::Span;
5use rustc_span::symbol::sym;
66use tracing::trace;
77
8use super::ConstCx;
89use super::check::Qualifs;
910use super::ops::{self, NonConstOp};
1011use super::qualifs::{NeedsNonConstDrop, Qualif};
11use super::ConstCx;
1212use crate::check_consts::rustc_allow_const_fn_unstable;
1313
1414/// Returns `true` if we should use the more precise live drop checker that runs after drop
compiler/rustc_const_eval/src/check_consts/qualifs.rs+4-8
......@@ -206,14 +206,10 @@ impl Qualif for NeedsNonConstDrop {
206206 cx.tcx,
207207 ObligationCause::dummy_with_span(cx.body.span),
208208 cx.param_env,
209 ty::TraitRef::new(
210 cx.tcx,
211 destruct_def_id,
212 [
213 ty::GenericArg::from(ty),
214 ty::GenericArg::from(cx.tcx.expected_host_effect_param_for_body(cx.def_id())),
215 ],
216 ),
209 ty::TraitRef::new(cx.tcx, destruct_def_id, [
210 ty::GenericArg::from(ty),
211 ty::GenericArg::from(cx.tcx.expected_host_effect_param_for_body(cx.def_id())),
212 ]),
217213 );
218214
219215 let infcx = cx.tcx.infer_ctxt().build();
compiler/rustc_const_eval/src/check_consts/resolver.rs+1-1
......@@ -13,7 +13,7 @@ use rustc_middle::mir::{
1313use rustc_mir_dataflow::fmt::DebugWithContext;
1414use rustc_mir_dataflow::{Analysis, AnalysisDomain, JoinSemiLattice};
1515
16use super::{qualifs, ConstCx, Qualif};
16use super::{ConstCx, Qualif, qualifs};
1717
1818/// A `Visitor` that propagates qualifs between locals. This defines the transfer function of
1919/// `FlowSensitiveAnalysis`.
compiler/rustc_const_eval/src/const_eval/dummy_machine.rs+1-1
......@@ -6,7 +6,7 @@ use rustc_middle::{bug, span_bug, ty};
66use rustc_span::def_id::DefId;
77
88use crate::interpret::{
9 self, throw_machine_stop, HasStaticRootDefId, ImmTy, Immediate, InterpCx, PointerArithmetic,
9 self, HasStaticRootDefId, ImmTy, Immediate, InterpCx, PointerArithmetic, throw_machine_stop,
1010};
1111
1212/// Macro for machine-specific `InterpError` without allocation.
compiler/rustc_const_eval/src/const_eval/error.rs+2-2
......@@ -1,8 +1,8 @@
11use std::mem;
22
33use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, Diagnostic, IntoDiagArg};
4use rustc_middle::mir::interpret::{Provenance, ReportedErrorInfo};
54use rustc_middle::mir::AssertKind;
5use rustc_middle::mir::interpret::{Provenance, ReportedErrorInfo};
66use rustc_middle::query::TyCtxtAt;
77use rustc_middle::ty::layout::LayoutError;
88use rustc_middle::ty::{ConstInt, TyCtxt};
......@@ -11,7 +11,7 @@ use rustc_span::{Span, Symbol};
1111use super::CompileTimeMachine;
1212use crate::errors::{self, FrameNote, ReportErrorExt};
1313use crate::interpret::{
14 err_inval, err_machine_stop, ErrorHandled, Frame, InterpError, InterpErrorInfo, MachineStopType,
14 ErrorHandled, Frame, InterpError, InterpErrorInfo, MachineStopType, err_inval, err_machine_stop,
1515};
1616
1717/// The CTFE machine has some custom error kinds.
compiler/rustc_const_eval/src/const_eval/eval_queries.rs+4-4
......@@ -11,18 +11,18 @@ use rustc_middle::ty::layout::LayoutOf;
1111use rustc_middle::ty::print::with_no_trimmed_paths;
1212use rustc_middle::ty::{self, Ty, TyCtxt};
1313use rustc_span::def_id::LocalDefId;
14use rustc_span::{Span, DUMMY_SP};
14use rustc_span::{DUMMY_SP, Span};
1515use rustc_target::abi::{self, Abi};
1616use tracing::{debug, instrument, trace};
1717
1818use super::{CanAccessMutGlobal, CompileTimeInterpCx, CompileTimeMachine};
1919use crate::const_eval::CheckAlignment;
2020use crate::interpret::{
21 create_static_alloc, eval_nullary_intrinsic, intern_const_alloc_recursive, throw_exhaust,
2221 CtfeValidationMode, GlobalId, Immediate, InternKind, InternResult, InterpCx, InterpError,
23 InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking, StackPopCleanup,
22 InterpResult, MPlaceTy, MemoryKind, OpTy, RefTracking, StackPopCleanup, create_static_alloc,
23 eval_nullary_intrinsic, intern_const_alloc_recursive, throw_exhaust,
2424};
25use crate::{errors, CTRL_C_RECEIVED};
25use crate::{CTRL_C_RECEIVED, errors};
2626
2727// Returns a pointer to where the result lives
2828#[instrument(level = "trace", skip(ecx, body))]
compiler/rustc_const_eval/src/const_eval/machine.rs+7-7
......@@ -6,14 +6,14 @@ use std::ops::ControlFlow;
66use rustc_ast::Mutability;
77use rustc_data_structures::fx::{FxHashMap, FxIndexMap, IndexEntry};
88use rustc_hir::def_id::{DefId, LocalDefId};
9use rustc_hir::{self as hir, LangItem, CRATE_HIR_ID};
9use rustc_hir::{self as hir, CRATE_HIR_ID, LangItem};
1010use rustc_middle::mir::AssertMessage;
1111use rustc_middle::query::TyCtxtAt;
1212use rustc_middle::ty::layout::{FnAbiOf, TyAndLayout};
1313use rustc_middle::ty::{self, Ty, TyCtxt};
1414use rustc_middle::{bug, mir};
15use rustc_span::symbol::{sym, Symbol};
1615use rustc_span::Span;
16use rustc_span::symbol::{Symbol, sym};
1717use rustc_target::abi::{Align, Size};
1818use rustc_target::spec::abi::Abi as CallAbi;
1919use tracing::debug;
......@@ -22,10 +22,10 @@ use super::error::*;
2222use crate::errors::{LongRunning, LongRunningWarn};
2323use crate::fluent_generated as fluent;
2424use crate::interpret::{
25 self, compile_time_machine, err_ub, throw_exhaust, throw_inval, throw_ub_custom, throw_unsup,
26 throw_unsup_format, AllocId, AllocRange, ConstAllocation, CtfeProvenance, FnArg, Frame,
27 GlobalAlloc, ImmTy, InterpCx, InterpResult, MPlaceTy, OpTy, Pointer, PointerArithmetic,
28 RangeSet, Scalar, StackPopCleanup,
25 self, AllocId, AllocRange, ConstAllocation, CtfeProvenance, FnArg, Frame, GlobalAlloc, ImmTy,
26 InterpCx, InterpResult, MPlaceTy, OpTy, Pointer, PointerArithmetic, RangeSet, Scalar,
27 StackPopCleanup, compile_time_machine, err_ub, throw_exhaust, throw_inval, throw_ub_custom,
28 throw_unsup, throw_unsup_format,
2929};
3030
3131/// When hitting this many interpreted terminators we emit a deny by default lint
......@@ -203,8 +203,8 @@ impl<'tcx> CompileTimeInterpCx<'tcx> {
203203 let topmost = span.ctxt().outer_expn().expansion_cause().unwrap_or(span);
204204 let caller = self.tcx.sess.source_map().lookup_char_pos(topmost.lo());
205205
206 use rustc_session::config::RemapPathScopeComponents;
207206 use rustc_session::RemapFileNameExt;
207 use rustc_session::config::RemapPathScopeComponents;
208208 (
209209 Symbol::intern(
210210 &caller
compiler/rustc_const_eval/src/const_eval/mod.rs+1-1
......@@ -7,7 +7,7 @@ use rustc_middle::{bug, mir};
77use rustc_target::abi::VariantIdx;
88use tracing::instrument;
99
10use crate::interpret::{format_interp_error, InterpCx};
10use crate::interpret::{InterpCx, format_interp_error};
1111
1212mod dummy_machine;
1313mod error;
compiler/rustc_const_eval/src/const_eval/valtrees.rs+3-3
......@@ -9,12 +9,12 @@ use tracing::{debug, instrument, trace};
99
1010use super::eval_queries::{mk_eval_cx_to_read_const_val, op_to_const};
1111use super::machine::CompileTimeInterpCx;
12use super::{ValTreeCreationError, ValTreeCreationResult, VALTREE_MAX_NODES};
12use super::{VALTREE_MAX_NODES, ValTreeCreationError, ValTreeCreationResult};
1313use crate::const_eval::CanAccessMutGlobal;
1414use crate::errors::MaxNumNodesInConstErr;
1515use crate::interpret::{
16 intern_const_alloc_recursive, ImmTy, Immediate, InternKind, MPlaceTy, MemPlaceMeta, MemoryKind,
17 PlaceTy, Projectable, Scalar,
16 ImmTy, Immediate, InternKind, MPlaceTy, MemPlaceMeta, MemoryKind, PlaceTy, Projectable, Scalar,
17 intern_const_alloc_recursive,
1818};
1919
2020#[instrument(skip(ecx), level = "debug")]
compiler/rustc_const_eval/src/errors.rs+5-8
......@@ -15,8 +15,8 @@ use rustc_middle::mir::interpret::{
1515};
1616use rustc_middle::ty::{self, Mutability, Ty};
1717use rustc_span::Span;
18use rustc_target::abi::call::AdjustForForeignAbiError;
1918use rustc_target::abi::WrappingRange;
19use rustc_target::abi::call::AdjustForForeignAbiError;
2020
2121use crate::interpret::InternKind;
2222
......@@ -510,13 +510,10 @@ impl<'a> ReportErrorExt for UndefinedBehaviorInfo<'a> {
510510 }
511511 ShiftOverflow { intrinsic, shift_amount } => {
512512 diag.arg("intrinsic", intrinsic);
513 diag.arg(
514 "shift_amount",
515 match shift_amount {
516 Either::Left(v) => v.to_string(),
517 Either::Right(v) => v.to_string(),
518 },
519 );
513 diag.arg("shift_amount", match shift_amount {
514 Either::Left(v) => v.to_string(),
515 Either::Right(v) => v.to_string(),
516 });
520517 }
521518 BoundsCheckFailed { len, index } => {
522519 diag.arg("len", len);
compiler/rustc_const_eval/src/interpret/call.rs+11-17
......@@ -14,9 +14,9 @@ use rustc_target::spec::abi::Abi;
1414use tracing::{info, instrument, trace};
1515
1616use super::{
17 throw_ub, throw_ub_custom, throw_unsup_format, CtfeProvenance, FnVal, ImmTy, InterpCx,
18 InterpResult, MPlaceTy, Machine, OpTy, PlaceTy, Projectable, Provenance, ReturnAction, Scalar,
19 StackPopCleanup, StackPopInfo,
17 CtfeProvenance, FnVal, ImmTy, InterpCx, InterpResult, MPlaceTy, Machine, OpTy, PlaceTy,
18 Projectable, Provenance, ReturnAction, Scalar, StackPopCleanup, StackPopInfo, throw_ub,
19 throw_ub_custom, throw_unsup_format,
2020};
2121use crate::fluent_generated as fluent;
2222
......@@ -364,13 +364,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
364364 "caller ABI: {:#?}, args: {:#?}",
365365 caller_fn_abi,
366366 args.iter()
367 .map(|arg| (
368 arg.layout().ty,
369 match arg {
370 FnArg::Copy(op) => format!("copy({op:?})"),
371 FnArg::InPlace(mplace) => format!("in-place({mplace:?})"),
372 }
373 ))
367 .map(|arg| (arg.layout().ty, match arg {
368 FnArg::Copy(op) => format!("copy({op:?})"),
369 FnArg::InPlace(mplace) => format!("in-place({mplace:?})"),
370 }))
374371 .collect::<Vec<_>>()
375372 );
376373 trace!(
......@@ -853,13 +850,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
853850 );
854851
855852 // Check `unwinding`.
856 assert_eq!(
857 unwinding,
858 match self.frame().loc {
859 Left(loc) => self.body().basic_blocks[loc.block].is_cleanup,
860 Right(_) => true,
861 }
862 );
853 assert_eq!(unwinding, match self.frame().loc {
854 Left(loc) => self.body().basic_blocks[loc.block].is_cleanup,
855 Right(_) => true,
856 });
863857 if unwinding && self.frame_idx() == 0 {
864858 throw_ub_custom!(fluent::const_eval_unwind_past_top);
865859 }
compiler/rustc_const_eval/src/interpret/cast.rs+2-2
......@@ -2,8 +2,8 @@ use std::assert_matches::assert_matches;
22
33use rustc_apfloat::ieee::{Double, Half, Quad, Single};
44use rustc_apfloat::{Float, FloatConvert};
5use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
65use rustc_middle::mir::CastKind;
6use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
77use rustc_middle::ty::adjustment::PointerCoercion;
88use rustc_middle::ty::layout::{IntegerExt, LayoutOf, TyAndLayout};
99use rustc_middle::ty::{self, FloatTy, Ty};
......@@ -14,7 +14,7 @@ use tracing::trace;
1414
1515use super::util::ensure_monomorphic_enough;
1616use super::{
17 err_inval, throw_ub, throw_ub_custom, FnVal, ImmTy, Immediate, InterpCx, Machine, OpTy, PlaceTy,
17 FnVal, ImmTy, Immediate, InterpCx, Machine, OpTy, PlaceTy, err_inval, throw_ub, throw_ub_custom,
1818};
1919use crate::fluent_generated as fluent;
2020
compiler/rustc_const_eval/src/interpret/discriminant.rs+1-1
......@@ -7,7 +7,7 @@ use rustc_target::abi::{self, TagEncoding, VariantIdx, Variants};
77use tracing::{instrument, trace};
88
99use super::{
10 err_ub, throw_ub, ImmTy, InterpCx, InterpResult, Machine, Projectable, Scalar, Writeable,
10 ImmTy, InterpCx, InterpResult, Machine, Projectable, Scalar, Writeable, err_ub, throw_ub,
1111};
1212
1313impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
compiler/rustc_const_eval/src/interpret/eval_context.rs+5-5
......@@ -1,8 +1,8 @@
11use either::{Left, Right};
22use rustc_errors::DiagCtxtHandle;
33use rustc_hir::def_id::DefId;
4use rustc_infer::infer::at::ToTrace;
54use rustc_infer::infer::TyCtxtInferExt;
5use rustc_infer::infer::at::ToTrace;
66use rustc_infer::traits::ObligationCause;
77use rustc_middle::mir::interpret::{ErrorHandled, InvalidMetaKind, ReportedErrorInfo};
88use rustc_middle::query::TyCtxtAt;
......@@ -19,11 +19,11 @@ use rustc_trait_selection::traits::ObligationCtxt;
1919use tracing::{debug, instrument, trace};
2020
2121use super::{
22 err_inval, throw_inval, throw_ub, throw_ub_custom, Frame, FrameInfo, GlobalId, InterpErrorInfo,
23 InterpResult, MPlaceTy, Machine, MemPlaceMeta, Memory, OpTy, Place, PlaceTy, PointerArithmetic,
24 Projectable, Provenance,
22 Frame, FrameInfo, GlobalId, InterpErrorInfo, InterpResult, MPlaceTy, Machine, MemPlaceMeta,
23 Memory, OpTy, Place, PlaceTy, PointerArithmetic, Projectable, Provenance, err_inval,
24 throw_inval, throw_ub, throw_ub_custom,
2525};
26use crate::{fluent_generated as fluent, util, ReportErrorExt};
26use crate::{ReportErrorExt, fluent_generated as fluent, util};
2727
2828pub struct InterpCx<'tcx, M: Machine<'tcx>> {
2929 /// Stores the `Machine` instance.
compiler/rustc_const_eval/src/interpret/intern.rs+6-6
......@@ -26,7 +26,7 @@ use rustc_span::def_id::LocalDefId;
2626use rustc_span::sym;
2727use tracing::{instrument, trace};
2828
29use super::{err_ub, AllocId, Allocation, InterpCx, MPlaceTy, Machine, MemoryKind, PlaceTy};
29use super::{AllocId, Allocation, InterpCx, MPlaceTy, Machine, MemoryKind, PlaceTy, err_ub};
3030use crate::const_eval;
3131use crate::errors::NestedStaticInThreadLocal;
3232
......@@ -100,11 +100,11 @@ fn intern_as_new_static<'tcx>(
100100 alloc_id: AllocId,
101101 alloc: ConstAllocation<'tcx>,
102102) {
103 let feed = tcx.create_def(
104 static_id,
105 sym::nested,
106 DefKind::Static { safety: hir::Safety::Safe, mutability: alloc.0.mutability, nested: true },
107 );
103 let feed = tcx.create_def(static_id, sym::nested, DefKind::Static {
104 safety: hir::Safety::Safe,
105 mutability: alloc.0.mutability,
106 nested: true,
107 });
108108 tcx.set_nested_alloc_id_static(alloc_id, feed.def_id());
109109
110110 if tcx.is_thread_local_static(static_id.into()) {
compiler/rustc_const_eval/src/interpret/intrinsics.rs+3-3
......@@ -9,16 +9,16 @@ use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic};
99use rustc_middle::ty::layout::{LayoutOf as _, TyAndLayout, ValidityRequirement};
1010use rustc_middle::ty::{GenericArgsRef, Ty, TyCtxt};
1111use rustc_middle::{bug, ty};
12use rustc_span::symbol::{sym, Symbol};
12use rustc_span::symbol::{Symbol, sym};
1313use rustc_target::abi::Size;
1414use tracing::trace;
1515
1616use super::memory::MemoryKind;
1717use super::util::ensure_monomorphic_enough;
1818use super::{
19 err_inval, err_ub_custom, err_unsup_format, throw_inval, throw_ub_custom, throw_ub_format,
2019 Allocation, CheckInAllocMsg, ConstAllocation, GlobalId, ImmTy, InterpCx, InterpResult,
21 MPlaceTy, Machine, OpTy, Pointer, PointerArithmetic, Provenance, Scalar,
20 MPlaceTy, Machine, OpTy, Pointer, PointerArithmetic, Provenance, Scalar, err_inval,
21 err_ub_custom, err_unsup_format, throw_inval, throw_ub_custom, throw_ub_format,
2222};
2323use crate::fluent_generated as fluent;
2424
compiler/rustc_const_eval/src/interpret/machine.rs+5-5
......@@ -9,18 +9,18 @@ use std::hash::Hash;
99use rustc_apfloat::{Float, FloatConvert};
1010use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
1111use rustc_middle::query::TyCtxtAt;
12use rustc_middle::ty::layout::TyAndLayout;
1312use rustc_middle::ty::Ty;
13use rustc_middle::ty::layout::TyAndLayout;
1414use rustc_middle::{mir, ty};
15use rustc_span::def_id::DefId;
1615use rustc_span::Span;
16use rustc_span::def_id::DefId;
1717use rustc_target::abi::{Align, Size};
1818use rustc_target::spec::abi::Abi as CallAbi;
1919
2020use super::{
21 throw_unsup, throw_unsup_format, AllocBytes, AllocId, AllocKind, AllocRange, Allocation,
22 ConstAllocation, CtfeProvenance, FnArg, Frame, ImmTy, InterpCx, InterpResult, MPlaceTy,
23 MemoryKind, Misalignment, OpTy, PlaceTy, Pointer, Provenance, RangeSet, CTFE_ALLOC_SALT,
21 AllocBytes, AllocId, AllocKind, AllocRange, Allocation, CTFE_ALLOC_SALT, ConstAllocation,
22 CtfeProvenance, FnArg, Frame, ImmTy, InterpCx, InterpResult, MPlaceTy, MemoryKind,
23 Misalignment, OpTy, PlaceTy, Pointer, Provenance, RangeSet, throw_unsup, throw_unsup_format,
2424};
2525
2626/// Data returned by [`Machine::after_stack_pop`], and consumed by
compiler/rustc_const_eval/src/interpret/memory.rs+2-2
......@@ -21,10 +21,10 @@ use rustc_target::abi::{Align, HasDataLayout, Size};
2121use tracing::{debug, instrument, trace};
2222
2323use super::{
24 alloc_range, err_ub, err_ub_custom, throw_ub, throw_ub_custom, throw_unsup, throw_unsup_format,
2524 AllocBytes, AllocId, AllocMap, AllocRange, Allocation, CheckAlignMsg, CheckInAllocMsg,
2625 CtfeProvenance, GlobalAlloc, InterpCx, InterpResult, Machine, MayLeak, Misalignment, Pointer,
27 PointerArithmetic, Provenance, Scalar,
26 PointerArithmetic, Provenance, Scalar, alloc_range, err_ub, err_ub_custom, throw_ub,
27 throw_ub_custom, throw_unsup, throw_unsup_format,
2828};
2929use crate::fluent_generated as fluent;
3030
compiler/rustc_const_eval/src/interpret/mod.rs+4-4
......@@ -24,13 +24,13 @@ use eval_context::{from_known_layout, mir_assign_valid_types};
2424pub use rustc_middle::mir::interpret::*; // have all the `interpret` symbols in one place: here
2525
2626pub use self::call::FnArg;
27pub use self::eval_context::{format_interp_error, InterpCx};
27pub use self::eval_context::{InterpCx, format_interp_error};
2828pub use self::intern::{
29 intern_const_alloc_for_constprop, intern_const_alloc_recursive, HasStaticRootDefId, InternKind,
30 InternResult,
29 HasStaticRootDefId, InternKind, InternResult, intern_const_alloc_for_constprop,
30 intern_const_alloc_recursive,
3131};
3232pub(crate) use self::intrinsics::eval_nullary_intrinsic;
33pub use self::machine::{compile_time_machine, AllocMap, Machine, MayLeak, ReturnAction};
33pub use self::machine::{AllocMap, Machine, MayLeak, ReturnAction, compile_time_machine};
3434pub use self::memory::{AllocKind, AllocRef, AllocRefMut, FnVal, Memory, MemoryKind};
3535use self::operand::Operand;
3636pub use self::operand::{ImmTy, Immediate, OpTy};
compiler/rustc_const_eval/src/interpret/operand.rs+3-3
......@@ -14,9 +14,9 @@ use rustc_target::abi::{self, Abi, HasDataLayout, Size};
1414use tracing::trace;
1515
1616use super::{
17 alloc_range, err_ub, from_known_layout, mir_assign_valid_types, throw_ub, CtfeProvenance,
18 InterpCx, InterpResult, MPlaceTy, Machine, MemPlace, MemPlaceMeta, OffsetMode, PlaceTy,
19 Pointer, Projectable, Provenance, Scalar,
17 CtfeProvenance, InterpCx, InterpResult, MPlaceTy, Machine, MemPlace, MemPlaceMeta, OffsetMode,
18 PlaceTy, Pointer, Projectable, Provenance, Scalar, alloc_range, err_ub, from_known_layout,
19 mir_assign_valid_types, throw_ub,
2020};
2121
2222/// An `Immediate` represents a single immediate self-contained Rust value.
compiler/rustc_const_eval/src/interpret/operator.rs+2-2
......@@ -1,7 +1,7 @@
11use either::Either;
22use rustc_apfloat::{Float, FloatConvert};
3use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
43use rustc_middle::mir::NullOp;
4use rustc_middle::mir::interpret::{InterpResult, PointerArithmetic, Scalar};
55use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
66use rustc_middle::ty::{self, FloatTy, ScalarInt, Ty};
77use rustc_middle::{bug, mir, span_bug};
......@@ -9,7 +9,7 @@ use rustc_span::symbol::sym;
99use rustc_target::abi::Size;
1010use tracing::trace;
1111
12use super::{throw_ub, ImmTy, InterpCx, Machine, MemPlaceMeta};
12use super::{ImmTy, InterpCx, Machine, MemPlaceMeta, throw_ub};
1313
1414impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
1515 fn three_way_compare<T: Ord>(&self, lhs: T, rhs: T) -> ImmTy<'tcx, M::Provenance> {
compiler/rustc_const_eval/src/interpret/place.rs+4-4
......@@ -6,16 +6,16 @@ use std::assert_matches::assert_matches;
66
77use either::{Either, Left, Right};
88use rustc_ast::Mutability;
9use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
109use rustc_middle::ty::Ty;
10use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1111use rustc_middle::{bug, mir, span_bug};
1212use rustc_target::abi::{Abi, Align, HasDataLayout, Size};
1313use tracing::{instrument, trace};
1414
1515use super::{
16 alloc_range, mir_assign_valid_types, AllocRef, AllocRefMut, CheckAlignMsg, CtfeProvenance,
17 ImmTy, Immediate, InterpCx, InterpResult, Machine, MemoryKind, Misalignment, OffsetMode, OpTy,
18 Operand, Pointer, Projectable, Provenance, Scalar,
16 AllocRef, AllocRefMut, CheckAlignMsg, CtfeProvenance, ImmTy, Immediate, InterpCx, InterpResult,
17 Machine, MemoryKind, Misalignment, OffsetMode, OpTy, Operand, Pointer, Projectable, Provenance,
18 Scalar, alloc_range, mir_assign_valid_types,
1919};
2020
2121#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
compiler/rustc_const_eval/src/interpret/projection.rs+3-3
......@@ -10,15 +10,15 @@
1010use std::marker::PhantomData;
1111use std::ops::Range;
1212
13use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1413use rustc_middle::ty::Ty;
14use rustc_middle::ty::layout::{LayoutOf, TyAndLayout};
1515use rustc_middle::{bug, mir, span_bug, ty};
1616use rustc_target::abi::{self, Size, VariantIdx};
1717use tracing::{debug, instrument};
1818
1919use super::{
20 err_ub, throw_ub, throw_unsup, InterpCx, InterpResult, MPlaceTy, Machine, MemPlaceMeta, OpTy,
21 Provenance, Scalar,
20 InterpCx, InterpResult, MPlaceTy, Machine, MemPlaceMeta, OpTy, Provenance, Scalar, err_ub,
21 throw_ub, throw_unsup,
2222};
2323
2424/// Describes the constraints placed on offset-projections.
compiler/rustc_const_eval/src/interpret/stack.rs+3-3
......@@ -15,9 +15,9 @@ use rustc_span::Span;
1515use tracing::{info_span, instrument, trace};
1616
1717use super::{
18 from_known_layout, throw_ub, throw_unsup, AllocId, CtfeProvenance, Immediate, InterpCx,
19 InterpResult, MPlaceTy, Machine, MemPlace, MemPlaceMeta, MemoryKind, Operand, Pointer,
20 Provenance, ReturnAction, Scalar,
18 AllocId, CtfeProvenance, Immediate, InterpCx, InterpResult, MPlaceTy, Machine, MemPlace,
19 MemPlaceMeta, MemoryKind, Operand, Pointer, Provenance, ReturnAction, Scalar,
20 from_known_layout, throw_ub, throw_unsup,
2121};
2222use crate::errors;
2323
compiler/rustc_const_eval/src/interpret/step.rs+3-3
......@@ -9,12 +9,12 @@ use rustc_middle::ty::{self, Instance, Ty};
99use rustc_middle::{bug, mir, span_bug};
1010use rustc_span::source_map::Spanned;
1111use rustc_target::abi::call::FnAbi;
12use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
12use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
1313use tracing::{info, instrument, trace};
1414
1515use super::{
16 throw_ub, FnArg, FnVal, ImmTy, Immediate, InterpCx, InterpResult, Machine, MemPlaceMeta,
17 PlaceTy, Projectable, Scalar,
16 FnArg, FnVal, ImmTy, Immediate, InterpCx, InterpResult, Machine, MemPlaceMeta, PlaceTy,
17 Projectable, Scalar, throw_ub,
1818};
1919use crate::util;
2020
compiler/rustc_const_eval/src/interpret/traits.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_target::abi::{Align, Size};
55use tracing::trace;
66
77use super::util::ensure_monomorphic_enough;
8use super::{throw_ub, InterpCx, MPlaceTy, Machine, MemPlaceMeta, OffsetMode, Projectable};
8use super::{InterpCx, MPlaceTy, Machine, MemPlaceMeta, OffsetMode, Projectable, throw_ub};
99
1010impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
1111 /// Creates a dynamic vtable for the given type and vtable origin. This is used only for
compiler/rustc_const_eval/src/interpret/util.rs+1-1
......@@ -9,7 +9,7 @@ use rustc_middle::ty::{
99};
1010use tracing::debug;
1111
12use super::{throw_inval, InterpCx, MPlaceTy, MemoryKind};
12use super::{InterpCx, MPlaceTy, MemoryKind, throw_inval};
1313use crate::const_eval::{CompileTimeInterpCx, CompileTimeMachine, InterpretationResult};
1414
1515/// Checks whether a type contains generic parameters which must be instantiated.
compiler/rustc_const_eval/src/interpret/validity.rs+19-18
......@@ -17,12 +17,12 @@ use rustc_hir as hir;
1717use rustc_middle::bug;
1818use rustc_middle::mir::interpret::ValidationErrorKind::{self, *};
1919use rustc_middle::mir::interpret::{
20 alloc_range, ExpectedKind, InterpError, InvalidMetaKind, Misalignment, PointerKind, Provenance,
21 UnsupportedOpInfo, ValidationErrorInfo,
20 ExpectedKind, InterpError, InvalidMetaKind, Misalignment, PointerKind, Provenance,
21 UnsupportedOpInfo, ValidationErrorInfo, alloc_range,
2222};
2323use rustc_middle::ty::layout::{LayoutCx, LayoutOf, TyAndLayout};
2424use rustc_middle::ty::{self, Ty};
25use rustc_span::symbol::{sym, Symbol};
25use rustc_span::symbol::{Symbol, sym};
2626use rustc_target::abi::{
2727 Abi, FieldIdx, FieldsShape, Scalar as ScalarAbi, Size, VariantIdx, Variants, WrappingRange,
2828};
......@@ -30,9 +30,9 @@ use tracing::trace;
3030
3131use super::machine::AllocMap;
3232use super::{
33 err_ub, format_interp_error, throw_ub, AllocId, AllocKind, CheckInAllocMsg, GlobalAlloc, ImmTy,
34 Immediate, InterpCx, InterpResult, MPlaceTy, Machine, MemPlaceMeta, PlaceTy, Pointer,
35 Projectable, Scalar, ValueVisitor,
33 AllocId, AllocKind, CheckInAllocMsg, GlobalAlloc, ImmTy, Immediate, InterpCx, InterpResult,
34 MPlaceTy, Machine, MemPlaceMeta, PlaceTy, Pointer, Projectable, Scalar, ValueVisitor, err_ub,
35 format_interp_error, throw_ub,
3636};
3737
3838// for the validation errors
......@@ -803,10 +803,10 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
803803 if start == 1 && end == max_value {
804804 // Only null is the niche. So make sure the ptr is NOT null.
805805 if self.ecx.scalar_may_be_null(scalar)? {
806 throw_validation_failure!(
807 self.path,
808 NullablePtrOutOfRange { range: valid_range, max_value }
809 )
806 throw_validation_failure!(self.path, NullablePtrOutOfRange {
807 range: valid_range,
808 max_value
809 })
810810 } else {
811811 return Ok(());
812812 }
......@@ -816,10 +816,10 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
816816 } else {
817817 // Conservatively, we reject, because the pointer *could* have a bad
818818 // value.
819 throw_validation_failure!(
820 self.path,
821 PtrOutOfRange { range: valid_range, max_value }
822 )
819 throw_validation_failure!(self.path, PtrOutOfRange {
820 range: valid_range,
821 max_value
822 })
823823 }
824824 }
825825 };
......@@ -827,10 +827,11 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
827827 if valid_range.contains(bits) {
828828 Ok(())
829829 } else {
830 throw_validation_failure!(
831 self.path,
832 OutOfRange { value: format!("{bits}"), range: valid_range, max_value }
833 )
830 throw_validation_failure!(self.path, OutOfRange {
831 value: format!("{bits}"),
832 range: valid_range,
833 max_value
834 })
834835 }
835836 }
836837
compiler/rustc_const_eval/src/interpret/visitor.rs+1-1
......@@ -10,7 +10,7 @@ use rustc_middle::ty::{self, Ty};
1010use rustc_target::abi::{FieldIdx, FieldsShape, VariantIdx, Variants};
1111use tracing::trace;
1212
13use super::{throw_inval, InterpCx, MPlaceTy, Machine, Projectable};
13use super::{InterpCx, MPlaceTy, Machine, Projectable, throw_inval};
1414
1515/// How to traverse a value and what to do when we are at the leaves.
1616pub trait ValueVisitor<'tcx, M: Machine<'tcx>>: Sized {
compiler/rustc_const_eval/src/util/caller_location.rs+1-1
......@@ -6,7 +6,7 @@ use rustc_middle::{bug, mir};
66use rustc_span::symbol::Symbol;
77use tracing::trace;
88
9use crate::const_eval::{mk_eval_cx_to_read_const_val, CanAccessMutGlobal, CompileTimeInterpCx};
9use crate::const_eval::{CanAccessMutGlobal, CompileTimeInterpCx, mk_eval_cx_to_read_const_val};
1010use crate::interpret::*;
1111
1212/// Allocate a `const core::panic::Location` with the provided filename and line/column numbers.
compiler/rustc_data_structures/src/fingerprint.rs+1-1
......@@ -3,7 +3,7 @@ use std::hash::{Hash, Hasher};
33use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
44
55use crate::stable_hasher::{
6 impl_stable_traits_for_trivial_type, FromStableHash, Hash64, StableHasherHash,
6 FromStableHash, Hash64, StableHasherHash, impl_stable_traits_for_trivial_type,
77};
88
99#[cfg(test)]
compiler/rustc_data_structures/src/flock/windows.rs+2-2
......@@ -6,8 +6,8 @@ use std::path::Path;
66use tracing::debug;
77use windows::Win32::Foundation::{ERROR_INVALID_FUNCTION, HANDLE};
88use windows::Win32::Storage::FileSystem::{
9 LockFileEx, FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE, LOCKFILE_EXCLUSIVE_LOCK,
10 LOCKFILE_FAIL_IMMEDIATELY, LOCK_FILE_FLAGS,
9 FILE_SHARE_DELETE, FILE_SHARE_READ, FILE_SHARE_WRITE, LOCK_FILE_FLAGS, LOCKFILE_EXCLUSIVE_LOCK,
10 LOCKFILE_FAIL_IMMEDIATELY, LockFileEx,
1111};
1212use windows::Win32::System::IO::OVERLAPPED;
1313
compiler/rustc_data_structures/src/graph/dominators/tests.rs+39-26
......@@ -15,10 +15,17 @@ fn diamond() {
1515#[test]
1616fn paper() {
1717 // example from the paper:
18 let graph = TestGraph::new(
19 6,
20 &[(6, 5), (6, 4), (5, 1), (4, 2), (4, 3), (1, 2), (2, 3), (3, 2), (2, 1)],
21 );
18 let graph = TestGraph::new(6, &[
19 (6, 5),
20 (6, 4),
21 (5, 1),
22 (4, 2),
23 (4, 3),
24 (1, 2),
25 (2, 3),
26 (3, 2),
27 (2, 1),
28 ]);
2229
2330 let d = dominators(&graph);
2431 assert_eq!(d.immediate_dominator(0), None); // <-- note that 0 is not in graph
......@@ -33,10 +40,19 @@ fn paper() {
3340#[test]
3441fn paper_slt() {
3542 // example from the paper:
36 let graph = TestGraph::new(
37 1,
38 &[(1, 2), (1, 3), (2, 3), (2, 7), (3, 4), (3, 6), (4, 5), (5, 4), (6, 7), (7, 8), (8, 5)],
39 );
43 let graph = TestGraph::new(1, &[
44 (1, 2),
45 (1, 3),
46 (2, 3),
47 (2, 7),
48 (3, 4),
49 (3, 6),
50 (4, 5),
51 (5, 4),
52 (6, 7),
53 (7, 8),
54 (8, 5),
55 ]);
4056
4157 dominators(&graph);
4258}
......@@ -53,24 +69,21 @@ fn immediate_dominator() {
5369
5470#[test]
5571fn transitive_dominator() {
56 let graph = TestGraph::new(
57 0,
58 &[
59 // First tree branch.
60 (0, 1),
61 (1, 2),
62 (2, 3),
63 (3, 4),
64 // Second tree branch.
65 (1, 5),
66 (5, 6),
67 // Third tree branch.
68 (0, 7),
69 // These links make 0 the dominator for 2 and 3.
70 (7, 2),
71 (5, 3),
72 ],
73 );
72 let graph = TestGraph::new(0, &[
73 // First tree branch.
74 (0, 1),
75 (1, 2),
76 (2, 3),
77 (3, 4),
78 // Second tree branch.
79 (1, 5),
80 (5, 6),
81 // Third tree branch.
82 (0, 7),
83 // These links make 0 the dominator for 2 and 3.
84 (7, 2),
85 (5, 3),
86 ]);
7487
7588 let d = dominators(&graph);
7689 assert_eq!(d.immediate_dominator(2), Some(0));
compiler/rustc_data_structures/src/graph/implementation/tests.rs+4-7
......@@ -110,13 +110,10 @@ fn each_adjacent_from_a() {
110110#[test]
111111fn each_adjacent_from_b() {
112112 let graph = create_graph();
113 test_adjacent_edges(
114 &graph,
115 NodeIndex(1),
116 "B",
117 &[("FB", "F"), ("AB", "A")],
118 &[("BD", "D"), ("BC", "C")],
119 );
113 test_adjacent_edges(&graph, NodeIndex(1), "B", &[("FB", "F"), ("AB", "A")], &[
114 ("BD", "D"),
115 ("BC", "C"),
116 ]);
120117}
121118
122119#[test]
compiler/rustc_data_structures/src/graph/scc/tests.rs+40-43
......@@ -326,49 +326,46 @@ fn test_bug_max_leak_minimised() {
326326
327327#[test]
328328fn test_bug_max_leak() {
329 let graph = TestGraph::new(
330 8,
331 &[
332 (0, 0),
333 (0, 18),
334 (0, 19),
335 (0, 1),
336 (0, 2),
337 (0, 7),
338 (0, 8),
339 (0, 23),
340 (18, 0),
341 (18, 12),
342 (19, 0),
343 (19, 25),
344 (12, 18),
345 (12, 3),
346 (12, 5),
347 (3, 12),
348 (3, 21),
349 (3, 22),
350 (5, 13),
351 (21, 3),
352 (22, 3),
353 (13, 5),
354 (13, 4),
355 (4, 13),
356 (4, 0),
357 (2, 11),
358 (7, 6),
359 (6, 20),
360 (20, 6),
361 (8, 17),
362 (17, 9),
363 (9, 16),
364 (16, 26),
365 (26, 15),
366 (15, 10),
367 (10, 14),
368 (14, 27),
369 (23, 24),
370 ],
371 );
329 let graph = TestGraph::new(8, &[
330 (0, 0),
331 (0, 18),
332 (0, 19),
333 (0, 1),
334 (0, 2),
335 (0, 7),
336 (0, 8),
337 (0, 23),
338 (18, 0),
339 (18, 12),
340 (19, 0),
341 (19, 25),
342 (12, 18),
343 (12, 3),
344 (12, 5),
345 (3, 12),
346 (3, 21),
347 (3, 22),
348 (5, 13),
349 (21, 3),
350 (22, 3),
351 (13, 5),
352 (13, 4),
353 (4, 13),
354 (4, 0),
355 (2, 11),
356 (7, 6),
357 (6, 20),
358 (20, 6),
359 (8, 17),
360 (17, 9),
361 (9, 16),
362 (16, 26),
363 (26, 15),
364 (15, 10),
365 (10, 14),
366 (14, 27),
367 (23, 24),
368 ]);
372369 let sccs: MaxReachedSccs = Sccs::new_with_annotation(&graph, |w| match w {
373370 22 => MaxReached(1),
374371 24 => MaxReached(2),
compiler/rustc_data_structures/src/obligation_forest/tests.rs+4-4
......@@ -347,10 +347,10 @@ fn diamond() {
347347 ));
348348 assert_eq!(d_count, 1);
349349 assert_eq!(ok.len(), 0);
350 assert_eq!(
351 err,
352 vec![super::Error { error: "operation failed", backtrace: vec!["D'", "A'.1", "A'"] }]
353 );
350 assert_eq!(err, vec![super::Error {
351 error: "operation failed",
352 backtrace: vec!["D'", "A'.1", "A'"]
353 }]);
354354
355355 let errors = forest.to_errors(());
356356 assert_eq!(errors.len(), 0);
compiler/rustc_data_structures/src/owned_slice/tests.rs+2-2
......@@ -1,9 +1,9 @@
11use std::ops::Deref;
2use std::sync::atomic::{self, AtomicBool};
32use std::sync::Arc;
3use std::sync::atomic::{self, AtomicBool};
44
55use crate::defer;
6use crate::owned_slice::{slice_owned, try_slice_owned, OwnedSlice};
6use crate::owned_slice::{OwnedSlice, slice_owned, try_slice_owned};
77
88#[test]
99fn smoke() {
compiler/rustc_data_structures/src/sharded.rs+1-1
......@@ -8,7 +8,7 @@ use either::Either;
88
99use crate::fx::{FxHashMap, FxHasher};
1010#[cfg(parallel_compiler)]
11use crate::sync::{is_dyn_thread_safe, CacheAligned};
11use crate::sync::{CacheAligned, is_dyn_thread_safe};
1212use crate::sync::{Lock, LockGuard, Mode};
1313
1414// 32 shards is sufficient to reduce contention on an 8-core Ryzen 7 1700,
compiler/rustc_data_structures/src/stable_hasher.rs+1-1
......@@ -14,7 +14,7 @@ pub use rustc_stable_hash::{
1414 FromStableHash, SipHasher128Hash as StableHasherHash, StableSipHasher128 as StableHasher,
1515};
1616
17pub use crate::hashes::{Hash128, Hash64};
17pub use crate::hashes::{Hash64, Hash128};
1818
1919/// Something that implements `HashStable<CTX>` can be hashed in a way that is
2020/// stable across multiple compilation sessions.
compiler/rustc_data_structures/src/sync/lock.rs+1-1
......@@ -25,8 +25,8 @@ mod maybe_sync {
2525 use std::mem::ManuallyDrop;
2626 use std::ops::{Deref, DerefMut};
2727
28 use parking_lot::lock_api::RawMutex as _;
2928 use parking_lot::RawMutex;
29 use parking_lot::lock_api::RawMutex as _;
3030
3131 use super::Mode;
3232 use crate::sync::mode;
compiler/rustc_data_structures/src/sync/parallel.rs+3-3
......@@ -4,7 +4,7 @@
44#![allow(dead_code)]
55
66use std::any::Any;
7use std::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
7use std::panic::{AssertUnwindSafe, catch_unwind, resume_unwind};
88
99#[cfg(not(parallel_compiler))]
1010pub use disabled::*;
......@@ -12,8 +12,8 @@ pub use disabled::*;
1212pub use enabled::*;
1313use parking_lot::Mutex;
1414
15use crate::sync::IntoDynSyncSend;
1615use crate::FatalErrorMarker;
16use crate::sync::IntoDynSyncSend;
1717
1818/// A guard used to hold panics that occur during a parallel section to later by unwound.
1919/// This is used for the parallel compiler to prevent fatal errors from non-deterministically
......@@ -102,7 +102,7 @@ mod disabled {
102102
103103#[cfg(parallel_compiler)]
104104mod enabled {
105 use crate::sync::{mode, parallel_guard, DynSend, DynSync, FromDyn};
105 use crate::sync::{DynSend, DynSync, FromDyn, mode, parallel_guard};
106106
107107 /// Runs a list of blocks in parallel. The first block is executed immediately on
108108 /// the current thread. Use that for the longest running block.
compiler/rustc_data_structures/src/work_queue.rs+1-1
......@@ -1,7 +1,7 @@
11use std::collections::VecDeque;
22
3use rustc_index::bit_set::BitSet;
43use rustc_index::Idx;
4use rustc_index::bit_set::BitSet;
55
66/// A work queue is a handy data structure for tracking work left to
77/// do. (For example, basic blocks left to process.) It is basically a
compiler/rustc_driver_impl/src/lib.rs+11-13
......@@ -24,7 +24,7 @@ use std::ffi::OsString;
2424use std::fmt::Write as _;
2525use std::fs::{self, File};
2626use std::io::{self, IsTerminal, Read, Write};
27use std::panic::{self, catch_unwind, PanicHookInfo};
27use std::panic::{self, PanicHookInfo, catch_unwind};
2828use std::path::PathBuf;
2929use std::process::{self, Command, Stdio};
3030use std::sync::atomic::{AtomicBool, Ordering};
......@@ -37,30 +37,30 @@ use rustc_codegen_ssa::traits::CodegenBackend;
3737use rustc_codegen_ssa::{CodegenErrors, CodegenResults};
3838use rustc_const_eval::CTRL_C_RECEIVED;
3939use rustc_data_structures::profiling::{
40 get_resident_set_size, print_time_passes_entry, TimePassesFormat,
40 TimePassesFormat, get_resident_set_size, print_time_passes_entry,
4141};
4242use rustc_errors::emitter::stderr_destination;
4343use rustc_errors::registry::Registry;
4444use rustc_errors::{
45 markdown, ColorConfig, DiagCtxt, ErrCode, ErrorGuaranteed, FatalError, PResult,
45 ColorConfig, DiagCtxt, ErrCode, ErrorGuaranteed, FatalError, PResult, markdown,
4646};
4747use rustc_feature::find_gated_cfg;
4848use rustc_interface::util::{self, get_codegen_backend};
49use rustc_interface::{interface, passes, Linker, Queries};
49use rustc_interface::{Linker, Queries, interface, passes};
5050use rustc_lint::unerased_lint_store;
5151use rustc_metadata::creader::MetadataLoader;
5252use rustc_metadata::locator;
5353use rustc_parse::{new_parser_from_file, new_parser_from_source_str, unwrap_or_emit_fatal};
5454use rustc_session::config::{
55 nightly_options, ErrorOutputType, Input, OutFileName, OutputType, UnstableOptions, CG_OPTIONS,
56 Z_OPTIONS,
55 CG_OPTIONS, ErrorOutputType, Input, OutFileName, OutputType, UnstableOptions, Z_OPTIONS,
56 nightly_options,
5757};
5858use rustc_session::getopts::{self, Matches};
5959use rustc_session::lint::{Lint, LintId};
6060use rustc_session::output::collect_crate_types;
61use rustc_session::{config, filesearch, EarlyDiagCtxt, Session};
62use rustc_span::source_map::FileLoader;
61use rustc_session::{EarlyDiagCtxt, Session, config, filesearch};
6362use rustc_span::FileName;
63use rustc_span::source_map::FileLoader;
6464use rustc_target::json::ToJson;
6565use rustc_target::spec::{Target, TargetTriple};
6666use time::OffsetDateTime;
......@@ -410,11 +410,9 @@ fn run_compiler(
410410 });
411411 } else {
412412 let krate = queries.parse()?;
413 pretty::print(
414 sess,
415 pp_mode,
416 pretty::PrintExtra::AfterParsing { krate: &*krate.borrow() },
417 );
413 pretty::print(sess, pp_mode, pretty::PrintExtra::AfterParsing {
414 krate: &*krate.borrow(),
415 });
418416 }
419417 trace!("finished pretty-printing");
420418 return early_exit();
compiler/rustc_driver_impl/src/pretty.rs+2-2
......@@ -8,11 +8,11 @@ use rustc_errors::FatalError;
88use rustc_middle::bug;
99use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
1010use rustc_middle::ty::{self, TyCtxt};
11use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode};
1211use rustc_session::Session;
12use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode};
1313use rustc_smir::rustc_internal::pretty::write_smir_pretty;
14use rustc_span::symbol::Ident;
1514use rustc_span::FileName;
15use rustc_span::symbol::Ident;
1616use tracing::debug;
1717use {rustc_ast as ast, rustc_hir_pretty as pprust_hir};
1818
compiler/rustc_driver_impl/src/signal_handler.rs+1-1
......@@ -1,7 +1,7 @@
11//! Signal handler for rustc
22//! Primarily used to extract a backtrace from stack overflow
33
4use std::alloc::{alloc, Layout};
4use std::alloc::{Layout, alloc};
55use std::{fmt, mem, ptr};
66
77use rustc_interface::util::{DEFAULT_STACK_SIZE, STACK_SIZE};
compiler/rustc_error_messages/src/lib.rs+4-4
......@@ -16,20 +16,20 @@ use std::path::{Path, PathBuf};
1616use std::sync::LazyLock as Lazy;
1717use std::{fmt, fs, io};
1818
19pub use fluent_bundle::types::FluentType;
2019use fluent_bundle::FluentResource;
20pub use fluent_bundle::types::FluentType;
2121pub use fluent_bundle::{self, FluentArgs, FluentError, FluentValue};
2222use fluent_syntax::parser::ParserError;
2323use icu_provider_adapters::fallback::{LocaleFallbackProvider, LocaleFallbacker};
24#[cfg(parallel_compiler)]
25use intl_memoizer::concurrent::IntlLangMemoizer;
2624#[cfg(not(parallel_compiler))]
2725use intl_memoizer::IntlLangMemoizer;
26#[cfg(parallel_compiler)]
27use intl_memoizer::concurrent::IntlLangMemoizer;
2828use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
2929use rustc_macros::{Decodable, Encodable};
3030use rustc_span::Span;
3131use tracing::{instrument, trace};
32pub use unic_langid::{langid, LanguageIdentifier};
32pub use unic_langid::{LanguageIdentifier, langid};
3333
3434pub type FluentBundle =
3535 IntoDynSyncSend<fluent_bundle::bundle::FluentBundle<FluentResource, IntlLangMemoizer>>;
compiler/rustc_errors/src/annotate_snippet_emitter_writer.rs+2-2
......@@ -8,12 +8,12 @@
88use annotate_snippets::{Renderer, Snippet};
99use rustc_data_structures::sync::Lrc;
1010use rustc_error_messages::FluentArgs;
11use rustc_span::source_map::SourceMap;
1211use rustc_span::SourceFile;
12use rustc_span::source_map::SourceMap;
1313
1414use crate::emitter::FileWithAnnotatedLines;
1515use crate::snippet::Line;
16use crate::translation::{to_fluent_args, Translate};
16use crate::translation::{Translate, to_fluent_args};
1717use crate::{
1818 CodeSuggestion, DiagInner, DiagMessage, Emitter, ErrCode, FluentBundle, LazyFallbackBundle,
1919 Level, MultiSpan, Style, Subdiag,
compiler/rustc_errors/src/diagnostic.rs+2-2
......@@ -7,12 +7,12 @@ use std::panic;
77use std::thread::panicking;
88
99use rustc_data_structures::fx::FxIndexMap;
10use rustc_error_messages::{fluent_value_from_str_list_sep_by_and, FluentValue};
10use rustc_error_messages::{FluentValue, fluent_value_from_str_list_sep_by_and};
1111use rustc_lint_defs::Applicability;
1212use rustc_macros::{Decodable, Encodable};
1313use rustc_span::source_map::Spanned;
1414use rustc_span::symbol::Symbol;
15use rustc_span::{Span, DUMMY_SP};
15use rustc_span::{DUMMY_SP, Span};
1616use tracing::debug;
1717
1818use crate::snippet::Style;
compiler/rustc_errors/src/diagnostic_impls.rs+3-3
......@@ -7,9 +7,9 @@ use std::process::ExitStatus;
77
88use rustc_ast_pretty::pprust;
99use rustc_macros::Subdiagnostic;
10use rustc_span::Span;
1011use rustc_span::edition::Edition;
1112use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, Symbol};
12use rustc_span::Span;
1313use rustc_target::abi::TargetDataLayoutErrors;
1414use rustc_target::spec::{PanicStrategy, SplitDebuginfo, StackProtector, TargetTriple};
1515use rustc_type_ir::{ClosureKind, FloatTy};
......@@ -17,8 +17,8 @@ use {rustc_ast as ast, rustc_hir as hir};
1717
1818use crate::diagnostic::DiagLocation;
1919use crate::{
20 fluent_generated as fluent, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee,
21 ErrCode, IntoDiagArg, Level, SubdiagMessageOp, Subdiagnostic,
20 Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, ErrCode, IntoDiagArg, Level,
21 SubdiagMessageOp, Subdiagnostic, fluent_generated as fluent,
2222};
2323
2424pub struct DiagArgFromDisplay<'a>(pub &'a dyn fmt::Display);
compiler/rustc_errors/src/emitter.rs+3-3
......@@ -8,7 +8,7 @@
88//! The output types are defined in `rustc_session::config::ErrorOutputType`.
99
1010use std::borrow::Cow;
11use std::cmp::{max, min, Reverse};
11use std::cmp::{Reverse, max, min};
1212use std::error::Report;
1313use std::io::prelude::*;
1414use std::io::{self, IsTerminal};
......@@ -22,7 +22,7 @@ use rustc_error_messages::{FluentArgs, SpanLabel};
2222use rustc_lint_defs::pluralize;
2323use rustc_span::hygiene::{ExpnKind, MacroKind};
2424use rustc_span::source_map::SourceMap;
25use rustc_span::{char_width, FileLines, FileName, SourceFile, Span};
25use rustc_span::{FileLines, FileName, SourceFile, Span, char_width};
2626use termcolor::{Buffer, BufferWriter, Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
2727use tracing::{debug, instrument, trace, warn};
2828
......@@ -31,7 +31,7 @@ use crate::snippet::{
3131 Annotation, AnnotationColumn, AnnotationType, Line, MultilineAnnotation, Style, StyledString,
3232};
3333use crate::styled_buffer::StyledBuffer;
34use crate::translation::{to_fluent_args, Translate};
34use crate::translation::{Translate, to_fluent_args};
3535use crate::{
3636 CodeSuggestion, DiagCtxt, DiagInner, DiagMessage, ErrCode, FluentBundle, LazyFallbackBundle,
3737 Level, MultiSpan, Subdiag, SubstitutionHighlight, SuggestionStyle, TerminalUrl,
compiler/rustc_errors/src/json.rs+4-4
......@@ -19,19 +19,19 @@ use derive_setters::Setters;
1919use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
2020use rustc_error_messages::FluentArgs;
2121use rustc_lint_defs::Applicability;
22use rustc_span::Span;
2223use rustc_span::hygiene::ExpnData;
2324use rustc_span::source_map::SourceMap;
24use rustc_span::Span;
2525use serde::Serialize;
2626use termcolor::{ColorSpec, WriteColor};
2727
2828use crate::diagnostic::IsLint;
2929use crate::emitter::{
30 should_show_source_code, ColorConfig, Destination, Emitter, HumanEmitter,
31 HumanReadableErrorType,
30 ColorConfig, Destination, Emitter, HumanEmitter, HumanReadableErrorType,
31 should_show_source_code,
3232};
3333use crate::registry::Registry;
34use crate::translation::{to_fluent_args, Translate};
34use crate::translation::{Translate, to_fluent_args};
3535use crate::{
3636 CodeSuggestion, FluentBundle, LazyFallbackBundle, MultiSpan, SpanLabel, Subdiag, Suggestions,
3737 TerminalUrl,
compiler/rustc_errors/src/json/tests.rs+65-97
......@@ -1,7 +1,7 @@
11use std::str;
22
3use rustc_span::source_map::FilePathMapping;
43use rustc_span::BytePos;
4use rustc_span::source_map::FilePathMapping;
55use serde::Deserialize;
66
77use super::*;
......@@ -69,128 +69,96 @@ fn test_positions(code: &str, span: (u32, u32), expected_output: SpanTestData) {
6969
7070#[test]
7171fn empty() {
72 test_positions(
73 " ",
74 (0, 1),
75 SpanTestData {
76 byte_start: 0,
77 byte_end: 1,
78 line_start: 1,
79 column_start: 1,
80 line_end: 1,
81 column_end: 2,
82 },
83 )
72 test_positions(" ", (0, 1), SpanTestData {
73 byte_start: 0,
74 byte_end: 1,
75 line_start: 1,
76 column_start: 1,
77 line_end: 1,
78 column_end: 2,
79 })
8480}
8581
8682#[test]
8783fn bom() {
88 test_positions(
89 "\u{feff} ",
90 (0, 1),
91 SpanTestData {
92 byte_start: 3,
93 byte_end: 4,
94 line_start: 1,
95 column_start: 1,
96 line_end: 1,
97 column_end: 2,
98 },
99 )
84 test_positions("\u{feff} ", (0, 1), SpanTestData {
85 byte_start: 3,
86 byte_end: 4,
87 line_start: 1,
88 column_start: 1,
89 line_end: 1,
90 column_end: 2,
91 })
10092}
10193
10294#[test]
10395fn lf_newlines() {
104 test_positions(
105 "\nmod foo;\nmod bar;\n",
106 (5, 12),
107 SpanTestData {
108 byte_start: 5,
109 byte_end: 12,
110 line_start: 2,
111 column_start: 5,
112 line_end: 3,
113 column_end: 3,
114 },
115 )
96 test_positions("\nmod foo;\nmod bar;\n", (5, 12), SpanTestData {
97 byte_start: 5,
98 byte_end: 12,
99 line_start: 2,
100 column_start: 5,
101 line_end: 3,
102 column_end: 3,
103 })
116104}
117105
118106#[test]
119107fn crlf_newlines() {
120 test_positions(
121 "\r\nmod foo;\r\nmod bar;\r\n",
122 (5, 12),
123 SpanTestData {
124 byte_start: 6,
125 byte_end: 14,
126 line_start: 2,
127 column_start: 5,
128 line_end: 3,
129 column_end: 3,
130 },
131 )
108 test_positions("\r\nmod foo;\r\nmod bar;\r\n", (5, 12), SpanTestData {
109 byte_start: 6,
110 byte_end: 14,
111 line_start: 2,
112 column_start: 5,
113 line_end: 3,
114 column_end: 3,
115 })
132116}
133117
134118#[test]
135119fn crlf_newlines_with_bom() {
136 test_positions(
137 "\u{feff}\r\nmod foo;\r\nmod bar;\r\n",
138 (5, 12),
139 SpanTestData {
140 byte_start: 9,
141 byte_end: 17,
142 line_start: 2,
143 column_start: 5,
144 line_end: 3,
145 column_end: 3,
146 },
147 )
120 test_positions("\u{feff}\r\nmod foo;\r\nmod bar;\r\n", (5, 12), SpanTestData {
121 byte_start: 9,
122 byte_end: 17,
123 line_start: 2,
124 column_start: 5,
125 line_end: 3,
126 column_end: 3,
127 })
148128}
149129
150130#[test]
151131fn span_before_crlf() {
152 test_positions(
153 "foo\r\nbar",
154 (2, 3),
155 SpanTestData {
156 byte_start: 2,
157 byte_end: 3,
158 line_start: 1,
159 column_start: 3,
160 line_end: 1,
161 column_end: 4,
162 },
163 )
132 test_positions("foo\r\nbar", (2, 3), SpanTestData {
133 byte_start: 2,
134 byte_end: 3,
135 line_start: 1,
136 column_start: 3,
137 line_end: 1,
138 column_end: 4,
139 })
164140}
165141
166142#[test]
167143fn span_on_crlf() {
168 test_positions(
169 "foo\r\nbar",
170 (3, 4),
171 SpanTestData {
172 byte_start: 3,
173 byte_end: 5,
174 line_start: 1,
175 column_start: 4,
176 line_end: 2,
177 column_end: 1,
178 },
179 )
144 test_positions("foo\r\nbar", (3, 4), SpanTestData {
145 byte_start: 3,
146 byte_end: 5,
147 line_start: 1,
148 column_start: 4,
149 line_end: 2,
150 column_end: 1,
151 })
180152}
181153
182154#[test]
183155fn span_after_crlf() {
184 test_positions(
185 "foo\r\nbar",
186 (4, 5),
187 SpanTestData {
188 byte_start: 5,
189 byte_end: 6,
190 line_start: 2,
191 column_start: 1,
192 line_end: 2,
193 column_end: 2,
194 },
195 )
156 test_positions("foo\r\nbar", (4, 5), SpanTestData {
157 byte_start: 5,
158 byte_end: 6,
159 line_start: 2,
160 column_start: 1,
161 line_end: 2,
162 column_end: 2,
163 })
196164}
compiler/rustc_errors/src/lib.rs+8-8
......@@ -42,6 +42,7 @@ use std::ops::DerefMut;
4242use std::path::{Path, PathBuf};
4343use std::{fmt, panic};
4444
45use Level::*;
4546pub use codes::*;
4647pub use diagnostic::{
4748 BugAbort, Diag, DiagArg, DiagArgMap, DiagArgName, DiagArgValue, DiagInner, DiagStyledString,
......@@ -53,29 +54,28 @@ pub use diagnostic_impls::{
5354 IndicateAnonymousLifetime, SingleLabelManySpans,
5455};
5556pub use emitter::ColorConfig;
56use emitter::{is_case_difference, is_different, DynEmitter, Emitter};
57use emitter::{DynEmitter, Emitter, is_case_difference, is_different};
5758use registry::Registry;
59use rustc_data_structures::AtomicRef;
5860use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
5961use rustc_data_structures::stable_hasher::{Hash128, StableHasher};
6062use rustc_data_structures::sync::{Lock, Lrc};
61use rustc_data_structures::AtomicRef;
6263pub use rustc_error_messages::{
63 fallback_fluent_bundle, fluent_bundle, DiagMessage, FluentBundle, LanguageIdentifier,
64 LazyFallbackBundle, MultiSpan, SpanLabel, SubdiagMessage,
64 DiagMessage, FluentBundle, LanguageIdentifier, LazyFallbackBundle, MultiSpan, SpanLabel,
65 SubdiagMessage, fallback_fluent_bundle, fluent_bundle,
6566};
6667use rustc_lint_defs::LintExpectationId;
67pub use rustc_lint_defs::{pluralize, Applicability};
68pub use rustc_lint_defs::{Applicability, pluralize};
6869use rustc_macros::{Decodable, Encodable};
70pub use rustc_span::ErrorGuaranteed;
6971pub use rustc_span::fatal_error::{FatalError, FatalErrorMarker};
7072use rustc_span::source_map::SourceMap;
71pub use rustc_span::ErrorGuaranteed;
72use rustc_span::{Loc, Span, DUMMY_SP};
73use rustc_span::{DUMMY_SP, Loc, Span};
7374pub use snippet::Style;
7475// Used by external projects such as `rust-gpu`.
7576// See https://github.com/rust-lang/rust/pull/115393.
7677pub use termcolor::{Color, ColorSpec, WriteColor};
7778use tracing::debug;
78use Level::*;
7979
8080pub mod annotate_snippet_emitter_writer;
8181pub mod codes;
compiler/rustc_errors/src/lock.rs+2-2
......@@ -16,11 +16,11 @@ pub(crate) fn acquire_global_lock(name: &str) -> Box<dyn Any> {
1616 use std::ffi::CString;
1717 use std::io;
1818
19 use windows::core::PCSTR;
2019 use windows::Win32::Foundation::{CloseHandle, HANDLE, WAIT_ABANDONED, WAIT_OBJECT_0};
2120 use windows::Win32::System::Threading::{
22 CreateMutexA, ReleaseMutex, WaitForSingleObject, INFINITE,
21 CreateMutexA, INFINITE, ReleaseMutex, WaitForSingleObject,
2322 };
23 use windows::core::PCSTR;
2424
2525 struct Handle(HANDLE);
2626
compiler/rustc_errors/src/tests.rs+2-2
......@@ -1,11 +1,11 @@
11use rustc_data_structures::sync::{IntoDynSyncSend, Lrc};
22use rustc_error_messages::fluent_bundle::resolver::errors::{ReferenceKind, ResolverError};
3use rustc_error_messages::{langid, DiagMessage};
3use rustc_error_messages::{DiagMessage, langid};
44
5use crate::FluentBundle;
56use crate::error::{TranslateError, TranslateErrorKind};
67use crate::fluent_bundle::*;
78use crate::translation::Translate;
8use crate::FluentBundle;
99
1010struct Dummy {
1111 bundle: FluentBundle,
compiler/rustc_expand/src/base.rs+4-4
......@@ -15,8 +15,8 @@ use rustc_data_structures::sync::{self, Lrc};
1515use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, PResult};
1616use rustc_feature::Features;
1717use rustc_lint_defs::{BufferedEarlyLint, RegisteredTools};
18use rustc_parse::parser::Parser;
1918use rustc_parse::MACRO_ARGUMENTS;
19use rustc_parse::parser::Parser;
2020use rustc_session::config::CollapseMacroDebuginfo;
2121use rustc_session::parse::ParseSess;
2222use rustc_session::{Limit, Session};
......@@ -24,9 +24,9 @@ use rustc_span::def_id::{CrateNum, DefId, LocalDefId};
2424use rustc_span::edition::Edition;
2525use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, MacroKind};
2626use rustc_span::source_map::SourceMap;
27use rustc_span::symbol::{kw, sym, Ident, Symbol};
28use rustc_span::{FileName, Span, DUMMY_SP};
29use smallvec::{smallvec, SmallVec};
27use rustc_span::symbol::{Ident, Symbol, kw, sym};
28use rustc_span::{DUMMY_SP, FileName, Span};
29use smallvec::{SmallVec, smallvec};
3030use thin_vec::ThinVec;
3131
3232use crate::base::ast::NestedMetaItem;
compiler/rustc_expand/src/build.rs+17-23
......@@ -1,12 +1,12 @@
11use rustc_ast::ptr::P;
22use rustc_ast::util::literal;
33use rustc_ast::{
4 self as ast, attr, token, AttrVec, BlockCheckMode, Expr, LocalKind, MatchKind, PatKind, UnOp,
4 self as ast, AttrVec, BlockCheckMode, Expr, LocalKind, MatchKind, PatKind, UnOp, attr, token,
55};
66use rustc_span::source_map::Spanned;
7use rustc_span::symbol::{kw, sym, Ident, Symbol};
8use rustc_span::{Span, DUMMY_SP};
9use thin_vec::{thin_vec, ThinVec};
7use rustc_span::symbol::{Ident, Symbol, kw, sym};
8use rustc_span::{DUMMY_SP, Span};
9use thin_vec::{ThinVec, thin_vec};
1010
1111use crate::base::ExtCtxt;
1212
......@@ -152,18 +152,15 @@ impl<'a> ExtCtxt<'a> {
152152 }
153153
154154 pub fn trait_bound(&self, path: ast::Path, is_const: bool) -> ast::GenericBound {
155 ast::GenericBound::Trait(
156 self.poly_trait_ref(path.span, path),
157 ast::TraitBoundModifiers {
158 polarity: ast::BoundPolarity::Positive,
159 constness: if is_const {
160 ast::BoundConstness::Maybe(DUMMY_SP)
161 } else {
162 ast::BoundConstness::Never
163 },
164 asyncness: ast::BoundAsyncness::Normal,
155 ast::GenericBound::Trait(self.poly_trait_ref(path.span, path), ast::TraitBoundModifiers {
156 polarity: ast::BoundPolarity::Positive,
157 constness: if is_const {
158 ast::BoundConstness::Maybe(DUMMY_SP)
159 } else {
160 ast::BoundConstness::Never
165161 },
166 )
162 asyncness: ast::BoundAsyncness::Normal,
163 })
167164 }
168165
169166 pub fn lifetime(&self, span: Span, ident: Ident) -> ast::Lifetime {
......@@ -232,14 +229,11 @@ impl<'a> ExtCtxt<'a> {
232229 }
233230
234231 pub fn block_expr(&self, expr: P<ast::Expr>) -> P<ast::Block> {
235 self.block(
236 expr.span,
237 thin_vec![ast::Stmt {
238 id: ast::DUMMY_NODE_ID,
239 span: expr.span,
240 kind: ast::StmtKind::Expr(expr),
241 }],
242 )
232 self.block(expr.span, thin_vec![ast::Stmt {
233 id: ast::DUMMY_NODE_ID,
234 span: expr.span,
235 kind: ast::StmtKind::Expr(expr),
236 }])
243237 }
244238 pub fn block(&self, span: Span, stmts: ThinVec<ast::Stmt>) -> P<ast::Block> {
245239 P(ast::Block {
compiler/rustc_expand/src/config.rs+3-3
......@@ -9,14 +9,14 @@ use rustc_ast::{self as ast, AttrStyle, Attribute, HasAttrs, HasTokens, MetaItem
99use rustc_attr as attr;
1010use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
1111use rustc_feature::{
12 AttributeSafety, Features, ACCEPTED_FEATURES, REMOVED_FEATURES, UNSTABLE_FEATURES,
12 ACCEPTED_FEATURES, AttributeSafety, Features, REMOVED_FEATURES, UNSTABLE_FEATURES,
1313};
1414use rustc_lint_defs::BuiltinLintDiag;
1515use rustc_parse::validate_attr;
16use rustc_session::parse::feature_err;
1716use rustc_session::Session;
18use rustc_span::symbol::{sym, Symbol};
17use rustc_session::parse::feature_err;
1918use rustc_span::Span;
19use rustc_span::symbol::{Symbol, sym};
2020use thin_vec::ThinVec;
2121use tracing::instrument;
2222
compiler/rustc_expand/src/expand.rs+5-5
......@@ -8,7 +8,7 @@ use rustc_ast::mut_visit::*;
88use rustc_ast::ptr::P;
99use rustc_ast::token::{self, Delimiter};
1010use rustc_ast::tokenstream::TokenStream;
11use rustc_ast::visit::{self, try_visit, walk_list, AssocCtxt, Visitor, VisitorResult};
11use rustc_ast::visit::{self, AssocCtxt, Visitor, VisitorResult, try_visit, walk_list};
1212use rustc_ast::{
1313 AssocItemKind, AstNodeWrapper, AttrArgs, AttrStyle, AttrVec, ExprKind, ForeignItemKind,
1414 HasAttrs, HasNodeId, Inline, ItemKind, MacStmtStyle, MetaItemKind, ModKind, NestedMetaItem,
......@@ -23,12 +23,12 @@ use rustc_parse::parser::{
2323 AttemptLocalParseRecovery, CommaRecoveryMode, ForceCollect, Parser, RecoverColon, RecoverComma,
2424};
2525use rustc_parse::validate_attr;
26use rustc_session::lint::builtin::{UNUSED_ATTRIBUTES, UNUSED_DOC_COMMENTS};
2726use rustc_session::lint::BuiltinLintDiag;
27use rustc_session::lint::builtin::{UNUSED_ATTRIBUTES, UNUSED_DOC_COMMENTS};
2828use rustc_session::parse::feature_err;
2929use rustc_session::{Limit, Session};
3030use rustc_span::hygiene::SyntaxContext;
31use rustc_span::symbol::{sym, Ident};
31use rustc_span::symbol::{Ident, sym};
3232use rustc_span::{ErrorGuaranteed, FileName, LocalExpnId, Span};
3333use smallvec::SmallVec;
3434
......@@ -42,9 +42,9 @@ use crate::errors::{
4242use crate::fluent_generated;
4343use crate::mbe::diagnostics::annotate_err_with_kind;
4444use crate::module::{
45 mod_dir_path, mod_file_path_from_attr, parse_external_mod, DirOwnership, ParsedExternalMod,
45 DirOwnership, ParsedExternalMod, mod_dir_path, mod_file_path_from_attr, parse_external_mod,
4646};
47use crate::placeholders::{placeholder, PlaceholderExpander};
47use crate::placeholders::{PlaceholderExpander, placeholder};
4848
4949macro_rules! ast_fragments {
5050 (
compiler/rustc_expand/src/mbe.rs+1-1
......@@ -16,8 +16,8 @@ use metavar_expr::MetaVarExpr;
1616use rustc_ast::token::{Delimiter, NonterminalKind, Token, TokenKind};
1717use rustc_ast::tokenstream::{DelimSpacing, DelimSpan};
1818use rustc_macros::{Decodable, Encodable};
19use rustc_span::symbol::Ident;
2019use rustc_span::Span;
20use rustc_span::symbol::Ident;
2121
2222/// Contains the sub-token-trees of a "delimited" token tree such as `(a b c)`.
2323/// The delimiters are not represented explicitly in the `tts` vector.
compiler/rustc_expand/src/mbe/diagnostics.rs+3-3
......@@ -12,11 +12,11 @@ use rustc_span::symbol::Ident;
1212use rustc_span::{ErrorGuaranteed, Span};
1313use tracing::debug;
1414
15use super::macro_rules::{parser_from_cx, NoopTracker};
16use crate::expand::{parse_ast_fragment, AstFragmentKind};
15use super::macro_rules::{NoopTracker, parser_from_cx};
16use crate::expand::{AstFragmentKind, parse_ast_fragment};
1717use crate::mbe::macro_parser::ParseResult::*;
1818use crate::mbe::macro_parser::{MatcherLoc, NamedParseResult, TtParser};
19use crate::mbe::macro_rules::{try_match_macro, Tracker};
19use crate::mbe::macro_rules::{Tracker, try_match_macro};
2020
2121pub(super) fn failed_to_match_macro(
2222 psess: &ParseSess,
compiler/rustc_expand/src/mbe/macro_check.rs+2-2
......@@ -108,14 +108,14 @@
108108use std::iter;
109109
110110use rustc_ast::token::{Delimiter, IdentIsRaw, Token, TokenKind};
111use rustc_ast::{NodeId, DUMMY_NODE_ID};
111use rustc_ast::{DUMMY_NODE_ID, NodeId};
112112use rustc_data_structures::fx::FxHashMap;
113113use rustc_errors::MultiSpan;
114114use rustc_lint_defs::BuiltinLintDiag;
115115use rustc_session::lint::builtin::{META_VARIABLE_MISUSE, MISSING_FRAGMENT_SPECIFIER};
116116use rustc_session::parse::ParseSess;
117117use rustc_span::edition::Edition;
118use rustc_span::symbol::{kw, MacroRulesNormalizedIdent};
118use rustc_span::symbol::{MacroRulesNormalizedIdent, kw};
119119use rustc_span::{ErrorGuaranteed, Span};
120120use smallvec::SmallVec;
121121
compiler/rustc_expand/src/mbe/macro_parser.rs+3-3
......@@ -75,16 +75,16 @@ use std::collections::hash_map::Entry::{Occupied, Vacant};
7575use std::fmt::Display;
7676use std::rc::Rc;
7777
78pub(crate) use NamedMatch::*;
79pub(crate) use ParseResult::*;
7880use rustc_ast::token::{self, DocComment, NonterminalKind, Token};
7981use rustc_ast_pretty::pprust;
8082use rustc_data_structures::fx::FxHashMap;
8183use rustc_errors::ErrorGuaranteed;
8284use rustc_lint_defs::pluralize;
8385use rustc_parse::parser::{ParseNtResult, Parser};
84use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
8586use rustc_span::Span;
86pub(crate) use NamedMatch::*;
87pub(crate) use ParseResult::*;
87use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
8888
8989use crate::mbe::macro_rules::Tracker;
9090use crate::mbe::{KleeneOp, TokenTree};
compiler/rustc_expand/src/mbe/macro_rules.rs+28-34
......@@ -8,23 +8,23 @@ use rustc_ast::token::NtPatKind::*;
88use rustc_ast::token::TokenKind::*;
99use rustc_ast::token::{self, Delimiter, NonterminalKind, Token, TokenKind};
1010use rustc_ast::tokenstream::{DelimSpan, TokenStream};
11use rustc_ast::{NodeId, DUMMY_NODE_ID};
11use rustc_ast::{DUMMY_NODE_ID, NodeId};
1212use rustc_ast_pretty::pprust;
1313use rustc_attr::{self as attr, TransparencyError};
1414use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
1515use rustc_errors::{Applicability, ErrorGuaranteed};
1616use rustc_feature::Features;
17use rustc_lint_defs::BuiltinLintDiag;
1718use rustc_lint_defs::builtin::{
1819 RUST_2021_INCOMPATIBLE_OR_PATTERNS, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
1920};
20use rustc_lint_defs::BuiltinLintDiag;
2121use rustc_parse::parser::{ParseNtResult, Parser, Recovery};
22use rustc_session::parse::ParseSess;
2322use rustc_session::Session;
23use rustc_session::parse::ParseSess;
24use rustc_span::Span;
2425use rustc_span::edition::Edition;
2526use rustc_span::hygiene::Transparency;
26use rustc_span::symbol::{kw, sym, Ident, MacroRulesNormalizedIdent};
27use rustc_span::Span;
27use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, kw, sym};
2828use tracing::{debug, instrument, trace, trace_span};
2929
3030use super::diagnostics;
......@@ -33,7 +33,7 @@ use crate::base::{
3333 DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult, SyntaxExtension,
3434 SyntaxExtensionKind, TTMacroExpander,
3535};
36use crate::expand::{ensure_complete_parse, parse_ast_fragment, AstFragment, AstFragmentKind};
36use crate::expand::{AstFragment, AstFragmentKind, ensure_complete_parse, parse_ast_fragment};
3737use crate::mbe;
3838use crate::mbe::diagnostics::{annotate_doc_comment, parse_failure_msg};
3939use crate::mbe::macro_check;
......@@ -408,35 +408,29 @@ pub fn compile_declarative_macro(
408408 // ...quasiquoting this would be nice.
409409 // These spans won't matter, anyways
410410 let argument_gram = vec![
411 mbe::TokenTree::Sequence(
412 DelimSpan::dummy(),
413 mbe::SequenceRepetition {
414 tts: vec![
415 mbe::TokenTree::MetaVarDecl(def.span, lhs_nm, tt_spec),
416 mbe::TokenTree::token(token::FatArrow, def.span),
417 mbe::TokenTree::MetaVarDecl(def.span, rhs_nm, tt_spec),
418 ],
419 separator: Some(Token::new(
420 if macro_rules { token::Semi } else { token::Comma },
421 def.span,
422 )),
423 kleene: mbe::KleeneToken::new(mbe::KleeneOp::OneOrMore, def.span),
424 num_captures: 2,
425 },
426 ),
411 mbe::TokenTree::Sequence(DelimSpan::dummy(), mbe::SequenceRepetition {
412 tts: vec![
413 mbe::TokenTree::MetaVarDecl(def.span, lhs_nm, tt_spec),
414 mbe::TokenTree::token(token::FatArrow, def.span),
415 mbe::TokenTree::MetaVarDecl(def.span, rhs_nm, tt_spec),
416 ],
417 separator: Some(Token::new(
418 if macro_rules { token::Semi } else { token::Comma },
419 def.span,
420 )),
421 kleene: mbe::KleeneToken::new(mbe::KleeneOp::OneOrMore, def.span),
422 num_captures: 2,
423 }),
427424 // to phase into semicolon-termination instead of semicolon-separation
428 mbe::TokenTree::Sequence(
429 DelimSpan::dummy(),
430 mbe::SequenceRepetition {
431 tts: vec![mbe::TokenTree::token(
432 if macro_rules { token::Semi } else { token::Comma },
433 def.span,
434 )],
435 separator: None,
436 kleene: mbe::KleeneToken::new(mbe::KleeneOp::ZeroOrMore, def.span),
437 num_captures: 0,
438 },
439 ),
425 mbe::TokenTree::Sequence(DelimSpan::dummy(), mbe::SequenceRepetition {
426 tts: vec![mbe::TokenTree::token(
427 if macro_rules { token::Semi } else { token::Comma },
428 def.span,
429 )],
430 separator: None,
431 kleene: mbe::KleeneToken::new(mbe::KleeneOp::ZeroOrMore, def.span),
432 num_captures: 0,
433 }),
440434 ];
441435 // Convert it into `MatcherLoc` form.
442436 let argument_gram = mbe::macro_parser::compute_locs(&argument_gram);
compiler/rustc_expand/src/mbe/quoted.rs+22-22
......@@ -1,13 +1,13 @@
11use rustc_ast::token::NtExprKind::*;
22use rustc_ast::token::{self, Delimiter, IdentIsRaw, NonterminalKind, Token};
3use rustc_ast::{tokenstream, NodeId};
3use rustc_ast::{NodeId, tokenstream};
44use rustc_ast_pretty::pprust;
55use rustc_feature::Features;
6use rustc_session::parse::feature_err;
76use rustc_session::Session;
8use rustc_span::edition::Edition;
9use rustc_span::symbol::{kw, sym, Ident};
7use rustc_session::parse::feature_err;
108use rustc_span::Span;
9use rustc_span::edition::Edition;
10use rustc_span::symbol::{Ident, kw, sym};
1111
1212use crate::errors;
1313use crate::mbe::macro_parser::count_metavar_decls;
......@@ -207,10 +207,10 @@ fn parse_tree<'a>(
207207 Some(&tokenstream::TokenTree::Delimited(delim_span, _, delim, ref tts)) => {
208208 if parsing_patterns {
209209 if delim != Delimiter::Parenthesis {
210 span_dollar_dollar_or_metavar_in_the_lhs_err(
211 sess,
212 &Token { kind: token::OpenDelim(delim), span: delim_span.entire() },
213 );
210 span_dollar_dollar_or_metavar_in_the_lhs_err(sess, &Token {
211 kind: token::OpenDelim(delim),
212 span: delim_span.entire(),
213 });
214214 }
215215 } else {
216216 match delim {
......@@ -263,10 +263,12 @@ fn parse_tree<'a>(
263263 // Count the number of captured "names" (i.e., named metavars)
264264 let num_captures =
265265 if parsing_patterns { count_metavar_decls(&sequence) } else { 0 };
266 TokenTree::Sequence(
267 delim_span,
268 SequenceRepetition { tts: sequence, separator, kleene, num_captures },
269 )
266 TokenTree::Sequence(delim_span, SequenceRepetition {
267 tts: sequence,
268 separator,
269 kleene,
270 num_captures,
271 })
270272 }
271273
272274 // `tree` is followed by an `ident`. This could be `$meta_var` or the `$crate`
......@@ -287,10 +289,10 @@ fn parse_tree<'a>(
287289 _,
288290 )) => {
289291 if parsing_patterns {
290 span_dollar_dollar_or_metavar_in_the_lhs_err(
291 sess,
292 &Token { kind: token::Dollar, span: dollar_span2 },
293 );
292 span_dollar_dollar_or_metavar_in_the_lhs_err(sess, &Token {
293 kind: token::Dollar,
294 span: dollar_span2,
295 });
294296 } else {
295297 maybe_emit_macro_metavar_expr_feature(features, sess, dollar_span2);
296298 }
......@@ -315,14 +317,12 @@ fn parse_tree<'a>(
315317
316318 // `tree` is the beginning of a delimited set of tokens (e.g., `(` or `{`). We need to
317319 // descend into the delimited set and further parse it.
318 &tokenstream::TokenTree::Delimited(span, spacing, delim, ref tts) => TokenTree::Delimited(
319 span,
320 spacing,
321 Delimited {
320 &tokenstream::TokenTree::Delimited(span, spacing, delim, ref tts) => {
321 TokenTree::Delimited(span, spacing, Delimited {
322322 delim,
323323 tts: parse(tts, parsing_patterns, sess, node_id, features, edition),
324 },
325 ),
324 })
325 }
326326 }
327327}
328328
compiler/rustc_expand/src/mbe/transcribe.rs+5-5
......@@ -1,18 +1,18 @@
11use std::mem;
22
3use rustc_ast::ExprKind;
34use rustc_ast::mut_visit::{self, MutVisitor};
45use rustc_ast::token::{self, Delimiter, IdentIsRaw, Lit, LitKind, Nonterminal, Token, TokenKind};
56use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
6use rustc_ast::ExprKind;
77use rustc_data_structures::fx::FxHashMap;
8use rustc_errors::{pluralize, Diag, DiagCtxtHandle, PResult};
8use rustc_errors::{Diag, DiagCtxtHandle, PResult, pluralize};
99use rustc_parse::lexer::nfc_normalize;
1010use rustc_parse::parser::ParseNtResult;
1111use rustc_session::parse::{ParseSess, SymbolGallery};
1212use rustc_span::hygiene::{LocalExpnId, Transparency};
13use rustc_span::symbol::{sym, Ident, MacroRulesNormalizedIdent};
14use rustc_span::{with_metavar_spans, Span, Symbol, SyntaxContext};
15use smallvec::{smallvec, SmallVec};
13use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent, sym};
14use rustc_span::{Span, Symbol, SyntaxContext, with_metavar_spans};
15use smallvec::{SmallVec, smallvec};
1616
1717use crate::errors::{
1818 CountRepetitionMisplaced, MetaVarExprUnrecognizedVar, MetaVarsDifSeqMatchers, MustRepeatOnce,
compiler/rustc_expand/src/module.rs+3-3
......@@ -2,13 +2,13 @@ use std::iter::once;
22use std::path::{self, Path, PathBuf};
33
44use rustc_ast::ptr::P;
5use rustc_ast::{token, AttrVec, Attribute, Inline, Item, ModSpans};
5use rustc_ast::{AttrVec, Attribute, Inline, Item, ModSpans, token};
66use rustc_errors::{Diag, ErrorGuaranteed};
77use rustc_parse::{new_parser_from_file, unwrap_or_emit_fatal, validate_attr};
8use rustc_session::parse::ParseSess;
98use rustc_session::Session;
10use rustc_span::symbol::{sym, Ident};
9use rustc_session::parse::ParseSess;
1110use rustc_span::Span;
11use rustc_span::symbol::{Ident, sym};
1212use thin_vec::ThinVec;
1313
1414use crate::base::ModuleData;
compiler/rustc_expand/src/placeholders.rs+2-2
......@@ -4,9 +4,9 @@ use rustc_ast::token::Delimiter;
44use rustc_ast::visit::AssocCtxt;
55use rustc_ast::{self as ast};
66use rustc_data_structures::fx::FxHashMap;
7use rustc_span::symbol::Ident;
87use rustc_span::DUMMY_SP;
9use smallvec::{smallvec, SmallVec};
8use rustc_span::symbol::Ident;
9use smallvec::{SmallVec, smallvec};
1010use thin_vec::ThinVec;
1111
1212use crate::expand::{AstFragment, AstFragmentKind};
compiler/rustc_expand/src/proc_macro.rs+1-1
......@@ -4,8 +4,8 @@ use rustc_ast::tokenstream::TokenStream;
44use rustc_errors::ErrorGuaranteed;
55use rustc_parse::parser::{ForceCollect, Parser};
66use rustc_session::config::ProcMacroExecutionStrategy;
7use rustc_span::profiling::SpannedEventArgRecorder;
87use rustc_span::Span;
8use rustc_span::profiling::SpannedEventArgRecorder;
99
1010use crate::base::{self, *};
1111use crate::{errors, proc_macro_server};
compiler/rustc_expand/src/proc_macro_server.rs+3-3
......@@ -2,7 +2,7 @@ use std::ops::{Bound, Range};
22
33use ast::token::IdentIsRaw;
44use pm::bridge::{
5 server, DelimSpan, Diagnostic, ExpnGlobals, Group, Ident, LitKind, Literal, Punct, TokenTree,
5 DelimSpan, Diagnostic, ExpnGlobals, Group, Ident, LitKind, Literal, Punct, TokenTree, server,
66};
77use pm::{Delimiter, Level};
88use rustc_ast as ast;
......@@ -18,9 +18,9 @@ use rustc_parse::parser::Parser;
1818use rustc_parse::{new_parser_from_source_str, source_str_to_stream, unwrap_or_emit_fatal};
1919use rustc_session::parse::ParseSess;
2020use rustc_span::def_id::CrateNum;
21use rustc_span::symbol::{self, sym, Symbol};
21use rustc_span::symbol::{self, Symbol, sym};
2222use rustc_span::{BytePos, FileName, Pos, SourceFile, Span};
23use smallvec::{smallvec, SmallVec};
23use smallvec::{SmallVec, smallvec};
2424
2525use crate::base::ExtCtxt;
2626
compiler/rustc_feature/src/accepted.rs+1-1
......@@ -2,7 +2,7 @@
22
33use rustc_span::symbol::sym;
44
5use super::{to_nonzero, Feature};
5use super::{Feature, to_nonzero};
66
77macro_rules! declare_features {
88 ($(
compiler/rustc_feature/src/builtin_attrs.rs+2-2
......@@ -2,11 +2,11 @@
22
33use std::sync::LazyLock;
44
5use rustc_data_structures::fx::FxHashMap;
6use rustc_span::symbol::{sym, Symbol};
75use AttributeDuplicates::*;
86use AttributeGate::*;
97use AttributeType::*;
8use rustc_data_structures::fx::FxHashMap;
9use rustc_span::symbol::{Symbol, sym};
1010
1111use crate::{Features, Stability};
1212
compiler/rustc_feature/src/lib.rs+4-4
......@@ -129,10 +129,10 @@ pub fn find_feature_issue(feature: Symbol, issue: GateIssue) -> Option<NonZero<u
129129
130130pub use accepted::ACCEPTED_FEATURES;
131131pub use builtin_attrs::{
132 deprecated_attributes, encode_cross_crate, find_gated_cfg, is_builtin_attr_name,
133 is_stable_diagnostic_attribute, is_valid_for_get_attr, AttributeDuplicates, AttributeGate,
134 AttributeSafety, AttributeTemplate, AttributeType, BuiltinAttribute, GatedCfg,
135 BUILTIN_ATTRIBUTES, BUILTIN_ATTRIBUTE_MAP,
132 AttributeDuplicates, AttributeGate, AttributeSafety, AttributeTemplate, AttributeType,
133 BUILTIN_ATTRIBUTE_MAP, BUILTIN_ATTRIBUTES, BuiltinAttribute, GatedCfg, deprecated_attributes,
134 encode_cross_crate, find_gated_cfg, is_builtin_attr_name, is_stable_diagnostic_attribute,
135 is_valid_for_get_attr,
136136};
137137pub use removed::REMOVED_FEATURES;
138138pub use unstable::{Features, INCOMPATIBLE_FEATURES, UNSTABLE_FEATURES};
compiler/rustc_feature/src/removed.rs+1-1
......@@ -2,7 +2,7 @@
22
33use rustc_span::symbol::sym;
44
5use super::{to_nonzero, Feature};
5use super::{Feature, to_nonzero};
66
77pub struct RemovedFeature {
88 pub feature: Feature,
compiler/rustc_feature/src/unstable.rs+2-2
......@@ -1,10 +1,10 @@
11//! List of the unstable feature gates.
22
33use rustc_data_structures::fx::FxHashSet;
4use rustc_span::symbol::{sym, Symbol};
54use rustc_span::Span;
5use rustc_span::symbol::{Symbol, sym};
66
7use super::{to_nonzero, Feature};
7use super::{Feature, to_nonzero};
88
99pub struct UnstableFeature {
1010 pub feature: Feature,
compiler/rustc_fluent_macro/src/fluent.rs+1-1
......@@ -11,7 +11,7 @@ use fluent_syntax::parser::ParserError;
1111use proc_macro::{Diagnostic, Level, Span};
1212use proc_macro2::TokenStream;
1313use quote::quote;
14use syn::{parse_macro_input, Ident, LitStr};
14use syn::{Ident, LitStr, parse_macro_input};
1515use unic_langid::langid;
1616
1717/// Helper function for returning an absolute path for macro-invocation relative file paths.
compiler/rustc_fs_util/src/lib.rs+1-1
......@@ -1,5 +1,5 @@
11use std::ffi::CString;
2use std::path::{absolute, Path, PathBuf};
2use std::path::{Path, PathBuf, absolute};
33use std::{fs, io};
44
55// Unfortunately, on windows, it looks like msvcrt.dll is silently translating
compiler/rustc_graphviz/src/tests.rs+7-11
......@@ -4,7 +4,7 @@ use std::io::prelude::*;
44use NodeLabels::*;
55
66use super::LabelText::{self, EscStr, HtmlStr, LabelStr};
7use super::{render, Edges, GraphWalk, Id, Labeller, Nodes, Style};
7use super::{Edges, GraphWalk, Id, Labeller, Nodes, Style, render};
88
99/// each node is an index in a vector in the graph.
1010type Node = usize;
......@@ -360,16 +360,12 @@ fn left_aligned_text() {
360360
361361 let mut writer = Vec::new();
362362
363 let g = LabelledGraphWithEscStrs::new(
364 "syntax_tree",
365 labels,
366 vec![
367 edge(0, 1, "then", Style::None),
368 edge(0, 2, "else", Style::None),
369 edge(1, 3, ";", Style::None),
370 edge(2, 3, ";", Style::None),
371 ],
372 );
363 let g = LabelledGraphWithEscStrs::new("syntax_tree", labels, vec![
364 edge(0, 1, "then", Style::None),
365 edge(0, 2, "else", Style::None),
366 edge(1, 3, ";", Style::None),
367 edge(2, 3, ";", Style::None),
368 ]);
373369
374370 render(&g, &mut writer).unwrap();
375371 let mut r = String::new();
compiler/rustc_hir/src/def.rs+1-1
......@@ -6,10 +6,10 @@ use rustc_ast::NodeId;
66use rustc_data_structures::stable_hasher::ToStableHashKey;
77use rustc_data_structures::unord::UnordMap;
88use rustc_macros::{Decodable, Encodable, HashStable_Generic};
9use rustc_span::Symbol;
910use rustc_span::def_id::{DefId, LocalDefId};
1011use rustc_span::hygiene::MacroKind;
1112use rustc_span::symbol::kw;
12use rustc_span::Symbol;
1313
1414use crate::definitions::DefPathData;
1515use crate::hir;
compiler/rustc_hir/src/definitions.rs+2-2
......@@ -11,11 +11,11 @@ use rustc_data_structures::stable_hasher::{Hash64, StableHasher};
1111use rustc_data_structures::unord::UnordMap;
1212use rustc_index::IndexVec;
1313use rustc_macros::{Decodable, Encodable};
14use rustc_span::symbol::{kw, sym, Symbol};
14use rustc_span::symbol::{Symbol, kw, sym};
1515use tracing::{debug, instrument};
1616
1717pub use crate::def_id::DefPathHash;
18use crate::def_id::{CrateNum, DefIndex, LocalDefId, StableCrateId, CRATE_DEF_INDEX, LOCAL_CRATE};
18use crate::def_id::{CRATE_DEF_INDEX, CrateNum, DefIndex, LOCAL_CRATE, LocalDefId, StableCrateId};
1919use crate::def_path_hash_map::DefPathHashMap;
2020
2121/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
compiler/rustc_hir/src/diagnostic_items.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_data_structures::fx::FxIndexMap;
22use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3use rustc_span::def_id::DefIdMap;
43use rustc_span::Symbol;
4use rustc_span::def_id::DefIdMap;
55
66use crate::def_id::DefId;
77
compiler/rustc_hir/src/hir.rs+12-11
......@@ -17,18 +17,18 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1717use rustc_span::def_id::LocalDefId;
1818use rustc_span::hygiene::MacroKind;
1919use rustc_span::source_map::Spanned;
20use rustc_span::symbol::{kw, sym, Ident, Symbol};
21use rustc_span::{BytePos, ErrorGuaranteed, Span, DUMMY_SP};
20use rustc_span::symbol::{Ident, Symbol, kw, sym};
21use rustc_span::{BytePos, DUMMY_SP, ErrorGuaranteed, Span};
2222use rustc_target::asm::InlineAsmRegOrRegClass;
2323use rustc_target::spec::abi::Abi;
2424use smallvec::SmallVec;
2525use tracing::debug;
2626
27use crate::LangItem;
2728use crate::def::{CtorKind, DefKind, Res};
2829use crate::def_id::{DefId, LocalDefIdMap};
2930pub(crate) use crate::hir_id::{HirId, ItemLocalId, ItemLocalMap, OwnerId};
3031use crate::intravisit::FnKind;
31use crate::LangItem;
3232
3333#[derive(Debug, Copy, Clone, HashStable_Generic)]
3434pub struct Lifetime {
......@@ -2589,10 +2589,10 @@ impl<'hir> Ty<'hir> {
25892589 fn visit_ty(&mut self, t: &'v Ty<'v>) {
25902590 if matches!(
25912591 &t.kind,
2592 TyKind::Path(QPath::Resolved(
2593 _,
2594 Path { res: crate::def::Res::SelfTyAlias { .. }, .. },
2595 ))
2592 TyKind::Path(QPath::Resolved(_, Path {
2593 res: crate::def::Res::SelfTyAlias { .. },
2594 ..
2595 },))
25962596 ) {
25972597 self.0.push(t.span);
25982598 return;
......@@ -2920,10 +2920,11 @@ impl<'hir> InlineAsmOperand<'hir> {
29202920 }
29212921
29222922 pub fn is_clobber(&self) -> bool {
2923 matches!(
2924 self,
2925 InlineAsmOperand::Out { reg: InlineAsmRegOrRegClass::Reg(_), late: _, expr: None }
2926 )
2923 matches!(self, InlineAsmOperand::Out {
2924 reg: InlineAsmRegOrRegClass::Reg(_),
2925 late: _,
2926 expr: None
2927 })
29272928 }
29282929}
29292930
compiler/rustc_hir/src/hir_id.rs+2-2
......@@ -2,10 +2,10 @@ use std::fmt::{self, Debug};
22
33use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey};
44use rustc_macros::{Decodable, Encodable, HashStable_Generic};
5use rustc_span::def_id::DefPathHash;
65use rustc_span::HashStableContext;
6use rustc_span::def_id::DefPathHash;
77
8use crate::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_ID};
8use crate::def_id::{CRATE_DEF_ID, DefId, DefIndex, LocalDefId};
99
1010#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
1111pub struct OwnerId {
compiler/rustc_hir/src/intravisit.rs+2-2
......@@ -64,11 +64,11 @@
6464//! This order consistency is required in a few places in rustc, for
6565//! example coroutine inference, and possibly also HIR borrowck.
6666
67use rustc_ast::visit::{try_visit, visit_opt, walk_list, VisitorResult};
67use rustc_ast::visit::{VisitorResult, try_visit, visit_opt, walk_list};
6868use rustc_ast::{Attribute, Label};
69use rustc_span::Span;
6970use rustc_span::def_id::LocalDefId;
7071use rustc_span::symbol::{Ident, Symbol};
71use rustc_span::Span;
7272
7373use crate::hir::*;
7474
compiler/rustc_hir/src/lang_items.rs+1-1
......@@ -11,8 +11,8 @@ use rustc_ast as ast;
1111use rustc_data_structures::fx::FxIndexMap;
1212use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
1313use rustc_macros::{Decodable, Encodable, HashStable_Generic};
14use rustc_span::symbol::{kw, sym, Symbol};
1514use rustc_span::Span;
15use rustc_span::symbol::{Symbol, kw, sym};
1616
1717use crate::def_id::DefId;
1818use crate::{MethodKind, Target};
compiler/rustc_hir/src/pat_util.rs+1-1
......@@ -1,7 +1,7 @@
11use std::iter::Enumerate;
22
3use rustc_span::symbol::Ident;
43use rustc_span::Span;
4use rustc_span::symbol::Ident;
55
66use crate::def::{CtorOf, DefKind, Res};
77use crate::def_id::{DefId, DefIdSet};
compiler/rustc_hir/src/target.rs+1-1
......@@ -7,7 +7,7 @@
77use std::fmt::{self, Display};
88
99use crate::def::DefKind;
10use crate::{hir, Item, ItemKind, TraitItem, TraitItemKind};
10use crate::{Item, ItemKind, TraitItem, TraitItemKind, hir};
1111
1212#[derive(Copy, Clone, PartialEq, Debug)]
1313pub enum GenericParamKind {
compiler/rustc_hir/src/tests.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_data_structures::stable_hasher::Hash64;
22use rustc_span::def_id::{DefPathHash, StableCrateId};
33use rustc_span::edition::Edition;
4use rustc_span::{create_session_globals_then, Symbol};
4use rustc_span::{Symbol, create_session_globals_then};
55
66use crate::definitions::{DefKey, DefPathData, DisambiguatedDefPathData};
77
compiler/rustc_hir/src/weak_lang_items.rs+1-1
......@@ -1,6 +1,6 @@
11//! Validity checking for weak lang items
22
3use rustc_span::symbol::{sym, Symbol};
3use rustc_span::symbol::{Symbol, sym};
44
55use crate::LangItem;
66
compiler/rustc_hir_analysis/src/autoderef.rs+1-1
......@@ -1,8 +1,8 @@
11use rustc_infer::infer::InferCtxt;
22use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
33use rustc_session::Limit;
4use rustc_span::def_id::{LocalDefId, LOCAL_CRATE};
54use rustc_span::Span;
5use rustc_span::def_id::{LOCAL_CRATE, LocalDefId};
66use rustc_trait_selection::traits::ObligationCtxt;
77use tracing::{debug, instrument};
88
compiler/rustc_hir_analysis/src/bounds.rs+12-15
......@@ -2,12 +2,12 @@
22//! [`rustc_middle::ty`] form.
33
44use rustc_data_structures::fx::FxIndexMap;
5use rustc_hir::def::DefKind;
65use rustc_hir::LangItem;
6use rustc_hir::def::DefKind;
77use rustc_middle::ty::fold::FnMutDelegate;
88use rustc_middle::ty::{self, Ty, TyCtxt, Upcast};
9use rustc_span::def_id::DefId;
109use rustc_span::Span;
10use rustc_span::def_id::DefId;
1111
1212use crate::hir_ty_lowering::OnlySelfBounds;
1313
......@@ -112,14 +112,11 @@ impl<'tcx> Bounds<'tcx> {
112112 // This should work for any bound variables as long as they don't have any
113113 // bounds e.g. `for<T: Trait>`.
114114 // FIXME(effects) reconsider this approach to allow compatibility with `for<T: Tr>`
115 let ty = tcx.replace_bound_vars_uncached(
116 ty,
117 FnMutDelegate {
118 regions: &mut |_| tcx.lifetimes.re_static,
119 types: &mut |_| tcx.types.unit,
120 consts: &mut |_| unimplemented!("`~const` does not support const binders"),
121 },
122 );
115 let ty = tcx.replace_bound_vars_uncached(ty, FnMutDelegate {
116 regions: &mut |_| tcx.lifetimes.re_static,
117 types: &mut |_| tcx.types.unit,
118 consts: &mut |_| unimplemented!("`~const` does not support const binders"),
119 });
123120
124121 self.effects_min_tys.insert(ty, span);
125122 return;
......@@ -152,11 +149,11 @@ impl<'tcx> Bounds<'tcx> {
152149 };
153150 let self_ty = Ty::new_projection(tcx, assoc, bound_trait_ref.skip_binder().args);
154151 // make `<T as Tr>::Effects: Compat<runtime>`
155 let new_trait_ref = ty::TraitRef::new(
156 tcx,
157 tcx.require_lang_item(LangItem::EffectsCompat, Some(span)),
158 [ty::GenericArg::from(self_ty), compat_val.into()],
159 );
152 let new_trait_ref =
153 ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::EffectsCompat, Some(span)), [
154 ty::GenericArg::from(self_ty),
155 compat_val.into(),
156 ]);
160157 self.clauses.push((bound_trait_ref.rebind(new_trait_ref).upcast(tcx), span));
161158 }
162159
compiler/rustc_hir_analysis/src/check/check.rs+3-3
......@@ -2,10 +2,10 @@ use std::cell::LazyCell;
22use std::ops::ControlFlow;
33
44use rustc_data_structures::unord::{UnordMap, UnordSet};
5use rustc_errors::codes::*;
65use rustc_errors::MultiSpan;
7use rustc_hir::def::{CtorKind, DefKind};
6use rustc_errors::codes::*;
87use rustc_hir::Node;
8use rustc_hir::def::{CtorKind, DefKind};
99use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
1010use rustc_infer::traits::Obligation;
1111use rustc_lint_defs::builtin::REPR_TRANSPARENT_EXTERNAL_PRIVATE_FIELDS;
......@@ -22,8 +22,8 @@ use rustc_middle::ty::{
2222};
2323use rustc_session::lint::builtin::{UNINHABITED_STATIC, UNSUPPORTED_CALLING_CONVENTIONS};
2424use rustc_target::abi::FieldIdx;
25use rustc_trait_selection::error_reporting::traits::on_unimplemented::OnUnimplementedDirective;
2625use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
26use rustc_trait_selection::error_reporting::traits::on_unimplemented::OnUnimplementedDirective;
2727use rustc_trait_selection::traits;
2828use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt as _;
2929use rustc_type_ir::fold::TypeFoldable;
compiler/rustc_hir_analysis/src/check/compare_impl_item.rs+32-55
......@@ -5,10 +5,10 @@ use std::iter;
55use hir::def_id::{DefId, DefIdMap, LocalDefId};
66use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
77use rustc_errors::codes::*;
8use rustc_errors::{pluralize, struct_span_code_err, Applicability, ErrorGuaranteed};
8use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
99use rustc_hir as hir;
1010use rustc_hir::def::{DefKind, Res};
11use rustc_hir::{intravisit, GenericParamKind, ImplItemKind};
11use rustc_hir::{GenericParamKind, ImplItemKind, intravisit};
1212use rustc_infer::infer::outlives::env::OutlivesEnvironment;
1313use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
1414use rustc_infer::traits::util;
......@@ -176,15 +176,12 @@ fn compare_method_predicate_entailment<'tcx>(
176176 // obligations.
177177 let impl_m_def_id = impl_m.def_id.expect_local();
178178 let impl_m_span = tcx.def_span(impl_m_def_id);
179 let cause = ObligationCause::new(
180 impl_m_span,
181 impl_m_def_id,
182 ObligationCauseCode::CompareImplItem {
179 let cause =
180 ObligationCause::new(impl_m_span, impl_m_def_id, ObligationCauseCode::CompareImplItem {
183181 impl_item_def_id: impl_m_def_id,
184182 trait_item_def_id: trait_m.def_id,
185183 kind: impl_m.kind,
186 },
187 );
184 });
188185
189186 // Create mapping from impl to placeholder.
190187 let impl_to_placeholder_args = GenericArgs::identity_for_item(tcx, impl_m.def_id);
......@@ -237,15 +234,12 @@ fn compare_method_predicate_entailment<'tcx>(
237234 let normalize_cause = traits::ObligationCause::misc(span, impl_m_def_id);
238235 let predicate = ocx.normalize(&normalize_cause, param_env, predicate);
239236
240 let cause = ObligationCause::new(
241 span,
242 impl_m_def_id,
243 ObligationCauseCode::CompareImplItem {
237 let cause =
238 ObligationCause::new(span, impl_m_def_id, ObligationCauseCode::CompareImplItem {
244239 impl_item_def_id: impl_m_def_id,
245240 trait_item_def_id: trait_m.def_id,
246241 kind: impl_m.kind,
247 },
248 );
242 });
249243 ocx.register_obligation(traits::Obligation::new(tcx, cause, param_env, predicate));
250244 }
251245
......@@ -465,15 +459,12 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
465459
466460 let impl_m_hir_id = tcx.local_def_id_to_hir_id(impl_m_def_id);
467461 let return_span = tcx.hir().fn_decl_by_hir_id(impl_m_hir_id).unwrap().output.span();
468 let cause = ObligationCause::new(
469 return_span,
470 impl_m_def_id,
471 ObligationCauseCode::CompareImplItem {
462 let cause =
463 ObligationCause::new(return_span, impl_m_def_id, ObligationCauseCode::CompareImplItem {
472464 impl_item_def_id: impl_m_def_id,
473465 trait_item_def_id: trait_m.def_id,
474466 kind: impl_m.kind,
475 },
476 );
467 });
477468
478469 // Create mapping from impl to placeholder.
479470 let impl_to_placeholder_args = GenericArgs::identity_for_item(tcx, impl_m.def_id);
......@@ -561,16 +552,13 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
561552 idx += 1;
562553 (
563554 ty,
564 Ty::new_placeholder(
565 tcx,
566 ty::Placeholder {
567 universe,
568 bound: ty::BoundTy {
569 var: ty::BoundVar::from_usize(idx),
570 kind: ty::BoundTyKind::Anon,
571 },
555 Ty::new_placeholder(tcx, ty::Placeholder {
556 universe,
557 bound: ty::BoundTy {
558 var: ty::BoundVar::from_usize(idx),
559 kind: ty::BoundTyKind::Anon,
572560 },
573 ),
561 }),
574562 )
575563 })
576564 .collect();
......@@ -936,13 +924,10 @@ impl<'tcx> ty::FallibleTypeFolder<TyCtxt<'tcx>> for RemapHiddenTyRegions<'tcx> {
936924 return Err(guar);
937925 };
938926
939 Ok(ty::Region::new_early_param(
940 self.tcx,
941 ty::EarlyParamRegion {
942 name: e.name,
943 index: (e.index as usize - self.num_trait_args + self.num_impl_args) as u32,
944 },
945 ))
927 Ok(ty::Region::new_early_param(self.tcx, ty::EarlyParamRegion {
928 name: e.name,
929 index: (e.index as usize - self.num_trait_args + self.num_impl_args) as u32,
930 }))
946931 }
947932}
948933
......@@ -1932,15 +1917,12 @@ fn compare_type_predicate_entailment<'tcx>(
19321917 let cause = ObligationCause::misc(span, impl_ty_def_id);
19331918 let predicate = ocx.normalize(&cause, param_env, predicate);
19341919
1935 let cause = ObligationCause::new(
1936 span,
1937 impl_ty_def_id,
1938 ObligationCauseCode::CompareImplItem {
1920 let cause =
1921 ObligationCause::new(span, impl_ty_def_id, ObligationCauseCode::CompareImplItem {
19391922 impl_item_def_id: impl_ty.def_id.expect_local(),
19401923 trait_item_def_id: trait_ty.def_id,
19411924 kind: impl_ty.kind,
1942 },
1943 );
1925 });
19441926 ocx.register_obligation(traits::Obligation::new(tcx, cause, param_env, predicate));
19451927 }
19461928
......@@ -2178,25 +2160,20 @@ fn param_env_with_gat_bounds<'tcx>(
21782160 let kind = ty::BoundTyKind::Param(param.def_id, param.name);
21792161 let bound_var = ty::BoundVariableKind::Ty(kind);
21802162 bound_vars.push(bound_var);
2181 Ty::new_bound(
2182 tcx,
2183 ty::INNERMOST,
2184 ty::BoundTy { var: ty::BoundVar::from_usize(bound_vars.len() - 1), kind },
2185 )
2163 Ty::new_bound(tcx, ty::INNERMOST, ty::BoundTy {
2164 var: ty::BoundVar::from_usize(bound_vars.len() - 1),
2165 kind,
2166 })
21862167 .into()
21872168 }
21882169 GenericParamDefKind::Lifetime => {
21892170 let kind = ty::BoundRegionKind::BrNamed(param.def_id, param.name);
21902171 let bound_var = ty::BoundVariableKind::Region(kind);
21912172 bound_vars.push(bound_var);
2192 ty::Region::new_bound(
2193 tcx,
2194 ty::INNERMOST,
2195 ty::BoundRegion {
2196 var: ty::BoundVar::from_usize(bound_vars.len() - 1),
2197 kind,
2198 },
2199 )
2173 ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
2174 var: ty::BoundVar::from_usize(bound_vars.len() - 1),
2175 kind,
2176 })
22002177 .into()
22012178 }
22022179 GenericParamDefKind::Const { .. } => {
compiler/rustc_hir_analysis/src/check/compare_impl_item/refine.rs+2-2
......@@ -1,8 +1,8 @@
11use rustc_data_structures::fx::FxIndexSet;
22use rustc_hir as hir;
33use rustc_hir::def_id::DefId;
4use rustc_infer::infer::outlives::env::OutlivesEnvironment;
54use rustc_infer::infer::TyCtxtInferExt;
5use rustc_infer::infer::outlives::env::OutlivesEnvironment;
66use rustc_lint_defs::builtin::{REFINING_IMPL_TRAIT_INTERNAL, REFINING_IMPL_TRAIT_REACHABLE};
77use rustc_middle::span_bug;
88use rustc_middle::traits::{ObligationCause, Reveal};
......@@ -13,7 +13,7 @@ use rustc_middle::ty::{
1313use rustc_span::Span;
1414use rustc_trait_selection::regions::InferCtxtRegionExt;
1515use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt;
16use rustc_trait_selection::traits::{elaborate, normalize_param_env_or_error, ObligationCtxt};
16use rustc_trait_selection::traits::{ObligationCtxt, elaborate, normalize_param_env_or_error};
1717
1818/// Check that an implementation does not refine an RPITIT from a trait method signature.
1919pub(super) fn check_refining_return_position_impl_trait_in_trait<'tcx>(
compiler/rustc_hir_analysis/src/check/dropck.rs+1-1
......@@ -4,7 +4,7 @@
44
55use rustc_data_structures::fx::FxHashSet;
66use rustc_errors::codes::*;
7use rustc_errors::{struct_span_code_err, ErrorGuaranteed};
7use rustc_errors::{ErrorGuaranteed, struct_span_code_err};
88use rustc_infer::infer::outlives::env::OutlivesEnvironment;
99use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
1010use rustc_infer::traits::{ObligationCause, ObligationCauseCode};
compiler/rustc_hir_analysis/src/check/entry.rs+2-2
......@@ -6,9 +6,9 @@ use rustc_infer::infer::TyCtxtInferExt;
66use rustc_middle::span_bug;
77use rustc_middle::ty::{self, Ty, TyCtxt};
88use rustc_session::config::EntryFnType;
9use rustc_span::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
10use rustc_span::symbol::sym;
119use rustc_span::Span;
10use rustc_span::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
11use rustc_span::symbol::sym;
1212use rustc_target::spec::abi::Abi;
1313use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
1414use rustc_trait_selection::traits::{self, ObligationCause, ObligationCauseCode};
compiler/rustc_hir_analysis/src/check/errs.rs+4-5
......@@ -79,11 +79,10 @@ fn handle_static_mut_ref(
7979 } else {
8080 (errors::MutRefSugg::Shared { lo, hi }, "shared")
8181 };
82 tcx.emit_node_span_lint(
83 STATIC_MUT_REFS,
84 hir_id,
82 tcx.emit_node_span_lint(STATIC_MUT_REFS, hir_id, span, errors::RefOfMutStatic {
8583 span,
86 errors::RefOfMutStatic { span, sugg, shared },
87 );
84 sugg,
85 shared,
86 });
8887 }
8988}
compiler/rustc_hir_analysis/src/check/intrinsic.rs+9-11
......@@ -2,7 +2,7 @@
22//! intrinsics that the compiler exposes.
33
44use rustc_errors::codes::*;
5use rustc_errors::{struct_span_code_err, DiagMessage};
5use rustc_errors::{DiagMessage, struct_span_code_err};
66use rustc_hir as hir;
77use rustc_middle::bug;
88use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
......@@ -190,16 +190,14 @@ pub fn check_intrinsic_type(
190190 ]);
191191 let mk_va_list_ty = |mutbl| {
192192 tcx.lang_items().va_list().map(|did| {
193 let region = ty::Region::new_bound(
194 tcx,
195 ty::INNERMOST,
196 ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon },
197 );
198 let env_region = ty::Region::new_bound(
199 tcx,
200 ty::INNERMOST,
201 ty::BoundRegion { var: ty::BoundVar::from_u32(2), kind: ty::BrEnv },
202 );
193 let region = ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
194 var: ty::BoundVar::ZERO,
195 kind: ty::BrAnon,
196 });
197 let env_region = ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
198 var: ty::BoundVar::from_u32(2),
199 kind: ty::BrEnv,
200 });
203201 let va_list_ty = tcx.type_of(did).instantiate(tcx, &[region.into()]);
204202 (Ty::new_ref(tcx, env_region, va_list_ty, mutbl), va_list_ty)
205203 })
compiler/rustc_hir_analysis/src/check/intrinsicck.rs+1-1
......@@ -6,8 +6,8 @@ use rustc_hir::{self as hir, LangItem};
66use rustc_middle::bug;
77use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableExt, UintTy};
88use rustc_session::lint;
9use rustc_span::def_id::LocalDefId;
109use rustc_span::Symbol;
10use rustc_span::def_id::LocalDefId;
1111use rustc_target::abi::FieldIdx;
1212use rustc_target::asm::{
1313 InlineAsmReg, InlineAsmRegClass, InlineAsmRegOrRegClass, InlineAsmType, ModifierInfo,
compiler/rustc_hir_analysis/src/check/mod.rs+4-4
......@@ -75,7 +75,7 @@ use std::num::NonZero;
7575
7676pub use check::check_abi;
7777use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
78use rustc_errors::{pluralize, struct_span_code_err, Diag, ErrorGuaranteed};
78use rustc_errors::{Diag, ErrorGuaranteed, pluralize, struct_span_code_err};
7979use rustc_hir::def_id::{DefId, LocalDefId};
8080use rustc_hir::intravisit::Visitor;
8181use rustc_index::bit_set::BitSet;
......@@ -88,13 +88,13 @@ use rustc_middle::ty::{self, GenericArgs, GenericArgsRef, Ty, TyCtxt};
8888use rustc_middle::{bug, span_bug};
8989use rustc_session::parse::feature_err;
9090use rustc_span::def_id::CRATE_DEF_ID;
91use rustc_span::symbol::{kw, sym, Ident};
92use rustc_span::{BytePos, Span, Symbol, DUMMY_SP};
91use rustc_span::symbol::{Ident, kw, sym};
92use rustc_span::{BytePos, DUMMY_SP, Span, Symbol};
9393use rustc_target::abi::VariantIdx;
9494use rustc_target::spec::abi::Abi;
95use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
9596use rustc_trait_selection::error_reporting::infer::ObligationCauseExt as _;
9697use rustc_trait_selection::error_reporting::traits::suggestions::ReturnsVisitor;
97use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
9898use rustc_trait_selection::traits::ObligationCtxt;
9999use tracing::debug;
100100
compiler/rustc_hir_analysis/src/check/wfcheck.rs+19-19
......@@ -4,11 +4,11 @@ use std::ops::{ControlFlow, Deref};
44use hir::intravisit::{self, Visitor};
55use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
66use rustc_errors::codes::*;
7use rustc_errors::{pluralize, struct_span_code_err, Applicability, ErrorGuaranteed};
7use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
8use rustc_hir::ItemKind;
89use rustc_hir::def::{DefKind, Res};
910use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
1011use rustc_hir::lang_items::LangItem;
11use rustc_hir::ItemKind;
1212use rustc_infer::infer::outlives::env::OutlivesEnvironment;
1313use rustc_infer::infer::{self, InferCtxt, TyCtxtInferExt};
1414use rustc_macros::LintDiagnostic;
......@@ -21,27 +21,27 @@ use rustc_middle::ty::{
2121};
2222use rustc_middle::{bug, span_bug};
2323use rustc_session::parse::feature_err;
24use rustc_span::symbol::{sym, Ident};
25use rustc_span::{Span, DUMMY_SP};
24use rustc_span::symbol::{Ident, sym};
25use rustc_span::{DUMMY_SP, Span};
2626use rustc_target::spec::abi::Abi;
2727use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2828use rustc_trait_selection::regions::InferCtxtRegionExt;
2929use rustc_trait_selection::traits::misc::{
30 type_allowed_to_implement_const_param_ty, ConstParamTyImplementationError,
30 ConstParamTyImplementationError, type_allowed_to_implement_const_param_ty,
3131};
3232use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt as _;
3333use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
3434use rustc_trait_selection::traits::{
3535 self, FulfillmentError, ObligationCause, ObligationCauseCode, ObligationCtxt, WellFormedLoc,
3636};
37use rustc_type_ir::solve::NoSolution;
3837use rustc_type_ir::TypeFlags;
38use rustc_type_ir::solve::NoSolution;
3939use tracing::{debug, instrument};
4040use {rustc_ast as ast, rustc_hir as hir};
4141
4242use crate::autoderef::Autoderef;
4343use crate::collect::CollectItemTypesVisitor;
44use crate::constrained_generic_params::{identify_constrained_generic_params, Parameter};
44use crate::constrained_generic_params::{Parameter, identify_constrained_generic_params};
4545use crate::{errors, fluent_generated as fluent};
4646
4747pub(super) struct WfCheckingCtxt<'a, 'tcx> {
......@@ -664,10 +664,10 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
664664 // Same for the region. In our example, 'a corresponds
665665 // to the 'me parameter.
666666 let region_param = gat_generics.param_at(*region_a_idx, tcx);
667 let region_param = ty::Region::new_early_param(
668 tcx,
669 ty::EarlyParamRegion { index: region_param.index, name: region_param.name },
670 );
667 let region_param = ty::Region::new_early_param(tcx, ty::EarlyParamRegion {
668 index: region_param.index,
669 name: region_param.name,
670 });
671671 // The predicate we expect to see. (In our example,
672672 // `Self: 'me`.)
673673 bounds.insert(
......@@ -693,16 +693,16 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
693693 debug!("required clause: {region_a} must outlive {region_b}");
694694 // Translate into the generic parameters of the GAT.
695695 let region_a_param = gat_generics.param_at(*region_a_idx, tcx);
696 let region_a_param = ty::Region::new_early_param(
697 tcx,
698 ty::EarlyParamRegion { index: region_a_param.index, name: region_a_param.name },
699 );
696 let region_a_param = ty::Region::new_early_param(tcx, ty::EarlyParamRegion {
697 index: region_a_param.index,
698 name: region_a_param.name,
699 });
700700 // Same for the region.
701701 let region_b_param = gat_generics.param_at(*region_b_idx, tcx);
702 let region_b_param = ty::Region::new_early_param(
703 tcx,
704 ty::EarlyParamRegion { index: region_b_param.index, name: region_b_param.name },
705 );
702 let region_b_param = ty::Region::new_early_param(tcx, ty::EarlyParamRegion {
703 index: region_b_param.index,
704 name: region_b_param.name,
705 });
706706 // The predicate we expect to see.
707707 bounds.insert(
708708 ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(
compiler/rustc_hir_analysis/src/coherence/builtin.rs+8-9
......@@ -7,20 +7,20 @@ use std::collections::BTreeMap;
77use rustc_data_structures::fx::FxHashSet;
88use rustc_errors::{ErrorGuaranteed, MultiSpan};
99use rustc_hir as hir;
10use rustc_hir::ItemKind;
1011use rustc_hir::def_id::{DefId, LocalDefId};
1112use rustc_hir::lang_items::LangItem;
12use rustc_hir::ItemKind;
1313use rustc_infer::infer::outlives::env::OutlivesEnvironment;
1414use rustc_infer::infer::{self, RegionResolutionError, TyCtxtInferExt};
1515use rustc_infer::traits::Obligation;
1616use rustc_middle::ty::adjustment::CoerceUnsizedInfo;
1717use rustc_middle::ty::print::PrintTraitRefExt as _;
18use rustc_middle::ty::{self, suggest_constraining_type_params, Ty, TyCtxt, TypeVisitableExt};
19use rustc_span::{Span, DUMMY_SP};
18use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt, suggest_constraining_type_params};
19use rustc_span::{DUMMY_SP, Span};
2020use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2121use rustc_trait_selection::traits::misc::{
22 type_allowed_to_implement_const_param_ty, type_allowed_to_implement_copy,
2322 ConstParamTyImplementationError, CopyImplementationError, InfringingFieldsReason,
23 type_allowed_to_implement_const_param_ty, type_allowed_to_implement_copy,
2424};
2525use rustc_trait_selection::traits::{self, ObligationCause, ObligationCtxt};
2626use tracing::debug;
......@@ -309,11 +309,10 @@ fn visit_implementation_of_dispatch_from_dyn(checker: &Checker<'_>) -> Result<()
309309 tcx,
310310 cause.clone(),
311311 param_env,
312 ty::TraitRef::new(
313 tcx,
314 dispatch_from_dyn_trait,
315 [field.ty(tcx, args_a), field.ty(tcx, args_b)],
316 ),
312 ty::TraitRef::new(tcx, dispatch_from_dyn_trait, [
313 field.ty(tcx, args_a),
314 field.ty(tcx, args_b),
315 ]),
317316 ));
318317 }
319318 let errors = ocx.select_all_or_error();
compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs+2-2
......@@ -11,10 +11,10 @@ use rustc_hir as hir;
1111use rustc_hir::def::DefKind;
1212use rustc_hir::def_id::{DefId, LocalDefId};
1313use rustc_middle::bug;
14use rustc_middle::ty::fast_reject::{simplify_type, SimplifiedType, TreatParams};
14use rustc_middle::ty::fast_reject::{SimplifiedType, TreatParams, simplify_type};
1515use rustc_middle::ty::{self, CrateInherentImpls, Ty, TyCtxt};
16use rustc_span::symbol::sym;
1716use rustc_span::ErrorGuaranteed;
17use rustc_span::symbol::sym;
1818
1919use crate::errors;
2020
compiler/rustc_hir_analysis/src/coherence/inherent_impls_overlap.rs+4-7
......@@ -252,13 +252,10 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
252252 for ident in &idents_to_add {
253253 connected_region_ids.insert(*ident, id_to_set);
254254 }
255 connected_regions.insert(
256 id_to_set,
257 ConnectedRegion {
258 idents: idents_to_add,
259 impl_blocks: std::iter::once(i).collect(),
260 },
261 );
255 connected_regions.insert(id_to_set, ConnectedRegion {
256 idents: idents_to_add,
257 impl_blocks: std::iter::once(i).collect(),
258 });
262259 }
263260 // Take the only id inside the list
264261 &[id_to_set] => {
compiler/rustc_hir_analysis/src/coherence/mod.rs+2-2
......@@ -7,12 +7,12 @@
77
88use rustc_errors::codes::*;
99use rustc_errors::struct_span_code_err;
10use rustc_hir::def_id::{DefId, LocalDefId};
1110use rustc_hir::LangItem;
11use rustc_hir::def_id::{DefId, LocalDefId};
1212use rustc_middle::query::Providers;
1313use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
1414use rustc_session::parse::feature_err;
15use rustc_span::{sym, ErrorGuaranteed};
15use rustc_span::{ErrorGuaranteed, sym};
1616use tracing::debug;
1717
1818use crate::errors;
compiler/rustc_hir_analysis/src/coherence/unsafety.rs+2-2
......@@ -4,11 +4,11 @@
44use rustc_errors::codes::*;
55use rustc_errors::struct_span_code_err;
66use rustc_hir::Safety;
7use rustc_middle::ty::print::PrintTraitRefExt as _;
87use rustc_middle::ty::ImplPolarity::*;
8use rustc_middle::ty::print::PrintTraitRefExt as _;
99use rustc_middle::ty::{ImplTraitHeader, TraitDef, TyCtxt};
10use rustc_span::def_id::LocalDefId;
1110use rustc_span::ErrorGuaranteed;
11use rustc_span::def_id::LocalDefId;
1212
1313pub(super) fn check_item(
1414 tcx: TyCtxt<'_>,
compiler/rustc_hir_analysis/src/collect.rs+4-4
......@@ -23,11 +23,11 @@ use rustc_data_structures::captures::Captures;
2323use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
2424use rustc_data_structures::unord::UnordMap;
2525use rustc_errors::{
26 struct_span_code_err, Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, StashKey, E0228,
26 Applicability, Diag, DiagCtxtHandle, E0228, ErrorGuaranteed, StashKey, struct_span_code_err,
2727};
2828use rustc_hir::def::DefKind;
2929use rustc_hir::def_id::{DefId, LocalDefId};
30use rustc_hir::intravisit::{self, walk_generics, Visitor};
30use rustc_hir::intravisit::{self, Visitor, walk_generics};
3131use rustc_hir::{self as hir, GenericParamKind, Node};
3232use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
3333use rustc_infer::traits::ObligationCause;
......@@ -36,8 +36,8 @@ use rustc_middle::query::Providers;
3636use rustc_middle::ty::util::{Discr, IntTypeExt};
3737use rustc_middle::ty::{self, AdtKind, Const, IsSuggestable, Ty, TyCtxt};
3838use rustc_middle::{bug, span_bug};
39use rustc_span::symbol::{kw, sym, Ident, Symbol};
40use rustc_span::{Span, DUMMY_SP};
39use rustc_span::symbol::{Ident, Symbol, kw, sym};
40use rustc_span::{DUMMY_SP, Span};
4141use rustc_target::spec::abi;
4242use rustc_trait_selection::error_reporting::traits::suggestions::NextTypeParamName;
4343use rustc_trait_selection::infer::InferCtxtExt;
compiler/rustc_hir_analysis/src/collect/dump.rs+1-1
......@@ -1,5 +1,5 @@
11use rustc_hir::def::DefKind;
2use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
2use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
33use rustc_hir::intravisit;
44use rustc_middle::hir::nested_filter::OnlyBodies;
55use rustc_middle::ty::TyCtxt;
compiler/rustc_hir_analysis/src/collect/generics_of.rs+1-1
......@@ -8,8 +8,8 @@ use rustc_hir::def::DefKind;
88use rustc_hir::def_id::LocalDefId;
99use rustc_middle::ty::{self, TyCtxt};
1010use rustc_session::lint;
11use rustc_span::symbol::{kw, Symbol};
1211use rustc_span::Span;
12use rustc_span::symbol::{Symbol, kw};
1313use tracing::{debug, instrument};
1414
1515use crate::delegation::inherit_generics_for_delegation_item;
compiler/rustc_hir_analysis/src/collect/item_bounds.rs+2-2
......@@ -5,13 +5,13 @@ use rustc_middle::ty::{
55 self, GenericArgs, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
66};
77use rustc_middle::{bug, span_bug};
8use rustc_span::def_id::{DefId, LocalDefId};
98use rustc_span::Span;
9use rustc_span::def_id::{DefId, LocalDefId};
1010use rustc_type_ir::Upcast;
1111use tracing::{debug, instrument};
1212
13use super::predicates_of::assert_only_contains_predicates_from;
1413use super::ItemCtxt;
14use super::predicates_of::assert_only_contains_predicates_from;
1515use crate::hir_ty_lowering::{HirTyLowerer, PredicateFilter};
1616
1717/// For associated types we include both bounds written on the type
compiler/rustc_hir_analysis/src/collect/predicates_of.rs+5-5
......@@ -9,7 +9,7 @@ use rustc_hir::intravisit::{self, Visitor};
99use rustc_middle::ty::{self, GenericPredicates, ImplTraitInTraitData, Ty, TyCtxt, Upcast};
1010use rustc_middle::{bug, span_bug};
1111use rustc_span::symbol::Ident;
12use rustc_span::{Span, DUMMY_SP};
12use rustc_span::{DUMMY_SP, Span};
1313use tracing::{debug, instrument, trace};
1414
1515use crate::bounds::Bounds;
......@@ -379,10 +379,10 @@ fn compute_bidirectional_outlives_predicates<'tcx>(
379379 for param in opaque_own_params {
380380 let orig_lifetime = tcx.map_opaque_lifetime_to_parent_lifetime(param.def_id.expect_local());
381381 if let ty::ReEarlyParam(..) = *orig_lifetime {
382 let dup_lifetime = ty::Region::new_early_param(
383 tcx,
384 ty::EarlyParamRegion { index: param.index, name: param.name },
385 );
382 let dup_lifetime = ty::Region::new_early_param(tcx, ty::EarlyParamRegion {
383 index: param.index,
384 name: param.name,
385 });
386386 let span = tcx.def_span(param.def_id);
387387 predicates.push((
388388 ty::ClauseKind::RegionOutlives(ty::OutlivesPredicate(orig_lifetime, dup_lifetime))
compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs+3-3
......@@ -21,9 +21,9 @@ use rustc_middle::middle::resolve_bound_vars::*;
2121use rustc_middle::query::Providers;
2222use rustc_middle::ty::{self, TyCtxt, TypeSuperVisitable, TypeVisitor};
2323use rustc_middle::{bug, span_bug};
24use rustc_span::def_id::{DefId, LocalDefId};
25use rustc_span::symbol::{sym, Ident};
2624use rustc_span::Span;
25use rustc_span::def_id::{DefId, LocalDefId};
26use rustc_span::symbol::{Ident, sym};
2727use tracing::{debug, debug_span, instrument};
2828
2929use crate::errors;
......@@ -1730,7 +1730,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
17301730 )
17311731 };
17321732
1733 use smallvec::{smallvec, SmallVec};
1733 use smallvec::{SmallVec, smallvec};
17341734 let mut stack: SmallVec<[(DefId, SmallVec<[ty::BoundVariableKind; 8]>); 8]> =
17351735 smallvec![(def_id, smallvec![])];
17361736 let mut visited: FxHashSet<DefId> = FxHashSet::default();
compiler/rustc_hir_analysis/src/collect/type_of.rs+3-3
......@@ -2,18 +2,18 @@ use core::ops::ControlFlow;
22
33use rustc_errors::{Applicability, StashKey, Suggestions};
44use rustc_hir as hir;
5use rustc_hir::def_id::{DefId, LocalDefId};
65use rustc_hir::HirId;
6use rustc_hir::def_id::{DefId, LocalDefId};
77use rustc_middle::query::plumbing::CyclePlaceholder;
88use rustc_middle::ty::print::with_forced_trimmed_paths;
99use rustc_middle::ty::util::IntTypeExt;
1010use rustc_middle::ty::{self, Article, IsSuggestable, Ty, TyCtxt, TypeVisitableExt};
1111use rustc_middle::{bug, span_bug};
1212use rustc_span::symbol::Ident;
13use rustc_span::{Span, DUMMY_SP};
13use rustc_span::{DUMMY_SP, Span};
1414use tracing::debug;
1515
16use super::{bad_placeholder, ItemCtxt};
16use super::{ItemCtxt, bad_placeholder};
1717use crate::errors::TypeofReservedKeywordUsed;
1818use crate::hir_ty_lowering::HirTyLowerer;
1919
compiler/rustc_hir_analysis/src/collect/type_of/opaque.rs+1-1
......@@ -2,7 +2,7 @@ use rustc_errors::StashKey;
22use rustc_hir::def::DefKind;
33use rustc_hir::def_id::LocalDefId;
44use rustc_hir::intravisit::{self, Visitor};
5use rustc_hir::{self as hir, def, Expr, ImplItem, Item, Node, TraitItem};
5use rustc_hir::{self as hir, Expr, ImplItem, Item, Node, TraitItem, def};
66use rustc_middle::bug;
77use rustc_middle::hir::nested_filter;
88use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
compiler/rustc_hir_analysis/src/delegation.rs+4-4
......@@ -41,10 +41,10 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ParamIndexRemapper<'tcx> {
4141 if let ty::ReEarlyParam(param) = r.kind()
4242 && let Some(index) = self.remap_table.get(&param.index).copied()
4343 {
44 return ty::Region::new_early_param(
45 self.tcx,
46 ty::EarlyParamRegion { index, name: param.name },
47 );
44 return ty::Region::new_early_param(self.tcx, ty::EarlyParamRegion {
45 index,
46 name: param.name,
47 });
4848 }
4949 r
5050 }
compiler/rustc_hir_analysis/src/errors/wrong_number_of_generic_args.rs+2-2
......@@ -1,12 +1,12 @@
11use std::iter;
22
3use GenericArgsInfo::*;
34use rustc_errors::codes::*;
4use rustc_errors::{pluralize, Applicability, Diag, Diagnostic, EmissionGuarantee, MultiSpan};
5use rustc_errors::{Applicability, Diag, Diagnostic, EmissionGuarantee, MultiSpan, pluralize};
56use rustc_hir as hir;
67use rustc_middle::ty::{self as ty, AssocItems, AssocKind, TyCtxt};
78use rustc_span::def_id::DefId;
89use tracing::debug;
9use GenericArgsInfo::*;
1010
1111/// Handles the `wrong number of type / lifetime / ... arguments` family of error messages.
1212pub(crate) struct WrongNumberOfGenericArgs<'a, 'tcx> {
compiler/rustc_hir_analysis/src/hir_ty_lowering/bounds.rs+7-9
......@@ -4,13 +4,13 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
44use rustc_errors::codes::*;
55use rustc_errors::struct_span_code_err;
66use rustc_hir as hir;
7use rustc_hir::HirId;
78use rustc_hir::def::{DefKind, Res};
89use rustc_hir::def_id::{DefId, LocalDefId};
9use rustc_hir::HirId;
1010use rustc_middle::bug;
1111use rustc_middle::ty::{self as ty, IsSuggestable, Ty, TyCtxt};
1212use rustc_span::symbol::Ident;
13use rustc_span::{sym, ErrorGuaranteed, Span, Symbol};
13use rustc_span::{ErrorGuaranteed, Span, Symbol, sym};
1414use rustc_trait_selection::traits;
1515use rustc_type_ir::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
1616use smallvec::SmallVec;
......@@ -672,15 +672,13 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
672672 let mut num_bound_vars = candidate.bound_vars().len();
673673 let args = candidate.skip_binder().args.extend_to(tcx, item_def_id, |param, _| {
674674 let arg = match param.kind {
675 ty::GenericParamDefKind::Lifetime => ty::Region::new_bound(
676 tcx,
677 ty::INNERMOST,
678 ty::BoundRegion {
675 ty::GenericParamDefKind::Lifetime => {
676 ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
679677 var: ty::BoundVar::from_usize(num_bound_vars),
680678 kind: ty::BoundRegionKind::BrNamed(param.def_id, param.name),
681 },
682 )
683 .into(),
679 })
680 .into()
681 }
684682 ty::GenericParamDefKind::Type { .. } => {
685683 let guar = *emitted_bad_param_err.get_or_insert_with(|| {
686684 self.dcx().emit_err(crate::errors::ReturnTypeNotationIllegalParam::Type {
compiler/rustc_hir_analysis/src/hir_ty_lowering/errors.rs+14-17
......@@ -3,7 +3,7 @@ use rustc_data_structures::sorted_map::SortedMap;
33use rustc_data_structures::unord::UnordMap;
44use rustc_errors::codes::*;
55use rustc_errors::{
6 pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan,
6 Applicability, Diag, ErrorGuaranteed, MultiSpan, pluralize, struct_span_code_err,
77};
88use rustc_hir as hir;
99use rustc_hir::def::{DefKind, Res};
......@@ -12,16 +12,16 @@ use rustc_middle::bug;
1212use rustc_middle::query::Key;
1313use rustc_middle::ty::print::{PrintPolyTraitRefExt as _, PrintTraitRefExt as _};
1414use rustc_middle::ty::{
15 self, suggest_constraining_type_param, AdtDef, Binder, GenericParamDefKind, TraitRef, Ty,
16 TyCtxt, TypeVisitableExt,
15 self, AdtDef, Binder, GenericParamDefKind, TraitRef, Ty, TyCtxt, TypeVisitableExt,
16 suggest_constraining_type_param,
1717};
1818use rustc_session::parse::feature_err;
1919use rustc_span::edit_distance::find_best_match_for_name;
20use rustc_span::symbol::{kw, sym, Ident};
21use rustc_span::{BytePos, Span, Symbol, DUMMY_SP};
20use rustc_span::symbol::{Ident, kw, sym};
21use rustc_span::{BytePos, DUMMY_SP, Span, Symbol};
2222use rustc_trait_selection::error_reporting::traits::report_object_safety_error;
2323use rustc_trait_selection::traits::{
24 object_safety_violations_for_assoc_item, FulfillmentError, TraitAliasExpansionInfo,
24 FulfillmentError, TraitAliasExpansionInfo, object_safety_violations_for_assoc_item,
2525};
2626
2727use crate::errors::{
......@@ -834,17 +834,14 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
834834 .into_iter()
835835 .map(|(trait_, mut assocs)| {
836836 assocs.sort();
837 format!(
838 "{} in `{trait_}`",
839 match &assocs[..] {
840 [] => String::new(),
841 [only] => format!("`{only}`"),
842 [assocs @ .., last] => format!(
843 "{} and `{last}`",
844 assocs.iter().map(|a| format!("`{a}`")).collect::<Vec<_>>().join(", ")
845 ),
846 }
847 )
837 format!("{} in `{trait_}`", match &assocs[..] {
838 [] => String::new(),
839 [only] => format!("`{only}`"),
840 [assocs @ .., last] => format!(
841 "{} and `{last}`",
842 assocs.iter().map(|a| format!("`{a}`")).collect::<Vec<_>>().join(", ")
843 ),
844 })
848845 })
849846 .collect::<Vec<String>>();
850847 names.sort();
compiler/rustc_hir_analysis/src/hir_ty_lowering/generics.rs+2-2
......@@ -1,10 +1,10 @@
11use rustc_ast::ast::ParamKindOrd;
22use rustc_errors::codes::*;
3use rustc_errors::{struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan};
3use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, struct_span_code_err};
44use rustc_hir as hir;
5use rustc_hir::GenericArg;
56use rustc_hir::def::{DefKind, Res};
67use rustc_hir::def_id::DefId;
7use rustc_hir::GenericArg;
88use rustc_middle::ty::{
99 self, GenericArgsRef, GenericParamDef, GenericParamDefKind, IsSuggestable, Ty,
1010};
compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs+1-1
......@@ -3,8 +3,8 @@ use rustc_errors::codes::*;
33use rustc_errors::{Diag, EmissionGuarantee, StashKey};
44use rustc_hir as hir;
55use rustc_hir::def::{DefKind, Res};
6use rustc_lint_defs::builtin::BARE_TRAIT_OBJECTS;
76use rustc_lint_defs::Applicability;
7use rustc_lint_defs::builtin::BARE_TRAIT_OBJECTS;
88use rustc_span::Span;
99use rustc_trait_selection::error_reporting::traits::suggestions::NextTypeParamName;
1010
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs+4-4
......@@ -26,7 +26,7 @@ use rustc_ast::TraitObjectSyntax;
2626use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
2727use rustc_errors::codes::*;
2828use rustc_errors::{
29 struct_span_code_err, Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError,
29 Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, struct_span_code_err,
3030};
3131use rustc_hir as hir;
3232use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
......@@ -44,8 +44,8 @@ use rustc_middle::ty::{
4444use rustc_middle::{bug, span_bug};
4545use rustc_session::lint::builtin::AMBIGUOUS_ASSOCIATED_ITEMS;
4646use rustc_span::edit_distance::find_best_match_for_name;
47use rustc_span::symbol::{kw, Ident, Symbol};
48use rustc_span::{Span, DUMMY_SP};
47use rustc_span::symbol::{Ident, Symbol, kw};
48use rustc_span::{DUMMY_SP, Span};
4949use rustc_target::spec::abi;
5050use rustc_trait_selection::infer::InferCtxtExt;
5151use rustc_trait_selection::traits::wf::object_region_bounds;
......@@ -54,7 +54,7 @@ use tracing::{debug, debug_span, instrument};
5454
5555use crate::bounds::Bounds;
5656use crate::errors::{AmbiguousLifetimeBound, BadReturnTypeNotation, WildPatTy};
57use crate::hir_ty_lowering::errors::{prohibit_assoc_item_constraint, GenericsArgsErrExtend};
57use crate::hir_ty_lowering::errors::{GenericsArgsErrExtend, prohibit_assoc_item_constraint};
5858use crate::hir_ty_lowering::generics::{check_generic_arg_count, lower_generic_args};
5959use crate::middle::resolve_bound_vars as rbv;
6060use crate::require_c_abi_if_c_variadic;
compiler/rustc_hir_analysis/src/hir_ty_lowering/object_safety.rs+1-1
......@@ -13,7 +13,7 @@ use rustc_middle::ty::{
1313use rustc_span::{ErrorGuaranteed, Span};
1414use rustc_trait_selection::error_reporting::traits::report_object_safety_error;
1515use rustc_trait_selection::traits::{self, hir_ty_lowering_object_safety_violations};
16use smallvec::{smallvec, SmallVec};
16use smallvec::{SmallVec, smallvec};
1717use tracing::{debug, instrument};
1818
1919use super::HirTyLowerer;
compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs+2-2
......@@ -68,15 +68,15 @@
6868use rustc_data_structures::fx::FxHashSet;
6969use rustc_hir as hir;
7070use rustc_hir::def_id::{DefId, LocalDefId};
71use rustc_infer::infer::outlives::env::OutlivesEnvironment;
7271use rustc_infer::infer::TyCtxtInferExt;
72use rustc_infer::infer::outlives::env::OutlivesEnvironment;
7373use rustc_infer::traits::specialization_graph::Node;
7474use rustc_middle::ty::trait_def::TraitSpecializationKind;
7575use rustc_middle::ty::{self, GenericArg, GenericArgs, GenericArgsRef, TyCtxt, TypeVisitableExt};
7676use rustc_span::{ErrorGuaranteed, Span};
7777use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
7878use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt as _;
79use rustc_trait_selection::traits::{self, translate_args_with_cause, wf, ObligationCtxt};
79use rustc_trait_selection::traits::{self, ObligationCtxt, translate_args_with_cause, wf};
8080use tracing::{debug, instrument};
8181
8282use crate::errors::GenericArgsOnOverriddenImpl;
compiler/rustc_hir_analysis/src/lib.rs+1-1
......@@ -100,8 +100,8 @@ use rustc_middle::mir::interpret::GlobalId;
100100use rustc_middle::query::Providers;
101101use rustc_middle::ty::{self, Ty, TyCtxt};
102102use rustc_session::parse::feature_err;
103use rustc_span::symbol::sym;
104103use rustc_span::Span;
104use rustc_span::symbol::sym;
105105use rustc_target::spec::abi::Abi;
106106use rustc_trait_selection::traits;
107107
compiler/rustc_hir_analysis/src/outlives/utils.rs+1-1
......@@ -2,7 +2,7 @@ use rustc_data_structures::fx::FxIndexMap;
22use rustc_middle::ty::{self, GenericArg, GenericArgKind, Region, Ty, TyCtxt};
33use rustc_middle::{bug, span_bug};
44use rustc_span::Span;
5use rustc_type_ir::outlives::{push_outlives_components, Component};
5use rustc_type_ir::outlives::{Component, push_outlives_components};
66use smallvec::smallvec;
77
88/// Tracks the `T: 'a` or `'a: 'a` predicates that we have inferred
compiler/rustc_hir_analysis/src/variance/dump.rs+1-1
......@@ -1,7 +1,7 @@
11use std::fmt::Write;
22
33use rustc_hir::def::DefKind;
4use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
4use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
55use rustc_middle::ty::{GenericArgs, TyCtxt};
66use rustc_span::symbol::sym;
77
compiler/rustc_hir_pretty/src/lib.rs+6-9
......@@ -18,9 +18,9 @@ use rustc_hir::{
1818 HirId, LifetimeParamKind, Node, PatKind, PreciseCapturingArg, RangeEnd, Term,
1919 TraitBoundModifier,
2020};
21use rustc_span::source_map::SourceMap;
22use rustc_span::symbol::{kw, Ident, Symbol};
2321use rustc_span::FileName;
22use rustc_span::source_map::SourceMap;
23use rustc_span::symbol::{Ident, Symbol, kw};
2424use rustc_target::spec::abi::Abi;
2525use {rustc_ast as ast, rustc_hir as hir};
2626
......@@ -2026,13 +2026,10 @@ impl<'a> State<'a> {
20262026 let generic_params = generic_params
20272027 .iter()
20282028 .filter(|p| {
2029 matches!(
2030 p,
2031 GenericParam {
2032 kind: GenericParamKind::Lifetime { kind: LifetimeParamKind::Explicit },
2033 ..
2034 }
2035 )
2029 matches!(p, GenericParam {
2030 kind: GenericParamKind::Lifetime { kind: LifetimeParamKind::Explicit },
2031 ..
2032 })
20362033 })
20372034 .collect::<Vec<_>>();
20382035
compiler/rustc_hir_typeck/src/callee.rs+22-28
......@@ -13,17 +13,17 @@ use rustc_middle::ty::adjustment::{
1313};
1414use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt};
1515use rustc_middle::{bug, span_bug};
16use rustc_span::def_id::LocalDefId;
17use rustc_span::symbol::{sym, Ident};
1816use rustc_span::Span;
17use rustc_span::def_id::LocalDefId;
18use rustc_span::symbol::{Ident, sym};
1919use rustc_target::spec::abi;
2020use rustc_trait_selection::error_reporting::traits::DefIdOrName;
2121use rustc_trait_selection::infer::InferCtxtExt as _;
2222use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
2323use tracing::{debug, instrument, trace};
2424
25use super::method::probe::ProbeScope;
2625use super::method::MethodCallee;
26use super::method::probe::ProbeScope;
2727use super::{Expectation, FnCtxt, TupleArgumentsFlag};
2828use crate::errors;
2929
......@@ -156,16 +156,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
156156 closure_sig,
157157 );
158158 let adjustments = self.adjust_steps(autoderef);
159 self.record_deferred_call_resolution(
160 def_id,
161 DeferredCallResolution {
162 call_expr,
163 callee_expr,
164 closure_ty: adjusted_ty,
165 adjustments,
166 fn_sig: closure_sig,
167 },
168 );
159 self.record_deferred_call_resolution(def_id, DeferredCallResolution {
160 call_expr,
161 callee_expr,
162 closure_ty: adjusted_ty,
163 adjustments,
164 fn_sig: closure_sig,
165 });
169166 return Some(CallStep::DeferredClosure(def_id, closure_sig));
170167 }
171168
......@@ -202,16 +199,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
202199 coroutine_closure_sig.abi,
203200 );
204201 let adjustments = self.adjust_steps(autoderef);
205 self.record_deferred_call_resolution(
206 def_id,
207 DeferredCallResolution {
208 call_expr,
209 callee_expr,
210 closure_ty: adjusted_ty,
211 adjustments,
212 fn_sig: call_sig,
213 },
214 );
202 self.record_deferred_call_resolution(def_id, DeferredCallResolution {
203 call_expr,
204 callee_expr,
205 closure_ty: adjusted_ty,
206 adjustments,
207 fn_sig: call_sig,
208 });
215209 return Some(CallStep::DeferredClosure(def_id, call_sig));
216210 }
217211
......@@ -554,11 +548,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
554548 self.tcx,
555549 self.misc(span),
556550 self.param_env,
557 ty::TraitRef::new(
558 self.tcx,
559 fn_once_def_id,
560 [arg_ty.into(), fn_sig.inputs()[0].into(), const_param],
561 ),
551 ty::TraitRef::new(self.tcx, fn_once_def_id, [
552 arg_ty.into(),
553 fn_sig.inputs()[0].into(),
554 const_param,
555 ]),
562556 ));
563557
564558 self.register_predicate(traits::Obligation::new(
compiler/rustc_hir_typeck/src/cast.rs+11-15
......@@ -42,7 +42,7 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeAndMut, TypeVisitableExt, VariantDe
4242use rustc_session::lint;
4343use rustc_span::def_id::LOCAL_CRATE;
4444use rustc_span::symbol::sym;
45use rustc_span::{Span, DUMMY_SP};
45use rustc_span::{DUMMY_SP, Span};
4646use rustc_trait_selection::infer::InferCtxtExt;
4747use tracing::{debug, instrument};
4848
......@@ -284,14 +284,11 @@ impl<'a, 'tcx> CastCheck<'tcx> {
284284 let mut err =
285285 make_invalid_casting_error(self.span, self.expr_ty, self.cast_ty, fcx);
286286 if self.cast_ty.is_integral() {
287 err.help(format!(
288 "cast through {} first",
289 match e {
290 CastError::NeedViaPtr => "a raw pointer",
291 CastError::NeedViaThinPtr => "a thin pointer",
292 e => unreachable!("control flow means we should never encounter a {e:?}"),
293 }
294 ));
287 err.help(format!("cast through {} first", match e {
288 CastError::NeedViaPtr => "a raw pointer",
289 CastError::NeedViaThinPtr => "a thin pointer",
290 e => unreachable!("control flow means we should never encounter a {e:?}"),
291 }));
295292 }
296293
297294 self.try_suggest_collection_to_bool(fcx, &mut err);
......@@ -620,12 +617,11 @@ impl<'a, 'tcx> CastCheck<'tcx> {
620617 };
621618 let expr_ty = fcx.resolve_vars_if_possible(self.expr_ty);
622619 let cast_ty = fcx.resolve_vars_if_possible(self.cast_ty);
623 fcx.tcx.emit_node_span_lint(
624 lint,
625 self.expr.hir_id,
626 self.span,
627 errors::TrivialCast { numeric, expr_ty, cast_ty },
628 );
620 fcx.tcx.emit_node_span_lint(lint, self.expr.hir_id, self.span, errors::TrivialCast {
621 numeric,
622 expr_ty,
623 cast_ty,
624 });
629625 }
630626
631627 #[instrument(skip(fcx), level = "debug")]
compiler/rustc_hir_typeck/src/check.rs+10-13
......@@ -191,21 +191,18 @@ fn check_panic_info_fn(tcx: TyCtxt<'_>, fn_id: LocalDefId, fn_sig: ty::FnSig<'_>
191191 let panic_info_did = tcx.require_lang_item(hir::LangItem::PanicInfo, Some(span));
192192
193193 // build type `for<'a, 'b> fn(&'a PanicInfo<'b>) -> !`
194 let panic_info_ty = tcx.type_of(panic_info_did).instantiate(
195 tcx,
196 &[ty::GenericArg::from(ty::Region::new_bound(
197 tcx,
198 ty::INNERMOST,
199 ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon },
200 ))],
201 );
194 let panic_info_ty = tcx.type_of(panic_info_did).instantiate(tcx, &[ty::GenericArg::from(
195 ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
196 var: ty::BoundVar::from_u32(1),
197 kind: ty::BrAnon,
198 }),
199 )]);
202200 let panic_info_ref_ty = Ty::new_imm_ref(
203201 tcx,
204 ty::Region::new_bound(
205 tcx,
206 ty::INNERMOST,
207 ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon },
208 ),
202 ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
203 var: ty::BoundVar::ZERO,
204 kind: ty::BrAnon,
205 }),
209206 panic_info_ty,
210207 );
211208
compiler/rustc_hir_typeck/src/closure.rs+20-28
......@@ -14,14 +14,14 @@ use rustc_middle::span_bug;
1414use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
1515use rustc_middle::ty::{self, GenericArgs, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor};
1616use rustc_span::def_id::LocalDefId;
17use rustc_span::{Span, DUMMY_SP};
17use rustc_span::{DUMMY_SP, Span};
1818use rustc_target::spec::abi::Abi;
1919use rustc_trait_selection::error_reporting::traits::ArgKind;
2020use rustc_trait_selection::traits;
2121use rustc_type_ir::ClosureKind;
2222use tracing::{debug, instrument, trace};
2323
24use super::{check_fn, CoroutineTypes, Expectation, FnCtxt};
24use super::{CoroutineTypes, Expectation, FnCtxt, check_fn};
2525
2626/// What signature do we *expect* the closure to have from context?
2727#[derive(Debug, Clone, TypeFoldable, TypeVisitable)]
......@@ -103,15 +103,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
103103 None => self.next_ty_var(expr_span),
104104 };
105105
106 let closure_args = ty::ClosureArgs::new(
107 tcx,
108 ty::ClosureArgsParts {
109 parent_args,
110 closure_kind_ty,
111 closure_sig_as_fn_ptr_ty: Ty::new_fn_ptr(tcx, sig),
112 tupled_upvars_ty,
113 },
114 );
106 let closure_args = ty::ClosureArgs::new(tcx, ty::ClosureArgsParts {
107 parent_args,
108 closure_kind_ty,
109 closure_sig_as_fn_ptr_ty: Ty::new_fn_ptr(tcx, sig),
110 tupled_upvars_ty,
111 });
115112
116113 (Ty::new_closure(tcx, expr_def_id.to_def_id(), closure_args.args), None)
117114 }
......@@ -180,18 +177,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
180177 _ => tcx.types.unit,
181178 };
182179
183 let coroutine_args = ty::CoroutineArgs::new(
184 tcx,
185 ty::CoroutineArgsParts {
186 parent_args,
187 kind_ty,
188 resume_ty,
189 yield_ty,
190 return_ty: liberated_sig.output(),
191 witness: interior,
192 tupled_upvars_ty,
193 },
194 );
180 let coroutine_args = ty::CoroutineArgs::new(tcx, ty::CoroutineArgsParts {
181 parent_args,
182 kind_ty,
183 resume_ty,
184 yield_ty,
185 return_ty: liberated_sig.output(),
186 witness: interior,
187 tupled_upvars_ty,
188 });
195189
196190 (
197191 Ty::new_coroutine(tcx, expr_def_id.to_def_id(), coroutine_args.args),
......@@ -222,9 +216,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
222216 };
223217
224218 let coroutine_captures_by_ref_ty = self.next_ty_var(expr_span);
225 let closure_args = ty::CoroutineClosureArgs::new(
226 tcx,
227 ty::CoroutineClosureArgsParts {
219 let closure_args =
220 ty::CoroutineClosureArgs::new(tcx, ty::CoroutineClosureArgsParts {
228221 parent_args,
229222 closure_kind_ty,
230223 signature_parts_ty: Ty::new_fn_ptr(
......@@ -245,8 +238,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
245238 tupled_upvars_ty,
246239 coroutine_captures_by_ref_ty,
247240 coroutine_witness_ty: interior,
248 },
249 );
241 });
250242
251243 let coroutine_kind_ty = match expected_kind {
252244 Some(kind) => Ty::from_coroutine_closure_kind(tcx, kind),
compiler/rustc_hir_typeck/src/coercion.rs+25-31
......@@ -38,7 +38,7 @@
3838use std::ops::Deref;
3939
4040use rustc_errors::codes::*;
41use rustc_errors::{struct_span_code_err, Applicability, Diag};
41use rustc_errors::{Applicability, Diag, struct_span_code_err};
4242use rustc_hir as hir;
4343use rustc_hir::def_id::{DefId, LocalDefId};
4444use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer;
......@@ -58,18 +58,18 @@ use rustc_middle::ty::visit::TypeVisitableExt;
5858use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
5959use rustc_session::parse::feature_err;
6060use rustc_span::symbol::sym;
61use rustc_span::{BytePos, DesugaringKind, Span, DUMMY_SP};
61use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, Span};
6262use rustc_target::spec::abi::Abi;
6363use rustc_trait_selection::infer::InferCtxtExt as _;
6464use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
6565use rustc_trait_selection::traits::{
6666 self, NormalizeExt, ObligationCause, ObligationCauseCode, ObligationCtxt,
6767};
68use smallvec::{smallvec, SmallVec};
68use smallvec::{SmallVec, smallvec};
6969use tracing::{debug, instrument};
7070
71use crate::errors::SuggestBoxingForReturnImplTrait;
7271use crate::FnCtxt;
72use crate::errors::SuggestBoxingForReturnImplTrait;
7373
7474struct Coerce<'a, 'tcx> {
7575 fcx: &'a FnCtxt<'a, 'tcx>,
......@@ -534,24 +534,18 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
534534 // the reborrow in coerce_borrowed_ptr will pick it up.
535535 let mutbl = AutoBorrowMutability::new(mutbl_b, AllowTwoPhase::No);
536536
537 Some((
538 Adjustment { kind: Adjust::Deref(None), target: ty_a },
539 Adjustment {
540 kind: Adjust::Borrow(AutoBorrow::Ref(r_borrow, mutbl)),
541 target: Ty::new_ref(self.tcx, r_borrow, ty_a, mutbl_b),
542 },
543 ))
537 Some((Adjustment { kind: Adjust::Deref(None), target: ty_a }, Adjustment {
538 kind: Adjust::Borrow(AutoBorrow::Ref(r_borrow, mutbl)),
539 target: Ty::new_ref(self.tcx, r_borrow, ty_a, mutbl_b),
540 }))
544541 }
545542 (&ty::Ref(_, ty_a, mt_a), &ty::RawPtr(_, mt_b)) => {
546543 coerce_mutbls(mt_a, mt_b)?;
547544
548 Some((
549 Adjustment { kind: Adjust::Deref(None), target: ty_a },
550 Adjustment {
551 kind: Adjust::Borrow(AutoBorrow::RawPtr(mt_b)),
552 target: Ty::new_ptr(self.tcx, ty_a, mt_b),
553 },
554 ))
545 Some((Adjustment { kind: Adjust::Deref(None), target: ty_a }, Adjustment {
546 kind: Adjust::Borrow(AutoBorrow::RawPtr(mt_b)),
547 target: Ty::new_ptr(self.tcx, ty_a, mt_b),
548 }))
555549 }
556550 _ => None,
557551 };
......@@ -573,11 +567,11 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
573567 let mut selcx = traits::SelectionContext::new(self);
574568
575569 // Create an obligation for `Source: CoerceUnsized<Target>`.
576 let cause = ObligationCause::new(
577 self.cause.span,
578 self.body_id,
579 ObligationCauseCode::Coercion { source, target },
580 );
570 let cause =
571 ObligationCause::new(self.cause.span, self.body_id, ObligationCauseCode::Coercion {
572 source,
573 target,
574 });
581575
582576 // Use a FIFO queue for this custom fulfillment procedure.
583577 //
......@@ -1021,10 +1015,10 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
10211015 // regionck knows that the region for `a` must be valid here.
10221016 if is_ref {
10231017 self.unify_and(a_unsafe, b, |target| {
1024 vec![
1025 Adjustment { kind: Adjust::Deref(None), target: mt_a.ty },
1026 Adjustment { kind: Adjust::Borrow(AutoBorrow::RawPtr(mutbl_b)), target },
1027 ]
1018 vec![Adjustment { kind: Adjust::Deref(None), target: mt_a.ty }, Adjustment {
1019 kind: Adjust::Borrow(AutoBorrow::RawPtr(mutbl_b)),
1020 target,
1021 }]
10281022 })
10291023 } else if mt_a.mutbl != mutbl_b {
10301024 self.unify_and(a_unsafe, b, simple(Adjust::Pointer(PointerCoercion::MutToConstPointer)))
......@@ -1241,10 +1235,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12411235 _ => span_bug!(new.span, "should not try to coerce a {new_ty} to a fn pointer"),
12421236 };
12431237 for expr in exprs.iter().map(|e| e.as_coercion_site()) {
1244 self.apply_adjustments(
1245 expr,
1246 vec![Adjustment { kind: prev_adjustment.clone(), target: fn_ptr }],
1247 );
1238 self.apply_adjustments(expr, vec![Adjustment {
1239 kind: prev_adjustment.clone(),
1240 target: fn_ptr,
1241 }]);
12481242 }
12491243 self.apply_adjustments(new, vec![Adjustment { kind: next_adjustment, target: fn_ptr }]);
12501244 return Ok(fn_ptr);
compiler/rustc_hir_typeck/src/demand.rs+1-1
......@@ -10,7 +10,7 @@ use rustc_middle::ty::fold::BottomUpFolder;
1010use rustc_middle::ty::print::with_no_trimmed_paths;
1111use rustc_middle::ty::{self, AssocItem, Ty, TypeFoldable, TypeVisitableExt};
1212use rustc_span::symbol::sym;
13use rustc_span::{Span, DUMMY_SP};
13use rustc_span::{DUMMY_SP, Span};
1414use rustc_trait_selection::infer::InferCtxtExt;
1515use rustc_trait_selection::traits::ObligationCause;
1616use tracing::instrument;
compiler/rustc_hir_typeck/src/diverges.rs+1-1
......@@ -1,6 +1,6 @@
11use std::{cmp, ops};
22
3use rustc_span::{Span, DUMMY_SP};
3use rustc_span::{DUMMY_SP, Span};
44
55/// Tracks whether executing a node may exit normally (versus
66/// return/break/panic, which "diverge", leaving dead code in their
compiler/rustc_hir_typeck/src/expr.rs+13-13
......@@ -7,7 +7,7 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
77use rustc_data_structures::unord::UnordMap;
88use rustc_errors::codes::*;
99use rustc_errors::{
10 pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, StashKey, Subdiagnostic,
10 Applicability, Diag, ErrorGuaranteed, StashKey, Subdiagnostic, pluralize, struct_span_code_err,
1111};
1212use rustc_hir::def::{CtorKind, DefKind, Res};
1313use rustc_hir::def_id::DefId;
......@@ -17,26 +17,28 @@ use rustc_hir::{ExprKind, HirId, QPath};
1717use rustc_hir_analysis::hir_ty_lowering::HirTyLowerer as _;
1818use rustc_infer::infer;
1919use rustc_infer::infer::{DefineOpaqueTypes, InferOk};
20use rustc_infer::traits::query::NoSolution;
2120use rustc_infer::traits::ObligationCause;
21use rustc_infer::traits::query::NoSolution;
2222use rustc_middle::ty::adjustment::{Adjust, Adjustment, AllowTwoPhase};
2323use rustc_middle::ty::error::{ExpectedFound, TypeError};
2424use rustc_middle::ty::{self, AdtKind, GenericArgsRef, Ty, TypeVisitableExt};
2525use rustc_middle::{bug, span_bug};
2626use rustc_session::errors::ExprParenthesesNeeded;
2727use rustc_session::parse::feature_err;
28use rustc_span::Span;
2829use rustc_span::edit_distance::find_best_match_for_name;
2930use rustc_span::hygiene::DesugaringKind;
3031use rustc_span::source_map::Spanned;
31use rustc_span::symbol::{kw, sym, Ident, Symbol};
32use rustc_span::Span;
33use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
32use rustc_span::symbol::{Ident, Symbol, kw, sym};
33use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
3434use rustc_trait_selection::infer::InferCtxtExt;
3535use rustc_trait_selection::traits::{self, ObligationCauseCode, ObligationCtxt};
3636use smallvec::SmallVec;
3737use tracing::{debug, instrument, trace};
3838use {rustc_ast as ast, rustc_hir as hir};
3939
40use crate::Expectation::{self, ExpectCastableToType, ExpectHasType, NoExpectation};
41use crate::TupleArgumentsFlag::DontTupleArguments;
4042use crate::coercion::{CoerceMany, DynamicCoerceMany};
4143use crate::errors::{
4244 AddressOfTemporaryTaken, FieldMultiplySpecifiedInInitializer,
......@@ -44,11 +46,9 @@ use crate::errors::{
4446 ReturnStmtOutsideOfFnBody, StructExprNonExhaustive, TypeMismatchFruTypo,
4547 YieldExprOutsideOfCoroutine,
4648};
47use crate::Expectation::{self, ExpectCastableToType, ExpectHasType, NoExpectation};
48use crate::TupleArgumentsFlag::DontTupleArguments;
4949use crate::{
50 cast, fatally_break_rust, report_unexpected_variant_res, type_error_struct, BreakableCtxt,
51 CoroutineTypes, Diverges, FnCtxt, Needs,
50 BreakableCtxt, CoroutineTypes, Diverges, FnCtxt, Needs, cast, fatally_break_rust,
51 report_unexpected_variant_res, type_error_struct,
5252};
5353
5454impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
......@@ -72,10 +72,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
7272 }
7373
7474 let adj_ty = self.next_ty_var(expr.span);
75 self.apply_adjustments(
76 expr,
77 vec![Adjustment { kind: Adjust::NeverToAny, target: adj_ty }],
78 );
75 self.apply_adjustments(expr, vec![Adjustment {
76 kind: Adjust::NeverToAny,
77 target: adj_ty,
78 }]);
7979 ty = adj_ty;
8080 }
8181
compiler/rustc_hir_typeck/src/expr_use_visitor.rs+7-5
......@@ -6,9 +6,9 @@ use std::cell::{Ref, RefCell};
66use std::ops::Deref;
77use std::slice::from_ref;
88
9use hir::Expr;
910use hir::def::DefKind;
1011use hir::pat_util::EnumerateAndAdjustIterator as _;
11use hir::Expr;
1212use rustc_data_structures::fx::FxIndexMap;
1313use rustc_hir as hir;
1414use rustc_hir::def::{CtorOf, Res};
......@@ -20,11 +20,11 @@ use rustc_middle::hir::place::ProjectionKind;
2020pub use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection};
2121use rustc_middle::mir::FakeReadCause;
2222use rustc_middle::ty::{
23 self, adjustment, AdtKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt as _,
23 self, AdtKind, Ty, TyCtxt, TypeFoldable, TypeVisitableExt as _, adjustment,
2424};
2525use rustc_middle::{bug, span_bug};
2626use rustc_span::{ErrorGuaranteed, Span};
27use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
27use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
2828use rustc_trait_selection::infer::InferCtxtExt;
2929use tracing::{debug, trace};
3030use ty::BorrowKind::ImmBorrow;
......@@ -151,7 +151,8 @@ pub trait TypeInformationCtxt<'tcx> {
151151}
152152
153153impl<'tcx> TypeInformationCtxt<'tcx> for &FnCtxt<'_, 'tcx> {
154 type TypeckResults<'a> = Ref<'a, ty::TypeckResults<'tcx>>
154 type TypeckResults<'a>
155 = Ref<'a, ty::TypeckResults<'tcx>>
155156 where
156157 Self: 'a;
157158
......@@ -195,7 +196,8 @@ impl<'tcx> TypeInformationCtxt<'tcx> for &FnCtxt<'_, 'tcx> {
195196}
196197
197198impl<'tcx> TypeInformationCtxt<'tcx> for (&LateContext<'tcx>, LocalDefId) {
198 type TypeckResults<'a> = &'tcx ty::TypeckResults<'tcx>
199 type TypeckResults<'a>
200 = &'tcx ty::TypeckResults<'tcx>
199201 where
200202 Self: 'a;
201203
compiler/rustc_hir_typeck/src/fallback.rs+3-3
......@@ -5,18 +5,18 @@ use rustc_data_structures::graph::vec_graph::VecGraph;
55use rustc_data_structures::graph::{self};
66use rustc_data_structures::unord::{UnordBag, UnordMap, UnordSet};
77use rustc_hir as hir;
8use rustc_hir::intravisit::Visitor;
98use rustc_hir::HirId;
9use rustc_hir::intravisit::Visitor;
1010use rustc_infer::infer::{DefineOpaqueTypes, InferOk};
1111use rustc_middle::bug;
1212use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable};
1313use rustc_session::lint;
1414use rustc_span::def_id::LocalDefId;
15use rustc_span::{Span, DUMMY_SP};
15use rustc_span::{DUMMY_SP, Span};
1616use rustc_trait_selection::traits::{ObligationCause, ObligationCtxt};
1717use tracing::debug;
1818
19use crate::{errors, FnCtxt, TypeckRootCtxt};
19use crate::{FnCtxt, TypeckRootCtxt, errors};
2020
2121#[derive(Copy, Clone)]
2222pub(crate) enum DivergingFallbackBehavior {
compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs+16-23
......@@ -28,10 +28,10 @@ use rustc_middle::ty::{
2828};
2929use rustc_middle::{bug, span_bug};
3030use rustc_session::lint;
31use rustc_span::Span;
3132use rustc_span::def_id::LocalDefId;
3233use rustc_span::hygiene::DesugaringKind;
3334use rustc_span::symbol::kw;
34use rustc_span::Span;
3535use rustc_target::abi::FieldIdx;
3636use rustc_trait_selection::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
3737use rustc_trait_selection::traits::{
......@@ -42,7 +42,7 @@ use tracing::{debug, instrument};
4242use crate::callee::{self, DeferredCallResolution};
4343use crate::errors::{self, CtorIsPrivate};
4444use crate::method::{self, MethodCallee};
45use crate::{rvalue_scopes, BreakableCtxt, Diverges, Expectation, FnCtxt, LoweredTy};
45use crate::{BreakableCtxt, Diverges, Expectation, FnCtxt, LoweredTy, rvalue_scopes};
4646
4747impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
4848 /// Produces warning on the given node, if the current point in the
......@@ -224,10 +224,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
224224 debug!("fcx {}", self.tag());
225225
226226 if Self::can_contain_user_lifetime_bounds((args, user_self_ty)) {
227 let canonicalized = self.canonicalize_user_type_annotation(UserType::TypeOf(
228 def_id,
229 UserArgs { args, user_self_ty },
230 ));
227 let canonicalized =
228 self.canonicalize_user_type_annotation(UserType::TypeOf(def_id, UserArgs {
229 args,
230 user_self_ty,
231 }));
231232 debug!(?canonicalized);
232233 self.write_user_type_annotation(hir_id, canonicalized);
233234 }
......@@ -270,13 +271,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
270271 }
271272
272273 let autoborrow_mut = adj.iter().any(|adj| {
273 matches!(
274 adj,
275 &Adjustment {
276 kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. })),
277 ..
278 }
279 )
274 matches!(adj, &Adjustment {
275 kind: Adjust::Borrow(AutoBorrow::Ref(_, AutoBorrowMutability::Mut { .. })),
276 ..
277 })
280278 });
281279
282280 match self.typeck_results.borrow_mut().adjustments_mut().entry(expr.hir_id) {
......@@ -968,16 +966,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
968966 let mut sp = MultiSpan::from_span(path_segment.ident.span);
969967 sp.push_span_label(
970968 path_segment.ident.span,
971 format!(
972 "this call modifies {} in-place",
973 match rcvr.kind {
974 ExprKind::Path(QPath::Resolved(
975 None,
976 hir::Path { segments: [segment], .. },
977 )) => format!("`{}`", segment.ident),
978 _ => "its receiver".to_string(),
979 }
980 ),
969 format!("this call modifies {} in-place", match rcvr.kind {
970 ExprKind::Path(QPath::Resolved(None, hir::Path { segments: [segment], .. })) =>
971 format!("`{}`", segment.ident),
972 _ => "its receiver".to_string(),
973 }),
981974 );
982975
983976 let modifies_rcvr_note =
compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs+1-1
......@@ -5,8 +5,8 @@ use rustc_hir::def::{DefKind, Res};
55use rustc_hir::def_id::DefId;
66use rustc_infer::traits::ObligationCauseCode;
77use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor};
8use rustc_span::symbol::kw;
98use rustc_span::Span;
9use rustc_span::symbol::kw;
1010use rustc_trait_selection::traits;
1111
1212use crate::FnCtxt;
compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs+9-9
......@@ -4,8 +4,8 @@ use itertools::Itertools;
44use rustc_data_structures::fx::FxIndexSet;
55use rustc_errors::codes::*;
66use rustc_errors::{
7 a_or_an, display_list_with_comma_and, pluralize, Applicability, Diag, ErrorGuaranteed,
8 MultiSpan, StashKey,
7 Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey, a_or_an,
8 display_list_with_comma_and, pluralize,
99};
1010use rustc_hir::def::{CtorOf, DefKind, Res};
1111use rustc_hir::def_id::DefId;
......@@ -22,28 +22,28 @@ use rustc_middle::ty::visit::TypeVisitableExt;
2222use rustc_middle::ty::{self, IsSuggestable, Ty, TyCtxt};
2323use rustc_middle::{bug, span_bug};
2424use rustc_session::Session;
25use rustc_span::symbol::{kw, Ident};
26use rustc_span::{sym, Span, DUMMY_SP};
25use rustc_span::symbol::{Ident, kw};
26use rustc_span::{DUMMY_SP, Span, sym};
2727use rustc_trait_selection::error_reporting::infer::{FailureCode, ObligationCauseExt};
2828use rustc_trait_selection::infer::InferCtxtExt;
2929use rustc_trait_selection::traits::{self, ObligationCauseCode, ObligationCtxt, SelectionContext};
3030use tracing::debug;
3131use {rustc_ast as ast, rustc_hir as hir};
3232
33use crate::Expectation::*;
34use crate::TupleArgumentsFlag::*;
3335use crate::coercion::CoerceMany;
3436use crate::errors::SuggestPtrNullMut;
3537use crate::fn_ctxt::arg_matrix::{ArgMatrix, Compatibility, Error, ExpectedIdx, ProvidedIdx};
3638use crate::fn_ctxt::infer::FnCall;
3739use crate::gather_locals::Declaration;
40use crate::method::MethodCallee;
3841use crate::method::probe::IsSuggestion;
3942use crate::method::probe::Mode::MethodCall;
4043use crate::method::probe::ProbeScope::TraitsInScope;
41use crate::method::MethodCallee;
42use crate::Expectation::*;
43use crate::TupleArgumentsFlag::*;
4444use crate::{
45 errors, struct_span_code_err, BreakableCtxt, Diverges, Expectation, FnCtxt, LoweredTy, Needs,
46 TupleArgumentsFlag,
45 BreakableCtxt, Diverges, Expectation, FnCtxt, LoweredTy, Needs, TupleArgumentsFlag, errors,
46 struct_span_code_err,
4747};
4848
4949#[derive(Clone, Copy, Default)]
compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs+2-2
......@@ -17,9 +17,9 @@ use rustc_infer::infer;
1717use rustc_middle::ty::{self, Const, Ty, TyCtxt, TypeVisitableExt};
1818use rustc_session::Session;
1919use rustc_span::symbol::Ident;
20use rustc_span::{self, sym, Span, DUMMY_SP};
21use rustc_trait_selection::error_reporting::infer::sub_relations::SubRelations;
20use rustc_span::{self, DUMMY_SP, Span, sym};
2221use rustc_trait_selection::error_reporting::TypeErrCtxt;
22use rustc_trait_selection::error_reporting::infer::sub_relations::SubRelations;
2323use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode, ObligationCtxt};
2424
2525use crate::coercion::DynamicCoerceMany;
compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs+12-12
......@@ -19,15 +19,15 @@ use rustc_middle::middle::stability::EvalResult;
1919use rustc_middle::span_bug;
2020use rustc_middle::ty::print::with_no_trimmed_paths;
2121use rustc_middle::ty::{
22 self, suggest_constraining_type_params, Article, Binder, IsSuggestable, Ty, TyCtxt,
23 TypeVisitableExt, Upcast,
22 self, Article, Binder, IsSuggestable, Ty, TyCtxt, TypeVisitableExt, Upcast,
23 suggest_constraining_type_params,
2424};
2525use rustc_session::errors::ExprParenthesesNeeded;
2626use rustc_span::source_map::Spanned;
27use rustc_span::symbol::{sym, Ident};
27use rustc_span::symbol::{Ident, sym};
2828use rustc_span::{Span, Symbol};
29use rustc_trait_selection::error_reporting::traits::DefIdOrName;
3029use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
30use rustc_trait_selection::error_reporting::traits::DefIdOrName;
3131use rustc_trait_selection::infer::InferCtxtExt;
3232use rustc_trait_selection::traits;
3333use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
......@@ -2001,17 +2001,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
20012001 expr.kind,
20022002 hir::ExprKind::Call(
20032003 hir::Expr {
2004 kind: hir::ExprKind::Path(hir::QPath::Resolved(
2005 None,
2006 hir::Path { res: Res::Def(hir::def::DefKind::Ctor(_, _), _), .. },
2007 )),
2004 kind: hir::ExprKind::Path(hir::QPath::Resolved(None, hir::Path {
2005 res: Res::Def(hir::def::DefKind::Ctor(_, _), _),
2006 ..
2007 },)),
20082008 ..
20092009 },
20102010 ..,
2011 ) | hir::ExprKind::Path(hir::QPath::Resolved(
2012 None,
2013 hir::Path { res: Res::Def(hir::def::DefKind::Ctor(_, _), _), .. },
2014 )),
2011 ) | hir::ExprKind::Path(hir::QPath::Resolved(None, hir::Path {
2012 res: Res::Def(hir::def::DefKind::Ctor(_, _), _),
2013 ..
2014 },)),
20152015 );
20162016
20172017 let (article, kind, variant, sugg_operator) =
compiler/rustc_hir_typeck/src/gather_locals.rs+1-1
......@@ -3,8 +3,8 @@ use rustc_hir::intravisit::{self, Visitor};
33use rustc_hir::{HirId, PatKind};
44use rustc_infer::traits::ObligationCauseCode;
55use rustc_middle::ty::{Ty, UserType};
6use rustc_span::def_id::LocalDefId;
76use rustc_span::Span;
7use rustc_span::def_id::LocalDefId;
88use tracing::debug;
99
1010use crate::FnCtxt;
compiler/rustc_hir_typeck/src/lib.rs+2-2
......@@ -43,7 +43,7 @@ pub use coercion::can_coerce;
4343use fn_ctxt::FnCtxt;
4444use rustc_data_structures::unord::UnordSet;
4545use rustc_errors::codes::*;
46use rustc_errors::{pluralize, struct_span_code_err, Applicability, ErrorGuaranteed};
46use rustc_errors::{Applicability, ErrorGuaranteed, pluralize, struct_span_code_err};
4747use rustc_hir as hir;
4848use rustc_hir::def::{DefKind, Res};
4949use rustc_hir::intravisit::Visitor;
......@@ -55,8 +55,8 @@ use rustc_middle::query::Providers;
5555use rustc_middle::ty::{self, Ty, TyCtxt};
5656use rustc_middle::{bug, span_bug};
5757use rustc_session::config;
58use rustc_span::def_id::LocalDefId;
5958use rustc_span::Span;
59use rustc_span::def_id::LocalDefId;
6060use tracing::{debug, instrument};
6161use typeck_root_ctxt::TypeckRootCtxt;
6262
compiler/rustc_hir_typeck/src/method/confirm.rs+4-4
......@@ -1,8 +1,8 @@
11use std::ops::Deref;
22
33use rustc_hir as hir;
4use rustc_hir::def_id::DefId;
54use rustc_hir::GenericArg;
5use rustc_hir::def_id::DefId;
66use rustc_hir_analysis::hir_ty_lowering::generics::{
77 check_generic_arg_count_for_call, lower_generic_args,
88};
......@@ -20,12 +20,12 @@ use rustc_middle::ty::{
2020 UserType,
2121};
2222use rustc_middle::{bug, span_bug};
23use rustc_span::{Span, DUMMY_SP};
23use rustc_span::{DUMMY_SP, Span};
2424use rustc_trait_selection::traits;
2525use tracing::debug;
2626
27use super::{probe, MethodCallee};
28use crate::{callee, FnCtxt};
27use super::{MethodCallee, probe};
28use crate::{FnCtxt, callee};
2929
3030struct ConfirmContext<'a, 'tcx> {
3131 fcx: &'a FnCtxt<'a, 'tcx>,
compiler/rustc_hir_typeck/src/method/mod.rs+2-2
......@@ -18,14 +18,14 @@ use rustc_middle::ty::{
1818 self, GenericArgs, GenericArgsRef, GenericParamDefKind, Ty, TypeVisitableExt,
1919};
2020use rustc_middle::{bug, span_bug};
21use rustc_span::symbol::Ident;
2221use rustc_span::Span;
22use rustc_span::symbol::Ident;
2323use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
2424use rustc_trait_selection::traits::{self, NormalizeExt};
2525use tracing::{debug, instrument};
2626
27use self::probe::{IsSuggestion, ProbeScope};
2827pub(crate) use self::MethodError::*;
28use self::probe::{IsSuggestion, ProbeScope};
2929use crate::FnCtxt;
3030
3131pub(crate) fn provide(providers: &mut Providers) {
compiler/rustc_hir_typeck/src/method/prelude_edition_lints.rs+3-3
......@@ -8,14 +8,14 @@ use rustc_lint::{ARRAY_INTO_ITER, BOXED_SLICE_INTO_ITER};
88use rustc_middle::span_bug;
99use rustc_middle::ty::{self, Ty};
1010use rustc_session::lint::builtin::{RUST_2021_PRELUDE_COLLISIONS, RUST_2024_PRELUDE_COLLISIONS};
11use rustc_span::symbol::kw::{Empty, Underscore};
12use rustc_span::symbol::{sym, Ident};
1311use rustc_span::Span;
12use rustc_span::symbol::kw::{Empty, Underscore};
13use rustc_span::symbol::{Ident, sym};
1414use rustc_trait_selection::infer::InferCtxtExt;
1515use tracing::debug;
1616
17use crate::method::probe::{self, Pick};
1817use crate::FnCtxt;
18use crate::method::probe::{self, Pick};
1919
2020impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2121 pub(super) fn lint_edition_dependent_dot_call(
compiler/rustc_hir_typeck/src/method/probe.rs+7-7
......@@ -6,15 +6,15 @@ use std::ops::Deref;
66use rustc_data_structures::fx::FxHashSet;
77use rustc_errors::Applicability;
88use rustc_hir as hir;
9use rustc_hir::def::DefKind;
109use rustc_hir::HirId;
10use rustc_hir::def::DefKind;
1111use rustc_hir_analysis::autoderef::{self, Autoderef};
1212use rustc_infer::infer::canonical::{Canonical, OriginalQueryValues, QueryResponse};
1313use rustc_infer::infer::{self, DefineOpaqueTypes, InferOk, TyCtxtInferExt};
1414use rustc_infer::traits::ObligationCauseCode;
1515use rustc_middle::middle::stability;
1616use rustc_middle::query::Providers;
17use rustc_middle::ty::fast_reject::{simplify_type, TreatParams};
17use rustc_middle::ty::fast_reject::{TreatParams, simplify_type};
1818use rustc_middle::ty::{
1919 self, AssocItem, AssocItemContainer, GenericArgs, GenericArgsRef, GenericParamDefKind,
2020 ParamEnvAnd, Ty, TyCtxt, TypeVisitableExt, Upcast,
......@@ -25,22 +25,22 @@ use rustc_span::def_id::{DefId, LocalDefId};
2525use rustc_span::edit_distance::{
2626 edit_distance_with_substrings, find_best_match_for_name_with_substrings,
2727};
28use rustc_span::symbol::{sym, Ident};
29use rustc_span::{Span, Symbol, DUMMY_SP};
28use rustc_span::symbol::{Ident, sym};
29use rustc_span::{DUMMY_SP, Span, Symbol};
3030use rustc_trait_selection::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
3131use rustc_trait_selection::infer::InferCtxtExt as _;
32use rustc_trait_selection::traits::query::CanonicalTyGoal;
3233use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
3334use rustc_trait_selection::traits::query::method_autoderef::{
3435 CandidateStep, MethodAutoderefBadTy, MethodAutoderefStepsResult,
3536};
36use rustc_trait_selection::traits::query::CanonicalTyGoal;
3737use rustc_trait_selection::traits::{self, ObligationCause, ObligationCtxt};
38use smallvec::{smallvec, SmallVec};
38use smallvec::{SmallVec, smallvec};
3939use tracing::{debug, instrument};
4040
4141use self::CandidateKind::*;
4242pub(crate) use self::PickKind::*;
43use super::{suggest, CandidateSource, MethodError, NoMatchData};
43use super::{CandidateSource, MethodError, NoMatchData, suggest};
4444use crate::FnCtxt;
4545
4646/// Boolean flag used to indicate if this search is for a suggestion
compiler/rustc_hir_typeck/src/method/suggest.rs+6-6
......@@ -13,7 +13,7 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
1313use rustc_data_structures::sorted_map::SortedMap;
1414use rustc_data_structures::unord::UnordSet;
1515use rustc_errors::codes::*;
16use rustc_errors::{pluralize, struct_span_code_err, Applicability, Diag, MultiSpan, StashKey};
16use rustc_errors::{Applicability, Diag, MultiSpan, StashKey, pluralize, struct_span_code_err};
1717use rustc_hir::def::DefKind;
1818use rustc_hir::def_id::DefId;
1919use rustc_hir::intravisit::{self, Visitor};
......@@ -21,21 +21,21 @@ use rustc_hir::lang_items::LangItem;
2121use rustc_hir::{self as hir, ExprKind, HirId, Node, PathSegment, QPath};
2222use rustc_infer::infer::{self, RegionVariableOrigin};
2323use rustc_middle::bug;
24use rustc_middle::ty::fast_reject::{simplify_type, DeepRejectCtxt, TreatParams};
24use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams, simplify_type};
2525use rustc_middle::ty::print::{
26 with_crate_prefix, with_forced_trimmed_paths, PrintTraitRefExt as _,
26 PrintTraitRefExt as _, with_crate_prefix, with_forced_trimmed_paths,
2727};
2828use rustc_middle::ty::{self, GenericArgKind, IsSuggestable, Ty, TyCtxt, TypeVisitableExt};
2929use rustc_span::def_id::DefIdSet;
30use rustc_span::symbol::{kw, sym, Ident};
30use rustc_span::symbol::{Ident, kw, sym};
3131use rustc_span::{
32 edit_distance, ErrorGuaranteed, ExpnKind, FileName, MacroKind, Span, Symbol, DUMMY_SP,
32 DUMMY_SP, ErrorGuaranteed, ExpnKind, FileName, MacroKind, Span, Symbol, edit_distance,
3333};
3434use rustc_trait_selection::error_reporting::traits::on_unimplemented::OnUnimplementedNote;
3535use rustc_trait_selection::infer::InferCtxtExt;
3636use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
3737use rustc_trait_selection::traits::{
38 supertraits, FulfillmentError, Obligation, ObligationCause, ObligationCauseCode,
38 FulfillmentError, Obligation, ObligationCause, ObligationCauseCode, supertraits,
3939};
4040use tracing::{debug, info, instrument};
4141
compiler/rustc_hir_typeck/src/op.rs+11-15
......@@ -2,7 +2,7 @@
22
33use rustc_data_structures::packed::Pu128;
44use rustc_errors::codes::*;
5use rustc_errors::{struct_span_code_err, Applicability, Diag};
5use rustc_errors::{Applicability, Diag, struct_span_code_err};
66use rustc_infer::traits::ObligationCauseCode;
77use rustc_middle::ty::adjustment::{
88 Adjust, Adjustment, AllowTwoPhase, AutoBorrow, AutoBorrowMutability,
......@@ -11,17 +11,17 @@ use rustc_middle::ty::print::with_no_trimmed_paths;
1111use rustc_middle::ty::{self, IsSuggestable, Ty, TyCtxt, TypeVisitableExt};
1212use rustc_middle::{bug, span_bug};
1313use rustc_session::errors::ExprParenthesesNeeded;
14use rustc_span::source_map::Spanned;
15use rustc_span::symbol::{sym, Ident};
1614use rustc_span::Span;
15use rustc_span::source_map::Spanned;
16use rustc_span::symbol::{Ident, sym};
1717use rustc_trait_selection::infer::InferCtxtExt;
1818use rustc_trait_selection::traits::{FulfillmentError, ObligationCtxt};
1919use rustc_type_ir::TyKind::*;
2020use tracing::debug;
2121use {rustc_ast as ast, rustc_hir as hir};
2222
23use super::method::MethodCallee;
2423use super::FnCtxt;
24use super::method::MethodCallee;
2525use crate::Expectation;
2626
2727impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
......@@ -896,17 +896,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
896896 let opname = Ident::with_dummy_span(opname);
897897 let (opt_rhs_expr, opt_rhs_ty) = opt_rhs.unzip();
898898 let input_types = opt_rhs_ty.as_slice();
899 let cause = self.cause(
900 span,
901 ObligationCauseCode::BinOp {
902 lhs_hir_id: lhs_expr.hir_id,
903 rhs_hir_id: opt_rhs_expr.map(|expr| expr.hir_id),
904 rhs_span: opt_rhs_expr.map(|expr| expr.span),
905 rhs_is_lit: opt_rhs_expr
906 .is_some_and(|expr| matches!(expr.kind, hir::ExprKind::Lit(_))),
907 output_ty: expected.only_has_type(self),
908 },
909 );
899 let cause = self.cause(span, ObligationCauseCode::BinOp {
900 lhs_hir_id: lhs_expr.hir_id,
901 rhs_hir_id: opt_rhs_expr.map(|expr| expr.hir_id),
902 rhs_span: opt_rhs_expr.map(|expr| expr.span),
903 rhs_is_lit: opt_rhs_expr.is_some_and(|expr| matches!(expr.kind, hir::ExprKind::Lit(_))),
904 output_ty: expected.only_has_type(self),
905 });
910906
911907 let method = self.lookup_method_in_trait(
912908 cause.clone(),
compiler/rustc_hir_typeck/src/pat.rs+4-4
......@@ -5,7 +5,7 @@ use rustc_ast as ast;
55use rustc_data_structures::fx::FxHashMap;
66use rustc_errors::codes::*;
77use rustc_errors::{
8 pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan,
8 Applicability, Diag, ErrorGuaranteed, MultiSpan, pluralize, struct_span_code_err,
99};
1010use rustc_hir::def::{CtorKind, DefKind, Res};
1111use rustc_hir::pat_util::EnumerateAndAdjustIterator;
......@@ -18,8 +18,8 @@ use rustc_session::parse::feature_err;
1818use rustc_span::edit_distance::find_best_match_for_name;
1919use rustc_span::hygiene::DesugaringKind;
2020use rustc_span::source_map::Spanned;
21use rustc_span::symbol::{kw, sym, Ident};
22use rustc_span::{BytePos, Span, DUMMY_SP};
21use rustc_span::symbol::{Ident, kw, sym};
22use rustc_span::{BytePos, DUMMY_SP, Span};
2323use rustc_target::abi::FieldIdx;
2424use rustc_trait_selection::infer::InferCtxtExt;
2525use rustc_trait_selection::traits::{ObligationCause, ObligationCauseCode};
......@@ -28,7 +28,7 @@ use ty::VariantDef;
2828
2929use super::report_unexpected_variant_res;
3030use crate::gather_locals::DeclOrigin;
31use crate::{errors, FnCtxt, LoweredTy};
31use crate::{FnCtxt, LoweredTy, errors};
3232
3333const CANNOT_IMPLICITLY_DEREF_POINTER_TRAIT_OBJ: &str = "\
3434This error indicates that a pointer to a trait type cannot be implicitly dereferenced by a \
compiler/rustc_hir_typeck/src/place_op.rs+5-8
......@@ -7,8 +7,8 @@ use rustc_middle::ty::adjustment::{
77 PointerCoercion,
88};
99use rustc_middle::ty::{self, Ty};
10use rustc_span::symbol::{sym, Ident};
1110use rustc_span::Span;
11use rustc_span::symbol::{Ident, sym};
1212use tracing::debug;
1313use {rustc_ast as ast, rustc_hir as hir};
1414
......@@ -30,13 +30,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3030 let ok = self.try_overloaded_deref(expr.span, oprnd_ty)?;
3131 let method = self.register_infer_ok_obligations(ok);
3232 if let ty::Ref(region, _, hir::Mutability::Not) = method.sig.inputs()[0].kind() {
33 self.apply_adjustments(
34 oprnd_expr,
35 vec![Adjustment {
36 kind: Adjust::Borrow(AutoBorrow::Ref(*region, AutoBorrowMutability::Not)),
37 target: method.sig.inputs()[0],
38 }],
39 );
33 self.apply_adjustments(oprnd_expr, vec![Adjustment {
34 kind: Adjust::Borrow(AutoBorrow::Ref(*region, AutoBorrowMutability::Not)),
35 target: method.sig.inputs()[0],
36 }]);
4037 } else {
4138 span_bug!(expr.span, "input to deref is not a ref?");
4239 }
compiler/rustc_hir_typeck/src/rvalue_scopes.rs+1-1
......@@ -1,5 +1,5 @@
1use hir::def_id::DefId;
21use hir::Node;
2use hir::def_id::DefId;
33use rustc_hir as hir;
44use rustc_middle::bug;
55use rustc_middle::middle::region::{RvalueCandidateType, Scope, ScopeTree};
compiler/rustc_hir_typeck/src/typeck_root_ctxt.rs+1-1
......@@ -9,8 +9,8 @@ use rustc_infer::infer::{InferCtxt, InferOk, TyCtxtInferExt};
99use rustc_middle::span_bug;
1010use rustc_middle::ty::visit::TypeVisitableExt;
1111use rustc_middle::ty::{self, Ty, TyCtxt};
12use rustc_span::def_id::LocalDefIdMap;
1312use rustc_span::Span;
13use rustc_span::def_id::LocalDefIdMap;
1414use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
1515use rustc_trait_selection::traits::{
1616 self, FulfillmentError, PredicateObligation, TraitEngine, TraitEngineExt as _,
compiler/rustc_hir_typeck/src/upvar.rs+22-31
......@@ -36,9 +36,9 @@ use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
3636use rustc_data_structures::unord::{ExtendUnord, UnordSet};
3737use rustc_errors::{Applicability, MultiSpan};
3838use rustc_hir as hir;
39use rustc_hir::HirId;
3940use rustc_hir::def_id::LocalDefId;
4041use rustc_hir::intravisit::{self, Visitor};
41use rustc_hir::HirId;
4242use rustc_middle::hir::place::{Place, PlaceBase, PlaceWithHirId, Projection, ProjectionKind};
4343use rustc_middle::mir::FakeReadCause;
4444use rustc_middle::traits::ObligationCauseCode;
......@@ -48,7 +48,7 @@ use rustc_middle::ty::{
4848};
4949use rustc_middle::{bug, span_bug};
5050use rustc_session::lint;
51use rustc_span::{sym, BytePos, Pos, Span, Symbol};
51use rustc_span::{BytePos, Pos, Span, Symbol, sym};
5252use rustc_target::abi::FIRST_VARIANT;
5353use rustc_trait_selection::infer::InferCtxtExt;
5454use tracing::{debug, instrument};
......@@ -287,14 +287,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
287287 bug!();
288288 };
289289 let place = self.place_for_root_variable(closure_def_id, local_id);
290 delegate.capture_information.push((
291 place,
292 ty::CaptureInfo {
293 capture_kind_expr_id: Some(init.hir_id),
294 path_expr_id: Some(init.hir_id),
295 capture_kind: UpvarCapture::ByValue,
296 },
297 ));
290 delegate.capture_information.push((place, ty::CaptureInfo {
291 capture_kind_expr_id: Some(init.hir_id),
292 path_expr_id: Some(init.hir_id),
293 capture_kind: UpvarCapture::ByValue,
294 }));
298295 }
299296 }
300297
......@@ -381,11 +378,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
381378 if let UpvarArgs::CoroutineClosure(args) = args
382379 && !args.references_error()
383380 {
384 let closure_env_region: ty::Region<'_> = ty::Region::new_bound(
385 self.tcx,
386 ty::INNERMOST,
387 ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::BrEnv },
388 );
381 let closure_env_region: ty::Region<'_> =
382 ty::Region::new_bound(self.tcx, ty::INNERMOST, ty::BoundRegion {
383 var: ty::BoundVar::ZERO,
384 kind: ty::BoundRegionKind::BrEnv,
385 });
389386
390387 let num_args = args
391388 .as_coroutine_closure()
......@@ -2004,14 +2001,11 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
20042001 let PlaceBase::Upvar(upvar_id) = place_with_id.place.base else { return };
20052002 assert_eq!(self.closure_def_id, upvar_id.closure_expr_id);
20062003
2007 self.capture_information.push((
2008 place_with_id.place.clone(),
2009 ty::CaptureInfo {
2010 capture_kind_expr_id: Some(diag_expr_id),
2011 path_expr_id: Some(diag_expr_id),
2012 capture_kind: ty::UpvarCapture::ByValue,
2013 },
2014 ));
2004 self.capture_information.push((place_with_id.place.clone(), ty::CaptureInfo {
2005 capture_kind_expr_id: Some(diag_expr_id),
2006 path_expr_id: Some(diag_expr_id),
2007 capture_kind: ty::UpvarCapture::ByValue,
2008 }));
20152009 }
20162010
20172011 #[instrument(skip(self), level = "debug")]
......@@ -2038,14 +2032,11 @@ impl<'tcx> euv::Delegate<'tcx> for InferBorrowKind<'tcx> {
20382032 capture_kind = ty::UpvarCapture::ByRef(ty::BorrowKind::ImmBorrow);
20392033 }
20402034
2041 self.capture_information.push((
2042 place,
2043 ty::CaptureInfo {
2044 capture_kind_expr_id: Some(diag_expr_id),
2045 path_expr_id: Some(diag_expr_id),
2046 capture_kind,
2047 },
2048 ));
2035 self.capture_information.push((place, ty::CaptureInfo {
2036 capture_kind_expr_id: Some(diag_expr_id),
2037 path_expr_id: Some(diag_expr_id),
2038 capture_kind,
2039 }));
20492040 }
20502041
20512042 #[instrument(skip(self), level = "debug")]
compiler/rustc_hir_typeck/src/writeback.rs+2-2
......@@ -7,16 +7,16 @@ use std::mem;
77use rustc_data_structures::unord::ExtendUnord;
88use rustc_errors::{ErrorGuaranteed, StashKey};
99use rustc_hir as hir;
10use rustc_hir::intravisit::{self, Visitor};
1110use rustc_hir::HirId;
11use rustc_hir::intravisit::{self, Visitor};
1212use rustc_middle::span_bug;
1313use rustc_middle::traits::ObligationCause;
1414use rustc_middle::ty::adjustment::{Adjust, Adjustment, PointerCoercion};
1515use rustc_middle::ty::fold::{TypeFoldable, TypeFolder};
1616use rustc_middle::ty::visit::TypeVisitableExt;
1717use rustc_middle::ty::{self, Ty, TyCtxt, TypeSuperFoldable};
18use rustc_span::symbol::sym;
1918use rustc_span::Span;
19use rustc_span::symbol::sym;
2020use rustc_trait_selection::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
2121use rustc_trait_selection::solve;
2222use tracing::{debug, instrument};
compiler/rustc_incremental/src/assert_dep_graph.rs+4-4
......@@ -38,17 +38,17 @@ use std::fs::{self, File};
3838use std::io::{BufWriter, Write};
3939
4040use rustc_data_structures::fx::FxIndexSet;
41use rustc_data_structures::graph::implementation::{Direction, NodeIndex, INCOMING, OUTGOING};
42use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
41use rustc_data_structures::graph::implementation::{Direction, INCOMING, NodeIndex, OUTGOING};
42use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
4343use rustc_hir::intravisit::{self, Visitor};
4444use rustc_middle::dep_graph::{
45 dep_kinds, DepGraphQuery, DepKind, DepNode, DepNodeExt, DepNodeFilter, EdgeFilter,
45 DepGraphQuery, DepKind, DepNode, DepNodeExt, DepNodeFilter, EdgeFilter, dep_kinds,
4646};
4747use rustc_middle::hir::nested_filter;
4848use rustc_middle::ty::TyCtxt;
4949use rustc_middle::{bug, span_bug};
50use rustc_span::symbol::{sym, Symbol};
5150use rustc_span::Span;
51use rustc_span::symbol::{Symbol, sym};
5252use tracing::debug;
5353use {rustc_ast as ast, rustc_graphviz as dot, rustc_hir as hir};
5454
compiler/rustc_incremental/src/lib.rs+3-3
......@@ -14,9 +14,9 @@ mod errors;
1414mod persist;
1515
1616pub use persist::{
17 copy_cgu_workproduct_to_incr_comp_cache_dir, finalize_session_directory, in_incr_comp_dir,
18 in_incr_comp_dir_sess, load_query_result_cache, save_dep_graph, save_work_product_index,
19 setup_dep_graph, LoadResult,
17 LoadResult, copy_cgu_workproduct_to_incr_comp_cache_dir, finalize_session_directory,
18 in_incr_comp_dir, in_incr_comp_dir_sess, load_query_result_cache, save_dep_graph,
19 save_work_product_index, setup_dep_graph,
2020};
2121
2222rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
compiler/rustc_incremental/src/persist/dirty_clean.rs+8-7
......@@ -23,12 +23,12 @@ use rustc_ast::{self as ast, Attribute, NestedMetaItem};
2323use rustc_data_structures::fx::FxHashSet;
2424use rustc_data_structures::unord::UnordSet;
2525use rustc_hir::def_id::LocalDefId;
26use rustc_hir::{intravisit, ImplItemKind, ItemKind as HirItem, Node as HirNode, TraitItemKind};
27use rustc_middle::dep_graph::{label_strs, DepNode, DepNodeExt};
26use rustc_hir::{ImplItemKind, ItemKind as HirItem, Node as HirNode, TraitItemKind, intravisit};
27use rustc_middle::dep_graph::{DepNode, DepNodeExt, label_strs};
2828use rustc_middle::hir::nested_filter;
2929use rustc_middle::ty::TyCtxt;
30use rustc_span::symbol::{sym, Symbol};
3130use rustc_span::Span;
31use rustc_span::symbol::{Symbol, sym};
3232use thin_vec::ThinVec;
3333use tracing::debug;
3434
......@@ -106,10 +106,11 @@ const LABELS_FN_IN_TRAIT: &[&[&str]] =
106106const LABELS_HIR_ONLY: &[&[&str]] = &[BASE_HIR];
107107
108108/// Impl `DepNode`s.
109const LABELS_TRAIT: &[&[&str]] = &[
110 BASE_HIR,
111 &[label_strs::associated_item_def_ids, label_strs::predicates_of, label_strs::generics_of],
112];
109const LABELS_TRAIT: &[&[&str]] = &[BASE_HIR, &[
110 label_strs::associated_item_def_ids,
111 label_strs::predicates_of,
112 label_strs::generics_of,
113]];
113114
114115/// Impl `DepNode`s.
115116const LABELS_IMPL: &[&[&str]] = &[BASE_HIR, BASE_IMPL];
compiler/rustc_incremental/src/persist/file_format.rs+1-1
......@@ -15,8 +15,8 @@ use std::path::{Path, PathBuf};
1515use std::{env, fs};
1616
1717use rustc_data_structures::memmap::Mmap;
18use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
1918use rustc_serialize::Encoder;
19use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
2020use rustc_session::Session;
2121use tracing::debug;
2222
compiler/rustc_incremental/src/persist/fs.rs+3-3
......@@ -108,14 +108,14 @@ use std::io::{self, ErrorKind};
108108use std::path::{Path, PathBuf};
109109use std::time::{Duration, SystemTime, UNIX_EPOCH};
110110
111use rand::{thread_rng, RngCore};
112use rustc_data_structures::base_n::{BaseNString, ToBaseN, CASE_INSENSITIVE};
111use rand::{RngCore, thread_rng};
112use rustc_data_structures::base_n::{BaseNString, CASE_INSENSITIVE, ToBaseN};
113113use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
114114use rustc_data_structures::svh::Svh;
115115use rustc_data_structures::unord::{UnordMap, UnordSet};
116116use rustc_data_structures::{base_n, flock};
117117use rustc_errors::ErrorGuaranteed;
118use rustc_fs_util::{link_or_copy, try_canonicalize, LinkOrCopy};
118use rustc_fs_util::{LinkOrCopy, link_or_copy, try_canonicalize};
119119use rustc_middle::bug;
120120use rustc_session::config::CrateType;
121121use rustc_session::output::{collect_crate_types, find_crate_name};
compiler/rustc_incremental/src/persist/load.rs+2-2
......@@ -7,10 +7,10 @@ use rustc_data_structures::memmap::Mmap;
77use rustc_data_structures::unord::UnordMap;
88use rustc_middle::dep_graph::{DepGraph, DepsType, SerializedDepGraph, WorkProductMap};
99use rustc_middle::query::on_disk_cache::OnDiskCache;
10use rustc_serialize::opaque::MemDecoder;
1110use rustc_serialize::Decodable;
12use rustc_session::config::IncrementalStateAssertion;
11use rustc_serialize::opaque::MemDecoder;
1312use rustc_session::Session;
13use rustc_session::config::IncrementalStateAssertion;
1414use rustc_span::ErrorGuaranteed;
1515use tracing::{debug, warn};
1616
compiler/rustc_incremental/src/persist/mod.rs+1-1
......@@ -11,6 +11,6 @@ mod save;
1111mod work_product;
1212
1313pub use fs::{finalize_session_directory, in_incr_comp_dir, in_incr_comp_dir_sess};
14pub use load::{load_query_result_cache, setup_dep_graph, LoadResult};
14pub use load::{LoadResult, load_query_result_cache, setup_dep_graph};
1515pub use save::{save_dep_graph, save_work_product_index};
1616pub use work_product::copy_cgu_workproduct_to_incr_comp_cache_dir;
compiler/rustc_incremental/src/persist/save.rs+1-1
......@@ -7,8 +7,8 @@ use rustc_middle::dep_graph::{
77 DepGraph, SerializedDepGraph, WorkProduct, WorkProductId, WorkProductMap,
88};
99use rustc_middle::ty::TyCtxt;
10use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
1110use rustc_serialize::Encodable as RustcEncodable;
11use rustc_serialize::opaque::{FileEncodeResult, FileEncoder};
1212use rustc_session::Session;
1313use tracing::debug;
1414
compiler/rustc_index/src/bit_set.rs+2-2
......@@ -3,11 +3,11 @@ use std::ops::{BitAnd, BitAndAssign, BitOrAssign, Bound, Not, Range, RangeBounds
33use std::rc::Rc;
44use std::{fmt, iter, mem, slice};
55
6use Chunk::*;
67use arrayvec::ArrayVec;
78#[cfg(feature = "nightly")]
89use rustc_macros::{Decodable_Generic, Encodable_Generic};
9use smallvec::{smallvec, SmallVec};
10use Chunk::*;
10use smallvec::{SmallVec, smallvec};
1111
1212use crate::{Idx, IndexVec};
1313
compiler/rustc_index/src/bit_set/tests.rs+30-40
......@@ -182,10 +182,11 @@ fn chunked_bitset() {
182182 //-----------------------------------------------------------------------
183183
184184 let mut b1 = ChunkedBitSet::<usize>::new_empty(1);
185 assert_eq!(
186 b1,
187 ChunkedBitSet { domain_size: 1, chunks: Box::new([Zeros(1)]), marker: PhantomData }
188 );
185 assert_eq!(b1, ChunkedBitSet {
186 domain_size: 1,
187 chunks: Box::new([Zeros(1)]),
188 marker: PhantomData
189 });
189190
190191 b1.assert_valid();
191192 assert!(!b1.contains(0));
......@@ -204,10 +205,11 @@ fn chunked_bitset() {
204205 //-----------------------------------------------------------------------
205206
206207 let mut b100 = ChunkedBitSet::<usize>::new_filled(100);
207 assert_eq!(
208 b100,
209 ChunkedBitSet { domain_size: 100, chunks: Box::new([Ones(100)]), marker: PhantomData }
210 );
208 assert_eq!(b100, ChunkedBitSet {
209 domain_size: 100,
210 chunks: Box::new([Ones(100)]),
211 marker: PhantomData
212 });
211213
212214 b100.assert_valid();
213215 for i in 0..100 {
......@@ -222,20 +224,17 @@ fn chunked_bitset() {
222224 );
223225 assert_eq!(b100.count(), 97);
224226 assert!(!b100.contains(20) && b100.contains(30) && !b100.contains(99) && b100.contains(50));
225 assert_eq!(
226 b100.chunks(),
227 vec![Mixed(
228 100,
229 97,
230 #[rustfmt::skip]
227 assert_eq!(b100.chunks(), vec![Mixed(
228 100,
229 97,
230 #[rustfmt::skip]
231231 Rc::new([
232232 0b11111111_11111111_11111110_11111111_11111111_11101111_11111111_11111111,
233233 0b00000000_00000000_00000000_00000111_11111111_11111111_11111111_11111111,
234234 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
235235 0, 0, 0, 0, 0,
236236 ])
237 )],
238 );
237 )],);
239238 b100.assert_valid();
240239 let mut num_removed = 0;
241240 for i in 0..100 {
......@@ -250,14 +249,11 @@ fn chunked_bitset() {
250249 //-----------------------------------------------------------------------
251250
252251 let mut b2548 = ChunkedBitSet::<usize>::new_empty(2548);
253 assert_eq!(
254 b2548,
255 ChunkedBitSet {
256 domain_size: 2548,
257 chunks: Box::new([Zeros(2048), Zeros(500)]),
258 marker: PhantomData,
259 }
260 );
252 assert_eq!(b2548, ChunkedBitSet {
253 domain_size: 2548,
254 chunks: Box::new([Zeros(2048), Zeros(500)]),
255 marker: PhantomData,
256 });
261257
262258 b2548.assert_valid();
263259 b2548.insert(14);
......@@ -274,14 +270,11 @@ fn chunked_bitset() {
274270 //-----------------------------------------------------------------------
275271
276272 let mut b4096 = ChunkedBitSet::<usize>::new_empty(4096);
277 assert_eq!(
278 b4096,
279 ChunkedBitSet {
280 domain_size: 4096,
281 chunks: Box::new([Zeros(2048), Zeros(2048)]),
282 marker: PhantomData,
283 }
284 );
273 assert_eq!(b4096, ChunkedBitSet {
274 domain_size: 4096,
275 chunks: Box::new([Zeros(2048), Zeros(2048)]),
276 marker: PhantomData,
277 });
285278
286279 b4096.assert_valid();
287280 for i in 0..4096 {
......@@ -311,14 +304,11 @@ fn chunked_bitset() {
311304 //-----------------------------------------------------------------------
312305
313306 let mut b10000 = ChunkedBitSet::<usize>::new_empty(10000);
314 assert_eq!(
315 b10000,
316 ChunkedBitSet {
317 domain_size: 10000,
318 chunks: Box::new([Zeros(2048), Zeros(2048), Zeros(2048), Zeros(2048), Zeros(1808),]),
319 marker: PhantomData,
320 }
321 );
307 assert_eq!(b10000, ChunkedBitSet {
308 domain_size: 10000,
309 chunks: Box::new([Zeros(2048), Zeros(2048), Zeros(2048), Zeros(2048), Zeros(1808),]),
310 marker: PhantomData,
311 });
322312
323313 b10000.assert_valid();
324314 assert!(b10000.insert(3000) && b10000.insert(5000));
compiler/rustc_index/src/vec/tests.rs+10-8
......@@ -29,19 +29,21 @@ fn index_size_is_optimized() {
2929#[test]
3030fn range_iterator_iterates_forwards() {
3131 let range = MyIdx::from_u32(1)..MyIdx::from_u32(4);
32 assert_eq!(
33 range.collect::<Vec<_>>(),
34 [MyIdx::from_u32(1), MyIdx::from_u32(2), MyIdx::from_u32(3)]
35 );
32 assert_eq!(range.collect::<Vec<_>>(), [
33 MyIdx::from_u32(1),
34 MyIdx::from_u32(2),
35 MyIdx::from_u32(3)
36 ]);
3637}
3738
3839#[test]
3940fn range_iterator_iterates_backwards() {
4041 let range = MyIdx::from_u32(1)..MyIdx::from_u32(4);
41 assert_eq!(
42 range.rev().collect::<Vec<_>>(),
43 [MyIdx::from_u32(3), MyIdx::from_u32(2), MyIdx::from_u32(1)]
44 );
42 assert_eq!(range.rev().collect::<Vec<_>>(), [
43 MyIdx::from_u32(3),
44 MyIdx::from_u32(2),
45 MyIdx::from_u32(1)
46 ]);
4547}
4648
4749#[test]
compiler/rustc_infer/src/infer/canonical/canonicalizer.rs+1-1
......@@ -15,10 +15,10 @@ use rustc_middle::ty::{
1515use smallvec::SmallVec;
1616use tracing::debug;
1717
18use crate::infer::InferCtxt;
1819use crate::infer::canonical::{
1920 Canonical, CanonicalTyVarKind, CanonicalVarInfo, CanonicalVarKind, OriginalQueryValues,
2021};
21use crate::infer::InferCtxt;
2222
2323impl<'tcx> InferCtxt<'tcx> {
2424 /// Canonicalizes a query value `V`. When we canonicalize a query,
compiler/rustc_infer/src/infer/canonical/query_response.rs+1-1
......@@ -19,7 +19,7 @@ use rustc_middle::ty::{self, BoundVar, GenericArg, GenericArgKind, Ty, TyCtxt};
1919use rustc_middle::{bug, span_bug};
2020use tracing::{debug, instrument};
2121
22use crate::infer::canonical::instantiate::{instantiate_value, CanonicalExt};
22use crate::infer::canonical::instantiate::{CanonicalExt, instantiate_value};
2323use crate::infer::canonical::{
2424 Canonical, CanonicalQueryResponse, CanonicalVarValues, Certainty, OriginalQueryValues,
2525 QueryOutlivesConstraint, QueryRegionConstraints, QueryResponse,
compiler/rustc_infer/src/infer/context.rs+2-2
......@@ -1,12 +1,12 @@
11///! Definition of `InferCtxtLike` from the librarified type layer.
22use rustc_hir::def_id::{DefId, LocalDefId};
3use rustc_middle::traits::solve::{Goal, NoSolution, SolverMode};
43use rustc_middle::traits::ObligationCause;
4use rustc_middle::traits::solve::{Goal, NoSolution, SolverMode};
55use rustc_middle::ty::fold::TypeFoldable;
66use rustc_middle::ty::{self, Ty, TyCtxt};
77use rustc_span::DUMMY_SP;
8use rustc_type_ir::relate::Relate;
98use rustc_type_ir::InferCtxtLike;
9use rustc_type_ir::relate::Relate;
1010
1111use super::{BoundRegionConversionTime, InferCtxt, SubregionOrigin};
1212
compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs+1-1
......@@ -4,7 +4,7 @@ use std::fmt;
44
55use rustc_data_structures::fx::FxHashSet;
66use rustc_data_structures::graph::implementation::{
7 Direction, Graph, NodeIndex, INCOMING, OUTGOING,
7 Direction, Graph, INCOMING, NodeIndex, OUTGOING,
88};
99use rustc_data_structures::intern::Interned;
1010use rustc_data_structures::unord::UnordSet;
compiler/rustc_infer/src/infer/mod.rs+21-27
......@@ -1,6 +1,9 @@
11use std::cell::{Cell, RefCell};
22use std::fmt;
33
4pub use BoundRegionConversionTime::*;
5pub use RegionVariableOrigin::*;
6pub use SubregionOrigin::*;
47pub use at::DefineOpaqueTypes;
58use free_regions::RegionRelations;
69pub use freshen::TypeFreshener;
......@@ -10,8 +13,8 @@ use opaque_types::OpaqueTypeStorage;
1013use region_constraints::{
1114 GenericKind, RegionConstraintCollector, RegionConstraintStorage, VarInfos, VerifyBound,
1215};
13pub use relate::combine::{CombineFields, PredicateEmittingRelation};
1416pub use relate::StructurallyRelateAliases;
17pub use relate::combine::{CombineFields, PredicateEmittingRelation};
1518use rustc_data_structures::captures::Captures;
1619use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
1720use rustc_data_structures::sync::Lrc;
......@@ -26,29 +29,26 @@ use rustc_middle::infer::canonical::{Canonical, CanonicalVarValues};
2629use rustc_middle::infer::unify_key::{
2730 ConstVariableOrigin, ConstVariableValue, ConstVidKey, EffectVarValue, EffectVidKey,
2831};
29use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult};
3032use rustc_middle::mir::ConstraintCategory;
33use rustc_middle::mir::interpret::{ErrorHandled, EvalToValTreeResult};
3134use rustc_middle::traits::select;
3235use rustc_middle::traits::solve::{Goal, NoSolution};
36pub use rustc_middle::ty::IntVarValue;
3337use rustc_middle::ty::error::{ExpectedFound, TypeError};
3438use rustc_middle::ty::fold::{
3539 BoundVarReplacerDelegate, TypeFoldable, TypeFolder, TypeSuperFoldable,
3640};
3741use rustc_middle::ty::visit::TypeVisitableExt;
38pub use rustc_middle::ty::IntVarValue;
3942use rustc_middle::ty::{
4043 self, ConstVid, EffectVid, FloatVid, GenericArg, GenericArgKind, GenericArgs, GenericArgsRef,
4144 GenericParamDefKind, InferConst, IntVid, Ty, TyCtxt, TyVid,
4245};
4346use rustc_middle::{bug, span_bug};
44use rustc_span::symbol::Symbol;
4547use rustc_span::Span;
48use rustc_span::symbol::Symbol;
4649use snapshot::undo_log::InferCtxtUndoLogs;
4750use tracing::{debug, instrument};
4851use type_variable::TypeVariableOrigin;
49pub use BoundRegionConversionTime::*;
50pub use RegionVariableOrigin::*;
51pub use SubregionOrigin::*;
5252
5353use crate::infer::relate::RelateResult;
5454use crate::traits::{self, ObligationCause, ObligationInspector, PredicateObligation, TraitEngine};
......@@ -1776,16 +1776,13 @@ fn replace_param_and_infer_args_with_placeholder<'tcx>(
17761776 self.idx += 1;
17771777 idx
17781778 };
1779 Ty::new_placeholder(
1780 self.tcx,
1781 ty::PlaceholderType {
1782 universe: ty::UniverseIndex::ROOT,
1783 bound: ty::BoundTy {
1784 var: ty::BoundVar::from_u32(idx),
1785 kind: ty::BoundTyKind::Anon,
1786 },
1779 Ty::new_placeholder(self.tcx, ty::PlaceholderType {
1780 universe: ty::UniverseIndex::ROOT,
1781 bound: ty::BoundTy {
1782 var: ty::BoundVar::from_u32(idx),
1783 kind: ty::BoundTyKind::Anon,
17871784 },
1788 )
1785 })
17891786 } else {
17901787 t.super_fold_with(self)
17911788 }
......@@ -1793,17 +1790,14 @@ fn replace_param_and_infer_args_with_placeholder<'tcx>(
17931790
17941791 fn fold_const(&mut self, c: ty::Const<'tcx>) -> ty::Const<'tcx> {
17951792 if let ty::ConstKind::Infer(_) = c.kind() {
1796 ty::Const::new_placeholder(
1797 self.tcx,
1798 ty::PlaceholderConst {
1799 universe: ty::UniverseIndex::ROOT,
1800 bound: ty::BoundVar::from_u32({
1801 let idx = self.idx;
1802 self.idx += 1;
1803 idx
1804 }),
1805 },
1806 )
1793 ty::Const::new_placeholder(self.tcx, ty::PlaceholderConst {
1794 universe: ty::UniverseIndex::ROOT,
1795 bound: ty::BoundVar::from_u32({
1796 let idx = self.idx;
1797 self.idx += 1;
1798 idx
1799 }),
1800 })
18071801 } else {
18081802 c.super_fold_with(self)
18091803 }
compiler/rustc_infer/src/infer/opaque_types/mod.rs+1-1
......@@ -2,8 +2,8 @@ use hir::def_id::{DefId, LocalDefId};
22use rustc_data_structures::fx::FxIndexMap;
33use rustc_data_structures::sync::Lrc;
44use rustc_hir as hir;
5use rustc_middle::traits::solve::Goal;
65use rustc_middle::traits::ObligationCause;
6use rustc_middle::traits::solve::Goal;
77use rustc_middle::ty::error::{ExpectedFound, TypeError};
88use rustc_middle::ty::fold::BottomUpFolder;
99use rustc_middle::ty::{
compiler/rustc_infer/src/infer/outlives/env.rs+1-1
......@@ -5,8 +5,8 @@ use rustc_middle::ty::{self, Region};
55use tracing::{debug, instrument};
66
77use super::explicit_outlives_bounds;
8use crate::infer::free_regions::FreeRegionMap;
98use crate::infer::GenericKind;
9use crate::infer::free_regions::FreeRegionMap;
1010use crate::traits::query::OutlivesBound;
1111
1212/// The `OutlivesEnvironment` collects information about what outlives
compiler/rustc_infer/src/infer/outlives/obligations.rs+10-14
......@@ -68,7 +68,7 @@ use rustc_middle::ty::{
6868 TypeFoldable as _, TypeVisitableExt,
6969};
7070use rustc_span::DUMMY_SP;
71use rustc_type_ir::outlives::{push_outlives_components, Component};
71use rustc_type_ir::outlives::{Component, push_outlives_components};
7272use smallvec::smallvec;
7373use tracing::{debug, instrument};
7474
......@@ -101,19 +101,15 @@ impl<'tcx> InferCtxt<'tcx> {
101101 ) {
102102 debug!(?sup_type, ?sub_region, ?cause);
103103 let origin = SubregionOrigin::from_obligation_cause(cause, || {
104 infer::RelateParamBound(
105 cause.span,
106 sup_type,
107 match cause.code().peel_derives() {
108 ObligationCauseCode::WhereClause(_, span)
109 | ObligationCauseCode::WhereClauseInExpr(_, span, ..)
110 if !span.is_dummy() =>
111 {
112 Some(*span)
113 }
114 _ => None,
115 },
116 )
104 infer::RelateParamBound(cause.span, sup_type, match cause.code().peel_derives() {
105 ObligationCauseCode::WhereClause(_, span)
106 | ObligationCauseCode::WhereClauseInExpr(_, span, ..)
107 if !span.is_dummy() =>
108 {
109 Some(*span)
110 }
111 _ => None,
112 })
117113 });
118114
119115 self.register_region_obligation(RegionObligation { sup_type, sub_region, origin });
compiler/rustc_infer/src/infer/outlives/verify.rs+1-1
......@@ -1,7 +1,7 @@
11use std::assert_matches::assert_matches;
22
33use rustc_middle::ty::{self, OutlivesPredicate, Ty, TyCtxt};
4use rustc_type_ir::outlives::{compute_alias_components_recursive, Component};
4use rustc_type_ir::outlives::{Component, compute_alias_components_recursive};
55use smallvec::smallvec;
66use tracing::{debug, instrument, trace};
77
compiler/rustc_infer/src/infer/relate/combine.rs+1-1
......@@ -30,7 +30,7 @@ use super::glb::Glb;
3030use super::lub::Lub;
3131use super::type_relating::TypeRelating;
3232use super::{RelateResult, StructurallyRelateAliases};
33use crate::infer::{relate, DefineOpaqueTypes, InferCtxt, TypeTrace};
33use crate::infer::{DefineOpaqueTypes, InferCtxt, TypeTrace, relate};
3434use crate::traits::{Obligation, PredicateObligation};
3535
3636#[derive(Clone)]
compiler/rustc_infer/src/infer/relate/generalize.rs+1-1
......@@ -17,7 +17,7 @@ use super::{
1717 PredicateEmittingRelation, Relate, RelateResult, StructurallyRelateAliases, TypeRelation,
1818};
1919use crate::infer::type_variable::TypeVariableValue;
20use crate::infer::{relate, InferCtxt, RegionVariableOrigin};
20use crate::infer::{InferCtxt, RegionVariableOrigin, relate};
2121
2222impl<'tcx> InferCtxt<'tcx> {
2323 /// The idea is that we should ensure that the type variable `target_vid`
compiler/rustc_infer/src/infer/relate/glb.rs+1-1
......@@ -6,9 +6,9 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
66use rustc_span::Span;
77use tracing::{debug, instrument};
88
9use super::StructurallyRelateAliases;
910use super::combine::{CombineFields, PredicateEmittingRelation};
1011use super::lattice::{self, LatticeDir};
11use super::StructurallyRelateAliases;
1212use crate::infer::{DefineOpaqueTypes, InferCtxt, SubregionOrigin};
1313use crate::traits::ObligationCause;
1414
compiler/rustc_infer/src/infer/relate/higher_ranked.rs+13-13
......@@ -6,8 +6,8 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
66use tracing::{debug, instrument};
77
88use super::RelateResult;
9use crate::infer::snapshot::CombinedSnapshot;
109use crate::infer::InferCtxt;
10use crate::infer::snapshot::CombinedSnapshot;
1111
1212impl<'tcx> InferCtxt<'tcx> {
1313 /// Replaces all bound variables (lifetimes, types, and constants) bound by
......@@ -34,22 +34,22 @@ impl<'tcx> InferCtxt<'tcx> {
3434
3535 let delegate = FnMutDelegate {
3636 regions: &mut |br: ty::BoundRegion| {
37 ty::Region::new_placeholder(
38 self.tcx,
39 ty::PlaceholderRegion { universe: next_universe, bound: br },
40 )
37 ty::Region::new_placeholder(self.tcx, ty::PlaceholderRegion {
38 universe: next_universe,
39 bound: br,
40 })
4141 },
4242 types: &mut |bound_ty: ty::BoundTy| {
43 Ty::new_placeholder(
44 self.tcx,
45 ty::PlaceholderType { universe: next_universe, bound: bound_ty },
46 )
43 Ty::new_placeholder(self.tcx, ty::PlaceholderType {
44 universe: next_universe,
45 bound: bound_ty,
46 })
4747 },
4848 consts: &mut |bound_var: ty::BoundVar| {
49 ty::Const::new_placeholder(
50 self.tcx,
51 ty::PlaceholderConst { universe: next_universe, bound: bound_var },
52 )
49 ty::Const::new_placeholder(self.tcx, ty::PlaceholderConst {
50 universe: next_universe,
51 bound: bound_var,
52 })
5353 },
5454 };
5555
compiler/rustc_infer/src/infer/relate/lub.rs+1-1
......@@ -6,9 +6,9 @@ use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
66use rustc_span::Span;
77use tracing::{debug, instrument};
88
9use super::StructurallyRelateAliases;
910use super::combine::{CombineFields, PredicateEmittingRelation};
1011use super::lattice::{self, LatticeDir};
11use super::StructurallyRelateAliases;
1212use crate::infer::{DefineOpaqueTypes, InferCtxt, SubregionOrigin};
1313use crate::traits::ObligationCause;
1414
compiler/rustc_infer/src/infer/relate/type_relating.rs+2-2
......@@ -1,14 +1,14 @@
11use rustc_middle::traits::solve::Goal;
22use rustc_middle::ty::relate::{
3 relate_args_invariantly, relate_args_with_variances, Relate, RelateResult, TypeRelation,
3 Relate, RelateResult, TypeRelation, relate_args_invariantly, relate_args_with_variances,
44};
55use rustc_middle::ty::{self, Ty, TyCtxt, TyVar};
66use rustc_span::Span;
77use tracing::{debug, instrument};
88
99use super::combine::CombineFields;
10use crate::infer::relate::{PredicateEmittingRelation, StructurallyRelateAliases};
1110use crate::infer::BoundRegionConversionTime::HigherRankedType;
11use crate::infer::relate::{PredicateEmittingRelation, StructurallyRelateAliases};
1212use crate::infer::{DefineOpaqueTypes, InferCtxt, SubregionOrigin};
1313
1414/// Enforce that `a` is equal to or a subtype of `b`.
compiler/rustc_infer/src/infer/snapshot/mod.rs+1-1
......@@ -2,8 +2,8 @@ use rustc_data_structures::undo_log::UndoLogs;
22use rustc_middle::ty;
33use tracing::{debug, instrument};
44
5use super::region_constraints::RegionSnapshot;
65use super::InferCtxt;
6use super::region_constraints::RegionSnapshot;
77
88mod fudge;
99pub(crate) mod undo_log;
compiler/rustc_infer/src/infer/snapshot/undo_log.rs+1-1
......@@ -6,7 +6,7 @@ use rustc_middle::infer::unify_key::{ConstVidKey, EffectVidKey, RegionVidKey};
66use rustc_middle::ty::{self, OpaqueHiddenType, OpaqueTypeKey};
77use tracing::debug;
88
9use crate::infer::{region_constraints, type_variable, InferCtxtInner};
9use crate::infer::{InferCtxtInner, region_constraints, type_variable};
1010use crate::traits;
1111
1212pub struct Snapshot<'tcx> {
compiler/rustc_infer/src/traits/engine.rs+6-9
......@@ -45,15 +45,12 @@ pub trait TraitEngine<'tcx, E: 'tcx>: 'tcx {
4545 cause: ObligationCause<'tcx>,
4646 ) {
4747 let trait_ref = ty::TraitRef::new(infcx.tcx, def_id, [ty]);
48 self.register_predicate_obligation(
49 infcx,
50 Obligation {
51 cause,
52 recursion_depth: 0,
53 param_env,
54 predicate: trait_ref.upcast(infcx.tcx),
55 },
56 );
48 self.register_predicate_obligation(infcx, Obligation {
49 cause,
50 recursion_depth: 0,
51 param_env,
52 predicate: trait_ref.upcast(infcx.tcx),
53 });
5754 }
5855
5956 fn register_predicate_obligation(
compiler/rustc_infer/src/traits/mod.rs+2-2
......@@ -18,14 +18,14 @@ pub use rustc_middle::traits::*;
1818use rustc_middle::ty::{self, Ty, TyCtxt, Upcast};
1919use rustc_span::Span;
2020
21pub use self::ImplSource::*;
22pub use self::SelectionError::*;
2123pub use self::engine::{FromSolverError, ScrubbedTraitError, TraitEngine};
2224pub(crate) use self::project::UndoLog;
2325pub use self::project::{
2426 MismatchedProjectionTypes, Normalized, NormalizedTerm, ProjectionCache, ProjectionCacheEntry,
2527 ProjectionCacheKey, ProjectionCacheStorage,
2628};
27pub use self::ImplSource::*;
28pub use self::SelectionError::*;
2929use crate::infer::InferCtxt;
3030
3131/// An `Obligation` represents some trait reference (e.g., `i32: Eq`) for
compiler/rustc_infer/src/traits/project.rs+4-4
......@@ -200,10 +200,10 @@ impl<'tcx> ProjectionCache<'_, 'tcx> {
200200 if result.must_apply_considering_regions() {
201201 ty.obligations = vec![];
202202 }
203 map.insert(
204 key,
205 ProjectionCacheEntry::NormalizedTerm { ty, complete: Some(result) },
206 );
203 map.insert(key, ProjectionCacheEntry::NormalizedTerm {
204 ty,
205 complete: Some(result),
206 });
207207 }
208208 ref value => {
209209 // Type inference could "strand behind" old cache entries. Leave
compiler/rustc_infer/src/traits/util.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_data_structures::fx::FxHashSet;
22use rustc_middle::ty::{self, ToPolyTraitRef, TyCtxt};
3use rustc_span::symbol::Ident;
43use rustc_span::Span;
4use rustc_span::symbol::Ident;
55pub use rustc_type_ir::elaborate::*;
66
77use crate::traits::{self, Obligation, ObligationCauseCode, PredicateObligation};
compiler/rustc_interface/src/interface.rs+3-3
......@@ -2,7 +2,7 @@ use std::path::PathBuf;
22use std::result;
33use std::sync::Arc;
44
5use rustc_ast::{token, LitKind, MetaItemKind};
5use rustc_ast::{LitKind, MetaItemKind, token};
66use rustc_codegen_ssa::traits::CodegenBackend;
77use rustc_data_structures::fx::{FxHashMap, FxHashSet};
88use rustc_data_structures::stable_hasher::StableHasher;
......@@ -21,10 +21,10 @@ use rustc_query_system::query::print_query_stack;
2121use rustc_session::config::{self, Cfg, CheckCfg, ExpectedValues, Input, OutFileName};
2222use rustc_session::filesearch::{self, sysroot_candidates};
2323use rustc_session::parse::ParseSess;
24use rustc_session::{lint, CompilerIO, EarlyDiagCtxt, Session};
24use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, lint};
25use rustc_span::FileName;
2526use rustc_span::source_map::{FileLoader, RealFileLoader, SourceMapInputs};
2627use rustc_span::symbol::sym;
27use rustc_span::FileName;
2828use tracing::trace;
2929
3030use crate::util;
compiler/rustc_interface/src/lib.rs+1-1
......@@ -14,7 +14,7 @@ mod queries;
1414pub mod util;
1515
1616pub use callbacks::setup_callbacks;
17pub use interface::{run_compiler, Config};
17pub use interface::{Config, run_compiler};
1818pub use passes::DEFAULT_QUERY_PROVIDERS;
1919pub use queries::{Linker, Queries};
2020
compiler/rustc_interface/src/passes.rs+12-16
......@@ -13,10 +13,10 @@ use rustc_data_structures::sync::{AppendOnlyIndexVec, FreezeLock, Lrc, OnceLock,
1313use rustc_expand::base::{ExtCtxt, LintStoreExpand};
1414use rustc_feature::Features;
1515use rustc_fs_util::try_canonicalize;
16use rustc_hir::def_id::{StableCrateId, StableCrateIdMap, LOCAL_CRATE};
16use rustc_hir::def_id::{LOCAL_CRATE, StableCrateId, StableCrateIdMap};
1717use rustc_hir::definitions::Definitions;
1818use rustc_incremental::setup_dep_graph;
19use rustc_lint::{unerased_lint_store, BufferedEarlyLint, EarlyCheckNode, LintStore};
19use rustc_lint::{BufferedEarlyLint, EarlyCheckNode, LintStore, unerased_lint_store};
2020use rustc_metadata::creader::CStore;
2121use rustc_middle::arena::Arena;
2222use rustc_middle::ty::{self, GlobalCtxt, RegisteredTools, TyCtxt};
......@@ -32,8 +32,8 @@ use rustc_session::cstore::Untracked;
3232use rustc_session::output::{collect_crate_types, filename_for_input, find_crate_name};
3333use rustc_session::search_paths::PathKind;
3434use rustc_session::{Limit, Session};
35use rustc_span::symbol::{sym, Symbol};
3635use rustc_span::FileName;
36use rustc_span::symbol::{Symbol, sym};
3737use rustc_target::spec::PanicStrategy;
3838use rustc_trait_selection::traits;
3939use tracing::{info, instrument};
......@@ -980,19 +980,15 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
980980 std::ops::ControlFlow::Continue::<std::convert::Infallible>(())
981981 });
982982
983 sess.code_stats.record_vtable_size(
984 tr,
985 &name,
986 VTableSizeInfo {
987 trait_name: name.clone(),
988 entries: entries_ignoring_upcasting + entries_for_upcasting,
989 entries_ignoring_upcasting,
990 entries_for_upcasting,
991 upcasting_cost_percent: entries_for_upcasting as f64
992 / entries_ignoring_upcasting as f64
993 * 100.,
994 },
995 )
983 sess.code_stats.record_vtable_size(tr, &name, VTableSizeInfo {
984 trait_name: name.clone(),
985 entries: entries_ignoring_upcasting + entries_for_upcasting,
986 entries_ignoring_upcasting,
987 entries_for_upcasting,
988 upcasting_cost_percent: entries_for_upcasting as f64
989 / entries_ignoring_upcasting as f64
990 * 100.,
991 })
996992 }
997993 }
998994
compiler/rustc_interface/src/queries.rs+2-2
......@@ -3,8 +3,8 @@ use std::cell::{RefCell, RefMut};
33use std::sync::Arc;
44
55use rustc_ast as ast;
6use rustc_codegen_ssa::traits::CodegenBackend;
76use rustc_codegen_ssa::CodegenResults;
7use rustc_codegen_ssa::traits::CodegenBackend;
88use rustc_data_structures::steal::Steal;
99use rustc_data_structures::svh::Svh;
1010use rustc_data_structures::sync::{OnceLock, WorkerLocal};
......@@ -13,8 +13,8 @@ use rustc_middle::arena::Arena;
1313use rustc_middle::dep_graph::DepGraph;
1414use rustc_middle::ty::{GlobalCtxt, TyCtxt};
1515use rustc_serialize::opaque::FileEncodeResult;
16use rustc_session::config::{self, OutputFilenames, OutputType};
1716use rustc_session::Session;
17use rustc_session::config::{self, OutputFilenames, OutputType};
1818
1919use crate::errors::FailedWritingFile;
2020use crate::interface::{Compiler, Result};
compiler/rustc_interface/src/tests.rs+10-10
......@@ -6,22 +6,22 @@ use std::sync::Arc;
66
77use rustc_data_structures::profiling::TimePassesFormat;
88use rustc_errors::emitter::HumanReadableErrorType;
9use rustc_errors::{registry, ColorConfig};
9use rustc_errors::{ColorConfig, registry};
1010use rustc_session::config::{
11 build_configuration, build_session_options, rustc_optgroups, BranchProtection, CFGuard, Cfg,
12 CollapseMacroDebuginfo, CoverageLevel, CoverageOptions, DebugInfo, DumpMonoStatsFormat,
13 ErrorOutputType, ExternEntry, ExternLocation, Externs, FmtDebug, FunctionReturn,
14 InliningThreshold, Input, InstrumentCoverage, InstrumentXRay, LinkSelfContained,
15 LinkerPluginLto, LocationDetail, LtoCli, MirIncludeSpans, NextSolverConfig, OomStrategy,
16 Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes,
11 BranchProtection, CFGuard, Cfg, CollapseMacroDebuginfo, CoverageLevel, CoverageOptions,
12 DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, Externs,
13 FmtDebug, FunctionReturn, InliningThreshold, Input, InstrumentCoverage, InstrumentXRay,
14 LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirIncludeSpans, NextSolverConfig,
15 OomStrategy, Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes,
1716 PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath,
18 SymbolManglingVersion, WasiExecModel,
17 SymbolManglingVersion, WasiExecModel, build_configuration, build_session_options,
18 rustc_optgroups,
1919};
2020use rustc_session::lint::Level;
2121use rustc_session::search_paths::SearchPath;
2222use rustc_session::utils::{CanonicalizedPath, NativeLib, NativeLibKind};
23use rustc_session::{build_session, filesearch, getopts, CompilerIO, EarlyDiagCtxt, Session};
24use rustc_span::edition::{Edition, DEFAULT_EDITION};
23use rustc_session::{CompilerIO, EarlyDiagCtxt, Session, build_session, filesearch, getopts};
24use rustc_span::edition::{DEFAULT_EDITION, Edition};
2525use rustc_span::source_map::{RealFileLoader, SourceMapInputs};
2626use rustc_span::symbol::sym;
2727use rustc_span::{FileName, SourceFileHashAlgorithm};
compiler/rustc_interface/src/util.rs+6-6
......@@ -1,21 +1,21 @@
11use std::env::consts::{DLL_PREFIX, DLL_SUFFIX};
22use std::path::{Path, PathBuf};
3use std::sync::atomic::{AtomicBool, Ordering};
43use std::sync::OnceLock;
4use std::sync::atomic::{AtomicBool, Ordering};
55use std::{env, iter, thread};
66
77use rustc_ast as ast;
88use rustc_codegen_ssa::traits::CodegenBackend;
99#[cfg(parallel_compiler)]
1010use rustc_data_structures::sync;
11use rustc_metadata::{load_symbol_from_dylib, DylibError};
11use rustc_metadata::{DylibError, load_symbol_from_dylib};
1212use rustc_middle::ty::CurrentGcx;
1313use rustc_parse::validate_attr;
14use rustc_session::config::{host_triple, Cfg, OutFileName, OutputFilenames, OutputTypes};
14use rustc_session::config::{Cfg, OutFileName, OutputFilenames, OutputTypes, host_triple};
1515use rustc_session::filesearch::sysroot_candidates;
1616use rustc_session::lint::{self, BuiltinLintDiag, LintBuffer};
17use rustc_session::output::{categorize_crate_type, CRATE_TYPES};
18use rustc_session::{filesearch, EarlyDiagCtxt, Session};
17use rustc_session::output::{CRATE_TYPES, categorize_crate_type};
18use rustc_session::{EarlyDiagCtxt, Session, filesearch};
1919use rustc_span::edit_distance::find_best_match_for_name;
2020use rustc_span::edition::Edition;
2121use rustc_span::source_map::SourceMapInputs;
......@@ -143,7 +143,7 @@ pub(crate) fn run_in_thread_pool_with_globals<F: FnOnce(CurrentGcx) -> R + Send,
143143 use rustc_data_structures::{defer, jobserver};
144144 use rustc_middle::ty::tls;
145145 use rustc_query_impl::QueryCtxt;
146 use rustc_query_system::query::{break_query_cycles, QueryContext};
146 use rustc_query_system::query::{QueryContext, break_query_cycles};
147147
148148 let thread_stack_size = init_stack_size(thread_builder_diag);
149149
compiler/rustc_lexer/src/tests.rs+11-26
......@@ -1,4 +1,4 @@
1use expect_test::{expect, Expect};
1use expect_test::{Expect, expect};
22
33use super::*;
44
......@@ -141,9 +141,7 @@ fn check_lexing(src: &str, expect: Expect) {
141141
142142#[test]
143143fn smoke_test() {
144 check_lexing(
145 "/* my source file */ fn main() { println!(\"zebra\"); }\n",
146 expect![[r#"
144 check_lexing("/* my source file */ fn main() { println!(\"zebra\"); }\n", expect![[r#"
147145 Token { kind: BlockComment { doc_style: None, terminated: true }, len: 20 }
148146 Token { kind: Whitespace, len: 1 }
149147 Token { kind: Ident, len: 2 }
......@@ -163,8 +161,7 @@ fn smoke_test() {
163161 Token { kind: Whitespace, len: 1 }
164162 Token { kind: CloseBrace, len: 1 }
165163 Token { kind: Whitespace, len: 1 }
166 "#]],
167 )
164 "#]])
168165}
169166
170167#[test]
......@@ -207,47 +204,35 @@ fn comment_flavors() {
207204
208205#[test]
209206fn nested_block_comments() {
210 check_lexing(
211 "/* /* */ */'a'",
212 expect![[r#"
207 check_lexing("/* /* */ */'a'", expect![[r#"
213208 Token { kind: BlockComment { doc_style: None, terminated: true }, len: 11 }
214209 Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 3 }, len: 3 }
215 "#]],
216 )
210 "#]])
217211}
218212
219213#[test]
220214fn characters() {
221 check_lexing(
222 "'a' ' ' '\\n'",
223 expect![[r#"
215 check_lexing("'a' ' ' '\\n'", expect![[r#"
224216 Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 3 }, len: 3 }
225217 Token { kind: Whitespace, len: 1 }
226218 Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 3 }, len: 3 }
227219 Token { kind: Whitespace, len: 1 }
228220 Token { kind: Literal { kind: Char { terminated: true }, suffix_start: 4 }, len: 4 }
229 "#]],
230 );
221 "#]]);
231222}
232223
233224#[test]
234225fn lifetime() {
235 check_lexing(
236 "'abc",
237 expect![[r#"
226 check_lexing("'abc", expect![[r#"
238227 Token { kind: Lifetime { starts_with_number: false }, len: 4 }
239 "#]],
240 );
228 "#]]);
241229}
242230
243231#[test]
244232fn raw_string() {
245 check_lexing(
246 "r###\"\"#a\\b\x00c\"\"###",
247 expect![[r#"
233 check_lexing("r###\"\"#a\\b\x00c\"\"###", expect![[r#"
248234 Token { kind: Literal { kind: RawStr { n_hashes: Some(3) }, suffix_start: 17 }, len: 17 }
249 "#]],
250 )
235 "#]])
251236}
252237
253238#[test]
compiler/rustc_lexer/src/unescape/tests.rs+6-9
......@@ -108,15 +108,12 @@ fn test_unescape_str_warn() {
108108 check("\\\n", &[]);
109109 check("\\\n ", &[]);
110110
111 check(
112 "\\\n \u{a0} x",
113 &[
114 (0..5, Err(EscapeError::UnskippedWhitespaceWarning)),
115 (3..5, Ok('\u{a0}')),
116 (5..6, Ok(' ')),
117 (6..7, Ok('x')),
118 ],
119 );
111 check("\\\n \u{a0} x", &[
112 (0..5, Err(EscapeError::UnskippedWhitespaceWarning)),
113 (3..5, Ok('\u{a0}')),
114 (5..6, Ok(' ')),
115 (6..7, Ok('x')),
116 ]);
120117 check("\\\n \n x", &[(0..7, Err(EscapeError::MultipleSkippedLinesWarning)), (7..8, Ok('x'))]);
121118}
122119
compiler/rustc_lint/src/builtin.rs+95-128
......@@ -28,10 +28,10 @@ use rustc_ast::visit::{FnCtxt, FnKind};
2828use rustc_ast::{self as ast, *};
2929use rustc_ast_pretty::pprust::{self, expr_to_string};
3030use rustc_errors::{Applicability, LintDiagnostic};
31use rustc_feature::{deprecated_attributes, AttributeGate, BuiltinAttribute, GateIssue, Stability};
31use rustc_feature::{AttributeGate, BuiltinAttribute, GateIssue, Stability, deprecated_attributes};
3232use rustc_hir as hir;
3333use rustc_hir::def::{DefKind, Res};
34use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
34use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
3535use rustc_hir::intravisit::FnKind as HirFnKind;
3636use rustc_hir::{Body, FnDecl, GenericParamKind, PatKind, PredicateOrigin};
3737use rustc_middle::bug;
......@@ -39,13 +39,13 @@ use rustc_middle::lint::in_external_macro;
3939use rustc_middle::ty::layout::LayoutOf;
4040use rustc_middle::ty::print::with_no_trimmed_paths;
4141use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt, Upcast, VariantDef};
42use rustc_session::lint::FutureIncompatibilityReason;
4243// hardwired lints from rustc_lint_defs
4344pub use rustc_session::lint::builtin::*;
44use rustc_session::lint::FutureIncompatibilityReason;
4545use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
4646use rustc_span::edition::Edition;
4747use rustc_span::source_map::Spanned;
48use rustc_span::symbol::{kw, sym, Ident, Symbol};
48use rustc_span::symbol::{Ident, Symbol, kw, sym};
4949use rustc_span::{BytePos, InnerSpan, Span};
5050use rustc_target::abi::Abi;
5151use rustc_target::asm::InlineAsmArch;
......@@ -68,10 +68,10 @@ use crate::lints::{
6868 BuiltinUnsafe, BuiltinUnstableFeatures, BuiltinUnusedDocComment, BuiltinUnusedDocCommentSub,
6969 BuiltinWhileTrue, InvalidAsmLabel,
7070};
71use crate::nonstandard_style::{method_context, MethodLateContext};
71use crate::nonstandard_style::{MethodLateContext, method_context};
7272use crate::{
73 fluent_generated as fluent, EarlyContext, EarlyLintPass, LateContext, LateLintPass, Level,
74 LintContext,
73 EarlyContext, EarlyLintPass, LateContext, LateLintPass, Level, LintContext,
74 fluent_generated as fluent,
7575};
7676
7777declare_lint! {
......@@ -120,11 +120,10 @@ impl EarlyLintPass for WhileTrue {
120120 "{}loop",
121121 label.map_or_else(String::new, |label| format!("{}: ", label.ident,))
122122 );
123 cx.emit_span_lint(
124 WHILE_TRUE,
125 condition_span,
126 BuiltinWhileTrue { suggestion: condition_span, replace },
127 );
123 cx.emit_span_lint(WHILE_TRUE, condition_span, BuiltinWhileTrue {
124 suggestion: condition_span,
125 replace,
126 });
128127 }
129128 }
130129}
......@@ -436,11 +435,10 @@ impl MissingDoc {
436435 let attrs = cx.tcx.hir().attrs(cx.tcx.local_def_id_to_hir_id(def_id));
437436 let has_doc = attrs.iter().any(has_doc);
438437 if !has_doc {
439 cx.emit_span_lint(
440 MISSING_DOCS,
441 cx.tcx.def_span(def_id),
442 BuiltinMissingDoc { article, desc },
443 );
438 cx.emit_span_lint(MISSING_DOCS, cx.tcx.def_span(def_id), BuiltinMissingDoc {
439 article,
440 desc,
441 });
444442 }
445443 }
446444}
......@@ -721,11 +719,10 @@ impl<'tcx> LateLintPass<'tcx> for MissingDebugImplementations {
721719 .next()
722720 .is_some();
723721 if !has_impl {
724 cx.emit_span_lint(
725 MISSING_DEBUG_IMPLEMENTATIONS,
726 item.span,
727 BuiltinMissingDebugImpl { tcx: cx.tcx, def_id: debug },
728 );
722 cx.emit_span_lint(MISSING_DEBUG_IMPLEMENTATIONS, item.span, BuiltinMissingDebugImpl {
723 tcx: cx.tcx,
724 def_id: debug,
725 });
729726 }
730727 }
731728}
......@@ -847,24 +844,21 @@ impl EarlyLintPass for DeprecatedAttr {
847844 BuiltinDeprecatedAttrLinkSuggestion::Default { suggestion: attr.span }
848845 }
849846 };
850 cx.emit_span_lint(
851 DEPRECATED,
852 attr.span,
853 BuiltinDeprecatedAttrLink { name, reason, link, suggestion },
854 );
847 cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrLink {
848 name,
849 reason,
850 link,
851 suggestion,
852 });
855853 }
856854 return;
857855 }
858856 }
859857 if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) {
860 cx.emit_span_lint(
861 DEPRECATED,
862 attr.span,
863 BuiltinDeprecatedAttrUsed {
864 name: pprust::path_to_string(&attr.get_normal_item().path),
865 suggestion: attr.span,
866 },
867 );
858 cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrUsed {
859 name: pprust::path_to_string(&attr.get_normal_item().path),
860 suggestion: attr.span,
861 });
868862 }
869863 }
870864}
......@@ -899,11 +893,11 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
899893 BuiltinUnusedDocCommentSub::BlockHelp
900894 }
901895 };
902 cx.emit_span_lint(
903 UNUSED_DOC_COMMENTS,
904 span,
905 BuiltinUnusedDocComment { kind: node_kind, label: node_span, sub },
906 );
896 cx.emit_span_lint(UNUSED_DOC_COMMENTS, span, BuiltinUnusedDocComment {
897 kind: node_kind,
898 label: node_span,
899 sub,
900 });
907901 }
908902 }
909903}
......@@ -1033,11 +1027,9 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
10331027 match param.kind {
10341028 GenericParamKind::Lifetime { .. } => {}
10351029 GenericParamKind::Type { .. } | GenericParamKind::Const { .. } => {
1036 cx.emit_span_lint(
1037 NO_MANGLE_GENERIC_ITEMS,
1038 span,
1039 BuiltinNoMangleGeneric { suggestion: no_mangle_attr.span },
1040 );
1030 cx.emit_span_lint(NO_MANGLE_GENERIC_ITEMS, span, BuiltinNoMangleGeneric {
1031 suggestion: no_mangle_attr.span,
1032 });
10411033 break;
10421034 }
10431035 }
......@@ -1064,11 +1056,9 @@ impl<'tcx> LateLintPass<'tcx> for InvalidNoMangleItems {
10641056
10651057 // Const items do not refer to a particular location in memory, and therefore
10661058 // don't have anything to attach a symbol to
1067 cx.emit_span_lint(
1068 NO_MANGLE_CONST_ITEMS,
1069 it.span,
1070 BuiltinConstNoMangle { suggestion },
1071 );
1059 cx.emit_span_lint(NO_MANGLE_CONST_ITEMS, it.span, BuiltinConstNoMangle {
1060 suggestion,
1061 });
10721062 }
10731063 }
10741064 hir::ItemKind::Impl(hir::Impl { generics, items, .. }) => {
......@@ -1316,15 +1306,11 @@ impl UnreachablePub {
13161306 applicability = Applicability::MaybeIncorrect;
13171307 }
13181308 let def_span = cx.tcx.def_span(def_id);
1319 cx.emit_span_lint(
1320 UNREACHABLE_PUB,
1321 def_span,
1322 BuiltinUnreachablePub {
1323 what,
1324 suggestion: (vis_span, applicability),
1325 help: exportable,
1326 },
1327 );
1309 cx.emit_span_lint(UNREACHABLE_PUB, def_span, BuiltinUnreachablePub {
1310 what,
1311 suggestion: (vis_span, applicability),
1312 help: exportable,
1313 });
13281314 }
13291315 }
13301316}
......@@ -1468,32 +1454,24 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds {
14681454 let enable_feat_help = cx.tcx.sess.is_nightly_build();
14691455
14701456 if let [.., label_sp] = *where_spans {
1471 cx.emit_span_lint(
1472 TYPE_ALIAS_BOUNDS,
1473 where_spans,
1474 BuiltinTypeAliasBounds {
1475 in_where_clause: true,
1476 label: label_sp,
1477 enable_feat_help,
1478 suggestions: vec![(generics.where_clause_span, String::new())],
1479 preds: generics.predicates,
1480 ty: ty.take(),
1481 },
1482 );
1457 cx.emit_span_lint(TYPE_ALIAS_BOUNDS, where_spans, BuiltinTypeAliasBounds {
1458 in_where_clause: true,
1459 label: label_sp,
1460 enable_feat_help,
1461 suggestions: vec![(generics.where_clause_span, String::new())],
1462 preds: generics.predicates,
1463 ty: ty.take(),
1464 });
14831465 }
14841466 if let [.., label_sp] = *inline_spans {
1485 cx.emit_span_lint(
1486 TYPE_ALIAS_BOUNDS,
1487 inline_spans,
1488 BuiltinTypeAliasBounds {
1489 in_where_clause: false,
1490 label: label_sp,
1491 enable_feat_help,
1492 suggestions: inline_sugg,
1493 preds: generics.predicates,
1494 ty,
1495 },
1496 );
1467 cx.emit_span_lint(TYPE_ALIAS_BOUNDS, inline_spans, BuiltinTypeAliasBounds {
1468 in_where_clause: false,
1469 label: label_sp,
1470 enable_feat_help,
1471 suggestions: inline_sugg,
1472 preds: generics.predicates,
1473 ty,
1474 });
14971475 }
14981476 }
14991477}
......@@ -1579,11 +1557,10 @@ impl<'tcx> LateLintPass<'tcx> for TrivialConstraints {
15791557 | ClauseKind::ConstEvaluatable(..) => continue,
15801558 };
15811559 if predicate.is_global() {
1582 cx.emit_span_lint(
1583 TRIVIAL_BOUNDS,
1584 span,
1585 BuiltinTrivialBounds { predicate_kind_name, predicate },
1586 );
1560 cx.emit_span_lint(TRIVIAL_BOUNDS, span, BuiltinTrivialBounds {
1561 predicate_kind_name,
1562 predicate,
1563 });
15871564 }
15881565 }
15891566 }
......@@ -1899,11 +1876,12 @@ impl KeywordIdents {
18991876 return;
19001877 }
19011878
1902 cx.emit_span_lint(
1903 lint,
1904 ident.span,
1905 BuiltinKeywordIdents { kw: ident, next: edition, suggestion: ident.span, prefix },
1906 );
1879 cx.emit_span_lint(lint, ident.span, BuiltinKeywordIdents {
1880 kw: ident,
1881 next: edition,
1882 suggestion: ident.span,
1883 prefix,
1884 });
19071885 }
19081886}
19091887
......@@ -2322,11 +2300,11 @@ impl EarlyLintPass for IncompleteInternalFeatures {
23222300 let help =
23232301 HAS_MIN_FEATURES.contains(&name).then_some(BuiltinIncompleteFeaturesHelp);
23242302
2325 cx.emit_span_lint(
2326 INCOMPLETE_FEATURES,
2327 span,
2328 BuiltinIncompleteFeatures { name, note, help },
2329 );
2303 cx.emit_span_lint(INCOMPLETE_FEATURES, span, BuiltinIncompleteFeatures {
2304 name,
2305 note,
2306 help,
2307 });
23302308 } else {
23312309 cx.emit_span_lint(INTERNAL_FEATURES, span, BuiltinInternalFeatures { name });
23322310 }
......@@ -2647,17 +2625,13 @@ impl<'tcx> LateLintPass<'tcx> for InvalidValue {
26472625 InitKind::Uninit => fluent::lint_builtin_unpermitted_type_init_uninit,
26482626 };
26492627 let sub = BuiltinUnpermittedTypeInitSub { err };
2650 cx.emit_span_lint(
2651 INVALID_VALUE,
2652 expr.span,
2653 BuiltinUnpermittedTypeInit {
2654 msg,
2655 ty: conjured_ty,
2656 label: expr.span,
2657 sub,
2658 tcx: cx.tcx,
2659 },
2660 );
2628 cx.emit_span_lint(INVALID_VALUE, expr.span, BuiltinUnpermittedTypeInit {
2629 msg,
2630 ty: conjured_ty,
2631 label: expr.span,
2632 sub,
2633 tcx: cx.tcx,
2634 });
26612635 }
26622636 }
26632637 }
......@@ -2735,11 +2709,9 @@ impl<'tcx> LateLintPass<'tcx> for DerefNullPtr {
27352709
27362710 if let rustc_hir::ExprKind::Unary(rustc_hir::UnOp::Deref, expr_deref) = expr.kind {
27372711 if is_null_ptr(cx, expr_deref) {
2738 cx.emit_span_lint(
2739 DEREF_NULLPTR,
2740 expr.span,
2741 BuiltinDerefNullptr { label: expr.span },
2742 );
2712 cx.emit_span_lint(DEREF_NULLPTR, expr.span, BuiltinDerefNullptr {
2713 label: expr.span,
2714 });
27432715 }
27442716 }
27452717 }
......@@ -2956,18 +2928,14 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
29562928 let span = span.unwrap_or(*template_span);
29572929 match label_kind {
29582930 AsmLabelKind::Named => {
2959 cx.emit_span_lint(
2960 NAMED_ASM_LABELS,
2961 span,
2962 InvalidAsmLabel::Named { missing_precise_span },
2963 );
2931 cx.emit_span_lint(NAMED_ASM_LABELS, span, InvalidAsmLabel::Named {
2932 missing_precise_span,
2933 });
29642934 }
29652935 AsmLabelKind::FormatArg => {
2966 cx.emit_span_lint(
2967 NAMED_ASM_LABELS,
2968 span,
2969 InvalidAsmLabel::FormatArg { missing_precise_span },
2970 );
2936 cx.emit_span_lint(NAMED_ASM_LABELS, span, InvalidAsmLabel::FormatArg {
2937 missing_precise_span,
2938 });
29712939 }
29722940 // the binary asm issue only occurs when using intel syntax on x86 targets
29732941 AsmLabelKind::Binary
......@@ -2977,11 +2945,10 @@ impl<'tcx> LateLintPass<'tcx> for AsmLabels {
29772945 Some(InlineAsmArch::X86 | InlineAsmArch::X86_64) | None
29782946 ) =>
29792947 {
2980 cx.emit_span_lint(
2981 BINARY_ASM_LABELS,
2948 cx.emit_span_lint(BINARY_ASM_LABELS, span, InvalidAsmLabel::Binary {
2949 missing_precise_span,
29822950 span,
2983 InvalidAsmLabel::Binary { missing_precise_span, span },
2984 )
2951 })
29852952 }
29862953 // No lint on anything other than x86
29872954 AsmLabelKind::Binary => (),
compiler/rustc_lint/src/context.rs+13-19
......@@ -29,15 +29,15 @@ use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
2929use rustc_middle::bug;
3030use rustc_middle::middle::privacy::EffectiveVisibilities;
3131use rustc_middle::ty::layout::{LayoutError, LayoutOfHelpers, TyAndLayout};
32use rustc_middle::ty::print::{with_no_trimmed_paths, PrintError, PrintTraitRefExt as _, Printer};
32use rustc_middle::ty::print::{PrintError, PrintTraitRefExt as _, Printer, with_no_trimmed_paths};
3333use rustc_middle::ty::{self, GenericArg, RegisteredTools, Ty, TyCtxt};
3434use rustc_session::lint::{
3535 BuiltinLintDiag, FutureIncompatibleInfo, Level, Lint, LintBuffer, LintExpectationId, LintId,
3636};
3737use rustc_session::{LintStoreMarker, Session};
38use rustc_span::edit_distance::find_best_match_for_names;
39use rustc_span::symbol::{sym, Ident, Symbol};
4038use rustc_span::Span;
39use rustc_span::edit_distance::find_best_match_for_names;
40use rustc_span::symbol::{Ident, Symbol, sym};
4141use rustc_target::abi;
4242use tracing::debug;
4343
......@@ -251,14 +251,11 @@ impl LintStore {
251251 }
252252
253253 pub fn register_group_alias(&mut self, lint_name: &'static str, alias: &'static str) {
254 self.lint_groups.insert(
255 alias,
256 LintGroup {
257 lint_ids: vec![],
258 is_externally_loaded: false,
259 depr: Some(LintAlias { name: lint_name, silent: true }),
260 },
261 );
254 self.lint_groups.insert(alias, LintGroup {
255 lint_ids: vec![],
256 is_externally_loaded: false,
257 depr: Some(LintAlias { name: lint_name, silent: true }),
258 });
262259 }
263260
264261 pub fn register_group(
......@@ -273,14 +270,11 @@ impl LintStore {
273270 .insert(name, LintGroup { lint_ids: to, is_externally_loaded, depr: None })
274271 .is_none();
275272 if let Some(deprecated) = deprecated_name {
276 self.lint_groups.insert(
277 deprecated,
278 LintGroup {
279 lint_ids: vec![],
280 is_externally_loaded,
281 depr: Some(LintAlias { name, silent: false }),
282 },
283 );
273 self.lint_groups.insert(deprecated, LintGroup {
274 lint_ids: vec![],
275 is_externally_loaded,
276 depr: Some(LintAlias { name, silent: false }),
277 });
284278 }
285279
286280 if !new {
compiler/rustc_lint/src/context/diagnostics.rs+3-3
......@@ -5,13 +5,13 @@ use std::borrow::Cow;
55
66use rustc_ast::util::unicode::TEXT_FLOW_CONTROL_CHARS;
77use rustc_errors::{
8 elided_lifetime_in_path_suggestion, Applicability, Diag, DiagArgValue, LintDiagnostic,
8 Applicability, Diag, DiagArgValue, LintDiagnostic, elided_lifetime_in_path_suggestion,
99};
1010use rustc_middle::middle::stability;
11use rustc_session::lint::{BuiltinLintDiag, ElidedLifetimeResolution};
1211use rustc_session::Session;
13use rustc_span::symbol::kw;
12use rustc_session::lint::{BuiltinLintDiag, ElidedLifetimeResolution};
1413use rustc_span::BytePos;
14use rustc_span::symbol::kw;
1515use tracing::debug;
1616
1717use crate::lints::{self, ElidedNamedLifetime};
compiler/rustc_lint/src/context/diagnostics/check_cfg.rs+2-2
......@@ -1,9 +1,9 @@
11use rustc_middle::bug;
2use rustc_session::config::ExpectedValues;
32use rustc_session::Session;
3use rustc_session::config::ExpectedValues;
44use rustc_span::edit_distance::find_best_match_for_name;
55use rustc_span::symbol::Ident;
6use rustc_span::{sym, Span, Symbol};
6use rustc_span::{Span, Symbol, sym};
77
88use crate::lints;
99
compiler/rustc_lint/src/deref_into_dyn_supertrait.rs+8-13
......@@ -86,19 +86,14 @@ impl<'tcx> LateLintPass<'tcx> for DerefIntoDynSupertrait {
8686 .find_map(|i| (i.ident.name == sym::Target).then_some(i.span))
8787 .map(|label| SupertraitAsDerefTargetLabel { label });
8888 let span = tcx.def_span(item.owner_id.def_id);
89 cx.emit_span_lint(
90 DEREF_INTO_DYN_SUPERTRAIT,
91 span,
92 SupertraitAsDerefTarget {
93 self_ty,
94 supertrait_principal: supertrait_principal.map_bound(|trait_ref| {
95 ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)
96 }),
97 target_principal,
98 label: span,
99 label2,
100 },
101 );
89 cx.emit_span_lint(DEREF_INTO_DYN_SUPERTRAIT, span, SupertraitAsDerefTarget {
90 self_ty,
91 supertrait_principal: supertrait_principal
92 .map_bound(|trait_ref| ty::ExistentialTraitRef::erase_self_ty(tcx, trait_ref)),
93 target_principal,
94 label: span,
95 label2,
96 });
10297 }
10398 }
10499}
compiler/rustc_lint/src/drop_forget_useless.rs+20-32
......@@ -163,44 +163,32 @@ impl<'tcx> LateLintPass<'tcx> for DropForgetUseless {
163163 };
164164 match fn_name {
165165 sym::mem_drop if arg_ty.is_ref() && !drop_is_single_call_in_arm => {
166 cx.emit_span_lint(
167 DROPPING_REFERENCES,
168 expr.span,
169 DropRefDiag { arg_ty, label: arg.span, sugg: let_underscore_ignore_sugg() },
170 );
166 cx.emit_span_lint(DROPPING_REFERENCES, expr.span, DropRefDiag {
167 arg_ty,
168 label: arg.span,
169 sugg: let_underscore_ignore_sugg(),
170 });
171171 }
172172 sym::mem_forget if arg_ty.is_ref() => {
173 cx.emit_span_lint(
174 FORGETTING_REFERENCES,
175 expr.span,
176 ForgetRefDiag {
177 arg_ty,
178 label: arg.span,
179 sugg: let_underscore_ignore_sugg(),
180 },
181 );
173 cx.emit_span_lint(FORGETTING_REFERENCES, expr.span, ForgetRefDiag {
174 arg_ty,
175 label: arg.span,
176 sugg: let_underscore_ignore_sugg(),
177 });
182178 }
183179 sym::mem_drop if is_copy && !drop_is_single_call_in_arm => {
184 cx.emit_span_lint(
185 DROPPING_COPY_TYPES,
186 expr.span,
187 DropCopyDiag {
188 arg_ty,
189 label: arg.span,
190 sugg: let_underscore_ignore_sugg(),
191 },
192 );
180 cx.emit_span_lint(DROPPING_COPY_TYPES, expr.span, DropCopyDiag {
181 arg_ty,
182 label: arg.span,
183 sugg: let_underscore_ignore_sugg(),
184 });
193185 }
194186 sym::mem_forget if is_copy => {
195 cx.emit_span_lint(
196 FORGETTING_COPY_TYPES,
197 expr.span,
198 ForgetCopyDiag {
199 arg_ty,
200 label: arg.span,
201 sugg: let_underscore_ignore_sugg(),
202 },
203 );
187 cx.emit_span_lint(FORGETTING_COPY_TYPES, expr.span, ForgetCopyDiag {
188 arg_ty,
189 label: arg.span,
190 sugg: let_underscore_ignore_sugg(),
191 });
204192 }
205193 sym::mem_drop
206194 if let ty::Adt(adt, _) = arg_ty.kind()
compiler/rustc_lint/src/early.rs+3-3
......@@ -15,15 +15,15 @@
1515//! for all lint attributes.
1616
1717use rustc_ast::ptr::P;
18use rustc_ast::visit::{self as ast_visit, walk_list, Visitor};
18use rustc_ast::visit::{self as ast_visit, Visitor, walk_list};
1919use rustc_ast::{self as ast, HasAttrs};
2020use rustc_data_structures::stack::ensure_sufficient_stack;
2121use rustc_feature::Features;
2222use rustc_middle::ty::RegisteredTools;
23use rustc_session::lint::{BufferedEarlyLint, LintBuffer, LintPass};
2423use rustc_session::Session;
25use rustc_span::symbol::Ident;
24use rustc_session::lint::{BufferedEarlyLint, LintBuffer, LintPass};
2625use rustc_span::Span;
26use rustc_span::symbol::Ident;
2727use tracing::debug;
2828
2929use crate::context::{EarlyContext, LintStore};
compiler/rustc_lint/src/enum_intrinsics_non_enums.rs+6-7
......@@ -1,9 +1,9 @@
11use rustc_hir as hir;
2use rustc_middle::ty::visit::TypeVisitableExt;
32use rustc_middle::ty::Ty;
3use rustc_middle::ty::visit::TypeVisitableExt;
44use rustc_session::{declare_lint, declare_lint_pass};
5use rustc_span::symbol::sym;
65use rustc_span::Span;
6use rustc_span::symbol::sym;
77
88use crate::context::LintContext;
99use crate::lints::{EnumIntrinsicsMemDiscriminate, EnumIntrinsicsMemVariant};
......@@ -55,11 +55,10 @@ fn enforce_mem_discriminant(
5555) {
5656 let ty_param = cx.typeck_results().node_args(func_expr.hir_id).type_at(0);
5757 if is_non_enum(ty_param) {
58 cx.emit_span_lint(
59 ENUM_INTRINSICS_NON_ENUMS,
60 expr_span,
61 EnumIntrinsicsMemDiscriminate { ty_param, note: args_span },
62 );
58 cx.emit_span_lint(ENUM_INTRINSICS_NON_ENUMS, expr_span, EnumIntrinsicsMemDiscriminate {
59 ty_param,
60 note: args_span,
61 });
6362 }
6463}
6564
compiler/rustc_lint/src/expect.rs+1-1
......@@ -3,8 +3,8 @@ use rustc_hir::CRATE_OWNER_ID;
33use rustc_middle::lint::LintExpectation;
44use rustc_middle::query::Providers;
55use rustc_middle::ty::TyCtxt;
6use rustc_session::lint::builtin::UNFULFILLED_LINT_EXPECTATIONS;
76use rustc_session::lint::LintExpectationId;
7use rustc_session::lint::builtin::UNFULFILLED_LINT_EXPECTATIONS;
88use rustc_span::Symbol;
99
1010use crate::lints::{Expectation, ExpectationNote};
compiler/rustc_lint/src/for_loops_over_fallibles.rs+9-6
......@@ -4,7 +4,7 @@ use rustc_infer::infer::TyCtxtInferExt;
44use rustc_infer::traits::ObligationCause;
55use rustc_middle::ty;
66use rustc_session::{declare_lint, declare_lint_pass};
7use rustc_span::{sym, Span};
7use rustc_span::{Span, sym};
88use rustc_trait_selection::traits::ObligationCtxt;
99
1010use crate::lints::{
......@@ -96,11 +96,14 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopsOverFallibles {
9696 end_span: pat.span.between(arg.span),
9797 };
9898
99 cx.emit_span_lint(
100 FOR_LOOPS_OVER_FALLIBLES,
101 arg.span,
102 ForLoopsOverFalliblesDiag { article, ref_prefix, ty, sub, question_mark, suggestion },
103 );
99 cx.emit_span_lint(FOR_LOOPS_OVER_FALLIBLES, arg.span, ForLoopsOverFalliblesDiag {
100 article,
101 ref_prefix,
102 ty,
103 sub,
104 question_mark,
105 suggestion,
106 });
104107 }
105108}
106109
compiler/rustc_lint/src/foreign_modules.rs+2-2
......@@ -5,12 +5,12 @@ use rustc_hir::def::DefKind;
55use rustc_middle::query::Providers;
66use rustc_middle::ty::{self, AdtDef, Instance, Ty, TyCtxt};
77use rustc_session::declare_lint;
8use rustc_span::{sym, Span, Symbol};
8use rustc_span::{Span, Symbol, sym};
99use rustc_target::abi::FIRST_VARIANT;
1010use tracing::{debug, instrument};
1111
1212use crate::lints::{BuiltinClashingExtern, BuiltinClashingExternSub};
13use crate::{types, LintVec};
13use crate::{LintVec, types};
1414
1515pub(crate) fn provide(providers: &mut Providers) {
1616 *providers = Providers { clashing_extern_declarations, ..*providers };
compiler/rustc_lint/src/hidden_unicode_codepoints.rs+8-6
......@@ -1,4 +1,4 @@
1use ast::util::unicode::{contains_text_flow_control_chars, TEXT_FLOW_CONTROL_CHARS};
1use ast::util::unicode::{TEXT_FLOW_CONTROL_CHARS, contains_text_flow_control_chars};
22use rustc_ast as ast;
33use rustc_session::{declare_lint, declare_lint_pass};
44use rustc_span::{BytePos, Span, Symbol};
......@@ -73,11 +73,13 @@ impl HiddenUnicodeCodepoints {
7373 HiddenUnicodeCodepointsDiagSub::NoEscape { spans }
7474 };
7575
76 cx.emit_span_lint(
77 TEXT_DIRECTION_CODEPOINT_IN_LITERAL,
78 span,
79 HiddenUnicodeCodepointsDiag { label, count, span_label: span, labels, sub },
80 );
76 cx.emit_span_lint(TEXT_DIRECTION_CODEPOINT_IN_LITERAL, span, HiddenUnicodeCodepointsDiag {
77 label,
78 count,
79 span_label: span,
80 labels,
81 sub,
82 });
8183 }
8284}
8385impl EarlyLintPass for HiddenUnicodeCodepoints {
compiler/rustc_lint/src/if_let_rescope.rs+15-20
......@@ -11,8 +11,8 @@ use rustc_macros::LintDiagnostic;
1111use rustc_middle::ty::TyCtxt;
1212use rustc_session::lint::{FutureIncompatibilityReason, Level};
1313use rustc_session::{declare_lint, impl_lint_pass};
14use rustc_span::edition::Edition;
1514use rustc_span::Span;
15use rustc_span::edition::Edition;
1616
1717use crate::{LateContext, LateLintPass};
1818
......@@ -210,25 +210,20 @@ impl IfLetRescope {
210210 }
211211 }
212212 if let Some((span, hir_id)) = first_if_to_lint {
213 tcx.emit_node_span_lint(
214 IF_LET_RESCOPE,
215 hir_id,
216 span,
217 IfLetRescopeLint {
218 significant_droppers,
219 lifetime_ends,
220 rewrite: first_if_to_rewrite.then_some(IfLetRescopeRewrite {
221 match_heads,
222 consequent_heads,
223 closing_brackets: ClosingBrackets {
224 span: expr_end,
225 count: closing_brackets,
226 empty_alt,
227 },
228 alt_heads,
229 }),
230 },
231 );
213 tcx.emit_node_span_lint(IF_LET_RESCOPE, hir_id, span, IfLetRescopeLint {
214 significant_droppers,
215 lifetime_ends,
216 rewrite: first_if_to_rewrite.then_some(IfLetRescopeRewrite {
217 match_heads,
218 consequent_heads,
219 closing_brackets: ClosingBrackets {
220 span: expr_end,
221 count: closing_brackets,
222 empty_alt,
223 },
224 alt_heads,
225 }),
226 });
232227 }
233228 }
234229}
compiler/rustc_lint/src/impl_trait_overcaptures.rs+10-8
......@@ -7,12 +7,12 @@ use rustc_errors::{Applicability, LintDiagnostic};
77use rustc_hir as hir;
88use rustc_hir::def::DefKind;
99use rustc_hir::def_id::{DefId, LocalDefId};
10use rustc_infer::infer::outlives::env::OutlivesEnvironment;
1110use rustc_infer::infer::TyCtxtInferExt;
11use rustc_infer::infer::outlives::env::OutlivesEnvironment;
1212use rustc_macros::LintDiagnostic;
1313use rustc_middle::middle::resolve_bound_vars::ResolvedArg;
1414use rustc_middle::ty::relate::{
15 structurally_relate_consts, structurally_relate_tys, Relate, RelateResult, TypeRelation,
15 Relate, RelateResult, TypeRelation, structurally_relate_consts, structurally_relate_tys,
1616};
1717use rustc_middle::ty::{
1818 self, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
......@@ -22,10 +22,10 @@ use rustc_session::lint::FutureIncompatibilityReason;
2222use rustc_session::{declare_lint, declare_lint_pass};
2323use rustc_span::edition::Edition;
2424use rustc_span::{Span, Symbol};
25use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt;
2625use rustc_trait_selection::traits::ObligationCtxt;
26use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt;
2727
28use crate::{fluent_generated as fluent, LateContext, LateLintPass};
28use crate::{LateContext, LateLintPass, fluent_generated as fluent};
2929
3030declare_lint! {
3131 /// The `impl_trait_overcaptures` lint warns against cases where lifetime
......@@ -309,10 +309,12 @@ where
309309 // We only computed variance of lifetimes...
310310 debug_assert_matches!(self.tcx.def_kind(def_id), DefKind::LifetimeParam);
311311 let uncaptured = match *kind {
312 ParamKind::Early(name, index) => ty::Region::new_early_param(
313 self.tcx,
314 ty::EarlyParamRegion { name, index },
315 ),
312 ParamKind::Early(name, index) => {
313 ty::Region::new_early_param(self.tcx, ty::EarlyParamRegion {
314 name,
315 index,
316 })
317 }
316318 ParamKind::Free(def_id, name) => ty::Region::new_late_param(
317319 self.tcx,
318320 self.parent_def_id.to_def_id(),
compiler/rustc_lint/src/internal.rs+25-37
......@@ -10,9 +10,9 @@ use rustc_hir::{
1010};
1111use rustc_middle::ty::{self, GenericArgsRef, Ty as MiddleTy};
1212use rustc_session::{declare_lint_pass, declare_tool_lint};
13use rustc_span::hygiene::{ExpnKind, MacroKind};
14use rustc_span::symbol::{kw, sym, Symbol};
1513use rustc_span::Span;
14use rustc_span::hygiene::{ExpnKind, MacroKind};
15use rustc_span::symbol::{Symbol, kw, sym};
1616use tracing::debug;
1717
1818use crate::lints::{
......@@ -48,11 +48,10 @@ impl LateLintPass<'_> for DefaultHashTypes {
4848 Some(sym::HashSet) => "FxHashSet",
4949 _ => return,
5050 };
51 cx.emit_span_lint(
52 DEFAULT_HASH_TYPES,
53 path.span,
54 DefaultHashTypesDiag { preferred, used: cx.tcx.item_name(def_id) },
55 );
51 cx.emit_span_lint(DEFAULT_HASH_TYPES, path.span, DefaultHashTypesDiag {
52 preferred,
53 used: cx.tcx.item_name(def_id),
54 });
5655 }
5756}
5857
......@@ -107,18 +106,14 @@ impl LateLintPass<'_> for QueryStability {
107106 if let Ok(Some(instance)) = ty::Instance::try_resolve(cx.tcx, cx.param_env, def_id, args) {
108107 let def_id = instance.def_id();
109108 if cx.tcx.has_attr(def_id, sym::rustc_lint_query_instability) {
110 cx.emit_span_lint(
111 POTENTIAL_QUERY_INSTABILITY,
112 span,
113 QueryInstability { query: cx.tcx.item_name(def_id) },
114 );
109 cx.emit_span_lint(POTENTIAL_QUERY_INSTABILITY, span, QueryInstability {
110 query: cx.tcx.item_name(def_id),
111 });
115112 }
116113 if cx.tcx.has_attr(def_id, sym::rustc_lint_untracked_query_information) {
117 cx.emit_span_lint(
118 UNTRACKED_QUERY_INFORMATION,
119 span,
120 QueryUntracked { method: cx.tcx.item_name(def_id) },
121 );
114 cx.emit_span_lint(UNTRACKED_QUERY_INFORMATION, span, QueryUntracked {
115 method: cx.tcx.item_name(def_id),
116 });
122117 }
123118 }
124119 }
......@@ -208,11 +203,9 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
208203
209204 match span {
210205 Some(span) => {
211 cx.emit_span_lint(
212 USAGE_OF_TY_TYKIND,
213 path.span,
214 TykindKind { suggestion: span },
215 );
206 cx.emit_span_lint(USAGE_OF_TY_TYKIND, path.span, TykindKind {
207 suggestion: span,
208 });
216209 }
217210 None => cx.emit_span_lint(USAGE_OF_TY_TYKIND, path.span, TykindDiag),
218211 }
......@@ -220,11 +213,10 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
220213 && path.segments.len() > 1
221214 && let Some(ty) = is_ty_or_ty_ctxt(cx, path)
222215 {
223 cx.emit_span_lint(
224 USAGE_OF_QUALIFIED_TY,
225 path.span,
226 TyQualified { ty, suggestion: path.span },
227 );
216 cx.emit_span_lint(USAGE_OF_QUALIFIED_TY, path.span, TyQualified {
217 ty,
218 suggestion: path.span,
219 });
228220 }
229221 }
230222 _ => {}
......@@ -418,11 +410,9 @@ impl<'tcx> LateLintPass<'tcx> for ExistingDocKeyword {
418410 if is_doc_keyword(keyword) {
419411 return;
420412 }
421 cx.emit_span_lint(
422 EXISTING_DOC_KEYWORD,
423 attr.span,
424 NonExistentDocKeyword { keyword },
425 );
413 cx.emit_span_lint(EXISTING_DOC_KEYWORD, attr.span, NonExistentDocKeyword {
414 keyword,
415 });
426416 }
427417 }
428418 }
......@@ -625,11 +615,9 @@ impl LateLintPass<'_> for BadOptAccess {
625615 && let Some(lit) = item.lit()
626616 && let ast::LitKind::Str(val, _) = lit.kind
627617 {
628 cx.emit_span_lint(
629 BAD_OPT_ACCESS,
630 expr.span,
631 BadOptAccessDiag { msg: val.as_str() },
632 );
618 cx.emit_span_lint(BAD_OPT_ACCESS, expr.span, BadOptAccessDiag {
619 msg: val.as_str(),
620 });
633621 }
634622 }
635623 }
compiler/rustc_lint/src/late.rs+3-3
......@@ -18,14 +18,14 @@ use std::any::Any;
1818use std::cell::Cell;
1919
2020use rustc_data_structures::stack::ensure_sufficient_stack;
21use rustc_data_structures::sync::{join, Lrc};
21use rustc_data_structures::sync::{Lrc, join};
2222use rustc_hir as hir;
2323use rustc_hir::def_id::{LocalDefId, LocalModDefId};
24use rustc_hir::{intravisit as hir_visit, HirId};
24use rustc_hir::{HirId, intravisit as hir_visit};
2525use rustc_middle::hir::nested_filter;
2626use rustc_middle::ty::{self, TyCtxt};
27use rustc_session::lint::LintPass;
2827use rustc_session::Session;
28use rustc_session::lint::LintPass;
2929use rustc_span::Span;
3030use tracing::debug;
3131
compiler/rustc_lint/src/let_underscore.rs+5-6
......@@ -2,7 +2,7 @@ use rustc_errors::MultiSpan;
22use rustc_hir as hir;
33use rustc_middle::ty;
44use rustc_session::{declare_lint, declare_lint_pass};
5use rustc_span::{sym, Symbol};
5use rustc_span::{Symbol, sym};
66
77use crate::lints::{NonBindingLet, NonBindingLetSub};
88use crate::{LateContext, LateLintPass, LintContext};
......@@ -156,11 +156,10 @@ impl<'tcx> LateLintPass<'tcx> for LetUnderscore {
156156 };
157157 if is_sync_lock {
158158 let span = MultiSpan::from_span(pat.span);
159 cx.emit_span_lint(
160 LET_UNDERSCORE_LOCK,
161 span,
162 NonBindingLet::SyncLock { sub, pat: pat.span },
163 );
159 cx.emit_span_lint(LET_UNDERSCORE_LOCK, span, NonBindingLet::SyncLock {
160 sub,
161 pat: pat.span,
162 });
164163 // Only emit let_underscore_drop for top-level `_` patterns.
165164 } else if can_use_init.is_some() {
166165 cx.emit_span_lint(LET_UNDERSCORE_DROP, local.span, NonBindingLet::DropType { sub });
compiler/rustc_lint/src/levels.rs+6-6
......@@ -2,25 +2,25 @@ use rustc_ast_pretty::pprust;
22use rustc_data_structures::fx::FxIndexMap;
33use rustc_errors::{Diag, LintDiagnostic, MultiSpan};
44use rustc_feature::{Features, GateIssue};
5use rustc_hir::intravisit::{self, Visitor};
65use rustc_hir::HirId;
6use rustc_hir::intravisit::{self, Visitor};
77use rustc_index::IndexVec;
88use rustc_middle::bug;
99use rustc_middle::hir::nested_filter;
1010use rustc_middle::lint::{
11 lint_level, reveal_actual_level, LevelAndSource, LintExpectation, LintLevelSource,
12 ShallowLintLevelMap,
11 LevelAndSource, LintExpectation, LintLevelSource, ShallowLintLevelMap, lint_level,
12 reveal_actual_level,
1313};
1414use rustc_middle::query::Providers;
1515use rustc_middle::ty::{RegisteredTools, TyCtxt};
16use rustc_session::Session;
1617use rustc_session::lint::builtin::{
1718 self, FORBIDDEN_LINT_GROUPS, RENAMED_AND_REMOVED_LINTS, SINGLE_USE_LIFETIMES,
1819 UNFULFILLED_LINT_EXPECTATIONS, UNKNOWN_LINTS, UNUSED_ATTRIBUTES,
1920};
2021use rustc_session::lint::{Level, Lint, LintExpectationId, LintId};
21use rustc_session::Session;
22use rustc_span::symbol::{sym, Symbol};
23use rustc_span::{Span, DUMMY_SP};
22use rustc_span::symbol::{Symbol, sym};
23use rustc_span::{DUMMY_SP, Span};
2424use tracing::{debug, instrument};
2525use {rustc_ast as ast, rustc_hir as hir};
2626
compiler/rustc_lint/src/lib.rs+14-19
......@@ -133,7 +133,7 @@ pub use builtin::{MissingDoc, SoftLints};
133133pub use context::{
134134 CheckLintNameResult, EarlyContext, FindLintError, LateContext, LintContext, LintStore,
135135};
136pub use early::{check_ast_node, EarlyCheckNode};
136pub use early::{EarlyCheckNode, check_ast_node};
137137pub use late::{check_crate, late_lint_mod, unerased_lint_store};
138138pub use passes::{EarlyLintPass, LateLintPass};
139139pub use rustc_session::lint::Level::{self, *};
......@@ -618,24 +618,19 @@ fn register_internals(store: &mut LintStore) {
618618 // `DIAGNOSTIC_OUTSIDE_OF_IMPL` here because `-Wrustc::internal` is provided to every crate and
619619 // these lints will trigger all of the time - change this once migration to diagnostic structs
620620 // and translation is completed
621 store.register_group(
622 false,
623 "rustc::internal",
624 None,
625 vec![
626 LintId::of(DEFAULT_HASH_TYPES),
627 LintId::of(POTENTIAL_QUERY_INSTABILITY),
628 LintId::of(UNTRACKED_QUERY_INFORMATION),
629 LintId::of(USAGE_OF_TY_TYKIND),
630 LintId::of(PASS_BY_VALUE),
631 LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
632 LintId::of(USAGE_OF_QUALIFIED_TY),
633 LintId::of(NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT),
634 LintId::of(EXISTING_DOC_KEYWORD),
635 LintId::of(BAD_OPT_ACCESS),
636 LintId::of(SPAN_USE_EQ_CTXT),
637 ],
638 );
621 store.register_group(false, "rustc::internal", None, vec![
622 LintId::of(DEFAULT_HASH_TYPES),
623 LintId::of(POTENTIAL_QUERY_INSTABILITY),
624 LintId::of(UNTRACKED_QUERY_INFORMATION),
625 LintId::of(USAGE_OF_TY_TYKIND),
626 LintId::of(PASS_BY_VALUE),
627 LintId::of(LINT_PASS_IMPL_WITHOUT_MACRO),
628 LintId::of(USAGE_OF_QUALIFIED_TY),
629 LintId::of(NON_GLOB_IMPORT_OF_TYPE_IR_INHERENT),
630 LintId::of(EXISTING_DOC_KEYWORD),
631 LintId::of(BAD_OPT_ACCESS),
632 LintId::of(SPAN_USE_EQ_CTXT),
633 ]);
639634}
640635
641636#[cfg(test)]
compiler/rustc_lint/src/lints.rs+3-3
......@@ -13,15 +13,15 @@ use rustc_hir::{self as hir, MissingLifetimeKind};
1313use rustc_macros::{LintDiagnostic, Subdiagnostic};
1414use rustc_middle::ty::inhabitedness::InhabitedPredicate;
1515use rustc_middle::ty::{Clause, PolyExistentialTraitRef, Ty, TyCtxt};
16use rustc_session::lint::AmbiguityErrorDiag;
1716use rustc_session::Session;
17use rustc_session::lint::AmbiguityErrorDiag;
1818use rustc_span::edition::Edition;
1919use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
20use rustc_span::{sym, Span, Symbol};
20use rustc_span::{Span, Symbol, sym};
2121
2222use crate::builtin::{InitError, ShorthandAssocTyCollector, TypeAliasBounds};
2323use crate::errors::{OverruledAttributeSub, RequestedLevel};
24use crate::{fluent_generated as fluent, LateContext};
24use crate::{LateContext, fluent_generated as fluent};
2525
2626// array_into_iter.rs
2727#[derive(LintDiagnostic)]
compiler/rustc_lint/src/macro_expr_fragment_specifier_2024_migration.rs+1-1
......@@ -8,8 +8,8 @@ use rustc_span::edition::Edition;
88use rustc_span::sym;
99use tracing::debug;
1010
11use crate::lints::MacroExprFragment2024;
1211use crate::EarlyLintPass;
12use crate::lints::MacroExprFragment2024;
1313
1414declare_lint! {
1515 /// The `edition_2024_expr_fragment_specifier` lint detects the use of
compiler/rustc_lint/src/map_unit_fn.rs+14-28
......@@ -60,39 +60,25 @@ impl<'tcx> LateLintPass<'tcx> for MapUnitFn {
6060 let fn_ty = cx.tcx.fn_sig(id).skip_binder();
6161 let ret_ty = fn_ty.output().skip_binder();
6262 if is_unit_type(ret_ty) {
63 cx.emit_span_lint(
64 MAP_UNIT_FN,
65 span,
66 MappingToUnit {
67 function_label: cx
68 .tcx
69 .span_of_impl(*id)
70 .unwrap_or(default_span),
71 argument_label: args[0].span,
72 map_label: arg_ty.default_span(cx.tcx),
73 suggestion: path.ident.span,
74 replace: "for_each".to_string(),
75 },
76 )
63 cx.emit_span_lint(MAP_UNIT_FN, span, MappingToUnit {
64 function_label: cx.tcx.span_of_impl(*id).unwrap_or(default_span),
65 argument_label: args[0].span,
66 map_label: arg_ty.default_span(cx.tcx),
67 suggestion: path.ident.span,
68 replace: "for_each".to_string(),
69 })
7770 }
7871 } else if let ty::Closure(id, subs) = arg_ty.kind() {
7972 let cl_ty = subs.as_closure().sig();
8073 let ret_ty = cl_ty.output().skip_binder();
8174 if is_unit_type(ret_ty) {
82 cx.emit_span_lint(
83 MAP_UNIT_FN,
84 span,
85 MappingToUnit {
86 function_label: cx
87 .tcx
88 .span_of_impl(*id)
89 .unwrap_or(default_span),
90 argument_label: args[0].span,
91 map_label: arg_ty.default_span(cx.tcx),
92 suggestion: path.ident.span,
93 replace: "for_each".to_string(),
94 },
95 )
75 cx.emit_span_lint(MAP_UNIT_FN, span, MappingToUnit {
76 function_label: cx.tcx.span_of_impl(*id).unwrap_or(default_span),
77 argument_label: args[0].span,
78 map_label: arg_ty.default_span(cx.tcx),
79 suggestion: path.ident.span,
80 replace: "for_each".to_string(),
81 })
9682 }
9783 }
9884 }
compiler/rustc_lint/src/methods.rs+5-6
......@@ -1,8 +1,8 @@
11use rustc_hir::{Expr, ExprKind};
22use rustc_middle::ty;
33use rustc_session::{declare_lint, declare_lint_pass};
4use rustc_span::symbol::sym;
54use rustc_span::Span;
5use rustc_span::symbol::sym;
66
77use crate::lints::CStringPtr;
88use crate::{LateContext, LateLintPass, LintContext};
......@@ -58,11 +58,10 @@ fn lint_cstring_as_ptr(
5858 if cx.tcx.is_diagnostic_item(sym::Result, def.did()) {
5959 if let ty::Adt(adt, _) = args.type_at(0).kind() {
6060 if cx.tcx.is_diagnostic_item(sym::cstring_type, adt.did()) {
61 cx.emit_span_lint(
62 TEMPORARY_CSTRING_AS_PTR,
63 as_ptr_span,
64 CStringPtr { as_ptr: as_ptr_span, unwrap: unwrap.span },
65 );
61 cx.emit_span_lint(TEMPORARY_CSTRING_AS_PTR, as_ptr_span, CStringPtr {
62 as_ptr: as_ptr_span,
63 unwrap: unwrap.span,
64 });
6665 }
6766 }
6867 }
compiler/rustc_lint/src/non_ascii_idents.rs+20-33
......@@ -209,30 +209,22 @@ impl EarlyLintPass for NonAsciiIdents {
209209 if codepoints.is_empty() {
210210 continue;
211211 }
212 cx.emit_span_lint(
213 UNCOMMON_CODEPOINTS,
214 sp,
215 IdentifierUncommonCodepoints {
216 codepoints_len: codepoints.len(),
217 codepoints: codepoints.into_iter().map(|(c, _)| c).collect(),
218 identifier_type: id_ty_descr,
219 },
220 );
212 cx.emit_span_lint(UNCOMMON_CODEPOINTS, sp, IdentifierUncommonCodepoints {
213 codepoints_len: codepoints.len(),
214 codepoints: codepoints.into_iter().map(|(c, _)| c).collect(),
215 identifier_type: id_ty_descr,
216 });
221217 }
222218
223219 let remaining = chars
224220 .extract_if(|(c, _)| !GeneralSecurityProfile::identifier_allowed(*c))
225221 .collect::<Vec<_>>();
226222 if !remaining.is_empty() {
227 cx.emit_span_lint(
228 UNCOMMON_CODEPOINTS,
229 sp,
230 IdentifierUncommonCodepoints {
231 codepoints_len: remaining.len(),
232 codepoints: remaining.into_iter().map(|(c, _)| c).collect(),
233 identifier_type: "Restricted",
234 },
235 );
223 cx.emit_span_lint(UNCOMMON_CODEPOINTS, sp, IdentifierUncommonCodepoints {
224 codepoints_len: remaining.len(),
225 codepoints: remaining.into_iter().map(|(c, _)| c).collect(),
226 identifier_type: "Restricted",
227 });
236228 }
237229 }
238230 }
......@@ -261,16 +253,12 @@ impl EarlyLintPass for NonAsciiIdents {
261253 .entry(skeleton_sym)
262254 .and_modify(|(existing_symbol, existing_span, existing_is_ascii)| {
263255 if !*existing_is_ascii || !is_ascii {
264 cx.emit_span_lint(
265 CONFUSABLE_IDENTS,
266 sp,
267 ConfusableIdentifierPair {
268 existing_sym: *existing_symbol,
269 sym: symbol,
270 label: *existing_span,
271 main_label: sp,
272 },
273 );
256 cx.emit_span_lint(CONFUSABLE_IDENTS, sp, ConfusableIdentifierPair {
257 existing_sym: *existing_symbol,
258 sym: symbol,
259 label: *existing_span,
260 main_label: sp,
261 });
274262 }
275263 if *existing_is_ascii && !is_ascii {
276264 *existing_symbol = symbol;
......@@ -382,11 +370,10 @@ impl EarlyLintPass for NonAsciiIdents {
382370 let char_info = format!("'{}' (U+{:04X})", ch, ch as u32);
383371 includes += &char_info;
384372 }
385 cx.emit_span_lint(
386 MIXED_SCRIPT_CONFUSABLES,
387 sp,
388 MixedScriptConfusables { set: script_set.to_string(), includes },
389 );
373 cx.emit_span_lint(MIXED_SCRIPT_CONFUSABLES, sp, MixedScriptConfusables {
374 set: script_set.to_string(),
375 includes,
376 });
390377 }
391378 }
392379 }
compiler/rustc_lint/src/non_fmt_panic.rs+6-10
......@@ -9,11 +9,11 @@ use rustc_session::lint::FutureIncompatibilityReason;
99use rustc_session::{declare_lint, declare_lint_pass};
1010use rustc_span::edition::Edition;
1111use rustc_span::symbol::kw;
12use rustc_span::{hygiene, sym, InnerSpan, Span, Symbol};
12use rustc_span::{InnerSpan, Span, Symbol, hygiene, sym};
1313use rustc_trait_selection::infer::InferCtxtExt;
1414
1515use crate::lints::{NonFmtPanicBraces, NonFmtPanicUnused};
16use crate::{fluent_generated as fluent, LateContext, LateLintPass, LintContext};
16use crate::{LateContext, LateLintPass, LintContext, fluent_generated as fluent};
1717
1818declare_lint! {
1919 /// The `non_fmt_panics` lint detects `panic!(..)` invocations where the first
......@@ -255,14 +255,10 @@ fn check_panic_str<'tcx>(
255255 .map(|span| fmt_span.from_inner(InnerSpan::new(span.start, span.end)))
256256 .collect(),
257257 };
258 cx.emit_span_lint(
259 NON_FMT_PANICS,
260 arg_spans,
261 NonFmtPanicUnused {
262 count: n_arguments,
263 suggestion: is_arg_inside_call(arg.span, span).then_some(arg.span),
264 },
265 );
258 cx.emit_span_lint(NON_FMT_PANICS, arg_spans, NonFmtPanicUnused {
259 count: n_arguments,
260 suggestion: is_arg_inside_call(arg.span, span).then_some(arg.span),
261 });
266262 } else {
267263 let brace_spans: Option<Vec<_>> =
268264 snippet.filter(|s| s.starts_with('"') || s.starts_with("r#")).map(|s| {
compiler/rustc_lint/src/non_local_def.rs+19-23
......@@ -10,14 +10,14 @@ use rustc_middle::ty::{
1010use rustc_session::{declare_lint, impl_lint_pass};
1111use rustc_span::def_id::{DefId, LOCAL_CRATE};
1212use rustc_span::symbol::kw;
13use rustc_span::{sym, ExpnKind, MacroKind, Span, Symbol};
13use rustc_span::{ExpnKind, MacroKind, Span, Symbol, sym};
1414use rustc_trait_selection::error_reporting::traits::ambiguity::{
15 compute_applicable_impls_for_diagnostics, CandidateSource,
15 CandidateSource, compute_applicable_impls_for_diagnostics,
1616};
1717use rustc_trait_selection::infer::TyCtxtInferExt;
1818
1919use crate::lints::{NonLocalDefinitionsCargoUpdateNote, NonLocalDefinitionsDiag};
20use crate::{fluent_generated as fluent, LateContext, LateLintPass, LintContext};
20use crate::{LateContext, LateLintPass, LintContext, fluent_generated as fluent};
2121
2222declare_lint! {
2323 /// The `non_local_definitions` lint checks for `impl` blocks and `#[macro_export]`
......@@ -277,26 +277,22 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
277277 None
278278 };
279279
280 cx.emit_span_lint(
281 NON_LOCAL_DEFINITIONS,
282 ms,
283 NonLocalDefinitionsDiag::Impl {
284 depth: self.body_depth,
285 body_kind_descr: cx.tcx.def_kind_descr(parent_def_kind, parent),
286 body_name: parent_opt_item_name
287 .map(|s| s.to_ident_string())
288 .unwrap_or_else(|| "<unnameable>".to_string()),
289 cargo_update: cargo_update(),
290 const_anon,
291 self_ty_str,
292 of_trait_str,
293 move_to,
294 doctest,
295 may_remove,
296 has_trait: impl_.of_trait.is_some(),
297 macro_to_change,
298 },
299 )
280 cx.emit_span_lint(NON_LOCAL_DEFINITIONS, ms, NonLocalDefinitionsDiag::Impl {
281 depth: self.body_depth,
282 body_kind_descr: cx.tcx.def_kind_descr(parent_def_kind, parent),
283 body_name: parent_opt_item_name
284 .map(|s| s.to_ident_string())
285 .unwrap_or_else(|| "<unnameable>".to_string()),
286 cargo_update: cargo_update(),
287 const_anon,
288 self_ty_str,
289 of_trait_str,
290 move_to,
291 doctest,
292 may_remove,
293 has_trait: impl_.of_trait.is_some(),
294 macro_to_change,
295 })
300296 }
301297 ItemKind::Macro(_macro, MacroKind::Bang)
302298 if cx.tcx.has_attr(item.owner_id.def_id, sym::macro_export) =>
compiler/rustc_lint/src/nonstandard_style.rs+11-11
......@@ -5,7 +5,7 @@ use rustc_middle::ty;
55use rustc_session::config::CrateType;
66use rustc_session::{declare_lint, declare_lint_pass};
77use rustc_span::def_id::LocalDefId;
8use rustc_span::symbol::{sym, Ident};
8use rustc_span::symbol::{Ident, sym};
99use rustc_span::{BytePos, Span};
1010use rustc_target::spec::abi::Abi;
1111use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
......@@ -151,11 +151,11 @@ impl NonCamelCaseTypes {
151151 } else {
152152 NonCamelCaseTypeSub::Label { span: ident.span }
153153 };
154 cx.emit_span_lint(
155 NON_CAMEL_CASE_TYPES,
156 ident.span,
157 NonCamelCaseType { sort, name, sub },
158 );
154 cx.emit_span_lint(NON_CAMEL_CASE_TYPES, ident.span, NonCamelCaseType {
155 sort,
156 name,
157 sub,
158 });
159159 }
160160 }
161161}
......@@ -489,11 +489,11 @@ impl NonUpperCaseGlobals {
489489 } else {
490490 NonUpperCaseGlobalSub::Label { span: ident.span }
491491 };
492 cx.emit_span_lint(
493 NON_UPPER_CASE_GLOBALS,
494 ident.span,
495 NonUpperCaseGlobal { sort, name, sub },
496 );
492 cx.emit_span_lint(NON_UPPER_CASE_GLOBALS, ident.span, NonUpperCaseGlobal {
493 sort,
494 name,
495 sub,
496 });
497497 }
498498 }
499499}
compiler/rustc_lint/src/noop_method_call.rs+7-11
......@@ -128,17 +128,13 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
128128 ty::Adt(def, _) => Some(cx.tcx.def_span(def.did()).shrink_to_lo()),
129129 _ => None,
130130 };
131 cx.emit_span_lint(
132 NOOP_METHOD_CALL,
133 span,
134 NoopMethodCallDiag {
135 method: call.ident.name,
136 orig_ty,
137 trait_,
138 label: span,
139 suggest_derive,
140 },
141 );
131 cx.emit_span_lint(NOOP_METHOD_CALL, span, NoopMethodCallDiag {
132 method: call.ident.name,
133 orig_ty,
134 trait_,
135 label: span,
136 suggest_derive,
137 });
142138 } else {
143139 match name {
144140 // If `type_of(x) == T` and `x.borrow()` is used to get `&T`,
compiler/rustc_lint/src/opaque_hidden_inferred_bound.rs+1-1
......@@ -5,8 +5,8 @@ use rustc_middle::ty::fold::BottomUpFolder;
55use rustc_middle::ty::print::{PrintTraitPredicateExt as _, TraitPredPrintModifiersAndPath};
66use rustc_middle::ty::{self, Ty, TypeFoldable};
77use rustc_session::{declare_lint, declare_lint_pass};
8use rustc_span::symbol::kw;
98use rustc_span::Span;
9use rustc_span::symbol::kw;
1010use rustc_trait_selection::traits::{self, ObligationCtxt};
1111
1212use crate::{LateContext, LateLintPass, LintContext};
compiler/rustc_lint/src/pass_by_value.rs+4-5
......@@ -31,11 +31,10 @@ impl<'tcx> LateLintPass<'tcx> for PassByValue {
3131 }
3232 }
3333 if let Some(t) = path_for_pass_by_value(cx, inner_ty) {
34 cx.emit_span_lint(
35 PASS_BY_VALUE,
36 ty.span,
37 PassByValueDiag { ty: t, suggestion: ty.span },
38 );
34 cx.emit_span_lint(PASS_BY_VALUE, ty.span, PassByValueDiag {
35 ty: t,
36 suggestion: ty.span,
37 });
3938 }
4039 }
4140 _ => {}
compiler/rustc_lint/src/passes.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_session::lint::builtin::HardwiredLints;
21use rustc_session::lint::LintPass;
2use rustc_session::lint::builtin::HardwiredLints;
33
44use crate::context::{EarlyContext, LateContext};
55
compiler/rustc_lint/src/redundant_semicolon.rs+4-5
......@@ -50,10 +50,9 @@ fn maybe_lint_redundant_semis(cx: &EarlyContext<'_>, seq: &mut Option<(Span, boo
5050 return;
5151 }
5252
53 cx.emit_span_lint(
54 REDUNDANT_SEMICOLONS,
55 span,
56 RedundantSemicolonsDiag { multiple, suggestion: span },
57 );
53 cx.emit_span_lint(REDUNDANT_SEMICOLONS, span, RedundantSemicolonsDiag {
54 multiple,
55 suggestion: span,
56 });
5857 }
5958}
compiler/rustc_lint/src/shadowed_into_iter.rs+6-5
......@@ -146,10 +146,11 @@ impl<'tcx> LateLintPass<'tcx> for ShadowedIntoIter {
146146 None
147147 };
148148
149 cx.emit_span_lint(
150 lint,
151 call.ident.span,
152 ShadowedIntoIterDiag { target, edition, suggestion: call.ident.span, sub },
153 );
149 cx.emit_span_lint(lint, call.ident.span, ShadowedIntoIterDiag {
150 target,
151 edition,
152 suggestion: call.ident.span,
153 sub,
154 });
154155 }
155156}
compiler/rustc_lint/src/static_mut_refs.rs+7-5
......@@ -3,8 +3,8 @@ use rustc_hir::{Expr, Stmt};
33use rustc_middle::ty::{Mutability, TyKind};
44use rustc_session::lint::FutureIncompatibilityReason;
55use rustc_session::{declare_lint, declare_lint_pass};
6use rustc_span::edition::Edition;
76use rustc_span::Span;
7use rustc_span::edition::Edition;
88
99use crate::lints::{MutRefSugg, RefOfMutStatic};
1010use crate::{LateContext, LateLintPass, LintContext};
......@@ -146,9 +146,11 @@ fn emit_static_mut_refs(
146146 }
147147 };
148148
149 cx.emit_span_lint(
150 STATIC_MUT_REFS,
149 cx.emit_span_lint(STATIC_MUT_REFS, span, RefOfMutStatic {
151150 span,
152 RefOfMutStatic { span, sugg, shared_label, shared_note, mut_note },
153 );
151 sugg,
152 shared_label,
153 shared_note,
154 mut_note,
155 });
154156}
compiler/rustc_lint/src/tail_expr_drop_order.rs+1-1
......@@ -8,8 +8,8 @@ use rustc_macros::LintDiagnostic;
88use rustc_middle::ty;
99use rustc_session::lint::FutureIncompatibilityReason;
1010use rustc_session::{declare_lint, declare_lint_pass};
11use rustc_span::edition::Edition;
1211use rustc_span::Span;
12use rustc_span::edition::Edition;
1313
1414use crate::{LateContext, LateLintPass};
1515
compiler/rustc_lint/src/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use rustc_span::{create_default_session_globals_then, Symbol};
1use rustc_span::{Symbol, create_default_session_globals_then};
22
33use crate::levels::parse_lint_and_tool_name;
44
compiler/rustc_lint/src/traits.rs+5-5
......@@ -101,11 +101,11 @@ impl<'tcx> LateLintPass<'tcx> for DropTraitConstraints {
101101 continue;
102102 }
103103 let Some(def_id) = cx.tcx.get_diagnostic_item(sym::needs_drop) else { return };
104 cx.emit_span_lint(
105 DROP_BOUNDS,
106 span,
107 DropTraitConstraintsDiag { predicate, tcx: cx.tcx, def_id },
108 );
104 cx.emit_span_lint(DROP_BOUNDS, span, DropTraitConstraintsDiag {
105 predicate,
106 tcx: cx.tcx,
107 def_id,
108 });
109109 }
110110 }
111111 }
compiler/rustc_lint/src/types.rs+22-22
......@@ -12,7 +12,7 @@ use rustc_middle::ty::{
1212use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
1313use rustc_span::def_id::LocalDefId;
1414use rustc_span::symbol::sym;
15use rustc_span::{source_map, Span, Symbol};
15use rustc_span::{Span, Symbol, source_map};
1616use rustc_target::abi::{Abi, TagEncoding, Variants, WrappingRange};
1717use rustc_target::spec::abi::Abi as SpecAbi;
1818use tracing::debug;
......@@ -24,7 +24,7 @@ use crate::lints::{
2424 AtomicOrderingStore, ImproperCTypes, InvalidAtomicOrderingDiag, InvalidNanComparisons,
2525 InvalidNanComparisonsSuggestion, UnusedComparisons, VariantSizeDifferencesDiag,
2626};
27use crate::{fluent_generated as fluent, LateContext, LateLintPass, LintContext};
27use crate::{LateContext, LateLintPass, LintContext, fluent_generated as fluent};
2828
2929mod literal;
3030
......@@ -434,16 +434,13 @@ impl<'tcx> LateLintPass<'tcx> for TypeLimits {
434434 }
435435
436436 fn rev_binop(binop: hir::BinOp) -> hir::BinOp {
437 source_map::respan(
438 binop.span,
439 match binop.node {
440 hir::BinOpKind::Lt => hir::BinOpKind::Gt,
441 hir::BinOpKind::Le => hir::BinOpKind::Ge,
442 hir::BinOpKind::Gt => hir::BinOpKind::Lt,
443 hir::BinOpKind::Ge => hir::BinOpKind::Le,
444 _ => return binop,
445 },
446 )
437 source_map::respan(binop.span, match binop.node {
438 hir::BinOpKind::Lt => hir::BinOpKind::Gt,
439 hir::BinOpKind::Le => hir::BinOpKind::Ge,
440 hir::BinOpKind::Gt => hir::BinOpKind::Lt,
441 hir::BinOpKind::Ge => hir::BinOpKind::Le,
442 _ => return binop,
443 })
447444 }
448445
449446 fn check_limits(
......@@ -1193,11 +1190,14 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
11931190 } else {
11941191 None
11951192 };
1196 self.cx.emit_span_lint(
1197 lint,
1198 sp,
1199 ImproperCTypes { ty, desc, label: sp, help, note, span_note },
1200 );
1193 self.cx.emit_span_lint(lint, sp, ImproperCTypes {
1194 ty,
1195 desc,
1196 label: sp,
1197 help,
1198 note,
1199 span_note,
1200 });
12011201 }
12021202
12031203 fn check_for_opaque_ty(&mut self, sp: Span, ty: Ty<'tcx>) -> bool {
......@@ -1666,11 +1666,11 @@ impl InvalidAtomicOrdering {
16661666 }
16671667
16681668 fn check_atomic_compare_exchange(cx: &LateContext<'_>, expr: &Expr<'_>) {
1669 let Some((method, args)) = Self::inherent_atomic_method_call(
1670 cx,
1671 expr,
1672 &[sym::fetch_update, sym::compare_exchange, sym::compare_exchange_weak],
1673 ) else {
1669 let Some((method, args)) = Self::inherent_atomic_method_call(cx, expr, &[
1670 sym::fetch_update,
1671 sym::compare_exchange,
1672 sym::compare_exchange_weak,
1673 ]) else {
16741674 return;
16751675 };
16761676
compiler/rustc_lint/src/types/literal.rs+46-58
......@@ -1,18 +1,18 @@
1use hir::{is_range_literal, ExprKind, Node};
2use rustc_middle::ty::layout::IntegerExt;
1use hir::{ExprKind, Node, is_range_literal};
32use rustc_middle::ty::Ty;
3use rustc_middle::ty::layout::IntegerExt;
44use rustc_middle::{bug, ty};
55use rustc_target::abi::{Integer, Size};
66use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
77
8use crate::LateContext;
89use crate::context::LintContext;
910use crate::lints::{
1011 OnlyCastu8ToChar, OverflowingBinHex, OverflowingBinHexSign, OverflowingBinHexSignBitSub,
1112 OverflowingBinHexSub, OverflowingInt, OverflowingIntHelp, OverflowingLiteral, OverflowingUInt,
1213 RangeEndpointOutOfRange, UseInclusiveRange,
1314};
14use crate::types::{TypeLimits, OVERFLOWING_LITERALS};
15use crate::LateContext;
15use crate::types::{OVERFLOWING_LITERALS, TypeLimits};
1616
1717/// Attempts to special-case the overflowing literal lint when it occurs as a range endpoint (`expr..MAX+1`).
1818/// Returns `true` iff the lint was emitted.
......@@ -74,11 +74,10 @@ fn lint_overflowing_range_endpoint<'tcx>(
7474 }
7575 };
7676
77 cx.emit_span_lint(
78 OVERFLOWING_LITERALS,
79 struct_expr.span,
80 RangeEndpointOutOfRange { ty, sub: sub_sugg },
81 );
77 cx.emit_span_lint(OVERFLOWING_LITERALS, struct_expr.span, RangeEndpointOutOfRange {
78 ty,
79 sub: sub_sugg,
80 });
8281
8382 // We've just emitted a lint, special cased for `(...)..MAX+1` ranges,
8483 // return `true` so the callers don't also emit a lint
......@@ -187,19 +186,15 @@ fn report_bin_hex_error(
187186 })
188187 .flatten();
189188
190 cx.emit_span_lint(
191 OVERFLOWING_LITERALS,
192 expr.span,
193 OverflowingBinHex {
194 ty: t,
195 lit: repr_str.clone(),
196 dec: val,
197 actually,
198 sign,
199 sub,
200 sign_bit_sub,
201 },
202 )
189 cx.emit_span_lint(OVERFLOWING_LITERALS, expr.span, OverflowingBinHex {
190 ty: t,
191 lit: repr_str.clone(),
192 dec: val,
193 actually,
194 sign,
195 sub,
196 sign_bit_sub,
197 })
203198}
204199
205200// Find the "next" fitting integer and return a suggestion string
......@@ -266,11 +261,13 @@ fn lint_int_literal<'tcx>(
266261 let help = get_type_suggestion(cx.typeck_results().node_type(e.hir_id), v, negative)
267262 .map(|suggestion_ty| OverflowingIntHelp { suggestion_ty });
268263
269 cx.emit_span_lint(
270 OVERFLOWING_LITERALS,
271 span,
272 OverflowingInt { ty: t.name_str(), lit, min, max, help },
273 );
264 cx.emit_span_lint(OVERFLOWING_LITERALS, span, OverflowingInt {
265 ty: t.name_str(),
266 lit,
267 min,
268 max,
269 help,
270 });
274271 }
275272}
276273
......@@ -294,11 +291,10 @@ fn lint_uint_literal<'tcx>(
294291 match par_e.kind {
295292 hir::ExprKind::Cast(..) => {
296293 if let ty::Char = cx.typeck_results().expr_ty(par_e).kind() {
297 cx.emit_span_lint(
298 OVERFLOWING_LITERALS,
299 par_e.span,
300 OnlyCastu8ToChar { span: par_e.span, literal: lit_val },
301 );
294 cx.emit_span_lint(OVERFLOWING_LITERALS, par_e.span, OnlyCastu8ToChar {
295 span: par_e.span,
296 literal: lit_val,
297 });
302298 return;
303299 }
304300 }
......@@ -321,20 +317,16 @@ fn lint_uint_literal<'tcx>(
321317 );
322318 return;
323319 }
324 cx.emit_span_lint(
325 OVERFLOWING_LITERALS,
326 e.span,
327 OverflowingUInt {
328 ty: t.name_str(),
329 lit: cx
330 .sess()
331 .source_map()
332 .span_to_snippet(lit.span)
333 .unwrap_or_else(|_| lit_val.to_string()),
334 min,
335 max,
336 },
337 );
320 cx.emit_span_lint(OVERFLOWING_LITERALS, e.span, OverflowingUInt {
321 ty: t.name_str(),
322 lit: cx
323 .sess()
324 .source_map()
325 .span_to_snippet(lit.span)
326 .unwrap_or_else(|_| lit_val.to_string()),
327 min,
328 max,
329 });
338330 }
339331}
340332
......@@ -367,18 +359,14 @@ pub(crate) fn lint_literal<'tcx>(
367359 _ => bug!(),
368360 };
369361 if is_infinite == Ok(true) {
370 cx.emit_span_lint(
371 OVERFLOWING_LITERALS,
372 e.span,
373 OverflowingLiteral {
374 ty: t.name_str(),
375 lit: cx
376 .sess()
377 .source_map()
378 .span_to_snippet(lit.span)
379 .unwrap_or_else(|_| sym.to_string()),
380 },
381 );
362 cx.emit_span_lint(OVERFLOWING_LITERALS, e.span, OverflowingLiteral {
363 ty: t.name_str(),
364 lit: cx
365 .sess()
366 .source_map()
367 .span_to_snippet(lit.span)
368 .unwrap_or_else(|_| sym.to_string()),
369 });
382370 }
383371 }
384372 _ => {}
compiler/rustc_lint/src/unit_bindings.rs+3-5
......@@ -63,11 +63,9 @@ impl<'tcx> LateLintPass<'tcx> for UnitBindings {
6363 && !matches!(init.kind, hir::ExprKind::Tup([]))
6464 && !matches!(local.pat.kind, hir::PatKind::Tuple([], ..))
6565 {
66 cx.emit_span_lint(
67 UNIT_BINDINGS,
68 local.span,
69 UnitBindingsDiag { label: local.pat.span },
70 );
66 cx.emit_span_lint(UNIT_BINDINGS, local.span, UnitBindingsDiag {
67 label: local.pat.span,
68 });
7169 }
7270 }
7371}
compiler/rustc_lint/src/unused.rs+48-58
......@@ -4,14 +4,14 @@ use std::ops::ControlFlow;
44use rustc_ast as ast;
55use rustc_ast::util::{classify, parser};
66use rustc_ast::{ExprKind, StmtKind};
7use rustc_errors::{pluralize, MultiSpan};
7use rustc_errors::{MultiSpan, pluralize};
88use rustc_hir::def::{DefKind, Res};
99use rustc_hir::def_id::DefId;
1010use rustc_hir::{self as hir, LangItem};
1111use rustc_infer::traits::util::elaborate;
12use rustc_middle::ty::{self, adjustment, Ty};
12use rustc_middle::ty::{self, Ty, adjustment};
1313use rustc_session::{declare_lint, declare_lint_pass, impl_lint_pass};
14use rustc_span::symbol::{kw, sym, Symbol};
14use rustc_span::symbol::{Symbol, kw, sym};
1515use rustc_span::{BytePos, Span};
1616use tracing::instrument;
1717
......@@ -185,22 +185,18 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
185185 let mut op_warned = false;
186186
187187 if let Some(must_use_op) = must_use_op {
188 cx.emit_span_lint(
189 UNUSED_MUST_USE,
190 expr.span,
191 UnusedOp {
192 op: must_use_op,
193 label: expr.span,
194 suggestion: if expr_is_from_block {
195 UnusedOpSuggestion::BlockTailExpr {
196 before_span: expr.span.shrink_to_lo(),
197 after_span: expr.span.shrink_to_hi(),
198 }
199 } else {
200 UnusedOpSuggestion::NormalExpr { span: expr.span.shrink_to_lo() }
201 },
188 cx.emit_span_lint(UNUSED_MUST_USE, expr.span, UnusedOp {
189 op: must_use_op,
190 label: expr.span,
191 suggestion: if expr_is_from_block {
192 UnusedOpSuggestion::BlockTailExpr {
193 before_span: expr.span.shrink_to_lo(),
194 after_span: expr.span.shrink_to_hi(),
195 }
196 } else {
197 UnusedOpSuggestion::NormalExpr { span: expr.span.shrink_to_lo() }
202198 },
203 );
199 });
204200 op_warned = true;
205201 }
206202
......@@ -497,39 +493,35 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
497493 );
498494 }
499495 MustUsePath::Closure(span) => {
500 cx.emit_span_lint(
501 UNUSED_MUST_USE,
502 *span,
503 UnusedClosure { count: plural_len, pre: descr_pre, post: descr_post },
504 );
496 cx.emit_span_lint(UNUSED_MUST_USE, *span, UnusedClosure {
497 count: plural_len,
498 pre: descr_pre,
499 post: descr_post,
500 });
505501 }
506502 MustUsePath::Coroutine(span) => {
507 cx.emit_span_lint(
508 UNUSED_MUST_USE,
509 *span,
510 UnusedCoroutine { count: plural_len, pre: descr_pre, post: descr_post },
511 );
503 cx.emit_span_lint(UNUSED_MUST_USE, *span, UnusedCoroutine {
504 count: plural_len,
505 pre: descr_pre,
506 post: descr_post,
507 });
512508 }
513509 MustUsePath::Def(span, def_id, reason) => {
514 cx.emit_span_lint(
515 UNUSED_MUST_USE,
516 *span,
517 UnusedDef {
518 pre: descr_pre,
519 post: descr_post,
520 cx,
521 def_id: *def_id,
522 note: *reason,
523 suggestion: (!is_inner).then_some(if expr_is_from_block {
524 UnusedDefSuggestion::BlockTailExpr {
525 before_span: span.shrink_to_lo(),
526 after_span: span.shrink_to_hi(),
527 }
528 } else {
529 UnusedDefSuggestion::NormalExpr { span: span.shrink_to_lo() }
530 }),
531 },
532 );
510 cx.emit_span_lint(UNUSED_MUST_USE, *span, UnusedDef {
511 pre: descr_pre,
512 post: descr_post,
513 cx,
514 def_id: *def_id,
515 note: *reason,
516 suggestion: (!is_inner).then_some(if expr_is_from_block {
517 UnusedDefSuggestion::BlockTailExpr {
518 before_span: span.shrink_to_lo(),
519 after_span: span.shrink_to_hi(),
520 }
521 } else {
522 UnusedDefSuggestion::NormalExpr { span: span.shrink_to_lo() }
523 }),
524 });
533525 }
534526 }
535527 }
......@@ -791,7 +783,7 @@ trait UnusedDelimLint {
791783 // ```
792784 // fn f(){(print!(á
793785 // ```
794 use rustc_ast::visit::{walk_expr, Visitor};
786 use rustc_ast::visit::{Visitor, walk_expr};
795787 struct ErrExprVisitor;
796788 impl<'ast> Visitor<'ast> for ErrExprVisitor {
797789 type Result = ControlFlow<()>;
......@@ -869,11 +861,11 @@ trait UnusedDelimLint {
869861 end_replace: hi_replace,
870862 }
871863 });
872 cx.emit_span_lint(
873 self.lint(),
874 primary_span,
875 UnusedDelim { delim: Self::DELIM_STR, item: msg, suggestion },
876 );
864 cx.emit_span_lint(self.lint(), primary_span, UnusedDelim {
865 delim: Self::DELIM_STR,
866 item: msg,
867 suggestion,
868 });
877869 }
878870
879871 fn check_expr(&mut self, cx: &EarlyContext<'_>, e: &ast::Expr) {
......@@ -1558,11 +1550,9 @@ impl UnusedImportBraces {
15581550 ast::UseTreeKind::Nested { .. } => return,
15591551 };
15601552
1561 cx.emit_span_lint(
1562 UNUSED_IMPORT_BRACES,
1563 item.span,
1564 UnusedImportBracesDiag { node: node_name },
1565 );
1553 cx.emit_span_lint(UNUSED_IMPORT_BRACES, item.span, UnusedImportBracesDiag {
1554 node: node_name,
1555 });
15661556 }
15671557 }
15681558}
compiler/rustc_lint_defs/src/builtin.rs+1-1
......@@ -9,7 +9,7 @@
99
1010use rustc_span::edition::Edition;
1111
12use crate::{declare_lint, declare_lint_pass, FutureIncompatibilityReason};
12use crate::{FutureIncompatibilityReason, declare_lint, declare_lint_pass};
1313
1414declare_lint_pass! {
1515 /// Does nothing as a lint pass, but registers some `Lint`s
compiler/rustc_lint_defs/src/lib.rs+1-1
......@@ -14,7 +14,7 @@ use rustc_hir::{HashStableContext, HirId, MissingLifetimeKind};
1414use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1515pub use rustc_span::edition::Edition;
1616use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
17use rustc_span::{sym, Span, Symbol};
17use rustc_span::{Span, Symbol, sym};
1818use rustc_target::spec::abi::Abi;
1919use serde::{Deserialize, Serialize};
2020
compiler/rustc_log/src/lib.rs+1-1
......@@ -44,8 +44,8 @@ use std::io::{self, IsTerminal};
4444
4545use tracing_core::{Event, Subscriber};
4646use tracing_subscriber::filter::{Directive, EnvFilter, LevelFilter};
47use tracing_subscriber::fmt::format::{self, FormatEvent, FormatFields};
4847use tracing_subscriber::fmt::FmtContext;
48use tracing_subscriber::fmt::format::{self, FormatEvent, FormatFields};
4949use tracing_subscriber::layer::SubscriberExt;
5050
5151/// The values of all the environment variables that matter for configuring a logger.
compiler/rustc_macros/src/diagnostics/diagnostic.rs+1-1
......@@ -8,7 +8,7 @@ use syn::spanned::Spanned;
88use synstructure::Structure;
99
1010use crate::diagnostics::diagnostic_builder::DiagnosticDeriveKind;
11use crate::diagnostics::error::{span_err, DiagnosticDeriveError};
11use crate::diagnostics::error::{DiagnosticDeriveError, span_err};
1212use crate::diagnostics::utils::SetOnce;
1313
1414/// The central struct for constructing the `into_diag` method from an annotated struct.
compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs+4-4
......@@ -3,17 +3,17 @@
33use proc_macro2::{Ident, Span, TokenStream};
44use quote::{format_ident, quote, quote_spanned};
55use syn::spanned::Spanned;
6use syn::{parse_quote, Attribute, Meta, Path, Token, Type};
6use syn::{Attribute, Meta, Path, Token, Type, parse_quote};
77use synstructure::{BindingInfo, Structure, VariantInfo};
88
99use super::utils::SubdiagnosticVariant;
1010use crate::diagnostics::error::{
11 span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError,
11 DiagnosticDeriveError, span_err, throw_invalid_attr, throw_span_err,
1212};
1313use crate::diagnostics::utils::{
14 FieldInfo, FieldInnerTy, FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind,
1415 build_field_mapping, is_doc_comment, report_error_if_not_applied_to_span, report_type_error,
15 should_generate_arg, type_is_bool, type_is_unit, type_matches_path, FieldInfo, FieldInnerTy,
16 FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind,
16 should_generate_arg, type_is_bool, type_is_unit, type_matches_path,
1717};
1818
1919/// What kind of diagnostic is being derived - a fatal/error/warning or a lint?
compiler/rustc_macros/src/diagnostics/subdiagnostic.rs+5-5
......@@ -8,13 +8,13 @@ use synstructure::{BindingInfo, Structure, VariantInfo};
88
99use super::utils::SubdiagnosticVariant;
1010use crate::diagnostics::error::{
11 invalid_attr, span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError,
11 DiagnosticDeriveError, invalid_attr, span_err, throw_invalid_attr, throw_span_err,
1212};
1313use crate::diagnostics::utils::{
14 build_field_mapping, build_suggestion_code, is_doc_comment, new_code_ident,
15 report_error_if_not_applied_to_applicability, report_error_if_not_applied_to_span,
16 should_generate_arg, AllowMultipleAlternatives, FieldInfo, FieldInnerTy, FieldMap, HasFieldMap,
17 SetOnce, SpannedOption, SubdiagnosticKind,
14 AllowMultipleAlternatives, FieldInfo, FieldInnerTy, FieldMap, HasFieldMap, SetOnce,
15 SpannedOption, SubdiagnosticKind, build_field_mapping, build_suggestion_code, is_doc_comment,
16 new_code_ident, report_error_if_not_applied_to_applicability,
17 report_error_if_not_applied_to_span, should_generate_arg,
1818};
1919
2020/// The central struct for constructing the `add_to_diag` method from an annotated struct.
compiler/rustc_macros/src/diagnostics/utils.rs+3-3
......@@ -5,16 +5,16 @@ use std::str::FromStr;
55
66use proc_macro::Span;
77use proc_macro2::{Ident, TokenStream};
8use quote::{format_ident, quote, ToTokens};
8use quote::{ToTokens, format_ident, quote};
99use syn::meta::ParseNestedMeta;
1010use syn::punctuated::Punctuated;
1111use syn::spanned::Spanned;
12use syn::{parenthesized, Attribute, Field, LitStr, Meta, Path, Token, Type, TypeTuple};
12use syn::{Attribute, Field, LitStr, Meta, Path, Token, Type, TypeTuple, parenthesized};
1313use synstructure::{BindingInfo, VariantInfo};
1414
1515use super::error::invalid_attr;
1616use crate::diagnostics::error::{
17 span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError,
17 DiagnosticDeriveError, span_err, throw_invalid_attr, throw_span_err,
1818};
1919
2020thread_local! {
compiler/rustc_macros/src/extension.rs+3-3
......@@ -4,9 +4,9 @@ use syn::parse::{Parse, ParseStream};
44use syn::punctuated::Punctuated;
55use syn::spanned::Spanned;
66use syn::{
7 braced, parse_macro_input, Attribute, Generics, ImplItem, Pat, PatIdent, Path, Signature,
8 Token, TraitItem, TraitItemConst, TraitItemFn, TraitItemMacro, TraitItemType, Type, Visibility,
9 WhereClause,
7 Attribute, Generics, ImplItem, Pat, PatIdent, Path, Signature, Token, TraitItem,
8 TraitItemConst, TraitItemFn, TraitItemMacro, TraitItemType, Type, Visibility, WhereClause,
9 braced, parse_macro_input,
1010};
1111
1212pub(crate) fn extension(
compiler/rustc_macros/src/lift.rs+6-9
......@@ -40,14 +40,11 @@ pub(super) fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::To
4040 });
4141
4242 s.add_impl_generic(newtcx);
43 s.bound_impl(
44 quote!(::rustc_middle::ty::Lift<::rustc_middle::ty::TyCtxt<'__lifted>>),
45 quote! {
46 type Lifted = #lifted;
43 s.bound_impl(quote!(::rustc_middle::ty::Lift<::rustc_middle::ty::TyCtxt<'__lifted>>), quote! {
44 type Lifted = #lifted;
4745
48 fn lift_to_interner(self, __tcx: ::rustc_middle::ty::TyCtxt<'__lifted>) -> Option<#lifted> {
49 Some(match self { #body })
50 }
51 },
52 )
46 fn lift_to_interner(self, __tcx: ::rustc_middle::ty::TyCtxt<'__lifted>) -> Option<#lifted> {
47 Some(match self { #body })
48 }
49 })
5350}
compiler/rustc_macros/src/query.rs+2-2
......@@ -4,8 +4,8 @@ use syn::parse::{Parse, ParseStream, Result};
44use syn::punctuated::Punctuated;
55use syn::spanned::Spanned;
66use syn::{
7 braced, parenthesized, parse_macro_input, parse_quote, token, AttrStyle, Attribute, Block,
8 Error, Expr, Ident, Pat, ReturnType, Token, Type,
7 AttrStyle, Attribute, Block, Error, Expr, Ident, Pat, ReturnType, Token, Type, braced,
8 parenthesized, parse_macro_input, parse_quote, token,
99};
1010
1111mod kw {
compiler/rustc_macros/src/serialize.rs+14-20
......@@ -105,14 +105,11 @@ fn decodable_body(
105105 };
106106 s.underscore_const(true);
107107
108 s.bound_impl(
109 quote!(::rustc_serialize::Decodable<#decoder_ty>),
110 quote! {
111 fn decode(__decoder: &mut #decoder_ty) -> Self {
112 #decode_body
113 }
114 },
115 )
108 s.bound_impl(quote!(::rustc_serialize::Decodable<#decoder_ty>), quote! {
109 fn decode(__decoder: &mut #decoder_ty) -> Self {
110 #decode_body
111 }
112 })
116113}
117114
118115fn decode_field(field: &syn::Field) -> proc_macro2::TokenStream {
......@@ -288,16 +285,13 @@ fn encodable_body(
288285 quote! {}
289286 };
290287
291 s.bound_impl(
292 quote!(::rustc_serialize::Encodable<#encoder_ty>),
293 quote! {
294 fn encode(
295 &self,
296 __encoder: &mut #encoder_ty,
297 ) {
298 #lints
299 #encode_body
300 }
301 },
302 )
288 s.bound_impl(quote!(::rustc_serialize::Encodable<#encoder_ty>), quote! {
289 fn encode(
290 &self,
291 __encoder: &mut #encoder_ty,
292 ) {
293 #lints
294 #encode_body
295 }
296 })
303297}
compiler/rustc_macros/src/symbols.rs+1-1
......@@ -30,7 +30,7 @@ use proc_macro2::{Span, TokenStream};
3030use quote::quote;
3131use syn::parse::{Parse, ParseStream, Result};
3232use syn::punctuated::Punctuated;
33use syn::{braced, Expr, Ident, Lit, LitStr, Macro, Token};
33use syn::{Expr, Ident, Lit, LitStr, Macro, Token, braced};
3434
3535#[cfg(test)]
3636mod tests;
compiler/rustc_macros/src/symbols/tests.rs+4-4
......@@ -94,8 +94,8 @@ fn check_symbol_order() {
9494 aardvark,
9595 }
9696 };
97 test_symbols_macro(
98 input,
99 &["Symbol `aardvark` must precede `zebra`", "location of previous symbol `zebra`"],
100 );
97 test_symbols_macro(input, &[
98 "Symbol `aardvark` must precede `zebra`",
99 "location of previous symbol `zebra`",
100 ]);
101101}
compiler/rustc_macros/src/type_foldable.rs+1-1
......@@ -1,4 +1,4 @@
1use quote::{quote, ToTokens};
1use quote::{ToTokens, quote};
22use syn::parse_quote;
33
44pub(super) fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
compiler/rustc_metadata/src/creader.rs+17-23
......@@ -8,7 +8,7 @@ use std::time::Duration;
88use std::{cmp, env, iter};
99
1010use proc_macro::bridge::client::ProcMacro;
11use rustc_ast::expand::allocator::{alloc_error_handler_name, global_fn_name, AllocatorKind};
11use rustc_ast::expand::allocator::{AllocatorKind, alloc_error_handler_name, global_fn_name};
1212use rustc_ast::{self as ast, *};
1313use rustc_data_structures::fx::FxHashSet;
1414use rustc_data_structures::owned_slice::OwnedSlice;
......@@ -17,7 +17,7 @@ use rustc_data_structures::sync::{self, FreezeReadGuard, FreezeWriteGuard};
1717use rustc_errors::DiagCtxtHandle;
1818use rustc_expand::base::SyntaxExtension;
1919use rustc_fs_util::try_canonicalize;
20use rustc_hir::def_id::{CrateNum, LocalDefId, StableCrateId, LOCAL_CRATE};
20use rustc_hir::def_id::{CrateNum, LOCAL_CRATE, LocalDefId, StableCrateId};
2121use rustc_hir::definitions::Definitions;
2222use rustc_index::IndexVec;
2323use rustc_middle::bug;
......@@ -28,8 +28,8 @@ use rustc_session::lint::{self, BuiltinLintDiag};
2828use rustc_session::output::validate_crate_name;
2929use rustc_session::search_paths::PathKind;
3030use rustc_span::edition::Edition;
31use rustc_span::symbol::{sym, Symbol};
32use rustc_span::{Span, DUMMY_SP};
31use rustc_span::symbol::{Symbol, sym};
32use rustc_span::{DUMMY_SP, Span};
3333use rustc_target::spec::{PanicStrategy, Target, TargetTriple};
3434use tracing::{debug, info, trace};
3535
......@@ -1063,15 +1063,12 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
10631063 let cnum = self.resolve_crate(name, item.span, dep_kind)?;
10641064
10651065 let path_len = definitions.def_path(def_id).data.len();
1066 self.cstore.update_extern_crate(
1067 cnum,
1068 ExternCrate {
1069 src: ExternCrateSource::Extern(def_id.to_def_id()),
1070 span: item.span,
1071 path_len,
1072 dependency_of: LOCAL_CRATE,
1073 },
1074 );
1066 self.cstore.update_extern_crate(cnum, ExternCrate {
1067 src: ExternCrateSource::Extern(def_id.to_def_id()),
1068 span: item.span,
1069 path_len,
1070 dependency_of: LOCAL_CRATE,
1071 });
10751072 Some(cnum)
10761073 }
10771074 _ => bug!(),
......@@ -1081,16 +1078,13 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
10811078 pub fn process_path_extern(&mut self, name: Symbol, span: Span) -> Option<CrateNum> {
10821079 let cnum = self.resolve_crate(name, span, CrateDepKind::Explicit)?;
10831080
1084 self.cstore.update_extern_crate(
1085 cnum,
1086 ExternCrate {
1087 src: ExternCrateSource::Path,
1088 span,
1089 // to have the least priority in `update_extern_crate`
1090 path_len: usize::MAX,
1091 dependency_of: LOCAL_CRATE,
1092 },
1093 );
1081 self.cstore.update_extern_crate(cnum, ExternCrate {
1082 src: ExternCrateSource::Path,
1083 span,
1084 // to have the least priority in `update_extern_crate`
1085 path_len: usize::MAX,
1086 dependency_of: LOCAL_CRATE,
1087 });
10941088
10951089 Some(cnum)
10961090 }
compiler/rustc_metadata/src/errors.rs+1-1
......@@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
44use rustc_errors::codes::*;
55use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level};
66use rustc_macros::{Diagnostic, Subdiagnostic};
7use rustc_span::{sym, Span, Symbol};
7use rustc_span::{Span, Symbol, sym};
88use rustc_target::spec::{PanicStrategy, TargetTriple};
99
1010use crate::fluent_generated as fluent;
compiler/rustc_metadata/src/fs.rs+1-1
......@@ -12,7 +12,7 @@ use crate::errors::{
1212 BinaryOutputToTty, FailedCopyToStdout, FailedCreateEncodedMetadata, FailedCreateFile,
1313 FailedCreateTempdir, FailedWriteError,
1414};
15use crate::{encode_metadata, EncodedMetadata};
15use crate::{EncodedMetadata, encode_metadata};
1616
1717// FIXME(eddyb) maybe include the crate name in this?
1818pub const METADATA_FILENAME: &str = "lib.rmeta";
compiler/rustc_metadata/src/lib.rs+3-3
......@@ -34,12 +34,12 @@ pub mod errors;
3434pub mod fs;
3535pub mod locator;
3636
37pub use creader::{load_symbol_from_dylib, DylibError};
38pub use fs::{emit_wrapper_file, METADATA_FILENAME};
37pub use creader::{DylibError, load_symbol_from_dylib};
38pub use fs::{METADATA_FILENAME, emit_wrapper_file};
3939pub use native_libs::{
4040 find_native_static_library, try_find_native_dynamic_library, try_find_native_static_library,
4141 walk_native_lib_search_dirs,
4242};
43pub use rmeta::{encode_metadata, rendered_const, EncodedMetadata, METADATA_HEADER};
43pub use rmeta::{EncodedMetadata, METADATA_HEADER, encode_metadata, rendered_const};
4444
4545rustc_fluent_macro::fluent_messages! { "../messages.ftl" }
compiler/rustc_metadata/src/locator.rs+3-3
......@@ -224,20 +224,20 @@ use rustc_data_structures::owned_slice::slice_owned;
224224use rustc_data_structures::svh::Svh;
225225use rustc_errors::{DiagArgValue, IntoDiagArg};
226226use rustc_fs_util::try_canonicalize;
227use rustc_session::Session;
227228use rustc_session::cstore::CrateSource;
228229use rustc_session::filesearch::FileSearch;
229230use rustc_session::search_paths::PathKind;
230231use rustc_session::utils::CanonicalizedPath;
231use rustc_session::Session;
232use rustc_span::symbol::Symbol;
233232use rustc_span::Span;
233use rustc_span::symbol::Symbol;
234234use rustc_target::spec::{Target, TargetTriple};
235235use snap::read::FrameDecoder;
236236use tracing::{debug, info};
237237
238238use crate::creader::{Library, MetadataLoader};
239239use crate::errors;
240use crate::rmeta::{rustc_version, MetadataBlob, METADATA_HEADER};
240use crate::rmeta::{METADATA_HEADER, MetadataBlob, rustc_version};
241241
242242#[derive(Clone)]
243243pub(crate) struct CrateLocator<'a> {
compiler/rustc_metadata/src/native_libs.rs+4-4
......@@ -1,11 +1,12 @@
11use std::ops::ControlFlow;
22use std::path::{Path, PathBuf};
33
4use rustc_ast::{NestedMetaItem, CRATE_NODE_ID};
4use rustc_ast::{CRATE_NODE_ID, NestedMetaItem};
55use rustc_attr as attr;
66use rustc_data_structures::fx::FxHashSet;
77use rustc_middle::query::LocalCrate;
88use rustc_middle::ty::{List, ParamEnv, ParamEnvAnd, Ty, TyCtxt};
9use rustc_session::Session;
910use rustc_session::config::CrateType;
1011use rustc_session::cstore::{
1112 DllCallingConvention, DllImport, ForeignModule, NativeLib, PeImportNameType,
......@@ -13,11 +14,10 @@ use rustc_session::cstore::{
1314use rustc_session::parse::feature_err;
1415use rustc_session::search_paths::PathKind;
1516use rustc_session::utils::NativeLibKind;
16use rustc_session::Session;
1717use rustc_span::def_id::{DefId, LOCAL_CRATE};
18use rustc_span::symbol::{sym, Symbol};
19use rustc_target::spec::abi::Abi;
18use rustc_span::symbol::{Symbol, sym};
2019use rustc_target::spec::LinkSelfContainedComponents;
20use rustc_target::spec::abi::Abi;
2121
2222use crate::{errors, fluent_generated};
2323
compiler/rustc_metadata/src/rmeta/decoder.rs+3-3
......@@ -22,16 +22,16 @@ use rustc_hir::diagnostic_items::DiagnosticItems;
2222use rustc_index::Idx;
2323use rustc_middle::middle::lib_features::LibFeatures;
2424use rustc_middle::mir::interpret::{AllocDecodingSession, AllocDecodingState};
25use rustc_middle::ty::codec::TyDecoder;
2625use rustc_middle::ty::Visibility;
26use rustc_middle::ty::codec::TyDecoder;
2727use rustc_middle::{bug, implement_ty_decoder};
2828use rustc_serialize::opaque::MemDecoder;
2929use rustc_serialize::{Decodable, Decoder};
30use rustc_session::cstore::{CrateSource, ExternCrate};
3130use rustc_session::Session;
31use rustc_session::cstore::{CrateSource, ExternCrate};
3232use rustc_span::hygiene::HygieneDecodeContext;
3333use rustc_span::symbol::kw;
34use rustc_span::{BytePos, Pos, SpanData, SpanDecoder, SyntaxContext, DUMMY_SP};
34use rustc_span::{BytePos, DUMMY_SP, Pos, SpanData, SpanDecoder, SyntaxContext};
3535use tracing::debug;
3636
3737use crate::creader::CStore;
compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs+3-3
......@@ -18,14 +18,14 @@ use rustc_middle::ty::{self, TyCtxt};
1818use rustc_middle::util::Providers;
1919use rustc_session::cstore::{CrateStore, ExternCrate};
2020use rustc_session::{Session, StableCrateId};
21use rustc_span::hygiene::ExpnId;
22use rustc_span::symbol::{kw, Symbol};
2321use rustc_span::Span;
22use rustc_span::hygiene::ExpnId;
23use rustc_span::symbol::{Symbol, kw};
2424
2525use super::{Decodable, DecodeContext, DecodeIterator};
2626use crate::creader::{CStore, LoadedMacro};
27use crate::rmeta::table::IsDefault;
2827use crate::rmeta::AttrFlags;
28use crate::rmeta::table::IsDefault;
2929use crate::{foreign_modules, native_libs};
3030
3131trait ProcessQueryValue<'tcx, T> {
compiler/rustc_metadata/src/rmeta/encoder.rs+3-3
......@@ -7,11 +7,11 @@ use std::path::{Path, PathBuf};
77use rustc_ast::Attribute;
88use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
99use rustc_data_structures::memmap::{Mmap, MmapMut};
10use rustc_data_structures::sync::{join, par_for_each_in, Lrc};
10use rustc_data_structures::sync::{Lrc, join, par_for_each_in};
1111use rustc_data_structures::temp_dir::MaybeTempDir;
1212use rustc_feature::Features;
1313use rustc_hir as hir;
14use rustc_hir::def_id::{LocalDefId, LocalDefIdSet, CRATE_DEF_ID, CRATE_DEF_INDEX, LOCAL_CRATE};
14use rustc_hir::def_id::{CRATE_DEF_ID, CRATE_DEF_INDEX, LOCAL_CRATE, LocalDefId, LocalDefIdSet};
1515use rustc_hir::definitions::DefPathData;
1616use rustc_hir_pretty::id_to_string;
1717use rustc_middle::middle::dependency_format::Linkage;
......@@ -24,7 +24,7 @@ use rustc_middle::ty::fast_reject::{self, TreatParams};
2424use rustc_middle::ty::{AssocItemContainer, SymbolName};
2525use rustc_middle::util::common::to_readable_str;
2626use rustc_middle::{bug, span_bug};
27use rustc_serialize::{opaque, Decodable, Decoder, Encodable, Encoder};
27use rustc_serialize::{Decodable, Decoder, Encodable, Encoder, opaque};
2828use rustc_session::config::{CrateType, OptLevel};
2929use rustc_span::hygiene::HygieneEncodeContext;
3030use rustc_span::symbol::sym;
compiler/rustc_metadata/src/rmeta/mod.rs+2-2
......@@ -5,7 +5,7 @@ pub(crate) use decoder::{CrateMetadata, CrateNumMap, MetadataBlob};
55use decoder::{DecodeContext, Metadata};
66use def_path_hash_map::DefPathHashMapRef;
77use encoder::EncodeContext;
8pub use encoder::{encode_metadata, rendered_const, EncodedMetadata};
8pub use encoder::{EncodedMetadata, encode_metadata, rendered_const};
99use rustc_ast::expand::StrippedCfgItem;
1010use rustc_data_structures::fx::FxHashMap;
1111use rustc_data_structures::svh::Svh;
......@@ -13,8 +13,8 @@ use rustc_hir::def::{CtorKind, DefKind, DocLinkResMap};
1313use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIndex, DefPathHash, StableCrateId};
1414use rustc_hir::definitions::DefKey;
1515use rustc_hir::lang_items::LangItem;
16use rustc_index::bit_set::BitSet;
1716use rustc_index::IndexVec;
17use rustc_index::bit_set::BitSet;
1818use rustc_macros::{
1919 Decodable, Encodable, MetadataDecodable, MetadataEncodable, TyDecodable, TyEncodable,
2020};
compiler/rustc_middle/src/dep_graph/dep_node.rs+2-2
......@@ -57,12 +57,12 @@
5757//! [dependency graph]: https://rustc-dev-guide.rust-lang.org/query.html
5858
5959use rustc_data_structures::fingerprint::Fingerprint;
60use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalModDefId, ModDefId, LOCAL_CRATE};
60use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalModDefId, ModDefId};
6161use rustc_hir::definitions::DefPathHash;
6262use rustc_hir::{HirId, ItemLocalId, OwnerId};
63pub use rustc_query_system::dep_graph::dep_node::DepKind;
6463pub use rustc_query_system::dep_graph::DepNode;
6564use rustc_query_system::dep_graph::FingerprintStyle;
65pub use rustc_query_system::dep_graph::dep_node::DepKind;
6666pub(crate) use rustc_query_system::dep_graph::{DepContext, DepNodeParams};
6767use rustc_span::symbol::Symbol;
6868
compiler/rustc_middle/src/dep_graph/mod.rs+3-3
......@@ -7,12 +7,12 @@ use crate::ty::{self, TyCtxt};
77#[macro_use]
88mod dep_node;
99
10pub use dep_node::{dep_kinds, label_strs, DepKind, DepNode, DepNodeExt};
10pub use dep_node::{DepKind, DepNode, DepNodeExt, dep_kinds, label_strs};
1111pub(crate) use dep_node::{make_compile_codegen_unit, make_compile_mono_item};
1212pub use rustc_query_system::dep_graph::debug::{DepNodeFilter, EdgeFilter};
1313pub use rustc_query_system::dep_graph::{
14 hash_result, DepContext, DepGraphQuery, DepNodeIndex, Deps, SerializedDepGraph,
15 SerializedDepNodeIndex, TaskDepsRef, WorkProduct, WorkProductId, WorkProductMap,
14 DepContext, DepGraphQuery, DepNodeIndex, Deps, SerializedDepGraph, SerializedDepNodeIndex,
15 TaskDepsRef, WorkProduct, WorkProductId, WorkProductMap, hash_result,
1616};
1717
1818pub type DepGraph = rustc_query_system::dep_graph::DepGraph<DepsType>;
compiler/rustc_middle/src/hir/map/mod.rs+4-4
......@@ -1,16 +1,16 @@
1use rustc_ast::visit::{walk_list, VisitorResult};
1use rustc_ast::visit::{VisitorResult, walk_list};
22use rustc_data_structures::fingerprint::Fingerprint;
33use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
44use rustc_data_structures::svh::Svh;
5use rustc_data_structures::sync::{par_for_each_in, try_par_for_each_in, DynSend, DynSync};
5use rustc_data_structures::sync::{DynSend, DynSync, par_for_each_in, try_par_for_each_in};
66use rustc_hir::def::{DefKind, Res};
7use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId, LOCAL_CRATE};
7use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId, LocalModDefId};
88use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
99use rustc_hir::intravisit::Visitor;
1010use rustc_hir::*;
1111use rustc_middle::hir::nested_filter;
1212use rustc_span::def_id::StableCrateId;
13use rustc_span::symbol::{kw, sym, Ident, Symbol};
13use rustc_span::symbol::{Ident, Symbol, kw, sym};
1414use rustc_span::{ErrorGuaranteed, Span};
1515use rustc_target::spec::abi::Abi;
1616use {rustc_ast as ast, rustc_hir_pretty as pprust_hir};
compiler/rustc_middle/src/hir/mod.rs+1-1
......@@ -9,7 +9,7 @@ pub mod place;
99use rustc_data_structures::fingerprint::Fingerprint;
1010use rustc_data_structures::sorted_map::SortedMap;
1111use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
12use rustc_data_structures::sync::{try_par_for_each_in, DynSend, DynSync};
12use rustc_data_structures::sync::{DynSend, DynSync, try_par_for_each_in};
1313use rustc_hir::def::DefKind;
1414use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId};
1515use rustc_hir::*;
compiler/rustc_middle/src/hooks/mod.rs+1-1
......@@ -6,7 +6,7 @@
66use rustc_hir::def_id::{DefId, DefPathHash};
77use rustc_session::StableCrateId;
88use rustc_span::def_id::{CrateNum, LocalDefId};
9use rustc_span::{ExpnHash, ExpnId, DUMMY_SP};
9use rustc_span::{DUMMY_SP, ExpnHash, ExpnId};
1010use tracing::instrument;
1111
1212use crate::mir;
compiler/rustc_middle/src/infer/unify_key.rs+1-1
......@@ -2,8 +2,8 @@ use std::cmp;
22use std::marker::PhantomData;
33
44use rustc_data_structures::unify::{NoError, UnifyKey, UnifyValue};
5use rustc_span::def_id::DefId;
65use rustc_span::Span;
6use rustc_span::def_id::DefId;
77
88use crate::ty::{self, Ty, TyCtxt};
99
compiler/rustc_middle/src/lint.rs+2-2
......@@ -5,11 +5,11 @@ use rustc_data_structures::sorted_map::SortedMap;
55use rustc_errors::{Diag, MultiSpan};
66use rustc_hir::{HirId, ItemLocalId};
77use rustc_macros::HashStable;
8use rustc_session::Session;
89use rustc_session::lint::builtin::{self, FORBIDDEN_LINT_GROUPS};
910use rustc_session::lint::{FutureIncompatibilityReason, Level, Lint, LintExpectationId, LintId};
10use rustc_session::Session;
1111use rustc_span::hygiene::{ExpnKind, MacroKind};
12use rustc_span::{symbol, DesugaringKind, Span, Symbol, DUMMY_SP};
12use rustc_span::{DUMMY_SP, DesugaringKind, Span, Symbol, symbol};
1313use tracing::instrument;
1414
1515use crate::ty::TyCtxt;
compiler/rustc_middle/src/middle/lang_items.rs+1-1
......@@ -7,8 +7,8 @@
77//! * Traits that represent operators; e.g., `Add`, `Sub`, `Index`.
88//! * Functions called by the compiler itself.
99
10use rustc_hir::def_id::DefId;
1110use rustc_hir::LangItem;
11use rustc_hir::def_id::DefId;
1212use rustc_span::Span;
1313use rustc_target::spec::PanicStrategy;
1414
compiler/rustc_middle/src/middle/limits.rs+1-1
......@@ -12,7 +12,7 @@ use std::num::IntErrorKind;
1212
1313use rustc_ast::Attribute;
1414use rustc_session::{Limit, Limits, Session};
15use rustc_span::symbol::{sym, Symbol};
15use rustc_span::symbol::{Symbol, sym};
1616
1717use crate::error::LimitInvalid;
1818use crate::query::Providers;
compiler/rustc_middle/src/middle/mod.rs+1-1
......@@ -6,8 +6,8 @@ pub mod lang_items;
66pub mod lib_features {
77 use rustc_data_structures::unord::UnordMap;
88 use rustc_macros::{HashStable, TyDecodable, TyEncodable};
9 use rustc_span::symbol::Symbol;
109 use rustc_span::Span;
10 use rustc_span::symbol::Symbol;
1111
1212 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
1313 #[derive(HashStable, TyEncodable, TyDecodable)]
compiler/rustc_middle/src/middle/privacy.rs+1-1
......@@ -9,7 +9,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
99use rustc_hir::def::DefKind;
1010use rustc_macros::HashStable;
1111use rustc_query_system::ich::StableHashingContext;
12use rustc_span::def_id::{LocalDefId, CRATE_DEF_ID};
12use rustc_span::def_id::{CRATE_DEF_ID, LocalDefId};
1313
1414use crate::ty::{TyCtxt, Visibility};
1515
compiler/rustc_middle/src/middle/region.rs+1-1
......@@ -14,7 +14,7 @@ use rustc_data_structures::unord::UnordMap;
1414use rustc_hir as hir;
1515use rustc_hir::{HirId, HirIdMap, Node};
1616use rustc_macros::{HashStable, TyDecodable, TyEncodable};
17use rustc_span::{Span, DUMMY_SP};
17use rustc_span::{DUMMY_SP, Span};
1818use tracing::debug;
1919
2020use crate::ty::TyCtxt;
compiler/rustc_middle/src/middle/stability.rs+2-2
......@@ -15,12 +15,12 @@ use rustc_hir::def_id::{DefId, LocalDefId, LocalDefIdMap};
1515use rustc_hir::{self as hir, HirId};
1616use rustc_macros::{Decodable, Encodable, HashStable, Subdiagnostic};
1717use rustc_middle::ty::print::with_no_trimmed_paths;
18use rustc_session::Session;
1819use rustc_session::lint::builtin::{DEPRECATED, DEPRECATED_IN_FUTURE, SOFT_UNSTABLE};
1920use rustc_session::lint::{BuiltinLintDiag, DeprecatedSinceKind, Level, Lint, LintBuffer};
2021use rustc_session::parse::feature_err_issue;
21use rustc_session::Session;
22use rustc_span::symbol::{sym, Symbol};
2322use rustc_span::Span;
23use rustc_span::symbol::{Symbol, sym};
2424use tracing::debug;
2525
2626pub use self::StabilityLevel::*;
compiler/rustc_middle/src/mir/basic_blocks.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_data_structures::fx::FxHashMap;
22use rustc_data_structures::graph;
3use rustc_data_structures::graph::dominators::{dominators, Dominators};
3use rustc_data_structures::graph::dominators::{Dominators, dominators};
44use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
55use rustc_data_structures::sync::OnceLock;
66use rustc_index::{IndexSlice, IndexVec};
......@@ -9,7 +9,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
99use smallvec::SmallVec;
1010
1111use crate::mir::traversal::Postorder;
12use crate::mir::{BasicBlock, BasicBlockData, Terminator, TerminatorKind, START_BLOCK};
12use crate::mir::{BasicBlock, BasicBlockData, START_BLOCK, Terminator, TerminatorKind};
1313
1414#[derive(Clone, TyEncodable, TyDecodable, Debug, HashStable, TypeFoldable, TypeVisitable)]
1515pub struct BasicBlocks<'tcx> {
compiler/rustc_middle/src/mir/consts.rs+4-4
......@@ -2,13 +2,13 @@ use std::fmt::{self, Debug, Display, Formatter};
22
33use rustc_hir::def_id::DefId;
44use rustc_macros::{HashStable, Lift, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
5use rustc_session::config::RemapPathScopeComponents;
65use rustc_session::RemapFileNameExt;
7use rustc_span::{Span, DUMMY_SP};
6use rustc_session::config::RemapPathScopeComponents;
7use rustc_span::{DUMMY_SP, Span};
88use rustc_target::abi::{HasDataLayout, Size};
99
10use crate::mir::interpret::{alloc_range, AllocId, ConstAllocation, ErrorHandled, Scalar};
11use crate::mir::{pretty_print_const_value, Promoted};
10use crate::mir::interpret::{AllocId, ConstAllocation, ErrorHandled, Scalar, alloc_range};
11use crate::mir::{Promoted, pretty_print_const_value};
1212use crate::ty::print::{pretty_print_const, with_no_trimmed_paths};
1313use crate::ty::{self, GenericArgsRef, ScalarInt, Ty, TyCtxt};
1414
compiler/rustc_middle/src/mir/interpret/allocation.rs+3-3
......@@ -18,9 +18,9 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable};
1818use rustc_target::abi::{Align, HasDataLayout, Size};
1919
2020use super::{
21 read_target_uint, write_target_uint, AllocId, BadBytesAccess, CtfeProvenance, InterpError,
22 InterpResult, Pointer, PointerArithmetic, Provenance, ResourceExhaustionInfo, Scalar,
23 ScalarSizeMismatch, UndefinedBehaviorInfo, UnsupportedOpInfo,
21 AllocId, BadBytesAccess, CtfeProvenance, InterpError, InterpResult, Pointer, PointerArithmetic,
22 Provenance, ResourceExhaustionInfo, Scalar, ScalarSizeMismatch, UndefinedBehaviorInfo,
23 UnsupportedOpInfo, read_target_uint, write_target_uint,
2424};
2525use crate::ty;
2626
compiler/rustc_middle/src/mir/interpret/allocation/provenance_map.rs+1-1
......@@ -9,7 +9,7 @@ use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
99use rustc_target::abi::{HasDataLayout, Size};
1010use tracing::trace;
1111
12use super::{alloc_range, AllocError, AllocRange, AllocResult, CtfeProvenance, Provenance};
12use super::{AllocError, AllocRange, AllocResult, CtfeProvenance, Provenance, alloc_range};
1313
1414/// Stores the provenance information of pointers stored in memory.
1515#[derive(Clone, PartialEq, Eq, Hash, Debug)]
compiler/rustc_middle/src/mir/interpret/error.rs+3-3
......@@ -10,13 +10,13 @@ use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, Into
1010use rustc_macros::{HashStable, TyDecodable, TyEncodable};
1111use rustc_session::CtfeBacktrace;
1212use rustc_span::def_id::DefId;
13use rustc_span::{Span, Symbol, DUMMY_SP};
14use rustc_target::abi::{call, Align, Size, VariantIdx, WrappingRange};
13use rustc_span::{DUMMY_SP, Span, Symbol};
14use rustc_target::abi::{Align, Size, VariantIdx, WrappingRange, call};
1515
1616use super::{AllocId, AllocRange, ConstAllocation, Pointer, Scalar};
1717use crate::error;
1818use crate::mir::{ConstAlloc, ConstValue};
19use crate::ty::{self, layout, tls, Ty, TyCtxt, ValTree};
19use crate::ty::{self, Ty, TyCtxt, ValTree, layout, tls};
2020
2121#[derive(Debug, Copy, Clone, PartialEq, Eq, HashStable, TyEncodable, TyDecodable)]
2222pub enum ErrorHandled {
compiler/rustc_middle/src/mir/interpret/mod.rs+2-2
......@@ -30,8 +30,8 @@ pub use {
3030};
3131
3232pub use self::allocation::{
33 alloc_range, AllocBytes, AllocError, AllocRange, AllocResult, Allocation, ConstAllocation,
34 InitChunk, InitChunkIter,
33 AllocBytes, AllocError, AllocRange, AllocResult, Allocation, ConstAllocation, InitChunk,
34 InitChunkIter, alloc_range,
3535};
3636pub use self::error::{
3737 BadBytesAccess, CheckAlignMsg, CheckInAllocMsg, ErrorHandled, EvalStaticInitializerRawResult,
compiler/rustc_middle/src/mir/interpret/queries.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_hir::def::DefKind;
22use rustc_hir::def_id::DefId;
33use rustc_session::lint;
4use rustc_span::{Span, DUMMY_SP};
4use rustc_span::{DUMMY_SP, Span};
55use tracing::{debug, instrument};
66
77use super::{
compiler/rustc_middle/src/mir/interpret/value.rs+1-1
......@@ -1,8 +1,8 @@
11use std::fmt;
22
33use either::{Either, Left, Right};
4use rustc_apfloat::ieee::{Double, Half, Quad, Single};
54use rustc_apfloat::Float;
5use rustc_apfloat::ieee::{Double, Half, Quad, Single};
66use rustc_macros::{HashStable, TyDecodable, TyEncodable};
77use rustc_target::abi::{HasDataLayout, Size};
88
compiler/rustc_middle/src/mir/mod.rs+8-8
......@@ -16,7 +16,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1616use rustc_data_structures::graph::dominators::Dominators;
1717use rustc_errors::{DiagArgName, DiagArgValue, DiagMessage, ErrorGuaranteed, IntoDiagArg};
1818use rustc_hir::def::{CtorKind, Namespace};
19use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
19use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
2020use rustc_hir::{
2121 self as hir, BindingMode, ByRef, CoroutineDesugaring, CoroutineKind, HirId, ImplicitSelfKind,
2222};
......@@ -26,7 +26,7 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisit
2626use rustc_serialize::{Decodable, Encodable};
2727use rustc_span::source_map::Spanned;
2828use rustc_span::symbol::Symbol;
29use rustc_span::{Span, DUMMY_SP};
29use rustc_span::{DUMMY_SP, Span};
3030use rustc_target::abi::{FieldIdx, VariantIdx};
3131use tracing::trace;
3232
......@@ -36,7 +36,7 @@ use crate::mir::interpret::{AllocRange, Scalar};
3636use crate::mir::visit::MirVisitable;
3737use crate::ty::codec::{TyDecoder, TyEncoder};
3838use crate::ty::fold::{FallibleTypeFolder, TypeFoldable};
39use crate::ty::print::{pretty_print_const, with_no_trimmed_paths, FmtPrinter, Printer};
39use crate::ty::print::{FmtPrinter, Printer, pretty_print_const, with_no_trimmed_paths};
4040use crate::ty::visit::TypeVisitableExt;
4141use crate::ty::{
4242 self, AdtDef, GenericArg, GenericArgsRef, Instance, InstanceKind, List, Ty, TyCtxt,
......@@ -72,7 +72,7 @@ pub use terminator::*;
7272pub use self::generic_graph::graphviz_safe_def_name;
7373pub use self::graphviz::write_mir_graphviz;
7474pub use self::pretty::{
75 create_dump_file, display_allocation, dump_enabled, dump_mir, write_mir_pretty, PassWhere,
75 PassWhere, create_dump_file, display_allocation, dump_enabled, dump_mir, write_mir_pretty,
7676};
7777
7878/// Types for locals
......@@ -1399,10 +1399,10 @@ impl<'tcx> BasicBlockData<'tcx> {
13991399 // existing elements from before the gap to the end of the gap.
14001400 // For now, this is safe code, emulating a gap but initializing it.
14011401 let mut gap = self.statements.len()..self.statements.len() + extra_stmts;
1402 self.statements.resize(
1403 gap.end,
1404 Statement { source_info: SourceInfo::outermost(DUMMY_SP), kind: StatementKind::Nop },
1405 );
1402 self.statements.resize(gap.end, Statement {
1403 source_info: SourceInfo::outermost(DUMMY_SP),
1404 kind: StatementKind::Nop,
1405 });
14061406 for (splice_start, new_stmts) in splices.into_iter().rev() {
14071407 let splice_end = splice_start + new_stmts.size_hint().0;
14081408 while gap.end > splice_end {
compiler/rustc_middle/src/mir/mono.rs+3-3
......@@ -2,19 +2,19 @@ use std::fmt;
22use std::hash::Hash;
33
44use rustc_attr::InlineAttr;
5use rustc_data_structures::base_n::{BaseNString, ToBaseN, CASE_INSENSITIVE};
5use rustc_data_structures::base_n::{BaseNString, CASE_INSENSITIVE, ToBaseN};
66use rustc_data_structures::fingerprint::Fingerprint;
77use rustc_data_structures::fx::FxIndexMap;
88use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher, ToStableHashKey};
99use rustc_data_structures::unord::UnordMap;
10use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
1110use rustc_hir::ItemId;
11use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
1212use rustc_index::Idx;
1313use rustc_macros::{HashStable, TyDecodable, TyEncodable};
1414use rustc_query_system::ich::StableHashingContext;
1515use rustc_session::config::OptLevel;
16use rustc_span::symbol::Symbol;
1716use rustc_span::Span;
17use rustc_span::symbol::Symbol;
1818use tracing::debug;
1919
2020use crate::dep_graph::{DepNode, WorkProduct, WorkProductId};
compiler/rustc_middle/src/mir/pretty.rs+2-2
......@@ -6,8 +6,8 @@ use std::path::{Path, PathBuf};
66
77use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
88use rustc_middle::mir::interpret::{
9 alloc_range, read_target_uint, AllocBytes, AllocId, Allocation, GlobalAlloc, Pointer,
10 Provenance,
9 AllocBytes, AllocId, Allocation, GlobalAlloc, Pointer, Provenance, alloc_range,
10 read_target_uint,
1111};
1212use rustc_middle::mir::visit::Visitor;
1313use rustc_middle::mir::*;
compiler/rustc_middle/src/mir/query.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_hir::def_id::LocalDefId;
1010use rustc_index::bit_set::BitMatrix;
1111use rustc_index::{Idx, IndexVec};
1212use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
13use rustc_span::symbol::Symbol;
1413use rustc_span::Span;
14use rustc_span::symbol::Symbol;
1515use rustc_target::abi::{FieldIdx, VariantIdx};
1616use smallvec::SmallVec;
1717
compiler/rustc_middle/src/mir/syntax.rs+2-2
......@@ -5,14 +5,14 @@
55
66use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece, Mutability};
77use rustc_data_structures::packed::Pu128;
8use rustc_hir::def_id::DefId;
98use rustc_hir::CoroutineKind;
9use rustc_hir::def_id::DefId;
1010use rustc_index::IndexVec;
1111use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
12use rustc_span::Span;
1213use rustc_span::def_id::LocalDefId;
1314use rustc_span::source_map::Spanned;
1415use rustc_span::symbol::Symbol;
15use rustc_span::Span;
1616use rustc_target::abi::{FieldIdx, VariantIdx};
1717use rustc_target::asm::InlineAsmRegOrRegClass;
1818use smallvec::SmallVec;
compiler/rustc_middle/src/mir/terminator.rs+1-1
......@@ -5,7 +5,7 @@ use std::slice;
55use rustc_data_structures::packed::Pu128;
66use rustc_hir::LangItem;
77use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
8use smallvec::{smallvec, SmallVec};
8use smallvec::{SmallVec, smallvec};
99
1010use super::{TerminatorKind, *};
1111
compiler/rustc_middle/src/query/keys.rs+2-2
......@@ -1,10 +1,10 @@
11//! Defines the set of legal keys that can be used in queries.
22
3use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalModDefId, ModDefId, LOCAL_CRATE};
3use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalModDefId, ModDefId};
44use rustc_hir::hir_id::{HirId, OwnerId};
55use rustc_query_system::query::{DefIdCache, DefaultCache, SingleCache, VecCache};
66use rustc_span::symbol::{Ident, Symbol};
7use rustc_span::{Span, DUMMY_SP};
7use rustc_span::{DUMMY_SP, Span};
88use rustc_target::abi;
99
1010use crate::infer::canonical::Canonical;
compiler/rustc_middle/src/query/mod.rs+9-9
......@@ -12,8 +12,8 @@ use std::path::PathBuf;
1212use std::sync::Arc;
1313
1414use rustc_arena::TypedArena;
15use rustc_ast::expand::allocator::AllocatorKind;
1615use rustc_ast::expand::StrippedCfgItem;
16use rustc_ast::expand::allocator::AllocatorKind;
1717use rustc_data_structures::fingerprint::Fingerprint;
1818use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
1919use rustc_data_structures::steal::Steal;
......@@ -30,16 +30,16 @@ use rustc_hir::{Crate, ItemLocalId, ItemLocalMap, TraitCandidate};
3030use rustc_index::IndexVec;
3131use rustc_macros::rustc_queries;
3232use rustc_query_system::ich::StableHashingContext;
33use rustc_query_system::query::{try_get_cached, QueryCache, QueryMode, QueryState};
33use rustc_query_system::query::{QueryCache, QueryMode, QueryState, try_get_cached};
34use rustc_session::Limits;
3435use rustc_session::config::{EntryFnType, OptLevel, OutputFilenames, SymbolManglingVersion};
3536use rustc_session::cstore::{
3637 CrateDepKind, CrateSource, ExternCrate, ForeignModule, LinkagePreference, NativeLib,
3738};
3839use rustc_session::lint::LintExpectationId;
39use rustc_session::Limits;
4040use rustc_span::def_id::LOCAL_CRATE;
4141use rustc_span::symbol::Symbol;
42use rustc_span::{Span, DUMMY_SP};
42use rustc_span::{DUMMY_SP, Span};
4343use rustc_target::abi;
4444use rustc_target::spec::PanicStrategy;
4545use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
......@@ -59,9 +59,9 @@ use crate::mir::interpret::{
5959 EvalToValTreeResult, GlobalId, LitToConstError, LitToConstInput,
6060};
6161use crate::mir::mono::CodegenUnit;
62use crate::query::erase::{erase, restore, Erase};
62use crate::query::erase::{Erase, erase, restore};
6363use crate::query::plumbing::{
64 query_ensure, query_ensure_error_guaranteed, query_get_at, CyclePlaceholder, DynamicQuery,
64 CyclePlaceholder, DynamicQuery, query_ensure, query_ensure_error_guaranteed, query_get_at,
6565};
6666use crate::traits::query::{
6767 CanonicalAliasGoal, CanonicalPredicateGoal, CanonicalTyGoal,
......@@ -70,12 +70,12 @@ use crate::traits::query::{
7070 MethodAutoderefStepsResult, NoSolution, NormalizationResult, OutlivesBound,
7171};
7272use crate::traits::{
73 specialization_graph, CodegenObligationError, EvaluationResult, ImplSource,
74 ObjectSafetyViolation, ObligationCause, OverflowError, WellFormedLoc,
73 CodegenObligationError, EvaluationResult, ImplSource, ObjectSafetyViolation, ObligationCause,
74 OverflowError, WellFormedLoc, specialization_graph,
7575};
7676use crate::ty::fast_reject::SimplifiedType;
7777use crate::ty::layout::ValidityRequirement;
78use crate::ty::print::{describe_as_module, PrintTraitRefExt};
78use crate::ty::print::{PrintTraitRefExt, describe_as_module};
7979use crate::ty::util::AlwaysRequiresDrop;
8080use crate::ty::{
8181 self, CrateInherentImpls, GenericArg, GenericArgsRef, ParamEnvAnd, Ty, TyCtxt, TyCtxtFeed,
compiler/rustc_middle/src/query/on_disk_cache.rs+10-13
......@@ -6,7 +6,7 @@ use rustc_data_structures::memmap::Mmap;
66use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, RwLock};
77use rustc_data_structures::unhash::UnhashMap;
88use rustc_data_structures::unord::{UnordMap, UnordSet};
9use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, StableCrateId, LOCAL_CRATE};
9use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, LocalDefId, StableCrateId};
1010use rustc_hir::definitions::DefPathHash;
1111use rustc_index::{Idx, IndexVec};
1212use rustc_macros::{Decodable, Encodable};
......@@ -328,18 +328,15 @@ impl<'sess> OnDiskCache<'sess> {
328328
329329 // Encode the file footer.
330330 let footer_pos = encoder.position() as u64;
331 encoder.encode_tagged(
332 TAG_FILE_FOOTER,
333 &Footer {
334 file_index_to_stable_id,
335 query_result_index,
336 side_effects_index,
337 interpret_alloc_index,
338 syntax_contexts,
339 expn_data,
340 foreign_expn_data,
341 },
342 );
331 encoder.encode_tagged(TAG_FILE_FOOTER, &Footer {
332 file_index_to_stable_id,
333 query_result_index,
334 side_effects_index,
335 interpret_alloc_index,
336 syntax_contexts,
337 expn_data,
338 foreign_expn_data,
339 });
343340
344341 // Encode the position of the footer as the last 8 bytes of the
345342 // file so we know where to look for it.
compiler/rustc_middle/src/query/plumbing.rs+2-2
......@@ -5,11 +5,11 @@ use rustc_data_structures::sync::{AtomicU64, WorkerLocal};
55use rustc_hir::def_id::{DefId, LocalDefId};
66use rustc_hir::hir_id::OwnerId;
77use rustc_macros::HashStable;
8use rustc_query_system::HandleCycleError;
89use rustc_query_system::dep_graph::{DepNodeIndex, SerializedDepNodeIndex};
910pub(crate) use rustc_query_system::query::QueryJobId;
1011use rustc_query_system::query::*;
11use rustc_query_system::HandleCycleError;
12use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
12use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
1313
1414use crate::dep_graph;
1515use crate::dep_graph::DepKind;
compiler/rustc_middle/src/thir.rs+1-1
......@@ -16,7 +16,7 @@ use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
1616use rustc_hir as hir;
1717use rustc_hir::def_id::DefId;
1818use rustc_hir::{BindingMode, ByRef, HirId, MatchSource, RangeEnd};
19use rustc_index::{newtype_index, IndexVec};
19use rustc_index::{IndexVec, newtype_index};
2020use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeVisitable};
2121use rustc_middle::middle::region;
2222use rustc_middle::mir::interpret::AllocId;
compiler/rustc_middle/src/traits/mod.rs+4-4
......@@ -14,17 +14,17 @@ use std::hash::{Hash, Hasher};
1414use rustc_data_structures::sync::Lrc;
1515use rustc_errors::{Applicability, Diag, EmissionGuarantee};
1616use rustc_hir as hir;
17use rustc_hir::def_id::DefId;
1817use rustc_hir::HirId;
18use rustc_hir::def_id::DefId;
1919use rustc_macros::{
2020 Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
2121};
22use rustc_span::def_id::{LocalDefId, CRATE_DEF_ID};
22use rustc_span::def_id::{CRATE_DEF_ID, LocalDefId};
2323use rustc_span::symbol::Symbol;
24use rustc_span::{Span, DUMMY_SP};
24use rustc_span::{DUMMY_SP, Span};
2525// FIXME: Remove this import and import via `solve::`
2626pub use rustc_type_ir::solve::{BuiltinImplSource, Reveal};
27use smallvec::{smallvec, SmallVec};
27use smallvec::{SmallVec, smallvec};
2828
2929pub use self::select::{EvaluationCache, EvaluationResult, OverflowError, SelectionCache};
3030use crate::mir::ConstraintCategory;
compiler/rustc_middle/src/ty/adt.rs+1-1
......@@ -17,7 +17,7 @@ use rustc_macros::{HashStable, TyDecodable, TyEncodable};
1717use rustc_query_system::ich::StableHashingContext;
1818use rustc_session::DataTypeKind;
1919use rustc_span::symbol::sym;
20use rustc_target::abi::{ReprOptions, VariantIdx, FIRST_VARIANT};
20use rustc_target::abi::{FIRST_VARIANT, ReprOptions, VariantIdx};
2121use tracing::{debug, info, trace};
2222
2323use super::{
compiler/rustc_middle/src/ty/closure.rs+1-1
......@@ -3,8 +3,8 @@ use std::fmt::Write;
33use rustc_data_structures::captures::Captures;
44use rustc_data_structures::fx::FxIndexMap;
55use rustc_hir as hir;
6use rustc_hir::def_id::LocalDefId;
76use rustc_hir::HirId;
7use rustc_hir::def_id::LocalDefId;
88use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
99use rustc_span::def_id::LocalDefIdMap;
1010use rustc_span::symbol::Ident;
compiler/rustc_middle/src/ty/consts.rs+5-8
......@@ -18,7 +18,7 @@ mod valtree;
1818
1919pub use int::*;
2020pub use kind::*;
21use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
21use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
2222pub use valtree::*;
2323
2424pub type ConstKind<'tcx> = ir::ConstKind<TyCtxt<'tcx>>;
......@@ -242,13 +242,10 @@ impl<'tcx> Const<'tcx> {
242242
243243 match Self::try_from_lit_or_param(tcx, ty, expr) {
244244 Some(v) => v,
245 None => ty::Const::new_unevaluated(
246 tcx,
247 ty::UnevaluatedConst {
248 def: def.to_def_id(),
249 args: GenericArgs::identity_for_item(tcx, def.to_def_id()),
250 },
251 ),
245 None => ty::Const::new_unevaluated(tcx, ty::UnevaluatedConst {
246 def: def.to_def_id(),
247 args: GenericArgs::identity_for_item(tcx, def.to_def_id()),
248 }),
252249 }
253250 }
254251
compiler/rustc_middle/src/ty/consts/int.rs+1-1
......@@ -1,8 +1,8 @@
11use std::fmt;
22use std::num::NonZero;
33
4use rustc_apfloat::ieee::{Double, Half, Quad, Single};
54use rustc_apfloat::Float;
5use rustc_apfloat::ieee::{Double, Half, Quad, Single};
66use rustc_errors::{DiagArgValue, IntoDiagArg};
77use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
88use rustc_target::abi::Size;
compiler/rustc_middle/src/ty/consts/kind.rs+5-8
......@@ -1,6 +1,6 @@
11use std::assert_matches::assert_matches;
22
3use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
3use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable, extension};
44
55use super::Const;
66use crate::mir;
......@@ -31,13 +31,10 @@ impl<'tcx> ty::UnevaluatedConst<'tcx> {
3131 // FIXME(eddyb, skinny121) pass `InferCtxt` into here when it's available, so that
3232 // we can call `infcx.const_eval_resolve` which handles inference variables.
3333 if (param_env, self).has_non_region_infer() {
34 (
35 tcx.param_env(self.def),
36 ty::UnevaluatedConst {
37 def: self.def,
38 args: ty::GenericArgs::identity_for_item(tcx, self.def),
39 },
40 )
34 (tcx.param_env(self.def), ty::UnevaluatedConst {
35 def: self.def,
36 args: ty::GenericArgs::identity_for_item(tcx, self.def),
37 })
4138 } else {
4239 (tcx.erase_regions(param_env).with_reveal_all_normalized(tcx), tcx.erase_regions(self))
4340 }
compiler/rustc_middle/src/ty/context.rs+16-19
......@@ -30,7 +30,7 @@ use rustc_errors::{
3030};
3131use rustc_hir as hir;
3232use rustc_hir::def::DefKind;
33use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
33use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId};
3434use rustc_hir::definitions::Definitions;
3535use rustc_hir::intravisit::Visitor;
3636use rustc_hir::lang_items::LangItem;
......@@ -45,17 +45,17 @@ use rustc_session::config::CrateType;
4545use rustc_session::cstore::{CrateStoreDyn, Untracked};
4646use rustc_session::lint::Lint;
4747use rustc_session::{Limit, MetadataKind, Session};
48use rustc_span::def_id::{DefPathHash, StableCrateId, CRATE_DEF_ID};
49use rustc_span::symbol::{kw, sym, Ident, Symbol};
50use rustc_span::{Span, DUMMY_SP};
48use rustc_span::def_id::{CRATE_DEF_ID, DefPathHash, StableCrateId};
49use rustc_span::symbol::{Ident, Symbol, kw, sym};
50use rustc_span::{DUMMY_SP, Span};
5151use rustc_target::abi::{FieldIdx, Layout, LayoutS, TargetDataLayout, VariantIdx};
5252use rustc_target::spec::abi;
53use rustc_type_ir::TyKind::*;
5354use rustc_type_ir::fold::TypeFoldable;
5455use rustc_type_ir::lang_items::TraitSolverLangItem;
5556pub use rustc_type_ir::lift::Lift;
5657use rustc_type_ir::solve::SolverMode;
57use rustc_type_ir::TyKind::*;
58use rustc_type_ir::{search_graph, CollectAndApply, Interner, TypeFlags, WithCachedTypeInfo};
58use rustc_type_ir::{CollectAndApply, Interner, TypeFlags, WithCachedTypeInfo, search_graph};
5959use tracing::{debug, instrument};
6060
6161use crate::arena::Arena;
......@@ -1015,10 +1015,10 @@ impl<'tcx> CommonLifetimes<'tcx> {
10151015 .map(|i| {
10161016 (0..NUM_PREINTERNED_RE_LATE_BOUNDS_V)
10171017 .map(|v| {
1018 mk(ty::ReBound(
1019 ty::DebruijnIndex::from(i),
1020 ty::BoundRegion { var: ty::BoundVar::from(v), kind: ty::BrAnon },
1021 ))
1018 mk(ty::ReBound(ty::DebruijnIndex::from(i), ty::BoundRegion {
1019 var: ty::BoundVar::from(v),
1020 kind: ty::BrAnon,
1021 }))
10221022 })
10231023 .collect()
10241024 })
......@@ -3052,15 +3052,12 @@ impl<'tcx> TyCtxt<'tcx> {
30523052 }
30533053
30543054 let generics = self.generics_of(new_parent);
3055 return ty::Region::new_early_param(
3056 self,
3057 ty::EarlyParamRegion {
3058 index: generics
3059 .param_def_id_to_index(self, ebv.to_def_id())
3060 .expect("early-bound var should be present in fn generics"),
3061 name: self.item_name(ebv.to_def_id()),
3062 },
3063 );
3055 return ty::Region::new_early_param(self, ty::EarlyParamRegion {
3056 index: generics
3057 .param_def_id_to_index(self, ebv.to_def_id())
3058 .expect("early-bound var should be present in fn generics"),
3059 name: self.item_name(ebv.to_def_id()),
3060 });
30643061 }
30653062 Some(resolve_bound_vars::ResolvedArg::LateBound(_, _, lbv)) => {
30663063 let new_parent = self.local_parent(lbv);
compiler/rustc_middle/src/ty/diagnostics.rs+1-1
......@@ -5,7 +5,7 @@ use std::fmt::Write;
55use std::ops::ControlFlow;
66
77use rustc_data_structures::fx::FxHashMap;
8use rustc_errors::{into_diag_arg_using_display, Applicability, Diag, DiagArgValue, IntoDiagArg};
8use rustc_errors::{Applicability, Diag, DiagArgValue, IntoDiagArg, into_diag_arg_using_display};
99use rustc_hir::def::DefKind;
1010use rustc_hir::def_id::DefId;
1111use rustc_hir::{self as hir, LangItem, PredicateOrigin, WherePredicate};
compiler/rustc_middle/src/ty/error.rs+1-1
......@@ -8,7 +8,7 @@ use rustc_hir::def::{CtorOf, DefKind};
88use rustc_macros::extension;
99pub use rustc_type_ir::error::ExpectedFound;
1010
11use crate::ty::print::{with_forced_trimmed_paths, FmtPrinter, PrettyPrinter};
11use crate::ty::print::{FmtPrinter, PrettyPrinter, with_forced_trimmed_paths};
1212use crate::ty::{self, Ty, TyCtxt};
1313
1414pub type TypeError<'tcx> = rustc_type_ir::error::TypeError<TyCtxt<'tcx>>;
compiler/rustc_middle/src/ty/fold.rs+15-20
......@@ -1,7 +1,7 @@
11use rustc_data_structures::fx::FxIndexMap;
22use rustc_hir::def_id::DefId;
33pub use rustc_type_ir::fold::{
4 shift_region, shift_vars, FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable,
4 FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable, shift_region, shift_vars,
55};
66use tracing::{debug, instrument};
77
......@@ -336,26 +336,21 @@ impl<'tcx> TyCtxt<'tcx> {
336336 T: TypeFoldable<TyCtxt<'tcx>>,
337337 {
338338 let shift_bv = |bv: ty::BoundVar| ty::BoundVar::from_usize(bv.as_usize() + bound_vars);
339 self.replace_escaping_bound_vars_uncached(
340 value,
341 FnMutDelegate {
342 regions: &mut |r: ty::BoundRegion| {
343 ty::Region::new_bound(
344 self,
345 ty::INNERMOST,
346 ty::BoundRegion { var: shift_bv(r.var), kind: r.kind },
347 )
348 },
349 types: &mut |t: ty::BoundTy| {
350 Ty::new_bound(
351 self,
352 ty::INNERMOST,
353 ty::BoundTy { var: shift_bv(t.var), kind: t.kind },
354 )
355 },
356 consts: &mut |c| ty::Const::new_bound(self, ty::INNERMOST, shift_bv(c)),
339 self.replace_escaping_bound_vars_uncached(value, FnMutDelegate {
340 regions: &mut |r: ty::BoundRegion| {
341 ty::Region::new_bound(self, ty::INNERMOST, ty::BoundRegion {
342 var: shift_bv(r.var),
343 kind: r.kind,
344 })
357345 },
358 )
346 types: &mut |t: ty::BoundTy| {
347 Ty::new_bound(self, ty::INNERMOST, ty::BoundTy {
348 var: shift_bv(t.var),
349 kind: t.kind,
350 })
351 },
352 consts: &mut |c| ty::Const::new_bound(self, ty::INNERMOST, shift_bv(c)),
353 })
359354 }
360355
361356 /// Replaces any late-bound regions bound in `value` with `'erased`. Useful in codegen but also
compiler/rustc_middle/src/ty/generic_args.rs+1-1
......@@ -11,7 +11,7 @@ use rustc_ast_ir::walk_visitable_list;
1111use rustc_data_structures::intern::Interned;
1212use rustc_errors::{DiagArgValue, IntoDiagArg};
1313use rustc_hir::def_id::DefId;
14use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable};
14use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable, extension};
1515use rustc_serialize::{Decodable, Encodable};
1616use rustc_type_ir::WithCachedTypeInfo;
1717use smallvec::SmallVec;
compiler/rustc_middle/src/ty/generics.rs+1-1
......@@ -2,8 +2,8 @@ use rustc_ast as ast;
22use rustc_data_structures::fx::FxHashMap;
33use rustc_hir::def_id::DefId;
44use rustc_macros::{HashStable, TyDecodable, TyEncodable};
5use rustc_span::symbol::{kw, Symbol};
65use rustc_span::Span;
6use rustc_span::symbol::{Symbol, kw};
77use tracing::instrument;
88
99use super::{Clause, InstantiatedPredicates, ParamConst, ParamTy, Ty, TyCtxt};
compiler/rustc_middle/src/ty/instance.rs+2-2
......@@ -12,12 +12,12 @@ use rustc_index::bit_set::FiniteBitSet;
1212use rustc_macros::{Decodable, Encodable, HashStable, Lift, TyDecodable, TyEncodable};
1313use rustc_middle::ty::normalize_erasing_regions::NormalizationError;
1414use rustc_span::def_id::LOCAL_CRATE;
15use rustc_span::{Span, Symbol, DUMMY_SP};
15use rustc_span::{DUMMY_SP, Span, Symbol};
1616use tracing::{debug, instrument};
1717
1818use crate::error;
1919use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
20use crate::ty::print::{shrunk_instance_name, FmtPrinter, Printer};
20use crate::ty::print::{FmtPrinter, Printer, shrunk_instance_name};
2121use crate::ty::{
2222 self, EarlyBinder, GenericArgs, GenericArgsRef, Ty, TyCtxt, TypeFoldable, TypeSuperFoldable,
2323 TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor,
compiler/rustc_middle/src/ty/intrinsic.rs+1-1
......@@ -1,6 +1,6 @@
11use rustc_macros::{Decodable, Encodable, HashStable};
2use rustc_span::def_id::DefId;
32use rustc_span::Symbol;
3use rustc_span::def_id::DefId;
44
55use super::TyCtxt;
66
compiler/rustc_middle/src/ty/layout.rs+8-9
......@@ -7,13 +7,13 @@ use rustc_errors::{
77 Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, IntoDiagArg, Level,
88};
99use rustc_hir as hir;
10use rustc_hir::def_id::DefId;
1110use rustc_hir::LangItem;
11use rustc_hir::def_id::DefId;
1212use rustc_index::IndexVec;
13use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable};
13use rustc_macros::{HashStable, TyDecodable, TyEncodable, extension};
1414use rustc_session::config::OptLevel;
15use rustc_span::symbol::{sym, Symbol};
16use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
15use rustc_span::symbol::{Symbol, sym};
16use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
1717use rustc_target::abi::call::FnAbi;
1818use rustc_target::abi::*;
1919use rustc_target::spec::abi::Abi as SpecAbi;
......@@ -1295,11 +1295,10 @@ pub trait FnAbiOf<'tcx>: FnAbiOfHelpers<'tcx> {
12951295 // However, we don't do this early in order to avoid calling
12961296 // `def_span` unconditionally (which may have a perf penalty).
12971297 let span = if !span.is_dummy() { span } else { tcx.def_span(instance.def_id()) };
1298 self.handle_fn_abi_err(
1299 *err,
1300 span,
1301 FnAbiRequest::OfInstance { instance, extra_args },
1302 )
1298 self.handle_fn_abi_err(*err, span, FnAbiRequest::OfInstance {
1299 instance,
1300 extra_args,
1301 })
13031302 }),
13041303 )
13051304 }
compiler/rustc_middle/src/ty/list.rs+1-1
......@@ -4,7 +4,7 @@ use std::hash::{Hash, Hasher};
44use std::ops::Deref;
55use std::{fmt, iter, mem, ptr, slice};
66
7use rustc_data_structures::aligned::{align_of, Aligned};
7use rustc_data_structures::aligned::{Aligned, align_of};
88#[cfg(parallel_compiler)]
99use rustc_data_structures::sync::DynSync;
1010use rustc_serialize::{Encodable, Encoder};
compiler/rustc_middle/src/ty/mod.rs+15-15
......@@ -26,52 +26,55 @@ pub use generics::*;
2626pub use intrinsic::IntrinsicDef;
2727use rustc_ast::expand::StrippedCfgItem;
2828use rustc_ast::node_id::NodeMap;
29pub use rustc_ast_ir::{try_visit, Movability, Mutability};
29pub use rustc_ast_ir::{Movability, Mutability, try_visit};
3030use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
3131use rustc_data_structures::intern::Interned;
3232use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
3333use rustc_data_structures::steal::Steal;
3434use rustc_data_structures::tagged_ptr::CopyTaggedPtr;
3535use rustc_errors::{Diag, ErrorGuaranteed, StashKey};
36use rustc_hir::LangItem;
3637use rustc_hir::def::{CtorKind, CtorOf, DefKind, DocLinkResMap, LifetimeRes, Res};
3738use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, LocalDefIdMap};
38use rustc_hir::LangItem;
3939use rustc_index::IndexVec;
4040use rustc_macros::{
41 extension, Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable,
42 TypeVisitable,
41 Decodable, Encodable, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable,
42 extension,
4343};
4444use rustc_query_system::ich::StableHashingContext;
4545use rustc_serialize::{Decodable, Encodable};
4646use rustc_session::lint::LintBuffer;
4747pub use rustc_session::lint::RegisteredTools;
4848use rustc_span::hygiene::MacroKind;
49use rustc_span::symbol::{kw, sym, Ident, Symbol};
49use rustc_span::symbol::{Ident, Symbol, kw, sym};
5050use rustc_span::{ExpnId, ExpnKind, Span};
5151use rustc_target::abi::{Align, FieldIdx, Integer, IntegerType, VariantIdx};
5252pub use rustc_target::abi::{ReprFlags, ReprOptions};
53pub use rustc_type_ir::relate::VarianceDiagInfo;
5453pub use rustc_type_ir::ConstKind::{
5554 Bound as BoundCt, Error as ErrorCt, Expr as ExprCt, Infer as InferCt, Param as ParamCt,
5655 Placeholder as PlaceholderCt, Unevaluated, Value,
5756};
57pub use rustc_type_ir::relate::VarianceDiagInfo;
5858pub use rustc_type_ir::*;
5959use tracing::{debug, instrument};
6060pub use vtable::*;
6161use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
6262
63pub use self::AssocItemContainer::*;
64pub use self::BorrowKind::*;
65pub use self::IntVarValue::*;
6366pub use self::closure::{
64 analyze_coroutine_closure_captures, is_ancestor_or_same_capture, place_to_string_for_capture,
65 BorrowKind, CaptureInfo, CapturedPlace, ClosureTypeInfo, MinCaptureInformationMap,
66 MinCaptureList, RootVariableMinCaptureList, UpvarCapture, UpvarId, UpvarPath,
67 CAPTURE_STRUCT_LOCAL,
67 BorrowKind, CAPTURE_STRUCT_LOCAL, CaptureInfo, CapturedPlace, ClosureTypeInfo,
68 MinCaptureInformationMap, MinCaptureList, RootVariableMinCaptureList, UpvarCapture, UpvarId,
69 UpvarPath, analyze_coroutine_closure_captures, is_ancestor_or_same_capture,
70 place_to_string_for_capture,
6871};
6972pub use self::consts::{
7073 Const, ConstInt, ConstKind, Expr, ExprKind, FeedConstTy, ScalarInt, UnevaluatedConst, ValTree,
7174};
7275pub use self::context::{
73 tls, CtxtInterners, CurrentGcx, DeducedParamAttrs, Feed, FreeRegionInfo, GlobalCtxt, Lift,
74 TyCtxt, TyCtxtFeed,
76 CtxtInterners, CurrentGcx, DeducedParamAttrs, Feed, FreeRegionInfo, GlobalCtxt, Lift, TyCtxt,
77 TyCtxtFeed, tls,
7578};
7679pub use self::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
7780pub use self::instance::{Instance, InstanceKind, ReifyReason, ShortInstance, UnusedGenericParams};
......@@ -104,9 +107,6 @@ pub use self::typeck_results::{
104107 TypeckResults, UserType, UserTypeAnnotationIndex,
105108};
106109pub use self::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
107pub use self::AssocItemContainer::*;
108pub use self::BorrowKind::*;
109pub use self::IntVarValue::*;
110110use crate::error::{OpaqueHiddenTypeMismatch, TypeMismatchReason};
111111use crate::metadata::ModChild;
112112use crate::middle::privacy::EffectiveVisibilities;
compiler/rustc_middle/src/ty/opaque_types.rs+1-1
......@@ -1,6 +1,6 @@
11use rustc_data_structures::fx::FxHashMap;
2use rustc_span::def_id::DefId;
32use rustc_span::Span;
3use rustc_span::def_id::DefId;
44use tracing::{debug, instrument, trace};
55
66use crate::error::ConstNotUsedTraitAlias;
compiler/rustc_middle/src/ty/predicate.rs+1-1
......@@ -3,7 +3,7 @@ use std::cmp::Ordering;
33use rustc_data_structures::captures::Captures;
44use rustc_data_structures::intern::Interned;
55use rustc_hir::def_id::DefId;
6use rustc_macros::{extension, HashStable};
6use rustc_macros::{HashStable, extension};
77use rustc_type_ir as ir;
88use tracing::instrument;
99
compiler/rustc_middle/src/ty/print/pretty.rs+7-7
......@@ -3,23 +3,23 @@ use std::fmt::{self, Write as _};
33use std::iter;
44use std::ops::{Deref, DerefMut};
55
6use rustc_apfloat::ieee::{Double, Half, Quad, Single};
76use rustc_apfloat::Float;
7use rustc_apfloat::ieee::{Double, Half, Quad, Single};
88use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
99use rustc_data_structures::unord::UnordMap;
1010use rustc_hir as hir;
11use rustc_hir::LangItem;
1112use rustc_hir::def::{self, CtorKind, DefKind, Namespace};
12use rustc_hir::def_id::{DefIdMap, DefIdSet, ModDefId, CRATE_DEF_ID, LOCAL_CRATE};
13use rustc_hir::def_id::{CRATE_DEF_ID, DefIdMap, DefIdSet, LOCAL_CRATE, ModDefId};
1314use rustc_hir::definitions::{DefKey, DefPathDataName};
14use rustc_hir::LangItem;
15use rustc_macros::{extension, Lift};
16use rustc_session::cstore::{ExternCrate, ExternCrateSource};
15use rustc_macros::{Lift, extension};
1716use rustc_session::Limit;
18use rustc_span::symbol::{kw, Ident, Symbol};
17use rustc_session::cstore::{ExternCrate, ExternCrateSource};
1918use rustc_span::FileNameDisplayPreference;
19use rustc_span::symbol::{Ident, Symbol, kw};
2020use rustc_target::abi::Size;
2121use rustc_target::spec::abi::Abi;
22use rustc_type_ir::{elaborate, Upcast as _};
22use rustc_type_ir::{Upcast as _, elaborate};
2323use smallvec::SmallVec;
2424
2525// `pretty` is a separate module only for organization.
compiler/rustc_middle/src/ty/region.rs+2-2
......@@ -4,8 +4,8 @@ use rustc_data_structures::intern::Interned;
44use rustc_errors::MultiSpan;
55use rustc_hir::def_id::DefId;
66use rustc_macros::{HashStable, TyDecodable, TyEncodable};
7use rustc_span::symbol::{kw, sym, Symbol};
8use rustc_span::{ErrorGuaranteed, DUMMY_SP};
7use rustc_span::symbol::{Symbol, kw, sym};
8use rustc_span::{DUMMY_SP, ErrorGuaranteed};
99use rustc_type_ir::RegionKind as IrRegionKind;
1010pub use rustc_type_ir::RegionVid;
1111use tracing::debug;
compiler/rustc_middle/src/ty/structural_impls.rs+1-1
......@@ -16,7 +16,7 @@ use super::print::PrettyPrinter;
1616use super::{GenericArg, GenericArgKind, Pattern, Region};
1717use crate::mir::interpret;
1818use crate::ty::fold::{FallibleTypeFolder, TypeFoldable, TypeSuperFoldable};
19use crate::ty::print::{with_no_trimmed_paths, FmtPrinter, Printer};
19use crate::ty::print::{FmtPrinter, Printer, with_no_trimmed_paths};
2020use crate::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
2121use crate::ty::{self, InferConst, Lift, Term, TermKind, Ty, TyCtxt};
2222
compiler/rustc_middle/src/ty/sty.rs+6-6
......@@ -11,15 +11,15 @@ use hir::def::{CtorKind, DefKind};
1111use rustc_data_structures::captures::Captures;
1212use rustc_errors::{ErrorGuaranteed, MultiSpan};
1313use rustc_hir as hir;
14use rustc_hir::def_id::DefId;
1514use rustc_hir::LangItem;
16use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable, TypeFoldable};
17use rustc_span::symbol::{sym, Symbol};
18use rustc_span::{Span, DUMMY_SP};
19use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
15use rustc_hir::def_id::DefId;
16use rustc_macros::{HashStable, TyDecodable, TyEncodable, TypeFoldable, extension};
17use rustc_span::symbol::{Symbol, sym};
18use rustc_span::{DUMMY_SP, Span};
19use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
2020use rustc_target::spec::abi;
21use rustc_type_ir::visit::TypeVisitableExt;
2221use rustc_type_ir::TyKind::*;
22use rustc_type_ir::visit::TypeVisitableExt;
2323use rustc_type_ir::{self as ir, BoundVar, CollectAndApply, DynKind};
2424use ty::util::{AsyncDropGlueMorphology, IntTypeExt};
2525
compiler/rustc_middle/src/ty/typeck_results.rs+2-2
......@@ -23,8 +23,8 @@ use crate::hir::place::Place as HirPlace;
2323use crate::infer::canonical::Canonical;
2424use crate::traits::ObligationCause;
2525use crate::ty::{
26 self, tls, BoundVar, CanonicalPolyFnSig, ClosureSizeProfileData, GenericArgKind, GenericArgs,
27 GenericArgsRef, Ty, UserArgs,
26 self, BoundVar, CanonicalPolyFnSig, ClosureSizeProfileData, GenericArgKind, GenericArgs,
27 GenericArgsRef, Ty, UserArgs, tls,
2828};
2929
3030#[derive(TyEncodable, TyDecodable, Debug, HashStable)]
compiler/rustc_middle/src/ty/util.rs+2-2
......@@ -11,12 +11,12 @@ use rustc_hir as hir;
1111use rustc_hir::def::{CtorOf, DefKind, Res};
1212use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
1313use rustc_index::bit_set::GrowableBitSet;
14use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable};
14use rustc_macros::{HashStable, TyDecodable, TyEncodable, extension};
1515use rustc_session::Limit;
1616use rustc_span::sym;
1717use rustc_target::abi::{Float, Integer, IntegerType, Size};
1818use rustc_target::spec::abi::Abi;
19use smallvec::{smallvec, SmallVec};
19use smallvec::{SmallVec, smallvec};
2020use tracing::{debug, instrument, trace};
2121
2222use crate::middle::codegen_fn_attrs::CodegenFnAttrFlags;
compiler/rustc_middle/src/ty/vtable.rs+1-1
......@@ -3,7 +3,7 @@ use std::fmt;
33use rustc_ast::Mutability;
44use rustc_macros::HashStable;
55
6use crate::mir::interpret::{alloc_range, AllocId, Allocation, Pointer, Scalar, CTFE_ALLOC_SALT};
6use crate::mir::interpret::{AllocId, Allocation, CTFE_ALLOC_SALT, Pointer, Scalar, alloc_range};
77use crate::ty::{self, Instance, PolyTraitRef, Ty, TyCtxt};
88
99#[derive(Clone, Copy, PartialEq, HashStable)]
compiler/rustc_middle/src/ty/walk.rs+1-1
......@@ -2,7 +2,7 @@
22//! WARNING: this does not keep track of the region depth.
33
44use rustc_data_structures::sso::SsoHashSet;
5use smallvec::{smallvec, SmallVec};
5use smallvec::{SmallVec, smallvec};
66use tracing::debug;
77
88use crate::ty::{self, GenericArg, GenericArgKind, Ty};
compiler/rustc_middle/src/util/bug.rs+2-2
......@@ -1,12 +1,12 @@
11// These functions are used by macro expansion for bug! and span_bug!
22
33use std::fmt;
4use std::panic::{panic_any, Location};
4use std::panic::{Location, panic_any};
55
66use rustc_errors::MultiSpan;
77use rustc_span::Span;
88
9use crate::ty::{tls, TyCtxt};
9use crate::ty::{TyCtxt, tls};
1010
1111#[cold]
1212#[inline(never)]
compiler/rustc_middle/src/util/call_kind.rs+2-2
......@@ -3,9 +3,9 @@
33//! context.
44
55use rustc_hir::def_id::DefId;
6use rustc_hir::{lang_items, LangItem};
6use rustc_hir::{LangItem, lang_items};
77use rustc_span::symbol::Ident;
8use rustc_span::{sym, DesugaringKind, Span};
8use rustc_span::{DesugaringKind, Span, sym};
99use tracing::debug;
1010
1111use crate::ty::{AssocItemContainer, GenericArgsRef, Instance, ParamEnv, Ty, TyCtxt};
compiler/rustc_middle/src/util/mod.rs+1-1
......@@ -3,7 +3,7 @@ pub mod call_kind;
33pub mod common;
44pub mod find_self_call;
55
6pub use call_kind::{call_kind, CallDesugaringKind, CallKind};
6pub use call_kind::{CallDesugaringKind, CallKind, call_kind};
77pub use find_self_call::find_self_call;
88
99#[derive(Default, Copy, Clone)]
compiler/rustc_middle/src/values.rs+2-2
......@@ -4,12 +4,12 @@ use std::ops::ControlFlow;
44
55use rustc_data_structures::fx::FxHashSet;
66use rustc_errors::codes::*;
7use rustc_errors::{pluralize, struct_span_code_err, Applicability, MultiSpan};
7use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err};
88use rustc_hir as hir;
99use rustc_hir::def::{DefKind, Res};
1010use rustc_middle::ty::{self, Representability, Ty, TyCtxt};
11use rustc_query_system::query::{report_cycle, CycleError};
1211use rustc_query_system::Value;
12use rustc_query_system::query::{CycleError, report_cycle};
1313use rustc_span::def_id::LocalDefId;
1414use rustc_span::{ErrorGuaranteed, Span};
1515
compiler/rustc_mir_build/src/build/block.rs+1-1
......@@ -5,8 +5,8 @@ use rustc_middle::{span_bug, ty};
55use rustc_span::Span;
66use tracing::debug;
77
8use crate::build::matches::{DeclareLetBindings, EmitStorageLive, ScheduleDrops};
98use crate::build::ForGuard::OutsideGuard;
9use crate::build::matches::{DeclareLetBindings, EmitStorageLive, ScheduleDrops};
1010use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
1111
1212impl<'a, 'tcx> Builder<'a, 'tcx> {
compiler/rustc_mir_build/src/build/cfg.rs+4-4
......@@ -40,10 +40,10 @@ impl<'tcx> CFG<'tcx> {
4040 place: Place<'tcx>,
4141 rvalue: Rvalue<'tcx>,
4242 ) {
43 self.push(
44 block,
45 Statement { source_info, kind: StatementKind::Assign(Box::new((place, rvalue))) },
46 );
43 self.push(block, Statement {
44 source_info,
45 kind: StatementKind::Assign(Box::new((place, rvalue))),
46 });
4747 }
4848
4949 pub(crate) fn push_assign_constant(
compiler/rustc_mir_build/src/build/custom/mod.rs+1-1
......@@ -19,8 +19,8 @@
1919
2020use rustc_ast::Attribute;
2121use rustc_data_structures::fx::FxHashMap;
22use rustc_hir::def_id::DefId;
2322use rustc_hir::HirId;
23use rustc_hir::def_id::DefId;
2424use rustc_index::{IndexSlice, IndexVec};
2525use rustc_middle::mir::*;
2626use rustc_middle::span_bug;
compiler/rustc_mir_build/src/build/custom/parse/instruction.rs+2-2
......@@ -4,11 +4,11 @@ use rustc_middle::mir::*;
44use rustc_middle::thir::*;
55use rustc_middle::ty;
66use rustc_middle::ty::cast::mir_cast_kind;
7use rustc_span::source_map::Spanned;
87use rustc_span::Span;
8use rustc_span::source_map::Spanned;
99use rustc_target::abi::{FieldIdx, VariantIdx};
1010
11use super::{parse_by_kind, PResult, ParseCtxt};
11use super::{PResult, ParseCtxt, parse_by_kind};
1212use crate::build::custom::ParseError;
1313use crate::build::expr::as_constant::as_constant_inner;
1414
compiler/rustc_mir_build/src/build/expr/as_constant.rs+2-2
......@@ -3,7 +3,7 @@
33use rustc_ast as ast;
44use rustc_hir::LangItem;
55use rustc_middle::mir::interpret::{
6 Allocation, LitToConstError, LitToConstInput, Scalar, CTFE_ALLOC_SALT,
6 Allocation, CTFE_ALLOC_SALT, LitToConstError, LitToConstInput, Scalar,
77};
88use rustc_middle::mir::*;
99use rustc_middle::thir::*;
......@@ -14,7 +14,7 @@ use rustc_middle::{bug, mir, span_bug};
1414use rustc_target::abi::Size;
1515use tracing::{instrument, trace};
1616
17use crate::build::{parse_float_into_constval, Builder};
17use crate::build::{Builder, parse_float_into_constval};
1818
1919impl<'a, 'tcx> Builder<'a, 'tcx> {
2020 /// Compile `expr`, yielding a compile-time constant. Assumes that
compiler/rustc_mir_build/src/build/expr/as_place.rs+22-28
......@@ -12,11 +12,11 @@ use rustc_middle::thir::*;
1212use rustc_middle::ty::{self, AdtDef, CanonicalUserTypeAnnotation, Ty, Variance};
1313use rustc_middle::{bug, span_bug};
1414use rustc_span::Span;
15use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
15use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
1616use tracing::{debug, instrument, trace};
1717
18use crate::build::expr::category::Category;
1918use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
19use crate::build::expr::category::Category;
2020use crate::build::{BlockAnd, BlockAndExtension, Builder, Capture, CaptureMap};
2121
2222/// The "outermost" place that holds this value.
......@@ -483,19 +483,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
483483 });
484484
485485 let place = place_builder.to_place(this);
486 this.cfg.push(
487 block,
488 Statement {
489 source_info,
490 kind: StatementKind::AscribeUserType(
491 Box::new((
492 place,
493 UserTypeProjection { base: annotation_index, projs: vec![] },
494 )),
495 Variance::Invariant,
496 ),
497 },
498 );
486 this.cfg.push(block, Statement {
487 source_info,
488 kind: StatementKind::AscribeUserType(
489 Box::new((place, UserTypeProjection {
490 base: annotation_index,
491 projs: vec![],
492 })),
493 Variance::Invariant,
494 ),
495 });
499496 }
500497 block.and(place_builder)
501498 }
......@@ -511,19 +508,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
511508 user_ty: user_ty.clone(),
512509 inferred_ty: expr.ty,
513510 });
514 this.cfg.push(
515 block,
516 Statement {
517 source_info,
518 kind: StatementKind::AscribeUserType(
519 Box::new((
520 Place::from(temp),
521 UserTypeProjection { base: annotation_index, projs: vec![] },
522 )),
523 Variance::Invariant,
524 ),
525 },
526 );
511 this.cfg.push(block, Statement {
512 source_info,
513 kind: StatementKind::AscribeUserType(
514 Box::new((Place::from(temp), UserTypeProjection {
515 base: annotation_index,
516 projs: vec![],
517 })),
518 Variance::Invariant,
519 ),
520 });
527521 }
528522 block.and(PlaceBuilder::from(temp))
529523 }
compiler/rustc_mir_build/src/build/expr/as_rvalue.rs+31-42
......@@ -7,12 +7,12 @@ use rustc_middle::middle::region;
77use rustc_middle::mir::interpret::Scalar;
88use rustc_middle::mir::*;
99use rustc_middle::thir::*;
10use rustc_middle::ty::cast::{mir_cast_kind, CastTy};
10use rustc_middle::ty::cast::{CastTy, mir_cast_kind};
1111use rustc_middle::ty::layout::IntegerExt;
1212use rustc_middle::ty::util::IntTypeExt;
1313use rustc_middle::ty::{self, Ty, UpvarArgs};
1414use rustc_span::source_map::Spanned;
15use rustc_span::{Span, DUMMY_SP};
15use rustc_span::{DUMMY_SP, Span};
1616use rustc_target::abi::{Abi, FieldIdx, Primitive};
1717use tracing::debug;
1818
......@@ -147,23 +147,19 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
147147 );
148148 let storage = this.temp(Ty::new_mut_ptr(tcx, tcx.types.u8), expr_span);
149149 let success = this.cfg.start_new_block();
150 this.cfg.terminate(
151 block,
152 source_info,
153 TerminatorKind::Call {
154 func: exchange_malloc,
155 args: [
156 Spanned { node: Operand::Move(size), span: DUMMY_SP },
157 Spanned { node: Operand::Move(align), span: DUMMY_SP },
158 ]
159 .into(),
160 destination: storage,
161 target: Some(success),
162 unwind: UnwindAction::Continue,
163 call_source: CallSource::Misc,
164 fn_span: expr_span,
165 },
166 );
150 this.cfg.terminate(block, source_info, TerminatorKind::Call {
151 func: exchange_malloc,
152 args: [Spanned { node: Operand::Move(size), span: DUMMY_SP }, Spanned {
153 node: Operand::Move(align),
154 span: DUMMY_SP,
155 }]
156 .into(),
157 destination: storage,
158 target: Some(success),
159 unwind: UnwindAction::Continue,
160 call_source: CallSource::Misc,
161 fn_span: expr_span,
162 });
167163 this.diverge_from(block);
168164 block = success;
169165
......@@ -171,10 +167,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
171167 // and therefore is not considered during coroutine auto-trait
172168 // determination. See the comment about `box` at `yield_in_scope`.
173169 let result = this.local_decls.push(LocalDecl::new(expr.ty, expr_span));
174 this.cfg.push(
175 block,
176 Statement { source_info, kind: StatementKind::StorageLive(result) },
177 );
170 this.cfg.push(block, Statement {
171 source_info,
172 kind: StatementKind::StorageLive(result),
173 });
178174 if let Some(scope) = scope {
179175 // schedule a shallow free of that memory, lest we unwind:
180176 this.schedule_drop_storage_and_value(expr_span, scope, result);
......@@ -268,15 +264,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
268264 );
269265 merge_place
270266 };
271 this.cfg.push(
272 block,
273 Statement {
274 source_info,
275 kind: StatementKind::Intrinsic(Box::new(
276 NonDivergingIntrinsic::Assume(Operand::Move(assert_place)),
277 )),
278 },
279 );
267 this.cfg.push(block, Statement {
268 source_info,
269 kind: StatementKind::Intrinsic(Box::new(
270 NonDivergingIntrinsic::Assume(Operand::Move(assert_place)),
271 )),
272 });
280273 }
281274
282275 (op, ty)
......@@ -721,16 +714,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
721714 );
722715 if let Operand::Move(to_drop) = value_operand {
723716 let success = this.cfg.start_new_block();
724 this.cfg.terminate(
725 block,
726 outer_source_info,
727 TerminatorKind::Drop {
728 place: to_drop,
729 target: success,
730 unwind: UnwindAction::Continue,
731 replace: false,
732 },
733 );
717 this.cfg.terminate(block, outer_source_info, TerminatorKind::Drop {
718 place: to_drop,
719 target: success,
720 unwind: UnwindAction::Continue,
721 replace: false,
722 });
734723 this.diverge_from(block);
735724 block = success;
736725 }
compiler/rustc_mir_build/src/build/expr/into.rs+43-56
......@@ -221,14 +221,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
221221 this.in_breakable_scope(Some(loop_block), destination, expr_span, move |this| {
222222 // conduct the test, if necessary
223223 let body_block = this.cfg.start_new_block();
224 this.cfg.terminate(
225 loop_block,
226 source_info,
227 TerminatorKind::FalseUnwind {
228 real_target: body_block,
229 unwind: UnwindAction::Continue,
230 },
231 );
224 this.cfg.terminate(loop_block, source_info, TerminatorKind::FalseUnwind {
225 real_target: body_block,
226 unwind: UnwindAction::Continue,
227 });
232228 this.diverge_from(loop_block);
233229
234230 // The “return” value of the loop body must always be a unit. We therefore
......@@ -259,30 +255,26 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
259255
260256 debug!("expr_into_dest: fn_span={:?}", fn_span);
261257
262 this.cfg.terminate(
263 block,
264 source_info,
265 TerminatorKind::Call {
266 func: fun,
267 args,
268 unwind: UnwindAction::Continue,
269 destination,
270 // The presence or absence of a return edge affects control-flow sensitive
271 // MIR checks and ultimately whether code is accepted or not. We can only
272 // omit the return edge if a return type is visibly uninhabited to a module
273 // that makes the call.
274 target: expr
275 .ty
276 .is_inhabited_from(this.tcx, this.parent_module, this.param_env)
277 .then_some(success),
278 call_source: if from_hir_call {
279 CallSource::Normal
280 } else {
281 CallSource::OverloadedOperator
282 },
283 fn_span,
258 this.cfg.terminate(block, source_info, TerminatorKind::Call {
259 func: fun,
260 args,
261 unwind: UnwindAction::Continue,
262 destination,
263 // The presence or absence of a return edge affects control-flow sensitive
264 // MIR checks and ultimately whether code is accepted or not. We can only
265 // omit the return edge if a return type is visibly uninhabited to a module
266 // that makes the call.
267 target: expr
268 .ty
269 .is_inhabited_from(this.tcx, this.parent_module, this.param_env)
270 .then_some(success),
271 call_source: if from_hir_call {
272 CallSource::Normal
273 } else {
274 CallSource::OverloadedOperator
284275 },
285 );
276 fn_span,
277 });
286278 this.diverge_from(block);
287279 success.unit()
288280 }
......@@ -469,11 +461,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
469461 let tmp = this.get_unit_temp();
470462 let target =
471463 this.ast_block(tmp, target, block, source_info).into_block();
472 this.cfg.terminate(
473 target,
474 source_info,
475 TerminatorKind::Goto { target: destination_block },
476 );
464 this.cfg.terminate(target, source_info, TerminatorKind::Goto {
465 target: destination_block,
466 });
477467
478468 mir::InlineAsmOperand::Label { target_index }
479469 }
......@@ -484,22 +474,18 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
484474 this.cfg.push_assign_unit(block, source_info, destination, this.tcx);
485475 }
486476
487 this.cfg.terminate(
488 block,
489 source_info,
490 TerminatorKind::InlineAsm {
491 template,
492 operands,
493 options,
494 line_spans,
495 targets: targets.into_boxed_slice(),
496 unwind: if options.contains(InlineAsmOptions::MAY_UNWIND) {
497 UnwindAction::Continue
498 } else {
499 UnwindAction::Unreachable
500 },
477 this.cfg.terminate(block, source_info, TerminatorKind::InlineAsm {
478 template,
479 operands,
480 options,
481 line_spans,
482 targets: targets.into_boxed_slice(),
483 unwind: if options.contains(InlineAsmOptions::MAY_UNWIND) {
484 UnwindAction::Continue
485 } else {
486 UnwindAction::Unreachable
501487 },
502 );
488 });
503489 if options.contains(InlineAsmOptions::MAY_UNWIND) {
504490 this.diverge_from(block);
505491 }
......@@ -562,11 +548,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
562548 )
563549 );
564550 let resume = this.cfg.start_new_block();
565 this.cfg.terminate(
566 block,
567 source_info,
568 TerminatorKind::Yield { value, resume, resume_arg: destination, drop: None },
569 );
551 this.cfg.terminate(block, source_info, TerminatorKind::Yield {
552 value,
553 resume,
554 resume_arg: destination,
555 drop: None,
556 });
570557 this.coroutine_drop_cleanup(block);
571558 resume.unit()
572559 }
compiler/rustc_mir_build/src/build/expr/stmt.rs+5-5
......@@ -123,11 +123,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
123123
124124 unpack!(block = this.break_for_tail_call(block, &args, source_info));
125125
126 this.cfg.terminate(
127 block,
128 source_info,
129 TerminatorKind::TailCall { func: fun, args, fn_span },
130 );
126 this.cfg.terminate(block, source_info, TerminatorKind::TailCall {
127 func: fun,
128 args,
129 fn_span,
130 });
131131
132132 this.cfg.start_new_block().unit()
133133 })
compiler/rustc_mir_build/src/build/matches/match_pair.rs+5-8
......@@ -2,9 +2,9 @@ use rustc_middle::mir::*;
22use rustc_middle::thir::{self, *};
33use rustc_middle::ty::{self, Ty, TypeVisitableExt};
44
5use crate::build::Builder;
56use crate::build::expr::as_place::{PlaceBase, PlaceBuilder};
67use crate::build::matches::{FlatPat, MatchPairTree, TestCase};
7use crate::build::Builder;
88
99impl<'a, 'tcx> Builder<'a, 'tcx> {
1010 /// Builds and returns [`MatchPairTree`] subtrees, one for each pattern in
......@@ -162,13 +162,10 @@ impl<'pat, 'tcx> MatchPairTree<'pat, 'tcx> {
162162 let ascription = place.map(|source| {
163163 let span = pattern.span;
164164 let parent_id = cx.tcx.typeck_root_def_id(cx.def_id.to_def_id());
165 let args = ty::InlineConstArgs::new(
166 cx.tcx,
167 ty::InlineConstArgsParts {
168 parent_args: ty::GenericArgs::identity_for_item(cx.tcx, parent_id),
169 ty: cx.infcx.next_ty_var(span),
170 },
171 )
165 let args = ty::InlineConstArgs::new(cx.tcx, ty::InlineConstArgsParts {
166 parent_args: ty::GenericArgs::identity_for_item(cx.tcx, parent_id),
167 ty: cx.infcx.next_ty_var(span),
168 })
172169 .args;
173170 let user_ty = cx.infcx.canonicalize_user_type_annotation(ty::UserType::TypeOf(
174171 def.to_def_id(),
compiler/rustc_mir_build/src/build/matches/mod.rs+46-67
......@@ -18,9 +18,9 @@ use rustc_span::{BytePos, Pos, Span};
1818use rustc_target::abi::VariantIdx;
1919use tracing::{debug, instrument};
2020
21use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
2122use crate::build::expr::as_place::PlaceBuilder;
2223use crate::build::scope::DropKind;
23use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard};
2424use crate::build::{
2525 BlockAnd, BlockAndExtension, Builder, GuardFrame, GuardFrameLocal, LocalsForNode,
2626};
......@@ -104,11 +104,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
104104 variable_source_info: SourceInfo,
105105 declare_let_bindings: DeclareLetBindings,
106106 ) -> BlockAnd<()> {
107 self.then_else_break_inner(
108 block,
109 expr_id,
110 ThenElseArgs { temp_scope_override, variable_source_info, declare_let_bindings },
111 )
107 self.then_else_break_inner(block, expr_id, ThenElseArgs {
108 temp_scope_override,
109 variable_source_info,
110 declare_let_bindings,
111 })
112112 }
113113
114114 fn then_else_break_inner(
......@@ -134,24 +134,16 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
134134 let local_scope = this.local_scope();
135135 let (lhs_success_block, failure_block) =
136136 this.in_if_then_scope(local_scope, expr_span, |this| {
137 this.then_else_break_inner(
138 block,
139 lhs,
140 ThenElseArgs {
141 declare_let_bindings: DeclareLetBindings::LetNotPermitted,
142 ..args
143 },
144 )
145 });
146 let rhs_success_block = this
147 .then_else_break_inner(
148 failure_block,
149 rhs,
150 ThenElseArgs {
137 this.then_else_break_inner(block, lhs, ThenElseArgs {
151138 declare_let_bindings: DeclareLetBindings::LetNotPermitted,
152139 ..args
153 },
154 )
140 })
141 });
142 let rhs_success_block = this
143 .then_else_break_inner(failure_block, rhs, ThenElseArgs {
144 declare_let_bindings: DeclareLetBindings::LetNotPermitted,
145 ..args
146 })
155147 .into_block();
156148
157149 // Make the LHS and RHS success arms converge to a common block.
......@@ -178,14 +170,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
178170 if this.tcx.sess.instrument_coverage() {
179171 this.cfg.push_coverage_span_marker(block, this.source_info(expr_span));
180172 }
181 this.then_else_break_inner(
182 block,
183 arg,
184 ThenElseArgs {
185 declare_let_bindings: DeclareLetBindings::LetNotPermitted,
186 ..args
187 },
188 )
173 this.then_else_break_inner(block, arg, ThenElseArgs {
174 declare_let_bindings: DeclareLetBindings::LetNotPermitted,
175 ..args
176 })
189177 });
190178 this.break_for_else(success_block, args.variable_source_info);
191179 failure_block.unit()
......@@ -638,30 +626,27 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
638626 let ty_source_info = self.source_info(annotation.span);
639627
640628 let base = self.canonical_user_type_annotations.push(annotation.clone());
641 self.cfg.push(
642 block,
643 Statement {
644 source_info: ty_source_info,
645 kind: StatementKind::AscribeUserType(
646 Box::new((place, UserTypeProjection { base, projs: Vec::new() })),
647 // We always use invariant as the variance here. This is because the
648 // variance field from the ascription refers to the variance to use
649 // when applying the type to the value being matched, but this
650 // ascription applies rather to the type of the binding. e.g., in this
651 // example:
652 //
653 // ```
654 // let x: T = <expr>
655 // ```
656 //
657 // We are creating an ascription that defines the type of `x` to be
658 // exactly `T` (i.e., with invariance). The variance field, in
659 // contrast, is intended to be used to relate `T` to the type of
660 // `<expr>`.
661 ty::Invariant,
662 ),
663 },
664 );
629 self.cfg.push(block, Statement {
630 source_info: ty_source_info,
631 kind: StatementKind::AscribeUserType(
632 Box::new((place, UserTypeProjection { base, projs: Vec::new() })),
633 // We always use invariant as the variance here. This is because the
634 // variance field from the ascription refers to the variance to use
635 // when applying the type to the value being matched, but this
636 // ascription applies rather to the type of the binding. e.g., in this
637 // example:
638 //
639 // ```
640 // let x: T = <expr>
641 // ```
642 //
643 // We are creating an ascription that defines the type of `x` to be
644 // exactly `T` (i.e., with invariance). The variance field, in
645 // contrast, is intended to be used to relate `T` to the type of
646 // `<expr>`.
647 ty::Invariant,
648 ),
649 });
665650
666651 self.schedule_drop_for_binding(var, irrefutable_pat.span, OutsideGuard);
667652 block.unit()
......@@ -2559,19 +2544,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
25592544 let source_info = self.source_info(ascription.annotation.span);
25602545
25612546 let base = self.canonical_user_type_annotations.push(ascription.annotation);
2562 self.cfg.push(
2563 block,
2564 Statement {
2565 source_info,
2566 kind: StatementKind::AscribeUserType(
2567 Box::new((
2568 ascription.source,
2569 UserTypeProjection { base, projs: Vec::new() },
2570 )),
2571 ascription.variance,
2572 ),
2573 },
2574 );
2547 self.cfg.push(block, Statement {
2548 source_info,
2549 kind: StatementKind::AscribeUserType(
2550 Box::new((ascription.source, UserTypeProjection { base, projs: Vec::new() })),
2551 ascription.variance,
2552 ),
2553 });
25752554 }
25762555 }
25772556
compiler/rustc_mir_build/src/build/matches/simplify.rs+1-1
......@@ -16,8 +16,8 @@ use std::mem;
1616
1717use tracing::{debug, instrument};
1818
19use crate::build::matches::{MatchPairTree, PatternExtraData, TestCase};
2019use crate::build::Builder;
20use crate::build::matches::{MatchPairTree, PatternExtraData, TestCase};
2121
2222impl<'a, 'tcx> Builder<'a, 'tcx> {
2323 /// Simplify a list of match pairs so they all require a test. Stores relevant bindings and
compiler/rustc_mir_build/src/build/matches/test.rs+35-47
......@@ -16,12 +16,12 @@ use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt};
1616use rustc_middle::{bug, span_bug};
1717use rustc_span::def_id::DefId;
1818use rustc_span::source_map::Spanned;
19use rustc_span::symbol::{sym, Symbol};
20use rustc_span::{Span, DUMMY_SP};
19use rustc_span::symbol::{Symbol, sym};
20use rustc_span::{DUMMY_SP, Span};
2121use tracing::{debug, instrument};
2222
23use crate::build::matches::{Candidate, MatchPairTree, Test, TestBranch, TestCase, TestKind};
2423use crate::build::Builder;
24use crate::build::matches::{Candidate, MatchPairTree, Test, TestBranch, TestCase, TestKind};
2525
2626impl<'a, 'tcx> Builder<'a, 'tcx> {
2727 /// Identifies what test is needed to decide if `match_pair` is applicable.
......@@ -322,23 +322,15 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
322322 );
323323 // `let temp = <Ty as Deref>::deref(ref_src);`
324324 // or `let temp = <Ty as DerefMut>::deref_mut(ref_src);`
325 self.cfg.terminate(
326 block,
327 source_info,
328 TerminatorKind::Call {
329 func: Operand::Constant(Box::new(ConstOperand {
330 span,
331 user_ty: None,
332 const_: method,
333 })),
334 args: [Spanned { node: Operand::Move(ref_src), span }].into(),
335 destination: temp,
336 target: Some(target_block),
337 unwind: UnwindAction::Continue,
338 call_source: CallSource::Misc,
339 fn_span: source_info.span,
340 },
341 );
325 self.cfg.terminate(block, source_info, TerminatorKind::Call {
326 func: Operand::Constant(Box::new(ConstOperand { span, user_ty: None, const_: method })),
327 args: [Spanned { node: Operand::Move(ref_src), span }].into(),
328 destination: temp,
329 target: Some(target_block),
330 unwind: UnwindAction::Continue,
331 call_source: CallSource::Misc,
332 fn_span: source_info.span,
333 });
342334 }
343335
344336 /// Compare using the provided built-in comparison operator
......@@ -466,33 +458,29 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
466458 let bool_ty = self.tcx.types.bool;
467459 let eq_result = self.temp(bool_ty, source_info.span);
468460 let eq_block = self.cfg.start_new_block();
469 self.cfg.terminate(
470 block,
471 source_info,
472 TerminatorKind::Call {
473 func: Operand::Constant(Box::new(ConstOperand {
474 span: source_info.span,
475
476 // FIXME(#54571): This constant comes from user input (a
477 // constant in a pattern). Are there forms where users can add
478 // type annotations here? For example, an associated constant?
479 // Need to experiment.
480 user_ty: None,
481
482 const_: method,
483 })),
484 args: [
485 Spanned { node: Operand::Copy(val), span: DUMMY_SP },
486 Spanned { node: expect, span: DUMMY_SP },
487 ]
488 .into(),
489 destination: eq_result,
490 target: Some(eq_block),
491 unwind: UnwindAction::Continue,
492 call_source: CallSource::MatchCmp,
493 fn_span: source_info.span,
494 },
495 );
461 self.cfg.terminate(block, source_info, TerminatorKind::Call {
462 func: Operand::Constant(Box::new(ConstOperand {
463 span: source_info.span,
464
465 // FIXME(#54571): This constant comes from user input (a
466 // constant in a pattern). Are there forms where users can add
467 // type annotations here? For example, an associated constant?
468 // Need to experiment.
469 user_ty: None,
470
471 const_: method,
472 })),
473 args: [Spanned { node: Operand::Copy(val), span: DUMMY_SP }, Spanned {
474 node: expect,
475 span: DUMMY_SP,
476 }]
477 .into(),
478 destination: eq_result,
479 target: Some(eq_block),
480 unwind: UnwindAction::Continue,
481 call_source: CallSource::MatchCmp,
482 fn_span: source_info.span,
483 });
496484 self.diverge_from(block);
497485
498486 // check the result
compiler/rustc_mir_build/src/build/matches/util.rs+5-6
......@@ -4,9 +4,9 @@ use rustc_middle::ty::Ty;
44use rustc_span::Span;
55use tracing::debug;
66
7use crate::build::Builder;
78use crate::build::expr::as_place::PlaceBase;
89use crate::build::matches::{Binding, Candidate, FlatPat, MatchPairTree, TestCase};
9use crate::build::Builder;
1010
1111impl<'a, 'tcx> Builder<'a, 'tcx> {
1212 /// Creates a false edge to `imaginary_target` and a real edge to
......@@ -20,11 +20,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2020 source_info: SourceInfo,
2121 ) {
2222 if imaginary_target != real_target {
23 self.cfg.terminate(
24 from_block,
25 source_info,
26 TerminatorKind::FalseEdge { real_target, imaginary_target },
27 );
23 self.cfg.terminate(from_block, source_info, TerminatorKind::FalseEdge {
24 real_target,
25 imaginary_target,
26 });
2827 } else {
2928 self.cfg.goto(from_block, source_info, real_target)
3029 }
compiler/rustc_mir_build/src/build/misc.rs+5-10
......@@ -45,16 +45,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
4545 ) -> Place<'tcx> {
4646 let usize_ty = self.tcx.types.usize;
4747 let temp = self.temp(usize_ty, source_info.span);
48 self.cfg.push_assign_constant(
49 block,
50 source_info,
51 temp,
52 ConstOperand {
53 span: source_info.span,
54 user_ty: None,
55 const_: Const::from_usize(self.tcx, value),
56 },
57 );
48 self.cfg.push_assign_constant(block, source_info, temp, ConstOperand {
49 span: source_info.span,
50 user_ty: None,
51 const_: Const::from_usize(self.tcx, value),
52 });
5853 temp
5954 }
6055
compiler/rustc_mir_build/src/build/mod.rs+1-1
......@@ -1,6 +1,6 @@
11use itertools::Itertools;
2use rustc_apfloat::ieee::{Double, Half, Quad, Single};
32use rustc_apfloat::Float;
3use rustc_apfloat::ieee::{Double, Half, Quad, Single};
44use rustc_ast::attr;
55use rustc_data_structures::fx::FxHashMap;
66use rustc_data_structures::sorted_map::SortedIndexMultiMap;
compiler/rustc_mir_build/src/build/scope.rs+36-56
......@@ -92,7 +92,7 @@ use rustc_middle::thir::{ExprId, LintLevel};
9292use rustc_middle::{bug, span_bug};
9393use rustc_session::lint::Level;
9494use rustc_span::source_map::Spanned;
95use rustc_span::{Span, DUMMY_SP};
95use rustc_span::{DUMMY_SP, Span};
9696use tracing::{debug, instrument};
9797
9898use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder, CFG};
......@@ -510,16 +510,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
510510 (Some(normal_block), Some(exit_block)) => {
511511 let target = self.cfg.start_new_block();
512512 let source_info = self.source_info(span);
513 self.cfg.terminate(
514 normal_block.into_block(),
515 source_info,
516 TerminatorKind::Goto { target },
517 );
518 self.cfg.terminate(
519 exit_block.into_block(),
520 source_info,
521 TerminatorKind::Goto { target },
522 );
513 self.cfg.terminate(normal_block.into_block(), source_info, TerminatorKind::Goto {
514 target,
515 });
516 self.cfg.terminate(exit_block.into_block(), source_info, TerminatorKind::Goto {
517 target,
518 });
523519 target.unit()
524520 }
525521 }
......@@ -806,25 +802,21 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
806802 unwind_drops.add_entry_point(block, unwind_entry_point);
807803
808804 let next = self.cfg.start_new_block();
809 self.cfg.terminate(
810 block,
811 source_info,
812 TerminatorKind::Drop {
813 place: local.into(),
814 target: next,
815 unwind: UnwindAction::Continue,
816 replace: false,
817 },
818 );
805 self.cfg.terminate(block, source_info, TerminatorKind::Drop {
806 place: local.into(),
807 target: next,
808 unwind: UnwindAction::Continue,
809 replace: false,
810 });
819811 block = next;
820812 }
821813 DropKind::Storage => {
822814 // Only temps and vars need their storage dead.
823815 assert!(local.index() > self.arg_count);
824 self.cfg.push(
825 block,
826 Statement { source_info, kind: StatementKind::StorageDead(local) },
827 );
816 self.cfg.push(block, Statement {
817 source_info,
818 kind: StatementKind::StorageDead(local),
819 });
828820 }
829821 }
830822 }
......@@ -1283,16 +1275,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
12831275 let assign_unwind = self.cfg.start_new_cleanup_block();
12841276 self.cfg.push_assign(assign_unwind, source_info, place, value.clone());
12851277
1286 self.cfg.terminate(
1287 block,
1288 source_info,
1289 TerminatorKind::Drop {
1290 place,
1291 target: assign,
1292 unwind: UnwindAction::Cleanup(assign_unwind),
1293 replace: true,
1294 },
1295 );
1278 self.cfg.terminate(block, source_info, TerminatorKind::Drop {
1279 place,
1280 target: assign,
1281 unwind: UnwindAction::Cleanup(assign_unwind),
1282 replace: true,
1283 });
12961284 self.diverge_from(block);
12971285
12981286 assign.unit()
......@@ -1312,17 +1300,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13121300 let source_info = self.source_info(span);
13131301 let success_block = self.cfg.start_new_block();
13141302
1315 self.cfg.terminate(
1316 block,
1317 source_info,
1318 TerminatorKind::Assert {
1319 cond,
1320 expected,
1321 msg: Box::new(msg),
1322 target: success_block,
1323 unwind: UnwindAction::Continue,
1324 },
1325 );
1303 self.cfg.terminate(block, source_info, TerminatorKind::Assert {
1304 cond,
1305 expected,
1306 msg: Box::new(msg),
1307 target: success_block,
1308 unwind: UnwindAction::Continue,
1309 });
13261310 self.diverge_from(block);
13271311
13281312 success_block
......@@ -1397,16 +1381,12 @@ fn build_scope_drops<'tcx>(
13971381 unwind_drops.add_entry_point(block, unwind_to);
13981382
13991383 let next = cfg.start_new_block();
1400 cfg.terminate(
1401 block,
1402 source_info,
1403 TerminatorKind::Drop {
1404 place: local.into(),
1405 target: next,
1406 unwind: UnwindAction::Continue,
1407 replace: false,
1408 },
1409 );
1384 cfg.terminate(block, source_info, TerminatorKind::Drop {
1385 place: local.into(),
1386 target: next,
1387 unwind: UnwindAction::Continue,
1388 replace: false,
1389 });
14101390 block = next;
14111391 }
14121392 DropKind::Storage => {
compiler/rustc_mir_build/src/check_unsafety.rs+11-12
......@@ -12,11 +12,11 @@ use rustc_middle::thir::visit::Visitor;
1212use rustc_middle::thir::*;
1313use rustc_middle::ty::print::with_no_trimmed_paths;
1414use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
15use rustc_session::lint::builtin::{DEPRECATED_SAFE_2024, UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE};
1615use rustc_session::lint::Level;
16use rustc_session::lint::builtin::{DEPRECATED_SAFE_2024, UNSAFE_OP_IN_UNSAFE_FN, UNUSED_UNSAFE};
1717use rustc_span::def_id::{DefId, LocalDefId};
1818use rustc_span::symbol::Symbol;
19use rustc_span::{sym, Span};
19use rustc_span::{Span, sym};
2020
2121use crate::build::ExprCategory;
2222use crate::errors::*;
......@@ -499,10 +499,11 @@ impl<'a, 'tcx> Visitor<'a, 'tcx> for UnsafetyVisitor<'a, 'tcx> {
499499 .copied()
500500 .filter(|feature| missing.contains(feature))
501501 .collect();
502 self.requires_unsafe(
503 expr.span,
504 CallToFunctionWith { function: func_did, missing, build_enabled },
505 );
502 self.requires_unsafe(expr.span, CallToFunctionWith {
503 function: func_did,
504 missing,
505 build_enabled,
506 });
506507 }
507508 }
508509 }
......@@ -1052,11 +1053,9 @@ pub(crate) fn check_unsafety(tcx: TyCtxt<'_>, def: LocalDefId) {
10521053 warnings.sort_by_key(|w| w.block_span);
10531054 for UnusedUnsafeWarning { hir_id, block_span, enclosing_unsafe } in warnings {
10541055 let block_span = tcx.sess.source_map().guess_head_span(block_span);
1055 tcx.emit_node_span_lint(
1056 UNUSED_UNSAFE,
1057 hir_id,
1058 block_span,
1059 UnusedUnsafe { span: block_span, enclosing: enclosing_unsafe },
1060 );
1056 tcx.emit_node_span_lint(UNUSED_UNSAFE, hir_id, block_span, UnusedUnsafe {
1057 span: block_span,
1058 enclosing: enclosing_unsafe,
1059 });
10611060 }
10621061}
compiler/rustc_mir_build/src/errors.rs+1-1
......@@ -7,8 +7,8 @@ use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
77use rustc_middle::ty::{self, Ty};
88use rustc_pattern_analysis::errors::Uncovered;
99use rustc_pattern_analysis::rustc::RustcPatCtxt;
10use rustc_span::symbol::Symbol;
1110use rustc_span::Span;
11use rustc_span::symbol::Symbol;
1212
1313use crate::fluent_generated as fluent;
1414
compiler/rustc_mir_build/src/lints.rs+4-6
......@@ -54,12 +54,10 @@ fn check_recursion<'tcx>(
5454
5555 let sp = tcx.def_span(def_id);
5656 let hir_id = tcx.local_def_id_to_hir_id(def_id);
57 tcx.emit_node_span_lint(
58 UNCONDITIONAL_RECURSION,
59 hir_id,
60 sp,
61 UnconditionalRecursion { span: sp, call_sites: vis.reachable_recursive_calls },
62 );
57 tcx.emit_node_span_lint(UNCONDITIONAL_RECURSION, hir_id, sp, UnconditionalRecursion {
58 span: sp,
59 call_sites: vis.reachable_recursive_calls,
60 });
6361 }
6462}
6563
compiler/rustc_mir_build/src/thir/cx/expr.rs+3-3
......@@ -17,13 +17,13 @@ use rustc_middle::ty::{
1717 UserType,
1818};
1919use rustc_middle::{bug, span_bug};
20use rustc_span::{sym, Span};
21use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
20use rustc_span::{Span, sym};
21use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
2222use tracing::{debug, info, instrument, trace};
2323
2424use crate::errors;
25use crate::thir::cx::region::Scope;
2625use crate::thir::cx::Cx;
26use crate::thir::cx::region::Scope;
2727use crate::thir::util::UserAnnotatedTyHelpers;
2828
2929impl<'tcx> Cx<'tcx> {
compiler/rustc_mir_build/src/thir/cx/mod.rs+6-4
......@@ -5,10 +5,10 @@
55use rustc_data_structures::steal::Steal;
66use rustc_errors::ErrorGuaranteed;
77use rustc_hir as hir;
8use rustc_hir::HirId;
89use rustc_hir::def::DefKind;
910use rustc_hir::def_id::{DefId, LocalDefId};
1011use rustc_hir::lang_items::LangItem;
11use rustc_hir::HirId;
1212use rustc_middle::bug;
1313use rustc_middle::middle::region;
1414use rustc_middle::thir::*;
......@@ -182,9 +182,11 @@ impl<'tcx> Cx<'tcx> {
182182 let ty = if fn_decl.c_variadic && index == fn_decl.inputs.len() {
183183 let va_list_did = self.tcx.require_lang_item(LangItem::VaList, Some(param.span));
184184
185 self.tcx
186 .type_of(va_list_did)
187 .instantiate(self.tcx, &[self.tcx.lifetimes.re_erased.into()])
185 self.tcx.type_of(va_list_did).instantiate(self.tcx, &[self
186 .tcx
187 .lifetimes
188 .re_erased
189 .into()])
188190 } else {
189191 fn_sig.inputs()[index]
190192 };
compiler/rustc_mir_build/src/thir/pattern/check_match.rs+2-2
......@@ -3,7 +3,7 @@ use rustc_ast::Mutability;
33use rustc_data_structures::fx::FxIndexSet;
44use rustc_data_structures::stack::ensure_sufficient_stack;
55use rustc_errors::codes::*;
6use rustc_errors::{struct_span_code_err, Applicability, ErrorGuaranteed, MultiSpan};
6use rustc_errors::{Applicability, ErrorGuaranteed, MultiSpan, struct_span_code_err};
77use rustc_hir::def::*;
88use rustc_hir::def_id::LocalDefId;
99use rustc_hir::{self as hir, BindingMode, ByRef, HirId};
......@@ -22,7 +22,7 @@ use rustc_session::lint::builtin::{
2222 BINDINGS_WITH_VARIANT_NAME, IRREFUTABLE_LET_PATTERNS, UNREACHABLE_PATTERNS,
2323};
2424use rustc_span::hygiene::DesugaringKind;
25use rustc_span::{sym, Span};
25use rustc_span::{Span, sym};
2626use tracing::instrument;
2727
2828use crate::errors::*;
compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_middle::thir::{FieldPat, Pat, PatKind};
1010use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt, ValTree};
1111use rustc_span::Span;
1212use rustc_target::abi::{FieldIdx, VariantIdx};
13use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
1413use rustc_trait_selection::traits::ObligationCause;
14use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
1515use tracing::{debug, instrument, trace};
1616
1717use super::PatCtxt;
compiler/rustc_mir_dataflow/src/elaborate_drops.rs+14-20
......@@ -8,9 +8,9 @@ use rustc_middle::span_bug;
88use rustc_middle::traits::Reveal;
99use rustc_middle::ty::util::IntTypeExt;
1010use rustc_middle::ty::{self, GenericArgsRef, Ty, TyCtxt};
11use rustc_span::source_map::Spanned;
1211use rustc_span::DUMMY_SP;
13use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
12use rustc_span::source_map::Spanned;
13use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
1414use tracing::{debug, instrument};
1515
1616/// The value of an inserted drop flag.
......@@ -233,15 +233,12 @@ where
233233 .patch_terminator(bb, TerminatorKind::Goto { target: self.succ });
234234 }
235235 DropStyle::Static => {
236 self.elaborator.patch().patch_terminator(
237 bb,
238 TerminatorKind::Drop {
239 place: self.place,
240 target: self.succ,
241 unwind: self.unwind.into_action(),
242 replace: false,
243 },
244 );
236 self.elaborator.patch().patch_terminator(bb, TerminatorKind::Drop {
237 place: self.place,
238 target: self.succ,
239 unwind: self.unwind.into_action(),
240 replace: false,
241 });
245242 }
246243 DropStyle::Conditional => {
247244 let drop_bb = self.complete_drop(self.succ, self.unwind);
......@@ -732,15 +729,12 @@ where
732729 };
733730 let loop_block = self.elaborator.patch().new_block(loop_block);
734731
735 self.elaborator.patch().patch_terminator(
736 drop_block,
737 TerminatorKind::Drop {
738 place: tcx.mk_place_deref(ptr),
739 target: loop_block,
740 unwind: unwind.into_action(),
741 replace: false,
742 },
743 );
732 self.elaborator.patch().patch_terminator(drop_block, TerminatorKind::Drop {
733 place: tcx.mk_place_deref(ptr),
734 target: loop_block,
735 unwind: unwind.into_action(),
736 replace: false,
737 });
744738
745739 loop_block
746740 }
compiler/rustc_mir_dataflow/src/framework/engine.rs+5-5
......@@ -7,17 +7,17 @@ use rustc_data_structures::work_queue::WorkQueue;
77use rustc_hir::def_id::DefId;
88use rustc_index::{Idx, IndexVec};
99use rustc_middle::bug;
10use rustc_middle::mir::{self, create_dump_file, dump_enabled, traversal, BasicBlock};
11use rustc_middle::ty::print::with_no_trimmed_paths;
10use rustc_middle::mir::{self, BasicBlock, create_dump_file, dump_enabled, traversal};
1211use rustc_middle::ty::TyCtxt;
13use rustc_span::symbol::{sym, Symbol};
12use rustc_middle::ty::print::with_no_trimmed_paths;
13use rustc_span::symbol::{Symbol, sym};
1414use tracing::{debug, error};
1515use {rustc_ast as ast, rustc_graphviz as dot};
1616
1717use super::fmt::DebugWithContext;
1818use super::{
19 graphviz, visit_results, Analysis, AnalysisDomain, Direction, GenKill, GenKillAnalysis,
20 GenKillSet, JoinSemiLattice, ResultsCursor, ResultsVisitor,
19 Analysis, AnalysisDomain, Direction, GenKill, GenKillAnalysis, GenKillSet, JoinSemiLattice,
20 ResultsCursor, ResultsVisitor, graphviz, visit_results,
2121};
2222use crate::errors::{
2323 DuplicateValuesFor, PathMustEndInFilename, RequiresAnArgument, UnknownFormatter,
compiler/rustc_mir_dataflow/src/framework/fmt.rs+1-1
......@@ -3,8 +3,8 @@
33
44use std::fmt;
55
6use rustc_index::bit_set::{BitSet, ChunkedBitSet, HybridBitSet};
76use rustc_index::Idx;
7use rustc_index::bit_set::{BitSet, ChunkedBitSet, HybridBitSet};
88
99use super::lattice::MaybeReachable;
1010
compiler/rustc_mir_dataflow/src/framework/graphviz.rs+5-5
......@@ -8,7 +8,7 @@ use std::{io, ops, str};
88use regex::Regex;
99use rustc_graphviz as dot;
1010use rustc_index::bit_set::BitSet;
11use rustc_middle::mir::{self, graphviz_safe_def_name, BasicBlock, Body, Location};
11use rustc_middle::mir::{self, BasicBlock, Body, Location, graphviz_safe_def_name};
1212
1313use super::fmt::{DebugDiffWithAdapter, DebugWithAdapter, DebugWithContext};
1414use super::{Analysis, CallReturnPlaces, Direction, Results, ResultsCursor, ResultsVisitor};
......@@ -502,10 +502,10 @@ where
502502 r#"<td colspan="{colspan}" {fmt} align="left">{state}</td>"#,
503503 colspan = this.style.num_state_columns(),
504504 fmt = fmt,
505 state = dot::escape_html(&format!(
506 "{:?}",
507 DebugWithAdapter { this: state, ctxt: analysis }
508 )),
505 state = dot::escape_html(&format!("{:?}", DebugWithAdapter {
506 this: state,
507 ctxt: analysis
508 })),
509509 )
510510 })
511511 }
compiler/rustc_mir_dataflow/src/framework/mod.rs+2-2
......@@ -32,8 +32,8 @@
3232
3333use std::cmp::Ordering;
3434
35use rustc_index::bit_set::{BitSet, ChunkedBitSet, HybridBitSet};
3635use rustc_index::Idx;
36use rustc_index::bit_set::{BitSet, ChunkedBitSet, HybridBitSet};
3737use rustc_middle::mir::{self, BasicBlock, CallReturnPlaces, Location, TerminatorEdges};
3838use rustc_middle::ty::TyCtxt;
3939
......@@ -49,7 +49,7 @@ pub use self::cursor::ResultsCursor;
4949pub use self::direction::{Backward, Direction, Forward};
5050pub use self::engine::{Engine, Results};
5151pub use self::lattice::{JoinSemiLattice, MaybeReachable};
52pub use self::visitor::{visit_results, ResultsVisitable, ResultsVisitor};
52pub use self::visitor::{ResultsVisitable, ResultsVisitor, visit_results};
5353
5454/// Analysis domains are all bitsets of various kinds. This trait holds
5555/// operations needed by all of them.
compiler/rustc_mir_dataflow/src/framework/tests.rs+18-24
......@@ -30,32 +30,26 @@ fn mock_body<'tcx>() -> mir::Body<'tcx> {
3030
3131 block(4, mir::TerminatorKind::Return);
3232 block(1, mir::TerminatorKind::Return);
33 block(
34 2,
35 mir::TerminatorKind::Call {
36 func: mir::Operand::Copy(dummy_place.clone()),
37 args: [].into(),
38 destination: dummy_place.clone(),
39 target: Some(mir::START_BLOCK),
40 unwind: mir::UnwindAction::Continue,
41 call_source: mir::CallSource::Misc,
42 fn_span: DUMMY_SP,
43 },
44 );
33 block(2, mir::TerminatorKind::Call {
34 func: mir::Operand::Copy(dummy_place.clone()),
35 args: [].into(),
36 destination: dummy_place.clone(),
37 target: Some(mir::START_BLOCK),
38 unwind: mir::UnwindAction::Continue,
39 call_source: mir::CallSource::Misc,
40 fn_span: DUMMY_SP,
41 });
4542 block(3, mir::TerminatorKind::Return);
4643 block(0, mir::TerminatorKind::Return);
47 block(
48 4,
49 mir::TerminatorKind::Call {
50 func: mir::Operand::Copy(dummy_place.clone()),
51 args: [].into(),
52 destination: dummy_place.clone(),
53 target: Some(mir::START_BLOCK),
54 unwind: mir::UnwindAction::Continue,
55 call_source: mir::CallSource::Misc,
56 fn_span: DUMMY_SP,
57 },
58 );
44 block(4, mir::TerminatorKind::Call {
45 func: mir::Operand::Copy(dummy_place.clone()),
46 args: [].into(),
47 destination: dummy_place.clone(),
48 target: Some(mir::START_BLOCK),
49 unwind: mir::UnwindAction::Continue,
50 call_source: mir::CallSource::Misc,
51 fn_span: DUMMY_SP,
52 });
5953
6054 mir::Body::new_cfg_only(blocks)
6155}
compiler/rustc_mir_dataflow/src/impls/initialized.rs+4-4
......@@ -1,7 +1,7 @@
11use std::assert_matches::assert_matches;
22
3use rustc_index::bit_set::{BitSet, ChunkedBitSet};
43use rustc_index::Idx;
4use rustc_index::bit_set::{BitSet, ChunkedBitSet};
55use rustc_middle::bug;
66use rustc_middle::mir::{self, Body, CallReturnPlaces, Location, TerminatorEdges};
77use rustc_middle::ty::{self, TyCtxt};
......@@ -11,9 +11,9 @@ use crate::elaborate_drops::DropFlagState;
1111use crate::framework::SwitchIntEdgeEffects;
1212use crate::move_paths::{HasMoveData, InitIndex, InitKind, LookupResult, MoveData, MovePathIndex};
1313use crate::{
14 drop_flag_effects, drop_flag_effects_for_function_entry, drop_flag_effects_for_location,
15 lattice, on_all_children_bits, on_lookup_result_bits, AnalysisDomain, GenKill, GenKillAnalysis,
16 MaybeReachable,
14 AnalysisDomain, GenKill, GenKillAnalysis, MaybeReachable, drop_flag_effects,
15 drop_flag_effects_for_function_entry, drop_flag_effects_for_location, lattice,
16 on_all_children_bits, on_lookup_result_bits,
1717};
1818
1919/// `MaybeInitializedPlaces` tracks all places that might be
compiler/rustc_mir_dataflow/src/impls/mod.rs+1-1
......@@ -7,7 +7,7 @@ mod initialized;
77mod liveness;
88mod storage_liveness;
99
10pub use self::borrowed_locals::{borrowed_locals, MaybeBorrowedLocals};
10pub use self::borrowed_locals::{MaybeBorrowedLocals, borrowed_locals};
1111pub use self::initialized::{
1212 DefinitelyInitializedPlaces, EverInitializedPlaces, MaybeInitializedPlaces,
1313 MaybeUninitializedPlaces,
compiler/rustc_mir_dataflow/src/lib.rs+3-3
......@@ -17,9 +17,9 @@ pub use self::drop_flag_effects::{
1717 move_path_children_matching, on_all_children_bits, on_lookup_result_bits,
1818};
1919pub use self::framework::{
20 fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, Direction, Engine,
21 Forward, GenKill, GenKillAnalysis, JoinSemiLattice, MaybeReachable, Results, ResultsCursor,
22 ResultsVisitable, ResultsVisitor, SwitchIntEdgeEffects,
20 Analysis, AnalysisDomain, Backward, Direction, Engine, Forward, GenKill, GenKillAnalysis,
21 JoinSemiLattice, MaybeReachable, Results, ResultsCursor, ResultsVisitable, ResultsVisitor,
22 SwitchIntEdgeEffects, fmt, graphviz, lattice, visit_results,
2323};
2424use self::move_paths::MoveData;
2525
compiler/rustc_mir_dataflow/src/move_paths/builder.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_middle::mir::tcx::{PlaceTy, RvalueInitializationState};
55use rustc_middle::mir::*;
66use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt};
77use rustc_middle::{bug, span_bug};
8use smallvec::{smallvec, SmallVec};
8use smallvec::{SmallVec, smallvec};
99use tracing::debug;
1010
1111use super::abs_domain::Lift;
compiler/rustc_mir_dataflow/src/points.rs+1-1
......@@ -3,7 +3,7 @@ use rustc_index::interval::SparseIntervalMatrix;
33use rustc_index::{Idx, IndexVec};
44use rustc_middle::mir::{self, BasicBlock, Body, Location};
55
6use crate::framework::{visit_results, ResultsVisitable, ResultsVisitor};
6use crate::framework::{ResultsVisitable, ResultsVisitor, visit_results};
77
88/// Maps between a `Location` and a `PointIndex` (and vice versa).
99pub struct DenseLocationMap {
compiler/rustc_mir_dataflow/src/rustc_peek.rs+1-1
......@@ -3,8 +3,8 @@ use rustc_hir::def_id::DefId;
33use rustc_index::bit_set::BitSet;
44use rustc_middle::mir::{self, Body, Local, Location};
55use rustc_middle::ty::{self, Ty, TyCtxt};
6use rustc_span::symbol::{sym, Symbol};
76use rustc_span::Span;
7use rustc_span::symbol::{Symbol, sym};
88use tracing::{debug, info};
99
1010use crate::errors::{
compiler/rustc_mir_dataflow/src/value_analysis.rs+1-1
......@@ -39,8 +39,8 @@ use std::ops::Range;
3939use rustc_data_structures::captures::Captures;
4040use rustc_data_structures::fx::{FxHashMap, FxIndexSet, StdEntry};
4141use rustc_data_structures::stack::ensure_sufficient_stack;
42use rustc_index::bit_set::BitSet;
4342use rustc_index::IndexVec;
43use rustc_index::bit_set::BitSet;
4444use rustc_middle::bug;
4545use rustc_middle::mir::tcx::PlaceTy;
4646use rustc_middle::mir::visit::{MutatingUseContext, PlaceContext, Visitor};
compiler/rustc_mir_transform/src/abort_unwinding_calls.rs+2-2
......@@ -1,9 +1,9 @@
11use rustc_ast::InlineAsmOptions;
22use rustc_middle::mir::*;
33use rustc_middle::span_bug;
4use rustc_middle::ty::{self, layout, TyCtxt};
5use rustc_target::spec::abi::Abi;
4use rustc_middle::ty::{self, TyCtxt, layout};
65use rustc_target::spec::PanicStrategy;
6use rustc_target::spec::abi::Abi;
77
88/// A pass that runs which is targeted at ensuring that codegen guarantees about
99/// unwinding are upheld for compilations of panic=abort programs.
compiler/rustc_mir_transform/src/add_moves_for_packed_drops.rs+6-9
......@@ -95,13 +95,10 @@ fn add_move_for_packed_drop<'tcx>(
9595
9696 patch.add_statement(loc, StatementKind::StorageLive(temp));
9797 patch.add_assign(loc, Place::from(temp), Rvalue::Use(Operand::Move(*place)));
98 patch.patch_terminator(
99 loc.block,
100 TerminatorKind::Drop {
101 place: Place::from(temp),
102 target: storage_dead_block,
103 unwind,
104 replace,
105 },
106 );
98 patch.patch_terminator(loc.block, TerminatorKind::Drop {
99 place: Place::from(temp),
100 target: storage_dead_block,
101 unwind,
102 replace,
103 });
107104}
compiler/rustc_mir_transform/src/add_retag.rs+8-14
......@@ -111,13 +111,10 @@ impl<'tcx> crate::MirPass<'tcx> for AddRetag {
111111 .collect::<Vec<_>>();
112112 // Now we go over the returns we collected to retag the return values.
113113 for (source_info, dest_place, dest_block) in returns {
114 basic_blocks[dest_block].statements.insert(
115 0,
116 Statement {
117 source_info,
118 kind: StatementKind::Retag(RetagKind::Default, Box::new(dest_place)),
119 },
120 );
114 basic_blocks[dest_block].statements.insert(0, Statement {
115 source_info,
116 kind: StatementKind::Retag(RetagKind::Default, Box::new(dest_place)),
117 });
121118 }
122119
123120 // PART 3
......@@ -172,13 +169,10 @@ impl<'tcx> crate::MirPass<'tcx> for AddRetag {
172169 };
173170 // Insert a retag after the statement.
174171 let source_info = block_data.statements[i].source_info;
175 block_data.statements.insert(
176 i + 1,
177 Statement {
178 source_info,
179 kind: StatementKind::Retag(retag_kind, Box::new(place)),
180 },
181 );
172 block_data.statements.insert(i + 1, Statement {
173 source_info,
174 kind: StatementKind::Retag(retag_kind, Box::new(place)),
175 });
182176 }
183177 }
184178 }
compiler/rustc_mir_transform/src/check_const_item_mutation.rs+1-1
......@@ -3,8 +3,8 @@ use rustc_middle::mir::visit::Visitor;
33use rustc_middle::mir::*;
44use rustc_middle::ty::TyCtxt;
55use rustc_session::lint::builtin::CONST_ITEM_MUTATION;
6use rustc_span::def_id::DefId;
76use rustc_span::Span;
7use rustc_span::def_id::DefId;
88
99use crate::errors;
1010
compiler/rustc_mir_transform/src/cleanup_post_borrowck.rs+1-1
......@@ -18,8 +18,8 @@
1818
1919use rustc_middle::mir::coverage::CoverageKind;
2020use rustc_middle::mir::{Body, BorrowKind, CastKind, Rvalue, StatementKind, TerminatorKind};
21use rustc_middle::ty::adjustment::PointerCoercion;
2221use rustc_middle::ty::TyCtxt;
22use rustc_middle::ty::adjustment::PointerCoercion;
2323
2424pub(super) struct CleanupPostBorrowck;
2525
compiler/rustc_mir_transform/src/copy_prop.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_index::bit_set::BitSet;
21use rustc_index::IndexSlice;
2use rustc_index::bit_set::BitSet;
33use rustc_middle::mir::visit::*;
44use rustc_middle::mir::*;
55use rustc_middle::ty::TyCtxt;
compiler/rustc_mir_transform/src/coroutine.rs+46-77
......@@ -67,14 +67,14 @@ use rustc_middle::ty::{
6767 self, CoroutineArgs, CoroutineArgsExt, GenericArgsRef, InstanceKind, Ty, TyCtxt,
6868};
6969use rustc_middle::{bug, span_bug};
70use rustc_mir_dataflow::Analysis;
7071use rustc_mir_dataflow::impls::{
7172 MaybeBorrowedLocals, MaybeLiveLocals, MaybeRequiresStorage, MaybeStorageLive,
7273};
7374use rustc_mir_dataflow::storage::always_storage_live_locals;
74use rustc_mir_dataflow::Analysis;
75use rustc_span::Span;
7576use rustc_span::def_id::{DefId, LocalDefId};
7677use rustc_span::symbol::sym;
77use rustc_span::Span;
7878use rustc_target::abi::{FieldIdx, VariantIdx};
7979use rustc_target::spec::PanicStrategy;
8080use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
......@@ -1054,14 +1054,11 @@ fn insert_switch<'tcx>(
10541054 let switch = TerminatorKind::SwitchInt { discr: Operand::Move(discr), targets: switch_targets };
10551055
10561056 let source_info = SourceInfo::outermost(body.span);
1057 body.basic_blocks_mut().raw.insert(
1058 0,
1059 BasicBlockData {
1060 statements: vec![assign],
1061 terminator: Some(Terminator { source_info, kind: switch }),
1062 is_cleanup: false,
1063 },
1064 );
1057 body.basic_blocks_mut().raw.insert(0, BasicBlockData {
1058 statements: vec![assign],
1059 terminator: Some(Terminator { source_info, kind: switch }),
1060 is_cleanup: false,
1061 });
10651062
10661063 let blocks = body.basic_blocks_mut().iter_mut();
10671064
......@@ -1072,7 +1069,7 @@ fn insert_switch<'tcx>(
10721069
10731070fn elaborate_coroutine_drops<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
10741071 use rustc_middle::mir::patch::MirPatch;
1075 use rustc_mir_dataflow::elaborate_drops::{elaborate_drop, Unwind};
1072 use rustc_mir_dataflow::elaborate_drops::{Unwind, elaborate_drop};
10761073
10771074 use crate::shim::DropShimElaborator;
10781075
......@@ -1605,16 +1602,13 @@ impl<'tcx> crate::MirPass<'tcx> for StateTransform {
16051602 // (which is now a generator interior).
16061603 let source_info = SourceInfo::outermost(body.span);
16071604 let stmts = &mut body.basic_blocks_mut()[START_BLOCK].statements;
1608 stmts.insert(
1609 0,
1610 Statement {
1611 source_info,
1612 kind: StatementKind::Assign(Box::new((
1613 old_resume_local.into(),
1614 Rvalue::Use(Operand::Move(resume_local.into())),
1615 ))),
1616 },
1617 );
1605 stmts.insert(0, Statement {
1606 source_info,
1607 kind: StatementKind::Assign(Box::new((
1608 old_resume_local.into(),
1609 Rvalue::Use(Operand::Move(resume_local.into())),
1610 ))),
1611 });
16181612
16191613 let always_live_locals = always_storage_live_locals(body);
16201614
......@@ -1851,18 +1845,12 @@ fn check_suspend_tys<'tcx>(tcx: TyCtxt<'tcx>, layout: &CoroutineLayout<'tcx>, bo
18511845 continue;
18521846 };
18531847
1854 check_must_not_suspend_ty(
1855 tcx,
1856 decl.ty,
1857 hir_id,
1858 param_env,
1859 SuspendCheckData {
1860 source_span: decl.source_info.span,
1861 yield_span: yield_source_info.span,
1862 plural_len: 1,
1863 ..Default::default()
1864 },
1865 );
1848 check_must_not_suspend_ty(tcx, decl.ty, hir_id, param_env, SuspendCheckData {
1849 source_span: decl.source_info.span,
1850 yield_span: yield_source_info.span,
1851 plural_len: 1,
1852 ..Default::default()
1853 });
18661854 }
18671855 }
18681856 }
......@@ -1902,13 +1890,10 @@ fn check_must_not_suspend_ty<'tcx>(
19021890 ty::Adt(_, args) if ty.is_box() => {
19031891 let boxed_ty = args.type_at(0);
19041892 let allocator_ty = args.type_at(1);
1905 check_must_not_suspend_ty(
1906 tcx,
1907 boxed_ty,
1908 hir_id,
1909 param_env,
1910 SuspendCheckData { descr_pre: &format!("{}boxed ", data.descr_pre), ..data },
1911 ) || check_must_not_suspend_ty(
1893 check_must_not_suspend_ty(tcx, boxed_ty, hir_id, param_env, SuspendCheckData {
1894 descr_pre: &format!("{}boxed ", data.descr_pre),
1895 ..data
1896 }) || check_must_not_suspend_ty(
19121897 tcx,
19131898 allocator_ty,
19141899 hir_id,
......@@ -1927,12 +1912,10 @@ fn check_must_not_suspend_ty<'tcx>(
19271912 {
19281913 let def_id = poly_trait_predicate.trait_ref.def_id;
19291914 let descr_pre = &format!("{}implementer{} of ", data.descr_pre, plural_suffix);
1930 if check_must_not_suspend_def(
1931 tcx,
1932 def_id,
1933 hir_id,
1934 SuspendCheckData { descr_pre, ..data },
1935 ) {
1915 if check_must_not_suspend_def(tcx, def_id, hir_id, SuspendCheckData {
1916 descr_pre,
1917 ..data
1918 }) {
19361919 has_emitted = true;
19371920 break;
19381921 }
......@@ -1946,12 +1929,10 @@ fn check_must_not_suspend_ty<'tcx>(
19461929 if let ty::ExistentialPredicate::Trait(ref trait_ref) = predicate.skip_binder() {
19471930 let def_id = trait_ref.def_id;
19481931 let descr_post = &format!(" trait object{}{}", plural_suffix, data.descr_post);
1949 if check_must_not_suspend_def(
1950 tcx,
1951 def_id,
1952 hir_id,
1953 SuspendCheckData { descr_post, ..data },
1954 ) {
1932 if check_must_not_suspend_def(tcx, def_id, hir_id, SuspendCheckData {
1933 descr_post,
1934 ..data
1935 }) {
19551936 has_emitted = true;
19561937 break;
19571938 }
......@@ -1963,13 +1944,10 @@ fn check_must_not_suspend_ty<'tcx>(
19631944 let mut has_emitted = false;
19641945 for (i, ty) in fields.iter().enumerate() {
19651946 let descr_post = &format!(" in tuple element {i}");
1966 if check_must_not_suspend_ty(
1967 tcx,
1968 ty,
1969 hir_id,
1970 param_env,
1971 SuspendCheckData { descr_post, ..data },
1972 ) {
1947 if check_must_not_suspend_ty(tcx, ty, hir_id, param_env, SuspendCheckData {
1948 descr_post,
1949 ..data
1950 }) {
19731951 has_emitted = true;
19741952 }
19751953 }
......@@ -1977,29 +1955,20 @@ fn check_must_not_suspend_ty<'tcx>(
19771955 }
19781956 ty::Array(ty, len) => {
19791957 let descr_pre = &format!("{}array{} of ", data.descr_pre, plural_suffix);
1980 check_must_not_suspend_ty(
1981 tcx,
1982 ty,
1983 hir_id,
1984 param_env,
1985 SuspendCheckData {
1986 descr_pre,
1987 plural_len: len.try_eval_target_usize(tcx, param_env).unwrap_or(0) as usize + 1,
1988 ..data
1989 },
1990 )
1958 check_must_not_suspend_ty(tcx, ty, hir_id, param_env, SuspendCheckData {
1959 descr_pre,
1960 plural_len: len.try_eval_target_usize(tcx, param_env).unwrap_or(0) as usize + 1,
1961 ..data
1962 })
19911963 }
19921964 // If drop tracking is enabled, we want to look through references, since the referent
19931965 // may not be considered live across the await point.
19941966 ty::Ref(_region, ty, _mutability) => {
19951967 let descr_pre = &format!("{}reference{} to ", data.descr_pre, plural_suffix);
1996 check_must_not_suspend_ty(
1997 tcx,
1998 ty,
1999 hir_id,
2000 param_env,
2001 SuspendCheckData { descr_pre, ..data },
2002 )
1968 check_must_not_suspend_ty(tcx, ty, hir_id, param_env, SuspendCheckData {
1969 descr_pre,
1970 ..data
1971 })
20031972 }
20041973 _ => false,
20051974 }
compiler/rustc_mir_transform/src/coroutine/by_move_body.rs+4-4
......@@ -140,10 +140,10 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
140140 // If the parent capture is by-ref, then we need to apply an additional
141141 // deref before applying any further projections to this place.
142142 if parent_capture.is_by_ref() {
143 child_precise_captures.insert(
144 0,
145 Projection { ty: parent_capture.place.ty(), kind: ProjectionKind::Deref },
146 );
143 child_precise_captures.insert(0, Projection {
144 ty: parent_capture.place.ty(),
145 kind: ProjectionKind::Deref,
146 });
147147 }
148148 // If the child capture is by-ref, then we need to apply a "ref"
149149 // projection (i.e. `&`) at the end. But wait! We don't have that
compiler/rustc_mir_transform/src/coverage/graph.rs+1-1
......@@ -6,8 +6,8 @@ use rustc_data_structures::captures::Captures;
66use rustc_data_structures::fx::FxHashSet;
77use rustc_data_structures::graph::dominators::{self, Dominators};
88use rustc_data_structures::graph::{self, DirectedGraph, StartNode};
9use rustc_index::bit_set::BitSet;
109use rustc_index::IndexVec;
10use rustc_index::bit_set::BitSet;
1111use rustc_middle::bug;
1212use rustc_middle::mir::{self, BasicBlock, Terminator, TerminatorKind};
1313use tracing::debug;
compiler/rustc_mir_transform/src/coverage/mappings.rs+2-2
......@@ -1,8 +1,8 @@
11use std::collections::BTreeSet;
22
33use rustc_data_structures::graph::DirectedGraph;
4use rustc_index::bit_set::BitSet;
54use rustc_index::IndexVec;
5use rustc_index::bit_set::BitSet;
66use rustc_middle::mir::coverage::{
77 BlockMarkerId, BranchSpan, ConditionInfo, CoverageInfoHi, CoverageKind,
88};
......@@ -10,10 +10,10 @@ use rustc_middle::mir::{self, BasicBlock, StatementKind};
1010use rustc_middle::ty::TyCtxt;
1111use rustc_span::Span;
1212
13use crate::coverage::ExtractedHirInfo;
1314use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph, START_BCB};
1415use crate::coverage::spans::extract_refined_covspans;
1516use crate::coverage::unexpand::unexpand_into_body_span;
16use crate::coverage::ExtractedHirInfo;
1717
1818/// Associates an ordinary executable code span with its corresponding BCB.
1919#[derive(Debug)]
compiler/rustc_mir_transform/src/coverage/mod.rs+2-2
......@@ -9,7 +9,7 @@ mod tests;
99mod unexpand;
1010
1111use rustc_hir as hir;
12use rustc_hir::intravisit::{walk_expr, Visitor};
12use rustc_hir::intravisit::{Visitor, walk_expr};
1313use rustc_middle::hir::map::Map;
1414use rustc_middle::hir::nested_filter;
1515use rustc_middle::mir::coverage::{
......@@ -147,8 +147,8 @@ fn create_mappings<'tcx>(
147147
148148 let source_file = source_map.lookup_source_file(body_span.lo());
149149
150 use rustc_session::config::RemapPathScopeComponents;
151150 use rustc_session::RemapFileNameExt;
151 use rustc_session::config::RemapPathScopeComponents;
152152 let file_name = Symbol::intern(
153153 &source_file.name.for_scope(tcx.sess, RemapPathScopeComponents::MACRO).to_string_lossy(),
154154 );
compiler/rustc_mir_transform/src/coverage/spans.rs+2-2
......@@ -8,9 +8,9 @@ use tracing::{debug, debug_span, instrument};
88
99use crate::coverage::graph::{BasicCoverageBlock, CoverageGraph};
1010use crate::coverage::spans::from_mir::{
11 extract_covspans_from_mir, ExtractedCovspans, Hole, SpanFromMir,
11 ExtractedCovspans, Hole, SpanFromMir, extract_covspans_from_mir,
1212};
13use crate::coverage::{mappings, ExtractedHirInfo};
13use crate::coverage::{ExtractedHirInfo, mappings};
1414
1515mod from_mir;
1616
compiler/rustc_mir_transform/src/coverage/spans/from_mir.rs+1-1
......@@ -5,12 +5,12 @@ use rustc_middle::mir::{
55};
66use rustc_span::{ExpnKind, Span};
77
8use crate::coverage::ExtractedHirInfo;
89use crate::coverage::graph::{
910 BasicCoverageBlock, BasicCoverageBlockData, CoverageGraph, START_BCB,
1011};
1112use crate::coverage::spans::Covspan;
1213use crate::coverage::unexpand::unexpand_into_body_span_with_expn_kind;
13use crate::coverage::ExtractedHirInfo;
1414
1515pub(crate) struct ExtractedCovspans {
1616 pub(crate) covspans: Vec<SpanFromMir>,
compiler/rustc_mir_transform/src/coverage/tests.rs+10-13
......@@ -29,7 +29,7 @@ use rustc_data_structures::graph::{DirectedGraph, Successors};
2929use rustc_index::{Idx, IndexVec};
3030use rustc_middle::mir::*;
3131use rustc_middle::{bug, ty};
32use rustc_span::{BytePos, Pos, Span, DUMMY_SP};
32use rustc_span::{BytePos, DUMMY_SP, Pos, Span};
3333
3434use super::graph::{self, BasicCoverageBlock};
3535
......@@ -129,18 +129,15 @@ impl<'tcx> MockBlocks<'tcx> {
129129 }
130130
131131 fn call(&mut self, some_from_block: Option<BasicBlock>) -> BasicBlock {
132 self.add_block_from(
133 some_from_block,
134 TerminatorKind::Call {
135 func: Operand::Copy(self.dummy_place.clone()),
136 args: [].into(),
137 destination: self.dummy_place.clone(),
138 target: Some(TEMP_BLOCK),
139 unwind: UnwindAction::Continue,
140 call_source: CallSource::Misc,
141 fn_span: DUMMY_SP,
142 },
143 )
132 self.add_block_from(some_from_block, TerminatorKind::Call {
133 func: Operand::Copy(self.dummy_place.clone()),
134 args: [].into(),
135 destination: self.dummy_place.clone(),
136 target: Some(TEMP_BLOCK),
137 unwind: UnwindAction::Continue,
138 call_source: CallSource::Misc,
139 fn_span: DUMMY_SP,
140 })
144141 }
145142
146143 fn goto(&mut self, some_from_block: Option<BasicBlock>) -> BasicBlock {
compiler/rustc_mir_transform/src/dataflow_const_prop.rs+2-2
......@@ -2,7 +2,7 @@
22//!
33//! Currently, this pass only propagates scalar values.
44
5use rustc_const_eval::const_eval::{throw_machine_stop_str, DummyMachine};
5use rustc_const_eval::const_eval::{DummyMachine, throw_machine_stop_str};
66use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, PlaceTy, Projectable};
77use rustc_data_structures::fx::FxHashMap;
88use rustc_hir::def::DefKind;
......@@ -18,7 +18,7 @@ use rustc_mir_dataflow::value_analysis::{
1818};
1919use rustc_mir_dataflow::{Analysis, Results, ResultsVisitor};
2020use rustc_span::DUMMY_SP;
21use rustc_target::abi::{Abi, FieldIdx, Size, VariantIdx, FIRST_VARIANT};
21use rustc_target::abi::{Abi, FIRST_VARIANT, FieldIdx, Size, VariantIdx};
2222use tracing::{debug, debug_span, instrument};
2323
2424// These constants are somewhat random guesses and have not been optimized.
compiler/rustc_mir_transform/src/dead_store_elimination.rs+2-2
......@@ -16,11 +16,11 @@ use rustc_middle::bug;
1616use rustc_middle::mir::visit::Visitor;
1717use rustc_middle::mir::*;
1818use rustc_middle::ty::TyCtxt;
19use rustc_mir_dataflow::Analysis;
1920use rustc_mir_dataflow::debuginfo::debuginfo_locals;
2021use rustc_mir_dataflow::impls::{
21 borrowed_locals, LivenessTransferFunction, MaybeTransitiveLiveLocals,
22 LivenessTransferFunction, MaybeTransitiveLiveLocals, borrowed_locals,
2223};
23use rustc_mir_dataflow::Analysis;
2424
2525use crate::util::is_within_packed;
2626
compiler/rustc_mir_transform/src/deduce_param_attrs.rs+1-1
......@@ -8,7 +8,7 @@
88use rustc_hir::def_id::LocalDefId;
99use rustc_index::bit_set::BitSet;
1010use rustc_middle::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
11use rustc_middle::mir::{Body, Location, Operand, Place, Terminator, TerminatorKind, RETURN_PLACE};
11use rustc_middle::mir::{Body, Location, Operand, Place, RETURN_PLACE, Terminator, TerminatorKind};
1212use rustc_middle::ty::{self, DeducedParamAttrs, Ty, TyCtxt};
1313use rustc_session::config::OptLevel;
1414
compiler/rustc_mir_transform/src/dest_prop.rs+4-4
......@@ -137,13 +137,13 @@ use rustc_index::interval::SparseIntervalMatrix;
137137use rustc_middle::bug;
138138use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
139139use rustc_middle::mir::{
140 dump_mir, traversal, Body, HasLocalDecls, InlineAsmOperand, Local, LocalKind, Location,
141 Operand, PassWhere, Place, Rvalue, Statement, StatementKind, TerminatorKind,
140 Body, HasLocalDecls, InlineAsmOperand, Local, LocalKind, Location, Operand, PassWhere, Place,
141 Rvalue, Statement, StatementKind, TerminatorKind, dump_mir, traversal,
142142};
143143use rustc_middle::ty::TyCtxt;
144use rustc_mir_dataflow::impls::MaybeLiveLocals;
145use rustc_mir_dataflow::points::{save_as_intervals, DenseLocationMap, PointIndex};
146144use rustc_mir_dataflow::Analysis;
145use rustc_mir_dataflow::impls::MaybeLiveLocals;
146use rustc_mir_dataflow::points::{DenseLocationMap, PointIndex, save_as_intervals};
147147use tracing::{debug, trace};
148148
149149pub(super) struct DestinationPropagation;
compiler/rustc_mir_transform/src/dump_mir.rs+1-1
......@@ -3,7 +3,7 @@
33use std::fs::File;
44use std::io;
55
6use rustc_middle::mir::{write_mir_pretty, Body};
6use rustc_middle::mir::{Body, write_mir_pretty};
77use rustc_middle::ty::TyCtxt;
88use rustc_session::config::{OutFileName, OutputType};
99
compiler/rustc_mir_transform/src/elaborate_drops.rs+3-3
......@@ -1,17 +1,17 @@
11use std::fmt;
22
3use rustc_index::bit_set::BitSet;
43use rustc_index::IndexVec;
4use rustc_index::bit_set::BitSet;
55use rustc_middle::mir::patch::MirPatch;
66use rustc_middle::mir::*;
77use rustc_middle::ty::{self, TyCtxt};
88use rustc_mir_dataflow::elaborate_drops::{
9 elaborate_drop, DropElaborator, DropFlagMode, DropFlagState, DropStyle, Unwind,
9 DropElaborator, DropFlagMode, DropFlagState, DropStyle, Unwind, elaborate_drop,
1010};
1111use rustc_mir_dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
1212use rustc_mir_dataflow::move_paths::{LookupResult, MoveData, MovePathIndex};
1313use rustc_mir_dataflow::{
14 on_all_children_bits, on_lookup_result_bits, Analysis, MoveDataParamEnv, ResultsCursor,
14 Analysis, MoveDataParamEnv, ResultsCursor, on_all_children_bits, on_lookup_result_bits,
1515};
1616use rustc_span::Span;
1717use rustc_target::abi::{FieldIdx, VariantIdx};
compiler/rustc_mir_transform/src/errors.rs+1-1
......@@ -4,8 +4,8 @@ use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
44use rustc_middle::mir::AssertKind;
55use rustc_middle::ty::TyCtxt;
66use rustc_session::lint::{self, Lint};
7use rustc_span::def_id::DefId;
87use rustc_span::Span;
8use rustc_span::def_id::DefId;
99
1010use crate::fluent_generated as fluent;
1111
compiler/rustc_mir_transform/src/ffi_unwind_calls.rs+6-8
......@@ -1,11 +1,11 @@
1use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE};
1use rustc_hir::def_id::{LOCAL_CRATE, LocalDefId};
22use rustc_middle::mir::*;
33use rustc_middle::query::{LocalCrate, Providers};
4use rustc_middle::ty::{self, layout, TyCtxt};
4use rustc_middle::ty::{self, TyCtxt, layout};
55use rustc_middle::{bug, span_bug};
66use rustc_session::lint::builtin::FFI_UNWIND_CALLS;
7use rustc_target::spec::abi::Abi;
87use rustc_target::spec::PanicStrategy;
8use rustc_target::spec::abi::Abi;
99use tracing::debug;
1010
1111use crate::errors;
......@@ -86,12 +86,10 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
8686 let span = terminator.source_info.span;
8787
8888 let foreign = fn_def_id.is_some();
89 tcx.emit_node_span_lint(
90 FFI_UNWIND_CALLS,
91 lint_root,
89 tcx.emit_node_span_lint(FFI_UNWIND_CALLS, lint_root, span, errors::FfiUnwindCall {
9290 span,
93 errors::FfiUnwindCall { span, foreign },
94 );
91 foreign,
92 });
9593
9694 tainted = true;
9795 }
compiler/rustc_mir_transform/src/function_item_references.rs+1-1
......@@ -4,9 +4,9 @@ use rustc_middle::mir::visit::Visitor;
44use rustc_middle::mir::*;
55use rustc_middle::ty::{self, EarlyBinder, GenericArgsRef, Ty, TyCtxt};
66use rustc_session::lint::builtin::FUNCTION_ITEM_REFERENCES;
7use rustc_span::Span;
78use rustc_span::source_map::Spanned;
89use rustc_span::symbol::sym;
9use rustc_span::Span;
1010use rustc_target::spec::abi::Abi;
1111
1212use crate::errors;
compiler/rustc_mir_transform/src/gvn.rs+6-6
......@@ -87,23 +87,23 @@ use std::borrow::Cow;
8787use either::Either;
8888use rustc_const_eval::const_eval::DummyMachine;
8989use rustc_const_eval::interpret::{
90 intern_const_alloc_for_constprop, ImmTy, Immediate, InterpCx, MemPlaceMeta, MemoryKind, OpTy,
91 Projectable, Scalar,
90 ImmTy, Immediate, InterpCx, MemPlaceMeta, MemoryKind, OpTy, Projectable, Scalar,
91 intern_const_alloc_for_constprop,
9292};
9393use rustc_data_structures::fx::FxIndexSet;
9494use rustc_data_structures::graph::dominators::Dominators;
9595use rustc_hir::def::DefKind;
9696use rustc_index::bit_set::BitSet;
97use rustc_index::{newtype_index, IndexVec};
97use rustc_index::{IndexVec, newtype_index};
9898use rustc_middle::bug;
9999use rustc_middle::mir::interpret::GlobalAlloc;
100100use rustc_middle::mir::visit::*;
101101use rustc_middle::mir::*;
102102use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
103103use rustc_middle::ty::{self, Ty, TyCtxt};
104use rustc_span::def_id::DefId;
105104use rustc_span::DUMMY_SP;
106use rustc_target::abi::{self, Abi, FieldIdx, Size, VariantIdx, FIRST_VARIANT};
105use rustc_span::def_id::DefId;
106use rustc_target::abi::{self, Abi, FIRST_VARIANT, FieldIdx, Size, VariantIdx};
107107use smallvec::SmallVec;
108108use tracing::{debug, instrument, trace};
109109
......@@ -1333,8 +1333,8 @@ impl<'body, 'tcx> VnState<'body, 'tcx> {
13331333 to: Ty<'tcx>,
13341334 location: Location,
13351335 ) -> Option<VnIndex> {
1336 use rustc_middle::ty::adjustment::PointerCoercion::*;
13371336 use CastKind::*;
1337 use rustc_middle::ty::adjustment::PointerCoercion::*;
13381338
13391339 let mut from = operand.ty(self.local_decls, self.tcx);
13401340 let mut value = self.simplify_operand(operand, location)?;
compiler/rustc_mir_transform/src/inline.rs+5-8
......@@ -6,8 +6,8 @@ use std::ops::{Range, RangeFrom};
66use rustc_attr::InlineAttr;
77use rustc_hir::def::DefKind;
88use rustc_hir::def_id::DefId;
9use rustc_index::bit_set::BitSet;
109use rustc_index::Idx;
10use rustc_index::bit_set::BitSet;
1111use rustc_middle::bug;
1212use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
1313use rustc_middle::mir::visit::*;
......@@ -885,13 +885,10 @@ impl<'tcx> Inliner<'tcx> {
885885 });
886886
887887 if let Some(block) = return_block {
888 caller_body[block].statements.insert(
889 0,
890 Statement {
891 source_info: callsite.source_info,
892 kind: StatementKind::StorageDead(local),
893 },
894 );
888 caller_body[block].statements.insert(0, Statement {
889 source_info: callsite.source_info,
890 kind: StatementKind::StorageDead(local),
891 });
895892 }
896893
897894 local
compiler/rustc_mir_transform/src/instsimplify.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_hir::LangItem;
55use rustc_middle::bug;
66use rustc_middle::mir::*;
77use rustc_middle::ty::layout::ValidityRequirement;
8use rustc_middle::ty::{self, layout, GenericArgsRef, ParamEnv, Ty, TyCtxt};
8use rustc_middle::ty::{self, GenericArgsRef, ParamEnv, Ty, TyCtxt, layout};
99use rustc_span::sym;
1010use rustc_span::symbol::Symbol;
1111use rustc_target::spec::abi::Abi;
compiler/rustc_mir_transform/src/jump_threading.rs+1-1
......@@ -39,8 +39,8 @@ use rustc_arena::DroplessArena;
3939use rustc_const_eval::const_eval::DummyMachine;
4040use rustc_const_eval::interpret::{ImmTy, Immediate, InterpCx, OpTy, Projectable};
4141use rustc_data_structures::fx::FxHashSet;
42use rustc_index::bit_set::BitSet;
4342use rustc_index::IndexVec;
43use rustc_index::bit_set::BitSet;
4444use rustc_middle::bug;
4545use rustc_middle::mir::interpret::Scalar;
4646use rustc_middle::mir::visit::Visitor;
compiler/rustc_mir_transform/src/known_panics_lint.rs+7-8
......@@ -6,13 +6,13 @@ use std::fmt::Debug;
66
77use rustc_const_eval::const_eval::DummyMachine;
88use rustc_const_eval::interpret::{
9 format_interp_error, ImmTy, InterpCx, InterpResult, Projectable, Scalar,
9 ImmTy, InterpCx, InterpResult, Projectable, Scalar, format_interp_error,
1010};
1111use rustc_data_structures::fx::FxHashSet;
12use rustc_hir::def::DefKind;
1312use rustc_hir::HirId;
14use rustc_index::bit_set::BitSet;
13use rustc_hir::def::DefKind;
1514use rustc_index::IndexVec;
15use rustc_index::bit_set::BitSet;
1616use rustc_middle::bug;
1717use rustc_middle::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
1818use rustc_middle::mir::*;
......@@ -296,12 +296,11 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
296296 let source_info = self.body.source_info(location);
297297 if let Some(lint_root) = self.lint_root(*source_info) {
298298 let span = source_info.span;
299 self.tcx.emit_node_span_lint(
300 lint_kind.lint(),
301 lint_root,
299 self.tcx.emit_node_span_lint(lint_kind.lint(), lint_root, span, AssertLint {
302300 span,
303 AssertLint { span, assert_kind, lint_kind },
304 );
301 assert_kind,
302 lint_kind,
303 });
305304 }
306305 }
307306
compiler/rustc_mir_transform/src/lib.rs+3-3
......@@ -26,14 +26,14 @@ use rustc_hir::def_id::LocalDefId;
2626use rustc_index::IndexVec;
2727use rustc_middle::mir::{
2828 AnalysisPhase, Body, CallSource, ClearCrossCrate, ConstOperand, ConstQualifs, LocalDecl,
29 MirPhase, Operand, Place, ProjectionElem, Promoted, RuntimePhase, Rvalue, SourceInfo,
30 Statement, StatementKind, TerminatorKind, START_BLOCK,
29 MirPhase, Operand, Place, ProjectionElem, Promoted, RuntimePhase, Rvalue, START_BLOCK,
30 SourceInfo, Statement, StatementKind, TerminatorKind,
3131};
3232use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt};
3333use rustc_middle::util::Providers;
3434use rustc_middle::{bug, query, span_bug};
3535use rustc_span::source_map::Spanned;
36use rustc_span::{sym, DUMMY_SP};
36use rustc_span::{DUMMY_SP, sym};
3737use rustc_trait_selection::traits;
3838use tracing::{debug, trace};
3939
compiler/rustc_mir_transform/src/promote_consts.rs+10-14
......@@ -15,7 +15,7 @@ use std::cell::Cell;
1515use std::{cmp, iter, mem};
1616
1717use either::{Left, Right};
18use rustc_const_eval::check_consts::{qualifs, ConstCx};
18use rustc_const_eval::check_consts::{ConstCx, qualifs};
1919use rustc_data_structures::fx::FxHashSet;
2020use rustc_hir as hir;
2121use rustc_index::{Idx, IndexSlice, IndexVec};
......@@ -23,8 +23,8 @@ use rustc_middle::mir::visit::{MutVisitor, MutatingUseContext, PlaceContext, Vis
2323use rustc_middle::mir::*;
2424use rustc_middle::ty::{self, GenericArgs, List, Ty, TyCtxt, TypeVisitableExt};
2525use rustc_middle::{bug, mir, span_bug};
26use rustc_span::source_map::Spanned;
2726use rustc_span::Span;
27use rustc_span::source_map::Spanned;
2828use tracing::{debug, instrument};
2929
3030/// A `MirPass` for promotion.
......@@ -912,23 +912,19 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
912912 self.extra_statements.push((loc, promoted_ref_statement));
913913
914914 (
915 Rvalue::Ref(
916 tcx.lifetimes.re_erased,
917 *borrow_kind,
918 Place {
919 local: mem::replace(&mut place.local, promoted_ref),
920 projection: List::empty(),
921 },
922 ),
915 Rvalue::Ref(tcx.lifetimes.re_erased, *borrow_kind, Place {
916 local: mem::replace(&mut place.local, promoted_ref),
917 projection: List::empty(),
918 }),
923919 promoted_operand,
924920 )
925921 };
926922
927923 assert_eq!(self.new_block(), START_BLOCK);
928 self.visit_rvalue(
929 &mut rvalue,
930 Location { block: START_BLOCK, statement_index: usize::MAX },
931 );
924 self.visit_rvalue(&mut rvalue, Location {
925 block: START_BLOCK,
926 statement_index: usize::MAX,
927 });
932928
933929 let span = self.promoted.span;
934930 self.assign(RETURN_PLACE, rvalue, span);
compiler/rustc_mir_transform/src/ref_prop.rs+2-2
......@@ -1,15 +1,15 @@
11use std::borrow::Cow;
22
33use rustc_data_structures::fx::FxHashSet;
4use rustc_index::bit_set::BitSet;
54use rustc_index::IndexVec;
5use rustc_index::bit_set::BitSet;
66use rustc_middle::bug;
77use rustc_middle::mir::visit::*;
88use rustc_middle::mir::*;
99use rustc_middle::ty::TyCtxt;
10use rustc_mir_dataflow::Analysis;
1011use rustc_mir_dataflow::impls::MaybeStorageDead;
1112use rustc_mir_dataflow::storage::always_storage_live_locals;
12use rustc_mir_dataflow::Analysis;
1313use tracing::{debug, instrument};
1414
1515use crate::ssa::{SsaLocals, StorageLiveLocals};
compiler/rustc_mir_transform/src/remove_uninit_drops.rs+1-1
......@@ -3,7 +3,7 @@ use rustc_middle::mir::{Body, TerminatorKind};
33use rustc_middle::ty::{self, GenericArgsRef, ParamEnv, Ty, TyCtxt, VariantDef};
44use rustc_mir_dataflow::impls::MaybeInitializedPlaces;
55use rustc_mir_dataflow::move_paths::{LookupResult, MoveData, MovePathIndex};
6use rustc_mir_dataflow::{move_path_children_matching, Analysis, MaybeReachable};
6use rustc_mir_dataflow::{Analysis, MaybeReachable, move_path_children_matching};
77use rustc_target::abi::FieldIdx;
88
99/// Removes `Drop` terminators whose target is known to be uninitialized at
compiler/rustc_mir_transform/src/required_consts.rs+1-1
......@@ -1,5 +1,5 @@
11use rustc_middle::mir::visit::Visitor;
2use rustc_middle::mir::{traversal, Body, ConstOperand, Location};
2use rustc_middle::mir::{Body, ConstOperand, Location, traversal};
33
44pub(super) struct RequiredConstsVisitor<'tcx> {
55 required_consts: Vec<ConstOperand<'tcx>>,
compiler/rustc_mir_transform/src/shim.rs+2-2
......@@ -14,8 +14,8 @@ use rustc_middle::ty::{
1414use rustc_middle::{bug, span_bug};
1515use rustc_mir_dataflow::elaborate_drops::{self, DropElaborator, DropFlagMode, DropStyle};
1616use rustc_span::source_map::Spanned;
17use rustc_span::{Span, DUMMY_SP};
18use rustc_target::abi::{FieldIdx, VariantIdx, FIRST_VARIANT};
17use rustc_span::{DUMMY_SP, Span};
18use rustc_target::abi::{FIRST_VARIANT, FieldIdx, VariantIdx};
1919use rustc_target::spec::abi::Abi;
2020use tracing::{debug, instrument};
2121
compiler/rustc_mir_transform/src/shim/async_destructor_ctor.rs+15-17
......@@ -8,8 +8,8 @@ use rustc_hir::lang_items::LangItem;
88use rustc_index::{Idx, IndexVec};
99use rustc_middle::mir::{
1010 BasicBlock, BasicBlockData, Body, CallSource, CastKind, Const, ConstOperand, ConstValue, Local,
11 LocalDecl, MirSource, Operand, Place, PlaceElem, Rvalue, SourceInfo, Statement, StatementKind,
12 Terminator, TerminatorKind, UnwindAction, UnwindTerminateReason, RETURN_PLACE,
11 LocalDecl, MirSource, Operand, Place, PlaceElem, RETURN_PLACE, Rvalue, SourceInfo, Statement,
12 StatementKind, Terminator, TerminatorKind, UnwindAction, UnwindTerminateReason,
1313};
1414use rustc_middle::ty::adjustment::PointerCoercion;
1515use rustc_middle::ty::util::{AsyncDropGlueMorphology, Discr};
......@@ -452,19 +452,17 @@ impl<'tcx> AsyncDestructorCtorShimBuilder<'tcx> {
452452 }
453453
454454 fn combine_sync_surface(&mut self) -> Ty<'tcx> {
455 self.apply_combinator(
456 1,
457 LangItem::AsyncDropSurfaceDropInPlace,
458 &[self.self_ty.unwrap().into()],
459 )
455 self.apply_combinator(1, LangItem::AsyncDropSurfaceDropInPlace, &[self
456 .self_ty
457 .unwrap()
458 .into()])
460459 }
461460
462461 fn combine_deferred_drop_in_place(&mut self) -> Ty<'tcx> {
463 self.apply_combinator(
464 1,
465 LangItem::AsyncDropDeferredDropInPlace,
466 &[self.self_ty.unwrap().into()],
467 )
462 self.apply_combinator(1, LangItem::AsyncDropDeferredDropInPlace, &[self
463 .self_ty
464 .unwrap()
465 .into()])
468466 }
469467
470468 fn combine_fuse(&mut self, inner_future_ty: Ty<'tcx>) -> Ty<'tcx> {
......@@ -484,11 +482,11 @@ impl<'tcx> AsyncDestructorCtorShimBuilder<'tcx> {
484482 }
485483
486484 fn combine_either(&mut self, other: Ty<'tcx>, matched: Ty<'tcx>) -> Ty<'tcx> {
487 self.apply_combinator(
488 4,
489 LangItem::AsyncDropEither,
490 &[other.into(), matched.into(), self.self_ty.unwrap().into()],
491 )
485 self.apply_combinator(4, LangItem::AsyncDropEither, &[
486 other.into(),
487 matched.into(),
488 self.self_ty.unwrap().into(),
489 ])
492490 }
493491
494492 fn return_(mut self) -> Body<'tcx> {
compiler/rustc_mir_transform/src/simplify_comparison_integral.rs+4-7
......@@ -113,13 +113,10 @@ impl<'tcx> crate::MirPass<'tcx> for SimplifyComparisonIntegral {
113113 // if we have StorageDeads to remove then make sure to insert them at the top of
114114 // each target
115115 for bb_idx in new_targets.all_targets() {
116 storage_deads_to_insert.push((
117 *bb_idx,
118 Statement {
119 source_info: terminator.source_info,
120 kind: StatementKind::StorageDead(opt.to_switch_on.local),
121 },
122 ));
116 storage_deads_to_insert.push((*bb_idx, Statement {
117 source_info: terminator.source_info,
118 kind: StatementKind::StorageDead(opt.to_switch_on.local),
119 }));
123120 }
124121 }
125122
compiler/rustc_mir_transform/src/single_use_consts.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_index::bit_set::BitSet;
21use rustc_index::IndexVec;
2use rustc_index::bit_set::BitSet;
33use rustc_middle::bug;
44use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
55use rustc_middle::mir::*;
compiler/rustc_mir_transform/src/sroa.rs+2-2
......@@ -1,14 +1,14 @@
11use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
22use rustc_hir::LangItem;
3use rustc_index::bit_set::{BitSet, GrowableBitSet};
43use rustc_index::IndexVec;
4use rustc_index::bit_set::{BitSet, GrowableBitSet};
55use rustc_middle::bug;
66use rustc_middle::mir::patch::MirPatch;
77use rustc_middle::mir::visit::*;
88use rustc_middle::mir::*;
99use rustc_middle::ty::{self, Ty, TyCtxt};
1010use rustc_mir_dataflow::value_analysis::{excluded_locals, iter_fields};
11use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
11use rustc_target::abi::{FIRST_VARIANT, FieldIdx};
1212use tracing::{debug, instrument};
1313
1414pub(super) struct ScalarReplacementOfAggregates;
compiler/rustc_mir_transform/src/ssa.rs+4-5
......@@ -159,11 +159,10 @@ impl SsaLocals {
159159 ) {
160160 for &local in &self.assignment_order {
161161 match self.assignments[local] {
162 Set1::One(DefLocation::Argument) => f(
163 local,
164 AssignedValue::Arg,
165 Location { block: START_BLOCK, statement_index: 0 },
166 ),
162 Set1::One(DefLocation::Argument) => f(local, AssignedValue::Arg, Location {
163 block: START_BLOCK,
164 statement_index: 0,
165 }),
167166 Set1::One(DefLocation::Assignment(loc)) => {
168167 let bb = &mut basic_blocks[loc.block];
169168 // `loc` must point to a direct assignment to `local`.
compiler/rustc_mir_transform/src/validate.rs+2-2
......@@ -2,8 +2,8 @@
22
33use rustc_data_structures::fx::{FxHashMap, FxHashSet};
44use rustc_hir::LangItem;
5use rustc_index::bit_set::BitSet;
65use rustc_index::IndexVec;
6use rustc_index::bit_set::BitSet;
77use rustc_infer::traits::Reveal;
88use rustc_middle::mir::coverage::CoverageKind;
99use rustc_middle::mir::visit::{NonUseContext, PlaceContext, Visitor};
......@@ -14,7 +14,7 @@ use rustc_middle::ty::{
1414 Variance,
1515};
1616use rustc_middle::{bug, span_bug};
17use rustc_target::abi::{Size, FIRST_VARIANT};
17use rustc_target::abi::{FIRST_VARIANT, Size};
1818use rustc_target::spec::abi::Abi;
1919
2020use crate::util::{is_within_packed, relate_types};
compiler/rustc_monomorphize/src/collector.rs+6-6
......@@ -210,7 +210,7 @@ mod move_check;
210210use std::path::PathBuf;
211211
212212use move_check::MoveCheckState;
213use rustc_data_structures::sync::{par_for_each_in, LRef, MTLock};
213use rustc_data_structures::sync::{LRef, MTLock, par_for_each_in};
214214use rustc_data_structures::unord::{UnordMap, UnordSet};
215215use rustc_hir as hir;
216216use rustc_hir::def::DefKind;
......@@ -220,7 +220,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
220220use rustc_middle::mir::interpret::{AllocId, ErrorHandled, GlobalAlloc, Scalar};
221221use rustc_middle::mir::mono::{InstantiationMode, MonoItem};
222222use rustc_middle::mir::visit::Visitor as MirVisitor;
223use rustc_middle::mir::{self, traversal, Location, MentionedItem};
223use rustc_middle::mir::{self, Location, MentionedItem, traversal};
224224use rustc_middle::query::TyCtxtAt;
225225use rustc_middle::ty::adjustment::{CustomCoerceUnsized, PointerCoercion};
226226use rustc_middle::ty::layout::ValidityRequirement;
......@@ -231,11 +231,11 @@ use rustc_middle::ty::{
231231};
232232use rustc_middle::util::Providers;
233233use rustc_middle::{bug, span_bug};
234use rustc_session::config::EntryFnType;
235234use rustc_session::Limit;
236use rustc_span::source_map::{dummy_spanned, respan, Spanned};
237use rustc_span::symbol::{sym, Ident};
238use rustc_span::{Span, DUMMY_SP};
235use rustc_session::config::EntryFnType;
236use rustc_span::source_map::{Spanned, dummy_spanned, respan};
237use rustc_span::symbol::{Ident, sym};
238use rustc_span::{DUMMY_SP, Span};
239239use rustc_target::abi::Size;
240240use tracing::{debug, instrument, trace};
241241
compiler/rustc_monomorphize/src/collector/move_check.rs+4-5
......@@ -132,12 +132,11 @@ impl<'a, 'tcx> MirUsedCollector<'a, 'tcx> {
132132 // but correct span? This would make the lint at least accept crate-level lint attributes.
133133 return;
134134 };
135 self.tcx.emit_node_span_lint(
136 LARGE_ASSIGNMENTS,
137 lint_root,
135 self.tcx.emit_node_span_lint(LARGE_ASSIGNMENTS, lint_root, span, LargeAssignmentsLint {
138136 span,
139 LargeAssignmentsLint { span, size: too_large_size.bytes(), limit: limit as u64 },
140 );
137 size: too_large_size.bytes(),
138 limit: limit as u64,
139 });
141140 self.move_check.move_size_spans.push(span);
142141 }
143142}
compiler/rustc_monomorphize/src/partitioning.rs+8-4
......@@ -101,10 +101,10 @@ use std::path::{Path, PathBuf};
101101use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
102102use rustc_data_structures::sync;
103103use rustc_data_structures::unord::{UnordMap, UnordSet};
104use rustc_hir::LangItem;
104105use rustc_hir::def::DefKind;
105106use rustc_hir::def_id::{DefId, DefIdSet, LOCAL_CRATE};
106107use rustc_hir::definitions::DefPathDataName;
107use rustc_hir::LangItem;
108108use rustc_middle::bug;
109109use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
110110use rustc_middle::middle::exported_symbols::{SymbolExportInfo, SymbolExportLevel};
......@@ -116,8 +116,8 @@ use rustc_middle::ty::print::{characteristic_def_id_of_type, with_no_trimmed_pat
116116use rustc_middle::ty::visit::TypeVisitableExt;
117117use rustc_middle::ty::{self, InstanceKind, TyCtxt};
118118use rustc_middle::util::Providers;
119use rustc_session::config::{DumpMonoStatsFormat, SwitchWithOptPath};
120119use rustc_session::CodegenUnits;
120use rustc_session::config::{DumpMonoStatsFormat, SwitchWithOptPath};
121121use rustc_span::symbol::Symbol;
122122use tracing::debug;
123123
......@@ -255,8 +255,12 @@ where
255255 }
256256 let size_estimate = mono_item.size_estimate(cx.tcx);
257257
258 cgu.items_mut()
259 .insert(mono_item, MonoItemData { inlined: false, linkage, visibility, size_estimate });
258 cgu.items_mut().insert(mono_item, MonoItemData {
259 inlined: false,
260 linkage,
261 visibility,
262 size_estimate,
263 });
260264
261265 // Get all inlined items that are reachable from `mono_item` without
262266 // going via another root item. This includes drop-glue, functions from
compiler/rustc_monomorphize/src/polymorphize.rs+1-1
......@@ -5,9 +5,9 @@
55//! generic parameters are unused (and eventually, in what ways generic parameters are used - only
66//! for their size, offset of a field, etc.).
77
8use rustc_hir::ConstContext;
89use rustc_hir::def::DefKind;
910use rustc_hir::def_id::DefId;
10use rustc_hir::ConstContext;
1111use rustc_middle::mir::visit::{TyContext, Visitor};
1212use rustc_middle::mir::{self, Local, LocalDecl, Location};
1313use rustc_middle::query::Providers;
compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs+1-1
......@@ -7,7 +7,7 @@ use rustc_type_ir::fold::TypeFoldable;
77use rustc_type_ir::inherent::*;
88use rustc_type_ir::lang_items::TraitSolverLangItem;
99use rustc_type_ir::visit::TypeVisitableExt as _;
10use rustc_type_ir::{self as ty, elaborate, Interner, Upcast as _};
10use rustc_type_ir::{self as ty, Interner, Upcast as _, elaborate};
1111use tracing::{debug, instrument};
1212
1313use crate::delegate::SolverDelegate;
compiler/rustc_next_trait_solver/src/solve/assembly/structural_traits.rs+13-18
......@@ -7,7 +7,7 @@ use rustc_type_ir::data_structures::HashMap;
77use rustc_type_ir::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable};
88use rustc_type_ir::inherent::*;
99use rustc_type_ir::lang_items::TraitSolverLangItem;
10use rustc_type_ir::{self as ty, elaborate, Interner, Upcast as _};
10use rustc_type_ir::{self as ty, Interner, Upcast as _, elaborate};
1111use rustc_type_ir_macros::{TypeFoldable_Generic, TypeVisitable_Generic};
1212use tracing::instrument;
1313
......@@ -507,11 +507,10 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<I:
507507 // will project to the right upvars for the generator, appending the inputs and
508508 // coroutine upvars respecting the closure kind.
509509 nested.push(
510 ty::TraitRef::new(
511 cx,
512 async_fn_kind_trait_def_id,
513 [kind_ty, Ty::from_closure_kind(cx, goal_kind)],
514 )
510 ty::TraitRef::new(cx, async_fn_kind_trait_def_id, [
511 kind_ty,
512 Ty::from_closure_kind(cx, goal_kind),
513 ])
515514 .upcast(cx),
516515 );
517516 }
......@@ -617,18 +616,14 @@ fn coroutine_closure_to_ambiguous_coroutine<I: Interner>(
617616 sig: ty::CoroutineClosureSignature<I>,
618617) -> I::Ty {
619618 let upvars_projection_def_id = cx.require_lang_item(TraitSolverLangItem::AsyncFnKindUpvars);
620 let tupled_upvars_ty = Ty::new_projection(
621 cx,
622 upvars_projection_def_id,
623 [
624 I::GenericArg::from(args.kind_ty()),
625 Ty::from_closure_kind(cx, goal_kind).into(),
626 goal_region.into(),
627 sig.tupled_inputs_ty.into(),
628 args.tupled_upvars_ty().into(),
629 args.coroutine_captures_by_ref_ty().into(),
630 ],
631 );
619 let tupled_upvars_ty = Ty::new_projection(cx, upvars_projection_def_id, [
620 I::GenericArg::from(args.kind_ty()),
621 Ty::from_closure_kind(cx, goal_kind).into(),
622 goal_region.into(),
623 sig.tupled_inputs_ty.into(),
624 args.tupled_upvars_ty().into(),
625 args.coroutine_captures_by_ref_ty().into(),
626 ]);
632627 sig.to_coroutine(
633628 cx,
634629 args.parent_args(),
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs+3-3
......@@ -22,9 +22,9 @@ use crate::delegate::SolverDelegate;
2222use crate::resolve::EagerResolver;
2323use crate::solve::eval_ctxt::NestedGoals;
2424use crate::solve::{
25 inspect, response_no_constraints_raw, CanonicalInput, CanonicalResponse, Certainty, EvalCtxt,
26 ExternalConstraintsData, Goal, MaybeCause, NestedNormalizationGoals, NoSolution,
27 PredefinedOpaquesData, QueryInput, QueryResult, Response,
25 CanonicalInput, CanonicalResponse, Certainty, EvalCtxt, ExternalConstraintsData, Goal,
26 MaybeCause, NestedNormalizationGoals, NoSolution, PredefinedOpaquesData, QueryInput,
27 QueryResult, Response, inspect, response_no_constraints_raw,
2828};
2929
3030trait ResponseT<I: Interner> {
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs+7-7
......@@ -17,9 +17,9 @@ use crate::delegate::SolverDelegate;
1717use crate::solve::inspect::{self, ProofTreeBuilder};
1818use crate::solve::search_graph::SearchGraph;
1919use crate::solve::{
20 CanonicalInput, CanonicalResponse, Certainty, Goal, GoalEvaluationKind, GoalSource,
21 NestedNormalizationGoals, NoSolution, PredefinedOpaquesData, QueryResult, SolverMode,
22 FIXPOINT_STEP_LIMIT,
20 CanonicalInput, CanonicalResponse, Certainty, FIXPOINT_STEP_LIMIT, Goal, GoalEvaluationKind,
21 GoalSource, NestedNormalizationGoals, NoSolution, PredefinedOpaquesData, QueryResult,
22 SolverMode,
2323};
2424
2525pub(super) mod canonical;
......@@ -497,10 +497,10 @@ where
497497 // Replace the goal with an unconstrained infer var, so the
498498 // RHS does not affect projection candidate assembly.
499499 let unconstrained_rhs = self.next_term_infer_of_kind(goal.predicate.term);
500 let unconstrained_goal = goal.with(
501 cx,
502 ty::NormalizesTo { alias: goal.predicate.alias, term: unconstrained_rhs },
503 );
500 let unconstrained_goal = goal.with(cx, ty::NormalizesTo {
501 alias: goal.predicate.alias,
502 term: unconstrained_rhs,
503 });
504504
505505 let (NestedNormalizationGoals(nested_goals), _, certainty) = self.evaluate_goal_raw(
506506 GoalEvaluationKind::Nested,
compiler/rustc_next_trait_solver/src/solve/eval_ctxt/probe.rs+1-1
......@@ -6,7 +6,7 @@ use tracing::instrument;
66use crate::delegate::SolverDelegate;
77use crate::solve::assembly::Candidate;
88use crate::solve::{
9 inspect, BuiltinImplSource, CandidateSource, EvalCtxt, NoSolution, QueryResult,
9 BuiltinImplSource, CandidateSource, EvalCtxt, NoSolution, QueryResult, inspect,
1010};
1111
1212pub(in crate::solve) struct ProbeCtxt<'me, 'a, D, I, F, T>
compiler/rustc_next_trait_solver/src/solve/inspect/build.rs+2-2
......@@ -13,8 +13,8 @@ use rustc_type_ir::{self as ty, Interner};
1313use crate::delegate::SolverDelegate;
1414use crate::solve::eval_ctxt::canonical;
1515use crate::solve::{
16 inspect, CanonicalInput, Certainty, GenerateProofTree, Goal, GoalEvaluationKind, GoalSource,
17 QueryInput, QueryResult,
16 CanonicalInput, Certainty, GenerateProofTree, Goal, GoalEvaluationKind, GoalSource, QueryInput,
17 QueryResult, inspect,
1818};
1919
2020/// The core data structure when building proof trees.
compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs+25-37
......@@ -340,11 +340,10 @@ where
340340
341341 let pred = tupled_inputs_and_output
342342 .map_bound(|(inputs, output)| ty::ProjectionPredicate {
343 projection_term: ty::AliasTerm::new(
344 cx,
345 goal.predicate.def_id(),
346 [goal.predicate.self_ty(), inputs],
347 ),
343 projection_term: ty::AliasTerm::new(cx, goal.predicate.def_id(), [
344 goal.predicate.self_ty(),
345 inputs,
346 ]),
348347 term: output.into(),
349348 })
350349 .upcast(cx);
......@@ -396,26 +395,21 @@ where
396395 .is_lang_item(goal.predicate.def_id(), TraitSolverLangItem::CallOnceFuture)
397396 {
398397 (
399 ty::AliasTerm::new(
400 cx,
401 goal.predicate.def_id(),
402 [goal.predicate.self_ty(), tupled_inputs_ty],
403 ),
398 ty::AliasTerm::new(cx, goal.predicate.def_id(), [
399 goal.predicate.self_ty(),
400 tupled_inputs_ty,
401 ]),
404402 output_coroutine_ty.into(),
405403 )
406404 } else if cx
407405 .is_lang_item(goal.predicate.def_id(), TraitSolverLangItem::CallRefFuture)
408406 {
409407 (
410 ty::AliasTerm::new(
411 cx,
412 goal.predicate.def_id(),
413 [
414 I::GenericArg::from(goal.predicate.self_ty()),
415 tupled_inputs_ty.into(),
416 env_region.into(),
417 ],
418 ),
408 ty::AliasTerm::new(cx, goal.predicate.def_id(), [
409 I::GenericArg::from(goal.predicate.self_ty()),
410 tupled_inputs_ty.into(),
411 env_region.into(),
412 ]),
419413 output_coroutine_ty.into(),
420414 )
421415 } else if cx.is_lang_item(
......@@ -423,14 +417,10 @@ where
423417 TraitSolverLangItem::AsyncFnOnceOutput,
424418 ) {
425419 (
426 ty::AliasTerm::new(
427 cx,
428 goal.predicate.def_id(),
429 [
430 I::GenericArg::from(goal.predicate.self_ty()),
431 tupled_inputs_ty.into(),
432 ],
433 ),
420 ty::AliasTerm::new(cx, goal.predicate.def_id(), [
421 I::GenericArg::from(goal.predicate.self_ty()),
422 tupled_inputs_ty.into(),
423 ]),
434424 coroutine_return_ty.into(),
435425 )
436426 } else {
......@@ -556,11 +546,10 @@ where
556546 // and opaque types: If the `self_ty` is `Sized`, then the metadata is `()`.
557547 // FIXME(ptr_metadata): This impl overlaps with the other impls and shouldn't
558548 // exist. Instead, `Pointee<Metadata = ()>` should be a supertrait of `Sized`.
559 let sized_predicate = ty::TraitRef::new(
560 cx,
561 cx.require_lang_item(TraitSolverLangItem::Sized),
562 [I::GenericArg::from(goal.predicate.self_ty())],
563 );
549 let sized_predicate =
550 ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Sized), [
551 I::GenericArg::from(goal.predicate.self_ty()),
552 ]);
564553 // FIXME(-Znext-solver=coinductive): Should this be `GoalSource::ImplWhereBound`?
565554 ecx.add_goal(GoalSource::Misc, goal.with(cx, sized_predicate));
566555 Ty::new_unit(cx)
......@@ -731,11 +720,10 @@ where
731720 CandidateSource::BuiltinImpl(BuiltinImplSource::Misc),
732721 goal,
733722 ty::ProjectionPredicate {
734 projection_term: ty::AliasTerm::new(
735 ecx.cx(),
736 goal.predicate.def_id(),
737 [self_ty, coroutine.resume_ty()],
738 ),
723 projection_term: ty::AliasTerm::new(ecx.cx(), goal.predicate.def_id(), [
724 self_ty,
725 coroutine.resume_ty(),
726 ]),
739727 term,
740728 }
741729 .upcast(cx),
compiler/rustc_next_trait_solver/src/solve/search_graph.rs+2-2
......@@ -1,13 +1,13 @@
11use std::convert::Infallible;
22use std::marker::PhantomData;
33
4use rustc_type_ir::Interner;
45use rustc_type_ir::inherent::*;
56use rustc_type_ir::search_graph::{self, PathKind};
67use rustc_type_ir::solve::{CanonicalInput, Certainty, QueryResult};
7use rustc_type_ir::Interner;
88
99use super::inspect::ProofTreeBuilder;
10use super::{has_no_inference_or_external_constraints, FIXPOINT_STEP_LIMIT};
10use super::{FIXPOINT_STEP_LIMIT, has_no_inference_or_external_constraints};
1111use crate::delegate::SolverDelegate;
1212
1313/// This type is never constructed. We only use it to implement `search_graph::Delegate`
compiler/rustc_next_trait_solver/src/solve/trait_goals.rs+14-21
......@@ -6,7 +6,7 @@ use rustc_type_ir::fast_reject::DeepRejectCtxt;
66use rustc_type_ir::inherent::*;
77use rustc_type_ir::lang_items::TraitSolverLangItem;
88use rustc_type_ir::visit::TypeVisitableExt as _;
9use rustc_type_ir::{self as ty, elaborate, Interner, TraitPredicate, Upcast as _};
9use rustc_type_ir::{self as ty, Interner, TraitPredicate, Upcast as _, elaborate};
1010use tracing::{instrument, trace};
1111
1212use crate::delegate::SolverDelegate;
......@@ -359,21 +359,18 @@ where
359359 )?;
360360 let output_is_sized_pred = tupled_inputs_and_output_and_coroutine.map_bound(
361361 |AsyncCallableRelevantTypes { output_coroutine_ty, .. }| {
362 ty::TraitRef::new(
363 cx,
364 cx.require_lang_item(TraitSolverLangItem::Sized),
365 [output_coroutine_ty],
366 )
362 ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Sized), [
363 output_coroutine_ty,
364 ])
367365 },
368366 );
369367
370368 let pred = tupled_inputs_and_output_and_coroutine
371369 .map_bound(|AsyncCallableRelevantTypes { tupled_inputs_ty, .. }| {
372 ty::TraitRef::new(
373 cx,
374 goal.predicate.def_id(),
375 [goal.predicate.self_ty(), tupled_inputs_ty],
376 )
370 ty::TraitRef::new(cx, goal.predicate.def_id(), [
371 goal.predicate.self_ty(),
372 tupled_inputs_ty,
373 ])
377374 })
378375 .upcast(cx);
379376 // A built-in `AsyncFn` impl only holds if the output is sized.
......@@ -1027,11 +1024,9 @@ where
10271024 GoalSource::ImplWhereBound,
10281025 goal.with(
10291026 cx,
1030 ty::TraitRef::new(
1031 cx,
1032 cx.require_lang_item(TraitSolverLangItem::Unsize),
1033 [a_tail_ty, b_tail_ty],
1034 ),
1027 ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Unsize), [
1028 a_tail_ty, b_tail_ty,
1029 ]),
10351030 ),
10361031 );
10371032 self.probe_builtin_trait_candidate(BuiltinImplSource::Misc)
......@@ -1069,11 +1064,9 @@ where
10691064 GoalSource::ImplWhereBound,
10701065 goal.with(
10711066 cx,
1072 ty::TraitRef::new(
1073 cx,
1074 cx.require_lang_item(TraitSolverLangItem::Unsize),
1075 [a_last_ty, b_last_ty],
1076 ),
1067 ty::TraitRef::new(cx, cx.require_lang_item(TraitSolverLangItem::Unsize), [
1068 a_last_ty, b_last_ty,
1069 ]),
10771070 ),
10781071 );
10791072 self.probe_builtin_trait_candidate(BuiltinImplSource::TupleUnsizing)
compiler/rustc_parse/src/errors.rs+24-36
......@@ -1116,25 +1116,19 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for ExpectedIdentifier {
11161116 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
11171117 let token_descr = TokenDescription::from_token(&self.token);
11181118
1119 let mut diag = Diag::new(
1120 dcx,
1121 level,
1122 match token_descr {
1123 Some(TokenDescription::ReservedIdentifier) => {
1124 fluent::parse_expected_identifier_found_reserved_identifier_str
1125 }
1126 Some(TokenDescription::Keyword) => {
1127 fluent::parse_expected_identifier_found_keyword_str
1128 }
1129 Some(TokenDescription::ReservedKeyword) => {
1130 fluent::parse_expected_identifier_found_reserved_keyword_str
1131 }
1132 Some(TokenDescription::DocComment) => {
1133 fluent::parse_expected_identifier_found_doc_comment_str
1134 }
1135 None => fluent::parse_expected_identifier_found_str,
1136 },
1137 );
1119 let mut diag = Diag::new(dcx, level, match token_descr {
1120 Some(TokenDescription::ReservedIdentifier) => {
1121 fluent::parse_expected_identifier_found_reserved_identifier_str
1122 }
1123 Some(TokenDescription::Keyword) => fluent::parse_expected_identifier_found_keyword_str,
1124 Some(TokenDescription::ReservedKeyword) => {
1125 fluent::parse_expected_identifier_found_reserved_keyword_str
1126 }
1127 Some(TokenDescription::DocComment) => {
1128 fluent::parse_expected_identifier_found_doc_comment_str
1129 }
1130 None => fluent::parse_expected_identifier_found_str,
1131 });
11381132 diag.span(self.span);
11391133 diag.arg("token", self.token);
11401134
......@@ -1176,23 +1170,17 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for ExpectedSemi {
11761170 fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, G> {
11771171 let token_descr = TokenDescription::from_token(&self.token);
11781172
1179 let mut diag = Diag::new(
1180 dcx,
1181 level,
1182 match token_descr {
1183 Some(TokenDescription::ReservedIdentifier) => {
1184 fluent::parse_expected_semi_found_reserved_identifier_str
1185 }
1186 Some(TokenDescription::Keyword) => fluent::parse_expected_semi_found_keyword_str,
1187 Some(TokenDescription::ReservedKeyword) => {
1188 fluent::parse_expected_semi_found_reserved_keyword_str
1189 }
1190 Some(TokenDescription::DocComment) => {
1191 fluent::parse_expected_semi_found_doc_comment_str
1192 }
1193 None => fluent::parse_expected_semi_found_str,
1194 },
1195 );
1173 let mut diag = Diag::new(dcx, level, match token_descr {
1174 Some(TokenDescription::ReservedIdentifier) => {
1175 fluent::parse_expected_semi_found_reserved_identifier_str
1176 }
1177 Some(TokenDescription::Keyword) => fluent::parse_expected_semi_found_keyword_str,
1178 Some(TokenDescription::ReservedKeyword) => {
1179 fluent::parse_expected_semi_found_reserved_keyword_str
1180 }
1181 Some(TokenDescription::DocComment) => fluent::parse_expected_semi_found_doc_comment_str,
1182 None => fluent::parse_expected_semi_found_str,
1183 });
11961184 diag.span(self.span);
11971185 diag.arg("token", self.token);
11981186
compiler/rustc_parse/src/lexer/diagnostics.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_ast::token::Delimiter;
22use rustc_errors::Diag;
3use rustc_span::source_map::SourceMap;
43use rustc_span::Span;
4use rustc_span::source_map::SourceMap;
55
66use super::UnmatchedDelim;
77
compiler/rustc_parse/src/lexer/mod.rs+2-2
......@@ -8,10 +8,10 @@ use rustc_errors::codes::*;
88use rustc_errors::{Applicability, Diag, DiagCtxtHandle, StashKey};
99use rustc_lexer::unescape::{self, EscapeError, Mode};
1010use rustc_lexer::{Base, Cursor, DocStyle, LiteralKind, RawStrError};
11use rustc_session::lint::BuiltinLintDiag;
1112use rustc_session::lint::builtin::{
1213 RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX, TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
1314};
14use rustc_session::lint::BuiltinLintDiag;
1515use rustc_session::parse::ParseSess;
1616use rustc_span::symbol::Symbol;
1717use rustc_span::{BytePos, Pos, Span};
......@@ -866,7 +866,7 @@ impl<'psess, 'src> StringReader<'psess, 'src> {
866866}
867867
868868pub fn nfc_normalize(string: &str) -> Symbol {
869 use unicode_normalization::{is_nfc_quick, IsNormalized, UnicodeNormalization};
869 use unicode_normalization::{IsNormalized, UnicodeNormalization, is_nfc_quick};
870870 match is_nfc_quick(string.chars()) {
871871 IsNormalized::Yes => Symbol::intern(string),
872872 _ => {
compiler/rustc_parse/src/lexer/tokentrees.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_errors::{Applicability, PErr};
55use rustc_span::symbol::kw;
66
77use super::diagnostics::{
8 report_suspicious_mismatch_block, same_indentation_level, TokenTreeDiagInfo,
8 TokenTreeDiagInfo, report_suspicious_mismatch_block, same_indentation_level,
99};
1010use super::{StringReader, UnmatchedDelim};
1111use crate::Parser;
compiler/rustc_parse/src/lexer/unescape_error_reporting.rs+1-1
......@@ -40,8 +40,8 @@ pub(crate) fn emit_unescape_error(
4040 dcx.emit_err(UnescapeError::InvalidUnicodeEscape { span: err_span, surrogate: false })
4141 }
4242 EscapeError::MoreThanOneChar => {
43 use unicode_normalization::char::is_combining_mark;
4443 use unicode_normalization::UnicodeNormalization;
44 use unicode_normalization::char::is_combining_mark;
4545 let mut sugg = None;
4646 let mut note = None;
4747
compiler/rustc_parse/src/lib.rs+2-2
......@@ -18,7 +18,7 @@ use std::path::Path;
1818
1919use rustc_ast as ast;
2020use rustc_ast::tokenstream::TokenStream;
21use rustc_ast::{token, AttrItem, Attribute, MetaItem};
21use rustc_ast::{AttrItem, Attribute, MetaItem, token};
2222use rustc_ast_pretty::pprust;
2323use rustc_data_structures::sync::Lrc;
2424use rustc_errors::{Diag, FatalError, PResult};
......@@ -29,7 +29,7 @@ pub const MACRO_ARGUMENTS: Option<&str> = Some("macro arguments");
2929
3030#[macro_use]
3131pub mod parser;
32use parser::{make_unclosed_delims_error, Parser};
32use parser::{Parser, make_unclosed_delims_error};
3333pub mod lexer;
3434pub mod validate_attr;
3535
compiler/rustc_parse/src/parser/attr_wrapper.rs+5-5
......@@ -10,7 +10,7 @@ use rustc_ast::{self as ast, AttrVec, Attribute, HasAttrs, HasTokens};
1010use rustc_data_structures::fx::FxHashSet;
1111use rustc_errors::PResult;
1212use rustc_session::parse::ParseSess;
13use rustc_span::{sym, Span, DUMMY_SP};
13use rustc_span::{DUMMY_SP, Span, sym};
1414
1515use super::{
1616 Capturing, FlatToken, ForceCollect, NodeRange, NodeReplacement, Parser, ParserRange,
......@@ -485,10 +485,10 @@ fn make_attr_token_stream(
485485 for flat_token in iter {
486486 match flat_token {
487487 FlatToken::Token((Token { kind: TokenKind::OpenDelim(delim), span }, spacing)) => {
488 stack_rest.push(mem::replace(
489 &mut stack_top,
490 FrameData { open_delim_sp: Some((delim, span, spacing)), inner: vec![] },
491 ));
488 stack_rest.push(mem::replace(&mut stack_top, FrameData {
489 open_delim_sp: Some((delim, span, spacing)),
490 inner: vec![],
491 }));
492492 }
493493 FlatToken::Token((Token { kind: TokenKind::CloseDelim(delim), span }, spacing)) => {
494494 let frame_data = mem::replace(&mut stack_top, stack_rest.pop().unwrap());
compiler/rustc_parse/src/parser/diagnostics.rs+31-37
......@@ -15,15 +15,15 @@ use rustc_ast::{
1515use rustc_ast_pretty::pprust;
1616use rustc_data_structures::fx::FxHashSet;
1717use rustc_errors::{
18 pluralize, Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, PErr, PResult,
19 Subdiagnostic, Suggestions,
18 Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, FatalError, PErr, PResult, Subdiagnostic,
19 Suggestions, pluralize,
2020};
2121use rustc_session::errors::ExprParenthesesNeeded;
2222use rustc_span::edit_distance::find_best_match_for_name;
2323use rustc_span::source_map::Spanned;
24use rustc_span::symbol::{kw, sym, AllKeywords, Ident};
25use rustc_span::{BytePos, Span, SpanSnippetError, Symbol, DUMMY_SP};
26use thin_vec::{thin_vec, ThinVec};
24use rustc_span::symbol::{AllKeywords, Ident, kw, sym};
25use rustc_span::{BytePos, DUMMY_SP, Span, SpanSnippetError, Symbol};
26use thin_vec::{ThinVec, thin_vec};
2727use tracing::{debug, trace};
2828
2929use super::pat::Expected;
......@@ -721,15 +721,12 @@ impl<'a> Parser<'a> {
721721 let span = self.token.span.with_lo(pos).with_hi(pos);
722722 err.span_suggestion_verbose(
723723 span,
724 format!(
725 "add a space before {} to write a regular comment",
726 match (kind, style) {
727 (token::CommentKind::Line, ast::AttrStyle::Inner) => "`!`",
728 (token::CommentKind::Block, ast::AttrStyle::Inner) => "`!`",
729 (token::CommentKind::Line, ast::AttrStyle::Outer) => "the last `/`",
730 (token::CommentKind::Block, ast::AttrStyle::Outer) => "the last `*`",
731 },
732 ),
724 format!("add a space before {} to write a regular comment", match (kind, style) {
725 (token::CommentKind::Line, ast::AttrStyle::Inner) => "`!`",
726 (token::CommentKind::Block, ast::AttrStyle::Inner) => "`!`",
727 (token::CommentKind::Line, ast::AttrStyle::Outer) => "the last `/`",
728 (token::CommentKind::Block, ast::AttrStyle::Outer) => "the last `*`",
729 },),
733730 " ".to_string(),
734731 Applicability::MachineApplicable,
735732 );
......@@ -1936,14 +1933,13 @@ impl<'a> Parser<'a> {
19361933 (token::Eof, None) => (self.prev_token.span, self.token.span),
19371934 _ => (self.prev_token.span.shrink_to_hi(), self.token.span),
19381935 };
1939 let msg = format!(
1940 "expected `{}`, found {}",
1941 token_str,
1942 match (&self.token.kind, self.subparser_name) {
1943 (token::Eof, Some(origin)) => format!("end of {origin}"),
1944 _ => this_token_str,
1945 },
1946 );
1936 let msg = format!("expected `{}`, found {}", token_str, match (
1937 &self.token.kind,
1938 self.subparser_name
1939 ) {
1940 (token::Eof, Some(origin)) => format!("end of {origin}"),
1941 _ => this_token_str,
1942 },);
19471943 let mut err = self.dcx().struct_span_err(sp, msg);
19481944 let label_exp = format!("expected `{token_str}`");
19491945 let sm = self.psess.source_map();
......@@ -2864,27 +2860,25 @@ impl<'a> Parser<'a> {
28642860 PatKind::Ident(BindingMode::NONE, ident, None) => {
28652861 match &first_pat.kind {
28662862 PatKind::Ident(_, old_ident, _) => {
2867 let path = PatKind::Path(
2868 None,
2869 Path {
2870 span: new_span,
2871 segments: thin_vec![
2872 PathSegment::from_ident(*old_ident),
2873 PathSegment::from_ident(*ident),
2874 ],
2875 tokens: None,
2876 },
2877 );
2863 let path = PatKind::Path(None, Path {
2864 span: new_span,
2865 segments: thin_vec![
2866 PathSegment::from_ident(*old_ident),
2867 PathSegment::from_ident(*ident),
2868 ],
2869 tokens: None,
2870 });
28782871 first_pat = self.mk_pat(new_span, path);
28792872 show_sugg = true;
28802873 }
28812874 PatKind::Path(old_qself, old_path) => {
28822875 let mut segments = old_path.segments.clone();
28832876 segments.push(PathSegment::from_ident(*ident));
2884 let path = PatKind::Path(
2885 old_qself.clone(),
2886 Path { span: new_span, segments, tokens: None },
2887 );
2877 let path = PatKind::Path(old_qself.clone(), Path {
2878 span: new_span,
2879 segments,
2880 tokens: None,
2881 });
28882882 first_pat = self.mk_pat(new_span, path);
28892883 show_sugg = true;
28902884 }
compiler/rustc_parse/src/parser/expr.rs+26-26
......@@ -10,25 +10,25 @@ use rustc_ast::ptr::P;
1010use rustc_ast::token::{self, Delimiter, Token, TokenKind};
1111use rustc_ast::util::case::Case;
1212use rustc_ast::util::classify;
13use rustc_ast::util::parser::{prec_let_scrutinee_needs_par, AssocOp, Fixity};
14use rustc_ast::visit::{walk_expr, Visitor};
13use rustc_ast::util::parser::{AssocOp, Fixity, prec_let_scrutinee_needs_par};
14use rustc_ast::visit::{Visitor, walk_expr};
1515use rustc_ast::{
1616 self as ast, AnonConst, Arm, AttrStyle, AttrVec, BinOp, BinOpKind, BlockCheckMode, CaptureBy,
17 ClosureBinder, Expr, ExprField, ExprKind, FnDecl, FnRetTy, Label, MacCall, MetaItemLit,
18 Movability, Param, RangeLimits, StmtKind, Ty, TyKind, UnOp, DUMMY_NODE_ID,
17 ClosureBinder, DUMMY_NODE_ID, Expr, ExprField, ExprKind, FnDecl, FnRetTy, Label, MacCall,
18 MetaItemLit, Movability, Param, RangeLimits, StmtKind, Ty, TyKind, UnOp,
1919};
2020use rustc_ast_pretty::pprust;
2121use rustc_data_structures::stack::ensure_sufficient_stack;
2222use rustc_errors::{Applicability, Diag, PResult, StashKey, Subdiagnostic};
2323use rustc_lexer::unescape::unescape_char;
2424use rustc_macros::Subdiagnostic;
25use rustc_session::errors::{report_lit_error, ExprParenthesesNeeded};
26use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP;
25use rustc_session::errors::{ExprParenthesesNeeded, report_lit_error};
2726use rustc_session::lint::BuiltinLintDiag;
27use rustc_session::lint::builtin::BREAK_WITH_LABEL_AND_LOOP;
2828use rustc_span::source_map::{self, Spanned};
29use rustc_span::symbol::{kw, sym, Ident, Symbol};
29use rustc_span::symbol::{Ident, Symbol, kw, sym};
3030use rustc_span::{BytePos, ErrorGuaranteed, Pos, Span};
31use thin_vec::{thin_vec, ThinVec};
31use thin_vec::{ThinVec, thin_vec};
3232use tracing::instrument;
3333
3434use super::diagnostics::SnapshotParser;
......@@ -811,20 +811,17 @@ impl<'a> Parser<'a> {
811811 // Check if an illegal postfix operator has been added after the cast.
812812 // If the resulting expression is not a cast, it is an illegal postfix operator.
813813 if !matches!(with_postfix.kind, ExprKind::Cast(_, _)) {
814 let msg = format!(
815 "cast cannot be followed by {}",
816 match with_postfix.kind {
817 ExprKind::Index(..) => "indexing",
818 ExprKind::Try(_) => "`?`",
819 ExprKind::Field(_, _) => "a field access",
820 ExprKind::MethodCall(_) => "a method call",
821 ExprKind::Call(_, _) => "a function call",
822 ExprKind::Await(_, _) => "`.await`",
823 ExprKind::Match(_, _, MatchKind::Postfix) => "a postfix match",
824 ExprKind::Err(_) => return Ok(with_postfix),
825 _ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
826 }
827 );
814 let msg = format!("cast cannot be followed by {}", match with_postfix.kind {
815 ExprKind::Index(..) => "indexing",
816 ExprKind::Try(_) => "`?`",
817 ExprKind::Field(_, _) => "a field access",
818 ExprKind::MethodCall(_) => "a method call",
819 ExprKind::Call(_, _) => "a function call",
820 ExprKind::Await(_, _) => "`.await`",
821 ExprKind::Match(_, _, MatchKind::Postfix) => "a postfix match",
822 ExprKind::Err(_) => return Ok(with_postfix),
823 _ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
824 });
828825 let mut err = self.dcx().struct_span_err(span, msg);
829826
830827 let suggest_parens = |err: &mut Diag<'_>| {
......@@ -2844,10 +2841,13 @@ impl<'a> Parser<'a> {
28442841 .emit_err(errors::MissingExpressionInForLoop { span: expr.span.shrink_to_lo() });
28452842 let err_expr = self.mk_expr(expr.span, ExprKind::Err(guar));
28462843 let block = self.mk_block(thin_vec![], BlockCheckMode::Default, self.prev_token.span);
2847 return Ok(self.mk_expr(
2848 lo.to(self.prev_token.span),
2849 ExprKind::ForLoop { pat, iter: err_expr, body: block, label: opt_label, kind },
2850 ));
2844 return Ok(self.mk_expr(lo.to(self.prev_token.span), ExprKind::ForLoop {
2845 pat,
2846 iter: err_expr,
2847 body: block,
2848 label: opt_label,
2849 kind,
2850 }));
28512851 }
28522852
28532853 let (attrs, loop_block) = self.parse_inner_attrs_and_block()?;
compiler/rustc_parse/src/parser/generics.rs+2-2
......@@ -1,10 +1,10 @@
11use ast::token::Delimiter;
22use rustc_ast::{
3 self as ast, token, AttrVec, GenericBounds, GenericParam, GenericParamKind, TyKind, WhereClause,
3 self as ast, AttrVec, GenericBounds, GenericParam, GenericParamKind, TyKind, WhereClause, token,
44};
55use rustc_errors::{Applicability, PResult};
6use rustc_span::symbol::{kw, Ident};
76use rustc_span::Span;
7use rustc_span::symbol::{Ident, kw};
88use thin_vec::ThinVec;
99
1010use super::{ForceCollect, Parser, Trailing, UsePreAttrPos};
compiler/rustc_parse/src/parser/item.rs+9-9
......@@ -10,15 +10,15 @@ use rustc_ast::util::case::Case;
1010use rustc_ast::{self as ast};
1111use rustc_ast_pretty::pprust;
1212use rustc_errors::codes::*;
13use rustc_errors::{struct_span_code_err, Applicability, PResult, StashKey};
13use rustc_errors::{Applicability, PResult, StashKey, struct_span_code_err};
1414use rustc_span::edit_distance::edit_distance;
1515use rustc_span::edition::Edition;
16use rustc_span::symbol::{kw, sym, Ident, Symbol};
17use rustc_span::{source_map, ErrorGuaranteed, Span, DUMMY_SP};
18use thin_vec::{thin_vec, ThinVec};
16use rustc_span::symbol::{Ident, Symbol, kw, sym};
17use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, source_map};
18use thin_vec::{ThinVec, thin_vec};
1919use tracing::debug;
2020
21use super::diagnostics::{dummy_arg, ConsumeClosingDelim};
21use super::diagnostics::{ConsumeClosingDelim, dummy_arg};
2222use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign};
2323use super::{
2424 AttrWrapper, FollowedByType, ForceCollect, Parser, PathStyle, Trailing, UsePreAttrPos,
......@@ -1897,10 +1897,10 @@ impl<'a> Parser<'a> {
18971897 // Try to recover extra trailing angle brackets
18981898 if let TyKind::Path(_, Path { segments, .. }) = &a_var.ty.kind {
18991899 if let Some(last_segment) = segments.last() {
1900 let guar = self.check_trailing_angle_brackets(
1901 last_segment,
1902 &[&token::Comma, &token::CloseDelim(Delimiter::Brace)],
1903 );
1900 let guar = self.check_trailing_angle_brackets(last_segment, &[
1901 &token::Comma,
1902 &token::CloseDelim(Delimiter::Brace),
1903 ]);
19041904 if let Some(_guar) = guar {
19051905 // Handle a case like `Vec<u8>>,` where we can continue parsing fields
19061906 // after the comma
compiler/rustc_parse/src/parser/mod.rs+5-5
......@@ -27,9 +27,9 @@ use rustc_ast::tokenstream::{
2727};
2828use rustc_ast::util::case::Case;
2929use rustc_ast::{
30 self as ast, AnonConst, AttrArgs, AttrArgsEq, AttrId, ByRef, Const, CoroutineKind, DelimArgs,
31 Expr, ExprKind, Extern, HasAttrs, HasTokens, Mutability, Recovered, Safety, StrLit, Visibility,
32 VisibilityKind, DUMMY_NODE_ID,
30 self as ast, AnonConst, AttrArgs, AttrArgsEq, AttrId, ByRef, Const, CoroutineKind,
31 DUMMY_NODE_ID, DelimArgs, Expr, ExprKind, Extern, HasAttrs, HasTokens, Mutability, Recovered,
32 Safety, StrLit, Visibility, VisibilityKind,
3333};
3434use rustc_ast_pretty::pprust;
3535use rustc_data_structures::fx::FxHashMap;
......@@ -37,8 +37,8 @@ use rustc_data_structures::sync::Lrc;
3737use rustc_errors::{Applicability, Diag, FatalError, MultiSpan, PResult};
3838use rustc_index::interval::IntervalSet;
3939use rustc_session::parse::ParseSess;
40use rustc_span::symbol::{kw, sym, Ident, Symbol};
41use rustc_span::{Span, DUMMY_SP};
40use rustc_span::symbol::{Ident, Symbol, kw, sym};
41use rustc_span::{DUMMY_SP, Span};
4242use thin_vec::ThinVec;
4343use tracing::debug;
4444
compiler/rustc_parse/src/parser/nonterminal.rs+2-2
......@@ -1,13 +1,13 @@
1use rustc_ast::HasTokens;
12use rustc_ast::ptr::P;
23use rustc_ast::token::Nonterminal::*;
34use rustc_ast::token::NtExprKind::*;
45use rustc_ast::token::NtPatKind::*;
56use rustc_ast::token::{self, Delimiter, NonterminalKind, Token};
6use rustc_ast::HasTokens;
77use rustc_ast_pretty::pprust;
88use rustc_data_structures::sync::Lrc;
99use rustc_errors::PResult;
10use rustc_span::symbol::{kw, Ident};
10use rustc_span::symbol::{Ident, kw};
1111
1212use crate::errors::UnexpectedNonterminal;
1313use crate::parser::pat::{CommaRecoveryMode, RecoverColon, RecoverComma};
compiler/rustc_parse/src/parser/pat.rs+4-4
......@@ -10,10 +10,10 @@ use rustc_ast::{
1010use rustc_ast_pretty::pprust;
1111use rustc_errors::{Applicability, Diag, DiagArgValue, PResult, StashKey};
1212use rustc_session::errors::ExprParenthesesNeeded;
13use rustc_span::source_map::{respan, Spanned};
14use rustc_span::symbol::{kw, sym, Ident};
13use rustc_span::source_map::{Spanned, respan};
14use rustc_span::symbol::{Ident, kw, sym};
1515use rustc_span::{BytePos, ErrorGuaranteed, Span};
16use thin_vec::{thin_vec, ThinVec};
16use thin_vec::{ThinVec, thin_vec};
1717
1818use super::{ForceCollect, Parser, PathStyle, Restrictions, Trailing, UsePreAttrPos};
1919use crate::errors::{
......@@ -27,7 +27,7 @@ use crate::errors::{
2727 UnexpectedLifetimeInPattern, UnexpectedParenInRangePat, UnexpectedParenInRangePatSugg,
2828 UnexpectedVertVertBeforeFunctionParam, UnexpectedVertVertInPattern, WrapInParens,
2929};
30use crate::parser::expr::{could_be_unclosed_char_literal, DestructuredFloat};
30use crate::parser::expr::{DestructuredFloat, could_be_unclosed_char_literal};
3131use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole};
3232
3333#[derive(PartialEq, Copy, Clone)]
compiler/rustc_parse/src/parser/path.rs+12-14
......@@ -9,7 +9,7 @@ use rustc_ast::{
99 Path, PathSegment, QSelf,
1010};
1111use rustc_errors::{Applicability, Diag, PResult};
12use rustc_span::symbol::{kw, sym, Ident};
12use rustc_span::symbol::{Ident, kw, sym};
1313use rustc_span::{BytePos, Span};
1414use thin_vec::ThinVec;
1515use tracing::debug;
......@@ -107,10 +107,11 @@ impl<'a> Parser<'a> {
107107 self.parse_path_segments(&mut path.segments, style, None)?;
108108 }
109109
110 Ok((
111 qself,
112 Path { segments: path.segments, span: lo.to(self.prev_token.span), tokens: None },
113 ))
110 Ok((qself, Path {
111 segments: path.segments,
112 span: lo.to(self.prev_token.span),
113 tokens: None,
114 }))
114115 }
115116
116117 /// Recover from an invalid single colon, when the user likely meant a qualified path.
......@@ -487,16 +488,13 @@ impl<'a> Parser<'a> {
487488
488489 error.span_suggestion_verbose(
489490 prev_token_before_parsing.span,
490 format!(
491 "consider removing the `::` here to {}",
492 match style {
493 PathStyle::Expr => "call the expression",
494 PathStyle::Pat => "turn this into a tuple struct pattern",
495 _ => {
496 return;
497 }
491 format!("consider removing the `::` here to {}", match style {
492 PathStyle::Expr => "call the expression",
493 PathStyle::Pat => "turn this into a tuple struct pattern",
494 _ => {
495 return;
498496 }
499 ),
497 }),
500498 "",
501499 Applicability::MaybeIncorrect,
502500 );
compiler/rustc_parse/src/parser/stmt.rs+12-18
......@@ -7,13 +7,13 @@ use rustc_ast::ptr::P;
77use rustc_ast::token::{self, Delimiter, TokenKind};
88use rustc_ast::util::classify::{self, TrailingBrace};
99use rustc_ast::{
10 AttrStyle, AttrVec, Block, BlockCheckMode, Expr, ExprKind, HasAttrs, Local, LocalKind, MacCall,
11 MacCallStmt, MacStmtStyle, Recovered, Stmt, StmtKind, DUMMY_NODE_ID,
10 AttrStyle, AttrVec, Block, BlockCheckMode, DUMMY_NODE_ID, Expr, ExprKind, HasAttrs, Local,
11 LocalKind, MacCall, MacCallStmt, MacStmtStyle, Recovered, Stmt, StmtKind,
1212};
1313use rustc_errors::{Applicability, Diag, PResult};
14use rustc_span::symbol::{kw, sym, Ident};
14use rustc_span::symbol::{Ident, kw, sym};
1515use rustc_span::{BytePos, ErrorGuaranteed, Span};
16use thin_vec::{thin_vec, ThinVec};
16use thin_vec::{ThinVec, thin_vec};
1717
1818use super::attr::InnerAttrForbiddenReason;
1919use super::diagnostics::AttemptLocalParseRecovery;
......@@ -417,20 +417,14 @@ impl<'a> Parser<'a> {
417417 fn check_let_else_init_trailing_brace(&self, init: &ast::Expr) {
418418 if let Some(trailing) = classify::expr_trailing_brace(init) {
419419 let (span, sugg) = match trailing {
420 TrailingBrace::MacCall(mac) => (
421 mac.span(),
422 errors::WrapInParentheses::MacroArgs {
423 left: mac.args.dspan.open,
424 right: mac.args.dspan.close,
425 },
426 ),
427 TrailingBrace::Expr(expr) => (
428 expr.span,
429 errors::WrapInParentheses::Expression {
430 left: expr.span.shrink_to_lo(),
431 right: expr.span.shrink_to_hi(),
432 },
433 ),
420 TrailingBrace::MacCall(mac) => (mac.span(), errors::WrapInParentheses::MacroArgs {
421 left: mac.args.dspan.open,
422 right: mac.args.dspan.close,
423 }),
424 TrailingBrace::Expr(expr) => (expr.span, errors::WrapInParentheses::Expression {
425 left: expr.span.shrink_to_lo(),
426 right: expr.span.shrink_to_hi(),
427 }),
434428 };
435429 self.dcx().emit_err(errors::InvalidCurlyInLetElse {
436430 span: span.with_lo(span.hi() - BytePos(1)),
compiler/rustc_parse/src/parser/tests.rs+3-3
......@@ -9,15 +9,15 @@ use ast::token::IdentIsRaw;
99use rustc_ast::ptr::P;
1010use rustc_ast::token::{self, Delimiter, Token};
1111use rustc_ast::tokenstream::{DelimSpacing, DelimSpan, Spacing, TokenStream, TokenTree};
12use rustc_ast::{self as ast, visit, PatKind};
12use rustc_ast::{self as ast, PatKind, visit};
1313use rustc_ast_pretty::pprust::item_to_string;
1414use rustc_data_structures::sync::Lrc;
1515use rustc_errors::emitter::HumanEmitter;
1616use rustc_errors::{DiagCtxt, MultiSpan, PResult};
1717use rustc_session::parse::ParseSess;
1818use rustc_span::source_map::{FilePathMapping, SourceMap};
19use rustc_span::symbol::{kw, sym, Symbol};
20use rustc_span::{create_default_session_globals_then, BytePos, FileName, Pos, Span};
19use rustc_span::symbol::{Symbol, kw, sym};
20use rustc_span::{BytePos, FileName, Pos, Span, create_default_session_globals_then};
2121use termcolor::WriteColor;
2222
2323use crate::parser::{ForceCollect, Parser};
compiler/rustc_parse/src/parser/tokenstream/tests.rs+1-1
......@@ -1,6 +1,6 @@
11use rustc_ast::token::{self, IdentIsRaw};
22use rustc_ast::tokenstream::{TokenStream, TokenTree};
3use rustc_span::{create_default_session_globals_then, BytePos, Span, Symbol};
3use rustc_span::{BytePos, Span, Symbol, create_default_session_globals_then};
44
55use crate::parser::tests::string_to_stream;
66
compiler/rustc_parse/src/parser/ty.rs+5-5
......@@ -2,14 +2,14 @@ use rustc_ast::ptr::P;
22use rustc_ast::token::{self, BinOpToken, Delimiter, IdentIsRaw, Token, TokenKind};
33use rustc_ast::util::case::Case;
44use rustc_ast::{
5 self as ast, BareFnTy, BoundAsyncness, BoundConstness, BoundPolarity, FnRetTy, GenericBound,
6 GenericBounds, GenericParam, Generics, Lifetime, MacCall, MutTy, Mutability, PolyTraitRef,
7 PreciseCapturingArg, TraitBoundModifiers, TraitObjectSyntax, Ty, TyKind, DUMMY_NODE_ID,
5 self as ast, BareFnTy, BoundAsyncness, BoundConstness, BoundPolarity, DUMMY_NODE_ID, FnRetTy,
6 GenericBound, GenericBounds, GenericParam, Generics, Lifetime, MacCall, MutTy, Mutability,
7 PolyTraitRef, PreciseCapturingArg, TraitBoundModifiers, TraitObjectSyntax, Ty, TyKind,
88};
99use rustc_errors::{Applicability, PResult};
10use rustc_span::symbol::{kw, sym, Ident};
10use rustc_span::symbol::{Ident, kw, sym};
1111use rustc_span::{ErrorGuaranteed, Span, Symbol};
12use thin_vec::{thin_vec, ThinVec};
12use thin_vec::{ThinVec, thin_vec};
1313
1414use super::{Parser, PathStyle, SeqSep, TokenType, Trailing};
1515use crate::errors::{
compiler/rustc_parse/src/validate_attr.rs+3-3
......@@ -7,12 +7,12 @@ use rustc_ast::{
77 NestedMetaItem, Safety,
88};
99use rustc_errors::{Applicability, FatalError, PResult};
10use rustc_feature::{AttributeSafety, AttributeTemplate, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
10use rustc_feature::{AttributeSafety, AttributeTemplate, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute};
1111use rustc_session::errors::report_lit_error;
12use rustc_session::lint::builtin::{ILL_FORMED_ATTRIBUTE_INPUT, UNSAFE_ATTR_OUTSIDE_UNSAFE};
1312use rustc_session::lint::BuiltinLintDiag;
13use rustc_session::lint::builtin::{ILL_FORMED_ATTRIBUTE_INPUT, UNSAFE_ATTR_OUTSIDE_UNSAFE};
1414use rustc_session::parse::ParseSess;
15use rustc_span::{sym, BytePos, Span, Symbol};
15use rustc_span::{BytePos, Span, Symbol, sym};
1616
1717use crate::{errors, parse_in};
1818
compiler/rustc_parse_format/src/lib.rs+33-51
......@@ -18,11 +18,11 @@
1818
1919use std::{iter, str, string};
2020
21use rustc_lexer::unescape;
2221pub use Alignment::*;
2322pub use Count::*;
2423pub use Piece::*;
2524pub use Position::*;
25use rustc_lexer::unescape;
2626
2727// Note: copied from rustc_span
2828/// Range inside of a `Span` used for diagnostics when we only have access to relative positions.
......@@ -870,34 +870,28 @@ impl<'a> Parser<'a> {
870870 if let (Some(pos), Some(_)) = (self.consume_pos('?'), self.consume_pos(':')) {
871871 let word = self.word();
872872 let pos = self.to_span_index(pos);
873 self.errors.insert(
874 0,
875 ParseError {
876 description: "expected format parameter to occur after `:`".to_owned(),
877 note: Some(format!("`?` comes after `:`, try `{}:{}` instead", word, "?")),
878 label: "expected `?` to occur after `:`".to_owned(),
879 span: pos.to(pos),
880 secondary_label: None,
881 suggestion: Suggestion::None,
882 },
883 );
873 self.errors.insert(0, ParseError {
874 description: "expected format parameter to occur after `:`".to_owned(),
875 note: Some(format!("`?` comes after `:`, try `{}:{}` instead", word, "?")),
876 label: "expected `?` to occur after `:`".to_owned(),
877 span: pos.to(pos),
878 secondary_label: None,
879 suggestion: Suggestion::None,
880 });
884881 }
885882 }
886883
887884 fn suggest_format_align(&mut self, alignment: char) {
888885 if let Some(pos) = self.consume_pos(alignment) {
889886 let pos = self.to_span_index(pos);
890 self.errors.insert(
891 0,
892 ParseError {
893 description: "expected format parameter to occur after `:`".to_owned(),
894 note: None,
895 label: format!("expected `{}` to occur after `:`", alignment),
896 span: pos.to(pos),
897 secondary_label: None,
898 suggestion: Suggestion::None,
899 },
900 );
887 self.errors.insert(0, ParseError {
888 description: "expected format parameter to occur after `:`".to_owned(),
889 note: None,
890 label: format!("expected `{}` to occur after `:`", alignment),
891 span: pos.to(pos),
892 secondary_label: None,
893 suggestion: Suggestion::None,
894 });
901895 }
902896 }
903897
......@@ -914,36 +908,24 @@ impl<'a> Parser<'a> {
914908 if let ArgumentNamed(_) = arg.position {
915909 match field.position {
916910 ArgumentNamed(_) => {
917 self.errors.insert(
918 0,
919 ParseError {
920 description: "field access isn't supported".to_string(),
921 note: None,
922 label: "not supported".to_string(),
923 span: InnerSpan::new(
924 arg.position_span.start,
925 field.position_span.end,
926 ),
927 secondary_label: None,
928 suggestion: Suggestion::UsePositional,
929 },
930 );
911 self.errors.insert(0, ParseError {
912 description: "field access isn't supported".to_string(),
913 note: None,
914 label: "not supported".to_string(),
915 span: InnerSpan::new(arg.position_span.start, field.position_span.end),
916 secondary_label: None,
917 suggestion: Suggestion::UsePositional,
918 });
931919 }
932920 ArgumentIs(_) => {
933 self.errors.insert(
934 0,
935 ParseError {
936 description: "tuple index access isn't supported".to_string(),
937 note: None,
938 label: "not supported".to_string(),
939 span: InnerSpan::new(
940 arg.position_span.start,
941 field.position_span.end,
942 ),
943 secondary_label: None,
944 suggestion: Suggestion::UsePositional,
945 },
946 );
921 self.errors.insert(0, ParseError {
922 description: "tuple index access isn't supported".to_string(),
923 note: None,
924 label: "not supported".to_string(),
925 span: InnerSpan::new(arg.position_span.start, field.position_span.end),
926 secondary_label: None,
927 suggestion: Suggestion::UsePositional,
928 });
947929 }
948930 _ => {}
949931 };
compiler/rustc_parse_format/src/tests.rs+290-350
......@@ -78,311 +78,307 @@ fn invalid_precision() {
7878
7979#[test]
8080fn format_nothing() {
81 same(
82 "{}",
83 &[NextArgument(Box::new(Argument {
84 position: ArgumentImplicitlyIs(0),
85 position_span: InnerSpan { start: 2, end: 2 },
86 format: fmtdflt(),
87 }))],
88 );
81 same("{}", &[NextArgument(Box::new(Argument {
82 position: ArgumentImplicitlyIs(0),
83 position_span: InnerSpan { start: 2, end: 2 },
84 format: fmtdflt(),
85 }))]);
8986}
9087#[test]
9188fn format_position() {
92 same(
93 "{3}",
94 &[NextArgument(Box::new(Argument {
95 position: ArgumentIs(3),
96 position_span: InnerSpan { start: 2, end: 3 },
97 format: fmtdflt(),
98 }))],
99 );
89 same("{3}", &[NextArgument(Box::new(Argument {
90 position: ArgumentIs(3),
91 position_span: InnerSpan { start: 2, end: 3 },
92 format: fmtdflt(),
93 }))]);
10094}
10195#[test]
10296fn format_position_nothing_else() {
103 same(
104 "{3:}",
105 &[NextArgument(Box::new(Argument {
106 position: ArgumentIs(3),
107 position_span: InnerSpan { start: 2, end: 3 },
108 format: fmtdflt(),
109 }))],
110 );
97 same("{3:}", &[NextArgument(Box::new(Argument {
98 position: ArgumentIs(3),
99 position_span: InnerSpan { start: 2, end: 3 },
100 format: fmtdflt(),
101 }))]);
111102}
112103#[test]
113104fn format_named() {
114 same(
115 "{name}",
116 &[NextArgument(Box::new(Argument {
117 position: ArgumentNamed("name"),
118 position_span: InnerSpan { start: 2, end: 6 },
119 format: fmtdflt(),
120 }))],
121 )
105 same("{name}", &[NextArgument(Box::new(Argument {
106 position: ArgumentNamed("name"),
107 position_span: InnerSpan { start: 2, end: 6 },
108 format: fmtdflt(),
109 }))])
122110}
123111#[test]
124112fn format_type() {
125 same(
126 "{3:x}",
127 &[NextArgument(Box::new(Argument {
128 position: ArgumentIs(3),
129 position_span: InnerSpan { start: 2, end: 3 },
130 format: FormatSpec {
131 fill: None,
132 fill_span: None,
133 align: AlignUnknown,
134 sign: None,
135 alternate: false,
136 zero_pad: false,
137 debug_hex: None,
138 precision: CountImplied,
139 width: CountImplied,
140 precision_span: None,
141 width_span: None,
142 ty: "x",
143 ty_span: None,
144 },
145 }))],
146 );
113 same("{3:x}", &[NextArgument(Box::new(Argument {
114 position: ArgumentIs(3),
115 position_span: InnerSpan { start: 2, end: 3 },
116 format: FormatSpec {
117 fill: None,
118 fill_span: None,
119 align: AlignUnknown,
120 sign: None,
121 alternate: false,
122 zero_pad: false,
123 debug_hex: None,
124 precision: CountImplied,
125 width: CountImplied,
126 precision_span: None,
127 width_span: None,
128 ty: "x",
129 ty_span: None,
130 },
131 }))]);
147132}
148133#[test]
149134fn format_align_fill() {
150 same(
151 "{3:>}",
152 &[NextArgument(Box::new(Argument {
153 position: ArgumentIs(3),
154 position_span: InnerSpan { start: 2, end: 3 },
155 format: FormatSpec {
156 fill: None,
157 fill_span: None,
158 align: AlignRight,
159 sign: None,
160 alternate: false,
161 zero_pad: false,
162 debug_hex: None,
163 precision: CountImplied,
164 width: CountImplied,
165 precision_span: None,
166 width_span: None,
167 ty: "",
168 ty_span: None,
169 },
170 }))],
171 );
172 same(
173 "{3:0<}",
174 &[NextArgument(Box::new(Argument {
175 position: ArgumentIs(3),
176 position_span: InnerSpan { start: 2, end: 3 },
177 format: FormatSpec {
178 fill: Some('0'),
179 fill_span: Some(InnerSpan::new(4, 5)),
180 align: AlignLeft,
181 sign: None,
182 alternate: false,
183 zero_pad: false,
184 debug_hex: None,
185 precision: CountImplied,
186 width: CountImplied,
187 precision_span: None,
188 width_span: None,
189 ty: "",
190 ty_span: None,
191 },
192 }))],
193 );
194 same(
195 "{3:*<abcd}",
196 &[NextArgument(Box::new(Argument {
197 position: ArgumentIs(3),
198 position_span: InnerSpan { start: 2, end: 3 },
199 format: FormatSpec {
200 fill: Some('*'),
201 fill_span: Some(InnerSpan::new(4, 5)),
202 align: AlignLeft,
203 sign: None,
204 alternate: false,
205 zero_pad: false,
206 debug_hex: None,
207 precision: CountImplied,
208 width: CountImplied,
209 precision_span: None,
210 width_span: None,
211 ty: "abcd",
212 ty_span: Some(InnerSpan::new(6, 10)),
213 },
214 }))],
215 );
135 same("{3:>}", &[NextArgument(Box::new(Argument {
136 position: ArgumentIs(3),
137 position_span: InnerSpan { start: 2, end: 3 },
138 format: FormatSpec {
139 fill: None,
140 fill_span: None,
141 align: AlignRight,
142 sign: None,
143 alternate: false,
144 zero_pad: false,
145 debug_hex: None,
146 precision: CountImplied,
147 width: CountImplied,
148 precision_span: None,
149 width_span: None,
150 ty: "",
151 ty_span: None,
152 },
153 }))]);
154 same("{3:0<}", &[NextArgument(Box::new(Argument {
155 position: ArgumentIs(3),
156 position_span: InnerSpan { start: 2, end: 3 },
157 format: FormatSpec {
158 fill: Some('0'),
159 fill_span: Some(InnerSpan::new(4, 5)),
160 align: AlignLeft,
161 sign: None,
162 alternate: false,
163 zero_pad: false,
164 debug_hex: None,
165 precision: CountImplied,
166 width: CountImplied,
167 precision_span: None,
168 width_span: None,
169 ty: "",
170 ty_span: None,
171 },
172 }))]);
173 same("{3:*<abcd}", &[NextArgument(Box::new(Argument {
174 position: ArgumentIs(3),
175 position_span: InnerSpan { start: 2, end: 3 },
176 format: FormatSpec {
177 fill: Some('*'),
178 fill_span: Some(InnerSpan::new(4, 5)),
179 align: AlignLeft,
180 sign: None,
181 alternate: false,
182 zero_pad: false,
183 debug_hex: None,
184 precision: CountImplied,
185 width: CountImplied,
186 precision_span: None,
187 width_span: None,
188 ty: "abcd",
189 ty_span: Some(InnerSpan::new(6, 10)),
190 },
191 }))]);
216192}
217193#[test]
218194fn format_counts() {
219 same(
220 "{:10x}",
221 &[NextArgument(Box::new(Argument {
222 position: ArgumentImplicitlyIs(0),
223 position_span: InnerSpan { start: 2, end: 2 },
224 format: FormatSpec {
225 fill: None,
226 fill_span: None,
227 align: AlignUnknown,
228 sign: None,
229 alternate: false,
230 zero_pad: false,
231 debug_hex: None,
232 precision: CountImplied,
233 precision_span: None,
234 width: CountIs(10),
235 width_span: Some(InnerSpan { start: 3, end: 5 }),
236 ty: "x",
237 ty_span: None,
238 },
239 }))],
240 );
241 same(
242 "{:10$.10x}",
243 &[NextArgument(Box::new(Argument {
244 position: ArgumentImplicitlyIs(0),
245 position_span: InnerSpan { start: 2, end: 2 },
246 format: FormatSpec {
247 fill: None,
248 fill_span: None,
249 align: AlignUnknown,
250 sign: None,
251 alternate: false,
252 zero_pad: false,
253 debug_hex: None,
254 precision: CountIs(10),
255 precision_span: Some(InnerSpan { start: 6, end: 9 }),
256 width: CountIsParam(10),
257 width_span: Some(InnerSpan { start: 3, end: 6 }),
258 ty: "x",
259 ty_span: None,
260 },
261 }))],
262 );
263 same(
264 "{1:0$.10x}",
265 &[NextArgument(Box::new(Argument {
266 position: ArgumentIs(1),
267 position_span: InnerSpan { start: 2, end: 3 },
268 format: FormatSpec {
269 fill: None,
270 fill_span: None,
271 align: AlignUnknown,
272 sign: None,
273 alternate: false,
274 zero_pad: false,
275 debug_hex: None,
276 precision: CountIs(10),
277 precision_span: Some(InnerSpan { start: 6, end: 9 }),
278 width: CountIsParam(0),
279 width_span: Some(InnerSpan { start: 4, end: 6 }),
280 ty: "x",
281 ty_span: None,
282 },
283 }))],
284 );
285 same(
286 "{:.*x}",
287 &[NextArgument(Box::new(Argument {
288 position: ArgumentImplicitlyIs(1),
289 position_span: InnerSpan { start: 2, end: 2 },
290 format: FormatSpec {
291 fill: None,
292 fill_span: None,
293 align: AlignUnknown,
294 sign: None,
295 alternate: false,
296 zero_pad: false,
297 debug_hex: None,
298 precision: CountIsStar(0),
299 precision_span: Some(InnerSpan { start: 3, end: 5 }),
300 width: CountImplied,
301 width_span: None,
302 ty: "x",
303 ty_span: None,
304 },
305 }))],
306 );
307 same(
308 "{:.10$x}",
309 &[NextArgument(Box::new(Argument {
310 position: ArgumentImplicitlyIs(0),
311 position_span: InnerSpan { start: 2, end: 2 },
312 format: FormatSpec {
313 fill: None,
314 fill_span: None,
315 align: AlignUnknown,
316 sign: None,
317 alternate: false,
318 zero_pad: false,
319 debug_hex: None,
320 precision: CountIsParam(10),
321 width: CountImplied,
322 precision_span: Some(InnerSpan::new(3, 7)),
323 width_span: None,
324 ty: "x",
325 ty_span: None,
326 },
327 }))],
328 );
329 same(
330 "{:a$.b$?}",
331 &[NextArgument(Box::new(Argument {
332 position: ArgumentImplicitlyIs(0),
333 position_span: InnerSpan { start: 2, end: 2 },
334 format: FormatSpec {
335 fill: None,
336 fill_span: None,
337 align: AlignUnknown,
338 sign: None,
339 alternate: false,
340 zero_pad: false,
341 debug_hex: None,
342 precision: CountIsName("b", InnerSpan { start: 6, end: 7 }),
343 precision_span: Some(InnerSpan { start: 5, end: 8 }),
344 width: CountIsName("a", InnerSpan { start: 3, end: 4 }),
345 width_span: Some(InnerSpan { start: 3, end: 5 }),
346 ty: "?",
347 ty_span: None,
348 },
349 }))],
350 );
351 same(
352 "{:.4}",
353 &[NextArgument(Box::new(Argument {
354 position: ArgumentImplicitlyIs(0),
355 position_span: InnerSpan { start: 2, end: 2 },
356 format: FormatSpec {
357 fill: None,
358 fill_span: None,
359 align: AlignUnknown,
360 sign: None,
361 alternate: false,
362 zero_pad: false,
363 debug_hex: None,
364 precision: CountIs(4),
365 precision_span: Some(InnerSpan { start: 3, end: 5 }),
366 width: CountImplied,
367 width_span: None,
368 ty: "",
369 ty_span: None,
370 },
371 }))],
372 )
195 same("{:10x}", &[NextArgument(Box::new(Argument {
196 position: ArgumentImplicitlyIs(0),
197 position_span: InnerSpan { start: 2, end: 2 },
198 format: FormatSpec {
199 fill: None,
200 fill_span: None,
201 align: AlignUnknown,
202 sign: None,
203 alternate: false,
204 zero_pad: false,
205 debug_hex: None,
206 precision: CountImplied,
207 precision_span: None,
208 width: CountIs(10),
209 width_span: Some(InnerSpan { start: 3, end: 5 }),
210 ty: "x",
211 ty_span: None,
212 },
213 }))]);
214 same("{:10$.10x}", &[NextArgument(Box::new(Argument {
215 position: ArgumentImplicitlyIs(0),
216 position_span: InnerSpan { start: 2, end: 2 },
217 format: FormatSpec {
218 fill: None,
219 fill_span: None,
220 align: AlignUnknown,
221 sign: None,
222 alternate: false,
223 zero_pad: false,
224 debug_hex: None,
225 precision: CountIs(10),
226 precision_span: Some(InnerSpan { start: 6, end: 9 }),
227 width: CountIsParam(10),
228 width_span: Some(InnerSpan { start: 3, end: 6 }),
229 ty: "x",
230 ty_span: None,
231 },
232 }))]);
233 same("{1:0$.10x}", &[NextArgument(Box::new(Argument {
234 position: ArgumentIs(1),
235 position_span: InnerSpan { start: 2, end: 3 },
236 format: FormatSpec {
237 fill: None,
238 fill_span: None,
239 align: AlignUnknown,
240 sign: None,
241 alternate: false,
242 zero_pad: false,
243 debug_hex: None,
244 precision: CountIs(10),
245 precision_span: Some(InnerSpan { start: 6, end: 9 }),
246 width: CountIsParam(0),
247 width_span: Some(InnerSpan { start: 4, end: 6 }),
248 ty: "x",
249 ty_span: None,
250 },
251 }))]);
252 same("{:.*x}", &[NextArgument(Box::new(Argument {
253 position: ArgumentImplicitlyIs(1),
254 position_span: InnerSpan { start: 2, end: 2 },
255 format: FormatSpec {
256 fill: None,
257 fill_span: None,
258 align: AlignUnknown,
259 sign: None,
260 alternate: false,
261 zero_pad: false,
262 debug_hex: None,
263 precision: CountIsStar(0),
264 precision_span: Some(InnerSpan { start: 3, end: 5 }),
265 width: CountImplied,
266 width_span: None,
267 ty: "x",
268 ty_span: None,
269 },
270 }))]);
271 same("{:.10$x}", &[NextArgument(Box::new(Argument {
272 position: ArgumentImplicitlyIs(0),
273 position_span: InnerSpan { start: 2, end: 2 },
274 format: FormatSpec {
275 fill: None,
276 fill_span: None,
277 align: AlignUnknown,
278 sign: None,
279 alternate: false,
280 zero_pad: false,
281 debug_hex: None,
282 precision: CountIsParam(10),
283 width: CountImplied,
284 precision_span: Some(InnerSpan::new(3, 7)),
285 width_span: None,
286 ty: "x",
287 ty_span: None,
288 },
289 }))]);
290 same("{:a$.b$?}", &[NextArgument(Box::new(Argument {
291 position: ArgumentImplicitlyIs(0),
292 position_span: InnerSpan { start: 2, end: 2 },
293 format: FormatSpec {
294 fill: None,
295 fill_span: None,
296 align: AlignUnknown,
297 sign: None,
298 alternate: false,
299 zero_pad: false,
300 debug_hex: None,
301 precision: CountIsName("b", InnerSpan { start: 6, end: 7 }),
302 precision_span: Some(InnerSpan { start: 5, end: 8 }),
303 width: CountIsName("a", InnerSpan { start: 3, end: 4 }),
304 width_span: Some(InnerSpan { start: 3, end: 5 }),
305 ty: "?",
306 ty_span: None,
307 },
308 }))]);
309 same("{:.4}", &[NextArgument(Box::new(Argument {
310 position: ArgumentImplicitlyIs(0),
311 position_span: InnerSpan { start: 2, end: 2 },
312 format: FormatSpec {
313 fill: None,
314 fill_span: None,
315 align: AlignUnknown,
316 sign: None,
317 alternate: false,
318 zero_pad: false,
319 debug_hex: None,
320 precision: CountIs(4),
321 precision_span: Some(InnerSpan { start: 3, end: 5 }),
322 width: CountImplied,
323 width_span: None,
324 ty: "",
325 ty_span: None,
326 },
327 }))])
373328}
374329#[test]
375330fn format_flags() {
376 same(
377 "{:-}",
378 &[NextArgument(Box::new(Argument {
379 position: ArgumentImplicitlyIs(0),
380 position_span: InnerSpan { start: 2, end: 2 },
331 same("{:-}", &[NextArgument(Box::new(Argument {
332 position: ArgumentImplicitlyIs(0),
333 position_span: InnerSpan { start: 2, end: 2 },
334 format: FormatSpec {
335 fill: None,
336 fill_span: None,
337 align: AlignUnknown,
338 sign: Some(Sign::Minus),
339 alternate: false,
340 zero_pad: false,
341 debug_hex: None,
342 precision: CountImplied,
343 width: CountImplied,
344 precision_span: None,
345 width_span: None,
346 ty: "",
347 ty_span: None,
348 },
349 }))]);
350 same("{:+#}", &[NextArgument(Box::new(Argument {
351 position: ArgumentImplicitlyIs(0),
352 position_span: InnerSpan { start: 2, end: 2 },
353 format: FormatSpec {
354 fill: None,
355 fill_span: None,
356 align: AlignUnknown,
357 sign: Some(Sign::Plus),
358 alternate: true,
359 zero_pad: false,
360 debug_hex: None,
361 precision: CountImplied,
362 width: CountImplied,
363 precision_span: None,
364 width_span: None,
365 ty: "",
366 ty_span: None,
367 },
368 }))]);
369}
370#[test]
371fn format_mixture() {
372 same("abcd {3:x} efg", &[
373 String("abcd "),
374 NextArgument(Box::new(Argument {
375 position: ArgumentIs(3),
376 position_span: InnerSpan { start: 7, end: 8 },
381377 format: FormatSpec {
382378 fill: None,
383379 fill_span: None,
384380 align: AlignUnknown,
385 sign: Some(Sign::Minus),
381 sign: None,
386382 alternate: false,
387383 zero_pad: false,
388384 debug_hex: None,
......@@ -390,79 +386,23 @@ fn format_flags() {
390386 width: CountImplied,
391387 precision_span: None,
392388 width_span: None,
393 ty: "",
394 ty_span: None,
395 },
396 }))],
397 );
398 same(
399 "{:+#}",
400 &[NextArgument(Box::new(Argument {
401 position: ArgumentImplicitlyIs(0),
402 position_span: InnerSpan { start: 2, end: 2 },
403 format: FormatSpec {
404 fill: None,
405 fill_span: None,
406 align: AlignUnknown,
407 sign: Some(Sign::Plus),
408 alternate: true,
409 zero_pad: false,
410 debug_hex: None,
411 precision: CountImplied,
412 width: CountImplied,
413 precision_span: None,
414 width_span: None,
415 ty: "",
389 ty: "x",
416390 ty_span: None,
417391 },
418 }))],
419 );
420}
421#[test]
422fn format_mixture() {
423 same(
424 "abcd {3:x} efg",
425 &[
426 String("abcd "),
427 NextArgument(Box::new(Argument {
428 position: ArgumentIs(3),
429 position_span: InnerSpan { start: 7, end: 8 },
430 format: FormatSpec {
431 fill: None,
432 fill_span: None,
433 align: AlignUnknown,
434 sign: None,
435 alternate: false,
436 zero_pad: false,
437 debug_hex: None,
438 precision: CountImplied,
439 width: CountImplied,
440 precision_span: None,
441 width_span: None,
442 ty: "x",
443 ty_span: None,
444 },
445 })),
446 String(" efg"),
447 ],
448 );
392 })),
393 String(" efg"),
394 ]);
449395}
450396#[test]
451397fn format_whitespace() {
452 same(
453 "{ }",
454 &[NextArgument(Box::new(Argument {
455 position: ArgumentImplicitlyIs(0),
456 position_span: InnerSpan { start: 2, end: 3 },
457 format: fmtdflt(),
458 }))],
459 );
460 same(
461 "{ }",
462 &[NextArgument(Box::new(Argument {
463 position: ArgumentImplicitlyIs(0),
464 position_span: InnerSpan { start: 2, end: 4 },
465 format: fmtdflt(),
466 }))],
467 );
398 same("{ }", &[NextArgument(Box::new(Argument {
399 position: ArgumentImplicitlyIs(0),
400 position_span: InnerSpan { start: 2, end: 3 },
401 format: fmtdflt(),
402 }))]);
403 same("{ }", &[NextArgument(Box::new(Argument {
404 position: ArgumentImplicitlyIs(0),
405 position_span: InnerSpan { start: 2, end: 4 },
406 format: fmtdflt(),
407 }))]);
468408}
compiler/rustc_passes/src/check_attr.rs+19-30
......@@ -8,16 +8,16 @@ use std::cell::Cell;
88use std::collections::hash_map::Entry;
99
1010use rustc_ast::{
11 ast, AttrKind, AttrStyle, Attribute, LitKind, MetaItemKind, MetaItemLit, NestedMetaItem,
11 AttrKind, AttrStyle, Attribute, LitKind, MetaItemKind, MetaItemLit, NestedMetaItem, ast,
1212};
1313use rustc_data_structures::fx::FxHashMap;
1414use rustc_errors::{Applicability, DiagCtxtHandle, IntoDiagArg, MultiSpan, StashKey};
15use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
15use rustc_feature::{AttributeDuplicates, AttributeType, BUILTIN_ATTRIBUTE_MAP, BuiltinAttribute};
1616use rustc_hir::def_id::LocalModDefId;
1717use rustc_hir::intravisit::{self, Visitor};
1818use rustc_hir::{
19 self as hir, self, FnSig, ForeignItem, HirId, Item, ItemKind, MethodKind, Safety, Target,
20 TraitItem, CRATE_HIR_ID, CRATE_OWNER_ID,
19 self as hir, self, CRATE_HIR_ID, CRATE_OWNER_ID, FnSig, ForeignItem, HirId, Item, ItemKind,
20 MethodKind, Safety, Target, TraitItem,
2121};
2222use rustc_macros::LintDiagnostic;
2323use rustc_middle::hir::nested_filter;
......@@ -32,8 +32,8 @@ use rustc_session::lint::builtin::{
3232 UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_ATTRIBUTES,
3333};
3434use rustc_session::parse::feature_err;
35use rustc_span::symbol::{kw, sym, Symbol};
36use rustc_span::{BytePos, Span, DUMMY_SP};
35use rustc_span::symbol::{Symbol, kw, sym};
36use rustc_span::{BytePos, DUMMY_SP, Span};
3737use rustc_target::spec::abi::Abi;
3838use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
3939use rustc_trait_selection::infer::{TyCtxtInferExt, ValuePairs};
......@@ -344,12 +344,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
344344 }
345345
346346 fn inline_attr_str_error_without_macro_def(&self, hir_id: HirId, attr: &Attribute, sym: &str) {
347 self.tcx.emit_node_span_lint(
348 UNUSED_ATTRIBUTES,
349 hir_id,
350 attr.span,
351 errors::IgnoredAttr { sym },
352 );
347 self.tcx
348 .emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::IgnoredAttr { sym });
353349 }
354350
355351 /// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl.
......@@ -1396,12 +1392,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
13961392 _ => {
13971393 // FIXME: #[cold] was previously allowed on non-functions and some crates used
13981394 // this, so only emit a warning.
1399 self.tcx.emit_node_span_lint(
1400 UNUSED_ATTRIBUTES,
1401 hir_id,
1402 attr.span,
1403 errors::Cold { span, on_crate: hir_id == CRATE_HIR_ID },
1404 );
1395 self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::Cold {
1396 span,
1397 on_crate: hir_id == CRATE_HIR_ID,
1398 });
14051399 }
14061400 }
14071401 }
......@@ -1416,12 +1410,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
14161410 return;
14171411 }
14181412
1419 self.tcx.emit_node_span_lint(
1420 UNUSED_ATTRIBUTES,
1421 hir_id,
1422 attr.span,
1423 errors::Link { span: (target != Target::ForeignMod).then_some(span) },
1424 );
1413 self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::Link {
1414 span: (target != Target::ForeignMod).then_some(span),
1415 });
14251416 }
14261417
14271418 /// Checks if `#[link_name]` is applied to an item other than a foreign function or static.
......@@ -2210,12 +2201,10 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
22102201 return;
22112202 };
22122203
2213 self.tcx.emit_node_span_lint(
2214 UNUSED_ATTRIBUTES,
2215 hir_id,
2216 attr.span,
2217 errors::Unused { attr_span: attr.span, note },
2218 );
2204 self.tcx.emit_node_span_lint(UNUSED_ATTRIBUTES, hir_id, attr.span, errors::Unused {
2205 attr_span: attr.span,
2206 note,
2207 });
22192208 }
22202209
22212210 /// A best effort attempt to create an error for a mismatching proc macro signature.
compiler/rustc_passes/src/check_const.rs+1-1
......@@ -14,7 +14,7 @@ use rustc_middle::query::Providers;
1414use rustc_middle::span_bug;
1515use rustc_middle::ty::TyCtxt;
1616use rustc_session::parse::feature_err;
17use rustc_span::{sym, Span, Symbol};
17use rustc_span::{Span, Symbol, sym};
1818use {rustc_attr as attr, rustc_hir as hir};
1919
2020use crate::errors::SkippingConstChecks;
compiler/rustc_passes/src/dead.rs+2-2
......@@ -5,8 +5,8 @@
55
66use std::mem;
77
8use hir::def_id::{LocalDefIdMap, LocalDefIdSet};
98use hir::ItemKind;
9use hir::def_id::{LocalDefIdMap, LocalDefIdSet};
1010use rustc_data_structures::unord::UnordSet;
1111use rustc_errors::MultiSpan;
1212use rustc_hir as hir;
......@@ -21,7 +21,7 @@ use rustc_middle::ty::{self, TyCtxt};
2121use rustc_middle::{bug, span_bug};
2222use rustc_session::lint;
2323use rustc_session::lint::builtin::DEAD_CODE;
24use rustc_span::symbol::{sym, Symbol};
24use rustc_span::symbol::{Symbol, sym};
2525use rustc_target::abi::FieldIdx;
2626
2727use crate::errors::{
compiler/rustc_passes/src/diagnostic_items.rs+2-2
......@@ -10,12 +10,12 @@
1010//! * Compiler internal types like `Ty` and `TyCtxt`
1111
1212use rustc_ast as ast;
13use rustc_hir::diagnostic_items::DiagnosticItems;
1413use rustc_hir::OwnerId;
14use rustc_hir::diagnostic_items::DiagnosticItems;
1515use rustc_middle::query::{LocalCrate, Providers};
1616use rustc_middle::ty::TyCtxt;
1717use rustc_span::def_id::{DefId, LOCAL_CRATE};
18use rustc_span::symbol::{sym, Symbol};
18use rustc_span::symbol::{Symbol, sym};
1919
2020use crate::errors::DuplicateDiagnosticItemInCrate;
2121
compiler/rustc_passes/src/entry.rs+3-3
......@@ -2,12 +2,12 @@ use rustc_ast::attr;
22use rustc_ast::entry::EntryPointType;
33use rustc_errors::codes::*;
44use rustc_hir::def::DefKind;
5use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
6use rustc_hir::{ItemId, Node, CRATE_HIR_ID};
5use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LOCAL_CRATE, LocalDefId};
6use rustc_hir::{CRATE_HIR_ID, ItemId, Node};
77use rustc_middle::query::Providers;
88use rustc_middle::ty::TyCtxt;
9use rustc_session::config::{sigpipe, CrateType, EntryFnType, RemapPathScopeComponents};
109use rustc_session::RemapFileNameExt;
10use rustc_session::config::{CrateType, EntryFnType, RemapPathScopeComponents, sigpipe};
1111use rustc_span::symbol::sym;
1212use rustc_span::{Span, Symbol};
1313
compiler/rustc_passes/src/errors.rs+6-10
......@@ -10,7 +10,7 @@ use rustc_errors::{
1010use rustc_hir::{self as hir, ExprKind, Target};
1111use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
1212use rustc_middle::ty::{MainDefinition, Ty};
13use rustc_span::{Span, Symbol, DUMMY_SP};
13use rustc_span::{DUMMY_SP, Span, Symbol};
1414
1515use crate::check_attr::ProcMacroKind;
1616use crate::fluent_generated as fluent;
......@@ -1337,15 +1337,11 @@ pub(crate) struct DuplicateLangItem {
13371337impl<G: EmissionGuarantee> Diagnostic<'_, G> for DuplicateLangItem {
13381338 #[track_caller]
13391339 fn into_diag(self, dcx: DiagCtxtHandle<'_>, level: Level) -> Diag<'_, G> {
1340 let mut diag = Diag::new(
1341 dcx,
1342 level,
1343 match self.duplicate {
1344 Duplicate::Plain => fluent::passes_duplicate_lang_item,
1345 Duplicate::Crate => fluent::passes_duplicate_lang_item_crate,
1346 Duplicate::CrateDepends => fluent::passes_duplicate_lang_item_crate_depends,
1347 },
1348 );
1340 let mut diag = Diag::new(dcx, level, match self.duplicate {
1341 Duplicate::Plain => fluent::passes_duplicate_lang_item,
1342 Duplicate::Crate => fluent::passes_duplicate_lang_item_crate,
1343 Duplicate::CrateDepends => fluent::passes_duplicate_lang_item_crate_depends,
1344 });
13491345 diag.code(E0152);
13501346 diag.arg("lang_item_name", self.lang_item_name);
13511347 diag.arg("crate_name", self.crate_name);
compiler/rustc_passes/src/hir_id_validator.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_data_structures::sync::Lock;
22use rustc_hir as hir;
33use rustc_hir::def_id::LocalDefId;
4use rustc_hir::{intravisit, HirId, ItemLocalId};
4use rustc_hir::{HirId, ItemLocalId, intravisit};
55use rustc_index::bit_set::GrowableBitSet;
66use rustc_middle::hir::nested_filter;
77use rustc_middle::ty::TyCtxt;
compiler/rustc_passes/src/hir_stats.rs+170-192
......@@ -3,15 +3,15 @@
33// completely accurate (some things might be counted twice, others missed).
44
55use rustc_ast::visit::BoundKind;
6use rustc_ast::{self as ast, visit as ast_visit, AttrId, NodeId};
6use rustc_ast::{self as ast, AttrId, NodeId, visit as ast_visit};
77use rustc_data_structures::fx::{FxHashMap, FxHashSet};
88use rustc_hir as hir;
9use rustc_hir::{intravisit as hir_visit, HirId};
9use rustc_hir::{HirId, intravisit as hir_visit};
1010use rustc_middle::hir::map::Map;
1111use rustc_middle::ty::TyCtxt;
1212use rustc_middle::util::common::to_readable_str;
13use rustc_span::def_id::LocalDefId;
1413use rustc_span::Span;
14use rustc_span::def_id::LocalDefId;
1515
1616#[derive(Copy, Clone, PartialEq, Eq, Hash)]
1717enum Id {
......@@ -219,28 +219,25 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
219219 }
220220
221221 fn visit_item(&mut self, i: &'v hir::Item<'v>) {
222 record_variants!(
223 (self, i, i.kind, Id::Node(i.hir_id()), hir, Item, ItemKind),
224 [
225 ExternCrate,
226 Use,
227 Static,
228 Const,
229 Fn,
230 Macro,
231 Mod,
232 ForeignMod,
233 GlobalAsm,
234 TyAlias,
235 OpaqueTy,
236 Enum,
237 Struct,
238 Union,
239 Trait,
240 TraitAlias,
241 Impl
242 ]
243 );
222 record_variants!((self, i, i.kind, Id::Node(i.hir_id()), hir, Item, ItemKind), [
223 ExternCrate,
224 Use,
225 Static,
226 Const,
227 Fn,
228 Macro,
229 Mod,
230 ForeignMod,
231 GlobalAsm,
232 TyAlias,
233 OpaqueTy,
234 Enum,
235 Struct,
236 Union,
237 Trait,
238 TraitAlias,
239 Impl
240 ]);
244241 hir_visit::walk_item(self, i)
245242 }
246243
......@@ -273,10 +270,9 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
273270 }
274271
275272 fn visit_stmt(&mut self, s: &'v hir::Stmt<'v>) {
276 record_variants!(
277 (self, s, s.kind, Id::Node(s.hir_id), hir, Stmt, StmtKind),
278 [Let, Item, Expr, Semi]
279 );
273 record_variants!((self, s, s.kind, Id::Node(s.hir_id), hir, Stmt, StmtKind), [
274 Let, Item, Expr, Semi
275 ]);
280276 hir_visit::walk_stmt(self, s)
281277 }
282278
......@@ -286,26 +282,23 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
286282 }
287283
288284 fn visit_pat(&mut self, p: &'v hir::Pat<'v>) {
289 record_variants!(
290 (self, p, p.kind, Id::Node(p.hir_id), hir, Pat, PatKind),
291 [
292 Wild,
293 Binding,
294 Struct,
295 TupleStruct,
296 Or,
297 Never,
298 Path,
299 Tuple,
300 Box,
301 Deref,
302 Ref,
303 Lit,
304 Range,
305 Slice,
306 Err
307 ]
308 );
285 record_variants!((self, p, p.kind, Id::Node(p.hir_id), hir, Pat, PatKind), [
286 Wild,
287 Binding,
288 Struct,
289 TupleStruct,
290 Or,
291 Never,
292 Path,
293 Tuple,
294 Box,
295 Deref,
296 Ref,
297 Lit,
298 Range,
299 Slice,
300 Err
301 ]);
309302 hir_visit::walk_pat(self, p)
310303 }
311304
......@@ -315,15 +308,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
315308 }
316309
317310 fn visit_expr(&mut self, e: &'v hir::Expr<'v>) {
318 record_variants!(
319 (self, e, e.kind, Id::Node(e.hir_id), hir, Expr, ExprKind),
320 [
321 ConstBlock, Array, Call, MethodCall, Tup, Binary, Unary, Lit, Cast, Type,
322 DropTemps, Let, If, Loop, Match, Closure, Block, Assign, AssignOp, Field, Index,
323 Path, AddrOf, Break, Continue, Ret, Become, InlineAsm, OffsetOf, Struct, Repeat,
324 Yield, Err
325 ]
326 );
311 record_variants!((self, e, e.kind, Id::Node(e.hir_id), hir, Expr, ExprKind), [
312 ConstBlock, Array, Call, MethodCall, Tup, Binary, Unary, Lit, Cast, Type, DropTemps,
313 Let, If, Loop, Match, Closure, Block, Assign, AssignOp, Field, Index, Path, AddrOf,
314 Break, Continue, Ret, Become, InlineAsm, OffsetOf, Struct, Repeat, Yield, Err
315 ]);
327316 hir_visit::walk_expr(self, e)
328317 }
329318
......@@ -333,27 +322,24 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
333322 }
334323
335324 fn visit_ty(&mut self, t: &'v hir::Ty<'v>) {
336 record_variants!(
337 (self, t, t.kind, Id::Node(t.hir_id), hir, Ty, TyKind),
338 [
339 InferDelegation,
340 Slice,
341 Array,
342 Ptr,
343 Ref,
344 BareFn,
345 Never,
346 Tup,
347 AnonAdt,
348 Path,
349 OpaqueDef,
350 TraitObject,
351 Typeof,
352 Infer,
353 Pat,
354 Err
355 ]
356 );
325 record_variants!((self, t, t.kind, Id::Node(t.hir_id), hir, Ty, TyKind), [
326 InferDelegation,
327 Slice,
328 Array,
329 Ptr,
330 Ref,
331 BareFn,
332 Never,
333 Tup,
334 AnonAdt,
335 Path,
336 OpaqueDef,
337 TraitObject,
338 Typeof,
339 Infer,
340 Pat,
341 Err
342 ]);
357343 hir_visit::walk_ty(self, t)
358344 }
359345
......@@ -368,10 +354,11 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
368354 }
369355
370356 fn visit_where_predicate(&mut self, p: &'v hir::WherePredicate<'v>) {
371 record_variants!(
372 (self, p, p, Id::None, hir, WherePredicate, WherePredicate),
373 [BoundPredicate, RegionPredicate, EqPredicate]
374 );
357 record_variants!((self, p, p, Id::None, hir, WherePredicate, WherePredicate), [
358 BoundPredicate,
359 RegionPredicate,
360 EqPredicate
361 ]);
375362 hir_visit::walk_where_predicate(self, p)
376363 }
377364
......@@ -425,10 +412,9 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
425412 }
426413
427414 fn visit_param_bound(&mut self, b: &'v hir::GenericBound<'v>) {
428 record_variants!(
429 (self, b, b, Id::None, hir, GenericBound, GenericBound),
430 [Trait, Outlives, Use]
431 );
415 record_variants!((self, b, b, Id::None, hir, GenericBound, GenericBound), [
416 Trait, Outlives, Use
417 ]);
432418 hir_visit::walk_param_bound(self, b)
433419 }
434420
......@@ -443,10 +429,9 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
443429 }
444430
445431 fn visit_generic_arg(&mut self, ga: &'v hir::GenericArg<'v>) {
446 record_variants!(
447 (self, ga, ga, Id::Node(ga.hir_id()), hir, GenericArg, GenericArg),
448 [Lifetime, Type, Const, Infer]
449 );
432 record_variants!((self, ga, ga, Id::Node(ga.hir_id()), hir, GenericArg, GenericArg), [
433 Lifetime, Type, Const, Infer
434 ]);
450435 match ga {
451436 hir::GenericArg::Lifetime(lt) => self.visit_lifetime(lt),
452437 hir::GenericArg::Type(ty) => self.visit_ty(ty),
......@@ -492,38 +477,34 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
492477
493478impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
494479 fn visit_foreign_item(&mut self, i: &'v ast::ForeignItem) {
495 record_variants!(
496 (self, i, i.kind, Id::None, ast, ForeignItem, ForeignItemKind),
497 [Static, Fn, TyAlias, MacCall]
498 );
480 record_variants!((self, i, i.kind, Id::None, ast, ForeignItem, ForeignItemKind), [
481 Static, Fn, TyAlias, MacCall
482 ]);
499483 ast_visit::walk_item(self, i)
500484 }
501485
502486 fn visit_item(&mut self, i: &'v ast::Item) {
503 record_variants!(
504 (self, i, i.kind, Id::None, ast, Item, ItemKind),
505 [
506 ExternCrate,
507 Use,
508 Static,
509 Const,
510 Fn,
511 Mod,
512 ForeignMod,
513 GlobalAsm,
514 TyAlias,
515 Enum,
516 Struct,
517 Union,
518 Trait,
519 TraitAlias,
520 Impl,
521 MacCall,
522 MacroDef,
523 Delegation,
524 DelegationMac
525 ]
526 );
487 record_variants!((self, i, i.kind, Id::None, ast, Item, ItemKind), [
488 ExternCrate,
489 Use,
490 Static,
491 Const,
492 Fn,
493 Mod,
494 ForeignMod,
495 GlobalAsm,
496 TyAlias,
497 Enum,
498 Struct,
499 Union,
500 Trait,
501 TraitAlias,
502 Impl,
503 MacCall,
504 MacroDef,
505 Delegation,
506 DelegationMac
507 ]);
527508 ast_visit::walk_item(self, i)
528509 }
529510
......@@ -538,10 +519,9 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
538519 }
539520
540521 fn visit_stmt(&mut self, s: &'v ast::Stmt) {
541 record_variants!(
542 (self, s, s.kind, Id::None, ast, Stmt, StmtKind),
543 [Let, Item, Expr, Semi, Empty, MacCall]
544 );
522 record_variants!((self, s, s.kind, Id::None, ast, Stmt, StmtKind), [
523 Let, Item, Expr, Semi, Empty, MacCall
524 ]);
545525 ast_visit::walk_stmt(self, s)
546526 }
547527
......@@ -556,29 +536,26 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
556536 }
557537
558538 fn visit_pat(&mut self, p: &'v ast::Pat) {
559 record_variants!(
560 (self, p, p.kind, Id::None, ast, Pat, PatKind),
561 [
562 Wild,
563 Ident,
564 Struct,
565 TupleStruct,
566 Or,
567 Path,
568 Tuple,
569 Box,
570 Deref,
571 Ref,
572 Lit,
573 Range,
574 Slice,
575 Rest,
576 Never,
577 Paren,
578 MacCall,
579 Err
580 ]
581 );
539 record_variants!((self, p, p.kind, Id::None, ast, Pat, PatKind), [
540 Wild,
541 Ident,
542 Struct,
543 TupleStruct,
544 Or,
545 Path,
546 Tuple,
547 Box,
548 Deref,
549 Ref,
550 Lit,
551 Range,
552 Slice,
553 Rest,
554 Never,
555 Paren,
556 MacCall,
557 Err
558 ]);
582559 ast_visit::walk_pat(self, p)
583560 }
584561
......@@ -598,32 +575,29 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
598575 }
599576
600577 fn visit_ty(&mut self, t: &'v ast::Ty) {
601 record_variants!(
602 (self, t, t.kind, Id::None, ast, Ty, TyKind),
603 [
604 Slice,
605 Array,
606 Ptr,
607 Ref,
608 BareFn,
609 Never,
610 Tup,
611 AnonStruct,
612 AnonUnion,
613 Path,
614 Pat,
615 TraitObject,
616 ImplTrait,
617 Paren,
618 Typeof,
619 Infer,
620 ImplicitSelf,
621 MacCall,
622 CVarArgs,
623 Dummy,
624 Err
625 ]
626 );
578 record_variants!((self, t, t.kind, Id::None, ast, Ty, TyKind), [
579 Slice,
580 Array,
581 Ptr,
582 Ref,
583 BareFn,
584 Never,
585 Tup,
586 AnonStruct,
587 AnonUnion,
588 Path,
589 Pat,
590 TraitObject,
591 ImplTrait,
592 Paren,
593 Typeof,
594 Infer,
595 ImplicitSelf,
596 MacCall,
597 CVarArgs,
598 Dummy,
599 Err
600 ]);
627601
628602 ast_visit::walk_ty(self, t)
629603 }
......@@ -634,10 +608,11 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
634608 }
635609
636610 fn visit_where_predicate(&mut self, p: &'v ast::WherePredicate) {
637 record_variants!(
638 (self, p, p, Id::None, ast, WherePredicate, WherePredicate),
639 [BoundPredicate, RegionPredicate, EqPredicate]
640 );
611 record_variants!((self, p, p, Id::None, ast, WherePredicate, WherePredicate), [
612 BoundPredicate,
613 RegionPredicate,
614 EqPredicate
615 ]);
641616 ast_visit::walk_where_predicate(self, p)
642617 }
643618
......@@ -647,18 +622,21 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
647622 }
648623
649624 fn visit_assoc_item(&mut self, i: &'v ast::AssocItem, ctxt: ast_visit::AssocCtxt) {
650 record_variants!(
651 (self, i, i.kind, Id::None, ast, AssocItem, AssocItemKind),
652 [Const, Fn, Type, MacCall, Delegation, DelegationMac]
653 );
625 record_variants!((self, i, i.kind, Id::None, ast, AssocItem, AssocItemKind), [
626 Const,
627 Fn,
628 Type,
629 MacCall,
630 Delegation,
631 DelegationMac
632 ]);
654633 ast_visit::walk_assoc_item(self, i, ctxt);
655634 }
656635
657636 fn visit_param_bound(&mut self, b: &'v ast::GenericBound, _ctxt: BoundKind) {
658 record_variants!(
659 (self, b, b, Id::None, ast, GenericBound, GenericBound),
660 [Trait, Outlives, Use]
661 );
637 record_variants!((self, b, b, Id::None, ast, GenericBound, GenericBound), [
638 Trait, Outlives, Use
639 ]);
662640 ast_visit::walk_param_bound(self, b)
663641 }
664642
......@@ -691,18 +669,18 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
691669 // common, so we implement `visit_generic_args` and tolerate the double
692670 // counting in the former case.
693671 fn visit_generic_args(&mut self, g: &'v ast::GenericArgs) {
694 record_variants!(
695 (self, g, g, Id::None, ast, GenericArgs, GenericArgs),
696 [AngleBracketed, Parenthesized, ParenthesizedElided]
697 );
672 record_variants!((self, g, g, Id::None, ast, GenericArgs, GenericArgs), [
673 AngleBracketed,
674 Parenthesized,
675 ParenthesizedElided
676 ]);
698677 ast_visit::walk_generic_args(self, g)
699678 }
700679
701680 fn visit_attribute(&mut self, attr: &'v ast::Attribute) {
702 record_variants!(
703 (self, attr, attr.kind, Id::None, ast, Attribute, AttrKind),
704 [Normal, DocComment]
705 );
681 record_variants!((self, attr, attr.kind, Id::None, ast, Attribute, AttrKind), [
682 Normal, DocComment
683 ]);
706684 ast_visit::walk_attribute(self, attr)
707685 }
708686
compiler/rustc_passes/src/lang_items.rs+2-2
......@@ -11,13 +11,13 @@ use rustc_ast as ast;
1111use rustc_ast::visit;
1212use rustc_data_structures::fx::FxHashMap;
1313use rustc_hir::def_id::{DefId, LocalDefId};
14use rustc_hir::lang_items::{extract, GenericRequirement};
14use rustc_hir::lang_items::{GenericRequirement, extract};
1515use rustc_hir::{LangItem, LanguageItems, MethodKind, Target};
1616use rustc_middle::query::Providers;
1717use rustc_middle::ty::{ResolverAstLowering, TyCtxt};
1818use rustc_session::cstore::ExternCrate;
19use rustc_span::symbol::kw::Empty;
2019use rustc_span::Span;
20use rustc_span::symbol::kw::Empty;
2121
2222use crate::errors::{
2323 DuplicateLangItem, IncorrectTarget, LangItemOnIncorrectTarget, UnknownLangItem,
compiler/rustc_passes/src/layout_test.rs+1-1
......@@ -4,9 +4,9 @@ use rustc_hir::def_id::LocalDefId;
44use rustc_middle::span_bug;
55use rustc_middle::ty::layout::{HasParamEnv, HasTyCtxt, LayoutError, LayoutOfHelpers};
66use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt};
7use rustc_span::Span;
78use rustc_span::source_map::Spanned;
89use rustc_span::symbol::sym;
9use rustc_span::Span;
1010use rustc_target::abi::{HasDataLayout, TargetDataLayout};
1111use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
1212use rustc_trait_selection::infer::TyCtxtInferExt;
compiler/rustc_passes/src/lib_features.rs+1-1
......@@ -12,7 +12,7 @@ use rustc_middle::middle::lib_features::{FeatureStability, LibFeatures};
1212use rustc_middle::query::{LocalCrate, Providers};
1313use rustc_middle::ty::TyCtxt;
1414use rustc_span::symbol::Symbol;
15use rustc_span::{sym, Span};
15use rustc_span::{Span, sym};
1616
1717use crate::errors::{FeaturePreviouslyDeclared, FeatureStableTwice};
1818
compiler/rustc_passes/src/liveness.rs+1-1
......@@ -96,7 +96,7 @@ use rustc_middle::query::Providers;
9696use rustc_middle::span_bug;
9797use rustc_middle::ty::{self, RootVariableMinCaptureList, Ty, TyCtxt};
9898use rustc_session::lint;
99use rustc_span::symbol::{kw, sym, Symbol};
99use rustc_span::symbol::{Symbol, kw, sym};
100100use rustc_span::{BytePos, Span};
101101use tracing::{debug, instrument};
102102
compiler/rustc_passes/src/loops.rs+1-1
......@@ -1,6 +1,7 @@
11use std::collections::BTreeMap;
22use std::fmt;
33
4use Context::*;
45use rustc_hir as hir;
56use rustc_hir::def_id::{LocalDefId, LocalModDefId};
67use rustc_hir::intravisit::{self, Visitor};
......@@ -11,7 +12,6 @@ use rustc_middle::span_bug;
1112use rustc_middle::ty::TyCtxt;
1213use rustc_span::hygiene::DesugaringKind;
1314use rustc_span::{BytePos, Span};
14use Context::*;
1515
1616use crate::errors::{
1717 BreakInsideClosure, BreakInsideCoroutine, BreakNonLoop, ContinueLabeledBlock, OutsideLoop,
compiler/rustc_passes/src/naked_functions.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_middle::hir::nested_filter::OnlyBodies;
1010use rustc_middle::query::Providers;
1111use rustc_middle::ty::TyCtxt;
1212use rustc_session::lint::builtin::UNDEFINED_NAKED_FUNCTION_ABI;
13use rustc_span::symbol::sym;
1413use rustc_span::Span;
14use rustc_span::symbol::sym;
1515use rustc_target::spec::abi::Abi;
1616
1717use crate::errors::{
compiler/rustc_passes/src/reachable.rs+1-1
......@@ -25,10 +25,10 @@
2525use hir::def_id::LocalDefIdSet;
2626use rustc_data_structures::stack::ensure_sufficient_stack;
2727use rustc_hir as hir;
28use rustc_hir::Node;
2829use rustc_hir::def::{DefKind, Res};
2930use rustc_hir::def_id::{DefId, LocalDefId};
3031use rustc_hir::intravisit::{self, Visitor};
31use rustc_hir::Node;
3232use rustc_middle::bug;
3333use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
3434use rustc_middle::middle::privacy::{self, Level};
compiler/rustc_passes/src/stability.rs+2-2
......@@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxIndexMap;
1212use rustc_data_structures::unord::{ExtendUnord, UnordMap, UnordSet};
1313use rustc_hir as hir;
1414use rustc_hir::def::{DefKind, Res};
15use rustc_hir::def_id::{LocalDefId, LocalModDefId, CRATE_DEF_ID, LOCAL_CRATE};
15use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE, LocalDefId, LocalModDefId};
1616use rustc_hir::hir_id::CRATE_HIR_ID;
1717use rustc_hir::intravisit::{self, Visitor};
1818use rustc_hir::{FieldDef, Item, ItemKind, TraitRef, Ty, TyKind, Variant};
......@@ -24,8 +24,8 @@ use rustc_middle::query::Providers;
2424use rustc_middle::ty::TyCtxt;
2525use rustc_session::lint;
2626use rustc_session::lint::builtin::{INEFFECTIVE_UNSTABLE_TRAIT_IMPL, USELESS_DEPRECATED};
27use rustc_span::symbol::{sym, Symbol};
2827use rustc_span::Span;
28use rustc_span::symbol::{Symbol, sym};
2929use rustc_target::spec::abi::Abi;
3030use tracing::{debug, info};
3131
compiler/rustc_pattern_analysis/src/constructor.rs+2-2
......@@ -176,13 +176,13 @@
176176//! we assume they never cover each other. In order to respect the invariants of
177177//! [`SplitConstructorSet`], we give each `Opaque` constructor a unique id so we can recognize it.
178178
179use std::cmp::{self, max, min, Ordering};
179use std::cmp::{self, Ordering, max, min};
180180use std::fmt;
181181use std::iter::once;
182182
183183use rustc_apfloat::ieee::{DoubleS, HalfS, IeeeFloat, QuadS, SingleS};
184use rustc_index::bit_set::{BitSet, GrowableBitSet};
185184use rustc_index::IndexVec;
185use rustc_index::bit_set::{BitSet, GrowableBitSet};
186186use smallvec::SmallVec;
187187
188188use self::Constructor::*;
compiler/rustc_pattern_analysis/src/lints.rs+1-1
......@@ -2,11 +2,11 @@ use rustc_session::lint::builtin::NON_EXHAUSTIVE_OMITTED_PATTERNS;
22use rustc_span::ErrorGuaranteed;
33use tracing::instrument;
44
5use crate::MatchArm;
56use crate::constructor::Constructor;
67use crate::errors::{NonExhaustiveOmittedPattern, NonExhaustiveOmittedPatternLintOnArm, Uncovered};
78use crate::pat_column::PatternColumn;
89use crate::rustc::{RevealedTy, RustcPatCtxt, WitnessPat};
9use crate::MatchArm;
1010
1111/// Traverse the patterns to collect any variants of a non_exhaustive enum that fail to be mentioned
1212/// in a given column.
compiler/rustc_pattern_analysis/src/pat.rs+1-1
......@@ -3,7 +3,7 @@
33
44use std::fmt;
55
6use smallvec::{smallvec, SmallVec};
6use smallvec::{SmallVec, smallvec};
77
88use self::Constructor::*;
99use crate::constructor::{Constructor, Slice, SliceKind};
compiler/rustc_pattern_analysis/src/rustc.rs+5-5
......@@ -2,8 +2,8 @@ use std::fmt;
22use std::iter::once;
33
44use rustc_arena::DroplessArena;
5use rustc_hir::def_id::DefId;
65use rustc_hir::HirId;
6use rustc_hir::def_id::DefId;
77use rustc_index::{Idx, IndexVec};
88use rustc_middle::middle::stability::EvalResult;
99use rustc_middle::mir::{self, Const};
......@@ -14,8 +14,8 @@ use rustc_middle::ty::{
1414};
1515use rustc_middle::{bug, span_bug};
1616use rustc_session::lint;
17use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
18use rustc_target::abi::{FieldIdx, Integer, VariantIdx, FIRST_VARIANT};
17use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
18use rustc_target::abi::{FIRST_VARIANT, FieldIdx, Integer, VariantIdx};
1919
2020use crate::constructor::Constructor::*;
2121use crate::constructor::{
......@@ -24,8 +24,8 @@ use crate::constructor::{
2424use crate::lints::lint_nonexhaustive_missing_variants;
2525use crate::pat_column::PatternColumn;
2626use crate::rustc::print::EnumInfo;
27use crate::usefulness::{compute_match_usefulness, PlaceValidity};
28use crate::{errors, Captures, PatCx, PrivateUninhabitedField};
27use crate::usefulness::{PlaceValidity, compute_match_usefulness};
28use crate::{Captures, PatCx, PrivateUninhabitedField, errors};
2929
3030mod print;
3131
compiler/rustc_pattern_analysis/src/usefulness.rs+1-1
......@@ -713,7 +713,7 @@ use std::fmt;
713713use rustc_data_structures::stack::ensure_sufficient_stack;
714714use rustc_hash::{FxHashMap, FxHashSet};
715715use rustc_index::bit_set::BitSet;
716use smallvec::{smallvec, SmallVec};
716use smallvec::{SmallVec, smallvec};
717717use tracing::{debug, instrument};
718718
719719use self::PlaceValidity::*;
compiler/rustc_pattern_analysis/tests/common/mod.rs+1-1
......@@ -6,9 +6,9 @@ use rustc_pattern_analysis::{Captures, MatchArm, PatCx, PrivateUninhabitedField}
66
77/// Sets up `tracing` for easier debugging. Tries to look like the `rustc` setup.
88pub fn init_tracing() {
9 use tracing_subscriber::Layer;
910 use tracing_subscriber::layer::SubscriberExt;
1011 use tracing_subscriber::util::SubscriberInitExt;
11 use tracing_subscriber::Layer;
1212 let _ = tracing_tree::HierarchicalLayer::default()
1313 .with_writer(std::io::stderr)
1414 .with_ansi(true)
compiler/rustc_pattern_analysis/tests/complexity.rs+1-1
......@@ -1,9 +1,9 @@
11//! Test the pattern complexity limit.
22
33use common::*;
4use rustc_pattern_analysis::MatchArm;
45use rustc_pattern_analysis::pat::DeconstructedPat;
56use rustc_pattern_analysis::usefulness::PlaceValidity;
6use rustc_pattern_analysis::MatchArm;
77
88#[macro_use]
99mod common;
compiler/rustc_pattern_analysis/tests/exhaustiveness.rs+1-1
......@@ -1,9 +1,9 @@
11//! Test exhaustiveness checking.
22
33use common::*;
4use rustc_pattern_analysis::MatchArm;
45use rustc_pattern_analysis::pat::{DeconstructedPat, WitnessPat};
56use rustc_pattern_analysis::usefulness::PlaceValidity;
6use rustc_pattern_analysis::MatchArm;
77
88#[macro_use]
99mod common;
compiler/rustc_pattern_analysis/tests/intersection.rs+1-1
......@@ -1,9 +1,9 @@
11//! Test the computation of arm intersections.
22
33use common::*;
4use rustc_pattern_analysis::MatchArm;
45use rustc_pattern_analysis::pat::DeconstructedPat;
56use rustc_pattern_analysis::usefulness::PlaceValidity;
6use rustc_pattern_analysis::MatchArm;
77
88#[macro_use]
99mod common;
compiler/rustc_privacy/src/errors.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_errors::codes::*;
21use rustc_errors::DiagArgFromDisplay;
2use rustc_errors::codes::*;
33use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
44use rustc_span::{Span, Symbol};
55
compiler/rustc_privacy/src/lib.rs+4-4
......@@ -20,12 +20,12 @@ use errors::{
2020 ItemIsPrivate, PrivateInterfacesOrBoundsLint, ReportEffectiveVisibility, UnnameableTypesLint,
2121 UnnamedItemIsPrivate,
2222};
23use rustc_ast::visit::{try_visit, VisitorResult};
2423use rustc_ast::MacroDef;
24use rustc_ast::visit::{VisitorResult, try_visit};
2525use rustc_data_structures::fx::FxHashSet;
2626use rustc_data_structures::intern::Interned;
2727use rustc_hir::def::{DefKind, Res};
28use rustc_hir::def_id::{DefId, LocalDefId, LocalModDefId, CRATE_DEF_ID};
28use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LocalDefId, LocalModDefId};
2929use rustc_hir::intravisit::{self, Visitor};
3030use rustc_hir::{AssocItemKind, ForeignItemKind, ItemId, ItemKind, PatKind};
3131use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility, Level};
......@@ -37,9 +37,9 @@ use rustc_middle::ty::{
3737};
3838use rustc_middle::{bug, span_bug};
3939use rustc_session::lint;
40use rustc_span::hygiene::Transparency;
41use rustc_span::symbol::{kw, sym, Ident};
4240use rustc_span::Span;
41use rustc_span::hygiene::Transparency;
42use rustc_span::symbol::{Ident, kw, sym};
4343use tracing::debug;
4444use {rustc_attr as attr, rustc_hir as hir};
4545
compiler/rustc_query_impl/src/lib.rs+6-6
......@@ -16,19 +16,19 @@ use rustc_data_structures::stable_hasher::HashStable;
1616use rustc_data_structures::sync::AtomicU64;
1717use rustc_middle::arena::Arena;
1818use rustc_middle::dep_graph::{self, DepKind, DepKindStruct, DepNodeIndex};
19use rustc_middle::query::erase::{erase, restore, Erase};
19use rustc_middle::query::erase::{Erase, erase, restore};
2020use rustc_middle::query::on_disk_cache::{CacheEncoder, EncodedDepNodeIndex, OnDiskCache};
2121use rustc_middle::query::plumbing::{DynamicQuery, QuerySystem, QuerySystemFns};
2222use rustc_middle::query::{
23 queries, AsLocalKey, DynamicQueries, ExternProviders, Providers, QueryCaches, QueryEngine,
24 QueryStates,
23 AsLocalKey, DynamicQueries, ExternProviders, Providers, QueryCaches, QueryEngine, QueryStates,
24 queries,
2525};
2626use rustc_middle::ty::TyCtxt;
2727use rustc_query_system::dep_graph::SerializedDepNodeIndex;
2828use rustc_query_system::ich::StableHashingContext;
2929use rustc_query_system::query::{
30 get_query_incr, get_query_non_incr, CycleError, HashResult, QueryCache, QueryConfig, QueryMap,
31 QueryMode, QueryState,
30 CycleError, HashResult, QueryCache, QueryConfig, QueryMap, QueryMode, QueryState,
31 get_query_incr, get_query_non_incr,
3232};
3333use rustc_query_system::{HandleCycleError, Value};
3434use rustc_span::{ErrorGuaranteed, Span};
......@@ -38,7 +38,7 @@ use crate::profiling_support::QueryKeyStringCache;
3838
3939#[macro_use]
4040mod plumbing;
41pub use crate::plumbing::{query_key_hash_verify_all, QueryCtxt};
41pub use crate::plumbing::{QueryCtxt, query_key_hash_verify_all};
4242
4343mod profiling_support;
4444pub use self::profiling_support::alloc_self_profile_query_strings;
compiler/rustc_query_impl/src/plumbing.rs+5-5
......@@ -11,21 +11,21 @@ use rustc_errors::DiagInner;
1111use rustc_index::Idx;
1212use rustc_middle::bug;
1313use rustc_middle::dep_graph::{
14 self, dep_kinds, DepContext, DepKind, DepKindStruct, DepNode, DepNodeIndex,
15 SerializedDepNodeIndex,
14 self, DepContext, DepKind, DepKindStruct, DepNode, DepNodeIndex, SerializedDepNodeIndex,
15 dep_kinds,
1616};
17use rustc_middle::query::Key;
1718use rustc_middle::query::on_disk_cache::{
1819 AbsoluteBytePos, CacheDecoder, CacheEncoder, EncodedDepNodeIndex,
1920};
20use rustc_middle::query::Key;
2121use rustc_middle::ty::print::with_reduced_queries;
2222use rustc_middle::ty::tls::{self, ImplicitCtxt};
2323use rustc_middle::ty::{self, TyCtxt, TyEncoder};
2424use rustc_query_system::dep_graph::{DepNodeParams, HasDepContext};
2525use rustc_query_system::ich::StableHashingContext;
2626use rustc_query_system::query::{
27 force_query, QueryCache, QueryConfig, QueryContext, QueryJobId, QueryMap, QuerySideEffects,
28 QueryStackFrame,
27 QueryCache, QueryConfig, QueryContext, QueryJobId, QueryMap, QuerySideEffects, QueryStackFrame,
28 force_query,
2929};
3030use rustc_query_system::{LayoutOfDepth, QueryOverflow};
3131use rustc_serialize::{Decodable, Encodable};
compiler/rustc_query_impl/src/profiling_support.rs+1-1
......@@ -4,7 +4,7 @@ use std::io::Write;
44use measureme::{StringComponent, StringId};
55use rustc_data_structures::fx::FxHashMap;
66use rustc_data_structures::profiling::SelfProfiler;
7use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE};
7use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LOCAL_CRATE, LocalDefId};
88use rustc_hir::definitions::DefPathData;
99use rustc_middle::ty::TyCtxt;
1010use rustc_query_system::query::QueryCache;
compiler/rustc_query_system/src/dep_graph/dep_node.rs+1-1
......@@ -45,9 +45,9 @@
4545use std::fmt;
4646use std::hash::Hash;
4747
48use rustc_data_structures::AtomicRef;
4849use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint};
4950use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey};
50use rustc_data_structures::AtomicRef;
5151use rustc_hir::definitions::DefPathHash;
5252use rustc_macros::{Decodable, Encodable};
5353
compiler/rustc_query_system/src/dep_graph/graph.rs+1-1
......@@ -3,8 +3,8 @@ use std::collections::hash_map::Entry;
33use std::fmt::Debug;
44use std::hash::Hash;
55use std::marker::PhantomData;
6use std::sync::atomic::Ordering;
76use std::sync::Arc;
7use std::sync::atomic::Ordering;
88
99use rustc_data_structures::fingerprint::Fingerprint;
1010use rustc_data_structures::fx::{FxHashMap, FxHashSet};
compiler/rustc_query_system/src/dep_graph/mod.rs+2-2
......@@ -9,14 +9,14 @@ use std::panic;
99
1010pub use dep_node::{DepKind, DepKindStruct, DepNode, DepNodeParams, WorkProductId};
1111pub(crate) use graph::DepGraphData;
12pub use graph::{hash_result, DepGraph, DepNodeIndex, TaskDepsRef, WorkProduct, WorkProductMap};
12pub use graph::{DepGraph, DepNodeIndex, TaskDepsRef, WorkProduct, WorkProductMap, hash_result};
1313pub use query::DepGraphQuery;
1414use rustc_data_structures::profiling::SelfProfilerRef;
1515use rustc_session::Session;
1616pub use serialized::{SerializedDepGraph, SerializedDepNodeIndex};
1717use tracing::instrument;
1818
19use self::graph::{print_markframe_trace, MarkFrame};
19use self::graph::{MarkFrame, print_markframe_trace};
2020use crate::ich::StableHashingContext;
2121
2222pub trait DepContext: Copy {
compiler/rustc_query_system/src/dep_graph/query.rs+1-1
......@@ -1,5 +1,5 @@
11use rustc_data_structures::fx::FxHashMap;
2use rustc_data_structures::graph::implementation::{Direction, Graph, NodeIndex, INCOMING};
2use rustc_data_structures::graph::implementation::{Direction, Graph, INCOMING, NodeIndex};
33use rustc_index::IndexVec;
44
55use super::{DepNode, DepNodeIndex};
compiler/rustc_query_system/src/ich/hcx.rs+2-2
......@@ -3,11 +3,11 @@ use rustc_data_structures::stable_hasher::{HashStable, HashingControls, StableHa
33use rustc_data_structures::sync::Lrc;
44use rustc_hir::def_id::{DefId, LocalDefId};
55use rustc_hir::definitions::DefPathHash;
6use rustc_session::cstore::Untracked;
76use rustc_session::Session;
7use rustc_session::cstore::Untracked;
88use rustc_span::source_map::SourceMap;
99use rustc_span::symbol::Symbol;
10use rustc_span::{BytePos, CachingSourceMapView, SourceFile, Span, SpanData, DUMMY_SP};
10use rustc_span::{BytePos, CachingSourceMapView, DUMMY_SP, SourceFile, Span, SpanData};
1111
1212use crate::ich;
1313
compiler/rustc_query_system/src/ich/mod.rs+1-1
......@@ -1,6 +1,6 @@
11//! ICH - Incremental Compilation Hash
22
3use rustc_span::symbol::{sym, Symbol};
3use rustc_span::symbol::{Symbol, sym};
44
55pub use self::hcx::StableHashingContext;
66
compiler/rustc_query_system/src/query/mod.rs+2-2
......@@ -5,7 +5,7 @@ mod job;
55#[cfg(parallel_compiler)]
66pub use self::job::break_query_cycles;
77pub use self::job::{
8 print_query_stack, report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryMap,
8 QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryMap, print_query_stack, report_cycle,
99};
1010
1111mod caches;
......@@ -17,8 +17,8 @@ use rustc_data_structures::sync::Lock;
1717use rustc_errors::DiagInner;
1818use rustc_hir::def::DefKind;
1919use rustc_macros::{Decodable, Encodable};
20use rustc_span::def_id::DefId;
2120use rustc_span::Span;
21use rustc_span::def_id::DefId;
2222use thin_vec::ThinVec;
2323
2424pub use self::config::{HashResult, QueryConfig};
compiler/rustc_query_system/src/query/plumbing.rs+3-3
......@@ -16,21 +16,21 @@ use rustc_data_structures::sync::Lock;
1616#[cfg(parallel_compiler)]
1717use rustc_data_structures::{outline, sync};
1818use rustc_errors::{Diag, FatalError, StashKey};
19use rustc_span::{Span, DUMMY_SP};
19use rustc_span::{DUMMY_SP, Span};
2020use thin_vec::ThinVec;
2121use tracing::instrument;
2222
2323use super::QueryConfig;
24use crate::HandleCycleError;
2425use crate::dep_graph::{DepContext, DepGraphData, DepNode, DepNodeIndex, DepNodeParams};
2526use crate::ich::StableHashingContext;
2627use crate::query::caches::QueryCache;
2728#[cfg(parallel_compiler)]
2829use crate::query::job::QueryLatch;
29use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo};
30use crate::query::job::{QueryInfo, QueryJob, QueryJobId, QueryJobInfo, report_cycle};
3031use crate::query::{
3132 QueryContext, QueryMap, QuerySideEffects, QueryStackFrame, SerializedDepNodeIndex,
3233};
33use crate::HandleCycleError;
3434
3535pub struct QueryState<K> {
3636 active: Sharded<FxHashMap<K, QueryResult>>,
compiler/rustc_resolve/src/build_reduced_graph.rs+10-12
......@@ -17,24 +17,25 @@ use rustc_data_structures::sync::Lrc;
1717use rustc_expand::base::ResolverExpand;
1818use rustc_expand::expand::AstFragment;
1919use rustc_hir::def::{self, *};
20use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
20use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
2121use rustc_metadata::creader::LoadedMacro;
2222use rustc_middle::metadata::ModChild;
2323use rustc_middle::ty::Feed;
2424use rustc_middle::{bug, ty};
25use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind};
26use rustc_span::symbol::{kw, sym, Ident, Symbol};
2725use rustc_span::Span;
26use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind};
27use rustc_span::symbol::{Ident, Symbol, kw, sym};
2828use tracing::debug;
2929
30use crate::Namespace::{MacroNS, TypeNS, ValueNS};
3031use crate::def_collector::collect_definitions;
3132use crate::imports::{ImportData, ImportKind};
3233use crate::macros::{MacroRulesBinding, MacroRulesScope, MacroRulesScopeRef};
33use crate::Namespace::{MacroNS, TypeNS, ValueNS};
3434use crate::{
35 errors, BindingKey, Determinacy, ExternPreludeEntry, Finalize, MacroData, Module, ModuleKind,
35 BindingKey, Determinacy, ExternPreludeEntry, Finalize, MacroData, Module, ModuleKind,
3636 ModuleOrUniformRoot, NameBinding, NameBindingData, NameBindingKind, ParentScope, PathResult,
3737 ResolutionError, Resolver, ResolverArenas, Segment, ToNameBinding, Used, VisResolutionError,
38 errors,
3839};
3940
4041type Res = def::Res<NodeId>;
......@@ -565,13 +566,10 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> {
565566 Some(rename) => source.ident.span.to(rename.span),
566567 None => source.ident.span,
567568 };
568 self.r.report_error(
569 span,
570 ResolutionError::SelfImportsOnlyAllowedWithin {
571 root: parent.is_none(),
572 span_with_rename,
573 },
574 );
569 self.r.report_error(span, ResolutionError::SelfImportsOnlyAllowedWithin {
570 root: parent.is_none(),
571 span_with_rename,
572 });
575573
576574 // Error recovery: replace `use foo::self;` with `use foo;`
577575 if let Some(parent) = module_path.pop() {
compiler/rustc_resolve/src/check_unused.rs+4-4
......@@ -29,15 +29,15 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
2929use rustc_data_structures::unord::UnordSet;
3030use rustc_errors::MultiSpan;
3131use rustc_hir::def::{DefKind, Res};
32use rustc_session::lint::BuiltinLintDiag;
3233use rustc_session::lint::builtin::{
3334 MACRO_USE_EXTERN_CRATE, UNUSED_EXTERN_CRATES, UNUSED_IMPORTS, UNUSED_QUALIFICATIONS,
3435};
35use rustc_session::lint::BuiltinLintDiag;
36use rustc_span::symbol::{kw, Ident};
37use rustc_span::{Span, DUMMY_SP};
36use rustc_span::symbol::{Ident, kw};
37use rustc_span::{DUMMY_SP, Span};
3838
3939use crate::imports::{Import, ImportKind};
40use crate::{module_to_string, LexicalScopeBinding, NameBindingKind, Resolver};
40use crate::{LexicalScopeBinding, NameBindingKind, Resolver, module_to_string};
4141
4242struct UnusedImport {
4343 use_tree: ast::UseTree,
compiler/rustc_resolve/src/def_collector.rs+8-11
......@@ -7,9 +7,9 @@ use rustc_expand::expand::AstFragment;
77use rustc_hir as hir;
88use rustc_hir::def::{CtorKind, CtorOf, DefKind};
99use rustc_hir::def_id::LocalDefId;
10use rustc_span::hygiene::LocalExpnId;
11use rustc_span::symbol::{kw, sym, Symbol};
1210use rustc_span::Span;
11use rustc_span::hygiene::LocalExpnId;
12use rustc_span::symbol::{Symbol, kw, sym};
1313use tracing::debug;
1414
1515use crate::{ImplTraitContext, InvocationParent, PendingAnonConstInfo, Resolver};
......@@ -127,15 +127,12 @@ impl<'a, 'ra, 'tcx> DefCollector<'a, 'ra, 'tcx> {
127127 fn visit_macro_invoc(&mut self, id: NodeId) {
128128 let id = id.placeholder_to_expn_id();
129129 let pending_anon_const_info = self.pending_anon_const_info.take();
130 let old_parent = self.resolver.invocation_parents.insert(
131 id,
132 InvocationParent {
133 parent_def: self.parent_def,
134 pending_anon_const_info,
135 impl_trait_context: self.impl_trait_context,
136 in_attr: self.in_attr,
137 },
138 );
130 let old_parent = self.resolver.invocation_parents.insert(id, InvocationParent {
131 parent_def: self.parent_def,
132 pending_anon_const_info,
133 impl_trait_context: self.impl_trait_context,
134 in_attr: self.in_attr,
135 });
139136 assert!(old_parent.is_none(), "parent `LocalDefId` is reset for an invocation");
140137 }
141138
compiler/rustc_resolve/src/diagnostics.rs+22-18
......@@ -2,36 +2,36 @@ use rustc_ast::expand::StrippedCfgItem;
22use rustc_ast::ptr::P;
33use rustc_ast::visit::{self, Visitor};
44use rustc_ast::{
5 self as ast, Crate, ItemKind, MetaItemKind, ModKind, NestedMetaItem, NodeId, Path,
6 CRATE_NODE_ID,
5 self as ast, CRATE_NODE_ID, Crate, ItemKind, MetaItemKind, ModKind, NestedMetaItem, NodeId,
6 Path,
77};
88use rustc_ast_pretty::pprust;
99use rustc_data_structures::fx::FxHashSet;
1010use rustc_errors::codes::*;
1111use rustc_errors::{
12 report_ambiguity_error, struct_span_code_err, Applicability, Diag, DiagCtxtHandle,
13 ErrorGuaranteed, MultiSpan, SuggestionStyle,
12 Applicability, Diag, DiagCtxtHandle, ErrorGuaranteed, MultiSpan, SuggestionStyle,
13 report_ambiguity_error, struct_span_code_err,
1414};
1515use rustc_feature::BUILTIN_ATTRIBUTES;
16use rustc_hir::PrimTy;
1617use rustc_hir::def::Namespace::{self, *};
1718use rustc_hir::def::{self, CtorKind, CtorOf, DefKind, NonMacroAttrKind, PerNS};
18use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
19use rustc_hir::PrimTy;
19use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
2020use rustc_middle::bug;
2121use rustc_middle::ty::TyCtxt;
22use rustc_session::Session;
2223use rustc_session::lint::builtin::{
2324 ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE, AMBIGUOUS_GLOB_IMPORTS,
2425 MACRO_EXPANDED_MACRO_EXPORTS_ACCESSED_BY_ABSOLUTE_PATHS,
2526};
2627use rustc_session::lint::{AmbiguityErrorDiag, BuiltinLintDiag};
27use rustc_session::Session;
2828use rustc_span::edit_distance::find_best_match_for_name;
2929use rustc_span::edition::Edition;
3030use rustc_span::hygiene::MacroKind;
3131use rustc_span::source_map::SourceMap;
32use rustc_span::symbol::{kw, sym, Ident, Symbol};
32use rustc_span::symbol::{Ident, Symbol, kw, sym};
3333use rustc_span::{BytePos, Span, SyntaxContext};
34use thin_vec::{thin_vec, ThinVec};
34use thin_vec::{ThinVec, thin_vec};
3535use tracing::debug;
3636
3737use crate::errors::{
......@@ -41,11 +41,11 @@ use crate::errors::{
4141use crate::imports::{Import, ImportKind};
4242use crate::late::{PatternSource, Rib};
4343use crate::{
44 errors as errs, path_names_to_string, AmbiguityError, AmbiguityErrorMisc, AmbiguityKind,
45 BindingError, BindingKey, Finalize, HasGenericParams, LexicalScopeBinding, MacroRulesScope,
46 Module, ModuleKind, ModuleOrUniformRoot, NameBinding, NameBindingKind, ParentScope, PathResult,
47 PrivacyError, ResolutionError, Resolver, Scope, ScopeSet, Segment, UseError, Used,
48 VisResolutionError,
44 AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, BindingError, BindingKey, Finalize,
45 HasGenericParams, LexicalScopeBinding, MacroRulesScope, Module, ModuleKind,
46 ModuleOrUniformRoot, NameBinding, NameBindingKind, ParentScope, PathResult, PrivacyError,
47 ResolutionError, Resolver, Scope, ScopeSet, Segment, UseError, Used, VisResolutionError,
48 errors as errs, path_names_to_string,
4949};
5050
5151type Res = def::Res<ast::NodeId>;
......@@ -1002,10 +1002,14 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
10021002 VisResolutionError::AncestorOnly(span) => {
10031003 self.dcx().create_err(errs::AncestorOnly(span))
10041004 }
1005 VisResolutionError::FailedToResolve(span, label, suggestion) => self.into_struct_error(
1006 span,
1007 ResolutionError::FailedToResolve { segment: None, label, suggestion, module: None },
1008 ),
1005 VisResolutionError::FailedToResolve(span, label, suggestion) => {
1006 self.into_struct_error(span, ResolutionError::FailedToResolve {
1007 segment: None,
1008 label,
1009 suggestion,
1010 module: None,
1011 })
1012 }
10091013 VisResolutionError::ExpectedFound(span, path_str, res) => {
10101014 self.dcx().create_err(errs::ExpectedModuleFound { span, res, path_str })
10111015 }
compiler/rustc_resolve/src/effective_visibilities.rs+2-2
......@@ -1,9 +1,9 @@
11use std::mem;
22
33use rustc_ast::visit::Visitor;
4use rustc_ast::{ast, visit, Crate, EnumDef};
4use rustc_ast::{Crate, EnumDef, ast, visit};
55use rustc_data_structures::fx::FxHashSet;
6use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
6use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
77use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility, Level};
88use rustc_middle::ty::Visibility;
99use tracing::info;
compiler/rustc_resolve/src/errors.rs+2-2
......@@ -1,11 +1,11 @@
11use rustc_errors::codes::*;
22use rustc_errors::{Applicability, ElidedLifetimeInPathSubdiag, MultiSpan};
33use rustc_macros::{Diagnostic, Subdiagnostic};
4use rustc_span::symbol::{Ident, Symbol};
54use rustc_span::Span;
5use rustc_span::symbol::{Ident, Symbol};
66
7use crate::late::PatternSource;
87use crate::Res;
8use crate::late::PatternSource;
99
1010#[derive(Diagnostic)]
1111#[diag(resolve_generic_params_from_outer_item, code = E0401)]
compiler/rustc_resolve/src/ident.rs+30-43
......@@ -1,27 +1,27 @@
1use Determinacy::*;
2use Namespace::*;
13use rustc_ast::{self as ast, NodeId};
24use rustc_errors::ErrorGuaranteed;
35use rustc_hir::def::{DefKind, Namespace, NonMacroAttrKind, PartialRes, PerNS};
46use rustc_middle::{bug, ty};
5use rustc_session::lint::builtin::PROC_MACRO_DERIVE_RESOLUTION_FALLBACK;
67use rustc_session::lint::BuiltinLintDiag;
8use rustc_session::lint::builtin::PROC_MACRO_DERIVE_RESOLUTION_FALLBACK;
79use rustc_session::parse::feature_err;
810use rustc_span::def_id::LocalDefId;
911use rustc_span::hygiene::{ExpnId, ExpnKind, LocalExpnId, MacroKind, SyntaxContext};
10use rustc_span::symbol::{kw, Ident};
11use rustc_span::{sym, Span};
12use rustc_span::symbol::{Ident, kw};
13use rustc_span::{Span, sym};
1214use tracing::{debug, instrument};
13use Determinacy::*;
14use Namespace::*;
1515
1616use crate::errors::{ParamKindInEnumDiscriminant, ParamKindInNonTrivialAnonConst};
1717use crate::imports::Import;
1818use crate::late::{ConstantHasGenerics, NoConstantGenericsReason, PathSource, Rib, RibKind};
19use crate::macros::{sub_namespace_match, MacroRulesScope};
19use crate::macros::{MacroRulesScope, sub_namespace_match};
2020use crate::{
21 errors, AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, BindingKey, Determinacy, Finalize,
21 AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, BindingKey, Determinacy, Finalize,
2222 ImportKind, LexicalScopeBinding, Module, ModuleKind, ModuleOrUniformRoot, NameBinding,
2323 NameBindingKind, ParentScope, PathResult, PrivacyError, Res, ResolutionError, Resolver, Scope,
24 ScopeSet, Segment, ToNameBinding, Used, Weak,
24 ScopeSet, Segment, ToNameBinding, Used, Weak, errors,
2525};
2626
2727type Visibility = ty::Visibility<LocalDefId>;
......@@ -1218,25 +1218,21 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
12181218 }
12191219 Some(_) => None,
12201220 };
1221 (
1222 rib_ident.span,
1223 AttemptToUseNonConstantValueInConstant {
1224 ident: original_rib_ident_def,
1225 suggestion: "const",
1226 current: "let",
1227 type_span,
1228 },
1229 )
1221 (rib_ident.span, AttemptToUseNonConstantValueInConstant {
1222 ident: original_rib_ident_def,
1223 suggestion: "const",
1224 current: "let",
1225 type_span,
1226 })
12301227 }
1231 Some((ident, kind)) => (
1232 span,
1233 AttemptToUseNonConstantValueInConstant {
1228 Some((ident, kind)) => {
1229 (span, AttemptToUseNonConstantValueInConstant {
12341230 ident,
12351231 suggestion: "let",
12361232 current: kind.as_str(),
12371233 type_span: None,
1238 },
1239 ),
1234 })
1235 }
12401236 };
12411237 self.report_error(span, resolution_error);
12421238 }
......@@ -1244,13 +1240,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
12441240 }
12451241 RibKind::ConstParamTy => {
12461242 if let Some(span) = finalize {
1247 self.report_error(
1248 span,
1249 ParamInTyOfConstParam {
1250 name: rib_ident.name,
1251 param_kind: None,
1252 },
1253 );
1243 self.report_error(span, ParamInTyOfConstParam {
1244 name: rib_ident.name,
1245 param_kind: None,
1246 });
12541247 }
12551248 return Res::Err;
12561249 }
......@@ -1331,13 +1324,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
13311324 }
13321325 RibKind::ConstParamTy => {
13331326 if let Some(span) = finalize {
1334 self.report_error(
1335 span,
1336 ResolutionError::ParamInTyOfConstParam {
1337 name: rib_ident.name,
1338 param_kind: Some(errors::ParamKindInTyOfConstParam::Type),
1339 },
1340 );
1327 self.report_error(span, ResolutionError::ParamInTyOfConstParam {
1328 name: rib_ident.name,
1329 param_kind: Some(errors::ParamKindInTyOfConstParam::Type),
1330 });
13411331 }
13421332 return Res::Err;
13431333 }
......@@ -1400,13 +1390,10 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
14001390 }
14011391 RibKind::ConstParamTy => {
14021392 if let Some(span) = finalize {
1403 self.report_error(
1404 span,
1405 ResolutionError::ParamInTyOfConstParam {
1406 name: rib_ident.name,
1407 param_kind: Some(errors::ParamKindInTyOfConstParam::Const),
1408 },
1409 );
1393 self.report_error(span, ResolutionError::ParamInTyOfConstParam {
1394 name: rib_ident.name,
1395 param_kind: Some(errors::ParamKindInTyOfConstParam::Const),
1396 });
14101397 }
14111398 return Res::Err;
14121399 }
compiler/rustc_resolve/src/imports.rs+16-19
......@@ -7,36 +7,36 @@ use rustc_ast::NodeId;
77use rustc_data_structures::fx::FxHashSet;
88use rustc_data_structures::intern::Interned;
99use rustc_errors::codes::*;
10use rustc_errors::{pluralize, struct_span_code_err, Applicability, MultiSpan};
10use rustc_errors::{Applicability, MultiSpan, pluralize, struct_span_code_err};
1111use rustc_hir::def::{self, DefKind, PartialRes};
1212use rustc_hir::def_id::DefId;
1313use rustc_middle::metadata::{ModChild, Reexport};
1414use rustc_middle::{span_bug, ty};
15use rustc_session::lint::BuiltinLintDiag;
1516use rustc_session::lint::builtin::{
1617 AMBIGUOUS_GLOB_REEXPORTS, HIDDEN_GLOB_REEXPORTS, PUB_USE_OF_PRIVATE_EXTERN_CRATE,
1718 REDUNDANT_IMPORTS, UNUSED_IMPORTS,
1819};
19use rustc_session::lint::BuiltinLintDiag;
20use rustc_span::Span;
2021use rustc_span::edit_distance::find_best_match_for_name;
2122use rustc_span::hygiene::LocalExpnId;
22use rustc_span::symbol::{kw, Ident, Symbol};
23use rustc_span::Span;
23use rustc_span::symbol::{Ident, Symbol, kw};
2424use smallvec::SmallVec;
2525use tracing::debug;
2626
27use crate::diagnostics::{import_candidates, DiagMode, Suggestion};
27use crate::Determinacy::{self, *};
28use crate::Namespace::*;
29use crate::diagnostics::{DiagMode, Suggestion, import_candidates};
2830use crate::errors::{
2931 CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS, CannotBeReexportedPrivate,
3032 CannotBeReexportedPrivateNS, CannotDetermineImportResolution, CannotGlobImportAllCrates,
3133 ConsiderAddingMacroExport, ConsiderMarkingAsPub, IsNotDirectlyImportable,
3234 ItemsInTraitsAreNotImportable,
3335};
34use crate::Determinacy::{self, *};
35use crate::Namespace::*;
3636use crate::{
37 module_to_string, names_to_string, AmbiguityError, AmbiguityKind, BindingKey, Finalize,
38 ImportSuggestion, Module, ModuleOrUniformRoot, NameBinding, NameBindingData, NameBindingKind,
39 ParentScope, PathResult, PerNS, ResolutionError, Resolver, ScopeSet, Segment, Used,
37 AmbiguityError, AmbiguityKind, BindingKey, Finalize, ImportSuggestion, Module,
38 ModuleOrUniformRoot, NameBinding, NameBindingData, NameBindingKind, ParentScope, PathResult,
39 PerNS, ResolutionError, Resolver, ScopeSet, Segment, Used, module_to_string, names_to_string,
4040};
4141
4242type Res = def::Res<NodeId>;
......@@ -901,15 +901,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
901901 } => {
902902 if no_ambiguity {
903903 assert!(import.imported_module.get().is_none());
904 self.report_error(
905 span,
906 ResolutionError::FailedToResolve {
907 segment: Some(segment_name),
908 label,
909 suggestion,
910 module,
911 },
912 );
904 self.report_error(span, ResolutionError::FailedToResolve {
905 segment: Some(segment_name),
906 label,
907 suggestion,
908 module,
909 });
913910 }
914911 return None;
915912 }
compiler/rustc_resolve/src/late.rs+30-41
......@@ -8,19 +8,19 @@
88
99use std::assert_matches::debug_assert_matches;
1010use std::borrow::Cow;
11use std::collections::hash_map::Entry;
1211use std::collections::BTreeSet;
12use std::collections::hash_map::Entry;
1313use std::mem::{replace, swap, take};
1414
1515use rustc_ast::ptr::P;
16use rustc_ast::visit::{visit_opt, walk_list, AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor};
16use rustc_ast::visit::{AssocCtxt, BoundKind, FnCtxt, FnKind, Visitor, visit_opt, walk_list};
1717use rustc_ast::*;
1818use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
1919use rustc_errors::codes::*;
2020use rustc_errors::{Applicability, DiagArgValue, IntoDiagArg, StashKey, Suggestions};
2121use rustc_hir::def::Namespace::{self, *};
2222use rustc_hir::def::{self, CtorKind, DefKind, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS};
23use rustc_hir::def_id::{DefId, LocalDefId, CRATE_DEF_ID, LOCAL_CRATE};
23use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LOCAL_CRATE, LocalDefId};
2424use rustc_hir::{MissingLifetimeKind, PrimTy, TraitCandidate};
2525use rustc_middle::middle::resolve_bound_vars::Set1;
2626use rustc_middle::ty::DelegationFnSig;
......@@ -28,16 +28,16 @@ use rustc_middle::{bug, span_bug};
2828use rustc_session::config::{CrateType, ResolveDocLinks};
2929use rustc_session::lint::{self, BuiltinLintDiag};
3030use rustc_session::parse::feature_err;
31use rustc_span::source_map::{respan, Spanned};
32use rustc_span::symbol::{kw, sym, Ident, Symbol};
31use rustc_span::source_map::{Spanned, respan};
32use rustc_span::symbol::{Ident, Symbol, kw, sym};
3333use rustc_span::{BytePos, Span, SyntaxContext};
34use smallvec::{smallvec, SmallVec};
34use smallvec::{SmallVec, smallvec};
3535use tracing::{debug, instrument, trace};
3636
3737use crate::{
38 errors, path_names_to_string, rustdoc, BindingError, BindingKey, Finalize, LexicalScopeBinding,
39 Module, ModuleOrUniformRoot, NameBinding, ParentScope, PathResult, ResolutionError, Resolver,
40 Segment, TyCtxt, UseError, Used,
38 BindingError, BindingKey, Finalize, LexicalScopeBinding, Module, ModuleOrUniformRoot,
39 NameBinding, ParentScope, PathResult, ResolutionError, Resolver, Segment, TyCtxt, UseError,
40 Used, errors, path_names_to_string, rustdoc,
4141};
4242
4343mod diagnostics;
......@@ -1801,11 +1801,9 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
18011801 && Some(true) == self.diag_metadata.in_non_gat_assoc_type
18021802 && let crate::ModuleKind::Def(DefKind::Trait, trait_id, _) = module.kind
18031803 {
1804 if def_id_matches_path(
1805 self.r.tcx,
1806 trait_id,
1807 &["core", "iter", "traits", "iterator", "Iterator"],
1808 ) {
1804 if def_id_matches_path(self.r.tcx, trait_id, &[
1805 "core", "iter", "traits", "iterator", "Iterator",
1806 ]) {
18091807 self.r.dcx().emit_err(errors::LendingIteratorReportError {
18101808 lifetime: lifetime.ident.span,
18111809 ty: ty.span,
......@@ -3412,14 +3410,11 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
34123410
34133411 match seen_trait_items.entry(id_in_trait) {
34143412 Entry::Occupied(entry) => {
3415 self.report_error(
3416 span,
3417 ResolutionError::TraitImplDuplicate {
3418 name: ident.name,
3419 old_span: *entry.get(),
3420 trait_item_span: binding.span,
3421 },
3422 );
3413 self.report_error(span, ResolutionError::TraitImplDuplicate {
3414 name: ident.name,
3415 old_span: *entry.get(),
3416 trait_item_span: binding.span,
3417 });
34233418 return;
34243419 }
34253420 Entry::Vacant(entry) => {
......@@ -3450,16 +3445,13 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
34503445 }
34513446 };
34523447 let trait_path = path_names_to_string(path);
3453 self.report_error(
3454 span,
3455 ResolutionError::TraitImplMismatch {
3456 name: ident.name,
3457 kind,
3458 code,
3459 trait_path,
3460 trait_item_span: binding.span,
3461 },
3462 );
3448 self.report_error(span, ResolutionError::TraitImplMismatch {
3449 name: ident.name,
3450 kind,
3451 code,
3452 trait_path,
3453 trait_item_span: binding.span,
3454 });
34633455 }
34643456
34653457 fn resolve_const_body(&mut self, expr: &'ast Expr, item: Option<(Ident, ConstantItemKind)>) {
......@@ -4447,15 +4439,12 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
44474439 module,
44484440 segment_name,
44494441 } => {
4450 return Err(respan(
4451 span,
4452 ResolutionError::FailedToResolve {
4453 segment: Some(segment_name),
4454 label,
4455 suggestion,
4456 module,
4457 },
4458 ));
4442 return Err(respan(span, ResolutionError::FailedToResolve {
4443 segment: Some(segment_name),
4444 label,
4445 suggestion,
4446 module,
4447 }));
44594448 }
44604449 PathResult::Module(..) | PathResult::Failed { .. } => return Ok(None),
44614450 PathResult::Indeterminate => bug!("indeterminate path result in resolve_qpath"),
compiler/rustc_resolve/src/late/diagnostics.rs+26-32
......@@ -5,30 +5,30 @@ use std::iter;
55use std::ops::Deref;
66
77use rustc_ast::ptr::P;
8use rustc_ast::visit::{walk_ty, FnCtxt, FnKind, LifetimeCtxt, Visitor};
8use rustc_ast::visit::{FnCtxt, FnKind, LifetimeCtxt, Visitor, walk_ty};
99use rustc_ast::{
10 self as ast, AssocItemKind, Expr, ExprKind, GenericParam, GenericParamKind, Item, ItemKind,
11 MethodCall, NodeId, Path, Ty, TyKind, DUMMY_NODE_ID,
10 self as ast, AssocItemKind, DUMMY_NODE_ID, Expr, ExprKind, GenericParam, GenericParamKind,
11 Item, ItemKind, MethodCall, NodeId, Path, Ty, TyKind,
1212};
1313use rustc_ast_pretty::pprust::where_bound_predicate_to_string;
1414use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1515use rustc_errors::codes::*;
1616use rustc_errors::{
17 pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan,
18 SuggestionStyle,
17 Applicability, Diag, ErrorGuaranteed, MultiSpan, SuggestionStyle, pluralize,
18 struct_span_code_err,
1919};
2020use rustc_hir as hir;
2121use rustc_hir::def::Namespace::{self, *};
2222use rustc_hir::def::{self, CtorKind, CtorOf, DefKind};
23use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
23use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
2424use rustc_hir::{MissingLifetimeKind, PrimTy};
2525use rustc_middle::ty;
26use rustc_session::{lint, Session};
26use rustc_session::{Session, lint};
2727use rustc_span::edit_distance::find_best_match_for_name;
2828use rustc_span::edition::Edition;
2929use rustc_span::hygiene::MacroKind;
30use rustc_span::symbol::{kw, sym, Ident, Symbol};
31use rustc_span::{Span, DUMMY_SP};
30use rustc_span::symbol::{Ident, Symbol, kw, sym};
31use rustc_span::{DUMMY_SP, Span};
3232use thin_vec::ThinVec;
3333use tracing::debug;
3434
......@@ -40,8 +40,8 @@ use crate::late::{
4040};
4141use crate::ty::fast_reject::SimplifiedType;
4242use crate::{
43 errors, path_names_to_string, Module, ModuleKind, ModuleOrUniformRoot, PathResult, PathSource,
44 Segment,
43 Module, ModuleKind, ModuleOrUniformRoot, PathResult, PathSource, Segment, errors,
44 path_names_to_string,
4545};
4646
4747type Res = def::Res<ast::NodeId>;
......@@ -1017,15 +1017,12 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
10171017
10181018 debug!("smart_resolve_path_fragment: E0424, source={:?}", source);
10191019 err.code(E0424);
1020 err.span_label(
1021 span,
1022 match source {
1023 PathSource::Pat => {
1024 "`self` value is a keyword and may not be bound to variables or shadowed"
1025 }
1026 _ => "`self` value is a keyword only available in methods with a `self` parameter",
1027 },
1028 );
1020 err.span_label(span, match source {
1021 PathSource::Pat => {
1022 "`self` value is a keyword and may not be bound to variables or shadowed"
1023 }
1024 _ => "`self` value is a keyword only available in methods with a `self` parameter",
1025 });
10291026 let is_assoc_fn = self.self_type_is_available();
10301027 let self_from_macro = "a `self` parameter, but a macro invocation can only \
10311028 access identifiers it receives from parameters";
......@@ -2309,18 +2306,15 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
23092306 if module_def_id == def_id {
23102307 let path =
23112308 Path { span: name_binding.span, segments: path_segments, tokens: None };
2312 result = Some((
2313 module,
2314 ImportSuggestion {
2315 did: Some(def_id),
2316 descr: "module",
2317 path,
2318 accessible: true,
2319 doc_visible,
2320 note: None,
2321 via_import: false,
2322 },
2323 ));
2309 result = Some((module, ImportSuggestion {
2310 did: Some(def_id),
2311 descr: "module",
2312 path,
2313 accessible: true,
2314 doc_visible,
2315 note: None,
2316 via_import: false,
2317 }));
23242318 } else {
23252319 // add the module to the lookup
23262320 if seen_modules.insert(module_def_id) {
compiler/rustc_resolve/src/lib.rs+6-6
......@@ -40,8 +40,8 @@ use rustc_arena::{DroplessArena, TypedArena};
4040use rustc_ast::expand::StrippedCfgItem;
4141use rustc_ast::node_id::NodeMap;
4242use rustc_ast::{
43 self as ast, attr, AngleBracketedArg, Crate, Expr, ExprKind, GenericArg, GenericArgs, LitKind,
44 NodeId, Path, CRATE_NODE_ID,
43 self as ast, AngleBracketedArg, CRATE_NODE_ID, Crate, Expr, ExprKind, GenericArg, GenericArgs,
44 LitKind, NodeId, Path, attr,
4545};
4646use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet};
4747use rustc_data_structures::intern::Interned;
......@@ -54,7 +54,7 @@ use rustc_hir::def::Namespace::{self, *};
5454use rustc_hir::def::{
5555 self, CtorOf, DefKind, DocLinkResMap, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS,
5656};
57use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap, CRATE_DEF_ID, LOCAL_CRATE};
57use rustc_hir::def_id::{CRATE_DEF_ID, CrateNum, DefId, LOCAL_CRATE, LocalDefId, LocalDefIdMap};
5858use rustc_hir::{PrimTy, TraitCandidate};
5959use rustc_index::IndexVec;
6060use rustc_metadata::creader::{CStore, CrateLoader};
......@@ -70,9 +70,9 @@ use rustc_query_system::ich::StableHashingContext;
7070use rustc_session::lint::builtin::PRIVATE_MACRO_USE;
7171use rustc_session::lint::{BuiltinLintDiag, LintBuffer};
7272use rustc_span::hygiene::{ExpnId, LocalExpnId, MacroKind, SyntaxContext, Transparency};
73use rustc_span::symbol::{kw, sym, Ident, Symbol};
74use rustc_span::{Span, DUMMY_SP};
75use smallvec::{smallvec, SmallVec};
73use rustc_span::symbol::{Ident, Symbol, kw, sym};
74use rustc_span::{DUMMY_SP, Span};
75use smallvec::{SmallVec, smallvec};
7676use tracing::debug;
7777
7878type Res = def::Res<NodeId>;
compiler/rustc_resolve/src/macros.rs+12-15
......@@ -5,7 +5,7 @@ use std::cell::Cell;
55use std::mem;
66
77use rustc_ast::expand::StrippedCfgItem;
8use rustc_ast::{self as ast, attr, Crate, Inline, ItemKind, ModKind, NodeId};
8use rustc_ast::{self as ast, Crate, Inline, ItemKind, ModKind, NodeId, attr};
99use rustc_ast_pretty::pprust;
1010use rustc_attr::StabilityLevel;
1111use rustc_data_structures::intern::Interned;
......@@ -23,24 +23,24 @@ use rustc_hir::def::{self, DefKind, Namespace, NonMacroAttrKind};
2323use rustc_hir::def_id::{CrateNum, DefId, LocalDefId};
2424use rustc_middle::middle::stability;
2525use rustc_middle::ty::{RegisteredTools, TyCtxt, Visibility};
26use rustc_session::lint::BuiltinLintDiag;
2627use rustc_session::lint::builtin::{
2728 LEGACY_DERIVE_HELPERS, OUT_OF_SCOPE_MACRO_CALLS, SOFT_UNSTABLE,
28 UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_MACROS, UNUSED_MACRO_RULES,
29 UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, UNUSED_MACRO_RULES, UNUSED_MACROS,
2930};
30use rustc_session::lint::BuiltinLintDiag;
3131use rustc_session::parse::feature_err;
3232use rustc_span::edit_distance::edit_distance;
3333use rustc_span::edition::Edition;
3434use rustc_span::hygiene::{self, AstPass, ExpnData, ExpnKind, LocalExpnId, MacroKind};
35use rustc_span::symbol::{kw, sym, Ident, Symbol};
36use rustc_span::{Span, DUMMY_SP};
35use rustc_span::symbol::{Ident, Symbol, kw, sym};
36use rustc_span::{DUMMY_SP, Span};
3737
38use crate::Namespace::*;
3839use crate::errors::{
3940 self, AddAsNonDerive, CannotDetermineMacroResolution, CannotFindIdentInThisScope,
4041 MacroExpectedFound, RemoveSurroundingDerive,
4142};
4243use crate::imports::Import;
43use crate::Namespace::*;
4444use crate::{
4545 BindingKey, BuiltinMacroState, DeriveData, Determinacy, Finalize, InvocationParent, MacroData,
4646 ModuleKind, ModuleOrUniformRoot, NameBinding, NameBindingKind, ParentScope, PathResult,
......@@ -914,15 +914,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
914914 None,
915915 )
916916 };
917 self.report_error(
918 span,
919 ResolutionError::FailedToResolve {
920 segment: path.last().map(|segment| segment.ident.name),
921 label,
922 suggestion,
923 module,
924 },
925 );
917 self.report_error(span, ResolutionError::FailedToResolve {
918 segment: path.last().map(|segment| segment.ident.name),
919 label,
920 suggestion,
921 module,
922 });
926923 }
927924 PathResult::Module(..) | PathResult::Indeterminate => unreachable!(),
928925 }
compiler/rustc_resolve/src/rustdoc.rs+2-2
......@@ -9,8 +9,8 @@ use rustc_ast::util::comments::beautify_doc_string;
99use rustc_data_structures::fx::FxHashMap;
1010use rustc_middle::ty::TyCtxt;
1111use rustc_span::def_id::DefId;
12use rustc_span::symbol::{kw, sym, Symbol};
13use rustc_span::{InnerSpan, Span, DUMMY_SP};
12use rustc_span::symbol::{Symbol, kw, sym};
13use rustc_span::{DUMMY_SP, InnerSpan, Span};
1414use tracing::{debug, trace};
1515
1616#[derive(Clone, Copy, PartialEq, Eq, Debug)]
compiler/rustc_sanitizers/src/cfi/mod.rs+1-1
......@@ -3,4 +3,4 @@
33//! For more information about LLVM CFI and cross-language LLVM CFI support for the Rust compiler,
44//! see design document in the tracking issue #89653.
55pub mod typeid;
6pub use crate::cfi::typeid::{typeid_for_fnabi, typeid_for_instance, TypeIdOptions};
6pub use crate::cfi::typeid::{TypeIdOptions, typeid_for_fnabi, typeid_for_instance};
compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs+2-2
......@@ -7,7 +7,7 @@
77
88use std::fmt::Write as _;
99
10use rustc_data_structures::base_n::{ToBaseN, ALPHANUMERIC_ONLY, CASE_INSENSITIVE};
10use rustc_data_structures::base_n::{ALPHANUMERIC_ONLY, CASE_INSENSITIVE, ToBaseN};
1111use rustc_data_structures::fx::FxHashMap;
1212use rustc_hir as hir;
1313use rustc_middle::bug;
......@@ -22,8 +22,8 @@ use rustc_target::abi::Integer;
2222use rustc_target::spec::abi::Abi;
2323use tracing::instrument;
2424
25use crate::cfi::typeid::itanium_cxx_abi::transform::{TransformTy, TransformTyOptions};
2625use crate::cfi::typeid::TypeIdOptions;
26use crate::cfi::typeid::itanium_cxx_abi::transform::{TransformTy, TransformTyOptions};
2727
2828/// Options for encode_ty.
2929pub(crate) type EncodeTyOptions = TypeIdOptions;
compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/mod.rs+3-3
......@@ -12,11 +12,11 @@ use tracing::instrument;
1212
1313mod encode;
1414mod transform;
15use crate::cfi::typeid::itanium_cxx_abi::encode::{encode_ty, DictKey, EncodeTyOptions};
15use crate::cfi::typeid::TypeIdOptions;
16use crate::cfi::typeid::itanium_cxx_abi::encode::{DictKey, EncodeTyOptions, encode_ty};
1617use crate::cfi::typeid::itanium_cxx_abi::transform::{
17 transform_instance, TransformTy, TransformTyOptions,
18 TransformTy, TransformTyOptions, transform_instance,
1819};
19use crate::cfi::typeid::TypeIdOptions;
2020
2121/// Returns a type metadata identifier for the specified FnAbi using the Itanium C++ ABI with vendor
2222/// extended type qualifiers and types for Rust types that are not used at the FFI boundary.
compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs+1-1
......@@ -19,8 +19,8 @@ use rustc_span::sym;
1919use rustc_trait_selection::traits;
2020use tracing::{debug, instrument};
2121
22use crate::cfi::typeid::itanium_cxx_abi::encode::EncodeTyOptions;
2322use crate::cfi::typeid::TypeIdOptions;
23use crate::cfi::typeid::itanium_cxx_abi::encode::EncodeTyOptions;
2424
2525/// Options for transform_ty.
2626pub(crate) type TransformTyOptions = TypeIdOptions;
compiler/rustc_sanitizers/src/kcfi/mod.rs+1-1
......@@ -4,4 +4,4 @@
44//! For more information about LLVM KCFI and cross-language LLVM KCFI support for the Rust compiler,
55//! see the tracking issue #123479.
66pub mod typeid;
7pub use crate::kcfi::typeid::{typeid_for_fnabi, typeid_for_instance, TypeIdOptions};
7pub use crate::kcfi::typeid::{TypeIdOptions, typeid_for_fnabi, typeid_for_instance};
compiler/rustc_sanitizers/src/kcfi/typeid/mod.rs+1-1
......@@ -10,7 +10,7 @@ use rustc_middle::ty::{Instance, InstanceKind, ReifyReason, Ty, TyCtxt};
1010use rustc_target::abi::call::FnAbi;
1111use twox_hash::XxHash64;
1212
13pub use crate::cfi::typeid::{itanium_cxx_abi, TypeIdOptions};
13pub use crate::cfi::typeid::{TypeIdOptions, itanium_cxx_abi};
1414
1515/// Returns a KCFI type metadata identifier for the specified FnAbi.
1616pub fn typeid_for_fnabi<'tcx>(
compiler/rustc_serialize/tests/leb128.rs+2-2
......@@ -1,6 +1,6 @@
1use rustc_serialize::leb128::*;
2use rustc_serialize::opaque::{MemDecoder, MAGIC_END_BYTES};
31use rustc_serialize::Decoder;
2use rustc_serialize::leb128::*;
3use rustc_serialize::opaque::{MAGIC_END_BYTES, MemDecoder};
44
55macro_rules! impl_test_unsigned_leb128 {
66 ($test_name:ident, $write_fn_name:ident, $read_fn_name:ident, $int_ty:ident) => {
compiler/rustc_session/src/code_stats.rs+1-1
......@@ -2,8 +2,8 @@ use std::cmp;
22
33use rustc_data_structures::fx::{FxHashMap, FxHashSet};
44use rustc_data_structures::sync::Lock;
5use rustc_span::def_id::DefId;
65use rustc_span::Symbol;
6use rustc_span::def_id::DefId;
77use rustc_target::abi::{Align, Size};
88
99#[derive(Clone, PartialEq, Eq, Hash, Debug)]
compiler/rustc_session/src/config.rs+4-4
......@@ -20,10 +20,10 @@ use rustc_errors::emitter::HumanReadableErrorType;
2020use rustc_errors::{ColorConfig, DiagArgValue, DiagCtxtFlags, IntoDiagArg};
2121use rustc_feature::UnstableFeatures;
2222use rustc_macros::{Decodable, Encodable, HashStable_Generic};
23use rustc_span::edition::{Edition, DEFAULT_EDITION, EDITION_NAME_LIST, LATEST_STABLE_EDITION};
23use rustc_span::edition::{DEFAULT_EDITION, EDITION_NAME_LIST, Edition, LATEST_STABLE_EDITION};
2424use rustc_span::source_map::FilePathMapping;
2525use rustc_span::{
26 sym, FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm, Symbol,
26 FileName, FileNameDisplayPreference, RealFileName, SourceFileHashAlgorithm, Symbol, sym,
2727};
2828use rustc_target::spec::{
2929 FramePointer, LinkSelfContainedComponents, LinkerFeatures, SplitDebuginfo, Target, TargetTriple,
......@@ -34,7 +34,7 @@ use crate::errors::FileWriteFail;
3434pub use crate::options::*;
3535use crate::search_paths::SearchPath;
3636use crate::utils::{CanonicalizedPath, NativeLib, NativeLibKind};
37use crate::{filesearch, lint, EarlyDiagCtxt, HashStableContext, Session};
37use crate::{EarlyDiagCtxt, HashStableContext, Session, filesearch, lint};
3838
3939mod cfg;
4040pub mod sigpipe;
......@@ -3004,8 +3004,8 @@ pub(crate) mod dep_tracking {
30043004 use rustc_data_structures::stable_hasher::Hash64;
30053005 use rustc_errors::LanguageIdentifier;
30063006 use rustc_feature::UnstableFeatures;
3007 use rustc_span::edition::Edition;
30083007 use rustc_span::RealFileName;
3008 use rustc_span::edition::Edition;
30093009 use rustc_target::spec::{
30103010 CodeModel, FramePointer, MergeFunctions, OnBrokenPipe, PanicStrategy, RelocModel,
30113011 RelroLevel, SanitizerSet, SplitDebuginfo, StackProtector, TargetTriple, TlsModel, WasmCAbi,
compiler/rustc_session/src/config/cfg.rs+4-4
......@@ -25,14 +25,14 @@ use std::iter;
2525
2626use rustc_ast::ast;
2727use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexSet};
28use rustc_lint_defs::builtin::EXPLICIT_BUILTIN_CFGS_IN_FLAGS;
2928use rustc_lint_defs::BuiltinLintDiag;
30use rustc_span::symbol::{sym, Symbol};
29use rustc_lint_defs::builtin::EXPLICIT_BUILTIN_CFGS_IN_FLAGS;
30use rustc_span::symbol::{Symbol, sym};
3131use rustc_target::abi::Align;
32use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, Target, TargetTriple, TARGETS};
32use rustc_target::spec::{PanicStrategy, RelocModel, SanitizerSet, TARGETS, Target, TargetTriple};
3333
34use crate::config::{CrateType, FmtDebug};
3534use crate::Session;
35use crate::config::{CrateType, FmtDebug};
3636
3737/// The parsed `--cfg` options that define the compilation environment of the
3838/// crate, used to drive conditional compilation.
compiler/rustc_session/src/cstore.rs+2-2
......@@ -8,12 +8,12 @@ use std::path::PathBuf;
88use rustc_ast as ast;
99use rustc_data_structures::sync::{self, AppendOnlyIndexVec, FreezeLock};
1010use rustc_hir::def_id::{
11 CrateNum, DefId, LocalDefId, StableCrateId, StableCrateIdMap, LOCAL_CRATE,
11 CrateNum, DefId, LOCAL_CRATE, LocalDefId, StableCrateId, StableCrateIdMap,
1212};
1313use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, Definitions};
1414use rustc_macros::{Decodable, Encodable, HashStable_Generic};
15use rustc_span::symbol::Symbol;
1615use rustc_span::Span;
16use rustc_span::symbol::Symbol;
1717use rustc_target::spec::abi::Abi;
1818
1919use crate::search_paths::PathKind;
compiler/rustc_session/src/filesearch.rs+3-3
......@@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
44use std::{env, fs};
55
66use rustc_fs_util::{fix_windows_verbatim_for_gcc, try_canonicalize};
7use smallvec::{smallvec, SmallVec};
7use smallvec::{SmallVec, smallvec};
88
99use crate::search_paths::{PathKind, SearchPath};
1010
......@@ -121,11 +121,11 @@ fn current_dll_path() -> Result<PathBuf, String> {
121121 use std::io;
122122 use std::os::windows::prelude::*;
123123
124 use windows::core::PCWSTR;
125124 use windows::Win32::Foundation::HMODULE;
126125 use windows::Win32::System::LibraryLoader::{
127 GetModuleFileNameW, GetModuleHandleExW, GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
126 GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, GetModuleFileNameW, GetModuleHandleExW,
128127 };
128 use windows::core::PCWSTR;
129129
130130 let mut module = HMODULE::default();
131131 unsafe {
compiler/rustc_session/src/options.rs+1-1
......@@ -20,7 +20,7 @@ use rustc_target::spec::{
2020use crate::config::*;
2121use crate::search_paths::SearchPath;
2222use crate::utils::NativeLib;
23use crate::{lint, EarlyDiagCtxt};
23use crate::{EarlyDiagCtxt, lint};
2424
2525macro_rules! insert {
2626 ($opt_name:ident, $opt_expr:expr, $sub_hashes:expr) => {
compiler/rustc_session/src/output.rs+1-1
......@@ -7,12 +7,12 @@ use rustc_errors::FatalError;
77use rustc_span::symbol::sym;
88use rustc_span::{Span, Symbol};
99
10use crate::Session;
1011use crate::config::{self, CrateType, Input, OutFileName, OutputFilenames, OutputType};
1112use crate::errors::{
1213 self, CrateNameDoesNotMatch, CrateNameEmpty, CrateNameInvalid, FileIsNotWriteable,
1314 InvalidCharacterInCrateName, InvalidCrateNameHelp,
1415};
15use crate::Session;
1616
1717pub fn out_filename(
1818 sess: &Session,
compiler/rustc_session/src/parse.rs+5-5
......@@ -7,17 +7,18 @@ use rustc_ast::attr::AttrIdGenerator;
77use rustc_ast::node_id::NodeId;
88use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
99use rustc_data_structures::sync::{AppendOnlyVec, Lock, Lrc};
10use rustc_errors::emitter::{stderr_destination, HumanEmitter, SilentEmitter};
10use rustc_errors::emitter::{HumanEmitter, SilentEmitter, stderr_destination};
1111use rustc_errors::{
12 fallback_fluent_bundle, ColorConfig, Diag, DiagCtxt, DiagCtxtHandle, DiagMessage,
13 EmissionGuarantee, MultiSpan, StashKey,
12 ColorConfig, Diag, DiagCtxt, DiagCtxtHandle, DiagMessage, EmissionGuarantee, MultiSpan,
13 StashKey, fallback_fluent_bundle,
1414};
15use rustc_feature::{find_feature_issue, GateIssue, UnstableFeatures};
15use rustc_feature::{GateIssue, UnstableFeatures, find_feature_issue};
1616use rustc_span::edition::Edition;
1717use rustc_span::hygiene::ExpnId;
1818use rustc_span::source_map::{FilePathMapping, SourceMap};
1919use rustc_span::{Span, Symbol};
2020
21use crate::Session;
2122use crate::config::{Cfg, CheckCfg};
2223use crate::errors::{
2324 CliFeatureDiagnosticHelp, FeatureDiagnosticForIssue, FeatureDiagnosticHelp,
......@@ -25,7 +26,6 @@ use crate::errors::{
2526};
2627use crate::lint::builtin::UNSTABLE_SYNTAX_PRE_EXPANSION;
2728use crate::lint::{BufferedEarlyLint, BuiltinLintDiag, Lint, LintId};
28use crate::Session;
2929
3030/// Collected spans during parsing for places where a certain feature was
3131/// used and should be feature gated accordingly in `check_crate`.
compiler/rustc_session/src/search_paths.rs+1-1
......@@ -3,8 +3,8 @@ use std::path::{Path, PathBuf};
33use rustc_macros::{Decodable, Encodable, HashStable_Generic};
44use rustc_target::spec::TargetTriple;
55
6use crate::filesearch::make_target_lib_path;
76use crate::EarlyDiagCtxt;
7use crate::filesearch::make_target_lib_path;
88
99#[derive(Clone, Debug)]
1010pub struct SearchPath {
compiler/rustc_session/src/session.rs+5-5
......@@ -2,9 +2,9 @@ use std::any::Any;
22use std::ops::{Div, Mul};
33use std::path::{Path, PathBuf};
44use std::str::FromStr;
5use std::sync::Arc;
56use std::sync::atomic::AtomicBool;
67use std::sync::atomic::Ordering::SeqCst;
7use std::sync::Arc;
88use std::{env, fmt, io};
99
1010use rustc_data_structures::flock;
......@@ -16,12 +16,12 @@ use rustc_data_structures::sync::{
1616};
1717use rustc_errors::annotate_snippet_emitter_writer::AnnotateSnippetEmitter;
1818use rustc_errors::codes::*;
19use rustc_errors::emitter::{stderr_destination, DynEmitter, HumanEmitter, HumanReadableErrorType};
19use rustc_errors::emitter::{DynEmitter, HumanEmitter, HumanReadableErrorType, stderr_destination};
2020use rustc_errors::json::JsonEmitter;
2121use rustc_errors::registry::Registry;
2222use rustc_errors::{
23 fallback_fluent_bundle, Diag, DiagCtxt, DiagCtxtHandle, DiagMessage, Diagnostic,
24 ErrorGuaranteed, FatalAbort, FluentBundle, LazyFallbackBundle, TerminalUrl,
23 Diag, DiagCtxt, DiagCtxtHandle, DiagMessage, Diagnostic, ErrorGuaranteed, FatalAbort,
24 FluentBundle, LazyFallbackBundle, TerminalUrl, fallback_fluent_bundle,
2525};
2626use rustc_macros::HashStable_Generic;
2727pub use rustc_span::def_id::StableCrateId;
......@@ -41,7 +41,7 @@ use crate::config::{
4141 InstrumentCoverage, OptLevel, OutFileName, OutputType, RemapPathScopeComponents,
4242 SwitchWithOptPath,
4343};
44use crate::parse::{add_feature_diagnostics, ParseSess};
44use crate::parse::{ParseSess, add_feature_diagnostics};
4545use crate::search_paths::{PathKind, SearchPath};
4646use crate::{errors, filesearch, lint};
4747
compiler/rustc_session/src/version.rs+1-1
......@@ -2,7 +2,7 @@ use std::borrow::Cow;
22use std::fmt::{self, Display};
33
44use rustc_errors::IntoDiagArg;
5use rustc_macros::{current_rustc_version, Decodable, Encodable, HashStable_Generic};
5use rustc_macros::{Decodable, Encodable, HashStable_Generic, current_rustc_version};
66
77#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
88#[derive(HashStable_Generic)]
compiler/rustc_smir/src/rustc_internal/mod.rs+2-2
......@@ -13,12 +13,12 @@ use rustc_data_structures::fx::FxIndexMap;
1313use rustc_middle::mir::interpret::AllocId;
1414use rustc_middle::ty;
1515use rustc_middle::ty::TyCtxt;
16use rustc_span::def_id::{CrateNum, DefId};
1716use rustc_span::Span;
17use rustc_span::def_id::{CrateNum, DefId};
1818use scoped_tls::scoped_thread_local;
19use stable_mir::Error;
1920use stable_mir::abi::Layout;
2021use stable_mir::ty::IndexedVal;
21use stable_mir::Error;
2222
2323use crate::rustc_smir::context::TablesWrapper;
2424use crate::rustc_smir::{Stable, Tables};
compiler/rustc_smir/src/rustc_smir/alloc.rs+2-2
......@@ -1,8 +1,8 @@
1use rustc_middle::mir::interpret::{alloc_range, AllocRange, Pointer};
21use rustc_middle::mir::ConstValue;
2use rustc_middle::mir::interpret::{AllocRange, Pointer, alloc_range};
3use stable_mir::Error;
34use stable_mir::mir::Mutability;
45use stable_mir::ty::{Allocation, ProvenanceMap};
5use stable_mir::Error;
66
77use crate::rustc_smir::{Stable, Tables};
88
compiler/rustc_smir/src/rustc_smir/context.rs+1-1
......@@ -34,7 +34,7 @@ use stable_mir::{Crate, CrateDef, CrateItem, CrateNum, DefId, Error, Filename, I
3434
3535use crate::rustc_internal::RustcInternal;
3636use crate::rustc_smir::builder::BodyBuilder;
37use crate::rustc_smir::{alloc, new_item_kind, smir_crate, Stable, Tables};
37use crate::rustc_smir::{Stable, Tables, alloc, new_item_kind, smir_crate};
3838
3939impl<'tcx> Context for TablesWrapper<'tcx> {
4040 fn target_info(&self) -> MachineInfo {
compiler/rustc_smir/src/rustc_smir/convert/mir.rs+2-2
......@@ -6,9 +6,9 @@ use rustc_middle::{bug, mir};
66use stable_mir::mir::alloc::GlobalAlloc;
77use stable_mir::mir::{ConstOperand, Statement, UserTypeProjection, VarDebugInfoFragment};
88use stable_mir::ty::{Allocation, ConstantKind, MirConst};
9use stable_mir::{opaque, Error};
9use stable_mir::{Error, opaque};
1010
11use crate::rustc_smir::{alloc, Stable, Tables};
11use crate::rustc_smir::{Stable, Tables, alloc};
1212
1313impl<'tcx> Stable<'tcx> for mir::Body<'tcx> {
1414 type T = stable_mir::mir::Body;
compiler/rustc_smir/src/rustc_smir/convert/ty.rs+7-5
......@@ -6,7 +6,7 @@ use stable_mir::ty::{
66 AdtKind, FloatTy, GenericArgs, GenericParamDef, IntTy, Region, RigidTy, TyKind, UintTy,
77};
88
9use crate::rustc_smir::{alloc, Stable, Tables};
9use crate::rustc_smir::{Stable, Tables, alloc};
1010
1111impl<'tcx> Stable<'tcx> for ty::AliasTyKind {
1212 type T = stable_mir::ty::AliasKind;
......@@ -815,10 +815,12 @@ impl<'tcx> Stable<'tcx> for ty::RegionKind<'tcx> {
815815 index: early_reg.index,
816816 name: early_reg.name.to_string(),
817817 }),
818 ty::ReBound(db_index, bound_reg) => RegionKind::ReBound(
819 db_index.as_u32(),
820 BoundRegion { var: bound_reg.var.as_u32(), kind: bound_reg.kind.stable(tables) },
821 ),
818 ty::ReBound(db_index, bound_reg) => {
819 RegionKind::ReBound(db_index.as_u32(), BoundRegion {
820 var: bound_reg.var.as_u32(),
821 kind: bound_reg.kind.stable(tables),
822 })
823 }
822824 ty::ReStatic => RegionKind::ReStatic,
823825 ty::RePlaceholder(place_holder) => {
824826 RegionKind::RePlaceholder(stable_mir::ty::Placeholder {
compiler/rustc_span/src/def_id.rs+1-1
......@@ -1,12 +1,12 @@
11use std::fmt;
22use std::hash::{BuildHasherDefault, Hash, Hasher};
33
4use rustc_data_structures::AtomicRef;
45use rustc_data_structures::fingerprint::Fingerprint;
56use rustc_data_structures::stable_hasher::{
67 Hash64, HashStable, StableHasher, StableOrd, ToStableHashKey,
78};
89use rustc_data_structures::unhash::Unhasher;
9use rustc_data_structures::AtomicRef;
1010use rustc_index::Idx;
1111use rustc_macros::{Decodable, Encodable, HashStable_Generic};
1212use rustc_serialize::{Decodable, Encodable};
compiler/rustc_span/src/hygiene.rs+3-3
......@@ -39,10 +39,10 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3939use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
4040use tracing::{debug, trace};
4141
42use crate::def_id::{CrateNum, DefId, StableCrateId, CRATE_DEF_ID, LOCAL_CRATE};
42use crate::def_id::{CRATE_DEF_ID, CrateNum, DefId, LOCAL_CRATE, StableCrateId};
4343use crate::edition::Edition;
44use crate::symbol::{kw, sym, Symbol};
45use crate::{with_session_globals, HashStableContext, Span, SpanDecoder, SpanEncoder, DUMMY_SP};
44use crate::symbol::{Symbol, kw, sym};
45use crate::{DUMMY_SP, HashStableContext, Span, SpanDecoder, SpanEncoder, with_session_globals};
4646
4747/// A `SyntaxContext` represents a chain of pairs `(ExpnId, Transparency)` named "marks".
4848#[derive(Clone, Copy, PartialEq, Eq, Hash)]
compiler/rustc_span/src/lib.rs+5-5
......@@ -39,7 +39,7 @@
3939extern crate self as rustc_span;
4040
4141use derive_where::derive_where;
42use rustc_data_structures::{outline, AtomicRef};
42use rustc_data_structures::{AtomicRef, outline};
4343use rustc_macros::{Decodable, Encodable, HashStable_Generic};
4444use rustc_serialize::opaque::{FileEncoder, MemDecoder};
4545use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
......@@ -60,13 +60,13 @@ pub use hygiene::{
6060};
6161use rustc_data_structures::stable_hasher::HashingControls;
6262pub mod def_id;
63use def_id::{CrateNum, DefId, DefIndex, DefPathHash, LocalDefId, StableCrateId, LOCAL_CRATE};
63use def_id::{CrateNum, DefId, DefIndex, DefPathHash, LOCAL_CRATE, LocalDefId, StableCrateId};
6464pub mod edit_distance;
6565mod span_encoding;
66pub use span_encoding::{Span, DUMMY_SP};
66pub use span_encoding::{DUMMY_SP, Span};
6767
6868pub mod symbol;
69pub use symbol::{sym, Symbol};
69pub use symbol::{Symbol, sym};
7070
7171mod analyze_source_file;
7272pub mod fatal_error;
......@@ -83,7 +83,7 @@ use std::{fmt, iter};
8383
8484use md5::{Digest, Md5};
8585use rustc_data_structures::fx::FxHashMap;
86use rustc_data_structures::stable_hasher::{Hash128, Hash64, HashStable, StableHasher};
86use rustc_data_structures::stable_hasher::{Hash64, Hash128, HashStable, StableHasher};
8787use rustc_data_structures::sync::{FreezeLock, FreezeWriteGuard, Lock, Lrc};
8888use sha1::Sha1;
8989use sha2::Sha256;
compiler/rustc_span/src/span_encoding.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_serialize::int_overflow::DebugStrictAdd;
55
66use crate::def_id::{DefIndex, LocalDefId};
77use crate::hygiene::SyntaxContext;
8use crate::{BytePos, SpanData, SPAN_TRACK};
8use crate::{BytePos, SPAN_TRACK, SpanData};
99
1010/// A compressed span.
1111///
compiler/rustc_span/src/symbol.rs+3-3
......@@ -11,9 +11,9 @@ use rustc_data_structures::stable_hasher::{
1111 HashStable, StableCompare, StableHasher, ToStableHashKey,
1212};
1313use rustc_data_structures::sync::Lock;
14use rustc_macros::{symbols, Decodable, Encodable, HashStable_Generic};
14use rustc_macros::{Decodable, Encodable, HashStable_Generic, symbols};
1515
16use crate::{with_session_globals, Edition, Span, DUMMY_SP};
16use crate::{DUMMY_SP, Edition, Span, with_session_globals};
1717
1818#[cfg(test)]
1919mod tests;
......@@ -2523,10 +2523,10 @@ pub mod kw {
25232523/// For example `sym::rustfmt` or `sym::u8`.
25242524pub mod sym {
25252525 // Used from a macro in `librustc_feature/accepted.rs`
2526 use super::Symbol;
25262527 pub use super::kw::MacroRules as macro_rules;
25272528 #[doc(inline)]
25282529 pub use super::sym_generated::*;
2529 use super::Symbol;
25302530
25312531 /// Get the symbol for an integer.
25322532 ///
compiler/rustc_symbol_mangling/src/test.rs+1-1
......@@ -7,7 +7,7 @@
77use rustc_hir::def_id::LocalDefId;
88use rustc_middle::ty::print::with_no_trimmed_paths;
99use rustc_middle::ty::{GenericArgs, Instance, TyCtxt};
10use rustc_span::symbol::{sym, Symbol};
10use rustc_span::symbol::{Symbol, sym};
1111
1212use crate::errors::{Kind, TestOutput};
1313
compiler/rustc_target/src/abi/mod.rs+2-2
......@@ -1,11 +1,11 @@
11use std::fmt;
22use std::ops::Deref;
33
4use rustc_data_structures::intern::Interned;
5use rustc_macros::HashStable_Generic;
64pub use Float::*;
75pub use Integer::*;
86pub use Primitive::*;
7use rustc_data_structures::intern::Interned;
8use rustc_macros::HashStable_Generic;
99
1010use crate::json::{Json, ToJson};
1111
compiler/rustc_target/src/asm/arm.rs+1-1
......@@ -1,7 +1,7 @@
11use std::fmt;
22
33use rustc_data_structures::fx::FxIndexSet;
4use rustc_span::{sym, Symbol};
4use rustc_span::{Symbol, sym};
55
66use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
77use crate::spec::{RelocModel, Target};
compiler/rustc_target/src/asm/riscv.rs+1-1
......@@ -1,7 +1,7 @@
11use std::fmt;
22
33use rustc_data_structures::fx::FxIndexSet;
4use rustc_span::{sym, Symbol};
4use rustc_span::{Symbol, sym};
55
66use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
77use crate::spec::{RelocModel, Target};
compiler/rustc_target/src/json.rs+1-1
......@@ -2,7 +2,7 @@ use std::borrow::Cow;
22use std::collections::BTreeMap;
33
44pub use serde_json::Value as Json;
5use serde_json::{json, Map, Number};
5use serde_json::{Map, Number, json};
66
77use crate::spec::TargetMetadata;
88
compiler/rustc_target/src/spec/base/aix.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{crt_objects, cvs, Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions};
2use crate::spec::{Cc, CodeModel, LinkOutputKind, LinkerFlavor, TargetOptions, crt_objects, cvs};
33
44pub(crate) fn opts() -> TargetOptions {
55 TargetOptions {
compiler/rustc_target/src/spec/base/android.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, TargetOptions, TlsModel};
1use crate::spec::{SanitizerSet, TargetOptions, TlsModel, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 let mut base = base::linux::opts();
compiler/rustc_target/src/spec/base/apple/mod.rs+6-7
......@@ -3,8 +3,8 @@ use std::env;
33use std::num::ParseIntError;
44
55use crate::spec::{
6 add_link_args, add_link_args_iter, cvs, Cc, DebuginfoKind, FramePointer, LinkArgs,
7 LinkerFlavor, Lld, SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions,
6 Cc, DebuginfoKind, FramePointer, LinkArgs, LinkerFlavor, Lld, SplitDebuginfo, StackProbeType,
7 StaticCow, Target, TargetOptions, add_link_args, add_link_args_iter, cvs,
88};
99
1010#[cfg(test)]
......@@ -190,11 +190,10 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: TargetAbi) -> LinkArgs {
190190 //
191191 // CC forwards the `-arch` to the linker, so we use the same value
192192 // here intentionally.
193 add_link_args(
194 &mut args,
195 LinkerFlavor::Darwin(Cc::Yes, Lld::No),
196 &["-arch", arch.ld_arch()],
197 );
193 add_link_args(&mut args, LinkerFlavor::Darwin(Cc::Yes, Lld::No), &[
194 "-arch",
195 arch.ld_arch(),
196 ]);
198197 // The presence of `-mmacosx-version-min` makes CC default to macOS,
199198 // and it sets the deployment target.
200199 let (major, minor, patch) = deployment_target(os, arch, abi);
compiler/rustc_target/src/spec/base/apple/tests.rs+5-8
......@@ -33,14 +33,11 @@ fn macos_link_environment_unmodified() {
3333 for target in all_macos_targets {
3434 // macOS targets should only remove information for cross-compiling, but never
3535 // for the host.
36 assert_eq!(
37 target.link_env_remove,
38 crate::spec::cvs![
39 "IPHONEOS_DEPLOYMENT_TARGET",
40 "TVOS_DEPLOYMENT_TARGET",
41 "XROS_DEPLOYMENT_TARGET"
42 ],
43 );
36 assert_eq!(target.link_env_remove, crate::spec::cvs![
37 "IPHONEOS_DEPLOYMENT_TARGET",
38 "TVOS_DEPLOYMENT_TARGET",
39 "XROS_DEPLOYMENT_TARGET"
40 ],);
4441 }
4542}
4643
compiler/rustc_target/src/spec/base/avr_gnu.rs+3-4
......@@ -26,10 +26,9 @@ pub(crate) fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
2626 linker: Some("avr-gcc".into()),
2727 eh_frame_header: false,
2828 pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[mmcu]),
29 late_link_args: TargetOptions::link_args(
30 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
31 &["-lgcc"],
32 ),
29 late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
30 "-lgcc",
31 ]),
3332 max_atomic_width: Some(16),
3433 atomic_cas: false,
3534 relocation_model: RelocModel::Static,
compiler/rustc_target/src/spec/base/dragonfly.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, RelroLevel, TargetOptions};
1use crate::spec::{RelroLevel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, RelroLevel, TargetOptions};
1use crate::spec::{RelroLevel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/fuchsia.rs+14-17
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 crt_objects, cvs, Cc, FramePointer, LinkOutputKind, LinkerFlavor, Lld, TargetOptions,
2 Cc, FramePointer, LinkOutputKind, LinkerFlavor, Lld, TargetOptions, crt_objects, cvs,
33};
44
55pub(crate) fn opts() -> TargetOptions {
......@@ -8,22 +8,19 @@ pub(crate) fn opts() -> TargetOptions {
88 // so we only list them for ld/lld.
99 //
1010 // https://github.com/llvm/llvm-project/blob/db9322b2066c55254e7691efeab863f43bfcc084/clang/lib/Driver/ToolChains/Fuchsia.cpp#L31
11 let pre_link_args = TargetOptions::link_args(
12 LinkerFlavor::Gnu(Cc::No, Lld::No),
13 &[
14 "--build-id",
15 "--hash-style=gnu",
16 "-z",
17 "max-page-size=4096",
18 "-z",
19 "now",
20 "-z",
21 "rodynamic",
22 "-z",
23 "separate-loadable-segments",
24 "--pack-dyn-relocs=relr",
25 ],
26 );
11 let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
12 "--build-id",
13 "--hash-style=gnu",
14 "-z",
15 "max-page-size=4096",
16 "-z",
17 "now",
18 "-z",
19 "rodynamic",
20 "-z",
21 "separate-loadable-segments",
22 "--pack-dyn-relocs=relr",
23 ]);
2724
2825 TargetOptions {
2926 os: "fuchsia".into(),
compiler/rustc_target/src/spec/base/haiku.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, RelroLevel, TargetOptions};
1use crate::spec::{RelroLevel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/hurd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, RelroLevel, TargetOptions};
1use crate::spec::{RelroLevel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/hurd_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, TargetOptions};
1use crate::spec::{TargetOptions, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions { env: "gnu".into(), ..base::hurd::opts() }
compiler/rustc_target/src/spec/base/illumos.rs+20-23
......@@ -1,28 +1,25 @@
1use crate::spec::{cvs, Cc, FramePointer, LinkerFlavor, TargetOptions};
1use crate::spec::{Cc, FramePointer, LinkerFlavor, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
4 let late_link_args = TargetOptions::link_args(
5 LinkerFlavor::Unix(Cc::Yes),
6 &[
7 // The illumos libc contains a stack unwinding implementation, as
8 // does libgcc_s. The latter implementation includes several
9 // additional symbols that are not always in base libc. To force
10 // the consistent use of just one unwinder, we ensure libc appears
11 // after libgcc_s in the NEEDED list for the resultant binary by
12 // ignoring any attempts to add it as a dynamic dependency until the
13 // very end.
14 // FIXME: This should be replaced by a more complete and generic
15 // mechanism for controlling the order of library arguments passed
16 // to the linker.
17 "-lc",
18 // LLVM will insert calls to the stack protector functions
19 // "__stack_chk_fail" and "__stack_chk_guard" into code in native
20 // object files. Some platforms include these symbols directly in
21 // libc, but at least historically these have been provided in
22 // libssp.so on illumos and Solaris systems.
23 "-lssp",
24 ],
25 );
4 let late_link_args = TargetOptions::link_args(LinkerFlavor::Unix(Cc::Yes), &[
5 // The illumos libc contains a stack unwinding implementation, as
6 // does libgcc_s. The latter implementation includes several
7 // additional symbols that are not always in base libc. To force
8 // the consistent use of just one unwinder, we ensure libc appears
9 // after libgcc_s in the NEEDED list for the resultant binary by
10 // ignoring any attempts to add it as a dynamic dependency until the
11 // very end.
12 // FIXME: This should be replaced by a more complete and generic
13 // mechanism for controlling the order of library arguments passed
14 // to the linker.
15 "-lc",
16 // LLVM will insert calls to the stack protector functions
17 // "__stack_chk_fail" and "__stack_chk_guard" into code in native
18 // object files. Some platforms include these symbols directly in
19 // libc, but at least historically these have been provided in
20 // libssp.so on illumos and Solaris systems.
21 "-lssp",
22 ]);
2623
2724 TargetOptions {
2825 os: "illumos".into(),
compiler/rustc_target/src/spec/base/l4re.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, PanicStrategy, RelocModel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/linux.rs+1-1
......@@ -1,6 +1,6 @@
11use std::borrow::Cow;
22
3use crate::spec::{cvs, RelroLevel, SplitDebuginfo, TargetOptions};
3use crate::spec::{RelroLevel, SplitDebuginfo, TargetOptions, cvs};
44
55pub(crate) fn opts() -> TargetOptions {
66 TargetOptions {
compiler/rustc_target/src/spec/base/linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, TargetOptions};
1use crate::spec::{TargetOptions, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions { env: "gnu".into(), ..base::linux::opts() }
compiler/rustc_target/src/spec/base/linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, crt_objects, LinkSelfContainedDefault, TargetOptions};
1use crate::spec::{LinkSelfContainedDefault, TargetOptions, base, crt_objects};
22
33pub(crate) fn opts() -> TargetOptions {
44 let mut base = base::linux::opts();
compiler/rustc_target/src/spec/base/linux_ohos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, TargetOptions, TlsModel};
1use crate::spec::{TargetOptions, TlsModel, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 let mut base = base::linux::opts();
compiler/rustc_target/src/spec/base/linux_uclibc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, TargetOptions};
1use crate::spec::{TargetOptions, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions { env: "uclibc".into(), ..base::linux::opts() }
compiler/rustc_target/src/spec/base/netbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, RelroLevel, TargetOptions};
1use crate::spec::{RelroLevel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/nto_qnx.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, RelroLevel, TargetOptions};
1use crate::spec::{RelroLevel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/openbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, FramePointer, RelroLevel, TargetOptions, TlsModel};
1use crate::spec::{FramePointer, RelroLevel, TargetOptions, TlsModel, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/redox.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelroLevel, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, RelroLevel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/solaris.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/teeos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{add_link_args, Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelroLevel, TargetOptions, add_link_args};
22
33pub(crate) fn opts() -> TargetOptions {
44 let lld_args = &["-zmax-page-size=4096", "-znow", "-ztext", "--execute-only"];
compiler/rustc_target/src/spec/base/uefi_msvc.rs+17-20
......@@ -9,30 +9,27 @@
99// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all
1010// code runs in the same environment, no process separation is supported.
1111
12use crate::spec::{base, LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions};
12use crate::spec::{LinkerFlavor, Lld, PanicStrategy, StackProbeType, TargetOptions, base};
1313
1414pub(crate) fn opts() -> TargetOptions {
1515 let mut base = base::msvc::opts();
1616
17 base.add_pre_link_args(
18 LinkerFlavor::Msvc(Lld::No),
19 &[
20 // Non-standard subsystems have no default entry-point in PE+ files. We have to define
21 // one. "efi_main" seems to be a common choice amongst other implementations and the
22 // spec.
23 "/entry:efi_main",
24 // COFF images have a "Subsystem" field in their header, which defines what kind of
25 // program it is. UEFI has 3 fields reserved, which are EFI_APPLICATION,
26 // EFI_BOOT_SERVICE_DRIVER, and EFI_RUNTIME_DRIVER. We default to EFI_APPLICATION,
27 // which is very likely the most common option. Individual projects can override this
28 // with custom linker flags.
29 // The subsystem-type only has minor effects on the application. It defines the memory
30 // regions the application is loaded into (runtime-drivers need to be put into
31 // reserved areas), as well as whether a return from the entry-point is treated as
32 // exit (default for applications).
33 "/subsystem:efi_application",
34 ],
35 );
17 base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &[
18 // Non-standard subsystems have no default entry-point in PE+ files. We have to define
19 // one. "efi_main" seems to be a common choice amongst other implementations and the
20 // spec.
21 "/entry:efi_main",
22 // COFF images have a "Subsystem" field in their header, which defines what kind of
23 // program it is. UEFI has 3 fields reserved, which are EFI_APPLICATION,
24 // EFI_BOOT_SERVICE_DRIVER, and EFI_RUNTIME_DRIVER. We default to EFI_APPLICATION,
25 // which is very likely the most common option. Individual projects can override this
26 // with custom linker flags.
27 // The subsystem-type only has minor effects on the application. It defines the memory
28 // regions the application is loaded into (runtime-drivers need to be put into
29 // reserved areas), as well as whether a return from the entry-point is treated as
30 // exit (default for applications).
31 "/subsystem:efi_application",
32 ]);
3633
3734 TargetOptions {
3835 os: "uefi".into(),
compiler/rustc_target/src/spec/base/unikraft_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, PanicStrategy, RelocModel, TargetOptions};
1use crate::spec::{PanicStrategy, RelocModel, TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/vxworks.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, TargetOptions};
1use crate::spec::{TargetOptions, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 TargetOptions {
compiler/rustc_target/src/spec/base/wasm.rs+2-2
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 add_link_args, cvs, Cc, LinkSelfContainedDefault, LinkerFlavor, PanicStrategy, RelocModel,
3 TargetOptions, TlsModel,
2 Cc, LinkSelfContainedDefault, LinkerFlavor, PanicStrategy, RelocModel, TargetOptions, TlsModel,
3 add_link_args, cvs,
44};
55
66pub(crate) fn options() -> TargetOptions {
compiler/rustc_target/src/spec/base/windows_gnu.rs+15-22
......@@ -1,31 +1,24 @@
11use std::borrow::Cow;
22
33use crate::spec::{
4 add_link_args, crt_objects, cvs, Cc, DebuginfoKind, LinkSelfContainedDefault, LinkerFlavor,
5 Lld, SplitDebuginfo, TargetOptions,
4 Cc, DebuginfoKind, LinkSelfContainedDefault, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions,
5 add_link_args, crt_objects, cvs,
66};
77
88pub(crate) fn opts() -> TargetOptions {
9 let mut pre_link_args = TargetOptions::link_args(
10 LinkerFlavor::Gnu(Cc::No, Lld::No),
11 &[
12 // Enable ASLR
13 "--dynamicbase",
14 // ASLR will rebase it anyway so leaving that option enabled only leads to confusion
15 "--disable-auto-image-base",
16 ],
17 );
18 add_link_args(
19 &mut pre_link_args,
20 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
21 &[
22 // Tell GCC to avoid linker plugins, because we are not bundling
23 // them with Windows installer, and Rust does its own LTO anyways.
24 "-fno-use-linker-plugin",
25 "-Wl,--dynamicbase",
26 "-Wl,--disable-auto-image-base",
27 ],
28 );
9 let mut pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
10 // Enable ASLR
11 "--dynamicbase",
12 // ASLR will rebase it anyway so leaving that option enabled only leads to confusion
13 "--disable-auto-image-base",
14 ]);
15 add_link_args(&mut pre_link_args, LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
16 // Tell GCC to avoid linker plugins, because we are not bundling
17 // them with Windows installer, and Rust does its own LTO anyways.
18 "-fno-use-linker-plugin",
19 "-Wl,--dynamicbase",
20 "-Wl,--disable-auto-image-base",
21 ]);
2922
3023 // Order of `late_link_args*` was found through trial and error to work with various
3124 // mingw-w64 versions (not tested on the CI). It's expected to change from time to time.
compiler/rustc_target/src/spec/base/windows_gnullvm.rs+12-9
......@@ -1,21 +1,24 @@
11use std::borrow::Cow;
22
3use crate::spec::{cvs, Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions};
3use crate::spec::{Cc, DebuginfoKind, LinkerFlavor, Lld, SplitDebuginfo, TargetOptions, cvs};
44
55pub(crate) fn opts() -> TargetOptions {
66 // We cannot use `-nodefaultlibs` because compiler-rt has to be passed
77 // as a path since it's not added to linker search path by the default.
88 // There were attempts to make it behave like libgcc (so one can just use -l<name>)
99 // but LLVM maintainers rejected it: https://reviews.llvm.org/D51440
10 let pre_link_args = TargetOptions::link_args(
11 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
12 &["-nolibc", "--unwindlib=none"],
13 );
10 let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
11 "-nolibc",
12 "--unwindlib=none",
13 ]);
1414 // Order of `late_link_args*` does not matter with LLD.
15 let late_link_args = TargetOptions::link_args(
16 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
17 &["-lmingw32", "-lmingwex", "-lmsvcrt", "-lkernel32", "-luser32"],
18 );
15 let late_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
16 "-lmingw32",
17 "-lmingwex",
18 "-lmsvcrt",
19 "-lkernel32",
20 "-luser32",
21 ]);
1922
2023 TargetOptions {
2124 os: "windows".into(),
compiler/rustc_target/src/spec/base/windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, cvs, TargetOptions};
1use crate::spec::{TargetOptions, base, cvs};
22
33pub(crate) fn opts() -> TargetOptions {
44 let base = base::msvc::opts();
compiler/rustc_target/src/spec/base/windows_uwp_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{add_link_args, base, Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions};
1use crate::spec::{Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions, add_link_args, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 let base = base::windows_gnu::opts();
compiler/rustc_target/src/spec/base/windows_uwp_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, LinkerFlavor, Lld, TargetOptions};
1use crate::spec::{LinkerFlavor, Lld, TargetOptions, base};
22
33pub(crate) fn opts() -> TargetOptions {
44 let mut opts = base::windows_msvc::opts();
compiler/rustc_target/src/spec/mod.rs+5-5
......@@ -45,7 +45,7 @@ use std::{fmt, io};
4545use rustc_fs_util::try_canonicalize;
4646use rustc_macros::{Decodable, Encodable, HashStable_Generic};
4747use rustc_serialize::{Decodable, Decoder, Encodable, Encoder};
48use rustc_span::symbol::{kw, sym, Symbol};
48use rustc_span::symbol::{Symbol, kw, sym};
4949use serde_json::Value;
5050use tracing::debug;
5151
......@@ -3389,10 +3389,10 @@ impl Target {
33893389
33903390 // Each field should have been read using `Json::remove` so any keys remaining are unused.
33913391 let remaining_keys = obj.keys();
3392 Ok((
3393 base,
3394 TargetWarnings { unused_fields: remaining_keys.cloned().collect(), incorrect_type },
3395 ))
3392 Ok((base, TargetWarnings {
3393 unused_fields: remaining_keys.cloned().collect(),
3394 incorrect_type,
3395 }))
33963396 }
33973397
33983398 /// Load a built-in target
compiler/rustc_target/src/spec/targets/aarch64_apple_darwin.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_ios.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_ios_macabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_ios_sim.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_tvos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_tvos_sim.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_visionos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_visionos_sim.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_watchos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_apple_watchos_sim.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, StackProbeType, Target, TargetOptions};
2use crate::spec::{StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/aarch64_be_unknown_linux_gnu_ilp32.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, StackProbeType, Target, TargetOptions};
2use crate::spec::{StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/aarch64_be_unknown_netbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, StackProbeType, Target, TargetOptions};
2use crate::spec::{StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/aarch64_kmc_solid_asp3.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, RelocModel, StackProbeType, Target, TargetOptions};
1use crate::spec::{RelocModel, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let base = base::solid::opts("asp3");
compiler/rustc_target/src/spec/targets/aarch64_linux_android.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
1use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base};
22
33// See https://developer.android.com/ndk/guides/abis.html#arm64-v8a
44// for target ABI requirements.
compiler/rustc_target/src/spec/targets/aarch64_pc_windows_gnullvm.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target};
1use crate::spec::{Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_gnullvm::opts();
compiler/rustc_target/src/spec/targets/aarch64_pc_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target};
1use crate::spec::{Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
compiler/rustc_target/src/spec/targets/aarch64_unknown_freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
1use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/aarch64_unknown_fuchsia.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
1use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/aarch64_unknown_hermit.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target, TargetOptions};
1use crate::spec::{StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/aarch64_unknown_illumos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, Target};
1use crate::spec::{Cc, LinkerFlavor, SanitizerSet, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::illumos::opts();
compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
1use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu_ilp32.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target, TargetOptions};
1use crate::spec::{StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
1use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_ohos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
1use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_ohos::opts();
compiler/rustc_target/src/spec/targets/aarch64_unknown_netbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target, TargetOptions};
1use crate::spec::{StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/aarch64_unknown_none.rs+3-4
......@@ -16,10 +16,9 @@ pub(crate) fn target() -> Target {
1616 linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
1717 linker: Some("rust-lld".into()),
1818 // Enable the Cortex-A53 errata 843419 mitigation by default
19 pre_link_args: TargetOptions::link_args(
20 LinkerFlavor::Gnu(Cc::No, Lld::No),
21 &["--fix-cortex-a53-843419"],
22 ),
19 pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
20 "--fix-cortex-a53-843419",
21 ]),
2322 features: "+v8a,+strict-align,+neon,+fp-armv8".into(),
2423 supported_sanitizers: SanitizerSet::KCFI | SanitizerSet::KERNELADDRESS,
2524 relocation_model: RelocModel::Static,
compiler/rustc_target/src/spec/targets/aarch64_unknown_nto_qnx700.rs+4-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 // In QNX, libc does not provide a compatible ABI between versions.
......@@ -27,10 +27,9 @@ pub(crate) fn target() -> Target {
2727 options: TargetOptions {
2828 features: "+v8a".into(),
2929 max_atomic_width: Some(128),
30 pre_link_args: TargetOptions::link_args(
31 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
32 &["-Vgcc_ntoaarch64le_cxx"],
33 ),
30 pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
31 "-Vgcc_ntoaarch64le_cxx",
32 ]),
3433 env: "nto70".into(),
3534 ..base::nto_qnx::opts()
3635 },
compiler/rustc_target/src/spec/targets/aarch64_unknown_openbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target, TargetOptions};
1use crate::spec::{StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/aarch64_unknown_redox.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target};
1use crate::spec::{StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::redox::opts();
compiler/rustc_target/src/spec/targets/aarch64_unknown_teeos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target};
1use crate::spec::{StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::teeos::opts();
compiler/rustc_target/src/spec/targets/aarch64_unknown_uefi.rs+1-1
......@@ -1,7 +1,7 @@
11// This defines the aarch64 target for UEFI systems as described in the UEFI specification. See the
22// uefi-base module for generic UEFI options.
33
4use crate::spec::{base, LinkerFlavor, Lld, Target};
4use crate::spec::{LinkerFlavor, Lld, Target, base};
55
66pub(crate) fn target() -> Target {
77 let mut base = base::uefi_msvc::opts();
compiler/rustc_target/src/spec/targets/aarch64_uwp_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target};
1use crate::spec::{Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_uwp_msvc::opts();
compiler/rustc_target/src/spec/targets/aarch64_wrs_vxworks.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target, TargetOptions};
1use crate::spec::{StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/arm64e_apple_darwin.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/arm64e_apple_ios.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/arm64e_apple_tvos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/arm64ec_pc_windows_msvc.rs+5-6
......@@ -1,14 +1,13 @@
1use crate::spec::{add_link_args, base, LinkerFlavor, Lld, Target};
1use crate::spec::{LinkerFlavor, Lld, Target, add_link_args, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
55 base.max_atomic_width = Some(128);
66 base.features = "+v8a,+neon,+fp-armv8".into();
7 add_link_args(
8 &mut base.late_link_args,
9 LinkerFlavor::Msvc(Lld::No),
10 &["/machine:arm64ec", "softintrin.lib"],
11 );
7 add_link_args(&mut base.late_link_args, LinkerFlavor::Msvc(Lld::No), &[
8 "/machine:arm64ec",
9 "softintrin.lib",
10 ]);
1211
1312 Target {
1413 llvm_target: "arm64ec-pc-windows-msvc".into(),
compiler/rustc_target/src/spec/targets/arm_linux_androideabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, Target, TargetOptions};
1use crate::spec::{SanitizerSet, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/arm_unknown_linux_gnueabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/arm_unknown_linux_musleabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armeb_unknown_linux_gnueabi.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/armv4t_none_eabi.rs+1-1
......@@ -9,7 +9,7 @@
99//! The default link script is very likely wrong, so you should use
1010//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
1111
12use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
12use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
compiler/rustc_target/src/spec/targets/armv4t_unknown_linux_gnueabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv5te_none_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11//! Targets the ARMv5TE, with code as `a32` code by default.
22
3use crate::spec::{base, cvs, FramePointer, Target, TargetOptions};
3use crate::spec::{FramePointer, Target, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_gnueabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_musleabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv5te_unknown_linux_uclibceabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv6_unknown_freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv6_unknown_netbsd_eabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv6k_nintendo_3ds.rs+7-5
......@@ -1,14 +1,16 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
22
33/// A base target for Nintendo 3DS devices using the devkitARM toolchain.
44///
55/// Requires the devkitARM toolchain for 3DS targets on the host system.
66
77pub(crate) fn target() -> Target {
8 let pre_link_args = TargetOptions::link_args(
9 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
10 &["-specs=3dsx.specs", "-mtune=mpcore", "-mfloat-abi=hard", "-mtp=soft"],
11 );
8 let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
9 "-specs=3dsx.specs",
10 "-mtune=mpcore",
11 "-mfloat-abi=hard",
12 "-mtp=soft",
13 ]);
1214
1315 Target {
1416 llvm_target: "armv6k-none-eabihf".into(),
compiler/rustc_target/src/spec/targets/armv7_linux_androideabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, Target, TargetOptions, base};
22
33// This target if is for the baseline of the Android v7a ABI
44// in thumb mode. It's named armv7-* instead of thumbv7-*
compiler/rustc_target/src/spec/targets/armv7_rtems_eabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv7_sony_vita_newlibeabihf.rs+5-5
......@@ -1,15 +1,15 @@
11use crate::abi::Endian;
2use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
33
44/// A base target for PlayStation Vita devices using the VITASDK toolchain (using newlib).
55///
66/// Requires the VITASDK toolchain on the host system.
77
88pub(crate) fn target() -> Target {
9 let pre_link_args = TargetOptions::link_args(
10 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
11 &["-Wl,-q", "-Wl,--pic-veneer"],
12 );
9 let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
10 "-Wl,-q",
11 "-Wl,--pic-veneer",
12 ]);
1313
1414 Target {
1515 llvm_target: "thumbv7a-vita-eabihf".into(),
compiler/rustc_target/src/spec/targets/armv7_unknown_freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
44// hardfloat.
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_gnueabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for glibc Linux on ARMv7 without NEON or
44// thumb-mode. See the thumbv7neon variant for enabling both.
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
44// hardfloat.
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_musleabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
44
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_ohos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or
44// hardfloat.
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for uclibc Linux on ARMv7 without NEON,
44// thumb-mode or hardfloat.
compiler/rustc_target/src/spec/targets/armv7_unknown_linux_uclibceabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for uclibc Linux on ARMv7 without NEON or
44// thumb-mode. See the thumbv7neon variant for enabling both.
compiler/rustc_target/src/spec/targets/armv7_unknown_netbsd_eabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv7_wrs_vxworks_eabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, RelocModel, Target, TargetOptions};
1use crate::spec::{RelocModel, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let base = base::solid::opts("asp3");
compiler/rustc_target/src/spec/targets/armv7a_kmc_solid_asp3_eabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, RelocModel, Target, TargetOptions};
1use crate::spec::{RelocModel, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let base = base::solid::opts("asp3");
compiler/rustc_target/src/spec/targets/armv7k_apple_watchos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/armv7s_apple_ios.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/avr_unknown_gnu_atmega328.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target};
1use crate::spec::{Target, base};
22
33pub(crate) fn target() -> Target {
44 base::avr_gnu::target("atmega328", "-mmcu=atmega328")
compiler/rustc_target/src/spec/targets/bpfeb_unknown_none.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target};
2use crate::spec::{Target, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/bpfel_unknown_none.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target};
2use crate::spec::{Target, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
22
33// This target is for glibc Linux on Csky
44
compiler/rustc_target/src/spec/targets/csky_unknown_linux_gnuabiv2hf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
22
33// This target is for glibc Linux on Csky
44
compiler/rustc_target/src/spec/targets/hexagon_unknown_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Target};
1use crate::spec::{Cc, LinkerFlavor, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/i386_apple_ios.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/i586_pc_nto_qnx700.rs+4-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -17,10 +17,9 @@ pub(crate) fn target() -> Target {
1717 options: TargetOptions {
1818 cpu: "pentium4".into(),
1919 max_atomic_width: Some(64),
20 pre_link_args: TargetOptions::link_args(
21 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
22 &["-Vgcc_ntox86_cxx"],
23 ),
20 pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
21 "-Vgcc_ntox86_cxx",
22 ]),
2423 env: "nto70".into(),
2524 stack_probes: StackProbeType::Inline,
2625 ..base::nto_qnx::opts()
compiler/rustc_target/src/spec/targets/i586_unknown_netbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target, TargetOptions};
1use crate::spec::{StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::netbsd::opts();
compiler/rustc_target/src/spec/targets/i686_apple_darwin.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/i686_linux_android.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target, TargetOptions};
1use crate::spec::{SanitizerSet, StackProbeType, Target, TargetOptions, base};
22
33// See https://developer.android.com/ndk/guides/abis.html#x86
44// for target ABI requirements.
compiler/rustc_target/src/spec/targets/i686_pc_windows_gnu.rs+6-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target};
1use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_gnu::opts();
......@@ -9,10 +9,11 @@ pub(crate) fn target() -> Target {
99
1010 // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
1111 // space available to x86 Windows binaries on x86_64.
12 base.add_pre_link_args(
13 LinkerFlavor::Gnu(Cc::No, Lld::No),
14 &["-m", "i386pe", "--large-address-aware"],
15 );
12 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
13 "-m",
14 "i386pe",
15 "--large-address-aware",
16 ]);
1617 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,--large-address-aware"]);
1718
1819 Target {
compiler/rustc_target/src/spec/targets/i686_pc_windows_gnullvm.rs+6-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target};
1use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_gnullvm::opts();
......@@ -9,10 +9,11 @@ pub(crate) fn target() -> Target {
99
1010 // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
1111 // space available to x86 Windows binaries on x86_64.
12 base.add_pre_link_args(
13 LinkerFlavor::Gnu(Cc::No, Lld::No),
14 &["-m", "i386pe", "--large-address-aware"],
15 );
12 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
13 "-m",
14 "i386pe",
15 "--large-address-aware",
16 ]);
1617
1718 Target {
1819 llvm_target: "i686-pc-windows-gnu".into(),
compiler/rustc_target/src/spec/targets/i686_pc_windows_msvc.rs+10-13
......@@ -1,4 +1,4 @@
1use crate::spec::{base, LinkerFlavor, Lld, SanitizerSet, Target};
1use crate::spec::{LinkerFlavor, Lld, SanitizerSet, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
......@@ -6,18 +6,15 @@ pub(crate) fn target() -> Target {
66 base.max_atomic_width = Some(64);
77 base.supported_sanitizers = SanitizerSet::ADDRESS;
88
9 base.add_pre_link_args(
10 LinkerFlavor::Msvc(Lld::No),
11 &[
12 // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
13 // space available to x86 Windows binaries on x86_64.
14 "/LARGEADDRESSAWARE",
15 // Ensure the linker will only produce an image if it can also produce a table of
16 // the image's safe exception handlers.
17 // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
18 "/SAFESEH",
19 ],
20 );
9 base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &[
10 // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
11 // space available to x86 Windows binaries on x86_64.
12 "/LARGEADDRESSAWARE",
13 // Ensure the linker will only produce an image if it can also produce a table of
14 // the image's safe exception handlers.
15 // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
16 "/SAFESEH",
17 ]);
2118
2219 Target {
2320 llvm_target: "i686-pc-windows-msvc".into(),
compiler/rustc_target/src/spec/targets/i686_unknown_freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::freebsd::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_haiku.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::haiku::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_hurd_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::hurd_gnu::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_netbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::netbsd::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_openbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::openbsd::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_redox.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::redox::opts();
compiler/rustc_target/src/spec/targets/i686_unknown_uefi.rs+1-1
......@@ -5,7 +5,7 @@
55// The cdecl ABI is used. It differs from the stdcall or fastcall ABI.
66// "i686-unknown-windows" is used to get the minimal subset of windows-specific features.
77
8use crate::spec::{base, Target};
8use crate::spec::{Target, base};
99
1010pub(crate) fn target() -> Target {
1111 let mut base = base::uefi_msvc::opts();
compiler/rustc_target/src/spec/targets/i686_uwp_windows_gnu.rs+6-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, FramePointer, LinkerFlavor, Lld, Target};
1use crate::spec::{Cc, FramePointer, LinkerFlavor, Lld, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_uwp_gnu::opts();
......@@ -8,10 +8,11 @@ pub(crate) fn target() -> Target {
88
99 // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
1010 // space available to x86 Windows binaries on x86_64.
11 base.add_pre_link_args(
12 LinkerFlavor::Gnu(Cc::No, Lld::No),
13 &["-m", "i386pe", "--large-address-aware"],
14 );
11 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
12 "-m",
13 "i386pe",
14 "--large-address-aware",
15 ]);
1516 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,--large-address-aware"]);
1617
1718 Target {
compiler/rustc_target/src/spec/targets/i686_uwp_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target};
1use crate::spec::{Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_uwp_msvc::opts();
compiler/rustc_target/src/spec/targets/i686_win7_windows_msvc.rs+10-13
......@@ -1,4 +1,4 @@
1use crate::spec::{base, LinkerFlavor, Lld, Target};
1use crate::spec::{LinkerFlavor, Lld, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
......@@ -6,18 +6,15 @@ pub(crate) fn target() -> Target {
66 base.max_atomic_width = Some(64);
77 base.vendor = "win7".into();
88
9 base.add_pre_link_args(
10 LinkerFlavor::Msvc(Lld::No),
11 &[
12 // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
13 // space available to x86 Windows binaries on x86_64.
14 "/LARGEADDRESSAWARE",
15 // Ensure the linker will only produce an image if it can also produce a table of
16 // the image's safe exception handlers.
17 // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
18 "/SAFESEH",
19 ],
20 );
9 base.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &[
10 // Mark all dynamic libraries and executables as compatible with the larger 4GiB address
11 // space available to x86 Windows binaries on x86_64.
12 "/LARGEADDRESSAWARE",
13 // Ensure the linker will only produce an image if it can also produce a table of
14 // the image's safe exception handlers.
15 // https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
16 "/SAFESEH",
17 ]);
2118
2219 Target {
2320 llvm_target: "i686-pc-windows-msvc".into(),
compiler/rustc_target/src/spec/targets/i686_wrs_vxworks.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::vxworks::opts();
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, CodeModel, Target, TargetOptions};
1use crate::spec::{CodeModel, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/loongarch64_unknown_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, CodeModel, Target, TargetOptions};
1use crate::spec::{CodeModel, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/m68k_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/mips64_openwrt_linux_musl.rs+1-1
......@@ -1,7 +1,7 @@
11//! A target tuple for OpenWrt MIPS64 targets.
22
33use crate::abi::Endian;
4use crate::spec::{base, Target, TargetOptions};
4use crate::spec::{Target, TargetOptions, base};
55
66pub(crate) fn target() -> Target {
77 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/mips64_unknown_linux_gnuabi64.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/mips64_unknown_linux_muslabi64.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_muslabi64.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/mips_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/mips_unknown_linux_musl.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/mips_unknown_linux_uclibc.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/mipsel_sony_psp.rs+5-5
......@@ -1,13 +1,13 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions, cvs};
22
33// The PSP has custom linker requirements.
44const LINKER_SCRIPT: &str = include_str!("./mipsel_sony_psp_linker_script.ld");
55
66pub(crate) fn target() -> Target {
7 let pre_link_args = TargetOptions::link_args(
8 LinkerFlavor::Gnu(Cc::No, Lld::No),
9 &["--emit-relocs", "--nmagic"],
10 );
7 let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
8 "--emit-relocs",
9 "--nmagic",
10 ]);
1111
1212 Target {
1313 llvm_target: "mipsel-sony-psp".into(),
compiler/rustc_target/src/spec/targets/mipsel_sony_psx.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/mipsel_unknown_linux_uclibc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/mipsel_unknown_netbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::netbsd::opts();
compiler/rustc_target/src/spec/targets/mipsisa32r6_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/mipsisa32r6el_unknown_linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/mipsisa64r6_unknown_linux_gnuabi64.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target, TargetOptions};
2use crate::spec::{Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
compiler/rustc_target/src/spec/targets/mipsisa64r6el_unknown_linux_gnuabi64.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/msp430_none_elf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs+7-5
......@@ -1,12 +1,14 @@
1use crate::spec::{base, Cc, LinkerFlavor, Target};
1use crate::spec::{Cc, LinkerFlavor, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::aix::opts();
55 base.max_atomic_width = Some(64);
6 base.add_pre_link_args(
7 LinkerFlavor::Unix(Cc::No),
8 &["-b64", "-bpT:0x100000000", "-bpD:0x110000000", "-bcdtors:all:0:s"],
9 );
6 base.add_pre_link_args(LinkerFlavor::Unix(Cc::No), &[
7 "-b64",
8 "-bpT:0x100000000",
9 "-bpD:0x110000000",
10 "-bcdtors:all:0:s",
11 ]);
1012
1113 Target {
1214 llvm_target: "powerpc64-ibm-aix".into(),
compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::freebsd::opts();
compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::openbsd::opts();
compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::vxworks::opts();
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::freebsd::opts();
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/powerpc_unknown_freebsd.rs+5-5
......@@ -1,13 +1,13 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::freebsd::opts();
66 // Extra hint to linker that we are generating secure-PLT code.
7 base.add_pre_link_args(
8 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
9 &["-m32", "--target=powerpc-unknown-freebsd13.0"],
10 );
7 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
8 "-m32",
9 "--target=powerpc-unknown-freebsd13.0",
10 ]);
1111 base.max_atomic_width = Some(32);
1212 base.stack_probes = StackProbeType::Inline;
1313
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_gnuspe.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_musl.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/powerpc_unknown_linux_muslspe.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/powerpc_unknown_netbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::netbsd::opts();
compiler/rustc_target/src/spec/targets/powerpc_unknown_openbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, StackProbeType, Target};
2use crate::spec::{StackProbeType, Target, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::openbsd::opts();
compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::vxworks::opts();
compiler/rustc_target/src/spec/targets/powerpc_wrs_vxworks_spe.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::vxworks::opts();
compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_gnu.rs+1-1
......@@ -1,6 +1,6 @@
11use std::borrow::Cow;
22
3use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
3use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/riscv32gc_unknown_linux_musl.rs+1-1
......@@ -1,6 +1,6 @@
11use std::borrow::Cow;
22
3use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
3use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/riscv32imac_esp_espidf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv32imac_unknown_nuttx_elf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv32imafc_esp_espidf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv32imafc_unknown_nuttx_elf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv32imc_esp_espidf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv32imc_unknown_nuttx_elf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{cvs, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetOptions, cvs};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv64_linux_android.rs+1-1
......@@ -1,6 +1,6 @@
11use std::borrow::Cow;
22
3use crate::spec::{base, CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetOptions};
3use crate::spec::{CodeModel, SanitizerSet, SplitDebuginfo, Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, CodeModel, Target, TargetOptions};
1use crate::spec::{CodeModel, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_fuchsia.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, CodeModel, SanitizerSet, Target, TargetOptions};
1use crate::spec::{CodeModel, SanitizerSet, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_hermit.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, CodeModel, RelocModel, Target, TargetOptions, TlsModel};
1use crate::spec::{CodeModel, RelocModel, Target, TargetOptions, TlsModel, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_gnu.rs+1-1
......@@ -1,6 +1,6 @@
11use std::borrow::Cow;
22
3use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
3use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_linux_musl.rs+1-1
......@@ -1,6 +1,6 @@
11use std::borrow::Cow;
22
3use crate::spec::{base, CodeModel, SplitDebuginfo, Target, TargetOptions};
3use crate::spec::{CodeModel, SplitDebuginfo, Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_netbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, CodeModel, Target, TargetOptions};
1use crate::spec::{CodeModel, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_nuttx_elf.rs+2-2
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 cvs, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetOptions,
2 Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetOptions, cvs,
44};
55
66pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/riscv64gc_unknown_openbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, CodeModel, Target, TargetOptions};
1use crate::spec::{CodeModel, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/riscv64imac_unknown_nuttx_elf.rs+2-2
......@@ -1,6 +1,6 @@
11use crate::spec::{
2 cvs, Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetOptions,
2 Cc, CodeModel, LinkerFlavor, Lld, PanicStrategy, RelocModel, SanitizerSet, Target,
3 TargetOptions, cvs,
44};
55
66pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/s390x_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, SanitizerSet, StackProbeType, Target};
2use crate::spec::{SanitizerSet, StackProbeType, Target, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/s390x_unknown_linux_musl.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, SanitizerSet, StackProbeType, Target};
2use crate::spec::{SanitizerSet, StackProbeType, Target, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/sparc64_unknown_linux_gnu.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Target};
2use crate::spec::{Target, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/sparc64_unknown_netbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::netbsd::opts();
compiler/rustc_target/src/spec/targets/sparc64_unknown_openbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
2use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::openbsd::opts();
compiler/rustc_target/src/spec/targets/sparc_unknown_linux_gnu.rs+4-5
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
2use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
33
44pub(crate) fn target() -> Target {
55 Target {
......@@ -16,10 +16,9 @@ pub(crate) fn target() -> Target {
1616 options: TargetOptions {
1717 cpu: "v9".into(),
1818 endian: Endian::Big,
19 late_link_args: TargetOptions::link_args(
20 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
21 &["-mcpu=v9", "-m32"],
22 ),
19 late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
20 "-mcpu=v9", "-m32",
21 ]),
2322 max_atomic_width: Some(32),
2423 ..base::linux_gnu::opts()
2524 },
compiler/rustc_target/src/spec/targets/sparcv9_sun_solaris.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::abi::Endian;
2use crate::spec::{base, Cc, LinkerFlavor, Target};
2use crate::spec::{Cc, LinkerFlavor, Target, base};
33
44pub(crate) fn target() -> Target {
55 let mut base = base::solaris::opts();
compiler/rustc_target/src/spec/targets/thumbv4t_none_eabi.rs+1-1
......@@ -9,7 +9,7 @@
99//! The default link script is very likely wrong, so you should use
1010//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
1111
12use crate::spec::{base, cvs, FramePointer, PanicStrategy, RelocModel, Target, TargetOptions};
12use crate::spec::{FramePointer, PanicStrategy, RelocModel, Target, TargetOptions, base, cvs};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
compiler/rustc_target/src/spec/targets/thumbv5te_none_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11//! Targets the ARMv5TE, with code as `t32` code by default.
22
3use crate::spec::{base, cvs, FramePointer, Target, TargetOptions};
3use crate::spec::{FramePointer, Target, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/thumbv6m_none_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture)
22
3use crate::spec::{base, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/thumbv6m_nuttx_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M0, Cortex-M0+ and Cortex-M1 processors (ARMv6-M architecture)
22
3use crate::spec::{base, cvs, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/thumbv7a_pc_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions};
1use crate::spec::{LinkerFlavor, Lld, PanicStrategy, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
compiler/rustc_target/src/spec/targets/thumbv7a_uwp_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, PanicStrategy, Target, TargetOptions};
1use crate::spec::{PanicStrategy, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/thumbv7em_none_eabi.rs+1-1
......@@ -9,7 +9,7 @@
99// To opt-in to hardware accelerated floating point operations, you can use, for example,
1010// `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`.
1111
12use crate::spec::{base, Target, TargetOptions};
12use crate::spec::{Target, TargetOptions, base};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
compiler/rustc_target/src/spec/targets/thumbv7em_none_eabihf.rs+1-1
......@@ -8,7 +8,7 @@
88//
99// To opt into double precision hardware support, use the `-C target-feature=+fp64` flag.
1010
11use crate::spec::{base, Target, TargetOptions};
11use crate::spec::{Target, TargetOptions, base};
1212
1313pub(crate) fn target() -> Target {
1414 Target {
compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabi.rs+1-1
......@@ -9,7 +9,7 @@
99// To opt-in to hardware accelerated floating point operations, you can use, for example,
1010// `-C target-feature=+vfp4` or `-C target-cpu=cortex-m4`.
1111
12use crate::spec::{base, cvs, Target, TargetOptions};
12use crate::spec::{Target, TargetOptions, base, cvs};
1313
1414pub(crate) fn target() -> Target {
1515 Target {
compiler/rustc_target/src/spec/targets/thumbv7em_nuttx_eabihf.rs+1-1
......@@ -8,7 +8,7 @@
88//
99// To opt into double precision hardware support, use the `-C target-feature=+fp64` flag.
1010
11use crate::spec::{base, cvs, Target, TargetOptions};
11use crate::spec::{Target, TargetOptions, base, cvs};
1212
1313pub(crate) fn target() -> Target {
1414 Target {
compiler/rustc_target/src/spec/targets/thumbv7m_none_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M3 processor (ARMv7-M)
22
3use crate::spec::{base, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/thumbv7m_nuttx_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M3 processor (ARMv7-M)
22
3use crate::spec::{base, cvs, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/thumbv7neon_linux_androideabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
22
33// This target if is for the Android v7a ABI in thumb mode with
44// NEON unconditionally enabled and, therefore, with 32 FPU registers
compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_gnueabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for glibc Linux on ARMv7 with thumb mode enabled
44// (for consistency with Android and Debian-based distributions)
compiler/rustc_target/src/spec/targets/thumbv7neon_unknown_linux_musleabihf.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target, TargetOptions};
1use crate::spec::{Target, TargetOptions, base};
22
33// This target is for musl Linux on ARMv7 with thumb mode enabled
44// (for consistency with Android and Debian-based distributions)
compiler/rustc_target/src/spec/targets/thumbv8m_base_none_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M23 processor (Baseline ARMv8-M)
22
3use crate::spec::{base, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, base};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/thumbv8m_base_nuttx_eabi.rs+1-1
......@@ -1,6 +1,6 @@
11// Targets the Cortex-M23 processor (Baseline ARMv8-M)
22
3use crate::spec::{base, cvs, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, base, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabi.rs+1-1
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// without the Floating Point extension.
33
4use crate::spec::{base, Target, TargetOptions};
4use crate::spec::{Target, TargetOptions, base};
55
66pub(crate) fn target() -> Target {
77 Target {
compiler/rustc_target/src/spec/targets/thumbv8m_main_none_eabihf.rs+1-1
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// with the Floating Point extension.
33
4use crate::spec::{base, Target, TargetOptions};
4use crate::spec::{Target, TargetOptions, base};
55
66pub(crate) fn target() -> Target {
77 Target {
compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabi.rs+1-1
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// without the Floating Point extension.
33
4use crate::spec::{base, cvs, Target, TargetOptions};
4use crate::spec::{Target, TargetOptions, base, cvs};
55
66pub(crate) fn target() -> Target {
77 Target {
compiler/rustc_target/src/spec/targets/thumbv8m_main_nuttx_eabihf.rs+1-1
......@@ -1,7 +1,7 @@
11// Targets the Cortex-M33 processor (Armv8-M Mainline architecture profile),
22// with the Floating Point extension.
33
4use crate::spec::{base, cvs, Target, TargetOptions};
4use crate::spec::{Target, TargetOptions, base, cvs};
55
66pub(crate) fn target() -> Target {
77 Target {
compiler/rustc_target/src/spec/targets/wasm32_unknown_emscripten.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 base, cvs, LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions,
2 LinkArgs, LinkerFlavor, PanicStrategy, RelocModel, Target, TargetOptions, base, cvs,
33};
44
55pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/wasm32_unknown_unknown.rs+12-18
......@@ -10,29 +10,23 @@
1010//! This target is more or less managed by the Rust and WebAssembly Working
1111//! Group nowadays at <https://github.com/rustwasm>.
1212
13use crate::spec::{base, Cc, LinkerFlavor, Target};
13use crate::spec::{Cc, LinkerFlavor, Target, base};
1414
1515pub(crate) fn target() -> Target {
1616 let mut options = base::wasm::options();
1717 options.os = "unknown".into();
1818
19 options.add_pre_link_args(
20 LinkerFlavor::WasmLld(Cc::No),
21 &[
22 // For now this target just never has an entry symbol no matter the output
23 // type, so unconditionally pass this.
24 "--no-entry",
25 ],
26 );
27 options.add_pre_link_args(
28 LinkerFlavor::WasmLld(Cc::Yes),
29 &[
30 // Make sure clang uses LLD as its linker and is configured appropriately
31 // otherwise
32 "--target=wasm32-unknown-unknown",
33 "-Wl,--no-entry",
34 ],
35 );
19 options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::No), &[
20 // For now this target just never has an entry symbol no matter the output
21 // type, so unconditionally pass this.
22 "--no-entry",
23 ]);
24 options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &[
25 // Make sure clang uses LLD as its linker and is configured appropriately
26 // otherwise
27 "--target=wasm32-unknown-unknown",
28 "-Wl,--no-entry",
29 ]);
3630
3731 Target {
3832 llvm_target: "wasm32-unknown-unknown".into(),
compiler/rustc_target/src/spec/targets/wasm32_wasip1.rs+1-1
......@@ -10,7 +10,7 @@
1010//! was since renamed to `wasm32-wasip1` after the preview2 target was
1111//! introduced.
1212
13use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};
13use crate::spec::{Cc, LinkSelfContainedDefault, LinkerFlavor, Target, base, crt_objects};
1414
1515pub(crate) fn target() -> Target {
1616 let mut options = base::wasm::options();
compiler/rustc_target/src/spec/targets/wasm32_wasip1_threads.rs+12-14
......@@ -7,7 +7,7 @@
77//!
88//! Historically this target was known as `wasm32-wasi-preview1-threads`.
99
10use crate::spec::{base, crt_objects, Cc, LinkSelfContainedDefault, LinkerFlavor, Target};
10use crate::spec::{Cc, LinkSelfContainedDefault, LinkerFlavor, Target, base, crt_objects};
1111
1212pub(crate) fn target() -> Target {
1313 let mut options = base::wasm::options();
......@@ -15,19 +15,17 @@ pub(crate) fn target() -> Target {
1515 options.os = "wasi".into();
1616 options.env = "p1".into();
1717
18 options.add_pre_link_args(
19 LinkerFlavor::WasmLld(Cc::No),
20 &["--import-memory", "--export-memory", "--shared-memory"],
21 );
22 options.add_pre_link_args(
23 LinkerFlavor::WasmLld(Cc::Yes),
24 &[
25 "--target=wasm32-wasip1-threads",
26 "-Wl,--import-memory",
27 "-Wl,--export-memory,",
28 "-Wl,--shared-memory",
29 ],
30 );
18 options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::No), &[
19 "--import-memory",
20 "--export-memory",
21 "--shared-memory",
22 ]);
23 options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &[
24 "--target=wasm32-wasip1-threads",
25 "-Wl,--import-memory",
26 "-Wl,--export-memory,",
27 "-Wl,--shared-memory",
28 ]);
3129
3230 options.pre_link_objects_self_contained = crt_objects::pre_wasi_self_contained();
3331 options.post_link_objects_self_contained = crt_objects::post_wasi_self_contained();
compiler/rustc_target/src/spec/targets/wasm32_wasip2.rs+1-1
......@@ -16,7 +16,7 @@
1616//! You can see more about wasi at <https://wasi.dev> and the component model at
1717//! <https://github.com/WebAssembly/component-model>.
1818
19use crate::spec::{base, crt_objects, LinkSelfContainedDefault, RelocModel, Target};
19use crate::spec::{LinkSelfContainedDefault, RelocModel, Target, base, crt_objects};
2020
2121pub(crate) fn target() -> Target {
2222 let mut options = base::wasm::options();
compiler/rustc_target/src/spec/targets/wasm64_unknown_unknown.rs+13-19
......@@ -7,30 +7,24 @@
77//! the standard library is available, most of it returns an error immediately
88//! (e.g. trying to create a TCP stream or something like that).
99
10use crate::spec::{base, Cc, LinkerFlavor, Target};
10use crate::spec::{Cc, LinkerFlavor, Target, base};
1111
1212pub(crate) fn target() -> Target {
1313 let mut options = base::wasm::options();
1414 options.os = "unknown".into();
1515
16 options.add_pre_link_args(
17 LinkerFlavor::WasmLld(Cc::No),
18 &[
19 // For now this target just never has an entry symbol no matter the output
20 // type, so unconditionally pass this.
21 "--no-entry",
22 "-mwasm64",
23 ],
24 );
25 options.add_pre_link_args(
26 LinkerFlavor::WasmLld(Cc::Yes),
27 &[
28 // Make sure clang uses LLD as its linker and is configured appropriately
29 // otherwise
30 "--target=wasm64-unknown-unknown",
31 "-Wl,--no-entry",
32 ],
33 );
16 options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::No), &[
17 // For now this target just never has an entry symbol no matter the output
18 // type, so unconditionally pass this.
19 "--no-entry",
20 "-mwasm64",
21 ]);
22 options.add_pre_link_args(LinkerFlavor::WasmLld(Cc::Yes), &[
23 // Make sure clang uses LLD as its linker and is configured appropriately
24 // otherwise
25 "--target=wasm64-unknown-unknown",
26 "-Wl,--no-entry",
27 ]);
3428
3529 // Any engine that implements wasm64 will surely implement the rest of these
3630 // features since they were all merged into the official spec by the time
compiler/rustc_target/src/spec/targets/x86_64_apple_darwin.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/x86_64_apple_ios.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/x86_64_apple_ios_macabi.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/x86_64_apple_tvos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/x86_64_apple_watchos_sim.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/x86_64_fortanix_unknown_sgx.rs+32-35
......@@ -1,42 +1,39 @@
11use std::borrow::Cow;
22
3use crate::spec::{cvs, Cc, LinkerFlavor, Lld, Target, TargetOptions};
3use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, cvs};
44
55pub(crate) fn target() -> Target {
6 let pre_link_args = TargetOptions::link_args(
7 LinkerFlavor::Gnu(Cc::No, Lld::No),
8 &[
9 "-e",
10 "elf_entry",
11 "-Bstatic",
12 "--gc-sections",
13 "-z",
14 "text",
15 "-z",
16 "norelro",
17 "--no-undefined",
18 "--error-unresolved-symbols",
19 "--no-undefined-version",
20 "-Bsymbolic",
21 "--export-dynamic",
22 // The following symbols are needed by libunwind, which is linked after
23 // libstd. Make sure they're included in the link.
24 "-u",
25 "__rust_abort",
26 "-u",
27 "__rust_c_alloc",
28 "-u",
29 "__rust_c_dealloc",
30 "-u",
31 "__rust_print_err",
32 "-u",
33 "__rust_rwlock_rdlock",
34 "-u",
35 "__rust_rwlock_unlock",
36 "-u",
37 "__rust_rwlock_wrlock",
38 ],
39 );
6 let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
7 "-e",
8 "elf_entry",
9 "-Bstatic",
10 "--gc-sections",
11 "-z",
12 "text",
13 "-z",
14 "norelro",
15 "--no-undefined",
16 "--error-unresolved-symbols",
17 "--no-undefined-version",
18 "-Bsymbolic",
19 "--export-dynamic",
20 // The following symbols are needed by libunwind, which is linked after
21 // libstd. Make sure they're included in the link.
22 "-u",
23 "__rust_abort",
24 "-u",
25 "__rust_c_alloc",
26 "-u",
27 "__rust_c_dealloc",
28 "-u",
29 "__rust_print_err",
30 "-u",
31 "__rust_rwlock_rdlock",
32 "-u",
33 "__rust_rwlock_unlock",
34 "-u",
35 "__rust_rwlock_wrlock",
36 ]);
4037
4138 const EXPORT_SYMBOLS: &[&str] = &[
4239 "sgx_entry",
compiler/rustc_target/src/spec/targets/x86_64_linux_android.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions,
2 Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions, base,
33};
44
55pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710.rs+4-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
......@@ -17,10 +17,9 @@ pub(crate) fn target() -> Target {
1717 cpu: "x86-64".into(),
1818 plt_by_default: false,
1919 max_atomic_width: Some(64),
20 pre_link_args: TargetOptions::link_args(
21 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
22 &["-Vgcc_ntox86_64_cxx"],
23 ),
20 pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
21 "-Vgcc_ntox86_64_cxx",
22 ]),
2423 env: "nto71".into(),
2524 ..base::nto_qnx::opts()
2625 },
compiler/rustc_target/src/spec/targets/x86_64_pc_solaris.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, SanitizerSet, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::solaris::opts();
compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnu.rs+6-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_gnu::opts();
......@@ -6,10 +6,11 @@ pub(crate) fn target() -> Target {
66 base.features = "+cx16,+sse3,+sahf".into();
77 base.plt_by_default = false;
88 // Use high-entropy 64 bit address space for ASLR
9 base.add_pre_link_args(
10 LinkerFlavor::Gnu(Cc::No, Lld::No),
11 &["-m", "i386pep", "--high-entropy-va"],
12 );
9 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
10 "-m",
11 "i386pep",
12 "--high-entropy-va",
13 ]);
1314 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64", "-Wl,--high-entropy-va"]);
1415 base.max_atomic_width = Some(128);
1516 base.linker = Some("x86_64-w64-mingw32-gcc".into());
compiler/rustc_target/src/spec/targets/x86_64_pc_windows_gnullvm.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_gnullvm::opts();
compiler/rustc_target/src/spec/targets/x86_64_pc_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, Target};
1use crate::spec::{SanitizerSet, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
compiler/rustc_target/src/spec/targets/x86_64_unikraft_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/x86_64_unknown_dragonfly.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::dragonfly::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_freebsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::freebsd::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_fuchsia.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, SanitizerSet, StackProbeType, Target};
1use crate::spec::{SanitizerSet, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::fuchsia::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_haiku.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::haiku::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_hermit.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, StackProbeType, Target, TargetOptions};
1use crate::spec::{StackProbeType, Target, TargetOptions, base};
22
33pub(crate) fn target() -> Target {
44 Target {
compiler/rustc_target/src/spec/targets/x86_64_unknown_hurd_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::hurd_gnu::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_illumos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, SanitizerSet, Target};
1use crate::spec::{Cc, LinkerFlavor, SanitizerSet, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::illumos::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_l4re_uclibc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, PanicStrategy, Target};
1use crate::spec::{PanicStrategy, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::l4re::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnux32.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_gnu::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_musl::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_none.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_ohos.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::linux_ohos::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_netbsd.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::spec::{
2 base, Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions,
2 Cc, LinkerFlavor, Lld, SanitizerSet, StackProbeType, Target, TargetOptions, base,
33};
44
55pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/x86_64_unknown_openbsd.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::openbsd::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_redox.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::redox::opts();
compiler/rustc_target/src/spec/targets/x86_64_unknown_uefi.rs+1-1
......@@ -6,7 +6,7 @@
66// LLVM. "x86_64-unknown-windows" is used to get the minimal subset of windows-specific features.
77
88use crate::abi::call::Conv;
9use crate::spec::{base, Target};
9use crate::spec::{Target, base};
1010
1111pub(crate) fn target() -> Target {
1212 let mut base = base::uefi_msvc::opts();
compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_gnu.rs+6-5
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_uwp_gnu::opts();
......@@ -6,10 +6,11 @@ pub(crate) fn target() -> Target {
66 base.features = "+cx16,+sse3,+sahf".into();
77 base.plt_by_default = false;
88 // Use high-entropy 64 bit address space for ASLR
9 base.add_pre_link_args(
10 LinkerFlavor::Gnu(Cc::No, Lld::No),
11 &["-m", "i386pep", "--high-entropy-va"],
12 );
9 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::No, Lld::No), &[
10 "-m",
11 "i386pep",
12 "--high-entropy-va",
13 ]);
1314 base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64", "-Wl,--high-entropy-va"]);
1415 base.max_atomic_width = Some(128);
1516
compiler/rustc_target/src/spec/targets/x86_64_uwp_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target};
1use crate::spec::{Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_uwp_msvc::opts();
compiler/rustc_target/src/spec/targets/x86_64_win7_windows_msvc.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Target};
1use crate::spec::{Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::windows_msvc::opts();
compiler/rustc_target/src/spec/targets/x86_64_wrs_vxworks.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::{base, Cc, LinkerFlavor, Lld, StackProbeType, Target};
1use crate::spec::{Cc, LinkerFlavor, Lld, StackProbeType, Target, base};
22
33pub(crate) fn target() -> Target {
44 let mut base = base::vxworks::opts();
compiler/rustc_target/src/spec/targets/x86_64h_apple_darwin.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::spec::base::apple::{base, Arch, TargetAbi};
1use crate::spec::base::apple::{Arch, TargetAbi, base};
22use crate::spec::{FramePointer, SanitizerSet, Target, TargetOptions};
33
44pub(crate) fn target() -> Target {
compiler/rustc_target/src/spec/targets/xtensa_esp32_espidf.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::abi::Endian;
22use crate::spec::base::xtensa;
3use crate::spec::{cvs, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/xtensa_esp32s2_espidf.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::abi::Endian;
22use crate::spec::base::xtensa;
3use crate::spec::{cvs, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/spec/targets/xtensa_esp32s3_espidf.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::abi::Endian;
22use crate::spec::base::xtensa;
3use crate::spec::{cvs, Target, TargetOptions};
3use crate::spec::{Target, TargetOptions, cvs};
44
55pub(crate) fn target() -> Target {
66 Target {
compiler/rustc_target/src/target_features.rs+7-11
......@@ -1,5 +1,5 @@
11use rustc_data_structures::fx::{FxHashMap, FxHashSet};
2use rustc_span::symbol::{sym, Symbol};
2use rustc_span::symbol::{Symbol, sym};
33
44/// Features that control behaviour of rustc, rather than the codegen.
55pub const RUSTC_SPECIFIC_FEATURES: &[&str] = &["crt-static"];
......@@ -243,17 +243,13 @@ const AARCH64_ALLOWED_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
243243 ("sve2p1", Unstable(sym::aarch64_unstable_target_feature), &["sve2"]),
244244 // FEAT_TME
245245 ("tme", Stable, &[]),
246 (
247 "v8.1a",
248 Unstable(sym::aarch64_ver_target_feature),
249 &["crc", "lse", "rdm", "pan", "lor", "vh"],
250 ),
246 ("v8.1a", Unstable(sym::aarch64_ver_target_feature), &[
247 "crc", "lse", "rdm", "pan", "lor", "vh",
248 ]),
251249 ("v8.2a", Unstable(sym::aarch64_ver_target_feature), &["v8.1a", "ras", "dpb"]),
252 (
253 "v8.3a",
254 Unstable(sym::aarch64_ver_target_feature),
255 &["v8.2a", "rcpc", "paca", "pacg", "jsconv"],
256 ),
250 ("v8.3a", Unstable(sym::aarch64_ver_target_feature), &[
251 "v8.2a", "rcpc", "paca", "pacg", "jsconv",
252 ]),
257253 ("v8.4a", Unstable(sym::aarch64_ver_target_feature), &["v8.3a", "dotprod", "dit", "flagm"]),
258254 ("v8.5a", Unstable(sym::aarch64_ver_target_feature), &["v8.4a", "ssbs", "sb", "dpb2", "bti"]),
259255 ("v8.6a", Unstable(sym::aarch64_ver_target_feature), &["v8.5a", "bf16", "i8mm"]),
compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs+4-4
......@@ -51,7 +51,7 @@ use std::path::PathBuf;
5151use std::{cmp, fmt, iter};
5252
5353use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
54use rustc_errors::{pluralize, Applicability, Diag, DiagStyledString, IntoDiagArg, StringPart};
54use rustc_errors::{Applicability, Diag, DiagStyledString, IntoDiagArg, StringPart, pluralize};
5555use rustc_hir::def::DefKind;
5656use rustc_hir::def_id::DefId;
5757use rustc_hir::intravisit::Visitor;
......@@ -61,12 +61,12 @@ use rustc_macros::extension;
6161use rustc_middle::bug;
6262use rustc_middle::dep_graph::DepContext;
6363use rustc_middle::ty::error::{ExpectedFound, TypeError, TypeErrorToStringExt};
64use rustc_middle::ty::print::{with_forced_trimmed_paths, PrintError, PrintTraitRefExt as _};
64use rustc_middle::ty::print::{PrintError, PrintTraitRefExt as _, with_forced_trimmed_paths};
6565use rustc_middle::ty::{
6666 self, List, Region, Ty, TyCtxt, TypeFoldable, TypeSuperVisitable, TypeVisitable,
6767 TypeVisitableExt,
6868};
69use rustc_span::{sym, BytePos, DesugaringKind, Pos, Span};
69use rustc_span::{BytePos, DesugaringKind, Pos, Span, sym};
7070use rustc_target::spec::abi;
7171use tracing::{debug, instrument};
7272
......@@ -203,8 +203,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
203203 fn check_and_note_conflicting_crates(&self, err: &mut Diag<'_>, terr: TypeError<'tcx>) {
204204 use hir::def_id::CrateNum;
205205 use rustc_hir::definitions::DisambiguatedDefPathData;
206 use ty::print::Printer;
207206 use ty::GenericArg;
207 use ty::print::Printer;
208208
209209 struct AbsolutePathPrinter<'tcx> {
210210 tcx: TyCtxt<'tcx>,
compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs+3-3
......@@ -6,7 +6,7 @@ use rustc_errors::codes::*;
66use rustc_errors::{Diag, IntoDiagArg};
77use rustc_hir as hir;
88use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
9use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
9use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
1010use rustc_hir::intravisit::{self, Visitor};
1111use rustc_hir::{Body, Closure, Expr, ExprKind, FnRetTy, HirId, LetStmt, LocalSource};
1212use rustc_middle::bug;
......@@ -17,8 +17,8 @@ use rustc_middle::ty::{
1717 self, GenericArg, GenericArgKind, GenericArgsRef, InferConst, IsSuggestable, Ty, TyCtxt,
1818 TypeFoldable, TypeFolder, TypeSuperFoldable, TypeckResults,
1919};
20use rustc_span::symbol::{sym, Ident};
21use rustc_span::{BytePos, FileName, Span, DUMMY_SP};
20use rustc_span::symbol::{Ident, sym};
21use rustc_span::{BytePos, DUMMY_SP, FileName, Span};
2222use tracing::{debug, instrument, warn};
2323
2424use crate::error_reporting::TypeErrCtxt;
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/different_lifetimes.rs+2-2
......@@ -2,14 +2,14 @@
22//! where both the regions are anonymous.
33
44use rustc_errors::{Diag, ErrorGuaranteed, Subdiagnostic};
5use rustc_hir::def_id::LocalDefId;
65use rustc_hir::Ty;
6use rustc_hir::def_id::LocalDefId;
77use rustc_middle::ty::{Region, TyCtxt};
88use tracing::debug;
99
10use crate::error_reporting::infer::nice_region_error::NiceRegionError;
1011use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type;
1112use crate::error_reporting::infer::nice_region_error::util::AnonymousParamInfo;
12use crate::error_reporting::infer::nice_region_error::NiceRegionError;
1313use crate::errors::{AddLifetimeParamsSuggestion, LifetimeMismatch, LifetimeMismatchLabels};
1414use crate::infer::{RegionResolutionError, SubregionOrigin};
1515
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mismatched_static_lifetime.rs+2-2
......@@ -11,8 +11,8 @@ use tracing::debug;
1111
1212use crate::error_reporting::infer::nice_region_error::NiceRegionError;
1313use crate::errors::{
14 note_and_explain, DoesNotOutliveStaticFromImpl, ImplicitStaticLifetimeSubdiag,
15 IntroducesStaticBecauseUnmetLifetimeReq, MismatchedStaticLifetime,
14 DoesNotOutliveStaticFromImpl, ImplicitStaticLifetimeSubdiag,
15 IntroducesStaticBecauseUnmetLifetimeReq, MismatchedStaticLifetime, note_and_explain,
1616};
1717use crate::infer::{RegionResolutionError, SubregionOrigin, TypeTrace};
1818use crate::traits::ObligationCauseCode;
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/mod.rs+1-1
......@@ -19,7 +19,7 @@ mod util;
1919
2020pub use different_lifetimes::suggest_adding_lifetime_params;
2121pub use find_anon_type::find_anon_type;
22pub use static_impl_trait::{suggest_new_region_bound, HirTraitObjectVisitor, TraitObjectVisitor};
22pub use static_impl_trait::{HirTraitObjectVisitor, TraitObjectVisitor, suggest_new_region_bound};
2323pub use util::find_param_with_region;
2424
2525impl<'cx, 'tcx> TypeErrCtxt<'cx, 'tcx> {
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/named_anon_conflict.rs+1-1
......@@ -6,8 +6,8 @@ use rustc_middle::ty;
66use rustc_span::symbol::kw;
77use tracing::debug;
88
9use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type;
109use crate::error_reporting::infer::nice_region_error::NiceRegionError;
10use crate::error_reporting::infer::nice_region_error::find_anon_type::find_anon_type;
1111use crate::errors::ExplicitLifetimeRequired;
1212
1313impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs+1-1
......@@ -3,7 +3,7 @@ use std::fmt;
33use rustc_data_structures::intern::Interned;
44use rustc_errors::{Diag, IntoDiagArg};
55use rustc_hir::def::Namespace;
6use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
6use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
77use rustc_middle::bug;
88use rustc_middle::ty::error::ExpectedFound;
99use rustc_middle::ty::print::{FmtPrinter, Print, PrintTraitRefExt as _, RegionHighlightMode};
compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/static_impl_trait.rs+5-8
......@@ -3,7 +3,7 @@
33use rustc_data_structures::fx::FxIndexSet;
44use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, Subdiagnostic};
55use rustc_hir::def_id::DefId;
6use rustc_hir::intravisit::{walk_ty, Visitor};
6use rustc_hir::intravisit::{Visitor, walk_ty};
77use rustc_hir::{
88 self as hir, GenericBound, GenericParam, GenericParamKind, Item, ItemKind, Lifetime,
99 LifetimeName, LifetimeParamKind, MissingLifetimeKind, Node, TyKind,
......@@ -11,9 +11,9 @@ use rustc_hir::{
1111use rustc_middle::ty::{
1212 self, AssocItemContainer, StaticLifetimeVisitor, Ty, TyCtxt, TypeSuperVisitable, TypeVisitor,
1313};
14use rustc_span::Span;
1415use rustc_span::def_id::LocalDefId;
1516use rustc_span::symbol::Ident;
16use rustc_span::Span;
1717use tracing::debug;
1818
1919use crate::error_reporting::infer::nice_region_error::NiceRegionError;
......@@ -329,12 +329,9 @@ pub fn suggest_new_region_bound(
329329 .params
330330 .iter()
331331 .filter(|p| {
332 matches!(
333 p.kind,
334 GenericParamKind::Lifetime {
335 kind: hir::LifetimeParamKind::Explicit
336 }
337 )
332 matches!(p.kind, GenericParamKind::Lifetime {
333 kind: hir::LifetimeParamKind::Explicit
334 })
338335 })
339336 .map(|p| {
340337 if let hir::ParamName::Plain(name) = p.name {
compiler/rustc_trait_selection/src/error_reporting/infer/note.rs+3-3
......@@ -7,10 +7,10 @@ use rustc_span::symbol::kw;
77use tracing::debug;
88
99use super::ObligationCauseAsDiagArg;
10use crate::error_reporting::infer::{note_and_explain_region, TypeErrCtxt};
10use crate::error_reporting::infer::{TypeErrCtxt, note_and_explain_region};
1111use crate::errors::{
12 note_and_explain, FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound, OutlivesContent,
13 RefLongerThanData, RegionOriginNote, WhereClauseSuggestions,
12 FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound, OutlivesContent, RefLongerThanData,
13 RegionOriginNote, WhereClauseSuggestions, note_and_explain,
1414};
1515use crate::fluent_generated as fluent;
1616use crate::infer::{self, SubregionOrigin};
compiler/rustc_trait_selection/src/error_reporting/infer/note_and_explain.rs+3-3
......@@ -1,14 +1,14 @@
11use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect};
2use rustc_errors::{pluralize, Diag, MultiSpan};
2use rustc_errors::{Diag, MultiSpan, pluralize};
33use rustc_hir as hir;
44use rustc_hir::def::DefKind;
55use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
66use rustc_middle::ty::error::{ExpectedFound, TypeError};
77use rustc_middle::ty::fast_reject::DeepRejectCtxt;
88use rustc_middle::ty::print::{FmtPrinter, Printer};
9use rustc_middle::ty::{self, suggest_constraining_type_param, Ty};
9use rustc_middle::ty::{self, Ty, suggest_constraining_type_param};
1010use rustc_span::def_id::DefId;
11use rustc_span::{sym, BytePos, Span, Symbol};
11use rustc_span::{BytePos, Span, Symbol, sym};
1212use tracing::debug;
1313
1414use crate::error_reporting::TypeErrCtxt;
compiler/rustc_trait_selection/src/error_reporting/infer/region.rs+5-5
......@@ -2,7 +2,7 @@ use std::iter;
22
33use rustc_data_structures::fx::FxIndexSet;
44use rustc_errors::{
5 struct_span_code_err, Applicability, Diag, Subdiagnostic, E0309, E0310, E0311, E0495,
5 Applicability, Diag, E0309, E0310, E0311, E0495, Subdiagnostic, struct_span_code_err,
66};
77use rustc_hir::def::DefKind;
88use rustc_hir::def_id::{DefId, LocalDefId};
......@@ -17,13 +17,13 @@ use rustc_span::{BytePos, ErrorGuaranteed, Span, Symbol};
1717use rustc_type_ir::Upcast as _;
1818use tracing::{debug, instrument};
1919
20use super::nice_region_error::find_anon_type;
2120use super::ObligationCauseAsDiagArg;
22use crate::error_reporting::infer::ObligationCauseExt;
21use super::nice_region_error::find_anon_type;
2322use crate::error_reporting::TypeErrCtxt;
23use crate::error_reporting::infer::ObligationCauseExt;
2424use crate::errors::{
25 self, note_and_explain, FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound,
26 OutlivesContent, RefLongerThanData, RegionOriginNote, WhereClauseSuggestions,
25 self, FulfillReqLifetime, LfBoundNotSatisfied, OutlivesBound, OutlivesContent,
26 RefLongerThanData, RegionOriginNote, WhereClauseSuggestions, note_and_explain,
2727};
2828use crate::fluent_generated as fluent;
2929use crate::infer::region_constraints::GenericKind;
compiler/rustc_trait_selection/src/error_reporting/infer/suggest.rs+3-3
......@@ -1,7 +1,7 @@
11use core::ops::ControlFlow;
22
33use hir::def::CtorKind;
4use hir::intravisit::{walk_expr, walk_stmt, Visitor};
4use hir::intravisit::{Visitor, walk_expr, walk_stmt};
55use hir::{LetStmt, QPath};
66use rustc_data_structures::fx::FxIndexSet;
77use rustc_errors::{Applicability, Diag};
......@@ -14,11 +14,11 @@ use rustc_middle::traits::{
1414};
1515use rustc_middle::ty::print::with_no_trimmed_paths;
1616use rustc_middle::ty::{self as ty, GenericArgKind, IsSuggestable, Ty, TypeVisitableExt};
17use rustc_span::{sym, Span};
17use rustc_span::{Span, sym};
1818use tracing::debug;
1919
20use crate::error_reporting::infer::hir::Path;
2120use crate::error_reporting::TypeErrCtxt;
21use crate::error_reporting::infer::hir::Path;
2222use crate::errors::{
2323 ConsiderAddingAwait, FnConsiderCasting, FnItemsAreDistinct, FnUniqTypes,
2424 FunctionPointerSuggestion, SuggestAccessingField, SuggestRemoveSemiOrReturnBinding,
compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs+6-6
......@@ -1,27 +1,27 @@
11use std::ops::ControlFlow;
22
33use rustc_errors::{
4 struct_span_code_err, Applicability, Diag, MultiSpan, StashKey, E0283, E0284, E0790,
4 Applicability, Diag, E0283, E0284, E0790, MultiSpan, StashKey, struct_span_code_err,
55};
66use rustc_hir as hir;
7use rustc_hir::LangItem;
78use rustc_hir::def::{DefKind, Res};
89use rustc_hir::def_id::DefId;
910use rustc_hir::intravisit::Visitor as _;
10use rustc_hir::LangItem;
1111use rustc_infer::infer::{BoundRegionConversionTime, InferCtxt};
1212use rustc_infer::traits::util::elaborate;
1313use rustc_infer::traits::{
1414 Obligation, ObligationCause, ObligationCauseCode, PolyTraitObligation, PredicateObligation,
1515};
1616use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitable as _, TypeVisitableExt as _};
17use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
17use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
1818use tracing::{debug, instrument};
1919
20use crate::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
21use crate::error_reporting::traits::{to_pretty_impl_header, FindExprBySpan};
2220use crate::error_reporting::TypeErrCtxt;
23use crate::traits::query::evaluate_obligation::InferCtxtExt;
21use crate::error_reporting::infer::need_type_info::TypeAnnotationNeeded;
22use crate::error_reporting::traits::{FindExprBySpan, to_pretty_impl_header};
2423use crate::traits::ObligationCtxt;
24use crate::traits::query::evaluate_obligation::InferCtxtExt;
2525
2626#[derive(Debug)]
2727pub enum CandidateSource {
compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs+31-35
......@@ -5,29 +5,29 @@ use rustc_data_structures::fx::FxHashMap;
55use rustc_data_structures::unord::UnordSet;
66use rustc_errors::codes::*;
77use rustc_errors::{
8 pluralize, struct_span_code_err, Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey,
9 StringPart, Suggestions,
8 Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey, StringPart, Suggestions, pluralize,
9 struct_span_code_err,
1010};
1111use rustc_hir::def::Namespace;
12use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
12use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
1313use rustc_hir::intravisit::Visitor;
1414use rustc_hir::{self as hir, LangItem, Node};
1515use rustc_infer::infer::{InferOk, TypeTrace};
16use rustc_middle::traits::select::OverflowError;
1716use rustc_middle::traits::SignatureMismatchData;
17use rustc_middle::traits::select::OverflowError;
1818use rustc_middle::ty::abstract_const::NotConstEvaluatable;
1919use rustc_middle::ty::error::{ExpectedFound, TypeError};
2020use rustc_middle::ty::fold::{BottomUpFolder, TypeFolder, TypeSuperFoldable};
2121use rustc_middle::ty::print::{
22 with_forced_trimmed_paths, FmtPrinter, Print, PrintTraitPredicateExt as _,
23 PrintTraitRefExt as _,
22 FmtPrinter, Print, PrintTraitPredicateExt as _, PrintTraitRefExt as _,
23 with_forced_trimmed_paths,
2424};
2525use rustc_middle::ty::{
2626 self, ToPolyTraitRef, TraitRef, Ty, TyCtxt, TypeFoldable, TypeVisitableExt, Upcast,
2727};
2828use rustc_middle::{bug, span_bug};
2929use rustc_span::symbol::sym;
30use rustc_span::{BytePos, Span, Symbol, DUMMY_SP};
30use rustc_span::{BytePos, DUMMY_SP, Span, Symbol};
3131use tracing::{debug, instrument};
3232
3333use super::on_unimplemented::{AppendConstMessage, OnUnimplementedNote};
......@@ -35,18 +35,18 @@ use super::suggestions::get_explanation_based_on_obligation;
3535use super::{
3636 ArgKind, CandidateSimilarity, GetSafeTransmuteErrorAndReason, ImplCandidate, UnsatisfiedConst,
3737};
38use crate::error_reporting::TypeErrCtxt;
3839use crate::error_reporting::infer::TyCategory;
3940use crate::error_reporting::traits::report_object_safety_error;
40use crate::error_reporting::TypeErrCtxt;
4141use crate::errors::{
4242 AsyncClosureNotFn, ClosureFnMutLabel, ClosureFnOnceLabel, ClosureKindMismatch,
4343};
4444use crate::infer::{self, InferCtxt, InferCtxtExt as _};
4545use crate::traits::query::evaluate_obligation::InferCtxtExt as _;
4646use crate::traits::{
47 elaborate, MismatchedProjectionTypes, NormalizeExt, Obligation, ObligationCause,
48 ObligationCauseCode, ObligationCtxt, Overflow, PredicateObligation, SelectionError,
49 SignatureMismatch, TraitNotObjectSafe,
47 MismatchedProjectionTypes, NormalizeExt, Obligation, ObligationCause, ObligationCauseCode,
48 ObligationCtxt, Overflow, PredicateObligation, SelectionError, SignatureMismatch,
49 TraitNotObjectSafe, elaborate,
5050};
5151
5252impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
......@@ -1688,16 +1688,13 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
16881688 for (sp, label) in spans.into_iter() {
16891689 span.push_span_label(sp, label);
16901690 }
1691 err.highlighted_span_help(
1692 span,
1693 vec![
1694 StringPart::normal("there are ".to_string()),
1695 StringPart::highlighted("multiple different versions".to_string()),
1696 StringPart::normal(" of crate `".to_string()),
1697 StringPart::highlighted(format!("{name}")),
1698 StringPart::normal("` in the dependency graph".to_string()),
1699 ],
1700 );
1691 err.highlighted_span_help(span, vec![
1692 StringPart::normal("there are ".to_string()),
1693 StringPart::highlighted("multiple different versions".to_string()),
1694 StringPart::normal(" of crate `".to_string()),
1695 StringPart::highlighted(format!("{name}")),
1696 StringPart::normal("` in the dependency graph".to_string()),
1697 ]);
17011698 let candidates = if impl_candidates.is_empty() {
17021699 alternative_candidates(trait_def_id)
17031700 } else {
......@@ -1724,17 +1721,14 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
17241721 span.push_span_label(self.tcx.def_span(trait_def_id), "this is the required trait");
17251722 span.push_span_label(sp_candidate, "this type implements the required trait");
17261723 span.push_span_label(sp_found, "this type doesn't implement the required trait");
1727 err.highlighted_span_note(
1728 span,
1729 vec![
1730 StringPart::normal(
1731 "two types coming from two different versions of the same crate are \
1724 err.highlighted_span_note(span, vec![
1725 StringPart::normal(
1726 "two types coming from two different versions of the same crate are \
17321727 different types "
1733 .to_string(),
1734 ),
1735 StringPart::highlighted("even if they look the same".to_string()),
1736 ],
1737 );
1728 .to_string(),
1729 ),
1730 StringPart::highlighted("even if they look the same".to_string()),
1731 ]);
17381732 }
17391733 err.help("you can use `cargo tree` to explore your dependency tree");
17401734 return true;
......@@ -2742,10 +2736,12 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
27422736 .inputs
27432737 .iter()
27442738 .map(|arg| match arg.kind {
2745 hir::TyKind::Tup(tys) => ArgKind::Tuple(
2746 Some(arg.span),
2747 vec![("_".to_owned(), "_".to_owned()); tys.len()],
2748 ),
2739 hir::TyKind::Tup(tys) => {
2740 ArgKind::Tuple(Some(arg.span), vec![
2741 ("_".to_owned(), "_".to_owned());
2742 tys.len()
2743 ])
2744 }
27492745 _ => ArgKind::empty(),
27502746 })
27512747 .collect::<Vec<ArgKind>>(),
compiler/rustc_trait_selection/src/error_reporting/traits/mod.rs+2-2
......@@ -7,7 +7,7 @@ pub mod suggestions;
77use std::{fmt, iter};
88
99use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
10use rustc_errors::{struct_span_code_err, Applicability, Diag, MultiSpan, E0038, E0276};
10use rustc_errors::{Applicability, Diag, E0038, E0276, MultiSpan, struct_span_code_err};
1111use rustc_hir::def_id::{DefId, LocalDefId};
1212use rustc_hir::intravisit::Visitor;
1313use rustc_hir::{self as hir, LangItem};
......@@ -15,7 +15,7 @@ use rustc_infer::traits::{
1515 ObjectSafetyViolation, Obligation, ObligationCause, ObligationCauseCode, PredicateObligation,
1616 SelectionError,
1717};
18use rustc_middle::ty::print::{with_no_trimmed_paths, PrintTraitRefExt as _};
18use rustc_middle::ty::print::{PrintTraitRefExt as _, with_no_trimmed_paths};
1919use rustc_middle::ty::{self, Ty, TyCtxt};
2020use rustc_span::{ErrorGuaranteed, ExpnKind, Span};
2121use tracing::{info, instrument};
compiler/rustc_trait_selection/src/error_reporting/traits/on_unimplemented.rs+2-2
......@@ -4,7 +4,7 @@ use std::path::PathBuf;
44use rustc_ast::{AttrArgs, AttrArgsEq, AttrKind, Attribute, MetaItem, NestedMetaItem};
55use rustc_data_structures::fx::FxHashMap;
66use rustc_errors::codes::*;
7use rustc_errors::{struct_span_code_err, ErrorGuaranteed};
7use rustc_errors::{ErrorGuaranteed, struct_span_code_err};
88use rustc_hir::def_id::{DefId, LocalDefId};
99use rustc_macros::LintDiagnostic;
1010use rustc_middle::bug;
......@@ -12,8 +12,8 @@ use rustc_middle::ty::print::PrintTraitRefExt as _;
1212use rustc_middle::ty::{self, GenericArgsRef, GenericParamDefKind, TyCtxt};
1313use rustc_parse_format::{ParseMode, Parser, Piece, Position};
1414use rustc_session::lint::builtin::UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES;
15use rustc_span::symbol::{kw, sym, Symbol};
1615use rustc_span::Span;
16use rustc_span::symbol::{Symbol, kw, sym};
1717use tracing::{debug, info};
1818use {rustc_attr as attr, rustc_hir as hir};
1919
compiler/rustc_trait_selection/src/error_reporting/traits/overflow.rs+1-1
......@@ -1,7 +1,7 @@
11use std::fmt;
22
33use rustc_errors::{
4 struct_span_code_err, Diag, EmissionGuarantee, ErrorGuaranteed, FatalError, E0275,
4 Diag, E0275, EmissionGuarantee, ErrorGuaranteed, FatalError, struct_span_code_err,
55};
66use rustc_hir::def::Namespace;
77use rustc_hir::def_id::LOCAL_CRATE;
compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs+18-19
......@@ -9,8 +9,8 @@ use rustc_data_structures::fx::FxHashSet;
99use rustc_data_structures::stack::ensure_sufficient_stack;
1010use rustc_errors::codes::*;
1111use rustc_errors::{
12 pluralize, struct_span_code_err, Applicability, Diag, EmissionGuarantee, MultiSpan, Style,
13 SuggestionStyle,
12 Applicability, Diag, EmissionGuarantee, MultiSpan, Style, SuggestionStyle, pluralize,
13 struct_span_code_err,
1414};
1515use rustc_hir as hir;
1616use rustc_hir::def::{CtorOf, DefKind, Res};
......@@ -18,25 +18,25 @@ use rustc_hir::def_id::DefId;
1818use rustc_hir::intravisit::Visitor;
1919use rustc_hir::lang_items::LangItem;
2020use rustc_hir::{
21 is_range_literal, CoroutineDesugaring, CoroutineKind, CoroutineSource, Expr, HirId, Node,
21 CoroutineDesugaring, CoroutineKind, CoroutineSource, Expr, HirId, Node, is_range_literal,
2222};
2323use rustc_infer::infer::{BoundRegionConversionTime, DefineOpaqueTypes, InferCtxt, InferOk};
2424use rustc_middle::hir::map;
2525use rustc_middle::traits::IsConstable;
2626use rustc_middle::ty::error::TypeError;
2727use rustc_middle::ty::print::{
28 with_forced_trimmed_paths, with_no_trimmed_paths, PrintPolyTraitPredicateExt as _,
29 PrintPolyTraitRefExt, PrintTraitPredicateExt as _,
28 PrintPolyTraitPredicateExt as _, PrintPolyTraitRefExt, PrintTraitPredicateExt as _,
29 with_forced_trimmed_paths, with_no_trimmed_paths,
3030};
3131use rustc_middle::ty::{
32 self, suggest_arbitrary_trait_bound, suggest_constraining_type_param, AdtKind, GenericArgs,
33 InferTy, IsSuggestable, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable, TypeFolder,
34 TypeSuperFoldable, TypeVisitableExt, TypeckResults, Upcast,
32 self, AdtKind, GenericArgs, InferTy, IsSuggestable, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable,
33 TypeFolder, TypeSuperFoldable, TypeVisitableExt, TypeckResults, Upcast,
34 suggest_arbitrary_trait_bound, suggest_constraining_type_param,
3535};
3636use rustc_middle::{bug, span_bug};
3737use rustc_span::def_id::LocalDefId;
38use rustc_span::symbol::{kw, sym, Ident, Symbol};
39use rustc_span::{BytePos, DesugaringKind, ExpnKind, MacroKind, Span, DUMMY_SP};
38use rustc_span::symbol::{Ident, Symbol, kw, sym};
39use rustc_span::{BytePos, DUMMY_SP, DesugaringKind, ExpnKind, MacroKind, Span};
4040use rustc_target::spec::abi;
4141use tracing::{debug, instrument};
4242
......@@ -668,10 +668,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
668668 }
669669 // Empty suggestions with empty spans ICE with debug assertions
670670 if steps == 0 {
671 return (
672 msg.trim_end_matches(" and dereferencing instead"),
673 vec![(prefix_span, String::new())],
674 );
671 return (msg.trim_end_matches(" and dereferencing instead"), vec![(
672 prefix_span,
673 String::new(),
674 )]);
675675 }
676676 let derefs = "*".repeat(steps);
677677 let needs_parens = steps > 0
......@@ -3553,11 +3553,10 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
35533553 }
35543554 ObligationCauseCode::TrivialBound => {
35553555 err.help("see issue #48214");
3556 tcx.disabled_nightly_features(
3557 err,
3558 Some(tcx.local_def_id_to_hir_id(body_id)),
3559 [(String::new(), sym::trivial_bounds)],
3560 );
3556 tcx.disabled_nightly_features(err, Some(tcx.local_def_id_to_hir_id(body_id)), [(
3557 String::new(),
3558 sym::trivial_bounds,
3559 )]);
35613560 }
35623561 ObligationCauseCode::OpaqueReturnType(expr_info) => {
35633562 if let Some((expr_ty, hir_id)) = expr_info {
compiler/rustc_trait_selection/src/errors.rs+3-3
......@@ -8,17 +8,17 @@ use rustc_errors::{
88};
99use rustc_hir as hir;
1010use rustc_hir::def_id::LocalDefId;
11use rustc_hir::intravisit::{walk_ty, Visitor};
11use rustc_hir::intravisit::{Visitor, walk_ty};
1212use rustc_hir::{FnRetTy, GenericParamKind};
1313use rustc_macros::{Diagnostic, Subdiagnostic};
1414use rustc_middle::ty::print::{PrintTraitRefExt as _, TraitRefPrintOnlyTraitPath};
1515use rustc_middle::ty::{self, Binder, ClosureKind, FnSig, PolyTraitRef, Region, Ty, TyCtxt};
16use rustc_span::symbol::{kw, Ident, Symbol};
16use rustc_span::symbol::{Ident, Symbol, kw};
1717use rustc_span::{BytePos, Span};
1818
19use crate::error_reporting::infer::ObligationCauseAsDiagArg;
1920use crate::error_reporting::infer::need_type_info::UnderspecifiedArgKind;
2021use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted;
21use crate::error_reporting::infer::ObligationCauseAsDiagArg;
2222use crate::fluent_generated as fluent;
2323
2424pub mod note_and_explain;
compiler/rustc_trait_selection/src/errors/note_and_explain.rs+1-1
......@@ -2,8 +2,8 @@ use rustc_errors::{Diag, EmissionGuarantee, IntoDiagArg, SubdiagMessageOp, Subdi
22use rustc_hir::def_id::LocalDefId;
33use rustc_middle::bug;
44use rustc_middle::ty::{self, TyCtxt};
5use rustc_span::symbol::kw;
65use rustc_span::Span;
6use rustc_span::symbol::kw;
77
88use crate::error_reporting::infer::nice_region_error::find_anon_type;
99use crate::fluent_generated as fluent;
compiler/rustc_trait_selection/src/regions.rs+1-1
......@@ -1,8 +1,8 @@
11use rustc_infer::infer::outlives::env::OutlivesEnvironment;
22use rustc_infer::infer::{InferCtxt, RegionResolutionError};
33use rustc_macros::extension;
4use rustc_middle::traits::query::NoSolution;
54use rustc_middle::traits::ObligationCause;
5use rustc_middle::traits::query::NoSolution;
66
77use crate::traits::ScrubbedTraitError;
88
compiler/rustc_trait_selection/src/solve/delegate.rs+5-5
......@@ -11,7 +11,7 @@ use rustc_infer::traits::solve::Goal;
1111use rustc_infer::traits::{ObligationCause, Reveal};
1212use rustc_middle::ty::fold::TypeFoldable;
1313use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt as _};
14use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
14use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span};
1515use rustc_type_ir::solve::{Certainty, NoSolution, SolverMode};
1616use tracing::trace;
1717
......@@ -182,10 +182,10 @@ impl<'tcx> rustc_next_trait_solver::delegate::SolverDelegate for SolverDelegate<
182182 }
183183
184184 fn inject_new_hidden_type_unchecked(&self, key: ty::OpaqueTypeKey<'tcx>, hidden_ty: Ty<'tcx>) {
185 self.0.inject_new_hidden_type_unchecked(
186 key,
187 ty::OpaqueHiddenType { ty: hidden_ty, span: DUMMY_SP },
188 )
185 self.0.inject_new_hidden_type_unchecked(key, ty::OpaqueHiddenType {
186 ty: hidden_ty,
187 span: DUMMY_SP,
188 })
189189 }
190190
191191 fn reset_opaque_types(&self) {
compiler/rustc_trait_selection/src/solve/fulfill.rs+5-5
......@@ -15,9 +15,9 @@ use rustc_middle::ty::{self, TyCtxt};
1515use rustc_next_trait_solver::solve::{GenerateProofTree, SolverDelegateEvalExt as _};
1616use tracing::instrument;
1717
18use super::Certainty;
1819use super::delegate::SolverDelegate;
1920use super::inspect::{self, ProofTreeInferCtxtExt, ProofTreeVisitor};
20use super::Certainty;
2121use crate::traits::{FulfillmentError, FulfillmentErrorCode, ScrubbedTraitError};
2222
2323/// A trait engine using the new trait solver.
......@@ -347,10 +347,10 @@ fn find_best_leaf_obligation<'tcx>(
347347) -> PredicateObligation<'tcx> {
348348 let obligation = infcx.resolve_vars_if_possible(obligation.clone());
349349 infcx
350 .visit_proof_tree(
351 obligation.clone().into(),
352 &mut BestObligation { obligation: obligation.clone(), consider_ambiguities },
353 )
350 .visit_proof_tree(obligation.clone().into(), &mut BestObligation {
351 obligation: obligation.clone(),
352 consider_ambiguities,
353 })
354354 .break_value()
355355 .unwrap_or(obligation)
356356}
compiler/rustc_trait_selection/src/solve/inspect/analyse.rs+2-2
......@@ -15,14 +15,14 @@ use rustc_ast_ir::try_visit;
1515use rustc_ast_ir::visit::VisitorResult;
1616use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk};
1717use rustc_macros::extension;
18use rustc_middle::traits::solve::{Certainty, Goal, GoalSource, NoSolution, QueryResult};
1918use rustc_middle::traits::ObligationCause;
19use rustc_middle::traits::solve::{Certainty, Goal, GoalSource, NoSolution, QueryResult};
2020use rustc_middle::ty::{TyCtxt, TypeFoldable};
2121use rustc_middle::{bug, ty};
2222use rustc_next_trait_solver::resolve::EagerResolver;
2323use rustc_next_trait_solver::solve::inspect::{self, instantiate_canonical_state};
2424use rustc_next_trait_solver::solve::{GenerateProofTree, MaybeCause, SolverDelegateEvalExt as _};
25use rustc_span::{Span, DUMMY_SP};
25use rustc_span::{DUMMY_SP, Span};
2626use tracing::instrument;
2727
2828use crate::solve::delegate::SolverDelegate;
compiler/rustc_trait_selection/src/solve/normalize.rs+17-18
......@@ -3,8 +3,8 @@ use std::fmt::Debug;
33use std::marker::PhantomData;
44
55use rustc_data_structures::stack::ensure_sufficient_stack;
6use rustc_infer::infer::at::At;
76use rustc_infer::infer::InferCtxt;
7use rustc_infer::infer::at::At;
88use rustc_infer::traits::{FromSolverError, Obligation, TraitEngine};
99use rustc_middle::traits::ObligationCause;
1010use rustc_middle::ty::{
......@@ -14,8 +14,8 @@ use rustc_middle::ty::{
1414use tracing::instrument;
1515
1616use super::{FulfillmentCtxt, NextSolverError};
17use crate::error_reporting::traits::OverflowCause;
1817use crate::error_reporting::InferCtxtErrorExt;
18use crate::error_reporting::traits::OverflowCause;
1919use crate::traits::query::evaluate_obligation::InferCtxtExt;
2020use crate::traits::{BoundVarReplacer, PlaceholderReplacer, ScrubbedTraitError};
2121
......@@ -130,12 +130,11 @@ where
130130 self.depth += 1;
131131
132132 let new_infer_ct = infcx.next_const_var(self.at.cause.span);
133 let obligation = Obligation::new(
134 tcx,
135 self.at.cause.clone(),
136 self.at.param_env,
137 ty::NormalizesTo { alias: uv.into(), term: new_infer_ct.into() },
138 );
133 let obligation =
134 Obligation::new(tcx, self.at.cause.clone(), self.at.param_env, ty::NormalizesTo {
135 alias: uv.into(),
136 term: new_infer_ct.into(),
137 });
139138
140139 let result = if infcx.predicate_may_hold(&obligation) {
141140 self.fulfill_cx.register_predicate_obligation(infcx, obligation);
......@@ -253,20 +252,20 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for DeeplyNormalizeForDiagnosticsFolder<'_,
253252 }
254253
255254 fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
256 deeply_normalize_with_skipped_universes(
257 self.at,
258 ty,
259 vec![None; ty.outer_exclusive_binder().as_usize()],
260 )
255 deeply_normalize_with_skipped_universes(self.at, ty, vec![
256 None;
257 ty.outer_exclusive_binder()
258 .as_usize()
259 ])
261260 .unwrap_or_else(|_: Vec<ScrubbedTraitError<'tcx>>| ty.super_fold_with(self))
262261 }
263262
264263 fn fold_const(&mut self, ct: ty::Const<'tcx>) -> ty::Const<'tcx> {
265 deeply_normalize_with_skipped_universes(
266 self.at,
267 ct,
268 vec![None; ct.outer_exclusive_binder().as_usize()],
269 )
264 deeply_normalize_with_skipped_universes(self.at, ct, vec![
265 None;
266 ct.outer_exclusive_binder()
267 .as_usize()
268 ])
270269 .unwrap_or_else(|_: Vec<ScrubbedTraitError<'tcx>>| ct.super_fold_with(self))
271270 }
272271}
compiler/rustc_trait_selection/src/traits/coherence.rs+23-30
......@@ -20,20 +20,20 @@ use rustc_middle::ty::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitableEx
2020use rustc_middle::ty::{self, Ty, TyCtxt};
2121pub use rustc_next_trait_solver::coherence::*;
2222use rustc_span::symbol::sym;
23use rustc_span::{Span, DUMMY_SP};
23use rustc_span::{DUMMY_SP, Span};
2424use tracing::{debug, instrument, warn};
2525
2626use super::ObligationCtxt;
2727use crate::error_reporting::traits::suggest_new_overflow_limit;
28use crate::infer::outlives::env::OutlivesEnvironment;
2928use crate::infer::InferOk;
29use crate::infer::outlives::env::OutlivesEnvironment;
3030use crate::solve::inspect::{InspectGoal, ProofTreeInferCtxtExt, ProofTreeVisitor};
3131use crate::solve::{deeply_normalize_for_diagnostics, inspect};
3232use crate::traits::query::evaluate_obligation::InferCtxtExt;
3333use crate::traits::select::IntercrateAmbiguityCause;
3434use crate::traits::{
35 util, FulfillmentErrorCode, NormalizeExt, Obligation, ObligationCause, PredicateObligation,
36 SelectionContext, SkipLeakCheck,
35 FulfillmentErrorCode, NormalizeExt, Obligation, ObligationCause, PredicateObligation,
36 SelectionContext, SkipLeakCheck, util,
3737};
3838
3939pub struct OverlapResult<'tcx> {
......@@ -346,10 +346,9 @@ fn impl_intersection_has_impossible_obligation<'a, 'cx, 'tcx>(
346346 overflowing_predicates: ambiguities
347347 .into_iter()
348348 .filter(|error| {
349 matches!(
350 error.code,
351 FulfillmentErrorCode::Ambiguity { overflow: Some(true) }
352 )
349 matches!(error.code, FulfillmentErrorCode::Ambiguity {
350 overflow: Some(true)
351 })
353352 })
354353 .map(|e| infcx.resolve_vars_if_possible(e.obligation.predicate))
355354 .collect(),
......@@ -470,16 +469,13 @@ fn plug_infer_with_placeholders<'tcx>(
470469 // Comparing against a type variable never registers hidden types anyway
471470 DefineOpaqueTypes::Yes,
472471 ty,
473 Ty::new_placeholder(
474 self.infcx.tcx,
475 ty::Placeholder {
476 universe: self.universe,
477 bound: ty::BoundTy {
478 var: self.next_var(),
479 kind: ty::BoundTyKind::Anon,
480 },
472 Ty::new_placeholder(self.infcx.tcx, ty::Placeholder {
473 universe: self.universe,
474 bound: ty::BoundTy {
475 var: self.next_var(),
476 kind: ty::BoundTyKind::Anon,
481477 },
482 ),
478 }),
483479 )
484480 else {
485481 bug!("we always expect to be able to plug an infer var with placeholder")
......@@ -499,10 +495,10 @@ fn plug_infer_with_placeholders<'tcx>(
499495 // registration happening anyway.
500496 DefineOpaqueTypes::Yes,
501497 ct,
502 ty::Const::new_placeholder(
503 self.infcx.tcx,
504 ty::Placeholder { universe: self.universe, bound: self.next_var() },
505 ),
498 ty::Const::new_placeholder(self.infcx.tcx, ty::Placeholder {
499 universe: self.universe,
500 bound: self.next_var(),
501 }),
506502 )
507503 else {
508504 bug!("we always expect to be able to plug an infer var with placeholder")
......@@ -527,16 +523,13 @@ fn plug_infer_with_placeholders<'tcx>(
527523 // Lifetimes don't contain opaque types (or any types for that matter).
528524 DefineOpaqueTypes::Yes,
529525 r,
530 ty::Region::new_placeholder(
531 self.infcx.tcx,
532 ty::Placeholder {
533 universe: self.universe,
534 bound: ty::BoundRegion {
535 var: self.next_var(),
536 kind: ty::BoundRegionKind::BrAnon,
537 },
526 ty::Region::new_placeholder(self.infcx.tcx, ty::Placeholder {
527 universe: self.universe,
528 bound: ty::BoundRegion {
529 var: self.next_var(),
530 kind: ty::BoundRegionKind::BrAnon,
538531 },
539 ),
532 }),
540533 )
541534 else {
542535 bug!("we always expect to be able to plug an infer var with placeholder")
compiler/rustc_trait_selection/src/traits/const_evaluatable.rs+1-1
......@@ -16,7 +16,7 @@ use rustc_middle::mir::interpret::ErrorHandled;
1616use rustc_middle::traits::ObligationCause;
1717use rustc_middle::ty::abstract_const::NotConstEvaluatable;
1818use rustc_middle::ty::{self, TyCtxt, TypeVisitable, TypeVisitableExt, TypeVisitor};
19use rustc_span::{Span, DUMMY_SP};
19use rustc_span::{DUMMY_SP, Span};
2020use tracing::{debug, instrument};
2121
2222use crate::traits::ObligationCtxt;
compiler/rustc_trait_selection/src/traits/fulfill.rs+2-2
......@@ -18,8 +18,8 @@ use tracing::{debug, debug_span, instrument};
1818use super::project::{self, ProjectAndUnifyResult};
1919use super::select::SelectionContext;
2020use super::{
21 const_evaluatable, wf, EvaluationResult, FulfillmentError, FulfillmentErrorCode,
22 PredicateObligation, ScrubbedTraitError, Unimplemented,
21 EvaluationResult, FulfillmentError, FulfillmentErrorCode, PredicateObligation,
22 ScrubbedTraitError, Unimplemented, const_evaluatable, wf,
2323};
2424use crate::error_reporting::InferCtxtErrorExt;
2525use crate::infer::{InferCtxt, TyOrConstInferVar};
compiler/rustc_trait_selection/src/traits/mod.rs+8-8
......@@ -35,20 +35,20 @@ use rustc_middle::ty::visit::{TypeVisitable, TypeVisitableExt};
3535use rustc_middle::ty::{
3636 self, GenericArgs, GenericArgsRef, Ty, TyCtxt, TypeFolder, TypeSuperVisitable, Upcast,
3737};
38use rustc_span::def_id::DefId;
3938use rustc_span::Span;
39use rustc_span::def_id::DefId;
4040use tracing::{debug, instrument};
4141
4242pub use self::coherence::{
43 add_placeholder_note, orphan_check_trait_ref, overlapping_impls, InCrate, IsFirstInputType,
44 OrphanCheckErr, OrphanCheckMode, OverlapResult, UncoveredTyParams,
43 InCrate, IsFirstInputType, OrphanCheckErr, OrphanCheckMode, OverlapResult, UncoveredTyParams,
44 add_placeholder_note, orphan_check_trait_ref, overlapping_impls,
4545};
4646pub use self::engine::{ObligationCtxt, TraitEngineExt};
4747pub use self::fulfill::{FulfillmentContext, OldSolverError, PendingPredicateObligation};
4848pub use self::normalize::NormalizeExt;
4949pub use self::object_safety::{
50 hir_ty_lowering_object_safety_violations, is_vtable_safe_method,
51 object_safety_violations_for_assoc_item, ObjectSafetyViolation,
50 ObjectSafetyViolation, hir_ty_lowering_object_safety_violations, is_vtable_safe_method,
51 object_safety_violations_for_assoc_item,
5252};
5353pub use self::project::{normalize_inherent_projection, normalize_projection_ty};
5454pub use self::select::{
......@@ -59,13 +59,13 @@ pub use self::specialize::specialization_graph::{
5959 FutureCompatOverlapError, FutureCompatOverlapErrorKind,
6060};
6161pub use self::specialize::{
62 specialization_graph, translate_args, translate_args_with_cause, OverlapError,
62 OverlapError, specialization_graph, translate_args, translate_args_with_cause,
6363};
6464pub use self::structural_normalize::StructurallyNormalizeExt;
6565pub use self::util::{
66 elaborate, expand_trait_aliases, impl_item_is_final, supertraits,
66 BoundVarReplacer, PlaceholderReplacer, TraitAliasExpander, TraitAliasExpansionInfo, elaborate,
67 expand_trait_aliases, impl_item_is_final, supertraits,
6768 transitive_bounds_that_define_assoc_item, upcast_choices, with_replaced_escaping_bound_vars,
68 BoundVarReplacer, PlaceholderReplacer, TraitAliasExpander, TraitAliasExpansionInfo,
6969};
7070use crate::error_reporting::InferCtxtErrorExt;
7171use crate::infer::outlives::env::OutlivesEnvironment;
compiler/rustc_trait_selection/src/traits/normalize.rs+4-4
......@@ -1,8 +1,8 @@
11//! Deeply normalize types using the old trait solver.
22
33use rustc_data_structures::stack::ensure_sufficient_stack;
4use rustc_infer::infer::at::At;
54use rustc_infer::infer::InferOk;
5use rustc_infer::infer::at::At;
66use rustc_infer::traits::{
77 FromSolverError, Normalized, Obligation, PredicateObligation, TraitEngine,
88};
......@@ -14,11 +14,11 @@ use rustc_middle::ty::{
1414use tracing::{debug, instrument};
1515
1616use super::{
17 project, with_replaced_escaping_bound_vars, BoundVarReplacer, PlaceholderReplacer,
18 SelectionContext,
17 BoundVarReplacer, PlaceholderReplacer, SelectionContext, project,
18 with_replaced_escaping_bound_vars,
1919};
20use crate::error_reporting::traits::OverflowCause;
2120use crate::error_reporting::InferCtxtErrorExt;
21use crate::error_reporting::traits::OverflowCause;
2222use crate::solve::NextSolverError;
2323
2424#[extension(pub trait NormalizeExt<'tcx>)]
compiler/rustc_trait_selection/src/traits/object_safety.rs+3-3
......@@ -20,17 +20,17 @@ use rustc_middle::ty::{
2020 TypeFoldable, TypeFolder, TypeSuperFoldable, TypeSuperVisitable, TypeVisitable,
2121 TypeVisitableExt, TypeVisitor, Upcast,
2222};
23use rustc_span::symbol::Symbol;
2423use rustc_span::Span;
24use rustc_span::symbol::Symbol;
2525use rustc_target::abi::Abi;
2626use smallvec::SmallVec;
2727use tracing::{debug, instrument};
2828
2929use super::elaborate;
3030use crate::infer::TyCtxtInferExt;
31use crate::traits::query::evaluate_obligation::InferCtxtExt;
3231pub use crate::traits::ObjectSafetyViolation;
33use crate::traits::{util, MethodViolationCode, Obligation, ObligationCause};
32use crate::traits::query::evaluate_obligation::InferCtxtExt;
33use crate::traits::{MethodViolationCode, Obligation, ObligationCause, util};
3434
3535/// Returns the object safety violations that affect HIR ty lowering.
3636///
compiler/rustc_trait_selection/src/traits/outlives_bounds.rs+1-1
......@@ -1,6 +1,6 @@
11use rustc_data_structures::fx::FxIndexSet;
2use rustc_infer::infer::resolve::OpportunisticRegionResolver;
32use rustc_infer::infer::InferOk;
3use rustc_infer::infer::resolve::OpportunisticRegionResolver;
44use rustc_macros::extension;
55use rustc_middle::infer::canonical::{OriginalQueryValues, QueryRegionConstraints};
66use rustc_middle::span_bug;
compiler/rustc_trait_selection/src/traits/project.rs+48-58
......@@ -7,11 +7,11 @@ use rustc_data_structures::stack::ensure_sufficient_stack;
77use rustc_errors::ErrorGuaranteed;
88use rustc_hir::def::DefKind;
99use rustc_hir::lang_items::LangItem;
10use rustc_infer::infer::resolve::OpportunisticRegionResolver;
1110use rustc_infer::infer::DefineOpaqueTypes;
11use rustc_infer::infer::resolve::OpportunisticRegionResolver;
1212use rustc_infer::traits::ObligationCauseCode;
13use rustc_middle::traits::select::OverflowError;
1413pub use rustc_middle::traits::Reveal;
14use rustc_middle::traits::select::OverflowError;
1515use rustc_middle::traits::{BuiltinImplSource, ImplSource, ImplSourceUserDefinedData};
1616use rustc_middle::ty::fast_reject::DeepRejectCtxt;
1717use rustc_middle::ty::fold::TypeFoldable;
......@@ -22,9 +22,9 @@ use rustc_span::symbol::sym;
2222use tracing::{debug, instrument};
2323
2424use super::{
25 specialization_graph, translate_args, util, MismatchedProjectionTypes, Normalized,
26 NormalizedTerm, Obligation, ObligationCause, PredicateObligation, ProjectionCacheEntry,
27 ProjectionCacheKey, Selection, SelectionContext, SelectionError,
25 MismatchedProjectionTypes, Normalized, NormalizedTerm, Obligation, ObligationCause,
26 PredicateObligation, ProjectionCacheEntry, ProjectionCacheKey, Selection, SelectionContext,
27 SelectionError, specialization_graph, translate_args, util,
2828};
2929use crate::errors::InherentProjectionNormalizationOverflow;
3030use crate::infer::{BoundRegionConversionTime, InferOk};
......@@ -1696,18 +1696,14 @@ fn confirm_closure_candidate<'cx, 'tcx>(
16961696 } else {
16971697 let upvars_projection_def_id =
16981698 tcx.require_lang_item(LangItem::AsyncFnKindUpvars, None);
1699 let tupled_upvars_ty = Ty::new_projection(
1700 tcx,
1701 upvars_projection_def_id,
1702 [
1703 ty::GenericArg::from(kind_ty),
1704 Ty::from_closure_kind(tcx, ty::ClosureKind::FnOnce).into(),
1705 tcx.lifetimes.re_static.into(),
1706 sig.tupled_inputs_ty.into(),
1707 args.tupled_upvars_ty().into(),
1708 args.coroutine_captures_by_ref_ty().into(),
1709 ],
1710 );
1699 let tupled_upvars_ty = Ty::new_projection(tcx, upvars_projection_def_id, [
1700 ty::GenericArg::from(kind_ty),
1701 Ty::from_closure_kind(tcx, ty::ClosureKind::FnOnce).into(),
1702 tcx.lifetimes.re_static.into(),
1703 sig.tupled_inputs_ty.into(),
1704 args.tupled_upvars_ty().into(),
1705 args.coroutine_captures_by_ref_ty().into(),
1706 ]);
17111707 sig.to_coroutine(
17121708 tcx,
17131709 args.parent_args(),
......@@ -1834,18 +1830,14 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
18341830 // will project to the right upvars for the generator, appending the inputs and
18351831 // coroutine upvars respecting the closure kind.
18361832 // N.B. No need to register a `AsyncFnKindHelper` goal here, it's already in `nested`.
1837 let tupled_upvars_ty = Ty::new_projection(
1838 tcx,
1839 upvars_projection_def_id,
1840 [
1841 ty::GenericArg::from(kind_ty),
1842 Ty::from_closure_kind(tcx, goal_kind).into(),
1843 env_region.into(),
1844 sig.tupled_inputs_ty.into(),
1845 args.tupled_upvars_ty().into(),
1846 args.coroutine_captures_by_ref_ty().into(),
1847 ],
1848 );
1833 let tupled_upvars_ty = Ty::new_projection(tcx, upvars_projection_def_id, [
1834 ty::GenericArg::from(kind_ty),
1835 Ty::from_closure_kind(tcx, goal_kind).into(),
1836 env_region.into(),
1837 sig.tupled_inputs_ty.into(),
1838 args.tupled_upvars_ty().into(),
1839 args.coroutine_captures_by_ref_ty().into(),
1840 ]);
18491841 sig.to_coroutine(
18501842 tcx,
18511843 args.parent_args(),
......@@ -1859,16 +1851,17 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
18591851 name => bug!("no such associated type: {name}"),
18601852 };
18611853 let projection_term = match item_name {
1862 sym::CallOnceFuture | sym::Output => ty::AliasTerm::new(
1863 tcx,
1864 obligation.predicate.def_id,
1865 [self_ty, sig.tupled_inputs_ty],
1866 ),
1867 sym::CallRefFuture => ty::AliasTerm::new(
1868 tcx,
1869 obligation.predicate.def_id,
1870 [ty::GenericArg::from(self_ty), sig.tupled_inputs_ty.into(), env_region.into()],
1871 ),
1854 sym::CallOnceFuture | sym::Output => {
1855 ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
1856 self_ty,
1857 sig.tupled_inputs_ty,
1858 ])
1859 }
1860 sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
1861 ty::GenericArg::from(self_ty),
1862 sig.tupled_inputs_ty.into(),
1863 env_region.into(),
1864 ]),
18721865 name => bug!("no such associated type: {name}"),
18731866 };
18741867
......@@ -1888,20 +1881,17 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
18881881 name => bug!("no such associated type: {name}"),
18891882 };
18901883 let projection_term = match item_name {
1891 sym::CallOnceFuture | sym::Output => ty::AliasTerm::new(
1892 tcx,
1893 obligation.predicate.def_id,
1894 [self_ty, Ty::new_tup(tcx, sig.inputs())],
1895 ),
1896 sym::CallRefFuture => ty::AliasTerm::new(
1897 tcx,
1898 obligation.predicate.def_id,
1899 [
1900 ty::GenericArg::from(self_ty),
1901 Ty::new_tup(tcx, sig.inputs()).into(),
1902 env_region.into(),
1903 ],
1904 ),
1884 sym::CallOnceFuture | sym::Output => {
1885 ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
1886 self_ty,
1887 Ty::new_tup(tcx, sig.inputs()),
1888 ])
1889 }
1890 sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
1891 ty::GenericArg::from(self_ty),
1892 Ty::new_tup(tcx, sig.inputs()).into(),
1893 env_region.into(),
1894 ]),
19051895 name => bug!("no such associated type: {name}"),
19061896 };
19071897
......@@ -1924,11 +1914,11 @@ fn confirm_async_closure_candidate<'cx, 'tcx>(
19241914 sym::CallOnceFuture | sym::Output => {
19251915 ty::AliasTerm::new(tcx, obligation.predicate.def_id, [self_ty, sig.inputs()[0]])
19261916 }
1927 sym::CallRefFuture => ty::AliasTerm::new(
1928 tcx,
1929 obligation.predicate.def_id,
1930 [ty::GenericArg::from(self_ty), sig.inputs()[0].into(), env_region.into()],
1931 ),
1917 sym::CallRefFuture => ty::AliasTerm::new(tcx, obligation.predicate.def_id, [
1918 ty::GenericArg::from(self_ty),
1919 sig.inputs()[0].into(),
1920 env_region.into(),
1921 ]),
19321922 name => bug!("no such associated type: {name}"),
19331923 };
19341924
compiler/rustc_trait_selection/src/traits/query/dropck_outlives.rs+2-2
......@@ -1,11 +1,11 @@
11use rustc_data_structures::fx::FxHashSet;
22use rustc_middle::traits::query::{DropckConstraint, DropckOutlivesResult};
33use rustc_middle::ty::{self, EarlyBinder, ParamEnvAnd, Ty, TyCtxt};
4use rustc_span::{Span, DUMMY_SP};
4use rustc_span::{DUMMY_SP, Span};
55use tracing::{debug, instrument};
66
7use crate::traits::query::normalize::QueryNormalizeExt;
87use crate::traits::query::NoSolution;
8use crate::traits::query::normalize::QueryNormalizeExt;
99use crate::traits::{Normalized, ObligationCause, ObligationCtxt};
1010
1111/// This returns true if the type `ty` is "trivial" for
compiler/rustc_trait_selection/src/traits/query/evaluate_obligation.rs+1-1
......@@ -1,8 +1,8 @@
11use rustc_macros::extension;
22use rustc_middle::span_bug;
33
4use crate::infer::canonical::OriginalQueryValues;
54use crate::infer::InferCtxt;
5use crate::infer::canonical::OriginalQueryValues;
66use crate::traits::{
77 EvaluationResult, ObligationCtxt, OverflowError, PredicateObligation, SelectionContext,
88};
compiler/rustc_trait_selection/src/traits/query/normalize.rs+1-1
......@@ -13,8 +13,8 @@ use rustc_span::DUMMY_SP;
1313use tracing::{debug, info, instrument};
1414
1515use super::NoSolution;
16use crate::error_reporting::traits::OverflowCause;
1716use crate::error_reporting::InferCtxtErrorExt;
17use crate::error_reporting::traits::OverflowCause;
1818use crate::infer::at::At;
1919use crate::infer::canonical::OriginalQueryValues;
2020use crate::infer::{InferCtxt, InferOk};
compiler/rustc_trait_selection/src/traits/query/type_op/ascribe_user_type.rs+3-3
......@@ -1,10 +1,10 @@
1use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
1use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
22use rustc_infer::traits::Obligation;
3pub use rustc_middle::traits::query::type_op::AscribeUserType;
43use rustc_middle::traits::query::NoSolution;
4pub use rustc_middle::traits::query::type_op::AscribeUserType;
55use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
66use rustc_middle::ty::{self, ParamEnvAnd, Ty, TyCtxt, UserArgs, UserSelfTy, UserType};
7use rustc_span::{Span, DUMMY_SP};
7use rustc_span::{DUMMY_SP, Span};
88use tracing::{debug, instrument};
99
1010use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs+2-2
......@@ -7,10 +7,10 @@ use rustc_middle::ty::{TyCtxt, TypeFoldable};
77use rustc_span::Span;
88use tracing::info;
99
10use crate::infer::canonical::query_response;
1110use crate::infer::InferCtxt;
12use crate::traits::query::type_op::TypeOpOutput;
11use crate::infer::canonical::query_response;
1312use crate::traits::ObligationCtxt;
13use crate::traits::query::type_op::TypeOpOutput;
1414
1515pub struct CustomTypeOp<F> {
1616 closure: F,
compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs+4-4
......@@ -5,14 +5,14 @@ use rustc_macros::{HashStable, TypeFoldable, TypeVisitable};
55use rustc_middle::infer::canonical::CanonicalQueryResponse;
66use rustc_middle::traits::ObligationCause;
77use rustc_middle::ty::{self, ParamEnvAnd, Ty, TyCtxt, TypeFolder, TypeVisitableExt};
8use rustc_span::def_id::CRATE_DEF_ID;
98use rustc_span::DUMMY_SP;
10use rustc_type_ir::outlives::{push_outlives_components, Component};
11use smallvec::{smallvec, SmallVec};
9use rustc_span::def_id::CRATE_DEF_ID;
10use rustc_type_ir::outlives::{Component, push_outlives_components};
11use smallvec::{SmallVec, smallvec};
1212use tracing::debug;
1313
1414use crate::traits::query::NoSolution;
15use crate::traits::{wf, ObligationCtxt};
15use crate::traits::{ObligationCtxt, wf};
1616
1717#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, TypeVisitable)]
1818pub struct ImpliedOutlivesBounds<'tcx> {
compiler/rustc_trait_selection/src/traits/query/type_op/normalize.rs+2-2
......@@ -1,8 +1,8 @@
11use std::fmt;
22
3pub use rustc_middle::traits::query::type_op::Normalize;
4use rustc_middle::traits::query::NoSolution;
53use rustc_middle::traits::ObligationCause;
4use rustc_middle::traits::query::NoSolution;
5pub use rustc_middle::traits::query::type_op::Normalize;
66use rustc_middle::ty::fold::TypeFoldable;
77use rustc_middle::ty::{self, Lift, ParamEnvAnd, Ty, TyCtxt, TypeVisitableExt};
88
compiler/rustc_trait_selection/src/traits/query/type_op/outlives.rs+1-1
......@@ -3,10 +3,10 @@ use rustc_middle::traits::query::{DropckOutlivesResult, NoSolution};
33use rustc_middle::ty::{ParamEnvAnd, Ty, TyCtxt};
44
55use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
6use crate::traits::ObligationCtxt;
67use crate::traits::query::dropck_outlives::{
78 compute_dropck_outlives_inner, trivial_dropck_outlives,
89};
9use crate::traits::ObligationCtxt;
1010
1111#[derive(Copy, Clone, Debug, HashStable, TypeFoldable, TypeVisitable)]
1212pub struct DropckOutlives<'tcx> {
compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs+2-2
......@@ -1,8 +1,8 @@
11use rustc_hir::LangItem;
22use rustc_infer::traits::Obligation;
3pub use rustc_middle::traits::query::type_op::ProvePredicate;
4use rustc_middle::traits::query::NoSolution;
53use rustc_middle::traits::ObligationCause;
4use rustc_middle::traits::query::NoSolution;
5pub use rustc_middle::traits::query::type_op::ProvePredicate;
66use rustc_middle::ty::{self, ParamEnvAnd, TyCtxt};
77
88use crate::infer::canonical::{Canonical, CanonicalQueryResponse};
compiler/rustc_trait_selection/src/traits/select/_match.rs+1-1
......@@ -1,5 +1,5 @@
11use rustc_infer::infer::relate::{
2 self, structurally_relate_tys, Relate, RelateResult, TypeRelation,
2 self, Relate, RelateResult, TypeRelation, structurally_relate_tys,
33};
44use rustc_middle::ty::error::{ExpectedFound, TypeError};
55use rustc_middle::ty::{self, InferConst, Ty, TyCtxt};
compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs+1-1
......@@ -8,8 +8,8 @@
88
99use std::ops::ControlFlow;
1010
11use hir::def_id::DefId;
1211use hir::LangItem;
12use hir::def_id::DefId;
1313use rustc_data_structures::fx::{FxHashSet, FxIndexSet};
1414use rustc_hir as hir;
1515use rustc_infer::traits::{Obligation, ObligationCause, PolyTraitObligation, SelectionError};
compiler/rustc_trait_selection/src/traits/select/confirmation.rs+37-55
......@@ -305,15 +305,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
305305 let make_transmute_obl = |src, dst| {
306306 let transmute_trait = obligation.predicate.def_id();
307307 let assume = obligation.predicate.skip_binder().trait_ref.args.const_at(2);
308 let trait_ref = ty::TraitRef::new(
309 tcx,
310 transmute_trait,
311 [
312 ty::GenericArg::from(dst),
313 ty::GenericArg::from(src),
314 ty::GenericArg::from(assume),
315 ],
316 );
308 let trait_ref = ty::TraitRef::new(tcx, transmute_trait, [
309 ty::GenericArg::from(dst),
310 ty::GenericArg::from(src),
311 ty::GenericArg::from(assume),
312 ]);
317313 Obligation::with_depth(
318314 tcx,
319315 obligation.cause.clone(),
......@@ -324,11 +320,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
324320 };
325321
326322 let make_freeze_obl = |ty| {
327 let trait_ref = ty::TraitRef::new(
328 tcx,
329 tcx.require_lang_item(LangItem::Freeze, None),
330 [ty::GenericArg::from(ty)],
331 );
323 let trait_ref =
324 ty::TraitRef::new(tcx, tcx.require_lang_item(LangItem::Freeze, None), [
325 ty::GenericArg::from(ty),
326 ]);
332327 Obligation::with_depth(
333328 tcx,
334329 obligation.cause.clone(),
......@@ -657,28 +652,20 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
657652 let kind = ty::BoundTyKind::Param(param.def_id, param.name);
658653 let bound_var = ty::BoundVariableKind::Ty(kind);
659654 bound_vars.push(bound_var);
660 Ty::new_bound(
661 tcx,
662 ty::INNERMOST,
663 ty::BoundTy {
664 var: ty::BoundVar::from_usize(bound_vars.len() - 1),
665 kind,
666 },
667 )
655 Ty::new_bound(tcx, ty::INNERMOST, ty::BoundTy {
656 var: ty::BoundVar::from_usize(bound_vars.len() - 1),
657 kind,
658 })
668659 .into()
669660 }
670661 GenericParamDefKind::Lifetime => {
671662 let kind = ty::BoundRegionKind::BrNamed(param.def_id, param.name);
672663 let bound_var = ty::BoundVariableKind::Region(kind);
673664 bound_vars.push(bound_var);
674 ty::Region::new_bound(
675 tcx,
676 ty::INNERMOST,
677 ty::BoundRegion {
678 var: ty::BoundVar::from_usize(bound_vars.len() - 1),
679 kind,
680 },
681 )
665 ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
666 var: ty::BoundVar::from_usize(bound_vars.len() - 1),
667 kind,
668 })
682669 .into()
683670 }
684671 GenericParamDefKind::Const { .. } => {
......@@ -921,11 +908,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
921908 ),
922909 ty::CoroutineClosure(_, args) => {
923910 args.as_coroutine_closure().coroutine_closure_sig().map_bound(|sig| {
924 ty::TraitRef::new(
925 self.tcx(),
926 obligation.predicate.def_id(),
927 [self_ty, sig.tupled_inputs_ty],
928 )
911 ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
912 self_ty,
913 sig.tupled_inputs_ty,
914 ])
929915 })
930916 }
931917 _ => {
......@@ -951,22 +937,20 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
951937 ty::CoroutineClosure(_, args) => {
952938 let args = args.as_coroutine_closure();
953939 let trait_ref = args.coroutine_closure_sig().map_bound(|sig| {
954 ty::TraitRef::new(
955 self.tcx(),
956 obligation.predicate.def_id(),
957 [self_ty, sig.tupled_inputs_ty],
958 )
940 ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
941 self_ty,
942 sig.tupled_inputs_ty,
943 ])
959944 });
960945 (trait_ref, args.kind_ty())
961946 }
962947 ty::FnDef(..) | ty::FnPtr(..) => {
963948 let sig = self_ty.fn_sig(tcx);
964949 let trait_ref = sig.map_bound(|sig| {
965 ty::TraitRef::new(
966 self.tcx(),
967 obligation.predicate.def_id(),
968 [self_ty, Ty::new_tup(tcx, sig.inputs())],
969 )
950 ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
951 self_ty,
952 Ty::new_tup(tcx, sig.inputs()),
953 ])
970954 });
971955
972956 // We must additionally check that the return type impls `Future`.
......@@ -990,11 +974,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
990974 let args = args.as_closure();
991975 let sig = args.sig();
992976 let trait_ref = sig.map_bound(|sig| {
993 ty::TraitRef::new(
994 self.tcx(),
995 obligation.predicate.def_id(),
996 [self_ty, sig.inputs()[0]],
997 )
977 ty::TraitRef::new(self.tcx(), obligation.predicate.def_id(), [
978 self_ty,
979 sig.inputs()[0],
980 ])
998981 });
999982
1000983 // We must additionally check that the return type impls `Future`.
......@@ -1310,11 +1293,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
13101293 // Construct the nested `TailField<T>: Unsize<TailField<U>>` predicate.
13111294 let tail_unsize_obligation = obligation.with(
13121295 tcx,
1313 ty::TraitRef::new(
1314 tcx,
1315 obligation.predicate.def_id(),
1316 [source_tail, target_tail],
1317 ),
1296 ty::TraitRef::new(tcx, obligation.predicate.def_id(), [
1297 source_tail,
1298 target_tail,
1299 ]),
13181300 );
13191301 nested.push(tail_unsize_obligation);
13201302
compiler/rustc_trait_selection/src/traits/select/mod.rs+11-13
......@@ -12,25 +12,25 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap, FxIndexSet};
1212use rustc_data_structures::stack::ensure_sufficient_stack;
1313use rustc_errors::{Diag, EmissionGuarantee};
1414use rustc_hir as hir;
15use rustc_hir::def_id::DefId;
1615use rustc_hir::LangItem;
17use rustc_infer::infer::relate::TypeRelation;
16use rustc_hir::def_id::DefId;
1817use rustc_infer::infer::BoundRegionConversionTime::{self, HigherRankedType};
1918use rustc_infer::infer::DefineOpaqueTypes;
19use rustc_infer::infer::relate::TypeRelation;
2020use rustc_infer::traits::TraitObligation;
2121use rustc_middle::bug;
22use rustc_middle::dep_graph::{dep_kinds, DepNodeIndex};
22use rustc_middle::dep_graph::{DepNodeIndex, dep_kinds};
2323use rustc_middle::mir::interpret::ErrorHandled;
2424pub use rustc_middle::traits::select::*;
2525use rustc_middle::ty::abstract_const::NotConstEvaluatable;
2626use rustc_middle::ty::error::TypeErrorToStringExt;
27use rustc_middle::ty::print::{with_no_trimmed_paths, PrintTraitRefExt as _};
27use rustc_middle::ty::print::{PrintTraitRefExt as _, with_no_trimmed_paths};
2828use rustc_middle::ty::{
2929 self, GenericArgsRef, PolyProjectionPredicate, Ty, TyCtxt, TypeFoldable, TypeVisitableExt,
3030 Upcast,
3131};
32use rustc_span::symbol::sym;
3332use rustc_span::Symbol;
33use rustc_span::symbol::sym;
3434use tracing::{debug, instrument, trace};
3535
3636use self::EvaluationResult::*;
......@@ -39,9 +39,9 @@ use super::coherence::{self, Conflict};
3939use super::project::ProjectionTermObligation;
4040use super::util::closure_trait_ref_and_return_type;
4141use super::{
42 const_evaluatable, project, util, wf, ImplDerivedCause, Normalized, Obligation,
43 ObligationCause, ObligationCauseCode, Overflow, PolyTraitObligation, PredicateObligation,
44 Selection, SelectionError, SelectionResult, TraitQueryMode,
42 ImplDerivedCause, Normalized, Obligation, ObligationCause, ObligationCauseCode, Overflow,
43 PolyTraitObligation, PredicateObligation, Selection, SelectionError, SelectionResult,
44 TraitQueryMode, const_evaluatable, project, util, wf,
4545};
4646use crate::error_reporting::InferCtxtErrorExt;
4747use crate::infer::{InferCtxt, InferCtxtExt, InferOk, TypeFreshener};
......@@ -2449,11 +2449,9 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
24492449 } else {
24502450 // If this is an ill-formed auto/built-in trait, then synthesize
24512451 // new error args for the missing generics.
2452 let err_args = ty::GenericArgs::extend_with_error(
2453 tcx,
2454 trait_def_id,
2455 &[normalized_ty.into()],
2456 );
2452 let err_args = ty::GenericArgs::extend_with_error(tcx, trait_def_id, &[
2453 normalized_ty.into(),
2454 ]);
24572455 ty::TraitRef::new_from_args(tcx, trait_def_id, err_args)
24582456 };
24592457
compiler/rustc_trait_selection/src/traits/specialize/mod.rs+3-3
......@@ -21,16 +21,16 @@ use rustc_middle::query::LocalCrate;
2121use rustc_middle::ty::print::PrintTraitRefExt as _;
2222use rustc_middle::ty::{self, GenericArgsRef, ImplSubject, Ty, TyCtxt, TypeVisitableExt};
2323use rustc_session::lint::builtin::{COHERENCE_LEAK_CHECK, ORDER_DEPENDENT_TRAIT_OBJECTS};
24use rustc_span::{sym, ErrorGuaranteed, Span, DUMMY_SP};
24use rustc_span::{DUMMY_SP, ErrorGuaranteed, Span, sym};
2525use specialization_graph::GraphExt;
2626use tracing::{debug, instrument};
2727
28use super::{util, SelectionContext};
28use super::{SelectionContext, util};
2929use crate::error_reporting::traits::to_pretty_impl_header;
3030use crate::errors::NegativePositiveConflict;
3131use crate::infer::{InferCtxt, InferOk, TyCtxtInferExt};
3232use crate::traits::select::IntercrateAmbiguityCause;
33use crate::traits::{coherence, FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt};
33use crate::traits::{FutureCompatOverlapErrorKind, ObligationCause, ObligationCtxt, coherence};
3434
3535/// Information pertinent to an overlapping impl error.
3636#[derive(Debug)]
compiler/rustc_trait_selection/src/traits/util.rs+6-10
......@@ -11,7 +11,7 @@ use rustc_middle::ty::{
1111 TypeVisitableExt, Upcast,
1212};
1313use rustc_span::Span;
14use smallvec::{smallvec, SmallVec};
14use smallvec::{SmallVec, smallvec};
1515use tracing::debug;
1616
1717use super::{NormalizeExt, ObligationCause, PredicateObligation, SelectionContext};
......@@ -223,15 +223,11 @@ pub(crate) fn closure_trait_ref_and_return_type<'tcx>(
223223 TupleArgumentsFlag::Yes => Ty::new_tup(tcx, sig.skip_binder().inputs()),
224224 };
225225 let trait_ref = if tcx.has_host_param(fn_trait_def_id) {
226 ty::TraitRef::new(
227 tcx,
228 fn_trait_def_id,
229 [
230 ty::GenericArg::from(self_ty),
231 ty::GenericArg::from(arguments_tuple),
232 ty::GenericArg::from(fn_host_effect),
233 ],
234 )
226 ty::TraitRef::new(tcx, fn_trait_def_id, [
227 ty::GenericArg::from(self_ty),
228 ty::GenericArg::from(arguments_tuple),
229 ty::GenericArg::from(fn_host_effect),
230 ])
235231 } else {
236232 ty::TraitRef::new(tcx, fn_trait_def_id, [self_ty, arguments_tuple])
237233 };
compiler/rustc_trait_selection/src/traits/vtable.rs+2-2
......@@ -8,8 +8,8 @@ use rustc_middle::query::Providers;
88use rustc_middle::ty::{
99 self, GenericArgs, GenericParamDefKind, Ty, TyCtxt, TypeVisitableExt, Upcast, VtblEntry,
1010};
11use rustc_span::{sym, Span, DUMMY_SP};
12use smallvec::{smallvec, SmallVec};
11use rustc_span::{DUMMY_SP, Span, sym};
12use smallvec::{SmallVec, smallvec};
1313use tracing::debug;
1414
1515use crate::errors::DumpVTableEntries;
compiler/rustc_trait_selection/src/traits/wf.rs+2-2
......@@ -8,8 +8,8 @@ use rustc_middle::ty::{
88 self, GenericArg, GenericArgKind, GenericArgsRef, Ty, TyCtxt, TypeSuperVisitable,
99 TypeVisitable, TypeVisitableExt, TypeVisitor,
1010};
11use rustc_span::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
12use rustc_span::{Span, DUMMY_SP};
11use rustc_span::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
12use rustc_span::{DUMMY_SP, Span};
1313use tracing::{debug, instrument, trace};
1414
1515use crate::infer::InferCtxt;
compiler/rustc_traits/src/dropck_outlives.rs+1-1
......@@ -1,7 +1,7 @@
11use rustc_data_structures::fx::FxHashSet;
22use rustc_hir::def_id::DefId;
3use rustc_infer::infer::canonical::{Canonical, QueryResponse};
43use rustc_infer::infer::TyCtxtInferExt;
4use rustc_infer::infer::canonical::{Canonical, QueryResponse};
55use rustc_middle::bug;
66use rustc_middle::query::Providers;
77use rustc_middle::traits::query::{DropckConstraint, DropckOutlivesResult};
compiler/rustc_traits/src/implied_outlives_bounds.rs+1-1
......@@ -2,8 +2,8 @@
22//! Do not call this query directory. See
33//! [`rustc_trait_selection::traits::query::type_op::implied_outlives_bounds`].
44
5use rustc_infer::infer::canonical::{self, Canonical};
65use rustc_infer::infer::TyCtxtInferExt;
6use rustc_infer::infer::canonical::{self, Canonical};
77use rustc_infer::traits::query::OutlivesBound;
88use rustc_middle::query::Providers;
99use rustc_middle::ty::TyCtxt;
compiler/rustc_traits/src/normalize_projection_ty.rs+1-1
......@@ -1,5 +1,5 @@
1use rustc_infer::infer::canonical::{Canonical, QueryResponse};
21use rustc_infer::infer::TyCtxtInferExt;
2use rustc_infer::infer::canonical::{Canonical, QueryResponse};
33use rustc_middle::query::Providers;
44use rustc_middle::ty::{ParamEnvAnd, TyCtxt};
55use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
compiler/rustc_traits/src/type_op.rs+2-2
......@@ -1,14 +1,14 @@
11use std::fmt;
22
3use rustc_infer::infer::canonical::{Canonical, QueryResponse};
43use rustc_infer::infer::TyCtxtInferExt;
4use rustc_infer::infer::canonical::{Canonical, QueryResponse};
55use rustc_middle::query::Providers;
66use rustc_middle::traits::query::NoSolution;
77use rustc_middle::ty::{Clause, FnSig, ParamEnvAnd, PolyFnSig, Ty, TyCtxt, TypeFoldable};
88use rustc_trait_selection::infer::InferCtxtBuilderExt;
99use rustc_trait_selection::traits::query::normalize::QueryNormalizeExt;
1010use rustc_trait_selection::traits::query::type_op::ascribe_user_type::{
11 type_op_ascribe_user_type_with_span, AscribeUserType,
11 AscribeUserType, type_op_ascribe_user_type_with_span,
1212};
1313use rustc_trait_selection::traits::query::type_op::normalize::Normalize;
1414use rustc_trait_selection::traits::query::type_op::prove_predicate::ProvePredicate;
compiler/rustc_transmute/src/layout/dfa.rs+1-1
......@@ -3,7 +3,7 @@ use std::sync::atomic::{AtomicU32, Ordering};
33
44use tracing::instrument;
55
6use super::{nfa, Byte, Nfa, Ref};
6use super::{Byte, Nfa, Ref, nfa};
77use crate::Map;
88
99#[derive(PartialEq, Clone, Debug)]
compiler/rustc_transmute/src/layout/tree.rs+1-1
......@@ -179,7 +179,7 @@ pub(crate) mod rustc {
179179 };
180180
181181 use super::Tree;
182 use crate::layout::rustc::{layout_of, Def, Ref};
182 use crate::layout::rustc::{Def, Ref, layout_of};
183183
184184 #[derive(Debug, Copy, Clone)]
185185 pub(crate) enum Err {
compiler/rustc_transmute/src/maybe_transmutable/mod.rs+1-1
......@@ -4,7 +4,7 @@ pub(crate) mod query_context;
44#[cfg(test)]
55mod tests;
66
7use crate::layout::{self, dfa, Byte, Def, Dfa, Nfa, Ref, Tree, Uninhabited};
7use crate::layout::{self, Byte, Def, Dfa, Nfa, Ref, Tree, Uninhabited, dfa};
88use crate::maybe_transmutable::query_context::QueryContext;
99use crate::{Answer, Condition, Map, Reason};
1010
compiler/rustc_transmute/src/maybe_transmutable/tests.rs+1-1
......@@ -2,7 +2,7 @@ use itertools::Itertools;
22
33use super::query_context::test::{Def, UltraMinimal};
44use crate::maybe_transmutable::MaybeTransmutableQuery;
5use crate::{layout, Reason};
5use crate::{Reason, layout};
66
77mod safety {
88 use super::*;
compiler/rustc_ty_utils/src/abi.rs+1-1
......@@ -5,7 +5,7 @@ use rustc_hir::lang_items::LangItem;
55use rustc_middle::bug;
66use rustc_middle::query::Providers;
77use rustc_middle::ty::layout::{
8 fn_can_unwind, FnAbiError, HasParamEnv, HasTyCtxt, LayoutCx, LayoutOf, TyAndLayout,
8 FnAbiError, HasParamEnv, HasTyCtxt, LayoutCx, LayoutOf, TyAndLayout, fn_can_unwind,
99};
1010use rustc_middle::ty::{self, InstanceKind, Ty, TyCtxt};
1111use rustc_session::config::OptLevel;
compiler/rustc_ty_utils/src/consts.rs+1-1
......@@ -11,7 +11,7 @@ use rustc_middle::ty::abstract_const::CastKind;
1111use rustc_middle::ty::{self, Expr, TyCtxt, TypeVisitableExt};
1212use rustc_middle::{bug, mir, thir};
1313use rustc_span::Span;
14use rustc_target::abi::{VariantIdx, FIRST_VARIANT};
14use rustc_target::abi::{FIRST_VARIANT, VariantIdx};
1515use tracing::{debug, instrument};
1616
1717use crate::errors::{GenericConstantTooComplex, GenericConstantTooComplexSub};
compiler/rustc_ty_utils/src/implied_bounds.rs+4-4
......@@ -78,10 +78,10 @@ fn assumed_wf_types<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> &'tcx [(Ty<'
7878 if matches!(*orig_lt, ty::ReLateParam(..)) {
7979 mapping.insert(
8080 orig_lt,
81 ty::Region::new_early_param(
82 tcx,
83 ty::EarlyParamRegion { index: param.index, name: param.name },
84 ),
81 ty::Region::new_early_param(tcx, ty::EarlyParamRegion {
82 index: param.index,
83 name: param.name,
84 }),
8585 );
8686 }
8787 }
compiler/rustc_ty_utils/src/instance.rs+2-2
......@@ -1,6 +1,6 @@
11use rustc_errors::ErrorGuaranteed;
2use rustc_hir::def_id::DefId;
32use rustc_hir::LangItem;
3use rustc_hir::def_id::DefId;
44use rustc_infer::infer::TyCtxtInferExt;
55use rustc_middle::bug;
66use rustc_middle::query::Providers;
......@@ -11,7 +11,7 @@ use rustc_span::sym;
1111use rustc_trait_selection::traits;
1212use rustc_type_ir::ClosureKind;
1313use tracing::debug;
14use traits::{translate_args, Reveal};
14use traits::{Reveal, translate_args};
1515
1616use crate::errors::UnexpectedFnPtrAssociatedItem;
1717
compiler/rustc_ty_utils/src/layout.rs+21-36
......@@ -9,7 +9,7 @@ use rustc_middle::bug;
99use rustc_middle::mir::{CoroutineLayout, CoroutineSavedLocal};
1010use rustc_middle::query::Providers;
1111use rustc_middle::ty::layout::{
12 FloatExt, HasTyCtxt, IntegerExt, LayoutCx, LayoutError, LayoutOf, TyAndLayout, MAX_SIMD_LANES,
12 FloatExt, HasTyCtxt, IntegerExt, LayoutCx, LayoutError, LayoutOf, MAX_SIMD_LANES, TyAndLayout,
1313};
1414use rustc_middle::ty::print::with_no_trimmed_paths;
1515use rustc_middle::ty::{
......@@ -194,20 +194,14 @@ fn layout_of_uncached<'tcx>(
194194 }
195195
196196 // Basic scalars.
197 ty::Bool => tcx.mk_layout(LayoutS::scalar(
198 cx,
199 Scalar::Initialized {
200 value: Int(I8, false),
201 valid_range: WrappingRange { start: 0, end: 1 },
202 },
203 )),
204 ty::Char => tcx.mk_layout(LayoutS::scalar(
205 cx,
206 Scalar::Initialized {
207 value: Int(I32, false),
208 valid_range: WrappingRange { start: 0, end: 0x10FFFF },
209 },
210 )),
197 ty::Bool => tcx.mk_layout(LayoutS::scalar(cx, Scalar::Initialized {
198 value: Int(I8, false),
199 valid_range: WrappingRange { start: 0, end: 1 },
200 })),
201 ty::Char => tcx.mk_layout(LayoutS::scalar(cx, Scalar::Initialized {
202 value: Int(I32, false),
203 valid_range: WrappingRange { start: 0, end: 0x10FFFF },
204 })),
211205 ty::Int(ity) => scalar(Int(Integer::from_int_ty(dl, ity), true)),
212206 ty::Uint(ity) => scalar(Int(Integer::from_uint_ty(dl, ity), false)),
213207 ty::Float(fty) => scalar(Float(Float::from_float_ty(fty))),
......@@ -510,13 +504,10 @@ fn layout_of_uncached<'tcx>(
510504 // Non-power-of-two vectors have padding up to the next power-of-two.
511505 // If we're a packed repr, remove the padding while keeping the alignment as close
512506 // to a vector as possible.
513 (
514 Abi::Aggregate { sized: true },
515 AbiAndPrefAlign {
516 abi: Align::max_for_offset(size),
517 pref: dl.vector_align(size).pref,
518 },
519 )
507 (Abi::Aggregate { sized: true }, AbiAndPrefAlign {
508 abi: Align::max_for_offset(size),
509 pref: dl.vector_align(size).pref,
510 })
520511 } else {
521512 (Abi::Vector { element: e_abi, count: e_len }, dl.vector_align(size))
522513 };
......@@ -1124,13 +1115,10 @@ fn variant_info_for_adt<'tcx>(
11241115 })
11251116 .collect();
11261117
1127 (
1128 variant_infos,
1129 match tag_encoding {
1130 TagEncoding::Direct => Some(tag.size(cx)),
1131 _ => None,
1132 },
1133 )
1118 (variant_infos, match tag_encoding {
1119 TagEncoding::Direct => Some(tag.size(cx)),
1120 _ => None,
1121 })
11341122 }
11351123 }
11361124}
......@@ -1250,11 +1238,8 @@ fn variant_info_for_coroutine<'tcx>(
12501238 let end_states: Vec<_> = end_states.collect();
12511239 variant_infos.extend(end_states);
12521240
1253 (
1254 variant_infos,
1255 match tag_encoding {
1256 TagEncoding::Direct => Some(tag.size(cx)),
1257 _ => None,
1258 },
1259 )
1241 (variant_infos, match tag_encoding {
1242 TagEncoding::Direct => Some(tag.size(cx)),
1243 _ => None,
1244 })
12601245}
compiler/rustc_ty_utils/src/needs_drop.rs+1-1
......@@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxHashSet;
44use rustc_hir::def_id::DefId;
55use rustc_middle::bug;
66use rustc_middle::query::Providers;
7use rustc_middle::ty::util::{needs_drop_components, AlwaysRequiresDrop};
7use rustc_middle::ty::util::{AlwaysRequiresDrop, needs_drop_components};
88use rustc_middle::ty::{self, EarlyBinder, GenericArgsRef, Ty, TyCtxt};
99use rustc_session::Limit;
1010use rustc_span::sym;
compiler/rustc_ty_utils/src/opaque_types.rs+1-1
......@@ -2,7 +2,7 @@ use rustc_data_structures::fx::FxHashSet;
22use rustc_hir::def::DefKind;
33use rustc_hir::def_id::LocalDefId;
44use rustc_hir::intravisit::Visitor;
5use rustc_hir::{intravisit, CRATE_HIR_ID};
5use rustc_hir::{CRATE_HIR_ID, intravisit};
66use rustc_middle::bug;
77use rustc_middle::query::Providers;
88use rustc_middle::ty::util::{CheckRegions, NotUniqueParam};
compiler/rustc_ty_utils/src/ty.rs+2-2
......@@ -1,7 +1,7 @@
11use rustc_data_structures::fx::FxHashSet;
22use rustc_hir as hir;
3use rustc_hir::def::DefKind;
43use rustc_hir::LangItem;
4use rustc_hir::def::DefKind;
55use rustc_index::bit_set::BitSet;
66use rustc_middle::bug;
77use rustc_middle::query::Providers;
......@@ -9,8 +9,8 @@ use rustc_middle::ty::{
99 self, EarlyBinder, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitableExt,
1010 TypeVisitor, Upcast,
1111};
12use rustc_span::def_id::{DefId, LocalDefId, CRATE_DEF_ID};
1312use rustc_span::DUMMY_SP;
13use rustc_span::def_id::{CRATE_DEF_ID, DefId, LocalDefId};
1414use rustc_trait_selection::traits;
1515use tracing::{debug, instrument};
1616
compiler/rustc_type_ir/src/effects.rs+1-1
......@@ -1,6 +1,6 @@
1use crate::Interner;
12use crate::inherent::*;
23use crate::lang_items::TraitSolverLangItem::{EffectsMaybe, EffectsNoRuntime, EffectsRuntime};
3use crate::Interner;
44
55#[derive(Clone, Copy, PartialEq, Eq)]
66pub enum EffectKind {
compiler/rustc_type_ir/src/elaborate.rs+1-1
......@@ -4,7 +4,7 @@ use smallvec::smallvec;
44
55use crate::data_structures::HashSet;
66use crate::inherent::*;
7use crate::outlives::{push_outlives_components, Component};
7use crate::outlives::{Component, push_outlives_components};
88use crate::{self as ty, Interner, Upcast as _};
99
1010/// "Elaboration" is the process of identifying all the predicates that
compiler/rustc_type_ir/src/lib.rs+6-6
......@@ -56,6 +56,12 @@ mod ty_info;
5656mod ty_kind;
5757mod upcast;
5858
59pub use AliasTyKind::*;
60pub use DynKind::*;
61pub use InferTy::*;
62pub use RegionKind::*;
63pub use TyKind::*;
64pub use Variance::*;
5965pub use binder::*;
6066pub use canonical::*;
6167#[cfg(feature = "nightly")]
......@@ -73,12 +79,6 @@ pub use region_kind::*;
7379pub use ty_info::*;
7480pub use ty_kind::*;
7581pub use upcast::*;
76pub use AliasTyKind::*;
77pub use DynKind::*;
78pub use InferTy::*;
79pub use RegionKind::*;
80pub use TyKind::*;
81pub use Variance::*;
8282
8383rustc_index::newtype_index! {
8484 /// A [De Bruijn index][dbi] is a standard means of representing
compiler/rustc_type_ir/src/outlives.rs+1-1
......@@ -3,7 +3,7 @@
33//! RFC for reference.
44
55use derive_where::derive_where;
6use smallvec::{smallvec, SmallVec};
6use smallvec::{SmallVec, smallvec};
77
88use crate::data_structures::SsoHashSet;
99use crate::inherent::*;
compiler/rustc_type_ir/src/predicate.rs+29-23
......@@ -492,29 +492,35 @@ impl<I: Interner> AliasTerm<I> {
492492
493493 pub fn to_term(self, interner: I) -> I::Term {
494494 match self.kind(interner) {
495 AliasTermKind::ProjectionTy => Ty::new_alias(
496 interner,
497 ty::AliasTyKind::Projection,
498 ty::AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
499 )
500 .into(),
501 AliasTermKind::InherentTy => Ty::new_alias(
502 interner,
503 ty::AliasTyKind::Inherent,
504 ty::AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
505 )
506 .into(),
507 AliasTermKind::OpaqueTy => Ty::new_alias(
508 interner,
509 ty::AliasTyKind::Opaque,
510 ty::AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
511 )
512 .into(),
513 AliasTermKind::WeakTy => Ty::new_alias(
514 interner,
515 ty::AliasTyKind::Weak,
516 ty::AliasTy { def_id: self.def_id, args: self.args, _use_alias_ty_new_instead: () },
517 )
495 AliasTermKind::ProjectionTy => {
496 Ty::new_alias(interner, ty::AliasTyKind::Projection, ty::AliasTy {
497 def_id: self.def_id,
498 args: self.args,
499 _use_alias_ty_new_instead: (),
500 })
501 .into()
502 }
503 AliasTermKind::InherentTy => {
504 Ty::new_alias(interner, ty::AliasTyKind::Inherent, ty::AliasTy {
505 def_id: self.def_id,
506 args: self.args,
507 _use_alias_ty_new_instead: (),
508 })
509 .into()
510 }
511 AliasTermKind::OpaqueTy => {
512 Ty::new_alias(interner, ty::AliasTyKind::Opaque, ty::AliasTy {
513 def_id: self.def_id,
514 args: self.args,
515 _use_alias_ty_new_instead: (),
516 })
517 .into()
518 }
519 AliasTermKind::WeakTy => Ty::new_alias(interner, ty::AliasTyKind::Weak, ty::AliasTy {
520 def_id: self.def_id,
521 args: self.args,
522 _use_alias_ty_new_instead: (),
523 })
518524 .into(),
519525 AliasTermKind::UnevaluatedConst | AliasTermKind::ProjectionConst => {
520526 I::Const::new_unevaluated(
compiler/rustc_type_ir/src/ty_kind.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_data_structures::unify::{NoError, UnifyKey, UnifyValue};
1010use rustc_macros::{Decodable, Encodable, HashStable_NoContext, TyDecodable, TyEncodable};
1111use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
1212
13pub use self::closure::*;
1413use self::TyKind::*;
14pub use self::closure::*;
1515use crate::inherent::*;
1616use crate::{self as ty, DebruijnIndex, Interner};
1717
compiler/rustc_type_ir/src/ty_kind/closure.rs+10-13
......@@ -3,7 +3,7 @@ use std::ops::ControlFlow;
33use derive_where::derive_where;
44use rustc_type_ir_macros::{Lift_Generic, TypeFoldable_Generic, TypeVisitable_Generic};
55
6use crate::fold::{shift_region, TypeFoldable, TypeFolder, TypeSuperFoldable};
6use crate::fold::{TypeFoldable, TypeFolder, TypeSuperFoldable, shift_region};
77use crate::inherent::*;
88use crate::visit::{TypeSuperVisitable, TypeVisitable, TypeVisitor};
99use crate::{self as ty, Interner};
......@@ -394,18 +394,15 @@ impl<I: Interner> CoroutineClosureSignature<I> {
394394 coroutine_def_id: I::DefId,
395395 tupled_upvars_ty: I::Ty,
396396 ) -> I::Ty {
397 let coroutine_args = ty::CoroutineArgs::new(
398 cx,
399 ty::CoroutineArgsParts {
400 parent_args,
401 kind_ty: coroutine_kind_ty,
402 resume_ty: self.resume_ty,
403 yield_ty: self.yield_ty,
404 return_ty: self.return_ty,
405 witness: self.interior,
406 tupled_upvars_ty,
407 },
408 );
397 let coroutine_args = ty::CoroutineArgs::new(cx, ty::CoroutineArgsParts {
398 parent_args,
399 kind_ty: coroutine_kind_ty,
400 resume_ty: self.resume_ty,
401 yield_ty: self.yield_ty,
402 return_ty: self.return_ty,
403 witness: self.interior,
404 tupled_upvars_ty,
405 });
409406
410407 Ty::new_coroutine(cx, coroutine_def_id, coroutine_args.args)
411408 }
compiler/rustc_type_ir_macros/src/lib.rs+26-35
......@@ -35,17 +35,14 @@ fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::Toke
3535 })
3636 });
3737
38 s.bound_impl(
39 quote!(::rustc_type_ir::fold::TypeFoldable<I>),
40 quote! {
41 fn try_fold_with<__F: ::rustc_type_ir::fold::FallibleTypeFolder<I>>(
42 self,
43 __folder: &mut __F
44 ) -> Result<Self, __F::Error> {
45 Ok(match self { #body_fold })
46 }
47 },
48 )
38 s.bound_impl(quote!(::rustc_type_ir::fold::TypeFoldable<I>), quote! {
39 fn try_fold_with<__F: ::rustc_type_ir::fold::FallibleTypeFolder<I>>(
40 self,
41 __folder: &mut __F
42 ) -> Result<Self, __F::Error> {
43 Ok(match self { #body_fold })
44 }
45 })
4946}
5047
5148fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
......@@ -85,19 +82,16 @@ fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
8582 let self_ty: syn::Type = parse_quote! { #name #ty_generics };
8683 let lifted_ty = lift(self_ty);
8784
88 s.bound_impl(
89 quote!(::rustc_type_ir::lift::Lift<J>),
90 quote! {
91 type Lifted = #lifted_ty;
85 s.bound_impl(quote!(::rustc_type_ir::lift::Lift<J>), quote! {
86 type Lifted = #lifted_ty;
9287
93 fn lift_to_interner(
94 self,
95 interner: J,
96 ) -> Option<Self::Lifted> {
97 Some(match self { #body_fold })
98 }
99 },
100 )
88 fn lift_to_interner(
89 self,
90 interner: J,
91 ) -> Option<Self::Lifted> {
92 Some(match self { #body_fold })
93 }
94 })
10195}
10296
10397fn lift(mut ty: syn::Type) -> syn::Type {
......@@ -145,16 +139,13 @@ fn type_visitable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::Tok
145139 });
146140 s.bind_with(|_| synstructure::BindStyle::Move);
147141
148 s.bound_impl(
149 quote!(::rustc_type_ir::visit::TypeVisitable<I>),
150 quote! {
151 fn visit_with<__V: ::rustc_type_ir::visit::TypeVisitor<I>>(
152 &self,
153 __visitor: &mut __V
154 ) -> __V::Result {
155 match *self { #body_visit }
156 <__V::Result as ::rustc_ast_ir::visit::VisitorResult>::output()
157 }
158 },
159 )
142 s.bound_impl(quote!(::rustc_type_ir::visit::TypeVisitable<I>), quote! {
143 fn visit_with<__V: ::rustc_type_ir::visit::TypeVisitor<I>>(
144 &self,
145 __visitor: &mut __V
146 ) -> __V::Result {
147 match *self { #body_visit }
148 <__V::Result as ::rustc_ast_ir::visit::VisitorResult>::output()
149 }
150 })
160151}
compiler/stable_mir/src/abi.rs+1-1
......@@ -8,7 +8,7 @@ use crate::compiler_interface::with;
88use crate::mir::FieldIdx;
99use crate::target::{MachineInfo, MachineSize as Size};
1010use crate::ty::{Align, IndexedVal, Ty, VariantIdx};
11use crate::{error, Error, Opaque};
11use crate::{Error, Opaque, error};
1212
1313/// A function ABI definition.
1414#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)]
compiler/stable_mir/src/compiler_interface.rs+2-2
......@@ -18,8 +18,8 @@ use crate::ty::{
1818 TraitDef, Ty, TyConst, TyConstId, TyKind, UintTy, VariantDef,
1919};
2020use crate::{
21 mir, Crate, CrateItem, CrateItems, CrateNum, DefId, Error, Filename, ImplTraitDecls, ItemKind,
22 Symbol, TraitDecls,
21 Crate, CrateItem, CrateItems, CrateNum, DefId, Error, Filename, ImplTraitDecls, ItemKind,
22 Symbol, TraitDecls, mir,
2323};
2424
2525/// This trait defines the interface between stable_mir and the Rust compiler.
compiler/stable_mir/src/crate_def.rs+1-1
......@@ -4,7 +4,7 @@
44use serde::Serialize;
55
66use crate::ty::{GenericArgs, Span, Ty};
7use crate::{with, Crate, Symbol};
7use crate::{Crate, Symbol, with};
88
99/// A unique identification number for each item accessible for the current compilation unit.
1010#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize)]
compiler/stable_mir/src/mir/alloc.rs+1-1
......@@ -7,7 +7,7 @@ use serde::Serialize;
77use crate::mir::mono::{Instance, StaticDef};
88use crate::target::{Endian, MachineInfo};
99use crate::ty::{Allocation, Binder, ExistentialTraitRef, IndexedVal, Ty};
10use crate::{with, Error};
10use crate::{Error, with};
1111
1212/// An allocation in the SMIR global memory can be either a function pointer,
1313/// a static, or a "real" allocation with some data in it.
compiler/stable_mir/src/mir/mono.rs+1-1
......@@ -7,7 +7,7 @@ use crate::abi::FnAbi;
77use crate::crate_def::CrateDef;
88use crate::mir::Body;
99use crate::ty::{Allocation, ClosureDef, ClosureKind, FnDef, GenericArgs, IndexedVal, Ty};
10use crate::{with, CrateItem, DefId, Error, ItemKind, Opaque, Symbol};
10use crate::{CrateItem, DefId, Error, ItemKind, Opaque, Symbol, with};
1111
1212#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)]
1313pub enum MonoItem {
compiler/stable_mir/src/mir/pretty.rs+1-1
......@@ -7,7 +7,7 @@ use fmt::{Display, Formatter};
77use super::{AssertMessage, BinOp, BorrowKind, FakeBorrowKind, TerminatorKind};
88use crate::mir::{Operand, Place, Rvalue, StatementKind, UnwindAction, VarDebugInfoContents};
99use crate::ty::{IndexedVal, MirConst, Ty, TyConst};
10use crate::{with, Body, Mutability};
10use crate::{Body, Mutability, with};
1111
1212impl Display for Ty {
1313 fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
compiler/stable_mir/src/ty.rs+2-2
......@@ -4,10 +4,10 @@ use std::ops::Range;
44use serde::Serialize;
55
66use super::mir::{Body, Mutability, Safety};
7use super::{with, DefId, Error, Symbol};
7use super::{DefId, Error, Symbol, with};
88use crate::abi::{FnAbi, Layout};
99use crate::crate_def::{CrateDef, CrateDefType};
10use crate::mir::alloc::{read_target_int, read_target_uint, AllocId};
10use crate::mir::alloc::{AllocId, read_target_int, read_target_uint};
1111use crate::mir::mono::StaticDef;
1212use crate::target::MachineInfo;
1313use crate::{Filename, Opaque};
compiler/stable_mir/src/visitor.rs+1-1
......@@ -4,8 +4,8 @@ use super::ty::{
44 Allocation, Binder, ConstDef, ExistentialPredicate, FnSig, GenericArgKind, GenericArgs,
55 MirConst, Promoted, Region, RigidTy, TermKind, Ty, UnevaluatedConst,
66};
7use crate::ty::TyConst;
87use crate::Opaque;
8use crate::ty::TyConst;
99
1010pub trait Visitor: Sized {
1111 type Break;
library/alloc/benches/binary_heap.rs+1-1
......@@ -1,7 +1,7 @@
11use std::collections::BinaryHeap;
22
33use rand::seq::SliceRandom;
4use test::{black_box, Bencher};
4use test::{Bencher, black_box};
55
66#[bench]
77fn bench_find_smallest_1000(b: &mut Bencher) {
library/alloc/benches/btree/map.rs+2-2
......@@ -1,9 +1,9 @@
11use std::collections::BTreeMap;
22use std::ops::RangeBounds;
33
4use rand::seq::SliceRandom;
54use rand::Rng;
6use test::{black_box, Bencher};
5use rand::seq::SliceRandom;
6use test::{Bencher, black_box};
77
88macro_rules! map_insert_rand_bench {
99 ($name: ident, $n: expr, $map: ident) => {
library/alloc/benches/slice.rs+2-2
......@@ -1,8 +1,8 @@
11use std::{mem, ptr};
22
3use rand::distributions::{Alphanumeric, DistString, Standard};
43use rand::Rng;
5use test::{black_box, Bencher};
4use rand::distributions::{Alphanumeric, DistString, Standard};
5use test::{Bencher, black_box};
66
77#[bench]
88fn iterator(b: &mut Bencher) {
library/alloc/benches/str.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33#[bench]
44fn char_iterator(b: &mut Bencher) {
library/alloc/benches/string.rs+1-1
......@@ -1,6 +1,6 @@
11use std::iter::repeat;
22
3use test::{black_box, Bencher};
3use test::{Bencher, black_box};
44
55#[bench]
66fn bench_with_capacity(b: &mut Bencher) {
library/alloc/benches/vec.rs+1-1
......@@ -1,7 +1,7 @@
11use std::iter::repeat;
22
33use rand::RngCore;
4use test::{black_box, Bencher};
4use test::{Bencher, black_box};
55
66#[bench]
77fn bench_new(b: &mut Bencher) {
library/alloc/benches/vec_deque.rs+2-2
......@@ -1,7 +1,7 @@
1use std::collections::{vec_deque, VecDeque};
1use std::collections::{VecDeque, vec_deque};
22use std::mem;
33
4use test::{black_box, Bencher};
4use test::{Bencher, black_box};
55
66#[bench]
77fn bench_new(b: &mut Bencher) {
library/alloc/src/boxed.rs+5-2
......@@ -199,7 +199,7 @@ use core::ops::{
199199 DerefPure, DispatchFromDyn, Receiver,
200200};
201201use core::pin::{Pin, PinCoerceUnsized};
202use core::ptr::{self, addr_of_mut, NonNull, Unique};
202use core::ptr::{self, NonNull, Unique, addr_of_mut};
203203use core::task::{Context, Poll};
204204use core::{borrow, fmt, slice};
205205
......@@ -2480,7 +2480,10 @@ impl<Args: Tuple, F: AsyncFnOnce<Args> + ?Sized, A: Allocator> AsyncFnOnce<Args>
24802480
24812481#[unstable(feature = "async_fn_traits", issue = "none")]
24822482impl<Args: Tuple, F: AsyncFnMut<Args> + ?Sized, A: Allocator> AsyncFnMut<Args> for Box<F, A> {
2483 type CallRefFuture<'a> = F::CallRefFuture<'a> where Self: 'a;
2483 type CallRefFuture<'a>
2484 = F::CallRefFuture<'a>
2485 where
2486 Self: 'a;
24842487
24852488 extern "rust-call" fn async_call_mut(&mut self, args: Args) -> Self::CallRefFuture<'_> {
24862489 F::async_call_mut(self, args)
library/alloc/src/collections/binary_heap/mod.rs+1-1
......@@ -145,7 +145,7 @@
145145
146146use core::alloc::Allocator;
147147use core::iter::{FusedIterator, InPlaceIterable, SourceIter, TrustedFused, TrustedLen};
148use core::mem::{self, swap, ManuallyDrop};
148use core::mem::{self, ManuallyDrop, swap};
149149use core::num::NonZero;
150150use core::ops::{Deref, DerefMut};
151151use core::{fmt, ptr};
library/alloc/src/collections/binary_heap/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use std::panic::{catch_unwind, AssertUnwindSafe};
1use std::panic::{AssertUnwindSafe, catch_unwind};
22
33use super::*;
44use crate::boxed::Box;
library/alloc/src/collections/btree/fix.rs+1-1
......@@ -3,7 +3,7 @@ use core::alloc::Allocator;
33use super::map::MIN_LEN;
44use super::node::ForceResult::*;
55use super::node::LeftOrRight::*;
6use super::node::{marker, Handle, NodeRef, Root};
6use super::node::{Handle, NodeRef, Root, marker};
77
88impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
99 /// Stocks up a possibly underfull node by merging with or stealing from a
library/alloc/src/collections/btree/map.rs+2-2
......@@ -13,7 +13,7 @@ use super::borrow::DormantMutRef;
1313use super::dedup_sorted_iter::DedupSortedIter;
1414use super::navigate::{LazyLeafRange, LeafRange};
1515use super::node::ForceResult::*;
16use super::node::{self, marker, Handle, NodeRef, Root};
16use super::node::{self, Handle, NodeRef, Root, marker};
1717use super::search::SearchBound;
1818use super::search::SearchResult::*;
1919use super::set_val::SetValZST;
......@@ -22,9 +22,9 @@ use crate::vec::Vec;
2222
2323mod entry;
2424
25use Entry::*;
2526#[stable(feature = "rust1", since = "1.0.0")]
2627pub use entry::{Entry, OccupiedEntry, OccupiedError, VacantEntry};
27use Entry::*;
2828
2929/// Minimum number of elements in a node that is not a root.
3030/// We might temporarily have fewer elements during methods.
library/alloc/src/collections/btree/map/entry.rs+1-1
......@@ -5,7 +5,7 @@ use core::mem;
55use Entry::*;
66
77use super::super::borrow::DormantMutRef;
8use super::super::node::{marker, Handle, NodeRef};
8use super::super::node::{Handle, NodeRef, marker};
99use super::BTreeMap;
1010use crate::alloc::{Allocator, Global};
1111
library/alloc/src/collections/btree/map/tests.rs+1-1
......@@ -1,7 +1,7 @@
11use core::assert_matches::assert_matches;
22use std::iter;
33use std::ops::Bound::{Excluded, Included, Unbounded};
4use std::panic::{catch_unwind, AssertUnwindSafe};
4use std::panic::{AssertUnwindSafe, catch_unwind};
55use std::sync::atomic::AtomicUsize;
66use std::sync::atomic::Ordering::SeqCst;
77
library/alloc/src/collections/btree/navigate.rs+1-1
......@@ -3,7 +3,7 @@ use core::ops::RangeBounds;
33use core::{hint, ptr};
44
55use super::node::ForceResult::*;
6use super::node::{marker, Handle, NodeRef};
6use super::node::{Handle, NodeRef, marker};
77use super::search::SearchBound;
88use crate::alloc::Allocator;
99// `front` and `back` are always both `None` or both `Some`.
library/alloc/src/collections/btree/remove.rs+1-1
......@@ -3,7 +3,7 @@ use core::alloc::Allocator;
33use super::map::MIN_LEN;
44use super::node::ForceResult::*;
55use super::node::LeftOrRight::*;
6use super::node::{marker, Handle, NodeRef};
6use super::node::{Handle, NodeRef, marker};
77
88impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal>, marker::KV> {
99 /// Removes a key-value pair from the tree, and returns that pair, as well as
library/alloc/src/collections/btree/search.rs+1-1
......@@ -6,7 +6,7 @@ use SearchBound::*;
66use SearchResult::*;
77
88use super::node::ForceResult::*;
9use super::node::{marker, Handle, NodeRef};
9use super::node::{Handle, NodeRef, marker};
1010
1111pub enum SearchBound<T> {
1212 /// An inclusive bound to look for, just like `Bound::Included(T)`.
library/alloc/src/collections/btree/set.rs+1-1
......@@ -7,10 +7,10 @@ use core::iter::{FusedIterator, Peekable};
77use core::mem::ManuallyDrop;
88use core::ops::{BitAnd, BitOr, BitXor, Bound, RangeBounds, Sub};
99
10use super::Recover;
1011use super::map::{BTreeMap, Keys};
1112use super::merge_iter::MergeIterInner;
1213use super::set_val::SetValZST;
13use super::Recover;
1414use crate::alloc::{Allocator, Global};
1515use crate::vec::Vec;
1616
library/alloc/src/collections/btree/set/tests.rs+7-11
......@@ -1,5 +1,5 @@
11use std::ops::Bound::{Excluded, Included};
2use std::panic::{catch_unwind, AssertUnwindSafe};
2use std::panic::{AssertUnwindSafe, catch_unwind};
33
44use super::*;
55use crate::testing::crash_test::{CrashTestDummy, Panic};
......@@ -132,11 +132,9 @@ fn test_difference() {
132132 check_difference(&[1, 3, 5, 9, 11], &[3, 6, 9], &[1, 5, 11]);
133133 check_difference(&[1, 3, 5, 9, 11], &[0, 1], &[3, 5, 9, 11]);
134134 check_difference(&[1, 3, 5, 9, 11], &[11, 12], &[1, 3, 5, 9]);
135 check_difference(
136 &[-5, 11, 22, 33, 40, 42],
137 &[-12, -5, 14, 23, 34, 38, 39, 50],
138 &[11, 22, 33, 40, 42],
139 );
135 check_difference(&[-5, 11, 22, 33, 40, 42], &[-12, -5, 14, 23, 34, 38, 39, 50], &[
136 11, 22, 33, 40, 42,
137 ]);
140138
141139 if cfg!(miri) {
142140 // Miri is too slow
......@@ -252,11 +250,9 @@ fn test_union() {
252250 check_union(&[], &[], &[]);
253251 check_union(&[1, 2, 3], &[2], &[1, 2, 3]);
254252 check_union(&[2], &[1, 2, 3], &[1, 2, 3]);
255 check_union(
256 &[1, 3, 5, 9, 11, 16, 19, 24],
257 &[-2, 1, 5, 9, 13, 19],
258 &[-2, 1, 3, 5, 9, 11, 13, 16, 19, 24],
259 );
253 check_union(&[1, 3, 5, 9, 11, 16, 19, 24], &[-2, 1, 5, 9, 13, 19], &[
254 -2, 1, 3, 5, 9, 11, 13, 16, 19, 24,
255 ]);
260256}
261257
262258#[test]
library/alloc/src/collections/linked_list/tests.rs+13-17
......@@ -1,7 +1,7 @@
11// FIXME(static_mut_refs): Do not allow `static_mut_refs` lint
22#![allow(static_mut_refs)]
33
4use std::panic::{catch_unwind, AssertUnwindSafe};
4use std::panic::{AssertUnwindSafe, catch_unwind};
55use std::thread;
66
77use rand::RngCore;
......@@ -696,10 +696,9 @@ fn test_cursor_mut_insert() {
696696 cursor.splice_after(p);
697697 cursor.splice_before(q);
698698 check_links(&m);
699 assert_eq!(
700 m.iter().cloned().collect::<Vec<_>>(),
701 &[200, 201, 202, 203, 1, 100, 101, 102, 103, 8, 2, 3, 4, 5, 6]
702 );
699 assert_eq!(m.iter().cloned().collect::<Vec<_>>(), &[
700 200, 201, 202, 203, 1, 100, 101, 102, 103, 8, 2, 3, 4, 5, 6
701 ]);
703702 let mut cursor = m.cursor_front_mut();
704703 cursor.move_prev();
705704 let tmp = cursor.split_before();
......@@ -916,10 +915,9 @@ fn extract_if_complex() {
916915 assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
917916
918917 assert_eq!(list.len(), 14);
919 assert_eq!(
920 list.into_iter().collect::<Vec<_>>(),
921 vec![1, 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39]
922 );
918 assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
919 1, 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39
920 ]);
923921 }
924922
925923 {
......@@ -934,10 +932,9 @@ fn extract_if_complex() {
934932 assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
935933
936934 assert_eq!(list.len(), 13);
937 assert_eq!(
938 list.into_iter().collect::<Vec<_>>(),
939 vec![7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39]
940 );
935 assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
936 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35, 37, 39
937 ]);
941938 }
942939
943940 {
......@@ -952,10 +949,9 @@ fn extract_if_complex() {
952949 assert_eq!(removed, vec![2, 4, 6, 18, 20, 22, 24, 26, 34, 36]);
953950
954951 assert_eq!(list.len(), 11);
955 assert_eq!(
956 list.into_iter().collect::<Vec<_>>(),
957 vec![7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35]
958 );
952 assert_eq!(list.into_iter().collect::<Vec<_>>(), vec![
953 7, 9, 11, 13, 15, 17, 27, 29, 31, 33, 35
954 ]);
959955 }
960956
961957 {
library/alloc/src/collections/vec_deque/mod.rs+1-1
......@@ -9,7 +9,7 @@
99
1010use core::cmp::{self, Ordering};
1111use core::hash::{Hash, Hasher};
12use core::iter::{repeat_n, repeat_with, ByRefSized};
12use core::iter::{ByRefSized, repeat_n, repeat_with};
1313// This is used in a bunch of intra-doc links.
1414// FIXME: For some reason, `#[cfg(doc)]` wasn't sufficient, resulting in
1515// failures in linkchecker even though rustdoc built the docs just fine.
library/alloc/src/collections/vec_deque/tests.rs+3-4
......@@ -562,10 +562,9 @@ fn make_contiguous_head_to_end() {
562562 tester.push_front(i as char);
563563 }
564564
565 assert_eq!(
566 tester,
567 ['P', 'O', 'N', 'M', 'L', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K']
568 );
565 assert_eq!(tester, [
566 'P', 'O', 'N', 'M', 'L', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'
567 ]);
569568
570569 // ABCDEFGHIJKPONML
571570 let expected_start = 0;
library/alloc/src/ffi/c_str.rs+1-1
......@@ -4,7 +4,7 @@
44mod tests;
55
66use core::borrow::Borrow;
7use core::ffi::{c_char, CStr};
7use core::ffi::{CStr, c_char};
88use core::num::NonZero;
99use core::slice::memchr;
1010use core::str::{self, Utf8Error};
library/alloc/src/fmt.rs+3-3
......@@ -580,10 +580,8 @@
580580pub use core::fmt::Alignment;
581581#[stable(feature = "rust1", since = "1.0.0")]
582582pub use core::fmt::Error;
583#[unstable(feature = "debug_closure_helpers", issue = "117729")]
584pub use core::fmt::{from_fn, FromFn};
585583#[stable(feature = "rust1", since = "1.0.0")]
586pub use core::fmt::{write, Arguments};
584pub use core::fmt::{Arguments, write};
587585#[stable(feature = "rust1", since = "1.0.0")]
588586pub use core::fmt::{Binary, Octal};
589587#[stable(feature = "rust1", since = "1.0.0")]
......@@ -592,6 +590,8 @@ pub use core::fmt::{Debug, Display};
592590pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
593591#[stable(feature = "rust1", since = "1.0.0")]
594592pub use core::fmt::{Formatter, Result, Write};
593#[unstable(feature = "debug_closure_helpers", issue = "117729")]
594pub use core::fmt::{FromFn, from_fn};
595595#[stable(feature = "rust1", since = "1.0.0")]
596596pub use core::fmt::{LowerExp, UpperExp};
597597#[stable(feature = "rust1", since = "1.0.0")]
library/alloc/src/rc.rs+2-2
......@@ -251,13 +251,13 @@ use core::intrinsics::abort;
251251#[cfg(not(no_global_oom_handling))]
252252use core::iter;
253253use core::marker::{PhantomData, Unsize};
254use core::mem::{self, align_of_val_raw, ManuallyDrop};
254use core::mem::{self, ManuallyDrop, align_of_val_raw};
255255use core::ops::{CoerceUnsized, Deref, DerefMut, DerefPure, DispatchFromDyn, Receiver};
256256use core::panic::{RefUnwindSafe, UnwindSafe};
257257#[cfg(not(no_global_oom_handling))]
258258use core::pin::Pin;
259259use core::pin::PinCoerceUnsized;
260use core::ptr::{self, drop_in_place, NonNull};
260use core::ptr::{self, NonNull, drop_in_place};
261261#[cfg(not(no_global_oom_handling))]
262262use core::slice::from_raw_parts_mut;
263263use core::{borrow, fmt, hint};
library/alloc/src/slice.rs+8-8
......@@ -43,14 +43,6 @@ pub use core::slice::ArrayWindows;
4343pub use core::slice::EscapeAscii;
4444#[stable(feature = "slice_get_slice", since = "1.28.0")]
4545pub use core::slice::SliceIndex;
46#[stable(feature = "from_ref", since = "1.28.0")]
47pub use core::slice::{from_mut, from_ref};
48#[unstable(feature = "slice_from_ptr_range", issue = "89792")]
49pub use core::slice::{from_mut_ptr_range, from_ptr_range};
50#[stable(feature = "rust1", since = "1.0.0")]
51pub use core::slice::{from_raw_parts, from_raw_parts_mut};
52#[unstable(feature = "slice_range", issue = "76393")]
53pub use core::slice::{range, try_range};
5446#[stable(feature = "slice_group_by", since = "1.77.0")]
5547pub use core::slice::{ChunkBy, ChunkByMut};
5648#[stable(feature = "rust1", since = "1.0.0")]
......@@ -69,6 +61,14 @@ pub use core::slice::{RSplit, RSplitMut};
6961pub use core::slice::{RSplitN, RSplitNMut, SplitN, SplitNMut};
7062#[stable(feature = "split_inclusive", since = "1.51.0")]
7163pub use core::slice::{SplitInclusive, SplitInclusiveMut};
64#[stable(feature = "from_ref", since = "1.28.0")]
65pub use core::slice::{from_mut, from_ref};
66#[unstable(feature = "slice_from_ptr_range", issue = "89792")]
67pub use core::slice::{from_mut_ptr_range, from_ptr_range};
68#[stable(feature = "rust1", since = "1.0.0")]
69pub use core::slice::{from_raw_parts, from_raw_parts_mut};
70#[unstable(feature = "slice_range", issue = "76393")]
71pub use core::slice::{range, try_range};
7272
7373////////////////////////////////////////////////////////////////////////////////
7474// Basic slice extension methods
library/alloc/src/str.rs+7-7
......@@ -9,9 +9,6 @@
99
1010use core::borrow::{Borrow, BorrowMut};
1111use core::iter::FusedIterator;
12#[stable(feature = "rust1", since = "1.0.0")]
13pub use core::str::pattern;
14use core::str::pattern::{DoubleEndedSearcher, Pattern, ReverseSearcher, Searcher};
1512#[stable(feature = "encode_utf16", since = "1.8.0")]
1613pub use core::str::EncodeUtf16;
1714#[stable(feature = "split_ascii_whitespace", since = "1.34.0")]
......@@ -20,12 +17,11 @@ pub use core::str::SplitAsciiWhitespace;
2017pub use core::str::SplitInclusive;
2118#[stable(feature = "rust1", since = "1.0.0")]
2219pub use core::str::SplitWhitespace;
23#[unstable(feature = "str_from_raw_parts", issue = "119206")]
24pub use core::str::{from_raw_parts, from_raw_parts_mut};
2520#[stable(feature = "rust1", since = "1.0.0")]
26pub use core::str::{from_utf8, from_utf8_mut, Bytes, CharIndices, Chars};
21pub use core::str::pattern;
22use core::str::pattern::{DoubleEndedSearcher, Pattern, ReverseSearcher, Searcher};
2723#[stable(feature = "rust1", since = "1.0.0")]
28pub use core::str::{from_utf8_unchecked, from_utf8_unchecked_mut, ParseBoolError};
24pub use core::str::{Bytes, CharIndices, Chars, from_utf8, from_utf8_mut};
2925#[stable(feature = "str_escape", since = "1.34.0")]
3026pub use core::str::{EscapeDebug, EscapeDefault, EscapeUnicode};
3127#[stable(feature = "rust1", since = "1.0.0")]
......@@ -38,6 +34,8 @@ pub use core::str::{MatchIndices, RMatchIndices};
3834#[stable(feature = "rust1", since = "1.0.0")]
3935pub use core::str::{Matches, RMatches};
4036#[stable(feature = "rust1", since = "1.0.0")]
37pub use core::str::{ParseBoolError, from_utf8_unchecked, from_utf8_unchecked_mut};
38#[stable(feature = "rust1", since = "1.0.0")]
4139pub use core::str::{RSplit, Split};
4240#[stable(feature = "rust1", since = "1.0.0")]
4341pub use core::str::{RSplitN, SplitN};
......@@ -45,6 +43,8 @@ pub use core::str::{RSplitN, SplitN};
4543pub use core::str::{RSplitTerminator, SplitTerminator};
4644#[stable(feature = "utf8_chunks", since = "1.79.0")]
4745pub use core::str::{Utf8Chunk, Utf8Chunks};
46#[unstable(feature = "str_from_raw_parts", issue = "119206")]
47pub use core::str::{from_raw_parts, from_raw_parts_mut};
4848use core::unicode::conversions;
4949use core::{mem, ptr};
5050
library/alloc/src/string.rs+3-3
......@@ -43,9 +43,9 @@
4343#![stable(feature = "rust1", since = "1.0.0")]
4444
4545use core::error::Error;
46use core::iter::FusedIterator;
4647#[cfg(not(no_global_oom_handling))]
4748use core::iter::from_fn;
48use core::iter::FusedIterator;
4949#[cfg(not(no_global_oom_handling))]
5050use core::ops::Add;
5151#[cfg(not(no_global_oom_handling))]
......@@ -62,9 +62,9 @@ use crate::alloc::Allocator;
6262use crate::borrow::{Cow, ToOwned};
6363use crate::boxed::Box;
6464use crate::collections::TryReserveError;
65use crate::str::{self, from_utf8_unchecked_mut, Chars, Utf8Error};
65use crate::str::{self, Chars, Utf8Error, from_utf8_unchecked_mut};
6666#[cfg(not(no_global_oom_handling))]
67use crate::str::{from_boxed_utf8_unchecked, FromStr};
67use crate::str::{FromStr, from_boxed_utf8_unchecked};
6868use crate::vec::Vec;
6969
7070/// A UTF-8–encoded, growable string.
library/alloc/src/sync.rs+1-1
......@@ -17,7 +17,7 @@ use core::intrinsics::abort;
1717#[cfg(not(no_global_oom_handling))]
1818use core::iter;
1919use core::marker::{PhantomData, Unsize};
20use core::mem::{self, align_of_val_raw, ManuallyDrop};
20use core::mem::{self, ManuallyDrop, align_of_val_raw};
2121use core::ops::{CoerceUnsized, Deref, DerefPure, DispatchFromDyn, Receiver};
2222use core::panic::{RefUnwindSafe, UnwindSafe};
2323use core::pin::{Pin, PinCoerceUnsized};
library/alloc/src/sync/tests.rs+1-1
......@@ -1,10 +1,10 @@
11use std::clone::Clone;
22use std::mem::MaybeUninit;
33use std::option::Option::None;
4use std::sync::Mutex;
45use std::sync::atomic::AtomicUsize;
56use std::sync::atomic::Ordering::SeqCst;
67use std::sync::mpsc::channel;
7use std::sync::Mutex;
88use std::thread;
99
1010use super::*;
library/alloc/src/vec/in_place_collect.rs+1-1
......@@ -163,7 +163,7 @@ use core::num::NonZero;
163163use core::ptr;
164164
165165use super::{InPlaceDrop, InPlaceDstDataSrcBufDrop, SpecFromIter, SpecFromIterNested, Vec};
166use crate::alloc::{handle_alloc_error, Global};
166use crate::alloc::{Global, handle_alloc_error};
167167
168168const fn in_place_collectible<DEST, SRC>(
169169 step_merge: Option<NonZero<usize>>,
library/alloc/src/vec/in_place_drop.rs+1-1
......@@ -1,5 +1,5 @@
11use core::marker::PhantomData;
2use core::ptr::{self, drop_in_place, NonNull};
2use core::ptr::{self, NonNull, drop_in_place};
33use core::slice::{self};
44
55use crate::alloc::Global;
library/alloc/tests/slice.rs+1-1
......@@ -1417,8 +1417,8 @@ fn test_box_slice_clone() {
14171417#[cfg_attr(target_os = "emscripten", ignore)]
14181418#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
14191419fn test_box_slice_clone_panics() {
1420 use std::sync::atomic::{AtomicUsize, Ordering};
14211420 use std::sync::Arc;
1421 use std::sync::atomic::{AtomicUsize, Ordering};
14221422
14231423 struct Canary {
14241424 count: Arc<AtomicUsize>,
library/alloc/tests/str.rs+77-88
......@@ -1524,14 +1524,18 @@ fn test_lines() {
15241524 t("bare\r", &["bare\r"]);
15251525 t("bare\rcr", &["bare\rcr"]);
15261526 t("Text\n\r", &["Text", "\r"]);
1527 t(
1528 "\nMäry häd ä little lämb\n\r\nLittle lämb\n",
1529 &["", "Märy häd ä little lämb", "", "Little lämb"],
1530 );
1531 t(
1532 "\r\nMäry häd ä little lämb\n\nLittle lämb",
1533 &["", "Märy häd ä little lämb", "", "Little lämb"],
1534 );
1527 t("\nMäry häd ä little lämb\n\r\nLittle lämb\n", &[
1528 "",
1529 "Märy häd ä little lämb",
1530 "",
1531 "Little lämb",
1532 ]);
1533 t("\r\nMäry häd ä little lämb\n\nLittle lämb", &[
1534 "",
1535 "Märy häd ä little lämb",
1536 "",
1537 "Little lämb",
1538 ]);
15351539}
15361540
15371541#[test]
......@@ -1971,88 +1975,73 @@ mod pattern {
19711975 assert_eq!(v, right);
19721976 }
19731977
1974 make_test!(
1975 str_searcher_ascii_haystack,
1976 "bb",
1977 "abbcbbd",
1978 [Reject(0, 1), Match(1, 3), Reject(3, 4), Match(4, 6), Reject(6, 7),]
1979 );
1980 make_test!(
1981 str_searcher_ascii_haystack_seq,
1982 "bb",
1983 "abbcbbbbd",
1984 [Reject(0, 1), Match(1, 3), Reject(3, 4), Match(4, 6), Match(6, 8), Reject(8, 9),]
1985 );
1986 make_test!(
1987 str_searcher_empty_needle_ascii_haystack,
1988 "",
1989 "abbcbbd",
1990 [
1991 Match(0, 0),
1992 Reject(0, 1),
1993 Match(1, 1),
1994 Reject(1, 2),
1995 Match(2, 2),
1996 Reject(2, 3),
1997 Match(3, 3),
1998 Reject(3, 4),
1999 Match(4, 4),
2000 Reject(4, 5),
2001 Match(5, 5),
2002 Reject(5, 6),
2003 Match(6, 6),
2004 Reject(6, 7),
2005 Match(7, 7),
2006 ]
2007 );
2008 make_test!(
2009 str_searcher_multibyte_haystack,
2010 " ",
2011 "├──",
2012 [Reject(0, 3), Reject(3, 6), Reject(6, 9),]
2013 );
2014 make_test!(
2015 str_searcher_empty_needle_multibyte_haystack,
2016 "",
2017 "├──",
2018 [
2019 Match(0, 0),
2020 Reject(0, 3),
2021 Match(3, 3),
2022 Reject(3, 6),
2023 Match(6, 6),
2024 Reject(6, 9),
2025 Match(9, 9),
2026 ]
2027 );
1978 make_test!(str_searcher_ascii_haystack, "bb", "abbcbbd", [
1979 Reject(0, 1),
1980 Match(1, 3),
1981 Reject(3, 4),
1982 Match(4, 6),
1983 Reject(6, 7),
1984 ]);
1985 make_test!(str_searcher_ascii_haystack_seq, "bb", "abbcbbbbd", [
1986 Reject(0, 1),
1987 Match(1, 3),
1988 Reject(3, 4),
1989 Match(4, 6),
1990 Match(6, 8),
1991 Reject(8, 9),
1992 ]);
1993 make_test!(str_searcher_empty_needle_ascii_haystack, "", "abbcbbd", [
1994 Match(0, 0),
1995 Reject(0, 1),
1996 Match(1, 1),
1997 Reject(1, 2),
1998 Match(2, 2),
1999 Reject(2, 3),
2000 Match(3, 3),
2001 Reject(3, 4),
2002 Match(4, 4),
2003 Reject(4, 5),
2004 Match(5, 5),
2005 Reject(5, 6),
2006 Match(6, 6),
2007 Reject(6, 7),
2008 Match(7, 7),
2009 ]);
2010 make_test!(str_searcher_multibyte_haystack, " ", "├──", [
2011 Reject(0, 3),
2012 Reject(3, 6),
2013 Reject(6, 9),
2014 ]);
2015 make_test!(str_searcher_empty_needle_multibyte_haystack, "", "├──", [
2016 Match(0, 0),
2017 Reject(0, 3),
2018 Match(3, 3),
2019 Reject(3, 6),
2020 Match(6, 6),
2021 Reject(6, 9),
2022 Match(9, 9),
2023 ]);
20282024 make_test!(str_searcher_empty_needle_empty_haystack, "", "", [Match(0, 0),]);
20292025 make_test!(str_searcher_nonempty_needle_empty_haystack, "├", "", []);
2030 make_test!(
2031 char_searcher_ascii_haystack,
2032 'b',
2033 "abbcbbd",
2034 [
2035 Reject(0, 1),
2036 Match(1, 2),
2037 Match(2, 3),
2038 Reject(3, 4),
2039 Match(4, 5),
2040 Match(5, 6),
2041 Reject(6, 7),
2042 ]
2043 );
2044 make_test!(
2045 char_searcher_multibyte_haystack,
2046 ' ',
2047 "├──",
2048 [Reject(0, 3), Reject(3, 6), Reject(6, 9),]
2049 );
2050 make_test!(
2051 char_searcher_short_haystack,
2052 '\u{1F4A9}',
2053 "* \t",
2054 [Reject(0, 1), Reject(1, 2), Reject(2, 3),]
2055 );
2026 make_test!(char_searcher_ascii_haystack, 'b', "abbcbbd", [
2027 Reject(0, 1),
2028 Match(1, 2),
2029 Match(2, 3),
2030 Reject(3, 4),
2031 Match(4, 5),
2032 Match(5, 6),
2033 Reject(6, 7),
2034 ]);
2035 make_test!(char_searcher_multibyte_haystack, ' ', "├──", [
2036 Reject(0, 3),
2037 Reject(3, 6),
2038 Reject(6, 9),
2039 ]);
2040 make_test!(char_searcher_short_haystack, '\u{1F4A9}', "* \t", [
2041 Reject(0, 1),
2042 Reject(1, 2),
2043 Reject(2, 3),
2044 ]);
20562045
20572046 // See #85462
20582047 #[test]
library/alloc/tests/string.rs+13-22
......@@ -154,28 +154,19 @@ fn test_fromutf8error_into_lossy() {
154154#[test]
155155fn test_from_utf16() {
156156 let pairs = [
157 (
158 String::from("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"),
159 vec![
160 0xd800, 0xdf45, 0xd800, 0xdf3f, 0xd800, 0xdf3b, 0xd800, 0xdf46, 0xd800, 0xdf39,
161 0xd800, 0xdf3b, 0xd800, 0xdf30, 0x000a,
162 ],
163 ),
164 (
165 String::from("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"),
166 vec![
167 0xd801, 0xdc12, 0xd801, 0xdc49, 0xd801, 0xdc2e, 0xd801, 0xdc40, 0xd801, 0xdc32,
168 0xd801, 0xdc4b, 0x0020, 0xd801, 0xdc0f, 0xd801, 0xdc32, 0xd801, 0xdc4d, 0x000a,
169 ],
170 ),
171 (
172 String::from("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"),
173 vec![
174 0xd800, 0xdf00, 0xd800, 0xdf16, 0xd800, 0xdf0b, 0xd800, 0xdf04, 0xd800, 0xdf11,
175 0xd800, 0xdf09, 0x00b7, 0xd800, 0xdf0c, 0xd800, 0xdf04, 0xd800, 0xdf15, 0xd800,
176 0xdf04, 0xd800, 0xdf0b, 0xd800, 0xdf09, 0xd800, 0xdf11, 0x000a,
177 ],
178 ),
157 (String::from("𐍅𐌿𐌻𐍆𐌹𐌻𐌰\n"), vec![
158 0xd800, 0xdf45, 0xd800, 0xdf3f, 0xd800, 0xdf3b, 0xd800, 0xdf46, 0xd800, 0xdf39, 0xd800,
159 0xdf3b, 0xd800, 0xdf30, 0x000a,
160 ]),
161 (String::from("𐐒𐑉𐐮𐑀𐐲𐑋 𐐏𐐲𐑍\n"), vec![
162 0xd801, 0xdc12, 0xd801, 0xdc49, 0xd801, 0xdc2e, 0xd801, 0xdc40, 0xd801, 0xdc32, 0xd801,
163 0xdc4b, 0x0020, 0xd801, 0xdc0f, 0xd801, 0xdc32, 0xd801, 0xdc4d, 0x000a,
164 ]),
165 (String::from("𐌀𐌖𐌋𐌄𐌑𐌉·𐌌𐌄𐌕𐌄𐌋𐌉𐌑\n"), vec![
166 0xd800, 0xdf00, 0xd800, 0xdf16, 0xd800, 0xdf0b, 0xd800, 0xdf04, 0xd800, 0xdf11, 0xd800,
167 0xdf09, 0x00b7, 0xd800, 0xdf0c, 0xd800, 0xdf04, 0xd800, 0xdf15, 0xd800, 0xdf04, 0xd800,
168 0xdf0b, 0xd800, 0xdf09, 0xd800, 0xdf11, 0x000a,
169 ]),
179170 (
180171 String::from("𐒋𐒘𐒈𐒑𐒛𐒒 𐒕𐒓 𐒈𐒚𐒍 𐒏𐒜𐒒𐒖𐒆 𐒕𐒆\n"),
181172 vec![
library/alloc/tests/vec.rs+1-1
......@@ -14,7 +14,7 @@ use std::fmt::Debug;
1414use std::iter::InPlaceIterable;
1515use std::mem::{size_of, swap};
1616use std::ops::Bound::*;
17use std::panic::{catch_unwind, AssertUnwindSafe};
17use std::panic::{AssertUnwindSafe, catch_unwind};
1818use std::rc::Rc;
1919use std::sync::atomic::{AtomicU32, Ordering};
2020use std::vec::{Drain, IntoIter};
library/alloc/tests/vec_deque.rs+2-2
......@@ -3,12 +3,12 @@
33
44use core::num::NonZero;
55use std::assert_matches::assert_matches;
6use std::collections::vec_deque::Drain;
76use std::collections::TryReserveErrorKind::*;
87use std::collections::VecDeque;
8use std::collections::vec_deque::Drain;
99use std::fmt::Debug;
1010use std::ops::Bound::*;
11use std::panic::{catch_unwind, AssertUnwindSafe};
11use std::panic::{AssertUnwindSafe, catch_unwind};
1212
1313use Taggy::*;
1414use Taggypar::*;
library/alloc/tests/vec_deque_alloc_error.rs+2-2
......@@ -1,8 +1,8 @@
11#![feature(alloc_error_hook, allocator_api)]
22
3use std::alloc::{set_alloc_error_hook, AllocError, Allocator, Layout, System};
3use std::alloc::{AllocError, Allocator, Layout, System, set_alloc_error_hook};
44use std::collections::VecDeque;
5use std::panic::{catch_unwind, AssertUnwindSafe};
5use std::panic::{AssertUnwindSafe, catch_unwind};
66use std::ptr::NonNull;
77
88#[test]
library/core/benches/any.rs+1-1
......@@ -1,6 +1,6 @@
11use core::any::*;
22
3use test::{black_box, Bencher};
3use test::{Bencher, black_box};
44
55#[bench]
66fn bench_downcast_ref(b: &mut Bencher) {
library/core/benches/array.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33macro_rules! map_array {
44 ($func_name:ident, $start_item: expr, $map_item: expr, $arr_size: expr) => {
library/core/benches/ascii.rs+1-1
......@@ -65,7 +65,7 @@ macro_rules! benches {
6565
6666use std::fmt::Write;
6767
68use test::{black_box, Bencher};
68use test::{Bencher, black_box};
6969
7070const ASCII_CASE_MASK: u8 = 0b0010_0000;
7171
library/core/benches/ascii/is_ascii.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33use super::{LONG, MEDIUM, SHORT};
44
library/core/benches/char/methods.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33const CHARS: [char; 9] = ['0', 'x', '2', '5', 'A', 'f', '7', '8', '9'];
44const RADIX: [u32; 5] = [2, 8, 10, 16, 32];
library/core/benches/fmt.rs+1-1
......@@ -1,7 +1,7 @@
11use std::fmt::{self, Write as FmtWrite};
22use std::io::{self, Write as IoWrite};
33
4use test::{black_box, Bencher};
4use test::{Bencher, black_box};
55
66#[bench]
77fn write_vec_value(bh: &mut Bencher) {
library/core/benches/hash/sip.rs+1-1
......@@ -2,7 +2,7 @@
22
33use core::hash::*;
44
5use test::{black_box, Bencher};
5use test::{Bencher, black_box};
66
77fn hash_bytes<H: Hasher>(mut s: H, x: &[u8]) -> u64 {
88 Hasher::write(&mut s, x);
library/core/benches/iter.rs+1-1
......@@ -4,7 +4,7 @@ use core::mem;
44use core::num::Wrapping;
55use core::ops::Range;
66
7use test::{black_box, Bencher};
7use test::{Bencher, black_box};
88
99#[bench]
1010fn bench_rposition(b: &mut Bencher) {
library/core/benches/net/addr_parser.rs+1-1
......@@ -1,7 +1,7 @@
11use core::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
22use core::str::FromStr;
33
4use test::{black_box, Bencher};
4use test::{Bencher, black_box};
55
66const IPV4_STR: &str = "192.168.0.1";
77const IPV4_STR_PORT: &str = "192.168.0.1:8080";
library/core/benches/num/dec2flt/mod.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33#[bench]
44fn bench_0(b: &mut Bencher) {
library/core/benches/num/flt2dec/mod.rs+2-2
......@@ -3,10 +3,10 @@ mod strategy {
33 mod grisu;
44}
55
6use core::num::flt2dec::{decode, DecodableFloat, Decoded, FullDecoded, MAX_SIG_DIGITS};
6use core::num::flt2dec::{DecodableFloat, Decoded, FullDecoded, MAX_SIG_DIGITS, decode};
77use std::io::Write;
88
9use test::{black_box, Bencher};
9use test::{Bencher, black_box};
1010
1111pub fn decode_finite<T: DecodableFloat>(v: T) -> Decoded {
1212 match decode(v).1 {
library/core/benches/num/int_log/mod.rs+1-1
......@@ -1,5 +1,5 @@
11use rand::Rng;
2use test::{black_box, Bencher};
2use test::{Bencher, black_box};
33
44macro_rules! int_log10_bench {
55 ($t:ty, $predictable:ident, $random:ident, $random_small:ident) => {
library/core/benches/num/int_pow/mod.rs+1-1
......@@ -1,5 +1,5 @@
11use rand::Rng;
2use test::{black_box, Bencher};
2use test::{Bencher, black_box};
33
44const ITERATIONS: usize = 128; // Uses an ITERATIONS * 20 Byte stack allocation
55type IntType = i128; // Hardest native type to multiply
library/core/benches/num/int_sqrt/mod.rs+1-1
......@@ -1,5 +1,5 @@
11use rand::Rng;
2use test::{black_box, Bencher};
2use test::{Bencher, black_box};
33
44macro_rules! int_sqrt_bench {
55 ($t:ty, $predictable:ident, $random:ident, $random_small:ident, $random_uniform:ident) => {
library/core/benches/num/mod.rs+1-1
......@@ -6,7 +6,7 @@ mod int_sqrt;
66
77use std::str::FromStr;
88
9use test::{black_box, Bencher};
9use test::{Bencher, black_box};
1010
1111const ASCII_NUMBERS: [&str; 19] = [
1212 "0",
library/core/benches/pattern.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33#[bench]
44fn starts_with_char(b: &mut Bencher) {
library/core/benches/slice.rs+1-1
......@@ -1,6 +1,6 @@
11use core::ptr::NonNull;
22
3use test::{black_box, Bencher};
3use test::{Bencher, black_box};
44
55enum Cache {
66 L1,
library/core/benches/str.rs+1-1
......@@ -1,6 +1,6 @@
11use std::str;
22
3use test::{black_box, Bencher};
3use test::{Bencher, black_box};
44
55mod char_count;
66mod corpora;
library/core/benches/str/char_count.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33use super::corpora::*;
44
library/core/benches/str/debug.rs+1-1
......@@ -5,7 +5,7 @@
55
66use std::fmt::{self, Write};
77
8use test::{black_box, Bencher};
8use test::{Bencher, black_box};
99
1010#[derive(Default)]
1111struct CountingWriter {
library/core/benches/str/iter.rs+1-1
......@@ -1,4 +1,4 @@
1use test::{black_box, Bencher};
1use test::{Bencher, black_box};
22
33use super::corpora;
44
library/core/benches/tuple.rs+1-1
......@@ -1,5 +1,5 @@
11use rand::prelude::*;
2use test::{black_box, Bencher};
2use test::{Bencher, black_box};
33
44#[bench]
55fn bench_tuple_comparison(b: &mut Bencher) {
library/core/src/array/mod.rs+1-1
......@@ -10,7 +10,7 @@ use crate::convert::Infallible;
1010use crate::error::Error;
1111use crate::fmt;
1212use crate::hash::{self, Hash};
13use crate::iter::{repeat_n, UncheckedIterator};
13use crate::iter::{UncheckedIterator, repeat_n};
1414use crate::mem::{self, MaybeUninit};
1515use crate::ops::{
1616 ChangeOutputType, ControlFlow, FromResidual, Index, IndexMut, NeverShortCircuit, Residual, Try,
library/core/src/async_iter/mod.rs+1-1
......@@ -125,4 +125,4 @@ mod async_iter;
125125mod from_iter;
126126
127127pub use async_iter::{AsyncIterator, IntoAsyncIterator};
128pub use from_iter::{from_iter, FromIter};
128pub use from_iter::{FromIter, from_iter};
library/core/src/cell.rs+9-8
......@@ -1577,10 +1577,10 @@ impl<'b, T: ?Sized> Ref<'b, T> {
15771577 {
15781578 let (a, b) = f(&*orig);
15791579 let borrow = orig.borrow.clone();
1580 (
1581 Ref { value: NonNull::from(a), borrow },
1582 Ref { value: NonNull::from(b), borrow: orig.borrow },
1583 )
1580 (Ref { value: NonNull::from(a), borrow }, Ref {
1581 value: NonNull::from(b),
1582 borrow: orig.borrow,
1583 })
15841584 }
15851585
15861586 /// Converts into a reference to the underlying data.
......@@ -1745,10 +1745,11 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
17451745 {
17461746 let borrow = orig.borrow.clone();
17471747 let (a, b) = f(&mut *orig);
1748 (
1749 RefMut { value: NonNull::from(a), borrow, marker: PhantomData },
1750 RefMut { value: NonNull::from(b), borrow: orig.borrow, marker: PhantomData },
1751 )
1748 (RefMut { value: NonNull::from(a), borrow, marker: PhantomData }, RefMut {
1749 value: NonNull::from(b),
1750 borrow: orig.borrow,
1751 marker: PhantomData,
1752 })
17521753 }
17531754
17541755 /// Converts into a mutable reference to the underlying data.
library/core/src/ffi/c_str.rs+1-1
......@@ -5,7 +5,7 @@ use crate::error::Error;
55use crate::ffi::c_char;
66use crate::iter::FusedIterator;
77use crate::marker::PhantomData;
8use crate::ptr::{addr_of, NonNull};
8use crate::ptr::{NonNull, addr_of};
99use crate::slice::memchr;
1010use crate::{fmt, intrinsics, ops, slice, str};
1111
library/core/src/fmt/mod.rs+2-2
......@@ -33,10 +33,10 @@ pub enum Alignment {
3333 Center,
3434}
3535
36#[unstable(feature = "debug_closure_helpers", issue = "117729")]
37pub use self::builders::{from_fn, FromFn};
3836#[stable(feature = "debug_builders", since = "1.2.0")]
3937pub use self::builders::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};
38#[unstable(feature = "debug_closure_helpers", issue = "117729")]
39pub use self::builders::{FromFn, from_fn};
4040
4141/// The type returned by formatter methods.
4242///
library/core/src/future/async_drop.rs+1-1
......@@ -6,7 +6,7 @@ use crate::intrinsics::discriminant_value;
66use crate::marker::{DiscriminantKind, PhantomPinned};
77use crate::mem::MaybeUninit;
88use crate::pin::Pin;
9use crate::task::{ready, Context, Poll};
9use crate::task::{Context, Poll, ready};
1010
1111/// Asynchronously drops a value by running `AsyncDrop::async_drop`
1212/// on a value and its fields recursively.
library/core/src/future/join.rs+2-2
......@@ -1,10 +1,10 @@
11#![allow(unused_imports, unused_macros)] // items are used by the macro
22
33use crate::cell::UnsafeCell;
4use crate::future::{poll_fn, Future};
4use crate::future::{Future, poll_fn};
55use crate::mem;
66use crate::pin::Pin;
7use crate::task::{ready, Context, Poll};
7use crate::task::{Context, Poll, ready};
88
99/// Polls multiple futures simultaneously, returning a tuple
1010/// of all results once complete.
library/core/src/future/mod.rs+4-4
......@@ -21,15 +21,15 @@ mod poll_fn;
2121mod ready;
2222
2323#[unstable(feature = "async_drop", issue = "126482")]
24pub use async_drop::{async_drop, async_drop_in_place, AsyncDrop, AsyncDropInPlace};
24pub use async_drop::{AsyncDrop, AsyncDropInPlace, async_drop, async_drop_in_place};
2525#[stable(feature = "into_future", since = "1.64.0")]
2626pub use into_future::IntoFuture;
2727#[stable(feature = "future_readiness_fns", since = "1.48.0")]
28pub use pending::{pending, Pending};
28pub use pending::{Pending, pending};
2929#[stable(feature = "future_poll_fn", since = "1.64.0")]
30pub use poll_fn::{poll_fn, PollFn};
30pub use poll_fn::{PollFn, poll_fn};
3131#[stable(feature = "future_readiness_fns", since = "1.48.0")]
32pub use ready::{ready, Ready};
32pub use ready::{Ready, ready};
3333
3434#[stable(feature = "futures_api", since = "1.36.0")]
3535pub use self::future::Future;
library/core/src/iter/adapters/fuse.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::intrinsics;
2use crate::iter::adapters::zip::try_get_unchecked;
32use crate::iter::adapters::SourceIter;
3use crate::iter::adapters::zip::try_get_unchecked;
44use crate::iter::{
55 FusedIterator, TrustedFused, TrustedLen, TrustedRandomAccess, TrustedRandomAccessNoCoerce,
66};
library/core/src/iter/adapters/map_while.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::fmt;
2use crate::iter::adapters::SourceIter;
32use crate::iter::InPlaceIterable;
3use crate::iter::adapters::SourceIter;
44use crate::num::NonZero;
55use crate::ops::{ControlFlow, Try};
66
library/core/src/iter/adapters/mod.rs+2-2
......@@ -48,12 +48,12 @@ pub use self::map_while::MapWhile;
4848pub use self::map_windows::MapWindows;
4949#[stable(feature = "iterator_step_by", since = "1.28.0")]
5050pub use self::step_by::StepBy;
51#[stable(feature = "iter_zip", since = "1.59.0")]
52pub use self::zip::zip;
5351#[unstable(feature = "trusted_random_access", issue = "none")]
5452pub use self::zip::TrustedRandomAccess;
5553#[unstable(feature = "trusted_random_access", issue = "none")]
5654pub use self::zip::TrustedRandomAccessNoCoerce;
55#[stable(feature = "iter_zip", since = "1.59.0")]
56pub use self::zip::zip;
5757#[stable(feature = "rust1", since = "1.0.0")]
5858pub use self::{
5959 chain::Chain, cycle::Cycle, enumerate::Enumerate, filter::Filter, filter_map::FilterMap,
library/core/src/iter/adapters/scan.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::fmt;
2use crate::iter::adapters::SourceIter;
32use crate::iter::InPlaceIterable;
3use crate::iter::adapters::SourceIter;
44use crate::num::NonZero;
55use crate::ops::{ControlFlow, Try};
66
library/core/src/iter/adapters/skip.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::intrinsics::unlikely;
2use crate::iter::adapters::zip::try_get_unchecked;
32use crate::iter::adapters::SourceIter;
3use crate::iter::adapters::zip::try_get_unchecked;
44use crate::iter::{
55 FusedIterator, InPlaceIterable, TrustedFused, TrustedLen, TrustedRandomAccess,
66 TrustedRandomAccessNoCoerce,
library/core/src/iter/adapters/step_by.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::intrinsics;
2use crate::iter::{from_fn, TrustedLen, TrustedRandomAccess};
2use crate::iter::{TrustedLen, TrustedRandomAccess, from_fn};
33use crate::num::NonZero;
44use crate::ops::{Range, Try};
55
library/core/src/iter/mod.rs+13-13
......@@ -380,11 +380,6 @@ macro_rules! impl_fold_via_try_fold {
380380 };
381381}
382382
383#[unstable(feature = "iter_chain", reason = "recently added", issue = "125964")]
384pub use self::adapters::chain;
385pub(crate) use self::adapters::try_process;
386#[stable(feature = "iter_zip", since = "1.59.0")]
387pub use self::adapters::zip;
388383#[unstable(feature = "iter_array_chunks", reason = "recently added", issue = "100450")]
389384pub use self::adapters::ArrayChunks;
390385#[unstable(feature = "std_internals", issue = "none")]
......@@ -407,6 +402,11 @@ pub use self::adapters::StepBy;
407402pub use self::adapters::TrustedRandomAccess;
408403#[unstable(feature = "trusted_random_access", issue = "none")]
409404pub use self::adapters::TrustedRandomAccessNoCoerce;
405#[unstable(feature = "iter_chain", reason = "recently added", issue = "125964")]
406pub use self::adapters::chain;
407pub(crate) use self::adapters::try_process;
408#[stable(feature = "iter_zip", since = "1.59.0")]
409pub use self::adapters::zip;
410410#[stable(feature = "rust1", since = "1.0.0")]
411411pub use self::adapters::{
412412 Chain, Cycle, Enumerate, Filter, FilterMap, FlatMap, Fuse, Inspect, Map, Peekable, Rev, Scan,
......@@ -427,21 +427,21 @@ pub use self::range::Step;
427427)]
428428pub use self::sources::from_coroutine;
429429#[stable(feature = "iter_empty", since = "1.2.0")]
430pub use self::sources::{empty, Empty};
430pub use self::sources::{Empty, empty};
431431#[stable(feature = "iter_from_fn", since = "1.34.0")]
432pub use self::sources::{from_fn, FromFn};
432pub use self::sources::{FromFn, from_fn};
433433#[stable(feature = "iter_once", since = "1.2.0")]
434pub use self::sources::{once, Once};
434pub use self::sources::{Once, once};
435435#[stable(feature = "iter_once_with", since = "1.43.0")]
436pub use self::sources::{once_with, OnceWith};
436pub use self::sources::{OnceWith, once_with};
437437#[stable(feature = "rust1", since = "1.0.0")]
438pub use self::sources::{repeat, Repeat};
438pub use self::sources::{Repeat, repeat};
439439#[stable(feature = "iter_repeat_n", since = "1.82.0")]
440pub use self::sources::{repeat_n, RepeatN};
440pub use self::sources::{RepeatN, repeat_n};
441441#[stable(feature = "iterator_repeat_with", since = "1.28.0")]
442pub use self::sources::{repeat_with, RepeatWith};
442pub use self::sources::{RepeatWith, repeat_with};
443443#[stable(feature = "iter_successors", since = "1.34.0")]
444pub use self::sources::{successors, Successors};
444pub use self::sources::{Successors, successors};
445445#[stable(feature = "fused", since = "1.26.0")]
446446pub use self::traits::FusedIterator;
447447#[unstable(issue = "none", feature = "inplace_iteration")]
library/core/src/iter/sources.rs+8-8
......@@ -9,7 +9,7 @@ mod repeat_with;
99mod successors;
1010
1111#[stable(feature = "iter_empty", since = "1.2.0")]
12pub use self::empty::{empty, Empty};
12pub use self::empty::{Empty, empty};
1313#[unstable(
1414 feature = "iter_from_coroutine",
1515 issue = "43122",
......@@ -17,16 +17,16 @@ pub use self::empty::{empty, Empty};
1717)]
1818pub use self::from_coroutine::from_coroutine;
1919#[stable(feature = "iter_from_fn", since = "1.34.0")]
20pub use self::from_fn::{from_fn, FromFn};
20pub use self::from_fn::{FromFn, from_fn};
2121#[stable(feature = "iter_once", since = "1.2.0")]
22pub use self::once::{once, Once};
22pub use self::once::{Once, once};
2323#[stable(feature = "iter_once_with", since = "1.43.0")]
24pub use self::once_with::{once_with, OnceWith};
24pub use self::once_with::{OnceWith, once_with};
2525#[stable(feature = "rust1", since = "1.0.0")]
26pub use self::repeat::{repeat, Repeat};
26pub use self::repeat::{Repeat, repeat};
2727#[stable(feature = "iter_repeat_n", since = "1.82.0")]
28pub use self::repeat_n::{repeat_n, RepeatN};
28pub use self::repeat_n::{RepeatN, repeat_n};
2929#[stable(feature = "iterator_repeat_with", since = "1.28.0")]
30pub use self::repeat_with::{repeat_with, RepeatWith};
30pub use self::repeat_with::{RepeatWith, repeat_with};
3131#[stable(feature = "iter_successors", since = "1.34.0")]
32pub use self::successors::{successors, Successors};
32pub use self::successors::{Successors, successors};
library/core/src/iter/traits/iterator.rs+4-4
......@@ -1,8 +1,8 @@
11use super::super::{
2 try_process, ArrayChunks, ByRefSized, Chain, Cloned, Copied, Cycle, Enumerate, Filter,
3 FilterMap, FlatMap, Flatten, Fuse, Inspect, Intersperse, IntersperseWith, Map, MapWhile,
4 MapWindows, Peekable, Product, Rev, Scan, Skip, SkipWhile, StepBy, Sum, Take, TakeWhile,
5 TrustedRandomAccessNoCoerce, Zip,
2 ArrayChunks, ByRefSized, Chain, Cloned, Copied, Cycle, Enumerate, Filter, FilterMap, FlatMap,
3 Flatten, Fuse, Inspect, Intersperse, IntersperseWith, Map, MapWhile, MapWindows, Peekable,
4 Product, Rev, Scan, Skip, SkipWhile, StepBy, Sum, Take, TakeWhile, TrustedRandomAccessNoCoerce,
5 Zip, try_process,
66};
77use crate::array;
88use crate::cmp::{self, Ordering};
library/core/src/num/dec2flt/decimal.rs+1-1
......@@ -9,7 +9,7 @@
99//! algorithm can be found in "ParseNumberF64 by Simple Decimal Conversion",
1010//! available online: <https://nigeltao.github.io/blog/2020/parse-number-f64-simple.html>.
1111
12use crate::num::dec2flt::common::{is_8digits, ByteSlice};
12use crate::num::dec2flt::common::{ByteSlice, is_8digits};
1313
1414#[derive(Clone)]
1515pub struct Decimal {
library/core/src/num/dec2flt/parse.rs+1-1
......@@ -1,6 +1,6 @@
11//! Functions to parse floating-point numbers.
22
3use crate::num::dec2flt::common::{is_8digits, ByteSlice};
3use crate::num::dec2flt::common::{ByteSlice, is_8digits};
44use crate::num::dec2flt::float::RawFloat;
55use crate::num::dec2flt::number::Number;
66
library/core/src/num/dec2flt/slow.rs+1-1
......@@ -1,7 +1,7 @@
11//! Slow, fallback algorithm for cases the Eisel-Lemire algorithm cannot round.
22
33use crate::num::dec2flt::common::BiasedFp;
4use crate::num::dec2flt::decimal::{parse_decimal, Decimal};
4use crate::num::dec2flt::decimal::{Decimal, parse_decimal};
55use crate::num::dec2flt::float::RawFloat;
66
77/// Parse the significant digits and biased, binary exponent of a float.
library/core/src/num/flt2dec/decoder.rs+1-1
......@@ -1,7 +1,7 @@
11//! Decodes a floating-point value into individual parts and error ranges.
22
3use crate::num::dec2flt::float::RawFloat;
43use crate::num::FpCategory;
4use crate::num::dec2flt::float::RawFloat;
55
66/// Decoded unsigned finite value, such that:
77///
library/core/src/num/flt2dec/mod.rs+1-1
......@@ -122,7 +122,7 @@ functions.
122122 issue = "none"
123123)]
124124
125pub use self::decoder::{decode, DecodableFloat, Decoded, FullDecoded};
125pub use self::decoder::{DecodableFloat, Decoded, FullDecoded, decode};
126126use super::fmt::{Formatted, Part};
127127use crate::mem::MaybeUninit;
128128
library/core/src/num/flt2dec/strategy/dragon.rs+1-1
......@@ -8,7 +8,7 @@ use crate::cmp::Ordering;
88use crate::mem::MaybeUninit;
99use crate::num::bignum::{Big32x40 as Big, Digit32 as Digit};
1010use crate::num::flt2dec::estimator::estimate_scaling_factor;
11use crate::num::flt2dec::{round_up, Decoded, MAX_SIG_DIGITS};
11use crate::num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up};
1212
1313static POW10: [Digit; 10] =
1414 [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000];
library/core/src/num/flt2dec/strategy/grisu.rs+1-1
......@@ -7,7 +7,7 @@
77
88use crate::mem::MaybeUninit;
99use crate::num::diy_float::Fp;
10use crate::num::flt2dec::{round_up, Decoded, MAX_SIG_DIGITS};
10use crate::num::flt2dec::{Decoded, MAX_SIG_DIGITS, round_up};
1111
1212// see the comments in `format_shortest_opt` for the rationale.
1313#[doc(hidden)]
library/core/src/num/mod.rs+2-2
......@@ -75,9 +75,9 @@ pub use nonzero::NonZero;
7575)]
7676pub use nonzero::ZeroablePrimitive;
7777#[stable(feature = "signed_nonzero", since = "1.34.0")]
78pub use nonzero::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize};
78pub use nonzero::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize};
7979#[stable(feature = "nonzero", since = "1.28.0")]
80pub use nonzero::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
80pub use nonzero::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize};
8181#[stable(feature = "saturating_int_impl", since = "1.74.0")]
8282pub use saturating::Saturating;
8383#[stable(feature = "rust1", since = "1.0.0")]
library/core/src/ops/async_function.rs+8-2
......@@ -79,7 +79,10 @@ mod impls {
7979 where
8080 F: AsyncFn<A>,
8181 {
82 type CallRefFuture<'a> = F::CallRefFuture<'a> where Self: 'a;
82 type CallRefFuture<'a>
83 = F::CallRefFuture<'a>
84 where
85 Self: 'a;
8386
8487 extern "rust-call" fn async_call_mut(&mut self, args: A) -> Self::CallRefFuture<'_> {
8588 F::async_call(*self, args)
......@@ -104,7 +107,10 @@ mod impls {
104107 where
105108 F: AsyncFnMut<A>,
106109 {
107 type CallRefFuture<'a> = F::CallRefFuture<'a> where Self: 'a;
110 type CallRefFuture<'a>
111 = F::CallRefFuture<'a>
112 where
113 Self: 'a;
108114
109115 extern "rust-call" fn async_call_mut(&mut self, args: A) -> Self::CallRefFuture<'_> {
110116 F::async_call_mut(*self, args)
library/core/src/ops/mod.rs+1-1
......@@ -172,9 +172,9 @@ pub use self::deref::DerefPure;
172172pub use self::deref::Receiver;
173173#[stable(feature = "rust1", since = "1.0.0")]
174174pub use self::deref::{Deref, DerefMut};
175pub(crate) use self::drop::fallback_surface_drop;
176175#[stable(feature = "rust1", since = "1.0.0")]
177176pub use self::drop::Drop;
177pub(crate) use self::drop::fallback_surface_drop;
178178#[stable(feature = "rust1", since = "1.0.0")]
179179pub use self::function::{Fn, FnMut, FnOnce};
180180#[stable(feature = "rust1", since = "1.0.0")]
library/core/src/primitive.rs+4-4
......@@ -46,7 +46,7 @@ pub use f32;
4646#[stable(feature = "core_primitive", since = "1.43.0")]
4747pub use f64;
4848#[stable(feature = "core_primitive", since = "1.43.0")]
49pub use i128;
49pub use i8;
5050#[stable(feature = "core_primitive", since = "1.43.0")]
5151pub use i16;
5252#[stable(feature = "core_primitive", since = "1.43.0")]
......@@ -54,13 +54,13 @@ pub use i32;
5454#[stable(feature = "core_primitive", since = "1.43.0")]
5555pub use i64;
5656#[stable(feature = "core_primitive", since = "1.43.0")]
57pub use i8;
57pub use i128;
5858#[stable(feature = "core_primitive", since = "1.43.0")]
5959pub use isize;
6060#[stable(feature = "core_primitive", since = "1.43.0")]
6161pub use str;
6262#[stable(feature = "core_primitive", since = "1.43.0")]
63pub use u128;
63pub use u8;
6464#[stable(feature = "core_primitive", since = "1.43.0")]
6565pub use u16;
6666#[stable(feature = "core_primitive", since = "1.43.0")]
......@@ -68,6 +68,6 @@ pub use u32;
6868#[stable(feature = "core_primitive", since = "1.43.0")]
6969pub use u64;
7070#[stable(feature = "core_primitive", since = "1.43.0")]
71pub use u8;
71pub use u128;
7272#[stable(feature = "core_primitive", since = "1.43.0")]
7373pub use usize;
library/core/src/ptr/mod.rs+1-1
......@@ -467,7 +467,7 @@ pub use crate::intrinsics::write_bytes;
467467
468468mod metadata;
469469#[unstable(feature = "ptr_metadata", issue = "81513")]
470pub use metadata::{from_raw_parts, from_raw_parts_mut, metadata, DynMetadata, Pointee, Thin};
470pub use metadata::{DynMetadata, Pointee, Thin, from_raw_parts, from_raw_parts_mut, metadata};
471471
472472mod non_null;
473473#[stable(feature = "nonnull", since = "1.25.0")]
library/core/src/range.rs+1-1
......@@ -24,9 +24,9 @@ mod iter;
2424#[unstable(feature = "new_range_api", issue = "125687")]
2525pub mod legacy;
2626
27use Bound::{Excluded, Included, Unbounded};
2728#[doc(inline)]
2829pub use iter::{IterRange, IterRangeFrom, IterRangeInclusive};
29use Bound::{Excluded, Included, Unbounded};
3030
3131#[doc(inline)]
3232pub use crate::iter::Step;
library/core/src/range/iter.rs+1-1
......@@ -2,7 +2,7 @@ use crate::iter::{
22 FusedIterator, Step, TrustedLen, TrustedRandomAccess, TrustedRandomAccessNoCoerce, TrustedStep,
33};
44use crate::num::NonZero;
5use crate::range::{legacy, Range, RangeFrom, RangeInclusive};
5use crate::range::{Range, RangeFrom, RangeInclusive, legacy};
66
77/// By-value [`Range`] iterator.
88#[unstable(feature = "new_range_api", issue = "125687")]
library/core/src/slice/iter.rs+1-1
......@@ -11,7 +11,7 @@ use crate::iter::{
1111use crate::marker::PhantomData;
1212use crate::mem::{self, SizedTypeProperties};
1313use crate::num::NonZero;
14use crate::ptr::{self, without_provenance, without_provenance_mut, NonNull};
14use crate::ptr::{self, NonNull, without_provenance, without_provenance_mut};
1515use crate::{cmp, fmt};
1616
1717#[stable(feature = "boxed_slice_into_iter", since = "1.80.0")]
library/core/src/slice/mod.rs+2-2
......@@ -39,11 +39,11 @@ mod raw;
3939mod rotate;
4040mod specialize;
4141
42#[stable(feature = "inherent_ascii_escape", since = "1.60.0")]
43pub use ascii::EscapeAscii;
4244#[unstable(feature = "str_internals", issue = "none")]
4345#[doc(hidden)]
4446pub use ascii::is_ascii_simple;
45#[stable(feature = "inherent_ascii_escape", since = "1.60.0")]
46pub use ascii::EscapeAscii;
4747#[stable(feature = "slice_get_slice", since = "1.28.0")]
4848pub use index::SliceIndex;
4949#[unstable(feature = "slice_range", issue = "76393")]
library/core/src/slice/sort/stable/mod.rs+1-1
......@@ -2,7 +2,7 @@
22
33use crate::mem::{self, MaybeUninit, SizedTypeProperties};
44use crate::slice::sort::shared::smallsort::{
5 insertion_sort_shift_left, StableSmallSortTypeImpl, SMALL_SORT_GENERAL_SCRATCH_LEN,
5 SMALL_SORT_GENERAL_SCRATCH_LEN, StableSmallSortTypeImpl, insertion_sort_shift_left,
66};
77use crate::{cmp, intrinsics};
88
library/core/src/slice/sort/stable/quicksort.rs+1-1
......@@ -1,9 +1,9 @@
11//! This module contains a stable quicksort and partition implementation.
22
33use crate::mem::{self, ManuallyDrop, MaybeUninit};
4use crate::slice::sort::shared::FreezeMarker;
45use crate::slice::sort::shared::pivot::choose_pivot;
56use crate::slice::sort::shared::smallsort::StableSmallSortTypeImpl;
6use crate::slice::sort::shared::FreezeMarker;
77use crate::{intrinsics, ptr};
88
99/// Sorts `v` recursively using quicksort.
library/core/src/str/converts.rs+1-1
......@@ -1,7 +1,7 @@
11//! Ways to create a `str` from bytes slice.
22
3use super::validations::run_utf8_validation;
43use super::Utf8Error;
4use super::validations::run_utf8_validation;
55use crate::{mem, ptr};
66
77/// Converts a slice of bytes to a string slice.
library/core/src/str/iter.rs+2-2
......@@ -3,8 +3,8 @@
33use super::pattern::{DoubleEndedSearcher, Pattern, ReverseSearcher, Searcher};
44use super::validations::{next_code_point, next_code_point_reverse};
55use super::{
6 from_utf8_unchecked, BytesIsNotEmpty, CharEscapeDebugContinue, CharEscapeDefault,
7 CharEscapeUnicode, IsAsciiWhitespace, IsNotEmpty, IsWhitespace, LinesMap, UnsafeBytesToStr,
6 BytesIsNotEmpty, CharEscapeDebugContinue, CharEscapeDefault, CharEscapeUnicode,
7 IsAsciiWhitespace, IsNotEmpty, IsWhitespace, LinesMap, UnsafeBytesToStr, from_utf8_unchecked,
88};
99use crate::fmt::{self, Write};
1010use crate::iter::{
library/core/src/task/wake.rs+1-1
......@@ -2,7 +2,7 @@
22
33use crate::any::Any;
44use crate::marker::PhantomData;
5use crate::mem::{transmute, ManuallyDrop};
5use crate::mem::{ManuallyDrop, transmute};
66use crate::panic::AssertUnwindSafe;
77use crate::{fmt, ptr};
88
library/core/tests/error.rs+1-1
......@@ -1,4 +1,4 @@
1use core::error::{request_ref, request_value, Request};
1use core::error::{Request, request_ref, request_value};
22
33// Test the `Request` API.
44#[derive(Debug)]
library/core/tests/future.rs+1-1
......@@ -1,4 +1,4 @@
1use std::future::{join, Future};
1use std::future::{Future, join};
22use std::pin::Pin;
33use std::sync::Arc;
44use std::task::{Context, Poll, Wake};
library/core/tests/iter/adapters/map_windows.rs+5-4
......@@ -159,10 +159,11 @@ fn output_n2() {
159159 <Vec<[char; 2]>>::new(),
160160 );
161161 assert_eq!("ab".chars().map_windows(|a: &[_; 2]| *a).collect::<Vec<_>>(), vec![['a', 'b']]);
162 assert_eq!(
163 "abcd".chars().map_windows(|a: &[_; 2]| *a).collect::<Vec<_>>(),
164 vec![['a', 'b'], ['b', 'c'], ['c', 'd']],
165 );
162 assert_eq!("abcd".chars().map_windows(|a: &[_; 2]| *a).collect::<Vec<_>>(), vec![
163 ['a', 'b'],
164 ['b', 'c'],
165 ['c', 'd']
166 ],);
166167}
167168
168169#[test]
library/core/tests/iter/adapters/zip.rs+1-1
......@@ -240,7 +240,7 @@ fn test_zip_trusted_random_access_composition() {
240240#[test]
241241#[cfg(panic = "unwind")]
242242fn test_zip_trusted_random_access_next_back_drop() {
243 use std::panic::{catch_unwind, AssertUnwindSafe};
243 use std::panic::{AssertUnwindSafe, catch_unwind};
244244
245245 let mut counter = 0;
246246
library/core/tests/num/bignum.rs+1-1
......@@ -1,5 +1,5 @@
1use core::num::bignum::tests::Big8x3 as Big;
21use core::num::bignum::Big32x40;
2use core::num::bignum::tests::Big8x3 as Big;
33
44#[test]
55#[should_panic]
library/core/tests/num/flt2dec/mod.rs+2-2
......@@ -1,6 +1,6 @@
11use core::num::flt2dec::{
2 decode, round_up, to_exact_exp_str, to_exact_fixed_str, to_shortest_exp_str, to_shortest_str,
3 DecodableFloat, Decoded, FullDecoded, Sign, MAX_SIG_DIGITS,
2 DecodableFloat, Decoded, FullDecoded, MAX_SIG_DIGITS, Sign, decode, round_up, to_exact_exp_str,
3 to_exact_fixed_str, to_shortest_exp_str, to_shortest_str,
44};
55use core::num::fmt::{Formatted, Part};
66use std::mem::MaybeUninit;
library/core/tests/num/flt2dec/random.rs+1-1
......@@ -1,7 +1,7 @@
11#![cfg(not(target_arch = "wasm32"))]
22
33use core::num::flt2dec::strategy::grisu::{format_exact_opt, format_shortest_opt};
4use core::num::flt2dec::{decode, DecodableFloat, Decoded, FullDecoded, MAX_SIG_DIGITS};
4use core::num::flt2dec::{DecodableFloat, Decoded, FullDecoded, MAX_SIG_DIGITS, decode};
55use std::mem::MaybeUninit;
66use std::str;
77
library/core/tests/num/mod.rs+1-1
......@@ -1,5 +1,5 @@
11use core::fmt::Debug;
2use core::num::{can_not_overflow, IntErrorKind, ParseIntError, TryFromIntError};
2use core::num::{IntErrorKind, ParseIntError, TryFromIntError, can_not_overflow};
33use core::ops::{Add, Div, Mul, Rem, Sub};
44use core::str::FromStr;
55
library/core/tests/pin_macro.rs+1-1
......@@ -2,7 +2,7 @@
22
33use core::marker::PhantomPinned;
44use core::mem::{drop as stuff, transmute};
5use core::pin::{pin, Pin};
5use core::pin::{Pin, pin};
66
77#[test]
88fn basic() {
library/core/tests/slice.rs+1-1
......@@ -1857,8 +1857,8 @@ fn sort_unstable() {
18571857fn select_nth_unstable() {
18581858 use core::cmp::Ordering::{Equal, Greater, Less};
18591859
1860 use rand::seq::SliceRandom;
18611860 use rand::Rng;
1861 use rand::seq::SliceRandom;
18621862
18631863 let mut rng = crate::test_rng();
18641864
library/core/tests/waker.rs+1-1
......@@ -22,7 +22,7 @@ static WAKER_VTABLE: RawWakerVTable = RawWakerVTable::new(
2222
2323// https://github.com/rust-lang/rust/issues/102012#issuecomment-1915282956
2424mod nop_waker {
25 use core::future::{ready, Future};
25 use core::future::{Future, ready};
2626 use core::pin::Pin;
2727 use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
2828
library/panic_unwind/src/emcc.rs+5-8
......@@ -98,14 +98,11 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
9898 if exception.is_null() {
9999 return uw::_URC_FATAL_PHASE1_ERROR as u32;
100100 }
101 ptr::write(
102 exception,
103 Exception {
104 canary: &EXCEPTION_TYPE_INFO,
105 caught: AtomicBool::new(false),
106 data: Some(data),
107 },
108 );
101 ptr::write(exception, Exception {
102 canary: &EXCEPTION_TYPE_INFO,
103 caught: AtomicBool::new(false),
104 data: Some(data),
105 });
109106 __cxa_throw(exception as *mut _, &EXCEPTION_TYPE_INFO, exception_cleanup);
110107}
111108
library/proc_macro/src/lib.rs+2-2
......@@ -54,7 +54,7 @@ use std::{error, fmt};
5454#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
5555pub use diagnostic::{Diagnostic, Level, MultiSpan};
5656
57use crate::escape::{escape_bytes, EscapeOptions};
57use crate::escape::{EscapeOptions, escape_bytes};
5858
5959/// Determines whether proc_macro has been made accessible to the currently
6060/// running program.
......@@ -371,7 +371,7 @@ impl Extend<TokenStream> for TokenStream {
371371/// Public implementation details for the `TokenStream` type, such as iterators.
372372#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
373373pub mod token_stream {
374 use crate::{bridge, Group, Ident, Literal, Punct, TokenStream, TokenTree};
374 use crate::{Group, Ident, Literal, Punct, TokenStream, TokenTree, bridge};
375375
376376 /// An iterator over `TokenStream`'s `TokenTree`s.
377377 /// The iteration is "shallow", e.g., the iterator doesn't recurse into delimited groups,
library/std/src/ascii.rs+1-1
......@@ -16,7 +16,7 @@
1616#[unstable(feature = "ascii_char", issue = "110998")]
1717pub use core::ascii::Char;
1818#[stable(feature = "rust1", since = "1.0.0")]
19pub use core::ascii::{escape_default, EscapeDefault};
19pub use core::ascii::{EscapeDefault, escape_default};
2020
2121/// Extension methods for ASCII-subset only operations.
2222///
library/std/src/backtrace.rs+1-1
......@@ -91,9 +91,9 @@ mod tests;
9191use crate::backtrace_rs::{self, BytesOrWideString};
9292use crate::ffi::c_void;
9393use crate::panic::UnwindSafe;
94use crate::sync::LazyLock;
9495use crate::sync::atomic::AtomicU8;
9596use crate::sync::atomic::Ordering::Relaxed;
96use crate::sync::LazyLock;
9797use crate::sys::backtrace::{lock, output_filename, set_image_base};
9898use crate::{env, fmt};
9999
library/std/src/collections/hash/map/tests.rs+1-1
......@@ -947,7 +947,7 @@ fn test_raw_entry() {
947947
948948mod test_extract_if {
949949 use super::*;
950 use crate::panic::{catch_unwind, AssertUnwindSafe};
950 use crate::panic::{AssertUnwindSafe, catch_unwind};
951951 use crate::sync::atomic::{AtomicUsize, Ordering};
952952
953953 trait EqSorted: Iterator {
library/std/src/collections/hash/set/tests.rs+2-2
......@@ -1,8 +1,8 @@
11use super::HashSet;
22use crate::hash::RandomState;
3use crate::panic::{catch_unwind, AssertUnwindSafe};
4use crate::sync::atomic::{AtomicU32, Ordering};
3use crate::panic::{AssertUnwindSafe, catch_unwind};
54use crate::sync::Arc;
5use crate::sync::atomic::{AtomicU32, Ordering};
66
77#[test]
88fn test_zero_capacities() {
library/std/src/collections/mod.rs+4-4
......@@ -418,13 +418,13 @@ pub use alloc_crate::collections::TryReserveError;
418418)]
419419pub use alloc_crate::collections::TryReserveErrorKind;
420420#[stable(feature = "rust1", since = "1.0.0")]
421pub use alloc_crate::collections::{binary_heap, btree_map, btree_set};
422#[stable(feature = "rust1", since = "1.0.0")]
423pub use alloc_crate::collections::{linked_list, vec_deque};
424#[stable(feature = "rust1", since = "1.0.0")]
425421pub use alloc_crate::collections::{BTreeMap, BTreeSet, BinaryHeap};
426422#[stable(feature = "rust1", since = "1.0.0")]
427423pub use alloc_crate::collections::{LinkedList, VecDeque};
424#[stable(feature = "rust1", since = "1.0.0")]
425pub use alloc_crate::collections::{binary_heap, btree_map, btree_set};
426#[stable(feature = "rust1", since = "1.0.0")]
427pub use alloc_crate::collections::{linked_list, vec_deque};
428428
429429#[stable(feature = "rust1", since = "1.0.0")]
430430#[doc(inline)]
library/std/src/error.rs+1-1
......@@ -7,7 +7,7 @@ mod tests;
77#[stable(feature = "rust1", since = "1.0.0")]
88pub use core::error::Error;
99#[unstable(feature = "error_generic_member_access", issue = "99301")]
10pub use core::error::{request_ref, request_value, Request};
10pub use core::error::{Request, request_ref, request_value};
1111
1212use crate::backtrace::Backtrace;
1313use crate::fmt::{self, Write};
library/std/src/f32.rs+2-2
......@@ -18,8 +18,8 @@ mod tests;
1818#[stable(feature = "rust1", since = "1.0.0")]
1919#[allow(deprecated, deprecated_in_future)]
2020pub use core::f32::{
21 consts, DIGITS, EPSILON, INFINITY, MANTISSA_DIGITS, MAX, MAX_10_EXP, MAX_EXP, MIN, MIN_10_EXP,
22 MIN_EXP, MIN_POSITIVE, NAN, NEG_INFINITY, RADIX,
21 DIGITS, EPSILON, INFINITY, MANTISSA_DIGITS, MAX, MAX_10_EXP, MAX_EXP, MIN, MIN_10_EXP, MIN_EXP,
22 MIN_POSITIVE, NAN, NEG_INFINITY, RADIX, consts,
2323};
2424
2525#[cfg(not(test))]
library/std/src/f64.rs+2-2
......@@ -18,8 +18,8 @@ mod tests;
1818#[stable(feature = "rust1", since = "1.0.0")]
1919#[allow(deprecated, deprecated_in_future)]
2020pub use core::f64::{
21 consts, DIGITS, EPSILON, INFINITY, MANTISSA_DIGITS, MAX, MAX_10_EXP, MAX_EXP, MIN, MIN_10_EXP,
22 MIN_EXP, MIN_POSITIVE, NAN, NEG_INFINITY, RADIX,
21 DIGITS, EPSILON, INFINITY, MANTISSA_DIGITS, MAX, MAX_10_EXP, MAX_EXP, MIN, MIN_10_EXP, MIN_EXP,
22 MIN_POSITIVE, NAN, NEG_INFINITY, RADIX, consts,
2323};
2424
2525#[cfg(not(test))]
library/std/src/ffi/mod.rs+5-5
......@@ -166,11 +166,6 @@ pub mod c_str;
166166
167167#[stable(feature = "core_c_void", since = "1.30.0")]
168168pub use core::ffi::c_void;
169#[stable(feature = "core_ffi_c", since = "1.64.0")]
170pub use core::ffi::{
171 c_char, c_double, c_float, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint,
172 c_ulong, c_ulonglong, c_ushort,
173};
174169#[unstable(
175170 feature = "c_variadic",
176171 reason = "the `c_variadic` feature has not been properly tested on \
......@@ -178,6 +173,11 @@ pub use core::ffi::{
178173 issue = "44930"
179174)]
180175pub use core::ffi::{VaList, VaListImpl};
176#[stable(feature = "core_ffi_c", since = "1.64.0")]
177pub use core::ffi::{
178 c_char, c_double, c_float, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint,
179 c_ulong, c_ulonglong, c_ushort,
180};
181181
182182#[doc(no_inline)]
183183#[stable(feature = "cstr_from_bytes_until_nul", since = "1.69.0")]
library/std/src/fs/tests.rs+2-2
......@@ -11,10 +11,10 @@ use crate::os::unix::fs::symlink as symlink_file;
1111#[cfg(unix)]
1212use crate::os::unix::fs::symlink as junction_point;
1313#[cfg(windows)]
14use crate::os::windows::fs::{junction_point, symlink_dir, symlink_file, OpenOptionsExt};
14use crate::os::windows::fs::{OpenOptionsExt, junction_point, symlink_dir, symlink_file};
1515use crate::path::Path;
1616use crate::sync::Arc;
17use crate::sys_common::io::test::{tmpdir, TempDir};
17use crate::sys_common::io::test::{TempDir, tmpdir};
1818use crate::time::{Duration, Instant, SystemTime};
1919use crate::{env, str, thread};
2020
library/std/src/io/buffered/bufreader.rs+2-2
......@@ -4,8 +4,8 @@ use buffer::Buffer;
44
55use crate::fmt;
66use crate::io::{
7 self, uninlined_slow_read_byte, BorrowedCursor, BufRead, IoSliceMut, Read, Seek, SeekFrom,
8 SizeHint, SpecReadByte, DEFAULT_BUF_SIZE,
7 self, BorrowedCursor, BufRead, DEFAULT_BUF_SIZE, IoSliceMut, Read, Seek, SeekFrom, SizeHint,
8 SpecReadByte, uninlined_slow_read_byte,
99};
1010
1111/// The `BufReader<R>` struct adds buffering to any reader.
library/std/src/io/buffered/bufwriter.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::io::{
2 self, ErrorKind, IntoInnerError, IoSlice, Seek, SeekFrom, Write, DEFAULT_BUF_SIZE,
2 self, DEFAULT_BUF_SIZE, ErrorKind, IntoInnerError, IoSlice, Seek, SeekFrom, Write,
33};
44use crate::mem::{self, ManuallyDrop};
55use crate::{error, fmt, ptr};
library/std/src/io/copy.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{BorrowedBuf, BufReader, BufWriter, Read, Result, Write, DEFAULT_BUF_SIZE};
1use super::{BorrowedBuf, BufReader, BufWriter, DEFAULT_BUF_SIZE, Read, Result, Write};
22use crate::alloc::Allocator;
33use crate::cmp;
44use crate::collections::VecDeque;
library/std/src/io/copy/tests.rs+1-1
......@@ -122,8 +122,8 @@ mod io_benches {
122122 use test::Bencher;
123123
124124 use crate::fs::{File, OpenOptions};
125 use crate::io::prelude::*;
126125 use crate::io::BufReader;
126 use crate::io::prelude::*;
127127
128128 #[bench]
129129 fn bench_copy_buf_reader(b: &mut Bencher) {
library/std/src/io/error/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{const_io_error, Custom, Error, ErrorData, ErrorKind, Repr, SimpleMessage};
1use super::{Custom, Error, ErrorData, ErrorKind, Repr, SimpleMessage, const_io_error};
22use crate::assert_matches::assert_matches;
33use crate::mem::size_of;
44use crate::sys::decode_error_kind;
library/std/src/io/mod.rs+3-3
......@@ -307,9 +307,9 @@ pub(crate) use error::const_io_error;
307307pub use self::buffered::WriterPanicked;
308308#[unstable(feature = "raw_os_error_ty", issue = "107792")]
309309pub use self::error::RawOsError;
310pub(crate) use self::stdio::attempt_print_to_stderr;
311310#[stable(feature = "is_terminal", since = "1.70.0")]
312311pub use self::stdio::IsTerminal;
312pub(crate) use self::stdio::attempt_print_to_stderr;
313313#[unstable(feature = "print_internals", issue = "none")]
314314#[doc(hidden)]
315315pub use self::stdio::{_eprint, _print};
......@@ -322,8 +322,8 @@ pub use self::{
322322 copy::copy,
323323 cursor::Cursor,
324324 error::{Error, ErrorKind, Result},
325 stdio::{stderr, stdin, stdout, Stderr, StderrLock, Stdin, StdinLock, Stdout, StdoutLock},
326 util::{empty, repeat, sink, Empty, Repeat, Sink},
325 stdio::{Stderr, StderrLock, Stdin, StdinLock, Stdout, StdoutLock, stderr, stdin, stdout},
326 util::{Empty, Repeat, Sink, empty, repeat, sink},
327327};
328328use crate::mem::take;
329329use crate::ops::{Deref, DerefMut};
library/std/src/io/stdio/tests.rs+3-4
......@@ -159,8 +159,7 @@ where
159159 assert_eq!(rx2.recv().unwrap(), Release2); // release th2
160160 th2.join().unwrap();
161161 th1.join().unwrap();
162 assert_eq!(
163 *log.lock().unwrap(),
164 [Start1, Acquire1, Start2, Release1, Acquire2, Release2, Acquire1, Release1]
165 );
162 assert_eq!(*log.lock().unwrap(), [
163 Start1, Acquire1, Start2, Release1, Acquire2, Release2, Acquire1, Release1
164 ]);
166165}
library/std/src/io/tests.rs+2-2
......@@ -1,7 +1,7 @@
1use super::{repeat, BorrowedBuf, Cursor, SeekFrom};
1use super::{BorrowedBuf, Cursor, SeekFrom, repeat};
22use crate::cmp::{self, min};
33use crate::io::{
4 self, BufRead, BufReader, IoSlice, IoSliceMut, Read, Seek, Write, DEFAULT_BUF_SIZE,
4 self, BufRead, BufReader, DEFAULT_BUF_SIZE, IoSlice, IoSliceMut, Read, Seek, Write,
55};
66use crate::mem::MaybeUninit;
77use crate::ops::Deref;
library/std/src/io/util/tests.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::io::prelude::*;
2use crate::io::{empty, repeat, sink, BorrowedBuf, Empty, Repeat, SeekFrom, Sink};
2use crate::io::{BorrowedBuf, Empty, Repeat, SeekFrom, Sink, empty, repeat, sink};
33use crate::mem::MaybeUninit;
44
55#[test]
library/std/src/lib.rs+10-10
......@@ -493,9 +493,9 @@ pub use core::default;
493493pub use core::future;
494494#[stable(feature = "core_hint", since = "1.27.0")]
495495pub use core::hint;
496#[stable(feature = "i128", since = "1.26.0")]
496#[stable(feature = "rust1", since = "1.0.0")]
497497#[allow(deprecated, deprecated_in_future)]
498pub use core::i128;
498pub use core::i8;
499499#[stable(feature = "rust1", since = "1.0.0")]
500500#[allow(deprecated, deprecated_in_future)]
501501pub use core::i16;
......@@ -505,9 +505,9 @@ pub use core::i32;
505505#[stable(feature = "rust1", since = "1.0.0")]
506506#[allow(deprecated, deprecated_in_future)]
507507pub use core::i64;
508#[stable(feature = "rust1", since = "1.0.0")]
508#[stable(feature = "i128", since = "1.26.0")]
509509#[allow(deprecated, deprecated_in_future)]
510pub use core::i8;
510pub use core::i128;
511511#[stable(feature = "rust1", since = "1.0.0")]
512512pub use core::intrinsics;
513513#[stable(feature = "rust1", since = "1.0.0")]
......@@ -529,9 +529,9 @@ pub use core::pin;
529529pub use core::ptr;
530530#[stable(feature = "rust1", since = "1.0.0")]
531531pub use core::result;
532#[stable(feature = "i128", since = "1.26.0")]
532#[stable(feature = "rust1", since = "1.0.0")]
533533#[allow(deprecated, deprecated_in_future)]
534pub use core::u128;
534pub use core::u8;
535535#[stable(feature = "rust1", since = "1.0.0")]
536536#[allow(deprecated, deprecated_in_future)]
537537pub use core::u16;
......@@ -541,9 +541,9 @@ pub use core::u32;
541541#[stable(feature = "rust1", since = "1.0.0")]
542542#[allow(deprecated, deprecated_in_future)]
543543pub use core::u64;
544#[stable(feature = "rust1", since = "1.0.0")]
544#[stable(feature = "i128", since = "1.26.0")]
545545#[allow(deprecated, deprecated_in_future)]
546pub use core::u8;
546pub use core::u128;
547547#[stable(feature = "rust1", since = "1.0.0")]
548548#[allow(deprecated, deprecated_in_future)]
549549pub use core::usize;
......@@ -649,9 +649,9 @@ pub mod arch {
649649 #[stable(feature = "simd_x86", since = "1.27.0")]
650650 pub use std_detect::is_x86_feature_detected;
651651 #[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")]
652 pub use std_detect::{is_mips64_feature_detected, is_mips_feature_detected};
652 pub use std_detect::{is_mips_feature_detected, is_mips64_feature_detected};
653653 #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")]
654 pub use std_detect::{is_powerpc64_feature_detected, is_powerpc_feature_detected};
654 pub use std_detect::{is_powerpc_feature_detected, is_powerpc64_feature_detected};
655655}
656656
657657// This was stabilized in the crate root so we have to keep it there.
library/std/src/net/ip_addr/tests.rs+1-1
......@@ -1,5 +1,5 @@
1use crate::net::test::{sa4, tsa};
21use crate::net::Ipv4Addr;
2use crate::net::test::{sa4, tsa};
33
44#[test]
55fn to_socket_addr_socketaddr() {
library/std/src/net/tcp.rs+1-1
......@@ -8,7 +8,7 @@ use crate::io::prelude::*;
88use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
99use crate::iter::FusedIterator;
1010use crate::net::{Shutdown, SocketAddr, ToSocketAddrs};
11use crate::sys_common::{net as net_imp, AsInner, FromInner, IntoInner};
11use crate::sys_common::{AsInner, FromInner, IntoInner, net as net_imp};
1212use crate::time::Duration;
1313
1414/// A TCP stream between a local and a remote socket.
library/std/src/net/udp.rs+1-1
......@@ -4,7 +4,7 @@ mod tests;
44use crate::fmt;
55use crate::io::{self, ErrorKind};
66use crate::net::{Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs};
7use crate::sys_common::{net as net_imp, AsInner, FromInner, IntoInner};
7use crate::sys_common::{AsInner, FromInner, IntoInner, net as net_imp};
88use crate::time::Duration;
99
1010/// A UDP socket.
library/std/src/num.rs+2-2
......@@ -26,9 +26,9 @@ pub use core::num::ZeroablePrimitive;
2626#[stable(feature = "rust1", since = "1.0.0")]
2727pub use core::num::{FpCategory, ParseFloatError, ParseIntError, TryFromIntError};
2828#[stable(feature = "signed_nonzero", since = "1.34.0")]
29pub use core::num::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize};
29pub use core::num::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize};
3030#[stable(feature = "nonzero", since = "1.28.0")]
31pub use core::num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
31pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize};
3232
3333#[cfg(test)]
3434use crate::fmt;
library/std/src/os/fortanix_sgx/mod.rs+6-6
......@@ -22,12 +22,12 @@ pub mod usercalls {
2222 /// Lowest-level interfaces to usercalls and usercall ABI type definitions.
2323 pub mod raw {
2424 pub use crate::sys::abi::usercalls::raw::{
25 accept_stream, alloc, async_queues, bind_stream, close, connect_stream, do_usercall,
26 exit, flush, free, insecure_time, launch_thread, read, read_alloc, send, wait, write,
27 ByteBuffer, Cancel, Error, Fd, FifoDescriptor, Register, RegisterArgument, Result,
28 Return, ReturnValue, Tcs, Usercall, Usercalls as UsercallNrs, EV_RETURNQ_NOT_EMPTY,
29 EV_UNPARK, EV_USERCALLQ_NOT_FULL, FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS,
30 USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO,
25 ByteBuffer, Cancel, EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL, Error,
26 FD_STDERR, FD_STDIN, FD_STDOUT, Fd, FifoDescriptor, RESULT_SUCCESS, Register,
27 RegisterArgument, Result, Return, ReturnValue, Tcs, USERCALL_USER_DEFINED, Usercall,
28 Usercalls as UsercallNrs, WAIT_INDEFINITE, WAIT_NO, accept_stream, alloc, async_queues,
29 bind_stream, close, connect_stream, do_usercall, exit, flush, free, insecure_time,
30 launch_thread, read, read_alloc, send, wait, write,
3131 };
3232 }
3333}
library/std/src/os/unix/net/ancillary.rs+1-1
......@@ -1,6 +1,6 @@
11// FIXME: This is currently disabled on *BSD.
22
3use super::{sockaddr_un, SocketAddr};
3use super::{SocketAddr, sockaddr_un};
44use crate::io::{self, IoSlice, IoSliceMut};
55use crate::marker::PhantomData;
66use crate::mem::zeroed;
library/std/src/os/unix/net/datagram.rs+2-2
......@@ -12,9 +12,9 @@
1212))]
1313use libc::MSG_NOSIGNAL;
1414
15use super::{SocketAddr, sockaddr_un};
1516#[cfg(any(doc, target_os = "android", target_os = "linux"))]
16use super::{recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to, SocketAncillary};
17use super::{sockaddr_un, SocketAddr};
17use super::{SocketAncillary, recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to};
1818#[cfg(any(doc, target_os = "android", target_os = "linux"))]
1919use crate::io::{IoSlice, IoSliceMut};
2020use crate::net::Shutdown;
library/std/src/os/unix/net/listener.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{sockaddr_un, SocketAddr, UnixStream};
1use super::{SocketAddr, UnixStream, sockaddr_un};
22use crate::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
33use crate::path::Path;
44use crate::sys::cvt;
library/std/src/os/unix/net/stream.rs+4-4
......@@ -1,3 +1,6 @@
1use super::{SocketAddr, sockaddr_un};
2#[cfg(any(doc, target_os = "android", target_os = "linux"))]
3use super::{SocketAncillary, recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to};
14#[cfg(any(
25 target_os = "android",
36 target_os = "linux",
......@@ -8,10 +11,7 @@
811 target_os = "nto",
912 target_vendor = "apple",
1013))]
11use super::{peer_cred, UCred};
12#[cfg(any(doc, target_os = "android", target_os = "linux"))]
13use super::{recv_vectored_with_ancillary_from, send_vectored_with_ancillary_to, SocketAncillary};
14use super::{sockaddr_un, SocketAddr};
14use super::{UCred, peer_cred};
1515use crate::fmt;
1616use crate::io::{self, IoSlice, IoSliceMut};
1717use crate::net::Shutdown;
library/std/src/os/unix/net/ucred.rs+2-2
......@@ -38,7 +38,7 @@ pub(super) use self::impl_linux::peer_cred;
3838
3939#[cfg(any(target_os = "linux", target_os = "android"))]
4040mod impl_linux {
41 use libc::{c_void, getsockopt, socklen_t, ucred, SOL_SOCKET, SO_PEERCRED};
41 use libc::{SO_PEERCRED, SOL_SOCKET, c_void, getsockopt, socklen_t, ucred};
4242
4343 use super::UCred;
4444 use crate::os::unix::io::AsRawFd;
......@@ -98,7 +98,7 @@ mod impl_bsd {
9898
9999#[cfg(target_vendor = "apple")]
100100mod impl_apple {
101 use libc::{c_void, getpeereid, getsockopt, pid_t, socklen_t, LOCAL_PEERPID, SOL_LOCAL};
101 use libc::{LOCAL_PEERPID, SOL_LOCAL, c_void, getpeereid, getsockopt, pid_t, socklen_t};
102102
103103 use super::UCred;
104104 use crate::os::unix::io::AsRawFd;
library/std/src/os/xous/ffi/definitions.rs+30-36
......@@ -126,42 +126,36 @@ impl From<i32> for Error {
126126#[stable(feature = "rust1", since = "1.0.0")]
127127impl core::fmt::Display for Error {
128128 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
129 write!(
130 f,
131 "{}",
132 match self {
133 Error::NoError => "no error occurred",
134 Error::BadAlignment => "memory was not properly aligned",
135 Error::BadAddress => "an invalid address was supplied",
136 Error::OutOfMemory => "the process or service has run out of memory",
137 Error::MemoryInUse => "the requested address is in use",
138 Error::InterruptNotFound =>
139 "the requested interrupt does not exist on this platform",
140 Error::InterruptInUse => "the requested interrupt is currently in use",
141 Error::InvalidString => "the specified string was not formatted correctly",
142 Error::ServerExists => "a server with that address already exists",
143 Error::ServerNotFound => "the requetsed server could not be found",
144 Error::ProcessNotFound => "the target process does not exist",
145 Error::ProcessNotChild =>
146 "the requested operation can only be done on child processes",
147 Error::ProcessTerminated => "the target process has crashed",
148 Error::Timeout => "the requested operation timed out",
149 Error::InternalError => "an internal error occurred",
150 Error::ServerQueueFull => "the server has too many pending messages",
151 Error::ThreadNotAvailable => "the specified thread does not exist",
152 Error::UnhandledSyscall => "the kernel did not recognize that syscall",
153 Error::InvalidSyscall => "the syscall had incorrect parameters",
154 Error::ShareViolation => "an attempt was made to share memory twice",
155 Error::InvalidThread => "tried to resume a thread that was not ready",
156 Error::InvalidPid => "kernel attempted to use a pid that was not valid",
157 Error::AccessDenied => "no permission to perform the requested operation",
158 Error::UseBeforeInit => "attempt to use a service before initialization finished",
159 Error::DoubleFree => "the requested resource was freed twice",
160 Error::DebugInProgress => "kernel attempted to activate a thread being debugged",
161 Error::InvalidLimit => "process attempted to adjust an invalid limit",
162 Error::UnknownError => "an unknown error occurred",
163 }
164 )
129 write!(f, "{}", match self {
130 Error::NoError => "no error occurred",
131 Error::BadAlignment => "memory was not properly aligned",
132 Error::BadAddress => "an invalid address was supplied",
133 Error::OutOfMemory => "the process or service has run out of memory",
134 Error::MemoryInUse => "the requested address is in use",
135 Error::InterruptNotFound => "the requested interrupt does not exist on this platform",
136 Error::InterruptInUse => "the requested interrupt is currently in use",
137 Error::InvalidString => "the specified string was not formatted correctly",
138 Error::ServerExists => "a server with that address already exists",
139 Error::ServerNotFound => "the requetsed server could not be found",
140 Error::ProcessNotFound => "the target process does not exist",
141 Error::ProcessNotChild => "the requested operation can only be done on child processes",
142 Error::ProcessTerminated => "the target process has crashed",
143 Error::Timeout => "the requested operation timed out",
144 Error::InternalError => "an internal error occurred",
145 Error::ServerQueueFull => "the server has too many pending messages",
146 Error::ThreadNotAvailable => "the specified thread does not exist",
147 Error::UnhandledSyscall => "the kernel did not recognize that syscall",
148 Error::InvalidSyscall => "the syscall had incorrect parameters",
149 Error::ShareViolation => "an attempt was made to share memory twice",
150 Error::InvalidThread => "tried to resume a thread that was not ready",
151 Error::InvalidPid => "kernel attempted to use a pid that was not valid",
152 Error::AccessDenied => "no permission to perform the requested operation",
153 Error::UseBeforeInit => "attempt to use a service before initialization finished",
154 Error::DoubleFree => "the requested resource was freed twice",
155 Error::DebugInProgress => "kernel attempted to activate a thread being debugged",
156 Error::InvalidLimit => "process attempted to adjust an invalid limit",
157 Error::UnknownError => "an unknown error occurred",
158 })
165159 }
166160}
167161
library/std/src/os/xous/services.rs+1-1
......@@ -19,7 +19,7 @@ pub(crate) use ticktimer::*;
1919
2020mod ns {
2121 const NAME_MAX_LENGTH: usize = 64;
22 use crate::os::xous::ffi::{lend_mut, Connection};
22 use crate::os::xous::ffi::{Connection, lend_mut};
2323 // By making this repr(C), the layout of this struct becomes well-defined
2424 // and no longer shifts around.
2525 // By marking it as `align(4096)` we define that it will be page-aligned,
library/std/src/os/xous/services/systime.rs+1-1
......@@ -1,6 +1,6 @@
11use core::sync::atomic::{AtomicU32, Ordering};
22
3use crate::os::xous::ffi::{connect, Connection};
3use crate::os::xous::ffi::{Connection, connect};
44
55pub(crate) enum SystimeScalar {
66 GetUtcTimeMs,
library/std/src/panic.rs+2-2
......@@ -231,11 +231,11 @@ pub macro panic_2015 {
231231 }),
232232}
233233
234#[stable(feature = "panic_hooks", since = "1.10.0")]
235pub use core::panic::Location;
234236#[doc(hidden)]
235237#[unstable(feature = "edition_panic", issue = "none", reason = "use panic!() instead")]
236238pub use core::panic::panic_2021;
237#[stable(feature = "panic_hooks", since = "1.10.0")]
238pub use core::panic::Location;
239239#[stable(feature = "catch_unwind", since = "1.9.0")]
240240pub use core::panic::{AssertUnwindSafe, RefUnwindSafe, UnwindSafe};
241241
library/std/src/path.rs+2-2
......@@ -75,14 +75,14 @@ use core::clone::CloneToUninit;
7575use crate::borrow::{Borrow, Cow};
7676use crate::collections::TryReserveError;
7777use crate::error::Error;
78use crate::ffi::{os_str, OsStr, OsString};
78use crate::ffi::{OsStr, OsString, os_str};
7979use crate::hash::{Hash, Hasher};
8080use crate::iter::FusedIterator;
8181use crate::ops::{self, Deref};
8282use crate::rc::Rc;
8383use crate::str::FromStr;
8484use crate::sync::Arc;
85use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR};
85use crate::sys::path::{MAIN_SEP_STR, is_sep_byte, is_verbatim_sep, parse_prefix};
8686use crate::{cmp, fmt, fs, io, sys};
8787
8888////////////////////////////////////////////////////////////////////////////////
library/std/src/pipe.rs+1-1
......@@ -12,7 +12,7 @@
1212//! ```
1313
1414use crate::io;
15use crate::sys::anonymous_pipe::{pipe as pipe_inner, AnonPipe};
15use crate::sys::anonymous_pipe::{AnonPipe, pipe as pipe_inner};
1616
1717/// Create anonymous pipe that is close-on-exec and blocking.
1818#[unstable(feature = "anonymous_pipe", issue = "127154")]
library/std/src/process.rs+1-1
......@@ -157,7 +157,7 @@ use crate::io::prelude::*;
157157use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
158158use crate::num::NonZero;
159159use crate::path::Path;
160use crate::sys::pipe::{read2, AnonPipe};
160use crate::sys::pipe::{AnonPipe, read2};
161161use crate::sys::process as imp;
162162#[stable(feature = "command_access", since = "1.57.0")]
163163pub use crate::sys_common::process::CommandEnvs;
library/std/src/process/tests.rs+1-1
......@@ -437,7 +437,7 @@ fn test_proc_thread_attributes() {
437437 use crate::mem;
438438 use crate::os::windows::io::AsRawHandle;
439439 use crate::os::windows::process::CommandExt;
440 use crate::sys::c::{CloseHandle, BOOL, HANDLE};
440 use crate::sys::c::{BOOL, CloseHandle, HANDLE};
441441 use crate::sys::cvt;
442442
443443 #[repr(C)]
library/std/src/sync/barrier/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::sync::mpsc::{channel, TryRecvError};
1use crate::sync::mpsc::{TryRecvError, channel};
22use crate::sync::{Arc, Barrier};
33use crate::thread;
44
library/std/src/sync/condvar.rs+1-1
......@@ -2,7 +2,7 @@
22mod tests;
33
44use crate::fmt;
5use crate::sync::{mutex, poison, LockResult, MutexGuard, PoisonError};
5use crate::sync::{LockResult, MutexGuard, PoisonError, mutex, poison};
66use crate::sys::sync as sys;
77use crate::time::{Duration, Instant};
88
library/std/src/sync/mod.rs+3-3
......@@ -161,10 +161,10 @@
161161
162162#![stable(feature = "rust1", since = "1.0.0")]
163163
164#[stable(feature = "rust1", since = "1.0.0")]
165pub use core::sync::atomic;
166164#[unstable(feature = "exclusive_wrapper", issue = "98407")]
167165pub use core::sync::Exclusive;
166#[stable(feature = "rust1", since = "1.0.0")]
167pub use core::sync::atomic;
168168
169169#[stable(feature = "rust1", since = "1.0.0")]
170170pub use alloc_crate::sync::{Arc, Weak};
......@@ -181,7 +181,7 @@ pub use self::mutex::MappedMutexGuard;
181181pub use self::mutex::{Mutex, MutexGuard};
182182#[stable(feature = "rust1", since = "1.0.0")]
183183#[allow(deprecated)]
184pub use self::once::{Once, OnceState, ONCE_INIT};
184pub use self::once::{ONCE_INIT, Once, OnceState};
185185#[stable(feature = "once_cell", since = "1.70.0")]
186186pub use self::once_lock::OnceLock;
187187#[stable(feature = "rust1", since = "1.0.0")]
library/std/src/sync/mpmc/context.rs+1-1
......@@ -4,8 +4,8 @@ use super::select::Selected;
44use super::waker::current_thread_id;
55use crate::cell::Cell;
66use crate::ptr;
7use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
87use crate::sync::Arc;
8use crate::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
99use crate::thread::{self, Thread};
1010use crate::time::Instant;
1111
library/std/src/sync/mpmc/waker.rs+1-1
......@@ -3,8 +3,8 @@
33use super::context::Context;
44use super::select::{Operation, Selected};
55use crate::ptr;
6use crate::sync::atomic::{AtomicBool, Ordering};
76use crate::sync::Mutex;
7use crate::sync::atomic::{AtomicBool, Ordering};
88
99/// Represents a thread blocked on a specific channel operation.
1010pub(crate) struct Entry {
library/std/src/sync/mpmc/zero.rs+1-1
......@@ -9,8 +9,8 @@ use super::utils::Backoff;
99use super::waker::Waker;
1010use crate::cell::UnsafeCell;
1111use crate::marker::PhantomData;
12use crate::sync::atomic::{AtomicBool, Ordering};
1312use crate::sync::Mutex;
13use crate::sync::atomic::{AtomicBool, Ordering};
1414use crate::time::Instant;
1515use crate::{fmt, ptr};
1616
library/std/src/sync/mutex.rs+1-1
......@@ -7,7 +7,7 @@ use crate::marker::PhantomData;
77use crate::mem::ManuallyDrop;
88use crate::ops::{Deref, DerefMut};
99use crate::ptr::NonNull;
10use crate::sync::{poison, LockResult, TryLockError, TryLockResult};
10use crate::sync::{LockResult, TryLockError, TryLockResult, poison};
1111use crate::sys::sync as sys;
1212
1313/// A mutual exclusion primitive useful for protecting shared data
library/std/src/sync/once_lock/tests.rs+1-1
......@@ -1,7 +1,7 @@
1use crate::sync::OnceLock;
12use crate::sync::atomic::AtomicUsize;
23use crate::sync::atomic::Ordering::SeqCst;
34use crate::sync::mpsc::channel;
4use crate::sync::OnceLock;
55use crate::{panic, thread};
66
77fn spawn_and_wait<R: Send + 'static>(f: impl FnOnce() -> R + Send + 'static) -> R {
library/std/src/sync/reentrant_lock.rs+1-1
......@@ -8,7 +8,7 @@ use crate::fmt;
88use crate::ops::Deref;
99use crate::panic::{RefUnwindSafe, UnwindSafe};
1010use crate::sys::sync as sys;
11use crate::thread::{current_id, ThreadId};
11use crate::thread::{ThreadId, current_id};
1212
1313/// A re-entrant mutual exclusion lock
1414///
library/std/src/sync/rwlock.rs+1-1
......@@ -7,7 +7,7 @@ use crate::marker::PhantomData;
77use crate::mem::ManuallyDrop;
88use crate::ops::{Deref, DerefMut};
99use crate::ptr::NonNull;
10use crate::sync::{poison, LockResult, TryLockError, TryLockResult};
10use crate::sync::{LockResult, TryLockError, TryLockResult, poison};
1111use crate::sys::sync as sys;
1212
1313/// A reader-writer lock
library/std/src/sys/alloc/solid.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{realloc_fallback, MIN_ALIGN};
1use super::{MIN_ALIGN, realloc_fallback};
22use crate::alloc::{GlobalAlloc, Layout, System};
33
44#[stable(feature = "alloc_system_type", since = "1.28.0")]
library/std/src/sys/alloc/unix.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{realloc_fallback, MIN_ALIGN};
1use super::{MIN_ALIGN, realloc_fallback};
22use crate::alloc::{GlobalAlloc, Layout, System};
33use crate::ptr;
44
library/std/src/sys/alloc/windows.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{realloc_fallback, MIN_ALIGN};
1use super::{MIN_ALIGN, realloc_fallback};
22use crate::alloc::{GlobalAlloc, Layout, System};
33use crate::ffi::c_void;
44use crate::mem::MaybeUninit;
library/std/src/sys/dbg.rs+1-1
......@@ -34,7 +34,7 @@ mod os {
3434
3535#[cfg(any(target_vendor = "apple", target_os = "freebsd"))]
3636mod os {
37 use libc::{c_int, sysctl, CTL_KERN, KERN_PROC, KERN_PROC_PID};
37 use libc::{CTL_KERN, KERN_PROC, KERN_PROC_PID, c_int, sysctl};
3838
3939 use super::DebuggerPresence;
4040 use crate::io::{Cursor, Read, Seek, SeekFrom};
library/std/src/sys/os_str/wtf8.rs+1-1
......@@ -7,7 +7,7 @@ use crate::borrow::Cow;
77use crate::collections::TryReserveError;
88use crate::rc::Rc;
99use crate::sync::Arc;
10use crate::sys_common::wtf8::{check_utf8_boundary, Wtf8, Wtf8Buf};
10use crate::sys_common::wtf8::{Wtf8, Wtf8Buf, check_utf8_boundary};
1111use crate::sys_common::{AsInner, FromInner, IntoInner};
1212use crate::{fmt, mem};
1313
library/std/src/sys/pal/hermit/args.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::ffi::{c_char, CStr, OsString};
1use crate::ffi::{CStr, OsString, c_char};
22use crate::os::hermit::ffi::OsStringExt;
33use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
44use crate::sync::atomic::{AtomicIsize, AtomicPtr};
library/std/src/sys/pal/hermit/fs.rs+2-2
......@@ -1,7 +1,7 @@
11use super::fd::FileDesc;
22use super::hermit_abi::{
3 self, dirent64, stat as stat_struct, DT_DIR, DT_LNK, DT_REG, DT_UNKNOWN, O_APPEND, O_CREAT,
4 O_DIRECTORY, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, S_IFDIR, S_IFLNK, S_IFMT, S_IFREG,
3 self, DT_DIR, DT_LNK, DT_REG, DT_UNKNOWN, O_APPEND, O_CREAT, O_DIRECTORY, O_EXCL, O_RDONLY,
4 O_RDWR, O_TRUNC, O_WRONLY, S_IFDIR, S_IFLNK, S_IFMT, S_IFREG, dirent64, stat as stat_struct,
55};
66use crate::ffi::{CStr, OsStr, OsString};
77use crate::io::{self, BorrowedCursor, Error, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
library/std/src/sys/pal/hermit/time.rs+1-1
......@@ -2,7 +2,7 @@
22
33use core::hash::{Hash, Hasher};
44
5use super::hermit_abi::{self, timespec, CLOCK_MONOTONIC, CLOCK_REALTIME};
5use super::hermit_abi::{self, CLOCK_MONOTONIC, CLOCK_REALTIME, timespec};
66use crate::cmp::Ordering;
77use crate::ops::{Add, AddAssign, Sub, SubAssign};
88use crate::time::Duration;
library/std/src/sys/pal/itron/task.rs+1-1
......@@ -1,5 +1,5 @@
11use super::abi;
2use super::error::{fail, fail_aborting, ItronError};
2use super::error::{ItronError, fail, fail_aborting};
33use crate::mem::MaybeUninit;
44
55/// Gets the ID of the task in Running state. Panics on failure.
library/std/src/sys/pal/itron/thread.rs+1-1
......@@ -1,7 +1,7 @@
11//! Thread implementation backed by μITRON tasks. Assumes `acre_tsk` and
22//! `exd_tsk` are available.
33
4use super::error::{expect_success, expect_success_aborting, ItronError};
4use super::error::{ItronError, expect_success, expect_success_aborting};
55use super::time::dur2reltims;
66use super::{abi, task};
77use crate::cell::UnsafeCell;
library/std/src/sys/pal/itron/time/tests.rs+14-16
......@@ -8,26 +8,24 @@ fn reltim2dur(t: u64) -> Duration {
88fn test_dur2reltims() {
99 assert_eq!(dur2reltims(reltim2dur(0)).collect::<Vec<_>>(), vec![]);
1010 assert_eq!(dur2reltims(reltim2dur(42)).collect::<Vec<_>>(), vec![42]);
11 assert_eq!(
12 dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(),
13 vec![abi::TMAX_RELTIM]
14 );
15 assert_eq!(
16 dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(),
17 vec![abi::TMAX_RELTIM, 10000]
18 );
11 assert_eq!(dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(), vec![
12 abi::TMAX_RELTIM
13 ]);
14 assert_eq!(dur2reltims(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(), vec![
15 abi::TMAX_RELTIM,
16 10000
17 ]);
1918}
2019
2120#[test]
2221fn test_dur2tmos() {
2322 assert_eq!(dur2tmos(reltim2dur(0)).collect::<Vec<_>>(), vec![0]);
2423 assert_eq!(dur2tmos(reltim2dur(42)).collect::<Vec<_>>(), vec![42]);
25 assert_eq!(
26 dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(),
27 vec![abi::TMAX_RELTIM]
28 );
29 assert_eq!(
30 dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(),
31 vec![abi::TMAX_RELTIM, 10000]
32 );
24 assert_eq!(dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64)).collect::<Vec<_>>(), vec![
25 abi::TMAX_RELTIM
26 ]);
27 assert_eq!(dur2tmos(reltim2dur(abi::TMAX_RELTIM as u64 + 10000)).collect::<Vec<_>>(), vec![
28 abi::TMAX_RELTIM,
29 10000
30 ]);
3331}
library/std/src/sys/pal/sgx/abi/usercalls/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use super::alloc::{copy_from_userspace, copy_to_userspace, User};
1use super::alloc::{User, copy_from_userspace, copy_to_userspace};
22
33#[test]
44fn test_copy_to_userspace_function() {
library/std/src/sys/pal/sgx/net.rs+1-1
......@@ -3,7 +3,7 @@ use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
33use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr, ToSocketAddrs};
44use crate::sync::Arc;
55use crate::sys::fd::FileDesc;
6use crate::sys::{sgx_ineffective, unsupported, AsInner, FromInner, IntoInner, TryIntoInner};
6use crate::sys::{AsInner, FromInner, IntoInner, TryIntoInner, sgx_ineffective, unsupported};
77use crate::time::Duration;
88use crate::{error, fmt};
99
library/std/src/sys/pal/sgx/waitqueue/mod.rs+2-2
......@@ -16,9 +16,9 @@ mod tests;
1616mod spin_mutex;
1717mod unsafe_list;
1818
19use fortanix_sgx_abi::{Tcs, EV_UNPARK, WAIT_INDEFINITE};
19use fortanix_sgx_abi::{EV_UNPARK, Tcs, WAIT_INDEFINITE};
2020
21pub use self::spin_mutex::{try_lock_or_false, SpinMutex, SpinMutexGuard};
21pub use self::spin_mutex::{SpinMutex, SpinMutexGuard, try_lock_or_false};
2222use self::unsafe_list::{UnsafeList, UnsafeListEntry};
2323use super::abi::{thread, usercalls};
2424use crate::num::NonZero;
library/std/src/sys/pal/solid/abi/fs.rs+2-2
......@@ -1,8 +1,8 @@
11//! `solid_fs.h`
22
33pub use libc::{
4 ino_t, off_t, stat, time_t, O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY,
5 SEEK_CUR, SEEK_END, SEEK_SET, S_IFBLK, S_IFCHR, S_IFDIR, S_IFIFO, S_IFMT, S_IFREG, S_IWRITE,
4 O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY, S_IFBLK, S_IFCHR, S_IFDIR,
5 S_IFIFO, S_IFMT, S_IFREG, S_IWRITE, SEEK_CUR, SEEK_END, SEEK_SET, ino_t, off_t, stat, time_t,
66};
77
88use crate::os::raw::{c_char, c_int, c_uchar};
library/std/src/sys/pal/solid/abi/mod.rs+1-1
......@@ -4,7 +4,7 @@ mod fs;
44pub mod sockets;
55pub use self::fs::*;
66// `solid_types.h`
7pub use super::itron::abi::{ER, ER_ID, E_TMOUT, ID};
7pub use super::itron::abi::{E_TMOUT, ER, ER_ID, ID};
88
99pub const SOLID_ERR_NOTFOUND: ER = -1000;
1010pub const SOLID_ERR_NOTSUPPORTED: ER = -1001;
library/std/src/sys/pal/solid/error.rs+1-1
......@@ -1,4 +1,4 @@
1pub use self::itron::error::{expect_success, ItronError as SolidError};
1pub use self::itron::error::{ItronError as SolidError, expect_success};
22use super::{abi, itron, net};
33use crate::io::ErrorKind;
44
library/std/src/sys/pal/solid/net.rs+1-1
......@@ -1,6 +1,6 @@
11use libc::{c_int, c_void, size_t};
22
3use self::netc::{sockaddr, socklen_t, MSG_PEEK};
3use self::netc::{MSG_PEEK, sockaddr, socklen_t};
44use super::abi;
55use crate::ffi::CStr;
66use crate::io::{self, BorrowedBuf, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut};
library/std/src/sys/pal/uefi/helpers.rs+1-1
......@@ -14,7 +14,7 @@ use r_efi::protocols::{device_path, device_path_to_text};
1414
1515use crate::ffi::{OsStr, OsString};
1616use crate::io::{self, const_io_error};
17use crate::mem::{size_of, MaybeUninit};
17use crate::mem::{MaybeUninit, size_of};
1818use crate::os::uefi::env::boot_services;
1919use crate::os::uefi::ffi::{OsStrExt, OsStringExt};
2020use crate::os::uefi::{self};
library/std/src/sys/pal/uefi/os.rs+2-2
......@@ -1,7 +1,7 @@
1use r_efi::efi::protocols::{device_path, loaded_image_device_path};
21use r_efi::efi::Status;
2use r_efi::efi::protocols::{device_path, loaded_image_device_path};
33
4use super::{helpers, unsupported, RawOsError};
4use super::{RawOsError, helpers, unsupported};
55use crate::error::Error as StdError;
66use crate::ffi::{OsStr, OsString};
77use crate::marker::PhantomData;
library/std/src/sys/pal/unix/fd.rs+8-8
......@@ -3,14 +3,6 @@
33#[cfg(test)]
44mod tests;
55
6#[cfg(any(
7 target_os = "android",
8 target_os = "linux",
9 target_os = "emscripten",
10 target_os = "l4re",
11 target_os = "hurd",
12))]
13use libc::off64_t;
146#[cfg(not(any(
157 target_os = "linux",
168 target_os = "emscripten",
......@@ -19,6 +11,14 @@ use libc::off64_t;
1911 target_os = "hurd",
2012)))]
2113use libc::off_t as off64_t;
14#[cfg(any(
15 target_os = "android",
16 target_os = "linux",
17 target_os = "emscripten",
18 target_os = "l4re",
19 target_os = "hurd",
20))]
21use libc::off64_t;
2222
2323use crate::cmp;
2424use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, Read};
library/std/src/sys/pal/unix/fs.rs+6-6
......@@ -31,10 +31,6 @@ use libc::fstatat64;
3131 all(target_os = "linux", target_env = "musl"),
3232))]
3333use libc::readdir as readdir64;
34#[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))]
35use libc::readdir64;
36#[cfg(any(target_os = "emscripten", target_os = "l4re"))]
37use libc::readdir64_r;
3834#[cfg(not(any(
3935 target_os = "android",
4036 target_os = "linux",
......@@ -50,6 +46,10 @@ use libc::readdir64_r;
5046 target_os = "hurd",
5147)))]
5248use libc::readdir_r as readdir64_r;
49#[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "hurd"))]
50use libc::readdir64;
51#[cfg(any(target_os = "emscripten", target_os = "l4re"))]
52use libc::readdir64_r;
5353use libc::{c_int, mode_t};
5454#[cfg(target_os = "android")]
5555use libc::{
......@@ -1866,7 +1866,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
18661866 let max_len = u64::MAX;
18671867 let (mut writer, _) = open_to_and_set_permissions(to, reader_metadata)?;
18681868
1869 use super::kernel_copy::{copy_regular_files, CopyResult};
1869 use super::kernel_copy::{CopyResult, copy_regular_files};
18701870
18711871 match copy_regular_files(reader.as_raw_fd(), writer.as_raw_fd(), max_len) {
18721872 CopyResult::Ended(bytes) => Ok(bytes),
......@@ -2008,7 +2008,7 @@ mod remove_dir_impl {
20082008 #[cfg(all(target_os = "linux", target_env = "gnu"))]
20092009 use libc::{fdopendir, openat64 as openat, unlinkat};
20102010
2011 use super::{lstat, Dir, DirEntry, InnerReadDir, ReadDir};
2011 use super::{Dir, DirEntry, InnerReadDir, ReadDir, lstat};
20122012 use crate::ffi::CStr;
20132013 use crate::io;
20142014 use crate::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd};
library/std/src/sys/pal/unix/net.rs+1-1
......@@ -1,4 +1,4 @@
1use libc::{c_int, c_void, size_t, sockaddr, socklen_t, MSG_PEEK};
1use libc::{MSG_PEEK, c_int, c_void, size_t, sockaddr, socklen_t};
22
33use crate::ffi::CStr;
44use crate::io::{self, BorrowedBuf, BorrowedCursor, IoSlice, IoSliceMut};
library/std/src/sys/pal/unix/process/process_common.rs+1-1
......@@ -1,7 +1,7 @@
11#[cfg(all(test, not(target_os = "emscripten")))]
22mod tests;
33
4use libc::{c_char, c_int, gid_t, pid_t, uid_t, EXIT_FAILURE, EXIT_SUCCESS};
4use libc::{EXIT_FAILURE, EXIT_SUCCESS, c_char, c_int, gid_t, pid_t, uid_t};
55
66use crate::collections::BTreeMap;
77use crate::ffi::{CStr, CString, OsStr, OsString};
library/std/src/sys/pal/unix/process/process_fuchsia.rs+1-1
......@@ -2,7 +2,7 @@ use libc::{c_int, size_t};
22
33use crate::num::NonZero;
44use crate::sys::process::process_common::*;
5use crate::sys::process::zircon::{zx_handle_t, Handle};
5use crate::sys::process::zircon::{Handle, zx_handle_t};
66use crate::{fmt, io, mem, ptr};
77
88////////////////////////////////////////////////////////////////////////////////
library/std/src/sys/pal/unix/process/process_unix.rs+1-1
......@@ -1190,8 +1190,8 @@ impl ExitStatusError {
11901190mod linux_child_ext {
11911191
11921192 use crate::os::linux::process as os;
1193 use crate::sys::pal::unix::linux::pidfd as imp;
11941193 use crate::sys::pal::unix::ErrorKind;
1194 use crate::sys::pal::unix::linux::pidfd as imp;
11951195 use crate::sys_common::FromInner;
11961196 use crate::{io, mem};
11971197
library/std/src/sys/pal/unix/process/process_vxworks.rs+1-1
......@@ -1,5 +1,5 @@
11#![forbid(unsafe_op_in_unsafe_fn)]
2use libc::{self, c_char, c_int, RTP_ID};
2use libc::{self, RTP_ID, c_char, c_int};
33
44use crate::io::{self, ErrorKind};
55use crate::num::NonZero;
library/std/src/sys/pal/unix/stack_overflow.rs+5-6
......@@ -36,21 +36,20 @@ impl Drop for Handler {
3636 target_os = "illumos",
3737))]
3838mod imp {
39 use libc::{
40 MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_PRIVATE, PROT_NONE, PROT_READ, PROT_WRITE, SA_ONSTACK,
41 SA_SIGINFO, SIG_DFL, SIGBUS, SIGSEGV, SS_DISABLE, sigaction, sigaltstack, sighandler_t,
42 };
3943 #[cfg(not(all(target_os = "linux", target_env = "gnu")))]
4044 use libc::{mmap as mmap64, mprotect, munmap};
4145 #[cfg(all(target_os = "linux", target_env = "gnu"))]
4246 use libc::{mmap64, mprotect, munmap};
43 use libc::{
44 sigaction, sigaltstack, sighandler_t, MAP_ANON, MAP_FAILED, MAP_FIXED, MAP_PRIVATE,
45 PROT_NONE, PROT_READ, PROT_WRITE, SA_ONSTACK, SA_SIGINFO, SIGBUS, SIGSEGV, SIG_DFL,
46 SS_DISABLE,
47 };
4847
4948 use super::Handler;
5049 use crate::cell::Cell;
5150 use crate::ops::Range;
52 use crate::sync::atomic::{AtomicBool, AtomicPtr, AtomicUsize, Ordering};
5351 use crate::sync::OnceLock;
52 use crate::sync::atomic::{AtomicBool, AtomicPtr, AtomicUsize, Ordering};
5453 use crate::sys::pal::unix::os;
5554 use crate::{io, mem, ptr, thread};
5655
library/std/src/sys/pal/unix/thread.rs+1-1
......@@ -516,7 +516,7 @@ mod cgroups {
516516
517517 use crate::borrow::Cow;
518518 use crate::ffi::OsString;
519 use crate::fs::{exists, File};
519 use crate::fs::{File, exists};
520520 use crate::io::{BufRead, BufReader, Read};
521521 use crate::os::unix::ffi::OsStringExt;
522522 use crate::path::{Path, PathBuf};
library/std/src/sys/pal/unix/thread_parking.rs+1-1
......@@ -2,7 +2,7 @@
22// separate modules for each platform.
33#![cfg(target_os = "netbsd")]
44
5use libc::{_lwp_self, c_long, clockid_t, lwpid_t, time_t, timespec, CLOCK_MONOTONIC};
5use libc::{_lwp_self, CLOCK_MONOTONIC, c_long, clockid_t, lwpid_t, time_t, timespec};
66
77use crate::ffi::{c_int, c_void};
88use crate::ptr;
library/std/src/sys/pal/wasi/fs.rs+1-1
......@@ -13,7 +13,7 @@ use crate::sys::common::small_c_string::run_path_with_cstr;
1313use crate::sys::time::SystemTime;
1414use crate::sys::unsupported;
1515pub use crate::sys_common::fs::exists;
16use crate::sys_common::{ignore_notfound, AsInner, FromInner, IntoInner};
16use crate::sys_common::{AsInner, FromInner, IntoInner, ignore_notfound};
1717use crate::{fmt, iter, ptr};
1818
1919pub struct File {
library/std/src/sys/pal/windows/args.rs+1-1
......@@ -14,8 +14,8 @@ use crate::path::{Path, PathBuf};
1414use crate::sys::path::get_long_path;
1515use crate::sys::process::ensure_no_nuls;
1616use crate::sys::{c, to_u16s};
17use crate::sys_common::wstr::WStrUnits;
1817use crate::sys_common::AsInner;
18use crate::sys_common::wstr::WStrUnits;
1919use crate::{fmt, io, iter, vec};
2020
2121/// This is the const equivalent to `NonZero::new(n).unwrap()`
library/std/src/sys/pal/windows/args/tests.rs+4-4
......@@ -47,10 +47,10 @@ fn whitespace_behavior() {
4747fn genius_quotes() {
4848 chk(r#"EXE "" """#, &["EXE", "", ""]);
4949 chk(r#"EXE "" """"#, &["EXE", "", r#"""#]);
50 chk(
51 r#"EXE "this is """all""" in the same argument""#,
52 &["EXE", r#"this is "all" in the same argument"#],
53 );
50 chk(r#"EXE "this is """all""" in the same argument""#, &[
51 "EXE",
52 r#"this is "all" in the same argument"#,
53 ]);
5454 chk(r#"EXE "a"""#, &["EXE", r#"a""#]);
5555 chk(r#"EXE "a"" a"#, &["EXE", r#"a" a"#]);
5656 // quotes cannot be escaped in command names
library/std/src/sys/pal/windows/c.rs+1-1
......@@ -5,7 +5,7 @@
55#![unstable(issue = "none", feature = "windows_c")]
66#![allow(clippy::style)]
77
8use core::ffi::{c_uint, c_ulong, c_ushort, c_void, CStr};
8use core::ffi::{CStr, c_uint, c_ulong, c_ushort, c_void};
99use core::{mem, ptr};
1010
1111mod windows_sys;
library/std/src/sys/pal/windows/compat.rs+1-1
......@@ -19,7 +19,7 @@
1919//! function is called. In the worst case, multiple threads may all end up
2020//! importing the same function unnecessarily.
2121
22use crate::ffi::{c_void, CStr};
22use crate::ffi::{CStr, c_void};
2323use crate::ptr::NonNull;
2424use crate::sys::c;
2525
library/std/src/sys/pal/windows/fs.rs+3-3
......@@ -1,9 +1,9 @@
11use core::ptr::addr_of;
22
33use super::api::{self, WinError};
4use super::{to_u16s, IoResult};
4use super::{IoResult, to_u16s};
55use crate::borrow::Cow;
6use crate::ffi::{c_void, OsStr, OsString};
6use crate::ffi::{OsStr, OsString, c_void};
77use crate::io::{self, BorrowedCursor, Error, IoSlice, IoSliceMut, SeekFrom};
88use crate::mem::{self, MaybeUninit};
99use crate::os::windows::io::{AsHandle, BorrowedHandle};
......@@ -13,7 +13,7 @@ use crate::sync::Arc;
1313use crate::sys::handle::Handle;
1414use crate::sys::path::maybe_verbatim;
1515use crate::sys::time::SystemTime;
16use crate::sys::{c, cvt, Align8};
16use crate::sys::{Align8, c, cvt};
1717use crate::sys_common::{AsInner, FromInner, IntoInner};
1818use crate::{fmt, ptr, slice};
1919
library/std/src/sys/pal/windows/futex.rs+2-2
......@@ -1,7 +1,7 @@
11use core::ffi::c_void;
22use core::sync::atomic::{
3 AtomicBool, AtomicI16, AtomicI32, AtomicI64, AtomicI8, AtomicIsize, AtomicPtr, AtomicU16,
4 AtomicU32, AtomicU64, AtomicU8, AtomicUsize,
3 AtomicBool, AtomicI8, AtomicI16, AtomicI32, AtomicI64, AtomicIsize, AtomicPtr, AtomicU8,
4 AtomicU16, AtomicU32, AtomicU64, AtomicUsize,
55};
66use core::time::Duration;
77use core::{mem, ptr};
library/std/src/sys/pal/windows/handle/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::sys::pipe::{anon_pipe, Pipes};
1use crate::sys::pipe::{Pipes, anon_pipe};
22use crate::{thread, time};
33
44/// Test the synchronous fallback for overlapped I/O.
library/std/src/sys/pal/windows/net.rs+7-7
......@@ -9,7 +9,7 @@ use crate::os::windows::io::{
99};
1010use crate::sync::OnceLock;
1111use crate::sys::c;
12use crate::sys_common::{net, AsInner, FromInner, IntoInner};
12use crate::sys_common::{AsInner, FromInner, IntoInner, net};
1313use crate::time::Duration;
1414use crate::{cmp, mem, ptr, sys};
1515
......@@ -27,12 +27,12 @@ pub mod netc {
2727 use crate::sys::c::{self, ADDRESS_FAMILY, ADDRINFOA, SOCKADDR, SOCKET};
2828 // re-exports from Windows API bindings.
2929 pub use crate::sys::c::{
30 bind, connect, freeaddrinfo, getpeername, getsockname, getsockopt, listen, setsockopt,
31 ADDRESS_FAMILY as sa_family_t, ADDRINFOA as addrinfo, IPPROTO_IP, IPPROTO_IPV6,
32 IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MULTICAST_LOOP, IPV6_V6ONLY,
33 IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_TTL,
34 SOCKADDR as sockaddr, SOCKADDR_STORAGE as sockaddr_storage, SOCK_DGRAM, SOCK_STREAM,
35 SOL_SOCKET, SO_BROADCAST, SO_RCVTIMEO, SO_SNDTIMEO,
30 ADDRESS_FAMILY as sa_family_t, ADDRINFOA as addrinfo, IP_ADD_MEMBERSHIP,
31 IP_DROP_MEMBERSHIP, IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_TTL, IPPROTO_IP, IPPROTO_IPV6,
32 IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MULTICAST_LOOP, IPV6_V6ONLY, SO_BROADCAST,
33 SO_RCVTIMEO, SO_SNDTIMEO, SOCK_DGRAM, SOCK_STREAM, SOCKADDR as sockaddr,
34 SOCKADDR_STORAGE as sockaddr_storage, SOL_SOCKET, bind, connect, freeaddrinfo, getpeername,
35 getsockname, getsockopt, listen, setsockopt,
3636 };
3737
3838 #[allow(non_camel_case_types)]
library/std/src/sys/pal/windows/process.rs+5-5
......@@ -22,8 +22,8 @@ use crate::sys::fs::{File, OpenOptions};
2222use crate::sys::handle::Handle;
2323use crate::sys::pipe::{self, AnonPipe};
2424use crate::sys::{cvt, path, stdio};
25use crate::sys_common::process::{CommandEnv, CommandEnvs};
2625use crate::sys_common::IntoInner;
26use crate::sys_common::process::{CommandEnv, CommandEnvs};
2727use crate::{cmp, env, fmt, mem, ptr};
2828
2929////////////////////////////////////////////////////////////////////////////////
......@@ -253,10 +253,10 @@ impl Command {
253253 attribute: usize,
254254 value: T,
255255 ) {
256 self.proc_thread_attributes.insert(
257 attribute,
258 ProcThreadAttributeValue { size: mem::size_of::<T>(), data: Box::new(value) },
259 );
256 self.proc_thread_attributes.insert(attribute, ProcThreadAttributeValue {
257 size: mem::size_of::<T>(),
258 data: Box::new(value),
259 });
260260 }
261261
262262 pub fn spawn(
library/std/src/sys/pal/windows/process/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{make_command_line, Arg};
1use super::{Arg, make_command_line};
22use crate::env;
33use crate::ffi::{OsStr, OsString};
44use crate::process::Command;
library/std/src/sys/pal/xous/net/dns.rs+1-1
......@@ -3,7 +3,7 @@ use core::convert::{TryFrom, TryInto};
33use crate::io;
44use crate::net::{Ipv4Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
55use crate::os::xous::ffi::lend_mut;
6use crate::os::xous::services::{dns_server, DnsLendMut};
6use crate::os::xous::services::{DnsLendMut, dns_server};
77
88pub struct DnsError {
99 pub code: u8,
library/std/src/sys/pal/xous/stdio.rs+2-2
......@@ -4,8 +4,8 @@ pub struct Stdin;
44pub struct Stdout {}
55pub struct Stderr;
66
7use crate::os::xous::ffi::{lend, try_lend, try_scalar, Connection};
8use crate::os::xous::services::{log_server, try_connect, LogLend, LogScalar};
7use crate::os::xous::ffi::{Connection, lend, try_lend, try_scalar};
8use crate::os::xous::services::{LogLend, LogScalar, log_server, try_connect};
99
1010impl Stdin {
1111 pub const fn new() -> Stdin {
library/std/src/sys/pal/xous/thread.rs+3-3
......@@ -4,10 +4,10 @@ use crate::ffi::CStr;
44use crate::io;
55use crate::num::NonZero;
66use crate::os::xous::ffi::{
7 blocking_scalar, create_thread, do_yield, join_thread, map_memory, update_memory_flags,
8 MemoryFlags, Syscall, ThreadId,
7 MemoryFlags, Syscall, ThreadId, blocking_scalar, create_thread, do_yield, join_thread,
8 map_memory, update_memory_flags,
99};
10use crate::os::xous::services::{ticktimer_server, TicktimerScalar};
10use crate::os::xous::services::{TicktimerScalar, ticktimer_server};
1111use crate::time::Duration;
1212
1313pub struct Thread {
library/std/src/sys/pal/zkvm/args.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{abi, WORD_SIZE};
1use super::{WORD_SIZE, abi};
22use crate::ffi::OsString;
33use crate::fmt;
44use crate::sys::os_str;
library/std/src/sys/pal/zkvm/os.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{abi, unsupported, WORD_SIZE};
1use super::{WORD_SIZE, abi, unsupported};
22use crate::error::Error as StdError;
33use crate::ffi::{OsStr, OsString};
44use crate::marker::PhantomData;
library/std/src/sys/path/windows.rs+1-1
......@@ -99,7 +99,7 @@ impl<'a> PrefixParserSlice<'a, '_> {
9999}
100100
101101pub fn parse_prefix(path: &OsStr) -> Option<Prefix<'_>> {
102 use Prefix::{DeviceNS, Disk, Verbatim, VerbatimDisk, VerbatimUNC, UNC};
102 use Prefix::{DeviceNS, Disk, UNC, Verbatim, VerbatimDisk, VerbatimUNC};
103103
104104 let parser = PrefixParser::<8>::new(path);
105105 let parser = parser.as_slice();
library/std/src/sys/sync/condvar/pthread.rs+1-1
......@@ -2,7 +2,7 @@ use crate::cell::UnsafeCell;
22use crate::ptr;
33use crate::sync::atomic::AtomicPtr;
44use crate::sync::atomic::Ordering::Relaxed;
5use crate::sys::sync::{mutex, Mutex};
5use crate::sys::sync::{Mutex, mutex};
66#[cfg(not(target_os = "nto"))]
77use crate::sys::time::TIMESPEC_MAX;
88#[cfg(target_os = "nto")]
library/std/src/sys/sync/condvar/windows7.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::cell::UnsafeCell;
2use crate::sys::sync::{mutex, Mutex};
2use crate::sys::sync::{Mutex, mutex};
33use crate::sys::{c, os};
44use crate::time::Duration;
55
library/std/src/sys/sync/condvar/xous.rs+1-1
......@@ -1,7 +1,7 @@
11use core::sync::atomic::{AtomicUsize, Ordering};
22
33use crate::os::xous::ffi::{blocking_scalar, scalar};
4use crate::os::xous::services::{ticktimer_server, TicktimerScalar};
4use crate::os::xous::services::{TicktimerScalar, ticktimer_server};
55use crate::sys::sync::Mutex;
66use crate::time::Duration;
77
library/std/src/sys/sync/mutex/fuchsia.rs+3-3
......@@ -40,9 +40,9 @@
4040use crate::sync::atomic::AtomicU32;
4141use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
4242use crate::sys::futex::zircon::{
43 zx_futex_wait, zx_futex_wake_single_owner, zx_handle_t, zx_thread_self, ZX_ERR_BAD_HANDLE,
44 ZX_ERR_BAD_STATE, ZX_ERR_INVALID_ARGS, ZX_ERR_TIMED_OUT, ZX_ERR_WRONG_TYPE, ZX_OK,
45 ZX_TIME_INFINITE,
43 ZX_ERR_BAD_HANDLE, ZX_ERR_BAD_STATE, ZX_ERR_INVALID_ARGS, ZX_ERR_TIMED_OUT, ZX_ERR_WRONG_TYPE,
44 ZX_OK, ZX_TIME_INFINITE, zx_futex_wait, zx_futex_wake_single_owner, zx_handle_t,
45 zx_thread_self,
4646};
4747
4848// The lowest two bits of a `zx_handle_t` are always set, so the lowest bit is used to mark the
library/std/src/sys/sync/mutex/itron.rs+1-1
......@@ -3,7 +3,7 @@
33#![forbid(unsafe_op_in_unsafe_fn)]
44
55use crate::sys::pal::itron::abi;
6use crate::sys::pal::itron::error::{expect_success, expect_success_aborting, fail, ItronError};
6use crate::sys::pal::itron::error::{ItronError, expect_success, expect_success_aborting, fail};
77use crate::sys::pal::itron::spin::SpinIdOnceCell;
88
99pub struct Mutex {
library/std/src/sys/sync/mutex/pthread.rs+1-1
......@@ -1,6 +1,6 @@
11use crate::cell::UnsafeCell;
22use crate::io::Error;
3use crate::mem::{forget, MaybeUninit};
3use crate::mem::{MaybeUninit, forget};
44use crate::sys::cvt_nz;
55use crate::sys_common::lazy_box::{LazyBox, LazyInit};
66
library/std/src/sys/sync/mutex/sgx.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::sys::pal::waitqueue::{try_lock_or_false, SpinMutex, WaitQueue, WaitVariable};
1use crate::sys::pal::waitqueue::{SpinMutex, WaitQueue, WaitVariable, try_lock_or_false};
22use crate::sys_common::lazy_box::{LazyBox, LazyInit};
33
44/// FIXME: `UnsafeList` is not movable.
library/std/src/sys/sync/mutex/xous.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::os::xous::ffi::{blocking_scalar, do_yield};
2use crate::os::xous::services::{ticktimer_server, TicktimerScalar};
2use crate::os::xous::services::{TicktimerScalar, ticktimer_server};
33use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
44use crate::sync::atomic::{AtomicBool, AtomicUsize};
55
library/std/src/sys/sync/rwlock/queue.rs+1-1
......@@ -110,7 +110,7 @@
110110use crate::cell::OnceCell;
111111use crate::hint::spin_loop;
112112use crate::mem;
113use crate::ptr::{self, null_mut, without_provenance_mut, NonNull};
113use crate::ptr::{self, NonNull, null_mut, without_provenance_mut};
114114use crate::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
115115use crate::sync::atomic::{AtomicBool, AtomicPtr};
116116use crate::thread::{self, Thread};
library/std/src/sys/sync/rwlock/solid.rs+1-1
......@@ -2,7 +2,7 @@
22#![forbid(unsafe_op_in_unsafe_fn)]
33
44use crate::sys::pal::abi;
5use crate::sys::pal::itron::error::{expect_success, expect_success_aborting, fail, ItronError};
5use crate::sys::pal::itron::error::{ItronError, expect_success, expect_success_aborting, fail};
66use crate::sys::pal::itron::spin::SpinIdOnceCell;
77
88pub struct RwLock {
library/std/src/sys/sync/thread_parking/id.rs+2-2
......@@ -10,8 +10,8 @@
1010use crate::cell::UnsafeCell;
1111use crate::pin::Pin;
1212use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
13use crate::sync::atomic::{fence, AtomicI8};
14use crate::sys::thread_parking::{current, park, park_timeout, unpark, ThreadId};
13use crate::sync::atomic::{AtomicI8, fence};
14use crate::sys::thread_parking::{ThreadId, current, park, park_timeout, unpark};
1515use crate::time::Duration;
1616
1717pub struct Parker {
library/std/src/sys/sync/thread_parking/windows7.rs+1-1
......@@ -190,7 +190,7 @@ mod keyed_events {
190190 use core::sync::atomic::Ordering::{Acquire, Relaxed};
191191 use core::time::Duration;
192192
193 use super::{Parker, EMPTY, NOTIFIED};
193 use super::{EMPTY, NOTIFIED, Parker};
194194 use crate::sys::c;
195195
196196 pub unsafe fn park(parker: Pin<&Parker>) {
library/std/src/sys/sync/thread_parking/xous.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::os::xous::ffi::{blocking_scalar, scalar};
2use crate::os::xous::services::{ticktimer_server, TicktimerScalar};
2use crate::os::xous::services::{TicktimerScalar, ticktimer_server};
33use crate::pin::Pin;
44use crate::ptr;
55use crate::sync::atomic::AtomicI8;
library/std/src/sys/thread_local/guard/key.rs+1-1
......@@ -4,7 +4,7 @@
44
55use crate::ptr;
66use crate::sys::thread_local::destructors;
7use crate::sys::thread_local::key::{set, LazyKey};
7use crate::sys::thread_local::key::{LazyKey, set};
88
99pub fn enable() {
1010 static DTORS: LazyKey = LazyKey::new(Some(run));
library/std/src/sys/thread_local/key/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use super::{get, set, LazyKey};
1use super::{LazyKey, get, set};
22use crate::ptr;
33
44#[test]
library/std/src/sys/thread_local/key/xous.rs+1-1
......@@ -39,7 +39,7 @@
3939use core::arch::asm;
4040
4141use crate::mem::ManuallyDrop;
42use crate::os::xous::ffi::{map_memory, unmap_memory, MemoryFlags};
42use crate::os::xous::ffi::{MemoryFlags, map_memory, unmap_memory};
4343use crate::ptr;
4444use crate::sync::atomic::Ordering::{Acquire, Relaxed, Release};
4545use crate::sync::atomic::{AtomicPtr, AtomicUsize};
library/std/src/sys/thread_local/os.rs+1-1
......@@ -2,7 +2,7 @@ use super::abort_on_dtor_unwind;
22use crate::cell::Cell;
33use crate::marker::PhantomData;
44use crate::ptr;
5use crate::sys::thread_local::key::{get, set, Key, LazyKey};
5use crate::sys::thread_local::key::{Key, LazyKey, get, set};
66
77#[doc(hidden)]
88#[allow_internal_unstable(thread_local_internals)]
library/std/src/sys_common/net.rs+1-1
......@@ -5,7 +5,7 @@ use crate::ffi::{c_int, c_void};
55use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut};
66use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
77use crate::sys::common::small_c_string::run_with_cstr;
8use crate::sys::net::{cvt, cvt_gai, cvt_r, init, netc as c, wrlen_t, Socket};
8use crate::sys::net::{Socket, cvt, cvt_gai, cvt_r, init, netc as c, wrlen_t};
99use crate::sys_common::{AsInner, FromInner, IntoInner};
1010use crate::time::Duration;
1111use crate::{cmp, fmt, mem, ptr};
library/std/src/sys_common/wtf8.rs+1-1
......@@ -18,7 +18,7 @@
1818#[cfg(test)]
1919mod tests;
2020
21use core::char::{encode_utf16_raw, encode_utf8_raw};
21use core::char::{encode_utf8_raw, encode_utf16_raw};
2222use core::clone::CloneToUninit;
2323use core::str::next_code_point;
2424
library/std/src/sys_common/wtf8/tests.rs+55-56
......@@ -356,32 +356,32 @@ fn wtf8buf_from_iterator() {
356356 fn f(values: &[u32]) -> Wtf8Buf {
357357 values.iter().map(|&c| CodePoint::from_u32(c).unwrap()).collect::<Wtf8Buf>()
358358 }
359 assert_eq!(
360 f(&[0x61, 0xE9, 0x20, 0x1F4A9]),
361 Wtf8Buf { bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(), is_known_utf8: true }
362 );
359 assert_eq!(f(&[0x61, 0xE9, 0x20, 0x1F4A9]), Wtf8Buf {
360 bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(),
361 is_known_utf8: true
362 });
363363
364364 assert_eq!(f(&[0xD83D, 0xDCA9]).bytes, b"\xF0\x9F\x92\xA9"); // Magic!
365 assert_eq!(
366 f(&[0xD83D, 0x20, 0xDCA9]),
367 Wtf8Buf { bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(), is_known_utf8: false }
368 );
369 assert_eq!(
370 f(&[0xD800, 0xDBFF]),
371 Wtf8Buf { bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(), is_known_utf8: false }
372 );
373 assert_eq!(
374 f(&[0xD800, 0xE000]),
375 Wtf8Buf { bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(), is_known_utf8: false }
376 );
377 assert_eq!(
378 f(&[0xD7FF, 0xDC00]),
379 Wtf8Buf { bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(), is_known_utf8: false }
380 );
381 assert_eq!(
382 f(&[0x61, 0xDC00]),
383 Wtf8Buf { bytes: b"\x61\xED\xB0\x80".to_vec(), is_known_utf8: false }
384 );
365 assert_eq!(f(&[0xD83D, 0x20, 0xDCA9]), Wtf8Buf {
366 bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(),
367 is_known_utf8: false
368 });
369 assert_eq!(f(&[0xD800, 0xDBFF]), Wtf8Buf {
370 bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(),
371 is_known_utf8: false
372 });
373 assert_eq!(f(&[0xD800, 0xE000]), Wtf8Buf {
374 bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(),
375 is_known_utf8: false
376 });
377 assert_eq!(f(&[0xD7FF, 0xDC00]), Wtf8Buf {
378 bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(),
379 is_known_utf8: false
380 });
381 assert_eq!(f(&[0x61, 0xDC00]), Wtf8Buf {
382 bytes: b"\x61\xED\xB0\x80".to_vec(),
383 is_known_utf8: false
384 });
385385 assert_eq!(f(&[0xDC00]), Wtf8Buf { bytes: b"\xED\xB0\x80".to_vec(), is_known_utf8: false });
386386}
387387
......@@ -396,36 +396,36 @@ fn wtf8buf_extend() {
396396 string
397397 }
398398
399 assert_eq!(
400 e(&[0x61, 0xE9], &[0x20, 0x1F4A9]),
401 Wtf8Buf { bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(), is_known_utf8: true }
402 );
399 assert_eq!(e(&[0x61, 0xE9], &[0x20, 0x1F4A9]), Wtf8Buf {
400 bytes: b"a\xC3\xA9 \xF0\x9F\x92\xA9".to_vec(),
401 is_known_utf8: true
402 });
403403
404404 assert_eq!(e(&[0xD83D], &[0xDCA9]).bytes, b"\xF0\x9F\x92\xA9"); // Magic!
405 assert_eq!(
406 e(&[0xD83D, 0x20], &[0xDCA9]),
407 Wtf8Buf { bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(), is_known_utf8: false }
408 );
409 assert_eq!(
410 e(&[0xD800], &[0xDBFF]),
411 Wtf8Buf { bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(), is_known_utf8: false }
412 );
413 assert_eq!(
414 e(&[0xD800], &[0xE000]),
415 Wtf8Buf { bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(), is_known_utf8: false }
416 );
417 assert_eq!(
418 e(&[0xD7FF], &[0xDC00]),
419 Wtf8Buf { bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(), is_known_utf8: false }
420 );
421 assert_eq!(
422 e(&[0x61], &[0xDC00]),
423 Wtf8Buf { bytes: b"\x61\xED\xB0\x80".to_vec(), is_known_utf8: false }
424 );
425 assert_eq!(
426 e(&[], &[0xDC00]),
427 Wtf8Buf { bytes: b"\xED\xB0\x80".to_vec(), is_known_utf8: false }
428 );
405 assert_eq!(e(&[0xD83D, 0x20], &[0xDCA9]), Wtf8Buf {
406 bytes: b"\xED\xA0\xBD \xED\xB2\xA9".to_vec(),
407 is_known_utf8: false
408 });
409 assert_eq!(e(&[0xD800], &[0xDBFF]), Wtf8Buf {
410 bytes: b"\xED\xA0\x80\xED\xAF\xBF".to_vec(),
411 is_known_utf8: false
412 });
413 assert_eq!(e(&[0xD800], &[0xE000]), Wtf8Buf {
414 bytes: b"\xED\xA0\x80\xEE\x80\x80".to_vec(),
415 is_known_utf8: false
416 });
417 assert_eq!(e(&[0xD7FF], &[0xDC00]), Wtf8Buf {
418 bytes: b"\xED\x9F\xBF\xED\xB0\x80".to_vec(),
419 is_known_utf8: false
420 });
421 assert_eq!(e(&[0x61], &[0xDC00]), Wtf8Buf {
422 bytes: b"\x61\xED\xB0\x80".to_vec(),
423 is_known_utf8: false
424 });
425 assert_eq!(e(&[], &[0xDC00]), Wtf8Buf {
426 bytes: b"\xED\xB0\x80".to_vec(),
427 is_known_utf8: false
428 });
429429}
430430
431431#[test]
......@@ -556,10 +556,9 @@ fn wtf8_encode_wide() {
556556 let mut string = Wtf8Buf::from_str("aé ");
557557 string.push(CodePoint::from_u32(0xD83D).unwrap());
558558 string.push_char('💩');
559 assert_eq!(
560 string.encode_wide().collect::<Vec<_>>(),
561 vec![0x61, 0xE9, 0x20, 0xD83D, 0xD83D, 0xDCA9]
562 );
559 assert_eq!(string.encode_wide().collect::<Vec<_>>(), vec![
560 0x61, 0xE9, 0x20, 0xD83D, 0xD83D, 0xDCA9
561 ]);
563562}
564563
565564#[test]
library/std/src/thread/mod.rs+3-3
......@@ -162,12 +162,12 @@ use crate::any::Any;
162162use crate::cell::{Cell, OnceCell, UnsafeCell};
163163use crate::ffi::CStr;
164164use crate::marker::PhantomData;
165use crate::mem::{self, forget, ManuallyDrop};
165use crate::mem::{self, ManuallyDrop, forget};
166166use crate::num::NonZero;
167167use crate::pin::Pin;
168168use crate::ptr::addr_of_mut;
169use crate::sync::atomic::{AtomicUsize, Ordering};
170169use crate::sync::Arc;
170use crate::sync::atomic::{AtomicUsize, Ordering};
171171use crate::sys::sync::Parker;
172172use crate::sys::thread as imp;
173173use crate::sys_common::{AsInner, IntoInner};
......@@ -178,7 +178,7 @@ use crate::{env, fmt, io, panic, panicking, str};
178178mod scoped;
179179
180180#[stable(feature = "scoped_threads", since = "1.63.0")]
181pub use scoped::{scope, Scope, ScopedJoinHandle};
181pub use scoped::{Scope, ScopedJoinHandle, scope};
182182
183183////////////////////////////////////////////////////////////////////////////////
184184// Thread-local storage
library/std/src/thread/scoped.rs+3-3
......@@ -1,8 +1,8 @@
1use super::{current, park, Builder, JoinInner, Result, Thread};
1use super::{Builder, JoinInner, Result, Thread, current, park};
22use crate::marker::PhantomData;
3use crate::panic::{catch_unwind, resume_unwind, AssertUnwindSafe};
4use crate::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
3use crate::panic::{AssertUnwindSafe, catch_unwind, resume_unwind};
54use crate::sync::Arc;
5use crate::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
66use crate::{fmt, io};
77
88/// A scope to spawn scoped threads in.
library/std/src/thread/tests.rs+1-1
......@@ -2,7 +2,7 @@ use super::Builder;
22use crate::any::Any;
33use crate::panic::panic_any;
44use crate::sync::atomic::{AtomicBool, Ordering};
5use crate::sync::mpsc::{channel, Sender};
5use crate::sync::mpsc::{Sender, channel};
66use crate::sync::{Arc, Barrier};
77use crate::thread::{self, Scope, ThreadId};
88use crate::time::{Duration, Instant};
library/std/src/time/tests.rs+2-2
......@@ -1,7 +1,7 @@
11use core::fmt::Debug;
22
33#[cfg(not(target_arch = "wasm32"))]
4use test::{black_box, Bencher};
4use test::{Bencher, black_box};
55
66use super::{Duration, Instant, SystemTime, UNIX_EPOCH};
77
......@@ -235,8 +235,8 @@ macro_rules! bench_instant_threaded {
235235 #[bench]
236236 #[cfg(not(target_arch = "wasm32"))]
237237 fn $bench_name(b: &mut Bencher) -> crate::thread::Result<()> {
238 use crate::sync::atomic::{AtomicBool, Ordering};
239238 use crate::sync::Arc;
239 use crate::sync::atomic::{AtomicBool, Ordering};
240240
241241 let running = Arc::new(AtomicBool::new(true));
242242
library/test/src/bench.rs+2-2
......@@ -1,15 +1,15 @@
11//! Benchmarking module.
22
3use std::panic::{catch_unwind, AssertUnwindSafe};
3use std::panic::{AssertUnwindSafe, catch_unwind};
44use std::sync::{Arc, Mutex};
55use std::time::{Duration, Instant};
66use std::{cmp, io};
77
8use super::Sender;
89use super::event::CompletedTest;
910use super::options::BenchMode;
1011use super::test_result::TestResult;
1112use super::types::{TestDesc, TestId};
12use super::Sender;
1313use crate::stats;
1414
1515/// An identity function that *__hints__* to the compiler to be maximally pessimistic about what
library/test/src/lib.rs+5-5
......@@ -28,17 +28,17 @@
2828
2929pub use cli::TestOpts;
3030
31pub use self::bench::{black_box, Bencher};
31pub use self::ColorConfig::*;
32pub use self::bench::{Bencher, black_box};
3233pub use self::console::run_tests_console;
3334pub use self::options::{ColorConfig, Options, OutputFormat, RunIgnored, ShouldPanic};
3435pub use self::types::TestName::*;
3536pub use self::types::*;
36pub use self::ColorConfig::*;
3737
3838// Module to be used by rustc to compile tests in libtest
3939pub mod test {
4040 pub use crate::bench::Bencher;
41 pub use crate::cli::{parse_opts, TestOpts};
41 pub use crate::cli::{TestOpts, parse_opts};
4242 pub use crate::helpers::metrics::{Metric, MetricMap};
4343 pub use crate::options::{Options, RunIgnored, RunStrategy, ShouldPanic};
4444 pub use crate::test_result::{TestResult, TrFailed, TrFailedMsg, TrIgnored, TrOk};
......@@ -53,9 +53,9 @@ pub mod test {
5353use std::collections::VecDeque;
5454use std::io::prelude::Write;
5555use std::mem::ManuallyDrop;
56use std::panic::{self, catch_unwind, AssertUnwindSafe, PanicHookInfo};
56use std::panic::{self, AssertUnwindSafe, PanicHookInfo, catch_unwind};
5757use std::process::{self, Command, Termination};
58use std::sync::mpsc::{channel, Sender};
58use std::sync::mpsc::{Sender, channel};
5959use std::sync::{Arc, Mutex};
6060use std::time::{Duration, Instant};
6161use std::{env, io, thread};
library/test/src/term/terminfo/mod.rs+2-2
......@@ -7,11 +7,11 @@ use std::io::{self, BufReader};
77use std::path::Path;
88use std::{env, error, fmt};
99
10use parm::{expand, Param, Variables};
10use parm::{Param, Variables, expand};
1111use parser::compiled::{msys_terminfo, parse};
1212use searcher::get_dbpath_for_term;
1313
14use super::{color, Terminal};
14use super::{Terminal, color};
1515
1616/// A parsed terminfo database entry.
1717#[allow(unused)]
library/test/src/term/win.rs+1-1
......@@ -5,7 +5,7 @@
55use std::io;
66use std::io::prelude::*;
77
8use super::{color, Terminal};
8use super::{Terminal, color};
99
1010/// A Terminal implementation that uses the Win32 Console API.
1111pub(crate) struct WinConsole<T> {
library/test/src/tests.rs+1-1
......@@ -3,11 +3,11 @@ use crate::{
33 console::OutputLocation,
44 formatters::PrettyFormatter,
55 test::{
6 parse_opts,
76 MetricMap,
87 // FIXME (introduced by #65251)
98 // ShouldPanic, StaticTestName, TestDesc, TestDescAndFn, TestOpts, TestTimeOptions,
109 // TestType, TrFailedMsg, TrIgnored, TrOk,
10 parse_opts,
1111 },
1212 time::{TestTimeOptions, TimeThreshold},
1313};
library/unwind/src/unwinding.rs+1-1
......@@ -32,7 +32,7 @@ pub use unwinding::abi::{UnwindContext, UnwindException};
3232pub enum _Unwind_Context {}
3333
3434pub use unwinding::custom_eh_frame_finder::{
35 set_custom_eh_frame_finder, EhFrameFinder, FrameInfo, FrameInfoKind,
35 EhFrameFinder, FrameInfo, FrameInfoKind, set_custom_eh_frame_finder,
3636};
3737
3838pub type _Unwind_Exception_Class = u64;
rustfmt.toml+1-1
......@@ -1,5 +1,5 @@
11# Run rustfmt with this config (it should be picked up automatically).
2version = "Two"
2style_edition = "2024"
33use_small_heuristics = "Max"
44merge_derives = false
55group_imports = "StdExternalCrate"
src/bootstrap/src/bin/main.rs+2-2
......@@ -11,8 +11,8 @@ use std::str::FromStr;
1111use std::{env, process};
1212
1313use bootstrap::{
14 find_recent_config_change_ids, human_readable_changes, t, Build, Config, Flags, Subcommand,
15 CONFIG_CHANGE_HISTORY,
14 Build, CONFIG_CHANGE_HISTORY, Config, Flags, Subcommand, find_recent_config_change_ids,
15 human_readable_changes, t,
1616};
1717
1818fn main() {
src/bootstrap/src/core/build_steps/check.rs+2-2
......@@ -5,9 +5,9 @@ use std::path::PathBuf;
55use crate::core::build_steps::compile::{
66 add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo, std_crates_for_run_make,
77};
8use crate::core::build_steps::tool::{prepare_tool_cargo, SourceType};
8use crate::core::build_steps::tool::{SourceType, prepare_tool_cargo};
99use crate::core::builder::{
10 self, crate_description, Alias, Builder, Kind, RunConfig, ShouldRun, Step,
10 self, Alias, Builder, Kind, RunConfig, ShouldRun, Step, crate_description,
1111};
1212use crate::core::config::TargetSelection;
1313use crate::{Compiler, Mode, Subcommand};
src/bootstrap/src/core/build_steps/clean.rs+1-1
......@@ -9,7 +9,7 @@ use std::fs;
99use std::io::{self, ErrorKind};
1010use std::path::Path;
1111
12use crate::core::builder::{crate_description, Builder, RunConfig, ShouldRun, Step};
12use crate::core::builder::{Builder, RunConfig, ShouldRun, Step, crate_description};
1313use crate::utils::helpers::t;
1414use crate::{Build, Compiler, Kind, Mode, Subcommand};
1515
src/bootstrap/src/core/build_steps/clippy.rs+2-2
......@@ -1,12 +1,12 @@
11//! Implementation of running clippy on the compiler, standard library and various tools.
22
33use super::compile::{librustc_stamp, libstd_stamp, run_cargo, rustc_cargo, std_cargo};
4use super::tool::{prepare_tool_cargo, SourceType};
4use super::tool::{SourceType, prepare_tool_cargo};
55use super::{check, compile};
66use crate::builder::{Builder, ShouldRun};
77use crate::core::build_steps::compile::std_crates_for_run_make;
88use crate::core::builder;
9use crate::core::builder::{crate_description, Alias, Kind, RunConfig, Step};
9use crate::core::builder::{Alias, Kind, RunConfig, Step, crate_description};
1010use crate::{Mode, Subcommand, TargetSelection};
1111
1212/// Disable the most spammy clippy lints
src/bootstrap/src/core/build_steps/compile.rs+3-3
......@@ -9,8 +9,8 @@
99use std::borrow::Cow;
1010use std::collections::HashSet;
1111use std::ffi::OsStr;
12use std::io::prelude::*;
1312use std::io::BufReader;
13use std::io::prelude::*;
1414use std::path::{Path, PathBuf};
1515use std::process::Stdio;
1616use std::{env, fs, str};
......@@ -22,14 +22,14 @@ use crate::core::build_steps::tool::SourceType;
2222use crate::core::build_steps::{dist, llvm};
2323use crate::core::builder;
2424use crate::core::builder::{
25 crate_description, Builder, Cargo, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath,
25 Builder, Cargo, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath, crate_description,
2626};
2727use crate::core::config::{DebuginfoLevel, LlvmLibunwind, RustcLto, TargetSelection};
2828use crate::utils::exec::command;
2929use crate::utils::helpers::{
3030 self, exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date,
3131};
32use crate::{CLang, Compiler, DependencyType, GitRepo, Mode, LLVM_TOOLS};
32use crate::{CLang, Compiler, DependencyType, GitRepo, LLVM_TOOLS, Mode};
3333
3434#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
3535pub struct Std {
src/bootstrap/src/core/build_steps/dist.rs+3-3
......@@ -14,8 +14,8 @@ use std::io::Write;
1414use std::path::{Path, PathBuf};
1515use std::{env, fs};
1616
17use object::read::archive::ArchiveFile;
1817use object::BinaryFormat;
18use object::read::archive::ArchiveFile;
1919
2020use crate::core::build_steps::doc::DocumentationFormat;
2121use crate::core::build_steps::tool::{self, Tool};
......@@ -24,12 +24,12 @@ use crate::core::build_steps::{compile, llvm};
2424use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
2525use crate::core::config::TargetSelection;
2626use crate::utils::channel::{self, Info};
27use crate::utils::exec::{command, BootstrapCommand};
27use crate::utils::exec::{BootstrapCommand, command};
2828use crate::utils::helpers::{
2929 exe, is_dylib, move_file, t, target_supports_cranelift_backend, timeit,
3030};
3131use crate::utils::tarball::{GeneratedTarball, OverlayKind, Tarball};
32use crate::{Compiler, DependencyType, Mode, LLVM_TOOLS};
32use crate::{Compiler, DependencyType, LLVM_TOOLS, Mode};
3333
3434pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
3535 format!("{}-{}", component, builder.rust_package_vers())
src/bootstrap/src/core/build_steps/doc.rs+3-3
......@@ -11,14 +11,14 @@ use std::io::{self, Write};
1111use std::path::{Path, PathBuf};
1212use std::{env, fs, mem};
1313
14use crate::Mode;
1415use crate::core::build_steps::compile;
15use crate::core::build_steps::tool::{self, prepare_tool_cargo, SourceType, Tool};
16use crate::core::build_steps::tool::{self, SourceType, Tool, prepare_tool_cargo};
1617use crate::core::builder::{
17 self, crate_description, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step,
18 self, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step, crate_description,
1819};
1920use crate::core::config::{Config, TargetSelection};
2021use crate::utils::helpers::{symlink_dir, t, up_to_date};
21use crate::Mode;
2222
2323macro_rules! submodule_helper {
2424 ($path:expr, submodule) => {
src/bootstrap/src/core/build_steps/format.rs+1-1
......@@ -3,8 +3,8 @@
33use std::collections::VecDeque;
44use std::path::{Path, PathBuf};
55use std::process::Command;
6use std::sync::mpsc::SyncSender;
76use std::sync::Mutex;
7use std::sync::mpsc::SyncSender;
88
99use build_helper::ci::CiEnv;
1010use build_helper::git::get_git_modified_files;
src/bootstrap/src/core/build_steps/gcc.rs+2-2
......@@ -15,8 +15,8 @@ use std::sync::OnceLock;
1515use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
1616use crate::core::config::TargetSelection;
1717use crate::utils::exec::command;
18use crate::utils::helpers::{self, t, HashStamp};
19use crate::{generate_smart_stamp_hash, Kind};
18use crate::utils::helpers::{self, HashStamp, t};
19use crate::{Kind, generate_smart_stamp_hash};
2020
2121pub struct Meta {
2222 stamp: HashStamp,
src/bootstrap/src/core/build_steps/llvm.rs+8-12
......@@ -23,9 +23,9 @@ use crate::core::config::{Config, TargetSelection};
2323use crate::utils::channel;
2424use crate::utils::exec::command;
2525use crate::utils::helpers::{
26 self, exe, get_clang_cl_resource_dir, output, t, unhashed_basename, up_to_date, HashStamp,
26 self, HashStamp, exe, get_clang_cl_resource_dir, output, t, unhashed_basename, up_to_date,
2727};
28use crate::{generate_smart_stamp_hash, CLang, GitRepo, Kind};
28use crate::{CLang, GitRepo, Kind, generate_smart_stamp_hash};
2929
3030#[derive(Clone)]
3131pub struct LlvmResult {
......@@ -154,16 +154,12 @@ pub fn prebuilt_llvm_config(builder: &Builder<'_>, target: TargetSelection) -> L
154154/// This retrieves the LLVM sha we *want* to use, according to git history.
155155pub(crate) fn detect_llvm_sha(config: &Config, is_git: bool) -> String {
156156 let llvm_sha = if is_git {
157 get_closest_merge_commit(
158 Some(&config.src),
159 &config.git_config(),
160 &[
161 config.src.join("src/llvm-project"),
162 config.src.join("src/bootstrap/download-ci-llvm-stamp"),
163 // the LLVM shared object file is named `LLVM-12-rust-{version}-nightly`
164 config.src.join("src/version"),
165 ],
166 )
157 get_closest_merge_commit(Some(&config.src), &config.git_config(), &[
158 config.src.join("src/llvm-project"),
159 config.src.join("src/bootstrap/download-ci-llvm-stamp"),
160 // the LLVM shared object file is named `LLVM-12-rust-{version}-nightly`
161 config.src.join("src/version"),
162 ])
167163 .unwrap()
168164 } else if let Some(info) = channel::read_commit_info_file(&config.src) {
169165 info.sha.trim().to_owned()
src/bootstrap/src/core/build_steps/run.rs+2-2
......@@ -5,14 +5,14 @@
55
66use std::path::PathBuf;
77
8use crate::Mode;
89use crate::core::build_steps::dist::distdir;
910use crate::core::build_steps::test;
1011use crate::core::build_steps::tool::{self, SourceType, Tool};
1112use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
12use crate::core::config::flags::get_completion;
1313use crate::core::config::TargetSelection;
14use crate::core::config::flags::get_completion;
1415use crate::utils::exec::command;
15use crate::Mode;
1616
1717#[derive(Debug, PartialOrd, Ord, Clone, Hash, PartialEq, Eq)]
1818pub struct BuildManifest;
src/bootstrap/src/core/build_steps/setup.rs+2-2
......@@ -9,7 +9,7 @@ use std::env::consts::EXE_SUFFIX;
99use std::fmt::Write as _;
1010use std::fs::File;
1111use std::io::Write;
12use std::path::{Path, PathBuf, MAIN_SEPARATOR_STR};
12use std::path::{MAIN_SEPARATOR_STR, Path, PathBuf};
1313use std::str::FromStr;
1414use std::{fmt, fs, io};
1515
......@@ -19,7 +19,7 @@ use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
1919use crate::utils::change_tracker::CONFIG_CHANGE_HISTORY;
2020use crate::utils::exec::command;
2121use crate::utils::helpers::{self, hex_encode};
22use crate::{t, Config};
22use crate::{Config, t};
2323
2424#[cfg(test)]
2525mod tests;
src/bootstrap/src/core/build_steps/synthetic_targets.rs+1-1
......@@ -7,10 +7,10 @@
77//! one of the target specs already defined in this module, or create new ones by adding a new step
88//! that calls create_synthetic_target.
99
10use crate::Compiler;
1011use crate::core::builder::{Builder, ShouldRun, Step};
1112use crate::core::config::TargetSelection;
1213use crate::utils::exec::command;
13use crate::Compiler;
1414
1515#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1616pub(crate) struct MirOptPanicAbortSyntheticTarget {
src/bootstrap/src/core/build_steps/test.rs+12-17
......@@ -15,17 +15,17 @@ use crate::core::build_steps::tool::{self, SourceType, Tool};
1515use crate::core::build_steps::toolstate::ToolState;
1616use crate::core::build_steps::{compile, dist, llvm};
1717use crate::core::builder::{
18 self, crate_description, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step,
18 self, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step, crate_description,
1919};
20use crate::core::config::flags::{get_completion, Subcommand};
2120use crate::core::config::TargetSelection;
22use crate::utils::exec::{command, BootstrapCommand};
21use crate::core::config::flags::{Subcommand, get_completion};
22use crate::utils::exec::{BootstrapCommand, command};
2323use crate::utils::helpers::{
24 self, add_link_lib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
25 linker_args, linker_flags, t, target_supports_cranelift_backend, up_to_date, LldThreads,
24 self, LldThreads, add_link_lib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
25 linker_args, linker_flags, t, target_supports_cranelift_backend, up_to_date,
2626};
2727use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
28use crate::{envify, CLang, DocTests, GitRepo, Mode};
28use crate::{CLang, DocTests, GitRepo, Mode, envify};
2929
3030const ADB_TEST_DIR: &str = "/data/local/tmp/work";
3131
......@@ -1075,12 +1075,8 @@ HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to
10751075 crate::exit!(1);
10761076 }
10771077 let all = false;
1078 crate::core::build_steps::format::format(
1079 builder,
1080 !builder.config.cmd.bless(),
1081 all,
1082 &[],
1083 );
1078 crate::core::build_steps::format::format(builder, !builder.config.cmd.bless(), all, &[
1079 ]);
10841080 }
10851081
10861082 builder.info("tidy check");
......@@ -3440,11 +3436,10 @@ impl Step for CodegenGCC {
34403436 let compiler = self.compiler;
34413437 let target = self.target;
34423438
3443 builder.ensure(compile::Std::new_with_extra_rust_args(
3444 compiler,
3445 target,
3446 &["-Csymbol-mangling-version=v0", "-Cpanic=abort"],
3447 ));
3439 builder.ensure(compile::Std::new_with_extra_rust_args(compiler, target, &[
3440 "-Csymbol-mangling-version=v0",
3441 "-Cpanic=abort",
3442 ]));
34483443
34493444 // If we're not doing a full bootstrap but we're testing a stage2
34503445 // version of libstd, then what we're actually testing is the libstd
src/bootstrap/src/core/build_steps/tool.rs+2-2
......@@ -9,9 +9,9 @@ use crate::core::builder;
99use crate::core::builder::{Builder, Cargo as CargoCommand, RunConfig, ShouldRun, Step};
1010use crate::core::config::TargetSelection;
1111use crate::utils::channel::GitInfo;
12use crate::utils::exec::{command, BootstrapCommand};
12use crate::utils::exec::{BootstrapCommand, command};
1313use crate::utils::helpers::{add_dylib_path, exe, git, t};
14use crate::{gha, Compiler, Kind, Mode};
14use crate::{Compiler, Kind, Mode, gha};
1515
1616#[derive(Debug, Clone, Hash, PartialEq, Eq)]
1717pub enum SourceType {
src/bootstrap/src/core/build_steps/toolstate.rs+5-9
......@@ -42,15 +42,11 @@ pub enum ToolState {
4242
4343impl fmt::Display for ToolState {
4444 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45 write!(
46 f,
47 "{}",
48 match self {
49 ToolState::TestFail => "test-fail",
50 ToolState::TestPass => "test-pass",
51 ToolState::BuildFail => "build-fail",
52 }
53 )
45 write!(f, "{}", match self {
46 ToolState::TestFail => "test-fail",
47 ToolState::TestPass => "test-pass",
48 ToolState::BuildFail => "build-fail",
49 })
5450 }
5551}
5652
src/bootstrap/src/core/builder.rs+30-33
......@@ -1,4 +1,4 @@
1use std::any::{type_name, Any};
1use std::any::{Any, type_name};
22use std::cell::{Cell, RefCell};
33use std::collections::BTreeSet;
44use std::ffi::{OsStr, OsString};
......@@ -12,6 +12,7 @@ use std::{env, fs};
1212
1313use clap::ValueEnum;
1414
15pub use crate::Compiler;
1516use crate::core::build_steps::tool::{self, SourceType};
1617use crate::core::build_steps::{
1718 check, clean, clippy, compile, dist, doc, gcc, install, llvm, run, setup, test, vendor,
......@@ -19,14 +20,13 @@ use crate::core::build_steps::{
1920use crate::core::config::flags::{Color, Subcommand};
2021use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection};
2122use crate::utils::cache::Cache;
22use crate::utils::exec::{command, BootstrapCommand};
23use crate::utils::exec::{BootstrapCommand, command};
2324use crate::utils::helpers::{
24 self, add_dylib_path, add_link_lib_path, check_cfg_arg, exe, libdir, linker_args, linker_flags,
25 t, LldThreads,
25 self, LldThreads, add_dylib_path, add_link_lib_path, check_cfg_arg, exe, libdir, linker_args,
26 linker_flags, t,
2627};
27pub use crate::Compiler;
2828use crate::{
29 prepare_behaviour_dump_dir, Build, CLang, Crate, DocTests, GitRepo, Mode, EXTRA_CHECK_CFGS,
29 Build, CLang, Crate, DocTests, EXTRA_CHECK_CFGS, GitRepo, Mode, prepare_behaviour_dump_dir,
3030};
3131
3232#[cfg(test)]
......@@ -314,33 +314,30 @@ const PATH_REMAP: &[(&str, &[&str])] = &[
314314 // actual path is `proc-macro-srv-cli`
315315 ("rust-analyzer-proc-macro-srv", &["src/tools/rust-analyzer/crates/proc-macro-srv-cli"]),
316316 // Make `x test tests` function the same as `x t tests/*`
317 (
318 "tests",
319 &[
320 // tidy-alphabetical-start
321 "tests/assembly",
322 "tests/codegen",
323 "tests/codegen-units",
324 "tests/coverage",
325 "tests/coverage-run-rustdoc",
326 "tests/crashes",
327 "tests/debuginfo",
328 "tests/incremental",
329 "tests/mir-opt",
330 "tests/pretty",
331 "tests/run-make",
332 "tests/run-pass-valgrind",
333 "tests/rustdoc",
334 "tests/rustdoc-gui",
335 "tests/rustdoc-js",
336 "tests/rustdoc-js-std",
337 "tests/rustdoc-json",
338 "tests/rustdoc-ui",
339 "tests/ui",
340 "tests/ui-fulldeps",
341 // tidy-alphabetical-end
342 ],
343 ),
317 ("tests", &[
318 // tidy-alphabetical-start
319 "tests/assembly",
320 "tests/codegen",
321 "tests/codegen-units",
322 "tests/coverage",
323 "tests/coverage-run-rustdoc",
324 "tests/crashes",
325 "tests/debuginfo",
326 "tests/incremental",
327 "tests/mir-opt",
328 "tests/pretty",
329 "tests/run-make",
330 "tests/run-pass-valgrind",
331 "tests/rustdoc",
332 "tests/rustdoc-gui",
333 "tests/rustdoc-js",
334 "tests/rustdoc-js-std",
335 "tests/rustdoc-json",
336 "tests/rustdoc-ui",
337 "tests/ui",
338 "tests/ui-fulldeps",
339 // tidy-alphabetical-end
340 ]),
344341];
345342
346343fn remap_paths(paths: &mut Vec<PathBuf>) {
src/bootstrap/src/core/builder/tests.rs+194-261
......@@ -1,9 +1,9 @@
11use std::thread;
22
33use super::*;
4use crate::Flags;
45use crate::core::build_steps::doc::DocumentationFormat;
56use crate::core::config::Config;
6use crate::Flags;
77
88fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
99 configure_with_args(&[cmd.to_owned()], host, target)
......@@ -202,10 +202,10 @@ fn test_exclude_kind() {
202202fn alias_and_path_for_library() {
203203 let mut cache =
204204 run_build(&["library".into(), "core".into()], configure("build", &["A-A"], &["A-A"]));
205 assert_eq!(
206 first(cache.all::<compile::Std>()),
207 &[std!(A => A, stage = 0), std!(A => A, stage = 1)]
208 );
205 assert_eq!(first(cache.all::<compile::Std>()), &[
206 std!(A => A, stage = 0),
207 std!(A => A, stage = 1)
208 ]);
209209
210210 let mut cache =
211211 run_build(&["library".into(), "core".into()], configure("doc", &["A-A"], &["A-A"]));
......@@ -216,18 +216,18 @@ mod defaults {
216216 use pretty_assertions::assert_eq;
217217
218218 use super::{configure, first, run_build};
219 use crate::core::builder::*;
220219 use crate::Config;
220 use crate::core::builder::*;
221221
222222 #[test]
223223 fn build_default() {
224224 let mut cache = run_build(&[], configure("build", &["A-A"], &["A-A"]));
225225
226226 let a = TargetSelection::from_user("A-A");
227 assert_eq!(
228 first(cache.all::<compile::Std>()),
229 &[std!(A => A, stage = 0), std!(A => A, stage = 1),]
230 );
227 assert_eq!(first(cache.all::<compile::Std>()), &[
228 std!(A => A, stage = 0),
229 std!(A => A, stage = 1),
230 ]);
231231 assert!(!cache.all::<compile::Assemble>().is_empty());
232232 // Make sure rustdoc is only built once.
233233 assert_eq!(
......@@ -269,34 +269,25 @@ mod defaults {
269269 // there's not really a need for us to build for target A in this case
270270 // (since we're producing stage 1 libraries/binaries). But currently
271271 // bootstrap is just a bit buggy here; this should be fixed though.
272 assert_eq!(
273 first(cache.all::<compile::Std>()),
274 &[
275 std!(A => A, stage = 0),
276 std!(A => A, stage = 1),
277 std!(A => B, stage = 0),
278 std!(A => B, stage = 1),
279 ]
280 );
281 assert_eq!(
282 first(cache.all::<compile::Assemble>()),
283 &[
284 compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
285 compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
286 compile::Assemble { target_compiler: Compiler { host: b, stage: 1 } },
287 ]
288 );
289 assert_eq!(
290 first(cache.all::<tool::Rustdoc>()),
291 &[
292 tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
293 tool::Rustdoc { compiler: Compiler { host: b, stage: 1 } },
294 ],
295 );
296 assert_eq!(
297 first(cache.all::<compile::Rustc>()),
298 &[rustc!(A => A, stage = 0), rustc!(A => B, stage = 0),]
299 );
272 assert_eq!(first(cache.all::<compile::Std>()), &[
273 std!(A => A, stage = 0),
274 std!(A => A, stage = 1),
275 std!(A => B, stage = 0),
276 std!(A => B, stage = 1),
277 ]);
278 assert_eq!(first(cache.all::<compile::Assemble>()), &[
279 compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
280 compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
281 compile::Assemble { target_compiler: Compiler { host: b, stage: 1 } },
282 ]);
283 assert_eq!(first(cache.all::<tool::Rustdoc>()), &[
284 tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
285 tool::Rustdoc { compiler: Compiler { host: b, stage: 1 } },
286 ],);
287 assert_eq!(first(cache.all::<compile::Rustc>()), &[
288 rustc!(A => A, stage = 0),
289 rustc!(A => B, stage = 0),
290 ]);
300291 }
301292
302293 #[test]
......@@ -310,24 +301,22 @@ mod defaults {
310301 // error_index_generator uses stage 0 to share rustdoc artifacts with the
311302 // rustdoc tool.
312303 assert_eq!(first(cache.all::<doc::ErrorIndex>()), &[doc::ErrorIndex { target: a },]);
313 assert_eq!(
314 first(cache.all::<tool::ErrorIndex>()),
315 &[tool::ErrorIndex { compiler: Compiler { host: a, stage: 0 } }]
316 );
304 assert_eq!(first(cache.all::<tool::ErrorIndex>()), &[tool::ErrorIndex {
305 compiler: Compiler { host: a, stage: 0 }
306 }]);
317307 // docs should be built with the beta compiler, not with the stage0 artifacts.
318308 // recall that rustdoc is off-by-one: `stage` is the compiler rustdoc is _linked_ to,
319309 // not the one it was built by.
320 assert_eq!(
321 first(cache.all::<tool::Rustdoc>()),
322 &[tool::Rustdoc { compiler: Compiler { host: a, stage: 0 } },]
323 );
310 assert_eq!(first(cache.all::<tool::Rustdoc>()), &[tool::Rustdoc {
311 compiler: Compiler { host: a, stage: 0 }
312 },]);
324313 }
325314}
326315
327316mod dist {
328317 use pretty_assertions::assert_eq;
329318
330 use super::{first, run_build, Config};
319 use super::{Config, first, run_build};
331320 use crate::core::builder::*;
332321
333322 fn configure(host: &[&str], target: &[&str]) -> Config {
......@@ -342,20 +331,18 @@ mod dist {
342331
343332 assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a },]);
344333 assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a },]);
345 assert_eq!(
346 first(cache.all::<dist::Rustc>()),
347 &[dist::Rustc { compiler: Compiler { host: a, stage: 2 } },]
348 );
349 assert_eq!(
350 first(cache.all::<dist::Std>()),
351 &[dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },]
352 );
334 assert_eq!(first(cache.all::<dist::Rustc>()), &[dist::Rustc {
335 compiler: Compiler { host: a, stage: 2 }
336 },]);
337 assert_eq!(first(cache.all::<dist::Std>()), &[dist::Std {
338 compiler: Compiler { host: a, stage: 1 },
339 target: a
340 },]);
353341 assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
354342 // Make sure rustdoc is only built once.
355 assert_eq!(
356 first(cache.all::<tool::Rustdoc>()),
357 &[tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },]
358 );
343 assert_eq!(first(cache.all::<tool::Rustdoc>()), &[tool::Rustdoc {
344 compiler: Compiler { host: a, stage: 2 }
345 },]);
359346 }
360347
361348 #[test]
......@@ -365,25 +352,19 @@ mod dist {
365352 let a = TargetSelection::from_user("A-A");
366353 let b = TargetSelection::from_user("B-B");
367354
368 assert_eq!(
369 first(cache.all::<dist::Docs>()),
370 &[dist::Docs { host: a }, dist::Docs { host: b },]
371 );
372 assert_eq!(
373 first(cache.all::<dist::Mingw>()),
374 &[dist::Mingw { host: a }, dist::Mingw { host: b },]
375 );
376 assert_eq!(
377 first(cache.all::<dist::Rustc>()),
378 &[dist::Rustc { compiler: Compiler { host: a, stage: 2 } },]
379 );
380 assert_eq!(
381 first(cache.all::<dist::Std>()),
382 &[
383 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
384 dist::Std { compiler: Compiler { host: a, stage: 2 }, target: b },
385 ]
386 );
355 assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a }, dist::Docs {
356 host: b
357 },]);
358 assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a }, dist::Mingw {
359 host: b
360 },]);
361 assert_eq!(first(cache.all::<dist::Rustc>()), &[dist::Rustc {
362 compiler: Compiler { host: a, stage: 2 }
363 },]);
364 assert_eq!(first(cache.all::<dist::Std>()), &[
365 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
366 dist::Std { compiler: Compiler { host: a, stage: 2 }, target: b },
367 ]);
387368 assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
388369 }
389370
......@@ -394,38 +375,27 @@ mod dist {
394375 let a = TargetSelection::from_user("A-A");
395376 let b = TargetSelection::from_user("B-B");
396377
397 assert_eq!(
398 first(cache.all::<dist::Docs>()),
399 &[dist::Docs { host: a }, dist::Docs { host: b },]
400 );
401 assert_eq!(
402 first(cache.all::<dist::Mingw>()),
403 &[dist::Mingw { host: a }, dist::Mingw { host: b },]
404 );
405 assert_eq!(
406 first(cache.all::<dist::Rustc>()),
407 &[
408 dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
409 dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
410 ]
411 );
412 assert_eq!(
413 first(cache.all::<dist::Std>()),
414 &[
415 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
416 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
417 ]
418 );
419 assert_eq!(
420 first(cache.all::<compile::Std>()),
421 &[
422 std!(A => A, stage = 0),
423 std!(A => A, stage = 1),
424 std!(A => A, stage = 2),
425 std!(A => B, stage = 1),
426 std!(A => B, stage = 2),
427 ],
428 );
378 assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a }, dist::Docs {
379 host: b
380 },]);
381 assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a }, dist::Mingw {
382 host: b
383 },]);
384 assert_eq!(first(cache.all::<dist::Rustc>()), &[
385 dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
386 dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
387 ]);
388 assert_eq!(first(cache.all::<dist::Std>()), &[
389 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
390 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
391 ]);
392 assert_eq!(first(cache.all::<compile::Std>()), &[
393 std!(A => A, stage = 0),
394 std!(A => A, stage = 1),
395 std!(A => A, stage = 2),
396 std!(A => B, stage = 1),
397 std!(A => B, stage = 2),
398 ],);
429399 assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
430400 }
431401
......@@ -438,14 +408,13 @@ mod dist {
438408 config.hosts = vec![b];
439409 let mut cache = run_build(&[], config);
440410
441 assert_eq!(
442 first(cache.all::<dist::Rustc>()),
443 &[dist::Rustc { compiler: Compiler { host: b, stage: 2 } },]
444 );
445 assert_eq!(
446 first(cache.all::<compile::Rustc>()),
447 &[rustc!(A => A, stage = 0), rustc!(A => B, stage = 1),]
448 );
411 assert_eq!(first(cache.all::<dist::Rustc>()), &[dist::Rustc {
412 compiler: Compiler { host: b, stage: 2 }
413 },]);
414 assert_eq!(first(cache.all::<compile::Rustc>()), &[
415 rustc!(A => A, stage = 0),
416 rustc!(A => B, stage = 1),
417 ]);
449418 }
450419
451420 #[test]
......@@ -456,29 +425,25 @@ mod dist {
456425 let b = TargetSelection::from_user("B-B");
457426 let c = TargetSelection::from_user("C-C");
458427
459 assert_eq!(
460 first(cache.all::<dist::Docs>()),
461 &[dist::Docs { host: a }, dist::Docs { host: b }, dist::Docs { host: c },]
462 );
463 assert_eq!(
464 first(cache.all::<dist::Mingw>()),
465 &[dist::Mingw { host: a }, dist::Mingw { host: b }, dist::Mingw { host: c },]
466 );
467 assert_eq!(
468 first(cache.all::<dist::Rustc>()),
469 &[
470 dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
471 dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
472 ]
473 );
474 assert_eq!(
475 first(cache.all::<dist::Std>()),
476 &[
477 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
478 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
479 dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },
480 ]
481 );
428 assert_eq!(first(cache.all::<dist::Docs>()), &[
429 dist::Docs { host: a },
430 dist::Docs { host: b },
431 dist::Docs { host: c },
432 ]);
433 assert_eq!(first(cache.all::<dist::Mingw>()), &[
434 dist::Mingw { host: a },
435 dist::Mingw { host: b },
436 dist::Mingw { host: c },
437 ]);
438 assert_eq!(first(cache.all::<dist::Rustc>()), &[
439 dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
440 dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
441 ]);
442 assert_eq!(first(cache.all::<dist::Std>()), &[
443 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
444 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
445 dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },
446 ]);
482447 assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
483448 }
484449
......@@ -492,10 +457,10 @@ mod dist {
492457
493458 assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: c },]);
494459 assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: c },]);
495 assert_eq!(
496 first(cache.all::<dist::Std>()),
497 &[dist::Std { compiler: Compiler { host: a, stage: 2 }, target: c },]
498 );
460 assert_eq!(first(cache.all::<dist::Std>()), &[dist::Std {
461 compiler: Compiler { host: a, stage: 2 },
462 target: c
463 },]);
499464 }
500465
501466 #[test]
......@@ -505,81 +470,61 @@ mod dist {
505470 let a = TargetSelection::from_user("A-A");
506471 let b = TargetSelection::from_user("B-B");
507472
508 assert_eq!(
509 first(cache.all::<dist::Docs>()),
510 &[dist::Docs { host: a }, dist::Docs { host: b },]
511 );
512 assert_eq!(
513 first(cache.all::<dist::Mingw>()),
514 &[dist::Mingw { host: a }, dist::Mingw { host: b },]
515 );
516 assert_eq!(
517 first(cache.all::<dist::Rustc>()),
518 &[
519 dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
520 dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
521 ]
522 );
523 assert_eq!(
524 first(cache.all::<dist::Std>()),
525 &[
526 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
527 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
528 ]
529 );
473 assert_eq!(first(cache.all::<dist::Docs>()), &[dist::Docs { host: a }, dist::Docs {
474 host: b
475 },]);
476 assert_eq!(first(cache.all::<dist::Mingw>()), &[dist::Mingw { host: a }, dist::Mingw {
477 host: b
478 },]);
479 assert_eq!(first(cache.all::<dist::Rustc>()), &[
480 dist::Rustc { compiler: Compiler { host: a, stage: 2 } },
481 dist::Rustc { compiler: Compiler { host: b, stage: 2 } },
482 ]);
483 assert_eq!(first(cache.all::<dist::Std>()), &[
484 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: a },
485 dist::Std { compiler: Compiler { host: a, stage: 1 }, target: b },
486 ]);
530487 assert_eq!(first(cache.all::<dist::Src>()), &[dist::Src]);
531 assert_eq!(
532 first(cache.all::<compile::Std>()),
533 &[
534 std!(A => A, stage = 0),
535 std!(A => A, stage = 1),
536 std!(A => A, stage = 2),
537 std!(A => B, stage = 1),
538 std!(A => B, stage = 2),
539 ]
540 );
541 assert_eq!(
542 first(cache.all::<compile::Assemble>()),
543 &[
544 compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
545 compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
546 compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
547 compile::Assemble { target_compiler: Compiler { host: b, stage: 2 } },
548 ]
549 );
488 assert_eq!(first(cache.all::<compile::Std>()), &[
489 std!(A => A, stage = 0),
490 std!(A => A, stage = 1),
491 std!(A => A, stage = 2),
492 std!(A => B, stage = 1),
493 std!(A => B, stage = 2),
494 ]);
495 assert_eq!(first(cache.all::<compile::Assemble>()), &[
496 compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
497 compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
498 compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
499 compile::Assemble { target_compiler: Compiler { host: b, stage: 2 } },
500 ]);
550501 }
551502
552503 #[test]
553504 fn build_all() {
554505 let build = Build::new(configure(&["A-A", "B-B"], &["A-A", "B-B", "C-C"]));
555506 let mut builder = Builder::new(&build);
556 builder.run_step_descriptions(
557 &Builder::get_step_descriptions(Kind::Build),
558 &["compiler/rustc".into(), "library".into()],
559 );
560
561 assert_eq!(
562 first(builder.cache.all::<compile::Std>()),
563 &[
564 std!(A => A, stage = 0),
565 std!(A => A, stage = 1),
566 std!(A => A, stage = 2),
567 std!(A => B, stage = 1),
568 std!(A => B, stage = 2),
569 std!(A => C, stage = 2),
570 ]
571 );
507 builder.run_step_descriptions(&Builder::get_step_descriptions(Kind::Build), &[
508 "compiler/rustc".into(),
509 "library".into(),
510 ]);
511
512 assert_eq!(first(builder.cache.all::<compile::Std>()), &[
513 std!(A => A, stage = 0),
514 std!(A => A, stage = 1),
515 std!(A => A, stage = 2),
516 std!(A => B, stage = 1),
517 std!(A => B, stage = 2),
518 std!(A => C, stage = 2),
519 ]);
572520 assert_eq!(builder.cache.all::<compile::Assemble>().len(), 5);
573 assert_eq!(
574 first(builder.cache.all::<compile::Rustc>()),
575 &[
576 rustc!(A => A, stage = 0),
577 rustc!(A => A, stage = 1),
578 rustc!(A => A, stage = 2),
579 rustc!(A => B, stage = 1),
580 rustc!(A => B, stage = 2),
581 ]
582 );
521 assert_eq!(first(builder.cache.all::<compile::Rustc>()), &[
522 rustc!(A => A, stage = 0),
523 rustc!(A => A, stage = 1),
524 rustc!(A => A, stage = 2),
525 rustc!(A => B, stage = 1),
526 rustc!(A => B, stage = 2),
527 ]);
583528 }
584529
585530 #[test]
......@@ -608,22 +553,20 @@ mod dist {
608553
609554 let a = TargetSelection::from_user("A-A");
610555
611 assert_eq!(
612 first(builder.cache.all::<compile::Std>()),
613 &[std!(A => A, stage = 0), std!(A => A, stage = 1), std!(A => C, stage = 2),]
614 );
615 assert_eq!(
616 first(builder.cache.all::<compile::Assemble>()),
617 &[
618 compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
619 compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
620 compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
621 ]
622 );
623 assert_eq!(
624 first(builder.cache.all::<compile::Rustc>()),
625 &[rustc!(A => A, stage = 0), rustc!(A => A, stage = 1),]
626 );
556 assert_eq!(first(builder.cache.all::<compile::Std>()), &[
557 std!(A => A, stage = 0),
558 std!(A => A, stage = 1),
559 std!(A => C, stage = 2),
560 ]);
561 assert_eq!(first(builder.cache.all::<compile::Assemble>()), &[
562 compile::Assemble { target_compiler: Compiler { host: a, stage: 0 } },
563 compile::Assemble { target_compiler: Compiler { host: a, stage: 1 } },
564 compile::Assemble { target_compiler: Compiler { host: a, stage: 2 } },
565 ]);
566 assert_eq!(first(builder.cache.all::<compile::Rustc>()), &[
567 rustc!(A => A, stage = 0),
568 rustc!(A => A, stage = 1),
569 ]);
627570 }
628571
629572 #[test]
......@@ -652,22 +595,18 @@ mod dist {
652595
653596 let host = TargetSelection::from_user("A-A");
654597
655 builder.run_step_descriptions(
656 &[StepDescription::from::<test::Crate>(Kind::Test)],
657 &["library/std".into()],
658 );
598 builder.run_step_descriptions(&[StepDescription::from::<test::Crate>(Kind::Test)], &[
599 "library/std".into(),
600 ]);
659601
660602 // Ensure we don't build any compiler artifacts.
661603 assert!(!builder.cache.contains::<compile::Rustc>());
662 assert_eq!(
663 first(builder.cache.all::<test::Crate>()),
664 &[test::Crate {
665 compiler: Compiler { host, stage: 0 },
666 target: host,
667 mode: Mode::Std,
668 crates: vec!["std".to_owned()],
669 },]
670 );
604 assert_eq!(first(builder.cache.all::<test::Crate>()), &[test::Crate {
605 compiler: Compiler { host, stage: 0 },
606 target: host,
607 mode: Mode::Std,
608 crates: vec!["std".to_owned()],
609 },]);
671610 }
672611
673612 #[test]
......@@ -686,16 +625,14 @@ mod dist {
686625 first(builder.cache.all::<doc::ErrorIndex>()),
687626 &[doc::ErrorIndex { target: a },]
688627 );
689 assert_eq!(
690 first(builder.cache.all::<tool::ErrorIndex>()),
691 &[tool::ErrorIndex { compiler: Compiler { host: a, stage: 1 } }]
692 );
628 assert_eq!(first(builder.cache.all::<tool::ErrorIndex>()), &[tool::ErrorIndex {
629 compiler: Compiler { host: a, stage: 1 }
630 }]);
693631 // This is actually stage 1, but Rustdoc::run swaps out the compiler with
694632 // stage minus 1 if --stage is not 0. Very confusing!
695 assert_eq!(
696 first(builder.cache.all::<tool::Rustdoc>()),
697 &[tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },]
698 );
633 assert_eq!(first(builder.cache.all::<tool::Rustdoc>()), &[tool::Rustdoc {
634 compiler: Compiler { host: a, stage: 2 }
635 },]);
699636 }
700637
701638 #[test]
......@@ -731,10 +668,9 @@ mod dist {
731668 first(builder.cache.all::<doc::ErrorIndex>()),
732669 &[doc::ErrorIndex { target: a },]
733670 );
734 assert_eq!(
735 first(builder.cache.all::<tool::ErrorIndex>()),
736 &[tool::ErrorIndex { compiler: Compiler { host: a, stage: 1 } }]
737 );
671 assert_eq!(first(builder.cache.all::<tool::ErrorIndex>()), &[tool::ErrorIndex {
672 compiler: Compiler { host: a, stage: 1 }
673 }]);
738674 // Unfortunately rustdoc is built twice. Once from stage1 for compiletest
739675 // (and other things), and once from stage0 for std crates. Ideally it
740676 // would only be built once. If someone wants to fix this, it might be
......@@ -746,13 +682,10 @@ mod dist {
746682 // The stage 0 copy is the one downloaded for bootstrapping. It is
747683 // (currently) needed to run "cargo test" on the linkchecker, and
748684 // should be relatively "free".
749 assert_eq!(
750 first(builder.cache.all::<tool::Rustdoc>()),
751 &[
752 tool::Rustdoc { compiler: Compiler { host: a, stage: 0 } },
753 tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
754 tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },
755 ]
756 );
685 assert_eq!(first(builder.cache.all::<tool::Rustdoc>()), &[
686 tool::Rustdoc { compiler: Compiler { host: a, stage: 0 } },
687 tool::Rustdoc { compiler: Compiler { host: a, stage: 1 } },
688 tool::Rustdoc { compiler: Compiler { host: a, stage: 2 } },
689 ]);
757690 }
758691}
src/bootstrap/src/core/config/config.rs+8-11
......@@ -7,14 +7,14 @@ use std::cell::{Cell, RefCell};
77use std::collections::{HashMap, HashSet};
88use std::fmt::{self, Display};
99use std::io::IsTerminal;
10use std::path::{absolute, Path, PathBuf};
10use std::path::{Path, PathBuf, absolute};
1111use std::process::Command;
1212use std::str::FromStr;
1313use std::sync::OnceLock;
1414use std::{cmp, env, fs};
1515
1616use build_helper::exit;
17use build_helper::git::{get_closest_merge_commit, output_result, GitConfig};
17use build_helper::git::{GitConfig, get_closest_merge_commit, output_result};
1818use serde::{Deserialize, Deserializer};
1919use serde_derive::Deserialize;
2020
......@@ -22,7 +22,7 @@ use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX;
2222use crate::core::build_steps::llvm;
2323pub use crate::core::config::flags::Subcommand;
2424use crate::core::config::flags::{Color, Flags, Warnings};
25use crate::utils::cache::{Interned, INTERNER};
25use crate::utils::cache::{INTERNER, Interned};
2626use crate::utils::channel::{self, GitInfo};
2727use crate::utils::helpers::{self, exe, output, t};
2828
......@@ -1745,14 +1745,11 @@ impl Config {
17451745 config.rustc_default_linker = default_linker;
17461746 config.musl_root = musl_root.map(PathBuf::from);
17471747 config.save_toolstates = save_toolstates.map(PathBuf::from);
1748 set(
1749 &mut config.deny_warnings,
1750 match flags.warnings {
1751 Warnings::Deny => Some(true),
1752 Warnings::Warn => Some(false),
1753 Warnings::Default => deny_warnings,
1754 },
1755 );
1748 set(&mut config.deny_warnings, match flags.warnings {
1749 Warnings::Deny => Some(true),
1750 Warnings::Warn => Some(false),
1751 Warnings::Default => deny_warnings,
1752 });
17561753 set(&mut config.backtrace_on_ice, backtrace_on_ice);
17571754 set(&mut config.rust_verify_llvm_ir, verify_llvm_ir);
17581755 config.rust_thin_lto_import_instr_limit = thin_lto_import_instr_limit;
src/bootstrap/src/core/config/flags.rs+1-1
......@@ -9,7 +9,7 @@ use clap::{CommandFactory, Parser, ValueEnum};
99
1010use crate::core::build_steps::setup::Profile;
1111use crate::core::builder::{Builder, Kind};
12use crate::core::config::{target_selection_list, Config, TargetSelectionList};
12use crate::core::config::{Config, TargetSelectionList, target_selection_list};
1313use crate::{Build, DocTests};
1414
1515#[derive(Copy, Clone, Default, Debug, ValueEnum)]
src/bootstrap/src/core/config/tests.rs+1-1
......@@ -1,5 +1,5 @@
11use std::env;
2use std::fs::{remove_file, File};
2use std::fs::{File, remove_file};
33use std::io::Write;
44use std::path::Path;
55
src/bootstrap/src/core/download.rs+2-2
......@@ -10,9 +10,9 @@ use build_helper::ci::CiEnv;
1010use xz2::bufread::XzDecoder;
1111
1212use crate::core::config::BUILDER_CONFIG_FILENAME;
13use crate::utils::exec::{command, BootstrapCommand};
13use crate::utils::exec::{BootstrapCommand, command};
1414use crate::utils::helpers::{check_run, exe, hex_encode, move_file, program_out_of_date};
15use crate::{t, Config};
15use crate::{Config, t};
1616
1717static SHOULD_FIX_BINS_AND_DYLIBS: OnceLock<bool> = OnceLock::new();
1818
src/bootstrap/src/core/metadata.rs+1-1
......@@ -4,7 +4,7 @@ use std::path::PathBuf;
44use serde_derive::Deserialize;
55
66use crate::utils::exec::command;
7use crate::{t, Build, Crate};
7use crate::{Build, Crate, t};
88
99/// For more information, see the output of
1010/// <https://doc.rust-lang.org/nightly/cargo/commands/cargo-metadata.html>
src/bootstrap/src/core/sanity.rs+1-1
......@@ -15,6 +15,7 @@ use std::{env, fs};
1515
1616use build_helper::git::warn_old_master_branch;
1717
18use crate::Build;
1819#[cfg(not(feature = "bootstrap-self-test"))]
1920use crate::builder::Builder;
2021use crate::builder::Kind;
......@@ -22,7 +23,6 @@ use crate::builder::Kind;
2223use crate::core::build_steps::tool;
2324use crate::core::config::Target;
2425use crate::utils::exec::command;
25use crate::Build;
2626
2727pub struct Finder {
2828 cache: HashMap<OsString, Option<PathBuf>>,
src/bootstrap/src/lib.rs+4-4
......@@ -35,8 +35,8 @@ use utils::helpers::hex_encode;
3535
3636use crate::core::builder;
3737use crate::core::builder::{Builder, Kind};
38use crate::core::config::{flags, DryRun, LldMode, LlvmLibunwind, Target, TargetSelection};
39use crate::utils::exec::{command, BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode};
38use crate::core::config::{DryRun, LldMode, LlvmLibunwind, Target, TargetSelection, flags};
39use crate::utils::exec::{BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode, command};
4040use crate::utils::helpers::{
4141 self, dir_is_empty, exe, libdir, mtime, output, set_file_times, symlink_dir,
4242};
......@@ -45,11 +45,11 @@ mod core;
4545mod utils;
4646
4747pub use core::builder::PathSet;
48pub use core::config::flags::{Flags, Subcommand};
4948pub use core::config::Config;
49pub use core::config::flags::{Flags, Subcommand};
5050
5151pub use utils::change_tracker::{
52 find_recent_config_change_ids, human_readable_changes, CONFIG_CHANGE_HISTORY,
52 CONFIG_CHANGE_HISTORY, find_recent_config_change_ids, human_readable_changes,
5353};
5454
5555const LLVM_TOOLS: &[&str] = &[
src/bootstrap/src/utils/cc_detect.rs+1-1
......@@ -26,7 +26,7 @@ use std::path::{Path, PathBuf};
2626use std::{env, iter};
2727
2828use crate::core::config::TargetSelection;
29use crate::utils::exec::{command, BootstrapCommand};
29use crate::utils::exec::{BootstrapCommand, command};
3030use crate::{Build, CLang, GitRepo};
3131
3232// The `cc` crate doesn't provide a way to obtain a path to the detected archiver,
src/bootstrap/src/utils/change_tracker/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use crate::{find_recent_config_change_ids, CONFIG_CHANGE_HISTORY};
1use crate::{CONFIG_CHANGE_HISTORY, find_recent_config_change_ids};
22
33#[test]
44fn test_find_recent_config_change_ids() {
src/bootstrap/src/utils/channel.rs+1-1
......@@ -9,8 +9,8 @@ use std::fs;
99use std::path::Path;
1010
1111use super::helpers;
12use crate::utils::helpers::{output, t};
1312use crate::Build;
13use crate::utils::helpers::{output, t};
1414
1515#[derive(Clone, Default)]
1616pub enum GitInfo {
src/bootstrap/src/utils/helpers.rs+2-2
......@@ -12,10 +12,10 @@ use std::{env, fs, io, str};
1212
1313use build_helper::util::fail;
1414
15use crate::LldMode;
1516use crate::core::builder::Builder;
1617use crate::core::config::{Config, TargetSelection};
1718pub use crate::utils::shared_helpers::{dylib_path, dylib_path_var};
18use crate::LldMode;
1919
2020#[cfg(test)]
2121mod tests;
......@@ -46,7 +46,7 @@ macro_rules! t {
4646}
4747pub use t;
4848
49use crate::utils::exec::{command, BootstrapCommand};
49use crate::utils::exec::{BootstrapCommand, command};
5050
5151pub fn exe(name: &str, target: TargetSelection) -> String {
5252 crate::utils::shared_helpers::exe(name, &target.triple)
src/bootstrap/src/utils/helpers/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use std::fs::{self, remove_file, File};
1use std::fs::{self, File, remove_file};
22use std::io::Write;
33use std::path::PathBuf;
44
src/bootstrap/src/utils/job.rs+7-7
......@@ -43,19 +43,19 @@ mod for_windows {
4343 use std::ffi::c_void;
4444 use std::{env, io, mem};
4545
46 use windows::core::PCWSTR;
47 use windows::Win32::Foundation::{CloseHandle, DuplicateHandle, DUPLICATE_SAME_ACCESS, HANDLE};
46 use windows::Win32::Foundation::{CloseHandle, DUPLICATE_SAME_ACCESS, DuplicateHandle, HANDLE};
4847 use windows::Win32::System::Diagnostics::Debug::{
49 SetErrorMode, SEM_NOGPFAULTERRORBOX, THREAD_ERROR_MODE,
48 SEM_NOGPFAULTERRORBOX, SetErrorMode, THREAD_ERROR_MODE,
5049 };
5150 use windows::Win32::System::JobObjects::{
52 AssignProcessToJobObject, CreateJobObjectW, JobObjectExtendedLimitInformation,
53 SetInformationJobObject, JOBOBJECT_EXTENDED_LIMIT_INFORMATION,
54 JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, JOB_OBJECT_LIMIT_PRIORITY_CLASS,
51 AssignProcessToJobObject, CreateJobObjectW, JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,
52 JOB_OBJECT_LIMIT_PRIORITY_CLASS, JOBOBJECT_EXTENDED_LIMIT_INFORMATION,
53 JobObjectExtendedLimitInformation, SetInformationJobObject,
5554 };
5655 use windows::Win32::System::Threading::{
57 GetCurrentProcess, OpenProcess, BELOW_NORMAL_PRIORITY_CLASS, PROCESS_DUP_HANDLE,
56 BELOW_NORMAL_PRIORITY_CLASS, GetCurrentProcess, OpenProcess, PROCESS_DUP_HANDLE,
5857 };
58 use windows::core::PCWSTR;
5959
6060 use crate::Build;
6161
src/bootstrap/src/utils/metrics.rs+1-1
......@@ -15,9 +15,9 @@ use build_helper::metrics::{
1515};
1616use sysinfo::{CpuRefreshKind, RefreshKind, System};
1717
18use crate::Build;
1819use crate::core::builder::{Builder, Step};
1920use crate::utils::helpers::t;
20use crate::Build;
2121
2222// Update this number whenever a breaking change is made to the build metrics.
2323//
src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs+1-1
......@@ -6,7 +6,7 @@
66
77use core::{panic, ptr};
88
9use r_efi::efi::{Char16, Handle, Status, SystemTable, RESET_SHUTDOWN};
9use r_efi::efi::{Char16, Handle, RESET_SHUTDOWN, Status, SystemTable};
1010
1111#[panic_handler]
1212fn panic_handler(_info: &panic::PanicInfo) -> ! {
src/etc/test-float-parse/src/gen/fuzz.rs+3-3
......@@ -1,14 +1,14 @@
1use std::any::{type_name, TypeId};
1use std::any::{TypeId, type_name};
22use std::collections::BTreeMap;
33use std::fmt::Write;
44use std::marker::PhantomData;
55use std::ops::Range;
66use std::sync::Mutex;
77
8use rand::distributions::{Distribution, Standard};
98use rand::Rng;
10use rand_chacha::rand_core::SeedableRng;
9use rand::distributions::{Distribution, Standard};
1110use rand_chacha::ChaCha8Rng;
11use rand_chacha::rand_core::SeedableRng;
1212
1313use crate::{Float, Generator, Int, SEED};
1414
src/etc/test-float-parse/src/lib.rs+2-2
......@@ -2,12 +2,12 @@ mod traits;
22mod ui;
33mod validate;
44
5use std::any::{type_name, TypeId};
5use std::any::{TypeId, type_name};
66use std::cmp::min;
77use std::ops::RangeInclusive;
88use std::process::ExitCode;
99use std::sync::atomic::{AtomicU64, Ordering};
10use std::sync::{mpsc, OnceLock};
10use std::sync::{OnceLock, mpsc};
1111use std::{fmt, time};
1212
1313use indicatif::{MultiProgress, ProgressBar};
src/etc/test-float-parse/src/traits.rs+1-1
......@@ -3,8 +3,8 @@
33use std::str::FromStr;
44use std::{fmt, ops};
55
6use num::bigint::ToBigInt;
76use num::Integer;
7use num::bigint::ToBigInt;
88
99use crate::validate::Constants;
1010
src/librustdoc/clean/auto_trait.rs+3-3
......@@ -4,14 +4,14 @@ use rustc_infer::infer::region_constraints::{Constraint, RegionConstraintData};
44use rustc_middle::bug;
55use rustc_middle::ty::{self, Region, Ty};
66use rustc_span::def_id::DefId;
7use rustc_span::symbol::{kw, Symbol};
7use rustc_span::symbol::{Symbol, kw};
88use rustc_trait_selection::traits::auto_trait::{self, RegionTarget};
99use thin_vec::ThinVec;
1010use tracing::{debug, instrument};
1111
1212use crate::clean::{
13 self, clean_generic_param_def, clean_middle_ty, clean_predicate,
14 clean_trait_ref_with_constraints, clean_ty_generics, simplify, Lifetime,
13 self, Lifetime, clean_generic_param_def, clean_middle_ty, clean_predicate,
14 clean_trait_ref_with_constraints, clean_ty_generics, simplify,
1515};
1616use crate::core::DocContext;
1717
src/librustdoc/clean/blanket_impl.rs+1-1
......@@ -2,8 +2,8 @@ use rustc_hir as hir;
22use rustc_infer::infer::{DefineOpaqueTypes, InferOk, TyCtxtInferExt};
33use rustc_infer::traits;
44use rustc_middle::ty::{self, Upcast};
5use rustc_span::def_id::DefId;
65use rustc_span::DUMMY_SP;
6use rustc_span::def_id::DefId;
77use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
88use thin_vec::ThinVec;
99use tracing::{debug, instrument, trace};
src/librustdoc/clean/cfg.rs+1-1
......@@ -10,8 +10,8 @@ use rustc_ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem};
1010use rustc_data_structures::fx::FxHashSet;
1111use rustc_feature::Features;
1212use rustc_session::parse::ParseSess;
13use rustc_span::symbol::{sym, Symbol};
1413use rustc_span::Span;
14use rustc_span::symbol::{Symbol, sym};
1515
1616use crate::html::escape::Escape;
1717
src/librustdoc/clean/cfg/tests.rs+16-17
......@@ -1,6 +1,6 @@
11use rustc_ast::{MetaItemLit, Path, Safety, StrStyle};
2use rustc_span::symbol::{kw, Ident};
3use rustc_span::{create_default_session_globals_then, DUMMY_SP};
2use rustc_span::symbol::{Ident, kw};
3use rustc_span::{DUMMY_SP, create_default_session_globals_then};
44use thin_vec::thin_vec;
55
66use super::*;
......@@ -267,13 +267,10 @@ fn test_parse_ok() {
267267 let mi = dummy_meta_item_list!(not, [a]);
268268 assert_eq!(Cfg::parse(&mi), Ok(!word_cfg("a")));
269269
270 let mi = dummy_meta_item_list!(
271 not,
272 [dummy_meta_item_list!(
273 any,
274 [dummy_meta_item_word("a"), dummy_meta_item_list!(all, [b, c]),]
275 ),]
276 );
270 let mi = dummy_meta_item_list!(not, [dummy_meta_item_list!(any, [
271 dummy_meta_item_word("a"),
272 dummy_meta_item_list!(all, [b, c]),
273 ]),]);
277274 assert_eq!(Cfg::parse(&mi), Ok(!(word_cfg("a") | (word_cfg("b") & word_cfg("c")))));
278275
279276 let mi = dummy_meta_item_list!(all, [a, b, c]);
......@@ -296,16 +293,18 @@ fn test_parse_err() {
296293 let mi = dummy_meta_item_list!(foo, []);
297294 assert!(Cfg::parse(&mi).is_err());
298295
299 let mi = dummy_meta_item_list!(
300 all,
301 [dummy_meta_item_list!(foo, []), dummy_meta_item_word("b"),]
302 );
296 let mi =
297 dummy_meta_item_list!(
298 all,
299 [dummy_meta_item_list!(foo, []), dummy_meta_item_word("b"),]
300 );
303301 assert!(Cfg::parse(&mi).is_err());
304302
305 let mi = dummy_meta_item_list!(
306 any,
307 [dummy_meta_item_word("a"), dummy_meta_item_list!(foo, []),]
308 );
303 let mi =
304 dummy_meta_item_list!(
305 any,
306 [dummy_meta_item_word("a"), dummy_meta_item_list!(foo, []),]
307 );
309308 assert!(Cfg::parse(&mi).is_err());
310309
311310 let mi = dummy_meta_item_list!(not, [dummy_meta_item_list!(foo, []),]);
src/librustdoc/clean/inline.rs+7-7
......@@ -4,25 +4,25 @@ use std::iter::once;
44use std::sync::Arc;
55
66use rustc_data_structures::fx::FxHashSet;
7use rustc_hir::Mutability;
78use rustc_hir::def::{DefKind, Res};
89use rustc_hir::def_id::{DefId, DefIdSet, LocalDefId, LocalModDefId};
9use rustc_hir::Mutability;
1010use rustc_metadata::creader::{CStore, LoadedMacro};
1111use rustc_middle::ty::fast_reject::SimplifiedType;
1212use rustc_middle::ty::{self, TyCtxt};
1313use rustc_span::def_id::LOCAL_CRATE;
1414use rustc_span::hygiene::MacroKind;
15use rustc_span::symbol::{sym, Symbol};
16use thin_vec::{thin_vec, ThinVec};
15use rustc_span::symbol::{Symbol, sym};
16use thin_vec::{ThinVec, thin_vec};
1717use tracing::{debug, trace};
1818use {rustc_ast as ast, rustc_hir as hir};
1919
2020use super::Item;
2121use crate::clean::{
22 self, clean_bound_vars, clean_generics, clean_impl_item, clean_middle_assoc_item,
23 clean_middle_field, clean_middle_ty, clean_poly_fn_sig, clean_trait_ref_with_constraints,
24 clean_ty, clean_ty_alias_inner_type, clean_ty_generics, clean_variant_def, utils, Attributes,
25 AttributesExt, ImplKind, ItemId, Type,
22 self, Attributes, AttributesExt, ImplKind, ItemId, Type, clean_bound_vars, clean_generics,
23 clean_impl_item, clean_middle_assoc_item, clean_middle_field, clean_middle_ty,
24 clean_poly_fn_sig, clean_trait_ref_with_constraints, clean_ty, clean_ty_alias_inner_type,
25 clean_ty_generics, clean_variant_def, utils,
2626};
2727use crate::core::DocContext;
2828use crate::formats::item_type::ItemType;
src/librustdoc/clean/mod.rs+34-45
......@@ -38,18 +38,18 @@ use rustc_ast::token::{Token, TokenKind};
3838use rustc_ast::tokenstream::{TokenStream, TokenTree};
3939use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet, IndexEntry};
4040use rustc_errors::codes::*;
41use rustc_errors::{struct_span_code_err, FatalError};
42use rustc_hir::def::{CtorKind, DefKind, Res};
43use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LocalDefId, LOCAL_CRATE};
41use rustc_errors::{FatalError, struct_span_code_err};
4442use rustc_hir::PredicateOrigin;
43use rustc_hir::def::{CtorKind, DefKind, Res};
44use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LOCAL_CRATE, LocalDefId};
4545use rustc_hir_analysis::lower_ty;
4646use rustc_middle::metadata::Reexport;
4747use rustc_middle::middle::resolve_bound_vars as rbv;
4848use rustc_middle::ty::{self, AdtKind, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt};
4949use rustc_middle::{bug, span_bug};
50use rustc_span::hygiene::{AstPass, MacroKind};
51use rustc_span::symbol::{kw, sym, Ident, Symbol};
5250use rustc_span::ExpnKind;
51use rustc_span::hygiene::{AstPass, MacroKind};
52use rustc_span::symbol::{Ident, Symbol, kw, sym};
5353use rustc_trait_selection::traits::wf::object_region_bounds;
5454use thin_vec::ThinVec;
5555use tracing::{debug, instrument};
......@@ -536,18 +536,14 @@ fn clean_generic_param_def(
536536 } else {
537537 None
538538 };
539 (
540 def.name,
541 GenericParamDefKind::Type {
542 bounds: ThinVec::new(), // These are filled in from the where-clauses.
543 default: default.map(Box::new),
544 synthetic,
545 },
546 )
539 (def.name, GenericParamDefKind::Type {
540 bounds: ThinVec::new(), // These are filled in from the where-clauses.
541 default: default.map(Box::new),
542 synthetic,
543 })
547544 }
548 ty::GenericParamDefKind::Const { has_default, synthetic, is_host_effect: _ } => (
549 def.name,
550 GenericParamDefKind::Const {
545 ty::GenericParamDefKind::Const { has_default, synthetic, is_host_effect: _ } => {
546 (def.name, GenericParamDefKind::Const {
551547 ty: Box::new(clean_middle_ty(
552548 ty::Binder::dummy(
553549 cx.tcx
......@@ -569,8 +565,8 @@ fn clean_generic_param_def(
569565 None
570566 },
571567 synthetic,
572 },
573 ),
568 })
569 }
574570 };
575571
576572 GenericParamDef { name, def_id: def.def_id, kind }
......@@ -615,25 +611,21 @@ fn clean_generic_param<'tcx>(
615611 } else {
616612 ThinVec::new()
617613 };
618 (
619 param.name.ident().name,
620 GenericParamDefKind::Type {
621 bounds,
622 default: default.map(|t| clean_ty(t, cx)).map(Box::new),
623 synthetic,
624 },
625 )
614 (param.name.ident().name, GenericParamDefKind::Type {
615 bounds,
616 default: default.map(|t| clean_ty(t, cx)).map(Box::new),
617 synthetic,
618 })
626619 }
627 hir::GenericParamKind::Const { ty, default, synthetic, is_host_effect: _ } => (
628 param.name.ident().name,
629 GenericParamDefKind::Const {
620 hir::GenericParamKind::Const { ty, default, synthetic, is_host_effect: _ } => {
621 (param.name.ident().name, GenericParamDefKind::Const {
630622 ty: Box::new(clean_ty(ty, cx)),
631623 default: default.map(|ct| {
632624 Box::new(ty::Const::from_const_arg(cx.tcx, ct, ty::FeedConstTy::No).to_string())
633625 }),
634626 synthetic,
635 },
636 ),
627 })
628 }
637629 };
638630
639631 GenericParamDef { name, def_id: param.def_id.to_def_id(), kind }
......@@ -653,10 +645,9 @@ fn is_impl_trait(param: &hir::GenericParam<'_>) -> bool {
653645///
654646/// See `lifetime_to_generic_param` in `rustc_ast_lowering` for more information.
655647fn is_elided_lifetime(param: &hir::GenericParam<'_>) -> bool {
656 matches!(
657 param.kind,
658 hir::GenericParamKind::Lifetime { kind: hir::LifetimeParamKind::Elided(_) }
659 )
648 matches!(param.kind, hir::GenericParamKind::Lifetime {
649 kind: hir::LifetimeParamKind::Elided(_)
650 })
660651}
661652
662653pub(crate) fn clean_generics<'tcx>(
......@@ -1055,10 +1046,11 @@ fn clean_fn_decl_legacy_const_generics(func: &mut Function, attrs: &[ast::Attrib
10551046 ..
10561047 } = param
10571048 {
1058 func.decl
1059 .inputs
1060 .values
1061 .insert(a.get() as _, Argument { name, type_: *ty, is_const: true });
1049 func.decl.inputs.values.insert(a.get() as _, Argument {
1050 name,
1051 type_: *ty,
1052 is_const: true,
1053 });
10621054 } else {
10631055 panic!("unexpected non const in position {pos}");
10641056 }
......@@ -1402,15 +1394,12 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
14021394 let bounds = tcx.explicit_item_bounds(assoc_item.def_id).iter_identity_copied();
14031395 predicates = tcx.arena.alloc_from_iter(bounds.chain(predicates.iter().copied()));
14041396 }
1405 let mut generics = clean_ty_generics(
1406 cx,
1407 tcx.generics_of(assoc_item.def_id),
1408 ty::GenericPredicates {
1397 let mut generics =
1398 clean_ty_generics(cx, tcx.generics_of(assoc_item.def_id), ty::GenericPredicates {
14091399 parent: None,
14101400 predicates,
14111401 effects_min_tys: ty::List::empty(),
1412 },
1413 );
1402 });
14141403 simplify::move_bounds_to_generic_parameters(&mut generics);
14151404
14161405 if let ty::TraitContainer = assoc_item.container {
src/librustdoc/clean/render_macro_matchers.rs+2-2
......@@ -1,11 +1,11 @@
11use rustc_ast::token::{self, BinOpToken, Delimiter, IdentIsRaw};
22use rustc_ast::tokenstream::{TokenStream, TokenTree};
3use rustc_ast_pretty::pprust::state::State as Printer;
43use rustc_ast_pretty::pprust::PrintState;
4use rustc_ast_pretty::pprust::state::State as Printer;
55use rustc_middle::ty::TyCtxt;
66use rustc_session::parse::ParseSess;
7use rustc_span::symbol::{kw, Ident, Symbol};
87use rustc_span::Span;
8use rustc_span::symbol::{Ident, Symbol, kw};
99
1010/// Render a macro matcher in a format suitable for displaying to the user
1111/// as part of an item declaration.
src/librustdoc/clean/types.rs+13-9
......@@ -12,7 +12,7 @@ use rustc_attr::{ConstStability, Deprecation, Stability, StabilityLevel, StableS
1212use rustc_const_eval::const_eval::is_unstable_const_fn;
1313use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1414use rustc_hir::def::{CtorKind, DefKind, Res};
15use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE};
15use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE, LocalDefId};
1616use rustc_hir::lang_items::LangItem;
1717use rustc_hir::{BodyId, Mutability};
1818use rustc_hir_analysis::check::intrinsic::intrinsic_operation_unsafety;
......@@ -22,12 +22,12 @@ use rustc_middle::span_bug;
2222use rustc_middle::ty::fast_reject::SimplifiedType;
2323use rustc_middle::ty::{self, TyCtxt, Visibility};
2424use rustc_resolve::rustdoc::{
25 add_doc_fragment, attrs_to_doc_fragments, inner_docs, span_of_fragments, DocFragment,
25 DocFragment, add_doc_fragment, attrs_to_doc_fragments, inner_docs, span_of_fragments,
2626};
2727use rustc_session::Session;
2828use rustc_span::hygiene::MacroKind;
29use rustc_span::symbol::{kw, sym, Ident, Symbol};
30use rustc_span::{FileName, Loc, DUMMY_SP};
29use rustc_span::symbol::{Ident, Symbol, kw, sym};
30use rustc_span::{DUMMY_SP, FileName, Loc};
3131use rustc_target::abi::VariantIdx;
3232use rustc_target::spec::abi::Abi;
3333use thin_vec::ThinVec;
......@@ -1064,10 +1064,14 @@ impl AttributesExt for [ast::Attribute] {
10641064}
10651065
10661066impl AttributesExt for [(Cow<'_, ast::Attribute>, Option<DefId>)] {
1067 type AttributeIterator<'a> = impl Iterator<Item = ast::NestedMetaItem> + 'a
1068 where Self: 'a;
1069 type Attributes<'a> = impl Iterator<Item = &'a ast::Attribute> + 'a
1070 where Self: 'a;
1067 type AttributeIterator<'a>
1068 = impl Iterator<Item = ast::NestedMetaItem> + 'a
1069 where
1070 Self: 'a;
1071 type Attributes<'a>
1072 = impl Iterator<Item = &'a ast::Attribute> + 'a
1073 where
1074 Self: 'a;
10711075
10721076 fn lists(&self, name: Symbol) -> Self::AttributeIterator<'_> {
10731077 AttributesExt::iter(self)
......@@ -1809,8 +1813,8 @@ impl PrimitiveType {
18091813 }
18101814
18111815 pub(crate) fn simplified_types() -> &'static SimplifiedTypes {
1812 use ty::{FloatTy, IntTy, UintTy};
18131816 use PrimitiveType::*;
1817 use ty::{FloatTy, IntTy, UintTy};
18141818 static CELL: OnceCell<SimplifiedTypes> = OnceCell::new();
18151819
18161820 let single = |x| iter::once(x).collect();
src/librustdoc/clean/types/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use rustc_resolve::rustdoc::{unindent_doc_fragments, DocFragmentKind};
1use rustc_resolve::rustdoc::{DocFragmentKind, unindent_doc_fragments};
22use rustc_span::create_default_session_globals_then;
33
44use super::*;
src/librustdoc/clean/utils.rs+5-5
......@@ -5,12 +5,12 @@ use std::sync::LazyLock as Lazy;
55
66use rustc_ast::tokenstream::TokenTree;
77use rustc_hir::def::{DefKind, Res};
8use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
8use rustc_hir::def_id::{DefId, LOCAL_CRATE, LocalDefId};
99use rustc_metadata::rendered_const;
1010use rustc_middle::mir;
1111use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, TyCtxt, TypeVisitableExt};
12use rustc_span::symbol::{kw, sym, Symbol};
13use thin_vec::{thin_vec, ThinVec};
12use rustc_span::symbol::{Symbol, kw, sym};
13use thin_vec::{ThinVec, thin_vec};
1414use tracing::{debug, warn};
1515use {rustc_ast as ast, rustc_hir as hir};
1616
......@@ -18,10 +18,10 @@ use crate::clean::auto_trait::synthesize_auto_trait_impls;
1818use crate::clean::blanket_impl::synthesize_blanket_impls;
1919use crate::clean::render_macro_matchers::render_macro_matcher;
2020use crate::clean::{
21 clean_doc_module, clean_middle_const, clean_middle_region, clean_middle_ty, inline,
2221 AssocItemConstraint, AssocItemConstraintKind, Crate, ExternalCrate, Generic, GenericArg,
2322 GenericArgs, ImportSource, Item, ItemKind, Lifetime, Path, PathSegment, Primitive,
24 PrimitiveType, Term, Type,
23 PrimitiveType, Term, Type, clean_doc_module, clean_middle_const, clean_middle_region,
24 clean_middle_ty, inline,
2525};
2626use crate::core::DocContext;
2727use crate::html::format::visibility_to_src_with_space;
src/librustdoc/config.rs+5-5
......@@ -8,15 +8,15 @@ use std::{fmt, io};
88use rustc_data_structures::fx::FxHashMap;
99use rustc_errors::DiagCtxtHandle;
1010use rustc_session::config::{
11 self, get_cmd_lint_options, nightly_options, parse_crate_types_from_list, parse_externs,
12 parse_target_triple, CodegenOptions, CrateType, ErrorOutputType, Externs, Input,
13 JsonUnusedExterns, UnstableOptions,
11 self, CodegenOptions, CrateType, ErrorOutputType, Externs, Input, JsonUnusedExterns,
12 UnstableOptions, get_cmd_lint_options, nightly_options, parse_crate_types_from_list,
13 parse_externs, parse_target_triple,
1414};
1515use rustc_session::lint::Level;
1616use rustc_session::search_paths::SearchPath;
17use rustc_session::{getopts, EarlyDiagCtxt};
18use rustc_span::edition::Edition;
17use rustc_session::{EarlyDiagCtxt, getopts};
1918use rustc_span::FileName;
19use rustc_span::edition::Edition;
2020use rustc_target::spec::TargetTriple;
2121
2222use crate::core::new_dcx;
src/librustdoc/core.rs+4-4
......@@ -8,7 +8,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
88use rustc_data_structures::sync::Lrc;
99use rustc_data_structures::unord::UnordSet;
1010use rustc_errors::codes::*;
11use rustc_errors::emitter::{stderr_destination, DynEmitter, HumanEmitter};
11use rustc_errors::emitter::{DynEmitter, HumanEmitter, stderr_destination};
1212use rustc_errors::json::JsonEmitter;
1313use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, TerminalUrl};
1414use rustc_feature::UnstableFeatures;
......@@ -17,14 +17,14 @@ use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LocalDefId};
1717use rustc_hir::intravisit::{self, Visitor};
1818use rustc_hir::{HirId, Path};
1919use rustc_interface::interface;
20use rustc_lint::{late_lint_mod, MissingDoc};
20use rustc_lint::{MissingDoc, late_lint_mod};
2121use rustc_middle::hir::nested_filter;
2222use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
2323use rustc_session::config::{self, CrateType, ErrorOutputType, Input, ResolveDocLinks};
2424pub(crate) use rustc_session::config::{Options, UnstableOptions};
25use rustc_session::{lint, Session};
25use rustc_session::{Session, lint};
2626use rustc_span::symbol::sym;
27use rustc_span::{source_map, Span};
27use rustc_span::{Span, source_map};
2828use tracing::{debug, info};
2929
3030use crate::clean::inline::build_external_trait;
src/librustdoc/doctest.rs+2-2
......@@ -16,14 +16,14 @@ pub(crate) use markdown::test as test_markdown;
1616use rustc_ast as ast;
1717use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1818use rustc_errors::{ColorConfig, DiagCtxtHandle, ErrorGuaranteed, FatalError};
19use rustc_hir::def_id::LOCAL_CRATE;
2019use rustc_hir::CRATE_HIR_ID;
20use rustc_hir::def_id::LOCAL_CRATE;
2121use rustc_interface::interface;
2222use rustc_session::config::{self, CrateType, ErrorOutputType, Input};
2323use rustc_session::lint;
24use rustc_span::FileName;
2425use rustc_span::edition::Edition;
2526use rustc_span::symbol::sym;
26use rustc_span::FileName;
2727use rustc_target::spec::{Target, TargetTriple};
2828use tempfile::{Builder as TempFileBuilder, TempDir};
2929use tracing::debug;
src/librustdoc/doctest/make.rs+3-3
......@@ -10,10 +10,10 @@ use rustc_errors::{ColorConfig, FatalError};
1010use rustc_parse::new_parser_from_source_str;
1111use rustc_parse::parser::attr::InnerAttrPolicy;
1212use rustc_session::parse::ParseSess;
13use rustc_span::FileName;
1314use rustc_span::edition::Edition;
1415use rustc_span::source_map::SourceMap;
1516use rustc_span::symbol::sym;
16use rustc_span::FileName;
1717use tracing::debug;
1818
1919use super::GlobalTestOptions;
......@@ -252,8 +252,8 @@ fn parse_source(
252252 info: &mut ParseSourceInfo,
253253 crate_name: &Option<&str>,
254254) -> ParsingResult {
255 use rustc_errors::emitter::{Emitter, HumanEmitter};
256255 use rustc_errors::DiagCtxt;
256 use rustc_errors::emitter::{Emitter, HumanEmitter};
257257 use rustc_parse::parser::ForceCollect;
258258 use rustc_span::source_map::FilePathMapping;
259259
......@@ -441,8 +441,8 @@ fn check_if_attr_is_complete(source: &str, edition: Edition) -> Option<AttrKind>
441441
442442 rustc_driver::catch_fatal_errors(|| {
443443 rustc_span::create_session_if_not_set_then(edition, |_| {
444 use rustc_errors::emitter::HumanEmitter;
445444 use rustc_errors::DiagCtxt;
445 use rustc_errors::emitter::HumanEmitter;
446446 use rustc_span::source_map::FilePathMapping;
447447
448448 let filename = FileName::anon_source_code(source);
src/librustdoc/doctest/markdown.rs+2-2
......@@ -8,10 +8,10 @@ use rustc_span::FileName;
88use tempfile::tempdir;
99
1010use super::{
11 generate_args_file, CreateRunnableDocTests, DocTestVisitor, GlobalTestOptions, ScrapedDocTest,
11 CreateRunnableDocTests, DocTestVisitor, GlobalTestOptions, ScrapedDocTest, generate_args_file,
1212};
1313use crate::config::Options;
14use crate::html::markdown::{find_testable_code, ErrorCodes, LangString, MdRelLine};
14use crate::html::markdown::{ErrorCodes, LangString, MdRelLine, find_testable_code};
1515
1616struct MdCollector {
1717 tests: Vec<ScrapedDocTest>,
src/librustdoc/doctest/runner.rs+2-2
......@@ -4,8 +4,8 @@ use rustc_data_structures::fx::FxHashSet;
44use rustc_span::edition::Edition;
55
66use crate::doctest::{
7 run_test, DocTestBuilder, GlobalTestOptions, IndividualTestOptions, RunnableDocTest,
8 RustdocOptions, ScrapedDocTest, TestFailure, UnusedExterns,
7 DocTestBuilder, GlobalTestOptions, IndividualTestOptions, RunnableDocTest, RustdocOptions,
8 ScrapedDocTest, TestFailure, UnusedExterns, run_test,
99};
1010use crate::html::markdown::{Ignore, LangString};
1111
src/librustdoc/doctest/rust.rs+4-4
......@@ -4,19 +4,19 @@ use std::env;
44
55use rustc_data_structures::fx::FxHashSet;
66use rustc_data_structures::sync::Lrc;
7use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
8use rustc_hir::{self as hir, intravisit, CRATE_HIR_ID};
7use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
8use rustc_hir::{self as hir, CRATE_HIR_ID, intravisit};
99use rustc_middle::hir::map::Map;
1010use rustc_middle::hir::nested_filter;
1111use rustc_middle::ty::TyCtxt;
1212use rustc_resolve::rustdoc::span_of_fragments;
1313use rustc_session::Session;
1414use rustc_span::source_map::SourceMap;
15use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP};
15use rustc_span::{BytePos, DUMMY_SP, FileName, Pos, Span};
1616
1717use super::{DocTestVisitor, ScrapedDocTest};
18use crate::clean::types::AttributesExt;
1918use crate::clean::Attributes;
19use crate::clean::types::AttributesExt;
2020use crate::html::markdown::{self, ErrorCodes, LangString, MdRelLine};
2121
2222struct RustCollector {
src/librustdoc/formats/cache.rs+2-2
......@@ -10,12 +10,12 @@ use crate::clean::types::ExternalLocation;
1010use crate::clean::{self, ExternalCrate, ItemId, PrimitiveType};
1111use crate::core::DocContext;
1212use crate::fold::DocFolder;
13use crate::formats::item_type::ItemType;
1413use crate::formats::Impl;
14use crate::formats::item_type::ItemType;
1515use crate::html::format::join_with_double_colon;
1616use crate::html::markdown::short_markdown_summary;
17use crate::html::render::search_index::get_function_type_for_search;
1817use crate::html::render::IndexItem;
18use crate::html::render::search_index::get_function_type_for_search;
1919use crate::visit_lib::RustdocEffectiveVisibilities;
2020
2121/// This cache is used to store information about the [`clean::Crate`] being
src/librustdoc/formats/mod.rs+1-1
......@@ -2,7 +2,7 @@ pub(crate) mod cache;
22pub(crate) mod item_type;
33pub(crate) mod renderer;
44
5pub(crate) use renderer::{run_format, FormatRenderer};
5pub(crate) use renderer::{FormatRenderer, run_format};
66use rustc_hir::def_id::DefId;
77
88use crate::clean::{self, ItemId};
src/librustdoc/html/format.rs+2-2
......@@ -22,12 +22,12 @@ use rustc_metadata::creader::{CStore, LoadedMacro};
2222use rustc_middle::ty;
2323use rustc_middle::ty::TyCtxt;
2424use rustc_span::symbol::kw;
25use rustc_span::{sym, Symbol};
25use rustc_span::{Symbol, sym};
2626use rustc_target::spec::abi::Abi;
2727use tracing::{debug, trace};
2828use {rustc_ast as ast, rustc_hir as hir};
2929
30use super::url_parts_builder::{estimate_item_path_byte_length, UrlPartsBuilder};
30use super::url_parts_builder::{UrlPartsBuilder, estimate_item_path_byte_length};
3131use crate::clean::types::ExternalLocation;
3232use crate::clean::utils::find_nearest_parent_module;
3333use crate::clean::{self, ExternalCrate, PrimitiveType};
src/librustdoc/html/highlight.rs+18-26
......@@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxHashMap;
1212use rustc_lexer::{Cursor, LiteralKind, TokenKind};
1313use rustc_span::edition::Edition;
1414use rustc_span::symbol::Symbol;
15use rustc_span::{BytePos, Span, DUMMY_SP};
15use rustc_span::{BytePos, DUMMY_SP, Span};
1616
1717use super::format::{self, Buffer};
1818use crate::clean::PrimitiveType;
......@@ -72,34 +72,26 @@ fn write_header(
7272 tooltip: Tooltip,
7373 extra_classes: &[String],
7474) {
75 write!(
76 out,
77 "<div class=\"example-wrap{}\">",
78 match tooltip {
79 Tooltip::Ignore => " ignore",
80 Tooltip::CompileFail => " compile_fail",
81 Tooltip::ShouldPanic => " should_panic",
82 Tooltip::Edition(_) => " edition",
83 Tooltip::None => "",
84 },
85 );
75 write!(out, "<div class=\"example-wrap{}\">", match tooltip {
76 Tooltip::Ignore => " ignore",
77 Tooltip::CompileFail => " compile_fail",
78 Tooltip::ShouldPanic => " should_panic",
79 Tooltip::Edition(_) => " edition",
80 Tooltip::None => "",
81 },);
8682
8783 if tooltip != Tooltip::None {
8884 let edition_code;
89 write!(
90 out,
91 "<a href=\"#\" class=\"tooltip\" title=\"{}\">ⓘ</a>",
92 match tooltip {
93 Tooltip::Ignore => "This example is not tested",
94 Tooltip::CompileFail => "This example deliberately fails to compile",
95 Tooltip::ShouldPanic => "This example panics",
96 Tooltip::Edition(edition) => {
97 edition_code = format!("This example runs with edition {edition}");
98 &edition_code
99 }
100 Tooltip::None => unreachable!(),
101 },
102 );
85 write!(out, "<a href=\"#\" class=\"tooltip\" title=\"{}\">ⓘ</a>", match tooltip {
86 Tooltip::Ignore => "This example is not tested",
87 Tooltip::CompileFail => "This example deliberately fails to compile",
88 Tooltip::ShouldPanic => "This example panics",
89 Tooltip::Edition(edition) => {
90 edition_code = format!("This example runs with edition {edition}");
91 &edition_code
92 }
93 Tooltip::None => unreachable!(),
94 },);
10395 }
10496
10597 if let Some(extra) = extra_content {
src/librustdoc/html/highlight/tests.rs+1-1
......@@ -2,7 +2,7 @@ use expect_test::expect_file;
22use rustc_data_structures::fx::FxHashMap;
33use rustc_span::create_default_session_globals_then;
44
5use super::{write_code, DecorationInfo};
5use super::{DecorationInfo, write_code};
66use crate::html::format::Buffer;
77
88const STYLE: &str = r#"
src/librustdoc/html/layout.rs+2-2
......@@ -3,10 +3,10 @@ use std::path::PathBuf;
33use rinja::Template;
44use rustc_data_structures::fx::FxHashMap;
55
6use super::static_files::{StaticFiles, STATIC_FILES};
6use super::static_files::{STATIC_FILES, StaticFiles};
77use crate::externalfiles::ExternalHtml;
88use crate::html::format::{Buffer, Print};
9use crate::html::render::{ensure_trailing_slash, StylePath};
9use crate::html::render::{StylePath, ensure_trailing_slash};
1010
1111#[derive(Clone)]
1212pub(crate) struct Layout {
src/librustdoc/html/markdown.rs+2-2
......@@ -35,8 +35,8 @@ use std::str::{self, CharIndices};
3535use std::sync::OnceLock;
3636
3737use pulldown_cmark::{
38 html, BrokenLink, BrokenLinkCallback, CodeBlockKind, CowStr, Event, LinkType, OffsetIter,
39 Options, Parser, Tag, TagEnd,
38 BrokenLink, BrokenLinkCallback, CodeBlockKind, CowStr, Event, LinkType, OffsetIter, Options,
39 Parser, Tag, TagEnd, html,
4040};
4141use rustc_data_structures::fx::FxHashMap;
4242use rustc_errors::{Diag, DiagMessage};
src/librustdoc/html/markdown/tests.rs+11-11
......@@ -1,8 +1,8 @@
1use rustc_span::edition::{Edition, DEFAULT_EDITION};
1use rustc_span::edition::{DEFAULT_EDITION, Edition};
22
33use super::{
4 find_testable_code, plain_text_summary, short_markdown_summary, ErrorCodes, HeadingOffset,
5 IdMap, Ignore, LangString, LangStringToken, Markdown, MarkdownItemInfo, TagIterator,
4 ErrorCodes, HeadingOffset, IdMap, Ignore, LangString, LangStringToken, Markdown,
5 MarkdownItemInfo, TagIterator, find_testable_code, plain_text_summary, short_markdown_summary,
66};
77
88#[test]
......@@ -275,14 +275,14 @@ fn test_lang_string_tokenizer() {
275275 case("foo", &[LangStringToken::LangToken("foo")]);
276276 case("foo,bar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]);
277277 case(".foo,.bar", &[]);
278 case(
279 "{.foo,.bar}",
280 &[LangStringToken::ClassAttribute("foo"), LangStringToken::ClassAttribute("bar")],
281 );
282 case(
283 " {.foo,.bar} ",
284 &[LangStringToken::ClassAttribute("foo"), LangStringToken::ClassAttribute("bar")],
285 );
278 case("{.foo,.bar}", &[
279 LangStringToken::ClassAttribute("foo"),
280 LangStringToken::ClassAttribute("bar"),
281 ]);
282 case(" {.foo,.bar} ", &[
283 LangStringToken::ClassAttribute("foo"),
284 LangStringToken::ClassAttribute("bar"),
285 ]);
286286 case("foo bar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]);
287287 case("foo\tbar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]);
288288 case("foo\t, bar", &[LangStringToken::LangToken("foo"), LangStringToken::LangToken("bar")]);
src/librustdoc/html/render/context.rs+7-7
......@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
33use std::io;
44use std::path::{Path, PathBuf};
55use std::rc::Rc;
6use std::sync::mpsc::{channel, Receiver};
6use std::sync::mpsc::{Receiver, channel};
77
88use rinja::Template;
99use rustc_data_structures::fx::{FxHashMap, FxHashSet};
......@@ -11,24 +11,24 @@ use rustc_hir::def_id::{DefIdMap, LOCAL_CRATE};
1111use rustc_middle::ty::TyCtxt;
1212use rustc_session::Session;
1313use rustc_span::edition::Edition;
14use rustc_span::{sym, FileName, Symbol};
14use rustc_span::{FileName, Symbol, sym};
1515use tracing::info;
1616
1717use super::print_item::{full_path, item_path, print_item};
18use super::sidebar::{print_sidebar, sidebar_module_like, ModuleLike, Sidebar};
19use super::{collect_spans_and_sources, scrape_examples_help, AllTypes, LinkFromSrc, StylePath};
18use super::sidebar::{ModuleLike, Sidebar, print_sidebar, sidebar_module_like};
19use super::{AllTypes, LinkFromSrc, StylePath, collect_spans_and_sources, scrape_examples_help};
2020use crate::clean::types::ExternalLocation;
2121use crate::clean::utils::has_doc_flag;
2222use crate::clean::{self, ExternalCrate};
2323use crate::config::{ModuleSorting, RenderOptions, ShouldMerge};
2424use crate::docfs::{DocFS, PathError};
2525use crate::error::Error;
26use crate::formats::FormatRenderer;
2627use crate::formats::cache::Cache;
2728use crate::formats::item_type::ItemType;
28use crate::formats::FormatRenderer;
2929use crate::html::escape::Escape;
30use crate::html::format::{join_with_double_colon, Buffer};
31use crate::html::markdown::{self, plain_text_summary, ErrorCodes, IdMap};
30use crate::html::format::{Buffer, join_with_double_colon};
31use crate::html::markdown::{self, ErrorCodes, IdMap, plain_text_summary};
3232use crate::html::render::write_shared::write_shared;
3333use crate::html::url_parts_builder::UrlPartsBuilder;
3434use crate::html::{layout, sources, static_files};
src/librustdoc/html/render/mod.rs+9-9
......@@ -48,30 +48,30 @@ use rinja::Template;
4848use rustc_attr::{ConstStability, DeprecatedSince, Deprecation, StabilityLevel, StableSince};
4949use rustc_data_structures::captures::Captures;
5050use rustc_data_structures::fx::{FxHashMap, FxHashSet};
51use rustc_hir::def_id::{DefId, DefIdSet};
5251use rustc_hir::Mutability;
52use rustc_hir::def_id::{DefId, DefIdSet};
5353use rustc_middle::ty::print::PrintTraitRefExt;
5454use rustc_middle::ty::{self, TyCtxt};
5555use rustc_session::RustcVersion;
56use rustc_span::symbol::{sym, Symbol};
57use rustc_span::{BytePos, FileName, RealFileName, DUMMY_SP};
56use rustc_span::symbol::{Symbol, sym};
57use rustc_span::{BytePos, DUMMY_SP, FileName, RealFileName};
5858use serde::ser::SerializeMap;
5959use serde::{Serialize, Serializer};
6060use tracing::{debug, info};
6161
6262pub(crate) use self::context::*;
63pub(crate) use self::span_map::{collect_spans_and_sources, LinkFromSrc};
63pub(crate) use self::span_map::{LinkFromSrc, collect_spans_and_sources};
6464pub(crate) use self::write_shared::*;
6565use crate::clean::{self, ItemId, RenderedLink};
6666use crate::error::Error;
67use crate::formats::Impl;
6768use crate::formats::cache::Cache;
6869use crate::formats::item_type::ItemType;
69use crate::formats::Impl;
7070use crate::html::escape::Escape;
7171use crate::html::format::{
72 display_fn, href, join_with_double_colon, print_abi_with_space, print_constness_with_space,
73 print_default_space, print_generic_bounds, print_where_clause, visibility_print_with_space,
74 Buffer, Ending, HrefError, PrintWithSpace,
72 Buffer, Ending, HrefError, PrintWithSpace, display_fn, href, join_with_double_colon,
73 print_abi_with_space, print_constness_with_space, print_default_space, print_generic_bounds,
74 print_where_clause, visibility_print_with_space,
7575};
7676use crate::html::markdown::{
7777 HeadingOffset, IdMap, Markdown, MarkdownItemInfo, MarkdownSummaryLine,
......@@ -79,7 +79,7 @@ use crate::html::markdown::{
7979use crate::html::static_files::SCRAPE_EXAMPLES_HELP_MD;
8080use crate::html::{highlight, sources};
8181use crate::scrape_examples::{CallData, CallLocation};
82use crate::{try_none, DOC_RUST_LANG_ORG_CHANNEL};
82use crate::{DOC_RUST_LANG_ORG_CHANNEL, try_none};
8383
8484pub(crate) fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
8585 crate::html::format::display_fn(move |f| {
src/librustdoc/html/render/print_item.rs+6-6
......@@ -13,27 +13,27 @@ use rustc_hir::def_id::DefId;
1313use rustc_index::IndexVec;
1414use rustc_middle::ty::{self, TyCtxt};
1515use rustc_span::hygiene::MacroKind;
16use rustc_span::symbol::{kw, sym, Symbol};
16use rustc_span::symbol::{Symbol, kw, sym};
1717use rustc_target::abi::VariantIdx;
1818use tracing::{debug, info};
1919
2020use super::type_layout::document_type_layout;
2121use super::{
22 AssocItemLink, AssocItemRender, Context, ImplRenderingParameters, RenderMode,
2223 collect_paths_for_type, document, ensure_trailing_slash, get_filtered_impls_for_reference,
2324 item_ty_to_section, notable_traits_button, notable_traits_json, render_all_impls,
2425 render_assoc_item, render_assoc_items, render_attributes_in_code, render_attributes_in_pre,
2526 render_impl, render_rightside, render_stability_since_raw,
26 render_stability_since_raw_with_extra, write_section_heading, AssocItemLink, AssocItemRender,
27 Context, ImplRenderingParameters, RenderMode,
27 render_stability_since_raw_with_extra, write_section_heading,
2828};
2929use crate::clean;
3030use crate::config::ModuleSorting;
31use crate::formats::item_type::ItemType;
3231use crate::formats::Impl;
32use crate::formats::item_type::ItemType;
3333use crate::html::escape::{Escape, EscapeBodyTextWithWbr};
3434use crate::html::format::{
35 display_fn, join_with_double_colon, print_abi_with_space, print_constness_with_space,
36 print_where_clause, visibility_print_with_space, Buffer, Ending, PrintWithSpace,
35 Buffer, Ending, PrintWithSpace, display_fn, join_with_double_colon, print_abi_with_space,
36 print_constness_with_space, print_where_clause, visibility_print_with_space,
3737};
3838use crate::html::highlight;
3939use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine};
src/librustdoc/html/render/search_index.rs+5-6
......@@ -8,7 +8,7 @@ use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
88use rustc_middle::ty::TyCtxt;
99use rustc_span::def_id::DefId;
1010use rustc_span::sym;
11use rustc_span::symbol::{kw, Symbol};
11use rustc_span::symbol::{Symbol, kw};
1212use serde::ser::{Serialize, SerializeSeq, SerializeStruct, Serializer};
1313use thin_vec::ThinVec;
1414use tracing::instrument;
......@@ -1169,14 +1169,13 @@ fn simplify_fn_type<'a, 'tcx>(
11691169 *stored_bounds = type_bounds;
11701170 }
11711171 }
1172 ty_constraints.push((
1173 RenderTypeId::AssociatedType(name),
1174 vec![RenderType {
1172 ty_constraints.push((RenderTypeId::AssociatedType(name), vec![
1173 RenderType {
11751174 id: Some(RenderTypeId::Index(idx)),
11761175 generics: None,
11771176 bindings: None,
1178 }],
1179 ))
1177 },
1178 ]))
11801179 }
11811180 }
11821181 }
src/librustdoc/html/render/sidebar.rs+2-2
......@@ -8,10 +8,10 @@ use rustc_hir::def_id::DefIdSet;
88use rustc_middle::ty::{self, TyCtxt};
99use tracing::debug;
1010
11use super::{item_ty_to_section, Context, ItemSection};
11use super::{Context, ItemSection, item_ty_to_section};
1212use crate::clean;
13use crate::formats::item_type::ItemType;
1413use crate::formats::Impl;
14use crate::formats::item_type::ItemType;
1515use crate::html::format::Buffer;
1616use crate::html::markdown::{IdMap, MarkdownWithToc};
1717
src/librustdoc/html/render/span_map.rs+1-1
......@@ -10,7 +10,7 @@ use rustc_middle::ty::TyCtxt;
1010use rustc_span::hygiene::MacroKind;
1111use rustc_span::{BytePos, ExpnKind, Span};
1212
13use crate::clean::{self, rustc_span, PrimitiveType};
13use crate::clean::{self, PrimitiveType, rustc_span};
1414use crate::html::sources;
1515
1616/// This enum allows us to store two different kinds of information:
src/librustdoc/html/render/write_shared.rs+5-5
......@@ -29,26 +29,26 @@ use itertools::Itertools;
2929use regex::Regex;
3030use rustc_data_structures::flock;
3131use rustc_data_structures::fx::{FxHashMap, FxHashSet};
32use rustc_middle::ty::fast_reject::DeepRejectCtxt;
3332use rustc_middle::ty::TyCtxt;
34use rustc_span::def_id::DefId;
33use rustc_middle::ty::fast_reject::DeepRejectCtxt;
3534use rustc_span::Symbol;
35use rustc_span::def_id::DefId;
3636use serde::de::DeserializeOwned;
3737use serde::ser::SerializeSeq;
3838use serde::{Deserialize, Serialize, Serializer};
3939
40use super::{collect_paths_for_type, ensure_trailing_slash, Context, RenderMode};
40use super::{Context, RenderMode, collect_paths_for_type, ensure_trailing_slash};
4141use crate::clean::{Crate, Item, ItemId, ItemKind};
4242use crate::config::{EmitType, PathToParts, RenderOptions, ShouldMerge};
4343use crate::docfs::PathError;
4444use crate::error::Error;
45use crate::formats::Impl;
4546use crate::formats::cache::Cache;
4647use crate::formats::item_type::ItemType;
47use crate::formats::Impl;
4848use crate::html::format::Buffer;
4949use crate::html::layout;
5050use crate::html::render::ordered_json::{EscapedJson, OrderedJson};
51use crate::html::render::search_index::{build_index, SerializedSearchIndex};
51use crate::html::render::search_index::{SerializedSearchIndex, build_index};
5252use crate::html::render::sorted_template::{self, FileFormat, SortedTemplate};
5353use crate::html::render::{AssocItemLink, ImplRenderingParameters, StylePath};
5454use crate::html::static_files::{self, suffix_path};
src/librustdoc/html/sources.rs+1-1
......@@ -10,7 +10,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1010use rustc_hir::def_id::LOCAL_CRATE;
1111use rustc_middle::ty::TyCtxt;
1212use rustc_session::Session;
13use rustc_span::{sym, FileName};
13use rustc_span::{FileName, sym};
1414use tracing::info;
1515
1616use crate::clean;
src/librustdoc/html/tests.rs+1-1
......@@ -1,4 +1,4 @@
1use rustc_span::{sym, Symbol};
1use rustc_span::{Symbol, sym};
22
33use crate::html::format::href_relative_parts;
44
src/librustdoc/json/conversions.rs+1-1
......@@ -19,8 +19,8 @@ use rustc_target::spec::abi::Abi as RustcAbi;
1919use rustdoc_json_types::*;
2020
2121use crate::clean::{self, ItemId};
22use crate::formats::item_type::ItemType;
2322use crate::formats::FormatRenderer;
23use crate::formats::item_type::ItemType;
2424use crate::json::JsonRenderer;
2525use crate::passes::collect_intra_doc_links::UrlFragment;
2626
src/librustdoc/json/mod.rs+16-22
......@@ -8,8 +8,8 @@ mod conversions;
88mod import_finder;
99
1010use std::cell::RefCell;
11use std::fs::{create_dir_all, File};
12use std::io::{stdout, BufWriter, Write};
11use std::fs::{File, create_dir_all};
12use std::io::{BufWriter, Write, stdout};
1313use std::path::PathBuf;
1414use std::rc::Rc;
1515
......@@ -24,14 +24,14 @@ use rustdoc_json_types as types;
2424use rustdoc_json_types::FxHashMap;
2525use tracing::{debug, trace};
2626
27use crate::clean::types::{ExternalCrate, ExternalLocation};
2827use crate::clean::ItemKind;
28use crate::clean::types::{ExternalCrate, ExternalLocation};
2929use crate::config::RenderOptions;
3030use crate::docfs::PathError;
3131use crate::error::Error;
32use crate::formats::cache::Cache;
3332use crate::formats::FormatRenderer;
34use crate::json::conversions::{id_from_item, id_from_item_default, IntoWithTcx};
33use crate::formats::cache::Cache;
34use crate::json::conversions::{IntoWithTcx, id_from_item, id_from_item_default};
3535use crate::{clean, try_err};
3636
3737#[derive(Clone)]
......@@ -253,14 +253,11 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
253253 .iter()
254254 .chain(&self.cache.external_paths)
255255 .map(|(&k, &(ref path, kind))| {
256 (
257 id_from_item_default(k.into(), self.tcx),
258 types::ItemSummary {
259 crate_id: k.krate.as_u32(),
260 path: path.iter().map(|s| s.to_string()).collect(),
261 kind: kind.into_tcx(self.tcx),
262 },
263 )
256 (id_from_item_default(k.into(), self.tcx), types::ItemSummary {
257 crate_id: k.krate.as_u32(),
258 path: path.iter().map(|s| s.to_string()).collect(),
259 kind: kind.into_tcx(self.tcx),
260 })
264261 })
265262 .collect(),
266263 external_crates: self
......@@ -269,16 +266,13 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
269266 .iter()
270267 .map(|(crate_num, external_location)| {
271268 let e = ExternalCrate { crate_num: *crate_num };
272 (
273 crate_num.as_u32(),
274 types::ExternalCrate {
275 name: e.name(self.tcx).to_string(),
276 html_root_url: match external_location {
277 ExternalLocation::Remote(s) => Some(s.clone()),
278 _ => None,
279 },
269 (crate_num.as_u32(), types::ExternalCrate {
270 name: e.name(self.tcx).to_string(),
271 html_root_url: match external_location {
272 ExternalLocation::Remote(s) => Some(s.clone()),
273 _ => None,
280274 },
281 )
275 })
282276 })
283277 .collect(),
284278 format_version: types::FORMAT_VERSION,
src/librustdoc/lib.rs+3-3
......@@ -73,14 +73,14 @@ extern crate jemalloc_sys;
7373use std::env::{self, VarError};
7474use std::io::{self, IsTerminal};
7575use std::process;
76use std::sync::atomic::AtomicBool;
7776use std::sync::Arc;
77use std::sync::atomic::AtomicBool;
7878
7979use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, FatalError};
8080use rustc_interface::interface;
8181use rustc_middle::ty::TyCtxt;
82use rustc_session::config::{make_crate_type_option, ErrorOutputType, RustcOptGroup};
83use rustc_session::{getopts, EarlyDiagCtxt};
82use rustc_session::config::{ErrorOutputType, RustcOptGroup, make_crate_type_option};
83use rustc_session::{EarlyDiagCtxt, getopts};
8484use tracing::info;
8585
8686use crate::clean::utils::DOC_RUST_LANG_ORG_CHANNEL;
src/librustdoc/lint.rs+2-2
......@@ -2,8 +2,8 @@ use std::sync::LazyLock as Lazy;
22
33use rustc_data_structures::fx::FxHashMap;
44use rustc_lint::LintStore;
5use rustc_lint_defs::{declare_tool_lint, Lint, LintId};
6use rustc_session::{lint, Session};
5use rustc_lint_defs::{Lint, LintId, declare_tool_lint};
6use rustc_session::{Session, lint};
77
88/// This function is used to setup the lint initialization. By default, in rustdoc, everything
99/// is "allowed". Depending if we run in test mode or not, we want some of them to be at their
src/librustdoc/markdown.rs+1-1
......@@ -1,5 +1,5 @@
11use std::fmt::Write as _;
2use std::fs::{create_dir_all, read_to_string, File};
2use std::fs::{File, create_dir_all, read_to_string};
33use std::io::prelude::*;
44use std::path::Path;
55
src/librustdoc/passes/calculate_doc_coverage.rs+2-2
......@@ -13,9 +13,9 @@ use tracing::debug;
1313
1414use crate::clean;
1515use crate::core::DocContext;
16use crate::html::markdown::{find_testable_code, ErrorCodes};
17use crate::passes::check_doc_test_visibility::{should_have_doc_example, Tests};
16use crate::html::markdown::{ErrorCodes, find_testable_code};
1817use crate::passes::Pass;
18use crate::passes::check_doc_test_visibility::{Tests, should_have_doc_example};
1919use crate::visit::DocVisitor;
2020
2121pub(crate) const CALCULATE_DOC_COVERAGE: Pass = Pass {
src/librustdoc/passes/check_doc_test_visibility.rs+1-1
......@@ -15,7 +15,7 @@ use crate::clean;
1515use crate::clean::utils::inherits_doc_hidden;
1616use crate::clean::*;
1717use crate::core::DocContext;
18use crate::html::markdown::{find_testable_code, ErrorCodes, Ignore, LangString, MdRelLine};
18use crate::html::markdown::{ErrorCodes, Ignore, LangString, MdRelLine, find_testable_code};
1919use crate::visit::DocVisitor;
2020
2121pub(crate) const CHECK_DOC_TEST_VISIBILITY: Pass = Pass {
src/librustdoc/passes/collect_intra_doc_links.rs+7-7
......@@ -14,25 +14,25 @@ use rustc_data_structures::intern::Interned;
1414use rustc_errors::{Applicability, Diag, DiagMessage};
1515use rustc_hir::def::Namespace::*;
1616use rustc_hir::def::{DefKind, Namespace, PerNS};
17use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
17use rustc_hir::def_id::{CRATE_DEF_ID, DefId};
1818use rustc_hir::{Mutability, Safety};
1919use rustc_middle::ty::{Ty, TyCtxt};
2020use rustc_middle::{bug, span_bug, ty};
2121use rustc_resolve::rustdoc::{
22 has_primitive_or_keyword_docs, prepare_to_doc_link_resolution, source_span_for_markdown_range,
23 strip_generics_from_path, MalformedGenerics,
22 MalformedGenerics, has_primitive_or_keyword_docs, prepare_to_doc_link_resolution,
23 source_span_for_markdown_range, strip_generics_from_path,
2424};
2525use rustc_session::lint::Lint;
26use rustc_span::hygiene::MacroKind;
27use rustc_span::symbol::{sym, Ident, Symbol};
2826use rustc_span::BytePos;
29use smallvec::{smallvec, SmallVec};
27use rustc_span::hygiene::MacroKind;
28use rustc_span::symbol::{Ident, Symbol, sym};
29use smallvec::{SmallVec, smallvec};
3030use tracing::{debug, info, instrument, trace};
3131
3232use crate::clean::utils::find_nearest_parent_module;
3333use crate::clean::{self, Crate, Item, ItemLink, PrimitiveType};
3434use crate::core::DocContext;
35use crate::html::markdown::{markdown_links, MarkdownLink, MarkdownLinkRange};
35use crate::html::markdown::{MarkdownLink, MarkdownLinkRange, markdown_links};
3636use crate::lint::{BROKEN_INTRA_DOC_LINKS, PRIVATE_INTRA_DOC_LINKS};
3737use crate::passes::Pass;
3838use crate::visit::DocVisitor;
src/librustdoc/passes/lint/bare_urls.rs+4-5
......@@ -77,10 +77,9 @@ fn find_raw_urls(
7777 // For now, we only check "full" URLs (meaning, starting with "http://" or "https://").
7878 for match_ in URL_REGEX.find_iter(text) {
7979 let url_range = match_.range();
80 f(
81 cx,
82 "this URL is not a hyperlink",
83 Range { start: range.start + url_range.start, end: range.start + url_range.end },
84 );
80 f(cx, "this URL is not a hyperlink", Range {
81 start: range.start + url_range.start,
82 end: range.start + url_range.end,
83 });
8584 }
8685}
src/librustdoc/passes/lint/check_code_block_syntax.rs+2-2
......@@ -2,14 +2,14 @@
22
33use rustc_data_structures::sync::{Lock, Lrc};
44use rustc_errors::emitter::Emitter;
5use rustc_errors::translation::{to_fluent_args, Translate};
5use rustc_errors::translation::{Translate, to_fluent_args};
66use rustc_errors::{Applicability, DiagCtxt, DiagInner, LazyFallbackBundle};
77use rustc_parse::{source_str_to_stream, unwrap_or_emit_fatal};
88use rustc_resolve::rustdoc::source_span_for_markdown_range;
99use rustc_session::parse::ParseSess;
1010use rustc_span::hygiene::{AstPass, ExpnData, ExpnKind, LocalExpnId, Transparency};
1111use rustc_span::source_map::{FilePathMapping, SourceMap};
12use rustc_span::{FileName, InnerSpan, DUMMY_SP};
12use rustc_span::{DUMMY_SP, FileName, InnerSpan};
1313
1414use crate::clean;
1515use crate::core::DocContext;
src/librustdoc/passes/lint/redundant_explicit_links.rs+3-3
......@@ -5,15 +5,15 @@ use pulldown_cmark::{
55};
66use rustc_ast::NodeId;
77use rustc_errors::SuggestionStyle;
8use rustc_hir::def::{DefKind, DocLinkResMap, Namespace, Res};
98use rustc_hir::HirId;
9use rustc_hir::def::{DefKind, DocLinkResMap, Namespace, Res};
1010use rustc_lint_defs::Applicability;
1111use rustc_resolve::rustdoc::{prepare_to_doc_link_resolution, source_span_for_markdown_range};
12use rustc_span::def_id::DefId;
1312use rustc_span::Symbol;
13use rustc_span::def_id::DefId;
1414
15use crate::clean::utils::{find_nearest_parent_module, inherits_doc_hidden};
1615use crate::clean::Item;
16use crate::clean::utils::{find_nearest_parent_module, inherits_doc_hidden};
1717use crate::core::DocContext;
1818use crate::html::markdown::main_body_opts;
1919
src/librustdoc/passes/strip_aliased_non_local.rs+1-1
......@@ -3,7 +3,7 @@ use rustc_middle::ty::{TyCtxt, Visibility};
33use crate::clean;
44use crate::clean::Item;
55use crate::core::DocContext;
6use crate::fold::{strip_item, DocFolder};
6use crate::fold::{DocFolder, strip_item};
77use crate::passes::Pass;
88
99pub(crate) const STRIP_ALIASED_NON_LOCAL: Pass = Pass {
src/librustdoc/passes/strip_hidden.rs+2-2
......@@ -2,7 +2,7 @@
22
33use std::mem;
44
5use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
5use rustc_hir::def_id::{CRATE_DEF_ID, LocalDefId};
66use rustc_middle::ty::TyCtxt;
77use rustc_span::symbol::sym;
88use tracing::debug;
......@@ -11,7 +11,7 @@ use crate::clean;
1111use crate::clean::utils::inherits_doc_hidden;
1212use crate::clean::{Item, ItemIdSet};
1313use crate::core::DocContext;
14use crate::fold::{strip_item, DocFolder};
14use crate::fold::{DocFolder, strip_item};
1515use crate::passes::{ImplStripper, Pass};
1616
1717pub(crate) const STRIP_HIDDEN: Pass = Pass {
src/librustdoc/passes/stripper.rs+1-1
......@@ -8,7 +8,7 @@ use tracing::debug;
88
99use crate::clean::utils::inherits_doc_hidden;
1010use crate::clean::{self, Item, ItemId, ItemIdSet};
11use crate::fold::{strip_item, DocFolder};
11use crate::fold::{DocFolder, strip_item};
1212use crate::formats::cache::Cache;
1313use crate::visit_lib::RustdocEffectiveVisibilities;
1414
src/librustdoc/visit_ast.rs+5-5
......@@ -7,19 +7,19 @@ use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
77use rustc_hir as hir;
88use rustc_hir::def::{DefKind, Res};
99use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId, LocalDefIdSet};
10use rustc_hir::intravisit::{walk_body, walk_item, Visitor};
11use rustc_hir::{Node, CRATE_HIR_ID};
10use rustc_hir::intravisit::{Visitor, walk_body, walk_item};
11use rustc_hir::{CRATE_HIR_ID, Node};
1212use rustc_middle::hir::nested_filter;
1313use rustc_middle::ty::TyCtxt;
14use rustc_span::Span;
1415use rustc_span::def_id::{CRATE_DEF_ID, LOCAL_CRATE};
1516use rustc_span::hygiene::MacroKind;
16use rustc_span::symbol::{kw, sym, Symbol};
17use rustc_span::Span;
17use rustc_span::symbol::{Symbol, kw, sym};
1818use tracing::debug;
1919
2020use crate::clean::cfg::Cfg;
2121use crate::clean::utils::{inherits_doc_hidden, should_ignore_res};
22use crate::clean::{reexport_chain, AttributesExt, NestedAttributesExt};
22use crate::clean::{AttributesExt, NestedAttributesExt, reexport_chain};
2323use crate::core;
2424
2525/// This module is used to store stuff from Rust's AST in a more convenient
src/stage0+450-450
......@@ -14,456 +14,456 @@ nightly_branch=master
1414# All changes below this comment will be overridden the next time the
1515# tool is executed.
1616
17compiler_date=2024-09-04
17compiler_date=2024-09-22
1818compiler_version=beta
19rustfmt_date=2024-09-04
19rustfmt_date=2024-09-22
2020rustfmt_version=nightly
2121
22dist/2024-09-04/rustc-beta-aarch64-apple-darwin.tar.gz=cb6487c102a7c5822be2236d79a2c4737b0ff284931c61607518a0de8d300abf
23dist/2024-09-04/rustc-beta-aarch64-apple-darwin.tar.xz=2556c7c07811195e94639f6d6556a0f49f3c267e0e3bfc44b1fdc555aac1ffe5
24dist/2024-09-04/rustc-beta-aarch64-pc-windows-msvc.tar.gz=c207a307bf10a50e2884f4d9408528a22703e1010dd921459541ee11aecc2405
25dist/2024-09-04/rustc-beta-aarch64-pc-windows-msvc.tar.xz=d6f99991029db32be7527dbe1a6ae840600db6d7497123156e6672f7a0e83aa2
26dist/2024-09-04/rustc-beta-aarch64-unknown-linux-gnu.tar.gz=b57cb4d25045e23f897078216776f244a73498ea89240077bda7a84c31c2f4fe
27dist/2024-09-04/rustc-beta-aarch64-unknown-linux-gnu.tar.xz=2c2b95c852114d7b18c3db13234ac56f933b70c3cf8b5ac9fce65415434961fe
28dist/2024-09-04/rustc-beta-aarch64-unknown-linux-musl.tar.gz=1f216d67bcd5d1e011bd2c6c69b6791c94e29cf7da3ab7dea82ff71a911e149b
29dist/2024-09-04/rustc-beta-aarch64-unknown-linux-musl.tar.xz=86abb27afb03e347abff65e4e34f1ec2e943af14f04f8cd9dd8666338147562d
30dist/2024-09-04/rustc-beta-arm-unknown-linux-gnueabi.tar.gz=842754febca1a5c6f7ccacf231621ba4578d72718a950ddedbf07a73594fa55f
31dist/2024-09-04/rustc-beta-arm-unknown-linux-gnueabi.tar.xz=3094887ecd5e3432e1ada0bba4a425213215c50680dc30d0c1d15ffda5bc62a0
32dist/2024-09-04/rustc-beta-arm-unknown-linux-gnueabihf.tar.gz=27192e3423f2b580d7927ae788cf778ff9c092e2eb7cdd5d16b41aa94d2bf03c
33dist/2024-09-04/rustc-beta-arm-unknown-linux-gnueabihf.tar.xz=e57767bd767964d51533e2310f177827842bf49176895280b3de3860caf351ab
34dist/2024-09-04/rustc-beta-armv7-unknown-linux-gnueabihf.tar.gz=b639bfce72277714769d36efab294ef3578573b93037160be7dff9f4a6e6b5ef
35dist/2024-09-04/rustc-beta-armv7-unknown-linux-gnueabihf.tar.xz=fce2b931641d51e88eb3e34d60bebe75384c1981654937b16f1333438d8b0696
36dist/2024-09-04/rustc-beta-i686-pc-windows-gnu.tar.gz=b58f7013b41044260ab2f9456940d9ce017dcfea06059fae8a672664f8ba00df
37dist/2024-09-04/rustc-beta-i686-pc-windows-gnu.tar.xz=c91958645f3c4cd562a5eb800ddb843aabfa2f067f5659313fdedeb270935bf8
38dist/2024-09-04/rustc-beta-i686-pc-windows-msvc.tar.gz=9a5075768fe2d42195c639d8c1066a020b573eae24c0c63e9a8876b78c39d673
39dist/2024-09-04/rustc-beta-i686-pc-windows-msvc.tar.xz=e76c27a8892a5b7a74c4d18d10c745af226711dbf62450378a3034a706624ce1
40dist/2024-09-04/rustc-beta-i686-unknown-linux-gnu.tar.gz=c10ffb2db62b113af1feab8625f1d88d31c1d4a4246d00e19a3588c9f69c0164
41dist/2024-09-04/rustc-beta-i686-unknown-linux-gnu.tar.xz=0496fbfa32d6c22929fe94ae5dcaabc47d31d7482f0fe6748ef7b7eb7443b775
42dist/2024-09-04/rustc-beta-loongarch64-unknown-linux-gnu.tar.gz=64b55368e8044ea44588c98f1529f46d65f7607ebf2fa2d50785abecfb37c188
43dist/2024-09-04/rustc-beta-loongarch64-unknown-linux-gnu.tar.xz=e03528ee7e4e92d666199ebcdde7d10f1d0fbeb2766217fd95f98da93bc361d0
44dist/2024-09-04/rustc-beta-loongarch64-unknown-linux-musl.tar.gz=eeb913008ecfbaaa76b7690b2e68bd1e70efc1afda19f44a1aa551a76e4b536a
45dist/2024-09-04/rustc-beta-loongarch64-unknown-linux-musl.tar.xz=c94c3545fa2a491763b1e593419034294c57a3df2ca8064db0b11d2e82e76c85
46dist/2024-09-04/rustc-beta-powerpc-unknown-linux-gnu.tar.gz=54c97827079aa7646cf206517f603487f4634ab1a17f2a7882b0cd3d6ffae8db
47dist/2024-09-04/rustc-beta-powerpc-unknown-linux-gnu.tar.xz=ee98a0e07989de836ff8ff4e768c6f0f13aa15150d1b59543297f31b2768a5fc
48dist/2024-09-04/rustc-beta-powerpc64-unknown-linux-gnu.tar.gz=a0fcd0f7af5b05a22d9be0abb6f3aa44c028c2606195163d2ad4b0352455ed1f
49dist/2024-09-04/rustc-beta-powerpc64-unknown-linux-gnu.tar.xz=cf35d480a6c0b439d29baacc4ee4087c4d7b5c1b4050302f3146f0bdbffcd472
50dist/2024-09-04/rustc-beta-powerpc64le-unknown-linux-gnu.tar.gz=ef19ce4d791b1caad30bc5af9e30494161f343d936a3300eb0d7c5e8f37db441
51dist/2024-09-04/rustc-beta-powerpc64le-unknown-linux-gnu.tar.xz=12adfd58c851d1f7bb23c5698abf6dffa2c26348df55fbb518c27497f7ebdf17
52dist/2024-09-04/rustc-beta-riscv64gc-unknown-linux-gnu.tar.gz=818151529f1e445f9202d0092f09f02818a2c52ad6814a89b2bbfcb0227c5202
53dist/2024-09-04/rustc-beta-riscv64gc-unknown-linux-gnu.tar.xz=e195d07d37699d860ce97422bba7f68166292103cedf4932b3ba8c0d9fa7e186
54dist/2024-09-04/rustc-beta-s390x-unknown-linux-gnu.tar.gz=d4a73ddd7eafdffe7f23720a7202f48676ae0bc49248d3a455c997d718730c5f
55dist/2024-09-04/rustc-beta-s390x-unknown-linux-gnu.tar.xz=475bb6e51f37fc769480345982e14afeee099cdf769773d0d0215d01fc77ce41
56dist/2024-09-04/rustc-beta-x86_64-apple-darwin.tar.gz=c061d06da7d4a283136d8e80f307c1ef4157739898776f5579b8d92980be0775
57dist/2024-09-04/rustc-beta-x86_64-apple-darwin.tar.xz=330b580c90ace563c96db64f639668284d8ede835870acf76b106d4c4913f476
58dist/2024-09-04/rustc-beta-x86_64-pc-windows-gnu.tar.gz=27f9e3c2e9380c689ab0c5e8438f1969261a30445e9b2d38efa9417fba1f4ea2
59dist/2024-09-04/rustc-beta-x86_64-pc-windows-gnu.tar.xz=62fc92dac7be442dcf306ae1baef471447b80a6a221502bf7b14b249dd599db7
60dist/2024-09-04/rustc-beta-x86_64-pc-windows-msvc.tar.gz=c52202bf41aafb517959e01cac2e4bbb53144aa0164f9b31e7b9db0af32be6c6
61dist/2024-09-04/rustc-beta-x86_64-pc-windows-msvc.tar.xz=24db84f0de7573812fe36fed5653fc117c80fc35b02a9340f746ded6a11d3bc0
62dist/2024-09-04/rustc-beta-x86_64-unknown-freebsd.tar.gz=406f8a37572376fec7563664043b4fc3b0e7a48c738b6ef862da3fc41f33b1d3
63dist/2024-09-04/rustc-beta-x86_64-unknown-freebsd.tar.xz=93fa021ca3973a52cbccd51771536e2b9a355eae4f4ab95c7168f4af79e96d4e
64dist/2024-09-04/rustc-beta-x86_64-unknown-illumos.tar.gz=a2a5942342b2f5dc7a196500210075ac695f106a18fd487a3c694847013454f3
65dist/2024-09-04/rustc-beta-x86_64-unknown-illumos.tar.xz=c8b63f35f30bb1d6adb49834b3a42dfc07c27042e8411f1b4777adced6193298
66dist/2024-09-04/rustc-beta-x86_64-unknown-linux-gnu.tar.gz=145c5d6e0edb688dbe59f9c638959e11718e0bdc625db76bac1d2836efd9f116
67dist/2024-09-04/rustc-beta-x86_64-unknown-linux-gnu.tar.xz=82845313e17067dac361eada63fdf2479fc177e8aa97aba5cb40a50861e276bc
68dist/2024-09-04/rustc-beta-x86_64-unknown-linux-musl.tar.gz=8351011105a5a338adbd2433ff5aa24cd038a67c0f0d040e4b92926d4aecd28e
69dist/2024-09-04/rustc-beta-x86_64-unknown-linux-musl.tar.xz=b2a972069142d5fdab775fd7709d4bc85b1c2c4167e9c455d2ef1b72cc207fd1
70dist/2024-09-04/rustc-beta-x86_64-unknown-netbsd.tar.gz=327501931ce36eb5613e5e77fb5356ff24f60078516473cd7f664bc970aee994
71dist/2024-09-04/rustc-beta-x86_64-unknown-netbsd.tar.xz=6d940ec725fa4931c914c291977f63828fe71e9763a3b8195dda668541c9122f
72dist/2024-09-04/rust-std-beta-aarch64-apple-darwin.tar.gz=9bf325e98fa60fcb7d4f09b796f2fe0e7e7c54e83ffba6d5cf30776a0346972d
73dist/2024-09-04/rust-std-beta-aarch64-apple-darwin.tar.xz=45d632045f5e3f8150d82fdc5163aea1d5ad785cd16da2d46293581b09bda895
74dist/2024-09-04/rust-std-beta-aarch64-apple-ios.tar.gz=c42f808164d79e023dc4186e47a6032c0877536a0c9459f3e871c66c129b0f75
75dist/2024-09-04/rust-std-beta-aarch64-apple-ios.tar.xz=9bbe6ae21530fb0555472f9a540b7791d5dce059439608d797507057199e696e
76dist/2024-09-04/rust-std-beta-aarch64-apple-ios-macabi.tar.gz=ae8005ea419f9f19be0c2603529d8801dc77e5344c72c1bd42eed81046fe5113
77dist/2024-09-04/rust-std-beta-aarch64-apple-ios-macabi.tar.xz=0053948699aba18b2bee7473f335940573aaf4bad6aabb00f28f2a335d280dab
78dist/2024-09-04/rust-std-beta-aarch64-apple-ios-sim.tar.gz=5adc7721f8f7fc0537b11a28ee2df6d90b96222a07590c84fab4dbefe33087d1
79dist/2024-09-04/rust-std-beta-aarch64-apple-ios-sim.tar.xz=4f3a9b61500ef3a38961288784c61a520baabfa597e997195007e0e229d1e4bf
80dist/2024-09-04/rust-std-beta-aarch64-linux-android.tar.gz=7192a628d6605b437a7203c18d48ac9a5af4879674117e9aebafb5029a10e069
81dist/2024-09-04/rust-std-beta-aarch64-linux-android.tar.xz=845177bda3220a534b20c66cda3bf27b0681c2977dfbcedeaf41022bc518f832
82dist/2024-09-04/rust-std-beta-aarch64-pc-windows-gnullvm.tar.gz=1a0ced7e1fbcdd38fcb33f1753f3af8b23f075d4ce38c3d1256ba142ddf80a47
83dist/2024-09-04/rust-std-beta-aarch64-pc-windows-gnullvm.tar.xz=75272f629adfaacb58c511163ae9b73714fe3f60d5e39b4cd996a42226626518
84dist/2024-09-04/rust-std-beta-aarch64-pc-windows-msvc.tar.gz=3b19e6dca8515f28a2325d7cf2f098e82e194d4418fce7c3caa94c9c08023646
85dist/2024-09-04/rust-std-beta-aarch64-pc-windows-msvc.tar.xz=138e8e1a85efb4f66ec878db18dfa48681f3045589c7b9a749afd0104dafd278
86dist/2024-09-04/rust-std-beta-aarch64-unknown-fuchsia.tar.gz=6da128ca58f46d2608c4d9630c09de263b853f9fe8b6fa41def0749e99a128e0
87dist/2024-09-04/rust-std-beta-aarch64-unknown-fuchsia.tar.xz=67a2c04a9f4947b4c313220150521f494364c5e589ff23a4584fa60b924ae095
88dist/2024-09-04/rust-std-beta-aarch64-unknown-linux-gnu.tar.gz=85ccd5a6e81caa63d4d4cfe55eead8a3829a5636d41f7640ea393bf7652eec28
89dist/2024-09-04/rust-std-beta-aarch64-unknown-linux-gnu.tar.xz=fb91518e70808c659f6f078c0094ca471e4e4f5d81c29c1bdc8907f6bdffc64f
90dist/2024-09-04/rust-std-beta-aarch64-unknown-linux-musl.tar.gz=410b24f1372f84d60804b4bcf20fa2025adaee3c56ab7dabda1e320809acafdb
91dist/2024-09-04/rust-std-beta-aarch64-unknown-linux-musl.tar.xz=64d7fa38af8a1c38e42bc9b9ab909f476d3388b7d02a21ba92519145cb3a3df8
92dist/2024-09-04/rust-std-beta-aarch64-unknown-linux-ohos.tar.gz=f4722b2a656d4f87bd13d4c8da6116e993e916114c55a2fd1a588e51dfde4ab0
93dist/2024-09-04/rust-std-beta-aarch64-unknown-linux-ohos.tar.xz=cb9150701f21de444addcdc9a53c83eeed3aaa3bc447e8f6358825a2f889bff2
94dist/2024-09-04/rust-std-beta-aarch64-unknown-none.tar.gz=26cf0407f17db7645fc1a4051d08246f1325b17941dd5139cb69b782498aa043
95dist/2024-09-04/rust-std-beta-aarch64-unknown-none.tar.xz=9dcdfd018e2ca6f21d0689adb152917a8695c2f14c4f6a53a5b52280219c2540
96dist/2024-09-04/rust-std-beta-aarch64-unknown-none-softfloat.tar.gz=1d1e555bb8af601d8df16b80dd263391a4c0805e1203c618fb370de1911a5a17
97dist/2024-09-04/rust-std-beta-aarch64-unknown-none-softfloat.tar.xz=078d88a6d4882696b3764d10dbd10e0d756752255096690e895903cd83265c70
98dist/2024-09-04/rust-std-beta-aarch64-unknown-uefi.tar.gz=5933f618e5c99e06c8556871a85016eba58f6de1056468a1ad47823105908fba
99dist/2024-09-04/rust-std-beta-aarch64-unknown-uefi.tar.xz=322f61ff7a6f6b261bbb9c592f50a39fa179c1f870d911a57b2afda7d7b2d196
100dist/2024-09-04/rust-std-beta-arm-linux-androideabi.tar.gz=e66bc47a75e12569032c81f6c950513e3fc78cf75e496e9873792b4c83f3dca1
101dist/2024-09-04/rust-std-beta-arm-linux-androideabi.tar.xz=9a84da40c9e5fb55e1ebad0dc9b724fe9d71d86bea0d2227315590f290fdce13
102dist/2024-09-04/rust-std-beta-arm-unknown-linux-gnueabi.tar.gz=3e8b535ec051eaaf63490649b1258ae64f1786abca6967bdc3eb6c6da96a4d81
103dist/2024-09-04/rust-std-beta-arm-unknown-linux-gnueabi.tar.xz=4936561a884b3b725a9b78651ea05a36da5e643be4e574416e12ba1c1e5f37d9
104dist/2024-09-04/rust-std-beta-arm-unknown-linux-gnueabihf.tar.gz=00eb51ffccdac33a39da37878104dded2c5efa01da5adf8bd932a0d9fb49d17b
105dist/2024-09-04/rust-std-beta-arm-unknown-linux-gnueabihf.tar.xz=3eb187c4a6f416672a8a36997aca5f04bab9ec6aee3a0d1f4ad5a0ed950605c3
106dist/2024-09-04/rust-std-beta-arm-unknown-linux-musleabi.tar.gz=66752ad65876dad43c19973f8967a098236f2605d2aa82df5b0f040247e049c3
107dist/2024-09-04/rust-std-beta-arm-unknown-linux-musleabi.tar.xz=f508b8c7956209c87259b38bebe5576ca8a5662a4d4747941082dd39d991610e
108dist/2024-09-04/rust-std-beta-arm-unknown-linux-musleabihf.tar.gz=926f2839c6627c822aa9f494e99030873987b6fca66364cc12ba468928a93b9c
109dist/2024-09-04/rust-std-beta-arm-unknown-linux-musleabihf.tar.xz=e2be0999ea8df01c1029b0976861162c9c60e41a87b4097345f2c5822777ee2b
110dist/2024-09-04/rust-std-beta-arm64ec-pc-windows-msvc.tar.gz=ec912c9e372cd0ae1a754305f0645580cf40f9742c4cbcc54952e613d47f595e
111dist/2024-09-04/rust-std-beta-arm64ec-pc-windows-msvc.tar.xz=f86091e5d806a9b4efa388e036ee69fa63fca68feca174c6670cd04966e2725f
112dist/2024-09-04/rust-std-beta-armebv7r-none-eabi.tar.gz=d51aa780c5df5b8b2e1fbbe97f79914ed083ea13528c43cca797ab8931a418d2
113dist/2024-09-04/rust-std-beta-armebv7r-none-eabi.tar.xz=19cbb2d1d8a6a3a33669da9fab7eb48f78f0682d777d2c2f188daf6d91895bc7
114dist/2024-09-04/rust-std-beta-armebv7r-none-eabihf.tar.gz=a1ae798b4eaf206510c33d5af1d4c99ed553fce89413449a5f82d5b80a2558aa
115dist/2024-09-04/rust-std-beta-armebv7r-none-eabihf.tar.xz=a0cb421635b927e5b255238658c9f9f5a0b2da60e05c993ecbda35af9318d6bc
116dist/2024-09-04/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.gz=5f9995804004211baefab1d230089a5719bce40b632bd3380044142a89ae5f2d
117dist/2024-09-04/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.xz=66f410541f2f53d44b2a2931b10a229c8143d6e9caabadea2df40704aad71854
118dist/2024-09-04/rust-std-beta-armv5te-unknown-linux-musleabi.tar.gz=64b62816adc9574f6961832a4c469e1103057ed553a4c42796e3af4962dc694a
119dist/2024-09-04/rust-std-beta-armv5te-unknown-linux-musleabi.tar.xz=3c0b3741af7f9b50d041dd52fe86fb4144c295632a6eba0197e77ac4ca94ab27
120dist/2024-09-04/rust-std-beta-armv7-linux-androideabi.tar.gz=aa3d37e6fc483c798a9debecf2ae7609609d0560baebb90733582b9bee15c493
121dist/2024-09-04/rust-std-beta-armv7-linux-androideabi.tar.xz=ed88cf7c141efd01eceb81b3b85e4eef38f559d8652d2fc4bf3395f4e3d2ef48
122dist/2024-09-04/rust-std-beta-armv7-unknown-linux-gnueabi.tar.gz=f8b34e2dd9bb5b2ea008bf6a69944da389d8d086a1ece57c1572c749717f4df8
123dist/2024-09-04/rust-std-beta-armv7-unknown-linux-gnueabi.tar.xz=7ae6076c42fecf7b92305af4220abd3d724d49d96def617a67db1ef298b74bb5
124dist/2024-09-04/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.gz=4e13553b0288f4cd046372c080f4968a2b69bcb489f6929e98e72682b601d4cc
125dist/2024-09-04/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.xz=dbaeb0445cfc110d7879a23ea7c4034cebb4158cd9781d8719f51864356a15d4
126dist/2024-09-04/rust-std-beta-armv7-unknown-linux-musleabi.tar.gz=164fa06abffc38aaf81c86aeb50fde51c96d713bb78d759a6f7e668c7967bdfb
127dist/2024-09-04/rust-std-beta-armv7-unknown-linux-musleabi.tar.xz=2ec4d5e339593555d02ea738ae1815e27d108fce5faeffd503308780c80a1a8d
128dist/2024-09-04/rust-std-beta-armv7-unknown-linux-musleabihf.tar.gz=36a09d9287c9d89b3946dc6aea2ce846e754ca2b07b667035f62e8d00c81587c
129dist/2024-09-04/rust-std-beta-armv7-unknown-linux-musleabihf.tar.xz=573316d483a27930bd1423ae8c1f2624dba141865150a41a5be317cc53fd850a
130dist/2024-09-04/rust-std-beta-armv7-unknown-linux-ohos.tar.gz=487feddaa3b11ad15b544e3338f4dfeb1f5297ce5d851dec1df36eee7bc016a2
131dist/2024-09-04/rust-std-beta-armv7-unknown-linux-ohos.tar.xz=866f612bc4fce03e851eb0b370282b35b066018c2b2467d265cbdde4bcc8afbd
132dist/2024-09-04/rust-std-beta-armv7a-none-eabi.tar.gz=3b2f1fefd2d97006264e5ce50839c8c22e9f6553f639e95c8bcc5bd01c54bead
133dist/2024-09-04/rust-std-beta-armv7a-none-eabi.tar.xz=55294ba0b8da663399c427b57157f4a3e43b117c77e011801410a9bfb62584a0
134dist/2024-09-04/rust-std-beta-armv7r-none-eabi.tar.gz=60ef291da36a614ddfd38c8bac0519113dc1203603181ba3a581df074fb62f07
135dist/2024-09-04/rust-std-beta-armv7r-none-eabi.tar.xz=6dde05a2b3a57ae340f699f959e7032bb6e53cf7e1ea24bf1dd88766dba2dcdf
136dist/2024-09-04/rust-std-beta-armv7r-none-eabihf.tar.gz=cc2ae41c8c8ee69f26eb55a033e5c6c23ec1e968aaa4c2e03357b62056176725
137dist/2024-09-04/rust-std-beta-armv7r-none-eabihf.tar.xz=dc7d1e0637369b0a32f8730a771e4b059ce45131b51beb276de8c03e153834b5
138dist/2024-09-04/rust-std-beta-i586-pc-windows-msvc.tar.gz=d6ce6f7d1412c1e0ec60a09c9db3d9bcbd0075617dd1756fa82e93d3df0ef8e4
139dist/2024-09-04/rust-std-beta-i586-pc-windows-msvc.tar.xz=60ff61cf60ac63a6c1ce3c6558351e873968ea1f812afdc7516ae5d19d85e54e
140dist/2024-09-04/rust-std-beta-i586-unknown-linux-gnu.tar.gz=4f5204d8d51ecbf0768419076c94dde6e0c776a9403e3e108866eec3faa68d06
141dist/2024-09-04/rust-std-beta-i586-unknown-linux-gnu.tar.xz=3ba0815668b11d682a54bfc4731aca5f7a821d77ab8ac32f9922bf9d684d72b4
142dist/2024-09-04/rust-std-beta-i586-unknown-linux-musl.tar.gz=ac1094f3e22829c4e3e27a91dae48f84ab2bca4373a6e851bdee807887e145ab
143dist/2024-09-04/rust-std-beta-i586-unknown-linux-musl.tar.xz=6547347750eefb619ac15256a3e1ef09c3ee633d73b23aae239cfcf4261f0d16
144dist/2024-09-04/rust-std-beta-i686-linux-android.tar.gz=af1e7557a1008392a0c2eee4f9e6b26ca56b21be2838ff4a4e3784363b1c3423
145dist/2024-09-04/rust-std-beta-i686-linux-android.tar.xz=b5d395b1c6994447b3358058aaf2219f952cb9fe6d5df0d8a533b9c2ed84134c
146dist/2024-09-04/rust-std-beta-i686-pc-windows-gnu.tar.gz=a0c0535feb405bf313035cdbc690fd80c18e1975ef0da2fcaeaeab66eb8ee461
147dist/2024-09-04/rust-std-beta-i686-pc-windows-gnu.tar.xz=85b08876c40d2bc1b44bf7d64319d1dae3af2dbd75cf3e3f37b3ea20bd21209c
148dist/2024-09-04/rust-std-beta-i686-pc-windows-gnullvm.tar.gz=60c37fb7de68381a3665728eb6a74ea017d81e2dcae11acf683cebcef7267487
149dist/2024-09-04/rust-std-beta-i686-pc-windows-gnullvm.tar.xz=a97edc7de6792da17dbcb6b5a67da4aa79784921c2b160185b2c8a806bd4945b
150dist/2024-09-04/rust-std-beta-i686-pc-windows-msvc.tar.gz=ea25bfabaad2bc02b0d37672bdf9357f317fd27031ef6039460e25c066917b11
151dist/2024-09-04/rust-std-beta-i686-pc-windows-msvc.tar.xz=ef65a47d79945d6375347c9889c3ec3250d4635e1918689cc1f992b7daf4f547
152dist/2024-09-04/rust-std-beta-i686-unknown-freebsd.tar.gz=5c4ca0b3bca99fc468bc7ada8ef1d202e9be8ba9808298485654ceab545538e8
153dist/2024-09-04/rust-std-beta-i686-unknown-freebsd.tar.xz=59ffa74e46e807cacd4ea0a1b16ce0ec7152c4458ad9f86feea82162b1c53da6
154dist/2024-09-04/rust-std-beta-i686-unknown-linux-gnu.tar.gz=dc535c0b1fe81cc6d1bbd8fecbc0625cb85c44a6f10dd8641fb8ae88083febc5
155dist/2024-09-04/rust-std-beta-i686-unknown-linux-gnu.tar.xz=624ce72e0b60a7b0d9a06b6925fd0e9a3bd50d9d7ed59db4a16145ff5381c232
156dist/2024-09-04/rust-std-beta-i686-unknown-linux-musl.tar.gz=6d43cf9f2dc34205616b17eafa8bf28f951de538e6d80ab4993d9b840b72ba49
157dist/2024-09-04/rust-std-beta-i686-unknown-linux-musl.tar.xz=b397f611d609167ddf2b5699d7cfef9da9c6c78988c7ca2c32b2f81f6640eba6
158dist/2024-09-04/rust-std-beta-i686-unknown-uefi.tar.gz=878584e638e92902521231a4b578ae1828d1e06093104b6ceca9a22a6c05939d
159dist/2024-09-04/rust-std-beta-i686-unknown-uefi.tar.xz=2806b9124d6145b65bfefc2e72a8ec3f745d3972904b7a2546bcaf649028a332
160dist/2024-09-04/rust-std-beta-loongarch64-unknown-linux-gnu.tar.gz=eb2792e0b57b36ed03762eff460bfbb7d8b28aaa309702e7e6414eba0a7d0e63
161dist/2024-09-04/rust-std-beta-loongarch64-unknown-linux-gnu.tar.xz=c36d7526ad190b15a41a1695be4b813d09d649395b1e91bf6dadc336333c690d
162dist/2024-09-04/rust-std-beta-loongarch64-unknown-linux-musl.tar.gz=d891dc7b3c1d05a1c245076a6656f2ad33cba79073e36e8e1eb11ab0c0045cdd
163dist/2024-09-04/rust-std-beta-loongarch64-unknown-linux-musl.tar.xz=6dbbd097bba35b9f0465a6d6b4d19d8b4700dbeecc1b0919aa99c72cad564a0a
164dist/2024-09-04/rust-std-beta-loongarch64-unknown-none.tar.gz=54da489ea59169e39b50d0be0221e20cf03bdad413854e0f35f66c323bf4e88e
165dist/2024-09-04/rust-std-beta-loongarch64-unknown-none.tar.xz=4c360c531107de92b695dd389514dc0af053a04d28c566a06a25e467d5ab548f
166dist/2024-09-04/rust-std-beta-loongarch64-unknown-none-softfloat.tar.gz=7ce834710452cb0569cdd234698f647db87e774d3e964493e17017a81a417aba
167dist/2024-09-04/rust-std-beta-loongarch64-unknown-none-softfloat.tar.xz=3e554450f5107e02335fa14fc7c7a2a3d4718741001f0f4e43984a3c0841ddf4
168dist/2024-09-04/rust-std-beta-nvptx64-nvidia-cuda.tar.gz=e8c8607e58379162fe0ec072bd544c97d73619df88eb56aeccdf2ebd5357f1b3
169dist/2024-09-04/rust-std-beta-nvptx64-nvidia-cuda.tar.xz=1dd759c92e6c1f67d5b697e1034b4962434a17211383741d0cc71acda9fcf209
170dist/2024-09-04/rust-std-beta-powerpc-unknown-linux-gnu.tar.gz=83907d49dd4cf4f73c1295571400c9761bae7a3b2447c140a358a07710e28f93
171dist/2024-09-04/rust-std-beta-powerpc-unknown-linux-gnu.tar.xz=f1ec605497fb3d7d364f2dfb7bc5c4898940518c1712b0271372ee608d61fd34
172dist/2024-09-04/rust-std-beta-powerpc64-unknown-linux-gnu.tar.gz=ac2b94c0f76c1f23be43880c01aab0a45d47e48a6c53b5dcfcf4e9507aa481e9
173dist/2024-09-04/rust-std-beta-powerpc64-unknown-linux-gnu.tar.xz=129ff2031d8ae69c34e944516bb47e093a2f2b47972bd401337fc1dc8b0f2b93
174dist/2024-09-04/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.gz=2dd17129ca857bfa97d8ae3429984f80a116cc9f967809b7e5bdcc5845398a30
175dist/2024-09-04/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.xz=06426a601db3dfc60f01b03bc201d21cc6bdc9b633a564e7025518decb91fea1
176dist/2024-09-04/rust-std-beta-riscv32i-unknown-none-elf.tar.gz=80bcbeed550e6ac30e9826cb801be5206d7937d2d940fca2d40ddabec62e2111
177dist/2024-09-04/rust-std-beta-riscv32i-unknown-none-elf.tar.xz=2994ee26443be51f11e8cc6e66aa2ee38e7f9440efbe0aa6aa2c513b3fe07f33
178dist/2024-09-04/rust-std-beta-riscv32im-unknown-none-elf.tar.gz=09f2b6dd18ebff39077a252e0d4b63b3557a49fb3a4f218f50f127aa44f653ec
179dist/2024-09-04/rust-std-beta-riscv32im-unknown-none-elf.tar.xz=156c0ef4be19442b8f59269815e570faa464332ccd2a8db91828eff9ab702ea7
180dist/2024-09-04/rust-std-beta-riscv32imac-unknown-none-elf.tar.gz=037ceaaf4b1356f72d16f2a6c0dfe50b1df8a82743da79262b020712ffcfb7ff
181dist/2024-09-04/rust-std-beta-riscv32imac-unknown-none-elf.tar.xz=a6e6f00d5df339ac19ebe2c661a5a4ec9b648328767db864b3db1bde0b330bfe
182dist/2024-09-04/rust-std-beta-riscv32imafc-unknown-none-elf.tar.gz=6da55a90ba454e77dd2c90d5d5c5ed833befab415ba65adf27d8e36645b189c0
183dist/2024-09-04/rust-std-beta-riscv32imafc-unknown-none-elf.tar.xz=9213accb8bc2b3a678c3b3cb4300015b1cc52798157e3898d99699b96bac486d
184dist/2024-09-04/rust-std-beta-riscv32imc-unknown-none-elf.tar.gz=5504f5fe7b45570922f7901476b8ac1eb28e9a7643bf5ace75bb368a644a05f8
185dist/2024-09-04/rust-std-beta-riscv32imc-unknown-none-elf.tar.xz=50109eb03c075ced8ebcff0909450f173e00491efece5874b8b59ad750bfc9ad
186dist/2024-09-04/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.gz=1ed3d0c1066b52dd2174ed45635386ff22798de8cee92765503fbcf71463094a
187dist/2024-09-04/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.xz=e2b22ed31374775441c6d80da80a52bc7558a1363776363ae341e78d0abf34fb
188dist/2024-09-04/rust-std-beta-riscv64gc-unknown-linux-musl.tar.gz=eff055a0e773741c4c2101791feea744c57ae95c50ad32ebec616daab1d098c8
189dist/2024-09-04/rust-std-beta-riscv64gc-unknown-linux-musl.tar.xz=680c9c2de4c7abf391d073709988593eb1daffe19876bd789a0f810f9d8d8458
190dist/2024-09-04/rust-std-beta-riscv64gc-unknown-none-elf.tar.gz=ae71d4f0789955cc883948c75aad9e492e37c206a64561705c8b7a9fec243f3e
191dist/2024-09-04/rust-std-beta-riscv64gc-unknown-none-elf.tar.xz=f41ecbae85295dda2dde95653a059be1852eacc28c175d36cb82cdacbf97a5e9
192dist/2024-09-04/rust-std-beta-riscv64imac-unknown-none-elf.tar.gz=1db39d0674e227b0fcacbc9de7aea52a349f515aaa8ea595cfbd91c6138e0b4c
193dist/2024-09-04/rust-std-beta-riscv64imac-unknown-none-elf.tar.xz=971c6dd1c7e3c6ab14d6d5f563edf974c87cbfd2a2028bced6e01175c8abafe6
194dist/2024-09-04/rust-std-beta-s390x-unknown-linux-gnu.tar.gz=029150a3c19afdafaff023ffd80f7aa1c2cfce7d7464339b0873a6e3da10a923
195dist/2024-09-04/rust-std-beta-s390x-unknown-linux-gnu.tar.xz=22a4612a5a7b38adb3e63ec8526444e51fe222c125c2ba51499987a3906b1cf5
196dist/2024-09-04/rust-std-beta-sparc64-unknown-linux-gnu.tar.gz=069c8fc749bc2ed94179af8e38849b83912c84cd551c4bf27f95e99def8ed0fc
197dist/2024-09-04/rust-std-beta-sparc64-unknown-linux-gnu.tar.xz=5b436df8a26688cc9853f5e12735187e9924a44101e21c4e59fc3dd38778e39a
198dist/2024-09-04/rust-std-beta-sparcv9-sun-solaris.tar.gz=77f6b8e4760ea43aac97ebb177223ad943fbbcc55dc3656afa400d7d1ea35787
199dist/2024-09-04/rust-std-beta-sparcv9-sun-solaris.tar.xz=d2b3e49982ccdb966f420eaba9d582108b227f1acb485f0b176762871d41ef3c
200dist/2024-09-04/rust-std-beta-thumbv6m-none-eabi.tar.gz=5e511b55cc961482998cca16def2424e749cf83a46a52b235e902baf8a653cca
201dist/2024-09-04/rust-std-beta-thumbv6m-none-eabi.tar.xz=8491ec0a3233b04909ad307bf679d6a012fe153eb9ae544956c8fa87a57dd55c
202dist/2024-09-04/rust-std-beta-thumbv7em-none-eabi.tar.gz=9b4d4913146843b01b4b6b7d8e1230c01f764a2ae2433dbb3264bfad14d0b3c6
203dist/2024-09-04/rust-std-beta-thumbv7em-none-eabi.tar.xz=ee700f3dca7d811a230222627ecc6c22d9850151adf47c2a48fb840a079508aa
204dist/2024-09-04/rust-std-beta-thumbv7em-none-eabihf.tar.gz=d54ea14641f79deb2b661e1fe9e9ff56d85189da5ced0f96c16503892c4b367a
205dist/2024-09-04/rust-std-beta-thumbv7em-none-eabihf.tar.xz=cd1529c6f77a079fbf15bcf81d41b4f18a8572729975b2a3ac91e18841e93495
206dist/2024-09-04/rust-std-beta-thumbv7m-none-eabi.tar.gz=fe214540eafddf6dc65ca94f1dad3a12df9e92a157060a9c27a730d99a706b28
207dist/2024-09-04/rust-std-beta-thumbv7m-none-eabi.tar.xz=2b9b1289855f7d9520eab69bc8c4e8505857e44b1e498968e47e3e847ae5a7da
208dist/2024-09-04/rust-std-beta-thumbv7neon-linux-androideabi.tar.gz=dc28759dc83a72d5c8505e90abb98ee55fb0ac53736422c95b631e063f566e5f
209dist/2024-09-04/rust-std-beta-thumbv7neon-linux-androideabi.tar.xz=b25c463af699783e8df43d7ccc5d1692d97e8a1ade8322dcf0cd74246d1d94b8
210dist/2024-09-04/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.gz=bb8ebf0008749bafb9cee686c7b09db4e4585178b506bc9bec6508577bc98713
211dist/2024-09-04/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.xz=afb9a8ed9a5dccb0c43eb6a920c647735648a1378413ff1fae754a7e5f972b06
212dist/2024-09-04/rust-std-beta-thumbv8m.base-none-eabi.tar.gz=b090d076b04e7894a94c1ed892825a3f6d27aa3908d40d1a66f098b9d53f4309
213dist/2024-09-04/rust-std-beta-thumbv8m.base-none-eabi.tar.xz=3213f7cb7365420b767779edc091a35f9e3a39e9439d0bf542dcc099eff25ce7
214dist/2024-09-04/rust-std-beta-thumbv8m.main-none-eabi.tar.gz=5d977dc47e7c04d1f729a2a153e2c37ceab7d9a049b111505146e82b7b3bc30b
215dist/2024-09-04/rust-std-beta-thumbv8m.main-none-eabi.tar.xz=8e9cef53163ff70ec8868d11d7c237cf40ced06852fcb193b3ef45232c3cd90a
216dist/2024-09-04/rust-std-beta-thumbv8m.main-none-eabihf.tar.gz=01f1916e4de4401ef0b7c43bfb0df72169f36ab09eda9ee923ef0d6608b8fafb
217dist/2024-09-04/rust-std-beta-thumbv8m.main-none-eabihf.tar.xz=1a9a9fe79884bd8e8e35cc8bcf3d1fb7a82ee4a40c630b78a302aabb047959f1
218dist/2024-09-04/rust-std-beta-wasm32-unknown-emscripten.tar.gz=66da8c5a7e579df020ef012747f9c8ce6a3094bdf43a99dc3763a9234eda3fff
219dist/2024-09-04/rust-std-beta-wasm32-unknown-emscripten.tar.xz=34ba780c992a10428fac49c9149d1f613fac221dd92866a93795543a991c29af
220dist/2024-09-04/rust-std-beta-wasm32-unknown-unknown.tar.gz=485304f0705ea8ef1a3516cd01e9b63e010af514edc03774cd87284367ed5e04
221dist/2024-09-04/rust-std-beta-wasm32-unknown-unknown.tar.xz=414608d21dd7cd268ad57a6be916b0be2c95433e2bc14083ff8c4a7a7cc8952b
222dist/2024-09-04/rust-std-beta-wasm32-wasi.tar.gz=c745c8682a54abe37c2734bf0c7931b6d10269eb56c07765e39dd289dab67e01
223dist/2024-09-04/rust-std-beta-wasm32-wasi.tar.xz=732c12837772531eabc44a7d4a545e130e2ae220d3670748fa2050cd4c65a18b
224dist/2024-09-04/rust-std-beta-wasm32-wasip1.tar.gz=2b54c587ddd908481f5561d6de60c7fdbef234ca2ecec4eb4d4791416038f7db
225dist/2024-09-04/rust-std-beta-wasm32-wasip1.tar.xz=799ee151f0aa3c5ec132f03c42152393d966c9249972967133edef56b30d66ae
226dist/2024-09-04/rust-std-beta-wasm32-wasip1-threads.tar.gz=120b8cad5a2a153bee58ccf81824e6a1c7c16befdd2785f963a9b2dfc350b9f2
227dist/2024-09-04/rust-std-beta-wasm32-wasip1-threads.tar.xz=5d74a8dc4731ab433cf796e7568122c7ca1463c648d2b49876ae1deaeaefa314
228dist/2024-09-04/rust-std-beta-wasm32-wasip2.tar.gz=911e60f2976d3b98dc9f6e82f72c459c5e07713e2dde2c7337569a71db2d1218
229dist/2024-09-04/rust-std-beta-wasm32-wasip2.tar.xz=947d312ec07c6190dcd4abeb493a2b67ac64a9a549ef30372c8eee7164c74883
230dist/2024-09-04/rust-std-beta-x86_64-apple-darwin.tar.gz=7b6e65885f14982f1112a2c0e8dd3266b1c4313276342ed98f2681432720b8c6
231dist/2024-09-04/rust-std-beta-x86_64-apple-darwin.tar.xz=cdbe462e3935c5a34415275afe830a6b5edae2fda84ed35e836ae868c884d19f
232dist/2024-09-04/rust-std-beta-x86_64-apple-ios.tar.gz=f75e7896ed5c9b64f817e9b2d6ed4d637e19ff26a14f72a570b4eff532f5b32b
233dist/2024-09-04/rust-std-beta-x86_64-apple-ios.tar.xz=60db5599bdad826b32637dfd2989daa90597b278ac14b42ede3a7c15aed119e0
234dist/2024-09-04/rust-std-beta-x86_64-apple-ios-macabi.tar.gz=3f57688112d2d80010636724acec5083bce0bc0a901f9ccbd76a09bb21de2b17
235dist/2024-09-04/rust-std-beta-x86_64-apple-ios-macabi.tar.xz=841dcf3eba0ad5b7bc8a4d55fabca80a1a27a3d697431c251b48912131148b6e
236dist/2024-09-04/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.gz=96af596e4bc63519decc0e17005006aee8a2f22258d86b6efa25a94fbbe62f23
237dist/2024-09-04/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.xz=4215a327f11bc7fa02546e69cb52c6c7bfe6a1ca602a6bf7a266e11937204bef
238dist/2024-09-04/rust-std-beta-x86_64-linux-android.tar.gz=80849fc95791de8cf98da9ebd405a4e268445b22b9413c8545870fe83f5891c7
239dist/2024-09-04/rust-std-beta-x86_64-linux-android.tar.xz=f849ad9d7ccc7eda06404e3bd67f150c3d8dfa66609405435fb2ba09c00ca136
240dist/2024-09-04/rust-std-beta-x86_64-pc-solaris.tar.gz=f871244a44131b1e2f56ad7c77ccb4e7433f39d6b248951f449914a65178bea3
241dist/2024-09-04/rust-std-beta-x86_64-pc-solaris.tar.xz=933b3b634b5caf57213be093977b0f56ba3609dc9407ac026079f75f4783642d
242dist/2024-09-04/rust-std-beta-x86_64-pc-windows-gnu.tar.gz=28ef28c4b17b5e8a20ae5f19feeb4643864f64ac8e9c68b84f8cec067317c339
243dist/2024-09-04/rust-std-beta-x86_64-pc-windows-gnu.tar.xz=1e40daa830d390d57c0dd23331849edf45adc0a35d120725bfd9fae43edf13e1
244dist/2024-09-04/rust-std-beta-x86_64-pc-windows-gnullvm.tar.gz=b9a6e290d7b9c71b4a33164116cc523654c3147168a04fc7608a27397c100944
245dist/2024-09-04/rust-std-beta-x86_64-pc-windows-gnullvm.tar.xz=a6e1db0945d1a5243caf2d1ad7d24b4dd16f8882d3e88118f203c91ff5e2cd52
246dist/2024-09-04/rust-std-beta-x86_64-pc-windows-msvc.tar.gz=8d70d70a645b36e6de01b08a34a28a995c73f91e8a285607a5516180d3a93350
247dist/2024-09-04/rust-std-beta-x86_64-pc-windows-msvc.tar.xz=d5a6fc72bf9dc0b7083d364358232a5df68b2b9f03a1a553bbeecf2a84936cb8
248dist/2024-09-04/rust-std-beta-x86_64-unknown-freebsd.tar.gz=01e159405178d883deb8eb09e9101826e7591c8d8fd6840133c0e8f77e00e395
249dist/2024-09-04/rust-std-beta-x86_64-unknown-freebsd.tar.xz=7fddda753b5f3e244de9427de6399052c81df87bd2b76d2c1f9a0fa4d1d1cddf
250dist/2024-09-04/rust-std-beta-x86_64-unknown-fuchsia.tar.gz=2c37eaef53b50d812205ed24de580165bfa800658ab9a9ea503667105119a544
251dist/2024-09-04/rust-std-beta-x86_64-unknown-fuchsia.tar.xz=8d1e3d290c5736c4e7a48a6b1a88ba18b9e68876638896b31b61917c6fcd2af4
252dist/2024-09-04/rust-std-beta-x86_64-unknown-illumos.tar.gz=83a57ec9e9696a63dadf9307e0cce117b92be8e9b7d17edfe410d38f75629202
253dist/2024-09-04/rust-std-beta-x86_64-unknown-illumos.tar.xz=3db6747b556581f02e0cf058b93538785d1eca9aaefe36dc8b7667428fa05ef7
254dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz=fe737fb11bd2a16b7636013f37041a35126f0bf8b2c562ac38384d45e49088c4
255dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz=a7a3f5245067b2967bbc4bd010ac3a6e9613cc9b6462c53cdcf0b91eab6cddbb
256dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-gnux32.tar.gz=8b3fa007713d4e37de79d5662a3de446d378e00fc631478e465fb170447c49ea
257dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-gnux32.tar.xz=c2dd95e94f9a9bc2d31e807a3b7cc5cb43a994cd4400ac1636ade3005344146b
258dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-musl.tar.gz=a294420b029900027530932ebd29cbd3f17672fffc60128122473088329f8cb8
259dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-musl.tar.xz=72a1c8052534e1b986ebd1bb5364de9e9e67353cfc6de7341f759d8da370bf2d
260dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-ohos.tar.gz=7227b14f3148302d954756bd4df570289aa8dedd8d889b5399821356ac097f8a
261dist/2024-09-04/rust-std-beta-x86_64-unknown-linux-ohos.tar.xz=61cf15b98ba67fb648ee87901bc33644efc342c2b6401ab8b6a14cae755cbd8d
262dist/2024-09-04/rust-std-beta-x86_64-unknown-netbsd.tar.gz=61b604f112031aadd7ad87e535cbb4966c53099e276fc76d99fecd0e912b2e28
263dist/2024-09-04/rust-std-beta-x86_64-unknown-netbsd.tar.xz=428a0a6955266ac0e74b11bb4c58a461c041f13f241d5a2d698139b4b5839ad5
264dist/2024-09-04/rust-std-beta-x86_64-unknown-none.tar.gz=c8b29984bf2b6d77893cda301e55dd128da76bad7dd87c751aa5585add2262fd
265dist/2024-09-04/rust-std-beta-x86_64-unknown-none.tar.xz=1460566b927586f6afa531aa1cefa9aec0d4e829a08a151638a42c255b6a7ef3
266dist/2024-09-04/rust-std-beta-x86_64-unknown-redox.tar.gz=17503716bb940d50db15bd1b467fe03ff15474f1b0b162eb3f2891699d898768
267dist/2024-09-04/rust-std-beta-x86_64-unknown-redox.tar.xz=66007a1f995597a697747886eacbe38c9d6a588b1ed365e6b4b522c72bc7b8af
268dist/2024-09-04/rust-std-beta-x86_64-unknown-uefi.tar.gz=b612bac841c9f93bc6189971bf82df47e8730cf1696d2d6f3344be67a6c28f0c
269dist/2024-09-04/rust-std-beta-x86_64-unknown-uefi.tar.xz=3dd0f70f8f226160700a52c19aebc2f27801360a8d2882702c5a0be94560da3b
270dist/2024-09-04/cargo-beta-aarch64-apple-darwin.tar.gz=3efe0d5356824c1620e223686c81cf10b629db0a0c385c3177b5fe1866776b5c
271dist/2024-09-04/cargo-beta-aarch64-apple-darwin.tar.xz=07deeec79d74a39b0cf971bd980936eb476005bf0e832adef9e4521bba3c010b
272dist/2024-09-04/cargo-beta-aarch64-pc-windows-msvc.tar.gz=c9da3632a36a2db512015580bd20e0b5207f8a0d98ae093a99755e4c512215f8
273dist/2024-09-04/cargo-beta-aarch64-pc-windows-msvc.tar.xz=b0b9aabd90863c1671ad80955277c2f006654779837cb1358774b8189fba357b
274dist/2024-09-04/cargo-beta-aarch64-unknown-linux-gnu.tar.gz=cb862535909b1f0fea6ee40a6a888f2f860f95b8700b1d5167bd7a41b9e33958
275dist/2024-09-04/cargo-beta-aarch64-unknown-linux-gnu.tar.xz=b1ff8f714cda2c98a7129e861adcf33245bd84bdfbdcec9fb1a89545dcd033f7
276dist/2024-09-04/cargo-beta-aarch64-unknown-linux-musl.tar.gz=5c3659e979393c8c1dbe1a6ccb09eea412671363e228f0c7ab4bd4896cd48470
277dist/2024-09-04/cargo-beta-aarch64-unknown-linux-musl.tar.xz=0435e1332b1bc40a280fc867eab54e925135eba774c3bc0553a8bb100d644f59
278dist/2024-09-04/cargo-beta-arm-unknown-linux-gnueabi.tar.gz=6f7f079ef04c4b1d14864cba67ec650a3e43f3baa81fea1797d00067f22a72a8
279dist/2024-09-04/cargo-beta-arm-unknown-linux-gnueabi.tar.xz=549607bdeacd26fa770ecb00ce54cb3ea72c5568e65966c1fddc3a540b9f6e6a
280dist/2024-09-04/cargo-beta-arm-unknown-linux-gnueabihf.tar.gz=e23b18a2a86bca5320b66c54d43a54d90db1b787443cb0e04d66e9d7428fece7
281dist/2024-09-04/cargo-beta-arm-unknown-linux-gnueabihf.tar.xz=5968c534ce88a2574a4f59a0ced82df36aef9c7338ed9c718e85aad514a792f4
282dist/2024-09-04/cargo-beta-armv7-unknown-linux-gnueabihf.tar.gz=3170e39d306e797e5631884c629ecb33a54635056b5a71fbebe5372c1c34da37
283dist/2024-09-04/cargo-beta-armv7-unknown-linux-gnueabihf.tar.xz=76b729642fdba25c015e49e444e158170d3ed2ac0a533ba7c6095ecdc0862ba5
284dist/2024-09-04/cargo-beta-i686-pc-windows-gnu.tar.gz=c58826189772af945c9d40868e80d64359f4108afa06d150a3d350323b0eb8df
285dist/2024-09-04/cargo-beta-i686-pc-windows-gnu.tar.xz=1b644d661778bfcbec892eab17bee06861940037992821c4ded8321a69c0f6a8
286dist/2024-09-04/cargo-beta-i686-pc-windows-msvc.tar.gz=e026eac2c2e891976e085d26591d85000dccf3c3654f3edd65e99c6c0ba43574
287dist/2024-09-04/cargo-beta-i686-pc-windows-msvc.tar.xz=e7307b2e55302228c5036991ca6141a5202a16f43b0148607f3802fdc90aa0cc
288dist/2024-09-04/cargo-beta-i686-unknown-linux-gnu.tar.gz=0a00604bad2096cd0b0db59a1b41b5737696015a4ddc60f9b1132829a4cd0a5f
289dist/2024-09-04/cargo-beta-i686-unknown-linux-gnu.tar.xz=a623eecb18a21b2dc6a4b62876b8fa4fc467c53fdd0cfdac493f89d619be5aa7
290dist/2024-09-04/cargo-beta-loongarch64-unknown-linux-gnu.tar.gz=64955892d99d0e7f0042016d7a5e3ac87f89b6f514b1934611050f89aa5f6a28
291dist/2024-09-04/cargo-beta-loongarch64-unknown-linux-gnu.tar.xz=3c7c3061c466fc4a1eb836c97cab95d511778d77d220189a6a77f8e5b46e4888
292dist/2024-09-04/cargo-beta-loongarch64-unknown-linux-musl.tar.gz=be1c255840307bd24c2c8b5c92e2fa0eed6037daf3ed9597e17bc56f313ef506
293dist/2024-09-04/cargo-beta-loongarch64-unknown-linux-musl.tar.xz=d0e456bc8b64a0ee778e69eac75b6a258c37f7b2d06496a8dfcc47d91e1c2dd1
294dist/2024-09-04/cargo-beta-powerpc-unknown-linux-gnu.tar.gz=b9cd94c4ac9a11eece8712b325d08007b641d5da7487fd38b30dbaf0f3d1b5a4
295dist/2024-09-04/cargo-beta-powerpc-unknown-linux-gnu.tar.xz=68dd4a74494fe8f02781a2b338eff5f5cc78d66048eddd3ed7cc3e31dcecd2c8
296dist/2024-09-04/cargo-beta-powerpc64-unknown-linux-gnu.tar.gz=b464ad7a1233e3ad5129340e623a60d2ad0882843acbef60a9aed45a453ccac1
297dist/2024-09-04/cargo-beta-powerpc64-unknown-linux-gnu.tar.xz=1167f3d38628c01b11dfb9f66eacdf4cd519b46ea1b8c9d182a390e7d552a933
298dist/2024-09-04/cargo-beta-powerpc64le-unknown-linux-gnu.tar.gz=eb16d3791a79aa384326e2e79aeafd8d3e27adf4733a5bcca441e278e578b60e
299dist/2024-09-04/cargo-beta-powerpc64le-unknown-linux-gnu.tar.xz=d100dcb6437e87b3b687a7059dd932567855f68d962a109268fcce5a5aa688c6
300dist/2024-09-04/cargo-beta-riscv64gc-unknown-linux-gnu.tar.gz=ee771d98286302d4a8a93ba5165c342a2fbe770bf7758f8bbc490ad188d2e5cc
301dist/2024-09-04/cargo-beta-riscv64gc-unknown-linux-gnu.tar.xz=d2e9eb5a1800545eec4186b5252737f3b3a02d232473e6864e4c6fd752a69623
302dist/2024-09-04/cargo-beta-s390x-unknown-linux-gnu.tar.gz=b35ef65a54c9dd068a699f4210c0c88bd2777308fd7ddad3c7d0b9a1c994657e
303dist/2024-09-04/cargo-beta-s390x-unknown-linux-gnu.tar.xz=eaee5c891aab499438427c2c965c2c8f4471a3b051effee139f251f544ac4ac4
304dist/2024-09-04/cargo-beta-x86_64-apple-darwin.tar.gz=917ba277cb3f050fb3e65126b587245bf89891256faec33a57e2b1a064075534
305dist/2024-09-04/cargo-beta-x86_64-apple-darwin.tar.xz=179d6fe24981d477eb806ba714bd639750577cb9de2d152116e994d3955ade38
306dist/2024-09-04/cargo-beta-x86_64-pc-windows-gnu.tar.gz=6aa52989d1ccb25b03433dec436507455256cb1e2ed305ba747c342551d0778f
307dist/2024-09-04/cargo-beta-x86_64-pc-windows-gnu.tar.xz=bc0403c00fa2093f09d95b1ad091850b2450f4e1d7fac225a730d7363074806b
308dist/2024-09-04/cargo-beta-x86_64-pc-windows-msvc.tar.gz=5c1e018191c296ddc443699e48c4f1a3e700983fc45ea230172f35881d09e103
309dist/2024-09-04/cargo-beta-x86_64-pc-windows-msvc.tar.xz=f1b44ff315f5332815263d5b0a1cd06f852431acbf5cc902bb6723c3398e11d6
310dist/2024-09-04/cargo-beta-x86_64-unknown-freebsd.tar.gz=7da980ccdb2d6bc0946749fcceaed7124f311b38bf28cef0797ca85909f5d5fb
311dist/2024-09-04/cargo-beta-x86_64-unknown-freebsd.tar.xz=a935462749686fb68eac699ea67ef1afaa22ed0b147d2e4d0a6712f225341fa2
312dist/2024-09-04/cargo-beta-x86_64-unknown-illumos.tar.gz=ccc3d29e88482885090f6fb954518bcb0b6bd3f54283702df9e0e80b78454c01
313dist/2024-09-04/cargo-beta-x86_64-unknown-illumos.tar.xz=c0cb33e5088f2b9f5fe8bedb3915fec10e7f65563013b914e0738486b5e8ebab
314dist/2024-09-04/cargo-beta-x86_64-unknown-linux-gnu.tar.gz=84fdbbc0912c4020dd1baec1d603c5d5c1986c7b321d3d9c0c42184aa6347f15
315dist/2024-09-04/cargo-beta-x86_64-unknown-linux-gnu.tar.xz=8f8948750141c3ee8a50e575f196bd972876e784cf1793b256a5a9462c9e3d44
316dist/2024-09-04/cargo-beta-x86_64-unknown-linux-musl.tar.gz=9ef6b7450b94ce202f1b603151075bf8f595022f2c52f6bcd1c4a72423db2b80
317dist/2024-09-04/cargo-beta-x86_64-unknown-linux-musl.tar.xz=5b63b98d67e211057fbaeb1db3721b90252a331143ca267bb30eebca4ac01cdd
318dist/2024-09-04/cargo-beta-x86_64-unknown-netbsd.tar.gz=69d500e2fca1c44fea31310b0636a9af009d4ec96b5ed2335864c47350fa7b59
319dist/2024-09-04/cargo-beta-x86_64-unknown-netbsd.tar.xz=7da3c2641f0ecdbd8b770402356416750a52265a6848d3734fce2195c889768a
320dist/2024-09-04/clippy-beta-aarch64-apple-darwin.tar.gz=15395c04235f2475d5e41371e2797f181af71275f82f04fbb885b1cd7a197f45
321dist/2024-09-04/clippy-beta-aarch64-apple-darwin.tar.xz=8be6fb9e0cafcd262594cfc4a36807bede9e158cbf7eb38c0f25144bf3bfdd1e
322dist/2024-09-04/clippy-beta-aarch64-pc-windows-msvc.tar.gz=b043e41facce81a5fc607f2268330b279d7e26975e409158ac2cbbc841d10f85
323dist/2024-09-04/clippy-beta-aarch64-pc-windows-msvc.tar.xz=ba41705b213f863416120c28fa4a7959cf41e261cce8233b12fd91aa0157d601
324dist/2024-09-04/clippy-beta-aarch64-unknown-linux-gnu.tar.gz=b093269be813ea76964de2c03c7380bcefab1e7d6e31c93fd3f374619a99a5f0
325dist/2024-09-04/clippy-beta-aarch64-unknown-linux-gnu.tar.xz=06d71273208fcbfa5958987038eacda066d4518b5cd6bd7405a981bf841868ae
326dist/2024-09-04/clippy-beta-aarch64-unknown-linux-musl.tar.gz=aa159e61c4986def9d27f55504d822d6023c277a546e95079161577ae2991df4
327dist/2024-09-04/clippy-beta-aarch64-unknown-linux-musl.tar.xz=7a3023b98a1c72c993d176c85f4790b234c41f35184636d29deeba40d51587a2
328dist/2024-09-04/clippy-beta-arm-unknown-linux-gnueabi.tar.gz=8e30a0377b780311bf51bdc48dcf233a344cb2fd9ae9aec174bc87d29f94c34b
329dist/2024-09-04/clippy-beta-arm-unknown-linux-gnueabi.tar.xz=488c28d10f45a498b1054fad9feb72a848d0668cd12d29b3a81f5569b1145018
330dist/2024-09-04/clippy-beta-arm-unknown-linux-gnueabihf.tar.gz=db25c9aa95b08acdaeaba407367a823e9e2094b0616c80b0c8a84d7c2f6c4292
331dist/2024-09-04/clippy-beta-arm-unknown-linux-gnueabihf.tar.xz=7c320cc979ebdde8753093a0e4b1da850b1b680c1ecd10c5d3e33242af12e4dd
332dist/2024-09-04/clippy-beta-armv7-unknown-linux-gnueabihf.tar.gz=835c0912556cd5b0b180856359db8d75204830984fb1b5f72bf436f137955fa2
333dist/2024-09-04/clippy-beta-armv7-unknown-linux-gnueabihf.tar.xz=836a54126122c2abfc649982708d97b6451eaf3a31ba556ed73ec1f4269be738
334dist/2024-09-04/clippy-beta-i686-pc-windows-gnu.tar.gz=90b52880cbd51bacb9597ee4fed07fa13fc399f03c5ba840c0c9e6c0a096b772
335dist/2024-09-04/clippy-beta-i686-pc-windows-gnu.tar.xz=c41be130f3276c4c905eab580e866682e4f3bbdd11b348f4d1438c67602fb036
336dist/2024-09-04/clippy-beta-i686-pc-windows-msvc.tar.gz=f023406dc34bb09d020a41fdf6ceb3e60c90dd38380fbbcc26e9f4e144eebca0
337dist/2024-09-04/clippy-beta-i686-pc-windows-msvc.tar.xz=b21746ec1a2c9fc76ce82917b65c8e73482aaefe5f99282f0c5e9682a3af486e
338dist/2024-09-04/clippy-beta-i686-unknown-linux-gnu.tar.gz=cce9cd9d470250c73437e151622b02f804fff3db045c6de25ee949aed435c383
339dist/2024-09-04/clippy-beta-i686-unknown-linux-gnu.tar.xz=9565f70c8d90540d464fb1f3b8bff52b77bf55189ab938b2c18bdeed751e9e4c
340dist/2024-09-04/clippy-beta-loongarch64-unknown-linux-gnu.tar.gz=0d1d63a8eca4d0812446f94bc793fbb7660da11babf5d8607d2798749c938a6b
341dist/2024-09-04/clippy-beta-loongarch64-unknown-linux-gnu.tar.xz=db178c0eaddcb318653d4b05fe0d97738440713f0cd120657cc2a3e758d52432
342dist/2024-09-04/clippy-beta-loongarch64-unknown-linux-musl.tar.gz=a604be9f091f88e97f702f619d86b91bff0a20fbd267200ac1e66df2bd823766
343dist/2024-09-04/clippy-beta-loongarch64-unknown-linux-musl.tar.xz=93c395e07a8457b8904c470751490326303e2ceaa93b737f8fc521b49dfbd69b
344dist/2024-09-04/clippy-beta-powerpc-unknown-linux-gnu.tar.gz=08aa4a8ccd7569a0513c2443e2b10993cbb92bed531370891452bd3dd8c0eb82
345dist/2024-09-04/clippy-beta-powerpc-unknown-linux-gnu.tar.xz=f6b0222261e1e2b1465549eda331c16d4ea6729d15e6fe208dbc4cce115e75e7
346dist/2024-09-04/clippy-beta-powerpc64-unknown-linux-gnu.tar.gz=96e2dca5adb7f5ffe41e5ff30e9419575f3991adde8bdbba023d11f344044dc1
347dist/2024-09-04/clippy-beta-powerpc64-unknown-linux-gnu.tar.xz=3ced511aca7268960c616d0105da02a92d83b7983b6accbb37eba722eff64cbf
348dist/2024-09-04/clippy-beta-powerpc64le-unknown-linux-gnu.tar.gz=421c27b25b79b9c88e4b65ac7cd0a4f06934a63324c56870cd7fff905869a33e
349dist/2024-09-04/clippy-beta-powerpc64le-unknown-linux-gnu.tar.xz=63254a01ab1a9a21cdb5a0b3a4da9e8ae7921b9ceec2339df4bbfb19ea7c6454
350dist/2024-09-04/clippy-beta-riscv64gc-unknown-linux-gnu.tar.gz=4ee751b09816886f8edbc431ab8c63df6c664dbedc40a67748fb17a639a070f1
351dist/2024-09-04/clippy-beta-riscv64gc-unknown-linux-gnu.tar.xz=7e9ffb62ab6c8f1cbb5f9e0b0a3c79cf104dfac09be2ef1d5e6b6c0c34b406c7
352dist/2024-09-04/clippy-beta-s390x-unknown-linux-gnu.tar.gz=0a49c1e844859f27b1283087c476a559c4c3a4c33c8ce2748165cc5c0b0ed039
353dist/2024-09-04/clippy-beta-s390x-unknown-linux-gnu.tar.xz=6daec872df52125b3de854ff0962433ba13b7cbe5519edfb29944fbc4cc817ad
354dist/2024-09-04/clippy-beta-x86_64-apple-darwin.tar.gz=6611771ce0e7cc19fbbb9383875edaf7de975b6cf154fcd5cd18a09f09793a36
355dist/2024-09-04/clippy-beta-x86_64-apple-darwin.tar.xz=1c90c63f87b43797aa04b88e4c1d0fe0f2ad131060fc8495be190d0ebd89a43e
356dist/2024-09-04/clippy-beta-x86_64-pc-windows-gnu.tar.gz=53a04c1426bc151fec4699848e33141df1b04097d4883c07fc07d2bf0bcddf8a
357dist/2024-09-04/clippy-beta-x86_64-pc-windows-gnu.tar.xz=be748b65b238e3e948e2421f82a72d1108ec79651381b1dcdaaa97df15c981df
358dist/2024-09-04/clippy-beta-x86_64-pc-windows-msvc.tar.gz=24ea01230bbf6b4f43094cfcf6c7c72e6d319c493ff3817456c667b89026c608
359dist/2024-09-04/clippy-beta-x86_64-pc-windows-msvc.tar.xz=37130d66eeaed68f0780b1dc19f2f59a2a0419350920521690d4870d7d71d8f1
360dist/2024-09-04/clippy-beta-x86_64-unknown-freebsd.tar.gz=4e427b7ea0f334bd6ea8c2de7fc1d5bf43d5333bc7a435cf65543c564fab6e41
361dist/2024-09-04/clippy-beta-x86_64-unknown-freebsd.tar.xz=b221491159f5352dd392f6ee6419f9d5d693ac347df9863fdac77f2ca1cf6a67
362dist/2024-09-04/clippy-beta-x86_64-unknown-illumos.tar.gz=9d835b4369fb51ab8c1eafb553b9304548e91dd32784ae81cb783b40985d2eee
363dist/2024-09-04/clippy-beta-x86_64-unknown-illumos.tar.xz=a6780c72c71f2e6c6e1bbc8bc4e639389ab9b7aed0ee7e2e0c21819156b5578e
364dist/2024-09-04/clippy-beta-x86_64-unknown-linux-gnu.tar.gz=613bf471668edb8209910dd13086cbefed0da6dea46dce2013a000ecc4315e45
365dist/2024-09-04/clippy-beta-x86_64-unknown-linux-gnu.tar.xz=e3328f37cfc89de1aabd89653a42ff54b8dadcc49e651b22fda325c00644309d
366dist/2024-09-04/clippy-beta-x86_64-unknown-linux-musl.tar.gz=d6a7a5ee37587c0b92aabfc5b9466d175cb8d05d209412a5beee8a61c241396f
367dist/2024-09-04/clippy-beta-x86_64-unknown-linux-musl.tar.xz=dc73b566be162eef2032eccb69b3542ab3c72b760fe7eeaacfcd367ee0b20f12
368dist/2024-09-04/clippy-beta-x86_64-unknown-netbsd.tar.gz=6f1e0be96b59a63a6616b68717c0a393fd99ec1a768affdd5c86249e5eb5d210
369dist/2024-09-04/clippy-beta-x86_64-unknown-netbsd.tar.xz=30fff8aceaedf6d76c6fc0636c2ddecc97fb66f9219b86299550b7312f043e38
370dist/2024-09-04/rustfmt-nightly-aarch64-apple-darwin.tar.gz=37a5383ba608540ed57484e221e87f3cd78fd35f068e98f0da1d3932d86d2eff
371dist/2024-09-04/rustfmt-nightly-aarch64-apple-darwin.tar.xz=a3935c24f5ac1d69756f4598f227e43304ede4e35f9808b3db9f04adfecc5445
372dist/2024-09-04/rustfmt-nightly-aarch64-pc-windows-msvc.tar.gz=0b21dd8c54055102a41f7ad622565c1fc36ff97642f2e2998e48d1cb1ebae196
373dist/2024-09-04/rustfmt-nightly-aarch64-pc-windows-msvc.tar.xz=2a543dbf79042924e8c05aaeed97ff37089c8f6994977b932bacb0403f11584c
374dist/2024-09-04/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.gz=8d9b19108587e6d8d12270ff025579dc559173245e08b94113bb91a7ada80670
375dist/2024-09-04/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz=d288770b8a85e24b35561129cc2a09c848006c547ce5fa35d33c8ed7e85d5322
376dist/2024-09-04/rustfmt-nightly-aarch64-unknown-linux-musl.tar.gz=2e69adc7e75efcd889108d185f200db6280494b05de6a06291dbf26ef32e5d42
377dist/2024-09-04/rustfmt-nightly-aarch64-unknown-linux-musl.tar.xz=fca74af6db1c53a79a4412a020f56ec9c61603d3373eaa936a57dad45f3751d7
378dist/2024-09-04/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.gz=b2be0123cde401aaed259a9387e04f3978fbddce98096b3a8a654b76f92f2e6b
379dist/2024-09-04/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.xz=c44c42a59887f1479383694f43688f9f2a8174ac89fdf657b2e8619372e0bcef
380dist/2024-09-04/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.gz=3d99bab3656d0318173c414dcb8930291ab43285883ca80a04d854023a4201a3
381dist/2024-09-04/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.xz=29e506c1a18449b84a643f0075f1263cd8512662f55e2c5b18305213e4246783
382dist/2024-09-04/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.gz=b486ff8e1e136ba15c9bb14db08dcd14b612adf1617cf1f820a23ee403958049
383dist/2024-09-04/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.xz=b4d593b5a89bb42e7f9eaa17df12778dd816c75e8997e964371286041691cbbf
384dist/2024-09-04/rustfmt-nightly-i686-pc-windows-gnu.tar.gz=dcf94a642166b0664a63c4162a2d303c75fdef6f2a7f9b3e502ba5baae117f69
385dist/2024-09-04/rustfmt-nightly-i686-pc-windows-gnu.tar.xz=4b27ac17748d8cdcd2bc7b9956541333997c6ec56f7a770628dc8e57fc7f442f
386dist/2024-09-04/rustfmt-nightly-i686-pc-windows-msvc.tar.gz=8a3caf2dc2b786ca58f6d37c011dc210e883398a3734f9f13678a9e57c5ccf5d
387dist/2024-09-04/rustfmt-nightly-i686-pc-windows-msvc.tar.xz=e129b88dd69200e305cc5ae16231952d85f9461dad13fd3bae5e889dac89d9c6
388dist/2024-09-04/rustfmt-nightly-i686-unknown-linux-gnu.tar.gz=1bc390abb8f754d5b8679b33186b97262dadff9c6db7268cfbcfe605c628a681
389dist/2024-09-04/rustfmt-nightly-i686-unknown-linux-gnu.tar.xz=8420198b0a22aaa5951678b954bcce636c78ba6567a06484c830b3eded815228
390dist/2024-09-04/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.gz=05071fe12ed4030464f996fe36dd2e3f60d3701956275499acaeaf03a16e36eb
391dist/2024-09-04/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.xz=2bfdabab0d03e570c073463a8867bbdb54879f501b0822906fa2aa5705603d7c
392dist/2024-09-04/rustfmt-nightly-loongarch64-unknown-linux-musl.tar.gz=0c7e3b10626a9d9a3f8522175085169ea4e34568a7be0093c6682bb9659bf65f
393dist/2024-09-04/rustfmt-nightly-loongarch64-unknown-linux-musl.tar.xz=deb2b51a41dae2e72188fa6c06c4a7bdb08c2723b3ce823602087bd9eb36eb07
394dist/2024-09-04/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.gz=e34590ec2cbd481ffd237101c239f27bd2298517bb7fc9c9f9b6d71abfff69e4
395dist/2024-09-04/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.xz=9cd0d3dd57b764ad054d4295f822a7fd74a1b1ee5babf77ed2dc2c39ee60b7a2
396dist/2024-09-04/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.gz=62566938d97058dd38b1e0c97aa4421d709ce988544956d6a4aaf3e54425dbce
397dist/2024-09-04/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.xz=8f27c6fc5b56092302e49da973ff08f0d3131465bf9a701a9ddc91d373acc435
398dist/2024-09-04/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.gz=7637f3b8060635595a3d2fb83fef68e9990ff1adb1bd3288c7c41767b37ee2c4
399dist/2024-09-04/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.xz=3275f15e3d7e9ccb991f6f9a7059acefd0bee49bfd4cf0724aed11e51e3772db
400dist/2024-09-04/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.gz=29379bab930e7b350cec51be33663ad67a0d30922d658006911f895221dcbffd
401dist/2024-09-04/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.xz=4f71e948ec587836315d7ec98e6f3c6125a298faf1321b4524257d3c9664f9eb
402dist/2024-09-04/rustfmt-nightly-s390x-unknown-linux-gnu.tar.gz=5b9361317481269e090b4270bcf754caca8a1797f6b2d83a4c570a4024bb0dc3
403dist/2024-09-04/rustfmt-nightly-s390x-unknown-linux-gnu.tar.xz=db3bf98663017bec6b6beba5848a350d4d34f39e3f98bacb321866112cff7c15
404dist/2024-09-04/rustfmt-nightly-x86_64-apple-darwin.tar.gz=9d5b8c84f82ededb2370c20afdb6b7d06d97161a65348f4ee2b6ab2171236cd0
405dist/2024-09-04/rustfmt-nightly-x86_64-apple-darwin.tar.xz=e880f57ba68bce871fa67230db19aab1f146548254867f09e0d83750bbb50a1c
406dist/2024-09-04/rustfmt-nightly-x86_64-pc-windows-gnu.tar.gz=8b2c79814b202661c74584d7c4aeb35cc0c8520c4df1c81f2fb2896a22385191
407dist/2024-09-04/rustfmt-nightly-x86_64-pc-windows-gnu.tar.xz=c193e2f2b859239aa0489c65663fb83c4bd7a87571d5b6ca6572f722c46cef64
408dist/2024-09-04/rustfmt-nightly-x86_64-pc-windows-msvc.tar.gz=8d6583366248882490371ef5d4532f82ba1779cb993b0078ca6903f9b6a0c5be
409dist/2024-09-04/rustfmt-nightly-x86_64-pc-windows-msvc.tar.xz=0b69fdd8edb566a75cdff616e09223b10796a91eaf8bd90aa11ddd6af61381b9
410dist/2024-09-04/rustfmt-nightly-x86_64-unknown-freebsd.tar.gz=0a452883a9a494f1613f9b0c796d13745e56eb85597142a677c78daeca95a67c
411dist/2024-09-04/rustfmt-nightly-x86_64-unknown-freebsd.tar.xz=01eb4d938f6e9228cae297688340daf298bf6e5322a4e3cdb4e06554fa131deb
412dist/2024-09-04/rustfmt-nightly-x86_64-unknown-illumos.tar.gz=4d9220bee07e3576f34c3a3dd327723ed660a774c4391f7a4a7e6a78ea2ca88c
413dist/2024-09-04/rustfmt-nightly-x86_64-unknown-illumos.tar.xz=2e2cd60bbb356d7b702c511ba56b480ffe0bbceef8f945be0f7b8e338d7998a0
414dist/2024-09-04/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.gz=4aac5347a6011ff27609b4a6b413454d610a5687253a7e09d1bcc8c0e3aa0e6f
415dist/2024-09-04/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz=ad3a0127c2cc09893fb19e4c58faa6188afeb575996ee4708eae6c5713ff9646
416dist/2024-09-04/rustfmt-nightly-x86_64-unknown-linux-musl.tar.gz=869fbf24ca816b0bf931da79920ae8edaef8a749271434c6522f7ff55920a507
417dist/2024-09-04/rustfmt-nightly-x86_64-unknown-linux-musl.tar.xz=f4870110759f28ad1cdde912fd3f79bd8eb0073bd42e436a456f0d04e7c2bd26
418dist/2024-09-04/rustfmt-nightly-x86_64-unknown-netbsd.tar.gz=eac75028d080b3d4ab86dbbb4f46c7734c60bd747e0325afbaa3b7a7cf0003be
419dist/2024-09-04/rustfmt-nightly-x86_64-unknown-netbsd.tar.xz=fe13bf3e0ec3088b35608d65b76f77014e0b90886ba81decfa21019ff222c79b
420dist/2024-09-04/rustc-nightly-aarch64-apple-darwin.tar.gz=ecda4ccde26bf6f8405ddbb838239c4f42e9136001e8954b21357d86343ad06d
421dist/2024-09-04/rustc-nightly-aarch64-apple-darwin.tar.xz=cdb1b12e6acf5b2bc5a5328f7cb292760d391b3e269d2b2143c87a344efcc9dd
422dist/2024-09-04/rustc-nightly-aarch64-pc-windows-msvc.tar.gz=46af634f433b9c7182637880f7b910ef13d2da9b1d7d4e255f9cd302691b99fc
423dist/2024-09-04/rustc-nightly-aarch64-pc-windows-msvc.tar.xz=a14935b0b82835388886c826b703057af093dfe16f0367c058dd6d352e585859
424dist/2024-09-04/rustc-nightly-aarch64-unknown-linux-gnu.tar.gz=68ced431fa8682f83dd79901ccb986accc5a6d948c837c43eb5fa244c19eab88
425dist/2024-09-04/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz=fa078e5edc9f6c7be5a39eac722f142d526b68e30acc8f81bd001035fd657a83
426dist/2024-09-04/rustc-nightly-aarch64-unknown-linux-musl.tar.gz=c88a3c5cbb7a8a55f18d27f2c573192d824e33657a143641d1c8fa1504cbc805
427dist/2024-09-04/rustc-nightly-aarch64-unknown-linux-musl.tar.xz=00170baf596aa6e043598e3c38153f29c1cbfe4a63298d4007979877e9c3e1c2
428dist/2024-09-04/rustc-nightly-arm-unknown-linux-gnueabi.tar.gz=19a55b89192897c77240404ff7ed8c64cdba106db13be4a1ae86a9ac44753c30
429dist/2024-09-04/rustc-nightly-arm-unknown-linux-gnueabi.tar.xz=42937abfd803faed251cecc7ac74abcc3c40332b8466535cc1727138fe03beeb
430dist/2024-09-04/rustc-nightly-arm-unknown-linux-gnueabihf.tar.gz=3cc5d6e89cd8b53db0c2900a73e59c188e90d042b2e43502e384f44d229b93e7
431dist/2024-09-04/rustc-nightly-arm-unknown-linux-gnueabihf.tar.xz=4e1ff68b91e0cc730ca6012aa577aaf73dd5108d0b26575eaade0a2380914fe0
432dist/2024-09-04/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.gz=082a2efdf341bdfd9bbe3e2340ae8dbf71bff71908439696d30fa25d00c5fe1b
433dist/2024-09-04/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.xz=0b480d334a3709ca23dfd4839b518391031b6afde4cea0c30f08f160e39592a0
434dist/2024-09-04/rustc-nightly-i686-pc-windows-gnu.tar.gz=bf06c7a0faebb7dbfa2c09d02f506410f05abc6aa2ba54c515f2a429e904de2a
435dist/2024-09-04/rustc-nightly-i686-pc-windows-gnu.tar.xz=c49f577fa788bb6b40350dd9e9f9088ded647f0a5cf5df69135a83d2e085d9ca
436dist/2024-09-04/rustc-nightly-i686-pc-windows-msvc.tar.gz=e42254e299e367c9414c4b61715125410ddc3ecb30f2457e4eb843725c6b6abd
437dist/2024-09-04/rustc-nightly-i686-pc-windows-msvc.tar.xz=91a752b8a61b81281203297712b1bc775a227d9626b4c84d9e10130f428f843d
438dist/2024-09-04/rustc-nightly-i686-unknown-linux-gnu.tar.gz=6f23df634f3e7028d9a6e9989e1edbc2d00e9b435473807f526fd58c150baf3d
439dist/2024-09-04/rustc-nightly-i686-unknown-linux-gnu.tar.xz=de7cef873379e3d5ef80b402b9d98bdf74366de27e8f928125081628937baf76
440dist/2024-09-04/rustc-nightly-loongarch64-unknown-linux-gnu.tar.gz=ef0946845c41e096dced01baf6e843c57fcf695c82d5408a1b7c0a5bbd150b39
441dist/2024-09-04/rustc-nightly-loongarch64-unknown-linux-gnu.tar.xz=d43bb8987a3bb394d7d2cf39d78f54505700525b250cb30741b903bf8712f3bf
442dist/2024-09-04/rustc-nightly-loongarch64-unknown-linux-musl.tar.gz=00013767600b1a5153ed4faa9d227fd55a905c375f712a7ca59573a317684c97
443dist/2024-09-04/rustc-nightly-loongarch64-unknown-linux-musl.tar.xz=cf1c4351f70e951290583213dade06fe4a61e6dcbc2d0e69be54ea91210051de
444dist/2024-09-04/rustc-nightly-powerpc-unknown-linux-gnu.tar.gz=be1957674fdda24a9cd8935789db35a17d3a0d71219bb6f1256af74c64ffc697
445dist/2024-09-04/rustc-nightly-powerpc-unknown-linux-gnu.tar.xz=20541daa3925834012ab68f186a1f1ab4d060cced96646e2142a0f14c04b6ad6
446dist/2024-09-04/rustc-nightly-powerpc64-unknown-linux-gnu.tar.gz=0eb6741b87d430573c9b0d5b9ba9725c0c03caabc01d5ee258867ea19aedafdc
447dist/2024-09-04/rustc-nightly-powerpc64-unknown-linux-gnu.tar.xz=8ad4670b74093e3c7055149649145a4af2b2a3d24a68bf893ed72202cc934946
448dist/2024-09-04/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.gz=2d7b60aa2d4853eba2bb2644cb14768a5a864386da0854aca7c1f6397374dca2
449dist/2024-09-04/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.xz=17792328178392ad96b1a0c05405c61d0b1e7196bdca9e55baebff12a4949725
450dist/2024-09-04/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.gz=2db9fe19d4e1d7f68a0802868d9344e23932190e2d46407523208a67b5ba053a
451dist/2024-09-04/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.xz=f0d4df5e4cfeff06eb2cb07c6f9ac0596130923133571fd1702d56a0251ebb99
452dist/2024-09-04/rustc-nightly-s390x-unknown-linux-gnu.tar.gz=4d3fea9ec53336195c0daa2b2937507c2216537647829466a19acee2ce9e201a
453dist/2024-09-04/rustc-nightly-s390x-unknown-linux-gnu.tar.xz=84ca3dccf7af68a343fed4d209771bac7439149695f63517bd048287f4539add
454dist/2024-09-04/rustc-nightly-x86_64-apple-darwin.tar.gz=f6f43ebb82851edae301033a2cfbd02724849c7fda42294818f3081f74d3a1a3
455dist/2024-09-04/rustc-nightly-x86_64-apple-darwin.tar.xz=55b0db99f02bd4c5595117663f6b6cc739f63723999062ced0096727e627f072
456dist/2024-09-04/rustc-nightly-x86_64-pc-windows-gnu.tar.gz=6cb63e57f9873e40695b735b8cdb9f0de70306f1692161cd8f7767b4016dcf39
457dist/2024-09-04/rustc-nightly-x86_64-pc-windows-gnu.tar.xz=79bf54beceda0a7f6580d3ef336d8deae3991b3b57e4c6aba635f9d848cc860d
458dist/2024-09-04/rustc-nightly-x86_64-pc-windows-msvc.tar.gz=7757651c78d5000926bd5e91996ea8abdc32db8e67b31271cb70680f551edd5f
459dist/2024-09-04/rustc-nightly-x86_64-pc-windows-msvc.tar.xz=4671e03fc7100bac43cf332e387161c0ccde77d3f893a9dfdd27be63fff39932
460dist/2024-09-04/rustc-nightly-x86_64-unknown-freebsd.tar.gz=675f49fc6a51d5e715789bc9ad92b9db12a94a033254e34efb65358700207bb5
461dist/2024-09-04/rustc-nightly-x86_64-unknown-freebsd.tar.xz=f9efc43f26600caf2ef7c8084fe94ae31ba540ae7e9f104e6a587c6e4272cd6b
462dist/2024-09-04/rustc-nightly-x86_64-unknown-illumos.tar.gz=9bd74b7ee78a02306f47640b99d752ea373ffdd88067376d9f03564f07edfb24
463dist/2024-09-04/rustc-nightly-x86_64-unknown-illumos.tar.xz=67c5d546df9fa451d42804de2d439229e9b21eb9329ff16eeadcc52f5b6393d1
464dist/2024-09-04/rustc-nightly-x86_64-unknown-linux-gnu.tar.gz=dfc427db6a14237a12fd077ccc44c07e7bb46a1b2965a3fb1ddd78a2ec334b81
465dist/2024-09-04/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz=8d307dce871ae5f7cc1410e85bb7b38f80aed5c1138030b4f112e727fb8c654b
466dist/2024-09-04/rustc-nightly-x86_64-unknown-linux-musl.tar.gz=b7f84d8aab03afcf2bab8ed21fa3ece6ac418d076e0195381110adfac2aa1fbc
467dist/2024-09-04/rustc-nightly-x86_64-unknown-linux-musl.tar.xz=296083c6b50b7dffe8a62884bac7e831e29487a31c8e6fb319f04f0e62157175
468dist/2024-09-04/rustc-nightly-x86_64-unknown-netbsd.tar.gz=96986595ce82c735b87fe75f00722514c49e7118d38c4bced554c9017377ec91
469dist/2024-09-04/rustc-nightly-x86_64-unknown-netbsd.tar.xz=bf8c9411ff7279fd56bb7e3c68ac29c8ce79ba031317b76aac6a74d20f1511f0
\ No newline at end of file
22dist/2024-09-22/rustc-beta-aarch64-apple-darwin.tar.gz=59b70ccc04680e74bbd1e13368bbf5639679fb8e1e7ba39ae4a235f9a96522f6
23dist/2024-09-22/rustc-beta-aarch64-apple-darwin.tar.xz=d4b18e0a269e7b66dbbdf03d7da6b478c6cff9cd52ef34f110b68a9ff0111d0f
24dist/2024-09-22/rustc-beta-aarch64-pc-windows-msvc.tar.gz=7cc2e8511801c27360e17cc0380e30e5eb6cc185224aba94bf9ed852e5ff2ce0
25dist/2024-09-22/rustc-beta-aarch64-pc-windows-msvc.tar.xz=a9f8f8e691b9a307ddc4468cc34964063253292f18869d21dc91ca437bbc08fd
26dist/2024-09-22/rustc-beta-aarch64-unknown-linux-gnu.tar.gz=5940e8c99d329fae3cc4b1d5709e9481e8f2b1dc799363ae0a1429ea4df4ad41
27dist/2024-09-22/rustc-beta-aarch64-unknown-linux-gnu.tar.xz=c7c36aada972ea10e50e0904530d06b2df074f9981dec4dcc66efeaa16499c1b
28dist/2024-09-22/rustc-beta-aarch64-unknown-linux-musl.tar.gz=2ae2b1e2d90c130be5274806db1e4dcdfe0b588fe72f967e58b128aa1d28a7eb
29dist/2024-09-22/rustc-beta-aarch64-unknown-linux-musl.tar.xz=d8297b214d4ef841bb5963e71353ce08a4d3aead47a2cdf234e0846ad0b1ccbb
30dist/2024-09-22/rustc-beta-arm-unknown-linux-gnueabi.tar.gz=256b62cd5f1bc17c081277752a49d38104ce438e83342e6bbb467442e9250563
31dist/2024-09-22/rustc-beta-arm-unknown-linux-gnueabi.tar.xz=457ea31587b8ff8c9fcc7a9ed4bf958625c7b9e55d640329ccdf432309a6583f
32dist/2024-09-22/rustc-beta-arm-unknown-linux-gnueabihf.tar.gz=4cc8f851eff833100fe4d7c421c25e65d4779d8cdbb9b5e2cb3c8f5ebf9f8e98
33dist/2024-09-22/rustc-beta-arm-unknown-linux-gnueabihf.tar.xz=6ab386aaab687a253b3d28b12307ad5c8df2ea1a0af281a8fab6fe6d24ee6130
34dist/2024-09-22/rustc-beta-armv7-unknown-linux-gnueabihf.tar.gz=0b548c45c2ec840942b29a68ad38debd8a2ec7c920d3be7cda91365e0a8fce80
35dist/2024-09-22/rustc-beta-armv7-unknown-linux-gnueabihf.tar.xz=bc1ce3524199c62230fc08b9dab1282d2f31d3cd1a892cbc8bfab0257e0ff5dc
36dist/2024-09-22/rustc-beta-i686-pc-windows-gnu.tar.gz=a407a4dda4c24e8e9d510843aa9e8f06291622d240538a14c1d924d8b7d84e33
37dist/2024-09-22/rustc-beta-i686-pc-windows-gnu.tar.xz=fe3b235ed043d14856f47babf433ae214d9b64480b1824053fee8b99ca69cc69
38dist/2024-09-22/rustc-beta-i686-pc-windows-msvc.tar.gz=a156aa0fb17b5edf476f97b8e839f9fe550ed3edd63a2fe2936a7fe0f388ece4
39dist/2024-09-22/rustc-beta-i686-pc-windows-msvc.tar.xz=0e46e75722b10bbbd2631c2676089665f92ce092408ed63aa14c99b1fc385369
40dist/2024-09-22/rustc-beta-i686-unknown-linux-gnu.tar.gz=5523e67362db0840d6f0ab6a1deec99c1b64c32fae94362792b0aa031bfd39d6
41dist/2024-09-22/rustc-beta-i686-unknown-linux-gnu.tar.xz=45a820f2ebd182ec3237436a567960d2bd0f92e9e603aa394b1a6eafbd9ba0fa
42dist/2024-09-22/rustc-beta-loongarch64-unknown-linux-gnu.tar.gz=bdbe165ffd50974b32f4b570da7908c125739c0321f700d12cc481f32ab76eaa
43dist/2024-09-22/rustc-beta-loongarch64-unknown-linux-gnu.tar.xz=997a8387989676848355e30dea1b131fa96945e62cef8f011025c52351db1269
44dist/2024-09-22/rustc-beta-loongarch64-unknown-linux-musl.tar.gz=a49f46df49a9aa974ff10361ae29267d2c86c10486399803a5a6879e638212f2
45dist/2024-09-22/rustc-beta-loongarch64-unknown-linux-musl.tar.xz=ee236f4dab4a06d23b6040a47afdf73496bc9093b3b29fae896f5f5bbe87c222
46dist/2024-09-22/rustc-beta-powerpc-unknown-linux-gnu.tar.gz=e83c1253643c4ff70301bab198db731ac65c6d3b0ec847d7aa68bd6afef6ee93
47dist/2024-09-22/rustc-beta-powerpc-unknown-linux-gnu.tar.xz=f7f09a5028ca3f45475cedec7518ead06b2e305554292462d82b2032e5d83f73
48dist/2024-09-22/rustc-beta-powerpc64-unknown-linux-gnu.tar.gz=9ef2829f5b2bc9666bba319875eecbda37840d204f7c1493dce2a4f2f45d45c5
49dist/2024-09-22/rustc-beta-powerpc64-unknown-linux-gnu.tar.xz=140489beedcf46e02931ce8f69e9008ea4c7e3c332d0a3482d4495d7fff21b81
50dist/2024-09-22/rustc-beta-powerpc64le-unknown-linux-gnu.tar.gz=63a34f34425d6c11d62768a3cdfc4602d96ae0f11d82344412a69a3b1ec550b9
51dist/2024-09-22/rustc-beta-powerpc64le-unknown-linux-gnu.tar.xz=108d429397a5cef93151439646b684109d1b619c1a6f11544062e407258f4897
52dist/2024-09-22/rustc-beta-riscv64gc-unknown-linux-gnu.tar.gz=77cb4dea8b55779e0f3de1f48e74de966d3a2dc27946228b42b0eae654d53e5a
53dist/2024-09-22/rustc-beta-riscv64gc-unknown-linux-gnu.tar.xz=93b7dc39c3da7560cbabef5a35dddec111a4d9c0ec0e2b0648925975c5042b31
54dist/2024-09-22/rustc-beta-s390x-unknown-linux-gnu.tar.gz=58b1eed6046552703f8993b36d2a571d12db806ca9665d276c338fc89f79b980
55dist/2024-09-22/rustc-beta-s390x-unknown-linux-gnu.tar.xz=39ad5c20dd703e5949f008ed21e671b1438a1160b4aece5ba434ae03f32004cf
56dist/2024-09-22/rustc-beta-x86_64-apple-darwin.tar.gz=c5082f7773f1573a1f60148ed744f148169b3c58ca38539e72688cb31221003e
57dist/2024-09-22/rustc-beta-x86_64-apple-darwin.tar.xz=a797564192dc84184d5af88ecb4d295ab266cde4a1c4407b06c56f656800e336
58dist/2024-09-22/rustc-beta-x86_64-pc-windows-gnu.tar.gz=0f29dc08756a36f42e9937cf9e2f8c5cc7771fab5b791b58dd7b038dcb20e2ca
59dist/2024-09-22/rustc-beta-x86_64-pc-windows-gnu.tar.xz=9a9f6178208f01487a132ab91ffb1251722df3f6e3ccc7f4b3e79dc389b7217a
60dist/2024-09-22/rustc-beta-x86_64-pc-windows-msvc.tar.gz=2f2b828b46dea57c9896149a5ffc5cc6db368d90067c498f554b9ea75de0990f
61dist/2024-09-22/rustc-beta-x86_64-pc-windows-msvc.tar.xz=42c64410633bf748134ba004ef397f2319556e44fc2862a4f3a5e847e334fdbf
62dist/2024-09-22/rustc-beta-x86_64-unknown-freebsd.tar.gz=9ba0fdecbd343606bbdf2d4b401d64ed5de82e4bd508c0e6b6bcc21365c4b840
63dist/2024-09-22/rustc-beta-x86_64-unknown-freebsd.tar.xz=aeabedce922b315fb872127a6102a76e9fe5e1932b14a7210f31191f9a85488b
64dist/2024-09-22/rustc-beta-x86_64-unknown-illumos.tar.gz=4d5348b0ef100a1691f655acee54447866d76b46f88e23ee641eb5e4b4318b4c
65dist/2024-09-22/rustc-beta-x86_64-unknown-illumos.tar.xz=046b8d0139b97d78a741251ef7094629394f67cbb817a7239de704b4ff3a8963
66dist/2024-09-22/rustc-beta-x86_64-unknown-linux-gnu.tar.gz=81ba8a28534746a9c33c98a98aeeea89f6c057333827d919b2f404991e0ded45
67dist/2024-09-22/rustc-beta-x86_64-unknown-linux-gnu.tar.xz=358bbda124aa68416d55d8ed6c9a184f8ea7ae166f3f0427e8c9ac40900bd4b6
68dist/2024-09-22/rustc-beta-x86_64-unknown-linux-musl.tar.gz=8594ed15236342879b4c486e4d5e2440891e9dec52302e1bb6393008eaf876e7
69dist/2024-09-22/rustc-beta-x86_64-unknown-linux-musl.tar.xz=e45cdb771899998e42bf3f9e965a4b4557199b1632843c0472731d48ea664834
70dist/2024-09-22/rustc-beta-x86_64-unknown-netbsd.tar.gz=ba1d8b89c65441cfe6fa1341c6a7e21dc596df13cef8e8038d8d7ac376bd91fc
71dist/2024-09-22/rustc-beta-x86_64-unknown-netbsd.tar.xz=95fb21a9730eaf815ba6da5f42b997accca0b578870207912a2ea359b588421e
72dist/2024-09-22/rust-std-beta-aarch64-apple-darwin.tar.gz=60127b21a176a56664e537a8e6d81c18c5406706f12e3a406ebad8c86f5fc442
73dist/2024-09-22/rust-std-beta-aarch64-apple-darwin.tar.xz=04d163b5bb40aa4ed7e712006155549eb5ca094e71b89b4a3e5142c40d0b2102
74dist/2024-09-22/rust-std-beta-aarch64-apple-ios.tar.gz=1463a6f3a55b1c7795c0417040423f2dc1d9a3df343ee4bd2d9c96b2de5c84e8
75dist/2024-09-22/rust-std-beta-aarch64-apple-ios.tar.xz=74a06570dd6bd8b501ccdcdf25b9b5ccac25936b883b37be6a0296d5e59394b6
76dist/2024-09-22/rust-std-beta-aarch64-apple-ios-macabi.tar.gz=ccdf0df40f435ca4c5f8d6b67cf06b48c1792d5b1592cb129e7e40e7690c3c5b
77dist/2024-09-22/rust-std-beta-aarch64-apple-ios-macabi.tar.xz=4388b9b3ab0e048b6c8349a3ceae6afc078bdc217172d7ef0271afb5e181fb6f
78dist/2024-09-22/rust-std-beta-aarch64-apple-ios-sim.tar.gz=4428d02fe8e43b5d082149991e88a4c9d342157fa1c2cd91903812240fb5bb08
79dist/2024-09-22/rust-std-beta-aarch64-apple-ios-sim.tar.xz=21f9c521dc8203584ce0c56536818431ec19f259f86b8d8cab5a33f7e44165cf
80dist/2024-09-22/rust-std-beta-aarch64-linux-android.tar.gz=d9d238db60d1e54366cfb4f20e2a6c6b8bc055f83716837970261b074cc93218
81dist/2024-09-22/rust-std-beta-aarch64-linux-android.tar.xz=aab44af6a7f1dc483c943be9fd0b2ade0c938a844acc8deab76843e3dc514355
82dist/2024-09-22/rust-std-beta-aarch64-pc-windows-gnullvm.tar.gz=fccf8f5199da8c0fe2d1dec6ee384c9761f2e6334e5dce28add413f29207e902
83dist/2024-09-22/rust-std-beta-aarch64-pc-windows-gnullvm.tar.xz=d6373d38a862120c08afa569ea9941945b43ce1676f45ca995fb3b30c34500ec
84dist/2024-09-22/rust-std-beta-aarch64-pc-windows-msvc.tar.gz=e0b31c36068626fbf2133a352002cbd8f4c2b6a1b5379a0ab0fd3bc640576e9d
85dist/2024-09-22/rust-std-beta-aarch64-pc-windows-msvc.tar.xz=d10defe0175f8872ebb68d2dd331fa9bbbeb1fa892188371665547567f7f2738
86dist/2024-09-22/rust-std-beta-aarch64-unknown-fuchsia.tar.gz=dda6f7b74035c963dd89a2e003d6c7baca2e2db9bfdd3007f95743e44bd08cb0
87dist/2024-09-22/rust-std-beta-aarch64-unknown-fuchsia.tar.xz=23944ba7752e89e860f19f3c18d2951bb5c7c6b707bd6e06914f7d48aafee40c
88dist/2024-09-22/rust-std-beta-aarch64-unknown-linux-gnu.tar.gz=b00fa5fea66b2af7d173d6405a59c529a1dd0b793d735c2d97fcab7775693ed4
89dist/2024-09-22/rust-std-beta-aarch64-unknown-linux-gnu.tar.xz=34bd748cc5bc0a6b6d8e6d8ea23693d7628bed11ebcd886860cd5c0b31ac3c0d
90dist/2024-09-22/rust-std-beta-aarch64-unknown-linux-musl.tar.gz=ecb1b709c48556fabc527d976e6cc69b8b69384cb4c45e691195a12b9cdba383
91dist/2024-09-22/rust-std-beta-aarch64-unknown-linux-musl.tar.xz=2c90df930935dcf9f9725588ed6579100fdf676267305f715f03e413a04c3032
92dist/2024-09-22/rust-std-beta-aarch64-unknown-linux-ohos.tar.gz=56782db097cca16a0d6e8466b83b35bfd7334d5f48b9ac5c500767eeba30c122
93dist/2024-09-22/rust-std-beta-aarch64-unknown-linux-ohos.tar.xz=9b41b551b5f88dfa3fdcc1d22102f102627c5c88e42353edaceda6da3b76d97b
94dist/2024-09-22/rust-std-beta-aarch64-unknown-none.tar.gz=087fccd0b40fe73a545885a58758eafb86e9bb7b9588d047c9536e5bd8c201b6
95dist/2024-09-22/rust-std-beta-aarch64-unknown-none.tar.xz=60039451dc07ada83944606e67363ca32b22879293bc41a6d66f6545e7e3f1aa
96dist/2024-09-22/rust-std-beta-aarch64-unknown-none-softfloat.tar.gz=0e1f73720beaecff935d0a90272448f5dfb0c912b2e366239c46c6ab3b854cfc
97dist/2024-09-22/rust-std-beta-aarch64-unknown-none-softfloat.tar.xz=c2670b262833415d43b22485c2734d87d8748315e6471a2a384249b2cba6e581
98dist/2024-09-22/rust-std-beta-aarch64-unknown-uefi.tar.gz=edfd391f36b6aa6758649ca6f9706d671956f078e572ea9ce5f9423a1310e817
99dist/2024-09-22/rust-std-beta-aarch64-unknown-uefi.tar.xz=59b09f6cef1d97b273262d3ccdd95d9c46766b82e935cb46538514292cd04a39
100dist/2024-09-22/rust-std-beta-arm-linux-androideabi.tar.gz=f84267d71217b79a5e622a281ce926c1a54ee9122e19b2647d1aa85afa9132be
101dist/2024-09-22/rust-std-beta-arm-linux-androideabi.tar.xz=57e80fea8463416012339fc6f74e9ae4da7d92042d05311bc8a9620fec3541b2
102dist/2024-09-22/rust-std-beta-arm-unknown-linux-gnueabi.tar.gz=556ff5b6947ed37f5215953fbcbe3e82313e7deb9d32d5b86feabe46c8328e56
103dist/2024-09-22/rust-std-beta-arm-unknown-linux-gnueabi.tar.xz=3f0721bc56fa232ca4203dcb43f1ef8f453373d9a0fa4720d89c51b827407a91
104dist/2024-09-22/rust-std-beta-arm-unknown-linux-gnueabihf.tar.gz=57b81555f7d7695e985e1538795c97b9f0573cd84d6fda25a09d49ac54bd1a24
105dist/2024-09-22/rust-std-beta-arm-unknown-linux-gnueabihf.tar.xz=66d5af25be1dfc99fbeb1aa0c7eee30dc2d3e5766affb73e6e7c0e7b9a78abff
106dist/2024-09-22/rust-std-beta-arm-unknown-linux-musleabi.tar.gz=23cfcb1cde1e95f55442ebb8ba155a0e13ec932cd7a8ab20a2ad09596a79b3a4
107dist/2024-09-22/rust-std-beta-arm-unknown-linux-musleabi.tar.xz=660d3f7b05da3d5b01775989546a687fe40090d193289c3ad24317c07c5eb445
108dist/2024-09-22/rust-std-beta-arm-unknown-linux-musleabihf.tar.gz=ee453c78eacca64fd0a6f1c066a6728ddca0ecbd6e184b63a4b4455f77183f07
109dist/2024-09-22/rust-std-beta-arm-unknown-linux-musleabihf.tar.xz=b003790997ebe0bfa095b0fe38db67db179a2f9e93f4b49852f5ec04828337f4
110dist/2024-09-22/rust-std-beta-arm64ec-pc-windows-msvc.tar.gz=60f03912a464169464800a603606e2cb8a302c998bd59f582cdd3b9bf39ecc82
111dist/2024-09-22/rust-std-beta-arm64ec-pc-windows-msvc.tar.xz=6d1858acf2f2cfb3daac89ae21cfc7a7df3e1f57dac0aaa3ee70057b1974c0f2
112dist/2024-09-22/rust-std-beta-armebv7r-none-eabi.tar.gz=b23fd4380d20e289e58b86afaad1df0636004c74a03d7f3ff861f26c6ca308f8
113dist/2024-09-22/rust-std-beta-armebv7r-none-eabi.tar.xz=beac209cec83a56315c109fc3a0e3b6b16f8044de270e23cdd9dc3e2b5db3af3
114dist/2024-09-22/rust-std-beta-armebv7r-none-eabihf.tar.gz=731064c4b9b35d420f740ff5fbc4f6dd1f038e3225db19ca861af6db5f283ea7
115dist/2024-09-22/rust-std-beta-armebv7r-none-eabihf.tar.xz=04b406b44da8aee6a077f9f971b5ba62bc98fb09413fe47fd892c67798381d5b
116dist/2024-09-22/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.gz=26dc6030f28453478e790879547f22a63ae810572cac790d4ed944eb68c96d87
117dist/2024-09-22/rust-std-beta-armv5te-unknown-linux-gnueabi.tar.xz=2aa9589c9512388e75c3c93e53b6a90ce5c973d98830a64388b0ec22618504c5
118dist/2024-09-22/rust-std-beta-armv5te-unknown-linux-musleabi.tar.gz=0020c2142cef0ab6bd62c4212f01dce2675104e0da5e701cbf03ee7c45a0fb2c
119dist/2024-09-22/rust-std-beta-armv5te-unknown-linux-musleabi.tar.xz=b891ccdcbd8abf7d56d31b84800a17cbe1f6d4242584598433e38eff5a9a16c0
120dist/2024-09-22/rust-std-beta-armv7-linux-androideabi.tar.gz=128b86795a07b47088fbc51a251f6b112379454940878150547b54ffb95890e9
121dist/2024-09-22/rust-std-beta-armv7-linux-androideabi.tar.xz=26497ef07fb7f42198b4fc02b122497fc09bd215eb7e3e01c789b481bd2d86ae
122dist/2024-09-22/rust-std-beta-armv7-unknown-linux-gnueabi.tar.gz=933f22ab901b9de042b17548e0218de699275a8553b8056d2d85430858f4e1bc
123dist/2024-09-22/rust-std-beta-armv7-unknown-linux-gnueabi.tar.xz=495f8186e0c589882d1e1f1cf21ab28ea5531bad327b6d5ae1ca83d26c77944e
124dist/2024-09-22/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.gz=53c87859857618a011e94c14c5641927503c5543831acd16498d7fb244eb00b8
125dist/2024-09-22/rust-std-beta-armv7-unknown-linux-gnueabihf.tar.xz=7ee039186087e320396e56cdd9e5a6b7993c44783e3a80fd86e74e41be646a57
126dist/2024-09-22/rust-std-beta-armv7-unknown-linux-musleabi.tar.gz=fa9f256a201c4fe5cd95363c2cb02d87565a321e27554e83d63f1d61ed55dfda
127dist/2024-09-22/rust-std-beta-armv7-unknown-linux-musleabi.tar.xz=fd3eced91b52924bb6d4acb3cc6c3bd7b45a1879e353f22442cb1e76ed5a7f28
128dist/2024-09-22/rust-std-beta-armv7-unknown-linux-musleabihf.tar.gz=b683d929fd6a6b60a786ec154970338158cc2b7bce28601b70966b898017b131
129dist/2024-09-22/rust-std-beta-armv7-unknown-linux-musleabihf.tar.xz=518fa28ee0292b95322bea4c0b714146a1b94c730e49bb6a84038520c91a668b
130dist/2024-09-22/rust-std-beta-armv7-unknown-linux-ohos.tar.gz=d0f8659cddfc6da0b0dd815794f86ec1ffa0a243020dc9190c4358c6cdc03fdf
131dist/2024-09-22/rust-std-beta-armv7-unknown-linux-ohos.tar.xz=89f39595aa42f23efa2b3853c466cddd6a932043bae3373193c25b788c15efd6
132dist/2024-09-22/rust-std-beta-armv7a-none-eabi.tar.gz=c1fc1973cc683c313e50542f1a6b69f1b5a5b4ac558b45954f79ef4dff9d5f75
133dist/2024-09-22/rust-std-beta-armv7a-none-eabi.tar.xz=00c45dfc370ea40d8993519bdb5cce8f5167401434f0b7553b6fdf7c5b49da87
134dist/2024-09-22/rust-std-beta-armv7r-none-eabi.tar.gz=ef54f8762f1d190b822e58b845889ac9c2dba4250cf0d693a3b1cbf64e2cf8a2
135dist/2024-09-22/rust-std-beta-armv7r-none-eabi.tar.xz=9375a15e96f7b3da4394bcda8ce34c452417f4278f07926830d5b00b155cb338
136dist/2024-09-22/rust-std-beta-armv7r-none-eabihf.tar.gz=85a5ae26f11c47872649699eaf01557aac746831b4c30de7b892438cc736b679
137dist/2024-09-22/rust-std-beta-armv7r-none-eabihf.tar.xz=e9dde209b4e0de6ae76b316c5e3aa2923f208bd9aa7858fef5177ba2e3b06119
138dist/2024-09-22/rust-std-beta-i586-pc-windows-msvc.tar.gz=652bc4cbf176d0780a81cff637684fd8f1cdc99c7a58d68325f54564942d46dc
139dist/2024-09-22/rust-std-beta-i586-pc-windows-msvc.tar.xz=367eca53e9c4be297454751d2d8b7f5503caf669962a44ea92290b0772969fb6
140dist/2024-09-22/rust-std-beta-i586-unknown-linux-gnu.tar.gz=7c48fb48b02628358ae3572c92d5cc112734e99606c78d04b29e665ee03f36ec
141dist/2024-09-22/rust-std-beta-i586-unknown-linux-gnu.tar.xz=4ac829df3b8b5e7864b883713a90ed18a9b08f45a3da2af2c6b3f700c8d7c27c
142dist/2024-09-22/rust-std-beta-i586-unknown-linux-musl.tar.gz=7786d5b5e0cb8489df5456854cbbdfefbb8b4a3755f61e62747abc224e48dfc6
143dist/2024-09-22/rust-std-beta-i586-unknown-linux-musl.tar.xz=e2ec9458a99a159480a45b8107041b3b4054316ba15adaf802690d2bf66b2f22
144dist/2024-09-22/rust-std-beta-i686-linux-android.tar.gz=54edc2ca229e1a5aad5077800c492cf5038da341555eda11fc4b77d1a3896def
145dist/2024-09-22/rust-std-beta-i686-linux-android.tar.xz=a75135f1e04b716855fce5b830797ea87bd428d54c06190cc8067ba5952d7215
146dist/2024-09-22/rust-std-beta-i686-pc-windows-gnu.tar.gz=4c5b54eecd6efbb03a3a01f57c265d47c49df49dd584e67b493205fcec92a59b
147dist/2024-09-22/rust-std-beta-i686-pc-windows-gnu.tar.xz=7ec6292ac497b450277c17cca3ca87321d5b6bd545bd479b37698ceebdcbf719
148dist/2024-09-22/rust-std-beta-i686-pc-windows-gnullvm.tar.gz=0deb2de1b9830099bb6de1bb99e4658c8e4e3438e555f239c85309b771293e6b
149dist/2024-09-22/rust-std-beta-i686-pc-windows-gnullvm.tar.xz=f35566df72b302dd446d449ffc8a775015b30970911c5284a3d4c1866e004a6b
150dist/2024-09-22/rust-std-beta-i686-pc-windows-msvc.tar.gz=17e505c8ece5c89988896b1c14400b203e2588bc7777189bef89335cc868fb1d
151dist/2024-09-22/rust-std-beta-i686-pc-windows-msvc.tar.xz=197fe430d6fce984ca397ba664beb25d4a0216180cd8fc2797710a8c541573a8
152dist/2024-09-22/rust-std-beta-i686-unknown-freebsd.tar.gz=9d7ff528d75e80ebb8255c9b6ef3f5ec6db579524e03dc3aad540690401fb7b8
153dist/2024-09-22/rust-std-beta-i686-unknown-freebsd.tar.xz=81152e616efe27a4ae80d2ffc86b79211c31ab324faa7847606f6ed839a3d470
154dist/2024-09-22/rust-std-beta-i686-unknown-linux-gnu.tar.gz=b1913a26f2258531596e1ef31fc42d720f807f04b068802ea3a0164d877d694c
155dist/2024-09-22/rust-std-beta-i686-unknown-linux-gnu.tar.xz=3be89fd0c0f0a5b6d5cea23feffd32573be29ec1ce6c96b88ac35e04cf1eaa46
156dist/2024-09-22/rust-std-beta-i686-unknown-linux-musl.tar.gz=e446e4cbb904f89fbaf7bd48be6975671db2cc2ad018fc03e967dff2bbce0e3d
157dist/2024-09-22/rust-std-beta-i686-unknown-linux-musl.tar.xz=453d6a6b1872e884aeae40936e950b7c2d0ce291c9f5882fc9c15a6b3e9c86fe
158dist/2024-09-22/rust-std-beta-i686-unknown-uefi.tar.gz=a330462d4b0ade7028d2c2bd8764b1225cc9eac90b014c8899f971fadf002cba
159dist/2024-09-22/rust-std-beta-i686-unknown-uefi.tar.xz=8fdb9e12d0cf92e0c4fcbcdc57daceb2cf17b21786e1252904ec0faba4b90a9d
160dist/2024-09-22/rust-std-beta-loongarch64-unknown-linux-gnu.tar.gz=82859d2feb163fa7ac068db184e8c76261771dc47838bd952301ffd8037d885a
161dist/2024-09-22/rust-std-beta-loongarch64-unknown-linux-gnu.tar.xz=1fa1ae996cd7010b4ab9006bfcb69098fcadbfc7a8f6988bdd34c62d2d6309f3
162dist/2024-09-22/rust-std-beta-loongarch64-unknown-linux-musl.tar.gz=e4200a2c1eb5a1420071fde891266849da5d46aaf46031129ae329175a3708f8
163dist/2024-09-22/rust-std-beta-loongarch64-unknown-linux-musl.tar.xz=15fc279f0c1370d05543af48c493d91687e3de2dc25123a1b657919494a0653c
164dist/2024-09-22/rust-std-beta-loongarch64-unknown-none.tar.gz=4cc49f8231bca8c19e4d449cf3b3cd84d5db9e4665394ebada29ea626cee4dc4
165dist/2024-09-22/rust-std-beta-loongarch64-unknown-none.tar.xz=b3b7959a696c75575edb3676520f64178151df1d523128c6ed6e28cd0c8051b9
166dist/2024-09-22/rust-std-beta-loongarch64-unknown-none-softfloat.tar.gz=7b15fd753967116653b4372e10796ae2ea35910872f517a2d1c6dd3539717915
167dist/2024-09-22/rust-std-beta-loongarch64-unknown-none-softfloat.tar.xz=87f88922e5c3a17af392bade5af1ce94f03aac275e6ed3dbadc9d6c720223c7f
168dist/2024-09-22/rust-std-beta-nvptx64-nvidia-cuda.tar.gz=f1d4f6887d12f1316bcf515bd07f9474bb9e036dfe78171720d72e98de580791
169dist/2024-09-22/rust-std-beta-nvptx64-nvidia-cuda.tar.xz=2dcaa78854d5b619e9609db70fa805cdf1e5baf2fac35f3eefb66ae854e78891
170dist/2024-09-22/rust-std-beta-powerpc-unknown-linux-gnu.tar.gz=c4ae30e180d94550da74b09f6005a6224136d8b5d752e9cdb1b44081a95b8c9f
171dist/2024-09-22/rust-std-beta-powerpc-unknown-linux-gnu.tar.xz=c6438a341e8008b3c475e3250d52df2cb0a505862a14ed70e89884086a56e54f
172dist/2024-09-22/rust-std-beta-powerpc64-unknown-linux-gnu.tar.gz=8ff723f008f1ff81541f2f14d68ad1e77a2842577dcbe4f5109f6c54fdc42726
173dist/2024-09-22/rust-std-beta-powerpc64-unknown-linux-gnu.tar.xz=c5704ef9d690721790d127ca341e4747d572bd34f636894fe897d23660a11467
174dist/2024-09-22/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.gz=13d46982612f710d7aacf1a9636502418fdc673dde21641e1c52d2c55c8c35a1
175dist/2024-09-22/rust-std-beta-powerpc64le-unknown-linux-gnu.tar.xz=9e33e5c0ffd8511705258a741b448e167fdb13229d1d8bb36ef0b41a1f9c49ec
176dist/2024-09-22/rust-std-beta-riscv32i-unknown-none-elf.tar.gz=f7e0cc15730cfcd05ac904a3fb6012a99310c15402db19e915860fc4bc1f55ce
177dist/2024-09-22/rust-std-beta-riscv32i-unknown-none-elf.tar.xz=af179ee477d53727d01feeb704776370482f8aa6f6bd51d7dcbcf90010d36b74
178dist/2024-09-22/rust-std-beta-riscv32im-unknown-none-elf.tar.gz=9673565000aebce56cddf905d27ec651d2c2845e9a2768ec38d10e18443924d8
179dist/2024-09-22/rust-std-beta-riscv32im-unknown-none-elf.tar.xz=38a5d0812838d5596a7a4804ee46e97bc5f4814056f93ad0988b7f2f34a90325
180dist/2024-09-22/rust-std-beta-riscv32imac-unknown-none-elf.tar.gz=cb397f91bf2c66a0f7d704c320964885aaeacec90a0f562358e8678e749c1e64
181dist/2024-09-22/rust-std-beta-riscv32imac-unknown-none-elf.tar.xz=ff95fa7f5598ed1f25e2aa0be9fb89ef0a7b145ffa9bcba7479bb3c0d83808b5
182dist/2024-09-22/rust-std-beta-riscv32imafc-unknown-none-elf.tar.gz=9049a87a4bea3319c7bf8162d5289ce252897e3ee637a0b6bca841c3507b98c4
183dist/2024-09-22/rust-std-beta-riscv32imafc-unknown-none-elf.tar.xz=e24970b400b30728a9ee5202b0fdb9734c115e015178817629220390badb7e50
184dist/2024-09-22/rust-std-beta-riscv32imc-unknown-none-elf.tar.gz=aa06101ff7386aac69a1dafeb39645344fae3c0ca02537078029c4ba073aa1af
185dist/2024-09-22/rust-std-beta-riscv32imc-unknown-none-elf.tar.xz=13e358d57a5bfe3e4ca2c8ca5e6c8d026cfac417b3c050ebd9bcd5d24f3a5f6c
186dist/2024-09-22/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.gz=5d880502cba47ed72006ef6e60fe004885c0f215d589a20456d41dcec8238503
187dist/2024-09-22/rust-std-beta-riscv64gc-unknown-linux-gnu.tar.xz=a242f39d05716b72aeebdf83357835bae0d2386feca6759f343721148b7a0d4d
188dist/2024-09-22/rust-std-beta-riscv64gc-unknown-linux-musl.tar.gz=117ec2433159f057fcd7fbae9d85042979340ab00f8d1b940c3adc5d3c791803
189dist/2024-09-22/rust-std-beta-riscv64gc-unknown-linux-musl.tar.xz=be0f262d8ed5122fee6b67abd4b78e419839e4005cfff1db9813ae655fbea23f
190dist/2024-09-22/rust-std-beta-riscv64gc-unknown-none-elf.tar.gz=78e28d3d341cedd0fe5ef0036b3b3c246b9f86e5e61d3bfd7e03e95d03920985
191dist/2024-09-22/rust-std-beta-riscv64gc-unknown-none-elf.tar.xz=43bb14df9b4947f111c1e4ba9c4092b73a895c9431a299e4b076d387477f5687
192dist/2024-09-22/rust-std-beta-riscv64imac-unknown-none-elf.tar.gz=e325c2ad8623b87456c12e17b29aa7f52ad243971002b4763677052f9b305eff
193dist/2024-09-22/rust-std-beta-riscv64imac-unknown-none-elf.tar.xz=ca02e01254defcfbf0a48ab574dc4b5aecd6a6be2ddc835704986284916019d8
194dist/2024-09-22/rust-std-beta-s390x-unknown-linux-gnu.tar.gz=79044a23a910bfd8488c382a3d2eab0c6a7ba9677165878b02f28a6c75d3a0b5
195dist/2024-09-22/rust-std-beta-s390x-unknown-linux-gnu.tar.xz=6a1196d2b2f30e22497a739e3b1ee302339ed442e0b807c707d1c4eb7c53ff3b
196dist/2024-09-22/rust-std-beta-sparc64-unknown-linux-gnu.tar.gz=fa3ad826bcf924094ad5cf19779fbfa70f656c1d2e66f4aee5dcf51792af74f4
197dist/2024-09-22/rust-std-beta-sparc64-unknown-linux-gnu.tar.xz=d5f701446546c6cb64b413be37f3c4a0739010f25616b6a295adfcefb16e8642
198dist/2024-09-22/rust-std-beta-sparcv9-sun-solaris.tar.gz=1ac5c327d5a0d0256d16968aab3bf35828c995c818ba73788421da56404f165e
199dist/2024-09-22/rust-std-beta-sparcv9-sun-solaris.tar.xz=fd6c7f163d2d6006eb85cc68e2794850f82dfe09f9173390cd0c167d90622d8d
200dist/2024-09-22/rust-std-beta-thumbv6m-none-eabi.tar.gz=8f082a38dfe968d8f987bfec0822e221d0ab8ab73dfd451b63de7644ccaeb239
201dist/2024-09-22/rust-std-beta-thumbv6m-none-eabi.tar.xz=044bca675ac6b621ced7f2bc9a9909814c0b0818505ca1bfcd765c1859a9ed7f
202dist/2024-09-22/rust-std-beta-thumbv7em-none-eabi.tar.gz=f3e1789a409b58b9769db8587ddbd21352e6634ff5a508b6ad82237cc85409be
203dist/2024-09-22/rust-std-beta-thumbv7em-none-eabi.tar.xz=5f36d0504401bf6cbd2eed78e4575a190300ae26c581ee8599ab8d6e32dfafaf
204dist/2024-09-22/rust-std-beta-thumbv7em-none-eabihf.tar.gz=a0ed6b4c71570e900e1605302ef865f7df9405e19245ed45ff5f7654eb3cbea7
205dist/2024-09-22/rust-std-beta-thumbv7em-none-eabihf.tar.xz=6fd7fac23460b49ca5246a6471de4f39d92764231ef2eac5f51d177c9d14ce2a
206dist/2024-09-22/rust-std-beta-thumbv7m-none-eabi.tar.gz=21e1983e3f9c481677db7c839d5b2b301bae748ef52e1d0b5c3fbf9347732c66
207dist/2024-09-22/rust-std-beta-thumbv7m-none-eabi.tar.xz=ade8b1a2c128c298ba1d20ea7c7585af2a2b3a17b55a8dc6d39f0eebf0f01e66
208dist/2024-09-22/rust-std-beta-thumbv7neon-linux-androideabi.tar.gz=29c7c493c9fee6afa8aea0f337da66118216ee21b373303432ccfb6375cd8428
209dist/2024-09-22/rust-std-beta-thumbv7neon-linux-androideabi.tar.xz=d63e1c8cf97c0834a3825d9a552ed0ce744b2471028f49cbad6f7df1f7bfad7c
210dist/2024-09-22/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.gz=0cec39208ae369c146d49dbc98984edb993c318a5dcbff205d3fa6b651400bc0
211dist/2024-09-22/rust-std-beta-thumbv7neon-unknown-linux-gnueabihf.tar.xz=158f249f6446503ad5c558dba966ca69f57161aa90fa995a9e9b68fb3e38e732
212dist/2024-09-22/rust-std-beta-thumbv8m.base-none-eabi.tar.gz=8df09685f21eb9285adff2493ea6a9b3a04ce2e24b0761a47b44f0257b3485ff
213dist/2024-09-22/rust-std-beta-thumbv8m.base-none-eabi.tar.xz=0a119d100a6bddf66047e98d453b8c54ab0952712c38b1e396bbef81114d4423
214dist/2024-09-22/rust-std-beta-thumbv8m.main-none-eabi.tar.gz=e7e234a7a8f687f0649654f562b12e09d332229dfd9e8d81a780afd9d8eac8ea
215dist/2024-09-22/rust-std-beta-thumbv8m.main-none-eabi.tar.xz=a3c6c68ad6c24d080af8034168b36bbb24edc30e1fce2ac91bc3fa09ac34a678
216dist/2024-09-22/rust-std-beta-thumbv8m.main-none-eabihf.tar.gz=1662be2b7ec3db6331ef545ac59c844733c3d1cdc728aef78049fecf37a416c5
217dist/2024-09-22/rust-std-beta-thumbv8m.main-none-eabihf.tar.xz=b19dd77e7582da1785f78e85e39a9d966c7a747641e6772dd18cbd489b4940b8
218dist/2024-09-22/rust-std-beta-wasm32-unknown-emscripten.tar.gz=a7ae18e142b5b7a3fbab372bbf4e829626b52a67a10496f2cdecc89aab029310
219dist/2024-09-22/rust-std-beta-wasm32-unknown-emscripten.tar.xz=75a9a2dae5117b714a08024588cb4f5e5a6f07f28af55013f49fbe7cc8e2a690
220dist/2024-09-22/rust-std-beta-wasm32-unknown-unknown.tar.gz=25bf0342788e03ad52ee4835f280f3d92bf2324db3acfcf2654c5f5d37d43431
221dist/2024-09-22/rust-std-beta-wasm32-unknown-unknown.tar.xz=21798a2663b6d0e7347404666d5341b51c5d5de108cd68efbd1466b7c4002a62
222dist/2024-09-22/rust-std-beta-wasm32-wasi.tar.gz=02c1fcc01d28005432f6e53b6f8cecda2b555d482f713ec70ac92b1507121ec7
223dist/2024-09-22/rust-std-beta-wasm32-wasi.tar.xz=f2b4ae22141d39202bddd45e3373a8520684dd71460ceb3cdc9bc7d09aedd774
224dist/2024-09-22/rust-std-beta-wasm32-wasip1.tar.gz=f59a67c3acc927e72278f66553cd10bb3d81e16045c76671d38d09c8a462c78f
225dist/2024-09-22/rust-std-beta-wasm32-wasip1.tar.xz=0f4eea80dcd13008f55d7120f2239aed87a6dcf693f70983caffc36a4be72ffb
226dist/2024-09-22/rust-std-beta-wasm32-wasip1-threads.tar.gz=2581846fe64f1d9547ec293875be715251174c5b163a7c533dcae81fd55ea6d6
227dist/2024-09-22/rust-std-beta-wasm32-wasip1-threads.tar.xz=ad6d869148eea87192f786fca0302983094b25a1afec2813012ba3133e8994c8
228dist/2024-09-22/rust-std-beta-wasm32-wasip2.tar.gz=091057da389eb1d464353acca41e158130f969ad20f90827a4dc38bd363a68fa
229dist/2024-09-22/rust-std-beta-wasm32-wasip2.tar.xz=c91b4440326443a4987758ac161b79f5aa30d23662a5c99a3c0adfedc0eb8e51
230dist/2024-09-22/rust-std-beta-x86_64-apple-darwin.tar.gz=180a9b1d5fb71ec3e88dd4e3a88f6f1da433a191125ecdf98c0169bd7b0511b3
231dist/2024-09-22/rust-std-beta-x86_64-apple-darwin.tar.xz=7d066c7b394c5b15027472fa388b9379ae8a7d4a990e02c0785f63a6f1b7f0c7
232dist/2024-09-22/rust-std-beta-x86_64-apple-ios.tar.gz=4ebdf9f16075859830e76e40547d1d56230ed8715e57f254c82d467634aa63e5
233dist/2024-09-22/rust-std-beta-x86_64-apple-ios.tar.xz=0bdcf11914a169b86b945df232a30c69f991393e3871956b55ca88a0ad65bf79
234dist/2024-09-22/rust-std-beta-x86_64-apple-ios-macabi.tar.gz=45ea8961f12b31e8404ebd178586711f7e4d4729d96ee298623240d8163766aa
235dist/2024-09-22/rust-std-beta-x86_64-apple-ios-macabi.tar.xz=a36a3ed36c0224edaa5161b1c2cb7acb2736d0c2845d56064bde1c94af4e2db1
236dist/2024-09-22/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.gz=8d217487118140549fdc2223954d38a7932a2e9004a07924f853139395f8d88d
237dist/2024-09-22/rust-std-beta-x86_64-fortanix-unknown-sgx.tar.xz=66d7b8cc0b92af4f0458eab631faee6069c3bdf8e35200fa3d573177b1b354c8
238dist/2024-09-22/rust-std-beta-x86_64-linux-android.tar.gz=7efbe112fdf33d55ada19f3803b2552796d1027281b6c652a19465e4902a22bf
239dist/2024-09-22/rust-std-beta-x86_64-linux-android.tar.xz=cacbf59cc9bad0a212d9fb86c81434350fb0b4842918bf7dc51fe978d21402b6
240dist/2024-09-22/rust-std-beta-x86_64-pc-solaris.tar.gz=073833d7b60d396be6890552f7068e885dc0fd4536e5049e88d97c71df31f126
241dist/2024-09-22/rust-std-beta-x86_64-pc-solaris.tar.xz=c6cbc8c41eb2e071cad032ae7587c5ae2e841f1d074c328229e3b7f271fe9330
242dist/2024-09-22/rust-std-beta-x86_64-pc-windows-gnu.tar.gz=0b5c7c007faa77fb28fe7cf275846f23adf0aa3fa1338dc93f86c05f7c605ded
243dist/2024-09-22/rust-std-beta-x86_64-pc-windows-gnu.tar.xz=c1ec0ad342ec630f2ed909c54b0ca7f9073a85977da3a86eb5ef68d5c13ad4b9
244dist/2024-09-22/rust-std-beta-x86_64-pc-windows-gnullvm.tar.gz=5cf9a1daad4b60f7946adbdc9bde0d0d3ce438902f0a158f5f4f423f10960886
245dist/2024-09-22/rust-std-beta-x86_64-pc-windows-gnullvm.tar.xz=d8cfeec61cbbf6bb1b4234bd53a777ad2157def8dc232ba4b5f16bc81f4f1524
246dist/2024-09-22/rust-std-beta-x86_64-pc-windows-msvc.tar.gz=795ac3edcb9f0f10f36a19be14641918b5b0d647d5cc38e8652040437e409538
247dist/2024-09-22/rust-std-beta-x86_64-pc-windows-msvc.tar.xz=dacb5baf49d2b3dd8727a159f8fd348967f987a95162e587c8e5add57dd6d31e
248dist/2024-09-22/rust-std-beta-x86_64-unknown-freebsd.tar.gz=089f99e1cbeab86b5d7ba9d582c5771c8d229ece1f81ad110716618823692deb
249dist/2024-09-22/rust-std-beta-x86_64-unknown-freebsd.tar.xz=8749c2ae47644c16f62a310500ab91e5403a25c3e023a2c6e25cfa16217c98e9
250dist/2024-09-22/rust-std-beta-x86_64-unknown-fuchsia.tar.gz=becef9619e8ad1d4de66796c5877fd9798e5c943fb93a893aacd7819465f8a15
251dist/2024-09-22/rust-std-beta-x86_64-unknown-fuchsia.tar.xz=3801cc566789ae0313a5d10159cd0c94cbbcd8636409ba69ace73fae972ce2eb
252dist/2024-09-22/rust-std-beta-x86_64-unknown-illumos.tar.gz=ba74cfa20f8c53865d96d26b9aaaa7abebf2269d1c3fe2bcd70e3cd7bd4e78d1
253dist/2024-09-22/rust-std-beta-x86_64-unknown-illumos.tar.xz=8f0a00cb53e21c90d60eb02853412d4cf671a1667bbbf7fe9a64183d966a9e48
254dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.gz=1188997812bfef02c93a13a7d31a9df560383a875bb6a3cbdbb03eaf5fa0d649
255dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz=12583cfd10835abf0f340fe8e141683cdce3e4df5a00998a04361b59203321e6
256dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-gnux32.tar.gz=854f01a511c01b003facf4beb89a511395f0efcdc2284ad279b92837349eaa95
257dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-gnux32.tar.xz=b016d4584a44064feee64de50963ccfbfaaecb792c88c97a079f279a0c1df955
258dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-musl.tar.gz=912eea9c27b6fd251c5b92ae24d6321d5effe9586dbbd473e16a8dee2b758291
259dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-musl.tar.xz=96bf10ef8fee6f8571b6601ab89e65562a91312502630c139d986b6e1ec9fbac
260dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-ohos.tar.gz=09e42b412f0891d608a9d4030203fe09645fc763ecad4be5ae790122a5d01f4a
261dist/2024-09-22/rust-std-beta-x86_64-unknown-linux-ohos.tar.xz=dd84077f22ac4abea1c143d5d293425a85fad62ac65a4b31f18b9100c4e1076e
262dist/2024-09-22/rust-std-beta-x86_64-unknown-netbsd.tar.gz=9aa5fa7bf57fbb95c3a6f718c0a2b62f32c6d1c9ccf93b392d4e166d311e0833
263dist/2024-09-22/rust-std-beta-x86_64-unknown-netbsd.tar.xz=765cf1a81b03ce210a88e87404a64d5b378f6615e428c385fac7a33b646f1276
264dist/2024-09-22/rust-std-beta-x86_64-unknown-none.tar.gz=e00c50362ffc95a1704912ea35c7b1792ead7906d98937fd73b9fa9fe31a520c
265dist/2024-09-22/rust-std-beta-x86_64-unknown-none.tar.xz=280cf203356db9c32898197a3b5954901897a5b3059547f67c59cf5780c46386
266dist/2024-09-22/rust-std-beta-x86_64-unknown-redox.tar.gz=77069fcc33bc481ac8e18697884c1f3e3004a5fe5b265acb419b5f60c03fd2c9
267dist/2024-09-22/rust-std-beta-x86_64-unknown-redox.tar.xz=254dba227a76cb476fbc2a897169713969bf00f691ef77e03d303473db130523
268dist/2024-09-22/rust-std-beta-x86_64-unknown-uefi.tar.gz=4f1fb25ef423ab3cd5577f3e081771494978998acb8c04dda9de8a7d56cce985
269dist/2024-09-22/rust-std-beta-x86_64-unknown-uefi.tar.xz=fc21de2770ff0d0eb44d0939db5b274b0f408eb1a904c9eaf4db4c9463b5ff8d
270dist/2024-09-22/cargo-beta-aarch64-apple-darwin.tar.gz=489c1b6aef3a7275e2e7a644677dde933a738534966089fe28c52c61dff04f2c
271dist/2024-09-22/cargo-beta-aarch64-apple-darwin.tar.xz=5fe4d6a15e4f51f0575f2aee12eb644a95e548a4f03a80835296c44b1daf18a6
272dist/2024-09-22/cargo-beta-aarch64-pc-windows-msvc.tar.gz=5c5c408b026e0332c4e5d816c7a6a961ae5af0174f02b793edd613e56c672494
273dist/2024-09-22/cargo-beta-aarch64-pc-windows-msvc.tar.xz=4e060bccd78dc8abba7c7006585103b6bfa473a0f1cdd9e2c6b10d4fb8294f8c
274dist/2024-09-22/cargo-beta-aarch64-unknown-linux-gnu.tar.gz=45cee09ecd3655b3a822b9c85e3f61f8e40b3fb510728503a3691f56ce415274
275dist/2024-09-22/cargo-beta-aarch64-unknown-linux-gnu.tar.xz=d8902eb0c3a725ef6345d325907ac10a7eb81e274c59aa589bf05aedea5958cb
276dist/2024-09-22/cargo-beta-aarch64-unknown-linux-musl.tar.gz=67e6658e39c0381554ac025c26564888804eb9d8a3e1178726652fff03bc21b4
277dist/2024-09-22/cargo-beta-aarch64-unknown-linux-musl.tar.xz=427e7a4781dcdd2e316eb0c2751257597b4af58da8a5fd8407a8402814b65148
278dist/2024-09-22/cargo-beta-arm-unknown-linux-gnueabi.tar.gz=735d1b824d3a375a6b9c5a5d22fb5e607d3ad06ff70cebe81b84007967c6a5c7
279dist/2024-09-22/cargo-beta-arm-unknown-linux-gnueabi.tar.xz=749c017f8c25d0df23a160e02a765bb5e967f7657fdf3105d0d7ce64afe83524
280dist/2024-09-22/cargo-beta-arm-unknown-linux-gnueabihf.tar.gz=050ae56d0398150212a75493562e6654cc14b7a1ebd6051bde146b5d408d24c8
281dist/2024-09-22/cargo-beta-arm-unknown-linux-gnueabihf.tar.xz=1088b61e20981dabe406ff52965f48ab1542dd84d9673f7d56b21145d0b604b3
282dist/2024-09-22/cargo-beta-armv7-unknown-linux-gnueabihf.tar.gz=43dfb8491dcb64b91e6786366300a0ee3fd00f1815cd84f3bb4247e6b723a6d6
283dist/2024-09-22/cargo-beta-armv7-unknown-linux-gnueabihf.tar.xz=90266fcba10bd88e1f8f5d8420ee6835fe3e337dad1cc43ab7ef79edbe1a1b98
284dist/2024-09-22/cargo-beta-i686-pc-windows-gnu.tar.gz=6dca2e273600ee0f92a416901a7713ffd6db420b953e62d51d95bc85c1dbe27b
285dist/2024-09-22/cargo-beta-i686-pc-windows-gnu.tar.xz=36fa46c7edcfc881568435f366e76f1989479356d93b8982981658fd44b80f4d
286dist/2024-09-22/cargo-beta-i686-pc-windows-msvc.tar.gz=bd99a9cf662fbe90b79711776f972d2d574fcd6f0053bb672e4cdb35fc67ddf3
287dist/2024-09-22/cargo-beta-i686-pc-windows-msvc.tar.xz=8a995e56a96217cd999e786b16a69de1ec6e9db6412cd2c9c6ce090ed21a84bf
288dist/2024-09-22/cargo-beta-i686-unknown-linux-gnu.tar.gz=ae115caa9516a96f144db9751b185503e1c648ea9b7e8b0a6aa10200315e6458
289dist/2024-09-22/cargo-beta-i686-unknown-linux-gnu.tar.xz=54b125ce0c00afa7bdebf5cb592249c37ac21d78479129a46d0b70d86fe6bf17
290dist/2024-09-22/cargo-beta-loongarch64-unknown-linux-gnu.tar.gz=21d2ca9f6d715e44fae058b7c26abc873930ac2823e72c9f8c983f7d089bd91a
291dist/2024-09-22/cargo-beta-loongarch64-unknown-linux-gnu.tar.xz=b9b395041d328a09643b7e727705aa7705bf67c08edb3d26b78405ce454c6798
292dist/2024-09-22/cargo-beta-loongarch64-unknown-linux-musl.tar.gz=da7853da9096b6ddebc3b3da948b90ac448663dc9a5d2940cad420360d5934a2
293dist/2024-09-22/cargo-beta-loongarch64-unknown-linux-musl.tar.xz=9997e251abe606e390e3d2c280233f435f8ab46a6a3d24ce95d7a700ec049664
294dist/2024-09-22/cargo-beta-powerpc-unknown-linux-gnu.tar.gz=1715eabf3860f2fa7e1e27f2163a5243c8000b6216c0e7ac8dec993061ff479b
295dist/2024-09-22/cargo-beta-powerpc-unknown-linux-gnu.tar.xz=f4e0f364c4ca68dc7b40b40bf13e28284a9bf6e6075b10504b9e6979d4a1a375
296dist/2024-09-22/cargo-beta-powerpc64-unknown-linux-gnu.tar.gz=70cb2337910933f0ce22ef57e8dec4ab5732855d0657e56ed237e3e483aa07d2
297dist/2024-09-22/cargo-beta-powerpc64-unknown-linux-gnu.tar.xz=1e9e383a093b54b8f7bff8dbf2f38590c148d0c9e18399bc128a09a6c67565bd
298dist/2024-09-22/cargo-beta-powerpc64le-unknown-linux-gnu.tar.gz=6e01a5a6cf68b8385d2a2eaa07984ba62ef4df6811be2ade5dd7b22ba7d4bd69
299dist/2024-09-22/cargo-beta-powerpc64le-unknown-linux-gnu.tar.xz=70d0e45fba27db3322c3e4d802cdcd37503d2a848b9c0c2b9b759d48611c19ab
300dist/2024-09-22/cargo-beta-riscv64gc-unknown-linux-gnu.tar.gz=baabb56c3670a0dab62fc7c0e5cb07474de795e81a6be42c57a91c2249e9b960
301dist/2024-09-22/cargo-beta-riscv64gc-unknown-linux-gnu.tar.xz=fd87e580bd0d4b47340b797fb52aeda83854556328869ebd1ce7136bcf8ead78
302dist/2024-09-22/cargo-beta-s390x-unknown-linux-gnu.tar.gz=dbf01fb97c1aa9db57b68fa863dca5df81e1f83c1686bdbc01c702b0148bba7a
303dist/2024-09-22/cargo-beta-s390x-unknown-linux-gnu.tar.xz=f2eaf49ad1a05b5acf3050159aeb7351544c5aa14a46b381b0e2659eb857bce8
304dist/2024-09-22/cargo-beta-x86_64-apple-darwin.tar.gz=cdd90fe77bff57d0acae21499c0188fac2ddf7aa24dba07dcbf900444ceb1295
305dist/2024-09-22/cargo-beta-x86_64-apple-darwin.tar.xz=2c8acbf6eb4076ad876993f09714a2b1664031a41a12ff395c1f9c4bd0283640
306dist/2024-09-22/cargo-beta-x86_64-pc-windows-gnu.tar.gz=f16189ad7a0d311b17b6bb6ced913cde0115ac07e9a950b85d4336c488456c6c
307dist/2024-09-22/cargo-beta-x86_64-pc-windows-gnu.tar.xz=1d4bf171c84def4110ee3f4e4798ab3ee52d0323bc2fc4abd564f229a23846da
308dist/2024-09-22/cargo-beta-x86_64-pc-windows-msvc.tar.gz=c3e27d6a38eb46fca153ef17cea76b11664e8171e0aa76af594e67ed9dffbef5
309dist/2024-09-22/cargo-beta-x86_64-pc-windows-msvc.tar.xz=b64792d6ec70ee083dac929343ab45f4a52039c7fbc6cb223b02663591c8f544
310dist/2024-09-22/cargo-beta-x86_64-unknown-freebsd.tar.gz=40bf96a087dc1d57ba495733975ff34a4e75e51d7ddffc025561f0951adb57ca
311dist/2024-09-22/cargo-beta-x86_64-unknown-freebsd.tar.xz=7912a49f7a181145b71a197014e3de6594b216959cd7c95a003fcd13854cb056
312dist/2024-09-22/cargo-beta-x86_64-unknown-illumos.tar.gz=1c3dfd5dcb8e7c8ba947b67f5bc466bae26ca1518a74798cfe5a21997bfcf71d
313dist/2024-09-22/cargo-beta-x86_64-unknown-illumos.tar.xz=6f620a91c2bc145f894f5736a9818f7b54583a93e7eb2d0ac202f46a38040b99
314dist/2024-09-22/cargo-beta-x86_64-unknown-linux-gnu.tar.gz=c6c20977054f56fc279e666cf02da65acb376c1b08bbbc998cf34d0cc2b5bb7b
315dist/2024-09-22/cargo-beta-x86_64-unknown-linux-gnu.tar.xz=9cca7e46ad35f0f69d8fe628a95e44388ed5cb62c1b77f2bab03dab28a05a650
316dist/2024-09-22/cargo-beta-x86_64-unknown-linux-musl.tar.gz=74005a4511ca2087ebb92db7e19a2e31e3ddcdef93e27da544bbc444df01dc32
317dist/2024-09-22/cargo-beta-x86_64-unknown-linux-musl.tar.xz=94215716623cadc8bf4a119612ad7482661905748d4e43ddff1855d4746f3972
318dist/2024-09-22/cargo-beta-x86_64-unknown-netbsd.tar.gz=fd9b2dd77b76b2ac44dbeb80e46371669223fe8ca57e4d480deeb162168c38d5
319dist/2024-09-22/cargo-beta-x86_64-unknown-netbsd.tar.xz=d419dbb9d1c905eb841c6870ddc8afe946b7618d3a0c6f39f8feeba6ecc74f0d
320dist/2024-09-22/clippy-beta-aarch64-apple-darwin.tar.gz=60aba239287116d7e0f58fc71e510fdb7582003efdb3011765f732b1e494c7e1
321dist/2024-09-22/clippy-beta-aarch64-apple-darwin.tar.xz=00ef2da71c8e3f5be8401128509ff99130eebd5c0b90b5b5c16dc0465c2a18f8
322dist/2024-09-22/clippy-beta-aarch64-pc-windows-msvc.tar.gz=7ff2952e057849ec69a7d1147920c2b6ecb99fe7984afe627c5514c8c6a8811c
323dist/2024-09-22/clippy-beta-aarch64-pc-windows-msvc.tar.xz=cc3e145daaf3674c1436d4380171ce5e26b075975121dac5c1d5c5d6cfa1a6e6
324dist/2024-09-22/clippy-beta-aarch64-unknown-linux-gnu.tar.gz=430c6d5ded52d04bfe93fce17f8fef57ce3ab05715767b85d6c9b59e521671b2
325dist/2024-09-22/clippy-beta-aarch64-unknown-linux-gnu.tar.xz=df4b9444dd435133bcfe386955b1d4b63c13e4acd766dc3bb9742c21431926d4
326dist/2024-09-22/clippy-beta-aarch64-unknown-linux-musl.tar.gz=7064208f59db897b1107072a3cc1a516d53888ea1c549bdf3cfd8479c65ec0c3
327dist/2024-09-22/clippy-beta-aarch64-unknown-linux-musl.tar.xz=1d33c3e2b4daa1ba7f1a6399790d1b76fdfe1ac9d293859983412d5e1e3663a1
328dist/2024-09-22/clippy-beta-arm-unknown-linux-gnueabi.tar.gz=b851cb5bcb31a2105039b55a613d937113fd45f5c1fbd4e3d24eecbed85a0bb0
329dist/2024-09-22/clippy-beta-arm-unknown-linux-gnueabi.tar.xz=a17f46c82fa28bfa9e3c9ff99cd25a888b6ff0c08a887ef4056b8ae29437a67a
330dist/2024-09-22/clippy-beta-arm-unknown-linux-gnueabihf.tar.gz=784a1a0134d54cff72c9bf59ee1e750d0493fef5bde06bf778bc98321d833031
331dist/2024-09-22/clippy-beta-arm-unknown-linux-gnueabihf.tar.xz=c11461066103bf92f21298e5cb3b009cf4ac07bde5d99ce9ab97c1cbdf7c73f5
332dist/2024-09-22/clippy-beta-armv7-unknown-linux-gnueabihf.tar.gz=98c74f6a0692482355045bb4b0977887b419a8aa3c4654b9b59cd0d867f261ac
333dist/2024-09-22/clippy-beta-armv7-unknown-linux-gnueabihf.tar.xz=20c82e6bbefdbaca22911a63a41d0aa05ed0ffad4571090c053cb354b49acd23
334dist/2024-09-22/clippy-beta-i686-pc-windows-gnu.tar.gz=3da558108df227ceb0ff7a2837d1bd2f5a75a0c7167f0b3c380d1aa5b2fa3e77
335dist/2024-09-22/clippy-beta-i686-pc-windows-gnu.tar.xz=f657f1cdc9f91243112834afbe5fe60f8b43e914504c8aed1994a13ac98bc575
336dist/2024-09-22/clippy-beta-i686-pc-windows-msvc.tar.gz=cf27f06843f5e0706aace4be4b9973fd164b57697b44d00852a9545d336c6fd2
337dist/2024-09-22/clippy-beta-i686-pc-windows-msvc.tar.xz=74dd229cdf65ce19ded1ed27cf5fb31c20f6a45879b277ad43aedc818eed514c
338dist/2024-09-22/clippy-beta-i686-unknown-linux-gnu.tar.gz=4d22b439675ec118d021a85dc75540d7a3331364395e21bc1a2d76c26aabe9d3
339dist/2024-09-22/clippy-beta-i686-unknown-linux-gnu.tar.xz=bfc60e9fe1dbed050904efc71e8d0e5c90dae7f949fc7c81312de0c129f4d058
340dist/2024-09-22/clippy-beta-loongarch64-unknown-linux-gnu.tar.gz=25df67e21543e3a3b71500f55da1abe6182a24aabe1f5bb1e57fe99821a22d97
341dist/2024-09-22/clippy-beta-loongarch64-unknown-linux-gnu.tar.xz=7b56b6f7704742821f42396f5c517adda129b68f05da258d371cc8a3bc7356f3
342dist/2024-09-22/clippy-beta-loongarch64-unknown-linux-musl.tar.gz=f7305d23b8b850b4169a2ae6816c9db721a989ffbb642a4645ed95068a6553fe
343dist/2024-09-22/clippy-beta-loongarch64-unknown-linux-musl.tar.xz=9576586590c11c86e8b029c32f17916ebd13d27d8750e30a927a4a986dd47aea
344dist/2024-09-22/clippy-beta-powerpc-unknown-linux-gnu.tar.gz=1eb483594b3ca3ab8e0eac99e7699be151791fcdf0349714b0da923ea33b92bc
345dist/2024-09-22/clippy-beta-powerpc-unknown-linux-gnu.tar.xz=42b9373a18ebf76394513cb75f8072ca094efbdfd8c60cc2249b04fad344f677
346dist/2024-09-22/clippy-beta-powerpc64-unknown-linux-gnu.tar.gz=fa6438d40613bb99062118bfb293f6f252a21c927d222c7cdfe4cee865d30d16
347dist/2024-09-22/clippy-beta-powerpc64-unknown-linux-gnu.tar.xz=7cfba858f149b327cbd9bf292080a2ae20404018228ab556eeefc3776f429785
348dist/2024-09-22/clippy-beta-powerpc64le-unknown-linux-gnu.tar.gz=5f6d94333400f99bbb0762be18fa9390885c13f4fe0ad7ea05b57808b26653e4
349dist/2024-09-22/clippy-beta-powerpc64le-unknown-linux-gnu.tar.xz=38042ee6161d8e8b04faf58a4bca98cf7940ece6ec42eb44ce29bdb9aedb6c89
350dist/2024-09-22/clippy-beta-riscv64gc-unknown-linux-gnu.tar.gz=b5056a3d8a8b3bbd888647117b316404b2701803bff09737cca18e16611ed3cd
351dist/2024-09-22/clippy-beta-riscv64gc-unknown-linux-gnu.tar.xz=9322024609e563bb0d1f342bae2deab1d0c0ae951c2e94fe74ddc22fe2c7d3f2
352dist/2024-09-22/clippy-beta-s390x-unknown-linux-gnu.tar.gz=8b52721fc1df5cd158e12ae80a2936929f64a7b2506c55793b4a7d28522f0e3e
353dist/2024-09-22/clippy-beta-s390x-unknown-linux-gnu.tar.xz=66dedbc154a11588a03616b92823c63502276123e66e9ff110c2e63cc7ed3529
354dist/2024-09-22/clippy-beta-x86_64-apple-darwin.tar.gz=66ba82b5e5097a2e35053fcb5db9ca44a152c1172f75d689688454561c8b3712
355dist/2024-09-22/clippy-beta-x86_64-apple-darwin.tar.xz=cfaa2e71b847103660336ad58025fff26f2928a4d7bcc5907fef91e70b63e1fc
356dist/2024-09-22/clippy-beta-x86_64-pc-windows-gnu.tar.gz=fef4e4f2c68294908e170c78efb657c02166fbfbc45b6ce65fbfb5c76ce6d20c
357dist/2024-09-22/clippy-beta-x86_64-pc-windows-gnu.tar.xz=0eec7155f78dfd0cc2e6ac996053492d7ba8a4fa5203f779a92b04ad42e8f651
358dist/2024-09-22/clippy-beta-x86_64-pc-windows-msvc.tar.gz=4dc7b6c972ed13417fa831ee20b9e4cc0a3895c39d4f059d1a14ebe51f7430e3
359dist/2024-09-22/clippy-beta-x86_64-pc-windows-msvc.tar.xz=c9f3fb89a31cbba2b575cbb7fc74c09c087940b138b34015239c8938ed6d6f14
360dist/2024-09-22/clippy-beta-x86_64-unknown-freebsd.tar.gz=cd7e5a9ee6be58a627b13d2e85c05aebd64414f854229aca917f3334acbe2352
361dist/2024-09-22/clippy-beta-x86_64-unknown-freebsd.tar.xz=7d81d8fd02506935f289e22c6a8f3433bc2c78ea02bbfa4950a31f49eb95344b
362dist/2024-09-22/clippy-beta-x86_64-unknown-illumos.tar.gz=d38eda29de151d13b0fb1f58b090b63e049e095a326e26b76055383ba13285a0
363dist/2024-09-22/clippy-beta-x86_64-unknown-illumos.tar.xz=3100a9e357e6ded30499d4a60a6ff64f26d99e1cbd1eea11ca7fcf92a9c1f293
364dist/2024-09-22/clippy-beta-x86_64-unknown-linux-gnu.tar.gz=c09c9e00e653ffdb51c4edca6aa1e23572092c45a1cb81235f05bc75331d68c3
365dist/2024-09-22/clippy-beta-x86_64-unknown-linux-gnu.tar.xz=1e2fa4de890d7bc6c2828df95a729a55cb2b255a25d96194ccca0c3e06a580ba
366dist/2024-09-22/clippy-beta-x86_64-unknown-linux-musl.tar.gz=ac80d0b1b7f3e451c3bd00fd882b547a9b87e95c3fc0d332050859ff827782a9
367dist/2024-09-22/clippy-beta-x86_64-unknown-linux-musl.tar.xz=1178ff5a580bd131ecb9a7b0ad2894c09f2882bcfc483ca14e1fd780925e97ed
368dist/2024-09-22/clippy-beta-x86_64-unknown-netbsd.tar.gz=b69d92c035e456d4d1dd8a09032a92f8226c9f39579966e86c2e202ac9995d29
369dist/2024-09-22/clippy-beta-x86_64-unknown-netbsd.tar.xz=a0e827a24ffe8d2b38efff5da0972eee15e098f790b49035b21a72ebf1cb17ef
370dist/2024-09-22/rustfmt-nightly-aarch64-apple-darwin.tar.gz=4e632df4953f955b24414d929c352ce1f6e196c50cedde3da4d8663f5f1dd77e
371dist/2024-09-22/rustfmt-nightly-aarch64-apple-darwin.tar.xz=d7f8d8442b25053e767ec85e50aa2a6f9bb01e45a2ec3fdec56ef1c305a91ba2
372dist/2024-09-22/rustfmt-nightly-aarch64-pc-windows-msvc.tar.gz=eaee820d549347d15f1b96e3c85517a65e2a5655b86e27927eb6646a7c1d7b67
373dist/2024-09-22/rustfmt-nightly-aarch64-pc-windows-msvc.tar.xz=5fb16519d2acb68df963800c9a5036f1ee38b6ea02a115c40b6622338cf7052c
374dist/2024-09-22/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.gz=037999e2fed25ae76b70960133a811a29707712d2141fc74a1db312cfe6020e1
375dist/2024-09-22/rustfmt-nightly-aarch64-unknown-linux-gnu.tar.xz=b10d1947baafc6160ce8d5902936c2b3469a1558b71263671e581ac5b1c14f0e
376dist/2024-09-22/rustfmt-nightly-aarch64-unknown-linux-musl.tar.gz=eb33ec39c232a6ddeab1b8038222f96407b9671052f995e0a60ada332a1ccb3f
377dist/2024-09-22/rustfmt-nightly-aarch64-unknown-linux-musl.tar.xz=396775133e37dac5de8e71e5d8fea26c19dbfc7841244a35c3529f5dfec93163
378dist/2024-09-22/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.gz=4885a99dbab8f33288501532b287c20f981bdcd10ea4d9ccffe585d5338c43d3
379dist/2024-09-22/rustfmt-nightly-arm-unknown-linux-gnueabi.tar.xz=af165d8090fd3c32efc7e5f58dd57d4a2c228cc6a9939c40024d896c35119bf6
380dist/2024-09-22/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.gz=150086cbd94e084b30faaebabc809cff11eca87a4aa4ff2b2b89286e0af6760e
381dist/2024-09-22/rustfmt-nightly-arm-unknown-linux-gnueabihf.tar.xz=49ab34e495e893037431851e65a35ea7e9d0b46ba651f7d73591bd659c031bd7
382dist/2024-09-22/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.gz=c61c6bb8a96c19a848155a38560e0a6dac91ec5f1ee2c602a060cd6039324839
383dist/2024-09-22/rustfmt-nightly-armv7-unknown-linux-gnueabihf.tar.xz=81b7ae3c5e27830fa10a17e062c56bcfe66413b994b27951b63f67faabd296d4
384dist/2024-09-22/rustfmt-nightly-i686-pc-windows-gnu.tar.gz=585896ee3c2b1644ebcba6a81b2f2dabc47da151f6100b5660e208c3a2967952
385dist/2024-09-22/rustfmt-nightly-i686-pc-windows-gnu.tar.xz=ca875f395d33249cbfd657cfab1b4c596de1453c4451c7bb4466ebec639ad016
386dist/2024-09-22/rustfmt-nightly-i686-pc-windows-msvc.tar.gz=4dbce4c329cac38785408eb1a8b2ff5358fd18b59276435695324a03a7018fa9
387dist/2024-09-22/rustfmt-nightly-i686-pc-windows-msvc.tar.xz=10aea1e2abaae9d098afff8d080cc9d84bfb3f77e2e72ec0a639d61dc5900fd8
388dist/2024-09-22/rustfmt-nightly-i686-unknown-linux-gnu.tar.gz=140897d538c0f7df473c3f704ec7e9198c9e903b5882688f0494166647dbd91e
389dist/2024-09-22/rustfmt-nightly-i686-unknown-linux-gnu.tar.xz=06e85fa8391eb7d82902ef55af8ee89a16f07b32e4839a848ac09b506f4227e3
390dist/2024-09-22/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.gz=4103e5daf242f72c0c7875044ea2ee5f2c88bc5c87ba1e685eee526038663e7d
391dist/2024-09-22/rustfmt-nightly-loongarch64-unknown-linux-gnu.tar.xz=fe424f1c13eb8257036db3e843d4c6b7b0e3bbf310f1d42719046f86dd635c95
392dist/2024-09-22/rustfmt-nightly-loongarch64-unknown-linux-musl.tar.gz=86304bb8673decae3d6e8b923765b410948277ea00d0cc5b14bb448da149aa8d
393dist/2024-09-22/rustfmt-nightly-loongarch64-unknown-linux-musl.tar.xz=743abf4d3ea8b3e1e8dbed6d9f75ee84680b0636e8e7c536b13bd69a41c8a0d9
394dist/2024-09-22/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.gz=db68cf7bfaa00b8f6c544b615eabdea998540ae70ec23af6b7370153a6706a64
395dist/2024-09-22/rustfmt-nightly-powerpc-unknown-linux-gnu.tar.xz=fe1abd02ed36a3720c41c46c77136c89c5addc2c8e5e2cbe25331a34082f4b7a
396dist/2024-09-22/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.gz=c6bb214d68fe7d631398a8684df49f4d1faeb42f9d422c247328e508bdaee830
397dist/2024-09-22/rustfmt-nightly-powerpc64-unknown-linux-gnu.tar.xz=230e19228f80fa4da3036d4eac5b9f9dde02b47d32c43278190da4d322461fd1
398dist/2024-09-22/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.gz=b21b569a1831a2ea621c35e19a1820f236fdfc54d38a387789b7750b1af26043
399dist/2024-09-22/rustfmt-nightly-powerpc64le-unknown-linux-gnu.tar.xz=28f8c4aa4cf00561d6c9dfddc13fdf5fba7b936f9f510b9ecc84160385d590d0
400dist/2024-09-22/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.gz=5cd81cb8c792abb3c31da225424ef5d1f6006163d3ddee06a95bb4286a29123e
401dist/2024-09-22/rustfmt-nightly-riscv64gc-unknown-linux-gnu.tar.xz=58eedfc8cda153ea5ee92278bf08a0625d129d3e208b3e0244e2b90819c7cc2e
402dist/2024-09-22/rustfmt-nightly-s390x-unknown-linux-gnu.tar.gz=17a0c073de3c6e3769a86d0438b1132762456153f3739c6652f94fca270e3a4b
403dist/2024-09-22/rustfmt-nightly-s390x-unknown-linux-gnu.tar.xz=d7001fc75844be6859a57d2263075ff1b7ac2d88c62452bd42fef97b0afe03d7
404dist/2024-09-22/rustfmt-nightly-x86_64-apple-darwin.tar.gz=7bc303ca8b36c782f2034441cbb6d3dc3ea891114895d2027cce9d8cd25ce348
405dist/2024-09-22/rustfmt-nightly-x86_64-apple-darwin.tar.xz=119dcbdeda0fc6cb80d18e6e908646cbaedd615f5a501922344c795ffd1dc7d8
406dist/2024-09-22/rustfmt-nightly-x86_64-pc-windows-gnu.tar.gz=b14962a790a48b609eda7e1a847c85759cd7dc7f9d0ac9914f126f458b4ae268
407dist/2024-09-22/rustfmt-nightly-x86_64-pc-windows-gnu.tar.xz=3a710fdf3d35c0a42f5c43341aa00390644d82e76c52aa59f4d652a6ab980b3d
408dist/2024-09-22/rustfmt-nightly-x86_64-pc-windows-msvc.tar.gz=946233868c179df3c133fa04bde2c863028a69776c7416aa4a33adb102d63783
409dist/2024-09-22/rustfmt-nightly-x86_64-pc-windows-msvc.tar.xz=1db1094ee7c9cad7a16b227de6763b835bc33c0650ba2eb9b380c430a766b81c
410dist/2024-09-22/rustfmt-nightly-x86_64-unknown-freebsd.tar.gz=68bc0322c947af0d98f63fc3e41322c12ce8be2bd185091b14407792d407f59b
411dist/2024-09-22/rustfmt-nightly-x86_64-unknown-freebsd.tar.xz=66e380f40e18c8a1ce91a9eaf7f662cacd580fc2b276cc854c03d795a5b9d547
412dist/2024-09-22/rustfmt-nightly-x86_64-unknown-illumos.tar.gz=5048bd14d07ed54f5120b0488925f69ff92d2fe00f1e19ae3a8a39a56201c09b
413dist/2024-09-22/rustfmt-nightly-x86_64-unknown-illumos.tar.xz=d2f903f996c265b4d70bb88d47e85dd7382b3298f9ff02ad4502f32d6f9919dd
414dist/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.gz=f0c150cb2fcbb7cfc4982426be6760093aa6cf854d84ed3c793f766fba6a0cc8
415dist/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-gnu.tar.xz=5d5cc741435c63b162417f425f7cf9445a13c109687cc85f28424fc51192e333
416dist/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-musl.tar.gz=a3252a997f60b086ea8c9c32665277f33cf574fdefee859ee448dc0b7eed5be9
417dist/2024-09-22/rustfmt-nightly-x86_64-unknown-linux-musl.tar.xz=b888f58dce3689e75ea6c23904481f7fec110f0aea45b75a9390d2160e0d3151
418dist/2024-09-22/rustfmt-nightly-x86_64-unknown-netbsd.tar.gz=4663adcc009bd376b0787760854fb694eaa0edff88f72b4cf486f7180f6a1c2b
419dist/2024-09-22/rustfmt-nightly-x86_64-unknown-netbsd.tar.xz=bfc83277d2217b3a908c3f9153db1336b63270c70c6cd83a2628cf18c41db47f
420dist/2024-09-22/rustc-nightly-aarch64-apple-darwin.tar.gz=ade996e00dd338a86cdcb25961d07c936edec1392526d78dd5de156ba012fe55
421dist/2024-09-22/rustc-nightly-aarch64-apple-darwin.tar.xz=147d0cfe57be988564d30fcba7fc0c69979b5fbdd91e4a08ac8e580be8a1cc6f
422dist/2024-09-22/rustc-nightly-aarch64-pc-windows-msvc.tar.gz=e6a59a0303abbabb3b373fda7fb697ad2cfd31011f231fbdfd45c1cbd64e8bd7
423dist/2024-09-22/rustc-nightly-aarch64-pc-windows-msvc.tar.xz=9ee27bc608470ef29a51272656d0ed5e03946dcc3411412ef8b05cc70f97f8b9
424dist/2024-09-22/rustc-nightly-aarch64-unknown-linux-gnu.tar.gz=3ec6f8cee20883195c102bdcffee31d695698bb6eaf45502720edbc16b02f471
425dist/2024-09-22/rustc-nightly-aarch64-unknown-linux-gnu.tar.xz=7f8fabd6433acb752131071c5bee76752fcc88e08ffff4684a7badb9ed4bc50e
426dist/2024-09-22/rustc-nightly-aarch64-unknown-linux-musl.tar.gz=7a8756afcd643b78aa6834497935d7bc0ede1ae74150fa83fff85243deb5e554
427dist/2024-09-22/rustc-nightly-aarch64-unknown-linux-musl.tar.xz=de39081dbeeb0715d433e0cd56e62db45c3bb5bf04d1e7dc3fa097e7b3ca97dc
428dist/2024-09-22/rustc-nightly-arm-unknown-linux-gnueabi.tar.gz=ea6bd6b337d24a7c9995fa95d8884e66755d016fb1d50fea063129a410bec22a
429dist/2024-09-22/rustc-nightly-arm-unknown-linux-gnueabi.tar.xz=fa195b2588675831274ca21c0d2420e5729d1c21c4c245f2fd1d2c044d7ede1c
430dist/2024-09-22/rustc-nightly-arm-unknown-linux-gnueabihf.tar.gz=6f0719613ec54221e978e7136baa00eb25b8b3d627e5de5ee3488c9d9e869b97
431dist/2024-09-22/rustc-nightly-arm-unknown-linux-gnueabihf.tar.xz=9e0bbd283a0377f881f1c048660c54700561762e220ff2713566d3fb6eb56cce
432dist/2024-09-22/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.gz=c8f88bb948119a9ff218571eb3ff0144915b2ce4a404d445db9f8f9c25044aa3
433dist/2024-09-22/rustc-nightly-armv7-unknown-linux-gnueabihf.tar.xz=1c41588099d929a7e9dd56cba22782f5202fac2829b924b1aa7dab3e03c52960
434dist/2024-09-22/rustc-nightly-i686-pc-windows-gnu.tar.gz=af2d30b4925e786ace64d4a11bb05ac6f7df1636989a3656d1aa9fe56cdc330f
435dist/2024-09-22/rustc-nightly-i686-pc-windows-gnu.tar.xz=4bfe618c3702ea805b63beac19cbf0561d262e67d87765a4e10ea9defded53c4
436dist/2024-09-22/rustc-nightly-i686-pc-windows-msvc.tar.gz=c4e57fe6fec40d874c8fb54227b310072dc98f35f99b8cc741e6818a67941f6d
437dist/2024-09-22/rustc-nightly-i686-pc-windows-msvc.tar.xz=ed10535a830e2e1ab22767a24b82b3314b7ef4ac3c318954ee8f2384b287d8e7
438dist/2024-09-22/rustc-nightly-i686-unknown-linux-gnu.tar.gz=da5e36f6bb3d9f00b8e5db5aceefcf8ad38552b85a1a4f60f7b700148cd49152
439dist/2024-09-22/rustc-nightly-i686-unknown-linux-gnu.tar.xz=5831b0209eb64a44b6bfc8aa4b092faaae85101f58f79c4e869bffec22361f1b
440dist/2024-09-22/rustc-nightly-loongarch64-unknown-linux-gnu.tar.gz=f31871890aa6249528b43119d0f050d27c5f404b560d48660cd4c9e7a3a80b76
441dist/2024-09-22/rustc-nightly-loongarch64-unknown-linux-gnu.tar.xz=19dc59393d25edef8a341bb137ad1f4ca20741038b0111dc81d6e61c0a7a1975
442dist/2024-09-22/rustc-nightly-loongarch64-unknown-linux-musl.tar.gz=8ebea352863ef014e4dafbafe5a28ddfff6a26f3e4cf728fb4099ecd3444a3ec
443dist/2024-09-22/rustc-nightly-loongarch64-unknown-linux-musl.tar.xz=97196b586f44022d2c24b7378830f716abceb451244035f74c40b6c1587f6c50
444dist/2024-09-22/rustc-nightly-powerpc-unknown-linux-gnu.tar.gz=6f4d2428ec7a4d5e1540b53e35904b9f9ff5b8fcd05cf3311b005dbfd426d65b
445dist/2024-09-22/rustc-nightly-powerpc-unknown-linux-gnu.tar.xz=c2bc66d7d763c1d4c5752b60ab563fe5b870dd35533712046acd40f258f7a337
446dist/2024-09-22/rustc-nightly-powerpc64-unknown-linux-gnu.tar.gz=d0e6f42aafc8d8b289b55c1ba4a34039c747a7445b347f05017606801a7d81a4
447dist/2024-09-22/rustc-nightly-powerpc64-unknown-linux-gnu.tar.xz=9612777e56955ab5446e3ef20e0d579fbeceedc3bdc4d0053367be2191551fd7
448dist/2024-09-22/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.gz=811099c8b6adc017678c4e43c8f7b02b2bde267eac1bbc023b1f22c184894231
449dist/2024-09-22/rustc-nightly-powerpc64le-unknown-linux-gnu.tar.xz=f766dab0fa46122c26e5a7736da65e8a2df9c2c6578093b6532dbd88a162d1a5
450dist/2024-09-22/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.gz=21e9896e5184d797445a19ce5788d8dabe86302d5f63bf8c07105b52a237c13b
451dist/2024-09-22/rustc-nightly-riscv64gc-unknown-linux-gnu.tar.xz=002da974c9606726cc7e6f68cda012ef305e420cf6f7a0de84bf791c007fecd6
452dist/2024-09-22/rustc-nightly-s390x-unknown-linux-gnu.tar.gz=adfa4248f4ad883a04d67f923325c28b7400853063f2d8017cca8f4100ec1125
453dist/2024-09-22/rustc-nightly-s390x-unknown-linux-gnu.tar.xz=8334aa8a99d2a8034267394d44b0e5036d053c247812dbd5bc90bdb2344e4713
454dist/2024-09-22/rustc-nightly-x86_64-apple-darwin.tar.gz=385aa935fb1762423d1a11c0928597e502adbab9809a86c17d98096c31f65775
455dist/2024-09-22/rustc-nightly-x86_64-apple-darwin.tar.xz=f2bb16e1618dbcc7dda85e0ff4460ee270a99871477380a6412f575bd02f4cf5
456dist/2024-09-22/rustc-nightly-x86_64-pc-windows-gnu.tar.gz=6e3894c7651bfb48c741aba516ee99690616431643db82cd186fe408675d07b4
457dist/2024-09-22/rustc-nightly-x86_64-pc-windows-gnu.tar.xz=5661b5ba3a496106f4b0019d4ce81dbcb4b4a0db68a90bac64a95a0bd9201514
458dist/2024-09-22/rustc-nightly-x86_64-pc-windows-msvc.tar.gz=564f7a0582f3b900201cda4fe502e191b651a845210d21a40a119b94e2e51133
459dist/2024-09-22/rustc-nightly-x86_64-pc-windows-msvc.tar.xz=1804ebc7ade5c49ec4b82cac2261cf159b8c852a7e06f3faafbf990214936d2b
460dist/2024-09-22/rustc-nightly-x86_64-unknown-freebsd.tar.gz=7455de95ddb8e565ddeaf2da7d80d890c60bc653f52afcab5244476d35305e0b
461dist/2024-09-22/rustc-nightly-x86_64-unknown-freebsd.tar.xz=36a7cf6e8245c3879c08d5e3acfb0155ebcdc6c5b06edc51d43376c44d9ed0b4
462dist/2024-09-22/rustc-nightly-x86_64-unknown-illumos.tar.gz=143f5ce723a8f5e54af64a3b31d83243a808355705b1402be5de821759187066
463dist/2024-09-22/rustc-nightly-x86_64-unknown-illumos.tar.xz=c88c8d2ae8f221fe1db978802c98368472381b443bed9501371c03617865785d
464dist/2024-09-22/rustc-nightly-x86_64-unknown-linux-gnu.tar.gz=0ea098f78927d9fdf4ec075a04e989b6ac83bc1f1225aca5960281cd65046a3b
465dist/2024-09-22/rustc-nightly-x86_64-unknown-linux-gnu.tar.xz=33e5e1e0b758de383281ae704d3dd1ee337d8e28515d6b4584dd2691587c7f0e
466dist/2024-09-22/rustc-nightly-x86_64-unknown-linux-musl.tar.gz=723f5eaceef968b05286a17b7868c7e0cf222ac33d23a9ac3f761fc274b87c38
467dist/2024-09-22/rustc-nightly-x86_64-unknown-linux-musl.tar.xz=1b00b14a57b6f3b7edbf9adc05d3ed28ed1e2b8ced921a444d13dd1ef577e715
468dist/2024-09-22/rustc-nightly-x86_64-unknown-netbsd.tar.gz=6cd2651e4e8aedd8aef8d325a72cf18694ee7a14077c7331d96e2e7c03b9c57a
469dist/2024-09-22/rustc-nightly-x86_64-unknown-netbsd.tar.xz=0c6144559f040a209183d6f02f61caf485f0174190e643870d1d6c9744bfede3
\ No newline at end of file
src/tools/build-manifest/src/main.rs+5-8
......@@ -598,14 +598,11 @@ impl Builder {
598598 })
599599 .collect();
600600
601 dst.insert(
602 pkg.manifest_component_name(),
603 Package {
604 version: version_info.version.unwrap_or_default(),
605 git_commit_hash: version_info.git_commit,
606 target: targets,
607 },
608 );
601 dst.insert(pkg.manifest_component_name(), Package {
602 version: version_info.version.unwrap_or_default(),
603 git_commit_hash: version_info.git_commit,
604 target: targets,
605 });
609606 }
610607
611608 fn url(&self, path: &Path) -> String {
src/tools/build-manifest/src/manifest.rs+1-1
......@@ -3,8 +3,8 @@ use std::path::{Path, PathBuf};
33
44use serde::{Serialize, Serializer};
55
6use crate::versions::PkgType;
76use crate::Builder;
7use crate::versions::PkgType;
88
99#[derive(Serialize)]
1010#[serde(rename_all = "kebab-case")]
src/tools/bump-stage0/src/main.rs+1-1
......@@ -1,7 +1,7 @@
11#![deny(unused_variables)]
22
33use anyhow::{Context, Error};
4use build_helper::stage0_parser::{parse_stage0_file, Stage0Config, VersionMetadata};
4use build_helper::stage0_parser::{Stage0Config, VersionMetadata, parse_stage0_file};
55use curl::easy::Easy;
66use indexmap::IndexMap;
77
src/tools/compiletest/src/common.rs+1-1
......@@ -11,7 +11,7 @@ use serde::de::{Deserialize, Deserializer, Error as _};
1111use test::{ColorConfig, OutputFormat};
1212
1313pub use self::Mode::*;
14use crate::util::{add_dylib_path, PathBufExt};
14use crate::util::{PathBufExt, add_dylib_path};
1515
1616macro_rules! string_enum {
1717 ($(#[$meta:meta])* $vis:vis enum $name:ident { $($variant:ident => $repr:expr,)* }) => {
src/tools/compiletest/src/errors.rs+1-1
......@@ -1,7 +1,7 @@
11use std::fmt;
22use std::fs::File;
3use std::io::prelude::*;
43use std::io::BufReader;
4use std::io::prelude::*;
55use std::path::Path;
66use std::str::FromStr;
77use std::sync::OnceLock;
src/tools/compiletest/src/header.rs+2-2
......@@ -1,8 +1,8 @@
11use std::collections::HashSet;
22use std::env;
33use std::fs::File;
4use std::io::prelude::*;
54use std::io::BufReader;
5use std::io::prelude::*;
66use std::path::{Path, PathBuf};
77use std::process::Command;
88use std::sync::OnceLock;
......@@ -11,7 +11,7 @@ use regex::Regex;
1111use tracing::*;
1212
1313use crate::common::{Config, Debugger, FailMode, Mode, PassMode};
14use crate::header::cfg::{parse_cfg_name_directive, MatchOutcome};
14use crate::header::cfg::{MatchOutcome, parse_cfg_name_directive};
1515use crate::header::needs::CachedNeedsConditions;
1616use crate::util::static_regex;
1717use crate::{extract_cdb_version, extract_gdb_version};
src/tools/compiletest/src/header/needs.rs+1-1
......@@ -1,5 +1,5 @@
11use crate::common::{Config, Sanitizer};
2use crate::header::{llvm_has_libzstd, IgnoreDecision};
2use crate::header::{IgnoreDecision, llvm_has_libzstd};
33
44pub(super) fn handle_needs(
55 cache: &CachedNeedsConditions,
src/tools/compiletest/src/header/tests.rs+4-5
......@@ -4,7 +4,7 @@ use std::str::FromStr;
44
55use super::iter_header;
66use crate::common::{Config, Debugger, Mode};
7use crate::header::{parse_normalize_rule, EarlyProps, HeadersCache};
7use crate::header::{EarlyProps, HeadersCache, parse_normalize_rule};
88
99fn make_test_description<R: Read>(
1010 config: &Config,
......@@ -226,10 +226,9 @@ fn revisions() {
226226 let config: Config = cfg().build();
227227
228228 assert_eq!(parse_rs(&config, "//@ revisions: a b c").revisions, vec!["a", "b", "c"],);
229 assert_eq!(
230 parse_makefile(&config, "# revisions: hello there").revisions,
231 vec!["hello", "there"],
232 );
229 assert_eq!(parse_makefile(&config, "# revisions: hello there").revisions, vec![
230 "hello", "there"
231 ],);
233232}
234233
235234#[test]
src/tools/compiletest/src/lib.rs+3-3
......@@ -34,10 +34,10 @@ use test::ColorConfig;
3434use tracing::*;
3535use walkdir::WalkDir;
3636
37use self::header::{make_test_description, EarlyProps};
37use self::header::{EarlyProps, make_test_description};
3838use crate::common::{
39 expected_output_path, output_base_dir, output_relative_path, Config, Debugger, Mode, PassMode,
40 TestPaths, UI_EXTENSIONS,
39 Config, Debugger, Mode, PassMode, TestPaths, UI_EXTENSIONS, expected_output_path,
40 output_base_dir, output_relative_path,
4141};
4242use crate::header::HeadersCache;
4343use crate::util::logv;
src/tools/compiletest/src/read2.rs+1-1
......@@ -232,9 +232,9 @@ mod imp {
232232 use std::process::{ChildStderr, ChildStdout};
233233 use std::{io, slice};
234234
235 use miow::Overlapped;
235236 use miow::iocp::{CompletionPort, CompletionStatus};
236237 use miow::pipe::NamedPipe;
237 use miow::Overlapped;
238238 use windows::Win32::Foundation::ERROR_BROKEN_PIPE;
239239
240240 struct Pipe<'a> {
src/tools/compiletest/src/read2/tests.rs+1-1
......@@ -1,6 +1,6 @@
11use std::io::Write;
22
3use crate::read2::{ProcOutput, FILTERED_PATHS_PLACEHOLDER_LEN, MAX_OUT_LEN};
3use crate::read2::{FILTERED_PATHS_PLACEHOLDER_LEN, MAX_OUT_LEN, ProcOutput};
44
55#[test]
66fn test_abbreviate_short_string() {
src/tools/compiletest/src/runtest.rs+10-10
......@@ -3,7 +3,7 @@
33use std::borrow::Cow;
44use std::collections::{HashMap, HashSet};
55use std::ffi::OsString;
6use std::fs::{self, create_dir_all, File};
6use std::fs::{self, File, create_dir_all};
77use std::hash::{DefaultHasher, Hash, Hasher};
88use std::io::prelude::*;
99use std::io::{self, BufReader};
......@@ -18,18 +18,18 @@ use regex::{Captures, Regex};
1818use tracing::*;
1919
2020use crate::common::{
21 expected_output_path, incremental_dir, output_base_dir, output_base_name,
22 output_testname_unique, Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap,
23 CoverageRun, Crashes, DebugInfo, Debugger, FailMode, Incremental, JsDocTest, MirOpt, PassMode,
24 Pretty, RunMake, RunPassValgrind, Rustdoc, RustdocJson, TestPaths, Ui, UI_EXTENSIONS, UI_FIXED,
25 UI_RUN_STDERR, UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG,
21 Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap, CoverageRun, Crashes,
22 DebugInfo, Debugger, FailMode, Incremental, JsDocTest, MirOpt, PassMode, Pretty, RunMake,
23 RunPassValgrind, Rustdoc, RustdocJson, TestPaths, UI_EXTENSIONS, UI_FIXED, UI_RUN_STDERR,
24 UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG, Ui, expected_output_path,
25 incremental_dir, output_base_dir, output_base_name, output_testname_unique,
2626};
2727use crate::compute_diff::{write_diff, write_filtered_diff};
2828use crate::errors::{self, Error, ErrorKind};
2929use crate::header::TestProps;
30use crate::read2::{read2_abbreviated, Truncated};
31use crate::util::{add_dylib_path, logv, static_regex, PathBufExt};
32use crate::{json, ColorConfig};
30use crate::read2::{Truncated, read2_abbreviated};
31use crate::util::{PathBufExt, add_dylib_path, logv, static_regex};
32use crate::{ColorConfig, json};
3333
3434mod debugger;
3535
......@@ -62,7 +62,7 @@ fn disable_error_reporting<F: FnOnce() -> R, R>(f: F) -> R {
6262 use std::sync::Mutex;
6363
6464 use windows::Win32::System::Diagnostics::Debug::{
65 SetErrorMode, SEM_NOGPFAULTERRORBOX, THREAD_ERROR_MODE,
65 SEM_NOGPFAULTERRORBOX, SetErrorMode, THREAD_ERROR_MODE,
6666 };
6767
6868 static LOCK: Mutex<()> = Mutex::new(());
src/tools/compiletest/src/runtest/mir_opt.rs+1-1
......@@ -2,7 +2,7 @@ use std::fs;
22use std::path::{Path, PathBuf};
33
44use glob::glob;
5use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
5use miropt_test_tools::{MiroptTest, MiroptTestFile, files_for_miropt_test};
66use tracing::debug;
77
88use super::{Emit, TestCx, WillExecute};
src/tools/compiletest/src/runtest/rustdoc.rs+1-1
......@@ -1,6 +1,6 @@
11use std::process::Command;
22
3use super::{remove_and_create_dir_all, TestCx};
3use super::{TestCx, remove_and_create_dir_all};
44
55impl TestCx<'_> {
66 pub(super) fn run_rustdoc_test(&self) {
src/tools/compiletest/src/runtest/rustdoc_json.rs+1-1
......@@ -1,6 +1,6 @@
11use std::process::Command;
22
3use super::{remove_and_create_dir_all, TestCx};
3use super::{TestCx, remove_and_create_dir_all};
44
55impl TestCx<'_> {
66 pub(super) fn run_rustdoc_json_test(&self) {
src/tools/compiletest/src/runtest/ui.rs+2-2
......@@ -2,12 +2,12 @@ use std::collections::HashSet;
22use std::fs::OpenOptions;
33use std::io::Write;
44
5use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
5use rustfix::{Filter, apply_suggestions, get_suggestions_from_json};
66use tracing::debug;
77
88use super::{
99 AllowUnused, Emit, ErrorKind, FailMode, LinkToAux, PassMode, TargetLocation, TestCx,
10 TestOutput, Truncated, WillExecute, UI_FIXED,
10 TestOutput, Truncated, UI_FIXED, WillExecute,
1111};
1212use crate::{errors, json};
1313
src/tools/coverage-dump/src/covfun.rs+2-2
......@@ -2,10 +2,10 @@ use std::collections::HashMap;
22use std::fmt::{self, Debug, Write as _};
33use std::sync::OnceLock;
44
5use anyhow::{anyhow, Context};
5use anyhow::{Context, anyhow};
66use regex::Regex;
77
8use crate::parser::{unescape_llvm_string_contents, Parser};
8use crate::parser::{Parser, unescape_llvm_string_contents};
99
1010pub(crate) fn dump_covfun_mappings(
1111 llvm_ir: &str,
src/tools/coverage-dump/src/prf_names.rs+1-1
......@@ -4,7 +4,7 @@ use std::sync::OnceLock;
44use anyhow::{anyhow, ensure};
55use regex::Regex;
66
7use crate::parser::{unescape_llvm_string_contents, Parser};
7use crate::parser::{Parser, unescape_llvm_string_contents};
88
99/// Scans through the contents of an LLVM IR assembly file to find `__llvm_prf_names`
1010/// entries, decodes them, and creates a table that maps name hash values to
src/tools/error_index_generator/main.rs+1-1
......@@ -12,7 +12,7 @@ use std::io::Write;
1212use std::path::{Path, PathBuf};
1313use std::str::FromStr;
1414
15use mdbook::book::{parse_summary, BookItem, Chapter};
15use mdbook::book::{BookItem, Chapter, parse_summary};
1616use mdbook::{Config, MDBook};
1717use rustc_errors::codes::DIAGNOSTICS;
1818
src/tools/generate-copyright/src/cargo_metadata.rs+6-9
......@@ -99,15 +99,12 @@ pub fn get_metadata(
9999 }
100100 // otherwise it's an out-of-tree dependency
101101 let package_id = Package { name: package.name, version: package.version.to_string() };
102 output.insert(
103 package_id,
104 PackageMetadata {
105 license: package.license.unwrap_or_else(|| String::from("Unspecified")),
106 authors: package.authors,
107 notices: BTreeMap::new(),
108 is_in_libstd: None,
109 },
110 );
102 output.insert(package_id, PackageMetadata {
103 license: package.license.unwrap_or_else(|| String::from("Unspecified")),
104 authors: package.authors,
105 notices: BTreeMap::new(),
106 is_in_libstd: None,
107 });
111108 }
112109 }
113110
src/tools/jsondoclint/src/main.rs+2-2
......@@ -1,10 +1,10 @@
11use std::io::{BufWriter, Write};
22use std::path::{Path, PathBuf};
33
4use anyhow::{bail, Result};
4use anyhow::{Result, bail};
55use clap::Parser;
66use fs_err as fs;
7use rustdoc_json_types::{Crate, Id, FORMAT_VERSION};
7use rustdoc_json_types::{Crate, FORMAT_VERSION, Id};
88use serde::Serialize;
99use serde_json::Value;
1010
src/tools/jsondoclint/src/validator.rs+1-1
......@@ -11,7 +11,7 @@ use rustdoc_json_types::{
1111use serde_json::Value;
1212
1313use crate::item_kind::Kind;
14use crate::{json_find, Error, ErrorKind};
14use crate::{Error, ErrorKind, json_find};
1515
1616// This is a rustc implementation detail that we rely on here
1717const LOCAL_CRATE_ID: u32 = 0;
src/tools/jsondoclint/src/validator/tests.rs+71-100
......@@ -1,5 +1,5 @@
11use rustc_hash::FxHashMap;
2use rustdoc_json_types::{Item, ItemKind, Visibility, FORMAT_VERSION};
2use rustdoc_json_types::{FORMAT_VERSION, Item, ItemKind, Visibility};
33
44use super::*;
55use crate::json_find::SelectorPart;
......@@ -25,42 +25,32 @@ fn errors_on_missing_links() {
2525 root: id("0"),
2626 crate_version: None,
2727 includes_private: false,
28 index: FxHashMap::from_iter([(
29 id("0"),
30 Item {
31 name: Some("root".to_owned()),
32 id: id(""),
33 crate_id: 0,
34 span: None,
35 visibility: Visibility::Public,
36 docs: None,
37 links: FxHashMap::from_iter([("Not Found".to_owned(), id("1"))]),
38 attrs: vec![],
39 deprecation: None,
40 inner: ItemEnum::Module(Module {
41 is_crate: true,
42 items: vec![],
43 is_stripped: false,
44 }),
45 },
46 )]),
28 index: FxHashMap::from_iter([(id("0"), Item {
29 name: Some("root".to_owned()),
30 id: id(""),
31 crate_id: 0,
32 span: None,
33 visibility: Visibility::Public,
34 docs: None,
35 links: FxHashMap::from_iter([("Not Found".to_owned(), id("1"))]),
36 attrs: vec![],
37 deprecation: None,
38 inner: ItemEnum::Module(Module { is_crate: true, items: vec![], is_stripped: false }),
39 })]),
4740 paths: FxHashMap::default(),
4841 external_crates: FxHashMap::default(),
4942 format_version: rustdoc_json_types::FORMAT_VERSION,
5043 };
5144
52 check(
53 &k,
54 &[Error {
55 kind: ErrorKind::NotFound(vec![vec![
56 SelectorPart::Field("index".to_owned()),
57 SelectorPart::Field("0".to_owned()),
58 SelectorPart::Field("links".to_owned()),
59 SelectorPart::Field("Not Found".to_owned()),
60 ]]),
61 id: id("1"),
62 }],
63 );
45 check(&k, &[Error {
46 kind: ErrorKind::NotFound(vec![vec![
47 SelectorPart::Field("index".to_owned()),
48 SelectorPart::Field("0".to_owned()),
49 SelectorPart::Field("links".to_owned()),
50 SelectorPart::Field("Not Found".to_owned()),
51 ]]),
52 id: id("1"),
53 }]);
6454}
6555
6656// Test we would catch
......@@ -72,60 +62,48 @@ fn errors_on_local_in_paths_and_not_index() {
7262 crate_version: None,
7363 includes_private: false,
7464 index: FxHashMap::from_iter([
75 (
76 id("0:0:1572"),
77 Item {
78 id: id("0:0:1572"),
79 crate_id: 0,
80 name: Some("microcore".to_owned()),
81 span: None,
82 visibility: Visibility::Public,
83 docs: None,
84 links: FxHashMap::from_iter([(("prim@i32".to_owned(), id("0:1:1571")))]),
85 attrs: Vec::new(),
86 deprecation: None,
87 inner: ItemEnum::Module(Module {
88 is_crate: true,
89 items: vec![id("0:1:717")],
90 is_stripped: false,
91 }),
92 },
93 ),
94 (
95 id("0:1:717"),
96 Item {
97 id: id("0:1:717"),
98 crate_id: 0,
99 name: Some("i32".to_owned()),
100 span: None,
101 visibility: Visibility::Public,
102 docs: None,
103 links: FxHashMap::default(),
104 attrs: Vec::new(),
105 deprecation: None,
106 inner: ItemEnum::Primitive(Primitive { name: "i32".to_owned(), impls: vec![] }),
107 },
108 ),
109 ]),
110 paths: FxHashMap::from_iter([(
111 id("0:1:1571"),
112 ItemSummary {
65 (id("0:0:1572"), Item {
66 id: id("0:0:1572"),
11367 crate_id: 0,
114 path: vec!["microcore".to_owned(), "i32".to_owned()],
115 kind: ItemKind::Primitive,
116 },
117 )]),
68 name: Some("microcore".to_owned()),
69 span: None,
70 visibility: Visibility::Public,
71 docs: None,
72 links: FxHashMap::from_iter([(("prim@i32".to_owned(), id("0:1:1571")))]),
73 attrs: Vec::new(),
74 deprecation: None,
75 inner: ItemEnum::Module(Module {
76 is_crate: true,
77 items: vec![id("0:1:717")],
78 is_stripped: false,
79 }),
80 }),
81 (id("0:1:717"), Item {
82 id: id("0:1:717"),
83 crate_id: 0,
84 name: Some("i32".to_owned()),
85 span: None,
86 visibility: Visibility::Public,
87 docs: None,
88 links: FxHashMap::default(),
89 attrs: Vec::new(),
90 deprecation: None,
91 inner: ItemEnum::Primitive(Primitive { name: "i32".to_owned(), impls: vec![] }),
92 }),
93 ]),
94 paths: FxHashMap::from_iter([(id("0:1:1571"), ItemSummary {
95 crate_id: 0,
96 path: vec!["microcore".to_owned(), "i32".to_owned()],
97 kind: ItemKind::Primitive,
98 })]),
11899 external_crates: FxHashMap::default(),
119100 format_version: rustdoc_json_types::FORMAT_VERSION,
120101 };
121102
122 check(
123 &krate,
124 &[Error {
125 id: id("0:1:1571"),
126 kind: ErrorKind::Custom("Id for local item in `paths` but not in `index`".to_owned()),
127 }],
128 );
103 check(&krate, &[Error {
104 id: id("0:1:1571"),
105 kind: ErrorKind::Custom("Id for local item in `paths` but not in `index`".to_owned()),
106 }]);
129107}
130108
131109#[test]
......@@ -135,25 +113,18 @@ fn checks_local_crate_id_is_correct() {
135113 root: id("root"),
136114 crate_version: None,
137115 includes_private: false,
138 index: FxHashMap::from_iter([(
139 id("root"),
140 Item {
141 id: id("root"),
142 crate_id: LOCAL_CRATE_ID.wrapping_add(1),
143 name: Some("irrelavent".to_owned()),
144 span: None,
145 visibility: Visibility::Public,
146 docs: None,
147 links: FxHashMap::default(),
148 attrs: Vec::new(),
149 deprecation: None,
150 inner: ItemEnum::Module(Module {
151 is_crate: true,
152 items: vec![],
153 is_stripped: false,
154 }),
155 },
156 )]),
116 index: FxHashMap::from_iter([(id("root"), Item {
117 id: id("root"),
118 crate_id: LOCAL_CRATE_ID.wrapping_add(1),
119 name: Some("irrelavent".to_owned()),
120 span: None,
121 visibility: Visibility::Public,
122 docs: None,
123 links: FxHashMap::default(),
124 attrs: Vec::new(),
125 deprecation: None,
126 inner: ItemEnum::Module(Module { is_crate: true, items: vec![], is_stripped: false }),
127 })]),
157128 paths: FxHashMap::default(),
158129 external_crates: FxHashMap::default(),
159130 format_version: FORMAT_VERSION,
src/tools/lint-docs/src/lib.rs+18-24
......@@ -19,30 +19,24 @@ mod groups;
1919/// level of the lint, which will be more difficult to support, since rustc
2020/// currently does not track that historical information.
2121static RENAMES: &[(Level, &[(&str, &str)])] = &[
22 (
23 Level::Allow,
24 &[
25 ("single-use-lifetime", "single-use-lifetimes"),
26 ("elided-lifetime-in-path", "elided-lifetimes-in-paths"),
27 ("async-idents", "keyword-idents"),
28 ("disjoint-capture-migration", "rust-2021-incompatible-closure-captures"),
29 ("keyword-idents", "keyword-idents-2018"),
30 ("or-patterns-back-compat", "rust-2021-incompatible-or-patterns"),
31 ],
32 ),
33 (
34 Level::Warn,
35 &[
36 ("bare-trait-object", "bare-trait-objects"),
37 ("unstable-name-collision", "unstable-name-collisions"),
38 ("unused-doc-comment", "unused-doc-comments"),
39 ("redundant-semicolon", "redundant-semicolons"),
40 ("overlapping-patterns", "overlapping-range-endpoints"),
41 ("non-fmt-panic", "non-fmt-panics"),
42 ("unused-tuple-struct-fields", "dead-code"),
43 ("static-mut-ref", "static-mut-refs"),
44 ],
45 ),
22 (Level::Allow, &[
23 ("single-use-lifetime", "single-use-lifetimes"),
24 ("elided-lifetime-in-path", "elided-lifetimes-in-paths"),
25 ("async-idents", "keyword-idents"),
26 ("disjoint-capture-migration", "rust-2021-incompatible-closure-captures"),
27 ("keyword-idents", "keyword-idents-2018"),
28 ("or-patterns-back-compat", "rust-2021-incompatible-or-patterns"),
29 ]),
30 (Level::Warn, &[
31 ("bare-trait-object", "bare-trait-objects"),
32 ("unstable-name-collision", "unstable-name-collisions"),
33 ("unused-doc-comment", "unused-doc-comments"),
34 ("redundant-semicolon", "redundant-semicolons"),
35 ("overlapping-patterns", "overlapping-range-endpoints"),
36 ("non-fmt-panic", "non-fmt-panics"),
37 ("unused-tuple-struct-fields", "dead-code"),
38 ("static-mut-ref", "static-mut-refs"),
39 ]),
4640 (Level::Deny, &[("exceeding-bitshifts", "arithmetic-overflow")]),
4741];
4842
src/tools/opt-dist/src/main.rs+1-1
......@@ -6,7 +6,7 @@ use utils::io;
66
77use crate::bolt::{bolt_optimize, with_bolt_instrumented};
88use crate::environment::{Environment, EnvironmentBuilder};
9use crate::exec::{cmd, Bootstrap};
9use crate::exec::{Bootstrap, cmd};
1010use crate::tests::run_tests;
1111use crate::timer::Timer;
1212use crate::training::{
src/tools/opt-dist/src/tests.rs+1-1
......@@ -1,7 +1,7 @@
11use anyhow::Context;
22use camino::{Utf8Path, Utf8PathBuf};
33
4use crate::environment::{executable_extension, Environment};
4use crate::environment::{Environment, executable_extension};
55use crate::exec::cmd;
66use crate::utils::io::{copy_directory, find_file_in_dir, unpack_archive};
77
src/tools/opt-dist/src/training.rs+2-2
......@@ -3,8 +3,8 @@ use build_helper::{LLVM_PGO_CRATES, RUSTC_PGO_CRATES};
33use camino::{Utf8Path, Utf8PathBuf};
44use humansize::BINARY;
55
6use crate::environment::{executable_extension, Environment};
7use crate::exec::{cmd, CmdBuilder};
6use crate::environment::{Environment, executable_extension};
7use crate::exec::{CmdBuilder, cmd};
88use crate::utils::io::{count_files, delete_directory};
99use crate::utils::with_log_group;
1010
src/tools/opt-dist/src/utils/artifact_size.rs+1-1
......@@ -11,7 +11,7 @@ use crate::utils::io::get_files_from_dir;
1111pub fn print_binary_sizes(env: &Environment) -> anyhow::Result<()> {
1212 use std::fmt::Write;
1313
14 use humansize::{format_size, BINARY};
14 use humansize::{BINARY, format_size};
1515
1616 let root = env.build_artifacts().join("stage2");
1717
src/tools/rust-installer/src/combiner.rs+1-1
......@@ -1,7 +1,7 @@
11use std::io::{Read, Write};
22use std::path::Path;
33
4use anyhow::{bail, Context, Result};
4use anyhow::{Context, Result, bail};
55use tar::Archive;
66
77use super::{Scripter, Tarballer};
src/tools/rust-installer/src/compression.rs+8-11
......@@ -81,17 +81,14 @@ impl CompressionFormat {
8181 let file = crate::util::create_new_file(path)?;
8282
8383 Ok(match self {
84 CompressionFormat::Gz => Box::new(GzEncoder::new(
85 file,
86 match profile {
87 CompressionProfile::Fast => flate2::Compression::fast(),
88 CompressionProfile::Balanced => flate2::Compression::new(6),
89 CompressionProfile::Best => flate2::Compression::best(),
90 CompressionProfile::NoOp => panic!(
91 "compression profile 'no-op' should not call `CompressionFormat::encode`."
92 ),
93 },
94 )),
84 CompressionFormat::Gz => Box::new(GzEncoder::new(file, match profile {
85 CompressionProfile::Fast => flate2::Compression::fast(),
86 CompressionProfile::Balanced => flate2::Compression::new(6),
87 CompressionProfile::Best => flate2::Compression::best(),
88 CompressionProfile::NoOp => panic!(
89 "compression profile 'no-op' should not call `CompressionFormat::encode`."
90 ),
91 })),
9592 CompressionFormat::Xz => {
9693 let encoder = match profile {
9794 CompressionProfile::NoOp => panic!(
src/tools/rust-installer/src/generator.rs+1-1
......@@ -2,7 +2,7 @@ use std::collections::BTreeSet;
22use std::io::Write;
33use std::path::Path;
44
5use anyhow::{bail, format_err, Context, Result};
5use anyhow::{Context, Result, bail, format_err};
66
77use super::{Scripter, Tarballer};
88use crate::compression::{CompressionFormats, CompressionProfile};
src/tools/rust-installer/src/tarballer.rs+1-1
......@@ -2,7 +2,7 @@ use std::fs::{read_link, symlink_metadata};
22use std::io::{BufWriter, Write};
33use std::path::Path;
44
5use anyhow::{bail, Context, Result};
5use anyhow::{Context, Result, bail};
66use tar::{Builder, Header, HeaderMode};
77use walkdir::WalkDir;
88
src/tools/rust-installer/src/util.rs+4-4
......@@ -1,15 +1,15 @@
11use std::fs;
2// FIXME: what about Windows? Are default ACLs executable?
3#[cfg(unix)]
4use std::os::unix::fs::symlink as symlink_file;
52// Needed to set the script mode to executable.
63#[cfg(unix)]
74use std::os::unix::fs::OpenOptionsExt;
5// FIXME: what about Windows? Are default ACLs executable?
6#[cfg(unix)]
7use std::os::unix::fs::symlink as symlink_file;
88#[cfg(windows)]
99use std::os::windows::fs::symlink_file;
1010use std::path::Path;
1111
12use anyhow::{format_err, Context, Result};
12use anyhow::{Context, Result, format_err};
1313use walkdir::WalkDir;
1414
1515/// Converts a `&Path` to a UTF-8 `&str`.
src/tools/rustbook/src/main.rs+2-2
......@@ -1,9 +1,9 @@
11use std::env;
22use std::path::{Path, PathBuf};
33
4use clap::{arg, crate_version, ArgMatches, Command};
5use mdbook::errors::Result as Result3;
4use clap::{ArgMatches, Command, arg, crate_version};
65use mdbook::MDBook;
6use mdbook::errors::Result as Result3;
77use mdbook_i18n_helpers::preprocessors::Gettext;
88use mdbook_spec::Spec;
99use mdbook_trpl_listing::TrplListing;
src/tools/rustdoc-themes/main.rs+2-2
......@@ -1,8 +1,8 @@
11use std::env::args;
2use std::fs::{create_dir_all, File};
2use std::fs::{File, create_dir_all};
33use std::io::{BufRead, BufReader, BufWriter, Write};
44use std::path::Path;
5use std::process::{exit, Command};
5use std::process::{Command, exit};
66
77fn get_themes<P: AsRef<Path>>(style_path: P) -> Vec<String> {
88 let mut ret = Vec::with_capacity(10);
src/tools/suggest-tests/src/main.rs+1-1
......@@ -1,6 +1,6 @@
11use std::process::ExitCode;
22
3use build_helper::git::{get_git_modified_files, GitConfig};
3use build_helper::git::{GitConfig, get_git_modified_files};
44use suggest_tests::get_suggestions;
55
66fn main() -> ExitCode {
src/tools/suggest-tests/src/static_suggestions.rs+1-1
......@@ -1,6 +1,6 @@
11use std::sync::OnceLock;
22
3use crate::{sug, Suggestion};
3use crate::{Suggestion, sug};
44
55// FIXME: perhaps this could use `std::lazy` when it is stablizied
66macro_rules! static_suggestions {
src/tools/tidy/src/ext_tool_checks.rs+4-5
......@@ -172,11 +172,10 @@ fn check_impl(
172172 let files;
173173 if file_args_clang_format.is_empty() {
174174 let llvm_wrapper = root_path.join("compiler/rustc_llvm/llvm-wrapper");
175 files = find_with_extension(
176 root_path,
177 Some(llvm_wrapper.as_path()),
178 &[OsStr::new("h"), OsStr::new("cpp")],
179 )?;
175 files = find_with_extension(root_path, Some(llvm_wrapper.as_path()), &[
176 OsStr::new("h"),
177 OsStr::new("cpp"),
178 ])?;
180179 file_args_clang_format.extend(files.iter().map(|p| p.as_os_str()));
181180 }
182181 let args = merge_args(&cfg_args_clang_format, &file_args_clang_format);
src/tools/tidy/src/main.rs+1-1
......@@ -9,7 +9,7 @@ use std::num::NonZeroUsize;
99use std::path::PathBuf;
1010use std::str::FromStr;
1111use std::sync::atomic::{AtomicBool, Ordering};
12use std::thread::{self, scope, ScopedJoinHandle};
12use std::thread::{self, ScopedJoinHandle, scope};
1313use std::{env, process};
1414
1515use tidy::*;
src/tools/tidy/src/target_specific_tests.rs+1-1
......@@ -4,7 +4,7 @@
44use std::collections::BTreeMap;
55use std::path::Path;
66
7use crate::iter_header::{iter_header, HeaderLine};
7use crate::iter_header::{HeaderLine, iter_header};
88use crate::walk::filter_not_rust;
99
1010const LLVM_COMPONENTS_HEADER: &str = "needs-llvm-components:";
src/tools/tidy/src/unknown_revision.rs+1-1
......@@ -12,7 +12,7 @@ use std::sync::OnceLock;
1212use ignore::DirEntry;
1313use regex::Regex;
1414
15use crate::iter_header::{iter_header, HeaderLine};
15use crate::iter_header::{HeaderLine, iter_header};
1616use crate::walk::{filter_dirs, filter_not_rust, walk};
1717
1818pub fn check(tests_path: impl AsRef<Path>, bad: &mut bool) {
src/tools/unicode-table-generator/src/case_mapping.rs+1-1
......@@ -2,7 +2,7 @@ use std::char;
22use std::collections::BTreeMap;
33use std::fmt::{self, Write};
44
5use crate::{fmt_list, UnicodeData};
5use crate::{UnicodeData, fmt_list};
66
77const INDEX_MASK: u32 = 1 << 22;
88
src/tools/unicode-table-generator/src/main.rs+1-1
......@@ -82,7 +82,7 @@ mod raw_emitter;
8282mod skiplist;
8383mod unicode_download;
8484
85use raw_emitter::{emit_codepoints, emit_whitespace, RawEmitter};
85use raw_emitter::{RawEmitter, emit_codepoints, emit_whitespace};
8686
8787static PROPERTIES: &[&str] = &[
8888 "Alphabetic",
src/tools/unicode-table-generator/src/raw_emitter.rs+21-27
......@@ -360,15 +360,12 @@ impl Canonicalized {
360360 let unique_mapping = unique_mapping
361361 .into_iter()
362362 .map(|(key, value)| {
363 (
364 key,
365 match value {
366 UniqueMapping::Canonicalized(idx) => {
367 u8::try_from(canonical_words.len() + idx).unwrap()
368 }
369 UniqueMapping::Canonical(idx) => u8::try_from(idx).unwrap(),
370 },
371 )
363 (key, match value {
364 UniqueMapping::Canonicalized(idx) => {
365 u8::try_from(canonical_words.len() + idx).unwrap()
366 }
367 UniqueMapping::Canonical(idx) => u8::try_from(idx).unwrap(),
368 })
372369 })
373370 .collect::<HashMap<_, _>>();
374371
......@@ -383,24 +380,21 @@ impl Canonicalized {
383380 let canonicalized_words = canonicalized_words
384381 .into_iter()
385382 .map(|v| {
386 (
387 u8::try_from(v.0).unwrap(),
388 match v.1 {
389 Mapping::RotateAndInvert(amount) => {
390 assert_eq!(amount, amount & LOWER_6);
391 1 << 6 | (amount as u8)
392 }
393 Mapping::Rotate(amount) => {
394 assert_eq!(amount, amount & LOWER_6);
395 amount as u8
396 }
397 Mapping::Invert => 1 << 6,
398 Mapping::ShiftRight(shift_by) => {
399 assert_eq!(shift_by, shift_by & LOWER_6);
400 1 << 7 | (shift_by as u8)
401 }
402 },
403 )
383 (u8::try_from(v.0).unwrap(), match v.1 {
384 Mapping::RotateAndInvert(amount) => {
385 assert_eq!(amount, amount & LOWER_6);
386 1 << 6 | (amount as u8)
387 }
388 Mapping::Rotate(amount) => {
389 assert_eq!(amount, amount & LOWER_6);
390 amount as u8
391 }
392 Mapping::Invert => 1 << 6,
393 Mapping::ShiftRight(shift_by) => {
394 assert_eq!(shift_by, shift_by & LOWER_6);
395 1 << 7 | (shift_by as u8)
396 }
397 })
404398 })
405399 .collect::<Vec<(u8, u8)>>();
406400 Canonicalized { unique_mapping, canonical_words, canonicalized_words }
src/tools/unstable-book-gen/src/main.rs+3-3
......@@ -5,11 +5,11 @@ use std::env;
55use std::fs::{self, write};
66use std::path::Path;
77
8use tidy::features::{collect_lang_features, collect_lib_features, Features};
8use tidy::features::{Features, collect_lang_features, collect_lib_features};
99use tidy::t;
1010use tidy::unstable_book::{
11 collect_unstable_book_section_file_names, collect_unstable_feature_names, LANG_FEATURES_DIR,
12 LIB_FEATURES_DIR, PATH_STR,
11 LANG_FEATURES_DIR, LIB_FEATURES_DIR, PATH_STR, collect_unstable_book_section_file_names,
12 collect_unstable_feature_names,
1313};
1414
1515fn generate_stub_issue(path: &Path, name: &str, issue: u32) {
tests/mir-opt/instsimplify/combine_transmutes.rs+1-1
......@@ -5,7 +5,7 @@
55#![feature(custom_mir)]
66
77use std::intrinsics::mir::*;
8use std::mem::{transmute, ManuallyDrop, MaybeUninit};
8use std::mem::{ManuallyDrop, MaybeUninit, transmute};
99
1010// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify-after-simplifycfg.diff
1111pub unsafe fn identity_transmutes() {
tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs+1-1
......@@ -1,7 +1,7 @@
11#![crate_type = "staticlib"]
22#![feature(c_variadic)]
33
4use std::ffi::{c_char, c_double, c_int, c_long, c_longlong, CStr, CString, VaList};
4use std::ffi::{CStr, CString, VaList, c_char, c_double, c_int, c_long, c_longlong};
55
66macro_rules! continue_if {
77 ($cond:expr) => {
tests/run-make/c-unwind-abi-catch-lib-panic/main.rs+1-1
......@@ -3,7 +3,7 @@
33//! This test triggers a panic in a Rust library that our foreign function invokes. This shows
44//! that we can unwind through the C code in that library, and catch the underlying panic.
55
6use std::panic::{catch_unwind, AssertUnwindSafe};
6use std::panic::{AssertUnwindSafe, catch_unwind};
77
88fn main() {
99 // Call `add_small_numbers`, passing arguments that will NOT trigger a panic.
tests/run-make/c-unwind-abi-catch-panic/main.rs+1-1
......@@ -2,7 +2,7 @@
22//!
33//! This test triggers a panic when calling a foreign function that calls *back* into Rust.
44
5use std::panic::{catch_unwind, AssertUnwindSafe};
5use std::panic::{AssertUnwindSafe, catch_unwind};
66
77fn main() {
88 // Call `add_small_numbers`, passing arguments that will NOT trigger a panic.
tests/run-make/compiler-builtins/rmake.rs+1-1
......@@ -17,8 +17,8 @@
1717use std::collections::HashSet;
1818use std::path::PathBuf;
1919
20use run_make_support::object::read::archive::ArchiveFile;
2120use run_make_support::object::read::Object;
21use run_make_support::object::read::archive::ArchiveFile;
2222use run_make_support::object::{ObjectSection, ObjectSymbol, RelocationTarget};
2323use run_make_support::rfs::{read, read_dir};
2424use run_make_support::{cmd, env_var, object};
tests/run-make/compressed-debuginfo-zstd/rmake.rs+1-1
......@@ -8,7 +8,7 @@
88//@ only-linux
99//@ ignore-cross-compile
1010
11use run_make_support::{llvm_readobj, run_in_tmpdir, Rustc};
11use run_make_support::{Rustc, llvm_readobj, run_in_tmpdir};
1212
1313fn check_compression(compression: &str, to_find: &str) {
1414 // check compressed debug sections via rustc flag
tests/run-make/crate-loading/multiple-dep-versions.rs+1-1
......@@ -1,7 +1,7 @@
11extern crate dep_2_reexport;
22extern crate dependency;
33use dep_2_reexport::Type;
4use dependency::{do_something, Trait};
4use dependency::{Trait, do_something};
55
66fn main() {
77 do_something(Type);
tests/run-make/crate-loading/rmake.rs+6-6
......@@ -64,10 +64,10 @@ note: there are multiple different versions of crate `dependency` in the depende
64645 | fn foo(&self);
6565 | -------------- the method is available for `dep_2_reexport::Type` here
6666 |
67 ::: multiple-dep-versions.rs:4:32
67 ::: multiple-dep-versions.rs:4:18
6868 |
694 | use dependency::{do_something, Trait};
70 | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#,
694 | use dependency::{Trait, do_something};
70 | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#,
7171 )
7272 .assert_stderr_contains(
7373 r#"
......@@ -92,9 +92,9 @@ note: there are multiple different versions of crate `dependency` in the depende
92926 | fn bar();
9393 | --------- the associated function is available for `dep_2_reexport::Type` here
9494 |
95 ::: multiple-dep-versions.rs:4:32
95 ::: multiple-dep-versions.rs:4:18
9696 |
974 | use dependency::{do_something, Trait};
98 | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#,
974 | use dependency::{Trait, do_something};
98 | ----- `Trait` imported here doesn't correspond to the right version of crate `dependency`"#,
9999 );
100100}
tests/run-make/extern-fn-explicit-align/test.rs+1-1
......@@ -1,6 +1,6 @@
11// Issue #80127: Passing structs via FFI should work with explicit alignment.
22
3use std::ffi::{c_char, CStr};
3use std::ffi::{CStr, c_char};
44use std::ptr::null_mut;
55
66#[repr(C)]
tests/run-make/foreign-exceptions/foo.rs+1-1
......@@ -2,7 +2,7 @@
22// are caught by catch_unwind. Also tests that Rust panics can unwind through
33// C++ code.
44
5use std::panic::{catch_unwind, AssertUnwindSafe};
5use std::panic::{AssertUnwindSafe, catch_unwind};
66
77struct DropCheck<'a>(&'a mut bool);
88impl<'a> Drop for DropCheck<'a> {
tests/run-make/naked-symbol-visibility/rmake.rs+1-1
......@@ -1,7 +1,7 @@
11//@ ignore-windows
22//@ only-x86_64
3use run_make_support::object::read::{File, Object, Symbol};
43use run_make_support::object::ObjectSymbol;
4use run_make_support::object::read::{File, Object, Symbol};
55use run_make_support::targets::is_windows;
66use run_make_support::{dynamic_lib_name, rfs, rustc};
77
tests/run-make/rustdoc-shared-flags/rmake.rs+1-1
......@@ -1,4 +1,4 @@
1use run_make_support::{rustc, rustdoc, Diff};
1use run_make_support::{Diff, rustc, rustdoc};
22
33fn compare_outputs(args: &[&str]) {
44 let rustc_output = rustc().args(args).run().stdout_utf8();
tests/run-make/split-debuginfo/main.rs+1-1
......@@ -1,6 +1,6 @@
11extern crate bar;
22
3use bar::{make_bar, Bar};
3use bar::{Bar, make_bar};
44
55fn main() {
66 let b = make_bar(3);
tests/run-make/type-mismatch-same-crate-name/crateA.rs+1-1
......@@ -12,5 +12,5 @@ mod bar {
1212
1313// This makes the publicly accessible path
1414// differ from the internal one.
15pub use bar::{bar, Bar};
15pub use bar::{Bar, bar};
1616pub use foo::Foo;
tests/run-make/wasm-export-all-symbols/rmake.rs+7-10
......@@ -20,16 +20,13 @@ fn test(args: &[&str]) {
2020 rustc().input("main.rs").target("wasm32-wasip1").args(args).run();
2121
2222 verify_exports(Path::new("foo.wasm"), &[("foo", Func), ("FOO", Global), ("memory", Memory)]);
23 verify_exports(
24 Path::new("main.wasm"),
25 &[
26 ("foo", Func),
27 ("FOO", Global),
28 ("_start", Func),
29 ("__main_void", Func),
30 ("memory", Memory),
31 ],
32 );
23 verify_exports(Path::new("main.wasm"), &[
24 ("foo", Func),
25 ("FOO", Global),
26 ("_start", Func),
27 ("__main_void", Func),
28 ("memory", Memory),
29 ]);
3330}
3431
3532fn verify_exports(path: &Path, exports: &[(&str, wasmparser::ExternalKind)]) {
tests/run-pass-valgrind/exit-flushes.rs+1-1
......@@ -4,7 +4,7 @@
44// https://github.com/rust-lang/rust/pull/30365#issuecomment-165763679
55
66use std::env;
7use std::process::{exit, Command};
7use std::process::{Command, exit};
88
99fn main() {
1010 if env::args().len() > 1 {
tests/rustdoc-js-std/path-maxeditdistance.js+5-5
......@@ -11,7 +11,7 @@ const EXPECTED = [
1111 { 'path': 'std::vec::IntoIter', 'name': 'into_iter' },
1212 { 'path': 'std::vec::ExtractIf', 'name': 'into_iter' },
1313 { 'path': 'std::vec::Splice', 'name': 'into_iter' },
14 { 'path': 'std::collections::VecDeque', 'name': 'into_iter' },
14 { 'path': 'std::collections::vec_deque::VecDeque', 'name': 'into_iter' },
1515 ],
1616 },
1717 {
......@@ -25,10 +25,10 @@ const EXPECTED = [
2525 { 'path': 'std::vec::IntoIter', 'name': 'into_iter' },
2626 { 'path': 'std::vec::ExtractIf', 'name': 'into_iter' },
2727 { 'path': 'std::vec::Splice', 'name': 'into_iter' },
28 { 'path': 'std::collections::VecDeque', 'name': 'iter' },
29 { 'path': 'std::collections::VecDeque', 'name': 'iter_mut' },
30 { 'path': 'std::collections::VecDeque', 'name': 'from_iter' },
31 { 'path': 'std::collections::VecDeque', 'name': 'into_iter' },
28 { 'path': 'std::collections::vec_deque::VecDeque', 'name': 'iter' },
29 { 'path': 'std::collections::vec_deque::VecDeque', 'name': 'iter_mut' },
30 { 'path': 'std::collections::vec_deque::VecDeque', 'name': 'from_iter' },
31 { 'path': 'std::collections::vec_deque::VecDeque', 'name': 'into_iter' },
3232 ],
3333 },
3434 {
tests/rustdoc-json/reexport/same_name_different_types.rs+1-1
......@@ -17,6 +17,6 @@ pub mod nested {
1717//@ ismany "$.index[*].inner[?(@.use.name == 'Bar')].use.id" $foo_fn $foo_struct
1818
1919//@ count "$.index[*].inner[?(@.use.name == 'Foo')]" 2
20pub use nested::Foo;
2120//@ count "$.index[*].inner[?(@.use.name == 'Bar')]" 2
2221pub use Foo as Bar;
22pub use nested::Foo;
tests/rustdoc-json/type/inherent_associated_type_bound.rs+4-1
......@@ -16,5 +16,8 @@ pub struct Carrier<'a>(&'a ());
1616pub fn user(_: for<'b> fn(Carrier<'b>::Focus<i32>)) {}
1717
1818impl<'a> Carrier<'a> {
19 pub type Focus<T> = &'a mut T where T: 'a;
19 pub type Focus<T>
20 = &'a mut T
21 where
22 T: 'a;
2023}