diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32c18cab09902..dcdaa06caa206 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -260,13 +260,13 @@ jobs: os: ubuntu-20.04-8core-32gb env: {} - name: i686-gnu - os: ubuntu-20.04-16core-64gb + os: ubuntu-20.04-8core-32gb env: {} - name: i686-gnu-nopt - os: ubuntu-20.04-16core-64gb + os: ubuntu-20.04-8core-32gb env: {} - name: mingw-check - os: ubuntu-20.04-8core-32gb + os: ubuntu-20.04-4core-16gb env: {} - name: test-various os: ubuntu-20.04-8core-32gb @@ -275,16 +275,16 @@ jobs: os: ubuntu-20.04-8core-32gb env: {} - name: x86_64-gnu - os: ubuntu-20.04-8core-32gb + os: ubuntu-20.04-4core-16gb env: {} - name: x86_64-gnu-stable env: IMAGE: x86_64-gnu RUST_CI_OVERRIDE_RELEASE_CHANNEL: stable CI_ONLY_WHEN_CHANNEL: nightly - os: ubuntu-20.04-8core-32gb + os: ubuntu-20.04-4core-16gb - name: x86_64-gnu-aux - os: ubuntu-20.04-8core-32gb + os: ubuntu-20.04-4core-16gb env: {} - name: x86_64-gnu-debug os: ubuntu-20.04-8core-32gb @@ -309,7 +309,7 @@ jobs: RUST_BACKTRACE: 1 os: ubuntu-20.04-8core-32gb - name: x86_64-gnu-nopt - os: ubuntu-20.04-8core-32gb + os: ubuntu-20.04-4core-16gb env: {} - name: x86_64-gnu-tools env: diff --git a/Cargo.lock b/Cargo.lock index d7806b5daa63a..c7a91ef71166d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4090,6 +4090,7 @@ dependencies = [ name = "rustc_smir" version = "0.0.0" dependencies = [ + "rustc_hir", "rustc_middle", "rustc_span", "tracing", diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index ea04ba4f66e46..dce7106d12804 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -1589,7 +1589,6 @@ pub enum ClosureBinder { pub struct MacCall { pub path: Path, pub args: P, - pub prior_type_ascription: Option<(Span, bool)>, } impl MacCall { diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index 68a4d522993c1..66b94d12a32c6 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -631,7 +631,7 @@ pub fn noop_visit_attribute(attr: &mut Attribute, vis: &mut T) { } pub fn noop_visit_mac(mac: &mut MacCall, vis: &mut T) { - let MacCall { path, args, prior_type_ascription: _ } = mac; + let MacCall { path, args } = mac; vis.visit_path(path); visit_delim_args(args, vis); } diff --git a/compiler/rustc_ast/src/util/parser.rs b/compiler/rustc_ast/src/util/parser.rs index 64ae904513cb3..35afd5423721d 100644 --- a/compiler/rustc_ast/src/util/parser.rs +++ b/compiler/rustc_ast/src/util/parser.rs @@ -53,8 +53,6 @@ pub enum AssocOp { DotDot, /// `..=` range DotDotEq, - /// `:` - Colon, } #[derive(PartialEq, Debug)] @@ -96,7 +94,6 @@ impl AssocOp { token::DotDotEq => Some(DotDotEq), // DotDotDot is no longer supported, but we need some way to display the error token::DotDotDot => Some(DotDotEq), - token::Colon => Some(Colon), // `<-` should probably be `< -` token::LArrow => Some(Less), _ if t.is_keyword(kw::As) => Some(As), @@ -133,7 +130,7 @@ impl AssocOp { pub fn precedence(&self) -> usize { use AssocOp::*; match *self { - As | Colon => 14, + As => 14, Multiply | Divide | Modulus => 13, Add | Subtract => 12, ShiftLeft | ShiftRight => 11, @@ -156,7 +153,7 @@ impl AssocOp { Assign | AssignOp(_) => Fixity::Right, As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual - | LAnd | LOr | Colon => Fixity::Left, + | LAnd | LOr => Fixity::Left, DotDot | DotDotEq => Fixity::None, } } @@ -166,8 +163,9 @@ impl AssocOp { match *self { Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual => true, Assign | AssignOp(_) | As | Multiply | Divide | Modulus | Add | Subtract - | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq - | Colon => false, + | ShiftLeft | ShiftRight | BitAnd | BitXor | BitOr | LAnd | LOr | DotDot | DotDotEq => { + false + } } } @@ -177,7 +175,7 @@ impl AssocOp { Assign | AssignOp(_) => true, Less | Greater | LessEqual | GreaterEqual | Equal | NotEqual | As | Multiply | Divide | Modulus | Add | Subtract | ShiftLeft | ShiftRight | BitAnd | BitXor - | BitOr | LAnd | LOr | DotDot | DotDotEq | Colon => false, + | BitOr | LAnd | LOr | DotDot | DotDotEq => false, } } @@ -202,7 +200,7 @@ impl AssocOp { BitOr => Some(BinOpKind::BitOr), LAnd => Some(BinOpKind::And), LOr => Some(BinOpKind::Or), - Assign | AssignOp(_) | As | DotDot | DotDotEq | Colon => None, + Assign | AssignOp(_) | As | DotDot | DotDotEq => None, } } @@ -223,10 +221,9 @@ impl AssocOp { Greater | // `{ 42 } > 3` GreaterEqual | // `{ 42 } >= 3` AssignOp(_) | // `{ 42 } +=` - As | // `{ 42 } as usize` // Equal | // `{ 42 } == { 42 }` Accepting these here would regress incorrect - // NotEqual | // `{ 42 } != { 42 }` struct literals parser recovery. - Colon, // `{ 42 }: usize` + // NotEqual | // `{ 42 } != { 42 } struct literals parser recovery. + As // `{ 42 } as usize` ) } } @@ -254,7 +251,6 @@ pub enum ExprPrecedence { Binary(BinOpKind), Cast, - Type, Assign, AssignOp, @@ -313,7 +309,6 @@ impl ExprPrecedence { // Binop-like expr kinds, handled by `AssocOp`. ExprPrecedence::Binary(op) => AssocOp::from_ast_binop(op).precedence() as i8, ExprPrecedence::Cast => AssocOp::As.precedence() as i8, - ExprPrecedence::Type => AssocOp::Colon.precedence() as i8, ExprPrecedence::Assign | ExprPrecedence::AssignOp => AssocOp::Assign.precedence() as i8, diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index 8eb84c036a084..441282c05b424 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -136,7 +136,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.diagnostic().span_bug( p.span, - &format!( + format!( "lower_qpath: no final extension segment in {}..{}", proj_start, p.segments.len() diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 17bcd24ee39fd..ee3ded311c557 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -83,7 +83,7 @@ impl<'a> PostExpansionVisitor<'a> { &self, const_extern_fn, span, - &format!("`{}` as a `const fn` ABI is unstable", abi) + format!("`{}` as a `const fn` ABI is unstable", abi) ), } } @@ -104,7 +104,7 @@ impl<'a> PostExpansionVisitor<'a> { if self.sess.opts.pretty.map_or(true, |ppm| ppm.needs_hir()) { self.sess.parse_sess.span_diagnostic.delay_span_bug( span, - &format!( + format!( "unrecognized ABI not caught in lowering: {}", symbol_unescaped.as_str() ), diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs index 5511cf851b185..b74c59bca30c5 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs @@ -341,10 +341,16 @@ impl<'a> State<'a> { self.print_type(ty); } ast::ExprKind::Type(expr, ty) => { - let prec = AssocOp::Colon.precedence() as i8; - self.print_expr_maybe_paren(expr, prec); - self.word_space(":"); + self.word("type_ascribe!("); + self.ibox(0); + self.print_expr(expr); + + self.word(","); + self.space_if_not_bol(); self.print_type(ty); + + self.end(); + self.word(")"); } ast::ExprKind::Let(pat, scrutinee, _) => { self.print_let(pat, scrutinee); diff --git a/compiler/rustc_attr/src/builtin.rs b/compiler/rustc_attr/src/builtin.rs index cb217be665476..d2d3792345f1c 100644 --- a/compiler/rustc_attr/src/builtin.rs +++ b/compiler/rustc_attr/src/builtin.rs @@ -623,7 +623,7 @@ fn gate_cfg(gated_cfg: &GatedCfg, cfg_span: Span, sess: &ParseSess, features: &F let (cfg, feature, has_feature) = gated_cfg; if !has_feature(features) && !cfg_span.allows_unstable(*feature) { let explain = format!("`cfg({cfg})` is experimental and subject to change"); - feature_err(sess, *feature, cfg_span, &explain).emit(); + feature_err(sess, *feature, cfg_span, explain).emit(); } } diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs index ac84188a35fb1..04b8174079acc 100644 --- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs @@ -158,7 +158,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } else if reinits > 1 { err.span_note( MultiSpan::from_spans(reinit_spans), - &if reinits <= 3 { + if reinits <= 3 { format!("these {reinits} reinitializations might get skipped") } else { format!( @@ -253,7 +253,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // We have a `&mut` ref, we need to reborrow on each iteration (#62112). err.span_suggestion_verbose( span.shrink_to_lo(), - &format!( + format!( "consider creating a fresh reborrow of {} here", self.describe_place(moved_place) .map(|n| format!("`{n}`")) @@ -304,7 +304,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { .. } = use_spans { - err.note(&format!( + err.note(format!( "{} occurs due to deref coercion to `{deref_target_ty}`", desired_action.as_noun(), )); @@ -586,7 +586,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // _ => {} // We don't want to point to this. // }; // ``` - err.span_label(sp, &label); + err.span_label(sp, label); shown = true; } } @@ -1139,7 +1139,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } if union_type_name != "" { - err.note(&format!( + err.note(format!( "{} is a field of the union `{}`, so it overlaps the field {}", msg_place, union_type_name, msg_borrow, )); @@ -1238,14 +1238,14 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { } err.span_help( inner_call_span, - &format!( + format!( "try adding a local storing this{}...", if use_span.is_some() { "" } else { " argument" } ), ); err.span_help( outer_call_span, - &format!( + format!( "...and then using that local {}", if use_span.is_some() { "here" } else { "as the argument to this call" } ), @@ -2281,7 +2281,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); err.span_suggestion_verbose( sugg_span, - &format!( + format!( "to force the {} to take ownership of {} (and any \ other referenced variables), use the `move` keyword", kind, captured_var @@ -2293,7 +2293,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { match category { ConstraintCategory::Return(_) | ConstraintCategory::OpaqueType => { let msg = format!("{} is returned here", kind); - err.span_note(constraint_span, &msg); + err.span_note(constraint_span, msg); } ConstraintCategory::CallArgument(_) => { fr_name.highlight_region_name(&mut err); @@ -2304,7 +2304,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); } else { let msg = format!("{scope} requires argument type to outlive `{fr_name}`"); - err.span_note(constraint_span, &msg); + err.span_note(constraint_span, msg); } } _ => bug!( @@ -2626,7 +2626,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { }); if let Some(Ok(instance)) = deref_target { let deref_target_ty = instance.ty(tcx, self.param_env); - err.note(&format!( + err.note(format!( "borrow occurs due to deref coercion to `{}`", deref_target_ty )); @@ -3180,7 +3180,7 @@ impl<'tcx> AnnotatedBorrowFnSignature<'tcx> { diag.span_label(*return_span, format!("also has lifetime `{}`", region_name,)); - diag.help(&format!( + diag.help(format!( "use data from the highlighted arguments which match the `{}` lifetime of \ the return type", region_name, diff --git a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs index f995c3165a91e..d0cb1126f38bb 100644 --- a/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs +++ b/compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs @@ -90,7 +90,7 @@ impl<'tcx> BorrowExplanation<'tcx> { { err.span_label( pat.span, - &format!("binding `{ident}` declared here"), + format!("binding `{ident}` declared here"), ); } } @@ -323,7 +323,7 @@ impl<'tcx> BorrowExplanation<'tcx> { err.span_suggestion_verbose( span.shrink_to_hi(), - &msg, + msg, format!(" + {suggestable_name}"), Applicability::Unspecified, ); diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs index a780255725e71..a2334cc7249c9 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mod.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs @@ -1073,7 +1073,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { if !is_loop_move { err.span_suggestion_verbose( move_span.shrink_to_lo(), - &format!( + format!( "consider creating a fresh reborrow of {} here", self.describe_place(moved_place.as_ref()) .map(|n| format!("`{n}`")) diff --git a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs index 67af96a71e30d..8b77477a31a33 100644 --- a/compiler/rustc_borrowck/src/diagnostics/move_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/move_errors.rs @@ -533,7 +533,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { suggestions.sort_unstable_by_key(|&(span, _, _)| span); suggestions.dedup_by_key(|&mut (span, _, _)| span); for (span, msg, suggestion) in suggestions { - err.span_suggestion_verbose(span, &msg, suggestion, Applicability::MachineApplicable); + err.span_suggestion_verbose(span, msg, suggestion, Applicability::MachineApplicable); } } diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index e3d81194ac817..7558247948fe4 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -573,7 +573,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { if !is_trait_sig { err.span_suggestion_verbose( err_help_span, - &format!( + format!( "consider changing this to be a mutable {pointer_desc}" ), suggested_code, @@ -582,7 +582,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { } else if let Some(x) = local_trait { err.span_suggestion_verbose( x, - &format!( + format!( "consider changing that to be a mutable {pointer_desc}" ), suggested_code, @@ -636,14 +636,14 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { }; err.span_suggestion_verbose( span, - &format!("consider {changing} this binding's type"), + format!("consider {changing} this binding's type"), sugg, Applicability::HasPlaceholders, ); } else { err.span_label( err_label_span, - &format!( + format!( "consider changing this binding's type to be: `{message}`" ), ); @@ -679,13 +679,13 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { match opt_source { Some(BorrowedContentSource::OverloadedDeref(ty)) => { - err.help(&format!( + err.help(format!( "trait `DerefMut` is required to modify through a dereference, \ but it is not implemented for `{ty}`", )); } Some(BorrowedContentSource::OverloadedIndex(ty)) => { - err.help(&format!( + err.help(format!( "trait `IndexMut` is required to modify indexed content, \ but it is not implemented for `{ty}`", )); @@ -736,7 +736,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { // val[index] = rv; // ---------- place self.err.multipart_suggestions( - &format!( + format!( "to modify a `{}`, use `.get_mut()`, `.insert()` or the entry API", self.ty, ), @@ -788,7 +788,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { { // val[index].path(args..); self.err.multipart_suggestion( - &format!("to modify a `{}` use `.get_mut()`", self.ty), + format!("to modify a `{}` use `.get_mut()`", self.ty), vec![ ( val.span.shrink_to_hi().with_hi(index.span.lo()), @@ -822,7 +822,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { let mut v = V { assign_span, err, ty, suggested: false }; v.visit_body(body); if !v.suggested { - err.help(&format!( + err.help(format!( "to modify a `{ty}`, use `.get_mut()`, `.insert()` or the entry API", )); } diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs index d5ece57437e0b..ffba60581861d 100644 --- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs @@ -171,7 +171,7 @@ impl OutlivesSuggestionBuilder { if let (Some(fr_name), Some(outlived_fr_name)) = (fr_name, outlived_fr_name) && !matches!(outlived_fr_name.source, RegionNameSource::Static) { - diag.help(&format!( + diag.help(format!( "consider adding the following bound: `{fr_name}: {outlived_fr_name}`", )); } @@ -207,7 +207,7 @@ impl OutlivesSuggestionBuilder { // If there is exactly one suggestable constraints, then just suggest it. Otherwise, emit a // list of diagnostics. let mut diag = if suggested.len() == 1 { - mbcx.infcx.tcx.sess.diagnostic().struct_help(&match suggested.last().unwrap() { + mbcx.infcx.tcx.sess.diagnostic().struct_help(match suggested.last().unwrap() { SuggestedConstraint::Outlives(a, bs) => { let bs: SmallVec<[String; 2]> = bs.iter().map(|r| r.to_string()).collect(); format!("add bound `{a}: {}`", bs.join(" + ")) @@ -232,15 +232,15 @@ impl OutlivesSuggestionBuilder { match constraint { SuggestedConstraint::Outlives(a, bs) => { let bs: SmallVec<[String; 2]> = bs.iter().map(|r| r.to_string()).collect(); - diag.help(&format!("add bound `{a}: {}`", bs.join(" + "))); + diag.help(format!("add bound `{a}: {}`", bs.join(" + "))); } SuggestedConstraint::Equal(a, b) => { - diag.help(&format!( + diag.help(format!( "`{a}` and `{b}` must be the same: replace one with the other", )); } SuggestedConstraint::Static(a) => { - diag.help(&format!("replace `{a}` with `'static`")); + diag.help(format!("replace `{a}` with `'static`")); } } } diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 9fcebeb0acdc7..37cf3f303126e 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -533,8 +533,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { } _ => panic!("Unexpected type {ty:?}"), }; - diag.note(&format!("requirement occurs because of {desc}",)); - diag.note(¬e); + diag.note(format!("requirement occurs because of {desc}",)); + diag.note(note); diag.help("see for more information about variance"); } } @@ -863,7 +863,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { } spans_suggs.push((alias_span.shrink_to_hi(), "<'a>".to_string())); diag.multipart_suggestion_verbose( - &format!( + format!( "to declare that the trait object {captures}, you can add a lifetime parameter `'a` in the type alias" ), spans_suggs, diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index f69c4829ae299..f38e1605fa5ca 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -622,7 +622,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> { // programs, so we need to use delay_span_bug here. See #82126. self.infcx.tcx.sess.delay_span_bug( hir_arg.span(), - &format!("unmatched subst and hir arg: found {kind:?} vs {hir_arg:?}"), + format!("unmatched subst and hir arg: found {kind:?} vs {hir_arg:?}"), ); } } diff --git a/compiler/rustc_borrowck/src/invalidation.rs b/compiler/rustc_borrowck/src/invalidation.rs index 06986f848bfeb..863c92acdf4dc 100644 --- a/compiler/rustc_borrowck/src/invalidation.rs +++ b/compiler/rustc_borrowck/src/invalidation.rs @@ -138,7 +138,7 @@ impl<'cx, 'tcx> Visitor<'tcx> for InvalidationGenerator<'cx, 'tcx> { TerminatorKind::Assert { cond, expected: _, msg, target: _, unwind: _ } => { self.consume_operand(location, cond); use rustc_middle::mir::AssertKind; - if let AssertKind::BoundsCheck { len, index } = msg { + if let AssertKind::BoundsCheck { len, index } = &**msg { self.consume_operand(location, len); self.consume_operand(location, index); } diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 6900729d671a0..c4c54620e04e9 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -738,7 +738,7 @@ impl<'cx, 'tcx> rustc_mir_dataflow::ResultsVisitor<'cx, 'tcx> for MirBorrowckCtx TerminatorKind::Assert { cond, expected: _, msg, target: _, unwind: _ } => { self.consume_operand(loc, (cond, span), flow_state); use rustc_middle::mir::AssertKind; - if let AssertKind::BoundsCheck { len, index } = msg { + if let AssertKind::BoundsCheck { len, index } = &**msg { self.consume_operand(loc, (len, span), flow_state); self.consume_operand(loc, (index, span), flow_state); } @@ -2022,7 +2022,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // been emitted (#52262). self.infcx.tcx.sess.delay_span_bug( span, - &format!( + format!( "Accessing `{:?}` with the kind `{:?}` shouldn't be possible", place, kind, ), @@ -2383,7 +2383,7 @@ mod error { } for (_, (mut diag, count)) in std::mem::take(&mut self.errors.buffered_mut_errors) { if count > 10 { - diag.note(&format!("...and {} other attempted mutable borrows", count - 10)); + diag.note(format!("...and {} other attempted mutable borrows", count - 10)); } diag.buffer(&mut self.errors.buffered); } diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs index 5f1bcb27ea793..a4394ddc01c5a 100644 --- a/compiler/rustc_borrowck/src/nll.rs +++ b/compiler/rustc_borrowck/src/nll.rs @@ -399,7 +399,7 @@ pub(super) fn dump_annotation<'tcx>( regioncx.annotate(tcx, &mut err); - err.note(&format!( + err.note(format!( "number of external vids: {}", closure_region_requirements.num_external_vids )); @@ -421,7 +421,7 @@ pub(super) fn dump_annotation<'tcx>( }; if !opaque_type_values.is_empty() { - err.note(&format!("Inferred opaque type values:\n{:#?}", opaque_type_values)); + err.note(format!("Inferred opaque type values:\n{:#?}", opaque_type_values)); } errors.buffer_non_error_diag(err); diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs index 2b16655cf7d5a..4970ece5e7deb 100644 --- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs +++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs @@ -399,7 +399,7 @@ fn check_opaque_type_parameter_valid( return Err(tcx .sess .struct_span_err(span, "non-defining opaque type use in defining scope") - .span_note(spans, &format!("{} used multiple times", descr)) + .span_note(spans, format!("{} used multiple times", descr)) .emit()); } } diff --git a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs index 4004966c40a77..bd01c0b504cb5 100644 --- a/compiler/rustc_borrowck/src/type_check/free_region_relations.rs +++ b/compiler/rustc_borrowck/src/type_check/free_region_relations.rs @@ -249,7 +249,7 @@ impl<'tcx> UniversalRegionRelationsBuilder<'_, 'tcx> { .infcx .tcx .sess - .delay_span_bug(span, &format!("failed to normalize {:?}", ty)); + .delay_span_bug(span, format!("failed to normalize {:?}", ty)); TypeOpOutput { output: self.infcx.tcx.ty_error(guar), constraints: None, diff --git a/compiler/rustc_borrowck/src/type_check/input_output.rs b/compiler/rustc_borrowck/src/type_check/input_output.rs index 9250b8d3eaf2a..a06d4bcc6c7ae 100644 --- a/compiler/rustc_borrowck/src/type_check/input_output.rs +++ b/compiler/rustc_borrowck/src/type_check/input_output.rs @@ -106,7 +106,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { if body.yield_ty().is_some() != universal_regions.yield_ty.is_some() { self.tcx().sess.delay_span_bug( body.span, - &format!( + format!( "Expected body to have yield_ty ({:?}) iff we have a UR yield_ty ({:?})", body.yield_ty(), universal_regions.yield_ty, diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index d5e50a61b032c..438920e293db8 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -236,7 +236,7 @@ pub(crate) fn type_check<'mir, 'tcx>( if hidden_type.has_non_region_infer() { let reported = infcx.tcx.sess.delay_span_bug( decl.hidden_type.span, - &format!("could not resolve {:#?}", hidden_type.ty.kind()), + format!("could not resolve {:#?}", hidden_type.ty.kind()), ); hidden_type.ty = infcx.tcx.ty_error(reported); } @@ -1404,7 +1404,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { span_mirbug!(self, term, "bad Assert ({:?}, not bool", cond_ty); } - if let AssertKind::BoundsCheck { len, index } = msg { + if let AssertKind::BoundsCheck { len, index } = &**msg { if len.ty(body, tcx) != tcx.types.usize { span_mirbug!(self, len, "bounds-check length non-usize {:?}", len) } diff --git a/compiler/rustc_borrowck/src/universal_regions.rs b/compiler/rustc_borrowck/src/universal_regions.rs index 3f7f23df8d92d..56f078f2da816 100644 --- a/compiler/rustc_borrowck/src/universal_regions.rs +++ b/compiler/rustc_borrowck/src/universal_regions.rs @@ -335,7 +335,7 @@ impl<'tcx> UniversalRegions<'tcx> { pub(crate) fn annotate(&self, tcx: TyCtxt<'tcx>, err: &mut Diagnostic) { match self.defining_ty { DefiningTy::Closure(def_id, substs) => { - err.note(&format!( + err.note(format!( "defining type: {} with closure substs {:#?}", tcx.def_path_str_with_substs(def_id, substs), &substs[tcx.generics_of(def_id).parent_count..], @@ -347,11 +347,11 @@ impl<'tcx> UniversalRegions<'tcx> { // and other things that are not stable across tests! // So we just include the region-vid. Annoying. for_each_late_bound_region_in_recursive_scope(tcx, def_id.expect_local(), |r| { - err.note(&format!("late-bound region is {:?}", self.to_region_vid(r))); + err.note(format!("late-bound region is {:?}", self.to_region_vid(r))); }); } DefiningTy::Generator(def_id, substs, _) => { - err.note(&format!( + err.note(format!( "defining type: {} with generator substs {:#?}", tcx.def_path_str_with_substs(def_id, substs), &substs[tcx.generics_of(def_id).parent_count..], @@ -361,23 +361,23 @@ impl<'tcx> UniversalRegions<'tcx> { // `r` but doing so is not stable across architectures // and so forth. for_each_late_bound_region_in_recursive_scope(tcx, def_id.expect_local(), |r| { - err.note(&format!("late-bound region is {:?}", self.to_region_vid(r))); + err.note(format!("late-bound region is {:?}", self.to_region_vid(r))); }); } DefiningTy::FnDef(def_id, substs) => { - err.note(&format!( + err.note(format!( "defining type: {}", tcx.def_path_str_with_substs(def_id, substs), )); } DefiningTy::Const(def_id, substs) => { - err.note(&format!( + err.note(format!( "defining constant type: {}", tcx.def_path_str_with_substs(def_id, substs), )); } DefiningTy::InlineConst(def_id, substs) => { - err.note(&format!( + err.note(format!( "defining inline constant type: {}", tcx.def_path_str_with_substs(def_id, substs), )); diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index c066512b09ee3..ac817d9a152ad 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -68,9 +68,7 @@ pub fn parse_asm_args<'a>( if !p.eat(&token::Comma) { if allow_templates { // After a template string, we always expect *only* a comma... - let mut err = diag.create_err(errors::AsmExpectedComma { span: p.token.span }); - p.maybe_annotate_with_ascription(&mut err, false); - return Err(err); + return Err(diag.create_err(errors::AsmExpectedComma { span: p.token.span })); } else { // ...after that delegate to `expect` to also include the other expected tokens. return Err(p.expect(&token::Comma).err().unwrap()); @@ -555,7 +553,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option, args: AsmArgs) -> Option format!("there is 1 {}argument", positional), x => format!("there are {} {}arguments", x, positional), }; - err.note(&msg); + err.note(msg); if named_pos.contains_key(&idx) { err.span_label(args.operands[idx].1, "named argument"); @@ -705,7 +703,7 @@ fn expand_preparsed_asm(ecx: &mut ExtCtxt<'_>, args: AsmArgs) -> Option, args: AsmArgs) -> Option( delim: MacDelimiter::Parenthesis, tokens, }), - prior_type_ascription: None, })), ); expr_if_not(cx, call_site_span, cond_expr, then, None) diff --git a/compiler/rustc_builtin_macros/src/assert/context.rs b/compiler/rustc_builtin_macros/src/assert/context.rs index bd3f148c9a79c..ea830a0ce60df 100644 --- a/compiler/rustc_builtin_macros/src/assert/context.rs +++ b/compiler/rustc_builtin_macros/src/assert/context.rs @@ -182,7 +182,6 @@ impl<'cx, 'a> Context<'cx, 'a> { delim: MacDelimiter::Parenthesis, tokens: initial.into_iter().chain(captures).collect::(), }), - prior_type_ascription: None, })), ) } diff --git a/compiler/rustc_builtin_macros/src/edition_panic.rs b/compiler/rustc_builtin_macros/src/edition_panic.rs index b2a21611db7f9..ef0db23ff2f2d 100644 --- a/compiler/rustc_builtin_macros/src/edition_panic.rs +++ b/compiler/rustc_builtin_macros/src/edition_panic.rs @@ -63,7 +63,6 @@ fn expand<'cx>( delim: MacDelimiter::Parenthesis, tokens: tts, }), - prior_type_ascription: None, })), ), ) diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index f17df5b0a83c7..adc12ec84f514 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -616,14 +616,14 @@ fn report_missing_placeholders( } else { diag.span_note( sp, - &format!("format specifiers use curly braces, and {}", trn), + format!("format specifiers use curly braces, and {}", trn), ); } } else { if success { - diag.help(&format!("`{}` should be written as `{}`", sub, trn)); + diag.help(format!("`{}` should be written as `{}`", sub, trn)); } else { - diag.note(&format!("`{}` should use curly braces, and {}", sub, trn)); + diag.note(format!("`{}` should use curly braces, and {}", sub, trn)); } } } @@ -777,7 +777,7 @@ fn report_invalid_references( has_precision_star = true; e.span_label( *span, - &format!( + format!( "this precision flag adds an extra required argument at position {}, which is why there {} expected", index, if num_placeholders == 1 { diff --git a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs index 378d5f39f4ab2..52b5601bb11b8 100644 --- a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs +++ b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs @@ -194,7 +194,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> { }; self.handler - .struct_span_err(attr.span, &msg) + .struct_span_err(attr.span, msg) .span_label(prev_attr.span, "previous attribute here") .emit(); @@ -219,7 +219,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> { pprust::path_to_string(&attr.get_normal_item().path), ); - self.handler.span_err(attr.span, &msg); + self.handler.span_err(attr.span, msg); return; } @@ -233,7 +233,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> { pprust::path_to_string(&attr.get_normal_item().path), ); - self.handler.span_err(attr.span, &msg); + self.handler.span_err(attr.span, msg); return; } diff --git a/compiler/rustc_builtin_macros/src/source_util.rs b/compiler/rustc_builtin_macros/src/source_util.rs index 0b17e92efe936..b8a24f1102daf 100644 --- a/compiler/rustc_builtin_macros/src/source_util.rs +++ b/compiler/rustc_builtin_macros/src/source_util.rs @@ -150,7 +150,7 @@ pub fn expand_include<'cx>( if self.p.token != token::Eof { let token = pprust::token_to_string(&self.p.token); let msg = format!("expected item, found `{}`", token); - self.p.struct_span_err(self.p.token.span, &msg).emit(); + self.p.struct_span_err(self.p.token.span, msg).emit(); } break; diff --git a/compiler/rustc_codegen_cranelift/src/abi/mod.rs b/compiler/rustc_codegen_cranelift/src/abi/mod.rs index e533afcfaa946..73a3e3353f3a8 100644 --- a/compiler/rustc_codegen_cranelift/src/abi/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/abi/mod.rs @@ -88,10 +88,10 @@ pub(crate) fn import_function<'tcx>( let sig = get_function_sig(tcx, module.target_config().default_call_conv, inst); match module.declare_function(name, Linkage::Import, &sig) { Ok(func_id) => func_id, - Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(&format!( + Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(format!( "attempt to declare `{name}` as function, but it was already declared as static" )), - Err(ModuleError::IncompatibleSignature(_, prev_sig, new_sig)) => tcx.sess.fatal(&format!( + Err(ModuleError::IncompatibleSignature(_, prev_sig, new_sig)) => tcx.sess.fatal(format!( "attempt to declare `{name}` with signature {new_sig:?}, \ but it was already declared with signature {prev_sig:?}" )), @@ -548,7 +548,7 @@ pub(crate) fn codegen_terminator_call<'tcx>( if !matches!(fn_sig.abi(), Abi::C { .. }) { fx.tcx.sess.span_fatal( source_info.span, - &format!("Variadic call for non-C abi {:?}", fn_sig.abi()), + format!("Variadic call for non-C abi {:?}", fn_sig.abi()), ); } let sig_ref = fx.bcx.func.dfg.call_signature(call_inst).unwrap(); @@ -560,7 +560,7 @@ pub(crate) fn codegen_terminator_call<'tcx>( // FIXME set %al to upperbound on float args once floats are supported fx.tcx.sess.span_fatal( source_info.span, - &format!("Non int ty {:?} for variadic call", ty), + format!("Non int ty {:?} for variadic call", ty), ); } AbiParam::new(ty) diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index a259a4f30b27c..e9dbea1be671d 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -220,13 +220,13 @@ pub(crate) fn verify_func( match cranelift_codegen::verify_function(&func, &flags) { Ok(_) => {} Err(err) => { - tcx.sess.err(&format!("{:?}", err)); + tcx.sess.err(format!("{:?}", err)); let pretty_error = cranelift_codegen::print_errors::pretty_verifier_error( &func, Some(Box::new(writer)), err, ); - tcx.sess.fatal(&format!("cranelift verify error:\n{}", pretty_error)); + tcx.sess.fatal(format!("cranelift verify error:\n{}", pretty_error)); } } }); @@ -335,7 +335,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) { fx.bcx.switch_to_block(failure); fx.bcx.ins().nop(); - match msg { + match &**msg { AssertKind::BoundsCheck { ref len, ref index } => { let len = codegen_operand(fx, len).load_scalar(fx); let index = codegen_operand(fx, index).load_scalar(fx); diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index 30f4cf4473c6b..264b95e7abd73 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -481,7 +481,7 @@ impl<'tcx> LayoutOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> { #[inline] fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! { if let layout::LayoutError::SizeOverflow(_) = err { - self.0.sess.span_fatal(span, &err.to_string()) + self.0.sess.span_fatal(span, err.to_string()) } else { span_bug!(span, "failed to get layout for `{}`: {}", ty, err) } @@ -499,7 +499,7 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> { fn_abi_request: FnAbiRequest<'tcx>, ) -> ! { if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err { - self.0.sess.span_fatal(span, &err.to_string()) + self.0.sess.span_fatal(span, err.to_string()) } else { match fn_abi_request { FnAbiRequest::OfFnPtr { sig, extra_args } => { diff --git a/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs b/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs index 54df04f8c2c4a..d2b928db7d4df 100644 --- a/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs +++ b/compiler/rustc_codegen_cranelift/src/concurrency_limiter.rs @@ -65,7 +65,7 @@ impl ConcurrencyLimiter { // Make sure to drop the mutex guard first to prevent poisoning the mutex. drop(state); if let Some(err) = err { - handler.fatal(&err).raise(); + handler.fatal(err).raise(); } else { // The error was already emitted, but compilation continued. Raise a silent // fatal error. diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index bf5d29c16f664..77af561a58724 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -308,7 +308,7 @@ fn data_id_for_static( attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL), ) { Ok(data_id) => data_id, - Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(&format!( + Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(format!( "attempt to declare `{symbol_name}` as static, but it was already declared as function" )), Err(err) => Err::<_, _>(err).unwrap(), @@ -356,7 +356,7 @@ fn data_id_for_static( attrs.flags.contains(CodegenFnAttrFlags::THREAD_LOCAL), ) { Ok(data_id) => data_id, - Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(&format!( + Err(ModuleError::IncompatibleDeclaration(_)) => tcx.sess.fatal(format!( "attempt to declare `{symbol_name}` as static, but it was already declared as function" )), Err(err) => Err::<_, _>(err).unwrap(), @@ -404,7 +404,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant if let Some(names) = section_name.split_once(',') { names } else { - tcx.sess.fatal(&format!( + tcx.sess.fatal(format!( "#[link_section = \"{}\"] is not valid for macos target: must be segment and section separated by comma", section_name )); @@ -449,7 +449,7 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant GlobalAlloc::Static(def_id) => { if tcx.codegen_fn_attrs(def_id).flags.contains(CodegenFnAttrFlags::THREAD_LOCAL) { - tcx.sess.fatal(&format!( + tcx.sess.fatal(format!( "Allocation {:?} contains reference to TLS value {:?}", alloc_id, def_id )); diff --git a/compiler/rustc_codegen_cranelift/src/driver/aot.rs b/compiler/rustc_codegen_cranelift/src/driver/aot.rs index 0e6c6ad95aa1a..aad9a9647f8c9 100644 --- a/compiler/rustc_codegen_cranelift/src/driver/aot.rs +++ b/compiler/rustc_codegen_cranelift/src/driver/aot.rs @@ -69,7 +69,7 @@ impl OngoingCodegen { let module_codegen_result = match module_codegen_result { Ok(module_codegen_result) => module_codegen_result, - Err(err) => sess.fatal(&err), + Err(err) => sess.fatal(err), }; let ModuleCodegenResult { module_regular, module_global_asm, existing_work_product } = module_codegen_result; @@ -468,7 +468,7 @@ pub(crate) fn run_aot( let obj = create_compressed_metadata_file(tcx.sess, &metadata, &symbol_name); if let Err(err) = std::fs::write(&tmp_file, obj) { - tcx.sess.fatal(&format!("error writing metadata object file: {}", err)); + tcx.sess.fatal(format!("error writing metadata object file: {}", err)); } (metadata_cgu_name, tmp_file) diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm.rs index f722e52284fe8..f67fdb592700f 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm.rs @@ -42,7 +42,7 @@ pub(crate) fn codegen_llvm_intrinsic_call<'tcx>( _ => { fx.tcx .sess - .warn(&format!("unsupported llvm intrinsic {}; replacing with trap", intrinsic)); + .warn(format!("unsupported llvm intrinsic {}; replacing with trap", intrinsic)); crate::trap::trap_unimplemented(fx, intrinsic); return; } diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs index b431158d2690f..33b2f4702a7a3 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_aarch64.rs @@ -207,7 +207,7 @@ pub(crate) fn codegen_aarch64_llvm_intrinsic_call<'tcx>( } */ _ => { - fx.tcx.sess.warn(&format!( + fx.tcx.sess.warn(format!( "unsupported AArch64 llvm intrinsic {}; replacing with trap", intrinsic )); diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs index 0f32d1a25ffad..56d8f13cec5e5 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/llvm_x86.rs @@ -138,10 +138,9 @@ pub(crate) fn codegen_x86_llvm_intrinsic_call<'tcx>( llvm_add_sub(fx, BinOp::Sub, ret, b_in, a, b); } _ => { - fx.tcx.sess.warn(&format!( - "unsupported x86 llvm intrinsic {}; replacing with trap", - intrinsic - )); + fx.tcx + .sess + .warn(format!("unsupported x86 llvm intrinsic {}; replacing with trap", intrinsic)); crate::trap::trap_unimplemented(fx, intrinsic); return; } diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs index 539f8c103dbd7..0a513b08b74f5 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs @@ -42,7 +42,7 @@ fn report_atomic_type_validation_error<'tcx>( ) { fx.tcx.sess.span_err( span, - &format!( + format!( "`{}` intrinsic: expected basic integer or raw pointer type, found `{:?}`", intrinsic, ty ), @@ -1202,7 +1202,7 @@ fn codegen_regular_intrinsic_call<'tcx>( _ => { fx.tcx .sess - .span_fatal(source_info.span, &format!("unsupported intrinsic {}", intrinsic)); + .span_fatal(source_info.span, format!("unsupported intrinsic {}", intrinsic)); } } diff --git a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs index 264b578c168b2..5a038bfca5d2d 100644 --- a/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs +++ b/compiler/rustc_codegen_cranelift/src/intrinsics/simd.rs @@ -13,7 +13,7 @@ fn report_simd_type_validation_error( span: Span, ty: Ty<'_>, ) { - fx.tcx.sess.span_err(span, &format!("invalid monomorphization of `{}` intrinsic: expected SIMD input type, found non-SIMD `{}`", intrinsic, ty)); + fx.tcx.sess.span_err(span, format!("invalid monomorphization of `{}` intrinsic: expected SIMD input type, found non-SIMD `{}`", intrinsic, ty)); // Prevent verifier error fx.bcx.ins().trap(TrapCode::UnreachableCodeReached); } @@ -150,7 +150,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( _ => { fx.tcx.sess.span_err( span, - &format!( + format!( "simd_shuffle index must be an array of `u32`, got `{}`", idx_ty, ), @@ -248,7 +248,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( if idx >= lane_count.into() { fx.tcx.sess.span_fatal( fx.mir.span, - &format!("[simd_insert] idx {} >= lane_count {}", idx, lane_count), + format!("[simd_insert] idx {} >= lane_count {}", idx, lane_count), ); } @@ -296,7 +296,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( if idx >= lane_count.into() { fx.tcx.sess.span_fatal( fx.mir.span, - &format!("[simd_extract] idx {} >= lane_count {}", idx, lane_count), + format!("[simd_extract] idx {} >= lane_count {}", idx, lane_count), ); } @@ -699,7 +699,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( _ => { fx.tcx.sess.span_fatal( span, - &format!( + format!( "invalid monomorphization of `simd_bitmask` intrinsic: \ vector argument `{}`'s element type `{}`, expected integer element \ type", @@ -739,7 +739,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( _ => { fx.tcx.sess.span_fatal( span, - &format!( + format!( "invalid monomorphization of `simd_bitmask` intrinsic: \ cannot return `{}`, expected `u{}` or `[u8; {}]`", ret.layout().ty, @@ -875,7 +875,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>( } _ => { - fx.tcx.sess.span_err(span, &format!("Unknown SIMD intrinsic {}", intrinsic)); + fx.tcx.sess.span_err(span, format!("Unknown SIMD intrinsic {}", intrinsic)); // Prevent verifier error fx.bcx.ins().trap(TrapCode::UnreachableCodeReached); } diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs index f0b399ae2808d..9966cc2ef3c12 100644 --- a/compiler/rustc_codegen_cranelift/src/lib.rs +++ b/compiler/rustc_codegen_cranelift/src/lib.rs @@ -185,7 +185,7 @@ impl CodegenBackend for CraneliftCodegenBackend { let mut config = self.config.borrow_mut(); if config.is_none() { let new_config = BackendConfig::from_opts(&sess.opts.cg.llvm_args) - .unwrap_or_else(|err| sess.fatal(&err)); + .unwrap_or_else(|err| sess.fatal(err)); *config = Some(new_config); } } @@ -245,7 +245,7 @@ impl CodegenBackend for CraneliftCodegenBackend { fn target_triple(sess: &Session) -> target_lexicon::Triple { match sess.target.llvm_target.parse() { Ok(triple) => triple, - Err(err) => sess.fatal(&format!("target not recognized: {}", err)), + Err(err) => sess.fatal(format!("target not recognized: {}", err)), } } @@ -307,7 +307,7 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Arc { let mut builder = cranelift_codegen::isa::lookup(target_triple.clone()).unwrap_or_else(|err| { - sess.fatal(&format!("can't compile for {}: {}", target_triple, err)); + sess.fatal(format!("can't compile for {}: {}", target_triple, err)); }); if let Err(_) = builder.enable(value) { sess.fatal("the specified target cpu isn't currently supported by Cranelift."); @@ -317,7 +317,7 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Arc { let mut builder = cranelift_codegen::isa::lookup(target_triple.clone()).unwrap_or_else(|err| { - sess.fatal(&format!("can't compile for {}: {}", target_triple, err)); + sess.fatal(format!("can't compile for {}: {}", target_triple, err)); }); if target_triple.architecture == target_lexicon::Architecture::X86_64 { // Don't use "haswell" as the default, as it implies `has_lzcnt`. @@ -330,7 +330,7 @@ fn build_isa(sess: &Session, backend_config: &BackendConfig) -> Arc target_isa, - Err(err) => sess.fatal(&format!("failed to build TargetIsa: {}", err)), + Err(err) => sess.fatal(format!("failed to build TargetIsa: {}", err)), } } diff --git a/compiler/rustc_codegen_cranelift/src/main_shim.rs b/compiler/rustc_codegen_cranelift/src/main_shim.rs index 205411e8c27be..20ba73f38523a 100644 --- a/compiler/rustc_codegen_cranelift/src/main_shim.rs +++ b/compiler/rustc_codegen_cranelift/src/main_shim.rs @@ -75,7 +75,7 @@ pub(crate) fn maybe_create_entry_wrapper( Ok(func_id) => func_id, Err(err) => { tcx.sess - .fatal(&format!("entry symbol `{entry_name}` declared multiple times: {err}")); + .fatal(format!("entry symbol `{entry_name}` declared multiple times: {err}")); } }; @@ -171,7 +171,7 @@ pub(crate) fn maybe_create_entry_wrapper( } if let Err(err) = m.define_function(cmain_func_id, &mut ctx) { - tcx.sess.fatal(&format!("entry symbol `{entry_name}` defined multiple times: {err}")); + tcx.sess.fatal(format!("entry symbol `{entry_name}` defined multiple times: {err}")); } unwind_context.add_function(cmain_func_id, &ctx, m.isa()); diff --git a/compiler/rustc_codegen_cranelift/src/value_and_place.rs b/compiler/rustc_codegen_cranelift/src/value_and_place.rs index c964d1ac5e0dd..b1fda6ff21337 100644 --- a/compiler/rustc_codegen_cranelift/src/value_and_place.rs +++ b/compiler/rustc_codegen_cranelift/src/value_and_place.rs @@ -344,7 +344,7 @@ impl<'tcx> CPlace<'tcx> { if layout.size.bytes() >= u64::from(u32::MAX - 16) { fx.tcx .sess - .fatal(&format!("values of type {} are too big to store on the stack", layout.ty)); + .fatal(format!("values of type {} are too big to store on the stack", layout.ty)); } let stack_slot = fx.bcx.create_sized_stack_slot(StackSlotData { diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index c63e156beae7b..8a7809a14682c 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -40,7 +40,6 @@ use regex::Regex; use tempfile::Builder as TempFileBuilder; use itertools::Itertools; -use std::borrow::Borrow; use std::cell::OnceCell; use std::collections::BTreeSet; use std::ffi::OsString; @@ -54,7 +53,7 @@ use std::{env, fmt, fs, io, mem, str}; pub fn ensure_removed(diag_handler: &Handler, path: &Path) { if let Err(e) = fs::remove_file(path) { if e.kind() != io::ErrorKind::NotFound { - diag_handler.err(&format!("failed to remove {}: {}", path.display(), e)); + diag_handler.err(format!("failed to remove {}: {}", path.display(), e)); } } } @@ -576,17 +575,17 @@ fn link_dwarf_object<'a>( impl ThorinSession { fn alloc_mmap(&self, data: Mmap) -> &Mmap { - (*self.arena_mmap.alloc(data)).borrow() + &*self.arena_mmap.alloc(data) } } impl thorin::Session for ThorinSession { fn alloc_data(&self, data: Vec) -> &[u8] { - (*self.arena_data.alloc(data)).borrow() + &*self.arena_data.alloc(data) } fn alloc_relocation(&self, data: Relocations) -> &Relocations { - (*self.arena_relocations.alloc(data)).borrow() + &*self.arena_relocations.alloc(data) } fn read_input(&self, path: &Path) -> std::io::Result<&[u8]> { @@ -1406,7 +1405,7 @@ fn print_native_static_libs(sess: &Session, all_native_libs: &[NativeLib]) { sess.emit_note(errors::StaticLibraryNativeArtifacts); // Prefix for greppability // Note: This must not be translated as tools are allowed to depend on this exact string. - sess.note_without_error(&format!("native-static-libs: {}", &lib_args.join(" "))); + sess.note_without_error(format!("native-static-libs: {}", &lib_args.join(" "))); } } diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 65dfc325a118f..1e57f4248d20f 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -1631,7 +1631,7 @@ impl<'a> Linker for AixLinker<'a> { } }; if let Err(e) = res { - self.sess.fatal(&format!("failed to write export file: {}", e)); + self.sess.fatal(format!("failed to write export file: {}", e)); } self.cmd.arg(format!("-bE:{}", path.to_str().unwrap())); } diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index c80347448cbb2..c42d59bd51c0a 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -1833,7 +1833,7 @@ impl SharedEmitterMain { sess.abort_if_errors(); } Ok(SharedEmitterMessage::Fatal(msg)) => { - sess.fatal(&msg); + sess.fatal(msg); } Err(_) => { break; diff --git a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs index 5bd42622f2c33..5cc87d1e56cca 100644 --- a/compiler/rustc_codegen_ssa/src/codegen_attrs.rs +++ b/compiler/rustc_codegen_ssa/src/codegen_attrs.rs @@ -301,7 +301,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { if let Some(val) = attr.value_str() { if val.as_str().bytes().any(|b| b == 0) { let msg = format!("illegal null byte in link_section value: `{}`", &val); - tcx.sess.span_err(attr.span, &msg); + tcx.sess.span_err(attr.span, msg); } else { codegen_fn_attrs.link_section = Some(val); } @@ -631,7 +631,7 @@ fn check_link_ordinal(tcx: TyCtxt<'_>, attr: &ast::Attribute) -> Option { } else { let msg = format!("ordinal value in `link_ordinal` is too large: `{}`", &ordinal); tcx.sess - .struct_span_err(attr.span, &msg) + .struct_span_err(attr.span, msg) .note("the value may not exceed `u16::MAX`") .emit(); None diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs index 03f33d8d8aa7f..6297f91341d44 100644 --- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs +++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs @@ -94,7 +94,7 @@ fn push_debuginfo_type_name<'tcx>( // Computing the layout can still fail here, e.g. if the target architecture // cannot represent the type. See https://github.com/rust-lang/rust/issues/94961. // FIXME: migrate once `rustc_middle::mir::interpret::InterpError` is translatable. - tcx.sess.fatal(&format!("{}", e)); + tcx.sess.fatal(format!("{}", e)); } } } else { diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs index a936b62dd4eba..1cfc4b933a8cb 100644 --- a/compiler/rustc_codegen_ssa/src/target_features.rs +++ b/compiler/rustc_codegen_ssa/src/target_features.rs @@ -370,7 +370,7 @@ pub fn from_target_feature( let Some(feature_gate) = supported_target_features.get(feature) else { let msg = format!("the feature named `{}` is not valid for this target", feature); - let mut err = tcx.sess.struct_span_err(item.span(), &msg); + let mut err = tcx.sess.struct_span_err(item.span(), msg); err.span_label( item.span(), format!("`{}` is not valid for this target", feature), @@ -408,7 +408,7 @@ pub fn from_target_feature( &tcx.sess.parse_sess, feature_gate.unwrap(), item.span(), - &format!("the target feature `{}` is currently unstable", feature), + format!("the target feature `{}` is currently unstable", feature), ) .emit(); } diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index 0579f78153527..cdef3fb23398b 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -104,13 +104,13 @@ impl<'tcx> ConstEvalErr<'tcx> { // Add spans for the stacktrace. Don't print a single-line backtrace though. if self.stacktrace.len() > 1 { // Helper closure to print duplicated lines. - let mut flush_last_line = |last_frame, times| { + let mut flush_last_line = |last_frame: Option<(String, _)>, times| { if let Some((line, span)) = last_frame { - err.span_note(span, &line); + err.span_note(span, line.clone()); // Don't print [... additional calls ...] if the number of lines is small if times < 3 { for _ in 0..times { - err.span_note(span, &line); + err.span_note(span, line.clone()); } } else { err.span_note( diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 99f180f475d6b..046d2052968a3 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -368,7 +368,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>( if matches!(err.error, InterpError::UndefinedBehavior(_)) { diag.note(NOTE_ON_UNDEFINED_BEHAVIOR_ERROR); } - diag.note(&format!( + diag.note(format!( "the raw bytes of the constant ({}", display_allocation( *ecx.tcx, diff --git a/compiler/rustc_const_eval/src/const_eval/mod.rs b/compiler/rustc_const_eval/src/const_eval/mod.rs index 3cdf1e6e30c99..05be45fef1391 100644 --- a/compiler/rustc_const_eval/src/const_eval/mod.rs +++ b/compiler/rustc_const_eval/src/const_eval/mod.rs @@ -83,7 +83,7 @@ pub(crate) fn eval_to_valtree<'tcx>( Some(span) => { tcx.sess.create_err(MaxNumNodesInConstErr { span, global_const_id }) } - None => tcx.sess.struct_err(&msg), + None => tcx.sess.struct_err(msg), }; diag.emit(); diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index b220d21f68b72..c2b82ba9b0792 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -387,7 +387,7 @@ pub fn intern_const_alloc_recursive< Err(error) => { ecx.tcx.sess.delay_span_bug( ecx.tcx.span, - &format!( + format!( "error during interning should later cause validation failure: {}", error ), diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index 319b80d66e18e..1e60a1e72ea07 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -293,7 +293,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // FIXME: This should be a span_bug (#80742) self.tcx.sess.delay_span_bug( self.frame().current_span(), - &format!("{null_op:?} MIR operator called for unsized type {ty}"), + format!("{null_op:?} MIR operator called for unsized type {ty}"), ); throw_inval!(SizeOfUnsizedType(ty)); } diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index e06b634cdc330..01b77289937fb 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -38,16 +38,14 @@ macro_rules! throw_validation_failure { msg.push_str(", but expected "); write!(&mut msg, $($expected_fmt)*).unwrap(); )? - let path = rustc_middle::ty::print::with_no_trimmed_paths!({ - let where_ = &$where; - if !where_.is_empty() { - let mut path = String::new(); - write_path(&mut path, where_); - Some(path) - } else { - None - } - }); + let where_ = &$where; + let path = if !where_.is_empty() { + let mut path = String::new(); + write_path(&mut path, where_); + Some(path) + } else { + None + }; throw_ub!(ValidationFailure { path, msg }) }}; } diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs index e3d39091a745d..21f3c2c891713 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs @@ -77,7 +77,7 @@ impl<'tcx> NonConstOp<'tcx> for FloatingPointOp { &ccx.tcx.sess.parse_sess, sym::const_fn_floating_point_arithmetic, span, - &format!("floating point arithmetic is not allowed in {}s", ccx.const_kind()), + format!("floating point arithmetic is not allowed in {}s", ccx.const_kind()), ) } } @@ -211,13 +211,13 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { err.span_note(span, "function defined here, but it is not `const`"); } FnPtr(..) => { - err.note(&format!( + err.note(format!( "function pointers need an RFC before allowed to be called in {}s", ccx.const_kind() )); } Closure(..) => { - err.note(&format!( + err.note(format!( "closures need an RFC before allowed to be called in {}s", ccx.const_kind() )); @@ -289,7 +289,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { ccx.const_kind() ); - err.note(&format!("attempting to deref into `{}`", deref_target_ty)); + err.note(format!("attempting to deref into `{}`", deref_target_ty)); // Check first whether the source is accessible (issue #87060) if tcx.sess.source_map().is_span_accessible(deref_target) { @@ -310,14 +310,14 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { }), }; - err.note(&format!( + err.note(format!( "calls in {}s are limited to constant functions, \ tuple structs and tuple variants", ccx.const_kind(), )); if let Some(feature) = feature && ccx.tcx.sess.is_nightly_build() { - err.help(&format!( + err.help(format!( "add `#![feature({})]` to the crate attributes to enable", feature, )); @@ -354,7 +354,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable { err.help("const-stable functions can only call other const-stable functions"); } else if ccx.tcx.sess.is_nightly_build() { if let Some(feature) = feature { - err.help(&format!( + err.help(format!( "add `#![feature({})]` to the crate attributes to enable", feature )); @@ -637,7 +637,7 @@ impl<'tcx> NonConstOp<'tcx> for RawMutPtrDeref { &ccx.tcx.sess.parse_sess, sym::const_mut_refs, span, - &format!("dereferencing raw mutable pointers in {}s is unstable", ccx.const_kind(),), + format!("dereferencing raw mutable pointers in {}s is unstable", ccx.const_kind(),), ) } } @@ -724,7 +724,7 @@ pub mod ty { &ccx.tcx.sess.parse_sess, sym::const_mut_refs, span, - &format!("mutable references are not allowed in {}s", ccx.const_kind()), + format!("mutable references are not allowed in {}s", ccx.const_kind()), ) } } diff --git a/compiler/rustc_const_eval/src/transform/validate.rs b/compiler/rustc_const_eval/src/transform/validate.rs index 03ab2e568df80..f46c2d00fe4e0 100644 --- a/compiler/rustc_const_eval/src/transform/validate.rs +++ b/compiler/rustc_const_eval/src/transform/validate.rs @@ -107,7 +107,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { // occurred. self.tcx.sess.diagnostic().delay_span_bug( span, - &format!( + format!( "broken MIR in {:?} ({}) at {:?}:\n{}", self.body.source.instance, self.when, @@ -1094,7 +1094,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> { if self.body.source_scopes.get(scope).is_none() { self.tcx.sess.diagnostic().delay_span_bug( self.body.span, - &format!( + format!( "broken MIR in {:?} ({}):\ninvalid source scope {:?}", self.body.source.instance, self.when, scope, ), diff --git a/compiler/rustc_error_messages/src/lib.rs b/compiler/rustc_error_messages/src/lib.rs index 88d94c93bf520..6c3f677ab8e69 100644 --- a/compiler/rustc_error_messages/src/lib.rs +++ b/compiler/rustc_error_messages/src/lib.rs @@ -287,11 +287,19 @@ pub enum SubdiagnosticMessage { FluentAttr(FluentId), } -/// `From` impl that enables existing diagnostic calls to functions which now take -/// `impl Into` to continue to work as before. -impl> From for SubdiagnosticMessage { - fn from(s: S) -> Self { - SubdiagnosticMessage::Str(s.into()) +impl From for SubdiagnosticMessage { + fn from(s: String) -> Self { + SubdiagnosticMessage::Str(s) + } +} +impl<'a> From<&'a str> for SubdiagnosticMessage { + fn from(s: &'a str) -> Self { + SubdiagnosticMessage::Str(s.to_string()) + } +} +impl From> for SubdiagnosticMessage { + fn from(s: Cow<'static, str>) -> Self { + SubdiagnosticMessage::Str(s.to_string()) } } @@ -352,11 +360,19 @@ impl DiagnosticMessage { } } -/// `From` impl that enables existing diagnostic calls to functions which now take -/// `impl Into` to continue to work as before. -impl> From for DiagnosticMessage { - fn from(s: S) -> Self { - DiagnosticMessage::Str(s.into()) +impl From for DiagnosticMessage { + fn from(s: String) -> Self { + DiagnosticMessage::Str(s) + } +} +impl<'a> From<&'a str> for DiagnosticMessage { + fn from(s: &'a str) -> Self { + DiagnosticMessage::Str(s.to_string()) + } +} +impl From> for DiagnosticMessage { + fn from(s: Cow<'static, str>) -> Self { + DiagnosticMessage::Str(s.to_string()) } } diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 3064d2bedbe12..1f1398342b122 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -791,7 +791,7 @@ macro_rules! struct_span_err { ($session:expr, $span:expr, $code:ident, $($message:tt)*) => ({ $session.struct_span_err_with_code( $span, - &format!($($message)*), + format!($($message)*), $crate::error_code!($code), ) }) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 2498ae2b7bce5..68e57de5e0889 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -601,7 +601,7 @@ impl Emitter for SilentEmitter { if d.level == Level::Fatal { let mut d = d.clone(); if let Some(ref note) = self.fatal_note { - d.note(note); + d.note(note.clone()); } self.fatal_handler.emit_diagnostic(&mut d); } diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index b65a636d7701c..f9c062d3a2176 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1462,10 +1462,10 @@ impl HandlerInner { DiagnosticMessage::Str(warnings), )), (_, 0) => { - let _ = self.fatal(&errors); + let _ = self.fatal(errors); } (_, _) => { - let _ = self.fatal(&format!("{}; {}", &errors, &warnings)); + let _ = self.fatal(format!("{}; {}", &errors, &warnings)); } } @@ -1486,18 +1486,18 @@ impl HandlerInner { error_codes.sort(); if error_codes.len() > 1 { let limit = if error_codes.len() > 9 { 9 } else { error_codes.len() }; - self.failure(&format!( + self.failure(format!( "Some errors have detailed explanations: {}{}", error_codes[..limit].join(", "), if error_codes.len() > 9 { "..." } else { "." } )); - self.failure(&format!( + self.failure(format!( "For more information about an error, try \ `rustc --explain {}`.", &error_codes[0] )); } else { - self.failure(&format!( + self.failure(format!( "For more information about this error, try \ `rustc --explain {}`.", &error_codes[0] @@ -1663,7 +1663,7 @@ impl HandlerInner { if bug.level != Level::DelayedBug { // NOTE(eddyb) not panicking here because we're already producing // an ICE, and the more information the merrier. - bug.note(&format!( + bug.note(format!( "`flushed_delayed` got diagnostic with level {:?}, \ instead of the expected `DelayedBug`", bug.level, @@ -1732,7 +1732,7 @@ impl DelayedDiagnostic { } fn decorate(mut self) -> Diagnostic { - self.inner.note(&format!("delayed at {}", self.note)); + self.inner.note(format!("delayed at {}", self.note)); self.inner } } @@ -1831,7 +1831,7 @@ pub fn add_elided_lifetime_in_path_suggestion( if incl_angl_brckt { format!("<{}>", anon_lts) } else { format!("{}, ", anon_lts) }; diag.span_suggestion_verbose( insertion_span.shrink_to_hi(), - &format!("indicate the anonymous lifetime{}", pluralize!(n)), + format!("indicate the anonymous lifetime{}", pluralize!(n)), suggestion, Applicability::MachineApplicable, ); diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index caa2a201c758d..c1cca89df8ca5 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -992,7 +992,6 @@ pub struct ExpansionData { pub depth: usize, pub module: Rc, pub dir_ownership: DirOwnership, - pub prior_type_ascription: Option<(Span, bool)>, /// Some parent node that is close to this macro call pub lint_node_id: NodeId, pub is_trailing_mac: bool, @@ -1043,7 +1042,6 @@ impl<'a> ExtCtxt<'a> { depth: 0, module: Default::default(), dir_ownership: DirOwnership::Owned { relative: None }, - prior_type_ascription: None, lint_node_id: ast::CRATE_NODE_ID, is_trailing_mac: false, }, @@ -1148,7 +1146,7 @@ impl<'a> ExtCtxt<'a> { for (span, notes) in self.expansions.iter() { let mut db = self.sess.parse_sess.create_note(errors::TraceMacro { span: *span }); for note in notes { - db.note(note); + db.note(note.clone()); } db.emit(); } diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index ec40911545f50..7c78970345ad5 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -657,8 +657,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.parse_ast_fragment(tok_result, fragment_kind, &mac.path, span) } SyntaxExtensionKind::LegacyBang(expander) => { - let prev = self.cx.current_expansion.prior_type_ascription; - self.cx.current_expansion.prior_type_ascription = mac.prior_type_ascription; let tok_result = expander.expand(self.cx, span, mac.args.tokens.clone()); let result = if let Some(result) = fragment_kind.make_from(tok_result) { result @@ -666,7 +664,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { self.error_wrong_fragment_kind(fragment_kind, &mac, span); fragment_kind.dummy(span) }; - self.cx.current_expansion.prior_type_ascription = prev; result } _ => unreachable!(), @@ -800,7 +797,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { &self.cx.sess.parse_sess, sym::proc_macro_hygiene, span, - &format!("custom attributes cannot be applied to {}", kind), + format!("custom attributes cannot be applied to {}", kind), ) .emit(); } diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 3aeb2edb54ca0..e4c65a2049bf6 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -250,8 +250,7 @@ fn expand_macro<'cx>( trace_macros_note(&mut cx.expansions, sp, msg); } - let mut p = Parser::new(sess, tts, false, None); - p.last_type_ascription = cx.current_expansion.prior_type_ascription; + let p = Parser::new(sess, tts, false, None); if is_local { cx.resolver.record_macro_rule_usage(node_id, i); @@ -475,7 +474,7 @@ pub fn compile_declarative_macro( let s = parse_failure_msg(&token); let sp = token.span.substitute_dummy(def.span); - let mut err = sess.parse_sess.span_diagnostic.struct_span_err(sp, &s); + let mut err = sess.parse_sess.span_diagnostic.struct_span_err(sp, s); err.span_label(sp, msg); annotate_doc_comment(&mut err, sess.source_map(), sp); err.emit(); @@ -484,7 +483,7 @@ pub fn compile_declarative_macro( Error(sp, msg) => { sess.parse_sess .span_diagnostic - .struct_span_err(sp.substitute_dummy(def.span), &msg) + .struct_span_err(sp.substitute_dummy(def.span), msg) .emit(); return dummy_syn_ext(); } @@ -556,7 +555,7 @@ pub fn compile_declarative_macro( let (transparency, transparency_error) = attr::find_transparency(&def.attrs, macro_rules); match transparency_error { Some(TransparencyError::UnknownTransparency(value, span)) => { - diag.span_err(span, &format!("unknown macro transparency: `{}`", value)); + diag.span_err(span, format!("unknown macro transparency: `{}`", value)); } Some(TransparencyError::MultipleTransparencyAttrs(old_span, new_span)) => { diag.span_err(vec![old_span, new_span], "multiple macro transparency attributes"); @@ -1165,7 +1164,7 @@ fn check_matcher_core<'tt>( let sp = next_token.span(); let mut err = sess.span_diagnostic.struct_span_err( sp, - &format!( + format!( "`${name}:{frag}` {may_be} followed by `{next}`, which \ is not allowed for `{frag}` fragments", name = name, @@ -1197,13 +1196,13 @@ fn check_matcher_core<'tt>( match possible { &[] => {} &[t] => { - err.note(&format!( + err.note(format!( "only {} is allowed after `{}` fragments", t, kind, )); } ts => { - err.note(&format!( + err.note(format!( "{}{} or {}", msg, ts[..ts.len() - 1].to_vec().join(", "), diff --git a/compiler/rustc_expand/src/mbe/metavar_expr.rs b/compiler/rustc_expand/src/mbe/metavar_expr.rs index fb3a00d86d4f7..6e919615019fb 100644 --- a/compiler/rustc_expand/src/mbe/metavar_expr.rs +++ b/compiler/rustc_expand/src/mbe/metavar_expr.rs @@ -78,7 +78,7 @@ fn check_trailing_token<'sess>( if let Some(tt) = iter.next() { let mut diag = sess .span_diagnostic - .struct_span_err(tt.span(), &format!("unexpected token: {}", pprust::tt_to_string(tt))); + .struct_span_err(tt.span(), format!("unexpected token: {}", pprust::tt_to_string(tt))); diag.span_note(tt.span(), "meta-variable expression must not have trailing tokens"); Err(diag) } else { @@ -137,11 +137,11 @@ fn parse_ident<'sess>( let token_str = pprust::token_to_string(token); let mut err = sess.span_diagnostic.struct_span_err( span, - &format!("expected identifier, found `{}`", &token_str) + format!("expected identifier, found `{}`", &token_str) ); err.span_suggestion( token.span, - &format!("try removing `{}`", &token_str), + format!("try removing `{}`", &token_str), "", Applicability::MaybeIncorrect, ); diff --git a/compiler/rustc_expand/src/mbe/quoted.rs b/compiler/rustc_expand/src/mbe/quoted.rs index bc298b0ad2b1e..b2bdf9c7e6db6 100644 --- a/compiler/rustc_expand/src/mbe/quoted.rs +++ b/compiler/rustc_expand/src/mbe/quoted.rs @@ -85,7 +85,7 @@ pub(super) fn parse( frag.name ); sess.span_diagnostic - .struct_span_err(span, &msg) + .struct_span_err(span, msg) .help(VALID_FRAGMENT_NAMES_MSG) .emit(); token::NonterminalKind::Ident @@ -195,7 +195,7 @@ fn parse_tree( _ => { let tok = pprust::token_kind_to_string(&token::OpenDelim(delim)); let msg = format!("expected `(` or `{{`, found `{}`", tok); - sess.span_diagnostic.span_err(delim_span.entire(), &msg); + sess.span_diagnostic.span_err(delim_span.entire(), msg); } } } @@ -246,7 +246,7 @@ fn parse_tree( "expected identifier, found `{}`", pprust::token_to_string(&token), ); - sess.span_diagnostic.span_err(token.span, &msg); + sess.span_diagnostic.span_err(token.span, msg); TokenTree::MetaVar(token.span, Ident::empty()) } @@ -358,7 +358,7 @@ fn parse_sep_and_kleene_op( // For example, `macro_rules! foo { ( ${length()} ) => {} }` fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &ParseSess, token: &Token) { sess.span_diagnostic - .span_err(token.span, &format!("unexpected token: {}", pprust::token_to_string(token))); + .span_err(token.span, format!("unexpected token: {}", pprust::token_to_string(token))); sess.span_diagnostic.span_note_without_error( token.span, "`$$` and meta-variable expressions are not allowed inside macro parameter definitions", diff --git a/compiler/rustc_expand/src/placeholders.rs b/compiler/rustc_expand/src/placeholders.rs index 03bb5c1dfe45f..e9af688ee2b61 100644 --- a/compiler/rustc_expand/src/placeholders.rs +++ b/compiler/rustc_expand/src/placeholders.rs @@ -21,7 +21,6 @@ pub fn placeholder( delim: ast::MacDelimiter::Parenthesis, tokens: ast::tokenstream::TokenStream::new(Vec::new()), }), - prior_type_ascription: None, }) } diff --git a/compiler/rustc_expand/src/proc_macro.rs b/compiler/rustc_expand/src/proc_macro.rs index 26bc216f678cf..41b24407fa07c 100644 --- a/compiler/rustc_expand/src/proc_macro.rs +++ b/compiler/rustc_expand/src/proc_macro.rs @@ -95,7 +95,7 @@ impl base::AttrProcMacro for AttrProcMacro { |e| { let mut err = ecx.struct_span_err(span, "custom attribute panicked"); if let Some(s) = e.as_str() { - err.help(&format!("message: {}", s)); + err.help(format!("message: {}", s)); } err.emit() }, @@ -148,7 +148,7 @@ impl MultiItemModifier for DeriveProcMacro { Err(e) => { let mut err = ecx.struct_span_err(span, "proc-macro derive panicked"); if let Some(s) = e.as_str() { - err.help(&format!("message: {}", s)); + err.help(format!("message: {}", s)); } err.emit(); return ExpandResult::Ready(vec![]); diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 3b9fc5e9a513c..70d608a5ea428 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -130,6 +130,8 @@ declare_features! ( (accepted, copy_closures, "1.26.0", Some(44490), None), /// Allows `crate` in paths. (accepted, crate_in_paths, "1.30.0", Some(45477), None), + /// Allows using `#[debugger_visualizer]` attribute. + (accepted, debugger_visualizer, "CURRENT_RUSTC_VERSION", Some(95939), None), /// Allows rustc to inject a default alloc_error_handler (accepted, default_alloc_error_handler, "1.68.0", Some(66741), None), /// Allows using assigning a default type to type parameters in algebraic data type definitions. diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index bafb83740ca85..6201e5b619b87 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -363,8 +363,6 @@ declare_features! ( (active, custom_inner_attributes, "1.30.0", Some(54726), None), /// Allows custom test frameworks with `#![test_runner]` and `#[test_case]`. (active, custom_test_frameworks, "1.30.0", Some(50297), None), - /// Allows using `#[debugger_visualizer]`. - (active, debugger_visualizer, "1.62.0", Some(95939), None), /// Allows declarative macros 2.0 (`macro`). (active, decl_macro, "1.17.0", Some(39412), None), /// Allows default type parameters to influence type inference. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index c77292fdd1647..574419440de66 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -403,16 +403,16 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk ), + // Debugging + ungated!( + debugger_visualizer, Normal, + template!(List: r#"natvis_file = "...", gdb_script_file = "...""#), DuplicatesOk + ), + // ========================================================================== // Unstable attributes: // ========================================================================== - // RFC #3191: #[debugger_visualizer] support - gated!( - debugger_visualizer, Normal, template!(List: r#"natvis_file = "...", gdb_script_file = "...""#), - DuplicatesOk, experimental!(debugger_visualizer) - ), - // Linking: gated!( naked, Normal, template!(Word), WarnFollowing, @only_local: true, diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index 8f91a96f964ab..e1c030d3e198a 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -293,6 +293,8 @@ language_item_table! { PointerLike, sym::pointer_like, pointer_like, Target::Trait, GenericRequirement::Exact(0); + ConstParamTy, sym::const_param_ty, const_param_ty_trait, Target::Trait, GenericRequirement::Exact(0); + Poll, sym::Poll, poll, Target::Enum, GenericRequirement::None; PollReady, sym::Ready, poll_ready_variant, Target::Variant, GenericRequirement::None; PollPending, sym::Pending, poll_pending_variant, Target::Variant, GenericRequirement::None; diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 5d45d09797b0b..e4f225bdad73e 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -35,6 +35,10 @@ hir_analysis_field_already_declared = hir_analysis_expected_used_symbol = expected `used`, `used(compiler)` or `used(linker)` +hir_analysis_const_param_ty_impl_on_non_adt = + the trait `ConstParamTy` may not be implemented for this type + .label = type is not a structure or enumeration + hir_analysis_ambiguous_lifetime_bound = ambiguous lifetime bound, explicit lifetime bound required diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs index 113c3f08ab9ae..7b922f5d52599 100644 --- a/compiler/rustc_hir_analysis/src/astconv/errors.rs +++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs @@ -243,13 +243,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let note = format!("{title} is defined in an impl for the type `{impl_ty}`"); if let Some(span) = note_span { - err.span_note(span, ¬e); + err.span_note(span, note); } else { - err.note(¬e); + err.note(note); } } if candidates.len() > limit { - err.note(&format!("and {} others", candidates.len() - limit)); + err.note(format!("and {} others", candidates.len() - limit)); } } @@ -303,7 +303,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { "associated type `{name}` not found for `{self_ty}` in the current scope" ); err.span_label(name.span, format!("associated item not found in `{self_ty}`")); - err.note(&format!( + err.note(format!( "the associated type was found for\n{type_candidates}{additional_types}", )); add_def_label(&mut err); @@ -390,10 +390,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let mut err = tcx.sess.struct_span_err( name.span, - &format!("the associated type `{name}` exists for `{self_ty}`, but its trait bounds were not satisfied") + format!("the associated type `{name}` exists for `{self_ty}`, but its trait bounds were not satisfied") ); if !bounds.is_empty() { - err.note(&format!( + err.note(format!( "the following trait bounds were not satisfied:\n{}", bounds.join("\n") )); @@ -409,7 +409,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if !tcx.sess.source_map().is_span_accessible(span) { continue; } - err.span_label(span, &msg); + err.span_label(span, msg); } add_def_label(&mut err); err.emit() @@ -589,7 +589,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } if !suggestions.is_empty() { err.multipart_suggestion( - &format!("specify the associated type{}", pluralize!(types_count)), + format!("specify the associated type{}", pluralize!(types_count)), suggestions, Applicability::HasPlaceholders, ); diff --git a/compiler/rustc_hir_analysis/src/astconv/generics.rs b/compiler/rustc_hir_analysis/src/astconv/generics.rs index 3b5c67de2390e..ed011b9086a19 100644 --- a/compiler/rustc_hir_analysis/src/astconv/generics.rs +++ b/compiler/rustc_hir_analysis/src/astconv/generics.rs @@ -112,7 +112,7 @@ fn generic_arg_mismatch_err( if let rustc_hir::ExprKind::Path(rustc_hir::QPath::Resolved(_, path)) = body.value.kind { if let Res::Def(DefKind::Fn { .. }, id) = path.res { - err.help(&format!("`{}` is a function item, not a type", tcx.item_name(id))); + err.help(format!("`{}` is a function item, not a type", tcx.item_name(id))); err.help("function item types cannot be named directly"); } } @@ -130,7 +130,7 @@ fn generic_arg_mismatch_err( } else { (arg.descr(), param.kind.descr()) }; - err.note(&format!("{} arguments must be provided before {} arguments", first, last)); + err.note(format!("{} arguments must be provided before {} arguments", first, last)); if let Some(help) = help { err.help(help); } diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index 709dea43d84aa..def192f6e1042 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -56,6 +56,9 @@ use std::slice; #[derive(Debug)] pub struct PathSeg(pub DefId, pub usize); +#[derive(Copy, Clone, Debug)] +pub struct OnlySelfBounds(pub bool); + pub trait AstConv<'tcx> { fn tcx(&self) -> TyCtxt<'tcx>; @@ -670,6 +673,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { args: &GenericArgs<'_>, infer_args: bool, self_ty: Ty<'tcx>, + only_self_bounds: OnlySelfBounds, ) -> GenericArgCountResult { let (substs, arg_count) = self.create_substs_for_ast_path( trait_ref_span, @@ -706,6 +710,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { &mut dup_bindings, binding_span.unwrap_or(binding.span), constness, + only_self_bounds, ); // Okay to ignore `Err` because of `ErrorGuaranteed` (see above). } @@ -741,6 +746,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { self_ty: Ty<'tcx>, bounds: &mut Bounds<'tcx>, speculative: bool, + only_self_bounds: OnlySelfBounds, ) -> GenericArgCountResult { let hir_id = trait_ref.hir_ref_id; let binding_span = None; @@ -766,6 +772,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { args, infer_args, self_ty, + only_self_bounds, ) } @@ -777,6 +784,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { args: &GenericArgs<'_>, self_ty: Ty<'tcx>, bounds: &mut Bounds<'tcx>, + only_self_bounds: OnlySelfBounds, ) { let binding_span = Some(span); let constness = ty::BoundConstness::NotConst; @@ -799,6 +807,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { args, infer_args, self_ty, + only_self_bounds, ); } @@ -947,6 +956,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ast_bounds: I, bounds: &mut Bounds<'tcx>, bound_vars: &'tcx ty::List, + only_self_bounds: OnlySelfBounds, ) { for ast_bound in ast_bounds { match ast_bound { @@ -964,11 +974,18 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { param_ty, bounds, false, + only_self_bounds, ); } &hir::GenericBound::LangItemTrait(lang_item, span, hir_id, args) => { self.instantiate_lang_item_trait_ref( - lang_item, span, hir_id, args, param_ty, bounds, + lang_item, + span, + hir_id, + args, + param_ty, + bounds, + only_self_bounds, ); } hir::GenericBound::Outlives(lifetime) => { @@ -1006,8 +1023,19 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { &self, param_ty: Ty<'tcx>, ast_bounds: &[hir::GenericBound<'_>], + only_self_bounds: OnlySelfBounds, ) -> Bounds<'tcx> { - self.compute_bounds_inner(param_ty, ast_bounds) + let mut bounds = Bounds::default(); + self.add_bounds( + param_ty, + ast_bounds.iter(), + &mut bounds, + ty::List::empty(), + only_self_bounds, + ); + debug!(?bounds); + + bounds } /// Convert the bounds in `ast_bounds` that refer to traits which define an associated type @@ -1029,17 +1057,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } } - self.compute_bounds_inner(param_ty, &result) - } - - fn compute_bounds_inner( - &self, - param_ty: Ty<'tcx>, - ast_bounds: &[hir::GenericBound<'_>], - ) -> Bounds<'tcx> { let mut bounds = Bounds::default(); - - self.add_bounds(param_ty, ast_bounds.iter(), &mut bounds, ty::List::empty()); + self.add_bounds( + param_ty, + result.iter(), + &mut bounds, + ty::List::empty(), + OnlySelfBounds(true), + ); debug!(?bounds); bounds @@ -1062,6 +1087,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { dup_bindings: &mut FxHashMap, path_span: Span, constness: ty::BoundConstness, + only_self_bounds: OnlySelfBounds, ) -> Result<(), ErrorGuaranteed> { // Given something like `U: SomeTrait`, we want to produce a // predicate like `::T = X`. This is somewhat @@ -1142,9 +1168,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { tcx.sess .struct_span_err( binding.span, - &format!("{} `{}` is private", assoc_item.kind, binding.item_name), + format!("{} `{}` is private", assoc_item.kind, binding.item_name), ) - .span_label(binding.span, &format!("private {}", assoc_item.kind)) + .span_label(binding.span, format!("private {}", assoc_item.kind)) .emit(); } tcx.check_stability(assoc_item.def_id, Some(hir_ref_id), binding.span, None); @@ -1316,11 +1342,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let expected = tcx.def_descr(assoc_item_def_id); let mut err = tcx.sess.struct_span_err( binding.span, - &format!("expected {expected} bound, found {got}"), + format!("expected {expected} bound, found {got}"), ); err.span_note( tcx.def_span(assoc_item_def_id), - &format!("{expected} defined here"), + format!("{expected} defined here"), ); if let hir::def::DefKind::AssocConst = def_kind @@ -1361,8 +1387,20 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { // // Calling `skip_binder` is okay, because `add_bounds` expects the `param_ty` // parameter to have a skipped binder. - let param_ty = tcx.mk_alias(ty::Projection, projection_ty.skip_binder()); - self.add_bounds(param_ty, ast_bounds.iter(), bounds, projection_ty.bound_vars()); + // + // NOTE: If `only_self_bounds` is true, do NOT expand this associated + // type bound into a trait predicate, since we only want to add predicates + // for the `Self` type. + if !only_self_bounds.0 { + let param_ty = tcx.mk_alias(ty::Projection, projection_ty.skip_binder()); + self.add_bounds( + param_ty, + ast_bounds.iter(), + bounds, + projection_ty.bound_vars(), + only_self_bounds, + ); + } } } Ok(()) @@ -1403,6 +1441,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { dummy_self, &mut bounds, false, + // FIXME: This should be `true`, but we don't really handle + // associated type bounds or type aliases in objects in a way + // that makes this meaningful, I think. + OnlySelfBounds(false), ) { potential_assoc_types.extend(cur_potential_assoc_types); } @@ -1466,7 +1508,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { "additional use", ); first_trait.label_with_exp_info(&mut err, "first non-auto trait", "first use"); - err.help(&format!( + err.help(format!( "consider creating a new trait with all of these as supertraits and using that \ trait here instead: `trait NewTrait: {} {{}}`", regular_traits @@ -1776,7 +1818,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ([], []) => { err.span_suggestion_verbose( span, - &format!( + format!( "if there were a type named `Type` that implements a trait named \ `Trait` with associated type `{name}`, you could use the \ fully-qualified path", @@ -1788,7 +1830,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ([], [trait_str]) => { err.span_suggestion_verbose( span, - &format!( + format!( "if there were a type named `Example` that implemented `{trait_str}`, \ you could use the fully-qualified path", ), @@ -1799,7 +1841,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ([], traits) => { err.span_suggestions( span, - &format!( + format!( "if there were a type named `Example` that implemented one of the \ traits with associated type `{name}`, you could use the \ fully-qualified path", @@ -1814,7 +1856,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ([type_str], []) => { err.span_suggestion_verbose( span, - &format!( + format!( "if there were a trait named `Example` with associated type `{name}` \ implemented for `{type_str}`, you could use the fully-qualified path", ), @@ -1825,7 +1867,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { (types, []) => { err.span_suggestions( span, - &format!( + format!( "if there were a trait named `Example` with associated type `{name}` \ implemented for one of the types, you could use the fully-qualified \ path", @@ -1991,7 +2033,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { ); } } else { - err.note(&format!( + err.note(format!( "associated type `{}` could derive from `{}`", ty_param_name, bound.print_only_trait_path(), @@ -1999,7 +2041,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } } if !where_bounds.is_empty() { - err.help(&format!( + err.help(format!( "consider introducing a new type parameter `T` and adding `where` constraints:\ \n where\n T: {},\n{}", ty_param_name, @@ -2067,14 +2109,14 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { // work for the `enum`, instead of just looking if it takes *any*. err.span_suggestion_verbose( args_span, - &format!("{type_name} doesn't have generic parameters"), + format!("{type_name} doesn't have generic parameters"), "", Applicability::MachineApplicable, ); return; } let Ok(snippet) = tcx.sess.source_map().span_to_snippet(args_span) else { - err.note(&msg); + err.note(msg); return; }; let (qself_sugg_span, is_self) = if let hir::TyKind::Path( @@ -2108,12 +2150,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { kw::SelfUpper == segment.ident.name, ), _ => { - err.note(&msg); + err.note(msg); return; } } } else { - err.note(&msg); + err.note(msg); return; }; let suggestion = vec![ @@ -2128,7 +2170,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { (args_span, String::new()), ]; err.multipart_suggestion_verbose( - &msg, + msg, suggestion, Applicability::MaybeIncorrect, ); @@ -2180,7 +2222,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let reported = if variant_resolution.is_some() { // Variant in type position let msg = format!("expected type, found variant `{}`", assoc_ident); - tcx.sess.span_err(span, &msg) + tcx.sess.span_err(span, msg) } else if qself_ty.is_enum() { let mut err = struct_span_err!( tcx.sess, @@ -2251,7 +2293,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { // Assume that if it's not matched, there must be a const defined with the same name // but it was used in a type position. let msg = format!("found associated const `{assoc_ident}` when type was expected"); - let guar = tcx.sess.struct_span_err(span, &msg).emit(); + let guar = tcx.sess.struct_span_err(span, msg).emit(); return Err(guar); }; @@ -2271,7 +2313,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { also, tcx.def_kind_descr(kind, def_id) ); - lint.span_note(tcx.def_span(def_id), ¬e_msg); + lint.span_note(tcx.def_span(def_id), note_msg); }; could_refer_to(DefKind::Variant, variant_def_id, ""); @@ -2468,9 +2510,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let msg = format!("{kind} `{name}` is private"); let def_span = tcx.def_span(item); tcx.sess - .struct_span_err_with_code(span, &msg, rustc_errors::error_code!(E0624)) - .span_label(span, &format!("private {kind}")) - .span_label(def_span, &format!("{kind} defined here")) + .struct_span_err_with_code(span, msg, rustc_errors::error_code!(E0624)) + .span_label(span, format!("private {kind}")) + .span_label(def_span, format!("{kind} defined here")) .emit(); } tcx.check_stability(item, Some(block), span, None); @@ -2918,7 +2960,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { self.prohibit_generics(path.segments.iter(), |err| { if let Some(span) = tcx.def_ident_span(def_id) { let name = tcx.item_name(def_id); - err.span_note(span, &format!("type parameter `{name}` defined here")); + err.span_note(span, format!("type parameter `{name}` defined here")); } }); @@ -2979,7 +3021,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let mut span: MultiSpan = vec![t_sp].into(); span.push_span_label( i_sp, - &format!("`Self` is on type `{type_name}` in this `impl`"), + format!("`Self` is on type `{type_name}` in this `impl`"), ); let mut postfix = ""; if generics == 0 { @@ -2987,11 +3029,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } span.push_span_label( t_sp, - &format!("`Self` corresponds to this type{postfix}"), + format!("`Self` corresponds to this type{postfix}"), ); - err.span_note(span, &msg); + err.span_note(span, msg); } else { - err.note(&msg); + err.note(msg); } for segment in path.segments { if let Some(args) = segment.args && segment.ident.name == kw::SelfUpper { @@ -3082,7 +3124,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if let Some(args) = segment.args { err.span_suggestion_verbose( segment.ident.span.shrink_to_hi().to(args.span_ext), - &format!("primitive type `{name}` doesn't have generic parameters"), + format!("primitive type `{name}` doesn't have generic parameters"), "", Applicability::MaybeIncorrect, ); @@ -3373,7 +3415,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if !infer_replacements.is_empty() { diag.multipart_suggestion( - &format!( + format!( "try replacing `_` with the type{} in the corresponding trait method signature", rustc_errors::pluralize!(infer_replacements.len()), ), diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs index 68e957f9d8e3a..61b66ae2593be 100644 --- a/compiler/rustc_hir_analysis/src/check/check.rs +++ b/compiler/rustc_hir_analysis/src/check/check.rs @@ -175,7 +175,7 @@ fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) { } // Generic statics are rejected, but we still reach this case. Err(e) => { - tcx.sess.delay_span_bug(span, &e.to_string()); + tcx.sess.delay_span_bug(span, e.to_string()); return; } }; @@ -334,7 +334,7 @@ pub(super) fn check_opaque_for_inheriting_lifetimes( &tcx.sess.parse_sess, sym::impl_trait_projections, span, - &format!( + format!( "`{}` return type cannot contain a projection or `Self` that references \ lifetimes from a parent scope", if is_async { "async fn" } else { "impl Trait" }, @@ -428,7 +428,7 @@ fn check_opaque_meets_bounds<'tcx>( let ty_err = ty_err.to_string(tcx); tcx.sess.delay_span_bug( span, - &format!("could not unify `{hidden_ty}` with revealed type:\n{ty_err}"), + format!("could not unify `{hidden_ty}` with revealed type:\n{ty_err}"), ); } } @@ -618,11 +618,11 @@ fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) { E0044, "foreign items may not have {kinds} parameters", ) - .span_label(item.span, &format!("can't have {kinds} parameters")) + .span_label(item.span, format!("can't have {kinds} parameters")) .help( // FIXME: once we start storing spans for type arguments, turn this // into a suggestion. - &format!( + format!( "replace the {} parameters with concrete {}{}", kinds, kinds_pl, @@ -985,10 +985,7 @@ pub(super) fn check_packed(tcx: TyCtxt<'_>, sp: Span, def: ty::AdtDef<'_>) { err.span_note( tcx.def_span(def_spans[0].0), - &format!( - "`{}` has a `#[repr(align)]` attribute", - tcx.item_name(def_spans[0].0) - ), + format!("`{}` has a `#[repr(align)]` attribute", tcx.item_name(def_spans[0].0)), ); if def_spans.len() > 2 { @@ -997,7 +994,7 @@ pub(super) fn check_packed(tcx: TyCtxt<'_>, sp: Span, def: ty::AdtDef<'_>) { let ident = tcx.item_name(*adt_def); err.span_note( *span, - &if first { + if first { format!( "`{}` contains a field of type `{}`", tcx.type_of(def.did()).subst_identity(), @@ -1466,10 +1463,10 @@ fn opaque_type_cycle_error( let ty_span = tcx.def_span(def_id); if !seen.contains(&ty_span) { let descr = if ty.is_impl_trait() { "opaque " } else { "" }; - err.span_label(ty_span, &format!("returning this {descr}type `{ty}`")); + err.span_label(ty_span, format!("returning this {descr}type `{ty}`")); seen.insert(ty_span); } - err.span_label(sp, &format!("returning here with type `{ty}`")); + err.span_label(sp, format!("returning here with type `{ty}`")); } for closure_def_id in visitor.closures { diff --git a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs index 48214b899a4b8..7384eb25f2ef7 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -1273,7 +1273,7 @@ fn compare_number_of_generics<'tcx>( let mut err = tcx.sess.struct_span_err_with_code( spans, - &format!( + format!( "{} `{}` has {} {kind} parameter{} but its trait \ declaration has {} {kind} parameter{}", item_kind, diff --git a/compiler/rustc_hir_analysis/src/check/dropck.rs b/compiler/rustc_hir_analysis/src/check/dropck.rs index 111bf5e545552..64dff8e68b852 100644 --- a/compiler/rustc_hir_analysis/src/check/dropck.rs +++ b/compiler/rustc_hir_analysis/src/check/dropck.rs @@ -52,7 +52,7 @@ pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), Erro let span = tcx.def_span(drop_impl_did); let reported = tcx.sess.delay_span_bug( span, - &format!("should have been rejected by coherence check: {dtor_self_type}"), + format!("should have been rejected by coherence check: {dtor_self_type}"), ); Err(reported) } @@ -76,15 +76,15 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>( struct_span_err!(tcx.sess, drop_impl_span, E0366, "`Drop` impls cannot be specialized"); match arg { ty::util::NotUniqueParam::DuplicateParam(arg) => { - err.note(&format!("`{arg}` is mentioned multiple times")) + err.note(format!("`{arg}` is mentioned multiple times")) } ty::util::NotUniqueParam::NotParam(arg) => { - err.note(&format!("`{arg}` is not a generic parameter")) + err.note(format!("`{arg}` is not a generic parameter")) } }; err.span_note( item_span, - &format!( + format!( "use the same sequence of generic lifetime, type and const parameters \ as the {self_descr} definition", ), diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index 6a10b50aa16ea..e8785235c8318 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -547,14 +547,14 @@ pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) Err(_) => { let msg = format!("unrecognized platform-specific intrinsic function: `{name}`"); - tcx.sess.struct_span_err(it.span, &msg).emit(); + tcx.sess.struct_span_err(it.span, msg).emit(); return; } } } _ => { let msg = format!("unrecognized platform-specific intrinsic function: `{name}`"); - tcx.sess.struct_span_err(it.span, &msg).emit(); + tcx.sess.struct_span_err(it.span, msg).emit(); return; } }; diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs index a28814681dbf6..0bb1467ef3170 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs @@ -130,7 +130,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { _ => None, }; let Some(asm_ty) = asm_ty else { - let msg = &format!("cannot use value of type `{ty}` for inline assembly"); + let msg = format!("cannot use value of type `{ty}` for inline assembly"); let mut err = self.tcx.sess.struct_span_err(expr.span, msg); err.note( "only integers, floats, SIMD vectors, pointers and function pointers \ @@ -145,7 +145,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { if !ty.is_copy_modulo_regions(self.tcx, self.param_env) { let msg = "arguments for inline assembly must be copyable"; let mut err = self.tcx.sess.struct_span_err(expr.span, msg); - err.note(&format!("`{ty}` does not implement the Copy trait")); + err.note(format!("`{ty}` does not implement the Copy trait")); err.emit(); } @@ -164,8 +164,8 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { let mut err = self.tcx.sess.struct_span_err(vec![in_expr.span, expr.span], msg); let in_expr_ty = (self.get_operand_ty)(in_expr); - err.span_label(in_expr.span, &format!("type `{in_expr_ty}`")); - err.span_label(expr.span, &format!("type `{ty}`")); + err.span_label(in_expr.span, format!("type `{in_expr_ty}`")); + err.span_label(expr.span, format!("type `{ty}`")); err.note( "asm inout arguments must have the same type, \ unless they are both pointers or integers of the same size", @@ -184,17 +184,17 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { let reg_class = reg.reg_class(); let supported_tys = reg_class.supported_types(asm_arch); let Some((_, feature)) = supported_tys.iter().find(|&&(t, _)| t == asm_ty) else { - let msg = &format!("type `{ty}` cannot be used with this register class"); + let msg = format!("type `{ty}` cannot be used with this register class"); let mut err = self.tcx.sess.struct_span_err(expr.span, msg); let supported_tys: Vec<_> = supported_tys.iter().map(|(t, _)| t.to_string()).collect(); - err.note(&format!( + err.note(format!( "register class `{}` supports these types: {}", reg_class.name(), supported_tys.join(", "), )); if let Some(suggest) = reg_class.suggest_class(asm_arch, asm_ty) { - err.help(&format!( + err.help(format!( "consider using the `{}` register class instead", suggest.name() )); @@ -215,9 +215,9 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { // register class is usable at all. if let Some(feature) = feature { if !target_features.contains(feature) { - let msg = &format!("`{}` target feature is not enabled", feature); + let msg = format!("`{}` target feature is not enabled", feature); let mut err = self.tcx.sess.struct_span_err(expr.span, msg); - err.note(&format!( + err.note(format!( "this is required to use type `{}` with register class `{}`", ty, reg_class.name(), @@ -252,10 +252,10 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { "formatting may not be suitable for sub-register argument", |lint| { lint.span_label(expr.span, "for this argument"); - lint.help(&format!( + lint.help(format!( "use `{{{idx}:{suggested_modifier}}}` to have the register formatted as `{suggested_result}`", )); - lint.help(&format!( + lint.help(format!( "or use `{{{idx}:{default_modifier}}}` to keep the default formatting of `{default_result}`", )); lint @@ -301,7 +301,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { op.is_clobber(), ) { let msg = format!("cannot use register `{}`: {}", reg.name(), msg); - self.tcx.sess.struct_span_err(*op_sp, &msg).emit(); + self.tcx.sess.struct_span_err(*op_sp, msg).emit(); continue; } } @@ -340,7 +340,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { reg_class.name(), feature ); - self.tcx.sess.struct_span_err(*op_sp, &msg).emit(); + self.tcx.sess.struct_span_err(*op_sp, msg).emit(); // register isn't enabled, don't do more checks continue; } @@ -354,7 +354,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { .intersperse(", ") .collect::(), ); - self.tcx.sess.struct_span_err(*op_sp, &msg).emit(); + self.tcx.sess.struct_span_err(*op_sp, msg).emit(); // register isn't enabled, don't do more checks continue; } @@ -436,7 +436,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { self.tcx.sess.struct_span_err(*op_sp, "invalid `sym` operand"); err.span_label( self.tcx.def_span(anon_const.def_id), - &format!("is {} `{}`", ty.kind().article(), ty), + format!("is {} `{}`", ty.kind().article(), ty), ); err.help("`sym` operands must refer to either a function or a static"); err.emit(); diff --git a/compiler/rustc_hir_analysis/src/check/wfcheck.rs b/compiler/rustc_hir_analysis/src/check/wfcheck.rs index c066c39676662..33c47da531e5e 100644 --- a/compiler/rustc_hir_analysis/src/check/wfcheck.rs +++ b/compiler/rustc_hir_analysis/src/check/wfcheck.rs @@ -445,7 +445,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe let plural = pluralize!(unsatisfied_bounds.len()); let mut err = tcx.sess.struct_span_err( gat_item_hir.span, - &format!("missing required bound{} on `{}`", plural, gat_item_hir.ident), + format!("missing required bound{} on `{}`", plural, gat_item_hir.ident), ); let suggestion = format!( @@ -455,14 +455,14 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, associated_items: &[hir::TraitItemRe ); err.span_suggestion( gat_item_hir.generics.tail_span_for_predicate_suggestion(), - &format!("add the required where clause{plural}"), + format!("add the required where clause{plural}"), suggestion, Applicability::MachineApplicable, ); let bound = if unsatisfied_bounds.len() > 1 { "these bounds are" } else { "this bound is" }; - err.note(&format!( + err.note(format!( "{} currently required to ensure that impls have maximum flexibility", bound )); @@ -916,14 +916,14 @@ fn check_param_wf(tcx: TyCtxt<'_>, param: &hir::GenericParam<'_>) { if is_ptr { tcx.sess.span_err( hir_ty.span, - &format!( + format!( "using {unsupported_type} as const generic parameters is forbidden", ), ); } else { let mut err = tcx.sess.struct_span_err( hir_ty.span, - &format!( + format!( "{unsupported_type} is forbidden as the type of a const generic parameter", ), ); @@ -1029,7 +1029,7 @@ fn check_type_defn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item<'tcx>, all_sized: b let ty = tcx.erase_regions(ty); if ty.has_infer() { tcx.sess - .delay_span_bug(item.span, &format!("inference variables in {:?}", ty)); + .delay_span_bug(item.span, format!("inference variables in {:?}", ty)); // Just treat unresolved type expression as if it needs drop. true } else { @@ -1651,7 +1651,7 @@ fn check_method_receiver<'tcx>( &tcx.sess.parse_sess, sym::arbitrary_self_types, span, - &format!( + format!( "`{receiver_ty}` cannot be used as the type of `self` without \ the `arbitrary_self_types` feature", ), @@ -1874,10 +1874,10 @@ fn report_bivariance( } else { format!("consider removing `{param_name}` or referring to it in a field") }; - err.help(&msg); + err.help(msg); if matches!(param.kind, hir::GenericParamKind::Type { .. }) && !has_explicit_bounds { - err.help(&format!( + err.help(format!( "if you intended `{0}` to be a const parameter, use `const {0}: usize` instead", param_name )); diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 611ce13b739c2..3982b3531050a 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -1,9 +1,11 @@ //! Check properties that are required by built-in traits and set //! up data structures required by type-checking/codegen. -use crate::errors::{CopyImplOnNonAdt, CopyImplOnTypeWithDtor, DropImplOnWrongItem}; +use crate::errors::{ + ConstParamTyImplOnNonAdt, CopyImplOnNonAdt, CopyImplOnTypeWithDtor, DropImplOnWrongItem, +}; use rustc_data_structures::fx::FxHashSet; -use rustc_errors::{struct_span_err, MultiSpan}; +use rustc_errors::{struct_span_err, ErrorGuaranteed, MultiSpan}; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::lang_items::LangItem; @@ -14,9 +16,11 @@ use rustc_infer::infer::{DefineOpaqueTypes, TyCtxtInferExt}; use rustc_infer::traits::Obligation; use rustc_middle::ty::adjustment::CoerceUnsizedInfo; use rustc_middle::ty::{self, suggest_constraining_type_params, Ty, TyCtxt, TypeVisitableExt}; +use rustc_span::Span; use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt; use rustc_trait_selection::traits::misc::{ - type_allowed_to_implement_copy, CopyImplementationError, InfringingFieldsReason, + type_allowed_to_implement_const_param_ty, type_allowed_to_implement_copy, + ConstParamTyImplementationError, CopyImplementationError, InfringingFieldsReason, }; use rustc_trait_selection::traits::ObligationCtxt; use rustc_trait_selection::traits::{self, ObligationCause}; @@ -27,6 +31,7 @@ pub fn check_trait(tcx: TyCtxt<'_>, trait_def_id: DefId) { Checker { tcx, trait_def_id } .check(lang_items.drop_trait(), visit_implementation_of_drop) .check(lang_items.copy_trait(), visit_implementation_of_copy) + .check(lang_items.const_param_ty_trait(), visit_implementation_of_const_param_ty) .check(lang_items.coerce_unsized_trait(), visit_implementation_of_coerce_unsized) .check(lang_items.dispatch_from_dyn_trait(), visit_implementation_of_dispatch_from_dyn); } @@ -83,110 +88,7 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) { match type_allowed_to_implement_copy(tcx, param_env, self_type, cause) { Ok(()) => {} Err(CopyImplementationError::InfringingFields(fields)) => { - let mut err = struct_span_err!( - tcx.sess, - span, - E0204, - "the trait `Copy` cannot be implemented for this type" - ); - - // We'll try to suggest constraining type parameters to fulfill the requirements of - // their `Copy` implementation. - let mut errors: BTreeMap<_, Vec<_>> = Default::default(); - let mut bounds = vec![]; - - let mut seen_tys = FxHashSet::default(); - - for (field, ty, reason) in fields { - // Only report an error once per type. - if !seen_tys.insert(ty) { - continue; - } - - let field_span = tcx.def_span(field.did); - err.span_label(field_span, "this field does not implement `Copy`"); - - match reason { - InfringingFieldsReason::Fulfill(fulfillment_errors) => { - for error in fulfillment_errors { - let error_predicate = error.obligation.predicate; - // Only note if it's not the root obligation, otherwise it's trivial and - // should be self-explanatory (i.e. a field literally doesn't implement Copy). - - // FIXME: This error could be more descriptive, especially if the error_predicate - // contains a foreign type or if it's a deeply nested type... - if error_predicate != error.root_obligation.predicate { - errors - .entry((ty.to_string(), error_predicate.to_string())) - .or_default() - .push(error.obligation.cause.span); - } - if let ty::PredicateKind::Clause(ty::Clause::Trait( - ty::TraitPredicate { - trait_ref, - polarity: ty::ImplPolarity::Positive, - .. - }, - )) = error_predicate.kind().skip_binder() - { - let ty = trait_ref.self_ty(); - if let ty::Param(_) = ty.kind() { - bounds.push(( - format!("{ty}"), - trait_ref.print_only_trait_path().to_string(), - Some(trait_ref.def_id), - )); - } - } - } - } - InfringingFieldsReason::Regions(region_errors) => { - for error in region_errors { - let ty = ty.to_string(); - match error { - RegionResolutionError::ConcreteFailure(origin, a, b) => { - let predicate = format!("{b}: {a}"); - errors - .entry((ty.clone(), predicate.clone())) - .or_default() - .push(origin.span()); - if let ty::RegionKind::ReEarlyBound(ebr) = *b && ebr.has_name() { - bounds.push((b.to_string(), a.to_string(), None)); - } - } - RegionResolutionError::GenericBoundFailure(origin, a, b) => { - let predicate = format!("{a}: {b}"); - errors - .entry((ty.clone(), predicate.clone())) - .or_default() - .push(origin.span()); - if let infer::region_constraints::GenericKind::Param(_) = a { - bounds.push((a.to_string(), b.to_string(), None)); - } - } - _ => continue, - } - } - } - } - } - for ((ty, error_predicate), spans) in errors { - let span: MultiSpan = spans.into(); - err.span_note( - span, - &format!("the `Copy` impl for `{}` requires that `{}`", ty, error_predicate), - ); - } - suggest_constraining_type_params( - tcx, - tcx.hir().get_generics(impl_did).expect("impls always have generics"), - &mut err, - bounds.iter().map(|(param, constraint, def_id)| { - (param.as_str(), constraint.as_str(), *def_id) - }), - None, - ); - err.emit(); + infringing_fields_error(tcx, fields, LangItem::Copy, impl_did, span); } Err(CopyImplementationError::NotAnAdt) => { tcx.sess.emit_err(CopyImplOnNonAdt { span }); @@ -197,6 +99,29 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) { } } +fn visit_implementation_of_const_param_ty(tcx: TyCtxt<'_>, impl_did: LocalDefId) { + let self_type = tcx.type_of(impl_did).subst_identity(); + assert!(!self_type.has_escaping_bound_vars()); + + let param_env = tcx.param_env(impl_did); + + let span = match tcx.hir().expect_item(impl_did).expect_impl() { + hir::Impl { polarity: hir::ImplPolarity::Negative(_), .. } => return, + impl_ => impl_.self_ty.span, + }; + + let cause = traits::ObligationCause::misc(span, impl_did); + match type_allowed_to_implement_const_param_ty(tcx, param_env, self_type, cause) { + Ok(()) => {} + Err(ConstParamTyImplementationError::InfrigingFields(fields)) => { + infringing_fields_error(tcx, fields, LangItem::ConstParamTy, impl_did, span); + } + Err(ConstParamTyImplementationError::NotAnAdtOrBuiltinAllowed) => { + tcx.sess.emit_err(ConstParamTyImplOnNonAdt { span }); + } + } +} + fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'_>, impl_did: LocalDefId) { debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did); @@ -288,7 +213,7 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef for structs containing the field being coerced, \ ZST fields with 1 byte alignment, and nothing else", ) - .note(&format!( + .note(format!( "extra field `{}` of type `{}` is not allowed", field.name, ty_a, )) @@ -316,7 +241,7 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDef for a coercion between structures with a single field \ being coerced", ) - .note(&format!( + .note(format!( "currently, {} fields need coercions: {}", coerced_fields.len(), coerced_fields @@ -373,7 +298,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) -> Coe let coerce_unsized_trait = tcx.require_lang_item(LangItem::CoerceUnsized, Some(span)); let unsize_trait = tcx.lang_items().require(LangItem::Unsize).unwrap_or_else(|err| { - tcx.sess.fatal(&format!("`CoerceUnsized` implementation {}", err.to_string())); + tcx.sess.fatal(format!("`CoerceUnsized` implementation {}", err.to_string())); }); let source = tcx.type_of(impl_did).subst_identity(); @@ -544,7 +469,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) -> Coe "`CoerceUnsized` may only be implemented for \ a coercion between structures with one field being coerced", ) - .note(&format!( + .note(format!( "currently, {} fields need coercions: {}", diff_fields.len(), diff_fields @@ -593,3 +518,119 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) -> Coe CoerceUnsizedInfo { custom_kind: kind } } + +fn infringing_fields_error( + tcx: TyCtxt<'_>, + fields: Vec<(&ty::FieldDef, Ty<'_>, InfringingFieldsReason<'_>)>, + lang_item: LangItem, + impl_did: LocalDefId, + impl_span: Span, +) -> ErrorGuaranteed { + let trait_did = tcx.require_lang_item(lang_item, Some(impl_span)); + + let trait_name = tcx.def_path_str(trait_did); + + let mut err = struct_span_err!( + tcx.sess, + impl_span, + E0204, + "the trait `{trait_name}` cannot be implemented for this type" + ); + + // We'll try to suggest constraining type parameters to fulfill the requirements of + // their `Copy` implementation. + let mut errors: BTreeMap<_, Vec<_>> = Default::default(); + let mut bounds = vec![]; + + let mut seen_tys = FxHashSet::default(); + + for (field, ty, reason) in fields { + // Only report an error once per type. + if !seen_tys.insert(ty) { + continue; + } + + let field_span = tcx.def_span(field.did); + err.span_label(field_span, format!("this field does not implement `{trait_name}`")); + + match reason { + InfringingFieldsReason::Fulfill(fulfillment_errors) => { + for error in fulfillment_errors { + let error_predicate = error.obligation.predicate; + // Only note if it's not the root obligation, otherwise it's trivial and + // should be self-explanatory (i.e. a field literally doesn't implement Copy). + + // FIXME: This error could be more descriptive, especially if the error_predicate + // contains a foreign type or if it's a deeply nested type... + if error_predicate != error.root_obligation.predicate { + errors + .entry((ty.to_string(), error_predicate.to_string())) + .or_default() + .push(error.obligation.cause.span); + } + if let ty::PredicateKind::Clause(ty::Clause::Trait(ty::TraitPredicate { + trait_ref, + polarity: ty::ImplPolarity::Positive, + .. + })) = error_predicate.kind().skip_binder() + { + let ty = trait_ref.self_ty(); + if let ty::Param(_) = ty.kind() { + bounds.push(( + format!("{ty}"), + trait_ref.print_only_trait_path().to_string(), + Some(trait_ref.def_id), + )); + } + } + } + } + InfringingFieldsReason::Regions(region_errors) => { + for error in region_errors { + let ty = ty.to_string(); + match error { + RegionResolutionError::ConcreteFailure(origin, a, b) => { + let predicate = format!("{b}: {a}"); + errors + .entry((ty.clone(), predicate.clone())) + .or_default() + .push(origin.span()); + if let ty::RegionKind::ReEarlyBound(ebr) = *b && ebr.has_name() { + bounds.push((b.to_string(), a.to_string(), None)); + } + } + RegionResolutionError::GenericBoundFailure(origin, a, b) => { + let predicate = format!("{a}: {b}"); + errors + .entry((ty.clone(), predicate.clone())) + .or_default() + .push(origin.span()); + if let infer::region_constraints::GenericKind::Param(_) = a { + bounds.push((a.to_string(), b.to_string(), None)); + } + } + _ => continue, + } + } + } + } + } + for ((ty, error_predicate), spans) in errors { + let span: MultiSpan = spans.into(); + err.span_note( + span, + format!("the `{trait_name}` impl for `{ty}` requires that `{error_predicate}`"), + ); + } + suggest_constraining_type_params( + tcx, + tcx.hir().get_generics(impl_did).expect("impls always have generics"), + &mut err, + bounds + .iter() + .map(|(param, constraint, def_id)| (param.as_str(), constraint.as_str(), *def_id)), + None, + ); + + err.emit() +} diff --git a/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs b/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs index 3d37e0ce0c69b..3355902069248 100644 --- a/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs +++ b/compiler/rustc_hir_analysis/src/coherence/inherent_impls.rs @@ -146,7 +146,7 @@ impl<'tcx> InherentCollect<'tcx> { ); err.help("consider using an extension trait instead"); if let ty::Ref(_, subty, _) = ty.kind() { - err.note(&format!( + err.note(format!( "you could also try moving the reference to \ uses of `{}` (such as `self`) within the implementation", subty diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index 89175c0ef7450..5ce8a83aad7f7 100644 --- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs +++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs @@ -372,10 +372,10 @@ fn emit_orphan_check_error<'tcx>( if is_target_ty { // Point at `D` in `impl for C in D` - err.span_label(self_ty_span, &msg); + err.span_label(self_ty_span, msg); } else { // Point at `C` in `impl for C in D` - err.span_label(trait_span, &msg); + err.span_label(trait_span, msg); } } err.note("define and implement a trait or new type instead"); @@ -531,15 +531,15 @@ fn lint_auto_trait_impl<'tcx>( let self_descr = tcx.def_descr(self_type_did); match arg { ty::util::NotUniqueParam::DuplicateParam(arg) => { - lint.note(&format!("`{}` is mentioned multiple times", arg)); + lint.note(format!("`{}` is mentioned multiple times", arg)); } ty::util::NotUniqueParam::NotParam(arg) => { - lint.note(&format!("`{}` is not a generic parameter", arg)); + lint.note(format!("`{}` is not a generic parameter", arg)); } } lint.span_note( item_span, - &format!( + format!( "try using the same sequence of generic parameters as the {} definition", self_descr, ), diff --git a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs index 80d6bc7db9e8f..948b903e509ad 100644 --- a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs +++ b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs @@ -1,5 +1,5 @@ use super::ItemCtxt; -use crate::astconv::AstConv; +use crate::astconv::{AstConv, OnlySelfBounds}; use rustc_hir as hir; use rustc_infer::traits::util; use rustc_middle::ty::subst::InternalSubsts; @@ -26,7 +26,7 @@ fn associated_type_bounds<'tcx>( ); let icx = ItemCtxt::new(tcx, assoc_item_def_id); - let mut bounds = icx.astconv().compute_bounds(item_ty, ast_bounds); + let mut bounds = icx.astconv().compute_bounds(item_ty, ast_bounds, OnlySelfBounds(false)); // Associated types are implicitly sized unless a `?Sized` bound is found icx.astconv().add_implicitly_sized(&mut bounds, item_ty, ast_bounds, None, span); @@ -67,7 +67,7 @@ fn opaque_type_bounds<'tcx>( ) -> &'tcx [(ty::Predicate<'tcx>, Span)] { ty::print::with_no_queries!({ let icx = ItemCtxt::new(tcx, opaque_def_id); - let mut bounds = icx.astconv().compute_bounds(item_ty, ast_bounds); + let mut bounds = icx.astconv().compute_bounds(item_ty, ast_bounds, OnlySelfBounds(false)); // Opaque types are implicitly sized unless a `?Sized` bound is found icx.astconv().add_implicitly_sized(&mut bounds, item_ty, ast_bounds, None, span); debug!(?bounds); diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 8c414521b7653..83470342a7660 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -1,4 +1,4 @@ -use crate::astconv::AstConv; +use crate::astconv::{AstConv, OnlySelfBounds}; use crate::bounds::Bounds; use crate::collect::ItemCtxt; use crate::constrained_generic_params as cgp; @@ -14,9 +14,6 @@ use rustc_middle::ty::{GenericPredicates, ToPredicate}; use rustc_span::symbol::{sym, Ident}; use rustc_span::{Span, DUMMY_SP}; -#[derive(Debug)] -struct OnlySelfBounds(bool); - /// Returns a list of all type predicates (explicit and implicit) for the definition with /// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus /// `Self: Trait` predicates for traits. @@ -99,8 +96,9 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen | ItemKind::Struct(_, generics) | ItemKind::Union(_, generics) => generics, - ItemKind::Trait(_, _, generics, ..) | ItemKind::TraitAlias(generics, _) => { - is_trait = Some(ty::TraitRef::identity(tcx, def_id.to_def_id())); + ItemKind::Trait(_, _, generics, self_bounds, ..) + | ItemKind::TraitAlias(generics, self_bounds) => { + is_trait = Some(self_bounds); generics } ItemKind::OpaqueTy(OpaqueTy { generics, .. }) => generics, @@ -122,10 +120,14 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen // Below we'll consider the bounds on the type parameters (including `Self`) // and the explicit where-clauses, but to get the full set of predicates - // on a trait we need to add in the supertrait bounds and bounds found on - // associated types. - if let Some(_trait_ref) = is_trait { - predicates.extend(tcx.implied_predicates_of(def_id).predicates.iter().cloned()); + // on a trait we must also consider the bounds that follow the trait's name, + // like `trait Foo: A + B + C`. + if let Some(self_bounds) = is_trait { + predicates.extend( + icx.astconv() + .compute_bounds(tcx.types.self_param, self_bounds, OnlySelfBounds(false)) + .predicates(), + ); } // In default impls, we can assume that the self type implements @@ -225,7 +227,13 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen } let mut bounds = Bounds::default(); - icx.astconv().add_bounds(ty, bound_pred.bounds.iter(), &mut bounds, bound_vars); + icx.astconv().add_bounds( + ty, + bound_pred.bounds.iter(), + &mut bounds, + bound_vars, + OnlySelfBounds(false), + ); predicates.extend(bounds.predicates()); } @@ -608,7 +616,7 @@ pub(super) fn implied_predicates_with_filter( let (superbounds, where_bounds_that_match) = match filter { PredicateFilter::All => ( // Convert the bounds that follow the colon (or equal in trait aliases) - icx.astconv().compute_bounds(self_param_ty, bounds), + icx.astconv().compute_bounds(self_param_ty, bounds, OnlySelfBounds(false)), // Also include all where clause bounds icx.type_parameter_bounds_in_generics( generics, @@ -620,7 +628,7 @@ pub(super) fn implied_predicates_with_filter( ), PredicateFilter::SelfOnly => ( // Convert the bounds that follow the colon (or equal in trait aliases) - icx.astconv().compute_bounds(self_param_ty, bounds), + icx.astconv().compute_bounds(self_param_ty, bounds, OnlySelfBounds(true)), // Include where clause bounds for `Self` icx.type_parameter_bounds_in_generics( generics, @@ -774,32 +782,35 @@ impl<'tcx> ItemCtxt<'tcx> { only_self_bounds: OnlySelfBounds, assoc_name: Option, ) -> Vec<(ty::Predicate<'tcx>, Span)> { - ast_generics - .predicates - .iter() - .filter_map(|wp| match wp { - hir::WherePredicate::BoundPredicate(bp) => Some(bp), - _ => None, - }) - .flat_map(|bp| { - let bt = if bp.is_param_bound(param_def_id.to_def_id()) { - Some(ty) - } else if !only_self_bounds.0 { - Some(self.to_ty(bp.bounded_ty)) - } else { - None - }; - let bvars = self.tcx.late_bound_vars(bp.hir_id); - - bp.bounds.iter().filter_map(move |b| bt.map(|bt| (bt, b, bvars))).filter( - |(_, b, _)| match assoc_name { - Some(assoc_name) => self.bound_defines_assoc_item(b, assoc_name), - None => true, - }, - ) - }) - .flat_map(|(bt, b, bvars)| predicates_from_bound(self, bt, b, bvars)) - .collect() + let mut bounds = Bounds::default(); + + for predicate in ast_generics.predicates { + let hir::WherePredicate::BoundPredicate(predicate) = predicate else { + continue; + }; + + let bound_ty = if predicate.is_param_bound(param_def_id.to_def_id()) { + ty + } else if !only_self_bounds.0 { + self.to_ty(predicate.bounded_ty) + } else { + continue; + }; + + let bound_vars = self.tcx.late_bound_vars(predicate.hir_id); + self.astconv().add_bounds( + bound_ty, + predicate.bounds.iter().filter(|bound| { + assoc_name + .map_or(true, |assoc_name| self.bound_defines_assoc_item(bound, assoc_name)) + }), + &mut bounds, + bound_vars, + only_self_bounds, + ); + } + + bounds.predicates().collect() } #[instrument(level = "trace", skip(self))] @@ -817,19 +828,3 @@ impl<'tcx> ItemCtxt<'tcx> { } } } - -/// Converts a specific `GenericBound` from the AST into a set of -/// predicates that apply to the self type. A vector is returned -/// because this can be anywhere from zero predicates (`T: ?Sized` adds no -/// predicates) to one (`T: Foo`) to many (`T: Bar` adds `T: Bar` -/// and `::X == i32`). -fn predicates_from_bound<'tcx>( - astconv: &dyn AstConv<'tcx>, - param_ty: Ty<'tcx>, - bound: &'tcx hir::GenericBound<'tcx>, - bound_vars: &'tcx ty::List, -) -> Vec<(ty::Predicate<'tcx>, Span)> { - let mut bounds = Bounds::default(); - astconv.add_bounds(param_ty, [bound].into_iter(), &mut bounds, bound_vars); - bounds.predicates().collect() -} diff --git a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs index 1c496f867a063..2e5d058c6ed4d 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -987,7 +987,7 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> { lifetime.ident ), |lint| { - let help = &format!( + let help = format!( "you can use the `'static` lifetime directly, in place of `{}`", lifetime.ident, ); @@ -1365,7 +1365,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> { self.tcx.sess.delay_span_bug( lifetime_ref.ident.span, - &format!("Could not resolve {:?} in scope {:#?}", lifetime_ref, self.scope,), + format!("Could not resolve {:?} in scope {:#?}", lifetime_ref, self.scope,), ); } diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index d7d509e5394bc..c20fbfd1e4080 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -828,14 +828,14 @@ fn infer_placeholder_type<'a>( if let Some(ty) = ty.make_suggestable(tcx, false) { err.span_suggestion( span, - &format!("provide a type for the {item}", item = kind), + format!("provide a type for the {item}", item = kind), format!("{colon} {ty}"), Applicability::MachineApplicable, ); } else { with_forced_trimmed_paths!(err.span_note( tcx.hir().body(body_id).value.span, - &format!("however, the inferred type `{ty}` cannot be named"), + format!("however, the inferred type `{ty}` cannot be named"), )); } } @@ -856,7 +856,7 @@ fn infer_placeholder_type<'a>( } else { with_forced_trimmed_paths!(diag.span_note( tcx.hir().body(body_id).value.span, - &format!("however, the inferred type `{ty}` cannot be named"), + format!("however, the inferred type `{ty}` cannot be named"), )); } } diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index f82169dee988e..25ad1bed76350 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -107,6 +107,14 @@ pub struct CopyImplOnNonAdt { pub span: Span, } +#[derive(Diagnostic)] +#[diag(hir_analysis_const_param_ty_impl_on_non_adt)] +pub struct ConstParamTyImplOnNonAdt { + #[primary_span] + #[label] + pub span: Span, +} + #[derive(Diagnostic)] #[diag(hir_analysis_trait_object_declared_with_no_traits, code = "E0224")] pub struct TraitObjectDeclaredWithNoTraits { diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check.rs b/compiler/rustc_hir_analysis/src/impl_wf_check.rs index 82a96f8e67408..f070b4f9bae73 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check.rs @@ -76,7 +76,7 @@ fn enforce_impl_params_are_constrained(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) // (#36836) tcx.sess.delay_span_bug( tcx.def_span(impl_def_id), - &format!( + format!( "potentially unconstrained type parameters weren't evaluated: {:?}", impl_self_ty, ), diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs index c09457e1d65ec..5cca2dacb5c7f 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs @@ -272,7 +272,7 @@ fn check_duplicate_params<'tcx>( if let (_, [duplicate, ..]) = base_params.partition_dedup() { let param = impl1_substs[duplicate.0 as usize]; tcx.sess - .struct_span_err(span, &format!("specializing impl repeats parameter `{}`", param)) + .struct_span_err(span, format!("specializing impl repeats parameter `{}`", param)) .emit(); } } @@ -464,7 +464,7 @@ fn check_specialization_on<'tcx>(tcx: TyCtxt<'tcx>, predicate: ty::Predicate<'tc tcx.sess .struct_span_err( span, - &format!( + format!( "cannot specialize on trait `{}`", tcx.def_path_str(trait_ref.def_id), ), @@ -479,7 +479,7 @@ fn check_specialization_on<'tcx>(tcx: TyCtxt<'tcx>, predicate: ty::Predicate<'tc tcx.sess .struct_span_err( span, - &format!("cannot specialize on associated type `{projection_ty} == {term}`",), + format!("cannot specialize on associated type `{projection_ty} == {term}`",), ) .emit(); } @@ -495,7 +495,7 @@ fn check_specialization_on<'tcx>(tcx: TyCtxt<'tcx>, predicate: ty::Predicate<'tc } _ => { tcx.sess - .struct_span_err(span, &format!("cannot specialize on predicate `{}`", predicate)) + .struct_span_err(span, format!("cannot specialize on predicate `{}`", predicate)) .emit(); } } diff --git a/compiler/rustc_hir_analysis/src/lib.rs b/compiler/rustc_hir_analysis/src/lib.rs index a4b797f77f7fe..961457b75794a 100644 --- a/compiler/rustc_hir_analysis/src/lib.rs +++ b/compiler/rustc_hir_analysis/src/lib.rs @@ -116,7 +116,7 @@ use rustc_trait_selection::traits::{self, ObligationCause, ObligationCauseCode, use std::ops::Not; -use astconv::AstConv; +use astconv::{AstConv, OnlySelfBounds}; use bounds::Bounds; fluent_messages! { "../messages.ftl" } @@ -531,6 +531,7 @@ pub fn hir_trait_to_predicates<'tcx>( self_ty, &mut bounds, true, + OnlySelfBounds(false), ); bounds diff --git a/compiler/rustc_hir_analysis/src/outlives/mod.rs b/compiler/rustc_hir_analysis/src/outlives/mod.rs index da72d2584e335..42612eed7508b 100644 --- a/compiler/rustc_hir_analysis/src/outlives/mod.rs +++ b/compiler/rustc_hir_analysis/src/outlives/mod.rs @@ -61,7 +61,7 @@ fn inferred_outlives_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId) -> &[(ty::Clau let span = tcx.def_span(item_def_id); let mut err = tcx.sess.struct_span_err(span, "rustc_outlives"); - for p in &pred { + for p in pred { err.note(p); } err.emit(); diff --git a/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs b/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs index 0bfbf99cb0b58..c37dff61b727a 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors/missing_cast_for_variadic_arg.rs @@ -48,7 +48,7 @@ impl<'tcx> StructuredDiagnostic<'tcx> for MissingCastForVariadicArg<'tcx, '_> { &self, mut err: DiagnosticBuilder<'tcx, ErrorGuaranteed>, ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> { - err.note(&format!( + err.note(format!( "certain types, like `{}`, must be casted before passing them to a \ variadic function, because of arcane ABI rules dictated by the C \ standard", diff --git a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs index 8f4d81ec3a935..6d1a1634ab4e8 100644 --- a/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_hir_analysis/src/structured_errors/wrong_number_of_generic_args.rs @@ -480,7 +480,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let span = self.path_segment.ident.span; let msg = self.create_error_message(); - self.tcx.sess.struct_span_err_with_code(span, &msg, self.code()) + self.tcx.sess.struct_span_err_with_code(span, msg, self.code()) } /// Builds the `expected 1 type argument / supplied 2 type arguments` message. @@ -602,7 +602,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_hi(), - &msg, + msg, sugg, Applicability::HasPlaceholders, ); @@ -625,7 +625,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let sugg = format!("{}{}{}", sugg_prefix, suggested_args, sugg_suffix); debug!("sugg: {:?}", sugg); - err.span_suggestion_verbose(sugg_span, &msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion_verbose(sugg_span, msg, sugg, Applicability::HasPlaceholders); } AngleBrackets::Implied => { // We never encounter missing lifetimes in situations in which lifetimes are elided @@ -652,7 +652,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { err.span_suggestion_verbose( span.shrink_to_hi(), - &msg, + msg, sugg, Applicability::HasPlaceholders, ); @@ -683,7 +683,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { let sugg = format!("{}{}{}", sugg_prefix, suggested_args, sugg_suffix); debug!("sugg: {:?}", sugg); - err.span_suggestion_verbose(sugg_span, &msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion_verbose(sugg_span, msg, sugg, Applicability::HasPlaceholders); } } } @@ -885,7 +885,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { err.span_suggestion( span_redundant_lt_args, - &msg_lifetimes, + msg_lifetimes, "", Applicability::MaybeIncorrect, ); @@ -927,7 +927,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { err.span_suggestion( span_redundant_type_or_const_args, - &msg_types_or_consts, + msg_types_or_consts, "", Applicability::MaybeIncorrect, ); @@ -943,7 +943,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { if !suggestions.is_empty() { err.multipart_suggestion_verbose( - &format!( + format!( "replace the generic bound{s} with the associated type{s}", s = pluralize!(unbound_types.len()) ), @@ -969,7 +969,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { }, ); - err.span_suggestion(span, &msg, "", Applicability::MaybeIncorrect); + err.span_suggestion(span, msg, "", Applicability::MaybeIncorrect); } else if redundant_lifetime_args && redundant_type_or_const_args { remove_lifetime_args(err); remove_type_or_const_args(err); @@ -1029,7 +1029,7 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> { ) }; - err.span_note(spans, &msg); + err.span_note(spans, msg); } /// Add note if `impl Trait` is explicitly specified. diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index 2db4f1e50d48e..d93e8efc1b59a 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1407,10 +1407,16 @@ impl<'a> State<'a> { self.print_type(ty); } hir::ExprKind::Type(expr, ty) => { - let prec = AssocOp::Colon.precedence() as i8; - self.print_expr_maybe_paren(expr, prec); - self.word_space(":"); + self.word("type_ascribe!("); + self.ibox(0); + self.print_expr(expr); + + self.word(","); + self.space_if_not_bol(); self.print_type(ty); + + self.end(); + self.word(")"); } hir::ExprKind::DropTemps(init) => { // Print `{`: diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs index aefde8109a07a..7d2f7e876083a 100644 --- a/compiler/rustc_hir_typeck/src/_match.rs +++ b/compiler/rustc_hir_typeck/src/_match.rs @@ -271,7 +271,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &cause, &mut |err| { if let Some((span, msg)) = &ret_reason { - err.span_label(*span, msg); + err.span_label(*span, msg.clone()); } else if let ExprKind::Block(block, _) = &then_expr.kind && let Some(expr) = &block.expr { diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index 5235710a2666e..655ab94eb48d1 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -397,7 +397,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .sess .struct_span_err( callee_expr.span, - &format!("evaluate({:?}) = {:?}", predicate, result), + format!("evaluate({:?}) = {:?}", predicate, result), ) .span_label(predicate_span, "predicate") .emit(); @@ -630,7 +630,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Some((removal_span, kind, path)) = &unit_variant { err.span_suggestion_verbose( *removal_span, - &format!( + format!( "`{path}` is a unit {kind}, and does not take parentheses to be constructed", ), "", diff --git a/compiler/rustc_hir_typeck/src/cast.rs b/compiler/rustc_hir_typeck/src/cast.rs index 1481c038cfebb..a92f368e0830e 100644 --- a/compiler/rustc_hir_typeck/src/cast.rs +++ b/compiler/rustc_hir_typeck/src/cast.rs @@ -146,7 +146,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let reported = self .tcx .sess - .delay_span_bug(span, &format!("`{:?}` should be sized but is not?", t)); + .delay_span_bug(span, format!("`{:?}` should be sized but is not?", t)); return Err(reported); } }) @@ -270,7 +270,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { fcx, ); if self.cast_ty.is_integral() { - err.help(&format!( + err.help(format!( "cast through {} first", match e { CastError::NeedViaPtr => "a raw pointer", @@ -292,7 +292,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { self.cast_ty, fcx, ) - .help(&format!( + .help(format!( "cast through {} first", match e { CastError::NeedViaInt => "an integer", @@ -651,13 +651,13 @@ impl<'a, 'tcx> CastCheck<'tcx> { ); } Err(_) => { - let msg = &format!("did you mean `&{}{}`?", mtstr, tstr); + let msg = format!("did you mean `&{}{}`?", mtstr, tstr); err.span_help(self.cast_span, msg); } } } else { let msg = - &format!("consider using an implicit coercion to `&{mtstr}{tstr}` instead"); + format!("consider using an implicit coercion to `&{mtstr}{tstr}` instead"); err.span_help(self.span, msg); } } @@ -674,7 +674,7 @@ impl<'a, 'tcx> CastCheck<'tcx> { Err(_) => { err.span_help( self.cast_span, - &format!("you might have meant `Box<{tstr}>`"), + format!("you might have meant `Box<{tstr}>`"), ); } } diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index 507c24d540cc5..1a3a14c92a537 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -707,9 +707,9 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { &self.tcx.sess.parse_sess, sym::trait_upcasting, self.cause.span, - &format!("cannot cast `{sub}` to `{sup}`, trait upcasting coercion is experimental"), + format!("cannot cast `{sub}` to `{sup}`, trait upcasting coercion is experimental"), ); - err.note(&format!("required when coercing `{source}` into `{target}`")); + err.note(format!("required when coercing `{source}` into `{target}`")); err.emit(); } @@ -1657,7 +1657,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { "the function expects a value to always be returned, but loops might run zero times", ); if MAXITER < ret_exprs.len() { - err.note(&format!( + err.note(format!( "if the loop doesn't execute, {} other values would never get returned", ret_exprs.len() - MAXITER )); @@ -1767,7 +1767,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { { err.span_note( sp, - &format!( + format!( "return type inferred to be `{}` here", expected ), @@ -1864,7 +1864,7 @@ impl<'tcx, 'exprs, E: AsCoercionSite> CoerceMany<'tcx, 'exprs, E> { Applicability::MaybeIncorrect, ); } else { - err.help(&format!( + err.help(format!( "if the trait `{}` were object safe, you could return a boxed trait object", &snippet[5..] )); diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index b8222820cf7a4..ee81ea345a64e 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -543,13 +543,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // We are pointing at the binding's type or initializer value, but it's pattern // is in a different line, so we point at both. err.span_label(secondary_span, "expected due to the type of this binding"); - err.span_label(primary_span, &format!("expected due to this{post_message}")); + err.span_label(primary_span, format!("expected due to this{post_message}")); } else if post_message == "" { // We are pointing at either the assignment lhs or the binding def pattern. err.span_label(primary_span, "expected due to the type of this binding"); } else { // We are pointing at the binding's type or initializer value. - err.span_label(primary_span, &format!("expected due to this{post_message}")); + err.span_label(primary_span, format!("expected due to this{post_message}")); } if !lhs.is_syntactic_place_expr() { @@ -566,7 +566,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) if rhs.hir_id == expr.hir_id && self.typeck_results.borrow().expr_ty_adjusted_opt(lhs) == Some(expected) => { - err.span_label(lhs.span, &format!("expected because this is `{expected}`")); + err.span_label(lhs.span, format!("expected because this is `{expected}`")); } _ => {} } @@ -704,19 +704,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }); err.span_note( path_span, - &format!( + format!( "the `{}` call is resolved to the method in `{container}`, shadowing {tail}", path.ident, ), ); if suggestions.len() > other_methods_in_scope.len() { - err.note(&format!( + err.note(format!( "additionally, there are {} other available methods that aren't in scope", suggestions.len() - other_methods_in_scope.len() )); } err.multipart_suggestions( - &format!( + format!( "you might have meant to call {}; you can use the fully-qualified path to call {} \ explicitly", if suggestions.len() == 1 { @@ -941,7 +941,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { [(variant, ctor_kind, field_name, note)] => { // Just a single matching variant. err.multipart_suggestion_verbose( - &format!( + format!( "try wrapping the expression in `{variant}`{note}", note = note.as_deref().unwrap_or("") ), @@ -953,7 +953,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => { // More than one matching variant. err.multipart_suggestions( - &format!( + format!( "try wrapping the expression in a variant of `{}`", self.tcx.def_path_str(expected_adt.did()) ), @@ -1726,7 +1726,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ]; (msg, suggestion) } else { - let msg = format!("{msg} and panic if the converted value doesn't fit"); + let msg = + format!("{} and panic if the converted value doesn't fit", msg.clone()); let mut suggestion = sugg.clone(); suggestion.push(( expr.span.shrink_to_hi(), @@ -1734,11 +1735,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { )); (msg, suggestion) }; - err.multipart_suggestion_verbose( - &msg, - suggestion, - Applicability::MachineApplicable, - ); + err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable); }; let suggest_to_change_suffix_or_into = @@ -1755,13 +1752,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let always_fallible = found_to_exp_is_fallible && (exp_to_found_is_fallible || expected_ty_expr.is_none()); let msg = if literal_is_ty_suffixed(expr) { - &lit_msg + lit_msg.clone() } else if always_fallible && (is_negative_int(expr) && is_uint(expected_ty)) { // We now know that converting either the lhs or rhs is fallible. Before we // suggest a fallible conversion, check if the value can never fit in the // expected type. let msg = format!("`{src}` cannot fit into type `{expected_ty}`"); - err.note(&msg); + err.note(msg); return; } else if in_const_context { // Do not recommend `into` or `try_into` in const contexts. @@ -1769,7 +1766,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else if found_to_exp_is_fallible { return suggest_fallible_into_or_lhs_from(err, exp_to_found_is_fallible); } else { - &msg + msg.clone() }; let suggestion = if literal_is_ty_suffixed(expr) { suffix_suggestion.clone() @@ -1831,14 +1828,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { suggest_to_change_suffix_or_into(err, false, true); } else if literal_is_ty_suffixed(expr) { err.multipart_suggestion_verbose( - &lit_msg, + lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else if can_cast { // Missing try_into implementation for `f64` to `f32` err.multipart_suggestion_verbose( - &format!("{cast_msg}, producing the closest possible value"), + format!("{cast_msg}, producing the closest possible value"), cast_suggestion, Applicability::MaybeIncorrect, // lossy conversion ); @@ -1848,14 +1845,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { (&ty::Uint(_) | &ty::Int(_), &ty::Float(_)) => { if literal_is_ty_suffixed(expr) { err.multipart_suggestion_verbose( - &lit_msg, + lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else if can_cast { // Missing try_into implementation for `{float}` to `{integer}` err.multipart_suggestion_verbose( - &format!("{msg}, rounding the float towards zero"), + format!("{msg}, rounding the float towards zero"), cast_suggestion, Applicability::MaybeIncorrect, // lossy conversion ); @@ -1866,7 +1863,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // if `found` is `None` (meaning found is `usize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { err.multipart_suggestion_verbose( - &format!( + format!( "{msg}, producing the floating point representation of the integer", ), into_suggestion, @@ -1874,14 +1871,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } else if literal_is_ty_suffixed(expr) { err.multipart_suggestion_verbose( - &lit_msg, + lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else { // Missing try_into implementation for `{integer}` to `{float}` err.multipart_suggestion_verbose( - &format!( + format!( "{cast_msg}, producing the floating point representation of the integer, \ rounded if necessary", ), @@ -1895,23 +1892,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // if `found` is `None` (meaning found is `isize`), don't suggest `.into()` if exp.bit_width() > found.bit_width().unwrap_or(256) { err.multipart_suggestion_verbose( - &format!( + format!( "{}, producing the floating point representation of the integer", - &msg, + msg.clone(), ), into_suggestion, Applicability::MachineApplicable, ); } else if literal_is_ty_suffixed(expr) { err.multipart_suggestion_verbose( - &lit_msg, + lit_msg, suffix_suggestion, Applicability::MachineApplicable, ); } else { // Missing try_into implementation for `{integer}` to `{float}` err.multipart_suggestion_verbose( - &format!( + format!( "{}, producing the floating point representation of the integer, \ rounded if necessary", &msg, @@ -1928,7 +1925,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &ty::Char, ) => { err.multipart_suggestion_verbose( - &format!("{cast_msg}, since a `char` always occupies 4 bytes"), + format!("{cast_msg}, since a `char` always occupies 4 bytes"), cast_suggestion, Applicability::MachineApplicable, ); diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index 3ffc583d43f61..778ef06d57e20 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -1944,12 +1944,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { private_fields: Vec<&ty::FieldDef>, used_fields: &'tcx [hir::ExprField<'tcx>], ) { - let mut err = self.tcx.sess.struct_span_err( - span, - &format!( - "cannot construct `{adt_ty}` with struct literal syntax due to private fields", - ), - ); + let mut err = + self.tcx.sess.struct_span_err( + span, + format!( + "cannot construct `{adt_ty}` with struct literal syntax due to private fields", + ), + ); let (used_private_fields, remaining_private_fields): ( Vec<(Symbol, Span, bool)>, Vec<(Symbol, Span, bool)>, @@ -2045,7 +2046,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(field.ident.span, "field does not exist"); err.span_suggestion_verbose( expr_span, - &format!( + format!( "`{adt}::{variant}` is a tuple {kind_name}, use the appropriate syntax", adt = ty, variant = variant.name, @@ -2063,7 +2064,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(field.ident.span, "field does not exist"); err.span_suggestion_verbose( expr_span, - &format!( + format!( "`{adt}` is a tuple {kind_name}, use the appropriate syntax", adt = ty, kind_name = kind_name, @@ -2105,7 +2106,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let available_field_names = self.available_field_names(variant, expr_span); if !available_field_names.is_empty() { - err.note(&format!( + err.note(format!( "available fields are: {}", self.name_series_display(available_field_names) )); @@ -2384,7 +2385,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } if add_label { - err.span_label(field_ident.span, &format!("field not found in `{ty}`")); + err.span_label(field_ident.span, format!("field not found in `{ty}`")); } } @@ -2565,7 +2566,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let param_span = self.tcx.hir().span(param_hir_id); let param_name = self.tcx.hir().ty_param_name(param_def_id.expect_local()); - err.span_label(param_span, &format!("type parameter '{param_name}' declared here")); + err.span_label(param_span, format!("type parameter '{param_name}' declared here")); } fn suggest_fields_on_recordish( @@ -2589,7 +2590,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let struct_variant_def = def.non_enum_variant(); let field_names = self.available_field_names(struct_variant_def, access_span); if !field_names.is_empty() { - err.note(&format!( + err.note(format!( "available fields are: {}", self.name_series_display(field_names), )); @@ -2630,7 +2631,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if let Ok(base) = self.tcx.sess.source_map().span_to_snippet(base.span) { let msg = format!("`{base}` is a raw pointer; try dereferencing it"); let suggestion = format!("(*{base}).{field}"); - err.span_suggestion(expr.span, &msg, suggestion, Applicability::MaybeIncorrect); + err.span_suggestion(expr.span, msg, suggestion, Applicability::MaybeIncorrect); } } diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 2b5af4bc81bfe..cbedbad1f3864 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -63,9 +63,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { lint::builtin::UNREACHABLE_CODE, id, span, - &msg, + msg.clone(), |lint| { - lint.span_label(span, &msg).span_label( + lint.span_label(span, msg).span_label( orig_span, custom_note .unwrap_or("any code following this expression is unreachable"), @@ -275,7 +275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => { self.tcx.sess.delay_span_bug( expr.span, - &format!( + format!( "while adjusting {:?}, can't compose {:?} and {:?}", expr, entry.get(), @@ -1034,15 +1034,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { rcvr.span, "you probably want to use this value after calling the method...", ); - err.span_note(sp, &modifies_rcvr_note); - err.note(&format!("...instead of the `()` output of method `{}`", path_segment.ident)); + err.span_note(sp, modifies_rcvr_note); + err.note(format!("...instead of the `()` output of method `{}`", path_segment.ident)); } else if let ExprKind::MethodCall(..) = rcvr.kind { err.span_note( sp, modifies_rcvr_note.clone() + ", it is not meant to be used in method chains.", ); } else { - err.span_note(sp, &modifies_rcvr_note); + err.span_note(sp, modifies_rcvr_note); } } @@ -1374,7 +1374,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { Err(_) => { self.tcx.sess.delay_span_bug( span, - &format!( + format!( "instantiate_value_path: (UFCS) {:?} was a subtype of {:?} but now is not?", self_ty, impl_ty, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index f42c825d9e8b1..1e82161d9f7b2 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -685,7 +685,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { err = tcx.sess.struct_span_err_with_code( full_call_span, - &format!( + format!( "{call_name} takes {}{} but {} {} supplied", if c_variadic { "at least " } else { "" }, potentially_plural_count( @@ -828,7 +828,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { tcx.sess.struct_span_err_with_code( full_call_span, - &format!( + format!( "this {} takes {}{} but {} {} supplied", call_name, if c_variadic { "at least " } else { "" }, @@ -1203,7 +1203,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } SuggestionText::Remove(plural) => { err.multipart_suggestion( - &format!("remove the extra argument{}", if plural { "s" } else { "" }), + format!("remove the extra argument{}", if plural { "s" } else { "" }), suggestions, Applicability::HasPlaceholders, ); @@ -1253,7 +1253,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { suggestion += ")"; err.span_suggestion_verbose( suggestion_span, - &suggestion_text, + suggestion_text, suggestion, Applicability::HasPlaceholders, ); @@ -1947,7 +1947,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { spans.push_span_label(param.span, ""); } - err.span_note(spans, &format!("{} defined here", self.tcx.def_descr(def_id))); + err.span_note(spans, format!("{} defined here", self.tcx.def_descr(def_id))); } else if let Some(hir::Node::Expr(e)) = self.tcx.hir().get_if_local(def_id) && let hir::ExprKind::Closure(hir::Closure { body, .. }) = &e.kind { @@ -1958,11 +1958,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { ("closure", self.tcx.def_span(def_id)) }; - err.span_note(span, &format!("{} defined here", kind)); + err.span_note(span, format!("{} defined here", kind)); } else { err.span_note( self.tcx.def_span(def_id), - &format!("{} defined here", self.tcx.def_descr(def_id)), + format!("{} defined here", self.tcx.def_descr(def_id)), ); } } diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 82fc1256bba64..7c75bf00c02f8 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -278,9 +278,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.check_ref(expr, found, expected) { if verbose { - err.span_suggestion_verbose(sp, &msg, suggestion, applicability); + err.span_suggestion_verbose(sp, msg, suggestion, applicability); } else { - err.span_suggestion(sp, &msg, suggestion, applicability); + err.span_suggestion(sp, msg, suggestion, applicability); } if annotation { let suggest_annotation = match expr.peel_drop_temps().kind { @@ -1449,7 +1449,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { diag.span_note( callee_expr.span, - &format!( + format!( "`{expected_ty}` does not implement `Clone`, so `{found_ty}` was cloned instead" ), ); diff --git a/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/record_consumed_borrow.rs b/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/record_consumed_borrow.rs index 5136d895f2268..8ab0bd535d6fd 100644 --- a/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/record_consumed_borrow.rs +++ b/compiler/rustc_hir_typeck/src/generator_interior/drop_ranges/record_consumed_borrow.rs @@ -205,7 +205,7 @@ impl<'tcx> expr_use_visitor::Delegate<'tcx> for ExprUseDelegate<'tcx> { if ty.has_infer() { self.tcx.sess.delay_span_bug( self.tcx.hir().span(assignee_place.hir_id), - &format!("inference variables in {ty}"), + format!("inference variables in {ty}"), ); } else if ty.needs_drop(self.tcx, self.param_env) { self.places diff --git a/compiler/rustc_hir_typeck/src/generator_interior/mod.rs b/compiler/rustc_hir_typeck/src/generator_interior/mod.rs index 915280a5bea02..019fb86f55c4c 100644 --- a/compiler/rustc_hir_typeck/src/generator_interior/mod.rs +++ b/compiler/rustc_hir_typeck/src/generator_interior/mod.rs @@ -112,7 +112,7 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> { self.fcx .tcx .sess - .delay_span_bug(span, &format!("Encountered var {:?}", unresolved_term)); + .delay_span_bug(span, format!("Encountered var {:?}", unresolved_term)); } else { let note = format!( "the type is part of the {} because of this {}", @@ -464,7 +464,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> { self.fcx .tcx .sess - .delay_span_bug(expr.span, &format!("inference variables in {ty}")); + .delay_span_bug(expr.span, format!("inference variables in {ty}")); true } else { ty.needs_drop(self.fcx.tcx, self.fcx.param_env) diff --git a/compiler/rustc_hir_typeck/src/intrinsicck.rs b/compiler/rustc_hir_typeck/src/intrinsicck.rs index 2ad79cd85b182..3c5eafd948488 100644 --- a/compiler/rustc_hir_typeck/src/intrinsicck.rs +++ b/compiler/rustc_hir_typeck/src/intrinsicck.rs @@ -72,8 +72,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let from = unpack_option_like(tcx, from); if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (from.kind(), sk_to) && size_to == Pointer(dl.instruction_address_space).size(&tcx) { struct_span_err!(tcx.sess, span, E0591, "can't transmute zero-sized type") - .note(&format!("source type: {from}")) - .note(&format!("target type: {to}")) + .note(format!("source type: {from}")) + .note(format!("target type: {to}")) .help("cast with `as` to a pointer instead") .emit(); return; @@ -109,10 +109,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { or dependently-sized types" ); if from == to { - err.note(&format!("`{from}` does not have a fixed size")); + err.note(format!("`{from}` does not have a fixed size")); } else { - err.note(&format!("source type: `{}` ({})", from, skeleton_string(from, sk_from))) - .note(&format!("target type: `{}` ({})", to, skeleton_string(to, sk_to))); + err.note(format!("source type: `{}` ({})", from, skeleton_string(from, sk_from))) + .note(format!("target type: `{}` ({})", to, skeleton_string(to, sk_to))); let mut should_delay_as_bug = false; if let Err(LayoutError::Unknown(bad_from)) = sk_from && bad_from.references_error() { should_delay_as_bug = true; diff --git a/compiler/rustc_hir_typeck/src/lib.rs b/compiler/rustc_hir_typeck/src/lib.rs index d50be47c91513..a2a4362e2f518 100644 --- a/compiler/rustc_hir_typeck/src/lib.rs +++ b/compiler/rustc_hir_typeck/src/lib.rs @@ -448,7 +448,7 @@ fn fatally_break_rust(sess: &Session) { "we would appreciate a joke overview: \ https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675", ); - handler.note_without_error(&format!( + handler.note_without_error(format!( "rustc {} running on {}", option_env!("CFG_VERSION").unwrap_or("unknown_version"), config::host_triple(), diff --git a/compiler/rustc_hir_typeck/src/method/prelude2021.rs b/compiler/rustc_hir_typeck/src/method/prelude2021.rs index 3d6c2119bea33..ec4e7f7f88af5 100644 --- a/compiler/rustc_hir_typeck/src/method/prelude2021.rs +++ b/compiler/rustc_hir_typeck/src/method/prelude2021.rs @@ -118,7 +118,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; lint.span_help( sp, - &format!("disambiguate the method call with `({})`", self_adjusted,), + format!("disambiguate the method call with `({})`", self_adjusted,), ); } @@ -180,7 +180,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { lint.span_help( sp, - &format!( + format!( "disambiguate the associated function with `{}::{}(...)`", trait_name, segment.ident, ), diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs index 1a429142e0148..a0e978b0c1074 100644 --- a/compiler/rustc_hir_typeck/src/method/probe.rs +++ b/compiler/rustc_hir_typeck/src/method/probe.rs @@ -1396,7 +1396,7 @@ impl<'tcx> Pick<'tcx> { // However `self.span` only // highlights the method name, so we can't use it. Also consider reusing // the code from `report_method_error()`. - lint.help(&format!( + lint.help(format!( "call with fully qualified syntax `{}(...)` to keep using the current \ method", tcx.def_path_str(self.item.def_id), @@ -1420,7 +1420,7 @@ impl<'tcx> Pick<'tcx> { } if tcx.sess.is_nightly_build() { for (candidate, feature) in &self.unstable_candidates { - lint.help(&format!( + lint.help(format!( "add `#![feature({})]` to the crate attributes to enable `{}`", feature, tcx.def_path_str(candidate.item.def_id), diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 43f40ada5acb6..b786348f89ea0 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -169,13 +169,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { kind, item_name ); - err.span_label(item_name.span, &format!("private {}", kind)); + err.span_label(item_name.span, format!("private {}", kind)); let sp = self .tcx .hir() .span_if_local(def_id) .unwrap_or_else(|| self.tcx.def_span(def_id)); - err.span_label(sp, &format!("private {} defined here", kind)); + err.span_label(sp, format!("private {} defined here", kind)); self.suggest_valid_traits(&mut err, out_of_scope_traits); err.emit(); } @@ -188,7 +188,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { format!("the `{item_name}` method cannot be invoked on a trait object") }; - let mut err = self.sess().struct_span_err(span, &msg); + let mut err = self.sess().struct_span_err(span, msg); if !needs_mut { err.span_label(bound_span, "this has a `Sized` requirement"); } @@ -228,12 +228,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { err.span_suggestion_verbose( mut_ty.ty.span.shrink_to_lo(), - &msg, + msg, "mut ", Applicability::MachineApplicable, ); } else { - err.help(&msg); + err.help(msg); } } } @@ -374,14 +374,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty_str }; if let Some(file) = ty_file { - err.note(&format!("the full type name has been written to '{}'", file.display(),)); + err.note(format!("the full type name has been written to '{}'", file.display(),)); } if rcvr_ty.references_error() { err.downgrade_to_delayed_bug(); } if tcx.ty_is_opaque_future(rcvr_ty) && item_name.name == sym::poll { - err.help(&format!( + err.help(format!( "method `poll` found on `Pin<&mut {ty_str}>`, \ see documentation for `std::pin::Pin`" )); @@ -510,7 +510,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } if let Some(iterator_trait) = self.tcx.get_diagnostic_item(sym::Iterator) { let iterator_trait = self.tcx.def_path_str(iterator_trait); - err.note(&format!( + err.note(format!( "`count` is defined on `{iterator_trait}`, which `{rcvr_ty}` does not implement" )); } @@ -810,7 +810,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { for (sp, label) in span_labels { span.push_span_label(sp, label); } - err.span_note(span, &msg); + err.span_note(span, msg); unsatisfied_bounds = true; } @@ -867,7 +867,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { obligations.sort(); err.span_suggestion_verbose( span, - &format!( + format!( "consider restricting the type parameter{s} to satisfy the \ trait bound{s}", s = pluralize!(obligations.len()) @@ -912,13 +912,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { but its trait bounds were not satisfied" ) }); - err.set_primary_message(&primary_message); + err.set_primary_message(primary_message); if let Some(label) = label { custom_span_label = true; err.span_label(span, label); } if !bound_list.is_empty() { - err.note(&format!( + err.note(format!( "the following trait bounds were not satisfied:\n{bound_list}" )); } @@ -1002,7 +1002,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { "".to_string() }; - err.note(&format!( + err.note(format!( "the {item_kind} was found for\n{}{}", type_candidates, additional_types )); @@ -1049,7 +1049,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { bound_spans.sort(); bound_spans.dedup(); for (span, msg) in bound_spans.into_iter() { - err.span_label(span, &msg); + err.span_label(span, msg); } if rcvr_ty.is_numeric() && rcvr_ty.is_fresh() || restrict_type_params { @@ -1119,7 +1119,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { err.span_suggestion( span, - &format!( + format!( "there is {} {} with a similar name", self.tcx.def_kind_descr_article(def_kind, similar_candidate.def_id), self.tcx.def_kind_descr(def_kind, similar_candidate.def_id) @@ -1203,9 +1203,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; if let Some(note_span) = note_span { // We have a span pointing to the method. Show note with snippet. - err.span_note(note_span, ¬e_str); + err.span_note(note_span, note_str); } else { - err.note(¬e_str); + err.note(note_str); } if let Some(sugg_span) = sugg_span && let Some(trait_ref) = self.tcx.impl_trait_ref(impl_did) { @@ -1243,7 +1243,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let Some(item) = self.associated_value(trait_did, item_name) else { continue }; let item_span = self.tcx.def_span(item.def_id); let idx = if sources.len() > 1 { - let msg = &format!( + let msg = format!( "candidate #{} is defined in the trait `{}`", idx + 1, self.tcx.def_path_str(trait_did) @@ -1251,7 +1251,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_note(item_span, msg); Some(idx + 1) } else { - let msg = &format!( + let msg = format!( "the candidate is defined in the trait `{}`", self.tcx.def_path_str(trait_did) ); @@ -1278,7 +1278,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } if sources.len() > limit { - err.note(&format!("and {} others", sources.len() - limit)); + err.note(format!("and {} others", sources.len() - limit)); } } @@ -1402,7 +1402,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { applicability, ); } else { - err.help(&format!("try with `{}::{}`", ty_str, item_name,)); + err.help(format!("try with `{}::{}`", ty_str, item_name,)); } } @@ -1436,7 +1436,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if self.is_fn_ty(field_ty, span) { let expr_span = expr.span.to(item_name.span); err.multipart_suggestion( - &format!( + format!( "to call the function stored in `{}`, \ surround the field access with parentheses", item_name, @@ -1612,7 +1612,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let snippet = snippet.strip_suffix('.').unwrap_or(&snippet); err.span_suggestion( lit.span, - &format!( + format!( "you must specify a concrete type for this numeric value, \ like `{}`", concrete_type @@ -1648,7 +1648,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // account for `let x: _ = 42;` // ^^^ type_span, - &msg, + msg, format!(": {concrete_type}"), Applicability::MaybeIncorrect, ); @@ -1861,7 +1861,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let self_ty = field.ty(tcx, substs); err.span_note( tcx.def_span(pick.item.def_id), - &format!("the method `{item_name}` exists on the type `{self_ty}`"), + format!("the method `{item_name}` exists on the type `{self_ty}`"), ); let (article, kind, variant, question) = if tcx.is_diagnostic_item(sym::Result, kind.did()) { @@ -1975,7 +1975,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_note( tcx.def_span(pick.item.def_id), - &format!("the method `{item_name}` exists on the type `{ty}`"), + format!("the method `{item_name}` exists on the type `{ty}`"), ); } } @@ -2046,7 +2046,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pluralize!(preds.len()), ) }; - err.span_note(spans, &msg); + err.span_note(spans, msg); } let preds: Vec<_> = errors @@ -2160,14 +2160,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } err.span_note( span, - &format!("the trait{} {} must be implemented", pluralize!(len), names), + format!("the trait{} {} must be implemented", pluralize!(len), names), ); } for (self_name, self_span, traits) in &derives_grouped { err.span_suggestion_verbose( self_span.shrink_to_lo(), - &format!("consider annotating `{}` with `#[derive({})]`", self_name, traits), + format!("consider annotating `{}` with `#[derive({})]`", self_name, traits), format!("#[derive({})]\n", traits), Applicability::MaybeIncorrect, ); @@ -2313,7 +2313,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_suggestions( span, - &msg, + msg, path_strings.chain(glob_path_strings), Applicability::MaybeIncorrect, ); @@ -2345,7 +2345,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.suggest_use_candidates(err, msg, candidates); if let Some(did) = edition_fix { - err.note(&format!( + err.note(format!( "'{}' is included in the prelude starting in Edition 2021", with_crate_prefix!(self.tcx.def_path_str(did)) )); @@ -2413,7 +2413,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if pick.autoderefs == 0 && !skip { err.span_label( pick.item.ident(self.tcx).span, - &format!("the method is available for `{}` here", rcvr_ty), + format!("the method is available for `{}` here", rcvr_ty), ); } break; @@ -2459,7 +2459,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if pick.autoderefs == 0 && !skip { err.span_label( pick.item.ident(self.tcx).span, - &format!("the method is available for `{}` here", new_rcvr_t), + format!("the method is available for `{}` here", new_rcvr_t), ); err.multipart_suggestion( "consider wrapping the receiver expression with the \ @@ -2655,7 +2655,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { if !candidates.iter().any(|t| trait_def_ids.contains(&t.def_id)) { err.span_suggestions( sp, - &message(format!( + message(format!( "restrict type parameter `{}` with", param.name.ident(), )), @@ -2687,7 +2687,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; err.span_suggestions( sp, - &message(format!("add {} supertrait for", article)), + message(format!("add {} supertrait for", article)), candidates.iter().map(|t| { format!("{} {}", sep, self.tcx.def_path_str(t.def_id),) }), @@ -2746,7 +2746,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { [trait_info] if trait_info.def_id.is_local() => { err.span_note( self.tcx.def_span(trait_info.def_id), - &format!( + format!( "`{}` defines an item `{}`, perhaps you need to {} it", self.tcx.def_path_str(trait_info.def_id), item_name, @@ -2763,7 +2763,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.tcx.def_path_str(trait_info.def_id), )); } - err.note(&msg); + err.note(msg); } } match &explicitly_negative[..] { @@ -2774,7 +2774,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.tcx.def_path_str(trait_info.def_id), item_name ); - err.note(&msg); + err.note(msg); } trait_infos => { let mut msg = format!( @@ -2784,7 +2784,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { for trait_info in trait_infos { msg.push_str(&format!("\n{}", self.tcx.def_path_str(trait_info.def_id))); } - err.note(&msg); + err.note(msg); } } } @@ -2836,7 +2836,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn_args.len() == args.len() + 1 { err.span_suggestion_verbose( method_name.span.shrink_to_hi(), - &format!("try calling `{}` instead", new_name.name.as_str()), + format!("try calling `{}` instead", new_name.name.as_str()), "_else", Applicability::MaybeIncorrect, ); @@ -2956,7 +2956,7 @@ fn print_disambiguation_help<'tcx>( }; err.span_suggestion_verbose( span, - &format!( + format!( "disambiguate the {} for {}", def_kind_descr, if let Some(candidate) = candidate { diff --git a/compiler/rustc_hir_typeck/src/op.rs b/compiler/rustc_hir_typeck/src/op.rs index e91ae4466eb87..af351a3fa10e8 100644 --- a/compiler/rustc_hir_typeck/src/op.rs +++ b/compiler/rustc_hir_typeck/src/op.rs @@ -390,7 +390,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) .is_ok() { - let msg = &format!( + let msg = format!( "`{}{}` can be used on `{}` if you dereference the left-hand side", op.node.as_str(), match is_assign { @@ -515,7 +515,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { // When we know that a missing bound is responsible, we don't show // this note as it is redundant. - err.note(&format!( + err.note(format!( "the trait `{missing_trait}` is not implemented for `{lhs_ty}`" )); } @@ -690,7 +690,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { err.span_suggestion( ex.span, - &format!( + format!( "you may have meant the maximum value of `{actual}`", ), format!("{actual}::MAX"), diff --git a/compiler/rustc_hir_typeck/src/pat.rs b/compiler/rustc_hir_typeck/src/pat.rs index d69a16d45ae54..5af955d313482 100644 --- a/compiler/rustc_hir_typeck/src/pat.rs +++ b/compiler/rustc_hir_typeck/src/pat.rs @@ -517,7 +517,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn endpoint_has_type(&self, err: &mut Diagnostic, span: Span, ty: Ty<'_>) { if !ty.references_error() { - err.span_label(span, &format!("this is of type `{}`", ty)); + err.span_label(span, format!("this is of type `{}`", ty)); } } @@ -544,7 +544,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { format!("this is of type `{}` but it should be `char` or numeric", ty) }; let mut one_side_err = |first_span, first_ty, second: Option<(bool, Ty<'tcx>, Span)>| { - err.span_label(first_span, &msg(first_ty)); + err.span_label(first_span, msg(first_ty)); if let Some((_, ty, sp)) = second { let ty = self.resolve_vars_if_possible(ty); self.endpoint_has_type(&mut err, sp, ty); @@ -552,8 +552,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; match (lhs, rhs) { (Some((true, lhs_ty, lhs_sp)), Some((true, rhs_ty, rhs_sp))) => { - err.span_label(lhs_sp, &msg(lhs_ty)); - err.span_label(rhs_sp, &msg(rhs_ty)); + err.span_label(lhs_sp, msg(lhs_ty)); + err.span_label(rhs_sp, msg(rhs_ty)); } (Some((true, lhs_ty, lhs_sp)), rhs) => one_side_err(lhs_sp, lhs_ty, rhs), (lhs, Some((true, rhs_ty, rhs_sp))) => one_side_err(rhs_sp, rhs_ty, lhs), @@ -651,7 +651,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) }); let pre = if in_match { "in the same arm, " } else { "" }; - err.note(&format!("{}a binding must have the same type in all alternatives", pre)); + err.note(format!("{}a binding must have the same type in all alternatives", pre)); self.suggest_adding_missing_ref_or_removing_ref( &mut err, span, @@ -958,11 +958,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) { let pat_span = pat.span; if let Some(span) = self.tcx.hir().res_span(pat_res) { - e.span_label(span, &format!("{} defined here", res.descr())); + e.span_label(span, format!("{} defined here", res.descr())); if let [hir::PathSegment { ident, .. }] = &*segments { e.span_label( pat_span, - &format!( + format!( "`{}` is interpreted as {} {}, not a new binding", ident, res.article(), @@ -1158,7 +1158,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); err.span_label( last_subpat_span, - &format!("expected {} field{}, found {}", fields.len(), fields_ending, subpats.len()), + format!("expected {} field{}, found {}", fields.len(), fields_ending, subpats.len()), ); if self.tcx.sess.source_map().is_multiline(qpath.span().between(last_subpat_span)) { err.span_label(qpath.span(), ""); @@ -1171,7 +1171,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } err.span_label( last_field_def_span, - &format!("{} has {} field{}", res.descr(), fields.len(), fields_ending), + format!("{} has {} field{}", res.descr(), fields.len(), fields_ending), ); // Identify the case `Some(x, y)` where the expected type is e.g. `Option<(T, U)>`. @@ -1641,7 +1641,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let unmentioned_field = unmentioned_fields[0].1.name; err.span_suggestion_short( pat_field.ident.span, - &format!( + format!( "`{}` has a field named `{}`", tcx.def_path_str(variant.def_id), unmentioned_field @@ -1831,7 +1831,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { lint.help( "ensure that all fields are mentioned explicitly by adding the suggested fields", ); - lint.note(&format!( + lint.note(format!( "the pattern is of type `{}` and the `non_exhaustive_omitted_patterns` attribute was found", ty, )); @@ -1895,7 +1895,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }; err.span_suggestion( sp, - &format!( + format!( "include the missing field{} in the pattern{}", pluralize!(len), if have_inaccessible_fields { " and ignore the inaccessible fields" } else { "" } @@ -1922,7 +1922,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); err.span_suggestion( sp, - &format!( + format!( "if you don't care about {these} missing field{s}, you can explicitly ignore {them}", these = pluralize!("this", len), s = pluralize!(len), diff --git a/compiler/rustc_hir_typeck/src/place_op.rs b/compiler/rustc_hir_typeck/src/place_op.rs index 1f7e7ba9f5b2d..f217c5c1e1c98 100644 --- a/compiler/rustc_hir_typeck/src/place_op.rs +++ b/compiler/rustc_hir_typeck/src/place_op.rs @@ -73,16 +73,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let ty = self.resolve_vars_if_possible(ty); let mut err = self.tcx.sess.struct_span_err( span, - &format!("negative integers cannot be used to index on a `{ty}`"), + format!("negative integers cannot be used to index on a `{ty}`"), ); - err.span_label(span, &format!("cannot use a negative integer for indexing on `{ty}`")); + err.span_label(span, format!("cannot use a negative integer for indexing on `{ty}`")); if let (hir::ExprKind::Path(..), Ok(snippet)) = (&base_expr.kind, self.tcx.sess.source_map().span_to_snippet(base_expr.span)) { // `foo[-1]` to `foo[foo.len() - 1]` err.span_suggestion_verbose( span.shrink_to_lo(), - &format!( + format!( "to access an element starting from the end of the `{ty}`, compute the index", ), format!("{snippet}.len() "), diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs index 147b3e74d0f8a..543194ac9d67b 100644 --- a/compiler/rustc_hir_typeck/src/upvar.rs +++ b/compiler/rustc_hir_typeck/src/upvar.rs @@ -713,7 +713,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.tcx.sess.delay_span_bug( closure_span, - &format!( + format!( "two identical projections: ({:?}, {:?})", capture1.place.projections, capture2.place.projections ), @@ -863,7 +863,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let indent = line2.split_once(|c: char| !c.is_whitespace()).unwrap_or_default().0; lint.span_suggestion( closure_body_span.with_lo(closure_body_span.lo() + BytePos::from_usize(line1.len())).shrink_to_lo(), - &diagnostic_msg, + diagnostic_msg, format!("\n{indent}{migration_string};"), Applicability::MachineApplicable, ); @@ -874,7 +874,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // directly after the `{`. lint.span_suggestion( closure_body_span.with_lo(closure_body_span.lo() + BytePos(1)).shrink_to_lo(), - &diagnostic_msg, + diagnostic_msg, format!(" {migration_string};"), Applicability::MachineApplicable, ); @@ -882,7 +882,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // This is a closure without braces around the body. // We add braces to add the `let` before the body. lint.multipart_suggestion( - &diagnostic_msg, + diagnostic_msg, vec![ (closure_body_span.shrink_to_lo(), format!("{{ {migration_string}; ")), (closure_body_span.shrink_to_hi(), " }".to_string()), @@ -893,7 +893,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } else { lint.span_suggestion( closure_span, - &diagnostic_msg, + diagnostic_msg, migration_string, Applicability::HasPlaceholders ); @@ -1519,7 +1519,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let span = capture_info.path_expr_id.map_or(closure_span, |e| self.tcx.hir().span(e)); - diag.span_note(span, &output_str); + diag.span_note(span, output_str); } diag.emit(); } @@ -1560,13 +1560,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { multi_span.push_span_label(path_span, path_label); multi_span.push_span_label(capture_kind_span, capture_kind_label); - diag.span_note(multi_span, &output_str); + diag.span_note(multi_span, output_str); } else { let span = capture_info .path_expr_id .map_or(closure_span, |e| self.tcx.hir().span(e)); - diag.span_note(span, &output_str); + diag.span_note(span, output_str); }; } } diff --git a/compiler/rustc_hir_typeck/src/writeback.rs b/compiler/rustc_hir_typeck/src/writeback.rs index 817918257beb4..cf95d4f04bb92 100644 --- a/compiler/rustc_hir_typeck/src/writeback.rs +++ b/compiler/rustc_hir_typeck/src/writeback.rs @@ -227,7 +227,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { // When encountering `return [0][0]` outside of a `fn` body we can encounter a base // that isn't in the type table. We assume more relevant errors have already been // emitted, so we delay an ICE if none have. (#64638) - self.tcx().sess.delay_span_bug(e.span, &format!("bad base: `{:?}`", base)); + self.tcx().sess.delay_span_bug(e.span, format!("bad base: `{:?}`", base)); } if let Some(ty::Ref(_, base_ty, _)) = base_ty { let index_ty = typeck_results.expr_ty_adjusted_opt(index).unwrap_or_else(|| { @@ -491,7 +491,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { let err = self .tcx() .sess - .struct_span_err(span, &format!("user substs: {:?}", user_substs)); + .struct_span_err(span, format!("user substs: {:?}", user_substs)); err.buffer(&mut errors_buffer); } } diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index c29f652034fc0..d798202a64441 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -205,7 +205,7 @@ impl CanonicalizeMode for CanonicalizeQueryResponse { // `delay_span_bug` to allow type error over an ICE. canonicalizer.tcx.sess.delay_span_bug( rustc_span::DUMMY_SP, - &format!("unexpected region in query response: `{:?}`", r), + format!("unexpected region in query response: `{:?}`", r), ); r } diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index 9b670c76a1822..c9e13be02ff9a 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -192,7 +192,7 @@ impl<'tcx> InferCtxt<'tcx> { self.tcx.check_tys_might_be_eq(canonical).map_err(|_| { self.tcx.sess.delay_span_bug( DUMMY_SP, - &format!("cannot relate consts of different types (a={:?}, b={:?})", a, b,), + format!("cannot relate consts of different types (a={:?}, b={:?})", a, b,), ) }) }); diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 547f851526f0a..98da5ba65b7b4 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -282,9 +282,9 @@ fn emit_msg_span( let message = format!("{}{}{}", prefix, description, suffix); if let Some(span) = span { - err.span_note(span, &message); + err.span_note(span, message); } else { - err.note(&message); + err.note(message); } } @@ -298,9 +298,9 @@ fn label_msg_span( let message = format!("{}{}{}", prefix, description, suffix); if let Some(span) = span { - err.span_label(span, &message); + err.span_label(span, message); } else { - err.note(&message); + err.note(message); } } @@ -2395,7 +2395,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { ); } else { let consider = format!("{} `{}: {}`...", msg, bound_kind, sub); - err.help(&consider); + err.help(consider); } } @@ -2625,7 +2625,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { ); err.span_note( sup_trace.cause.span, - &format!("...so that the {}", sup_trace.cause.as_requirement_str()), + format!("...so that the {}", sup_trace.cause.as_requirement_str()), ); err.note_expected_found(&"", sup_expected, &"", sup_found); diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index 27c3b796d14e5..aad9885827da5 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -299,7 +299,7 @@ pub fn suggest_new_region_bound( if let Some(explicit_static) = &explicit_static { err.span_suggestion_verbose( span, - &format!("{consider} `{ty}`'s {explicit_static}"), + format!("{consider} `{ty}`'s {explicit_static}"), &lifetime_name, Applicability::MaybeIncorrect, ); @@ -367,7 +367,7 @@ pub fn suggest_new_region_bound( spans_suggs .push((fn_return.span.shrink_to_hi(), format!(" + {name} "))); err.multipart_suggestion_verbose( - &format!( + format!( "{declare} `{ty}` {captures}, {use_lt}", ), spans_suggs, @@ -376,7 +376,7 @@ pub fn suggest_new_region_bound( } else { err.span_suggestion_verbose( fn_return.span.shrink_to_hi(), - &format!("{declare} `{ty}` {captures}, {explicit}",), + format!("{declare} `{ty}` {captures}, {explicit}",), &plus_lt, Applicability::MaybeIncorrect, ); @@ -387,7 +387,7 @@ pub fn suggest_new_region_bound( if let LifetimeName::ImplicitObjectLifetimeDefault = lt.res { err.span_suggestion_verbose( fn_return.span.shrink_to_hi(), - &format!( + format!( "{declare} the trait object {captures}, {explicit}", declare = declare, captures = captures, @@ -404,7 +404,7 @@ pub fn suggest_new_region_bound( if let Some(explicit_static) = &explicit_static { err.span_suggestion_verbose( lt.ident.span, - &format!("{} the trait object's {}", consider, explicit_static), + format!("{} the trait object's {}", consider, explicit_static), &lifetime_name, Applicability::MaybeIncorrect, ); diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs index e410172c8c8d1..a31163519404c 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs @@ -209,7 +209,7 @@ impl Trait for X { if !sp.contains(p_span) { diag.span_label(p_span, "this type parameter"); } - diag.help(&format!( + diag.help(format!( "every closure has a distinct type and so could not always match the \ caller-chosen type of parameter `{}`", p @@ -248,7 +248,7 @@ impl Trait for X { proj_ty, values.expected, )) { - diag.help(&msg); + diag.help(msg); diag.note( "for more information, visit \ https://doc.rust-lang.org/book/ch19-03-advanced-traits.html", @@ -415,12 +415,12 @@ impl Trait for X { if !impl_comparison { // Generic suggestion when we can't be more specific. if callable_scope { - diag.help(&format!( + diag.help(format!( "{} or calling a method that returns `{}`", msg, values.expected )); } else { - diag.help(&msg); + diag.help(msg); } diag.note( "for more information, visit \ @@ -536,7 +536,7 @@ fn foo(&self) -> Self::T { String::new() } for (sp, label) in methods.into_iter() { span.push_span_label(sp, label); } - diag.span_help(span, &msg); + diag.span_help(span, msg); return true; } false diff --git a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs index bd1bfed3a0c9d..f1468cae455b5 100644 --- a/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs +++ b/compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs @@ -824,7 +824,7 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> { // resolution errors here; delay ICE in favor of those errors. self.tcx().sess.delay_span_bug( self.var_infos[node_idx].origin.span(), - &format!( + format!( "collect_error_for_expanding_node() could not find \ error for var {:?} in universe {:?}, lower_bounds={:#?}, \ upper_bounds={:#?}", diff --git a/compiler/rustc_infer/src/infer/opaque_types/table.rs b/compiler/rustc_infer/src/infer/opaque_types/table.rs index ae4b85c8799ef..a0f6d7ecab70f 100644 --- a/compiler/rustc_infer/src/infer/opaque_types/table.rs +++ b/compiler/rustc_infer/src/infer/opaque_types/table.rs @@ -42,7 +42,7 @@ impl<'tcx> Drop for OpaqueTypeStorage<'tcx> { fn drop(&mut self) { if !self.opaque_types.is_empty() { ty::tls::with(|tcx| { - tcx.sess.delay_span_bug(DUMMY_SP, &format!("{:?}", self.opaque_types)) + tcx.sess.delay_span_bug(DUMMY_SP, format!("{:?}", self.opaque_types)) }); } } diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index d3f7eeff9976c..9c20c814b697f 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -256,7 +256,7 @@ where // this point it never will be self.tcx.sess.delay_span_bug( origin.span(), - &format!("unresolved inference variable in outlives: {:?}", v), + format!("unresolved inference variable in outlives: {:?}", v), ); } } diff --git a/compiler/rustc_infer/src/infer/outlives/verify.rs b/compiler/rustc_infer/src/infer/outlives/verify.rs index e1cb53bc71d33..c86da22526b02 100644 --- a/compiler/rustc_infer/src/infer/outlives/verify.rs +++ b/compiler/rustc_infer/src/infer/outlives/verify.rs @@ -179,7 +179,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> { // this point it never will be self.tcx.sess.delay_span_bug( rustc_span::DUMMY_SP, - &format!("unresolved inference variable in outlives: {:?}", v), + format!("unresolved inference variable in outlives: {:?}", v), ); // add a bound that never holds VerifyBound::AnyBound(vec![]) diff --git a/compiler/rustc_infer/src/traits/error_reporting/mod.rs b/compiler/rustc_infer/src/traits/error_reporting/mod.rs index 4d53519581b37..b5a7d0326a88d 100644 --- a/compiler/rustc_infer/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/traits/error_reporting/mod.rs @@ -73,7 +73,7 @@ pub fn report_object_safety_error<'tcx>( format!("...because {}", violation.error_msg()) }; if spans.is_empty() { - err.note(&msg); + err.note(msg); } else { for span in spans { multi_span.push(span); diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 3c6dbb466db7a..71cf644eb5019 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -50,6 +50,14 @@ lint_deprecated_lint_name = lint_renamed_or_removed_lint = {$msg} .suggestion = use the new name +lint_suspicious_double_ref_op = + using `.{$call}()` on a double reference, which returns `{$ty}` instead of {$op -> + *[should_not_happen] [{$op}] + [deref] dereferencing + [borrow] borrowing + [clone] cloning + } the inner type + lint_unknown_lint = unknown lint: `{$name}` .suggestion = did you mean diff --git a/compiler/rustc_lint/src/context.rs b/compiler/rustc_lint/src/context.rs index 626c09fea07ac..d4898ffe883bc 100644 --- a/compiler/rustc_lint/src/context.rs +++ b/compiler/rustc_lint/src/context.rs @@ -616,7 +616,7 @@ pub trait LintContext: Sized { 1 => ("an ", ""), _ => ("", "s"), }; - db.span_label(span, &format!( + db.span_label(span, format!( "this comment contains {}invisible unicode text flow control codepoint{}", an, s, @@ -680,12 +680,12 @@ pub trait LintContext: Sized { ); } BuiltinLintDiagnostics::UnknownCrateTypes(span, note, sugg) => { - db.span_suggestion(span, ¬e, sugg, Applicability::MaybeIncorrect); + db.span_suggestion(span, note, sugg, Applicability::MaybeIncorrect); } BuiltinLintDiagnostics::UnusedImports(message, replaces, in_test_module) => { if !replaces.is_empty() { db.tool_only_multipart_suggestion( - &message, + message, replaces, Applicability::MachineApplicable, ); @@ -720,13 +720,13 @@ pub trait LintContext: Sized { } BuiltinLintDiagnostics::MissingAbi(span, default_abi) => { db.span_label(span, "ABI should be specified here"); - db.help(&format!("the default ABI is {}", default_abi.name())); + db.help(format!("the default ABI is {}", default_abi.name())); } BuiltinLintDiagnostics::LegacyDeriveHelpers(span) => { db.span_label(span, "the attribute is introduced here"); } BuiltinLintDiagnostics::ProcMacroBackCompat(note) => { - db.note(¬e); + db.note(note); } BuiltinLintDiagnostics::OrPatternsBackCompat(span,suggestion) => { db.span_suggestion(span, "use pat_param to preserve semantics", suggestion, Applicability::MachineApplicable); @@ -747,13 +747,13 @@ pub trait LintContext: Sized { } => { db.span_note( invoc_span, - &format!("the built-in attribute `{attr_name}` will be ignored, since it's applied to the macro invocation `{macro_name}`") + format!("the built-in attribute `{attr_name}` will be ignored, since it's applied to the macro invocation `{macro_name}`") ); } BuiltinLintDiagnostics::TrailingMacro(is_trailing, name) => { if is_trailing { db.note("macro invocations at the end of a block are treated as expressions"); - db.note(&format!("to ignore the value produced by the macro, add a semicolon after the invocation of `{name}`")); + db.note(format!("to ignore the value produced by the macro, add a semicolon after the invocation of `{name}`")); } } BuiltinLintDiagnostics::BreakWithLabelAndLoop(span) => { @@ -765,7 +765,7 @@ pub trait LintContext: Sized { ); } BuiltinLintDiagnostics::NamedAsmLabel(help) => { - db.help(&help); + db.help(help); db.note("see the asm section of Rust By Example for more information"); }, BuiltinLintDiagnostics::UnexpectedCfg((name, name_span), None) => { @@ -793,7 +793,7 @@ pub trait LintContext: Sized { possibilities.sort(); let possibilities = possibilities.join(", "); - db.note(&format!("expected values for `{name}` are: {possibilities}")); + db.note(format!("expected values for `{name}` are: {possibilities}")); } // Suggest the most probable if we found one @@ -801,7 +801,7 @@ pub trait LintContext: Sized { db.span_suggestion(value_span, "did you mean", format!("\"{best_match}\""), Applicability::MaybeIncorrect); } } else { - db.note(&format!("no expected value for `{name}`")); + db.note(format!("no expected value for `{name}`")); if name != sym::feature { db.span_suggestion(name_span.shrink_to_hi().to(value_span), "remove the value", "", Applicability::MaybeIncorrect); } diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index 65607d71805c3..9f1f5a26ee533 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -428,7 +428,7 @@ pub fn check_ast_node_inner<'a, T: EarlyLintPass>( for early_lint in lints { sess.delay_span_bug( early_lint.span, - &format!( + format!( "failed to process buffered lint here (dummy = {})", id == ast::DUMMY_NODE_ID ), diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 848f6a9ecb532..d7bacc6485f15 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -1150,6 +1150,14 @@ pub struct NoopMethodCallDiag<'a> { pub label: Span, } +#[derive(LintDiagnostic)] +#[diag(lint_suspicious_double_ref_op)] +pub struct SuspiciousDoubleRefDiag<'a> { + pub call: Symbol, + pub ty: Ty<'a>, + pub op: &'static str, +} + // pass_by_value.rs #[derive(LintDiagnostic)] #[diag(lint_pass_by_value)] diff --git a/compiler/rustc_lint/src/noop_method_call.rs b/compiler/rustc_lint/src/noop_method_call.rs index d67a00619dd09..d054966459d85 100644 --- a/compiler/rustc_lint/src/noop_method_call.rs +++ b/compiler/rustc_lint/src/noop_method_call.rs @@ -1,10 +1,11 @@ use crate::context::LintContext; -use crate::lints::NoopMethodCallDiag; +use crate::lints::{NoopMethodCallDiag, SuspiciousDoubleRefDiag}; use crate::LateContext; use crate::LateLintPass; use rustc_hir::def::DefKind; use rustc_hir::{Expr, ExprKind}; use rustc_middle::ty; +use rustc_middle::ty::adjustment::Adjust; use rustc_span::symbol::sym; declare_lint! { @@ -35,14 +36,44 @@ declare_lint! { "detects the use of well-known noop methods" } -declare_lint_pass!(NoopMethodCall => [NOOP_METHOD_CALL]); +declare_lint! { + /// The `suspicious_double_ref_op` lint checks for usage of `.clone()`/`.borrow()`/`.deref()` + /// on an `&&T` when `T: !Deref/Borrow/Clone`, which means the call will return the inner `&T`, + /// instead of performing the operation on the underlying `T` and can be confusing. + /// + /// ### Example + /// + /// ```rust + /// # #![allow(unused)] + /// struct Foo; + /// let foo = &&Foo; + /// let clone: &Foo = foo.clone(); + /// ``` + /// + /// {{produces}} + /// + /// ### Explanation + /// + /// Since `Foo` doesn't implement `Clone`, running `.clone()` only dereferences the double + /// reference, instead of cloning the inner type which should be what was intended. + pub SUSPICIOUS_DOUBLE_REF_OP, + Warn, + "suspicious call of trait method on `&&T`" +} + +declare_lint_pass!(NoopMethodCall => [NOOP_METHOD_CALL, SUSPICIOUS_DOUBLE_REF_OP]); impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { // We only care about method calls. - let ExprKind::MethodCall(call, receiver, ..) = &expr.kind else { - return + let ExprKind::MethodCall(call, receiver, _, call_span) = &expr.kind else { + return; }; + + if call_span.from_expansion() { + return; + } + // We only care about method calls corresponding to the `Clone`, `Deref` and `Borrow` // traits and ignore any other method call. let did = match cx.typeck_results().type_dependent_def(expr.hir_id) { @@ -70,25 +101,39 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall { }; // (Re)check that it implements the noop diagnostic. let Some(name) = cx.tcx.get_diagnostic_name(i.def_id()) else { return }; - if !matches!( - name, - sym::noop_method_borrow | sym::noop_method_clone | sym::noop_method_deref - ) { - return; - } + + let op = match name { + sym::noop_method_borrow => "borrow", + sym::noop_method_clone => "clone", + sym::noop_method_deref => "deref", + _ => return, + }; + let receiver_ty = cx.typeck_results().expr_ty(receiver); let expr_ty = cx.typeck_results().expr_ty_adjusted(expr); - if receiver_ty != expr_ty { - // This lint will only trigger if the receiver type and resulting expression \ - // type are the same, implying that the method call is unnecessary. + let arg_adjustments = cx.typeck_results().expr_adjustments(receiver); + + // If there is any user defined auto-deref step, then we don't want to warn. + // https://github.com/rust-lang/rust-clippy/issues/9272 + if arg_adjustments.iter().any(|adj| matches!(adj.kind, Adjust::Deref(Some(_)))) { return; } + let expr_span = expr.span; let span = expr_span.with_lo(receiver.span.hi()); - cx.emit_spanned_lint( - NOOP_METHOD_CALL, - span, - NoopMethodCallDiag { method: call.ident.name, receiver_ty, label: span }, - ); + + if receiver_ty == expr_ty { + cx.emit_spanned_lint( + NOOP_METHOD_CALL, + span, + NoopMethodCallDiag { method: call.ident.name, receiver_ty, label: span }, + ); + } else { + cx.emit_spanned_lint( + SUSPICIOUS_DOUBLE_REF_OP, + span, + SuspiciousDoubleRefDiag { call: call.ident.name, ty: expr_ty, op }, + ) + } } } diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs index 51b41b5f6a214..a44c1dd582ed3 100644 --- a/compiler/rustc_metadata/src/errors.rs +++ b/compiler/rustc_metadata/src/errors.rs @@ -498,7 +498,7 @@ impl IntoDiagnostic<'_> for MultipleCandidates { diag.code(error_code!(E0464)); diag.set_span(self.span); for (i, candidate) in self.candidates.iter().enumerate() { - diag.note(&format!("candidate #{}: {}", i + 1, candidate.display())); + diag.note(format!("candidate #{}: {}", i + 1, candidate.display())); } diag } diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index b855c8e433266..b43dcf3e5a183 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -287,7 +287,7 @@ impl<'tcx> Collector<'tcx> { &sess.parse_sess, sym::$feature, span, - &format!("linking modifier `{modifier}` is unstable"), + format!("linking modifier `{modifier}` is unstable"), ) .emit(); } diff --git a/compiler/rustc_middle/src/lint.rs b/compiler/rustc_middle/src/lint.rs index c61de97d53271..c266584ac280f 100644 --- a/compiler/rustc_middle/src/lint.rs +++ b/compiler/rustc_middle/src/lint.rs @@ -231,19 +231,19 @@ pub fn explain_lint_level_source( let name = lint.name_lower(); match src { LintLevelSource::Default => { - err.note_once(&format!("`#[{}({})]` on by default", level.as_str(), name)); + err.note_once(format!("`#[{}({})]` on by default", level.as_str(), name)); } LintLevelSource::CommandLine(lint_flag_val, orig_level) => { let flag = orig_level.to_cmd_flag(); let hyphen_case_lint_name = name.replace('_', "-"); if lint_flag_val.as_str() == name { - err.note_once(&format!( + err.note_once(format!( "requested on the command line with `{} {}`", flag, hyphen_case_lint_name )); } else { let hyphen_case_flag_val = lint_flag_val.as_str().replace('_', "-"); - err.note_once(&format!( + err.note_once(format!( "`{} {}` implied by `{} {}`", flag, hyphen_case_lint_name, flag, hyphen_case_flag_val )); @@ -256,7 +256,7 @@ pub fn explain_lint_level_source( err.span_note_once(span, "the lint level is defined here"); if lint_attr_name.as_str() != name { let level_str = level.as_str(); - err.note_once(&format!( + err.note_once(format!( "`#[{}({})]` implied by `#[{}({})]`", level_str, name, level_str, lint_attr_name )); @@ -444,12 +444,12 @@ pub fn struct_lint_level( }; if future_incompatible.explain_reason { - err.warn(&explanation); + err.warn(explanation); } if !future_incompatible.reference.is_empty() { let citation = format!("for more information, see {}", future_incompatible.reference); - err.note(&citation); + err.note(citation); } } diff --git a/compiler/rustc_middle/src/middle/stability.rs b/compiler/rustc_middle/src/middle/stability.rs index b61f7806b7a99..89fc864319df6 100644 --- a/compiler/rustc_middle/src/middle/stability.rs +++ b/compiler/rustc_middle/src/middle/stability.rs @@ -115,8 +115,8 @@ pub fn report_unstable( soft_handler(SOFT_UNSTABLE, span, &msg) } else { let mut err = - feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), &msg); - if let Some((inner_types, ref msg, sugg, applicability)) = suggestion { + feature_err_issue(&sess.parse_sess, feature, span, GateIssue::Library(issue), msg); + if let Some((inner_types, msg, sugg, applicability)) = suggestion { err.span_suggestion(inner_types, msg, sugg, applicability); } err.emit(); @@ -170,7 +170,7 @@ pub fn deprecation_suggestion( if let Some(suggestion) = suggestion { diag.span_suggestion_verbose( span, - &format!("replace the use of the deprecated {}", kind), + format!("replace the use of the deprecated {}", kind), suggestion, Applicability::MachineApplicable, ); @@ -599,7 +599,7 @@ impl<'tcx> TyCtxt<'tcx> { |span, def_id| { // The API could be uncallable for other reasons, for example when a private module // was referenced. - self.sess.delay_span_bug(span, &format!("encountered unmarked API: {:?}", def_id)); + self.sess.delay_span_bug(span, format!("encountered unmarked API: {:?}", def_id)); }, ) } diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 2490b17aac09b..858a3d266ea3c 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -3073,13 +3073,13 @@ mod size_asserts { use super::*; use rustc_data_structures::static_assert_size; // tidy-alphabetical-start - static_assert_size!(BasicBlockData<'_>, 144); + static_assert_size!(BasicBlockData<'_>, 136); static_assert_size!(LocalDecl<'_>, 40); static_assert_size!(SourceScopeData<'_>, 72); static_assert_size!(Statement<'_>, 32); static_assert_size!(StatementKind<'_>, 16); - static_assert_size!(Terminator<'_>, 112); - static_assert_size!(TerminatorKind<'_>, 96); + static_assert_size!(Terminator<'_>, 104); + static_assert_size!(TerminatorKind<'_>, 88); static_assert_size!(VarDebugInfo<'_>, 80); // tidy-alphabetical-end } diff --git a/compiler/rustc_middle/src/mir/syntax.rs b/compiler/rustc_middle/src/mir/syntax.rs index a8293ba18196a..33b7fe0c2dc55 100644 --- a/compiler/rustc_middle/src/mir/syntax.rs +++ b/compiler/rustc_middle/src/mir/syntax.rs @@ -651,7 +651,7 @@ pub enum TerminatorKind<'tcx> { Assert { cond: Operand<'tcx>, expected: bool, - msg: AssertMessage<'tcx>, + msg: Box>, target: BasicBlock, unwind: UnwindAction, }, diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 111993ec7a880..be2657d25a694 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -617,13 +617,11 @@ rustc_queries! { /// `is_const_fn` function. Consider using `is_const_fn` or `is_const_fn_raw` instead. query constness(key: DefId) -> hir::Constness { desc { |tcx| "checking if item is const: `{}`", tcx.def_path_str(key) } - cache_on_disk_if { key.is_local() } separate_provide_extern } query asyncness(key: DefId) -> hir::IsAsync { desc { |tcx| "checking if the function is async: `{}`", tcx.def_path_str(key) } - cache_on_disk_if { key.is_local() } separate_provide_extern } @@ -641,14 +639,12 @@ rustc_queries! { /// Returns `true` if this is a foreign item (i.e., linked via `extern { ... }`). query is_foreign_item(key: DefId) -> bool { desc { |tcx| "checking if `{}` is a foreign item", tcx.def_path_str(key) } - cache_on_disk_if { key.is_local() } separate_provide_extern } /// Returns `Some(generator_kind)` if the node pointed to by `def_id` is a generator. query generator_kind(def_id: DefId) -> Option { desc { |tcx| "looking up generator kind of `{}`", tcx.def_path_str(def_id) } - cache_on_disk_if { def_id.is_local() } separate_provide_extern } @@ -747,7 +743,6 @@ rustc_queries! { } query impl_polarity(impl_id: DefId) -> ty::ImplPolarity { desc { |tcx| "computing implementation polarity of `{}`", tcx.def_path_str(impl_id) } - cache_on_disk_if { impl_id.is_local() } separate_provide_extern } @@ -879,7 +874,6 @@ rustc_queries! { } query diagnostic_only_typeck(key: LocalDefId) -> &'tcx ty::TypeckResults<'tcx> { desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) } - cache_on_disk_if { true } } query used_trait_imports(key: LocalDefId) -> &'tcx UnordSet { @@ -1144,7 +1138,6 @@ rustc_queries! { query fn_arg_names(def_id: DefId) -> &'tcx [rustc_span::symbol::Ident] { desc { |tcx| "looking up function parameter names for `{}`", tcx.def_path_str(def_id) } - cache_on_disk_if { def_id.is_local() } separate_provide_extern } /// Gets the rendered value of the specified constant or associated constant. @@ -1152,12 +1145,10 @@ rustc_queries! { query rendered_const(def_id: DefId) -> &'tcx String { arena_cache desc { |tcx| "rendering constant initializer of `{}`", tcx.def_path_str(def_id) } - cache_on_disk_if { def_id.is_local() } separate_provide_extern } query impl_parent(def_id: DefId) -> Option { desc { |tcx| "computing specialization parent impl of `{}`", tcx.def_path_str(def_id) } - cache_on_disk_if { def_id.is_local() } separate_provide_extern } @@ -1410,7 +1401,6 @@ rustc_queries! { query impl_defaultness(def_id: DefId) -> hir::Defaultness { desc { |tcx| "looking up whether `{}` is a default impl", tcx.def_path_str(def_id) } - cache_on_disk_if { def_id.is_local() } separate_provide_extern feedable } diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index d69d42bb5d389..c237556420841 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -1010,10 +1010,7 @@ impl ObjectSafetyViolation { ) => { err.span_suggestion( *span, - &format!( - "consider changing method `{}`'s `self` parameter to be `&self`", - name - ), + format!("consider changing method `{}`'s `self` parameter to be `&self`", name), "&Self", Applicability::MachineApplicable, ); @@ -1021,7 +1018,7 @@ impl ObjectSafetyViolation { ObjectSafetyViolation::AssocConst(name, _) | ObjectSafetyViolation::GAT(name, _) | ObjectSafetyViolation::Method(name, ..) => { - err.help(&format!("consider moving `{}` to another trait", name)); + err.help(format!("consider moving `{}` to another trait", name)); } } } diff --git a/compiler/rustc_middle/src/ty/consts.rs b/compiler/rustc_middle/src/ty/consts.rs index 0a191ff7626b7..e7107c28bf407 100644 --- a/compiler/rustc_middle/src/ty/consts.rs +++ b/compiler/rustc_middle/src/ty/consts.rs @@ -114,7 +114,7 @@ impl<'tcx> Const<'tcx> { Err(e) => { tcx.sess.delay_span_bug( expr.span, - &format!("Const::from_anon_const: couldn't lit_to_const {:?}", e), + format!("Const::from_anon_const: couldn't lit_to_const {:?}", e), ); } } diff --git a/compiler/rustc_middle/src/ty/diagnostics.rs b/compiler/rustc_middle/src/ty/diagnostics.rs index ae0bb4949c743..6a29063b80db3 100644 --- a/compiler/rustc_middle/src/ty/diagnostics.rs +++ b/compiler/rustc_middle/src/ty/diagnostics.rs @@ -139,7 +139,7 @@ pub fn suggest_arbitrary_trait_bound<'tcx>( // Suggest a where clause bound for a non-type parameter. err.span_suggestion_verbose( generics.tail_span_for_predicate_suggestion(), - &format!( + format!( "consider {} `where` clause, but there might be an alternative better way to express \ this requirement", if generics.where_clause_span.is_empty() { "introducing a" } else { "extending the" }, @@ -242,7 +242,7 @@ pub fn suggest_constraining_type_params<'a>( err.span_label( param.span, - &format!("this type parameter needs to be `{}`", constraint), + format!("this type parameter needs to be `{}`", constraint), ); suggest_removing_unsized_bound(generics, &mut suggestions, param, def_id); } diff --git a/compiler/rustc_middle/src/ty/opaque_types.rs b/compiler/rustc_middle/src/ty/opaque_types.rs index 751f3066c9cc6..72710b78c9373 100644 --- a/compiler/rustc_middle/src/ty/opaque_types.rs +++ b/compiler/rustc_middle/src/ty/opaque_types.rs @@ -177,7 +177,7 @@ impl<'tcx> TypeFolder> for ReverseMapper<'tcx> { .sess .struct_span_err( self.span, - &format!( + format!( "type parameter `{}` is part of concrete type but not \ used in parameter list for the `impl Trait` type alias", ty diff --git a/compiler/rustc_middle/src/util/bug.rs b/compiler/rustc_middle/src/util/bug.rs index b73ae59390535..3dfd0824f9872 100644 --- a/compiler/rustc_middle/src/util/bug.rs +++ b/compiler/rustc_middle/src/util/bug.rs @@ -31,8 +31,8 @@ fn opt_span_bug_fmt>( tls::with_opt(move |tcx| { let msg = format!("{}: {}", location, args); match (tcx, span) { - (Some(tcx), Some(span)) => tcx.sess.diagnostic().span_bug(span, &msg), - (Some(tcx), None) => tcx.sess.diagnostic().bug(&msg), + (Some(tcx), Some(span)) => tcx.sess.diagnostic().span_bug(span, msg), + (Some(tcx), None) => tcx.sess.diagnostic().bug(msg), (None, _) => panic_any(msg), } }) diff --git a/compiler/rustc_mir_build/src/build/scope.rs b/compiler/rustc_mir_build/src/build/scope.rs index 4c66c5b8eaea4..56c87c402fe2b 100644 --- a/compiler/rustc_mir_build/src/build/scope.rs +++ b/compiler/rustc_mir_build/src/build/scope.rs @@ -1172,7 +1172,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { TerminatorKind::Assert { cond, expected, - msg, + msg: Box::new(msg), target: success_block, unwind: UnwindAction::Continue, }, diff --git a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs index 66d29931400f1..8cb3b00c9ad70 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/check_match.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/check_match.rs @@ -672,7 +672,7 @@ fn non_exhaustive_match<'p, 'tcx>( ty::Adt(def, _) if def.is_variant_list_non_exhaustive() && !def.did().is_local()); adt_defined_here(cx, &mut err, scrut_ty, &witnesses); - err.note(&format!( + err.note(format!( "the matched value is of type `{}`{}", scrut_ty, if is_variant_list_non_exhaustive { ", which is marked as non-exhaustive" } else { "" } @@ -682,13 +682,13 @@ fn non_exhaustive_match<'p, 'tcx>( && witnesses.len() == 1 && matches!(witnesses[0].ctor(), Constructor::NonExhaustive) { - err.note(&format!( + err.note(format!( "`{}` does not have a fixed maximum value, so a wildcard `_` is necessary to match \ exhaustively", scrut_ty, )); if cx.tcx.sess.is_nightly_build() { - err.help(&format!( + err.help(format!( "add `#![feature(precise_pointer_size_matching)]` to the crate attributes to \ enable precise `{}` matching", scrut_ty, @@ -793,9 +793,9 @@ fn non_exhaustive_match<'p, 'tcx>( }, ); if let Some((span, sugg)) = suggestion { - err.span_suggestion_verbose(span, &msg, sugg, Applicability::HasPlaceholders); + err.span_suggestion_verbose(span, msg, sugg, Applicability::HasPlaceholders); } else { - err.help(&msg); + err.help(msg); } err.emit(); } @@ -857,7 +857,7 @@ fn adt_defined_here<'p, 'tcx>( for pat in spans { span.push_span_label(pat, "not covered"); } - err.span_note(span, &format!("`{}` defined here", ty)); + err.span_note(span, format!("`{}` defined here", ty)); } } diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index 0a3423bdd3773..1cf2f7ec0fff1 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -229,7 +229,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> { self.lower_pattern_range(ty, lc, hc, end, lo_span, lo_expr, hi_expr) } None => { - let msg = &format!( + let msg = format!( "found bad range pattern `{:?}` outside of error recovery", (&lo, &hi), ); diff --git a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs index d8f66a1755b2b..f229b10c44767 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs @@ -685,10 +685,9 @@ enum ArmType { /// For example, if we are constructing a witness for the match against /// /// ```compile_fail,E0004 -/// # #![feature(type_ascription)] /// struct Pair(Option<(u32, u32)>, bool); /// # fn foo(p: Pair) { -/// match (p: Pair) { +/// match p { /// Pair(None, _) => {} /// Pair(_, false) => {} /// } diff --git a/compiler/rustc_mir_transform/src/check_alignment.rs b/compiler/rustc_mir_transform/src/check_alignment.rs index e99712eeef853..d60184e0ebef6 100644 --- a/compiler/rustc_mir_transform/src/check_alignment.rs +++ b/compiler/rustc_mir_transform/src/check_alignment.rs @@ -224,10 +224,10 @@ fn insert_alignment_check<'tcx>( cond: Operand::Copy(is_ok), expected: true, target: new_block, - msg: AssertKind::MisalignedPointerDereference { + msg: Box::new(AssertKind::MisalignedPointerDereference { required: Operand::Copy(alignment), found: Operand::Copy(addr), - }, + }), unwind: UnwindAction::Terminate, }, }); diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 880745b8f0eb7..deec66bbaf356 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -21,9 +21,9 @@ use rustc_target::spec::abi::Abi as CallAbi; use crate::MirPass; use rustc_const_eval::interpret::{ - self, compile_time_machine, AllocId, ConstAllocation, ConstValue, CtfeValidationMode, Frame, - ImmTy, Immediate, InterpCx, InterpResult, LocalValue, MemoryKind, OpTy, PlaceTy, Pointer, - Scalar, StackPopCleanup, + self, compile_time_machine, AllocId, ConstAllocation, ConstValue, Frame, ImmTy, Immediate, + InterpCx, InterpResult, LocalValue, MemoryKind, OpTy, PlaceTy, Pointer, Scalar, + StackPopCleanup, }; /// The maximum number of bytes that we'll allocate space for a local or the return value. @@ -464,16 +464,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { return None; } - // Do not try creating references, nor any types with potentially-complex - // invariants. This avoids an issue where checking validity would do a - // bunch of work generating a nice message about the invariant violation, - // only to not show it to anyone (since this isn't the lint). - Rvalue::Cast(CastKind::Transmute, op, dst_ty) if !dst_ty.is_primitive() => { - trace!("skipping Transmute of {:?} to {:?}", op, dst_ty); - - return None; - } - // There's no other checking to do at this time. Rvalue::Aggregate(..) | Rvalue::Use(..) @@ -591,18 +581,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } trace!("attempting to replace {:?} with {:?}", rval, value); - if let Err(e) = self.ecx.const_validate_operand( - value, - vec![], - // FIXME: is ref tracking too expensive? - // FIXME: what is the point of ref tracking if we do not even check the tracked refs? - &mut interpret::RefTracking::empty(), - CtfeValidationMode::Regular, - ) { - trace!("validation error, attempt failed: {:?}", e); - return; - } - // FIXME> figure out what to do when read_immediate_raw fails let imm = self.ecx.read_immediate_raw(value).ok(); diff --git a/compiler/rustc_mir_transform/src/elaborate_drops.rs b/compiler/rustc_mir_transform/src/elaborate_drops.rs index 443f469ce52db..98e7a519c2013 100644 --- a/compiler/rustc_mir_transform/src/elaborate_drops.rs +++ b/compiler/rustc_mir_transform/src/elaborate_drops.rs @@ -366,7 +366,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { if maybe_dead { self.tcx.sess.delay_span_bug( terminator.source_info.span, - &format!( + format!( "drop of untracked, uninitialized value {:?}, place {:?} ({:?})", bb, place, path ), @@ -440,7 +440,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { ) { self.tcx.sess.delay_span_bug( terminator.source_info.span, - &format!("drop of untracked value {:?}", bb), + format!("drop of untracked value {:?}", bb), ); } // A drop and replace behind a pointer/array/whatever. diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs index e44dd084b2de5..9e16c400f1479 100644 --- a/compiler/rustc_mir_transform/src/generator.rs +++ b/compiler/rustc_mir_transform/src/generator.rs @@ -865,7 +865,7 @@ fn sanitize_witness<'tcx>( _ => { tcx.sess.delay_span_bug( body.span, - &format!("unexpected generator witness type {:?}", witness.kind()), + format!("unexpected generator witness type {:?}", witness.kind()), ); return; } @@ -1150,7 +1150,7 @@ fn insert_panic_block<'tcx>( literal: ConstantKind::from_bool(tcx, false), })), expected: true, - msg: message, + msg: Box::new(message), target: assert_block, unwind: UnwindAction::Continue, }; @@ -1451,8 +1451,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform { ) } _ => { - tcx.sess - .delay_span_bug(body.span, &format!("unexpected generator type {}", gen_ty)); + tcx.sess.delay_span_bug(body.span, format!("unexpected generator type {}", gen_ty)); return; } }; diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 5ac9c8e2073dd..65162477b7bc5 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -843,7 +843,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } } mir::TerminatorKind::Assert { ref msg, .. } => { - let lang_item = match msg { + let lang_item = match &**msg { mir::AssertKind::BoundsCheck { .. } => LangItem::PanicBoundsCheck, _ => LangItem::Panic, }; diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index 9c4fac84fc294..9a5232b1bcdd9 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -420,6 +420,15 @@ parse_maybe_fn_typo_with_impl = you might have meant to write `impl` instead of parse_expected_fn_path_found_fn_keyword = expected identifier, found keyword `fn` .suggestion = use `Fn` to refer to the trait +parse_path_single_colon = path separator must be a double colon + .suggestion = use a double colon instead + +parse_colon_as_semi = statements are terminated with a semicolon + .suggestion = use a semicolon instead + +parse_type_ascription_removed = + if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 + parse_where_clause_before_tuple_struct_body = where clauses are not allowed before tuple struct bodies .label = unexpected where clause .name_label = while parsing this tuple struct diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index f286707a9c0df..b445ccc7ad0aa 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -1340,6 +1340,28 @@ pub(crate) struct ExpectedFnPathFoundFnKeyword { pub fn_token_span: Span, } +#[derive(Diagnostic)] +#[diag(parse_path_single_colon)] +pub(crate) struct PathSingleColon { + #[primary_span] + #[suggestion(applicability = "machine-applicable", code = "::")] + pub span: Span, + + #[note(parse_type_ascription_removed)] + pub type_ascription: Option<()>, +} + +#[derive(Diagnostic)] +#[diag(parse_colon_as_semi)] +pub(crate) struct ColonAsSemi { + #[primary_span] + #[suggestion(applicability = "machine-applicable", code = ";")] + pub span: Span, + + #[note(parse_type_ascription_removed)] + pub type_ascription: Option<()>, +} + #[derive(Diagnostic)] #[diag(parse_where_clause_before_tuple_struct_body)] pub(crate) struct WhereClauseBeforeTupleStructBody { diff --git a/compiler/rustc_parse/src/lexer/mod.rs b/compiler/rustc_parse/src/lexer/mod.rs index a4a75fcb96995..b1c0dedd3c7dc 100644 --- a/compiler/rustc_parse/src/lexer/mod.rs +++ b/compiler/rustc_parse/src/lexer/mod.rs @@ -321,7 +321,7 @@ impl<'a> StringReader<'a> { ) -> DiagnosticBuilder<'a, !> { self.sess .span_diagnostic - .struct_span_fatal(self.mk_sp(from_pos, to_pos), &format!("{}: {}", m, escaped_char(c))) + .struct_span_fatal(self.mk_sp(from_pos, to_pos), format!("{}: {}", m, escaped_char(c))) } /// Detect usages of Unicode codepoints changing the direction of the text on screen and loudly @@ -542,7 +542,7 @@ impl<'a> StringReader<'a> { err.span_label(self.mk_sp(start, start), "unterminated raw string"); if n_hashes > 0 { - err.note(&format!( + err.note(format!( "this raw string should be terminated with `\"{}`", "#".repeat(n_hashes as usize) )); diff --git a/compiler/rustc_parse/src/lexer/tokentrees.rs b/compiler/rustc_parse/src/lexer/tokentrees.rs index 7c2c0895193ed..318a299850902 100644 --- a/compiler/rustc_parse/src/lexer/tokentrees.rs +++ b/compiler/rustc_parse/src/lexer/tokentrees.rs @@ -199,8 +199,7 @@ impl<'a> TokenTreesReader<'a> { // matching opening delimiter). let token_str = token_to_string(&self.token); let msg = format!("unexpected closing delimiter: `{}`", token_str); - let mut err = - self.string_reader.sess.span_diagnostic.struct_span_err(self.token.span, &msg); + let mut err = self.string_reader.sess.span_diagnostic.struct_span_err(self.token.span, msg); report_suspicious_mismatch_block( &mut err, diff --git a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs index 0d12ec6081d83..d8bcf816fb263 100644 --- a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs +++ b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs @@ -129,7 +129,7 @@ pub(crate) fn emit_unescape_error( let label = if mode.is_byte() { "unknown byte escape" } else { "unknown character escape" }; let ec = escaped_char(c); - let mut diag = handler.struct_span_err(span, &format!("{}: `{}`", label, ec)); + let mut diag = handler.struct_span_err(span, format!("{}: `{}`", label, ec)); diag.span_label(span, label); if c == '{' || c == '}' && !mode.is_byte() { diag.help( @@ -180,13 +180,13 @@ pub(crate) fn emit_unescape_error( } else { String::new() }; - err.span_label(span, &format!("must be ASCII{}", postfix)); + err.span_label(span, format!("must be ASCII{}", postfix)); // Note: the \\xHH suggestions are not given for raw byte string // literals, because they are araw and so cannot use any escapes. if (c as u32) <= 0xFF && mode != Mode::RawByteStr { err.span_suggestion( span, - &format!( + format!( "if you meant to use the unicode code point for {:?}, use a \\xHH escape", c ), @@ -200,10 +200,7 @@ pub(crate) fn emit_unescape_error( utf8.push(c); err.span_suggestion( span, - &format!( - "if you meant to use the UTF-8 encoding of {:?}, use \\xHH escapes", - c - ), + format!("if you meant to use the UTF-8 encoding of {:?}, use \\xHH escapes", c), utf8.as_bytes() .iter() .map(|b: &u8| format!("\\x{:X}", *b)) diff --git a/compiler/rustc_parse/src/lexer/unicode_chars.rs b/compiler/rustc_parse/src/lexer/unicode_chars.rs index 1f027c08fc3b5..829d9693e55a6 100644 --- a/compiler/rustc_parse/src/lexer/unicode_chars.rs +++ b/compiler/rustc_parse/src/lexer/unicode_chars.rs @@ -350,7 +350,7 @@ pub(super) fn check_for_substitution( let Some((_, ascii_name, token)) = ASCII_ARRAY.iter().find(|&&(s, _, _)| s == ascii_str) else { let msg = format!("substitution character not found for '{}'", ch); - reader.sess.span_diagnostic.span_bug_no_panic(span, &msg); + reader.sess.span_diagnostic.span_bug_no_panic(span, msg); return (None, None); }; diff --git a/compiler/rustc_parse/src/lib.rs b/compiler/rustc_parse/src/lib.rs index 61a1cdeb540e9..25de780853291 100644 --- a/compiler/rustc_parse/src/lib.rs +++ b/compiler/rustc_parse/src/lib.rs @@ -153,7 +153,7 @@ fn try_file_to_source_file( ) -> Result, Diagnostic> { sess.source_map().load_file(path).map_err(|e| { let msg = format!("couldn't read {}: {}", path.display(), e); - let mut diag = Diagnostic::new(Level::Fatal, &msg); + let mut diag = Diagnostic::new(Level::Fatal, msg); if let Some(sp) = spanopt { diag.set_span(sp); } @@ -190,7 +190,7 @@ pub fn maybe_file_to_stream( override_span: Option, ) -> Result> { let src = source_file.src.as_ref().unwrap_or_else(|| { - sess.span_diagnostic.bug(&format!( + sess.span_diagnostic.bug(format!( "cannot lex `source_file` without source: {}", sess.source_map().filename_for_diagnostics(&source_file.name) )); @@ -247,7 +247,7 @@ pub fn parse_cfg_attr( match parse_in(parse_sess, tokens.clone(), "`cfg_attr` input", |p| p.parse_cfg_attr()) { Ok(r) => return Some(r), Err(mut e) => { - e.help(&format!("the valid syntax is `{}`", CFG_ATTR_GRAMMAR_HELP)) + e.help(format!("the valid syntax is `{}`", CFG_ATTR_GRAMMAR_HELP)) .note(CFG_ATTR_NOTE_REF) .emit(); } diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 0e041df898cac..513f51a3b5cf1 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -4,7 +4,7 @@ use super::{ TokenExpectType, TokenType, }; use crate::errors::{ - AmbiguousPlus, AttributeOnParamType, BadQPathStage2, BadTypePlus, BadTypePlusSub, + AmbiguousPlus, AttributeOnParamType, BadQPathStage2, BadTypePlus, BadTypePlusSub, ColonAsSemi, ComparisonOperatorsCannotBeChained, ComparisonOperatorsCannotBeChainedSugg, ConstGenericWithoutBraces, ConstGenericWithoutBracesSugg, DocCommentDoesNotDocumentAnything, DocCommentOnParamType, DoubleColonInBound, ExpectedIdentifier, ExpectedSemi, ExpectedSemiSugg, @@ -84,6 +84,7 @@ impl RecoverQPath for Ty { } impl RecoverQPath for Pat { + const PATH_STYLE: PathStyle = PathStyle::Pat; fn to_ty(&self) -> Option> { self.to_ty() } @@ -206,11 +207,11 @@ struct MultiSugg { impl MultiSugg { fn emit(self, err: &mut Diagnostic) { - err.multipart_suggestion(&self.msg, self.patches, self.applicability); + err.multipart_suggestion(self.msg, self.patches, self.applicability); } fn emit_verbose(self, err: &mut Diagnostic) { - err.multipart_suggestion_verbose(&self.msg, self.patches, self.applicability); + err.multipart_suggestion_verbose(self.msg, self.patches, self.applicability); } } @@ -590,13 +591,13 @@ impl<'a> Parser<'a> { }; self.last_unexpected_token_span = Some(self.token.span); // FIXME: translation requires list formatting (for `expect`) - let mut err = self.struct_span_err(self.token.span, &msg_exp); + let mut err = self.struct_span_err(self.token.span, msg_exp); if let TokenKind::Ident(symbol, _) = &self.prev_token.kind { if ["def", "fun", "func", "function"].contains(&symbol.as_str()) { err.span_suggestion_short( self.prev_token.span, - &format!("write `fn` instead of `{symbol}` to declare a function"), + format!("write `fn` instead of `{symbol}` to declare a function"), "fn", Applicability::MachineApplicable, ); @@ -663,7 +664,6 @@ impl<'a> Parser<'a> { err.span_label(sp, label_exp); err.span_label(self.token.span, "unexpected token"); } - self.maybe_annotate_with_ascription(&mut err, false); Err(err) } @@ -695,13 +695,13 @@ impl<'a> Parser<'a> { err.set_span(span); err.span_suggestion( span, - &format!("remove the extra `#`{}", pluralize!(count)), + format!("remove the extra `#`{}", pluralize!(count)), "", Applicability::MachineApplicable, ); err.span_label( str_span, - &format!("this raw string started with {n_hashes} `#`{}", pluralize!(n_hashes)), + format!("this raw string started with {n_hashes} `#`{}", pluralize!(n_hashes)), ); true } @@ -788,59 +788,6 @@ impl<'a> Parser<'a> { None } - pub fn maybe_annotate_with_ascription( - &mut self, - err: &mut Diagnostic, - maybe_expected_semicolon: bool, - ) { - if let Some((sp, likely_path)) = self.last_type_ascription.take() { - let sm = self.sess.source_map(); - let next_pos = sm.lookup_char_pos(self.token.span.lo()); - let op_pos = sm.lookup_char_pos(sp.hi()); - - let allow_unstable = self.sess.unstable_features.is_nightly_build(); - - if likely_path { - err.span_suggestion( - sp, - "maybe write a path separator here", - "::", - if allow_unstable { - Applicability::MaybeIncorrect - } else { - Applicability::MachineApplicable - }, - ); - self.sess.type_ascription_path_suggestions.borrow_mut().insert(sp); - } else if op_pos.line != next_pos.line && maybe_expected_semicolon { - err.span_suggestion( - sp, - "try using a semicolon", - ";", - Applicability::MaybeIncorrect, - ); - } else if allow_unstable { - err.span_label(sp, "tried to parse a type due to this type ascription"); - } else { - err.span_label(sp, "tried to parse a type due to this"); - } - if allow_unstable { - // Give extra information about type ascription only if it's a nightly compiler. - err.note( - "`#![feature(type_ascription)]` lets you annotate an expression with a type: \ - `: `", - ); - if !likely_path { - // Avoid giving too much info when it was likely an unrelated typo. - err.note( - "see issue #23416 \ - for more information", - ); - } - } - } - } - /// Eats and discards tokens until one of `kets` is encountered. Respects token trees, /// passes through any errors encountered. Used for error recovery. pub(super) fn eat_to_tokens(&mut self, kets: &[&TokenKind]) { @@ -1413,12 +1360,12 @@ impl<'a> Parser<'a> { ) -> PResult<'a, P> { let mut err = self.struct_span_err( op_span, - &format!("Rust has no {} {} operator", kind.fixity, kind.op.name()), + format!("Rust has no {} {} operator", kind.fixity, kind.op.name()), ); - err.span_label(op_span, &format!("not a valid {} operator", kind.fixity)); + err.span_label(op_span, format!("not a valid {} operator", kind.fixity)); let help_base_case = |mut err: DiagnosticBuilder<'_, _>, base| { - err.help(&format!("use `{}= 1` instead", kind.op.chr())); + err.help(format!("use `{}= 1` instead", kind.op.chr())); err.emit(); Ok(base) }; @@ -1607,7 +1554,7 @@ impl<'a> Parser<'a> { _ => this_token_str, }, ); - let mut err = self.struct_span_err(sp, &msg); + let mut err = self.struct_span_err(sp, msg); let label_exp = format!("expected `{token_str}`"); let sm = self.sess.source_map(); if !sm.is_multiline(prev_sp.until(sp)) { @@ -1622,12 +1569,36 @@ impl<'a> Parser<'a> { } pub(super) fn expect_semi(&mut self) -> PResult<'a, ()> { - if self.eat(&token::Semi) { + if self.eat(&token::Semi) || self.recover_colon_as_semi() { return Ok(()); } self.expect(&token::Semi).map(drop) // Error unconditionally } + pub(super) fn recover_colon_as_semi(&mut self) -> bool { + let line_idx = |span: Span| { + self.sess + .source_map() + .span_to_lines(span) + .ok() + .and_then(|lines| Some(lines.lines.get(0)?.line_index)) + }; + + if self.may_recover() + && self.token == token::Colon + && self.look_ahead(1, |next| line_idx(self.token.span) < line_idx(next.span)) + { + self.sess.emit_err(ColonAsSemi { + span: self.token.span, + type_ascription: self.sess.unstable_features.is_nightly_build().then_some(()), + }); + self.bump(); + return true; + } + + false + } + /// Consumes alternative await syntaxes like `await!()`, `await `, /// `await? `, `await()`, and `await { }`. pub(super) fn recover_incorrect_await_syntax( @@ -1734,7 +1705,7 @@ impl<'a> Parser<'a> { Applicability::MachineApplicable, ); } - err.span_suggestion(lo.shrink_to_lo(), &format!("{prefix}you can still access the deprecated `try!()` macro using the \"raw identifier\" syntax"), "r#", Applicability::MachineApplicable); + err.span_suggestion(lo.shrink_to_lo(), format!("{prefix}you can still access the deprecated `try!()` macro using the \"raw identifier\" syntax"), "r#", Applicability::MachineApplicable); err.emit(); Ok(self.mk_expr_err(lo.to(hi))) } else { @@ -1790,24 +1761,6 @@ impl<'a> Parser<'a> { } } - pub(super) fn could_ascription_be_path(&self, node: &ast::ExprKind) -> bool { - (self.token == token::Lt && // `foo:` - } - pub(super) fn recover_seq_parse_error( &mut self, delim: Delimiter, @@ -1902,7 +1855,6 @@ impl<'a> Parser<'a> { && brace_depth == 0 && bracket_depth == 0 => { - debug!("recover_stmt_ return - Semi"); break; } _ => self.bump(), @@ -2108,7 +2060,7 @@ impl<'a> Parser<'a> { format!("expected expression, found {}", super::token_descr(&self.token),), ), }; - let mut err = self.struct_span_err(span, &msg); + let mut err = self.struct_span_err(span, msg); let sp = self.sess.source_map().start_point(self.token.span); if let Some(sp) = self.sess.ambiguous_block_expr_parse.borrow().get(&sp) { err.subdiagnostic(ExprParenthesesNeeded::surrounding(*sp)); @@ -2179,7 +2131,7 @@ impl<'a> Parser<'a> { // arguments after a comma. let mut err = self.struct_span_err( self.token.span, - &format!("expected one of `,` or `>`, found {}", super::token_descr(&self.token)), + format!("expected one of `,` or `>`, found {}", super::token_descr(&self.token)), ); err.span_label(self.token.span, "expected one of `,` or `>`"); match self.recover_const_arg(arg.span(), err) { @@ -2606,7 +2558,7 @@ impl<'a> Parser<'a> { let mut err = self.struct_span_err(comma_span, "unexpected `,` in pattern"); if let Ok(seq_snippet) = self.span_to_snippet(seq_span) { err.multipart_suggestion( - &format!( + format!( "try adding parentheses to match on a tuple{}", if let CommaRecoveryMode::LikelyTuple = rt { "" } else { "..." }, ), diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index bff9de5c652f9..f58f8919e5c9d 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -174,10 +174,8 @@ impl<'a> Parser<'a> { self.parse_expr_prefix(attrs)? } }; - let last_type_ascription_set = self.last_type_ascription.is_some(); if !self.should_continue_as_assoc_expr(&lhs) { - self.last_type_ascription = None; return Ok(lhs); } @@ -301,9 +299,6 @@ impl<'a> Parser<'a> { if op == AssocOp::As { lhs = self.parse_assoc_op_cast(lhs, lhs_span, ExprKind::Cast)?; continue; - } else if op == AssocOp::Colon { - lhs = self.parse_assoc_op_ascribe(lhs, lhs_span)?; - continue; } else if op == AssocOp::DotDot || op == AssocOp::DotDotEq { // If we didn't have to handle `x..`/`x..=`, it would be pretty easy to // generalise it to the Fixity::None code. @@ -364,7 +359,7 @@ impl<'a> Parser<'a> { let aopexpr = self.mk_assign_op(source_map::respan(cur_op_span, aop), lhs, rhs); self.mk_expr(span, aopexpr) } - AssocOp::As | AssocOp::Colon | AssocOp::DotDot | AssocOp::DotDotEq => { + AssocOp::As | AssocOp::DotDot | AssocOp::DotDotEq => { self.span_bug(span, "AssocOp should have been handled by special case") } }; @@ -373,9 +368,7 @@ impl<'a> Parser<'a> { break; } } - if last_type_ascription_set { - self.last_type_ascription = None; - } + Ok(lhs) } @@ -743,7 +736,7 @@ impl<'a> Parser<'a> { ( // `foo: ` ExprKind::Path(None, ast::Path { segments, .. }), - TokenKind::Ident(kw::For | kw::Loop | kw::While, false), + token::Ident(kw::For | kw::Loop | kw::While, false), ) if segments.len() == 1 => { let snapshot = self.create_snapshot_for_diagnostic(); let label = Label { @@ -838,21 +831,19 @@ impl<'a> Parser<'a> { &mut self, cast_expr: P, ) -> PResult<'a, P> { + if let ExprKind::Type(_, _) = cast_expr.kind { + panic!("ExprKind::Type must not be parsed"); + } + let span = cast_expr.span; - let (cast_kind, maybe_ascription_span) = - if let ExprKind::Type(ascripted_expr, _) = &cast_expr.kind { - ("type ascription", Some(ascripted_expr.span.shrink_to_hi().with_hi(span.hi()))) - } else { - ("cast", None) - }; let with_postfix = self.parse_expr_dot_or_call_with_(cast_expr, span)?; // Check if an illegal postfix operator has been added after the cast. // If the resulting expression is not a cast, it is an illegal postfix operator. - if !matches!(with_postfix.kind, ExprKind::Cast(_, _) | ExprKind::Type(_, _)) { + if !matches!(with_postfix.kind, ExprKind::Cast(_, _)) { let msg = format!( - "{cast_kind} cannot be followed by {}", + "cast cannot be followed by {}", match with_postfix.kind { ExprKind::Index(_, _) => "indexing", ExprKind::Try(_) => "`?`", @@ -864,7 +855,7 @@ impl<'a> Parser<'a> { _ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"), } ); - let mut err = self.struct_span_err(span, &msg); + let mut err = self.struct_span_err(span, msg); let suggest_parens = |err: &mut Diagnostic| { let suggestions = vec![ @@ -878,44 +869,13 @@ impl<'a> Parser<'a> { ); }; - // If type ascription is "likely an error", the user will already be getting a useful - // help message, and doesn't need a second. - if self.last_type_ascription.map_or(false, |last_ascription| last_ascription.1) { - self.maybe_annotate_with_ascription(&mut err, false); - } else if let Some(ascription_span) = maybe_ascription_span { - let is_nightly = self.sess.unstable_features.is_nightly_build(); - if is_nightly { - suggest_parens(&mut err); - } - err.span_suggestion( - ascription_span, - &format!( - "{}remove the type ascription", - if is_nightly { "alternatively, " } else { "" } - ), - "", - if is_nightly { - Applicability::MaybeIncorrect - } else { - Applicability::MachineApplicable - }, - ); - } else { - suggest_parens(&mut err); - } + suggest_parens(&mut err); + err.emit(); }; Ok(with_postfix) } - fn parse_assoc_op_ascribe(&mut self, lhs: P, lhs_span: Span) -> PResult<'a, P> { - let maybe_path = self.could_ascription_be_path(&lhs.kind); - self.last_type_ascription = Some((self.prev_token.span, maybe_path)); - let lhs = self.parse_assoc_op_cast(lhs, lhs_span, ExprKind::Type)?; - self.sess.gated_spans.gate(sym::type_ascription, lhs.span); - Ok(lhs) - } - /// Parse `& mut? ` or `& raw [ const | mut ] `. fn parse_expr_borrow(&mut self, lo: Span) -> PResult<'a, (Span, ExprKind)> { self.expect_and()?; @@ -1010,7 +970,7 @@ impl<'a> Parser<'a> { }; if has_dot { // expr.f - e = self.parse_expr_dot_suffix(lo, e)?; + e = self.parse_dot_suffix_expr(lo, e)?; continue; } if self.expr_is_complete(&e) { @@ -1024,13 +984,7 @@ impl<'a> Parser<'a> { } } - fn look_ahead_type_ascription_as_field(&mut self) -> bool { - self.look_ahead(1, |t| t.is_ident()) - && self.look_ahead(2, |t| t == &token::Colon) - && self.look_ahead(3, |t| t.can_begin_expr()) - } - - fn parse_expr_dot_suffix(&mut self, lo: Span, base: P) -> PResult<'a, P> { + fn parse_dot_suffix_expr(&mut self, lo: Span, base: P) -> PResult<'a, P> { match self.token.uninterpolate().kind { token::Ident(..) => self.parse_dot_suffix(base, lo), token::Literal(token::Lit { kind: token::Integer, symbol, suffix }) => { @@ -1183,9 +1137,7 @@ impl<'a> Parser<'a> { /// Parse a function call expression, `expr(...)`. fn parse_expr_fn_call(&mut self, lo: Span, fun: P) -> P { - let snapshot = if self.token.kind == token::OpenDelim(Delimiter::Parenthesis) - && self.look_ahead_type_ascription_as_field() - { + let snapshot = if self.token.kind == token::OpenDelim(Delimiter::Parenthesis) { Some((self.create_snapshot_for_diagnostic(), fun.kind.clone())) } else { None @@ -1216,7 +1168,6 @@ impl<'a> Parser<'a> { if !self.may_recover() { return None; } - match (seq.as_mut(), snapshot) { (Err(err), Some((mut snapshot, ExprKind::Path(None, path)))) => { snapshot.bump(); // `(` @@ -1260,9 +1211,7 @@ impl<'a> Parser<'a> { return Some(self.mk_expr_err(span)); } Ok(_) => {} - Err(mut err) => { - err.emit(); - } + Err(err) => err.cancel(), } } _ => {} @@ -1516,7 +1465,6 @@ impl<'a> Parser<'a> { let mac = P(MacCall { path, args: self.parse_delim_args()?, - prior_type_ascription: self.last_type_ascription, }); (lo.to(self.prev_token.span), ExprKind::MacCall(mac)) } else if self.check(&token::OpenDelim(Delimiter::Brace)) @@ -1535,7 +1483,7 @@ impl<'a> Parser<'a> { } /// Parse `'label: $expr`. The label is already parsed. - fn parse_expr_labeled( + pub(super) fn parse_expr_labeled( &mut self, label_: Label, mut consume_colon: bool, @@ -1855,7 +1803,7 @@ impl<'a> Parser<'a> { let token = self.token.clone(); let err = |self_: &Self| { let msg = format!("unexpected token: {}", super::token_descr(&token)); - self_.struct_span_err(token.span, &msg) + self_.struct_span_err(token.span, msg) }; // On an error path, eagerly consider a lifetime to be an unclosed character lit if self.token.is_lifetime() { @@ -3013,6 +2961,11 @@ impl<'a> Parser<'a> { } else { e.span_label(pth.span, "while parsing this struct"); } + + if !recover { + return Err(e); + } + e.emit(); // If the next token is a comma, then try to parse @@ -3024,6 +2977,7 @@ impl<'a> Parser<'a> { break; } } + None } }; diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 9e003bfc09747..d7bfc432d54d3 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -71,7 +71,7 @@ impl<'a> Parser<'a> { if !self.eat(term) { let token_str = super::token_descr(&self.token); if !self.maybe_consume_incorrect_semicolon(&items) { - let msg = &format!("expected item, found {token_str}"); + let msg = format!("expected item, found {token_str}"); let mut err = self.struct_span_err(self.token.span, msg); let label = if self.is_kw_followed_by_ident(kw::Let) { "consider using `const` or `static` instead of `let` for global variables" @@ -443,7 +443,7 @@ impl<'a> Parser<'a> { Ok(args) => { self.eat_semi_for_macro_if_needed(&args); self.complain_if_pub_macro(vis, false); - Ok(MacCall { path, args, prior_type_ascription: self.last_type_ascription }) + Ok(MacCall { path, args }) } Err(mut err) => { @@ -1429,7 +1429,7 @@ impl<'a> Parser<'a> { VariantData::Struct(fields, recovered) } else { let token_str = super::token_descr(&self.token); - let msg = &format!("expected `where` or `{{` after union name, found {token_str}"); + let msg = format!("expected `where` or `{{` after union name, found {token_str}"); let mut err = self.struct_span_err(self.token.span, msg); err.span_label(self.token.span, "expected `where` or `{` after union name"); return Err(err); @@ -1465,7 +1465,7 @@ impl<'a> Parser<'a> { self.eat(&token::CloseDelim(Delimiter::Brace)); } else { let token_str = super::token_descr(&self.token); - let msg = &format!( + let msg = format!( "expected {}`{{` after struct name, found {}", if parsed_where { "" } else { "`where`, or " }, token_str @@ -1602,7 +1602,7 @@ impl<'a> Parser<'a> { let sp = self.prev_token.span.shrink_to_hi(); let mut err = self.struct_span_err( sp, - &format!("expected `,`, or `}}`, found {}", super::token_descr(&self.token)), + format!("expected `,`, or `}}`, found {}", super::token_descr(&self.token)), ); // Try to recover extra trailing angle brackets @@ -1740,7 +1740,7 @@ impl<'a> Parser<'a> { Ok(_) => { let mut err = self.struct_span_err( lo.to(self.prev_token.span), - &format!("functions are not allowed in {adt_ty} definitions"), + format!("functions are not allowed in {adt_ty} definitions"), ); err.help( "unlike in C++, Java, and C#, functions are declared in `impl` blocks", @@ -1759,7 +1759,7 @@ impl<'a> Parser<'a> { Ok((ident, _)) => { let mut err = self.struct_span_err( lo.with_hi(ident.span.hi()), - &format!("structs are not allowed in {adt_ty} definitions"), + format!("structs are not allowed in {adt_ty} definitions"), ); err.help("consider creating a new `struct` definition instead of nesting"); err @@ -2228,11 +2228,11 @@ impl<'a> Parser<'a> { err.span_suggestion( self.token.uninterpolated_span(), - &format!("`{original_kw}` already used earlier, remove this one"), + format!("`{original_kw}` already used earlier, remove this one"), "", Applicability::MachineApplicable, ) - .span_note(original_sp, &format!("`{original_kw}` first seen here")); + .span_note(original_sp, format!("`{original_kw}` first seen here")); } // The keyword has not been seen yet, suggest correct placement in the function front matter else if let Some(WrongKw::Misplaced(correct_pos_sp)) = wrong_kw { @@ -2243,7 +2243,7 @@ impl<'a> Parser<'a> { err.span_suggestion( correct_pos_sp.to(misplaced_qual_sp), - &format!("`{misplaced_qual}` must come before `{current_qual}`"), + format!("`{misplaced_qual}` must come before `{current_qual}`"), format!("{misplaced_qual} {current_qual}"), Applicability::MachineApplicable, ).note("keyword order for functions declaration is `pub`, `default`, `const`, `async`, `unsafe`, `extern`"); @@ -2267,7 +2267,7 @@ impl<'a> Parser<'a> { if matches!(orig_vis.kind, VisibilityKind::Inherited) { err.span_suggestion( sp_start.to(self.prev_token.span), - &format!("visibility `{vs}` must come before `{snippet}`"), + format!("visibility `{vs}` must come before `{snippet}`"), format!("{vs} {snippet}"), Applicability::MachineApplicable, ); diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 1c34e491f210e..0c265d7af0e6e 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -148,9 +148,6 @@ pub struct Parser<'a> { max_angle_bracket_count: u32, last_unexpected_token_span: Option, - /// Span pointing at the `:` for the last type ascription the parser has seen, and whether it - /// looked like it could have been a mistyped path or literal `Option:Some(42)`). - pub last_type_ascription: Option<(Span, bool /* likely path typo */)>, /// If present, this `Parser` is not parsing Rust code but rather a macro call. subparser_name: Option<&'static str>, capture_state: CaptureState, @@ -165,7 +162,7 @@ pub struct Parser<'a> { // This type is used a lot, e.g. it's cloned when matching many declarative macro rules with nonterminals. Make sure // it doesn't unintentionally get bigger. #[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))] -rustc_data_structures::static_assert_size!(Parser<'_>, 288); +rustc_data_structures::static_assert_size!(Parser<'_>, 272); /// Stores span information about a closure. #[derive(Clone)] @@ -470,7 +467,6 @@ impl<'a> Parser<'a> { unmatched_angle_bracket_count: 0, max_angle_bracket_count: 0, last_unexpected_token_span: None, - last_type_ascription: None, subparser_name, capture_state: CaptureState { capturing: Capturing::No, @@ -909,7 +905,7 @@ impl<'a> Parser<'a> { expect_err .span_suggestion_verbose( self.prev_token.span.shrink_to_hi().until(self.token.span), - &msg, + msg, " @ ", Applicability::MaybeIncorrect, ) @@ -925,7 +921,7 @@ impl<'a> Parser<'a> { expect_err .span_suggestion_short( sp, - &format!("missing `{}`", token_str), + format!("missing `{}`", token_str), token_str, Applicability::MaybeIncorrect, ) @@ -941,10 +937,14 @@ impl<'a> Parser<'a> { // propagate the help message from sub error 'e' to main error 'expect_err; expect_err.children.push(xx.clone()); } - expect_err.emit(); - e.cancel(); - break; + if self.token == token::Colon { + // we will try to recover in `maybe_recover_struct_lit_bad_delims` + return Err(expect_err); + } else { + expect_err.emit(); + break; + } } } } diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index f2422fe307c5f..c317d96368ee6 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -406,11 +406,11 @@ impl<'a> Parser<'a> { // Parse pattern starting with a path let (qself, path) = if self.eat_lt() { // Parse a qualified path - let (qself, path) = self.parse_qpath(PathStyle::Expr)?; + let (qself, path) = self.parse_qpath(PathStyle::Pat)?; (Some(qself), path) } else { // Parse an unqualified path - (None, self.parse_path(PathStyle::Expr)?) + (None, self.parse_path(PathStyle::Pat)?) }; let span = lo.to(self.prev_token.span); @@ -444,7 +444,7 @@ impl<'a> Parser<'a> { super::token_descr(&self_.token) ); - let mut err = self_.struct_span_err(self_.token.span, &msg); + let mut err = self_.struct_span_err(self_.token.span, msg); err.span_label(self_.token.span, format!("expected {}", expected)); err }); @@ -666,7 +666,7 @@ impl<'a> Parser<'a> { fn parse_pat_mac_invoc(&mut self, path: Path) -> PResult<'a, PatKind> { self.bump(); let args = self.parse_delim_args()?; - let mac = P(MacCall { path, args, prior_type_ascription: self.last_type_ascription }); + let mac = P(MacCall { path, args }); Ok(PatKind::MacCall(mac)) } @@ -680,7 +680,7 @@ impl<'a> Parser<'a> { let expected = Expected::to_string_or_fallback(expected); let msg = format!("expected {}, found {}", expected, super::token_descr(&self.token)); - let mut err = self.struct_span_err(self.token.span, &msg); + let mut err = self.struct_span_err(self.token.span, msg); err.span_label(self.token.span, format!("expected {}", expected)); let sp = self.sess.source_map().start_point(self.token.span); @@ -789,11 +789,11 @@ impl<'a> Parser<'a> { let lo = self.token.span; let (qself, path) = if self.eat_lt() { // Parse a qualified path - let (qself, path) = self.parse_qpath(PathStyle::Expr)?; + let (qself, path) = self.parse_qpath(PathStyle::Pat)?; (Some(qself), path) } else { // Parse an unqualified path - (None, self.parse_path(PathStyle::Expr)?) + (None, self.parse_path(PathStyle::Pat)?) }; let hi = self.prev_token.span; Ok(self.mk_expr(lo.to(hi), ExprKind::Path(qself, path))) @@ -978,7 +978,7 @@ impl<'a> Parser<'a> { break; } let token_str = super::token_descr(&self.token); - let msg = &format!("expected `}}`, found {}", token_str); + let msg = format!("expected `}}`, found {}", token_str); let mut err = self.struct_span_err(self.token.span, msg); err.span_label(self.token.span, "expected `}`"); diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index ae73760bd8cab..47822a9ac7807 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -1,5 +1,6 @@ use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign}; use super::{Parser, Restrictions, TokenType}; +use crate::errors::PathSingleColon; use crate::{errors, maybe_whole}; use rustc_ast::ptr::P; use rustc_ast::token::{self, Delimiter, Token, TokenKind}; @@ -8,7 +9,7 @@ use rustc_ast::{ AssocConstraintKind, BlockCheckMode, GenericArg, GenericArgs, Generics, ParenthesizedArgs, Path, PathSegment, QSelf, }; -use rustc_errors::{Applicability, PResult}; +use rustc_errors::{Applicability, IntoDiagnostic, PResult}; use rustc_span::source_map::{BytePos, Span}; use rustc_span::symbol::{kw, sym, Ident}; use std::mem; @@ -24,7 +25,19 @@ pub enum PathStyle { /// In all such contexts the non-path interpretation is preferred by default for practical /// reasons, but the path interpretation can be forced by the disambiguator `::`, e.g. /// `x` - comparisons, `x::` - unambiguously a path. + /// + /// Also, a path may never be followed by a `:`. This means that we can eagerly recover if + /// we encounter it. Expr, + /// The same as `Expr`, but may be followed by a `:`. + /// For example, this code: + /// ```rust + /// struct S; + /// + /// let S: S; + /// // ^ Followed by a `:` + /// ``` + Pat, /// In other contexts, notably in types, no ambiguity exists and paths can be written /// without the disambiguator, e.g., `x` - unambiguously a path. /// Paths with disambiguators are still accepted, `x::` - unambiguously a path too. @@ -38,6 +51,12 @@ pub enum PathStyle { Mod, } +impl PathStyle { + fn has_generic_ambiguity(&self) -> bool { + matches!(self, Self::Expr | Self::Pat) + } +} + impl<'a> Parser<'a> { /// Parses a qualified path. /// Assumes that the leading `<` has been parsed already. @@ -183,7 +202,6 @@ impl<'a> Parser<'a> { segments.push(PathSegment::path_root(lo.shrink_to_lo().with_ctxt(mod_sep_ctxt))); } self.parse_path_segments(&mut segments, style, ty_generics)?; - Ok(Path { segments, span: lo.to(self.prev_token.span), tokens: None }) } @@ -195,7 +213,7 @@ impl<'a> Parser<'a> { ) -> PResult<'a, ()> { loop { let segment = self.parse_path_segment(style, ty_generics)?; - if style == PathStyle::Expr { + if style.has_generic_ambiguity() { // In order to check for trailing angle brackets, we must have finished // recursing (`parse_path_segment` can indirectly call this function), // that is, the next token must be the highlighted part of the below example: @@ -217,6 +235,29 @@ impl<'a> Parser<'a> { segments.push(segment); if self.is_import_coupler() || !self.eat(&token::ModSep) { + if style == PathStyle::Expr + && self.may_recover() + && self.token == token::Colon + && self.look_ahead(1, |token| token.is_ident() && !token.is_reserved_ident()) + { + // Emit a special error message for `a::b:c` to help users + // otherwise, `a: c` might have meant to introduce a new binding + if self.token.span.lo() == self.prev_token.span.hi() + && self.look_ahead(1, |token| self.token.span.hi() == token.span.lo()) + { + self.bump(); // bump past the colon + self.sess.emit_err(PathSingleColon { + span: self.prev_token.span, + type_ascription: self + .sess + .unstable_features + .is_nightly_build() + .then_some(()), + }); + } + continue; + } + return Ok(()); } } @@ -270,8 +311,25 @@ impl<'a> Parser<'a> { ty_generics, )?; self.expect_gt().map_err(|mut err| { + // Try to recover a `:` into a `::` + if self.token == token::Colon + && self.look_ahead(1, |token| { + token.is_ident() && !token.is_reserved_ident() + }) + { + err.cancel(); + err = PathSingleColon { + span: self.token.span, + type_ascription: self + .sess + .unstable_features + .is_nightly_build() + .then_some(()), + } + .into_diagnostic(self.diagnostic()); + } // Attempt to find places where a missing `>` might belong. - if let Some(arg) = args + else if let Some(arg) = args .iter() .rev() .find(|arg| !matches!(arg, AngleBracketedArg::Constraint(_))) @@ -621,14 +679,14 @@ impl<'a> Parser<'a> { ); err.span_suggestion( eq.to(before_next), - &format!("remove the `=` if `{}` is a type", ident), + format!("remove the `=` if `{}` is a type", ident), "", Applicability::MaybeIncorrect, ) } else { err.span_label( self.token.span, - &format!("expected type, found {}", super::token_descr(&self.token)), + format!("expected type, found {}", super::token_descr(&self.token)), ) }; return Err(err); diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index fbe5b88c49eaa..1c17de337e833 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -10,6 +10,8 @@ use super::{ use crate::errors; use crate::maybe_whole; +use crate::errors::MalformedLoopLabel; +use ast::Label; use rustc_ast as ast; use rustc_ast::ptr::P; use rustc_ast::token::{self, Delimiter, TokenKind}; @@ -19,7 +21,8 @@ use rustc_ast::{Block, BlockCheckMode, Expr, ExprKind, HasAttrs, Local, Stmt}; use rustc_ast::{StmtKind, DUMMY_NODE_ID}; use rustc_errors::{Applicability, DiagnosticBuilder, ErrorGuaranteed, PResult}; use rustc_span::source_map::{BytePos, Span}; -use rustc_span::symbol::{kw, sym}; +use rustc_span::symbol::{kw, sym, Ident}; + use std::mem; use thin_vec::{thin_vec, ThinVec}; @@ -186,7 +189,7 @@ impl<'a> Parser<'a> { _ => MacStmtStyle::NoBraces, }; - let mac = P(MacCall { path, args, prior_type_ascription: self.last_type_ascription }); + let mac = P(MacCall { path, args }); let kind = if (style == MacStmtStyle::Braces && self.token != token::Dot @@ -546,10 +549,36 @@ impl<'a> Parser<'a> { } let stmt = match self.parse_full_stmt(recover) { Err(mut err) if recover.yes() => { - self.maybe_annotate_with_ascription(&mut err, false); if let Some(ref mut snapshot) = snapshot { snapshot.recover_diff_marker(); } + if self.token == token::Colon { + // if next token is following a colon, it's likely a path + // and we can suggest a path separator + let ident_span = self.prev_token.span; + self.bump(); + if self.token.span.lo() == self.prev_token.span.hi() { + err.span_suggestion_verbose( + self.prev_token.span, + "maybe write a path separator here", + "::", + Applicability::MaybeIncorrect, + ); + } + if self.look_ahead(1, |token| token == &token::Eq) { + err.span_suggestion_verbose( + ident_span.shrink_to_lo(), + "you might have meant to introduce a new binding", + "let ", + Applicability::MaybeIncorrect, + ); + } + if self.sess.unstable_features.is_nightly_build() { + // FIXME(Nilstrieb): Remove this again after a few months. + err.note("type ascription syntax has been removed, see issue #101728 "); + } + } + err.emit(); self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore); Some(self.mk_stmt_err(self.token.span)) @@ -580,47 +609,104 @@ impl<'a> Parser<'a> { }; let mut eat_semi = true; + let mut add_semi_to_stmt = false; + match &mut stmt.kind { // Expression without semicolon. StmtKind::Expr(expr) if self.token != token::Eof && classify::expr_requires_semi_to_be_stmt(expr) => { // Just check for errors and recover; do not eat semicolon yet. // `expect_one_of` returns PResult<'a, bool /* recovered */> - let replace_with_err = - match self.expect_one_of(&[], &[token::Semi, token::CloseDelim(Delimiter::Brace)]) { + + let expect_result = self.expect_one_of(&[], &[token::Semi, token::CloseDelim(Delimiter::Brace)]); + + let replace_with_err = 'break_recover: { + match expect_result { // Recover from parser, skip type error to avoid extra errors. - Ok(true) => true, - Err(mut e) => { - if let TokenKind::DocComment(..) = self.token.kind && - let Ok(snippet) = self.span_to_snippet(self.token.span) { + Ok(true) => true, + Err(mut e) => { + if let TokenKind::DocComment(..) = self.token.kind + && let Ok(snippet) = self.span_to_snippet(self.token.span) + { let sp = self.token.span; let marker = &snippet[..3]; let (comment_marker, doc_comment_marker) = marker.split_at(2); e.span_suggestion( sp.with_hi(sp.lo() + BytePos(marker.len() as u32)), - &format!( + format!( "add a space before `{}` to use a regular comment", doc_comment_marker, ), format!("{} {}", comment_marker, doc_comment_marker), Applicability::MaybeIncorrect, ); - } + } + + if self.recover_colon_as_semi() { + // recover_colon_as_semi has already emitted a nicer error. + e.delay_as_bug(); + add_semi_to_stmt = true; + eat_semi = false; + + break 'break_recover false; + } + + match &expr.kind { + ExprKind::Path(None, ast::Path { segments, .. }) if segments.len() == 1 => { + if self.token == token::Colon + && self.look_ahead(1, |token| { + token.is_whole_block() || matches!( + token.kind, + token::Ident(kw::For | kw::Loop | kw::While, false) + | token::OpenDelim(Delimiter::Brace) + ) + }) + { + let snapshot = self.create_snapshot_for_diagnostic(); + let label = Label { + ident: Ident::from_str_and_span( + &format!("'{}", segments[0].ident), + segments[0].ident.span, + ), + }; + match self.parse_expr_labeled(label, false) { + Ok(labeled_expr) => { + e.delay_as_bug(); + self.sess.emit_err(MalformedLoopLabel { + span: label.ident.span, + correct_label: label.ident, + }); + *expr = labeled_expr; + break 'break_recover false; + } + Err(err) => { + err.cancel(); + self.restore_snapshot(snapshot); + } + } + } + } + _ => {} + } - if let Err(mut e) = - self.check_mistyped_turbofish_with_multiple_type_params(e, expr) - { - if recover.no() { - return Err(e); + if let Err(mut e) = + self.check_mistyped_turbofish_with_multiple_type_params(e, expr) + { + if recover.no() { + return Err(e); + } + e.emit(); + self.recover_stmt(); } - e.emit(); - self.recover_stmt(); + + true + } - true + Ok(false) => false } - _ => false }; + if replace_with_err { // We already emitted an error, so don't emit another type error let sp = expr.span.to(self.prev_token.span); @@ -643,9 +729,10 @@ impl<'a> Parser<'a> { StmtKind::Empty | StmtKind::Item(_) | StmtKind::Local(_) | StmtKind::Semi(_) => eat_semi = false, } - if eat_semi && self.eat(&token::Semi) { + if add_semi_to_stmt || (eat_semi && self.eat(&token::Semi)) { stmt = stmt.add_trailing_semicolon(); } + stmt.span = stmt.span.to(self.prev_token.span); Ok(Some(stmt)) } diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 3ceb3a2bef16e..f58f09d06bcda 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -315,9 +315,8 @@ impl<'a> Parser<'a> { } } else { let msg = format!("expected type, found {}", super::token_descr(&self.token)); - let mut err = self.struct_span_err(self.token.span, &msg); + let mut err = self.struct_span_err(self.token.span, msg); err.span_label(self.token.span, "expected type"); - self.maybe_annotate_with_ascription(&mut err, true); return Err(err); }; @@ -651,11 +650,7 @@ impl<'a> Parser<'a> { let path = self.parse_path_inner(PathStyle::Type, ty_generics)?; if self.eat(&token::Not) { // Macro invocation in type position - Ok(TyKind::MacCall(P(MacCall { - path, - args: self.parse_delim_args()?, - prior_type_ascription: self.last_type_ascription, - }))) + Ok(TyKind::MacCall(P(MacCall { path, args: self.parse_delim_args()? }))) } else if allow_plus == AllowPlus::Yes && self.check_plus() { // `Trait1 + Trait2 + 'a` self.parse_remaining_bounds_path(ThinVec::new(), path, lo, true) diff --git a/compiler/rustc_parse/src/validate_attr.rs b/compiler/rustc_parse/src/validate_attr.rs index 815b7c8567918..982c4615affb6 100644 --- a/compiler/rustc_parse/src/validate_attr.rs +++ b/compiler/rustc_parse/src/validate_attr.rs @@ -189,7 +189,7 @@ fn emit_malformed_attribute( sess.buffer_lint(&ILL_FORMED_ATTRIBUTE_INPUT, span, ast::CRATE_NODE_ID, &msg); } else { sess.span_diagnostic - .struct_span_err(span, &error_msg) + .struct_span_err(span, error_msg) .span_suggestions( span, if suggestions.len() == 1 { diff --git a/compiler/rustc_passes/src/check_const.rs b/compiler/rustc_passes/src/check_const.rs index 30dd3e4d01699..6742722ce52c6 100644 --- a/compiler/rustc_passes/src/check_const.rs +++ b/compiler/rustc_passes/src/check_const.rs @@ -148,7 +148,7 @@ impl<'tcx> CheckConstVisitor<'tcx> { [missing_primary, ref missing_secondary @ ..] => { let msg = format!("{} is not allowed in a `{}`", expr.name(), const_kind.keyword_name()); - let mut err = feature_err(&tcx.sess.parse_sess, *missing_primary, span, &msg); + let mut err = feature_err(&tcx.sess.parse_sess, *missing_primary, span, msg); // If multiple feature gates would be required to enable this expression, include // them as help messages. Don't emit a separate error for each missing feature gate. @@ -161,7 +161,7 @@ impl<'tcx> CheckConstVisitor<'tcx> { "add `#![feature({})]` to the crate attributes to enable", gate, ); - err.help(¬e); + err.help(note); } } diff --git a/compiler/rustc_passes/src/hir_id_validator.rs b/compiler/rustc_passes/src/hir_id_validator.rs index 3942a73befdce..363e1743677ad 100644 --- a/compiler/rustc_passes/src/hir_id_validator.rs +++ b/compiler/rustc_passes/src/hir_id_validator.rs @@ -31,7 +31,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) { if !errors.is_empty() { let message = errors.iter().fold(String::new(), |s1, s2| s1 + "\n" + s2); - tcx.sess.delay_span_bug(rustc_span::DUMMY_SP, &message); + tcx.sess.delay_span_bug(rustc_span::DUMMY_SP, message); } } } diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs index a534b54070cd0..5f2ec656d1d1e 100644 --- a/compiler/rustc_query_system/src/query/job.rs +++ b/compiler/rustc_query_system/src/query/job.rs @@ -633,7 +633,7 @@ pub fn print_query_stack( }; let mut diag = Diagnostic::new( Level::FailureNote, - &format!("#{} [{:?}] {}", i, query_info.query.dep_kind, query_info.query.description), + format!("#{} [{:?}] {}", i, query_info.query.dep_kind, query_info.query.description), ); diag.span = query_info.job.span.into(); handler.force_print_diagnostic(diag); diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index 3799679cb1eac..2438b3a38ed4d 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -1002,7 +1002,7 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> { let msg = format!("`{}` is already in scope", name); let note = "macro-expanded `#[macro_use]`s may not shadow existing macros (see RFC 1560)"; - self.r.tcx.sess.struct_span_err(span, &msg).note(note).emit(); + self.r.tcx.sess.struct_span_err(span, msg).note(note).emit(); } } diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index ae3fd0ede6cff..17c4a6be049ed 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -418,7 +418,7 @@ impl Resolver<'_, '_> { UNUSED_IMPORTS, unused.use_tree_id, ms, - &msg, + msg, BuiltinLintDiagnostics::UnusedImports(fix_msg.into(), fixes, test_module_span), ); } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 4b7048eac0483..fd263bab78fbd 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -238,7 +238,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { }, }; - err.note(&format!( + err.note(format!( "`{}` must be defined only once in the {} namespace of this {}", name, ns.descr(), @@ -683,7 +683,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { making the path in the pattern qualified: `path::to::ModOrType::{}`", name, ); - err.span_help(span, &help_msg); + err.span_help(span, help_msg); } show_candidates( self.tcx, @@ -783,10 +783,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if let Some((suggestions, msg, applicability)) = suggestion { if suggestions.is_empty() { - err.help(&msg); + err.help(msg); return err; } - err.multipart_suggestion(&msg, suggestions, applicability); + err.multipart_suggestion(msg, suggestions, applicability); } err @@ -930,7 +930,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } => { let mut err = self.tcx.sess.struct_span_err_with_code( span, - &format!( + format!( "item `{}` is an associated {}, which doesn't match its trait `{}`", name, kind, trait_path, ), @@ -1359,7 +1359,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if macro_kind == MacroKind::Derive && (ident.name == sym::Send || ident.name == sym::Sync) { let msg = format!("unsafe traits like `{}` should be implemented explicitly", ident); - err.span_note(ident.span, &msg); + err.span_note(ident.span, msg); return; } if self.macro_names.contains(&ident.normalize_to_macros_2_0()) { @@ -1419,7 +1419,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if !import.span.is_dummy() { err.span_note( import.span, - &format!("`{}` is imported here, but it is {}", ident, desc), + format!("`{}` is imported here, but it is {}", ident, desc), ); // Silence the 'unused import' warning we might get, // since this diagnostic already covers that import. @@ -1427,7 +1427,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { return; } } - err.note(&format!("`{}` is in scope, but it is {}", ident, desc)); + err.note(format!("`{}` is in scope, but it is {}", ident, desc)); return; } } @@ -1474,7 +1474,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { err.span_label( self.tcx.sess.source_map().guess_head_span(def_span), - &format!( + format!( "{}{} `{}` defined here", prefix, suggestion.res.descr(), @@ -1492,7 +1492,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { format!("maybe you meant this {}", suggestion.res.descr()) } }; - err.span_suggestion(span, &msg, suggestion.candidate, Applicability::MaybeIncorrect); + err.span_suggestion(span, msg, suggestion.candidate, Applicability::MaybeIncorrect); true } @@ -1534,7 +1534,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let mut err = struct_span_err!(self.tcx.sess, ident.span, E0659, "`{ident}` is ambiguous"); err.span_label(ident.span, "ambiguous name"); - err.note(&format!("ambiguous because of {}", kind.descr())); + err.note(format!("ambiguous because of {}", kind.descr())); let mut could_refer_to = |b: &NameBinding<'_>, misc: AmbiguityErrorMisc, also: &str| { let what = self.binding_description(b, ident, misc == AmbiguityErrorMisc::FromPrelude); @@ -1562,10 +1562,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { AmbiguityErrorMisc::FromPrelude | AmbiguityErrorMisc::None => {} } - err.span_note(b.span, ¬e_msg); + err.span_note(b.span, note_msg); for (i, help_msg) in help_msgs.iter().enumerate() { let or = if i == 0 { "" } else { "or " }; - err.help(&format!("{}{}", or, help_msg)); + err.help(format!("{}{}", or, help_msg)); } }; @@ -1608,7 +1608,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let descr = get_descr(binding); let mut err = struct_span_err!(self.tcx.sess, ident.span, E0603, "{} `{}` is private", descr, ident); - err.span_label(ident.span, &format!("private {}", descr)); + err.span_label(ident.span, format!("private {}", descr)); let mut non_exhaustive = None; // If an ADT is foreign and marked as `non_exhaustive`, then that's @@ -1623,7 +1623,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { err.span_label(span, "a constructor is private if any of the fields is private"); if let Res::Def(_, d) = res && let Some(fields) = self.field_visibility_spans.get(&d) { err.multipart_suggestion_verbose( - &format!( + format!( "consider making the field{} publicly accessible", pluralize!(fields.len()) ), @@ -1676,7 +1676,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { format!("cannot be constructed because it is `#[non_exhaustive]`"), ); } - err.span_note(note_span, &msg); + err.span_note(note_span, msg); } err.emit(); @@ -2444,7 +2444,7 @@ fn show_candidates( }; for note in accessible_path_strings.iter().flat_map(|cand| cand.3.as_ref()) { - err.note(note); + err.note(note.clone()); } if let Some(span) = use_placement_span { @@ -2452,7 +2452,7 @@ fn show_candidates( DiagnosticMode::Pattern => { err.span_suggestions( span, - &msg, + msg, accessible_path_strings.into_iter().map(|a| a.0), Applicability::MaybeIncorrect, ); @@ -2471,7 +2471,7 @@ fn show_candidates( err.span_suggestions_with_style( span, - &msg, + msg, accessible_path_strings.into_iter().map(|a| a.0), Applicability::MaybeIncorrect, SuggestionStyle::ShowAlways, @@ -2481,7 +2481,7 @@ fn show_candidates( if sp.can_be_used_for_suggestions() { err.span_suggestion_verbose( sp, - &format!("if you import `{}`, refer to it directly", last.ident), + format!("if you import `{}`, refer to it directly", last.ident), "", Applicability::Unspecified, ); @@ -2495,7 +2495,7 @@ fn show_candidates( msg.push_str(&candidate.0); } - err.help(&msg); + err.help(msg); } } else if !matches!(mode, DiagnosticMode::Import) { assert!(!inaccessible_path_strings.is_empty()); @@ -2520,9 +2520,9 @@ fn show_candidates( let span = tcx.sess.source_map().guess_head_span(span); let mut multi_span = MultiSpan::from_span(span); multi_span.push_span_label(span, "not accessible"); - err.span_note(multi_span, &msg); + err.span_note(multi_span, msg); } else { - err.note(&msg); + err.note(msg); } if let Some(note) = (*note).as_deref() { err.note(note); @@ -2566,10 +2566,10 @@ fn show_candidates( } for note in inaccessible_path_strings.iter().flat_map(|cand| cand.3.as_ref()) { - err.note(note); + err.note(note.clone()); } - err.span_note(multi_span, &msg); + err.span_note(multi_span, msg); } } } diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 5a56d7b99a978..530c188fe1803 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -527,7 +527,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { PROC_MACRO_DERIVE_RESOLUTION_FALLBACK, lint_id, orig_ident.span, - &format!( + format!( "cannot find {} `{}` in this scope", ns.descr(), ident @@ -1345,7 +1345,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ribs: Option<&PerNS>>>, ignore_binding: Option<&'a NameBinding<'a>>, ) -> PathResult<'a> { - debug!("resolve_path(path={:?}, opt_ns={:?}, finalize={:?})", path, opt_ns, finalize); + debug!( + "resolve_path(path={:?}, opt_ns={:?}, finalize={:?}) path_len: {}", + path, + opt_ns, + finalize, + path.len() + ); let mut module = None; let mut allow_super = true; diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index d7c518fbdd0dc..2044798f4d01d 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -578,7 +578,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let mut diag = struct_span_err!(self.tcx.sess, span, E0432, "{}", &msg); if let Some((_, UnresolvedImportError { note: Some(note), .. })) = errors.iter().last() { - diag.note(note); + diag.note(note.clone()); } for (import, err) in errors.into_iter().take(MAX_LABEL_COUNT) { @@ -588,10 +588,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if let Some((suggestions, msg, applicability)) = err.suggestion { if suggestions.is_empty() { - diag.help(&msg); + diag.help(msg); continue; } - diag.multipart_suggestion(&msg, suggestions, applicability); + diag.multipart_suggestion(msg, suggestions, applicability); } if let Some(candidates) = &err.candidates { @@ -1063,7 +1063,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { PUB_USE_OF_PRIVATE_EXTERN_CRATE, import_id, import.span, - &msg, + msg, ); } else { let error_msg = if crate_private_reexport { @@ -1084,7 +1084,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { struct_span_err!(self.tcx.sess, import.span, E0365, "{}", error_msg) .span_label(import.span, label_msg) - .note(&format!("consider declaring type or module `{}` with `pub`", ident)) + .note(format!("consider declaring type or module `{}` with `pub`", ident)) .emit(); } else { let mut err = @@ -1102,7 +1102,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { _ => { err.span_note( import.span, - &format!( + format!( "consider marking `{ident}` as `pub` in the imported module" ), ); @@ -1200,7 +1200,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { UNUSED_IMPORTS, id, import.span, - &format!("the item `{}` is imported redundantly", ident), + format!("the item `{}` is imported redundantly", ident), BuiltinLintDiagnostics::RedundantImport(redundant_spans, ident), ); } diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 511ae8516a866..11d2b975fec6d 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -548,9 +548,6 @@ struct DiagnosticMetadata<'ast> { /// they are used (in a `break` or `continue` statement) unused_labels: FxHashMap, - /// Only used for better errors on `fn(): fn()`. - current_type_ascription: Vec, - /// Only used for better errors on `let x = { foo: bar };`. /// In the case of a parse error with `let x = { foo: bar, };`, this isn't needed, it's only /// needed for cases where this parses as a correct type ascription. @@ -2201,7 +2198,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { this.r .tcx .sess - .span_err(ident.span, &format!("imports cannot refer to {}", what)); + .span_err(ident.span, format!("imports cannot refer to {}", what)); } }; @@ -4064,17 +4061,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { } } } - ExprKind::Type(ref type_expr, ref ty) => { - // `ParseSess::type_ascription_path_suggestions` keeps spans of colon tokens in - // type ascription. Here we are trying to retrieve the span of the colon token as - // well, but only if it's written without spaces `expr:Ty` and therefore confusable - // with `expr::Ty`, only in this case it will match the span from - // `type_ascription_path_suggestions`. - self.diagnostic_metadata - .current_type_ascription - .push(type_expr.span.between(ty.span)); + ExprKind::Type(ref _type_expr, ref _ty) => { visit::walk_expr(self, expr); - self.diagnostic_metadata.current_type_ascription.pop(); } // `async |x| ...` gets desugared to `|x| async {...}`, so we need to // resolve the arguments within the proper scopes so that usages of them inside the diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index e824a6ddc072f..e215b6b7090ae 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -28,7 +28,7 @@ use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edition::Edition; use rustc_span::hygiene::MacroKind; use rustc_span::symbol::{kw, sym, Ident, Symbol}; -use rustc_span::{BytePos, Span}; +use rustc_span::Span; use std::iter; use std::ops::Deref; @@ -315,8 +315,11 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { debug!(?res, ?source); let base_error = self.make_base_error(path, span, source, res); let code = source.error_code(res.is_some()); - let mut err = - self.r.tcx.sess.struct_span_err_with_code(base_error.span, &base_error.msg, code); + let mut err = self.r.tcx.sess.struct_span_err_with_code( + base_error.span, + base_error.msg.clone(), + code, + ); self.suggest_swapping_misplaced_self_ty_and_trait(&mut err, source, res, base_error.span); @@ -332,7 +335,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { if self.suggest_pattern_match_with_let(&mut err, source, span) { // Fallback label. - err.span_label(base_error.span, &base_error.fallback_label); + err.span_label(base_error.span, base_error.fallback_label); return (err, Vec::new()); } @@ -350,18 +353,15 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { return (err, candidates); } - if !self.type_ascription_suggestion(&mut err, base_error.span) { - let mut fallback = - self.suggest_trait_and_bounds(&mut err, source, res, span, &base_error); + let mut fallback = self.suggest_trait_and_bounds(&mut err, source, res, span, &base_error); - // if we have suggested using pattern matching, then don't add needless suggestions - // for typos. - fallback |= self.suggest_typo(&mut err, source, path, span, &base_error); + // if we have suggested using pattern matching, then don't add needless suggestions + // for typos. + fallback |= self.suggest_typo(&mut err, source, path, span, &base_error); - if fallback { - // Fallback label. - err.span_label(base_error.span, &base_error.fallback_label); - } + if fallback { + // Fallback label. + err.span_label(base_error.span, base_error.fallback_label); } self.err_code_special_cases(&mut err, source, path, span); @@ -494,24 +494,6 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { .filter(|(_, enum_ty_path)| !enum_ty_path.starts_with("std::prelude::")) .collect(); if !enum_candidates.is_empty() { - if let (PathSource::Type, Some(span)) = - (source, self.diagnostic_metadata.current_type_ascription.last()) - { - if self - .r - .tcx - .sess - .parse_sess - .type_ascription_path_suggestions - .borrow() - .contains(span) - { - // Already reported this issue on the lhs of the type ascription. - err.downgrade_to_delayed_bug(); - return (true, candidates); - } - } - enum_candidates.sort(); // Contextualize for E0412 "cannot find type", but don't belabor the point @@ -530,7 +512,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { err.span_suggestions( span, - &msg, + msg, enum_candidates.into_iter().map(|(_variant_path, enum_ty_path)| enum_ty_path), Applicability::MachineApplicable, ); @@ -577,7 +559,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { | AssocSuggestion::AssocType => { err.span_suggestion( span, - &format!("you might have meant to {}", candidate.action()), + format!("you might have meant to {}", candidate.action()), format!("Self::{path_str}"), Applicability::MachineApplicable, ); @@ -598,7 +580,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { err.span_suggestion( call_span, - &format!("try calling `{ident}` as a method"), + format!("try calling `{ident}` as a method"), format!("self.{path_str}({args_snippet})"), Applicability::MachineApplicable, ); @@ -630,7 +612,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { ident.name == path[0].ident.name { err.span_help( ident.span, - &format!("the binding `{}` is available in a different scope in the same function", path_str), + format!("the binding `{}` is available in a different scope in the same function", path_str), ); return (true, candidates); } @@ -911,7 +893,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { if let Some(ident) = fn_kind.ident() { err.span_label( ident.span, - &format!("this function {} have a `self` parameter", doesnt), + format!("this function {} have a `self` parameter", doesnt), ); } } @@ -1087,7 +1069,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { if ident.span == span { err.span_suggestion_verbose( *where_span, - &format!("constrain the associated type to `{}`", ident), + format!("constrain the associated type to `{}`", ident), format!( "{}: {}<{} = {}>", self.r @@ -1288,7 +1270,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } PathSource::Expr(_) | PathSource::TupleStruct(..) | PathSource::Pat => { let span = find_span(&source, err); - err.span_label(self.r.def_span(def_id), &format!("`{path_str}` defined here")); + err.span_label(self.r.def_span(def_id), format!("`{path_str}` defined here")); let (tail, descr, applicability, old_fields) = match source { PathSource::Pat => ("", "pattern", Applicability::MachineApplicable, None), @@ -1332,7 +1314,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { }; err.span_suggestion( span, - &format!("use struct {} syntax instead", descr), + format!("use struct {} syntax instead", descr), format!("{path_str} {{{pad}{fields}{pad}}}"), applicability, ); @@ -1393,26 +1375,6 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { Res::Def(DefKind::Enum, def_id), PathSource::TupleStruct(..) | PathSource::Expr(..), ) => { - if self - .diagnostic_metadata - .current_type_ascription - .last() - .map(|sp| { - self.r - .tcx - .sess - .parse_sess - .type_ascription_path_suggestions - .borrow() - .contains(&sp) - }) - .unwrap_or(false) - { - err.downgrade_to_delayed_bug(); - // We already suggested changing `:` into `::` during parsing. - return false; - } - self.suggest_using_enum_variant(err, source, def_id, span); } (Res::Def(DefKind::Struct, def_id), source) if ns == ValueNS => { @@ -1494,7 +1456,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { if non_visible_spans.len() > 0 { if let Some(fields) = self.r.field_visibility_spans.get(&def_id) { err.multipart_suggestion_verbose( - &format!( + format!( "consider making the field{} publicly accessible", pluralize!(fields.len()) ), @@ -1524,7 +1486,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { let span = find_span(&source, err); err.span_label( self.r.def_span(def_id), - &format!("`{path_str}` defined here"), + format!("`{path_str}` defined here"), ); err.span_suggestion( span, @@ -1538,7 +1500,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } (Res::Def(DefKind::Ctor(_, CtorKind::Fn), ctor_def_id), _) if ns == ValueNS => { let def_id = self.r.tcx.parent(ctor_def_id); - err.span_label(self.r.def_span(def_id), &format!("`{path_str}` defined here")); + err.span_label(self.r.def_span(def_id), format!("`{path_str}` defined here")); let fields = self.r.field_def_ids(def_id).map_or_else( || "/* fields */".to_string(), |field_ids| vec!["_"; field_ids.len()].join(", "), @@ -1817,80 +1779,6 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { }) } - /// Only used in a specific case of type ascription suggestions - fn get_colon_suggestion_span(&self, start: Span) -> Span { - let sm = self.r.tcx.sess.source_map(); - start.to(sm.next_point(start)) - } - - fn type_ascription_suggestion(&self, err: &mut Diagnostic, base_span: Span) -> bool { - let sm = self.r.tcx.sess.source_map(); - let base_snippet = sm.span_to_snippet(base_span); - if let Some(&sp) = self.diagnostic_metadata.current_type_ascription.last() { - if let Ok(snippet) = sm.span_to_snippet(sp) { - let len = snippet.trim_end().len() as u32; - if snippet.trim() == ":" { - let colon_sp = - sp.with_lo(sp.lo() + BytePos(len - 1)).with_hi(sp.lo() + BytePos(len)); - let mut show_label = true; - if sm.is_multiline(sp) { - err.span_suggestion_short( - colon_sp, - "maybe you meant to write `;` here", - ";", - Applicability::MaybeIncorrect, - ); - } else { - let after_colon_sp = - self.get_colon_suggestion_span(colon_sp.shrink_to_hi()); - if snippet.len() == 1 { - // `foo:bar` - err.span_suggestion( - colon_sp, - "maybe you meant to write a path separator here", - "::", - Applicability::MaybeIncorrect, - ); - show_label = false; - if !self - .r - .tcx - .sess - .parse_sess - .type_ascription_path_suggestions - .borrow_mut() - .insert(colon_sp) - { - err.downgrade_to_delayed_bug(); - } - } - if let Ok(base_snippet) = base_snippet { - // Try to find an assignment - let eq_span = sm.span_look_ahead(after_colon_sp, Some("="), Some(50)); - if let Ok(ref snippet) = sm.span_to_snippet(eq_span) && snippet == "=" { - err.span_suggestion( - base_span, - "maybe you meant to write an assignment here", - format!("let {}", base_snippet), - Applicability::MaybeIncorrect, - ); - show_label = false; - } - } - } - if show_label { - err.span_label( - base_span, - "expecting a type here because of type ascription", - ); - } - return show_label; - } - } - } - false - } - // try to give a suggestion for this pattern: `name = blah`, which is common in other languages // suggest `let name = blah` to introduce a new binding fn let_binding_suggestion(&mut self, err: &mut Diagnostic, ident_span: Span) -> bool { @@ -2014,7 +1902,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { err.span_suggestions( span, - &msg, + msg, suggestable_variants, Applicability::MaybeIncorrect, ); @@ -2022,17 +1910,17 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { // If the enum has no tuple variants.. if non_suggestable_variant_count == variants.len() { - err.help(&format!("the enum has no tuple variants {}", source_msg)); + err.help(format!("the enum has no tuple variants {}", source_msg)); } // If there are also non-tuple variants.. if non_suggestable_variant_count == 1 { - err.help(&format!( + err.help(format!( "you might have meant {} the enum's non-tuple variant", source_msg )); } else if non_suggestable_variant_count >= 1 { - err.help(&format!( + err.help(format!( "you might have meant {} one of the enum's non-tuple variants", source_msg )); @@ -2282,7 +2170,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { lint::builtin::SINGLE_USE_LIFETIMES, param.id, param.ident.span, - &format!("lifetime parameter `{}` only used once", param.ident), + format!("lifetime parameter `{}` only used once", param.ident), lint::BuiltinLintDiagnostics::SingleUseLifetime { param_span: param.ident.span, use_span: Some((use_span, elidable)), @@ -2301,7 +2189,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { lint::builtin::UNUSED_LIFETIMES, param.id, param.ident.span, - &format!("lifetime parameter `{}` never used", param.ident), + format!("lifetime parameter `{}` never used", param.ident), lint::BuiltinLintDiagnostics::SingleUseLifetime { param_span: param.ident.span, use_span: None, @@ -2367,7 +2255,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { suggest_note = false; // Avoid displaying the same help multiple times. err.span_label( span, - &format!( + format!( "lifetime `{}` is missing in item created through this procedural macro", name, ), @@ -2573,13 +2461,13 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { )]; } } else if num_params == 1 { - err.help(&format!( + err.help(format!( "this function's return type contains a borrowed value, \ but the signature does not say which {} it is borrowed from", m )); } else { - err.help(&format!( + err.help(format!( "this function's return type contains a borrowed value, \ but the signature does not say whether it is borrowed from {}", m @@ -2648,7 +2536,7 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } 1 => { err.multipart_suggestion_verbose( - &format!("consider using the `{}` lifetime", existing_name), + format!("consider using the `{}` lifetime", existing_name), spans_suggs, Applicability::MaybeIncorrect, ); @@ -2699,7 +2587,7 @@ pub(super) fn signal_label_shadowing(sess: &Session, orig: Span, shadower: Ident let shadower = shadower.span; let mut err = sess.struct_span_warn( shadower, - &format!("label name `{}` shadows a label name that is already in scope", name), + format!("label name `{}` shadows a label name that is already in scope", name), ); err.span_label(orig, "first declared here"); err.span_label(shadower, format!("label `{}` already in scope", name)); diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index b30c1cd226cb6..4da43c6a9a2db 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -121,7 +121,7 @@ pub(crate) fn registered_tools(tcx: TyCtxt<'_>, (): ()) -> RegisteredTools { if let Some(old_ident) = registered_tools.replace(ident) { let msg = format!("{} `{}` was already registered", "tool", ident); tcx.sess - .struct_span_err(ident.span, &msg) + .struct_span_err(ident.span, msg) .span_label(old_ident.span, "already registered here") .emit(); } @@ -130,7 +130,7 @@ pub(crate) fn registered_tools(tcx: TyCtxt<'_>, (): ()) -> RegisteredTools { let msg = format!("`{}` only accepts identifiers", sym::register_tool); let span = nested_meta.span(); tcx.sess - .struct_span_err(span, &msg) + .struct_span_err(span, msg) .span_label(span, "not an identifier") .emit(); } @@ -202,7 +202,7 @@ impl<'a, 'tcx> ResolverExpand for Resolver<'a, 'tcx> { self.tcx .sess .diagnostic() - .bug(&format!("built-in macro `{}` was already registered", name)); + .bug(format!("built-in macro `{}` was already registered", name)); } } @@ -315,7 +315,7 @@ impl<'a, 'tcx> ResolverExpand for Resolver<'a, 'tcx> { UNUSED_MACROS, node_id, ident.span, - &format!("unused macro definition: `{}`", ident.name), + format!("unused macro definition: `{}`", ident.name), ); } for (&(def_id, arm_i), &(ident, rule_span)) in self.unused_macro_rules.iter() { @@ -328,7 +328,7 @@ impl<'a, 'tcx> ResolverExpand for Resolver<'a, 'tcx> { UNUSED_MACRO_RULES, node_id, rule_span, - &format!( + format!( "{} rule of macro `{}` is never used", crate::diagnostics::ordinalize(arm_i + 1), ident.name @@ -698,7 +698,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { Segment::names_to_string(path) ); let msg_note = "import resolution is stuck, try simplifying macro imports"; - this.tcx.sess.struct_span_err(span, &msg).note(msg_note).emit(); + this.tcx.sess.struct_span_err(span, msg).note(msg_note).emit(); } } }; @@ -788,7 +788,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { Err(..) => { let expected = kind.descr_expected(); let msg = format!("cannot find {} `{}` in this scope", expected, ident); - let mut err = self.tcx.sess.struct_span_err(ident.span, &msg); + let mut err = self.tcx.sess.struct_span_err(ident.span, msg); self.unresolved_macro_suggestions(&mut err, kind, &parent_scope, ident); err.emit(); } @@ -866,9 +866,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if kind != NonMacroAttrKind::Tool && binding.map_or(true, |b| b.is_import()) { let msg = format!("cannot use {} {} through an import", kind.article(), kind.descr()); - let mut err = self.tcx.sess.struct_span_err(span, &msg); + let mut err = self.tcx.sess.struct_span_err(span, msg); if let Some(binding) = binding { - err.span_note(binding.span, &format!("the {} imported here", kind.descr())); + err.span_note(binding.span, format!("the {} imported here", kind.descr())); } err.emit(); } @@ -883,7 +883,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if macro_kind.is_some() && sub_namespace_match(macro_kind, Some(MacroKind::Attr)) { self.tcx.sess.span_err( ident.span, - &format!("name `{}` is reserved in attribute namespace", ident), + format!("name `{}` is reserved in attribute namespace", ident), ); } } @@ -927,7 +927,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } else { let msg = format!("cannot find a built-in macro with name `{}`", item.ident); - self.tcx.sess.span_err(item.span, &msg); + self.tcx.sess.span_err(item.span, msg); } } diff --git a/compiler/rustc_session/src/parse.rs b/compiler/rustc_session/src/parse.rs index 15e27952cf50f..5cc9c62617dd5 100644 --- a/compiler/rustc_session/src/parse.rs +++ b/compiler/rustc_session/src/parse.rs @@ -214,8 +214,6 @@ pub struct ParseSess { pub env_depinfo: Lock)>>, /// File paths accessed during the build. pub file_depinfo: Lock>, - /// All the type ascriptions expressions that have had a suggestion for likely path typo. - pub type_ascription_path_suggestions: Lock>, /// Whether cfg(version) should treat the current release as incomplete pub assume_incomplete_release: bool, /// Spans passed to `proc_macro::quote_span`. Each span has a numerical @@ -258,7 +256,6 @@ impl ParseSess { reached_eof: AtomicBool::new(false), env_depinfo: Default::default(), file_depinfo: Default::default(), - type_ascription_path_suggestions: Default::default(), assume_incomplete_release: false, proc_macro_quoted_spans: Default::default(), attr_id_generator: AttrIdGenerator::new(), diff --git a/compiler/rustc_smir/Cargo.toml b/compiler/rustc_smir/Cargo.toml index fb97ee5bebe6e..80360a3c73f8d 100644 --- a/compiler/rustc_smir/Cargo.toml +++ b/compiler/rustc_smir/Cargo.toml @@ -4,6 +4,7 @@ version = "0.0.0" edition = "2021" [dependencies] +rustc_hir = { path = "../rustc_hir" } rustc_middle = { path = "../rustc_middle", optional = true } rustc_span = { path = "../rustc_span", optional = true } tracing = "0.1" diff --git a/compiler/rustc_smir/src/rustc_smir/mod.rs b/compiler/rustc_smir/src/rustc_smir/mod.rs index 09cb6fd22d5e6..241cd182059ba 100644 --- a/compiler/rustc_smir/src/rustc_smir/mod.rs +++ b/compiler/rustc_smir/src/rustc_smir/mod.rs @@ -93,10 +93,10 @@ fn rustc_statement_to_statement( } } -fn rustc_rvalue_to_rvalue(rvalue: &rustc_middle::mir::Rvalue<'_>) -> stable_mir::mir::Operand { +fn rustc_rvalue_to_rvalue(rvalue: &rustc_middle::mir::Rvalue<'_>) -> stable_mir::mir::Rvalue { use rustc_middle::mir::Rvalue::*; match rvalue { - Use(op) => rustc_op_to_op(op), + Use(op) => stable_mir::mir::Rvalue::Use(rustc_op_to_op(op)), Repeat(_, _) => todo!(), Ref(_, _, _) => todo!(), ThreadLocalRef(_) => todo!(), @@ -104,9 +104,15 @@ fn rustc_rvalue_to_rvalue(rvalue: &rustc_middle::mir::Rvalue<'_>) -> stable_mir: Len(_) => todo!(), Cast(_, _, _) => todo!(), BinaryOp(_, _) => todo!(), - CheckedBinaryOp(_, _) => todo!(), + CheckedBinaryOp(bin_op, ops) => stable_mir::mir::Rvalue::CheckedBinaryOp( + rustc_bin_op_to_bin_op(bin_op), + rustc_op_to_op(&ops.0), + rustc_op_to_op(&ops.1), + ), NullaryOp(_, _) => todo!(), - UnaryOp(_, _) => todo!(), + UnaryOp(un_op, op) => { + stable_mir::mir::Rvalue::UnaryOp(rustc_un_op_to_un_op(un_op), rustc_op_to_op(op)) + } Discriminant(_) => todo!(), Aggregate(_, _) => todo!(), ShallowInitBox(_, _) => todo!(), @@ -124,8 +130,10 @@ fn rustc_op_to_op(op: &rustc_middle::mir::Operand<'_>) -> stable_mir::mir::Opera } fn rustc_place_to_place(place: &rustc_middle::mir::Place<'_>) -> stable_mir::mir::Place { - assert_eq!(&place.projection[..], &[]); - stable_mir::mir::Place { local: place.local.as_usize() } + stable_mir::mir::Place { + local: place.local.as_usize(), + projection: format!("{:?}", place.projection), + } } fn rustc_unwind_to_unwind( @@ -140,6 +148,96 @@ fn rustc_unwind_to_unwind( } } +fn rustc_assert_msg_to_msg<'tcx>( + assert_message: &rustc_middle::mir::AssertMessage<'tcx>, +) -> stable_mir::mir::AssertMessage { + use rustc_middle::mir::AssertKind; + match assert_message { + AssertKind::BoundsCheck { len, index } => stable_mir::mir::AssertMessage::BoundsCheck { + len: rustc_op_to_op(len), + index: rustc_op_to_op(index), + }, + AssertKind::Overflow(bin_op, op1, op2) => stable_mir::mir::AssertMessage::Overflow( + rustc_bin_op_to_bin_op(bin_op), + rustc_op_to_op(op1), + rustc_op_to_op(op2), + ), + AssertKind::OverflowNeg(op) => { + stable_mir::mir::AssertMessage::OverflowNeg(rustc_op_to_op(op)) + } + AssertKind::DivisionByZero(op) => { + stable_mir::mir::AssertMessage::DivisionByZero(rustc_op_to_op(op)) + } + AssertKind::RemainderByZero(op) => { + stable_mir::mir::AssertMessage::RemainderByZero(rustc_op_to_op(op)) + } + AssertKind::ResumedAfterReturn(generator) => { + stable_mir::mir::AssertMessage::ResumedAfterReturn(rustc_generator_to_generator( + generator, + )) + } + AssertKind::ResumedAfterPanic(generator) => { + stable_mir::mir::AssertMessage::ResumedAfterPanic(rustc_generator_to_generator( + generator, + )) + } + AssertKind::MisalignedPointerDereference { required, found } => { + stable_mir::mir::AssertMessage::MisalignedPointerDereference { + required: rustc_op_to_op(required), + found: rustc_op_to_op(found), + } + } + } +} + +fn rustc_bin_op_to_bin_op(bin_op: &rustc_middle::mir::BinOp) -> stable_mir::mir::BinOp { + use rustc_middle::mir::BinOp; + match bin_op { + BinOp::Add => stable_mir::mir::BinOp::Add, + BinOp::Sub => stable_mir::mir::BinOp::Sub, + BinOp::Mul => stable_mir::mir::BinOp::Mul, + BinOp::Div => stable_mir::mir::BinOp::Div, + BinOp::Rem => stable_mir::mir::BinOp::Rem, + BinOp::BitXor => stable_mir::mir::BinOp::BitXor, + BinOp::BitAnd => stable_mir::mir::BinOp::BitAnd, + BinOp::BitOr => stable_mir::mir::BinOp::BitOr, + BinOp::Shl => stable_mir::mir::BinOp::Shl, + BinOp::Shr => stable_mir::mir::BinOp::Shr, + BinOp::Eq => stable_mir::mir::BinOp::Eq, + BinOp::Lt => stable_mir::mir::BinOp::Lt, + BinOp::Le => stable_mir::mir::BinOp::Le, + BinOp::Ne => stable_mir::mir::BinOp::Ne, + BinOp::Ge => stable_mir::mir::BinOp::Ge, + BinOp::Gt => stable_mir::mir::BinOp::Gt, + BinOp::Offset => stable_mir::mir::BinOp::Offset, + } +} + +fn rustc_un_op_to_un_op(unary_op: &rustc_middle::mir::UnOp) -> stable_mir::mir::UnOp { + use rustc_middle::mir::UnOp; + match unary_op { + UnOp::Not => stable_mir::mir::UnOp::Not, + UnOp::Neg => stable_mir::mir::UnOp::Neg, + } +} + +fn rustc_generator_to_generator( + generator: &rustc_hir::GeneratorKind, +) -> stable_mir::mir::GeneratorKind { + use rustc_hir::{AsyncGeneratorKind, GeneratorKind}; + match generator { + GeneratorKind::Async(async_gen) => { + let async_gen = match async_gen { + AsyncGeneratorKind::Block => stable_mir::mir::AsyncGeneratorKind::Block, + AsyncGeneratorKind::Closure => stable_mir::mir::AsyncGeneratorKind::Closure, + AsyncGeneratorKind::Fn => stable_mir::mir::AsyncGeneratorKind::Fn, + }; + stable_mir::mir::GeneratorKind::Async(async_gen) + } + GeneratorKind::Gen => stable_mir::mir::GeneratorKind::Gen, + } +} + fn rustc_terminator_to_terminator( terminator: &rustc_middle::mir::Terminator<'_>, ) -> stable_mir::mir::Terminator { @@ -162,7 +260,11 @@ fn rustc_terminator_to_terminator( Terminate => Terminator::Abort, Return => Terminator::Return, Unreachable => Terminator::Unreachable, - Drop { .. } => todo!(), + Drop { place, target, unwind } => Terminator::Drop { + place: rustc_place_to_place(place), + target: target.as_usize(), + unwind: rustc_unwind_to_unwind(unwind), + }, Call { func, args, destination, target, unwind, from_hir_call: _, fn_span: _ } => { Terminator::Call { func: rustc_op_to_op(func), @@ -172,9 +274,15 @@ fn rustc_terminator_to_terminator( unwind: rustc_unwind_to_unwind(unwind), } } - Assert { .. } => todo!(), + Assert { cond, expected, msg, target, unwind } => Terminator::Assert { + cond: rustc_op_to_op(cond), + expected: *expected, + msg: rustc_assert_msg_to_msg(msg), + target: target.as_usize(), + unwind: rustc_unwind_to_unwind(unwind), + }, Yield { .. } => todo!(), - GeneratorDrop => todo!(), + GeneratorDrop => Terminator::GeneratorDrop, FalseEdge { .. } => todo!(), FalseUnwind { .. } => todo!(), InlineAsm { .. } => todo!(), diff --git a/compiler/rustc_smir/src/stable_mir/mir/body.rs b/compiler/rustc_smir/src/stable_mir/mir/body.rs index bd5e6b68a12fa..4baf3f1f75eac 100644 --- a/compiler/rustc_smir/src/stable_mir/mir/body.rs +++ b/compiler/rustc_smir/src/stable_mir/mir/body.rs @@ -26,7 +26,7 @@ pub enum Terminator { Drop { place: Place, target: usize, - unwind: Option, + unwind: UnwindAction, }, Call { func: Operand, @@ -38,10 +38,11 @@ pub enum Terminator { Assert { cond: Operand, expected: bool, - msg: String, + msg: AssertMessage, target: usize, - cleanup: Option, + unwind: UnwindAction, }, + GeneratorDrop, } #[derive(Clone, Debug)] @@ -52,12 +53,72 @@ pub enum UnwindAction { Cleanup(usize), } +#[derive(Clone, Debug)] +pub enum AssertMessage { + BoundsCheck { len: Operand, index: Operand }, + Overflow(BinOp, Operand, Operand), + OverflowNeg(Operand), + DivisionByZero(Operand), + RemainderByZero(Operand), + ResumedAfterReturn(GeneratorKind), + ResumedAfterPanic(GeneratorKind), + MisalignedPointerDereference { required: Operand, found: Operand }, +} + +#[derive(Clone, Debug)] +pub enum BinOp { + Add, + Sub, + Mul, + Div, + Rem, + BitXor, + BitAnd, + BitOr, + Shl, + Shr, + Eq, + Lt, + Le, + Ne, + Ge, + Gt, + Offset, +} + +#[derive(Clone, Debug)] +pub enum UnOp { + Not, + Neg, +} + +#[derive(Clone, Debug)] +pub enum GeneratorKind { + Async(AsyncGeneratorKind), + Gen, +} + +#[derive(Clone, Debug)] +pub enum AsyncGeneratorKind { + Block, + Closure, + Fn, +} + #[derive(Clone, Debug)] pub enum Statement { - Assign(Place, Operand), + Assign(Place, Rvalue), Nop, } +// FIXME this is incomplete +#[derive(Clone, Debug)] +pub enum Rvalue { + Use(Operand), + CheckedBinaryOp(BinOp, Operand, Operand), + UnaryOp(UnOp, Operand), +} + #[derive(Clone, Debug)] pub enum Operand { Copy(Place), @@ -68,6 +129,7 @@ pub enum Operand { #[derive(Clone, Debug)] pub struct Place { pub local: usize, + pub projection: String, } #[derive(Clone, Debug)] diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 31bbdb2a3bc65..7969b848fd956 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -531,6 +531,7 @@ symbols! { const_mut_refs, const_panic, const_panic_fmt, + const_param_ty, const_precise_live_drops, const_raw_ptr_deref, const_raw_ptr_to_usize_cast, diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index ce187fbdf8424..69b3c1e7effbf 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -271,7 +271,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> { let underscores = vec!["_"; expected_args.len()].join(", "); err.span_suggestion_verbose( closure_arg_span.unwrap_or(found_span), - &format!( + format!( "consider changing the closure to take and ignore the expected argument{}", pluralize!(expected_args.len()) ), @@ -575,7 +575,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { Limit(0) => Limit(2), limit => limit * 2, }; - err.help(&format!( + err.help(format!( "consider increasing the recursion limit by adding a \ `#![recursion_limit = \"{}\"]` attribute to your crate (`{}`)", suggested_limit, @@ -737,7 +737,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { if is_try_conversion && let Some(ret_span) = self.return_type_span(&obligation) { err.span_label( ret_span, - &format!( + format!( "expected `{}` because of this", trait_ref.skip_binder().self_ty() ), @@ -780,7 +780,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err.emit(); return; } - if let Some(ref s) = label { + if let Some(s) = label { // If it has a custom `#[rustc_on_unimplemented]` // error message, let's display it as the label! err.span_label(span, s); @@ -788,7 +788,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // When the self type is a type param We don't need to "the trait // `std::marker::Sized` is not implemented for `T`" as we will point // at the type param with a label to suggest constraining it. - err.help(&explanation); + err.help(explanation); } } else if let Some(custom_explanation) = safe_transmute_explanation { err.span_label(span, custom_explanation); @@ -811,13 +811,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ); if let Some((msg, span)) = type_def { - err.span_label(span, &msg); + err.span_label(span, msg); } - if let Some(ref s) = note { + if let Some(s) = note { // If it has a custom `#[rustc_on_unimplemented]` note, let's display it - err.note(s.as_str()); + err.note(s); } - if let Some(ref s) = parent_label { + if let Some(s) = parent_label { let body = obligation.cause.body_id; err.span_label(tcx.def_span(body), s); } @@ -1028,7 +1028,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // which bounds actually failed to hold. self.tcx.sess.struct_span_err( span, - &format!("the type `{}` is not well-formed", ty), + format!("the type `{}` is not well-formed", ty), ) } } @@ -1071,7 +1071,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ty::PredicateKind::Clause(ty::Clause::ConstArgHasType(ct, ty)) => { let mut diag = self.tcx.sess.struct_span_err( span, - &format!("the constant `{}` is not of type `{}`", ct, ty), + format!("the constant `{}` is not of type `{}`", ct, ty), ); self.note_type_err( &mut diag, @@ -1835,7 +1835,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { candidates.sort(); candidates.dedup(); let end = if candidates.len() <= 9 { candidates.len() } else { 8 }; - err.help(&format!( + err.help(format!( "the following {other}types implement trait `{}`:{}{}", trait_ref.print_only_trait_path(), candidates[..end].join(""), @@ -2026,7 +2026,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { "perhaps two different versions of crate `{}` are being used?", trait_crate ); - err.note(&crate_msg); + err.note(crate_msg); suggested = true; } suggested @@ -2158,7 +2158,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err.cancel(); return; } - err.note(&format!("cannot satisfy `{}`", predicate)); + err.note(format!("cannot satisfy `{}`", predicate)); let impl_candidates = self.find_similar_impl_candidates( predicate.to_opt_poly_trait_pred().unwrap(), ); @@ -2178,7 +2178,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err.cancel(); return; } - err.note(&format!("cannot satisfy `{}`", predicate)); + err.note(format!("cannot satisfy `{}`", predicate)); } } @@ -2223,9 +2223,9 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err.cancel(); err = self.tcx.sess.struct_span_err_with_code( span, - &format!( + format!( "cannot {verb} associated {noun} on trait without specifying the corresponding `impl` type", - ), + ), rustc_errors::error_code!(E0790), ); @@ -2332,7 +2332,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ErrorCode::E0284, true, ); - err.note(&format!("cannot satisfy `{}`", predicate)); + err.note(format!("cannot satisfy `{}`", predicate)); err } else { // If we can't find a substitution, just print a generic error @@ -2343,7 +2343,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { "type annotations needed: cannot satisfy `{}`", predicate, ); - err.span_label(span, &format!("cannot satisfy `{}`", predicate)); + err.span_label(span, format!("cannot satisfy `{}`", predicate)); err } } @@ -2371,7 +2371,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { "type annotations needed: cannot satisfy `{}`", predicate, ); - err.span_label(span, &format!("cannot satisfy `{}`", predicate)); + err.span_label(span, format!("cannot satisfy `{}`", predicate)); err } } @@ -2386,7 +2386,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { "type annotations needed: cannot satisfy `{}`", predicate, ); - err.span_label(span, &format!("cannot satisfy `{}`", predicate)); + err.span_label(span, format!("cannot satisfy `{}`", predicate)); err } }; @@ -2459,13 +2459,13 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { match (spans.len(), crates.len(), crate_names.len()) { (0, 0, 0) => { - err.note(&format!("cannot satisfy `{}`", predicate)); + err.note(format!("cannot satisfy `{}`", predicate)); } (0, _, 1) => { - err.note(&format!("{} in the `{}` crate{}", msg, crates[0], post,)); + err.note(format!("{} in the `{}` crate{}", msg, crates[0], post,)); } (0, _, _) => { - err.note(&format!( + err.note(format!( "{} in the following crates: {}{}", msg, crate_names.join(", "), @@ -2474,19 +2474,17 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } (_, 0, 0) => { let span: MultiSpan = spans.into(); - err.span_note(span, &msg); + err.span_note(span, msg); } (_, 1, 1) => { let span: MultiSpan = spans.into(); - err.span_note(span, &msg); - err.note( - &format!("and another `impl` found in the `{}` crate{}", crates[0], post,), - ); + err.span_note(span, msg); + err.note(format!("and another `impl` found in the `{}` crate{}", crates[0], post,)); } _ => { let span: MultiSpan = spans.into(); - err.span_note(span, &msg); - err.note(&format!( + err.span_note(span, msg); + err.note(format!( "and more `impl`s found in the following crates: {}{}", crate_names.join(", "), post, @@ -2657,7 +2655,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } err.span_help( multispan, - &format!( + format!( "you could relax the implicit `Sized` bound on `{T}` if it were \ used through indirection like `&{T}` or `Box<{T}>`", T = param.name.ident(), @@ -2882,7 +2880,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { .fn_trait_kind_from_def_id(trait_ref.def_id()) .expect("expected to map DefId to ClosureKind"); if !implemented_kind.extends(selected_kind) { - err.note(&format!( + err.note(format!( "`{}` implements `{}`, but it must implement `{}`, which is more general", trait_ref.skip_binder().self_ty(), implemented_kind, @@ -2899,7 +2897,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { if expected.len() != given.len() { // Note number of types that were expected and given err.note( - &format!( + format!( "expected a closure taking {} argument{}, but one taking {} argument{} was given", given.len(), pluralize!(given.len()), @@ -2942,7 +2940,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { unsatisfied_const = UnsatisfiedConst(true); err.span_note( span, - &format!( + format!( "the trait `{}` is implemented for `{}`, \ but that implementation is not `const`", non_const_predicate.print_modifiers_and_trait_path(), @@ -3171,7 +3169,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let mut err = self.tcx.sess.struct_span_err(span, "unconstrained generic constant"); let const_span = self.tcx.def_span(uv.def); match self.tcx.sess.source_map().span_to_snippet(const_span) { - Ok(snippet) => err.help(&format!( + Ok(snippet) => err.help(format!( "try adding a `where` bound using this expression: `where [(); {}]:`", snippet )), diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 595f6e0b9271b..08220c4fe9fec 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -515,7 +515,7 @@ fn suggest_restriction<'tcx>( err.span_suggestion_verbose( sp, - &format!("consider further restricting {}", msg), + format!("consider further restricting {}", msg), suggestion, Applicability::MachineApplicable, ); @@ -964,7 +964,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // a more general note. err.span_suggestion_verbose( obligation.cause.span.shrink_to_hi(), - &msg, + msg, format!("({args})"), Applicability::HasPlaceholders, ); @@ -994,7 +994,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } _ => return false, }; - err.help(&format!("{msg}: `{name}({args})`")); + err.help(format!("{msg}: `{name}({args})`")); } true } @@ -1334,7 +1334,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let msg = format!("the trait bound `{}` is not satisfied", old_pred); if has_custom_message { - err.note(&msg); + err.note(msg); } else { err.message = vec![(rustc_errors::DiagnosticMessage::Str(msg), Style::NoStyle)]; @@ -1358,7 +1358,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } else { let is_mut = mut_ref_self_ty_satisfies_pred || ref_inner_ty_mut; let sugg_prefix = format!("&{}", if is_mut { "mut " } else { "" }); - let sugg_msg = &format!( + let sugg_msg = format!( "consider{} borrowing here", if is_mut { " mutably" } else { "" } ); @@ -1452,7 +1452,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err.span_suggestion( obligation.cause.span.shrink_to_lo(), - &format!( + format!( "consider borrowing the value, since `&{self_ty}` can be coerced into `{object_ty}`" ), "&", @@ -1505,7 +1505,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { }; err.multipart_suggestion_verbose( - &msg, + msg, suggestions, Applicability::MachineApplicable, ); @@ -1617,7 +1617,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { if let ty::PredicateKind::Clause(ty::Clause::Trait(pred)) = obligation.predicate.kind().skip_binder() { - err.span_label(*span, &format!("this call returns `{}`", pred.self_ty())); + err.span_label(*span, format!("this call returns `{}`", pred.self_ty())); } if let Some(typeck_results) = &self.typeck_results && let ty = typeck_results.expr_ty_adjusted(base) @@ -1632,14 +1632,14 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { if vis_span.is_empty() { err.span_suggestion_verbose( span.shrink_to_lo(), - &msg, + msg, "async ", Applicability::MaybeIncorrect, ); } else { err.span_suggestion_verbose( vis_span.shrink_to_hi(), - &msg, + msg, " async", Applicability::MaybeIncorrect, ); @@ -1717,7 +1717,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { Applicability::MachineApplicable, ); } else { - err.note(&format!( + err.note(format!( "`{}` is implemented for `{:?}`, but not for `{:?}`", trait_pred.print_modifiers_and_trait_path(), suggested_ty, @@ -1754,7 +1754,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { { err.span_label( expr.span, - &format!( + format!( "this expression has type `{}`, which implements `{}`", ty, trait_pred.print_modifiers_and_trait_path() @@ -1946,7 +1946,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // Suggest `-> impl Trait`. err.span_suggestion( ret_ty.span, - &format!( + format!( "use `impl {1}` as the return type, as all return paths are of type `{}`, \ which implements `{1}`", last_ty, trait_obj, @@ -1981,13 +1981,13 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } else { // This is currently not possible to trigger because E0038 takes precedence, but // leave it in for completeness in case anything changes in an earlier stage. - err.note(&format!( + err.note(format!( "if trait `{}` were object-safe, you could return a trait object", trait_obj, )); } err.note(trait_obj_msg); - err.note(&format!( + err.note(format!( "if all the returned values were of the same type you could use `impl {}` as the \ return type", trait_obj, @@ -2027,7 +2027,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } else { err.span_label( expr.span, - &format!("this returned value is of type `{}`", ty), + format!("this returned value is of type `{}`", ty), ); } } @@ -2177,7 +2177,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ) { if let Some(assoc_item) = self.tcx.opt_associated_item(item_def_id) { if let ty::AssocKind::Const | ty::AssocKind::Type = assoc_item.kind { - err.note(&format!( + err.note(format!( "{}s cannot be accessed directly on a `trait`, they can only be \ accessed through a specific `impl`", self.tcx.def_kind_descr(assoc_item.kind.as_def_kind(), item_def_id) @@ -2607,7 +2607,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { } err.span_note( span, - &format!( + format!( "{} {} as this value is used across {}", future_or_generator, trait_explanation, an_await_or_yield ), @@ -2628,7 +2628,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ); err.span_note( span, - &format!( + format!( "future {not_trait} as it awaits another future which {not_trait}", not_trait = trait_explanation ), @@ -2730,7 +2730,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let mut span = MultiSpan::from_span(upvar_span); span.push_span_label(upvar_span, span_label); - err.span_note(span, &span_note); + err.span_note(span, span_note); } } @@ -2794,15 +2794,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { err.note("only the last element of a tuple may have a dynamically sized type"); } ObligationCauseCode::ProjectionWf(data) => { - err.note(&format!("required so that the projection `{data}` is well-formed")); + err.note(format!("required so that the projection `{data}` is well-formed")); } ObligationCauseCode::ReferenceOutlivesReferent(ref_ty) => { - err.note(&format!( + err.note(format!( "required so that reference `{ref_ty}` does not outlive its referent" )); } ObligationCauseCode::ObjectTypeBound(object_ty, region) => { - err.note(&format!( + err.note(format!( "required so that the lifetime bound of `{}` for `{}` is satisfied", region, object_ty, )); @@ -2838,9 +2838,9 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { if span.is_visible(sm) { let msg = format!("required by this bound in `{short_item_name}`"); multispan.push_span_label(span, msg); - err.span_note(multispan, &descr); + err.span_note(multispan, descr); } else { - err.span_note(tcx.def_span(item_def_id), &descr); + err.span_note(tcx.def_span(item_def_id), descr); } } ObligationCauseCode::ObjectCastObligation(concrete_ty, object_ty) => { @@ -2848,24 +2848,24 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { self.tcx.short_ty_string(self.resolve_vars_if_possible(concrete_ty)); let (object_ty, object_file) = self.tcx.short_ty_string(self.resolve_vars_if_possible(object_ty)); - err.note(&with_forced_trimmed_paths!(format!( + err.note(with_forced_trimmed_paths!(format!( "required for the cast from `{concrete_ty}` to the object type `{object_ty}`", ))); if let Some(file) = concrete_file { - err.note(&format!( + err.note(format!( "the full name for the casted type has been written to '{}'", file.display(), )); } if let Some(file) = object_file { - err.note(&format!( + err.note(format!( "the full name for the object type has been written to '{}'", file.display(), )); } } ObligationCauseCode::Coercion { source: _, target } => { - err.note(&format!("required by cast to type `{}`", self.ty_to_string(target))); + err.note(format!("required by cast to type `{}`", self.ty_to_string(target))); } ObligationCauseCode::RepeatElementCopy { is_const_fn } => { err.note( @@ -3068,8 +3068,8 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { )); match ty.kind() { ty::Adt(def, _) => match self.tcx.opt_item_ident(def.did()) { - Some(ident) => err.span_note(ident.span, &msg), - None => err.note(&msg), + Some(ident) => err.span_note(ident.span, msg), + None => err.note(msg), }, ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => { // If the previous type is async fn, this is the future generated by the body of an async function. @@ -3090,7 +3090,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { { break 'print; } - err.span_note(self.tcx.def_span(def_id), &msg) + err.span_note(self.tcx.def_span(def_id), msg) } ty::GeneratorWitness(bound_tys) => { use std::fmt::Write; @@ -3126,7 +3126,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let kind = tcx.generator_kind(def_id).unwrap().descr(); err.span_note( sp, - with_forced_trimmed_paths!(&format!( + with_forced_trimmed_paths!(format!( "required because it's used within this {kind}", )), ) @@ -3136,7 +3136,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { "required because it's used within this closure", ), ty::Str => err.note("`str` is considered to contain a `[u8]` slice for auto trait purposes"), - _ => err.note(&msg), + _ => err.note(msg), }; } } @@ -3190,7 +3190,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { // FIXME: we should do something else so that it works even on crate foreign // auto traits. is_auto_trait = matches!(is_auto, hir::IsAuto::Yes); - err.span_note(ident.span, &msg); + err.span_note(ident.span, msg); } Some(Node::Item(hir::Item { kind: hir::ItemKind::Impl(hir::Impl { of_trait, self_ty, .. }), @@ -3219,15 +3219,15 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { "unsatisfied trait bound introduced here", ); } - err.span_note(spans, &msg); + err.span_note(spans, msg); } _ => { - err.note(&msg); + err.note(msg); } }; if let Some(file) = file { - err.note(&format!( + err.note(format!( "the full type name has been written to '{}'", file.display(), )); @@ -3267,19 +3267,19 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { parent_trait_pred = child_trait_pred; } if count > 0 { - err.note(&format!( + err.note(format!( "{} redundant requirement{} hidden", count, pluralize!(count) )); let (self_ty, file) = self.tcx.short_ty_string(parent_trait_pred.skip_binder().self_ty()); - err.note(&format!( + err.note(format!( "required for `{self_ty}` to implement `{}`", parent_trait_pred.print_modifiers_and_trait_path() )); if let Some(file) = file { - err.note(&format!( + err.note(format!( "the full type name has been written to '{}'", file.display(), )); @@ -3360,7 +3360,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { { assoc_span.push_span_label(ident.span, "in this trait"); } - err.span_note(assoc_span, &msg); + err.span_note(assoc_span, msg); } ObligationCauseCode::TrivialBound => { err.help("see issue #48214"); @@ -3516,7 +3516,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { if can_derive { err.span_suggestion_verbose( self.tcx.def_span(adt.did()).shrink_to_lo(), - &format!( + format!( "consider annotating `{}` with `#[derive({})]`", trait_pred.skip_binder().self_ty(), diagnostic_name, @@ -3903,7 +3903,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { .map(|trait_ref| trait_ref.trait_ref.self_ty()) .find(|t| is_slice(*t)) { - let msg = &format!("convert the array to a `{}` slice instead", slice_ty); + let msg = format!("convert the array to a `{}` slice instead", slice_ty); if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) { let mut suggestions = vec![]; @@ -4124,7 +4124,7 @@ fn suggest_trait_object_return_type_alternatives( ) { err.span_suggestion( ret_ty, - &format!( + format!( "use `impl {}` as the return type if all return paths have the same type but you \ want to expose only the trait in the signature", trait_obj, @@ -4134,7 +4134,7 @@ fn suggest_trait_object_return_type_alternatives( ); if is_object_safe { err.multipart_suggestion( - &format!( + format!( "use a boxed trait object if all return paths implement trait `{}`", trait_obj, ), diff --git a/compiler/rustc_trait_selection/src/traits/misc.rs b/compiler/rustc_trait_selection/src/traits/misc.rs index 63949843aedcd..2210ef975e6c8 100644 --- a/compiler/rustc_trait_selection/src/traits/misc.rs +++ b/compiler/rustc_trait_selection/src/traits/misc.rs @@ -2,13 +2,14 @@ use crate::traits::{self, ObligationCause, ObligationCtxt}; +use hir::LangItem; use rustc_data_structures::fx::FxIndexSet; use rustc_hir as hir; use rustc_infer::infer::canonical::Canonical; use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt}; use rustc_infer::traits::query::NoSolution; use rustc_infer::{infer::outlives::env::OutlivesEnvironment, traits::FulfillmentError}; -use rustc_middle::ty::{self, ParamEnv, Ty, TyCtxt, TypeVisitableExt}; +use rustc_middle::ty::{self, AdtDef, GenericArg, List, ParamEnv, Ty, TyCtxt, TypeVisitableExt}; use rustc_span::DUMMY_SP; use super::outlives_bounds::InferCtxtExt; @@ -19,6 +20,11 @@ pub enum CopyImplementationError<'tcx> { HasDestructor, } +pub enum ConstParamTyImplementationError<'tcx> { + InfrigingFields(Vec<(&'tcx ty::FieldDef, Ty<'tcx>, InfringingFieldsReason<'tcx>)>), + NotAnAdtOrBuiltinAllowed, +} + pub enum InfringingFieldsReason<'tcx> { Fulfill(Vec>), Regions(Vec>), @@ -27,7 +33,10 @@ pub enum InfringingFieldsReason<'tcx> { /// Checks that the fields of the type (an ADT) all implement copy. /// /// If fields don't implement copy, return an error containing a list of -/// those violating fields. If it's not an ADT, returns `Err(NotAnAdt)`. +/// those violating fields. +/// +/// If it's not an ADT, int ty, `bool`, float ty, `char`, raw pointer, `!`, +/// a reference or an array returns `Err(NotAnAdt)`. pub fn type_allowed_to_implement_copy<'tcx>( tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -47,12 +56,82 @@ pub fn type_allowed_to_implement_copy<'tcx>( | ty::Ref(_, _, hir::Mutability::Not) | ty::Array(..) => return Ok(()), - ty::Adt(adt, substs) => (adt, substs), + &ty::Adt(adt, substs) => (adt, substs), _ => return Err(CopyImplementationError::NotAnAdt), }; - let copy_def_id = tcx.require_lang_item(hir::LangItem::Copy, Some(parent_cause.span)); + all_fields_implement_trait( + tcx, + param_env, + self_type, + adt, + substs, + parent_cause, + hir::LangItem::Copy, + ) + .map_err(CopyImplementationError::InfringingFields)?; + + if adt.has_dtor(tcx) { + return Err(CopyImplementationError::HasDestructor); + } + + Ok(()) +} + +/// Checks that the fields of the type (an ADT) all implement `ConstParamTy`. +/// +/// If fields don't implement `ConstParamTy`, return an error containing a list of +/// those violating fields. +/// +/// If it's not an ADT, int ty, `bool` or `char`, returns `Err(NotAnAdtOrBuiltinAllowed)`. +pub fn type_allowed_to_implement_const_param_ty<'tcx>( + tcx: TyCtxt<'tcx>, + param_env: ty::ParamEnv<'tcx>, + self_type: Ty<'tcx>, + parent_cause: ObligationCause<'tcx>, +) -> Result<(), ConstParamTyImplementationError<'tcx>> { + let (adt, substs) = match self_type.kind() { + // `core` provides these impls. + ty::Uint(_) + | ty::Int(_) + | ty::Bool + | ty::Char + | ty::Str + | ty::Array(..) + | ty::Slice(_) + | ty::Ref(.., hir::Mutability::Not) => return Ok(()), + + &ty::Adt(adt, substs) => (adt, substs), + + _ => return Err(ConstParamTyImplementationError::NotAnAdtOrBuiltinAllowed), + }; + + all_fields_implement_trait( + tcx, + param_env, + self_type, + adt, + substs, + parent_cause, + hir::LangItem::ConstParamTy, + ) + .map_err(ConstParamTyImplementationError::InfrigingFields)?; + + Ok(()) +} + +/// Check that all fields of a given `adt` implement `lang_item` trait. +pub fn all_fields_implement_trait<'tcx>( + tcx: TyCtxt<'tcx>, + param_env: ty::ParamEnv<'tcx>, + self_type: Ty<'tcx>, + adt: AdtDef<'tcx>, + substs: &'tcx List>, + parent_cause: ObligationCause<'tcx>, + lang_item: LangItem, +) -> Result<(), Vec<(&'tcx ty::FieldDef, Ty<'tcx>, InfringingFieldsReason<'tcx>)>> { + let trait_def_id = tcx.require_lang_item(lang_item, Some(parent_cause.span)); let mut infringing = Vec::new(); for variant in adt.variants() { @@ -93,7 +172,7 @@ pub fn type_allowed_to_implement_copy<'tcx>( // between expected and found const-generic types. Don't report an // additional copy error here, since it's not typically useful. if !normalization_errors.is_empty() || ty.references_error() { - tcx.sess.delay_span_bug(field_span, format!("couldn't normalize struct field `{unnormalized_ty}` when checking Copy implementation")); + tcx.sess.delay_span_bug(field_span, format!("couldn't normalize struct field `{unnormalized_ty}` when checking {tr} implementation", tr = tcx.def_path_str(trait_def_id))); continue; } @@ -101,7 +180,7 @@ pub fn type_allowed_to_implement_copy<'tcx>( ObligationCause::dummy_with_span(field_ty_span), param_env, ty, - copy_def_id, + trait_def_id, ); let errors = ocx.select_all_or_error(); if !errors.is_empty() { @@ -124,15 +203,7 @@ pub fn type_allowed_to_implement_copy<'tcx>( } } - if !infringing.is_empty() { - return Err(CopyImplementationError::InfringingFields(infringing)); - } - - if adt.has_dtor(tcx) { - return Err(CopyImplementationError::HasDestructor); - } - - Ok(()) + if infringing.is_empty() { Ok(()) } else { Err(infringing) } } pub fn check_tys_might_be_eq<'tcx>( diff --git a/compiler/rustc_trait_selection/src/traits/object_safety.rs b/compiler/rustc_trait_selection/src/traits/object_safety.rs index 73e2efc3b000e..384b6ae93a12a 100644 --- a/compiler/rustc_trait_selection/src/traits/object_safety.rs +++ b/compiler/rustc_trait_selection/src/traits/object_safety.rs @@ -525,7 +525,7 @@ fn virtual_call_violation_for_method<'tcx>( // #78372 tcx.sess.delay_span_bug( tcx.def_span(method.def_id), - &format!("error: {}\n while computing layout for type {:?}", err, ty), + format!("error: {}\n while computing layout for type {:?}", err, ty), ); None } @@ -541,7 +541,7 @@ fn virtual_call_violation_for_method<'tcx>( abi => { tcx.sess.delay_span_bug( tcx.def_span(method.def_id), - &format!( + format!( "receiver when `Self = ()` should have a Scalar ABI; found {:?}", abi ), @@ -560,7 +560,7 @@ fn virtual_call_violation_for_method<'tcx>( abi => { tcx.sess.delay_span_bug( tcx.def_span(method.def_id), - &format!( + format!( "receiver when `Self = {}` should have a ScalarPair ABI; found {:?}", trait_object_ty, abi ), diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index ea45412e47f11..4369b257f5fe7 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1749,7 +1749,7 @@ fn assemble_candidates_from_impls<'cx, 'tcx>( // These traits have no associated types. selcx.tcx().sess.delay_span_bug( obligation.cause.span, - &format!("Cannot project an associated type from `{:?}`", impl_source), + format!("Cannot project an associated type from `{:?}`", impl_source), ); return Err(()); } diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs index 8f1b05c1190d5..1f8e756043d23 100644 --- a/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs +++ b/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs @@ -79,7 +79,7 @@ pub fn scrape_region_constraints<'tcx, Op: super::TypeOp<'tcx, Output = R>, R>( if !errors.is_empty() { infcx.tcx.sess.diagnostic().delay_span_bug( DUMMY_SP, - &format!("errors selecting obligation during MIR typeck: {:?}", errors), + format!("errors selecting obligation during MIR typeck: {:?}", errors), ); } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 863553670dee2..9890e990eebf0 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -67,7 +67,7 @@ impl IntercrateAmbiguityCause { /// Emits notes when the overlap is caused by complex intercrate ambiguities. /// See #23980 for details. pub fn add_intercrate_ambiguity_hint(&self, err: &mut Diagnostic) { - err.note(&self.intercrate_ambiguity_hint()); + err.note(self.intercrate_ambiguity_hint()); } pub fn intercrate_ambiguity_hint(&self) -> String { @@ -2449,7 +2449,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> { // for a variable being generalized... let guar = self.infcx.tcx.sess.delay_span_bug( obligation.cause.span, - &format!( + format!( "Impl {:?} was matchable against {:?} but now is not", impl_def_id, obligation ), diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 8546bbe52dcc3..233d35aed3820 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -373,7 +373,7 @@ fn report_conflicting_impls<'tcx>( } None => format!("conflicting implementation in crate `{}`", cname), }; - err.note(&msg); + err.note(msg); } } diff --git a/compiler/rustc_traits/src/dropck_outlives.rs b/compiler/rustc_traits/src/dropck_outlives.rs index 58117c46f0430..fcdffc7468b82 100644 --- a/compiler/rustc_traits/src/dropck_outlives.rs +++ b/compiler/rustc_traits/src/dropck_outlives.rs @@ -190,7 +190,7 @@ fn dtorck_constraint_for_ty<'tcx>( tcx.sess.delay_span_bug( span, - &format!("upvar_tys for closure not found. Expected capture information for closure {ty}",), + format!("upvar_tys for closure not found. Expected capture information for closure {ty}",), ); return Err(NoSolution); } @@ -232,7 +232,7 @@ fn dtorck_constraint_for_ty<'tcx>( // be fully resolved. tcx.sess.delay_span_bug( span, - &format!("upvar_tys for generator not found. Expected capture information for generator {ty}",), + format!("upvar_tys for generator not found. Expected capture information for generator {ty}",), ); return Err(NoSolution); } diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index 64586a6782b18..eedf459ce8fbc 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -85,7 +85,7 @@ fn resolve_associated_item<'tcx>( Err(CodegenObligationError::Ambiguity) => { let reported = tcx.sess.delay_span_bug( tcx.def_span(trait_item_id), - &format!( + format!( "encountered ambiguity selecting `{trait_ref:?}` during codegen, presuming due to \ overflow or prior type error", ), diff --git a/compiler/rustc_ty_utils/src/needs_drop.rs b/compiler/rustc_ty_utils/src/needs_drop.rs index 5f436f7c9fdf9..a04f85afb9ee2 100644 --- a/compiler/rustc_ty_utils/src/needs_drop.rs +++ b/compiler/rustc_ty_utils/src/needs_drop.rs @@ -132,7 +132,7 @@ where _ => { tcx.sess.delay_span_bug( tcx.hir().span_if_local(def_id).unwrap_or(DUMMY_SP), - &format!("unexpected generator witness type {:?}", witness), + format!("unexpected generator witness type {:?}", witness), ); return Some(Err(AlwaysRequiresDrop)); } diff --git a/library/core/src/ascii.rs b/library/core/src/ascii.rs index 8a4cb78cc7f92..065f1b3e70e68 100644 --- a/library/core/src/ascii.rs +++ b/library/core/src/ascii.rs @@ -9,10 +9,10 @@ #![stable(feature = "core_ascii", since = "1.26.0")] +use crate::escape; use crate::fmt; use crate::iter::FusedIterator; -use crate::ops::Range; -use crate::str::from_utf8_unchecked; +use crate::num::NonZeroUsize; /// An iterator over the escaped version of a byte. /// @@ -21,10 +21,7 @@ use crate::str::from_utf8_unchecked; #[must_use = "iterators are lazy and do nothing unless consumed"] #[stable(feature = "rust1", since = "1.0.0")] #[derive(Clone)] -pub struct EscapeDefault { - range: Range, - data: [u8; 4], -} +pub struct EscapeDefault(escape::EscapeIterInner<4>); /// Returns an iterator that produces an escaped version of a `u8`. /// @@ -90,21 +87,9 @@ pub struct EscapeDefault { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn escape_default(c: u8) -> EscapeDefault { - let (data, len) = match c { - b'\t' => ([b'\\', b't', 0, 0], 2), - b'\r' => ([b'\\', b'r', 0, 0], 2), - b'\n' => ([b'\\', b'n', 0, 0], 2), - b'\\' => ([b'\\', b'\\', 0, 0], 2), - b'\'' => ([b'\\', b'\'', 0, 0], 2), - b'"' => ([b'\\', b'"', 0, 0], 2), - b'\x20'..=b'\x7e' => ([c, 0, 0, 0], 1), - _ => { - let hex_digits: &[u8; 16] = b"0123456789abcdef"; - ([b'\\', b'x', hex_digits[(c >> 4) as usize], hex_digits[(c & 0xf) as usize]], 4) - } - }; - - return EscapeDefault { range: 0..len, data }; + let mut data = [0; 4]; + let range = escape::escape_ascii_into(&mut data, c); + EscapeDefault(escape::EscapeIterInner::new(data, range)) } #[stable(feature = "rust1", since = "1.0.0")] @@ -113,33 +98,59 @@ impl Iterator for EscapeDefault { #[inline] fn next(&mut self) -> Option { - self.range.next().map(|i| self.data[i as usize]) + self.0.next() } + + #[inline] fn size_hint(&self) -> (usize, Option) { - self.range.size_hint() + let n = self.0.len(); + (n, Some(n)) + } + + #[inline] + fn count(self) -> usize { + self.0.len() } + + #[inline] fn last(mut self) -> Option { - self.next_back() + self.0.next_back() + } + + #[inline] + fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> { + self.0.advance_by(n) } } + #[stable(feature = "rust1", since = "1.0.0")] impl DoubleEndedIterator for EscapeDefault { + #[inline] fn next_back(&mut self) -> Option { - self.range.next_back().map(|i| self.data[i as usize]) + self.0.next_back() + } + + #[inline] + fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize> { + self.0.advance_back_by(n) } } + #[stable(feature = "rust1", since = "1.0.0")] -impl ExactSizeIterator for EscapeDefault {} +impl ExactSizeIterator for EscapeDefault { + #[inline] + fn len(&self) -> usize { + self.0.len() + } +} + #[stable(feature = "fused", since = "1.26.0")] impl FusedIterator for EscapeDefault {} #[stable(feature = "ascii_escape_display", since = "1.39.0")] impl fmt::Display for EscapeDefault { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - // SAFETY: ok because `escape_default` created only valid utf-8 data - f.write_str(unsafe { - from_utf8_unchecked(&self.data[(self.range.start as usize)..(self.range.end as usize)]) - }) + f.write_str(self.0.as_str()) } } diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 9bc97ea0bff18..2408f17807554 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -380,20 +380,7 @@ impl char { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn escape_unicode(self) -> EscapeUnicode { - let c = self as u32; - - // or-ing 1 ensures that for c==0 the code computes that one - // digit should be printed and (which is the same) avoids the - // (31 - 32) underflow - let msb = 31 - (c | 1).leading_zeros(); - - // the index of the most significant hex digit - let ms_hex_digit = msb / 4; - EscapeUnicode { - c: self, - state: EscapeUnicodeState::Backslash, - hex_digit_idx: ms_hex_digit as usize, - } + EscapeUnicode::new(self) } /// An extended version of `escape_debug` that optionally permits escaping @@ -403,21 +390,20 @@ impl char { /// characters, and double quotes in strings. #[inline] pub(crate) fn escape_debug_ext(self, args: EscapeDebugExtArgs) -> EscapeDebug { - let init_state = match self { - '\0' => EscapeDefaultState::Backslash('0'), - '\t' => EscapeDefaultState::Backslash('t'), - '\r' => EscapeDefaultState::Backslash('r'), - '\n' => EscapeDefaultState::Backslash('n'), - '\\' => EscapeDefaultState::Backslash(self), - '"' if args.escape_double_quote => EscapeDefaultState::Backslash(self), - '\'' if args.escape_single_quote => EscapeDefaultState::Backslash(self), + match self { + '\0' => EscapeDebug::backslash(b'0'), + '\t' => EscapeDebug::backslash(b't'), + '\r' => EscapeDebug::backslash(b'r'), + '\n' => EscapeDebug::backslash(b'n'), + '\\' => EscapeDebug::backslash(b'\\'), + '"' if args.escape_double_quote => EscapeDebug::backslash(b'"'), + '\'' if args.escape_single_quote => EscapeDebug::backslash(b'\''), _ if args.escape_grapheme_extended && self.is_grapheme_extended() => { - EscapeDefaultState::Unicode(self.escape_unicode()) + EscapeDebug::from_unicode(self.escape_unicode()) } - _ if is_printable(self) => EscapeDefaultState::Char(self), - _ => EscapeDefaultState::Unicode(self.escape_unicode()), - }; - EscapeDebug(EscapeDefault { state: init_state }) + _ if is_printable(self) => EscapeDebug::printable(self), + _ => EscapeDebug::from_unicode(self.escape_unicode()), + } } /// Returns an iterator that yields the literal escape code of a character @@ -515,15 +501,14 @@ impl char { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn escape_default(self) -> EscapeDefault { - let init_state = match self { - '\t' => EscapeDefaultState::Backslash('t'), - '\r' => EscapeDefaultState::Backslash('r'), - '\n' => EscapeDefaultState::Backslash('n'), - '\\' | '\'' | '"' => EscapeDefaultState::Backslash(self), - '\x20'..='\x7e' => EscapeDefaultState::Char(self), - _ => EscapeDefaultState::Unicode(self.escape_unicode()), - }; - EscapeDefault { state: init_state } + match self { + '\t' => EscapeDefault::backslash(b't'), + '\r' => EscapeDefault::backslash(b'r'), + '\n' => EscapeDefault::backslash(b'n'), + '\\' | '\'' | '"' => EscapeDefault::backslash(self as u8), + '\x20'..='\x7e' => EscapeDefault::printable(self as u8), + _ => EscapeDefault::from_unicode(self.escape_unicode()), + } } /// Returns the number of bytes this `char` would need if encoded in UTF-8. diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs index 8ec78e88733cf..e186db7052cd0 100644 --- a/library/core/src/char/mod.rs +++ b/library/core/src/char/mod.rs @@ -39,8 +39,10 @@ pub use self::methods::encode_utf16_raw; pub use self::methods::encode_utf8_raw; use crate::error::Error; +use crate::escape; use crate::fmt::{self, Write}; use crate::iter::FusedIterator; +use crate::num::NonZeroUsize; pub(crate) use self::methods::EscapeDebugExtArgs; @@ -146,86 +148,44 @@ pub const fn from_digit(num: u32, radix: u32) -> Option { /// [`escape_unicode`]: char::escape_unicode #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] -pub struct EscapeUnicode { - c: char, - state: EscapeUnicodeState, - - // The index of the next hex digit to be printed (0 if none), - // i.e., the number of remaining hex digits to be printed; - // increasing from the least significant digit: 0x543210 - hex_digit_idx: usize, -} +pub struct EscapeUnicode(escape::EscapeIterInner<10>); -// The enum values are ordered so that their representation is the -// same as the remaining length (besides the hexadecimal digits). This -// likely makes `len()` a single load from memory) and inline-worth. -#[derive(Clone, Debug)] -enum EscapeUnicodeState { - Done, - RightBrace, - Value, - LeftBrace, - Type, - Backslash, +impl EscapeUnicode { + fn new(chr: char) -> Self { + let mut data = [0; 10]; + let range = escape::escape_unicode_into(&mut data, chr); + Self(escape::EscapeIterInner::new(data, range)) + } } #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for EscapeUnicode { type Item = char; + #[inline] fn next(&mut self) -> Option { - match self.state { - EscapeUnicodeState::Backslash => { - self.state = EscapeUnicodeState::Type; - Some('\\') - } - EscapeUnicodeState::Type => { - self.state = EscapeUnicodeState::LeftBrace; - Some('u') - } - EscapeUnicodeState::LeftBrace => { - self.state = EscapeUnicodeState::Value; - Some('{') - } - EscapeUnicodeState::Value => { - let hex_digit = ((self.c as u32) >> (self.hex_digit_idx * 4)) & 0xf; - let c = char::from_digit(hex_digit, 16).unwrap(); - if self.hex_digit_idx == 0 { - self.state = EscapeUnicodeState::RightBrace; - } else { - self.hex_digit_idx -= 1; - } - Some(c) - } - EscapeUnicodeState::RightBrace => { - self.state = EscapeUnicodeState::Done; - Some('}') - } - EscapeUnicodeState::Done => None, - } + self.0.next().map(char::from) } #[inline] fn size_hint(&self) -> (usize, Option) { - let n = self.len(); + let n = self.0.len(); (n, Some(n)) } #[inline] fn count(self) -> usize { - self.len() + self.0.len() } - fn last(self) -> Option { - match self.state { - EscapeUnicodeState::Done => None, + #[inline] + fn last(mut self) -> Option { + self.0.next_back().map(char::from) + } - EscapeUnicodeState::RightBrace - | EscapeUnicodeState::Value - | EscapeUnicodeState::LeftBrace - | EscapeUnicodeState::Type - | EscapeUnicodeState::Backslash => Some('}'), - } + #[inline] + fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> { + self.0.advance_by(n) } } @@ -233,16 +193,7 @@ impl Iterator for EscapeUnicode { impl ExactSizeIterator for EscapeUnicode { #[inline] fn len(&self) -> usize { - // The match is a single memory access with no branching - self.hex_digit_idx - + match self.state { - EscapeUnicodeState::Done => 0, - EscapeUnicodeState::RightBrace => 1, - EscapeUnicodeState::Value => 2, - EscapeUnicodeState::LeftBrace => 3, - EscapeUnicodeState::Type => 4, - EscapeUnicodeState::Backslash => 5, - } + self.0.len() } } @@ -252,10 +203,7 @@ impl FusedIterator for EscapeUnicode {} #[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for EscapeUnicode { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - for c in self.clone() { - f.write_char(c)?; - } - Ok(()) + f.write_str(self.0.as_str()) } } @@ -267,90 +215,60 @@ impl fmt::Display for EscapeUnicode { /// [`escape_default`]: char::escape_default #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] -pub struct EscapeDefault { - state: EscapeDefaultState, -} +pub struct EscapeDefault(escape::EscapeIterInner<10>); -#[derive(Clone, Debug)] -enum EscapeDefaultState { - Done, - Char(char), - Backslash(char), - Unicode(EscapeUnicode), +impl EscapeDefault { + fn printable(chr: u8) -> Self { + let data = [chr, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + Self(escape::EscapeIterInner::new(data, 0..1)) + } + + fn backslash(chr: u8) -> Self { + let data = [b'\\', chr, 0, 0, 0, 0, 0, 0, 0, 0]; + Self(escape::EscapeIterInner::new(data, 0..2)) + } + + fn from_unicode(esc: EscapeUnicode) -> Self { + Self(esc.0) + } } #[stable(feature = "rust1", since = "1.0.0")] impl Iterator for EscapeDefault { type Item = char; + #[inline] fn next(&mut self) -> Option { - match self.state { - EscapeDefaultState::Backslash(c) => { - self.state = EscapeDefaultState::Char(c); - Some('\\') - } - EscapeDefaultState::Char(c) => { - self.state = EscapeDefaultState::Done; - Some(c) - } - EscapeDefaultState::Done => None, - EscapeDefaultState::Unicode(ref mut iter) => iter.next(), - } + self.0.next().map(char::from) } #[inline] fn size_hint(&self) -> (usize, Option) { - let n = self.len(); + let n = self.0.len(); (n, Some(n)) } #[inline] fn count(self) -> usize { - self.len() + self.0.len() } - fn nth(&mut self, n: usize) -> Option { - match self.state { - EscapeDefaultState::Backslash(c) if n == 0 => { - self.state = EscapeDefaultState::Char(c); - Some('\\') - } - EscapeDefaultState::Backslash(c) if n == 1 => { - self.state = EscapeDefaultState::Done; - Some(c) - } - EscapeDefaultState::Backslash(_) => { - self.state = EscapeDefaultState::Done; - None - } - EscapeDefaultState::Char(c) => { - self.state = EscapeDefaultState::Done; - - if n == 0 { Some(c) } else { None } - } - EscapeDefaultState::Done => None, - EscapeDefaultState::Unicode(ref mut i) => i.nth(n), - } + #[inline] + fn last(mut self) -> Option { + self.0.next_back().map(char::from) } - fn last(self) -> Option { - match self.state { - EscapeDefaultState::Unicode(iter) => iter.last(), - EscapeDefaultState::Done => None, - EscapeDefaultState::Backslash(c) | EscapeDefaultState::Char(c) => Some(c), - } + #[inline] + fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> { + self.0.advance_by(n) } } #[stable(feature = "exact_size_escape", since = "1.11.0")] impl ExactSizeIterator for EscapeDefault { + #[inline] fn len(&self) -> usize { - match self.state { - EscapeDefaultState::Done => 0, - EscapeDefaultState::Char(_) => 1, - EscapeDefaultState::Backslash(_) => 2, - EscapeDefaultState::Unicode(ref iter) => iter.len(), - } + self.0.len() } } @@ -360,10 +278,7 @@ impl FusedIterator for EscapeDefault {} #[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for EscapeDefault { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - for c in self.clone() { - f.write_char(c)?; - } - Ok(()) + f.write_str(self.0.as_str()) } } @@ -375,21 +290,74 @@ impl fmt::Display for EscapeDefault { /// [`escape_debug`]: char::escape_debug #[stable(feature = "char_escape_debug", since = "1.20.0")] #[derive(Clone, Debug)] -pub struct EscapeDebug(EscapeDefault); +pub struct EscapeDebug(EscapeDebugInner); + +#[derive(Clone, Debug)] +// Note: It’s possible to manually encode the EscapeDebugInner inside of +// EscapeIterInner (e.g. with alive=254..255 indicating that data[0..4] holds +// a char) which would likely result in a more optimised code. For now we use +// the option easier to implement. +enum EscapeDebugInner { + Bytes(escape::EscapeIterInner<10>), + Char(char), +} + +impl EscapeDebug { + fn printable(chr: char) -> Self { + Self(EscapeDebugInner::Char(chr)) + } + + fn backslash(chr: u8) -> Self { + let data = [b'\\', chr, 0, 0, 0, 0, 0, 0, 0, 0]; + let iter = escape::EscapeIterInner::new(data, 0..2); + Self(EscapeDebugInner::Bytes(iter)) + } + + fn from_unicode(esc: EscapeUnicode) -> Self { + Self(EscapeDebugInner::Bytes(esc.0)) + } + + fn clear(&mut self) { + let bytes = escape::EscapeIterInner::new([0; 10], 0..0); + self.0 = EscapeDebugInner::Bytes(bytes); + } +} #[stable(feature = "char_escape_debug", since = "1.20.0")] impl Iterator for EscapeDebug { type Item = char; + + #[inline] fn next(&mut self) -> Option { - self.0.next() + match self.0 { + EscapeDebugInner::Bytes(ref mut bytes) => bytes.next().map(char::from), + EscapeDebugInner::Char(chr) => { + self.clear(); + Some(chr) + } + } } + fn size_hint(&self) -> (usize, Option) { - self.0.size_hint() + let n = self.len(); + (n, Some(n)) + } + + #[inline] + fn count(self) -> usize { + self.len() } } #[stable(feature = "char_escape_debug", since = "1.20.0")] -impl ExactSizeIterator for EscapeDebug {} +impl ExactSizeIterator for EscapeDebug { + fn len(&self) -> usize { + match &self.0 { + EscapeDebugInner::Bytes(bytes) => bytes.len(), + EscapeDebugInner::Char(_) => 1, + } + } +} #[stable(feature = "fused", since = "1.26.0")] impl FusedIterator for EscapeDebug {} @@ -397,7 +365,10 @@ impl FusedIterator for EscapeDebug {} #[stable(feature = "char_escape_debug", since = "1.20.0")] impl fmt::Display for EscapeDebug { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(&self.0, f) + match &self.0 { + EscapeDebugInner::Bytes(bytes) => f.write_str(bytes.as_str()), + EscapeDebugInner::Char(chr) => f.write_char(*chr), + } } } diff --git a/library/core/src/escape.rs b/library/core/src/escape.rs new file mode 100644 index 0000000000000..20ac3cf027f87 --- /dev/null +++ b/library/core/src/escape.rs @@ -0,0 +1,99 @@ +//! Helper code for character escaping. + +use crate::num::NonZeroUsize; +use crate::ops::Range; + +const HEX_DIGITS: [u8; 16] = *b"0123456789abcdef"; + +/// Escapes a byte into provided buffer; returns length of escaped +/// representation. +pub(crate) fn escape_ascii_into(output: &mut [u8; 4], byte: u8) -> Range { + let (data, len) = match byte { + b'\t' => ([b'\\', b't', 0, 0], 2), + b'\r' => ([b'\\', b'r', 0, 0], 2), + b'\n' => ([b'\\', b'n', 0, 0], 2), + b'\\' => ([b'\\', b'\\', 0, 0], 2), + b'\'' => ([b'\\', b'\'', 0, 0], 2), + b'"' => ([b'\\', b'"', 0, 0], 2), + b'\x20'..=b'\x7e' => ([byte, 0, 0, 0], 1), + _ => { + let hi = HEX_DIGITS[usize::from(byte >> 4)]; + let lo = HEX_DIGITS[usize::from(byte & 0xf)]; + ([b'\\', b'x', hi, lo], 4) + } + }; + *output = data; + 0..(len as u8) +} + +/// Escapes a character into provided buffer using `\u{NNNN}` representation. +pub(crate) fn escape_unicode_into(output: &mut [u8; 10], ch: char) -> Range { + output[9] = b'}'; + + let ch = ch as u32; + output[3] = HEX_DIGITS[((ch >> 20) & 15) as usize]; + output[4] = HEX_DIGITS[((ch >> 16) & 15) as usize]; + output[5] = HEX_DIGITS[((ch >> 12) & 15) as usize]; + output[6] = HEX_DIGITS[((ch >> 8) & 15) as usize]; + output[7] = HEX_DIGITS[((ch >> 4) & 15) as usize]; + output[8] = HEX_DIGITS[((ch >> 0) & 15) as usize]; + + // or-ing 1 ensures that for ch==0 the code computes that one digit should + // be printed. + let start = (ch | 1).leading_zeros() as usize / 4 - 2; + output[start..start + 3].copy_from_slice(b"\\u{"); + + (start as u8)..10 +} + +/// An iterator over an fixed-size array. +/// +/// This is essentially equivalent to array’s IntoIter except that indexes are +/// limited to u8 to reduce size of the structure. +#[derive(Clone, Debug)] +pub(crate) struct EscapeIterInner { + // Invariant: data[alive] is all ASCII. + pub(crate) data: [u8; N], + + // Invariant: alive.start <= alive.end <= N. + pub(crate) alive: Range, +} + +impl EscapeIterInner { + pub fn new(data: [u8; N], alive: Range) -> Self { + const { assert!(N < 256) }; + debug_assert!(alive.start <= alive.end && usize::from(alive.end) <= N, "{alive:?}"); + let this = Self { data, alive }; + debug_assert!(this.as_bytes().is_ascii(), "Expected ASCII, got {:?}", this.as_bytes()); + this + } + + fn as_bytes(&self) -> &[u8] { + &self.data[usize::from(self.alive.start)..usize::from(self.alive.end)] + } + + pub fn as_str(&self) -> &str { + // SAFETY: self.data[self.alive] is all ASCII characters. + unsafe { crate::str::from_utf8_unchecked(self.as_bytes()) } + } + + pub fn len(&self) -> usize { + usize::from(self.alive.end - self.alive.start) + } + + pub fn next(&mut self) -> Option { + self.alive.next().map(|i| self.data[usize::from(i)]) + } + + pub fn next_back(&mut self) -> Option { + self.alive.next_back().map(|i| self.data[usize::from(i)]) + } + + pub fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize> { + self.alive.advance_by(n) + } + + pub fn advance_back_by(&mut self, n: usize) -> Result<(), NonZeroUsize> { + self.alive.advance_back_by(n) + } +} diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 24a9d81d03784..a535a011aafe2 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -162,6 +162,7 @@ #![feature(const_waker)] #![feature(core_panic)] #![feature(duration_consts_float)] +#![feature(internal_impls_macro)] #![feature(ip)] #![feature(is_ascii_octdigit)] #![feature(maybe_uninit_uninit_array)] @@ -376,6 +377,7 @@ pub mod alloc; // note: does not need to be public mod bool; +mod escape; mod tuple; mod unit; diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 82e4c6489745d..52f3d208aba4e 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -12,6 +12,60 @@ use crate::fmt::Debug; use crate::hash::Hash; use crate::hash::Hasher; +/// Implements a given marker trait for multiple types at the same time. +/// +/// The basic syntax looks like this: +/// ```ignore private macro +/// marker_impls! { MarkerTrait for u8, i8 } +/// ``` +/// You can also implement `unsafe` traits +/// ```ignore private macro +/// marker_impls! { unsafe MarkerTrait for u8, i8 } +/// ``` +/// Add attributes to all impls: +/// ```ignore private macro +/// marker_impls! { +/// #[allow(lint)] +/// #[unstable(feature = "marker_trait", issue = "none")] +/// MarkerTrait for u8, i8 +/// } +/// ``` +/// And use generics: +/// ```ignore private macro +/// marker_impls! { +/// MarkerTrait for +/// u8, i8, +/// {T: ?Sized} *const T, +/// {T: ?Sized} *mut T, +/// {T: MarkerTrait} PhantomData, +/// u32, +/// } +/// ``` +#[unstable(feature = "internal_impls_macro", issue = "none")] +macro marker_impls { + ( $(#[$($meta:tt)*])* $Trait:ident for $( $({$($bounds:tt)*})? $T:ty ),+ $(,)?) => { + // This inner macro is needed because... idk macros are weird. + // It allows repeating `meta` on all impls. + #[unstable(feature = "internal_impls_macro", issue = "none")] + macro _impl { + ( $$({$$($$bounds_:tt)*})? $$T_:ty ) => { + $(#[$($meta)*])* impl<$$($$($$bounds_)*)?> $Trait for $$T_ {} + } + } + $( _impl! { $({$($bounds)*})? $T } )+ + }, + ( $(#[$($meta:tt)*])* unsafe $Trait:ident for $( $({$($bounds:tt)*})? $T:ty ),+ $(,)?) => { + #[unstable(feature = "internal_impls_macro", issue = "none")] + macro _impl { + ( $$({$$($$bounds_:tt)*})? $$T_:ty ) => { + $(#[$($meta)*])* unsafe impl<$$($$($$bounds_)*)?> $Trait for $$T_ {} + } + } + + $( _impl! { $({$($bounds)*})? $T } )+ + }, +} + /// Types that can be transferred across thread boundaries. /// /// This trait is automatically implemented when the compiler determines it's @@ -214,6 +268,20 @@ pub trait StructuralEq { // Empty. } +// FIXME: Remove special cases of these types from the compiler pattern checking code and always check `T: StructuralEq` instead +marker_impls! { + #[unstable(feature = "structural_match", issue = "31434")] + StructuralEq for + usize, u8, u16, u32, u64, u128, + isize, i8, i16, i32, i64, i128, + bool, + char, + str /* Technically requires `[u8]: StructuralEq` */, + {T, const N: usize} [T; N], + {T} [T], + {T: ?Sized} &T, +} + /// Types whose values can be duplicated simply by copying bits. /// /// By default, variable bindings have 'move semantics.' In other @@ -401,6 +469,30 @@ pub macro Copy($item:item) { /* compiler built-in */ } +// Implementations of `Copy` for primitive types. +// +// Implementations that cannot be described in Rust +// are implemented in `traits::SelectionContext::copy_clone_conditions()` +// in `rustc_trait_selection`. +marker_impls! { + #[stable(feature = "rust1", since = "1.0.0")] + Copy for + usize, u8, u16, u32, u64, u128, + isize, i8, i16, i32, i64, i128, + f32, f64, + bool, char, + {T: ?Sized} *const T, + {T: ?Sized} *mut T, + +} + +#[unstable(feature = "never_type", issue = "35121")] +impl Copy for ! {} + +/// Shared references can be copied, but mutable references *cannot*! +#[stable(feature = "rust1", since = "1.0.0")] +impl Copy for &T {} + /// Types for which it is safe to share references between threads. /// /// This trait is automatically implemented when the compiler determines @@ -778,11 +870,14 @@ pub trait DiscriminantKind { pub(crate) unsafe auto trait Freeze {} impl !Freeze for UnsafeCell {} -unsafe impl Freeze for PhantomData {} -unsafe impl Freeze for *const T {} -unsafe impl Freeze for *mut T {} -unsafe impl Freeze for &T {} -unsafe impl Freeze for &mut T {} +marker_impls! { + unsafe Freeze for + {T: ?Sized} PhantomData, + {T: ?Sized} *const T, + {T: ?Sized} *mut T, + {T: ?Sized} &T, + {T: ?Sized} &mut T, +} /// Types that can be safely moved after being pinned. /// @@ -843,17 +938,19 @@ pub struct PhantomPinned; #[stable(feature = "pin", since = "1.33.0")] impl !Unpin for PhantomPinned {} -#[stable(feature = "pin", since = "1.33.0")] -impl<'a, T: ?Sized + 'a> Unpin for &'a T {} - -#[stable(feature = "pin", since = "1.33.0")] -impl<'a, T: ?Sized + 'a> Unpin for &'a mut T {} - -#[stable(feature = "pin_raw", since = "1.38.0")] -impl Unpin for *const T {} +marker_impls! { + #[stable(feature = "pin", since = "1.33.0")] + Unpin for + {T: ?Sized} &T, + {T: ?Sized} &mut T, +} -#[stable(feature = "pin_raw", since = "1.38.0")] -impl Unpin for *mut T {} +marker_impls! { + #[stable(feature = "pin_raw", since = "1.38.0")] + Unpin for + {T: ?Sized} *const T, + {T: ?Sized} *mut T, +} /// A marker for types that can be dropped. /// @@ -888,43 +985,25 @@ pub trait Tuple {} )] pub trait PointerLike {} -/// Implementations of `Copy` for primitive types. -/// -/// Implementations that cannot be described in Rust -/// are implemented in `traits::SelectionContext::copy_clone_conditions()` -/// in `rustc_trait_selection`. -mod copy_impls { - - use super::Copy; - - macro_rules! impl_copy { - ($($t:ty)*) => { - $( - #[stable(feature = "rust1", since = "1.0.0")] - impl Copy for $t {} - )* - } - } - - impl_copy! { - usize u8 u16 u32 u64 u128 - isize i8 i16 i32 i64 i128 - f32 f64 - bool char - } - - #[unstable(feature = "never_type", issue = "35121")] - impl Copy for ! {} - - #[stable(feature = "rust1", since = "1.0.0")] - impl Copy for *const T {} - - #[stable(feature = "rust1", since = "1.0.0")] - impl Copy for *mut T {} - - /// Shared references can be copied, but mutable references *cannot*! - #[stable(feature = "rust1", since = "1.0.0")] - impl Copy for &T {} +/// A marker for types which can be used as types of `const` generic parameters. +#[cfg_attr(not(bootstrap), lang = "const_param_ty")] +#[unstable(feature = "adt_const_params", issue = "95174")] +#[rustc_on_unimplemented(message = "`{Self}` can't be used as a const parameter type")] +pub trait ConstParamTy: StructuralEq {} + +// FIXME(generic_const_parameter_types): handle `ty::FnDef`/`ty::Closure` +// FIXME(generic_const_parameter_types): handle `ty::Tuple` +marker_impls! { + #[unstable(feature = "adt_const_params", issue = "95174")] + ConstParamTy for + usize, u8, u16, u32, u64, u128, + isize, i8, i16, i32, i64, i128, + bool, + char, + str /* Technically requires `[u8]: ConstParamTy` */, + {T: ConstParamTy, const N: usize} [T; N], + {T: ConstParamTy} [T], + {T: ?Sized + ConstParamTy} &T, } /// A common trait implemented by all function pointers. diff --git a/library/core/tests/clone.rs b/library/core/tests/clone.rs index 33ca9f2c6a3a1..aafe5ced2e97f 100644 --- a/library/core/tests/clone.rs +++ b/library/core/tests/clone.rs @@ -1,4 +1,5 @@ #[test] +#[cfg_attr(not(bootstrap), allow(suspicious_double_ref_op))] fn test_borrowed_clone() { let x = 5; let y: &i32 = &x; diff --git a/library/std/src/sys/common/thread_local/mod.rs b/library/std/src/sys/common/thread_local/mod.rs index a7528c06c9de2..951d509ec9533 100644 --- a/library/std/src/sys/common/thread_local/mod.rs +++ b/library/std/src/sys/common/thread_local/mod.rs @@ -6,7 +6,7 @@ cfg_if::cfg_if! { mod static_local; #[doc(hidden)] pub use static_local::{Key, thread_local_inner}; - } else if #[cfg(all(target_thread_local))] { + } else if #[cfg(target_thread_local)] { #[doc(hidden)] mod fast_local; #[doc(hidden)] diff --git a/library/test/src/formatters/json.rs b/library/test/src/formatters/json.rs index 8572d1c20ce7e..47c4e7757e40c 100644 --- a/library/test/src/formatters/json.rs +++ b/library/test/src/formatters/json.rs @@ -18,14 +18,10 @@ impl JsonFormatter { } fn writeln_message(&mut self, s: &str) -> io::Result<()> { - assert!(!s.contains('\n')); - - self.out.write_all(s.as_ref())?; - self.out.write_all(b"\n") - } - - fn write_message(&mut self, s: &str) -> io::Result<()> { - assert!(!s.contains('\n')); + // self.out will take a lock, but that lock is released when write_all returns. This + // results in a race condition and json output may not end with a new line. We avoid this + // by issuing `write_all` calls line-by-line. + assert_eq!(s.chars().last(), Some('\n')); self.out.write_all(s.as_ref()) } @@ -34,34 +30,35 @@ impl JsonFormatter { &mut self, ty: &str, name: &str, - evt: &str, + event: &str, exec_time: Option<&time::TestExecTime>, stdout: Option>, extra: Option<&str>, ) -> io::Result<()> { // A doc test's name includes a filename which must be escaped for correct json. - self.write_message(&format!( - r#"{{ "type": "{}", "name": "{}", "event": "{}""#, - ty, - EscapedString(name), - evt - ))?; - if let Some(exec_time) = exec_time { - self.write_message(&format!(r#", "exec_time": {}"#, exec_time.0.as_secs_f64()))?; - } - if let Some(stdout) = stdout { - self.write_message(&format!(r#", "stdout": "{}""#, EscapedString(stdout)))?; - } - if let Some(extra) = extra { - self.write_message(&format!(r#", {extra}"#))?; - } - self.writeln_message(" }") + let name = EscapedString(name); + let exec_time_json = if let Some(exec_time) = exec_time { + format!(r#", "exec_time": {}"#, exec_time.0.as_secs_f64()) + } else { + String::from("") + }; + let stdout_json = if let Some(stdout) = stdout { + format!(r#", "stdout": "{}""#, EscapedString(stdout)) + } else { + String::from("") + }; + let extra_json = + if let Some(extra) = extra { format!(r#", {extra}"#) } else { String::from("") }; + let newline = "\n"; + + self.writeln_message(&format!( + r#"{{ "type": "{ty}", "name": "{name}", "event": "{event}"{exec_time_json}{stdout_json}{extra_json} }}{newline}"#)) } } impl OutputFormatter for JsonFormatter { fn write_discovery_start(&mut self) -> io::Result<()> { - self.writeln_message(&format!(r#"{{ "type": "suite", "event": "discovery" }}"#)) + self.writeln_message(concat!(r#"{ "type": "suite", "event": "discovery" }"#, "\n")) } fn write_test_discovered(&mut self, desc: &TestDesc, test_type: &str) -> io::Result<()> { @@ -77,11 +74,13 @@ impl OutputFormatter for JsonFormatter { .. } = desc; + let name = EscapedString(name.as_slice()); + let ignore_message = ignore_message.unwrap_or(""); + let source_path = EscapedString(source_file); + let newline = "\n"; + self.writeln_message(&format!( - r#"{{ "type": "{test_type}", "event": "discovered", "name": "{}", "ignore": {ignore}, "ignore_message": "{}", "source_path": "{}", "start_line": {start_line}, "start_col": {start_col}, "end_line": {end_line}, "end_col": {end_col} }}"#, - EscapedString(name.as_slice()), - ignore_message.unwrap_or(""), - EscapedString(source_file), + r#"{{ "type": "{test_type}", "event": "discovered", "name": "{name}", "ignore": {ignore}, "ignore_message": "{ignore_message}", "source_path": "{source_path}", "start_line": {start_line}, "start_col": {start_col}, "end_line": {end_line}, "end_col": {end_col} }}{newline}"# )) } @@ -89,9 +88,10 @@ impl OutputFormatter for JsonFormatter { let ConsoleTestDiscoveryState { tests, benchmarks, ignored, .. } = state; let total = tests + benchmarks; + let newline = "\n"; self.writeln_message(&format!( - r#"{{ "type": "suite", "event": "completed", "tests": {tests}, "benchmarks": {benchmarks}, "total": {total}, "ignored": {ignored} }}"# - )) + r#"{{ "type": "suite", "event": "completed", "tests": {tests}, "benchmarks": {benchmarks}, "total": {total}, "ignored": {ignored} }}{newline}"# + )) } fn write_run_start(&mut self, test_count: usize, shuffle_seed: Option) -> io::Result<()> { @@ -100,15 +100,17 @@ impl OutputFormatter for JsonFormatter { } else { String::new() }; + let newline = "\n"; self.writeln_message(&format!( - r#"{{ "type": "suite", "event": "started", "test_count": {test_count}{shuffle_seed_json} }}"# - )) + r#"{{ "type": "suite", "event": "started", "test_count": {test_count}{shuffle_seed_json} }}{newline}"# + )) } fn write_test_start(&mut self, desc: &TestDesc) -> io::Result<()> { + let name = EscapedString(desc.name.as_slice()); + let newline = "\n"; self.writeln_message(&format!( - r#"{{ "type": "test", "event": "started", "name": "{}" }}"#, - EscapedString(desc.name.as_slice()) + r#"{{ "type": "test", "event": "started", "name": "{name}" }}{newline}"# )) } @@ -173,53 +175,43 @@ impl OutputFormatter for JsonFormatter { } else { format!(r#", "mib_per_second": {}"#, bs.mb_s) }; + let name = EscapedString(desc.name.as_slice()); - let line = format!( + self.writeln_message(&format!( "{{ \"type\": \"bench\", \ - \"name\": \"{}\", \ - \"median\": {}, \ - \"deviation\": {}{} }}", - EscapedString(desc.name.as_slice()), - median, - deviation, - mbps - ); - - self.writeln_message(&line) + \"name\": \"{name}\", \ + \"median\": {median}, \ + \"deviation\": {deviation}{mbps} }}\n", + )) } } } fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()> { + let name = EscapedString(desc.name.as_slice()); + let newline = "\n"; self.writeln_message(&format!( - r#"{{ "type": "test", "event": "timeout", "name": "{}" }}"#, - EscapedString(desc.name.as_slice()) + r#"{{ "type": "test", "event": "timeout", "name": "{name}" }}{newline}"#, )) } fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result { - self.write_message(&format!( - "{{ \"type\": \"suite\", \ - \"event\": \"{}\", \ - \"passed\": {}, \ - \"failed\": {}, \ - \"ignored\": {}, \ - \"measured\": {}, \ - \"filtered_out\": {}", - if state.failed == 0 { "ok" } else { "failed" }, - state.passed, - state.failed, - state.ignored, - state.measured, - state.filtered_out, - ))?; - - if let Some(ref exec_time) = state.exec_time { - let time_str = format!(", \"exec_time\": {}", exec_time.0.as_secs_f64()); - self.write_message(&time_str)?; - } + let event = if state.failed == 0 { "ok" } else { "failed" }; + let passed = state.passed; + let failed = state.failed; + let ignored = state.ignored; + let measured = state.measured; + let filtered_out = state.filtered_out; + let exec_time_json = if let Some(ref exec_time) = state.exec_time { + format!(r#", "exec_time": {}"#, exec_time.0.as_secs_f64()) + } else { + String::from("") + }; + let newline = "\n"; - self.writeln_message(" }")?; + self.writeln_message(&format!( + r#"{{ "type": "suite", "event": "{event}", "passed": {passed}, "failed": {failed}, "ignored": {ignored}, "measured": {measured}, "filtered_out": {filtered_out}{exec_time_json} }}{newline}"# + ))?; Ok(state.failed == 0) } diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md index 9f7259f883a59..5898a21d61350 100644 --- a/src/ci/docker/README.md +++ b/src/ci/docker/README.md @@ -83,12 +83,12 @@ To run the image, A number of these images take quite a long time to compile as they're building whole gcc toolchains to do cross builds with. Much of this is relatively self-explanatory but some images use [crosstool-ng] which isn't quite as self -explanatory. Below is a description of where these `*.config` files come form, +explanatory. Below is a description of where these `*.defconfig` files come form, how to generate them, and how the existing ones were generated. [crosstool-ng]: https://github.com/crosstool-ng/crosstool-ng -### Generating a `.config` file +### Generating a `.defconfig` file **NOTE:** Existing Dockerfiles can also be a good guide for the process and order of script execution. @@ -100,14 +100,14 @@ next two steps. these steps are outside the container: ``` -# Note: We use ubuntu:16.04 because that's the "base" of linux-cross Docker +# Note: We use ubuntu:22.04 because that's the "base" of linux-cross Docker # image, or simply run ./src/ci/docker/run.sh once, which will download the correct # one and you can check it out with `docker images` -$ docker run -it ubuntu:16.04 bash +$ docker run -it ubuntu:22.04 bash # in another terminal: $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -cfbec05ed730 ubuntu:16.04 "bash" 16 seconds ago Up 15 seconds drunk_murdock +cfbec05ed730 ubuntu:22.04 "bash" 16 seconds ago Up 15 seconds drunk_murdock $ docker cp src/ci/docker/scripts drunk_murdock:/tmp/ ``` @@ -127,7 +127,7 @@ $ bash ./crosstool-ng.sh present. Otherwise one can use the TUI to load any config-file. ``` -$ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config +$ docker cp arm-linux-gnueabi.defconfig drunk_murdock:/tmp/.config ``` - Now, inside the container run the following command to configure the @@ -136,49 +136,54 @@ $ docker cp arm-linux-gnueabi.config drunk_murdock:/tmp/.config ``` $ cd /tmp/ +$ ct-ng olddefconfig $ ct-ng menuconfig +$ ct-ng savedefconfig ``` -- Finally, we retrieve the `.config` file from the container and give it a +- Finally, we retrieve the `defconfig` file from the container and give it a meaningful name. This is done outside the container. ``` -$ docker cp drunk_murdock:/tmp/.config arm-linux-gnueabi.config +$ docker cp drunk_murdock:/tmp/defconfig arm-linux-gnueabi.defconfig ``` - Now you can shutdown the container or repeat the two last steps to generate a - new `.config` file. + new `.defconfig` file. ### Toolchain configuration Changes on top of the default toolchain configuration used to generate the -`.config` files in this directory. The changes are formatted as follows: +`.defconfig` files in this directory. The changes are formatted as follows: ``` $category > $option = $value -- $comment ``` -### `arm-linux-gnueabi.config` +### `arm-linux-gnueabi.defconfig` For targets: `arm-unknown-linux-gnueabi` - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET} -- Path and misc options > Patches origin = Bundled only +- Path and misc options > Use a mirror = ENABLE +- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc - Target options > Target Architecture = arm - Target options > Architecture level = armv6 -- (+) - Target options > Floating point = software (no FPU) -- (\*) - Operating System > Target OS = linux - Operating System > Linux kernel version = 3.2.101 +- Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.17.0 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM -### `arm-linux-gnueabihf.config` +### `arm-linux-gnueabihf.defconfig` For targets: `arm-unknown-linux-gnueabihf` - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET} -- Path and misc options > Patches origin = Bundled only +- Path and misc options > Use a mirror = ENABLE +- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc - Target options > Target Architecture = arm - Target options > Architecture level = armv6 -- (+) - Target options > Use specific FPU = vfp -- (+) @@ -186,16 +191,18 @@ For targets: `arm-unknown-linux-gnueabihf` - Target options > Default instruction set mode = arm -- (+) - Operating System > Target OS = linux - Operating System > Linux kernel version = 3.2.101 +- Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.17.0 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM -### `armv7-linux-gnueabihf.config` +### `armv7-linux-gnueabihf.defconfig` For targets: `armv7-unknown-linux-gnueabihf` - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET} -- Path and misc options > Patches origin = Bundled only +- Path and misc options > Use a mirror = ENABLE +- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc - Target options > Target Architecture = arm - Target options > Suffix to the arch-part = v7 - Target options > Architecture level = armv7-a -- (+) @@ -204,8 +211,9 @@ For targets: `armv7-unknown-linux-gnueabihf` - Target options > Default instruction set mode = thumb -- (\*) - Operating System > Target OS = linux - Operating System > Linux kernel version = 3.2.101 +- Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.17.0 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM (\*) These options have been selected to match the configuration of the arm @@ -214,7 +222,7 @@ For targets: `armv7-unknown-linux-gnueabihf` libraries like jemalloc. See the mk/cfg/arm(v7)-unknown-linux-gnueabi{,hf}.mk file in Rust's source code. -### `aarch64-linux-gnu.config` +### `aarch64-linux-gnu.defconfig` For targets: `aarch64-unknown-linux-gnu` @@ -225,17 +233,16 @@ For targets: `aarch64-unknown-linux-gnu` - Target options > Bitness = 64-bit - Operating System > Target OS = linux - Operating System > Linux kernel version = 4.1.49 -- Binary utilities > Version of binutils = 2.32 +- Binary utilities > Version of binutils = 2.29.1 - C-library > glibc version = 2.17 -- aarch64 support was introduced in this version -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM -### `i586-linux-gnu.config` +### `i586-linux-gnu.defconfig` For targets: `i586-unknown-linux-gnu` - Path and misc options > Prefix directory = /x-tools/${CT\_TARGET} -- Path and misc options > Patches origin = Bundled only - Target options > Target Architecture = x86 - Target options > Architecture level = i586 - Target options > Target CFLAGS = -Wa,-mrelax-relocations=no @@ -244,13 +251,13 @@ For targets: `i586-unknown-linux-gnu` - Binary utilities > Version of binutils = 2.32 - Binary utilities > binutils extra config = --enable-compressed-debug-sections=none -- (\*) - C-library > glibc version = 2.17.0 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE (\*) Compressed debug is enabled by default for gas (assembly) on Linux/x86 targets, but that makes our `compiler_builtins` incompatible with binutils < 2.32. -### `mips-linux-gnu.config` +### `mips-linux-gnu.defconfig` For targets: `mips-unknown-linux-gnu` @@ -265,14 +272,14 @@ For targets: `mips-unknown-linux-gnu` - Target options > Bitness = 32-bit - Target options > Architecture level = mips32r2 - Operating System > Target OS = linux -- Operating System > Linux kernel version = 4.4.174 +- Operating System > Linux kernel version = 4.4.302 - Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.23 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > gcc extra config = --with-fp-32=xx --with-odd-spreg-32=no - C compiler > C++ = ENABLE -- to cross compile LLVM -### `mipsel-linux-gnu.config` +### `mipsel-linux-gnu.defconfig` For targets: `mipsel-unknown-linux-gnu` @@ -287,14 +294,14 @@ For targets: `mipsel-unknown-linux-gnu` - Target options > Bitness = 32-bit - Target options > Architecture level = mips32r2 - Operating System > Target OS = linux -- Operating System > Linux kernel version = 4.4.174 +- Operating System > Linux kernel version = 4.4.302 - Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.23 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > gcc extra config = --with-fp-32=xx --with-odd-spreg-32=no - C compiler > C++ = ENABLE -- to cross compile LLVM -### `mips64-linux-gnu.config` +### `mips64-linux-gnu.defconfig` For targets: `mips64-unknown-linux-gnuabi64` @@ -309,13 +316,13 @@ For targets: `mips64-unknown-linux-gnuabi64` - Target options > Bitness = 64-bit - Target options > Architecture level = mips64r2 - Operating System > Target OS = linux -- Operating System > Linux kernel version = 4.4.174 +- Operating System > Linux kernel version = 4.4.302 - Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.23 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM -### `mips64el-linux-gnu.config` +### `mips64el-linux-gnu.defconfig` For targets: `mips64el-unknown-linux-gnuabi64` @@ -330,13 +337,13 @@ For targets: `mips64el-unknown-linux-gnuabi64` - Target options > Bitness = 64-bit - Target options > Architecture level = mips64r2 - Operating System > Target OS = linux -- Operating System > Linux kernel version = 4.4.174 +- Operating System > Linux kernel version = 4.4.302 - Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.23 -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM -### `powerpc-linux-gnu.config` +### `powerpc-linux-gnu.defconfig` For targets: `powerpc-unknown-linux-gnu` @@ -349,10 +356,10 @@ For targets: `powerpc-unknown-linux-gnu` - Operating System > Linux kernel version = 3.2.101 - Binary utilities > Version of binutils = 2.30 - C-library > glibc version = 2.17 -- ~RHEL7 glibc -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM -### `powerpc64-linux-gnu.config` +### `powerpc64-linux-gnu.defconfig` For targets: `powerpc64-unknown-linux-gnu` @@ -367,12 +374,28 @@ For targets: `powerpc64-unknown-linux-gnu` - Operating System > Linux kernel version = 3.2.101 - Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.17 -- ~RHEL7 glibc -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > C++ = ENABLE -- to cross compile LLVM (+) These CPU options match the configuration of the toolchains in RHEL6. -### `s390x-linux-gnu.config` +### `riscv64-unknown-linux-gnu.defconfig` + +For targets: `riscv64-unknown-linux-gnu` + +- Path and misc options > Prefix directory = /x-tools/${CT\_TARGET} +- Path and misc options > Use a mirror = ENABLE +- Path and misc options > Base URL = https://ci-mirrors.rust-lang.org/rustc +- Target options > Target Architecture = riscv +- Target options > Bitness = 64-bit +- Operating System > Target OS = linux +- Operating System > Linux kernel version = 4.20.17 +- Binary utilities > Version of binutils = 2.32 +- C-library > glibc version = 2.29 +- C compiler > gcc version = 8.5.0 +- C compiler > C++ = ENABLE -- to cross compile LLVM + +### `s390x-linux-gnu.defconfig` For targets: `s390x-unknown-linux-gnu` @@ -385,6 +408,6 @@ For targets: `s390x-unknown-linux-gnu` - Operating System > Linux kernel version = 3.2.101 - Binary utilities > Version of binutils = 2.32 - C-library > glibc version = 2.17 -- ~RHEL7 glibc -- C compiler > gcc version = 8.3.0 +- C compiler > gcc version = 8.5.0 - C compiler > gcc extra config = --with-arch=z10 -- LLVM's minimum support - C compiler > C++ = ENABLE -- to cross compile LLVM diff --git a/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile index 23fa23f0f2d06..18972387e34d7 100644 --- a/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-aarch64-linux/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.config host-x86_64/dist-aarch64-linux/build-toolchains.sh /tmp/ -RUN ./build-toolchains.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.config b/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.config deleted file mode 100644 index 4561e2a1ec392..0000000000000 --- a/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.config +++ /dev/null @@ -1,754 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -CT_ARCH_ARM=y -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="arm" -CT_ARCH_CHOICE_KSYM="ARM" -# CT_ARCH_ALPHA_EV4 is not set -# CT_ARCH_ALPHA_EV45 is not set -# CT_ARCH_ALPHA_EV5 is not set -# CT_ARCH_ALPHA_EV56 is not set -# CT_ARCH_ALPHA_EV6 is not set -# CT_ARCH_ALPHA_EV67 is not set -CT_ARCH_CPU="" -CT_ARCH_TUNE="" -CT_ARCH_ARM_SHOW=y - -# -# Options for arm -# -CT_ARCH_ARM_PKG_KSYM="" -# CT_ARCH_ARM_MODE_ARM is not set -# CT_ARCH_ARM_MODE_THUMB is not set -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_SUPPORTS_BOTH_MMU=y -CT_ARCH_DEFAULT_HAS_MMU=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_FLAT_FORMAT=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_LE=y -# CT_ARCH_BE is not set -CT_ARCH_LE=y -CT_ARCH_ENDIAN="little" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=64 -# CT_ARCH_32 is not set -CT_ARCH_64=y - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_CPU=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_EXCLUSIVE_WITH_CPU=y -CT_ARCH_ARCH="" -# CT_ARCH_FLOAT_AUTO is not set -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SOFTFP is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -CT_LINUX_V_4_1=y -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="4.1.49" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_later_than_3_7=y -CT_LINUX_3_7_or_later=y -CT_LINUX_REQUIRE_3_7_or_later=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -# CT_BINUTILS_V_2_32 is not set -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -CT_BINUTILS_V_2_29=y -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.29.1" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_2_30_or_older=y -CT_BINUTILS_older_than_2_30=y -CT_BINUTILS_REQUIRE_older_than_2_30=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_GOLD_SUPPORTS_ARCH=y -CT_BINUTILS_GOLD_SUPPORT=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -# CT_BINUTILS_LINKER_LD_GOLD is not set -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_NEWLIB is not set -# CT_LIBC_NONE is not set -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_PORTS_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="4.1.49" -# CT_GLIBC_SSP_DEFAULT is not set -# CT_GLIBC_SSP_NO is not set -# CT_GLIBC_SSP_YES is not set -# CT_GLIBC_SSP_ALL is not set -# CT_GLIBC_SSP_STRONG is not set -# CT_NEWLIB_USE_REDHAT is not set -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig new file mode 100644 index 0000000000000..47e984ef85a21 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-aarch64-linux/aarch64-linux-gnu.defconfig @@ -0,0 +1,12 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_ARM=y +CT_ARCH_64=y +CT_KERNEL_LINUX=y +CT_LINUX_V_4_1=y +CT_BINUTILS_V_2_29=y +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-aarch64-linux/build-toolchains.sh b/src/ci/docker/host-x86_64/dist-aarch64-linux/build-toolchains.sh deleted file mode 100755 index f15a7081612d8..0000000000000 --- a/src/ci/docker/host-x86_64/dist-aarch64-linux/build-toolchains.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../aarch64-linux-gnu.config .config -ct-ng oldconfig -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile index 0c3b9ebdc3316..9a1b3e3641add 100644 --- a/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-arm-linux/Dockerfile @@ -1,10 +1,10 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh WORKDIR /build @@ -17,13 +17,11 @@ RUN CFLAGS="-Wa,--compress-debug-sections=none -Wl,--compress-debug-sections=non COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-arm-linux/arm-linux-gnueabi.config host-x86_64/dist-arm-linux/build-toolchains.sh /tmp/ -RUN ./build-toolchains.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-arm-linux/arm-linux-gnueabi.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.config b/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.config deleted file mode 100644 index e047db92652c2..0000000000000 --- a/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.config +++ /dev/null @@ -1,748 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -# CT_USE_MIRROR is not set -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -CT_ARCH_ARM=y -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="arm" -CT_ARCH_CHOICE_KSYM="ARM" -CT_ARCH_CPU="" -CT_ARCH_TUNE="" -CT_ARCH_ARM_SHOW=y - -# -# Options for arm -# -CT_ARCH_ARM_PKG_KSYM="" -CT_ARCH_ARM_MODE="arm" -CT_ARCH_ARM_MODE_ARM=y -# CT_ARCH_ARM_MODE_THUMB is not set -# CT_ARCH_ARM_INTERWORKING is not set -CT_ARCH_ARM_EABI_FORCE=y -CT_ARCH_ARM_EABI=y -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_SUPPORTS_BOTH_MMU=y -CT_ARCH_DEFAULT_HAS_MMU=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_FLAT_FORMAT=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_LE=y -# CT_ARCH_BE is not set -CT_ARCH_LE=y -CT_ARCH_ENDIAN="little" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=32 -CT_ARCH_32=y -# CT_ARCH_64 is not set - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_CPU=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_SUPPORTS_WITH_FPU=y -CT_ARCH_SUPPORTS_SOFTFP=y -CT_ARCH_EXCLUSIVE_WITH_CPU=y -CT_ARCH_ARCH="armv6" -CT_ARCH_FPU="" -# CT_ARCH_FLOAT_AUTO is not set -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SOFTFP is not set -CT_ARCH_FLOAT_SW=y -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="soft" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -CT_LINUX_V_3_2=y -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="3.2.101" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_3_7_or_older=y -CT_LINUX_older_than_3_7=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_GOLD_SUPPORTS_ARCH=y -CT_BINUTILS_GOLD_SUPPORT=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -# CT_BINUTILS_LINKER_LD_GOLD is not set -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_PORTS_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="3.2.101" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="https://ci-mirrors.rust-lang.org/rustc" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="https://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.defconfig b/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.defconfig new file mode 100644 index 0000000000000..e7afdbe9d4dea --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-arm-linux/arm-linux-gnueabi.defconfig @@ -0,0 +1,13 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_ARM=y +CT_ARCH_ARCH="armv6" +CT_ARCH_FLOAT_SW=y +CT_KERNEL_LINUX=y +CT_LINUX_V_3_2=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-arm-linux/build-toolchains.sh b/src/ci/docker/host-x86_64/dist-arm-linux/build-toolchains.sh deleted file mode 100755 index ad53ba4dd1bc0..0000000000000 --- a/src/ci/docker/host-x86_64/dist-arm-linux/build-toolchains.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../arm-linux-gnueabi.config .config -# FIXME ct-ng oldconfig is not working as intended. -# ct-ng oldconfig -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile index 753d6450502f3..855465aa38e24 100644 --- a/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-armhf-linux/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.config host-x86_64/dist-armhf-linux/build-toolchains.sh /tmp/ -RUN ./build-toolchains.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.config b/src/ci/docker/host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.config deleted file mode 100644 index e0f6417793de8..0000000000000 --- a/src/ci/docker/host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.config +++ /dev/null @@ -1,749 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -# CT_USE_MIRROR is not set -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -CT_ARCH_ARM=y -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="arm" -CT_ARCH_CHOICE_KSYM="ARM" -CT_ARCH_CPU="" -CT_ARCH_TUNE="" -CT_ARCH_ARM_SHOW=y - -# -# Options for arm -# -CT_ARCH_ARM_PKG_KSYM="" -CT_ARCH_ARM_MODE="arm" -CT_ARCH_ARM_MODE_ARM=y -# CT_ARCH_ARM_MODE_THUMB is not set -# CT_ARCH_ARM_INTERWORKING is not set -CT_ARCH_ARM_EABI_FORCE=y -CT_ARCH_ARM_EABI=y -CT_ARCH_ARM_TUPLE_USE_EABIHF=y -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_SUPPORTS_BOTH_MMU=y -CT_ARCH_DEFAULT_HAS_MMU=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_FLAT_FORMAT=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_LE=y -# CT_ARCH_BE is not set -CT_ARCH_LE=y -CT_ARCH_ENDIAN="little" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=32 -CT_ARCH_32=y -# CT_ARCH_64 is not set - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_CPU=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_SUPPORTS_WITH_FPU=y -CT_ARCH_SUPPORTS_SOFTFP=y -CT_ARCH_EXCLUSIVE_WITH_CPU=y -CT_ARCH_ARCH="armv6" -CT_ARCH_FPU="vfp" -# CT_ARCH_FLOAT_AUTO is not set -CT_ARCH_FLOAT_HW=y -# CT_ARCH_FLOAT_SOFTFP is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="hard" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -CT_LINUX_V_3_2=y -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="3.2.101" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_3_7_or_older=y -CT_LINUX_older_than_3_7=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_GOLD_SUPPORTS_ARCH=y -CT_BINUTILS_GOLD_SUPPORT=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -# CT_BINUTILS_LINKER_LD_GOLD is not set -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_PORTS_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="3.2.101" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="https://ci-mirrors.rust-lang.org/rustc" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="https://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.defconfig b/src/ci/docker/host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.defconfig new file mode 100644 index 0000000000000..c7c5b4d5a2865 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-armhf-linux/arm-linux-gnueabihf.defconfig @@ -0,0 +1,14 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_ARM=y +CT_ARCH_ARCH="armv6" +CT_ARCH_FPU="vfp" +CT_ARCH_FLOAT_HW=y +CT_KERNEL_LINUX=y +CT_LINUX_V_3_2=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile index 7eb5097aae88a..dab0667ed55c4 100644 --- a/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-armv7-linux/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-armv7-linux/build-toolchains.sh host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.config /tmp/ -RUN ./build-toolchains.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.config b/src/ci/docker/host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.config deleted file mode 100644 index 2d8167f1f3328..0000000000000 --- a/src/ci/docker/host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.config +++ /dev/null @@ -1,746 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="" -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -# CT_USE_MIRROR is not set -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -CT_LOG_INFO=y -# CT_LOG_EXTRA is not set -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="INFO" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -CT_ARCH_ARM=y -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="arm" -CT_ARCH_CHOICE_KSYM="ARM" -CT_ARCH_CPU="" -CT_ARCH_TUNE="" -CT_ARCH_ARM_SHOW=y - -# -# Options for arm -# -CT_ARCH_ARM_PKG_KSYM="" -CT_ARCH_ARM_MODE="thumb" -# CT_ARCH_ARM_MODE_ARM is not set -CT_ARCH_ARM_MODE_THUMB=y -# CT_ARCH_ARM_INTERWORKING is not set -CT_ARCH_ARM_EABI_FORCE=y -CT_ARCH_ARM_EABI=y -CT_ARCH_ARM_TUPLE_USE_EABIHF=y -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="v7" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_SUPPORTS_BOTH_MMU=y -CT_ARCH_DEFAULT_HAS_MMU=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_FLAT_FORMAT=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_LE=y -# CT_ARCH_BE is not set -CT_ARCH_LE=y -CT_ARCH_ENDIAN="little" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=32 -CT_ARCH_32=y -# CT_ARCH_64 is not set - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_CPU=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_SUPPORTS_WITH_FPU=y -CT_ARCH_SUPPORTS_SOFTFP=y -CT_ARCH_EXCLUSIVE_WITH_CPU=y -CT_ARCH_ARCH="armv7-a" -CT_ARCH_FPU="vfpv3-d16" -# CT_ARCH_FLOAT_AUTO is not set -CT_ARCH_FLOAT_HW=y -# CT_ARCH_FLOAT_SOFTFP is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="hard" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -CT_LINUX_V_3_2=y -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="3.2.101" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_3_7_or_older=y -CT_LINUX_older_than_3_7=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_GOLD_SUPPORTS_ARCH=y -CT_BINUTILS_GOLD_SUPPORT=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -# CT_BINUTILS_LINKER_LD_GOLD is not set -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_PORTS_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="3.2.101" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="https://ci-mirrors.rust-lang.org/rustc" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -# CT_MPC_V_1_1 is not set -CT_MPC_V_1_0=y -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.0.3" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_older=y -CT_MPC_older_than_1_1_0=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_3_1=y -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="3.1.6" -CT_MPFR_MIRRORS="https://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_4_0_0_or_older=y -CT_MPFR_older_than_4_0_0=y -CT_MPFR_REQUIRE_older_than_4_0_0=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="https://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.defconfig b/src/ci/docker/host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.defconfig new file mode 100644 index 0000000000000..3f37e546b4255 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-armv7-linux/armv7-linux-gnueabihf.defconfig @@ -0,0 +1,16 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_ARM=y +CT_ARCH_ARM_MODE_THUMB=y +CT_ARCH_SUFFIX="v7" +CT_ARCH_ARCH="armv7-a" +CT_ARCH_FPU="vfpv3-d16" +CT_ARCH_FLOAT_HW=y +CT_KERNEL_LINUX=y +CT_LINUX_V_3_2=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-armv7-linux/build-toolchains.sh b/src/ci/docker/host-x86_64/dist-armv7-linux/build-toolchains.sh deleted file mode 100755 index 602ad8ac87737..0000000000000 --- a/src/ci/docker/host-x86_64/dist-armv7-linux/build-toolchains.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../armv7-linux-gnueabihf.config .config -# FIXME ct-ng oldconfig is not working as intended. -# ct-ng oldconfig -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile index 34829adf79bcf..a62f98b21d225 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile @@ -21,17 +21,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh WORKDIR /tmp -COPY host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.config \ - host-x86_64/dist-i586-gnu-i586-i686-musl/build-i586-gnu-toolchain.sh \ - /tmp/ -RUN su rustbuild -c ./build-i586-gnu-toolchain.sh +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh + ENV PATH=$PATH:/x-tools/i586-unknown-linux-gnu/bin ENV \ CC_i586_unknown_linux_gnu=i586-unknown-linux-gnu-gcc \ diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/build-i586-gnu-toolchain.sh b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/build-i586-gnu-toolchain.sh deleted file mode 100755 index ceab60cfb45e9..0000000000000 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/build-i586-gnu-toolchain.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../i586-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.config b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.config deleted file mode 100644 index cdbd52d23bc37..0000000000000 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.config +++ /dev/null @@ -1,726 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -CT_ARCH_X86=y -# CT_ARCH_XTENSA is not set -CT_ARCH="x86" -CT_ARCH_CHOICE_KSYM="X86" -CT_ARCH_CPU="" -CT_ARCH_TUNE="" -CT_ARCH_X86_SHOW=y - -# -# Options for x86 -# -CT_ARCH_X86_PKG_KSYM="" -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=32 -CT_ARCH_32=y -# CT_ARCH_64 is not set - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_CPU=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_ARCH="i586" -CT_TARGET_CFLAGS="-Wa,-mrelax-relocations=no" -CT_TARGET_LDFLAGS="" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -CT_LINUX_V_3_2=y -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="3.2.101" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_3_7_or_older=y -CT_LINUX_older_than_3_7=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_GOLD_SUPPORTS_ARCH=y -CT_BINUTILS_GOLD_SUPPORT=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -# CT_BINUTILS_LINKER_LD_GOLD is not set -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="--enable-compressed-debug-sections=none" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="3.2.101" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set -CT_CC_GCC_LIBMPX=y - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="https://ci-mirrors.rust-lang.org/rustc" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig new file mode 100644 index 0000000000000..01fe493a9fecd --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/i586-linux-gnu.defconfig @@ -0,0 +1,14 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_X86=y +CT_ARCH_ARCH="i586" +CT_TARGET_CFLAGS="-Wa,-mrelax-relocations=no" +CT_KERNEL_LINUX=y +CT_LINUX_V_3_2=y +CT_BINUTILS_V_2_32=y +CT_BINUTILS_EXTRA_CONFIG_ARRAY="--enable-compressed-debug-sections=none" +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile index eb511b3210792..c08febf423adb 100644 --- a/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile @@ -3,16 +3,17 @@ FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh WORKDIR /tmp +COPY scripts/crosstool-ng-build.sh /scripts/ COPY host-x86_64/dist-mips-linux/patches/ /tmp/patches/ -COPY host-x86_64/dist-mips-linux/mips-linux-gnu.config host-x86_64/dist-mips-linux/build-mips-toolchain.sh /tmp/ -RUN su rustbuild -c ./build-mips-toolchain.sh +COPY host-x86_64/dist-mips-linux/mips-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-mips-linux/build-mips-toolchain.sh b/src/ci/docker/host-x86_64/dist-mips-linux/build-mips-toolchain.sh deleted file mode 100755 index 32612cf685283..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mips-linux/build-mips-toolchain.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../mips-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-mips-linux/mips-linux-gnu.config b/src/ci/docker/host-x86_64/dist-mips-linux/mips-linux-gnu.config deleted file mode 100644 index 5bfbbae206b41..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mips-linux/mips-linux-gnu.config +++ /dev/null @@ -1,740 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -# CT_PATCH_BUNDLED is not set -CT_PATCH_BUNDLED_LOCAL=y -CT_PATCH_ORDER="bundled,local" -CT_PATCH_USE_LOCAL=y -CT_LOCAL_PATCH_DIR="/tmp/patches" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -CT_ARCH_MIPS=y -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="mips" -CT_ARCH_CHOICE_KSYM="MIPS" -CT_ARCH_TUNE="" -CT_ARCH_MIPS_SHOW=y - -# -# Options for mips -# -CT_ARCH_MIPS_PKG_KSYM="" -CT_ARCH_mips_o32=y -CT_ARCH_mips_ABI="32" -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_BE=y -CT_ARCH_BE=y -# CT_ARCH_LE is not set -CT_ARCH_ENDIAN="big" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=32 -CT_ARCH_32=y -# CT_ARCH_64 is not set - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_ARCH="mips32r2" -CT_ARCH_FLOAT_AUTO=y -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="auto" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -CT_LINUX_V_4_4=y -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -# CT_LINUX_V_3_2 is not set -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="4.4.174" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_later_than_3_7=y -CT_LINUX_3_7_or_later=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -CT_GLIBC_V_2_23=y -# CT_GLIBC_V_2_19 is not set -# CT_GLIBC_V_2_17 is not set -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.23" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_later=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_later_than_2_20=y -CT_GLIBC_2_20_or_later=y -CT_GLIBC_later_than_2_17=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_NO_SPARC_V8=y -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="4.4.174" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-fp-32=xx --with-odd-spreg-32=no" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_CC_GCC_HAS_ARCH_OPTIONS=y - -# -# architecture-specific options -# -CT_CC_GCC_mips_llsc=m -CT_CC_GCC_mips_synci=m -# CT_CC_GCC_mips_plt is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-mips-linux/mips-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-mips-linux/mips-linux-gnu.defconfig new file mode 100644 index 0000000000000..75743fe81416b --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-mips-linux/mips-linux-gnu.defconfig @@ -0,0 +1,16 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_PATCH_BUNDLED_LOCAL=y +CT_LOCAL_PATCH_DIR="/tmp/patches" +CT_ARCH_MIPS=y +CT_ARCH_mips_o32=y +CT_ARCH_ARCH="mips32r2" +CT_KERNEL_LINUX=y +CT_LINUX_V_4_4=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_23=y +CT_GCC_V_8=y +CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-fp-32=xx --with-odd-spreg-32=no" +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile index de862e1df2d6a..10f31075e2d55 100644 --- a/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile @@ -3,16 +3,17 @@ FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh WORKDIR /tmp +COPY scripts/crosstool-ng-build.sh /scripts/ COPY host-x86_64/dist-mips-linux/patches/ /tmp/patches/ -COPY host-x86_64/dist-mips64-linux/mips64-linux-gnu.config host-x86_64/dist-mips64-linux/build-mips64-toolchain.sh /tmp/ -RUN su rustbuild -c ./build-mips64-toolchain.sh +COPY host-x86_64/dist-mips64-linux/mips64-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-mips64-linux/build-mips64-toolchain.sh b/src/ci/docker/host-x86_64/dist-mips64-linux/build-mips64-toolchain.sh deleted file mode 100755 index f554a5f475498..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mips64-linux/build-mips64-toolchain.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../mips64-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-mips64-linux/mips64-linux-gnu.config b/src/ci/docker/host-x86_64/dist-mips64-linux/mips64-linux-gnu.config deleted file mode 100644 index c28d655427e3c..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mips64-linux/mips64-linux-gnu.config +++ /dev/null @@ -1,741 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -# CT_PATCH_BUNDLED is not set -CT_PATCH_BUNDLED_LOCAL=y -CT_PATCH_ORDER="bundled,local" -CT_PATCH_USE_LOCAL=y -CT_LOCAL_PATCH_DIR="/tmp/patches" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -CT_ARCH_MIPS=y -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="mips" -CT_ARCH_CHOICE_KSYM="MIPS" -CT_ARCH_TUNE="" -CT_ARCH_MIPS_SHOW=y - -# -# Options for mips -# -CT_ARCH_MIPS_PKG_KSYM="" -# CT_ARCH_mips_n32 is not set -CT_ARCH_mips_n64=y -CT_ARCH_mips_ABI="64" -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_BE=y -CT_ARCH_BE=y -# CT_ARCH_LE is not set -CT_ARCH_ENDIAN="big" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=64 -# CT_ARCH_32 is not set -CT_ARCH_64=y - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_ARCH="mips64r2" -CT_ARCH_FLOAT_AUTO=y -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="auto" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -CT_LINUX_V_4_4=y -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -# CT_LINUX_V_3_2 is not set -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="4.4.174" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_later_than_3_7=y -CT_LINUX_3_7_or_later=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -CT_GLIBC_V_2_23=y -# CT_GLIBC_V_2_19 is not set -# CT_GLIBC_V_2_17 is not set -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.23" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_later=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_later_than_2_20=y -CT_GLIBC_2_20_or_later=y -CT_GLIBC_later_than_2_17=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_NO_SPARC_V8=y -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="4.4.174" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_CC_GCC_HAS_ARCH_OPTIONS=y - -# -# architecture-specific options -# -CT_CC_GCC_mips_llsc=m -CT_CC_GCC_mips_synci=m -# CT_CC_GCC_mips_plt is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-mips64-linux/mips64-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-mips64-linux/mips64-linux-gnu.defconfig new file mode 100644 index 0000000000000..4b8f7a5492033 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-mips64-linux/mips64-linux-gnu.defconfig @@ -0,0 +1,16 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_PATCH_BUNDLED_LOCAL=y +CT_LOCAL_PATCH_DIR="/tmp/patches" +CT_ARCH_MIPS=y +CT_ARCH_mips_n64=y +CT_ARCH_64=y +CT_ARCH_ARCH="mips64r2" +CT_KERNEL_LINUX=y +CT_LINUX_V_4_4=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_23=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile index b90950f733023..5ab4a53de8a88 100644 --- a/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile @@ -3,16 +3,17 @@ FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh WORKDIR /tmp +COPY scripts/crosstool-ng-build.sh /scripts/ COPY host-x86_64/dist-mips-linux/patches/ /tmp/patches/ -COPY host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.config host-x86_64/dist-mips64el-linux/build-mips64el-toolchain.sh /tmp/ -RUN su rustbuild -c ./build-mips64el-toolchain.sh +COPY host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-mips64el-linux/build-mips64el-toolchain.sh b/src/ci/docker/host-x86_64/dist-mips64el-linux/build-mips64el-toolchain.sh deleted file mode 100755 index 1ad406800b1aa..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mips64el-linux/build-mips64el-toolchain.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../mips64el-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.config b/src/ci/docker/host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.config deleted file mode 100644 index 50dfe7b2dd1a6..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.config +++ /dev/null @@ -1,741 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -# CT_PATCH_BUNDLED is not set -CT_PATCH_BUNDLED_LOCAL=y -CT_PATCH_ORDER="bundled,local" -CT_PATCH_USE_LOCAL=y -CT_LOCAL_PATCH_DIR="/tmp/patches" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -CT_ARCH_MIPS=y -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="mips" -CT_ARCH_CHOICE_KSYM="MIPS" -CT_ARCH_TUNE="" -CT_ARCH_MIPS_SHOW=y - -# -# Options for mips -# -CT_ARCH_MIPS_PKG_KSYM="" -# CT_ARCH_mips_n32 is not set -CT_ARCH_mips_n64=y -CT_ARCH_mips_ABI="64" -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_BE=y -# CT_ARCH_BE is not set -CT_ARCH_LE=y -CT_ARCH_ENDIAN="little" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=64 -# CT_ARCH_32 is not set -CT_ARCH_64=y - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_ARCH="mips64r2" -CT_ARCH_FLOAT_AUTO=y -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="auto" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -CT_LINUX_V_4_4=y -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -# CT_LINUX_V_3_2 is not set -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="4.4.174" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_later_than_3_7=y -CT_LINUX_3_7_or_later=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -CT_GLIBC_V_2_23=y -# CT_GLIBC_V_2_19 is not set -# CT_GLIBC_V_2_17 is not set -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.23" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_later=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_later_than_2_20=y -CT_GLIBC_2_20_or_later=y -CT_GLIBC_later_than_2_17=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_NO_SPARC_V8=y -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="4.4.174" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_CC_GCC_HAS_ARCH_OPTIONS=y - -# -# architecture-specific options -# -CT_CC_GCC_mips_llsc=m -CT_CC_GCC_mips_synci=m -# CT_CC_GCC_mips_plt is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.defconfig new file mode 100644 index 0000000000000..9c8eb5007b79b --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-mips64el-linux/mips64el-linux-gnu.defconfig @@ -0,0 +1,17 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_PATCH_BUNDLED_LOCAL=y +CT_LOCAL_PATCH_DIR="/tmp/patches" +CT_ARCH_MIPS=y +CT_ARCH_mips_n64=y +CT_ARCH_LE=y +CT_ARCH_64=y +CT_ARCH_ARCH="mips64r2" +CT_KERNEL_LINUX=y +CT_LINUX_V_4_4=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_23=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile index 6cc2de5e47d01..0bbaf00339d0a 100644 --- a/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile @@ -3,16 +3,17 @@ FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh WORKDIR /tmp +COPY scripts/crosstool-ng-build.sh /scripts/ COPY host-x86_64/dist-mips-linux/patches/ /tmp/patches/ -COPY host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.config host-x86_64/dist-mipsel-linux/build-mipsel-toolchain.sh /tmp/ -RUN su rustbuild -c ./build-mipsel-toolchain.sh +COPY host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-mipsel-linux/build-mipsel-toolchain.sh b/src/ci/docker/host-x86_64/dist-mipsel-linux/build-mipsel-toolchain.sh deleted file mode 100755 index 598e4893325f7..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mipsel-linux/build-mipsel-toolchain.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../mipsel-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.config b/src/ci/docker/host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.config deleted file mode 100644 index 3566c7c8593e2..0000000000000 --- a/src/ci/docker/host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.config +++ /dev/null @@ -1,740 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -# CT_PATCH_BUNDLED is not set -CT_PATCH_BUNDLED_LOCAL=y -CT_PATCH_ORDER="bundled,local" -CT_PATCH_USE_LOCAL=y -CT_LOCAL_PATCH_DIR="/tmp/patches" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -CT_ARCH_MIPS=y -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="mips" -CT_ARCH_CHOICE_KSYM="MIPS" -CT_ARCH_TUNE="" -CT_ARCH_MIPS_SHOW=y - -# -# Options for mips -# -CT_ARCH_MIPS_PKG_KSYM="" -CT_ARCH_mips_o32=y -CT_ARCH_mips_ABI="32" -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_BE=y -# CT_ARCH_BE is not set -CT_ARCH_LE=y -CT_ARCH_ENDIAN="little" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=32 -CT_ARCH_32=y -# CT_ARCH_64 is not set - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_ARCH="mips32r2" -CT_ARCH_FLOAT_AUTO=y -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="auto" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -CT_LINUX_V_4_4=y -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -# CT_LINUX_V_3_2 is not set -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="4.4.174" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_later_than_3_7=y -CT_LINUX_3_7_or_later=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -CT_GLIBC_V_2_23=y -# CT_GLIBC_V_2_19 is not set -# CT_GLIBC_V_2_17 is not set -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.23" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_later=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_later_than_2_20=y -CT_GLIBC_2_20_or_later=y -CT_GLIBC_later_than_2_17=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_NO_SPARC_V8=y -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="4.4.174" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-fp-32=xx --with-odd-spreg-32=no" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_CC_GCC_HAS_ARCH_OPTIONS=y - -# -# architecture-specific options -# -CT_CC_GCC_mips_llsc=m -CT_CC_GCC_mips_synci=m -# CT_CC_GCC_mips_plt is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.defconfig new file mode 100644 index 0000000000000..a9dae121e536a --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-mipsel-linux/mipsel-linux-gnu.defconfig @@ -0,0 +1,17 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_PATCH_BUNDLED_LOCAL=y +CT_LOCAL_PATCH_DIR="/tmp/patches" +CT_ARCH_MIPS=y +CT_ARCH_mips_o32=y +CT_ARCH_LE=y +CT_ARCH_ARCH="mips32r2" +CT_KERNEL_LINUX=y +CT_LINUX_V_4_4=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_23=y +CT_GCC_V_8=y +CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-fp-32=xx --with-odd-spreg-32=no" +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile index 94a837151c623..b546f571f66bd 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc-linux/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.config host-x86_64/dist-powerpc-linux/build-powerpc-toolchain.sh /tmp/ -RUN ./build-powerpc-toolchain.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-powerpc-linux/build-powerpc-toolchain.sh b/src/ci/docker/host-x86_64/dist-powerpc-linux/build-powerpc-toolchain.sh deleted file mode 100755 index 264d0764f2957..0000000000000 --- a/src/ci/docker/host-x86_64/dist-powerpc-linux/build-powerpc-toolchain.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../powerpc-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.config b/src/ci/docker/host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.config deleted file mode 100644 index 0df859ad94488..0000000000000 --- a/src/ci/docker/host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.config +++ /dev/null @@ -1,736 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -CT_ARCH_POWERPC=y -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="powerpc" -CT_ARCH_CHOICE_KSYM="POWERPC" -CT_ARCH_CPU="powerpc" -CT_ARCH_TUNE="" -CT_ARCH_POWERPC_SHOW=y - -# -# Options for powerpc -# -CT_ARCH_POWERPC_PKG_KSYM="" -CT_ARCH_powerpc_ABI="" -CT_ARCH_powerpc_ABI_DEFAULT=y -# CT_ARCH_powerpc_ABI_SPE is not set -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_BE=y -CT_ARCH_BE=y -# CT_ARCH_LE is not set -CT_ARCH_ENDIAN="big" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=32 -CT_ARCH_32=y -# CT_ARCH_64 is not set - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ABI=y -CT_ARCH_SUPPORTS_WITH_CPU=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_ABI="" -CT_ARCH_FLOAT_AUTO=y -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="auto" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -CT_LINUX_V_3_2=y -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="3.2.101" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_3_7_or_older=y -CT_LINUX_older_than_3_7=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -# CT_BINUTILS_V_2_32 is not set -# CT_BINUTILS_V_2_31 is not set -CT_BINUTILS_V_2_30=y -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.30" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_2_30_or_older=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_PORTS_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="3.2.101" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.defconfig new file mode 100644 index 0000000000000..6a0e96a3b67bc --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-powerpc-linux/powerpc-linux-gnu.defconfig @@ -0,0 +1,12 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_POWERPC=y +CT_ARCH_CPU="powerpc" +CT_KERNEL_LINUX=y +CT_LINUX_V_3_2=y +CT_BINUTILS_V_2_30=y +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile index c976536cb7c5d..c88185a2000db 100644 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-powerpc64-linux/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-powerpc64-linux/shared.sh host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.config host-x86_64/dist-powerpc64-linux/build-powerpc64-toolchain.sh /tmp/ -RUN ./build-powerpc64-toolchain.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux/build-powerpc64-toolchain.sh b/src/ci/docker/host-x86_64/dist-powerpc64-linux/build-powerpc64-toolchain.sh deleted file mode 100755 index f7aa2cd326832..0000000000000 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux/build-powerpc64-toolchain.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -ex - -source shared.sh - -mkdir build -cd build -cp ../powerpc64-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.config b/src/ci/docker/host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.config deleted file mode 100644 index d3293eab2bed6..0000000000000 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.config +++ /dev/null @@ -1,736 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -CT_ARCH_POWERPC=y -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="powerpc" -CT_ARCH_CHOICE_KSYM="POWERPC" -CT_ARCH_CPU="power4" -CT_ARCH_TUNE="power6" -CT_ARCH_POWERPC_SHOW=y - -# -# Options for powerpc -# -CT_ARCH_POWERPC_PKG_KSYM="" -CT_ARCH_powerpc_ABI="" -CT_ARCH_powerpc_ABI_DEFAULT=y -# CT_ARCH_powerpc_ABI_SPE is not set -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_EITHER_ENDIAN=y -CT_ARCH_DEFAULT_BE=y -CT_ARCH_BE=y -# CT_ARCH_LE is not set -CT_ARCH_ENDIAN="big" -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=64 -# CT_ARCH_32 is not set -CT_ARCH_64=y - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ABI=y -CT_ARCH_SUPPORTS_WITH_CPU=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_SUPPORTS_WITH_FLOAT=y -CT_ARCH_ABI="" -CT_ARCH_FLOAT_AUTO=y -# CT_ARCH_FLOAT_HW is not set -# CT_ARCH_FLOAT_SW is not set -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" -CT_ARCH_FLOAT="auto" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -CT_LINUX_V_3_2=y -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="3.2.101" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_3_7_or_older=y -CT_LINUX_older_than_3_7=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_PORTS_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="3.2.101" -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.defconfig new file mode 100644 index 0000000000000..2b442cbe79467 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-powerpc64-linux/powerpc64-linux-gnu.defconfig @@ -0,0 +1,14 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_POWERPC=y +CT_ARCH_CPU="power4" +CT_ARCH_TUNE="power6" +CT_ARCH_64=y +CT_KERNEL_LINUX=y +CT_LINUX_V_3_2=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-powerpc64-linux/shared.sh b/src/ci/docker/host-x86_64/dist-powerpc64-linux/shared.sh deleted file mode 100644 index dc86dddd464f2..0000000000000 --- a/src/ci/docker/host-x86_64/dist-powerpc64-linux/shared.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile index 397f9538b8bc9..426e601f5d34d 100644 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-riscv64-linux/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-riscv64-linux/build-toolchains.sh host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.config /tmp/ -RUN ./build-toolchains.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux/build-toolchains.sh b/src/ci/docker/host-x86_64/dist-riscv64-linux/build-toolchains.sh deleted file mode 100755 index a7025b2b7545e..0000000000000 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux/build-toolchains.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../riscv64-unknown-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.config b/src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.config deleted file mode 100644 index 7400a8a038d0c..0000000000000 --- a/src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.config +++ /dev/null @@ -1,907 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -CT_EXPERIMENTAL=y -# CT_ALLOW_BUILD_AS_ROOT is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -# CT_USE_MIRROR is not set -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_LOCAL is not set -# CT_PATCH_BUNDLED_LOCAL is not set -# CT_PATCH_LOCAL_BUNDLED is not set -# CT_PATCH_NONE is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -# CT_LOG_EXTRA is not set -CT_LOG_ALL=y -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="ALL" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MICROBLAZE is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_MOXIE is not set -# CT_ARCH_MSP430 is not set -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -CT_ARCH_RISCV=y -# CT_ARCH_S390 is not set -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="riscv" -CT_ARCH_CHOICE_KSYM="RISCV" -CT_ARCH_TUNE="" -CT_ARCH_RISCV_SHOW=y - -# -# Options for riscv -# -CT_ARCH_RISCV_PKG_KSYM="" -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -# CT_DEMULTILIB is not set -CT_ARCH_SUPPORTS_BOTH_MMU=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=64 -# CT_ARCH_32 is not set -CT_ARCH_64=y - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_ARCH=y -CT_ARCH_SUPPORTS_WITH_ABI=y -CT_ARCH_SUPPORTS_WITH_TUNE=y -CT_ARCH_ARCH="rv64gc" -CT_ARCH_ABI="" -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -# CT_NATIVE is not set -CT_CROSS=y -# CT_CROSS_NATIVE is not set -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -# CT_LINUX_SRC_DEVEL is not set -# CT_LINUX_SRC_CUSTOM is not set -CT_LINUX_PATCH_GLOBAL=y -# CT_LINUX_PATCH_BUNDLED is not set -# CT_LINUX_PATCH_LOCAL is not set -# CT_LINUX_PATCH_BUNDLED_LOCAL is not set -# CT_LINUX_PATCH_LOCAL_BUNDLED is not set -# CT_LINUX_PATCH_NONE is not set -CT_LINUX_PATCH_ORDER="global" -CT_LINUX_V_4_20=y -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -# CT_LINUX_V_3_2 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="4.20.8" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_later_than_4_8=y -CT_LINUX_4_8_or_later=y -CT_LINUX_later_than_3_7=y -CT_LINUX_3_7_or_later=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_LINUX_REQUIRE_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -# CT_BINUTILS_SRC_DEVEL is not set -# CT_BINUTILS_SRC_CUSTOM is not set -CT_BINUTILS_PATCH_GLOBAL=y -# CT_BINUTILS_PATCH_BUNDLED is not set -# CT_BINUTILS_PATCH_LOCAL is not set -# CT_BINUTILS_PATCH_BUNDLED_LOCAL is not set -# CT_BINUTILS_PATCH_LOCAL_BUNDLED is not set -# CT_BINUTILS_PATCH_NONE is not set -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_REQUIRE_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_MUSL is not set -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -# CT_GLIBC_SRC_DEVEL is not set -# CT_GLIBC_SRC_CUSTOM is not set -CT_GLIBC_PATCH_GLOBAL=y -# CT_GLIBC_PATCH_BUNDLED is not set -# CT_GLIBC_PATCH_LOCAL is not set -# CT_GLIBC_PATCH_BUNDLED_LOCAL is not set -# CT_GLIBC_PATCH_LOCAL_BUNDLED is not set -# CT_GLIBC_PATCH_NONE is not set -CT_GLIBC_PATCH_ORDER="global" -CT_GLIBC_V_2_29=y -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.29" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_later=y -CT_GLIBC_2_29_or_older=y -CT_GLIBC_REQUIRE_2_29_or_later=y -CT_GLIBC_later_than_2_27=y -CT_GLIBC_2_27_or_later=y -CT_GLIBC_later_than_2_26=y -CT_GLIBC_2_26_or_later=y -CT_GLIBC_later_than_2_25=y -CT_GLIBC_2_25_or_later=y -CT_GLIBC_later_than_2_24=y -CT_GLIBC_2_24_or_later=y -CT_GLIBC_later_than_2_23=y -CT_GLIBC_2_23_or_later=y -CT_GLIBC_later_than_2_20=y -CT_GLIBC_2_20_or_later=y -CT_GLIBC_later_than_2_17=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_BUILD_SSP=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_NO_SPARC_V8=y -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_ENABLE_FORTIFIED_BUILD is not set -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -CT_GLIBC_KERNEL_VERSION_NONE=y -# CT_GLIBC_KERNEL_VERSION_AS_HEADERS is not set -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="" -CT_GLIBC_SSP_DEFAULT=y -# CT_GLIBC_SSP_NO is not set -# CT_GLIBC_SSP_YES is not set -# CT_GLIBC_SSP_ALL is not set -# CT_GLIBC_SSP_STRONG is not set -# CT_GLIBC_ENABLE_WERROR is not set -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -# CT_GCC_USE_LINARO is not set -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -# CT_GCC_SRC_DEVEL is not set -# CT_GCC_SRC_CUSTOM is not set -CT_GCC_PATCH_GLOBAL=y -# CT_GCC_PATCH_BUNDLED is not set -# CT_GCC_PATCH_LOCAL is not set -# CT_GCC_PATCH_BUNDLED_LOCAL is not set -# CT_GCC_PATCH_LOCAL_BUNDLED is not set -# CT_GCC_PATCH_NONE is not set -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_REQUIRE_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_REQUIRE_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_REQUIRE_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set -# CT_CC_LANG_ADA is not set -# CT_CC_LANG_OBJC is not set -# CT_CC_LANG_OBJCXX is not set -# CT_CC_LANG_GOLANG is not set -CT_CC_LANG_OTHERS="" - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -CT_DEBUG_GDB=y -CT_DEBUG_GDB_PKG_KSYM="GDB" -CT_GDB_DIR_NAME="gdb" -CT_GDB_USE_GNU=y -CT_GDB_USE="GDB" -CT_GDB_PKG_NAME="gdb" -CT_GDB_SRC_RELEASE=y -# CT_GDB_SRC_DEVEL is not set -# CT_GDB_SRC_CUSTOM is not set -CT_GDB_PATCH_GLOBAL=y -# CT_GDB_PATCH_BUNDLED is not set -# CT_GDB_PATCH_LOCAL is not set -# CT_GDB_PATCH_BUNDLED_LOCAL is not set -# CT_GDB_PATCH_LOCAL_BUNDLED is not set -# CT_GDB_PATCH_NONE is not set -CT_GDB_PATCH_ORDER="global" -CT_GDB_V_8_2=y -# CT_GDB_V_8_1 is not set -# CT_GDB_V_8_0 is not set -# CT_GDB_NO_VERSIONS is not set -CT_GDB_VERSION="8.2.1" -CT_GDB_MIRRORS="$(CT_Mirrors GNU gdb) $(CT_Mirrors sourceware gdb/releases)" -CT_GDB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GDB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GDB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GDB_SIGNATURE_FORMAT="" -CT_GDB_later_than_8_0=y -CT_GDB_8_0_or_later=y -CT_GDB_REQUIRE_8_0_or_later=y -CT_GDB_later_than_7_12=y -CT_GDB_7_12_or_later=y -CT_GDB_later_than_7_2=y -CT_GDB_7_2_or_later=y -CT_GDB_later_than_7_0=y -CT_GDB_7_0_or_later=y -CT_GDB_CROSS=y -# CT_GDB_CROSS_STATIC is not set -# CT_GDB_CROSS_SIM is not set -# CT_GDB_CROSS_PYTHON is not set -CT_GDB_CROSS_EXTRA_CONFIG_ARRAY="" -# CT_GDB_NATIVE is not set -# CT_GDB_GDBSERVER is not set -CT_GDB_HAS_PKGVERSION_BUGURL=y -CT_GDB_HAS_PYTHON=y -CT_GDB_INSTALL_GDBINIT=y -CT_GDB_HAS_IPA_LIB=y -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -CT_COMP_LIBS_EXPAT=y -CT_COMP_LIBS_EXPAT_PKG_KSYM="EXPAT" -CT_EXPAT_DIR_NAME="expat" -CT_EXPAT_PKG_NAME="expat" -CT_EXPAT_SRC_RELEASE=y -# CT_EXPAT_SRC_DEVEL is not set -# CT_EXPAT_SRC_CUSTOM is not set -CT_EXPAT_PATCH_GLOBAL=y -# CT_EXPAT_PATCH_BUNDLED is not set -# CT_EXPAT_PATCH_LOCAL is not set -# CT_EXPAT_PATCH_BUNDLED_LOCAL is not set -# CT_EXPAT_PATCH_LOCAL_BUNDLED is not set -# CT_EXPAT_PATCH_NONE is not set -CT_EXPAT_PATCH_ORDER="global" -CT_EXPAT_V_2_2=y -# CT_EXPAT_NO_VERSIONS is not set -CT_EXPAT_VERSION="2.4.1" -CT_EXPAT_VERSION_TAG="2_4_1" -CT_EXPAT_MIRRORS="https://github.com/libexpat/libexpat/releases/download/R_${CT_EXPAT_VERSION_TAG}" -CT_EXPAT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_EXPAT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_EXPAT_ARCHIVE_FORMATS=".tar.bz2" -CT_EXPAT_SIGNATURE_FORMAT="" -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -# CT_GETTEXT_SRC_DEVEL is not set -# CT_GETTEXT_SRC_CUSTOM is not set -CT_GETTEXT_PATCH_GLOBAL=y -# CT_GETTEXT_PATCH_BUNDLED is not set -# CT_GETTEXT_PATCH_LOCAL is not set -# CT_GETTEXT_PATCH_BUNDLED_LOCAL is not set -# CT_GETTEXT_PATCH_LOCAL_BUNDLED is not set -# CT_GETTEXT_PATCH_NONE is not set -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -# CT_GMP_SRC_DEVEL is not set -# CT_GMP_SRC_CUSTOM is not set -CT_GMP_PATCH_GLOBAL=y -# CT_GMP_PATCH_BUNDLED is not set -# CT_GMP_PATCH_LOCAL is not set -# CT_GMP_PATCH_BUNDLED_LOCAL is not set -# CT_GMP_PATCH_LOCAL_BUNDLED is not set -# CT_GMP_PATCH_NONE is not set -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -# CT_ISL_SRC_DEVEL is not set -# CT_ISL_SRC_CUSTOM is not set -CT_ISL_PATCH_GLOBAL=y -# CT_ISL_PATCH_BUNDLED is not set -# CT_ISL_PATCH_LOCAL is not set -# CT_ISL_PATCH_BUNDLED_LOCAL is not set -# CT_ISL_PATCH_LOCAL_BUNDLED is not set -# CT_ISL_PATCH_NONE is not set -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="https://ci-mirrors.rust-lang.org/rustc" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -# CT_LIBICONV_SRC_DEVEL is not set -# CT_LIBICONV_SRC_CUSTOM is not set -CT_LIBICONV_PATCH_GLOBAL=y -# CT_LIBICONV_PATCH_BUNDLED is not set -# CT_LIBICONV_PATCH_LOCAL is not set -# CT_LIBICONV_PATCH_BUNDLED_LOCAL is not set -# CT_LIBICONV_PATCH_LOCAL_BUNDLED is not set -# CT_LIBICONV_PATCH_NONE is not set -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -# CT_MPC_SRC_DEVEL is not set -# CT_MPC_SRC_CUSTOM is not set -CT_MPC_PATCH_GLOBAL=y -# CT_MPC_PATCH_BUNDLED is not set -# CT_MPC_PATCH_LOCAL is not set -# CT_MPC_PATCH_BUNDLED_LOCAL is not set -# CT_MPC_PATCH_LOCAL_BUNDLED is not set -# CT_MPC_PATCH_NONE is not set -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -# CT_MPFR_SRC_DEVEL is not set -# CT_MPFR_SRC_CUSTOM is not set -CT_MPFR_PATCH_GLOBAL=y -# CT_MPFR_PATCH_BUNDLED is not set -# CT_MPFR_PATCH_LOCAL is not set -# CT_MPFR_PATCH_BUNDLED_LOCAL is not set -# CT_MPFR_PATCH_LOCAL_BUNDLED is not set -# CT_MPFR_PATCH_NONE is not set -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -# CT_NCURSES_SRC_DEVEL is not set -# CT_NCURSES_SRC_CUSTOM is not set -CT_NCURSES_PATCH_GLOBAL=y -# CT_NCURSES_PATCH_BUNDLED is not set -# CT_NCURSES_PATCH_LOCAL is not set -# CT_NCURSES_PATCH_BUNDLED_LOCAL is not set -# CT_NCURSES_PATCH_LOCAL_BUNDLED is not set -# CT_NCURSES_PATCH_NONE is not set -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -# CT_NCURSES_NEW_ABI is not set -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -# CT_ZLIB_SRC_DEVEL is not set -# CT_ZLIB_SRC_CUSTOM is not set -CT_ZLIB_PATCH_GLOBAL=y -# CT_ZLIB_PATCH_BUNDLED is not set -# CT_ZLIB_PATCH_LOCAL is not set -# CT_ZLIB_PATCH_BUNDLED_LOCAL is not set -# CT_ZLIB_PATCH_LOCAL_BUNDLED is not set -# CT_ZLIB_PATCH_NONE is not set -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="https://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_EXPAT_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_EXPAT=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" - -# -# Test suite -# -# CT_TEST_SUITE_GCC is not set diff --git a/src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.defconfig new file mode 100644 index 0000000000000..10075907beb00 --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-riscv64-linux/riscv64-unknown-linux-gnu.defconfig @@ -0,0 +1,16 @@ +CT_CONFIG_VERSION="4" +CT_EXPERIMENTAL=y +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_RISCV=y +# CT_DEMULTILIB is not set +CT_ARCH_USE_MMU=y +CT_ARCH_64=y +CT_ARCH_ARCH="rv64gc" +CT_KERNEL_LINUX=y +CT_LINUX_V_4_20=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_29=y +CT_GCC_V_8=y +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile index adb98d7ebb545..de776911d628d 100644 --- a/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-s390x-linux/Dockerfile @@ -1,20 +1,18 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 COPY scripts/cross-apt-packages.sh /scripts/ RUN sh /scripts/cross-apt-packages.sh -COPY scripts/crosstool-ng-1.24.sh /scripts/ -RUN sh /scripts/crosstool-ng-1.24.sh +COPY scripts/crosstool-ng.sh /scripts/ +RUN sh /scripts/crosstool-ng.sh COPY scripts/rustbuild-setup.sh /scripts/ RUN sh /scripts/rustbuild-setup.sh -USER rustbuild WORKDIR /tmp -COPY host-x86_64/dist-s390x-linux/s390x-linux-gnu.config host-x86_64/dist-s390x-linux/build-s390x-toolchain.sh /tmp/ -RUN ./build-s390x-toolchain.sh - -USER root +COPY scripts/crosstool-ng-build.sh /scripts/ +COPY host-x86_64/dist-s390x-linux/s390x-linux-gnu.defconfig /tmp/crosstool.defconfig +RUN /scripts/crosstool-ng-build.sh COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh diff --git a/src/ci/docker/host-x86_64/dist-s390x-linux/build-s390x-toolchain.sh b/src/ci/docker/host-x86_64/dist-s390x-linux/build-s390x-toolchain.sh deleted file mode 100755 index 6f8d6be842b8e..0000000000000 --- a/src/ci/docker/host-x86_64/dist-s390x-linux/build-s390x-toolchain.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -ex - -hide_output() { - set +x - on_err=" -echo ERROR: An error was encountered with the build. -cat /tmp/build.log -exit 1 -" - trap "$on_err" ERR - bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & - PING_LOOP_PID=$! - "$@" &> /tmp/build.log - rm /tmp/build.log - trap - ERR - kill $PING_LOOP_PID - set -x -} - -mkdir build -cd build -cp ../s390x-linux-gnu.config .config -hide_output ct-ng build -cd .. -rm -rf build diff --git a/src/ci/docker/host-x86_64/dist-s390x-linux/s390x-linux-gnu.config b/src/ci/docker/host-x86_64/dist-s390x-linux/s390x-linux-gnu.config deleted file mode 100644 index 51ef36b03ac09..0000000000000 --- a/src/ci/docker/host-x86_64/dist-s390x-linux/s390x-linux-gnu.config +++ /dev/null @@ -1,732 +0,0 @@ -# -# Automatically generated file; DO NOT EDIT. -# crosstool-NG Configuration -# -CT_CONFIGURE_has_static_link=y -CT_CONFIGURE_has_cxx11=y -CT_CONFIGURE_has_wget=y -CT_CONFIGURE_has_curl=y -CT_CONFIGURE_has_make_3_81_or_newer=y -CT_CONFIGURE_has_make_4_0_or_newer=y -CT_CONFIGURE_has_libtool_2_4_or_newer=y -CT_CONFIGURE_has_libtoolize_2_4_or_newer=y -CT_CONFIGURE_has_autoconf_2_65_or_newer=y -CT_CONFIGURE_has_autoreconf_2_65_or_newer=y -CT_CONFIGURE_has_automake_1_15_or_newer=y -CT_CONFIGURE_has_gnu_m4_1_4_12_or_newer=y -CT_CONFIGURE_has_python_3_4_or_newer=y -CT_CONFIGURE_has_bison_2_7_or_newer=y -CT_CONFIGURE_has_python=y -CT_CONFIGURE_has_git=y -CT_CONFIGURE_has_md5sum=y -CT_CONFIGURE_has_sha1sum=y -CT_CONFIGURE_has_sha256sum=y -CT_CONFIGURE_has_sha512sum=y -CT_CONFIGURE_has_install_with_strip_program=y -CT_CONFIG_VERSION_CURRENT="3" -CT_CONFIG_VERSION="3" -CT_MODULES=y - -# -# Paths and misc options -# - -# -# crosstool-NG behavior -# -# CT_OBSOLETE is not set -# CT_EXPERIMENTAL is not set -# CT_DEBUG_CT is not set - -# -# Paths -# -CT_LOCAL_TARBALLS_DIR="${HOME}/src" -CT_SAVE_TARBALLS=y -# CT_TARBALLS_BUILDROOT_LAYOUT is not set -CT_WORK_DIR="${CT_TOP_DIR}/.build" -CT_BUILD_TOP_DIR="${CT_WORK_DIR:-${CT_TOP_DIR}/.build}/${CT_HOST:+HOST-${CT_HOST}/}${CT_TARGET}" -CT_PREFIX_DIR="/x-tools/${CT_TARGET}" -CT_RM_RF_PREFIX_DIR=y -CT_REMOVE_DOCS=y -CT_INSTALL_LICENSES=y -CT_PREFIX_DIR_RO=y -CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y -# CT_STRIP_TARGET_TOOLCHAIN_EXECUTABLES is not set - -# -# Downloading -# -CT_DOWNLOAD_AGENT_WGET=y -# CT_DOWNLOAD_AGENT_CURL is not set -# CT_DOWNLOAD_AGENT_NONE is not set -# CT_FORBID_DOWNLOAD is not set -# CT_FORCE_DOWNLOAD is not set -CT_CONNECT_TIMEOUT=10 -CT_DOWNLOAD_WGET_OPTIONS="--passive-ftp --tries=3 -nc --progress=dot:binary" -# CT_ONLY_DOWNLOAD is not set -CT_USE_MIRROR=y -# CT_FORCE_MIRROR is not set -CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" -CT_VERIFY_DOWNLOAD_DIGEST=y -CT_VERIFY_DOWNLOAD_DIGEST_SHA512=y -# CT_VERIFY_DOWNLOAD_DIGEST_SHA256 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_SHA1 is not set -# CT_VERIFY_DOWNLOAD_DIGEST_MD5 is not set -CT_VERIFY_DOWNLOAD_DIGEST_ALG="sha512" -# CT_VERIFY_DOWNLOAD_SIGNATURE is not set - -# -# Extracting -# -# CT_FORCE_EXTRACT is not set -CT_OVERRIDE_CONFIG_GUESS_SUB=y -# CT_ONLY_EXTRACT is not set -CT_PATCH_BUNDLED=y -# CT_PATCH_BUNDLED_LOCAL is not set -CT_PATCH_ORDER="bundled" - -# -# Build behavior -# -CT_PARALLEL_JOBS=0 -CT_LOAD="" -CT_USE_PIPES=y -CT_EXTRA_CFLAGS_FOR_BUILD="" -CT_EXTRA_LDFLAGS_FOR_BUILD="" -CT_EXTRA_CFLAGS_FOR_HOST="" -CT_EXTRA_LDFLAGS_FOR_HOST="" -# CT_CONFIG_SHELL_SH is not set -# CT_CONFIG_SHELL_ASH is not set -CT_CONFIG_SHELL_BASH=y -# CT_CONFIG_SHELL_CUSTOM is not set -CT_CONFIG_SHELL="${bash}" - -# -# Logging -# -# CT_LOG_ERROR is not set -# CT_LOG_WARN is not set -# CT_LOG_INFO is not set -CT_LOG_EXTRA=y -# CT_LOG_ALL is not set -# CT_LOG_DEBUG is not set -CT_LOG_LEVEL_MAX="EXTRA" -# CT_LOG_SEE_TOOLS_WARN is not set -CT_LOG_PROGRESS_BAR=y -CT_LOG_TO_FILE=y -CT_LOG_FILE_COMPRESS=y - -# -# Target options -# -# CT_ARCH_ALPHA is not set -# CT_ARCH_ARC is not set -# CT_ARCH_ARM is not set -# CT_ARCH_AVR is not set -# CT_ARCH_M68K is not set -# CT_ARCH_MIPS is not set -# CT_ARCH_NIOS2 is not set -# CT_ARCH_POWERPC is not set -CT_ARCH_S390=y -# CT_ARCH_SH is not set -# CT_ARCH_SPARC is not set -# CT_ARCH_X86 is not set -# CT_ARCH_XTENSA is not set -CT_ARCH="s390" -CT_ARCH_CHOICE_KSYM="S390" -# CT_ARCH_ALPHA_EV4 is not set -# CT_ARCH_ALPHA_EV45 is not set -# CT_ARCH_ALPHA_EV5 is not set -# CT_ARCH_ALPHA_EV56 is not set -# CT_ARCH_ALPHA_EV6 is not set -# CT_ARCH_ALPHA_EV67 is not set -CT_ARCH_S390_SHOW=y - -# -# Options for s390 -# -CT_ARCH_S390_PKG_KSYM="" -CT_ALL_ARCH_CHOICES="ALPHA ARC ARM AVR M68K MICROBLAZE MIPS MOXIE MSP430 NIOS2 POWERPC RISCV S390 SH SPARC X86 XTENSA" -CT_ARCH_SUFFIX="" -# CT_OMIT_TARGET_VENDOR is not set - -# -# Generic target options -# -# CT_MULTILIB is not set -CT_DEMULTILIB=y -CT_ARCH_USE_MMU=y -CT_ARCH_SUPPORTS_32=y -CT_ARCH_SUPPORTS_64=y -CT_ARCH_DEFAULT_32=y -CT_ARCH_BITNESS=64 -# CT_ARCH_32 is not set -CT_ARCH_64=y - -# -# Target optimisations -# -CT_ARCH_SUPPORTS_WITH_FPU=y -CT_ARCH_FPU="" -CT_TARGET_CFLAGS="" -CT_TARGET_LDFLAGS="" - -# -# Toolchain options -# - -# -# General toolchain options -# -CT_FORCE_SYSROOT=y -CT_USE_SYSROOT=y -CT_SYSROOT_NAME="sysroot" -CT_SYSROOT_DIR_PREFIX="" -CT_WANTS_STATIC_LINK=y -CT_WANTS_STATIC_LINK_CXX=y -# CT_STATIC_TOOLCHAIN is not set -CT_SHOW_CT_VERSION=y -CT_TOOLCHAIN_PKGVERSION="" -CT_TOOLCHAIN_BUGURL="" - -# -# Tuple completion and aliasing -# -CT_TARGET_VENDOR="unknown" -CT_TARGET_ALIAS_SED_EXPR="" -CT_TARGET_ALIAS="" - -# -# Toolchain type -# -CT_CROSS=y -# CT_CANADIAN is not set -CT_TOOLCHAIN_TYPE="cross" - -# -# Build system -# -CT_BUILD="" -CT_BUILD_PREFIX="" -CT_BUILD_SUFFIX="" - -# -# Misc options -# -# CT_TOOLCHAIN_ENABLE_NLS is not set - -# -# Operating System -# -CT_KERNEL_SUPPORTS_SHARED_LIBS=y -# CT_KERNEL_BARE_METAL is not set -CT_KERNEL_LINUX=y -CT_KERNEL="linux" -CT_KERNEL_CHOICE_KSYM="LINUX" -CT_KERNEL_LINUX_SHOW=y - -# -# Options for linux -# -CT_KERNEL_LINUX_PKG_KSYM="LINUX" -CT_LINUX_DIR_NAME="linux" -CT_LINUX_PKG_NAME="linux" -CT_LINUX_SRC_RELEASE=y -CT_LINUX_PATCH_ORDER="global" -# CT_LINUX_V_4_20 is not set -# CT_LINUX_V_4_19 is not set -# CT_LINUX_V_4_18 is not set -# CT_LINUX_V_4_17 is not set -# CT_LINUX_V_4_16 is not set -# CT_LINUX_V_4_15 is not set -# CT_LINUX_V_4_14 is not set -# CT_LINUX_V_4_13 is not set -# CT_LINUX_V_4_12 is not set -# CT_LINUX_V_4_11 is not set -# CT_LINUX_V_4_10 is not set -# CT_LINUX_V_4_9 is not set -# CT_LINUX_V_4_4 is not set -# CT_LINUX_V_4_1 is not set -# CT_LINUX_V_3_16 is not set -# CT_LINUX_V_3_13 is not set -# CT_LINUX_V_3_12 is not set -# CT_LINUX_V_3_10 is not set -# CT_LINUX_V_3_4 is not set -CT_LINUX_V_3_2=y -# CT_LINUX_V_2_6_32 is not set -# CT_LINUX_NO_VERSIONS is not set -CT_LINUX_VERSION="3.2.101" -CT_LINUX_MIRRORS="$(CT_Mirrors kernel.org linux ${CT_LINUX_VERSION})" -CT_LINUX_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LINUX_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_LINUX_SIGNATURE_FORMAT="unpacked/.sign" -CT_LINUX_4_8_or_older=y -CT_LINUX_older_than_4_8=y -CT_LINUX_3_7_or_older=y -CT_LINUX_older_than_3_7=y -CT_LINUX_later_than_3_2=y -CT_LINUX_3_2_or_later=y -CT_KERNEL_LINUX_VERBOSITY_0=y -# CT_KERNEL_LINUX_VERBOSITY_1 is not set -# CT_KERNEL_LINUX_VERBOSITY_2 is not set -CT_KERNEL_LINUX_VERBOSE_LEVEL=0 -CT_KERNEL_LINUX_INSTALL_CHECK=y -CT_ALL_KERNEL_CHOICES="BARE_METAL LINUX WINDOWS" - -# -# Common kernel options -# -CT_SHARED_LIBS=y - -# -# Binary utilities -# -CT_ARCH_BINFMT_ELF=y -CT_BINUTILS_BINUTILS=y -CT_BINUTILS="binutils" -CT_BINUTILS_CHOICE_KSYM="BINUTILS" -CT_BINUTILS_BINUTILS_SHOW=y - -# -# Options for binutils -# -CT_BINUTILS_BINUTILS_PKG_KSYM="BINUTILS" -CT_BINUTILS_DIR_NAME="binutils" -CT_BINUTILS_USE_GNU=y -CT_BINUTILS_USE="BINUTILS" -CT_BINUTILS_PKG_NAME="binutils" -CT_BINUTILS_SRC_RELEASE=y -CT_BINUTILS_PATCH_ORDER="global" -CT_BINUTILS_V_2_32=y -# CT_BINUTILS_V_2_31 is not set -# CT_BINUTILS_V_2_30 is not set -# CT_BINUTILS_V_2_29 is not set -# CT_BINUTILS_V_2_28 is not set -# CT_BINUTILS_V_2_27 is not set -# CT_BINUTILS_V_2_26 is not set -# CT_BINUTILS_NO_VERSIONS is not set -CT_BINUTILS_VERSION="2.32" -CT_BINUTILS_MIRRORS="$(CT_Mirrors GNU binutils) $(CT_Mirrors sourceware binutils/releases)" -CT_BINUTILS_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_BINUTILS_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_BINUTILS_SIGNATURE_FORMAT="packed/.sig" -CT_BINUTILS_later_than_2_30=y -CT_BINUTILS_2_30_or_later=y -CT_BINUTILS_later_than_2_27=y -CT_BINUTILS_2_27_or_later=y -CT_BINUTILS_later_than_2_25=y -CT_BINUTILS_2_25_or_later=y -CT_BINUTILS_later_than_2_23=y -CT_BINUTILS_2_23_or_later=y - -# -# GNU binutils -# -CT_BINUTILS_HAS_HASH_STYLE=y -CT_BINUTILS_HAS_GOLD=y -CT_BINUTILS_HAS_PLUGINS=y -CT_BINUTILS_HAS_PKGVERSION_BUGURL=y -CT_BINUTILS_FORCE_LD_BFD_DEFAULT=y -CT_BINUTILS_LINKER_LD=y -CT_BINUTILS_LINKERS_LIST="ld" -CT_BINUTILS_LINKER_DEFAULT="bfd" -# CT_BINUTILS_PLUGINS is not set -CT_BINUTILS_RELRO=m -CT_BINUTILS_EXTRA_CONFIG_ARRAY="" -# CT_BINUTILS_FOR_TARGET is not set -CT_ALL_BINUTILS_CHOICES="BINUTILS" - -# -# C-library -# -CT_LIBC_GLIBC=y -# CT_LIBC_NEWLIB is not set -# CT_LIBC_NONE is not set -# CT_LIBC_UCLIBC is not set -CT_LIBC="glibc" -CT_LIBC_CHOICE_KSYM="GLIBC" -CT_THREADS="nptl" -CT_LIBC_GLIBC_SHOW=y - -# -# Options for glibc -# -CT_LIBC_GLIBC_PKG_KSYM="GLIBC" -CT_GLIBC_DIR_NAME="glibc" -CT_GLIBC_USE_GNU=y -CT_GLIBC_USE="GLIBC" -CT_GLIBC_PKG_NAME="glibc" -CT_GLIBC_SRC_RELEASE=y -CT_GLIBC_PATCH_ORDER="global" -# CT_GLIBC_V_2_29 is not set -# CT_GLIBC_V_2_28 is not set -# CT_GLIBC_V_2_27 is not set -# CT_GLIBC_V_2_26 is not set -# CT_GLIBC_V_2_25 is not set -# CT_GLIBC_V_2_24 is not set -# CT_GLIBC_V_2_23 is not set -# CT_GLIBC_V_2_19 is not set -CT_GLIBC_V_2_17=y -# CT_GLIBC_V_2_12_1 is not set -# CT_GLIBC_NO_VERSIONS is not set -CT_GLIBC_VERSION="2.17" -CT_GLIBC_MIRRORS="$(CT_Mirrors GNU glibc)" -CT_GLIBC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GLIBC_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_GLIBC_SIGNATURE_FORMAT="packed/.sig" -CT_GLIBC_2_29_or_older=y -CT_GLIBC_older_than_2_29=y -CT_GLIBC_2_27_or_older=y -CT_GLIBC_older_than_2_27=y -CT_GLIBC_2_26_or_older=y -CT_GLIBC_older_than_2_26=y -CT_GLIBC_2_25_or_older=y -CT_GLIBC_older_than_2_25=y -CT_GLIBC_2_24_or_older=y -CT_GLIBC_older_than_2_24=y -CT_GLIBC_2_23_or_older=y -CT_GLIBC_older_than_2_23=y -CT_GLIBC_2_20_or_older=y -CT_GLIBC_older_than_2_20=y -CT_GLIBC_2_17_or_later=y -CT_GLIBC_2_17_or_older=y -CT_GLIBC_later_than_2_14=y -CT_GLIBC_2_14_or_later=y -CT_GLIBC_DEP_KERNEL_HEADERS_VERSION=y -CT_GLIBC_DEP_BINUTILS=y -CT_GLIBC_DEP_GCC=y -CT_GLIBC_DEP_PYTHON=y -CT_GLIBC_HAS_NPTL_ADDON=y -CT_GLIBC_HAS_PORTS_ADDON=y -CT_GLIBC_HAS_LIBIDN_ADDON=y -CT_GLIBC_USE_NPTL_ADDON=y -# CT_GLIBC_USE_LIBIDN_ADDON is not set -CT_GLIBC_HAS_OBSOLETE_RPC=y -CT_GLIBC_EXTRA_CONFIG_ARRAY="" -CT_GLIBC_CONFIGPARMS="" -CT_GLIBC_EXTRA_CFLAGS="" -CT_GLIBC_ENABLE_OBSOLETE_RPC=y -# CT_GLIBC_DISABLE_VERSIONING is not set -CT_GLIBC_OLDEST_ABI="" -CT_GLIBC_FORCE_UNWIND=y -# CT_GLIBC_LOCALES is not set -# CT_GLIBC_KERNEL_VERSION_NONE is not set -CT_GLIBC_KERNEL_VERSION_AS_HEADERS=y -# CT_GLIBC_KERNEL_VERSION_CHOSEN is not set -CT_GLIBC_MIN_KERNEL="3.2.101" -# CT_GLIBC_SSP_DEFAULT is not set -# CT_GLIBC_SSP_NO is not set -# CT_GLIBC_SSP_YES is not set -# CT_GLIBC_SSP_ALL is not set -# CT_GLIBC_SSP_STRONG is not set -# CT_NEWLIB_USE_REDHAT is not set -CT_ALL_LIBC_CHOICES="AVR_LIBC BIONIC GLIBC MINGW_W64 MOXIEBOX MUSL NEWLIB NONE UCLIBC" -CT_LIBC_SUPPORT_THREADS_ANY=y -CT_LIBC_SUPPORT_THREADS_NATIVE=y - -# -# Common C library options -# -CT_THREADS_NATIVE=y -# CT_CREATE_LDSO_CONF is not set -CT_LIBC_XLDD=y - -# -# C compiler -# -CT_CC_CORE_PASSES_NEEDED=y -CT_CC_CORE_PASS_1_NEEDED=y -CT_CC_CORE_PASS_2_NEEDED=y -CT_CC_SUPPORT_CXX=y -CT_CC_SUPPORT_FORTRAN=y -CT_CC_SUPPORT_ADA=y -CT_CC_SUPPORT_OBJC=y -CT_CC_SUPPORT_OBJCXX=y -CT_CC_SUPPORT_GOLANG=y -CT_CC_GCC=y -CT_CC="gcc" -CT_CC_CHOICE_KSYM="GCC" -CT_CC_GCC_SHOW=y - -# -# Options for gcc -# -CT_CC_GCC_PKG_KSYM="GCC" -CT_GCC_DIR_NAME="gcc" -CT_GCC_USE_GNU=y -CT_GCC_USE="GCC" -CT_GCC_PKG_NAME="gcc" -CT_GCC_SRC_RELEASE=y -CT_GCC_PATCH_ORDER="global" -CT_GCC_V_8=y -# CT_GCC_V_7 is not set -# CT_GCC_V_6 is not set -# CT_GCC_V_5 is not set -# CT_GCC_V_4_9 is not set -# CT_GCC_NO_VERSIONS is not set -CT_GCC_VERSION="8.3.0" -CT_GCC_MIRRORS="$(CT_Mirrors GNU gcc/gcc-${CT_GCC_VERSION}) $(CT_Mirrors sourceware gcc/releases/gcc-${CT_GCC_VERSION})" -CT_GCC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GCC_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_GCC_SIGNATURE_FORMAT="" -CT_GCC_later_than_7=y -CT_GCC_7_or_later=y -CT_GCC_later_than_6=y -CT_GCC_6_or_later=y -CT_GCC_later_than_5=y -CT_GCC_5_or_later=y -CT_GCC_later_than_4_9=y -CT_GCC_4_9_or_later=y -CT_GCC_later_than_4_8=y -CT_GCC_4_8_or_later=y -CT_CC_GCC_HAS_LIBMPX=y -CT_CC_GCC_ENABLE_CXX_FLAGS="" -CT_CC_GCC_CORE_EXTRA_CONFIG_ARRAY="" -CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-arch=z10" -CT_CC_GCC_STATIC_LIBSTDCXX=y -# CT_CC_GCC_SYSTEM_ZLIB is not set -CT_CC_GCC_CONFIG_TLS=m - -# -# Optimisation features -# -CT_CC_GCC_USE_GRAPHITE=y -CT_CC_GCC_USE_LTO=y - -# -# Settings for libraries running on target -# -CT_CC_GCC_ENABLE_TARGET_OPTSPACE=y -# CT_CC_GCC_LIBMUDFLAP is not set -# CT_CC_GCC_LIBGOMP is not set -# CT_CC_GCC_LIBSSP is not set -# CT_CC_GCC_LIBQUADMATH is not set -# CT_CC_GCC_LIBSANITIZER is not set - -# -# Misc. obscure options. -# -CT_CC_CXA_ATEXIT=y -# CT_CC_GCC_DISABLE_PCH is not set -CT_CC_GCC_SJLJ_EXCEPTIONS=m -CT_CC_GCC_LDBL_128=m -# CT_CC_GCC_BUILD_ID is not set -CT_CC_GCC_LNK_HASH_STYLE_DEFAULT=y -# CT_CC_GCC_LNK_HASH_STYLE_SYSV is not set -# CT_CC_GCC_LNK_HASH_STYLE_GNU is not set -# CT_CC_GCC_LNK_HASH_STYLE_BOTH is not set -CT_CC_GCC_LNK_HASH_STYLE="" -CT_CC_GCC_DEC_FLOAT_AUTO=y -# CT_CC_GCC_DEC_FLOAT_BID is not set -# CT_CC_GCC_DEC_FLOAT_DPD is not set -# CT_CC_GCC_DEC_FLOATS_NO is not set -CT_ALL_CC_CHOICES="GCC" - -# -# Additional supported languages: -# -CT_CC_LANG_CXX=y -# CT_CC_LANG_FORTRAN is not set - -# -# Debug facilities -# -# CT_DEBUG_DUMA is not set -# CT_DEBUG_GDB is not set -# CT_DEBUG_LTRACE is not set -# CT_DEBUG_STRACE is not set -CT_ALL_DEBUG_CHOICES="DUMA GDB LTRACE STRACE" - -# -# Companion libraries -# -# CT_COMPLIBS_CHECK is not set -# CT_COMP_LIBS_CLOOG is not set -# CT_COMP_LIBS_EXPAT is not set -CT_COMP_LIBS_GETTEXT=y -CT_COMP_LIBS_GETTEXT_PKG_KSYM="GETTEXT" -CT_GETTEXT_DIR_NAME="gettext" -CT_GETTEXT_PKG_NAME="gettext" -CT_GETTEXT_SRC_RELEASE=y -CT_GETTEXT_PATCH_ORDER="global" -CT_GETTEXT_V_0_19_8_1=y -# CT_GETTEXT_NO_VERSIONS is not set -CT_GETTEXT_VERSION="0.19.8.1" -CT_GETTEXT_MIRRORS="$(CT_Mirrors GNU gettext)" -CT_GETTEXT_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GETTEXT_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.gz" -CT_GETTEXT_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_GMP=y -CT_COMP_LIBS_GMP_PKG_KSYM="GMP" -CT_GMP_DIR_NAME="gmp" -CT_GMP_PKG_NAME="gmp" -CT_GMP_SRC_RELEASE=y -CT_GMP_PATCH_ORDER="global" -CT_GMP_V_6_1=y -# CT_GMP_NO_VERSIONS is not set -CT_GMP_VERSION="6.1.2" -CT_GMP_MIRRORS="https://gmplib.org/download/gmp https://gmplib.org/download/gmp/archive $(CT_Mirrors GNU gmp)" -CT_GMP_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_GMP_ARCHIVE_FORMATS=".tar.xz .tar.lz .tar.bz2" -CT_GMP_SIGNATURE_FORMAT="packed/.sig" -CT_GMP_later_than_5_1_0=y -CT_GMP_5_1_0_or_later=y -CT_GMP_later_than_5_0_0=y -CT_GMP_5_0_0_or_later=y -CT_GMP_REQUIRE_5_0_0_or_later=y -CT_COMP_LIBS_ISL=y -CT_COMP_LIBS_ISL_PKG_KSYM="ISL" -CT_ISL_DIR_NAME="isl" -CT_ISL_PKG_NAME="isl" -CT_ISL_SRC_RELEASE=y -CT_ISL_PATCH_ORDER="global" -CT_ISL_V_0_20=y -# CT_ISL_V_0_19 is not set -# CT_ISL_V_0_18 is not set -# CT_ISL_V_0_17 is not set -# CT_ISL_V_0_16 is not set -# CT_ISL_V_0_15 is not set -# CT_ISL_NO_VERSIONS is not set -CT_ISL_VERSION="0.20" -CT_ISL_MIRRORS="http://isl.gforge.inria.fr" -CT_ISL_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ISL_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz" -CT_ISL_SIGNATURE_FORMAT="" -CT_ISL_later_than_0_18=y -CT_ISL_0_18_or_later=y -CT_ISL_later_than_0_15=y -CT_ISL_0_15_or_later=y -CT_ISL_REQUIRE_0_15_or_later=y -CT_ISL_later_than_0_14=y -CT_ISL_0_14_or_later=y -CT_ISL_REQUIRE_0_14_or_later=y -CT_ISL_later_than_0_13=y -CT_ISL_0_13_or_later=y -CT_ISL_later_than_0_12=y -CT_ISL_0_12_or_later=y -CT_ISL_REQUIRE_0_12_or_later=y -# CT_COMP_LIBS_LIBELF is not set -CT_COMP_LIBS_LIBICONV=y -CT_COMP_LIBS_LIBICONV_PKG_KSYM="LIBICONV" -CT_LIBICONV_DIR_NAME="libiconv" -CT_LIBICONV_PKG_NAME="libiconv" -CT_LIBICONV_SRC_RELEASE=y -CT_LIBICONV_PATCH_ORDER="global" -CT_LIBICONV_V_1_15=y -# CT_LIBICONV_NO_VERSIONS is not set -CT_LIBICONV_VERSION="1.15" -CT_LIBICONV_MIRRORS="$(CT_Mirrors GNU libiconv)" -CT_LIBICONV_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_LIBICONV_ARCHIVE_FORMATS=".tar.gz" -CT_LIBICONV_SIGNATURE_FORMAT="packed/.sig" -CT_COMP_LIBS_MPC=y -CT_COMP_LIBS_MPC_PKG_KSYM="MPC" -CT_MPC_DIR_NAME="mpc" -CT_MPC_PKG_NAME="mpc" -CT_MPC_SRC_RELEASE=y -CT_MPC_PATCH_ORDER="global" -CT_MPC_V_1_1=y -# CT_MPC_V_1_0 is not set -# CT_MPC_NO_VERSIONS is not set -CT_MPC_VERSION="1.1.0" -CT_MPC_MIRRORS="http://www.multiprecision.org/downloads $(CT_Mirrors GNU mpc)" -CT_MPC_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPC_ARCHIVE_FORMATS=".tar.gz" -CT_MPC_SIGNATURE_FORMAT="packed/.sig" -CT_MPC_1_1_0_or_later=y -CT_MPC_1_1_0_or_older=y -CT_COMP_LIBS_MPFR=y -CT_COMP_LIBS_MPFR_PKG_KSYM="MPFR" -CT_MPFR_DIR_NAME="mpfr" -CT_MPFR_PKG_NAME="mpfr" -CT_MPFR_SRC_RELEASE=y -CT_MPFR_PATCH_ORDER="global" -CT_MPFR_V_4_0=y -# CT_MPFR_V_3_1 is not set -# CT_MPFR_NO_VERSIONS is not set -CT_MPFR_VERSION="4.0.2" -CT_MPFR_MIRRORS="http://www.mpfr.org/mpfr-${CT_MPFR_VERSION} $(CT_Mirrors GNU mpfr)" -CT_MPFR_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_MPFR_ARCHIVE_FORMATS=".tar.xz .tar.bz2 .tar.gz .zip" -CT_MPFR_SIGNATURE_FORMAT="packed/.asc" -CT_MPFR_later_than_4_0_0=y -CT_MPFR_4_0_0_or_later=y -CT_MPFR_later_than_3_0_0=y -CT_MPFR_3_0_0_or_later=y -CT_MPFR_REQUIRE_3_0_0_or_later=y -CT_COMP_LIBS_NCURSES=y -CT_COMP_LIBS_NCURSES_PKG_KSYM="NCURSES" -CT_NCURSES_DIR_NAME="ncurses" -CT_NCURSES_PKG_NAME="ncurses" -CT_NCURSES_SRC_RELEASE=y -CT_NCURSES_PATCH_ORDER="global" -CT_NCURSES_V_6_1=y -# CT_NCURSES_V_6_0 is not set -# CT_NCURSES_NO_VERSIONS is not set -CT_NCURSES_VERSION="6.1" -CT_NCURSES_MIRRORS="ftp://invisible-island.net/ncurses $(CT_Mirrors GNU ncurses)" -CT_NCURSES_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_NCURSES_ARCHIVE_FORMATS=".tar.gz" -CT_NCURSES_SIGNATURE_FORMAT="packed/.sig" -CT_NCURSES_HOST_CONFIG_ARGS="" -CT_NCURSES_HOST_DISABLE_DB=y -CT_NCURSES_HOST_FALLBACKS="linux,xterm,xterm-color,xterm-256color,vt100" -CT_NCURSES_TARGET_CONFIG_ARGS="" -# CT_NCURSES_TARGET_DISABLE_DB is not set -CT_NCURSES_TARGET_FALLBACKS="" -CT_COMP_LIBS_ZLIB=y -CT_COMP_LIBS_ZLIB_PKG_KSYM="ZLIB" -CT_ZLIB_DIR_NAME="zlib" -CT_ZLIB_PKG_NAME="zlib" -CT_ZLIB_SRC_RELEASE=y -CT_ZLIB_PATCH_ORDER="global" -CT_ZLIB_V_1_2_11=y -# CT_ZLIB_NO_VERSIONS is not set -CT_ZLIB_VERSION="1.2.11" -CT_ZLIB_MIRRORS="http://downloads.sourceforge.net/project/libpng/zlib/${CT_ZLIB_VERSION}" -CT_ZLIB_ARCHIVE_FILENAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_DIRNAME="@{pkg_name}-@{version}" -CT_ZLIB_ARCHIVE_FORMATS=".tar.xz .tar.gz" -CT_ZLIB_SIGNATURE_FORMAT="packed/.asc" -CT_ALL_COMP_LIBS_CHOICES="CLOOG EXPAT GETTEXT GMP ISL LIBELF LIBICONV MPC MPFR NCURSES ZLIB" -CT_LIBICONV_NEEDED=y -CT_GETTEXT_NEEDED=y -CT_GMP_NEEDED=y -CT_MPFR_NEEDED=y -CT_ISL_NEEDED=y -CT_MPC_NEEDED=y -CT_NCURSES_NEEDED=y -CT_ZLIB_NEEDED=y -CT_LIBICONV=y -CT_GETTEXT=y -CT_GMP=y -CT_MPFR=y -CT_ISL=y -CT_MPC=y -CT_NCURSES=y -CT_ZLIB=y - -# -# Companion tools -# -# CT_COMP_TOOLS_FOR_HOST is not set -# CT_COMP_TOOLS_AUTOCONF is not set -# CT_COMP_TOOLS_AUTOMAKE is not set -# CT_COMP_TOOLS_BISON is not set -# CT_COMP_TOOLS_DTC is not set -# CT_COMP_TOOLS_LIBTOOL is not set -# CT_COMP_TOOLS_M4 is not set -# CT_COMP_TOOLS_MAKE is not set -CT_ALL_COMP_TOOLS_CHOICES="AUTOCONF AUTOMAKE BISON DTC LIBTOOL M4 MAKE" diff --git a/src/ci/docker/host-x86_64/dist-s390x-linux/s390x-linux-gnu.defconfig b/src/ci/docker/host-x86_64/dist-s390x-linux/s390x-linux-gnu.defconfig new file mode 100644 index 0000000000000..1fe21966600bb --- /dev/null +++ b/src/ci/docker/host-x86_64/dist-s390x-linux/s390x-linux-gnu.defconfig @@ -0,0 +1,13 @@ +CT_CONFIG_VERSION="4" +CT_PREFIX_DIR="/x-tools/${CT_TARGET}" +CT_USE_MIRROR=y +CT_MIRROR_BASE_URL="https://ci-mirrors.rust-lang.org/rustc" +CT_ARCH_S390=y +CT_ARCH_64=y +CT_KERNEL_LINUX=y +CT_LINUX_V_3_2=y +CT_BINUTILS_V_2_32=y +CT_GLIBC_V_2_17=y +CT_GCC_V_8=y +CT_CC_GCC_EXTRA_CONFIG_ARRAY="--with-arch=z10" +CT_CC_LANG_CXX=y diff --git a/src/ci/docker/scripts/crosstool-ng-1.24.sh b/src/ci/docker/scripts/crosstool-ng-1.24.sh deleted file mode 100644 index 3a40f6cddb369..0000000000000 --- a/src/ci/docker/scripts/crosstool-ng-1.24.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -ex - -# Mirrored from https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.24.0.tar.gz -url="https://ci-mirrors.rust-lang.org/rustc/crosstool-ng-1.24.0.tar.gz" -curl -Lf $url | tar xzf - -cd crosstool-ng-crosstool-ng-1.24.0 -./bootstrap -./configure --prefix=/usr/local -make -j$(nproc) -make install -cd .. -rm -rf crosstool-ng-crosstool-ng-1.24.0 diff --git a/src/ci/docker/host-x86_64/dist-armhf-linux/build-toolchains.sh b/src/ci/docker/scripts/crosstool-ng-build.sh similarity index 78% rename from src/ci/docker/host-x86_64/dist-armhf-linux/build-toolchains.sh rename to src/ci/docker/scripts/crosstool-ng-build.sh index 6b5374422a62a..c813d10eb9d2b 100755 --- a/src/ci/docker/host-x86_64/dist-armhf-linux/build-toolchains.sh +++ b/src/ci/docker/scripts/crosstool-ng-build.sh @@ -2,6 +2,10 @@ set -ex +if [ $UID -eq 0 ]; then + exec su rustbuild -c "$0" +fi + hide_output() { set +x on_err=" @@ -21,9 +25,8 @@ exit 1 mkdir build cd build -cp ../arm-linux-gnueabihf.config .config -# FIXME ct-ng oldconfig is not working as intended. -# ct-ng oldconfig +cp ../crosstool.defconfig .config +ct-ng olddefconfig hide_output ct-ng build cd .. rm -rf build diff --git a/src/ci/docker/scripts/crosstool-ng.sh b/src/ci/docker/scripts/crosstool-ng.sh index 1d0c28c8e5824..a28d7bde2accf 100644 --- a/src/ci/docker/scripts/crosstool-ng.sh +++ b/src/ci/docker/scripts/crosstool-ng.sh @@ -1,12 +1,19 @@ #!/bin/sh set -ex -url="https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.22.0.tar.gz" +CT_NG=1.25.0 + +url="https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-$CT_NG.tar.gz" curl -Lf $url | tar xzf - -cd crosstool-ng-crosstool-ng-1.22.0 +cd crosstool-ng-crosstool-ng-$CT_NG + +# https://github.com/crosstool-ng/crosstool-ng/issues/1832 +# "download source of zlib is invalid now" +sed -e "s|zlib.net/'|zlib.net/fossils'|" -i packages/zlib/package.desc + ./bootstrap ./configure --prefix=/usr/local make -j$(nproc) make install cd .. -rm -rf crosstool-ng-crosstool-ng-1.22.0 +rm -rf crosstool-ng-crosstool-ng-$CT_NG diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index 8409b9ca56993..5661adf677625 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -73,6 +73,10 @@ x--expand-yaml-anchors--remove: - &base-job env: {} + - &job-linux-4c + os: ubuntu-20.04-4core-16gb + <<: *base-job + - &job-linux-8c os: ubuntu-20.04-8core-32gb <<: *base-job @@ -416,13 +420,13 @@ jobs: <<: *job-linux-8c - name: i686-gnu - <<: *job-linux-16c + <<: *job-linux-8c - name: i686-gnu-nopt - <<: *job-linux-16c + <<: *job-linux-8c - name: mingw-check - <<: *job-linux-8c + <<: *job-linux-4c - name: test-various <<: *job-linux-8c @@ -431,7 +435,7 @@ jobs: <<: *job-linux-8c - name: x86_64-gnu - <<: *job-linux-8c + <<: *job-linux-4c # This job ensures commits landing on nightly still pass the full # test suite on the stable channel. There are some UI tests that @@ -446,10 +450,10 @@ jobs: # could cause failures when `dev: 1` in `stage0.txt`, and running # this on stable is useless. CI_ONLY_WHEN_CHANNEL: nightly - <<: *job-linux-8c + <<: *job-linux-4c - name: x86_64-gnu-aux - <<: *job-linux-8c + <<: *job-linux-4c - name: x86_64-gnu-debug <<: *job-linux-8c @@ -478,7 +482,7 @@ jobs: <<: *job-linux-8c - name: x86_64-gnu-nopt - <<: *job-linux-8c + <<: *job-linux-4c - name: x86_64-gnu-tools env: diff --git a/src/doc/unstable-book/src/language-features/debugger-visualizer.md b/src/doc/unstable-book/src/language-features/debugger-visualizer.md deleted file mode 100644 index c7a0414b67602..0000000000000 --- a/src/doc/unstable-book/src/language-features/debugger-visualizer.md +++ /dev/null @@ -1,27 +0,0 @@ -# `debugger_visualizer` - -The tracking issue for this feature is: [#95939] - -[#95939]: https://github.com/rust-lang/rust/issues/95939 - ------------------------- - -The `debugger_visualizer` attribute can be used to instruct the compiler -to embed a debugger visualizer file into the PDB/ELF generated by `rustc`. - -## Examples - -``` rust,ignore (partial-example) -#![feature(debugger_visualizer)] -#![debugger_visualizer(natvis_file = "foo.natvis")] -#![debugger_visualizer(gdb_script_file = "foo.py")] -struct Foo { - -} -``` - -## Limitations - -Currently, this feature only supports embedding Natvis files on `-windows-msvc` -targets via the `natvis_file` meta item. `-windows-gnu` targets are not currently -supported. diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index b579e7f5ae9ca..dfa4b091b0164 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -382,7 +382,7 @@ impl Options { match kind.parse() { Ok(kind) => emit.push(kind), Err(()) => { - diag.err(&format!("unrecognized emission type: {}", kind)); + diag.err(format!("unrecognized emission type: {}", kind)); return Err(1); } } @@ -559,28 +559,28 @@ impl Options { matches.opt_strs("theme").iter().map(|s| (PathBuf::from(&s), s.to_owned())) { if !theme_file.is_file() { - diag.struct_err(&format!("invalid argument: \"{}\"", theme_s)) + diag.struct_err(format!("invalid argument: \"{}\"", theme_s)) .help("arguments to --theme must be files") .emit(); return Err(1); } if theme_file.extension() != Some(OsStr::new("css")) { - diag.struct_err(&format!("invalid argument: \"{}\"", theme_s)) + diag.struct_err(format!("invalid argument: \"{}\"", theme_s)) .help("arguments to --theme must have a .css extension") .emit(); return Err(1); } let (success, ret) = theme::test_theme_against(&theme_file, &paths, &diag); if !success { - diag.struct_err(&format!("error loading theme file: \"{}\"", theme_s)).emit(); + diag.struct_err(format!("error loading theme file: \"{}\"", theme_s)).emit(); return Err(1); } else if !ret.is_empty() { - diag.struct_warn(&format!( + diag.struct_warn(format!( "theme file \"{}\" is missing CSS rules from the default theme", theme_s )) .warn("the theme may appear incorrect when loaded") - .help(&format!( + .help(format!( "to see what rules are missing, call `rustdoc --check-theme \"{}\"`", theme_s )) @@ -611,7 +611,7 @@ impl Options { match matches.opt_str("r").as_deref() { Some("rust") | None => {} Some(s) => { - diag.struct_err(&format!("unknown input format: {}", s)).emit(); + diag.struct_err(format!("unknown input format: {}", s)).emit(); return Err(1); } } @@ -631,7 +631,7 @@ impl Options { let crate_types = match parse_crate_types_from_list(matches.opt_strs("crate-type")) { Ok(types) => types, Err(e) => { - diag.struct_err(&format!("unknown crate type: {}", e)).emit(); + diag.struct_err(format!("unknown crate type: {}", e)).emit(); return Err(1); } }; @@ -649,7 +649,7 @@ impl Options { out_fmt } Err(e) => { - diag.struct_err(&e).emit(); + diag.struct_err(e).emit(); return Err(1); } }, @@ -790,7 +790,7 @@ fn check_deprecated_options(matches: &getopts::Matches, diag: &rustc_errors::Han for &flag in deprecated_flags.iter() { if matches.opt_present(flag) { - diag.struct_warn(&format!("the `{}` flag is deprecated", flag)) + diag.struct_warn(format!("the `{}` flag is deprecated", flag)) .note( "see issue #44136 \ for more information", @@ -803,7 +803,7 @@ fn check_deprecated_options(matches: &getopts::Matches, diag: &rustc_errors::Han for &flag in removed_flags.iter() { if matches.opt_present(flag) { - let mut err = diag.struct_warn(&format!("the `{}` flag no longer functions", flag)); + let mut err = diag.struct_warn(format!("the `{}` flag no longer functions", flag)); err.note( "see issue #44136 \ for more information", diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 3a0c2ab02975a..a6be132337eb6 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -383,7 +383,7 @@ pub(crate) fn run_global_ctxt( fn report_deprecated_attr(name: &str, diag: &rustc_errors::Handler, sp: Span) { let mut msg = - diag.struct_span_warn(sp, &format!("the `#![doc({})]` attribute is deprecated", name)); + diag.struct_span_warn(sp, format!("the `#![doc({})]` attribute is deprecated", name)); msg.note( "see issue #44136 \ for more information", diff --git a/src/librustdoc/externalfiles.rs b/src/librustdoc/externalfiles.rs index 37fd909c93342..88049c4ca0051 100644 --- a/src/librustdoc/externalfiles.rs +++ b/src/librustdoc/externalfiles.rs @@ -83,14 +83,14 @@ pub(crate) fn load_string>( let contents = match fs::read(file_path) { Ok(bytes) => bytes, Err(e) => { - diag.struct_err(&format!("error reading `{}`: {}", file_path.display(), e)).emit(); + diag.struct_err(format!("error reading `{}`: {}", file_path.display(), e)).emit(); return Err(LoadStringError::ReadFail); } }; match str::from_utf8(&contents) { Ok(s) => Ok(s.to_string()), Err(_) => { - diag.struct_err(&format!("error reading `{}`: not UTF-8", file_path.display())).emit(); + diag.struct_err(format!("error reading `{}`: not UTF-8", file_path.display())).emit(); Err(LoadStringError::BadUtf8) } } diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 1b445b8981e1a..297120da284b9 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -167,7 +167,7 @@ pub(crate) fn print_generic_bounds<'a, 'tcx: 'a>( display_fn(move |f| { let mut bounds_dup = FxHashSet::default(); - for (i, bound) in bounds.iter().filter(|b| bounds_dup.insert(b.clone())).enumerate() { + for (i, bound) in bounds.iter().filter(|b| bounds_dup.insert(*b)).enumerate() { if i > 0 { f.write_str(" + ")?; } diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs index a063c8c9f02dd..01a92f6df6a0c 100644 --- a/src/librustdoc/html/render/context.rs +++ b/src/librustdoc/html/render/context.rs @@ -746,7 +746,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { // Flush pending errors. Rc::get_mut(&mut self.shared).unwrap().fs.close(); let nb_errors = - self.shared.errors.iter().map(|err| self.tcx().sess.struct_err(&err).emit()).count(); + self.shared.errors.iter().map(|err| self.tcx().sess.struct_err(err).emit()).count(); if nb_errors > 0 { Err(Error::new(io::Error::new(io::ErrorKind::Other, "I/O error"), "")) } else { diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 73bf27c9d3449..e09c6480060d0 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2256,8 +2256,7 @@ fn render_call_locations(mut w: W, cx: &mut Context<'_>, item: &c Ok(contents) => contents, Err(err) => { let span = item.span(tcx).map_or(rustc_span::DUMMY_SP, |span| span.inner()); - tcx.sess - .span_err(span, &format!("failed to read file {}: {}", path.display(), err)); + tcx.sess.span_err(span, format!("failed to read file {}: {}", path.display(), err)); return false; } }; diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs index c8397967c8791..a26fa37491296 100644 --- a/src/librustdoc/html/sources.rs +++ b/src/librustdoc/html/sources.rs @@ -145,7 +145,7 @@ impl DocVisitor for SourceCollector<'_, '_> { Err(e) => { self.cx.shared.tcx.sess.span_err( span, - &format!( + format!( "failed to render source code for `{}`: {}", filename.prefer_local(), e, diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 66080f64b9c21..263ce3d93b9fd 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -677,7 +677,7 @@ fn wrap_return(diag: &rustc_errors::Handler, res: Result<(), String>) -> MainRes match res { Ok(()) => diag.has_errors().map_or(Ok(()), Err), Err(err) => { - let reported = diag.struct_err(&err).emit(); + let reported = diag.struct_err(err).emit(); Err(reported) } } @@ -693,10 +693,10 @@ fn run_renderer<'tcx, T: formats::FormatRenderer<'tcx>>( Ok(_) => tcx.sess.has_errors().map_or(Ok(()), Err), Err(e) => { let mut msg = - tcx.sess.struct_err(&format!("couldn't generate documentation: {}", e.error)); + tcx.sess.struct_err(format!("couldn't generate documentation: {}", e.error)); let file = e.file.display().to_string(); if !file.is_empty() { - msg.note(&format!("failed to create or modify \"{}\"", file)); + msg.note(format!("failed to create or modify \"{}\"", file)); } Err(msg.emit()) } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 7e173a171a83a..a885ff0ca5e58 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1179,9 +1179,9 @@ impl LinkCollector<'_, '_> { specified.descr(), ); if let Some(sp) = sp { - diag.span_label(sp, ¬e); + diag.span_label(sp, note); } else { - diag.note(¬e); + diag.note(note); } suggest_disambiguator(resolved, diag, path_str, &ori_link.link, sp); }; @@ -1617,7 +1617,7 @@ fn report_diagnostic( let line = dox[last_new_line_offset..].lines().next().unwrap_or(""); // Print the line containing the `link_range` and manually mark it with '^'s. - lint.note(&format!( + lint.note(format!( "the link appears in this line:\n\n{line}\n\ {indicator: { let note = assoc_item_not_allowed(res); if let Some(span) = sp { - diag.span_label(span, ¬e); + diag.span_label(span, note); } else { - diag.note(¬e); + diag.note(note); } return; } @@ -1834,9 +1834,9 @@ fn resolution_failure( unresolved, ); if let Some(span) = sp { - diag.span_label(span, ¬e); + diag.span_label(span, note); } else { - diag.note(¬e); + diag.note(note); } continue; @@ -1854,9 +1854,9 @@ fn resolution_failure( } }; if let Some(span) = sp { - diag.span_label(span, ¬e); + diag.span_label(span, note); } else { - diag.note(¬e); + diag.note(note); } } }, @@ -1906,7 +1906,7 @@ fn disambiguator_error( "see {}/rustdoc/write-documentation/linking-to-items-by-name.html#namespaces-and-disambiguators for more info about disambiguators", crate::DOC_RUST_LANG_ORG_CHANNEL ); - diag.note(&msg); + diag.note(msg); }); } @@ -2023,13 +2023,13 @@ fn suggest_disambiguator( if let Some(sp) = sp { let mut spans = suggestion.as_help_span(path_str, ori_link, sp); if spans.len() > 1 { - diag.multipart_suggestion(&help, spans, Applicability::MaybeIncorrect); + diag.multipart_suggestion(help, spans, Applicability::MaybeIncorrect); } else { let (sp, suggestion_text) = spans.pop().unwrap(); - diag.span_suggestion_verbose(sp, &help, suggestion_text, Applicability::MaybeIncorrect); + diag.span_suggestion_verbose(sp, help, suggestion_text, Applicability::MaybeIncorrect); } } else { - diag.help(&format!("{}: {}", help, suggestion.as_help(path_str))); + diag.help(format!("{}: {}", help, suggestion.as_help(path_str))); } } diff --git a/src/librustdoc/passes/lint/check_code_block_syntax.rs b/src/librustdoc/passes/lint/check_code_block_syntax.rs index 26fbb03a43e69..8f873dbe50131 100644 --- a/src/librustdoc/passes/lint/check_code_block_syntax.rs +++ b/src/librustdoc/passes/lint/check_code_block_syntax.rs @@ -108,7 +108,7 @@ fn check_rust_syntax( // just give a `help` instead. lint.span_help( sp.from_inner(InnerSpan::new(0, 3)), - &format!("{}: ```text", explanation), + format!("{}: ```text", explanation), ); } else if empty_block { lint.span_suggestion( @@ -119,12 +119,12 @@ fn check_rust_syntax( ); } } else if empty_block || is_ignore { - lint.help(&format!("{}: ```text", explanation)); + lint.help(format!("{}: ```text", explanation)); } // FIXME(#67563): Provide more context for these errors by displaying the spans inline. for message in buffer.messages.iter() { - lint.note(message); + lint.note(message.clone()); } lint diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index dfa99ffcb7c7d..d2fa7769bbd2f 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -331,7 +331,7 @@ pub(crate) fn run( }; if let Err(e) = inner() { - tcx.sess.fatal(&e); + tcx.sess.fatal(e); } Ok(()) @@ -358,7 +358,7 @@ pub(crate) fn load_call_locations( }; inner().map_err(|e: String| { - diag.err(&format!("failed to load examples: {}", e)); + diag.err(format!("failed to load examples: {}", e)); 1 }) } diff --git a/src/librustdoc/theme.rs b/src/librustdoc/theme.rs index e7a26cb346ee6..722e01cd1fc72 100644 --- a/src/librustdoc/theme.rs +++ b/src/librustdoc/theme.rs @@ -241,7 +241,7 @@ pub(crate) fn test_theme_against>( { Ok(c) => c, Err(e) => { - diag.struct_err(&e).emit(); + diag.struct_err(e).emit(); return (false, vec![]); } }; diff --git a/src/tools/cargo b/src/tools/cargo index 9e586fbd8b931..ac84010322a31 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 9e586fbd8b931494067144623b76c37d213b1ab6 +Subproject commit ac84010322a31f4a581dafe26258aa4ac8dea9cd diff --git a/src/tools/clippy/clippy_lints/src/declared_lints.rs b/src/tools/clippy/clippy_lints/src/declared_lints.rs index 0c66d36a1d630..fa726a649370e 100644 --- a/src/tools/clippy/clippy_lints/src/declared_lints.rs +++ b/src/tools/clippy/clippy_lints/src/declared_lints.rs @@ -313,7 +313,6 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[ crate::methods::CHARS_NEXT_CMP_INFO, crate::methods::CLEAR_WITH_DRAIN_INFO, crate::methods::CLONED_INSTEAD_OF_COPIED_INFO, - crate::methods::CLONE_DOUBLE_REF_INFO, crate::methods::CLONE_ON_COPY_INFO, crate::methods::CLONE_ON_REF_PTR_INFO, crate::methods::COLLAPSIBLE_STR_REPLACE_INFO, diff --git a/src/tools/clippy/clippy_lints/src/future_not_send.rs b/src/tools/clippy/clippy_lints/src/future_not_send.rs index ff838c2d56e43..d1314795f5803 100644 --- a/src/tools/clippy/clippy_lints/src/future_not_send.rs +++ b/src/tools/clippy/clippy_lints/src/future_not_send.rs @@ -96,7 +96,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend { if let PredicateKind::Clause(Clause::Trait(trait_pred)) = obligation.predicate.kind().skip_binder() { - db.note(&format!( + db.note(format!( "`{}` doesn't implement `{}`", trait_pred.self_ty(), trait_pred.trait_ref.print_only_trait_path(), diff --git a/src/tools/clippy/clippy_lints/src/lib.rs b/src/tools/clippy/clippy_lints/src/lib.rs index 573ffe349ec23..9e65f9ecd1664 100644 --- a/src/tools/clippy/clippy_lints/src/lib.rs +++ b/src/tools/clippy/clippy_lints/src/lib.rs @@ -353,7 +353,7 @@ pub fn register_pre_expansion_lints(store: &mut rustc_lint::LintStore, sess: &Se pub fn read_conf(sess: &Session, path: &io::Result<(Option, Vec)>) -> Conf { if let Ok((_, warnings)) = path { for warning in warnings { - sess.warn(warning); + sess.warn(warning.clone()); } } let file_name = match path { diff --git a/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs b/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs index 3795c0ec25098..65fd50dff5846 100644 --- a/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs +++ b/src/tools/clippy/clippy_lints/src/methods/clone_on_copy.rs @@ -1,7 +1,6 @@ -use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then}; +use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::get_parent_node; use clippy_utils::source::snippet_with_context; -use clippy_utils::sugg; use clippy_utils::ty::is_copy; use rustc_errors::Applicability; use rustc_hir::{BindingAnnotation, ByRef, Expr, ExprKind, MatchSource, Node, PatKind, QPath}; @@ -9,7 +8,6 @@ use rustc_lint::LateContext; use rustc_middle::ty::{self, adjustment::Adjust, print::with_forced_trimmed_paths}; use rustc_span::symbol::{sym, Symbol}; -use super::CLONE_DOUBLE_REF; use super::CLONE_ON_COPY; /// Checks for the `CLONE_ON_COPY` lint. @@ -42,41 +40,7 @@ pub(super) fn check( let ty = cx.typeck_results().expr_ty(expr); if let ty::Ref(_, inner, _) = arg_ty.kind() { - if let ty::Ref(_, innermost, _) = inner.kind() { - span_lint_and_then( - cx, - CLONE_DOUBLE_REF, - expr.span, - &with_forced_trimmed_paths!(format!( - "using `clone` on a double-reference; \ - this will copy the reference of type `{ty}` instead of cloning the inner type" - )), - |diag| { - if let Some(snip) = sugg::Sugg::hir_opt(cx, arg) { - let mut ty = innermost; - let mut n = 0; - while let ty::Ref(_, inner, _) = ty.kind() { - ty = inner; - n += 1; - } - let refs = "&".repeat(n + 1); - let derefs = "*".repeat(n); - let explicit = with_forced_trimmed_paths!(format!("<{refs}{ty}>::clone({snip})")); - diag.span_suggestion( - expr.span, - "try dereferencing it", - with_forced_trimmed_paths!(format!("{refs}({derefs}{}).clone()", snip.deref())), - Applicability::MaybeIncorrect, - ); - diag.span_suggestion( - expr.span, - "or try being explicit if you are sure, that you want to clone a reference", - explicit, - Applicability::MaybeIncorrect, - ); - } - }, - ); + if let ty::Ref(..) = inner.kind() { return; // don't report clone_on_copy } } diff --git a/src/tools/clippy/clippy_lints/src/methods/mod.rs b/src/tools/clippy/clippy_lints/src/methods/mod.rs index 9cafbc2e5f5a6..e4a659d3ce73c 100644 --- a/src/tools/clippy/clippy_lints/src/methods/mod.rs +++ b/src/tools/clippy/clippy_lints/src/methods/mod.rs @@ -984,29 +984,6 @@ declare_clippy_lint! { "using 'clone' on a ref-counted pointer" } -declare_clippy_lint! { - /// ### What it does - /// Checks for usage of `.clone()` on an `&&T`. - /// - /// ### Why is this bad? - /// Cloning an `&&T` copies the inner `&T`, instead of - /// cloning the underlying `T`. - /// - /// ### Example - /// ```rust - /// fn main() { - /// let x = vec![1]; - /// let y = &&x; - /// let z = y.clone(); - /// println!("{:p} {:p}", *y, z); // prints out the same pointer - /// } - /// ``` - #[clippy::version = "pre 1.29.0"] - pub CLONE_DOUBLE_REF, - correctness, - "using `clone` on `&&T`" -} - declare_clippy_lint! { /// ### What it does /// Checks for usage of `.to_string()` on an `&&T` where @@ -3258,7 +3235,6 @@ impl_lint_pass!(Methods => [ CHARS_LAST_CMP, CLONE_ON_COPY, CLONE_ON_REF_PTR, - CLONE_DOUBLE_REF, COLLAPSIBLE_STR_REPLACE, ITER_OVEREAGER_CLONED, CLONED_INSTEAD_OF_COPIED, diff --git a/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs b/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs index d00708e828eae..91f7ce1dbe58e 100644 --- a/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs +++ b/src/tools/clippy/clippy_lints/src/methods/str_splitn.rs @@ -175,13 +175,13 @@ fn check_manual_split_once_indirect( let remove_msg = format!("remove the `{iter_ident}` usages"); diag.span_suggestion( first.span, - &remove_msg, + remove_msg.clone(), "", app, ); diag.span_suggestion( second.span, - &remove_msg, + remove_msg, "", app, ); diff --git a/src/tools/clippy/clippy_lints/src/non_send_fields_in_send_ty.rs b/src/tools/clippy/clippy_lints/src/non_send_fields_in_send_ty.rs index 839c3a3815c29..7eaa7db78a470 100644 --- a/src/tools/clippy/clippy_lints/src/non_send_fields_in_send_ty.rs +++ b/src/tools/clippy/clippy_lints/src/non_send_fields_in_send_ty.rs @@ -131,13 +131,13 @@ impl<'tcx> LateLintPass<'tcx> for NonSendFieldInSendTy { for field in non_send_fields { diag.span_note( field.def.span, - &format!("it is not safe to send field `{}` to another thread", field.def.ident.name), + format!("it is not safe to send field `{}` to another thread", field.def.ident.name), ); match field.generic_params.len() { 0 => diag.help("use a thread-safe type that implements `Send`"), - 1 if is_ty_param(field.ty) => diag.help(&format!("add `{}: Send` bound in `Send` impl", field.ty)), - _ => diag.help(&format!( + 1 if is_ty_param(field.ty) => diag.help(format!("add `{}: Send` bound in `Send` impl", field.ty)), + _ => diag.help(format!( "add bounds on type parameter{} `{}` that satisfy `{}: Send`", if field.generic_params.len() > 1 { "s" } else { "" }, field.generic_params_string(), diff --git a/src/tools/clippy/clippy_lints/src/renamed_lints.rs b/src/tools/clippy/clippy_lints/src/renamed_lints.rs index 9f487dedb8cb6..5e81a01a461ab 100644 --- a/src/tools/clippy/clippy_lints/src/renamed_lints.rs +++ b/src/tools/clippy/clippy_lints/src/renamed_lints.rs @@ -30,6 +30,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[ ("clippy::stutter", "clippy::module_name_repetitions"), ("clippy::to_string_in_display", "clippy::recursive_format_impl"), ("clippy::zero_width_space", "clippy::invisible_characters"), + ("clippy::clone_double_ref", "suspicious_double_ref_op"), ("clippy::drop_bounds", "drop_bounds"), ("clippy::for_loop_over_option", "for_loops_over_fallibles"), ("clippy::for_loop_over_result", "for_loops_over_fallibles"), diff --git a/src/tools/clippy/clippy_utils/src/attrs.rs b/src/tools/clippy/clippy_utils/src/attrs.rs index b4ad42a50279f..49cb9718ef66e 100644 --- a/src/tools/clippy/clippy_utils/src/attrs.rs +++ b/src/tools/clippy/clippy_utils/src/attrs.rs @@ -133,7 +133,7 @@ pub fn get_unique_attr<'a>( let mut unique_attr: Option<&ast::Attribute> = None; for attr in get_attr(sess, attrs, name) { if let Some(duplicate) = unique_attr { - sess.struct_span_err(attr.span, &format!("`{name}` is defined multiple times")) + sess.struct_span_err(attr.span, format!("`{name}` is defined multiple times")) .span_note(duplicate.span, "first definition found here") .emit(); } else { diff --git a/src/tools/clippy/clippy_utils/src/sugg.rs b/src/tools/clippy/clippy_utils/src/sugg.rs index e81eadceec0aa..03cd8e48b9a55 100644 --- a/src/tools/clippy/clippy_utils/src/sugg.rs +++ b/src/tools/clippy/clippy_utils/src/sugg.rs @@ -163,7 +163,8 @@ impl<'a> Sugg<'a> { get_snippet(rhs.span), ), hir::ExprKind::Cast(lhs, ty) => Sugg::BinOp(AssocOp::As, get_snippet(lhs.span), get_snippet(ty.span)), - hir::ExprKind::Type(lhs, ty) => Sugg::BinOp(AssocOp::Colon, get_snippet(lhs.span), get_snippet(ty.span)), + //FIXME(chenyukang), remove this after type ascription is removed from AST + hir::ExprKind::Type(lhs, ty) => Sugg::BinOp(AssocOp::As, get_snippet(lhs.span), get_snippet(ty.span)), } } @@ -258,8 +259,9 @@ impl<'a> Sugg<'a> { snippet_with_context(cx, lhs.span, ctxt, default, app).0, snippet_with_context(cx, ty.span, ctxt, default, app).0, ), + //FIXME(chenyukang), remove this after type ascription is removed from AST ast::ExprKind::Type(ref lhs, ref ty) => Sugg::BinOp( - AssocOp::Colon, + AssocOp::As, snippet_with_context(cx, lhs.span, ctxt, default, app).0, snippet_with_context(cx, ty.span, ctxt, default, app).0, ), @@ -392,7 +394,6 @@ fn binop_to_string(op: AssocOp, lhs: &str, rhs: &str) -> String { AssocOp::As => format!("{lhs} as {rhs}"), AssocOp::DotDot => format!("{lhs}..{rhs}"), AssocOp::DotDotEq => format!("{lhs}..={rhs}"), - AssocOp::Colon => format!("{lhs}: {rhs}"), } } @@ -602,13 +603,13 @@ enum Associativity { #[must_use] fn associativity(op: AssocOp) -> Associativity { use rustc_ast::util::parser::AssocOp::{ - Add, As, Assign, AssignOp, BitAnd, BitOr, BitXor, Colon, Divide, DotDot, DotDotEq, Equal, Greater, + Add, As, Assign, AssignOp, BitAnd, BitOr, BitXor, Divide, DotDot, DotDotEq, Equal, Greater, GreaterEqual, LAnd, LOr, Less, LessEqual, Modulus, Multiply, NotEqual, ShiftLeft, ShiftRight, Subtract, }; match op { Assign | AssignOp(_) => Associativity::Right, - Add | BitAnd | BitOr | BitXor | LAnd | LOr | Multiply | As | Colon => Associativity::Both, + Add | BitAnd | BitOr | BitXor | LAnd | LOr | Multiply | As => Associativity::Both, Divide | Equal | Greater | GreaterEqual | Less | LessEqual | Modulus | NotEqual | ShiftLeft | ShiftRight | Subtract => Associativity::Left, DotDot | DotDotEq => Associativity::None, diff --git a/src/tools/clippy/tests/ui/explicit_deref_methods.fixed b/src/tools/clippy/tests/ui/explicit_deref_methods.fixed index 77e9f5fc1fdf1..60482c66da7c4 100644 --- a/src/tools/clippy/tests/ui/explicit_deref_methods.fixed +++ b/src/tools/clippy/tests/ui/explicit_deref_methods.fixed @@ -3,7 +3,7 @@ #![allow(unused_variables)] #![allow( clippy::borrow_deref_ref, - clippy::clone_double_ref, + suspicious_double_ref_op, clippy::explicit_auto_deref, clippy::needless_borrow, clippy::uninlined_format_args diff --git a/src/tools/clippy/tests/ui/explicit_deref_methods.rs b/src/tools/clippy/tests/ui/explicit_deref_methods.rs index 0c2cc7c2c3a6a..e3613e216bb22 100644 --- a/src/tools/clippy/tests/ui/explicit_deref_methods.rs +++ b/src/tools/clippy/tests/ui/explicit_deref_methods.rs @@ -3,7 +3,7 @@ #![allow(unused_variables)] #![allow( clippy::borrow_deref_ref, - clippy::clone_double_ref, + suspicious_double_ref_op, clippy::explicit_auto_deref, clippy::needless_borrow, clippy::uninlined_format_args diff --git a/src/tools/clippy/tests/ui/rename.fixed b/src/tools/clippy/tests/ui/rename.fixed index e8a00a9e7f712..ff19a042825d8 100644 --- a/src/tools/clippy/tests/ui/rename.fixed +++ b/src/tools/clippy/tests/ui/rename.fixed @@ -36,6 +36,7 @@ #![allow(enum_intrinsics_non_enums)] #![allow(non_fmt_panics)] #![allow(named_arguments_used_positionally)] +#![allow(suspicious_double_ref_op)] #![allow(temporary_cstring_as_ptr)] #![allow(unknown_lints)] #![allow(unused_labels)] @@ -67,6 +68,7 @@ #![warn(clippy::module_name_repetitions)] #![warn(clippy::recursive_format_impl)] #![warn(clippy::invisible_characters)] +#![warn(suspicious_double_ref_op)] #![warn(drop_bounds)] #![warn(for_loops_over_fallibles)] #![warn(for_loops_over_fallibles)] diff --git a/src/tools/clippy/tests/ui/rename.rs b/src/tools/clippy/tests/ui/rename.rs index c8ea70c2bcb1d..38b1647c0cca0 100644 --- a/src/tools/clippy/tests/ui/rename.rs +++ b/src/tools/clippy/tests/ui/rename.rs @@ -36,6 +36,7 @@ #![allow(enum_intrinsics_non_enums)] #![allow(non_fmt_panics)] #![allow(named_arguments_used_positionally)] +#![allow(suspicious_double_ref_op)] #![allow(temporary_cstring_as_ptr)] #![allow(unknown_lints)] #![allow(unused_labels)] @@ -67,6 +68,7 @@ #![warn(clippy::stutter)] #![warn(clippy::to_string_in_display)] #![warn(clippy::zero_width_space)] +#![warn(clippy::clone_double_ref)] #![warn(clippy::drop_bounds)] #![warn(clippy::for_loop_over_option)] #![warn(clippy::for_loop_over_result)] diff --git a/src/tools/clippy/tests/ui/rename.stderr b/src/tools/clippy/tests/ui/rename.stderr index 27a0263292ef1..70d15408b9fc1 100644 --- a/src/tools/clippy/tests/ui/rename.stderr +++ b/src/tools/clippy/tests/ui/rename.stderr @@ -1,5 +1,5 @@ error: lint `clippy::almost_complete_letter_range` has been renamed to `clippy::almost_complete_range` - --> $DIR/rename.rs:42:9 + --> $DIR/rename.rs:43:9 | LL | #![warn(clippy::almost_complete_letter_range)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::almost_complete_range` @@ -7,250 +7,256 @@ LL | #![warn(clippy::almost_complete_letter_range)] = note: `-D renamed-and-removed-lints` implied by `-D warnings` error: lint `clippy::blacklisted_name` has been renamed to `clippy::disallowed_names` - --> $DIR/rename.rs:43:9 + --> $DIR/rename.rs:44:9 | LL | #![warn(clippy::blacklisted_name)] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_names` error: lint `clippy::block_in_if_condition_expr` has been renamed to `clippy::blocks_in_if_conditions` - --> $DIR/rename.rs:44:9 + --> $DIR/rename.rs:45:9 | LL | #![warn(clippy::block_in_if_condition_expr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions` error: lint `clippy::block_in_if_condition_stmt` has been renamed to `clippy::blocks_in_if_conditions` - --> $DIR/rename.rs:45:9 + --> $DIR/rename.rs:46:9 | LL | #![warn(clippy::block_in_if_condition_stmt)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::blocks_in_if_conditions` error: lint `clippy::box_vec` has been renamed to `clippy::box_collection` - --> $DIR/rename.rs:46:9 + --> $DIR/rename.rs:47:9 | LL | #![warn(clippy::box_vec)] | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::box_collection` error: lint `clippy::const_static_lifetime` has been renamed to `clippy::redundant_static_lifetimes` - --> $DIR/rename.rs:47:9 + --> $DIR/rename.rs:48:9 | LL | #![warn(clippy::const_static_lifetime)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::redundant_static_lifetimes` error: lint `clippy::cyclomatic_complexity` has been renamed to `clippy::cognitive_complexity` - --> $DIR/rename.rs:48:9 + --> $DIR/rename.rs:49:9 | LL | #![warn(clippy::cyclomatic_complexity)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::cognitive_complexity` error: lint `clippy::derive_hash_xor_eq` has been renamed to `clippy::derived_hash_with_manual_eq` - --> $DIR/rename.rs:49:9 + --> $DIR/rename.rs:50:9 | LL | #![warn(clippy::derive_hash_xor_eq)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::derived_hash_with_manual_eq` error: lint `clippy::disallowed_method` has been renamed to `clippy::disallowed_methods` - --> $DIR/rename.rs:50:9 + --> $DIR/rename.rs:51:9 | LL | #![warn(clippy::disallowed_method)] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_methods` error: lint `clippy::disallowed_type` has been renamed to `clippy::disallowed_types` - --> $DIR/rename.rs:51:9 + --> $DIR/rename.rs:52:9 | LL | #![warn(clippy::disallowed_type)] | ^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::disallowed_types` error: lint `clippy::eval_order_dependence` has been renamed to `clippy::mixed_read_write_in_expression` - --> $DIR/rename.rs:52:9 + --> $DIR/rename.rs:53:9 | LL | #![warn(clippy::eval_order_dependence)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::mixed_read_write_in_expression` error: lint `clippy::identity_conversion` has been renamed to `clippy::useless_conversion` - --> $DIR/rename.rs:53:9 + --> $DIR/rename.rs:54:9 | LL | #![warn(clippy::identity_conversion)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::useless_conversion` error: lint `clippy::if_let_some_result` has been renamed to `clippy::match_result_ok` - --> $DIR/rename.rs:54:9 + --> $DIR/rename.rs:55:9 | LL | #![warn(clippy::if_let_some_result)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::match_result_ok` error: lint `clippy::logic_bug` has been renamed to `clippy::overly_complex_bool_expr` - --> $DIR/rename.rs:55:9 + --> $DIR/rename.rs:56:9 | LL | #![warn(clippy::logic_bug)] | ^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::overly_complex_bool_expr` error: lint `clippy::new_without_default_derive` has been renamed to `clippy::new_without_default` - --> $DIR/rename.rs:56:9 + --> $DIR/rename.rs:57:9 | LL | #![warn(clippy::new_without_default_derive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default` error: lint `clippy::option_and_then_some` has been renamed to `clippy::bind_instead_of_map` - --> $DIR/rename.rs:57:9 + --> $DIR/rename.rs:58:9 | LL | #![warn(clippy::option_and_then_some)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::bind_instead_of_map` error: lint `clippy::option_expect_used` has been renamed to `clippy::expect_used` - --> $DIR/rename.rs:58:9 + --> $DIR/rename.rs:59:9 | LL | #![warn(clippy::option_expect_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` error: lint `clippy::option_map_unwrap_or` has been renamed to `clippy::map_unwrap_or` - --> $DIR/rename.rs:59:9 + --> $DIR/rename.rs:60:9 | LL | #![warn(clippy::option_map_unwrap_or)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::option_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` - --> $DIR/rename.rs:60:9 + --> $DIR/rename.rs:61:9 | LL | #![warn(clippy::option_map_unwrap_or_else)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::option_unwrap_used` has been renamed to `clippy::unwrap_used` - --> $DIR/rename.rs:61:9 + --> $DIR/rename.rs:62:9 | LL | #![warn(clippy::option_unwrap_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` error: lint `clippy::ref_in_deref` has been renamed to `clippy::needless_borrow` - --> $DIR/rename.rs:62:9 + --> $DIR/rename.rs:63:9 | LL | #![warn(clippy::ref_in_deref)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::needless_borrow` error: lint `clippy::result_expect_used` has been renamed to `clippy::expect_used` - --> $DIR/rename.rs:63:9 + --> $DIR/rename.rs:64:9 | LL | #![warn(clippy::result_expect_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::expect_used` error: lint `clippy::result_map_unwrap_or_else` has been renamed to `clippy::map_unwrap_or` - --> $DIR/rename.rs:64:9 + --> $DIR/rename.rs:65:9 | LL | #![warn(clippy::result_map_unwrap_or_else)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::map_unwrap_or` error: lint `clippy::result_unwrap_used` has been renamed to `clippy::unwrap_used` - --> $DIR/rename.rs:65:9 + --> $DIR/rename.rs:66:9 | LL | #![warn(clippy::result_unwrap_used)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::unwrap_used` error: lint `clippy::single_char_push_str` has been renamed to `clippy::single_char_add_str` - --> $DIR/rename.rs:66:9 + --> $DIR/rename.rs:67:9 | LL | #![warn(clippy::single_char_push_str)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::single_char_add_str` error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions` - --> $DIR/rename.rs:67:9 + --> $DIR/rename.rs:68:9 | LL | #![warn(clippy::stutter)] | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions` error: lint `clippy::to_string_in_display` has been renamed to `clippy::recursive_format_impl` - --> $DIR/rename.rs:68:9 + --> $DIR/rename.rs:69:9 | LL | #![warn(clippy::to_string_in_display)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::recursive_format_impl` error: lint `clippy::zero_width_space` has been renamed to `clippy::invisible_characters` - --> $DIR/rename.rs:69:9 + --> $DIR/rename.rs:70:9 | LL | #![warn(clippy::zero_width_space)] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::invisible_characters` +error: lint `clippy::clone_double_ref` has been renamed to `suspicious_double_ref_op` + --> $DIR/rename.rs:71:9 + | +LL | #![warn(clippy::clone_double_ref)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `suspicious_double_ref_op` + error: lint `clippy::drop_bounds` has been renamed to `drop_bounds` - --> $DIR/rename.rs:70:9 + --> $DIR/rename.rs:72:9 | LL | #![warn(clippy::drop_bounds)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `drop_bounds` error: lint `clippy::for_loop_over_option` has been renamed to `for_loops_over_fallibles` - --> $DIR/rename.rs:71:9 + --> $DIR/rename.rs:73:9 | LL | #![warn(clippy::for_loop_over_option)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` error: lint `clippy::for_loop_over_result` has been renamed to `for_loops_over_fallibles` - --> $DIR/rename.rs:72:9 + --> $DIR/rename.rs:74:9 | LL | #![warn(clippy::for_loop_over_result)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` error: lint `clippy::for_loops_over_fallibles` has been renamed to `for_loops_over_fallibles` - --> $DIR/rename.rs:73:9 + --> $DIR/rename.rs:75:9 | LL | #![warn(clippy::for_loops_over_fallibles)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `for_loops_over_fallibles` error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter` - --> $DIR/rename.rs:74:9 + --> $DIR/rename.rs:76:9 | LL | #![warn(clippy::into_iter_on_array)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `array_into_iter` error: lint `clippy::invalid_atomic_ordering` has been renamed to `invalid_atomic_ordering` - --> $DIR/rename.rs:75:9 + --> $DIR/rename.rs:77:9 | LL | #![warn(clippy::invalid_atomic_ordering)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_atomic_ordering` error: lint `clippy::invalid_ref` has been renamed to `invalid_value` - --> $DIR/rename.rs:76:9 + --> $DIR/rename.rs:78:9 | LL | #![warn(clippy::invalid_ref)] | ^^^^^^^^^^^^^^^^^^^ help: use the new name: `invalid_value` error: lint `clippy::let_underscore_drop` has been renamed to `let_underscore_drop` - --> $DIR/rename.rs:77:9 + --> $DIR/rename.rs:79:9 | LL | #![warn(clippy::let_underscore_drop)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `let_underscore_drop` error: lint `clippy::mem_discriminant_non_enum` has been renamed to `enum_intrinsics_non_enums` - --> $DIR/rename.rs:78:9 + --> $DIR/rename.rs:80:9 | LL | #![warn(clippy::mem_discriminant_non_enum)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `enum_intrinsics_non_enums` error: lint `clippy::panic_params` has been renamed to `non_fmt_panics` - --> $DIR/rename.rs:79:9 + --> $DIR/rename.rs:81:9 | LL | #![warn(clippy::panic_params)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `non_fmt_panics` error: lint `clippy::positional_named_format_parameters` has been renamed to `named_arguments_used_positionally` - --> $DIR/rename.rs:80:9 + --> $DIR/rename.rs:82:9 | LL | #![warn(clippy::positional_named_format_parameters)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `named_arguments_used_positionally` error: lint `clippy::temporary_cstring_as_ptr` has been renamed to `temporary_cstring_as_ptr` - --> $DIR/rename.rs:81:9 + --> $DIR/rename.rs:83:9 | LL | #![warn(clippy::temporary_cstring_as_ptr)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `temporary_cstring_as_ptr` error: lint `clippy::unknown_clippy_lints` has been renamed to `unknown_lints` - --> $DIR/rename.rs:82:9 + --> $DIR/rename.rs:84:9 | LL | #![warn(clippy::unknown_clippy_lints)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unknown_lints` error: lint `clippy::unused_label` has been renamed to `unused_labels` - --> $DIR/rename.rs:83:9 + --> $DIR/rename.rs:85:9 | LL | #![warn(clippy::unused_label)] | ^^^^^^^^^^^^^^^^^^^^ help: use the new name: `unused_labels` -error: aborting due to 42 previous errors +error: aborting due to 43 previous errors diff --git a/src/tools/clippy/tests/ui/unnecessary_clone.rs b/src/tools/clippy/tests/ui/unnecessary_clone.rs index 8b1629b19a769..7ceed3c75fd85 100644 --- a/src/tools/clippy/tests/ui/unnecessary_clone.rs +++ b/src/tools/clippy/tests/ui/unnecessary_clone.rs @@ -42,14 +42,6 @@ fn clone_on_copy_generic(t: T) { Some(t).clone(); } -fn clone_on_double_ref() { - let x = vec![1]; - let y = &&x; - let z: &Vec<_> = y.clone(); - - println!("{:p} {:p}", *y, z); -} - mod many_derefs { struct A; struct B; @@ -84,11 +76,6 @@ mod many_derefs { let _: E = a.clone(); let _: E = *****a; } - - fn check(mut encoded: &[u8]) { - let _ = &mut encoded.clone(); - let _ = &encoded.clone(); - } } mod issue2076 { diff --git a/src/tools/clippy/tests/ui/unnecessary_clone.stderr b/src/tools/clippy/tests/ui/unnecessary_clone.stderr index 6022d9fa4c5c3..5686ab6b4531e 100644 --- a/src/tools/clippy/tests/ui/unnecessary_clone.stderr +++ b/src/tools/clippy/tests/ui/unnecessary_clone.stderr @@ -44,63 +44,17 @@ error: using `clone` on type `Option` which implements the `Copy` trait LL | Some(t).clone(); | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `Some(t)` -error: using `clone` on a double-reference; this will copy the reference of type `&Vec` instead of cloning the inner type - --> $DIR/unnecessary_clone.rs:48:22 - | -LL | let z: &Vec<_> = y.clone(); - | ^^^^^^^^^ - | - = note: `#[deny(clippy::clone_double_ref)]` on by default -help: try dereferencing it - | -LL | let z: &Vec<_> = &(*y).clone(); - | ~~~~~~~~~~~~~ -help: or try being explicit if you are sure, that you want to clone a reference - | -LL | let z: &Vec<_> = <&Vec>::clone(y); - | ~~~~~~~~~~~~~~~~~~~~~ - error: using `clone` on type `E` which implements the `Copy` trait - --> $DIR/unnecessary_clone.rs:84:20 + --> $DIR/unnecessary_clone.rs:76:20 | LL | let _: E = a.clone(); | ^^^^^^^^^ help: try dereferencing it: `*****a` -error: using `clone` on a double-reference; this will copy the reference of type `&[u8]` instead of cloning the inner type - --> $DIR/unnecessary_clone.rs:89:22 - | -LL | let _ = &mut encoded.clone(); - | ^^^^^^^^^^^^^^^ - | -help: try dereferencing it - | -LL | let _ = &mut &(*encoded).clone(); - | ~~~~~~~~~~~~~~~~~~~ -help: or try being explicit if you are sure, that you want to clone a reference - | -LL | let _ = &mut <&[u8]>::clone(encoded); - | ~~~~~~~~~~~~~~~~~~~~~~~ - -error: using `clone` on a double-reference; this will copy the reference of type `&[u8]` instead of cloning the inner type - --> $DIR/unnecessary_clone.rs:90:18 - | -LL | let _ = &encoded.clone(); - | ^^^^^^^^^^^^^^^ - | -help: try dereferencing it - | -LL | let _ = &&(*encoded).clone(); - | ~~~~~~~~~~~~~~~~~~~ -help: or try being explicit if you are sure, that you want to clone a reference - | -LL | let _ = &<&[u8]>::clone(encoded); - | ~~~~~~~~~~~~~~~~~~~~~~~ - error: using `.clone()` on a ref-counted pointer - --> $DIR/unnecessary_clone.rs:108:14 + --> $DIR/unnecessary_clone.rs:95:14 | LL | Some(try_opt!(Some(rc)).clone()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `Rc::::clone(&try_opt!(Some(rc)))` -error: aborting due to 12 previous errors +error: aborting due to 9 previous errors diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 0fd9f3ae3f406..a4be7af886b45 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -1385,7 +1385,9 @@ impl<'test> TestCx<'test> { let actual_errors = json::parse_output(&diagnostic_file_name, &proc_res.stderr, proc_res); let mut unexpected = Vec::new(); let mut found = vec![false; expected_errors.len()]; - for actual_error in &actual_errors { + for mut actual_error in actual_errors { + actual_error.msg = self.normalize_output(&actual_error.msg, &[]); + let opt_index = expected_errors.iter().enumerate().position(|(index, expected_error)| { !found[index] @@ -1404,7 +1406,8 @@ impl<'test> TestCx<'test> { None => { // If the test is a known bug, don't require that the error is annotated - if self.is_unexpected_compiler_message(actual_error, expect_help, expect_note) { + if self.is_unexpected_compiler_message(&actual_error, expect_help, expect_note) + { self.error(&format!( "{}:{}: unexpected {}: '{}'", file_name, diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 73f922b317480..213413e578f01 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -1cb63572d271855a5ccef79a3e10a8015d00f6ad +9b99ff76b28605ad2e2c49e369721ae400e6a665 diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index aeba0ea5a9524..a93f3eb84f2c1 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -409,14 +409,15 @@ pub fn report_msg<'tcx>( } else { // Make sure we show the message even when it is a dummy span. for line in span_msg { - err.note(&line); + err.note(line); } err.note("(no span available)"); } // Show note and help messages. let mut extra_span = false; - for (span_data, note) in ¬es { + let notes_len = notes.len(); + for (span_data, note) in notes { if let Some(span_data) = span_data { err.span_note(span_data.span(), note); extra_span = true; @@ -424,7 +425,8 @@ pub fn report_msg<'tcx>( err.note(note); } } - for (span_data, help) in &helps { + let helps_len = helps.len(); + for (span_data, help) in helps { if let Some(span_data) = span_data { err.span_help(span_data.span(), help); extra_span = true; @@ -432,7 +434,7 @@ pub fn report_msg<'tcx>( err.help(help); } } - if notes.len() + helps.len() > 0 { + if notes_len + helps_len > 0 { // Add visual separator before backtrace. err.note(if extra_span { "BACKTRACE (of the first span):" } else { "BACKTRACE:" }); } @@ -441,7 +443,7 @@ pub fn report_msg<'tcx>( let is_local = machine.is_local(frame_info); // No span for non-local frames and the first frame (which is the error site). if is_local && idx > 0 { - err.span_note(frame_info.span, &frame_info.to_string()); + err.span_note(frame_info.span, frame_info.to_string()); } else { let sm = sess.source_map(); let span = sm.span_to_embeddable_string(frame_info.span); diff --git a/src/tools/rustfmt/tests/source/type-ascription.rs b/src/tools/rustfmt/tests/source/type-ascription.rs deleted file mode 100644 index 4874094ccc4c4..0000000000000 --- a/src/tools/rustfmt/tests/source/type-ascription.rs +++ /dev/null @@ -1,10 +0,0 @@ - -fn main() { - let xxxxxxxxxxx = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy : SomeTrait; - - let xxxxxxxxxxxxxxx = yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; - - let z = funk(yyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz, wwwwww): AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; - - x : u32 - 1u32 / 10f32 : u32 -} diff --git a/src/tools/rustfmt/tests/target/configs/format_macro_bodies/true.rs b/src/tools/rustfmt/tests/target/configs/format_macro_bodies/true.rs index 9dc2524c38961..17ac1498c932c 100644 --- a/src/tools/rustfmt/tests/target/configs/format_macro_bodies/true.rs +++ b/src/tools/rustfmt/tests/target/configs/format_macro_bodies/true.rs @@ -1,10 +1,6 @@ // rustfmt-format_macro_bodies: true macro_rules! foo { - ($a: ident : $b: ty) => { - $a(42): $b; - }; - ($a: ident $b: ident $c: ident) => { - $a = $b + $c; - }; + ($a: ident : $b: ty) => { $a(42): $b; }; + ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; } diff --git a/src/tools/rustfmt/tests/target/configs/format_macro_matchers/false.rs b/src/tools/rustfmt/tests/target/configs/format_macro_matchers/false.rs index 3966d21be7563..01ecac9879d69 100644 --- a/src/tools/rustfmt/tests/target/configs/format_macro_matchers/false.rs +++ b/src/tools/rustfmt/tests/target/configs/format_macro_matchers/false.rs @@ -1,10 +1,6 @@ // rustfmt-format_macro_matchers: false macro_rules! foo { - ($a: ident : $b: ty) => { - $a(42): $b; - }; - ($a: ident $b: ident $c: ident) => { - $a = $b + $c; - }; + ($a: ident : $b: ty) => { $a(42): $b; }; + ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; } diff --git a/src/tools/rustfmt/tests/target/configs/format_macro_matchers/true.rs b/src/tools/rustfmt/tests/target/configs/format_macro_matchers/true.rs index e113af96f26be..fa0442e228ac8 100644 --- a/src/tools/rustfmt/tests/target/configs/format_macro_matchers/true.rs +++ b/src/tools/rustfmt/tests/target/configs/format_macro_matchers/true.rs @@ -1,10 +1,6 @@ // rustfmt-format_macro_matchers: true macro_rules! foo { - ($a:ident : $b:ty) => { - $a(42): $b; - }; - ($a:ident $b:ident $c:ident) => { - $a = $b + $c; - }; + ($a: ident : $b: ty) => { $a(42): $b; }; + ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; } diff --git a/src/tools/rustfmt/tests/target/macros.rs b/src/tools/rustfmt/tests/target/macros.rs index e930b5037d930..7b4574349df3e 100644 --- a/src/tools/rustfmt/tests/target/macros.rs +++ b/src/tools/rustfmt/tests/target/macros.rs @@ -122,7 +122,7 @@ fn main() { 20, 21, 22); // #1092 - chain!(input, a: take!(max_size), || []); + chain!(input, a:take!(max_size), || []); // #2727 foo!("bar"); @@ -156,17 +156,13 @@ fn issue1178() { } fn issue1739() { - sql_function!( - add_rss_item, - add_rss_item_t, - ( - a: types::Integer, - b: types::Timestamptz, - c: types::Text, - d: types::Text, - e: types::Text - ) - ); + sql_function!(add_rss_item, + add_rss_item_t, + (a: types::Integer, + b: types::Timestamptz, + c: types::Text, + d: types::Text, + e: types::Text)); w.slice_mut(s![ .., @@ -232,7 +228,7 @@ fn issue_3174() { "debugMessage": debug.message, }) } else { - json!({ "errorKind": format!("{:?}", error.err_kind()) }) + json!({"errorKind": format!("{:?}", error.err_kind())}) }; } diff --git a/src/tools/rustfmt/tests/target/type-ascription.rs b/src/tools/rustfmt/tests/target/type-ascription.rs deleted file mode 100644 index a2f082ba4b497..0000000000000 --- a/src/tools/rustfmt/tests/target/type-ascription.rs +++ /dev/null @@ -1,12 +0,0 @@ -fn main() { - let xxxxxxxxxxx = - yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: SomeTrait; - - let xxxxxxxxxxxxxxx = - yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; - - let z = funk(yyyyyyyyyyyyyyy, zzzzzzzzzzzzzzzz, wwwwww): - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; - - x: u32 - 1u32 / 10f32: u32 -} diff --git a/src/tools/rustfmt/tests/target/type.rs b/src/tools/rustfmt/tests/target/type.rs index 38cf909c2587a..c789ecb055a7d 100644 --- a/src/tools/rustfmt/tests/target/type.rs +++ b/src/tools/rustfmt/tests/target/type.rs @@ -129,7 +129,7 @@ fn issue3117() { fn issue3139() { assert_eq!( to_json_value(&None::).unwrap(), - json!({ "test": None:: }) + json!( { "test": None :: } ) ); } diff --git a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs index 327515b10afd1..c187df637fdc7 100644 --- a/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs +++ b/tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.rs @@ -2,7 +2,6 @@ // ignore-lldb // no-prefer-dynamic -#![feature(debugger_visualizer)] #![debugger_visualizer(natvis_file = "dependency-with-embedded-visualizers.natvis")] #![debugger_visualizer(gdb_script_file = "dependency-with-embedded-visualizers.py")] #![crate_type = "rlib"] diff --git a/tests/debuginfo/embedded-visualizer.rs b/tests/debuginfo/embedded-visualizer.rs index 2898e75e0ee36..ac421092839f4 100644 --- a/tests/debuginfo/embedded-visualizer.rs +++ b/tests/debuginfo/embedded-visualizer.rs @@ -60,7 +60,6 @@ // gdb-check:$4 = "Person A" is 10 years old. #![allow(unused_variables)] -#![feature(debugger_visualizer)] #![debugger_visualizer(natvis_file = "embedded-visualizer.natvis")] #![debugger_visualizer(gdb_script_file = "embedded-visualizer.py")] diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff similarity index 100% rename from tests/mir-opt/const_prop/transmute.from_char.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.from_char.ConstProp.32bit.diff diff --git a/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff new file mode 100644 index 0000000000000..933dfbb5166d2 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.from_char.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `from_char` before ConstProp ++ // MIR for `from_char` after ConstProp + + fn from_char() -> i32 { + let mut _0: i32; // return place in scope 0 at $DIR/transmute.rs:+0:23: +0:26 + scope 1 { + } + + bb0: { +- _0 = const 'R' as i32 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:28 ++ _0 = const 82_i32; // scope 1 at $DIR/transmute.rs:+1:14: +1:28 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff similarity index 71% rename from tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff index f3474855f027d..4a31194de6eed 100644 --- a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.diff +++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.32bit.diff @@ -7,7 +7,8 @@ } bb0: { - _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30 +- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30 ++ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30 return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff new file mode 100644 index 0000000000000..4a31194de6eed --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_bool.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `invalid_bool` before ConstProp ++ // MIR for `invalid_bool` after ConstProp + + fn invalid_bool() -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 + scope 1 { + } + + bb0: { +- _0 = const -1_i8 as bool (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:30 ++ _0 = const {transmute(0xff): bool}; // scope 1 at $DIR/transmute.rs:+1:14: +1:30 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff similarity index 70% rename from tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff index ba087e226c9c4..2c541f2f6a084 100644 --- a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.diff +++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.32bit.diff @@ -7,7 +7,8 @@ } bb0: { - _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 +- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 ++ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff new file mode 100644 index 0000000000000..2c541f2f6a084 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.invalid_char.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `invalid_char` before ConstProp ++ // MIR for `invalid_char` after ConstProp + + fn invalid_char() -> char { + let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:33: +0:37 + scope 1 { + } + + bb0: { +- _0 = const _ as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 ++ _0 = const {transmute(0x7fffffff): char}; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff similarity index 100% rename from tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.32bit.diff diff --git a/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff new file mode 100644 index 0000000000000..76d464789c191 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.less_as_i8.ConstProp.64bit.diff @@ -0,0 +1,23 @@ +- // MIR for `less_as_i8` before ConstProp ++ // MIR for `less_as_i8` after ConstProp + + fn less_as_i8() -> i8 { + let mut _0: i8; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:26 + let mut _1: std::cmp::Ordering; // in scope 0 at $DIR/transmute.rs:+1:24: +1:48 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/transmute.rs:+1:24: +1:48 +- _1 = Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 +- _0 = move _1 as i8 (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:49 ++ _1 = const Less; // scope 1 at $DIR/transmute.rs:+1:24: +1:48 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: std::cmp::Ordering, val: Value(Scalar(0xff)) } ++ _0 = const -1_i8; // scope 1 at $DIR/transmute.rs:+1:14: +1:49 + StorageDead(_1); // scope 1 at $DIR/transmute.rs:+1:48: +1:49 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.rs b/tests/mir-opt/const_prop/transmute.rs index b753cdccd606f..762c421715ab5 100644 --- a/tests/mir-opt/const_prop/transmute.rs +++ b/tests/mir-opt/const_prop/transmute.rs @@ -1,5 +1,7 @@ // unit-test: ConstProp // compile-flags: -O --crate-type=lib +// ignore-endian-big +// EMIT_MIR_FOR_EACH_BIT_WIDTH use std::mem::transmute; diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff similarity index 100% rename from tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.32bit.diff diff --git a/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff new file mode 100644 index 0000000000000..538b1f26e4c9b --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.undef_union_as_integer.ConstProp.64bit.diff @@ -0,0 +1,22 @@ +- // MIR for `undef_union_as_integer` before ConstProp ++ // MIR for `undef_union_as_integer` after ConstProp + + fn undef_union_as_integer() -> u32 { + let mut _0: u32; // return place in scope 0 at $DIR/transmute.rs:+0:43: +0:46 + let mut _1: undef_union_as_integer::Union32; // in scope 0 at $DIR/transmute.rs:+2:24: +2:44 + let mut _2: (); // in scope 0 at $DIR/transmute.rs:+2:40: +2:42 + scope 1 { + } + + bb0: { + StorageLive(_1); // scope 1 at $DIR/transmute.rs:+2:24: +2:44 + StorageLive(_2); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 + _2 = (); // scope 1 at $DIR/transmute.rs:+2:40: +2:42 + _1 = Union32 { value: move _2 }; // scope 1 at $DIR/transmute.rs:+2:24: +2:44 + StorageDead(_2); // scope 1 at $DIR/transmute.rs:+2:43: +2:44 + _0 = move _1 as u32 (Transmute); // scope 1 at $DIR/transmute.rs:+2:14: +2:45 + StorageDead(_1); // scope 1 at $DIR/transmute.rs:+2:44: +2:45 + return; // scope 0 at $DIR/transmute.rs:+3:2: +3:2 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff similarity index 67% rename from tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff index 8bf97996a678f..bc41b5d08131e 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.32bit.diff @@ -15,7 +15,11 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 - _2 = const 1_usize as std::boxed::Box (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 +- _2 = const 1_usize as std::boxed::Box (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _2 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: Box, val: Value(Scalar(0x00000001)) } StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff new file mode 100644 index 0000000000000..c4376e6e17afc --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_box.ConstProp.64bit.diff @@ -0,0 +1,27 @@ +- // MIR for `unreachable_box` before ConstProp ++ // MIR for `unreachable_box` after ConstProp + + fn unreachable_box() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2 + let _2: std::boxed::Box; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16 + scope 1 { + debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 + StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 +- _2 = const 1_usize as std::boxed::Box (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _2 = const Box::(Unique:: {{ pointer: NonNull:: {{ pointer: {0x1 as *const Never} }}, _marker: PhantomData:: }}, std::alloc::Global); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: Box, val: Value(Scalar(0x0000000000000001)) } + StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff similarity index 100% rename from tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.32bit.diff diff --git a/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff new file mode 100644 index 0000000000000..81b7b36899309 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_direct.ConstProp.64bit.diff @@ -0,0 +1,25 @@ +- // MIR for `unreachable_direct` before ConstProp ++ // MIR for `unreachable_direct` after ConstProp + + fn unreachable_direct() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:39: +0:40 + let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:41: +3:2 + let _2: Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _3: (); // in scope 0 at $DIR/transmute.rs:+1:39: +1:41 + let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:15 + scope 1 { + debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:41: +3:2 + StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 + StorageLive(_3); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 + _3 = (); // scope 2 at $DIR/transmute.rs:+1:39: +1:41 + _2 = move _3 as Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:29: +1:42 + unreachable; // scope 2 at $DIR/transmute.rs:+1:29: +1:42 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff similarity index 78% rename from tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff index 34f7aea8ed26c..47f023cd93dd0 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.32bit.diff @@ -17,7 +17,11 @@ StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 StorageLive(_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 - _3 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 +- _3 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _3 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x00000001)) } _2 = &mut (*_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 StorageDead(_3); // scope 0 at $DIR/transmute.rs:+1:54: +1:55 StorageLive(_4); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 diff --git a/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff new file mode 100644 index 0000000000000..62300d2e313b3 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_mut.ConstProp.64bit.diff @@ -0,0 +1,31 @@ +- // MIR for `unreachable_mut` before ConstProp ++ // MIR for `unreachable_mut` after ConstProp + + fn unreachable_mut() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2 + let _2: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _3: &mut Never; // in scope 0 at $DIR/transmute.rs:+1:34: +1:52 + let mut _4: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16 + scope 1 { + debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 + StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 + StorageLive(_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 +- _3 = const 1_usize as &mut Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ _3 = const {0x1 as &mut Never}; // scope 2 at $DIR/transmute.rs:+1:34: +1:52 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &mut Never, val: Value(Scalar(0x0000000000000001)) } + _2 = &mut (*_3); // scope 0 at $DIR/transmute.rs:+1:34: +1:52 + StorageDead(_3); // scope 0 at $DIR/transmute.rs:+1:54: +1:55 + StorageLive(_4); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff similarity index 73% rename from tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff index ff95f2a0b943c..8578f898a7eee 100644 --- a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.diff +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.32bit.diff @@ -15,7 +15,11 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 - _2 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48 +- _2 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ _2 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &Never, val: Value(Scalar(0x00000001)) } StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 } diff --git a/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff new file mode 100644 index 0000000000000..8b11cea93658d --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.unreachable_ref.ConstProp.64bit.diff @@ -0,0 +1,27 @@ +- // MIR for `unreachable_ref` before ConstProp ++ // MIR for `unreachable_ref` after ConstProp + + fn unreachable_ref() -> ! { + let mut _0: !; // return place in scope 0 at $DIR/transmute.rs:+0:36: +0:37 + let mut _1: !; // in scope 0 at $DIR/transmute.rs:+0:38: +3:2 + let _2: &Never; // in scope 0 at $DIR/transmute.rs:+1:9: +1:10 + let mut _3: !; // in scope 0 at $DIR/transmute.rs:+2:5: +2:16 + scope 1 { + debug x => _2; // in scope 1 at $DIR/transmute.rs:+1:9: +1:10 + } + scope 2 { + } + + bb0: { + StorageLive(_1); // scope 0 at $DIR/transmute.rs:+0:38: +3:2 + StorageLive(_2); // scope 0 at $DIR/transmute.rs:+1:9: +1:10 +- _2 = const 1_usize as &Never (Transmute); // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ _2 = const {0x1 as &Never}; // scope 2 at $DIR/transmute.rs:+1:30: +1:48 ++ // mir::Constant ++ // + span: no-location ++ // + literal: Const { ty: &Never, val: Value(Scalar(0x0000000000000001)) } + StorageLive(_3); // scope 1 at $DIR/transmute.rs:+2:5: +2:16 + unreachable; // scope 1 at $DIR/transmute.rs:+2:11: +2:13 + } + } + diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff similarity index 100% rename from tests/mir-opt/const_prop/transmute.valid_char.ConstProp.diff rename to tests/mir-opt/const_prop/transmute.valid_char.ConstProp.32bit.diff diff --git a/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff new file mode 100644 index 0000000000000..eac33b7300348 --- /dev/null +++ b/tests/mir-opt/const_prop/transmute.valid_char.ConstProp.64bit.diff @@ -0,0 +1,15 @@ +- // MIR for `valid_char` before ConstProp ++ // MIR for `valid_char` after ConstProp + + fn valid_char() -> char { + let mut _0: char; // return place in scope 0 at $DIR/transmute.rs:+0:24: +0:28 + scope 1 { + } + + bb0: { +- _0 = const 82_u32 as char (Transmute); // scope 1 at $DIR/transmute.rs:+1:14: +1:33 ++ _0 = const 'R'; // scope 1 at $DIR/transmute.rs:+1:14: +1:33 + return; // scope 0 at $DIR/transmute.rs:+2:2: +2:2 + } + } + diff --git a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 8dac53c2a6234..7db100a08a106 100644 --- a/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/tests/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -67,7 +67,7 @@ impl CodegenBackend for TheBackend { let crate_name = codegen_results.crate_info.local_crate_name; for &crate_type in sess.opts.crate_types.iter() { if crate_type != CrateType::Rlib { - sess.fatal(&format!("Crate type is {:?}", crate_type)); + sess.fatal(format!("Crate type is {:?}", crate_type)); } let output_name = out_filename(sess, crate_type, &outputs, crate_name); let mut out_file = ::std::fs::File::create(output_name).unwrap(); diff --git a/tests/rustdoc-ui/issues/issue-105742.rs b/tests/rustdoc-ui/issues/issue-105742.rs index 8f4172c0cbbbf..1fbb70c7808ee 100644 --- a/tests/rustdoc-ui/issues/issue-105742.rs +++ b/tests/rustdoc-ui/issues/issue-105742.rs @@ -19,6 +19,8 @@ pub trait SVec: Index< //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` Output = ::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument @@ -26,6 +28,8 @@ pub trait SVec: Index< //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` Output = ::Item> as SVec>::Item, //~^ expected 1 lifetime argument //~| expected 1 generic argument @@ -34,11 +38,15 @@ pub trait SVec: Index< //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` //~| expected 1 generic argument //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` + //~| missing generics for associated type `SVec::Item` > { type Item<'a, T>; diff --git a/tests/rustdoc-ui/issues/issue-105742.stderr b/tests/rustdoc-ui/issues/issue-105742.stderr index cd53762ef9b2d..b63176c914905 100644 --- a/tests/rustdoc-ui/issues/issue-105742.stderr +++ b/tests/rustdoc-ui/issues/issue-105742.stderr @@ -5,7 +5,7 @@ LL | ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -21,7 +21,7 @@ LL | ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -31,13 +31,13 @@ LL | ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:37 + --> $DIR/issue-105742.rs:24:37 | LL | Output = ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -47,13 +47,13 @@ LL | Output = ::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:37 + --> $DIR/issue-105742.rs:24:37 | LL | Output = ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -63,13 +63,13 @@ LL | Output = ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:30 + --> $DIR/issue-105742.rs:33:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -79,13 +79,13 @@ LL | Output = ::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:30 + --> $DIR/issue-105742.rs:33:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -95,13 +95,13 @@ LL | Output = ::Item> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:46 + --> $DIR/issue-105742.rs:33:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -111,13 +111,13 @@ LL | Output = ::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:46 + --> $DIR/issue-105742.rs:33:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -133,7 +133,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -149,7 +149,7 @@ LL | pub fn next<'a, T>(s: &'a mut dyn SVec) { | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -165,7 +165,7 @@ LL | ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -181,7 +181,7 @@ LL | ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -191,13 +191,13 @@ LL | ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:37 + --> $DIR/issue-105742.rs:24:37 | LL | Output = ::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -207,13 +207,13 @@ LL | Output = ::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:22:37 + --> $DIR/issue-105742.rs:24:37 | LL | Output = ::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -223,13 +223,13 @@ LL | Output = ::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:30 + --> $DIR/issue-105742.rs:33:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -239,13 +239,13 @@ LL | Output = ::Item<'a>> as SVec>::Item, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:30 + --> $DIR/issue-105742.rs:33:30 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -255,13 +255,13 @@ LL | Output = ::Item> as SVec>::Item, | +++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:46 + --> $DIR/issue-105742.rs:33:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -271,13 +271,13 @@ LL | Output = ::Item> as SVec>::Item<'a>, | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:29:46 + --> $DIR/issue-105742.rs:33:46 | LL | Output = ::Item> as SVec>::Item, | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -317,13 +317,141 @@ LL | | > { | |__^ ...because it uses `Self` as a type parameter error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:45:38 + --> $DIR/issue-105742.rs:15:21 + | +LL | ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:15:21 + | +LL | ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:24:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:24:37 + | +LL | Output = ::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:33:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item<'a>> as SVec>::Item, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:33:30 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:33:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ -- +help: add missing lifetime argument + | +LL | Output = ::Item> as SVec>::Item<'a>, + | ++++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:33:46 + | +LL | Output = ::Item> as SVec>::Item, + | ^^^^ expected 1 generic argument + | +note: associated type defined here, with 1 generic parameter: `T` + --> $DIR/issue-105742.rs:51:10 + | +LL | type Item<'a, T>; + | ^^^^ - +help: add missing generic argument + | +LL | Output = ::Item> as SVec>::Item, + | +++ + +error[E0107]: missing generics for associated type `SVec::Item` + --> $DIR/issue-105742.rs:53:38 | LL | fn len(&self) -> ::Item; | ^^^^ expected 1 lifetime argument | note: associated type defined here, with 1 lifetime parameter: `'a` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ -- @@ -333,13 +461,13 @@ LL | fn len(&self) -> ::Item<'_>; | ++++ error[E0107]: missing generics for associated type `SVec::Item` - --> $DIR/issue-105742.rs:45:38 + --> $DIR/issue-105742.rs:53:38 | LL | fn len(&self) -> ::Item; | ^^^^ expected 1 generic argument | note: associated type defined here, with 1 generic parameter: `T` - --> $DIR/issue-105742.rs:43:10 + --> $DIR/issue-105742.rs:51:10 | LL | type Item<'a, T>; | ^^^^ - @@ -348,7 +476,7 @@ help: add missing generic argument LL | fn len(&self) -> ::Item; | +++ -error: aborting due to 21 previous errors +error: aborting due to 29 previous errors Some errors have detailed explanations: E0038, E0107. For more information about an error, try `rustc --explain E0038`. diff --git a/tests/ui-fulldeps/stable-mir/crate-info.rs b/tests/ui-fulldeps/stable-mir/crate-info.rs index 95f27efa7715c..1454d6dde6c97 100644 --- a/tests/ui-fulldeps/stable-mir/crate-info.rs +++ b/tests/ui-fulldeps/stable-mir/crate-info.rs @@ -60,6 +60,24 @@ fn test_stable_mir(tcx: TyCtxt<'_>) { stable_mir::mir::Terminator::Call { .. } => {} other => panic!("{other:?}"), } + + let drop = get_item(tcx, &items, (DefKind::Fn, "drop")).unwrap(); + let body = drop.body(); + assert_eq!(body.blocks.len(), 2); + let block = &body.blocks[0]; + match &block.terminator { + stable_mir::mir::Terminator::Drop { .. } => {} + other => panic!("{other:?}"), + } + + let assert = get_item(tcx, &items, (DefKind::Fn, "assert")).unwrap(); + let body = assert.body(); + assert_eq!(body.blocks.len(), 2); + let block = &body.blocks[0]; + match &block.terminator { + stable_mir::mir::Terminator::Assert { .. } => {} + other => panic!("{other:?}"), + } } // Use internal API to find a function in a crate. @@ -131,6 +149,12 @@ fn generate_input(path: &str) -> std::io::Result<()> { let x_64 = foo::bar(x); let y_64 = foo::bar(y); x_64.wrapping_add(y_64) + }} + + pub fn drop(_: String) {{}} + + pub fn assert(x: i32) -> i32 {{ + x + 1 }}"# )?; Ok(()) diff --git a/tests/ui/associated-type-bounds/duplicate.rs b/tests/ui/associated-type-bounds/duplicate.rs index f67410986e559..4b8bf52c37492 100644 --- a/tests/ui/associated-type-bounds/duplicate.rs +++ b/tests/ui/associated-type-bounds/duplicate.rs @@ -193,10 +193,13 @@ trait TRI3> {} //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] trait TRS1: Iterator {} //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] trait TRS2: Iterator {} //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] trait TRS3: Iterator {} //~^ ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] +//~| ERROR the value of the associated type `Item` (from trait `Iterator`) is already specified [E0719] trait TRW1 where T: Iterator, diff --git a/tests/ui/associated-type-bounds/duplicate.stderr b/tests/ui/associated-type-bounds/duplicate.stderr index c3061327f566e..08721eff7b0ce 100644 --- a/tests/ui/associated-type-bounds/duplicate.stderr +++ b/tests/ui/associated-type-bounds/duplicate.stderr @@ -367,7 +367,23 @@ LL | trait TRS1: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:196:34 + --> $DIR/duplicate.rs:194:34 + | +LL | trait TRS1: Iterator {} + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified + --> $DIR/duplicate.rs:197:34 + | +LL | trait TRS2: Iterator {} + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified + --> $DIR/duplicate.rs:197:34 | LL | trait TRS2: Iterator {} | ---------- ^^^^^^^^^^ re-bound here @@ -375,7 +391,15 @@ LL | trait TRS2: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:198:37 + --> $DIR/duplicate.rs:200:37 + | +LL | trait TRS3: Iterator {} + | ------------- ^^^^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified + --> $DIR/duplicate.rs:200:37 | LL | trait TRS3: Iterator {} | ------------- ^^^^^^^^^^^^^ re-bound here @@ -383,7 +407,7 @@ LL | trait TRS3: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:202:29 + --> $DIR/duplicate.rs:205:29 | LL | T: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -391,7 +415,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:208:29 + --> $DIR/duplicate.rs:211:29 | LL | T: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -399,7 +423,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:214:32 + --> $DIR/duplicate.rs:217:32 | LL | T: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -407,7 +431,7 @@ LL | T: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:220:32 + --> $DIR/duplicate.rs:223:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -415,7 +439,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:220:32 + --> $DIR/duplicate.rs:223:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -423,7 +447,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:227:32 + --> $DIR/duplicate.rs:230:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -431,7 +455,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:227:32 + --> $DIR/duplicate.rs:230:32 | LL | Self: Iterator, | ---------- ^^^^^^^^^^ re-bound here @@ -439,7 +463,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:234:35 + --> $DIR/duplicate.rs:237:35 | LL | Self: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -447,7 +471,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:234:35 + --> $DIR/duplicate.rs:237:35 | LL | Self: Iterator, | ------------- ^^^^^^^^^^^^^ re-bound here @@ -455,7 +479,7 @@ LL | Self: Iterator, | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:252:40 + --> $DIR/duplicate.rs:255:40 | LL | type TADyn1 = dyn Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -463,7 +487,7 @@ LL | type TADyn1 = dyn Iterator; | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:254:44 + --> $DIR/duplicate.rs:257:44 | LL | type TADyn2 = Box>; | ---------- ^^^^^^^^^^ re-bound here @@ -471,7 +495,7 @@ LL | type TADyn2 = Box>; | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:256:43 + --> $DIR/duplicate.rs:259:43 | LL | type TADyn3 = dyn Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here @@ -479,7 +503,7 @@ LL | type TADyn3 = dyn Iterator; | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:240:34 + --> $DIR/duplicate.rs:243:34 | LL | type A: Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -487,7 +511,7 @@ LL | type A: Iterator; | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:244:34 + --> $DIR/duplicate.rs:247:34 | LL | type A: Iterator; | ---------- ^^^^^^^^^^ re-bound here @@ -495,13 +519,13 @@ LL | type A: Iterator; | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/duplicate.rs:248:37 + --> $DIR/duplicate.rs:251:37 | LL | type A: Iterator; | ------------- ^^^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 63 previous errors +error: aborting due to 66 previous errors For more information about this error, try `rustc --explain E0719`. diff --git a/tests/ui/associated-type-bounds/supertrait-defines-ty.rs b/tests/ui/associated-type-bounds/supertrait-defines-ty.rs new file mode 100644 index 0000000000000..b6f37cb908e4e --- /dev/null +++ b/tests/ui/associated-type-bounds/supertrait-defines-ty.rs @@ -0,0 +1,26 @@ +// check-pass + +// Make sure that we don't look into associated type bounds when looking for +// supertraits that define an associated type. Fixes #76593. + +#![feature(associated_type_bounds)] + +trait Load: Sized { + type Blob; +} + +trait Primitive: Load {} + +trait BlobPtr: Primitive {} + +trait CleanPtr: Load { + fn to_blob(&self) -> Self::Blob; +} + +impl Load for () { + type Blob = Self; +} +impl Primitive for () {} +impl BlobPtr for () {} + +fn main() {} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs new file mode 100644 index 0000000000000..0da68ae757351 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.rs @@ -0,0 +1,13 @@ +#![allow(incomplete_features)] +#![feature(adt_const_params)] + +fn check(_: impl std::marker::ConstParamTy) {} + +fn main() { + check(main); //~ error: `fn() {main}` can't be used as a const parameter type + check(|| {}); //~ error: `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]` can't be used as a const parameter type + check(main as fn()); //~ error: `fn()` can't be used as a const parameter type + check(&mut ()); //~ error: `&mut ()` can't be used as a const parameter type + check(&mut () as *mut ()); //~ error: `*mut ()` can't be used as a const parameter type + check(&() as *const ()); //~ error: `*const ()` can't be used as a const parameter type +} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr new file mode 100644 index 0000000000000..de5704ee429ed --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr @@ -0,0 +1,87 @@ +error[E0277]: `fn() {main}` can't be used as a const parameter type + --> $DIR/const_param_ty_bad.rs:7:11 + | +LL | check(main); + | ----- ^^^^ the trait `ConstParamTy` is not implemented for fn item `fn() {main}` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/const_param_ty_bad.rs:4:18 + | +LL | fn check(_: impl std::marker::ConstParamTy) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error[E0277]: `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]` can't be used as a const parameter type + --> $DIR/const_param_ty_bad.rs:8:11 + | +LL | check(|| {}); + | ----- ^^^^^ the trait `ConstParamTy` is not implemented for closure `[closure@$DIR/const_param_ty_bad.rs:8:11: 8:13]` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/const_param_ty_bad.rs:4:18 + | +LL | fn check(_: impl std::marker::ConstParamTy) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error[E0277]: `fn()` can't be used as a const parameter type + --> $DIR/const_param_ty_bad.rs:9:11 + | +LL | check(main as fn()); + | ----- ^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `fn()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/const_param_ty_bad.rs:4:18 + | +LL | fn check(_: impl std::marker::ConstParamTy) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error[E0277]: `&mut ()` can't be used as a const parameter type + --> $DIR/const_param_ty_bad.rs:10:11 + | +LL | check(&mut ()); + | ----- ^^^^^^^ the trait `ConstParamTy` is not implemented for `&mut ()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/const_param_ty_bad.rs:4:18 + | +LL | fn check(_: impl std::marker::ConstParamTy) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error[E0277]: `*mut ()` can't be used as a const parameter type + --> $DIR/const_param_ty_bad.rs:11:11 + | +LL | check(&mut () as *mut ()); + | ----- ^^^^^^^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `*mut ()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/const_param_ty_bad.rs:4:18 + | +LL | fn check(_: impl std::marker::ConstParamTy) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error[E0277]: `*const ()` can't be used as a const parameter type + --> $DIR/const_param_ty_bad.rs:12:11 + | +LL | check(&() as *const ()); + | ----- ^^^^^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `*const ()` + | | + | required by a bound introduced by this call + | +note: required by a bound in `check` + --> $DIR/const_param_ty_bad.rs:4:18 + | +LL | fn check(_: impl std::marker::ConstParamTy) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs new file mode 100644 index 0000000000000..b0e3b13cc1ef9 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.rs @@ -0,0 +1,12 @@ +#![allow(incomplete_features)] +#![feature(adt_const_params)] + +#[derive(PartialEq, Eq)] +struct NotParam; + +fn check() {} + +fn main() { + check::<[NotParam; 0]>(); + //~^ error: `NotParam` can't be used as a const parameter type +} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr new file mode 100644 index 0000000000000..ef55242df8742 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad_empty_array.stderr @@ -0,0 +1,16 @@ +error[E0277]: `NotParam` can't be used as a const parameter type + --> $DIR/const_param_ty_bad_empty_array.rs:10:13 + | +LL | check::<[NotParam; 0]>(); + | ^^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `NotParam` + | + = note: required for `[NotParam; 0]` to implement `ConstParamTy` +note: required by a bound in `check` + --> $DIR/const_param_ty_bad_empty_array.rs:7:13 + | +LL | fn check() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs new file mode 100644 index 0000000000000..e4dc76703a2d8 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.rs @@ -0,0 +1,13 @@ +#![allow(incomplete_features)] +#![feature(adt_const_params)] + +#[derive(PartialEq, Eq)] +struct NotParam; + +fn check() {} + +fn main() { + check::<&NotParam>(); //~ error: `NotParam` can't be used as a const parameter type + check::<[NotParam]>(); //~ error: `NotParam` can't be used as a const parameter type + check::<[NotParam; 17]>(); //~ error: `NotParam` can't be used as a const parameter type +} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr new file mode 100644 index 0000000000000..86d1c94e87f96 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_generic_bounds_do_not_hold.stderr @@ -0,0 +1,42 @@ +error[E0277]: `NotParam` can't be used as a const parameter type + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:10:13 + | +LL | check::<&NotParam>(); + | ^^^^^^^^^ the trait `ConstParamTy` is not implemented for `NotParam` + | + = note: required for `&NotParam` to implement `ConstParamTy` +note: required by a bound in `check` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 + | +LL | fn check() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error[E0277]: `NotParam` can't be used as a const parameter type + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:11:13 + | +LL | check::<[NotParam]>(); + | ^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `NotParam` + | + = note: required for `[NotParam]` to implement `ConstParamTy` +note: required by a bound in `check` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 + | +LL | fn check() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error[E0277]: `NotParam` can't be used as a const parameter type + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:12:13 + | +LL | check::<[NotParam; 17]>(); + | ^^^^^^^^^^^^^^ the trait `ConstParamTy` is not implemented for `NotParam` + | + = note: required for `[NotParam; 17]` to implement `ConstParamTy` +note: required by a bound in `check` + --> $DIR/const_param_ty_generic_bounds_do_not_hold.rs:7:13 + | +LL | fn check() {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `check` + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_good.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_good.rs new file mode 100644 index 0000000000000..a1b711a3024e3 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_good.rs @@ -0,0 +1,43 @@ +// check-pass +#![allow(incomplete_features)] +#![feature(adt_const_params)] +use std::marker::ConstParamTy; + +#[derive(PartialEq, Eq)] +struct S { + field: u8, + gen: T, +} + +impl ConstParamTy for S {} + +fn check() {} + +fn main() { + check::(); + check::(); + check::(); + check::(); + check::(); + + check::(); + check::(); + check::(); + check::(); + check::(); + + check::(); + check::(); + check::(); + + check::<&u8>(); + check::<&str>(); + check::<[usize]>(); + check::<[u16; 0]>(); + check::<[u8; 42]>(); + + check::>(); + check::>(); + + // FIXME: test tuples +} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.rs new file mode 100644 index 0000000000000..07fd243737e2a --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.rs @@ -0,0 +1,13 @@ +#![allow(incomplete_features)] +#![feature(adt_const_params)] + +#[derive(PartialEq, Eq)] +struct NotParam; + +#[derive(PartialEq, Eq)] +struct CantParam(NotParam); + +impl std::marker::ConstParamTy for CantParam {} +//~^ error: the trait `ConstParamTy` cannot be implemented for this type + +fn main() {} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr new file mode 100644 index 0000000000000..c8e065848b1e0 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_bad_field.stderr @@ -0,0 +1,12 @@ +error[E0204]: the trait `ConstParamTy` cannot be implemented for this type + --> $DIR/const_param_ty_impl_bad_field.rs:10:36 + | +LL | struct CantParam(NotParam); + | -------- this field does not implement `ConstParamTy` +LL | +LL | impl std::marker::ConstParamTy for CantParam {} + | ^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0204`. diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs new file mode 100644 index 0000000000000..17ef396164efd --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.rs @@ -0,0 +1,17 @@ +#![allow(incomplete_features)] +#![feature(adt_const_params)] + +#[derive(PartialEq, Eq)] +struct ImplementsConstParamTy; +impl std::marker::ConstParamTy for ImplementsConstParamTy {} + +struct CantParam(ImplementsConstParamTy); + +impl std::marker::ConstParamTy for CantParam {} +//~^ error: the type `CantParam` does not `#[derive(Eq)]` + +fn check() {} + +fn main() { + check::(); +} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr new file mode 100644 index 0000000000000..ca5abf5e25420 --- /dev/null +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_impl_no_structural_eq.stderr @@ -0,0 +1,12 @@ +error[E0277]: the type `CantParam` does not `#[derive(Eq)]` + --> $DIR/const_param_ty_impl_no_structural_eq.rs:10:36 + | +LL | impl std::marker::ConstParamTy for CantParam {} + | ^^^^^^^^^ the trait `StructuralEq` is not implemented for `CantParam` + | +note: required by a bound in `ConstParamTy` + --> $SRC_DIR/core/src/marker.rs:LL:COL + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/const-generics/assoc_const_eq_diagnostic.rs b/tests/ui/const-generics/assoc_const_eq_diagnostic.rs index 4d0aaf88e403b..bf8202ac15267 100644 --- a/tests/ui/const-generics/assoc_const_eq_diagnostic.rs +++ b/tests/ui/const-generics/assoc_const_eq_diagnostic.rs @@ -10,6 +10,7 @@ pub trait Parse { pub trait CoolStuff: Parse {} //~^ ERROR expected associated constant bound +//~| ERROR expected associated constant bound //~| ERROR expected type fn no_help() -> Mode::Cool {} diff --git a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr index ba727ee0ea308..d7e5e50cba82d 100644 --- a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr +++ b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr @@ -8,7 +8,7 @@ LL | pub trait CoolStuff: Parse {} | help: try using the variant's enum: `Mode` error[E0573]: expected type, found variant `Mode::Cool` - --> $DIR/assoc_const_eq_diagnostic.rs:15:17 + --> $DIR/assoc_const_eq_diagnostic.rs:16:17 | LL | fn no_help() -> Mode::Cool {} | ^^^^^^^^^^ @@ -28,6 +28,18 @@ note: associated constant defined here LL | const MODE: Mode; | ^^^^^^^^^^^^^^^^ -error: aborting due to 3 previous errors +error: expected associated constant bound, found type + --> $DIR/assoc_const_eq_diagnostic.rs:11:28 + | +LL | pub trait CoolStuff: Parse {} + | ^^^^^^^^^^^^^^^^^ help: if equating a const, try wrapping with braces: `MODE = { const }` + | +note: associated constant defined here + --> $DIR/assoc_const_eq_diagnostic.rs:8:5 + | +LL | const MODE: Mode; + | ^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0573`. diff --git a/tests/ui/const-generics/nested-type.rs b/tests/ui/const-generics/nested-type.rs index 5240f5c3b0b64..ff95018065a84 100644 --- a/tests/ui/const-generics/nested-type.rs +++ b/tests/ui/const-generics/nested-type.rs @@ -3,7 +3,7 @@ #![cfg_attr(full, feature(adt_const_params))] #![cfg_attr(full, allow(incomplete_features))] -struct Foo; impl Foo { @@ -15,5 +15,9 @@ struct Foo::value() //~^ ERROR cannot call non-const fn }]>; +//[min]~^^^^^^^^^^^^ ERROR `[u8; { + +// N.B. it is important that the comment above is not inside the array length, +// otherwise it may check for itself, instead of the actual error fn main() {} diff --git a/tests/ui/consts/auxiliary/external_macro.rs b/tests/ui/consts/auxiliary/external_macro.rs index d260634c9963b..fea24703ddadf 100644 --- a/tests/ui/consts/auxiliary/external_macro.rs +++ b/tests/ui/consts/auxiliary/external_macro.rs @@ -9,6 +9,6 @@ macro_rules! static_assert { ($test:expr) => { #[allow(dead_code)] - const _: () = [()][!($test: bool) as usize]; + const _: () = [()][!($test) as usize]; } } diff --git a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr index a3c607b59037f..6d92fa5e14e98 100644 --- a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr +++ b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr @@ -65,6 +65,7 @@ error: unexpected `,` in pattern LL | let women, men: (Vec, Vec) = genomes.iter().cloned() | ^ | + = note: type ascription syntax has been removed, see issue #101728 help: try adding parentheses to match on a tuple | LL | let (women, men): (Vec, Vec) = genomes.iter().cloned() diff --git a/tests/ui/error-codes/E0719.rs b/tests/ui/error-codes/E0719.rs index 3311e190937cc..cbf1bb219a07b 100644 --- a/tests/ui/error-codes/E0719.rs +++ b/tests/ui/error-codes/E0719.rs @@ -1,5 +1,6 @@ trait Foo: Iterator {} //~^ ERROR is already specified +//~| ERROR is already specified type Unit = (); diff --git a/tests/ui/error-codes/E0719.stderr b/tests/ui/error-codes/E0719.stderr index b342d634334d0..e302f406d02b0 100644 --- a/tests/ui/error-codes/E0719.stderr +++ b/tests/ui/error-codes/E0719.stderr @@ -7,13 +7,21 @@ LL | trait Foo: Iterator {} | `Item` bound here first error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified - --> $DIR/E0719.rs:6:42 + --> $DIR/E0719.rs:1:33 + | +LL | trait Foo: Iterator {} + | ---------- ^^^^^^^^^^ re-bound here + | | + | `Item` bound here first + +error[E0719]: the value of the associated type `Item` (from trait `Iterator`) is already specified + --> $DIR/E0719.rs:7:42 | LL | fn test() -> Box> { | --------- ^^^^^^^^^^^ re-bound here | | | `Item` bound here first -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0719`. diff --git a/tests/ui/feature-gates/feature-gate-debugger-visualizer.rs b/tests/ui/feature-gates/feature-gate-debugger-visualizer.rs deleted file mode 100644 index 4c4dc450d18bc..0000000000000 --- a/tests/ui/feature-gates/feature-gate-debugger-visualizer.rs +++ /dev/null @@ -1,3 +0,0 @@ -#![debugger_visualizer(natvis_file = "auxiliary/debugger-visualizer.natvis")] //~ ERROR the `#[debugger_visualizer]` attribute is an experimental feature - -fn main() {} diff --git a/tests/ui/feature-gates/feature-gate-debugger-visualizer.stderr b/tests/ui/feature-gates/feature-gate-debugger-visualizer.stderr deleted file mode 100644 index e9367fbc6c96c..0000000000000 --- a/tests/ui/feature-gates/feature-gate-debugger-visualizer.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0658]: the `#[debugger_visualizer]` attribute is an experimental feature - --> $DIR/feature-gate-debugger-visualizer.rs:1:1 - | -LL | #![debugger_visualizer(natvis_file = "auxiliary/debugger-visualizer.natvis")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #95939 for more information - = help: add `#![feature(debugger_visualizer)]` to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/feature-gate-type_ascription.rs b/tests/ui/feature-gates/feature-gate-type_ascription.rs index 7a597157300ed..5c3f0e37df63d 100644 --- a/tests/ui/feature-gates/feature-gate-type_ascription.rs +++ b/tests/ui/feature-gates/feature-gate-type_ascription.rs @@ -1,5 +1,5 @@ // Type ascription is unstable fn main() { - let a = 10: u8; //~ ERROR type ascription is experimental + let a = type_ascribe!(10, u8); //~ ERROR use of unstable library feature 'type_ascription': placeholder syntax for type ascription } diff --git a/tests/ui/feature-gates/feature-gate-type_ascription.stderr b/tests/ui/feature-gates/feature-gate-type_ascription.stderr index 615d5b9a1e089..d747aea6d177f 100644 --- a/tests/ui/feature-gates/feature-gate-type_ascription.stderr +++ b/tests/ui/feature-gates/feature-gate-type_ascription.stderr @@ -1,8 +1,8 @@ -error[E0658]: type ascription is experimental +error[E0658]: use of unstable library feature 'type_ascription': placeholder syntax for type ascription --> $DIR/feature-gate-type_ascription.rs:4:13 | -LL | let a = 10: u8; - | ^^^^^^ +LL | let a = type_ascribe!(10, u8); + | ^^^^^^^^^^^^ | = note: see issue #23416 for more information = help: add `#![feature(type_ascription)]` to the crate attributes to enable diff --git a/tests/ui/fmt/format-string-error.rs b/tests/ui/fmt/format-string-error.rs index eae4f3cb5479f..9b436e2c479f2 100644 --- a/tests/ui/fmt/format-string-error.rs +++ b/tests/ui/fmt/format-string-error.rs @@ -17,7 +17,7 @@ fn main() { let _ = format!("}"); //~^ ERROR invalid format string: unmatched `}` found let _ = format!("{\\}"); - //~^ ERROR invalid format string: expected `'}'`, found `'\\'` + //~^ ERROR invalid format string: expected `'}'`, found `'\'` let _ = format!("\n\n\n{\n\n\n"); //~^ ERROR invalid format string let _ = format!(r###" diff --git a/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs b/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs index ecabf8943ea3c..b7b93ef1c443b 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs +++ b/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.rs @@ -5,9 +5,6 @@ trait X { const _: () = { fn f1<'a>(arg : Box>) {} //~^ ERROR: expected one of `>`, a const expression, lifetime, or type, found `:` - //~| ERROR: expected parameter name, found `>` - //~| ERROR: expected one of `!`, `)`, `+`, `,`, or `::`, found `>` - //~| ERROR: constant provided when a type was expected }; const _: () = { diff --git a/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr b/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr index 10ceccedcac1b..bfddb6dc693ca 100644 --- a/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr +++ b/tests/ui/generic-associated-types/parse/trait-path-missing-gen_arg.stderr @@ -3,41 +3,14 @@ error: expected one of `>`, a const expression, lifetime, or type, found `:` | LL | fn f1<'a>(arg : Box>) {} | ^ expected one of `>`, a const expression, lifetime, or type - | -help: expressions must be enclosed in braces to be used as const generic arguments - | -LL | fn f1<'a>(arg : Box<{ dyn X< : 32 } >>) {} - | + + - -error: expected parameter name, found `>` - --> $DIR/trait-path-missing-gen_arg.rs:6:36 - | -LL | fn f1<'a>(arg : Box>) {} - | ^ expected parameter name - -error: expected one of `!`, `)`, `+`, `,`, or `::`, found `>` - --> $DIR/trait-path-missing-gen_arg.rs:6:36 - | -LL | fn f1<'a>(arg : Box>) {} - | ^ - | | - | expected one of `!`, `)`, `+`, `,`, or `::` - | help: missing `,` error: expected one of `>`, a const expression, lifetime, or type, found `=` - --> $DIR/trait-path-missing-gen_arg.rs:14:30 + --> $DIR/trait-path-missing-gen_arg.rs:11:30 | LL | fn f1<'a>(arg : Box>) {} | - ^ expected one of `>`, a const expression, lifetime, or type | | | maybe try to close unmatched angle bracket -error[E0747]: constant provided when a type was expected - --> $DIR/trait-path-missing-gen_arg.rs:6:23 - | -LL | fn f1<'a>(arg : Box>) {} - | ^^^^^^^^^^^ - -error: aborting due to 5 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0747`. diff --git a/tests/ui/generics/single-colon-path-not-const-generics.rs b/tests/ui/generics/single-colon-path-not-const-generics.rs index 55a7ae0bb6d91..dff00b0b72007 100644 --- a/tests/ui/generics/single-colon-path-not-const-generics.rs +++ b/tests/ui/generics/single-colon-path-not-const-generics.rs @@ -6,8 +6,8 @@ pub mod foo { pub struct Foo { a: Vec, - //~^ ERROR expected - //~| HELP path separator + //~^ ERROR path separator must be a double colon + //~| HELP use a double colon instead } fn main() {} diff --git a/tests/ui/generics/single-colon-path-not-const-generics.stderr b/tests/ui/generics/single-colon-path-not-const-generics.stderr index 3eafa9fa5a9dd..96f07e190c1e2 100644 --- a/tests/ui/generics/single-colon-path-not-const-generics.stderr +++ b/tests/ui/generics/single-colon-path-not-const-generics.stderr @@ -1,11 +1,12 @@ -error: expected one of `,` or `>`, found `:` +error: path separator must be a double colon --> $DIR/single-colon-path-not-const-generics.rs:8:18 | +LL | pub struct Foo { + | --- while parsing this struct LL | a: Vec, - | ^ - | | - | expected one of `,` or `>` - | help: write a path separator here: `::` + | ^ help: use a double colon instead: `::` + | + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 error: aborting due to previous error diff --git a/tests/ui/invalid/invalid-debugger-visualizer-option.rs b/tests/ui/invalid/invalid-debugger-visualizer-option.rs index 5645a30ccee7d..150723898bd78 100644 --- a/tests/ui/invalid/invalid-debugger-visualizer-option.rs +++ b/tests/ui/invalid/invalid-debugger-visualizer-option.rs @@ -1,7 +1,6 @@ // normalize-stderr-test: "foo.random:.*\(" -> "foo.random: $$FILE_NOT_FOUND_MSG (" // normalize-stderr-test: "os error \d+" -> "os error $$FILE_NOT_FOUND_CODE" -#![feature(debugger_visualizer)] #![debugger_visualizer(random_file = "../foo.random")] //~ ERROR invalid argument #![debugger_visualizer(natvis_file = "../foo.random")] //~ ERROR fn main() {} diff --git a/tests/ui/invalid/invalid-debugger-visualizer-option.stderr b/tests/ui/invalid/invalid-debugger-visualizer-option.stderr index afb8d16ee960a..6fbb4d641e6f6 100644 --- a/tests/ui/invalid/invalid-debugger-visualizer-option.stderr +++ b/tests/ui/invalid/invalid-debugger-visualizer-option.stderr @@ -1,5 +1,5 @@ error: invalid argument - --> $DIR/invalid-debugger-visualizer-option.rs:5:24 + --> $DIR/invalid-debugger-visualizer-option.rs:4:24 | LL | #![debugger_visualizer(random_file = "../foo.random")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | #![debugger_visualizer(random_file = "../foo.random")] = note: expected: `gdb_script_file = "..."` error: couldn't read $DIR/../foo.random: $FILE_NOT_FOUND_MSG (os error $FILE_NOT_FOUND_CODE) - --> $DIR/invalid-debugger-visualizer-option.rs:6:24 + --> $DIR/invalid-debugger-visualizer-option.rs:5:24 | LL | #![debugger_visualizer(natvis_file = "../foo.random")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/invalid/invalid-debugger-visualizer-target.rs b/tests/ui/invalid/invalid-debugger-visualizer-target.rs index f0aba6a75c4cb..f9dd20dbfed1d 100644 --- a/tests/ui/invalid/invalid-debugger-visualizer-target.rs +++ b/tests/ui/invalid/invalid-debugger-visualizer-target.rs @@ -1,4 +1,2 @@ -#![feature(debugger_visualizer)] - #[debugger_visualizer(natvis_file = "../foo.natvis")] //~ ERROR attribute should be applied to a module fn main() {} diff --git a/tests/ui/invalid/invalid-debugger-visualizer-target.stderr b/tests/ui/invalid/invalid-debugger-visualizer-target.stderr index 3555bbb169b1c..7944f7518593c 100644 --- a/tests/ui/invalid/invalid-debugger-visualizer-target.stderr +++ b/tests/ui/invalid/invalid-debugger-visualizer-target.stderr @@ -1,5 +1,5 @@ error: attribute should be applied to a module - --> $DIR/invalid-debugger-visualizer-target.rs:3:1 + --> $DIR/invalid-debugger-visualizer-target.rs:1:1 | LL | #[debugger_visualizer(natvis_file = "../foo.natvis")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/issues/issue-22644.rs b/tests/ui/issues/issue-22644.rs index b1d69dcd86260..e3ada65049d56 100644 --- a/tests/ui/issues/issue-22644.rs +++ b/tests/ui/issues/issue-22644.rs @@ -1,18 +1,12 @@ -#![feature(type_ascription)] - fn main() { - let a : usize = 0; - let long_name : usize = 0; + let a: usize = 0; + let long_name: usize = 0; println!("{}", a as usize > long_name); println!("{}", a as usize < long_name); //~ ERROR `<` is interpreted as a start of generic println!("{}{}", a as usize < long_name, long_name); //~^ ERROR `<` is interpreted as a start of generic println!("{}", a as usize < 4); //~ ERROR `<` is interpreted as a start of generic - println!("{}", a: usize > long_name); - println!("{}{}", a: usize < long_name, long_name); - //~^ ERROR `<` is interpreted as a start of generic - println!("{}", a: usize < 4); //~ ERROR `<` is interpreted as a start of generic println!("{}", a as @@ -30,6 +24,4 @@ fn main() { 5); println!("{}", a as usize << long_name); //~ ERROR `<<` is interpreted as a start of generic - - println!("{}", a: &mut 4); //~ ERROR expected type, found `4` } diff --git a/tests/ui/issues/issue-22644.stderr b/tests/ui/issues/issue-22644.stderr index 45027afa7b62b..0799e9ef11b14 100644 --- a/tests/ui/issues/issue-22644.stderr +++ b/tests/ui/issues/issue-22644.stderr @@ -1,5 +1,5 @@ error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:8:31 + --> $DIR/issue-22644.rs:6:31 | LL | println!("{}", a as usize < long_name); | ^ --------- interpreted as generic arguments @@ -12,7 +12,7 @@ LL | println!("{}", (a as usize) < long_name); | + + error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:9:33 + --> $DIR/issue-22644.rs:7:33 | LL | println!("{}{}", a as usize < long_name, long_name); | ^ -------------------- interpreted as generic arguments @@ -25,7 +25,7 @@ LL | println!("{}{}", (a as usize) < long_name, long_name); | + + error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:11:31 + --> $DIR/issue-22644.rs:9:31 | LL | println!("{}", a as usize < 4); | ^ - interpreted as generic arguments @@ -38,33 +38,7 @@ LL | println!("{}", (a as usize) < 4); | + + error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:13:31 - | -LL | println!("{}{}", a: usize < long_name, long_name); - | ^ -------------------- interpreted as generic arguments - | | - | not interpreted as comparison - | -help: try comparing the cast value - | -LL | println!("{}{}", (a: usize) < long_name, long_name); - | + + - -error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:15:29 - | -LL | println!("{}", a: usize < 4); - | ^ - interpreted as generic arguments - | | - | not interpreted as comparison - | -help: try comparing the cast value - | -LL | println!("{}", (a: usize) < 4); - | + + - -error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:20:20 + --> $DIR/issue-22644.rs:14:20 | LL | < | ^ not interpreted as comparison @@ -79,7 +53,7 @@ LL ~ usize) | error: `<` is interpreted as a start of generic arguments for `usize`, not a comparison - --> $DIR/issue-22644.rs:29:20 + --> $DIR/issue-22644.rs:23:20 | LL | < | ^ not interpreted as comparison @@ -96,7 +70,7 @@ LL ~ usize) | error: `<<` is interpreted as a start of generic arguments for `usize`, not a shift - --> $DIR/issue-22644.rs:32:31 + --> $DIR/issue-22644.rs:26:31 | LL | println!("{}", a as usize << long_name); | ^^ --------- interpreted as generic arguments @@ -108,16 +82,5 @@ help: try shifting the cast value LL | println!("{}", (a as usize) << long_name); | + + -error: expected type, found `4` - --> $DIR/issue-22644.rs:34:28 - | -LL | println!("{}", a: &mut 4); - | - ^ expected type - | | - | tried to parse a type due to this type ascription - | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` - = note: see issue #23416 for more information - -error: aborting due to 9 previous errors +error: aborting due to 6 previous errors diff --git a/tests/ui/lint/noop-method-call.rs b/tests/ui/lint/noop-method-call.rs index 89b2966359542..dbcf2a5131b5b 100644 --- a/tests/ui/lint/noop-method-call.rs +++ b/tests/ui/lint/noop-method-call.rs @@ -19,18 +19,17 @@ fn main() { let clone_type_ref = &CloneType(1u32); let clone_type_ref_clone: CloneType = clone_type_ref.clone(); - // Calling clone on a double reference doesn't warn since the method call itself - // peels the outer reference off let clone_type_ref = &&CloneType(1u32); let clone_type_ref_clone: &CloneType = clone_type_ref.clone(); + //~^ WARNING using `.clone()` on a double reference, which returns `&CloneType` let non_deref_type = &PlainType(1u32); let non_deref_type_deref: &PlainType = non_deref_type.deref(); //~^ WARNING call to `.deref()` on a reference in this situation does nothing - // Dereferencing a &&T does not warn since it has collapsed the double reference let non_deref_type = &&PlainType(1u32); let non_deref_type_deref: &PlainType = non_deref_type.deref(); + //~^ WARNING using `.deref()` on a double reference, which returns `&PlainType` let non_borrow_type = &PlainType(1u32); let non_borrow_type_borrow: &PlainType = non_borrow_type.borrow(); @@ -41,7 +40,8 @@ fn main() { let non_borrow_type_borrow: &PlainType = non_borrow_type.borrow(); let xs = ["a", "b", "c"]; - let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // ok, but could use `*x` instead + let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead + //~^ WARNING using `.clone()` on a double reference, which returns `&str` } fn generic(non_clone_type: &PlainType) { diff --git a/tests/ui/lint/noop-method-call.stderr b/tests/ui/lint/noop-method-call.stderr index 6a904d01abc8e..37cd1a0fc18ea 100644 --- a/tests/ui/lint/noop-method-call.stderr +++ b/tests/ui/lint/noop-method-call.stderr @@ -11,22 +11,42 @@ note: the lint level is defined here LL | #![warn(noop_method_call)] | ^^^^^^^^^^^^^^^^ +warning: using `.clone()` on a double reference, which returns `&CloneType` instead of cloning the inner type + --> $DIR/noop-method-call.rs:23:63 + | +LL | let clone_type_ref_clone: &CloneType = clone_type_ref.clone(); + | ^^^^^^^^ + | + = note: `#[warn(suspicious_double_ref_op)]` on by default + warning: call to `.deref()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:28:63 + --> $DIR/noop-method-call.rs:27:63 | LL | let non_deref_type_deref: &PlainType = non_deref_type.deref(); | ^^^^^^^^ unnecessary method call | = note: the type `&PlainType` which `deref` is being called on is the same as the type returned from `deref`, so the method call does not do anything and can be removed +warning: using `.deref()` on a double reference, which returns `&PlainType` instead of dereferencing the inner type + --> $DIR/noop-method-call.rs:31:63 + | +LL | let non_deref_type_deref: &PlainType = non_deref_type.deref(); + | ^^^^^^^^ + warning: call to `.borrow()` on a reference in this situation does nothing - --> $DIR/noop-method-call.rs:36:66 + --> $DIR/noop-method-call.rs:35:66 | LL | let non_borrow_type_borrow: &PlainType = non_borrow_type.borrow(); | ^^^^^^^^^ unnecessary method call | = note: the type `&PlainType` which `borrow` is being called on is the same as the type returned from `borrow`, so the method call does not do anything and can be removed +warning: using `.clone()` on a double reference, which returns `&str` instead of cloning the inner type + --> $DIR/noop-method-call.rs:43:44 + | +LL | let _v: Vec<&str> = xs.iter().map(|x| x.clone()).collect(); // could use `*x` instead + | ^^^^^^^^ + warning: call to `.clone()` on a reference in this situation does nothing --> $DIR/noop-method-call.rs:48:19 | @@ -43,5 +63,5 @@ LL | non_clone_type.clone(); | = note: the type `&PlainType` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed -warning: 5 warnings emitted +warning: 8 warnings emitted diff --git a/tests/ui/lint/suspicious-double-ref-op.rs b/tests/ui/lint/suspicious-double-ref-op.rs new file mode 100644 index 0000000000000..b9bcd31c2a8b0 --- /dev/null +++ b/tests/ui/lint/suspicious-double-ref-op.rs @@ -0,0 +1,30 @@ +#![feature(lazy_cell)] +#![deny(suspicious_double_ref_op, noop_method_call)] + +pub fn clone_on_double_ref() { + let x = vec![1]; + let y = &&x; + let z: &Vec<_> = y.clone(); + //~^ ERROR using `.clone()` on a double reference, which returns `&Vec` + + println!("{:p} {:p}", *y, z); +} + +use std::sync::LazyLock; + +pub static STRS: LazyLock<&str> = LazyLock::new(|| "First"); + +// https://github.com/rust-lang/rust-clippy/issues/9272 +fn rust_clippy_issue_9272() { + let str = STRS.clone(); + println!("{str}") +} + +fn check(mut encoded: &[u8]) { + let _ = &mut encoded.clone(); + //~^ ERROR call to `.clone()` on a reference in this situation does nothing + let _ = &encoded.clone(); + //~^ ERROR call to `.clone()` on a reference in this situation does nothing +} + +fn main() {} diff --git a/tests/ui/lint/suspicious-double-ref-op.stderr b/tests/ui/lint/suspicious-double-ref-op.stderr new file mode 100644 index 0000000000000..d15487ca23865 --- /dev/null +++ b/tests/ui/lint/suspicious-double-ref-op.stderr @@ -0,0 +1,35 @@ +error: using `.clone()` on a double reference, which returns `&Vec` instead of cloning the inner type + --> $DIR/suspicious-double-ref-op.rs:7:23 + | +LL | let z: &Vec<_> = y.clone(); + | ^^^^^^^^ + | +note: the lint level is defined here + --> $DIR/suspicious-double-ref-op.rs:2:9 + | +LL | #![deny(suspicious_double_ref_op, noop_method_call)] + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: call to `.clone()` on a reference in this situation does nothing + --> $DIR/suspicious-double-ref-op.rs:24:25 + | +LL | let _ = &mut encoded.clone(); + | ^^^^^^^^ unnecessary method call + | + = note: the type `&[u8]` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed +note: the lint level is defined here + --> $DIR/suspicious-double-ref-op.rs:2:35 + | +LL | #![deny(suspicious_double_ref_op, noop_method_call)] + | ^^^^^^^^^^^^^^^^ + +error: call to `.clone()` on a reference in this situation does nothing + --> $DIR/suspicious-double-ref-op.rs:26:21 + | +LL | let _ = &encoded.clone(); + | ^^^^^^^^ unnecessary method call + | + = note: the type `&[u8]` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed + +error: aborting due to 3 previous errors + diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs index 79d8cd7571603..816f99baa8495 100644 --- a/tests/ui/macros/stringify.rs +++ b/tests/ui/macros/stringify.rs @@ -134,8 +134,7 @@ fn test_expr() { assert_eq!(stringify_expr!(expr as T), "expr as T"); // ExprKind::Type - assert_eq!(stringify_expr!(expr: T), "expr: T"); - assert_eq!(stringify_expr!(expr: T), "expr: T"); + // There is no syntax for type ascription. // ExprKind::If assert_eq!(stringify_expr!(if true {}), "if true {}"); diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail.rs b/tests/ui/or-patterns/or-patterns-syntactic-fail.rs index 358e9d034c474..23dbb57cbcf0f 100644 --- a/tests/ui/or-patterns/or-patterns-syntactic-fail.rs +++ b/tests/ui/or-patterns/or-patterns-syntactic-fail.rs @@ -8,9 +8,12 @@ use E::*; fn no_top_level_or_patterns() { // We do *not* allow or-patterns at the top level of lambdas... - let _ = |A | B: E| (); //~ ERROR no implementation for `E | ()` + let _ = |A | B: E| (); + //~^ ERROR expected identifier, found // -------- This looks like an or-pattern but is in fact `|A| (B: E | ())`. +} +fn no_top_level_or_patterns_2() { // ...and for now neither do we allow or-patterns at the top level of functions. fn fun1(A | B: E) {} //~^ ERROR top-level or-patterns are not allowed diff --git a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr index 604bba417e6cc..c16a90368e194 100644 --- a/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr +++ b/tests/ui/or-patterns/or-patterns-syntactic-fail.stderr @@ -1,43 +1,34 @@ +error: expected identifier, found `:` + --> $DIR/or-patterns-syntactic-fail.rs:11:19 + | +LL | let _ = |A | B: E| (); + | ^ expected identifier + | + = note: type ascription syntax has been removed, see issue #101728 + error: top-level or-patterns are not allowed in function parameters - --> $DIR/or-patterns-syntactic-fail.rs:15:13 + --> $DIR/or-patterns-syntactic-fail.rs:18:13 | LL | fn fun1(A | B: E) {} | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` error: top-level or-patterns are not allowed in function parameters - --> $DIR/or-patterns-syntactic-fail.rs:18:13 + --> $DIR/or-patterns-syntactic-fail.rs:21:13 | LL | fn fun2(| A | B: E) {} | ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)` error: top-level or-patterns are not allowed in `let` bindings - --> $DIR/or-patterns-syntactic-fail.rs:23:9 + --> $DIR/or-patterns-syntactic-fail.rs:26:9 | LL | let A | B: E = A; | ^^^^^ help: wrap the pattern in parentheses: `(A | B)` error: top-level or-patterns are not allowed in `let` bindings - --> $DIR/or-patterns-syntactic-fail.rs:26:9 + --> $DIR/or-patterns-syntactic-fail.rs:29:9 | LL | let | A | B: E = A; | ^^^^^^^ help: wrap the pattern in parentheses: `(A | B)` -error[E0369]: no implementation for `E | ()` - --> $DIR/or-patterns-syntactic-fail.rs:11:22 - | -LL | let _ = |A | B: E| (); - | ----^ -- () - | | - | E - | -note: an implementation of `BitOr<()>` might be missing for `E` - --> $DIR/or-patterns-syntactic-fail.rs:6:1 - | -LL | enum E { A, B } - | ^^^^^^ must implement `BitOr<()>` -note: the trait `BitOr` must be implemented - --> $SRC_DIR/core/src/ops/bit.rs:LL:COL - error: aborting due to 5 previous errors -For more information about this error, try `rustc --explain E0369`. diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.rs b/tests/ui/parser/attr-stmt-expr-attr-bad.rs index c94a32146b90b..d1950087c4c2d 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.rs +++ b/tests/ui/parser/attr-stmt-expr-attr-bad.rs @@ -6,6 +6,7 @@ fn main() {} //~^ ERROR expected one of #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } //~^ ERROR an inner attribute is not permitted in this context +//~| ERROR an inner attribute is not permitted in this context //~| ERROR expected expression, found `)` #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } //~^ ERROR an inner attribute is not permitted in this context diff --git a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr b/tests/ui/parser/attr-stmt-expr-attr-bad.stderr index a857f11fd18d4..96899fd3fc5ca 100644 --- a/tests/ui/parser/attr-stmt-expr-attr-bad.stderr +++ b/tests/ui/parser/attr-stmt-expr-attr-bad.stderr @@ -19,6 +19,15 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files = note: outer attributes, like `#[test]`, annotate the item following them +error: an inner attribute is not permitted in this context + --> $DIR/attr-stmt-expr-attr-bad.rs:7:36 + | +LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } + | ^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + error: expected expression, found `)` --> $DIR/attr-stmt-expr-attr-bad.rs:7:44 | @@ -26,7 +35,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); } | ^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:10:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:11:38 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^^^^^^^^ @@ -35,13 +44,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `)` - --> $DIR/attr-stmt-expr-attr-bad.rs:10:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:11:46 | LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); } | ^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:13:36 + --> $DIR/attr-stmt-expr-attr-bad.rs:14:36 | LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } | ^^^^^^^^ @@ -50,7 +59,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:15:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:16:33 | LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } | ^^^^^^^^ @@ -59,7 +68,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:17:33 + --> $DIR/attr-stmt-expr-attr-bad.rs:18:33 | LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } | ^^^^^^^^ @@ -68,13 +77,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:19:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:20:34 | LL | #[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; } | ^ expected one of 8 possible tokens error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:21:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:22:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } | ^^^^^^^^ @@ -83,7 +92,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:23:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:24:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } | ^^^^^^^^ @@ -92,7 +101,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:25:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:26:35 | LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } | ^^^^^^^^ @@ -101,7 +110,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:27:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:28:40 | LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } | ^^^^^^^^ @@ -110,19 +119,19 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected expression, found `..` - --> $DIR/attr-stmt-expr-attr-bad.rs:29:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:30:40 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; } | ^^ expected expression error: expected expression, found `..` - --> $DIR/attr-stmt-expr-attr-bad.rs:31:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:32:40 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..; } | ^^ expected expression error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:33:41 + --> $DIR/attr-stmt-expr-attr-bad.rs:34:41 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } | ^^^^^^^^ @@ -131,7 +140,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:35:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:36:45 | LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } | ^^^^^^^^ @@ -140,7 +149,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:37:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:38:37 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -149,7 +158,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:39:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:40:38 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } | ^^^^^^^^ @@ -158,13 +167,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:41:40 + --> $DIR/attr-stmt-expr-attr-bad.rs:42:40 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:43:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:44:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -173,7 +182,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; } | the branch belongs to this `else` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:45:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:46:46 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -182,7 +191,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:47:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:48:45 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | ---- ^^^^^^^ ------- the attributes are attached to this branch @@ -191,7 +200,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; } | the branch belongs to this `else` error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:49:50 + --> $DIR/attr-stmt-expr-attr-bad.rs:50:50 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -200,7 +209,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:51:51 + --> $DIR/attr-stmt-expr-attr-bad.rs:52:51 | LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } | ^^^^^^^^ @@ -209,7 +218,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:53:45 + --> $DIR/attr-stmt-expr-attr-bad.rs:54:45 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -218,7 +227,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; } | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:55:46 + --> $DIR/attr-stmt-expr-attr-bad.rs:56:46 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -227,13 +236,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:57:48 + --> $DIR/attr-stmt-expr-attr-bad.rs:58:48 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:59:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:60:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | ---- ^^^^^^^ -- the attributes are attached to this branch @@ -242,7 +251,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; } | the branch belongs to this `else` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:61:54 + --> $DIR/attr-stmt-expr-attr-bad.rs:62:54 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } | ^^^^^^^^ @@ -251,7 +260,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; } = note: outer attributes, like `#[test]`, annotate the item following them error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:63:53 + --> $DIR/attr-stmt-expr-attr-bad.rs:64:53 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; } | ---- ^^^^^^^ --------------- the attributes are attached to this branch @@ -260,7 +269,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {} | the branch belongs to this `else` error: outer attributes are not allowed on `if` and `else` branches - --> $DIR/attr-stmt-expr-attr-bad.rs:65:66 + --> $DIR/attr-stmt-expr-attr-bad.rs:66:66 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; } | -- ^^^^^^^ -- the attributes are attached to this branch @@ -269,7 +278,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {} | the branch belongs to this `if` error: an inner attribute is not permitted in this context - --> $DIR/attr-stmt-expr-attr-bad.rs:67:67 + --> $DIR/attr-stmt-expr-attr-bad.rs:68:67 | LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; } | ^^^^^^^^ @@ -278,7 +287,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]} = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:70:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:71:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -289,7 +298,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:72:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:73:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } | ------- ^^^^^^^^ not permitted following an outer attribute @@ -300,7 +309,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; } = note: outer attributes, like `#[test]`, annotate the item following them error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:74:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:75:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -316,7 +325,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!(); } | error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:76:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:77:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; } | ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation @@ -332,7 +341,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo![]; } | error: an inner attribute is not permitted following an outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:78:32 + --> $DIR/attr-stmt-expr-attr-bad.rs:79:32 | LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; } | ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation @@ -348,7 +357,7 @@ LL + #[cfg(FALSE)] fn s() { #[attr] #[attr] foo!{}; } | error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:84:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:85:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | ^^^ help: use `..` instead @@ -356,13 +365,13 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:84:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:85:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } } | ^ expected one of `=>`, `if`, or `|` error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:87:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:88:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | ^^^ help: use `..` instead @@ -370,19 +379,19 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:87:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:88:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } } | ^ expected one of `=>`, `if`, or `|` error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:90:39 + --> $DIR/attr-stmt-expr-attr-bad.rs:91:39 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } } | ^ error[E0586]: inclusive range with no end - --> $DIR/attr-stmt-expr-attr-bad.rs:92:35 + --> $DIR/attr-stmt-expr-attr-bad.rs:93:35 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | ^^^ help: use `..` instead @@ -390,47 +399,47 @@ LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } = note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`) error: expected one of `=>`, `if`, or `|`, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:92:38 + --> $DIR/attr-stmt-expr-attr-bad.rs:93:38 | LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } } | ^ expected one of `=>`, `if`, or `|` error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:96:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:97:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | ^ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:96:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:97:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: unexpected token: `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:99:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:100:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | ^ error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#` - --> $DIR/attr-stmt-expr-attr-bad.rs:99:34 + --> $DIR/attr-stmt-expr-attr-bad.rs:100:34 | LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); } | ^ expected one of `.`, `;`, `?`, `else`, or an operator error: expected statement after outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:104:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:105:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } } | ^^^^^^^ error: expected statement after outer attribute - --> $DIR/attr-stmt-expr-attr-bad.rs:106:37 + --> $DIR/attr-stmt-expr-attr-bad.rs:107:37 | LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } } | ^^^^^^^ -error: aborting due to 52 previous errors +error: aborting due to 53 previous errors For more information about this error, try `rustc --explain E0586`. diff --git a/tests/ui/parser/issue-103869.rs b/tests/ui/parser/issue-103869.rs index 28c442bdd632d..9213437458a59 100644 --- a/tests/ui/parser/issue-103869.rs +++ b/tests/ui/parser/issue-103869.rs @@ -2,7 +2,6 @@ enum VecOrMap{ vec: Vec, //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found `:` //~| HELP: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` - //~| ERROR expected item, found `:` map: HashMap } diff --git a/tests/ui/parser/issue-103869.stderr b/tests/ui/parser/issue-103869.stderr index 0b8cd919a9de2..9eb20e2005a4a 100644 --- a/tests/ui/parser/issue-103869.stderr +++ b/tests/ui/parser/issue-103869.stderr @@ -1,16 +1,12 @@ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `:` --> $DIR/issue-103869.rs:2:8 | +LL | enum VecOrMap{ + | -------- while parsing this enum LL | vec: Vec, | ^ expected one of `(`, `,`, `=`, `{`, or `}` | = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` -error: expected item, found `:` - --> $DIR/issue-103869.rs:2:8 - | -LL | vec: Vec, - | ^ expected item - -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs b/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs index 7bd4b3a165c3d..3d110adef3e34 100644 --- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs +++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.rs @@ -10,14 +10,14 @@ pub fn index_after_as_cast() { vec![1, 2, 3] as Vec[0]; //~^ ERROR: cast cannot be followed by indexing vec![1, 2, 3]: Vec[0]; - //~^ ERROR: type ascription cannot be followed by indexing + //~^ ERROR: expected one of } pub fn index_after_cast_to_index() { (&[0]) as &[i32][0]; //~^ ERROR: cast cannot be followed by indexing (&[0i32]): &[i32; 1][0]; - //~^ ERROR: type ascription cannot be followed by indexing + //~^ ERROR: expected one of } pub fn cast_after_cast() { @@ -25,7 +25,7 @@ pub fn cast_after_cast() { } if 5u64: u64: u64 == 0u64 { - + //~^ ERROR expected `{`, found `:` } let _ = 5u64: u64: u64 as u8 as i8 == 9i8; let _ = 0i32: i32: i32; @@ -36,26 +36,46 @@ pub fn cast_after_cast() { } pub fn cast_cast_method_call() { - let _ = 0i32: i32: i32.count_ones(); - //~^ ERROR: type ascription cannot be followed by a method call - let _ = 0 as i32: i32.count_ones(); - //~^ ERROR: type ascription cannot be followed by a method call - let _ = 0i32: i32 as i32.count_ones(); - //~^ ERROR: cast cannot be followed by a method call + let _ = 0i32: i32: i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_2() { + let _ = 0 as i32: i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_3() { + let _ = 0i32: i32 as i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_4() { let _ = 0 as i32 as i32.count_ones(); //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32: i32 as u32 as i32.count_ones(); - //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32.count_ones(): u32; - //~^ ERROR: type ascription cannot be followed by a method call - let _ = 0 as i32.count_ones(): u32; +} + +pub fn cast_cast_method_call_5() { + let _ = 0i32: i32: i32 as u32 as i32.count_ones(); //~ ERROR expected one of +} + +pub fn cast_cast_method_call_6() { + let _ = 0i32: i32.count_ones(): u32; //~ ERROR expected one of +} + +pub fn cast_cast_method_call_7() { + let _ = 0 as i32.count_ones(): u32; //~ ERROR expected one of //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32.count_ones() as u32; - //~^ ERROR: type ascription cannot be followed by a method call +} + +pub fn cast_cast_method_call_8() { + let _ = 0i32: i32.count_ones() as u32; //~ ERROR expected one of +} + +pub fn cast_cast_method_call_9() { let _ = 0 as i32.count_ones() as u32; //~^ ERROR: cast cannot be followed by a method call - let _ = 0i32: i32: i32.count_ones() as u32 as i32; - //~^ ERROR: type ascription cannot be followed by a method call +} + +pub fn cast_cast_method_call_10() { + let _ = 0i32: i32: i32.count_ones() as u32 as i32; //~ ERROR expected one of } pub fn multiline_error() { @@ -74,8 +94,7 @@ pub fn precedence() { pub fn method_calls() { 0 as i32.max(0); //~^ ERROR: cast cannot be followed by a method call - 0: i32.max(0); - //~^ ERROR: type ascription cannot be followed by a method call + 0: i32.max(0); //~ ERROR expected one of } pub fn complex() { @@ -84,7 +103,7 @@ pub fn complex() { if true { 33 } else { 44 } as i32.max(0), //~^ ERROR: cast cannot be followed by a method call if true { 33 } else { 44 }: i32.max(0) - //~^ ERROR: type ascription cannot be followed by a method call + //~^ ERROR: expected one of ); } @@ -93,7 +112,7 @@ pub fn in_condition() { //~^ ERROR: cast cannot be followed by a method call } if 5u64: u64.max(0) == 0 { - //~^ ERROR: type ascription cannot be followed by a method call + //~^ ERROR: expected `{`, found `:` } } @@ -104,7 +123,7 @@ pub fn inside_block() { } else { false }; let _ = if true { 5u64: u64.max(0) == 0 - //~^ ERROR: type ascription cannot be followed by a method call + //~^ ERROR: expected one of } else { false }; } @@ -112,14 +131,14 @@ static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); //~^ ERROR: cast cannot be followed by indexing static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); -//~^ ERROR: type ascription cannot be followed by indexing +//~^ ERROR: expected one of pub fn cast_then_try() -> Result { Err(0u64) as Result?; //~^ ERROR: cast cannot be followed by `?` Err(0u64): Result?; - //~^ ERROR: type ascription cannot be followed by `?` + //~^ ERROR: expected one of Ok(1) } @@ -131,13 +150,14 @@ pub fn cast_then_call() { drop as F(); //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214] drop_ptr: F(); - //~^ ERROR: parenthesized type parameters may only be used with a `Fn` trait [E0214] + //~^ ERROR: expected identifier, found `:` } pub fn cast_to_fn_should_work() { let drop_ptr = drop as fn(u8); drop as fn(u8); drop_ptr: fn(u8); + //~^ ERROR expected one of } pub fn parens_after_cast_error() { @@ -145,7 +165,7 @@ pub fn parens_after_cast_error() { drop as fn(u8)(0); //~^ ERROR: cast cannot be followed by a function call drop_ptr: fn(u8)(0); - //~^ ERROR: type ascription cannot be followed by a function call + //~^ ERROR: expected one of } pub async fn cast_then_await() { @@ -153,7 +173,7 @@ pub async fn cast_then_await() { //~^ ERROR: cast cannot be followed by `.await` Box::pin(noop()): Pin>.await; - //~^ ERROR: type ascription cannot be followed by `.await` + //~^ ERROR: expected one of } pub async fn noop() {} @@ -167,5 +187,5 @@ pub fn struct_field() { Foo::default() as Foo.bar; //~^ ERROR: cannot be followed by a field access Foo::default(): Foo.bar; - //~^ ERROR: type ascription cannot be followed by a field access + //~^ ERROR expected one of } diff --git a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr index 0c328bde285aa..d313c888e51c6 100644 --- a/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr +++ b/tests/ui/parser/issues/issue-35813-postfix-after-cast.stderr @@ -9,21 +9,11 @@ help: try surrounding the expression in parentheses LL | (vec![1, 2, 3] as Vec)[0]; | + + -error: type ascription cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:12:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:12:18 | LL | vec![1, 2, 3]: Vec[0]; - | ^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (vec![1, 2, 3]: Vec)[0]; - | + + -help: alternatively, remove the type ascription - | -LL - vec![1, 2, 3]: Vec[0]; -LL + vec![1, 2, 3][0]; - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by indexing --> $DIR/issue-35813-postfix-after-cast.rs:17:5 @@ -36,67 +26,50 @@ help: try surrounding the expression in parentheses LL | ((&[0]) as &[i32])[0]; | + + -error: type ascription cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:19:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:19:14 | LL | (&[0i32]): &[i32; 1][0]; - | ^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected `{`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:27:12 | -LL | ((&[0i32]): &[i32; 1])[0]; - | + + -help: alternatively, remove the type ascription +LL | if 5u64: u64: u64 == 0u64 { + | ^ expected `{` | -LL - (&[0i32]): &[i32; 1][0]; -LL + (&[0i32])[0]; +note: the `if` expression is missing a block after this condition + --> $DIR/issue-35813-postfix-after-cast.rs:27:8 | +LL | if 5u64: u64: u64 == 0u64 { + | ^^^^ -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:39:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:39:17 | LL | let _ = 0i32: i32: i32.count_ones(); - | ^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32: i32).count_ones(); - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0i32: i32: i32.count_ones(); -LL + let _ = 0i32: i32.count_ones(); + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:41:13 +error: expected one of `!`, `(`, `.`, `::`, `;`, `<`, `?`, or `else`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:43:21 | LL | let _ = 0 as i32: i32.count_ones(); - | ^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0 as i32: i32).count_ones(); - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0 as i32: i32.count_ones(); -LL + let _ = 0 as i32.count_ones(); + | ^ expected one of 8 possible tokens | + = note: type ascription syntax has been removed, see issue #101728 -error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:43:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:47:17 | LL | let _ = 0i32: i32 as i32.count_ones(); - | ^^^^^^^^^^^^^^^^ + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32 as i32).count_ones(); - | + + + = note: type ascription syntax has been removed, see issue #101728 error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:45:13 + --> $DIR/issue-35813-postfix-after-cast.rs:51:13 | LL | let _ = 0 as i32 as i32.count_ones(); | ^^^^^^^^^^^^^^^ @@ -106,35 +79,24 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32 as i32).count_ones(); | + + -error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:47:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:56:17 | LL | let _ = 0i32: i32: i32 as u32 as i32.count_ones(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | -LL | let _ = (0i32: i32: i32 as u32 as i32).count_ones(); - | + + + = note: type ascription syntax has been removed, see issue #101728 -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:49:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:60:17 | LL | let _ = 0i32: i32.count_ones(): u32; - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32).count_ones(): u32; - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0i32: i32.count_ones(): u32; -LL + let _ = 0i32.count_ones(): u32; + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:51:13 + --> $DIR/issue-35813-postfix-after-cast.rs:64:13 | LL | let _ = 0 as i32.count_ones(): u32; | ^^^^^^^^ @@ -144,24 +106,24 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32).count_ones(): u32; | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:53:13 +error: expected one of `.`, `;`, `?`, or `else`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:64:34 | -LL | let _ = 0i32: i32.count_ones() as u32; - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses +LL | let _ = 0 as i32.count_ones(): u32; + | ^ expected one of `.`, `;`, `?`, or `else` | -LL | let _ = (0i32: i32).count_ones() as u32; - | + + -help: alternatively, remove the type ascription + = note: type ascription syntax has been removed, see issue #101728 + +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:69:17 | -LL - let _ = 0i32: i32.count_ones() as u32; -LL + let _ = 0i32.count_ones() as u32; +LL | let _ = 0i32: i32.count_ones() as u32; + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:55:13 + --> $DIR/issue-35813-postfix-after-cast.rs:73:13 | LL | let _ = 0 as i32.count_ones() as u32; | ^^^^^^^^ @@ -171,24 +133,16 @@ help: try surrounding the expression in parentheses LL | let _ = (0 as i32).count_ones() as u32; | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:57:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:78:17 | LL | let _ = 0i32: i32: i32.count_ones() as u32 as i32; - | ^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | let _ = (0i32: i32: i32).count_ones() as u32 as i32; - | + + -help: alternatively, remove the type ascription - | -LL - let _ = 0i32: i32: i32.count_ones() as u32 as i32; -LL + let _ = 0i32: i32.count_ones() as u32 as i32; + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | + = note: type ascription syntax has been removed, see issue #101728 error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:62:13 + --> $DIR/issue-35813-postfix-after-cast.rs:82:13 | LL | let _ = 0 | _____________^ @@ -202,7 +156,7 @@ LL ~ as i32) | error: cast cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:70:18 + --> $DIR/issue-35813-postfix-after-cast.rs:90:18 | LL | let x: i32 = &vec![1, 2, 3] as &Vec[0]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -213,7 +167,7 @@ LL | let x: i32 = (&vec![1, 2, 3] as &Vec)[0]; | + + error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:75:5 + --> $DIR/issue-35813-postfix-after-cast.rs:95:5 | LL | 0 as i32.max(0); | ^^^^^^^^ @@ -223,24 +177,14 @@ help: try surrounding the expression in parentheses LL | (0 as i32).max(0); | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:77:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:97:6 | LL | 0: i32.max(0); - | ^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (0: i32).max(0); - | + + -help: alternatively, remove the type ascription - | -LL - 0: i32.max(0); -LL + 0.max(0); - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:92:8 + --> $DIR/issue-35813-postfix-after-cast.rs:111:8 | LL | if 5u64 as i32.max(0) == 0 { | ^^^^^^^^^^^ @@ -250,24 +194,20 @@ help: try surrounding the expression in parentheses LL | if (5u64 as i32).max(0) == 0 { | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:95:8 +error: expected `{`, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:114:12 | LL | if 5u64: u64.max(0) == 0 { - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | if (5u64: u64).max(0) == 0 { - | + + -help: alternatively, remove the type ascription + | ^ expected `{` | -LL - if 5u64: u64.max(0) == 0 { -LL + if 5u64.max(0) == 0 { +note: the `if` expression is missing a block after this condition + --> $DIR/issue-35813-postfix-after-cast.rs:114:8 | +LL | if 5u64: u64.max(0) == 0 { + | ^^^^ error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:102:9 + --> $DIR/issue-35813-postfix-after-cast.rs:121:9 | LL | 5u64 as u32.max(0) == 0 | ^^^^^^^^^^^ @@ -277,24 +217,14 @@ help: try surrounding the expression in parentheses LL | (5u64 as u32).max(0) == 0 | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:106:9 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:125:13 | LL | 5u64: u64.max(0) == 0 - | ^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (5u64: u64).max(0) == 0 - | + + -help: alternatively, remove the type ascription - | -LL - 5u64: u64.max(0) == 0 -LL + 5u64.max(0) == 0 - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:111:24 + --> $DIR/issue-35813-postfix-after-cast.rs:130:24 | LL | static bar: &[i32] = &(&[1,2,3] as &[i32][0..1]); | ^^^^^^^^^^^^^^^^^^ @@ -304,24 +234,14 @@ help: try surrounding the expression in parentheses LL | static bar: &[i32] = &((&[1,2,3] as &[i32])[0..1]); | + + -error: type ascription cannot be followed by indexing - --> $DIR/issue-35813-postfix-after-cast.rs:114:25 +error: expected one of `)`, `,`, `.`, `?`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:133:36 | LL | static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); - | ^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | static bar2: &[i32] = &((&[1i32,2,3]: &[i32; 3])[0..1]); - | + + -help: alternatively, remove the type ascription - | -LL - static bar2: &[i32] = &(&[1i32,2,3]: &[i32; 3][0..1]); -LL + static bar2: &[i32] = &(&[1i32,2,3][0..1]); - | + | ^ expected one of `)`, `,`, `.`, `?`, or an operator error: cast cannot be followed by `?` - --> $DIR/issue-35813-postfix-after-cast.rs:119:5 + --> $DIR/issue-35813-postfix-after-cast.rs:138:5 | LL | Err(0u64) as Result?; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -331,24 +251,28 @@ help: try surrounding the expression in parentheses LL | (Err(0u64) as Result)?; | + + -error: type ascription cannot be followed by `?` - --> $DIR/issue-35813-postfix-after-cast.rs:121:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:140:14 | LL | Err(0u64): Result?; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses + | ^ expected one of `.`, `;`, `?`, `}`, or an operator + +error: expected identifier, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:152:13 | -LL | (Err(0u64): Result)?; - | + + -help: alternatively, remove the type ascription +LL | drop_ptr: F(); + | ^ expected identifier | -LL - Err(0u64): Result?; -LL + Err(0u64)?; + = note: type ascription syntax has been removed, see issue #101728 + +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:159:13 | +LL | drop_ptr: fn(u8); + | ^ expected one of 8 possible tokens error: cast cannot be followed by a function call - --> $DIR/issue-35813-postfix-after-cast.rs:145:5 + --> $DIR/issue-35813-postfix-after-cast.rs:165:5 | LL | drop as fn(u8)(0); | ^^^^^^^^^^^^^^ @@ -358,24 +282,14 @@ help: try surrounding the expression in parentheses LL | (drop as fn(u8))(0); | + + -error: type ascription cannot be followed by a function call - --> $DIR/issue-35813-postfix-after-cast.rs:147:5 +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:167:13 | LL | drop_ptr: fn(u8)(0); - | ^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (drop_ptr: fn(u8))(0); - | + + -help: alternatively, remove the type ascription - | -LL - drop_ptr: fn(u8)(0); -LL + drop_ptr(0); - | + | ^ expected one of 8 possible tokens error: cast cannot be followed by `.await` - --> $DIR/issue-35813-postfix-after-cast.rs:152:5 + --> $DIR/issue-35813-postfix-after-cast.rs:172:5 | LL | Box::pin(noop()) as Pin>>.await; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -385,24 +299,14 @@ help: try surrounding the expression in parentheses LL | (Box::pin(noop()) as Pin>>).await; | + + -error: type ascription cannot be followed by `.await` - --> $DIR/issue-35813-postfix-after-cast.rs:155:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:175:21 | LL | Box::pin(noop()): Pin>.await; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (Box::pin(noop()): Pin>).await; - | + + -help: alternatively, remove the type ascription - | -LL - Box::pin(noop()): Pin>.await; -LL + Box::pin(noop()).await; - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by a field access - --> $DIR/issue-35813-postfix-after-cast.rs:167:5 + --> $DIR/issue-35813-postfix-after-cast.rs:187:5 | LL | Foo::default() as Foo.bar; | ^^^^^^^^^^^^^^^^^^^^^ @@ -412,24 +316,14 @@ help: try surrounding the expression in parentheses LL | (Foo::default() as Foo).bar; | + + -error: type ascription cannot be followed by a field access - --> $DIR/issue-35813-postfix-after-cast.rs:169:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:189:19 | LL | Foo::default(): Foo.bar; - | ^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (Foo::default(): Foo).bar; - | + + -help: alternatively, remove the type ascription - | -LL - Foo::default(): Foo.bar; -LL + Foo::default().bar; - | + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: cast cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:84:9 + --> $DIR/issue-35813-postfix-after-cast.rs:103:9 | LL | if true { 33 } else { 44 } as i32.max(0), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -439,34 +333,18 @@ help: try surrounding the expression in parentheses LL | (if true { 33 } else { 44 } as i32).max(0), | + + -error: type ascription cannot be followed by a method call - --> $DIR/issue-35813-postfix-after-cast.rs:86:9 +error: expected one of `,`, `.`, `?`, or an operator, found `:` + --> $DIR/issue-35813-postfix-after-cast.rs:105:35 | LL | if true { 33 } else { 44 }: i32.max(0) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -help: try surrounding the expression in parentheses - | -LL | (if true { 33 } else { 44 }: i32).max(0) - | + + -help: alternatively, remove the type ascription - | -LL - if true { 33 } else { 44 }: i32.max(0) -LL + if true { 33 } else { 44 }.max(0) - | + | ^ expected one of `,`, `.`, `?`, or an operator error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-35813-postfix-after-cast.rs:131:13 + --> $DIR/issue-35813-postfix-after-cast.rs:150:13 | LL | drop as F(); | ^^^ only `Fn` traits may use parentheses -error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-35813-postfix-after-cast.rs:133:15 - | -LL | drop_ptr: F(); - | ^^^ only `Fn` traits may use parentheses - -error: aborting due to 36 previous errors +error: aborting due to 39 previous errors For more information about this error, try `rustc --explain E0214`. diff --git a/tests/ui/parser/issues/issue-44406.rs b/tests/ui/parser/issues/issue-44406.rs index a5b7e83a01622..6719e58284836 100644 --- a/tests/ui/parser/issues/issue-44406.rs +++ b/tests/ui/parser/issues/issue-44406.rs @@ -6,5 +6,4 @@ macro_rules! foo { fn main() { foo!(true); - //~^ ERROR expected identifier, found keyword } diff --git a/tests/ui/parser/issues/issue-44406.stderr b/tests/ui/parser/issues/issue-44406.stderr index de02ea85b27b7..69ff64c2772de 100644 --- a/tests/ui/parser/issues/issue-44406.stderr +++ b/tests/ui/parser/issues/issue-44406.stderr @@ -1,14 +1,3 @@ -error: expected identifier, found keyword `true` - --> $DIR/issue-44406.rs:8:10 - | -LL | foo!(true); - | ^^^^ expected identifier, found keyword - | -help: escape `true` to use it as an identifier - | -LL | foo!(r#true); - | ++ - error: invalid `struct` delimiters or `fn` call arguments --> $DIR/issue-44406.rs:3:9 | @@ -29,5 +18,5 @@ LL - bar(baz: $rest) LL + bar(: $rest) | -error: aborting due to 2 previous errors +error: aborting due to previous error diff --git a/tests/ui/parser/issues/issue-62913.rs b/tests/ui/parser/issues/issue-62913.rs index 0db06f636c3ec..a55ef5ac71030 100644 --- a/tests/ui/parser/issues/issue-62913.rs +++ b/tests/ui/parser/issues/issue-62913.rs @@ -1,4 +1,4 @@ "\u\\" //~^ ERROR incorrect unicode escape sequence //~| ERROR invalid trailing slash in literal -//~| ERROR expected item, found `"\u\\"` +//~| ERROR expected item, found `"\u\"` diff --git a/tests/ui/parser/issues/issue-91461.rs b/tests/ui/parser/issues/issue-91461.rs index 3e3c411c478ab..80e0940ad8f85 100644 --- a/tests/ui/parser/issues/issue-91461.rs +++ b/tests/ui/parser/issues/issue-91461.rs @@ -1,6 +1,5 @@ fn main() { a(_:b:,) - //~^ ERROR: expected identifier, found reserved identifier `_` - //~| ERROR: expected type, found `,` - //~| ERROR: expected type, found `,` + //~^ ERROR expected identifier, found reserved identifier + //~| ERROR: expected one of } diff --git a/tests/ui/parser/issues/issue-91461.stderr b/tests/ui/parser/issues/issue-91461.stderr index 94fcf1721d8c1..27e1b5cdc177f 100644 --- a/tests/ui/parser/issues/issue-91461.stderr +++ b/tests/ui/parser/issues/issue-91461.stderr @@ -4,28 +4,11 @@ error: expected identifier, found reserved identifier `_` LL | a(_:b:,) | ^ expected identifier, found reserved identifier -error: expected type, found `,` - --> $DIR/issue-91461.rs:2:11 +error: expected one of `)`, `,`, `.`, `?`, or an operator, found `:` + --> $DIR/issue-91461.rs:2:8 | LL | a(_:b:,) - | - -^ expected type - | | | - | | tried to parse a type due to this type ascription - | while parsing this struct - | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` - = note: see issue #23416 for more information - -error: expected type, found `,` - --> $DIR/issue-91461.rs:2:11 - | -LL | a(_:b:,) - | -^ expected type - | | - | tried to parse a type due to this type ascription - | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` - = note: see issue #23416 for more information + | ^ expected one of `)`, `,`, `.`, `?`, or an operator -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.rs b/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.rs index a709e34b5014c..01a978d55574b 100644 --- a/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.rs +++ b/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.rs @@ -22,8 +22,7 @@ fn case_1() { #[cfg(FALSE)] fn case_2() { let a @ (b: u8); - //~^ ERROR expected one of `!` - //~| ERROR expected one of `)` + //~^ ERROR expected one of `)` } #[cfg(FALSE)] diff --git a/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr b/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr index 27660ae406e29..0c109ff6bbad1 100644 --- a/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr +++ b/tests/ui/pattern/bindings-after-at/nested-type-ascription-syntactically-invalid.stderr @@ -9,18 +9,14 @@ error: expected one of `)`, `,`, `@`, or `|`, found `:` | LL | let a @ (b: u8); | ^ expected one of `)`, `,`, `@`, or `|` - -error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `)` - --> $DIR/nested-type-ascription-syntactically-invalid.rs:24:19 | -LL | let a @ (b: u8); - | ^ expected one of 7 possible tokens + = note: type ascription syntax has been removed, see issue #101728 error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `=`, found `@` - --> $DIR/nested-type-ascription-syntactically-invalid.rs:31:15 + --> $DIR/nested-type-ascription-syntactically-invalid.rs:30:15 | LL | let a: T1 @ Outer(b: T2); | ^ expected one of 7 possible tokens -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr index d4f42b787e4da..97f346e8c1dba 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.nn.stderr @@ -4,5 +4,11 @@ error: ~const can only be applied to `#[const_trait]` traits LL | trait Bar: ~const Foo {} | ^^^ -error: aborting due to previous error +error: ~const can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-2.rs:11:19 + | +LL | trait Bar: ~const Foo {} + | ^^^ + +error: aborting due to 2 previous errors diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr index d4f42b787e4da..97f346e8c1dba 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.ny.stderr @@ -4,5 +4,11 @@ error: ~const can only be applied to `#[const_trait]` traits LL | trait Bar: ~const Foo {} | ^^^ -error: aborting due to previous error +error: ~const can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-2.rs:11:19 + | +LL | trait Bar: ~const Foo {} + | ^^^ + +error: aborting due to 2 previous errors diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.rs b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.rs index d183efde2df1f..ecb06271cd9b4 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.rs +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.rs @@ -10,6 +10,7 @@ trait Foo { #[cfg_attr(any(yy, ny), const_trait)] trait Bar: ~const Foo {} //[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]` +//[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]` const fn foo(x: &T) { x.a(); diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr index 13fc719f28c5c..c9fa1955498d4 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yn.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-2.rs:15:7 + --> $DIR/super-traits-fail-2.rs:16:7 | LL | x.a(); | ^ the trait `~const Foo` is not implemented for `T` | note: the trait `Foo` is implemented for `T`, but that implementation is not `const` - --> $DIR/super-traits-fail-2.rs:15:5 + --> $DIR/super-traits-fail-2.rs:16:5 | LL | x.a(); | ^ diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr index 13fc719f28c5c..c9fa1955498d4 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-2.yy.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `T: ~const Foo` is not satisfied - --> $DIR/super-traits-fail-2.rs:15:7 + --> $DIR/super-traits-fail-2.rs:16:7 | LL | x.a(); | ^ the trait `~const Foo` is not implemented for `T` | note: the trait `Foo` is implemented for `T`, but that implementation is not `const` - --> $DIR/super-traits-fail-2.rs:15:5 + --> $DIR/super-traits-fail-2.rs:16:5 | LL | x.a(); | ^ diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr index d433e1cfa698a..fdc6b805889ed 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.nn.stderr @@ -5,10 +5,16 @@ LL | trait Bar: ~const Foo {} | ^^^ error: ~const can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:15:24 + --> $DIR/super-traits-fail-3.rs:12:19 + | +LL | trait Bar: ~const Foo {} + | ^^^ + +error: ~const can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:16:24 | LL | const fn foo(x: &T) { | ^^^ -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr index 2a7e8e00bc78c..7375b8c819ca7 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.ny.stderr @@ -4,5 +4,11 @@ error: ~const can only be applied to `#[const_trait]` traits LL | trait Bar: ~const Foo {} | ^^^ -error: aborting due to previous error +error: ~const can only be applied to `#[const_trait]` traits + --> $DIR/super-traits-fail-3.rs:12:19 + | +LL | trait Bar: ~const Foo {} + | ^^^ + +error: aborting due to 2 previous errors diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.rs b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.rs index 70d2936d3b259..8cf64944ac1c3 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.rs +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.rs @@ -11,6 +11,7 @@ trait Foo { #[cfg_attr(any(yy, ny), const_trait)] trait Bar: ~const Foo {} //[ny,nn]~^ ERROR: ~const can only be applied to `#[const_trait]` +//[ny,nn]~| ERROR: ~const can only be applied to `#[const_trait]` const fn foo(x: &T) { //[yn,nn]~^ ERROR: ~const can only be applied to `#[const_trait]` diff --git a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr index e5978c12a0981..7a152914b6964 100644 --- a/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/super-traits-fail-3.yn.stderr @@ -1,5 +1,5 @@ error: ~const can only be applied to `#[const_trait]` traits - --> $DIR/super-traits-fail-3.rs:15:24 + --> $DIR/super-traits-fail-3.rs:16:24 | LL | const fn foo(x: &T) { | ^^^ diff --git a/tests/ui/suggestions/many-type-ascription.rs b/tests/ui/suggestions/many-type-ascription.rs index 31ac556b9447c..cc2406d6690e3 100644 --- a/tests/ui/suggestions/many-type-ascription.rs +++ b/tests/ui/suggestions/many-type-ascription.rs @@ -1,4 +1,4 @@ fn main() { - let _ = 0: i32; //~ ERROR: type ascription is experimental + let _ = 0: i32; //~ ERROR: expected one of let _ = 0: i32; // (error only emitted once) } diff --git a/tests/ui/suggestions/many-type-ascription.stderr b/tests/ui/suggestions/many-type-ascription.stderr index 3706bbae9df9f..e36919c82f832 100644 --- a/tests/ui/suggestions/many-type-ascription.stderr +++ b/tests/ui/suggestions/many-type-ascription.stderr @@ -1,12 +1,10 @@ -error[E0658]: type ascription is experimental - --> $DIR/many-type-ascription.rs:2:13 +error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/many-type-ascription.rs:2:14 | LL | let _ = 0: i32; - | ^^^^^^ + | ^ expected one of `.`, `;`, `?`, `else`, or an operator | - = note: see issue #23416 for more information - = help: add `#![feature(type_ascription)]` to the crate attributes to enable + = note: type ascription syntax has been removed, see issue #101728 error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.rs b/tests/ui/suggestions/type-ascription-instead-of-let.rs index 0e1c307502728..5ad6024329861 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-let.rs +++ b/tests/ui/suggestions/type-ascription-instead-of-let.rs @@ -3,8 +3,7 @@ fn fun(x: i32) -> i32 { x } fn main() { let closure_annotated = |value: i32| -> i32 { temp: i32 = fun(5i32); - //~^ ERROR cannot find value `temp` in this scope + //~^ ERROR expected identifier, found `:` temp + value + 1 - //~^ ERROR cannot find value `temp` in this scope }; } diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.stderr b/tests/ui/suggestions/type-ascription-instead-of-let.stderr index 92e4b5798c889..fb697b0ccfd5e 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-let.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-let.stderr @@ -1,18 +1,8 @@ -error[E0425]: cannot find value `temp` in this scope - --> $DIR/type-ascription-instead-of-let.rs:5:9 +error: expected identifier, found `:` + --> $DIR/type-ascription-instead-of-let.rs:5:13 | LL | temp: i32 = fun(5i32); - | ^^^^ - | | - | not found in this scope - | help: maybe you meant to write an assignment here: `let temp` + | ^ expected identifier -error[E0425]: cannot find value `temp` in this scope - --> $DIR/type-ascription-instead-of-let.rs:7:9 - | -LL | temp + value + 1 - | ^^^^ not found in this scope - -error: aborting due to 2 previous errors +error: aborting due to previous error -For more information about this error, try `rustc --explain E0425`. diff --git a/tests/ui/suggestions/type-ascription-instead-of-method.fixed b/tests/ui/suggestions/type-ascription-instead-of-method.fixed index 56b740b0d5ca0..02e316b264e87 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-method.fixed +++ b/tests/ui/suggestions/type-ascription-instead-of-method.fixed @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _ = Box::new("foo".to_string()); - //~^ ERROR expected type, found + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/suggestions/type-ascription-instead-of-method.rs b/tests/ui/suggestions/type-ascription-instead-of-method.rs index a603e09e7e839..6f893ee89b2cc 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-method.rs +++ b/tests/ui/suggestions/type-ascription-instead-of-method.rs @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _ = Box:new("foo".to_string()); - //~^ ERROR expected type, found + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/suggestions/type-ascription-instead-of-method.stderr b/tests/ui/suggestions/type-ascription-instead-of-method.stderr index 83bc33f410ad0..b3799101cf0a5 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-method.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-method.stderr @@ -1,12 +1,10 @@ -error: expected type, found `"foo"` - --> $DIR/type-ascription-instead-of-method.rs:3:21 +error: path separator must be a double colon + --> $DIR/type-ascription-instead-of-method.rs:3:16 | LL | let _ = Box:new("foo".to_string()); - | - ^^^^^ expected type - | | - | help: maybe write a path separator here: `::` + | ^ help: use a double colon instead: `::` | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 error: aborting due to previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed b/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed index 787fcc1208e1b..4cec58be856f0 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.fixed @@ -1,6 +1,6 @@ // run-rustfix fn main() -> Result<(), ()> { let _ = vec![Ok(2)].into_iter().collect::,_>>()?; - //~^ ERROR expected `::`, found `(` + //~^ ERROR expected one of Ok(()) } diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.rs b/tests/ui/suggestions/type-ascription-instead-of-path-2.rs index 934016b3b811f..5695d5a7f7251 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.rs +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.rs @@ -1,6 +1,6 @@ // run-rustfix fn main() -> Result<(), ()> { let _ = vec![Ok(2)].into_iter().collect:,_>>()?; - //~^ ERROR expected `::`, found `(` + //~^ ERROR expected one of Ok(()) } diff --git a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr index 970b220b73712..43d00591e74c0 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path-2.stderr @@ -1,12 +1,14 @@ -error: expected `::`, found `(` - --> $DIR/type-ascription-instead-of-path-2.rs:3:63 +error: expected one of `(`, `.`, `::`, `;`, `?`, `else`, or an operator, found `:` + --> $DIR/type-ascription-instead-of-path-2.rs:3:44 | LL | let _ = vec![Ok(2)].into_iter().collect:,_>>()?; - | - ^ expected `::` - | | - | help: maybe write a path separator here: `::` + | ^ expected one of 7 possible tokens | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` + = note: type ascription syntax has been removed, see issue #101728 +help: maybe write a path separator here + | +LL | let _ = vec![Ok(2)].into_iter().collect::,_>>()?; + | ~~ error: aborting due to previous error diff --git a/tests/ui/suggestions/type-ascription-instead-of-path.rs b/tests/ui/suggestions/type-ascription-instead-of-path.rs index ce40b55f1ee84..69647887afcee 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path.rs +++ b/tests/ui/suggestions/type-ascription-instead-of-path.rs @@ -1,5 +1,4 @@ fn main() { std:io::stdin(); - //~^ ERROR failed to resolve: use of undeclared crate or module `io` - //~| ERROR expected value, found crate + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/suggestions/type-ascription-instead-of-path.stderr b/tests/ui/suggestions/type-ascription-instead-of-path.stderr index 518660cfa1686..849630218daed 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-path.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-path.stderr @@ -1,18 +1,10 @@ -error[E0433]: failed to resolve: use of undeclared crate or module `io` - --> $DIR/type-ascription-instead-of-path.rs:2:9 +error: path separator must be a double colon + --> $DIR/type-ascription-instead-of-path.rs:2:8 | LL | std:io::stdin(); - | ^^ use of undeclared crate or module `io` - -error[E0423]: expected value, found crate `std` - --> $DIR/type-ascription-instead-of-path.rs:2:5 + | ^ help: use a double colon instead: `::` | -LL | std:io::stdin(); - | ^^^- help: maybe you meant to write a path separator here: `::` - | | - | not a value + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0423, E0433. -For more information about an error, try `rustc --explain E0423`. diff --git a/tests/ui/suggestions/type-ascription-instead-of-variant.fixed b/tests/ui/suggestions/type-ascription-instead-of-variant.fixed index b3247e1287d99..04cb206862462 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-variant.fixed +++ b/tests/ui/suggestions/type-ascription-instead-of-variant.fixed @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _ = Option::Some(""); - //~^ ERROR expected type, found + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/suggestions/type-ascription-instead-of-variant.rs b/tests/ui/suggestions/type-ascription-instead-of-variant.rs index 6fd2c19541cdb..2cce69bfec8f3 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-variant.rs +++ b/tests/ui/suggestions/type-ascription-instead-of-variant.rs @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _ = Option:Some(""); - //~^ ERROR expected type, found + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/suggestions/type-ascription-instead-of-variant.stderr b/tests/ui/suggestions/type-ascription-instead-of-variant.stderr index f59ba78d4d38a..11d0f5f527e21 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-variant.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-variant.stderr @@ -1,12 +1,10 @@ -error: expected type, found `""` - --> $DIR/type-ascription-instead-of-variant.rs:3:25 +error: path separator must be a double colon + --> $DIR/type-ascription-instead-of-variant.rs:3:19 | LL | let _ = Option:Some(""); - | - ^^ expected type - | | - | help: maybe write a path separator here: `::` + | ^ help: use a double colon instead: `::` | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 error: aborting due to previous error diff --git a/tests/ui/traits/issue-38404.rs b/tests/ui/traits/issue-38404.rs index 1a92acc34042b..05921b2c36e46 100644 --- a/tests/ui/traits/issue-38404.rs +++ b/tests/ui/traits/issue-38404.rs @@ -2,5 +2,6 @@ trait A: std::ops::Add + Sized {} trait B: A {} trait C: A> {} //~^ ERROR the trait `B` cannot be made into an object +//~| ERROR the trait `B` cannot be made into an object fn main() {} diff --git a/tests/ui/traits/issue-38404.stderr b/tests/ui/traits/issue-38404.stderr index d7721d7e69cd4..f8625f53b78fa 100644 --- a/tests/ui/traits/issue-38404.stderr +++ b/tests/ui/traits/issue-38404.stderr @@ -12,6 +12,20 @@ LL | trait A: std::ops::Add + Sized {} LL | trait B: A {} | - this trait cannot be made into an object... -error: aborting due to previous error +error[E0038]: the trait `B` cannot be made into an object + --> $DIR/issue-38404.rs:3:15 + | +LL | trait C: A> {} + | ^^^^^^^^^^^^^^^^^^^^^^ `B` cannot be made into an object + | +note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit + --> $DIR/issue-38404.rs:1:13 + | +LL | trait A: std::ops::Add + Sized {} + | ^^^^^^^^^^^^^^^^^^^ ...because it uses `Self` as a type parameter +LL | trait B: A {} + | - this trait cannot be made into an object... + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/type/ascription/issue-34255-1.rs b/tests/ui/type/ascription/issue-34255-1.rs index 44b47cc4eb2a2..7436f83593d34 100644 --- a/tests/ui/type/ascription/issue-34255-1.rs +++ b/tests/ui/type/ascription/issue-34255-1.rs @@ -1,13 +1,12 @@ +// rustfix + struct Reactor { input_cells: Vec, } impl Reactor { - pub fn new() -> Self { + pub fn new() -> Self { //~ ERROR struct literal body without path input_cells: Vec::new() - //~^ ERROR cannot find value `input_cells` in this scope - //~| ERROR parenthesized type parameters may only be used with a `Fn` trait - //~| ERROR missing generics for struct `Vec` } } diff --git a/tests/ui/type/ascription/issue-34255-1.stderr b/tests/ui/type/ascription/issue-34255-1.stderr index fafff19f8f6ec..254d36cb9479c 100644 --- a/tests/ui/type/ascription/issue-34255-1.stderr +++ b/tests/ui/type/ascription/issue-34255-1.stderr @@ -1,36 +1,18 @@ -error[E0425]: cannot find value `input_cells` in this scope - --> $DIR/issue-34255-1.rs:7:9 +error: struct literal body without path + --> $DIR/issue-34255-1.rs:8:26 | -LL | input_cells: Vec::new() - | ^^^^^^^^^^^ a field by this name exists in `Self` +LL | pub fn new() -> Self { + | __________________________^ +LL | | input_cells: Vec::new() +LL | | } + | |_____^ | -help: you might have meant to write a `struct` literal +help: you might have forgotten to add the struct literal inside the block | LL ~ pub fn new() -> Self { SomeStruct { LL | input_cells: Vec::new() - ... -LL | -LL ~ }} - | - -error[E0214]: parenthesized type parameters may only be used with a `Fn` trait - --> $DIR/issue-34255-1.rs:7:27 - | -LL | input_cells: Vec::new() - | ^^^^^ only `Fn` traits may use parentheses - -error[E0107]: missing generics for struct `Vec` - --> $DIR/issue-34255-1.rs:7:22 - | -LL | input_cells: Vec::new() - | ^^^ expected at least 1 generic argument - | -help: add missing generic argument +LL ~ } } | -LL | input_cells: Vec::new() - | +++ -error: aborting due to 3 previous errors +error: aborting due to previous error -Some errors have detailed explanations: E0107, E0214, E0425. -For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/type/ascription/issue-47666.fixed b/tests/ui/type/ascription/issue-47666.fixed index c4db747551e52..027c692f9003b 100644 --- a/tests/ui/type/ascription/issue-47666.fixed +++ b/tests/ui/type/ascription/issue-47666.fixed @@ -1,4 +1,4 @@ // run-rustfix fn main() { - let _ = Option::Some(vec![0, 1]); //~ ERROR expected type, found + let _ = Option::Some(vec![0, 1]); //~ ERROR path separator must be a double colon } diff --git a/tests/ui/type/ascription/issue-47666.rs b/tests/ui/type/ascription/issue-47666.rs index c67202e2157f0..e2f5d03ef7425 100644 --- a/tests/ui/type/ascription/issue-47666.rs +++ b/tests/ui/type/ascription/issue-47666.rs @@ -1,4 +1,4 @@ // run-rustfix fn main() { - let _ = Option:Some(vec![0, 1]); //~ ERROR expected type, found + let _ = Option:Some(vec![0, 1]); //~ ERROR path separator must be a double colon } diff --git a/tests/ui/type/ascription/issue-47666.stderr b/tests/ui/type/ascription/issue-47666.stderr index 0f90fce3a42b9..74d85a75c85c6 100644 --- a/tests/ui/type/ascription/issue-47666.stderr +++ b/tests/ui/type/ascription/issue-47666.stderr @@ -1,16 +1,10 @@ -error: expected type, found `<[_]>::into_vec(#[rustc_box] ::alloc::boxed::Box::new([0, 1]))` - --> $DIR/issue-47666.rs:3:25 +error: path separator must be a double colon + --> $DIR/issue-47666.rs:3:19 | LL | let _ = Option:Some(vec![0, 1]); - | - ^^^^^^^^^^ - | | | - | | expected type - | | in this macro invocation - | | this macro call doesn't expand to a type - | help: maybe write a path separator here: `::` + | ^ help: use a double colon instead: `::` | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` - = note: this error originates in the macro `$crate::__rust_force_expr` which comes from the expansion of the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 error: aborting due to previous error diff --git a/tests/ui/type/ascription/issue-54516.fixed b/tests/ui/type/ascription/issue-54516.fixed index f78268894daec..48622663b4d5e 100644 --- a/tests/ui/type/ascription/issue-54516.fixed +++ b/tests/ui/type/ascription/issue-54516.fixed @@ -3,5 +3,5 @@ use std::collections::BTreeMap; fn main() { println!("{}", std::mem::size_of::>()); - //~^ ERROR type ascription cannot be followed by a function call + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/type/ascription/issue-54516.rs b/tests/ui/type/ascription/issue-54516.rs index 1f34e6943bab2..9e71d2af1d32b 100644 --- a/tests/ui/type/ascription/issue-54516.rs +++ b/tests/ui/type/ascription/issue-54516.rs @@ -3,5 +3,5 @@ use std::collections::BTreeMap; fn main() { println!("{}", std::mem:size_of::>()); - //~^ ERROR type ascription cannot be followed by a function call + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/type/ascription/issue-54516.stderr b/tests/ui/type/ascription/issue-54516.stderr index 1ab9093e58445..a1371432f5ad6 100644 --- a/tests/ui/type/ascription/issue-54516.stderr +++ b/tests/ui/type/ascription/issue-54516.stderr @@ -1,12 +1,10 @@ -error: type ascription cannot be followed by a function call - --> $DIR/issue-54516.rs:5:20 +error: path separator must be a double colon + --> $DIR/issue-54516.rs:5:28 | LL | println!("{}", std::mem:size_of::>()); - | ^^^^^^^^-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | help: maybe write a path separator here: `::` + | ^ help: use a double colon instead: `::` | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 error: aborting due to previous error diff --git a/tests/ui/type/ascription/issue-60933.fixed b/tests/ui/type/ascription/issue-60933.fixed index 3e8be3875b34e..016ad4a7e6a63 100644 --- a/tests/ui/type/ascription/issue-60933.fixed +++ b/tests/ui/type/ascription/issue-60933.fixed @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _: usize = std::mem::size_of::(); - //~^ ERROR type ascription cannot be followed by a function call + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/type/ascription/issue-60933.rs b/tests/ui/type/ascription/issue-60933.rs index 2a4ad7bdc4ee7..972bf2827f97f 100644 --- a/tests/ui/type/ascription/issue-60933.rs +++ b/tests/ui/type/ascription/issue-60933.rs @@ -1,5 +1,5 @@ // run-rustfix fn main() { let _: usize = std::mem:size_of::(); - //~^ ERROR type ascription cannot be followed by a function call + //~^ ERROR path separator must be a double colon } diff --git a/tests/ui/type/ascription/issue-60933.stderr b/tests/ui/type/ascription/issue-60933.stderr index 0b7f8edf62402..0ec527ff5a958 100644 --- a/tests/ui/type/ascription/issue-60933.stderr +++ b/tests/ui/type/ascription/issue-60933.stderr @@ -1,12 +1,10 @@ -error: type ascription cannot be followed by a function call - --> $DIR/issue-60933.rs:3:20 +error: path separator must be a double colon + --> $DIR/issue-60933.rs:3:28 | LL | let _: usize = std::mem:size_of::(); - | ^^^^^^^^-^^^^^^^^^^^^^^ - | | - | help: maybe write a path separator here: `::` + | ^ help: use a double colon instead: `::` | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 error: aborting due to previous error diff --git a/tests/ui/type/missing-let-in-binding.fixed b/tests/ui/type/missing-let-in-binding.fixed index d1787688950ac..4301fed2312e6 100644 --- a/tests/ui/type/missing-let-in-binding.fixed +++ b/tests/ui/type/missing-let-in-binding.fixed @@ -1,5 +1,5 @@ // run-rustfix fn main() { let mut _foo: i32 = 1; - let _foo: i32 = 4; //~ ERROR type ascription is experimental + let _foo: i32 = 4; //~ ERROR expected identifier, found `:` } diff --git a/tests/ui/type/missing-let-in-binding.rs b/tests/ui/type/missing-let-in-binding.rs index ca42f2e6eaccc..c0f91d98ff31f 100644 --- a/tests/ui/type/missing-let-in-binding.rs +++ b/tests/ui/type/missing-let-in-binding.rs @@ -1,5 +1,5 @@ // run-rustfix fn main() { let mut _foo: i32 = 1; - _foo: i32 = 4; //~ ERROR type ascription is experimental + _foo: i32 = 4; //~ ERROR expected identifier, found `:` } diff --git a/tests/ui/type/missing-let-in-binding.stderr b/tests/ui/type/missing-let-in-binding.stderr index 12759c5096e23..fc094e8cbad71 100644 --- a/tests/ui/type/missing-let-in-binding.stderr +++ b/tests/ui/type/missing-let-in-binding.stderr @@ -1,11 +1,10 @@ -error[E0658]: type ascription is experimental - --> $DIR/missing-let-in-binding.rs:4:5 +error: expected identifier, found `:` + --> $DIR/missing-let-in-binding.rs:4:9 | LL | _foo: i32 = 4; - | ^^^^^^^^^ + | ^ expected identifier | - = note: see issue #23416 for more information - = help: add `#![feature(type_ascription)]` to the crate attributes to enable + = note: type ascription syntax has been removed, see issue #101728 help: you might have meant to introduce a new binding | LL | let _foo: i32 = 4; @@ -13,4 +12,3 @@ LL | let _foo: i32 = 4; error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/type/type-ascription-instead-of-statement-end.rs b/tests/ui/type/type-ascription-instead-of-statement-end.rs index 1d5565ab58384..e30e571386bd2 100644 --- a/tests/ui/type/type-ascription-instead-of-statement-end.rs +++ b/tests/ui/type/type-ascription-instead-of-statement-end.rs @@ -1,10 +1,8 @@ -#![feature(type_ascription)] - fn main() { - println!("test"): - 0; //~ ERROR expected type, found `0` + println!("test"): //~ ERROR statements are terminated with a semicolon + 0; } fn foo() { - println!("test"): 0; //~ ERROR expected type, found `0` + println!("test"): 0; //~ ERROR expected one of } diff --git a/tests/ui/type/type-ascription-instead-of-statement-end.stderr b/tests/ui/type/type-ascription-instead-of-statement-end.stderr index 521ebcdf1929c..8c09e78bc5fbc 100644 --- a/tests/ui/type/type-ascription-instead-of-statement-end.stderr +++ b/tests/ui/type/type-ascription-instead-of-statement-end.stderr @@ -1,24 +1,16 @@ -error: expected type, found `0` - --> $DIR/type-ascription-instead-of-statement-end.rs:5:5 +error: statements are terminated with a semicolon + --> $DIR/type-ascription-instead-of-statement-end.rs:2:21 | LL | println!("test"): - | - help: try using a semicolon: `;` -LL | 0; - | ^ expected type + | ^ help: use a semicolon instead: `;` | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` - = note: see issue #23416 for more information + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 -error: expected type, found `0` - --> $DIR/type-ascription-instead-of-statement-end.rs:9:23 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/type-ascription-instead-of-statement-end.rs:7:21 | LL | println!("test"): 0; - | - ^ expected type - | | - | tried to parse a type due to this type ascription - | - = note: `#![feature(type_ascription)]` lets you annotate an expression with a type: `: ` - = note: see issue #23416 for more information + | ^ expected one of `.`, `;`, `?`, `}`, or an operator error: aborting due to 2 previous errors diff --git a/tests/ui/type/type-ascription-precedence.rs b/tests/ui/type/type-ascription-precedence.rs index d3aef929b9fa2..1527bb7aa177b 100644 --- a/tests/ui/type/type-ascription-precedence.rs +++ b/tests/ui/type/type-ascription-precedence.rs @@ -1,10 +1,8 @@ // Operator precedence of type ascription // Type ascription has very high precedence, the same as operator `as` - #![feature(type_ascription)] use std::ops::*; - struct S; struct Z; @@ -25,30 +23,34 @@ impl Deref for S { fn deref(&self) -> &Z { panic!() } } -fn main() { - &S: &S; // OK - (&S): &S; // OK - &(S: &S); //~ ERROR mismatched types +fn test1() { + &S: &S; //~ ERROR expected one of + (&S): &S; + &(S: &S); +} + +fn test2() { + *(S: Z); //~ ERROR expected identifier +} - *S: Z; // OK - (*S): Z; // OK - *(S: Z); //~ ERROR mismatched types - //~^ ERROR type `Z` cannot be dereferenced +fn test3() { + -(S: Z); //~ ERROR expected identifier +} - -S: Z; // OK - (-S): Z; // OK - -(S: Z); //~ ERROR mismatched types - //~^ ERROR cannot apply unary operator `-` to type `Z` +fn test4() { + (S + Z): Z; //~ ERROR expected one of +} - S + Z: Z; // OK - S + (Z: Z); // OK - (S + Z): Z; //~ ERROR mismatched types +fn test5() { + (S * Z): Z; //~ ERROR expected one of +} - S * Z: Z; // OK - S * (Z: Z); // OK - (S * Z): Z; //~ ERROR mismatched types +fn test6() { + S .. S: S; //~ ERROR expected identifier, found `:` +} - S .. S: S; // OK - S .. (S: S); // OK - (S .. S): S; //~ ERROR mismatched types +fn test7() { + (S .. S): S; //~ ERROR expected one of } + +fn main() {} diff --git a/tests/ui/type/type-ascription-precedence.stderr b/tests/ui/type/type-ascription-precedence.stderr index d6d1e1d7d0293..09cdc370309dc 100644 --- a/tests/ui/type/type-ascription-precedence.stderr +++ b/tests/ui/type/type-ascription-precedence.stderr @@ -1,63 +1,46 @@ -error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:31:7 +error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `:` + --> $DIR/type-ascription-precedence.rs:27:7 | -LL | &(S: &S); - | ^ expected `&S`, found `S` +LL | &S: &S; + | ^ expected one of 8 possible tokens -error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:35:7 +error: expected identifier, found `:` + --> $DIR/type-ascription-precedence.rs:33:8 | LL | *(S: Z); - | ^ expected `Z`, found `S` + | ^ expected identifier -error[E0614]: type `Z` cannot be dereferenced - --> $DIR/type-ascription-precedence.rs:35:5 - | -LL | *(S: Z); - | ^^^^^^^ - -error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:40:7 - | -LL | -(S: Z); - | ^ expected `Z`, found `S` - -error[E0600]: cannot apply unary operator `-` to type `Z` - --> $DIR/type-ascription-precedence.rs:40:5 +error: expected identifier, found `:` + --> $DIR/type-ascription-precedence.rs:37:8 | LL | -(S: Z); - | ^^^^^^^ cannot apply unary operator `-` - | -note: an implementation of `std::ops::Neg` might be missing for `Z` - --> $DIR/type-ascription-precedence.rs:9:1 - | -LL | struct Z; - | ^^^^^^^^ must implement `std::ops::Neg` -note: the trait `std::ops::Neg` must be implemented - --> $SRC_DIR/core/src/ops/arith.rs:LL:COL + | ^ expected identifier -error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:45:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/type-ascription-precedence.rs:41:12 | LL | (S + Z): Z; - | ^^^^^^^ expected `Z`, found `S` + | ^ expected one of `.`, `;`, `?`, `}`, or an operator -error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:49:5 +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/type-ascription-precedence.rs:45:12 | LL | (S * Z): Z; - | ^^^^^^^ expected `Z`, found `S` + | ^ expected one of `.`, `;`, `?`, `}`, or an operator -error[E0308]: mismatched types - --> $DIR/type-ascription-precedence.rs:53:5 +error: expected identifier, found `:` + --> $DIR/type-ascription-precedence.rs:49:11 | -LL | (S .. S): S; - | ^^^^^^^^ expected `S`, found `Range` +LL | S .. S: S; + | ^ expected identifier | - = note: expected struct `S` - found struct `std::ops::Range` + = note: type ascription syntax has been removed, see issue #101728 + +error: expected one of `.`, `;`, `?`, `}`, or an operator, found `:` + --> $DIR/type-ascription-precedence.rs:53:13 + | +LL | (S .. S): S; + | ^ expected one of `.`, `;`, `?`, `}`, or an operator -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors -Some errors have detailed explanations: E0308, E0600, E0614. -For more information about an error, try `rustc --explain E0308`. diff --git a/tests/ui/type/type-ascription-with-fn-call.fixed b/tests/ui/type/type-ascription-with-fn-call.fixed index 6d96c4303c357..847f33099732e 100644 --- a/tests/ui/type/type-ascription-with-fn-call.fixed +++ b/tests/ui/type/type-ascription-with-fn-call.fixed @@ -1,9 +1,7 @@ // run-rustfix -#![feature(type_ascription)] - fn main() { - f() ; - f(); //~ ERROR expected type, found function + f() ; //~ ERROR statements are terminated with a semicolon + f(); } fn f() {} diff --git a/tests/ui/type/type-ascription-with-fn-call.rs b/tests/ui/type/type-ascription-with-fn-call.rs index ed4f7c9041c3a..1db48b0adc435 100644 --- a/tests/ui/type/type-ascription-with-fn-call.rs +++ b/tests/ui/type/type-ascription-with-fn-call.rs @@ -1,9 +1,7 @@ // run-rustfix -#![feature(type_ascription)] - fn main() { - f() : - f(); //~ ERROR expected type, found function + f() : //~ ERROR statements are terminated with a semicolon + f(); } fn f() {} diff --git a/tests/ui/type/type-ascription-with-fn-call.stderr b/tests/ui/type/type-ascription-with-fn-call.stderr index d78fd08fd6065..e3afa497ac201 100644 --- a/tests/ui/type/type-ascription-with-fn-call.stderr +++ b/tests/ui/type/type-ascription-with-fn-call.stderr @@ -1,11 +1,10 @@ -error[E0573]: expected type, found function `f` - --> $DIR/type-ascription-with-fn-call.rs:6:5 +error: statements are terminated with a semicolon + --> $DIR/type-ascription-with-fn-call.rs:3:10 | LL | f() : - | - help: maybe you meant to write `;` here -LL | f(); - | ^^^ expecting a type here because of type ascription + | ^ help: use a semicolon instead: `;` + | + = note: if you meant to annotate an expression with a type, the type ascription syntax has been removed, see issue #101728 error: aborting due to previous error -For more information about this error, try `rustc --explain E0573`. diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs b/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs index 7ff9199f63c5c..e7e62c077394e 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.rs @@ -3,6 +3,7 @@ fn foo1, U>(x: T) {} trait Trait: Copy {} //~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied +//~| ERROR trait takes 0 generic arguments but 1 generic argument was supplied struct MyStruct1>; //~^ ERROR trait takes 0 generic arguments but 1 generic argument was supplied diff --git a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr index a71fd95365820..a3517af877cc7 100644 --- a/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr +++ b/tests/ui/typeck/typeck-builtin-bound-type-parameters.stderr @@ -15,7 +15,15 @@ LL | trait Trait: Copy {} | expected 0 generic arguments error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/typeck-builtin-bound-type-parameters.rs:7:21 + --> $DIR/typeck-builtin-bound-type-parameters.rs:4:14 + | +LL | trait Trait: Copy {} + | ^^^^---------- help: remove these generics + | | + | expected 0 generic arguments + +error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied + --> $DIR/typeck-builtin-bound-type-parameters.rs:8:21 | LL | struct MyStruct1>; | ^^^^--- help: remove these generics @@ -23,7 +31,7 @@ LL | struct MyStruct1>; | expected 0 generic arguments error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/typeck-builtin-bound-type-parameters.rs:10:25 + --> $DIR/typeck-builtin-bound-type-parameters.rs:11:25 | LL | struct MyStruct2<'a, T: Copy<'a>>; | ^^^^---- help: remove these generics @@ -31,7 +39,7 @@ LL | struct MyStruct2<'a, T: Copy<'a>>; | expected 0 lifetime arguments error[E0107]: trait takes 0 lifetime arguments but 1 lifetime argument was supplied - --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 + --> $DIR/typeck-builtin-bound-type-parameters.rs:14:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^^^^ -- help: remove this lifetime argument @@ -39,13 +47,13 @@ LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | expected 0 lifetime arguments error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied - --> $DIR/typeck-builtin-bound-type-parameters.rs:13:15 + --> $DIR/typeck-builtin-bound-type-parameters.rs:14:15 | LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} | ^^^^ - help: remove this generic argument | | | expected 0 generic arguments -error: aborting due to 6 previous errors +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0107`.