diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 1c69937eed07a..135d56c89d48a 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -136,6 +136,7 @@ struct LoweringContext<'a, 'hir> { allow_try_trait: Arc<[Symbol]>, allow_gen_future: Arc<[Symbol]>, + allow_pattern_type: Arc<[Symbol]>, allow_async_iterator: Arc<[Symbol]>, allow_for_await: Arc<[Symbol]>, allow_async_fn_traits: Arc<[Symbol]>, @@ -176,6 +177,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { impl_trait_defs: Vec::new(), impl_trait_bounds: Vec::new(), allow_try_trait: [sym::try_trait_v2, sym::yeet_desugar_details].into(), + allow_pattern_type: [sym::pattern_types, sym::pattern_type_range_trait].into(), allow_gen_future: if tcx.features().async_fn_track_caller() { [sym::gen_future, sym::closure_track_caller].into() } else { @@ -1357,7 +1359,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { } } TyKind::Pat(ty, pat) => { - hir::TyKind::Pat(self.lower_ty(ty, itctx), self.lower_ty_pat(pat)) + hir::TyKind::Pat(self.lower_ty(ty, itctx), self.lower_ty_pat(pat, ty.span)) } TyKind::MacCall(_) => { span_bug!(t.span, "`TyKind::MacCall` should have been expanded by now") diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index 2dcfe7c745da5..728981dea5f83 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -3,11 +3,11 @@ use std::sync::Arc; use rustc_ast::ptr::P; use rustc_ast::*; use rustc_data_structures::stack::ensure_sufficient_stack; -use rustc_hir as hir; -use rustc_hir::def::Res; +use rustc_hir::def::{DefKind, Res}; +use rustc_hir::{self as hir, LangItem}; use rustc_middle::span_bug; use rustc_span::source_map::{Spanned, respan}; -use rustc_span::{Ident, Span}; +use rustc_span::{DesugaringKind, Ident, Span, kw}; use super::errors::{ ArbitraryExpressionInPattern, ExtraDoubleDot, MisplacedDoubleDot, SubTupleBinding, @@ -430,22 +430,124 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.arena.alloc(hir::PatExpr { hir_id: self.lower_node_id(expr.id), span, kind }) } - pub(crate) fn lower_ty_pat(&mut self, pattern: &TyPat) -> &'hir hir::TyPat<'hir> { - self.arena.alloc(self.lower_ty_pat_mut(pattern)) + pub(crate) fn lower_ty_pat( + &mut self, + pattern: &TyPat, + base_type: Span, + ) -> &'hir hir::TyPat<'hir> { + self.arena.alloc(self.lower_ty_pat_mut(pattern, base_type)) } - fn lower_ty_pat_mut(&mut self, pattern: &TyPat) -> hir::TyPat<'hir> { + fn lower_ty_pat_mut(&mut self, pattern: &TyPat, base_type: Span) -> hir::TyPat<'hir> { // loop here to avoid recursion let pat_hir_id = self.lower_node_id(pattern.id); let node = match &pattern.kind { - TyPatKind::Range(e1, e2, Spanned { node: end, .. }) => hir::TyPatKind::Range( - e1.as_deref().map(|e| self.lower_anon_const_to_const_arg(e)), - e2.as_deref().map(|e| self.lower_anon_const_to_const_arg(e)), - self.lower_range_end(end, e2.is_some()), + TyPatKind::Range(e1, e2, Spanned { node: end, span }) => hir::TyPatKind::Range( + e1.as_deref().map(|e| self.lower_anon_const_to_const_arg(e)).unwrap_or_else(|| { + self.lower_ty_pat_range_end( + hir::LangItem::RangeMin, + span.shrink_to_lo(), + base_type, + ) + }), + e2.as_deref() + .map(|e| match end { + RangeEnd::Included(..) => self.lower_anon_const_to_const_arg(e), + RangeEnd::Excluded => self.lower_excluded_range_end(e), + }) + .unwrap_or_else(|| { + self.lower_ty_pat_range_end( + hir::LangItem::RangeMax, + span.shrink_to_hi(), + base_type, + ) + }), ), TyPatKind::Err(guar) => hir::TyPatKind::Err(*guar), }; hir::TyPat { hir_id: pat_hir_id, kind: node, span: self.lower_span(pattern.span) } } + + /// Lowers the range end of an exclusive range (`2..5`) to an inclusive range 2..=(5 - 1). + /// This way the type system doesn't have to handle the distinction between inclusive/exclusive ranges. + fn lower_excluded_range_end(&mut self, e: &AnonConst) -> &'hir hir::ConstArg<'hir> { + let span = self.lower_span(e.value.span); + let unstable_span = self.mark_span_with_reason( + DesugaringKind::PatTyRange, + span, + Some(Arc::clone(&self.allow_pattern_type)), + ); + let anon_const = self.with_new_scopes(span, |this| { + let def_id = this.local_def_id(e.id); + let hir_id = this.lower_node_id(e.id); + let body = this.lower_body(|this| { + // Need to use a custom function as we can't just subtract `1` from a `char`. + let kind = hir::ExprKind::Path(this.make_lang_item_qpath( + hir::LangItem::RangeSub, + unstable_span, + None, + )); + let fn_def = this.arena.alloc(hir::Expr { hir_id: this.next_id(), kind, span }); + let args = this.arena.alloc([this.lower_expr_mut(&e.value)]); + ( + &[], + hir::Expr { + hir_id: this.next_id(), + kind: hir::ExprKind::Call(fn_def, args), + span, + }, + ) + }); + hir::AnonConst { def_id, hir_id, body, span } + }); + self.arena.alloc(hir::ConstArg { + hir_id: self.next_id(), + kind: hir::ConstArgKind::Anon(self.arena.alloc(anon_const)), + }) + } + + /// When a range has no end specified (`1..` or `1..=`) or no start specified (`..5` or `..=5`), + /// we instead use a constant of the MAX/MIN of the type. + /// This way the type system does not have to handle the lack of a start/end. + fn lower_ty_pat_range_end( + &mut self, + lang_item: LangItem, + span: Span, + base_type: Span, + ) -> &'hir hir::ConstArg<'hir> { + let parent_def_id = self.current_hir_id_owner.def_id; + let node_id = self.next_node_id(); + + // Add a definition for the in-band const def. + // We're generating a range end that didn't exist in the AST, + // so the def collector didn't create the def ahead of time. That's why we have to do + // it here. + let def_id = self.create_def(parent_def_id, node_id, kw::Empty, DefKind::AnonConst, span); + let hir_id = self.lower_node_id(node_id); + + let unstable_span = self.mark_span_with_reason( + DesugaringKind::PatTyRange, + self.lower_span(span), + Some(Arc::clone(&self.allow_pattern_type)), + ); + let span = self.lower_span(base_type); + + let path_expr = hir::Expr { + hir_id: self.next_id(), + kind: hir::ExprKind::Path(self.make_lang_item_qpath(lang_item, unstable_span, None)), + span, + }; + + let ct = self.with_new_scopes(span, |this| { + self.arena.alloc(hir::AnonConst { + def_id, + hir_id, + body: this.lower_body(|_this| (&[], path_expr)), + span, + }) + }); + let hir_id = self.next_id(); + self.arena.alloc(hir::ConstArg { kind: hir::ConstArgKind::Anon(ct), hir_id }) + } } diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 93553f3f3648a..0a161442933ab 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -132,14 +132,33 @@ fn get_llvm_object_symbols( if err.is_null() { return Ok(true); } else { - return Err(unsafe { *Box::from_raw(err as *mut io::Error) }); + let error = unsafe { *Box::from_raw(err as *mut io::Error) }; + // These are the magic constants for LLVM bitcode files: + // https://github.com/llvm/llvm-project/blob/7eadc1960d199676f04add402bb0aa6f65b7b234/llvm/lib/BinaryFormat/Magic.cpp#L90-L97 + if buf.starts_with(&[0xDE, 0xCE, 0x17, 0x0B]) || buf.starts_with(&[b'B', b'C', 0xC0, 0xDE]) + { + // For LLVM bitcode, failure to read the symbols is not fatal. The bitcode may have been + // produced by a newer LLVM version that the one linked to rustc. This is fine provided + // that the linker does use said newer LLVM version. We skip writing the symbols for the + // bitcode to the symbol table of the archive. Traditional linkers don't like this, but + // newer linkers like lld, mold and wild ignore the symbol table anyway, so if they link + // against a new enough LLVM it will work out in the end. + // LLVM's archive writer also has this same behavior of only warning about invalid + // bitcode since https://github.com/llvm/llvm-project/pull/96848 + + // We don't have access to the DiagCtxt here to produce a nice warning in the correct format. + eprintln!("warning: Failed to read symbol table from LLVM bitcode: {}", error); + return Ok(true); + } else { + return Err(error); + } } unsafe extern "C" fn callback(state: *mut c_void, symbol_name: *const c_char) -> *mut c_void { let f = unsafe { &mut *(state as *mut &mut dyn FnMut(&[u8]) -> io::Result<()>) }; match f(unsafe { CStr::from_ptr(symbol_name) }.to_bytes()) { Ok(()) => std::ptr::null_mut(), - Err(err) => Box::into_raw(Box::new(err)) as *mut c_void, + Err(err) => Box::into_raw(Box::new(err) as Box) as *mut c_void, } } @@ -148,7 +167,7 @@ fn get_llvm_object_symbols( Box::into_raw(Box::new(io::Error::new( io::ErrorKind::Other, format!("LLVM error: {}", error.to_string_lossy()), - ))) as *mut c_void + )) as Box) as *mut c_void } } diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index b090730ac6b51..5054ae561c043 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1726,8 +1726,12 @@ fn exec_linker( args.push_str( &Escape { arg: arg.to_str().unwrap(), - // LLD also uses MSVC-like parsing for @-files by default when running on windows hosts - is_like_msvc: sess.target.is_like_msvc || (cfg!(windows) && flavor.uses_lld()), + // Windows-style escaping for @-files is used by + // - all linkers targeting MSVC-like targets, including LLD + // - all LLD flavors running on Windows hosts + // С/С++ compilers use Posix-style escaping (except clang-cl, which we do not use). + is_like_msvc: sess.target.is_like_msvc + || (cfg!(windows) && flavor.uses_lld() && !flavor.uses_cc()), } .to_string(), ); diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 3c75bc588a138..c57ce55eb30c6 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1600,7 +1600,7 @@ pub struct PatField<'hir> { pub span: Span, } -#[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic)] +#[derive(Copy, Clone, PartialEq, Debug, HashStable_Generic, Hash, Eq, Encodable, Decodable)] pub enum RangeEnd { Included, Excluded, @@ -1668,7 +1668,7 @@ pub enum PatExprKind<'hir> { #[derive(Debug, Clone, Copy, HashStable_Generic)] pub enum TyPatKind<'hir> { /// A range pattern (e.g., `1..=2` or `1..2`). - Range(Option<&'hir ConstArg<'hir>>, Option<&'hir ConstArg<'hir>>, RangeEnd), + Range(&'hir ConstArg<'hir>, &'hir ConstArg<'hir>), /// A placeholder for a pattern that wasn't well formed in some way. Err(ErrorGuaranteed), diff --git a/compiler/rustc_hir/src/intravisit.rs b/compiler/rustc_hir/src/intravisit.rs index d5fa7ec366b28..db08538b90a83 100644 --- a/compiler/rustc_hir/src/intravisit.rs +++ b/compiler/rustc_hir/src/intravisit.rs @@ -708,9 +708,9 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm<'v>) -> V::Res pub fn walk_ty_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v TyPat<'v>) -> V::Result { try_visit!(visitor.visit_id(pattern.hir_id)); match pattern.kind { - TyPatKind::Range(lower_bound, upper_bound, _) => { - visit_opt!(visitor, visit_const_arg_unambig, lower_bound); - visit_opt!(visitor, visit_const_arg_unambig, upper_bound); + TyPatKind::Range(lower_bound, upper_bound) => { + try_visit!(visitor.visit_const_arg_unambig(lower_bound)); + try_visit!(visitor.visit_const_arg_unambig(upper_bound)); } TyPatKind::Err(_) => (), } diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index f5626937ec456..c3b14a4e06c79 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -418,6 +418,9 @@ language_item_table! { Range, sym::Range, range_struct, Target::Struct, GenericRequirement::None; RangeToInclusive, sym::RangeToInclusive, range_to_inclusive_struct, Target::Struct, GenericRequirement::None; RangeTo, sym::RangeTo, range_to_struct, Target::Struct, GenericRequirement::None; + RangeMax, sym::RangeMax, range_max, Target::AssocConst, GenericRequirement::Exact(0); + RangeMin, sym::RangeMin, range_min, Target::AssocConst, GenericRequirement::Exact(0); + RangeSub, sym::RangeSub, range_sub, Target::Method(MethodKind::Trait { body: false }), GenericRequirement::Exact(0); // `new_range` types that are `Copy + IntoIterator` RangeFromCopy, sym::RangeFromCopy, range_from_copy_struct, Target::Struct, GenericRequirement::None; diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index 3f75cce009225..d16aba197fe59 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -244,9 +244,6 @@ hir_analysis_inherent_ty_outside_relevant = cannot define inherent `impl` for a .help = consider moving this inherent impl into the crate defining the type if possible .span_help = alternatively add `#[rustc_allow_incoherent_impl]` to the relevant impl items -hir_analysis_invalid_base_type = `{$ty}` is not a valid base type for range patterns - .note = range patterns only support integers - hir_analysis_invalid_generic_receiver_ty = invalid generic `self` parameter type: `{$receiver_ty}` .note = type of `self` must not be a method generic parameter type diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 852533ff5c954..f3e1e89812ca7 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -11,8 +11,6 @@ use rustc_middle::ty::Ty; use rustc_span::{Ident, Span, Symbol}; use crate::fluent_generated as fluent; -mod pattern_types; -pub(crate) use pattern_types::*; pub(crate) mod wrong_number_of_generic_args; mod precise_captures; diff --git a/compiler/rustc_hir_analysis/src/errors/pattern_types.rs b/compiler/rustc_hir_analysis/src/errors/pattern_types.rs deleted file mode 100644 index ec7b3aaa1c14c..0000000000000 --- a/compiler/rustc_hir_analysis/src/errors/pattern_types.rs +++ /dev/null @@ -1,14 +0,0 @@ -use rustc_macros::Diagnostic; -use rustc_middle::ty::Ty; -use rustc_span::Span; - -#[derive(Diagnostic)] -#[diag(hir_analysis_invalid_base_type)] -pub(crate) struct InvalidBaseType<'tcx> { - pub ty: Ty<'tcx>, - #[primary_span] - pub ty_span: Span, - pub pat: &'static str, - #[note] - pub pat_span: Span, -} diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs index 750770178eef9..5daf7f18cfd96 100644 --- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs +++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs @@ -53,9 +53,7 @@ use rustc_type_ir::Upcast; use tracing::{debug, instrument}; use crate::check::check_abi_fn_ptr; -use crate::errors::{ - AmbiguousLifetimeBound, BadReturnTypeNotation, InvalidBaseType, NoVariantNamed, -}; +use crate::errors::{AmbiguousLifetimeBound, BadReturnTypeNotation, NoVariantNamed}; use crate::hir_ty_lowering::errors::{GenericsArgsErrExtend, prohibit_assoc_item_constraint}; use crate::hir_ty_lowering::generics::{check_generic_arg_count, lower_generic_args}; use crate::middle::resolve_bound_vars as rbv; @@ -2452,28 +2450,26 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { let ty_span = ty.span; let ty = self.lower_ty(ty); let pat_ty = match pat.kind { - hir::TyPatKind::Range(start, end, include_end) => { - let ty = match ty.kind() { - ty::Int(_) | ty::Uint(_) | ty::Char => ty, - _ => Ty::new_error( - tcx, - self.dcx().emit_err(InvalidBaseType { - ty, - pat: "range", + hir::TyPatKind::Range(start, end) => { + let (ty, start, end) = match ty.kind() { + // Keep this list of types in sync with the list of types that + // the `RangePattern` trait is implemented for. + ty::Int(_) | ty::Uint(_) | ty::Char => { + let start = self.lower_const_arg(start, FeedConstTy::No); + let end = self.lower_const_arg(end, FeedConstTy::No); + (ty, start, end) + } + _ => { + let guar = self.dcx().span_delayed_bug( ty_span, - pat_span: pat.span, - }), - ), - }; - let start = start.map(|expr| self.lower_const_arg(expr, FeedConstTy::No)); - let end = end.map(|expr| self.lower_const_arg(expr, FeedConstTy::No)); - - let include_end = match include_end { - hir::RangeEnd::Included => true, - hir::RangeEnd::Excluded => false, + "invalid base type for range pattern", + ); + let errc = ty::Const::new_error(tcx, guar); + (Ty::new_error(tcx, guar), errc, errc) + } }; - let pat = tcx.mk_pat(ty::PatternKind::Range { start, end, include_end }); + let pat = tcx.mk_pat(ty::PatternKind::Range { start, end }); Ty::new_pat(tcx, ty, pat) } hir::TyPatKind::Err(e) => Ty::new_error(tcx, e), diff --git a/compiler/rustc_hir_analysis/src/variance/constraints.rs b/compiler/rustc_hir_analysis/src/variance/constraints.rs index e954d2b9ea48e..8475903c68fde 100644 --- a/compiler/rustc_hir_analysis/src/variance/constraints.rs +++ b/compiler/rustc_hir_analysis/src/variance/constraints.rs @@ -252,13 +252,9 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { ty::Pat(typ, pat) => { match *pat { - ty::PatternKind::Range { start, end, include_end: _ } => { - if let Some(start) = start { - self.add_constraints_from_const(current, start, variance); - } - if let Some(end) = end { - self.add_constraints_from_const(current, end, variance); - } + ty::PatternKind::Range { start, end } => { + self.add_constraints_from_const(current, start, variance); + self.add_constraints_from_const(current, end, variance); } } self.add_constraints_from_ty(current, typ, variance); diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs index b3377b487694b..ab6ac1ba392b9 100644 --- a/compiler/rustc_hir_pretty/src/lib.rs +++ b/compiler/rustc_hir_pretty/src/lib.rs @@ -1868,17 +1868,10 @@ impl<'a> State<'a> { // Pat isn't normalized, but the beauty of it // is that it doesn't matter match pat.kind { - TyPatKind::Range(begin, end, end_kind) => { - if let Some(expr) = begin { - self.print_const_arg(expr); - } - match end_kind { - RangeEnd::Included => self.word("..."), - RangeEnd::Excluded => self.word(".."), - } - if let Some(expr) = end { - self.print_const_arg(expr); - } + TyPatKind::Range(begin, end) => { + self.print_const_arg(begin); + self.word("..="); + self.print_const_arg(end); } TyPatKind::Err(_) => { self.popen(); diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index cb83d405cc3ed..14710e5545202 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -882,27 +882,13 @@ fn ty_is_known_nonnull<'tcx>( || Option::unwrap_or_default( try { match **pat { - ty::PatternKind::Range { start, end, include_end } => { - match (start, end) { - (Some(start), None) => { - start.try_to_value()?.try_to_bits(tcx, typing_env)? > 0 - } - (Some(start), Some(end)) => { - let start = - start.try_to_value()?.try_to_bits(tcx, typing_env)?; - let end = - end.try_to_value()?.try_to_bits(tcx, typing_env)?; - - if include_end { - // This also works for negative numbers, as we just need - // to ensure we aren't wrapping over zero. - start > 0 && end >= start - } else { - start > 0 && end > start - } - } - _ => false, - } + ty::PatternKind::Range { start, end } => { + let start = start.try_to_value()?.try_to_bits(tcx, typing_env)?; + let end = end.try_to_value()?.try_to_bits(tcx, typing_env)?; + + // This also works for negative numbers, as we just need + // to ensure we aren't wrapping over zero. + start > 0 && end >= start } } }, diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 97850a2afc11e..3d63ea8205302 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -3782,7 +3782,7 @@ declare_lint! { Warn, "use of unsupported calling convention for function pointer", @future_incompatible = FutureIncompatibleInfo { - reason: FutureIncompatibilityReason::FutureReleaseErrorDontReportInDeps, + reason: FutureIncompatibilityReason::FutureReleaseErrorReportInDeps, reference: "issue #130260 ", }; } diff --git a/compiler/rustc_middle/src/ty/flags.rs b/compiler/rustc_middle/src/ty/flags.rs index ec0498b168c01..0b8f0e8cd41d9 100644 --- a/compiler/rustc_middle/src/ty/flags.rs +++ b/compiler/rustc_middle/src/ty/flags.rs @@ -220,13 +220,9 @@ impl FlagComputation { &ty::Pat(ty, pat) => { self.add_ty(ty); match *pat { - ty::PatternKind::Range { start, end, include_end: _ } => { - if let Some(start) = start { - self.add_const(start) - } - if let Some(end) = end { - self.add_const(end) - } + ty::PatternKind::Range { start, end } => { + self.add_const(start); + self.add_const(end); } } } diff --git a/compiler/rustc_middle/src/ty/pattern.rs b/compiler/rustc_middle/src/ty/pattern.rs index e604aedd05e32..4cad1ab209916 100644 --- a/compiler/rustc_middle/src/ty/pattern.rs +++ b/compiler/rustc_middle/src/ty/pattern.rs @@ -26,18 +26,30 @@ impl<'tcx> fmt::Debug for Pattern<'tcx> { impl<'tcx> fmt::Debug for PatternKind<'tcx> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { - PatternKind::Range { start, end, include_end } => { - if let Some(start) = start { - write!(f, "{start}")?; + PatternKind::Range { start, end } => { + write!(f, "{start}")?; + + if let Some(c) = end.try_to_value() { + let end = c.valtree.unwrap_leaf(); + let size = end.size(); + let max = match c.ty.kind() { + ty::Int(_) => { + Some(ty::ScalarInt::truncate_from_int(size.signed_int_max(), size)) + } + ty::Uint(_) => { + Some(ty::ScalarInt::truncate_from_uint(size.unsigned_int_max(), size)) + } + ty::Char => Some(ty::ScalarInt::truncate_from_uint(char::MAX, size)), + _ => None, + }; + if let Some((max, _)) = max + && end == max + { + return write!(f, ".."); + } } - write!(f, "..")?; - if include_end { - write!(f, "=")?; - } - if let Some(end) = end { - write!(f, "{end}")?; - } - Ok(()) + + write!(f, "..={end}") } } } @@ -46,5 +58,5 @@ impl<'tcx> fmt::Debug for PatternKind<'tcx> { #[derive(Clone, PartialEq, Eq, Hash)] #[derive(HashStable, TyEncodable, TyDecodable, TypeVisitable, TypeFoldable)] pub enum PatternKind<'tcx> { - Range { start: Option>, end: Option>, include_end: bool }, + Range { start: ty::Const<'tcx>, end: ty::Const<'tcx> }, } diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 839c1c346a47b..b1dfcb80bde57 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -51,22 +51,12 @@ impl<'tcx> Relate> for ty::Pattern<'tcx> { ) -> RelateResult<'tcx, Self> { match (&*a, &*b) { ( - &ty::PatternKind::Range { start: start_a, end: end_a, include_end: inc_a }, - &ty::PatternKind::Range { start: start_b, end: end_b, include_end: inc_b }, + &ty::PatternKind::Range { start: start_a, end: end_a }, + &ty::PatternKind::Range { start: start_b, end: end_b }, ) => { - // FIXME(pattern_types): make equal patterns equal (`0..=` is the same as `..=`). - let mut relate_opt_const = |a, b| match (a, b) { - (None, None) => Ok(None), - (Some(a), Some(b)) => relation.relate(a, b).map(Some), - // FIXME(pattern_types): report a better error - _ => Err(TypeError::Mismatch), - }; - let start = relate_opt_const(start_a, start_b)?; - let end = relate_opt_const(end_a, end_b)?; - if inc_a != inc_b { - todo!() - } - Ok(relation.cx().mk_pat(ty::PatternKind::Range { start, end, include_end: inc_a })) + let start = relation.relate(start_a, start_b)?; + let end = relation.relate(end_a, end_b)?; + Ok(relation.cx().mk_pat(ty::PatternKind::Range { start, end })) } } } diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index db9e9fbc643b2..6c62c04f42e4c 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -284,6 +284,7 @@ TrivialTypeTraversalImpls! { rustc_hir::def_id::LocalDefId, rustc_hir::HirId, rustc_hir::MatchSource, + rustc_hir::RangeEnd, rustc_span::Ident, rustc_span::Span, rustc_span::Symbol, diff --git a/compiler/rustc_middle/src/ty/walk.rs b/compiler/rustc_middle/src/ty/walk.rs index 3e8a3d1a28923..a23316ae6fc88 100644 --- a/compiler/rustc_middle/src/ty/walk.rs +++ b/compiler/rustc_middle/src/ty/walk.rs @@ -137,9 +137,9 @@ fn push_inner<'tcx>(stack: &mut TypeWalkerStack<'tcx>, parent: GenericArg<'tcx>) ty::Pat(ty, pat) => { match *pat { - ty::PatternKind::Range { start, end, include_end: _ } => { - stack.extend(end.map(Into::into)); - stack.extend(start.map(Into::into)); + ty::PatternKind::Range { start, end } => { + stack.push(end.into()); + stack.push(start.into()); } } stack.push(ty.into()); diff --git a/compiler/rustc_smir/src/rustc_internal/internal.rs b/compiler/rustc_smir/src/rustc_internal/internal.rs index 50cf605ba2a82..bb2b2dea2f37f 100644 --- a/compiler/rustc_smir/src/rustc_internal/internal.rs +++ b/compiler/rustc_smir/src/rustc_internal/internal.rs @@ -88,10 +88,9 @@ impl RustcInternal for Pattern { type T<'tcx> = rustc_ty::Pattern<'tcx>; fn internal<'tcx>(&self, tables: &mut Tables<'_>, tcx: TyCtxt<'tcx>) -> Self::T<'tcx> { tcx.mk_pat(match self { - Pattern::Range { start, end, include_end } => rustc_ty::PatternKind::Range { - start: start.as_ref().map(|c| c.internal(tables, tcx)), - end: end.as_ref().map(|c| c.internal(tables, tcx)), - include_end: *include_end, + Pattern::Range { start, end, include_end: _ } => rustc_ty::PatternKind::Range { + start: start.as_ref().unwrap().internal(tables, tcx), + end: end.as_ref().unwrap().internal(tables, tcx), }, }) } diff --git a/compiler/rustc_smir/src/rustc_smir/convert/ty.rs b/compiler/rustc_smir/src/rustc_smir/convert/ty.rs index a0faf20c79a67..aa0eac628dd0f 100644 --- a/compiler/rustc_smir/src/rustc_smir/convert/ty.rs +++ b/compiler/rustc_smir/src/rustc_smir/convert/ty.rs @@ -405,10 +405,11 @@ impl<'tcx> Stable<'tcx> for ty::Pattern<'tcx> { fn stable(&self, tables: &mut Tables<'_>) -> Self::T { match **self { - ty::PatternKind::Range { start, end, include_end } => stable_mir::ty::Pattern::Range { - start: start.stable(tables), - end: end.stable(tables), - include_end, + ty::PatternKind::Range { start, end } => stable_mir::ty::Pattern::Range { + // FIXME(SMIR): update data structures to not have an Option here anymore + start: Some(start.stable(tables)), + end: Some(end.stable(tables)), + include_end: true, }, } } diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs index 84e89ff4b7dab..64982b858c644 100644 --- a/compiler/rustc_span/src/hygiene.rs +++ b/compiler/rustc_span/src/hygiene.rs @@ -1173,6 +1173,8 @@ pub enum DesugaringKind { BoundModifier, /// Calls to contract checks (`#[requires]` to precond, `#[ensures]` to postcond) Contract, + /// A pattern type range start/end + PatTyRange, } impl DesugaringKind { @@ -1190,6 +1192,7 @@ impl DesugaringKind { DesugaringKind::WhileLoop => "`while` loop", DesugaringKind::BoundModifier => "trait bound modifier", DesugaringKind::Contract => "contract check", + DesugaringKind::PatTyRange => "pattern type", } } } diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 501c9039f2de9..43ebd41571772 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -308,6 +308,9 @@ symbols! { RangeFull, RangeInclusive, RangeInclusiveCopy, + RangeMax, + RangeMin, + RangeSub, RangeTo, RangeToInclusive, Rc, @@ -1521,6 +1524,7 @@ symbols! { pattern_complexity_limit, pattern_parentheses, pattern_type, + pattern_type_range_trait, pattern_types, permissions_from_mode, phantom_data, diff --git a/compiler/rustc_symbol_mangling/src/v0.rs b/compiler/rustc_symbol_mangling/src/v0.rs index 4fafd1ac3509a..7756a4f1c3a15 100644 --- a/compiler/rustc_symbol_mangling/src/v0.rs +++ b/compiler/rustc_symbol_mangling/src/v0.rs @@ -413,12 +413,8 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> { } ty::Pat(ty, pat) => match *pat { - ty::PatternKind::Range { start, end, include_end } => { - let consts = [ - start.unwrap_or(self.tcx.consts.unit), - end.unwrap_or(self.tcx.consts.unit), - ty::Const::from_bool(self.tcx, include_end), - ]; + ty::PatternKind::Range { start, end } => { + let consts = [start, end]; // HACK: Represent as tuple until we have something better. // HACK: constants are used in arrays, even if the types don't match. self.push("T"); diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 18906a6a8ce0f..54b6c22b2d821 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -708,7 +708,7 @@ impl<'a, 'tcx> TypeVisitor> for WfPredicates<'a, 'tcx> { ty::Pat(subty, pat) => { self.require_sized(subty, ObligationCauseCode::Misc); match *pat { - ty::PatternKind::Range { start, end, include_end: _ } => { + ty::PatternKind::Range { start, end } => { let mut check = |c| { let cause = self.cause(ObligationCauseCode::Misc); self.out.push(traits::Obligation::with_depth( @@ -738,12 +738,8 @@ impl<'a, 'tcx> TypeVisitor> for WfPredicates<'a, 'tcx> { } } }; - if let Some(start) = start { - check(start) - } - if let Some(end) = end { - check(end) - } + check(start); + check(end); } } } diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 2ab6b8e17c4cc..55af8ceeab920 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -207,24 +207,17 @@ fn layout_of_uncached<'tcx>( let layout = cx.layout_of(ty)?.layout; let mut layout = LayoutData::clone(&layout.0); match *pat { - ty::PatternKind::Range { start, end, include_end } => { + ty::PatternKind::Range { start, end } => { if let BackendRepr::Scalar(scalar) | BackendRepr::ScalarPair(scalar, _) = &mut layout.backend_repr { - if let Some(start) = start { - scalar.valid_range_mut().start = extract_const_value(cx, ty, start)? - .try_to_bits(tcx, cx.typing_env) - .ok_or_else(|| error(cx, LayoutError::Unknown(ty)))?; - } - if let Some(end) = end { - let mut end = extract_const_value(cx, ty, end)? - .try_to_bits(tcx, cx.typing_env) - .ok_or_else(|| error(cx, LayoutError::Unknown(ty)))?; - if !include_end { - end = end.wrapping_sub(1); - } - scalar.valid_range_mut().end = end; - } + scalar.valid_range_mut().start = extract_const_value(cx, ty, start)? + .try_to_bits(tcx, cx.typing_env) + .ok_or_else(|| error(cx, LayoutError::Unknown(ty)))?; + + scalar.valid_range_mut().end = extract_const_value(cx, ty, end)? + .try_to_bits(tcx, cx.typing_env) + .ok_or_else(|| error(cx, LayoutError::Unknown(ty)))?; let niche = Niche { offset: Size::ZERO, diff --git a/compiler/rustc_ty_utils/src/ty.rs b/compiler/rustc_ty_utils/src/ty.rs index 8ed45b4e5415b..8610c30ab703e 100644 --- a/compiler/rustc_ty_utils/src/ty.rs +++ b/compiler/rustc_ty_utils/src/ty.rs @@ -37,8 +37,6 @@ fn sized_constraint_for_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option None, - UnsafeBinder(_) => todo!(), - // these are never sized Str | Slice(..) | Dynamic(_, _, ty::Dyn) | Foreign(..) => Some(ty), @@ -52,9 +50,14 @@ fn sized_constraint_for_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Option Some(ty), + // We cannot instantiate the binder, so just return the *original* type back, + // but only if the inner type has a sized constraint. Thus we skip the binder, + // but don't actually use the result from `sized_constraint_for_ty`. + UnsafeBinder(inner_ty) => sized_constraint_for_ty(tcx, inner_ty.skip_binder()).map(|_| ty), + Placeholder(..) | Bound(..) | Infer(..) => { bug!("unexpected type `{ty:?}` in sized_constraint_for_ty") } diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 594236cf1d96f..c8ced78c4d791 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -1369,7 +1369,7 @@ pub trait PartialOrd: PartialEq { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_diagnostic_item = "cmp_partialord_lt"] fn lt(&self, other: &Rhs) -> bool { - matches!(self.partial_cmp(other), Some(Less)) + self.partial_cmp(other).is_some_and(Ordering::is_lt) } /// Tests less than or equal to (for `self` and `other`) and is used by the @@ -1387,7 +1387,7 @@ pub trait PartialOrd: PartialEq { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_diagnostic_item = "cmp_partialord_le"] fn le(&self, other: &Rhs) -> bool { - matches!(self.partial_cmp(other), Some(Less | Equal)) + self.partial_cmp(other).is_some_and(Ordering::is_le) } /// Tests greater than (for `self` and `other`) and is used by the `>` @@ -1405,7 +1405,7 @@ pub trait PartialOrd: PartialEq { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_diagnostic_item = "cmp_partialord_gt"] fn gt(&self, other: &Rhs) -> bool { - matches!(self.partial_cmp(other), Some(Greater)) + self.partial_cmp(other).is_some_and(Ordering::is_gt) } /// Tests greater than or equal to (for `self` and `other`) and is used by @@ -1423,7 +1423,7 @@ pub trait PartialOrd: PartialEq { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_diagnostic_item = "cmp_partialord_ge"] fn ge(&self, other: &Rhs) -> bool { - matches!(self.partial_cmp(other), Some(Greater | Equal)) + self.partial_cmp(other).is_some_and(Ordering::is_ge) } } diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs index 3bde183fefb71..3881cf90ad729 100644 --- a/library/core/src/intrinsics/simd.rs +++ b/library/core/src/intrinsics/simd.rs @@ -11,7 +11,7 @@ /// `idx` must be in-bounds of the vector. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn simd_insert(_x: T, _idx: u32, _val: U) -> T; +pub const unsafe fn simd_insert(_x: T, _idx: u32, _val: U) -> T; /// Extracts an element from a vector. /// @@ -22,7 +22,7 @@ pub unsafe fn simd_insert(_x: T, _idx: u32, _val: U) -> T; /// `idx` must be in-bounds of the vector. #[rustc_intrinsic] #[rustc_nounwind] -pub unsafe fn simd_extract(_x: T, _idx: u32) -> U; +pub const unsafe fn simd_extract(_x: T, _idx: u32) -> U; /// Adds two simd vectors elementwise. /// diff --git a/library/core/src/pat.rs b/library/core/src/pat.rs index 752e79c2dacee..5122d55f5163a 100644 --- a/library/core/src/pat.rs +++ b/library/core/src/pat.rs @@ -12,3 +12,60 @@ macro_rules! pattern_type { /* compiler built-in */ }; } + +/// A trait implemented for integer types and `char`. +/// Useful in the future for generic pattern types, but +/// used right now to simplify ast lowering of pattern type ranges. +#[unstable(feature = "pattern_type_range_trait", issue = "123646")] +#[rustc_const_unstable(feature = "pattern_type_range_trait", issue = "123646")] +#[const_trait] +#[diagnostic::on_unimplemented( + message = "`{Self}` is not a valid base type for range patterns", + label = "only integer types and `char` are supported" +)] +pub trait RangePattern { + /// Trait version of the inherent `MIN` assoc const. + #[cfg_attr(not(bootstrap), lang = "RangeMin")] + const MIN: Self; + + /// Trait version of the inherent `MIN` assoc const. + #[cfg_attr(not(bootstrap), lang = "RangeMax")] + const MAX: Self; + + /// A compile-time helper to subtract 1 for exclusive ranges. + #[cfg_attr(not(bootstrap), lang = "RangeSub")] + #[track_caller] + fn sub_one(self) -> Self; +} + +macro_rules! impl_range_pat { + ($($ty:ty,)*) => { + $( + impl const RangePattern for $ty { + const MIN: $ty = <$ty>::MIN; + const MAX: $ty = <$ty>::MAX; + fn sub_one(self) -> Self { + self - 1 + } + } + )* + } +} + +impl_range_pat! { + i8, i16, i32, i64, i128, isize, + u8, u16, u32, u64, u128, usize, +} + +impl const RangePattern for char { + const MIN: Self = char::MIN; + + const MAX: Self = char::MAX; + + fn sub_one(self) -> Self { + match char::from_u32(self as u32 - 1) { + None => panic!("exclusive range to start of valid chars"), + Some(val) => val, + } + } +} diff --git a/library/std/src/sys/pal/windows/process.rs b/library/std/src/sys/pal/windows/process.rs index a41dfbfe6014d..6eff471f38670 100644 --- a/library/std/src/sys/pal/windows/process.rs +++ b/library/std/src/sys/pal/windows/process.rs @@ -260,9 +260,10 @@ impl Command { needs_stdin: bool, proc_thread_attribute_list: Option<&ProcThreadAttributeList<'_>>, ) -> io::Result<(Process, StdioPipes)> { + let env_saw_path = self.env.have_changed_path(); let maybe_env = self.env.capture_if_changed(); - let child_paths = if let Some(env) = maybe_env.as_ref() { + let child_paths = if env_saw_path && let Some(env) = maybe_env.as_ref() { env.get(&EnvKey::new("PATH")).map(|s| s.as_os_str()) } else { None diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index aee56fe78e21f..8e913f6818423 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -987,9 +987,7 @@ macro_rules! tool_doc { cargo.rustdocflag("-Arustdoc::private-intra-doc-links"); cargo.rustdocflag("--enable-index-page"); cargo.rustdocflag("--show-type-layout"); - // FIXME: `--generate-link-to-definition` tries to resolve cfged out code - // see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222 - // cargo.rustdocflag("--generate-link-to-definition"); + cargo.rustdocflag("--generate-link-to-definition"); let out_dir = builder.stage_out(compiler, Mode::ToolRustc).join(target).join("doc"); $(for krate in $crates { diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 709711d9d34c1..c9fa2e9ba9663 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -269,7 +269,13 @@ impl Step for Cargotest { .args(builder.config.test_args()) .env("RUSTC", builder.rustc(compiler)) .env("RUSTDOC", builder.rustdoc(compiler)); - add_rustdoc_cargo_linker_args(&mut cmd, builder, compiler.host, LldThreads::No); + add_rustdoc_cargo_linker_args( + &mut cmd, + builder, + compiler.host, + LldThreads::No, + compiler.stage, + ); cmd.delay_failure().run(builder); } } @@ -847,7 +853,7 @@ impl Step for RustdocTheme { .env("CFG_RELEASE_CHANNEL", &builder.config.channel) .env("RUSTDOC_REAL", builder.rustdoc(self.compiler)) .env("RUSTC_BOOTSTRAP", "1"); - cmd.args(linker_args(builder, self.compiler.host, LldThreads::No)); + cmd.args(linker_args(builder, self.compiler.host, LldThreads::No, self.compiler.stage)); cmd.delay_failure().run(builder); } @@ -1023,7 +1029,13 @@ impl Step for RustdocGUI { cmd.env("RUSTDOC", builder.rustdoc(self.compiler)) .env("RUSTC", builder.rustc(self.compiler)); - add_rustdoc_cargo_linker_args(&mut cmd, builder, self.compiler.host, LldThreads::No); + add_rustdoc_cargo_linker_args( + &mut cmd, + builder, + self.compiler.host, + LldThreads::No, + self.compiler.stage, + ); for path in &builder.paths { if let Some(p) = helpers::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) { @@ -1887,7 +1899,7 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let mut hostflags = flags.clone(); hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display())); - hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No)); + hostflags.extend(linker_flags(builder, compiler.host, LldThreads::No, compiler.stage)); let mut targetflags = flags; targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display())); diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index 0aab9f04feae8..d1d52d82eaa0f 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -260,7 +260,7 @@ impl Cargo { } } - for arg in linker_args(builder, compiler.host, LldThreads::Yes) { + for arg in linker_args(builder, compiler.host, LldThreads::Yes, 0) { self.hostflags.arg(&arg); } @@ -270,10 +270,10 @@ impl Cargo { } // We want to set -Clinker using Cargo, therefore we only call `linker_flags` and not // `linker_args` here. - for flag in linker_flags(builder, target, LldThreads::Yes) { + for flag in linker_flags(builder, target, LldThreads::Yes, compiler.stage) { self.rustflags.arg(&flag); } - for arg in linker_args(builder, target, LldThreads::Yes) { + for arg in linker_args(builder, target, LldThreads::Yes, compiler.stage) { self.rustdocflags.arg(&arg); } diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 9c04f097bee27..c8e2856bdc874 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -1462,7 +1462,7 @@ impl<'a> Builder<'a> { cmd.arg("-Dwarnings"); } cmd.arg("-Znormalize-docs"); - cmd.args(linker_args(self, compiler.host, LldThreads::Yes)); + cmd.args(linker_args(self, compiler.host, LldThreads::Yes, compiler.stage)); cmd } diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index 3fee397da091d..7ad308cd06728 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -430,8 +430,9 @@ pub fn linker_args( builder: &Builder<'_>, target: TargetSelection, lld_threads: LldThreads, + stage: u32, ) -> Vec { - let mut args = linker_flags(builder, target, lld_threads); + let mut args = linker_flags(builder, target, lld_threads, stage); if let Some(linker) = builder.linker(target) { args.push(format!("-Clinker={}", linker.display())); @@ -446,12 +447,18 @@ pub fn linker_flags( builder: &Builder<'_>, target: TargetSelection, lld_threads: LldThreads, + stage: u32, ) -> Vec { let mut args = vec![]; if !builder.is_lld_direct_linker(target) && builder.config.lld_mode.is_used() { match builder.config.lld_mode { LldMode::External => { - args.push("-Clinker-flavor=gnu-lld-cc".to_string()); + // cfg(bootstrap) - remove after updating bootstrap compiler (#137498) + if stage == 0 && target.is_windows() { + args.push("-Clink-arg=-fuse-ld=lld".to_string()); + } else { + args.push("-Clinker-flavor=gnu-lld-cc".to_string()); + } // FIXME(kobzol): remove this flag once MCP510 gets stabilized args.push("-Zunstable-options".to_string()); } @@ -479,8 +486,9 @@ pub fn add_rustdoc_cargo_linker_args( builder: &Builder<'_>, target: TargetSelection, lld_threads: LldThreads, + stage: u32, ) { - let args = linker_args(builder, target, lld_threads); + let args = linker_args(builder, target, lld_threads, stage); let mut flags = cmd .get_envs() .find_map(|(k, v)| if k == OsStr::new("RUSTDOCFLAGS") { v } else { None }) diff --git a/src/tools/clippy/clippy_utils/src/hir_utils.rs b/src/tools/clippy/clippy_utils/src/hir_utils.rs index 0ac675345ae0c..cde201196c57a 100644 --- a/src/tools/clippy/clippy_utils/src/hir_utils.rs +++ b/src/tools/clippy/clippy_utils/src/hir_utils.rs @@ -1108,14 +1108,9 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> { pub fn hash_ty_pat(&mut self, pat: &TyPat<'_>) { std::mem::discriminant(&pat.kind).hash(&mut self.s); match pat.kind { - TyPatKind::Range(s, e, i) => { - if let Some(s) = s { - self.hash_const_arg(s); - } - if let Some(e) = e { - self.hash_const_arg(e); - } - std::mem::discriminant(&i).hash(&mut self.s); + TyPatKind::Range(s, e) => { + self.hash_const_arg(s); + self.hash_const_arg(e); }, TyPatKind::Err(_) => {}, } diff --git a/tests/assembly/aarch64-pointer-auth.rs b/tests/assembly/aarch64-pointer-auth.rs index 344e9e74bc2ac..8c0069826795f 100644 --- a/tests/assembly/aarch64-pointer-auth.rs +++ b/tests/assembly/aarch64-pointer-auth.rs @@ -1,5 +1,6 @@ // Test that PAC instructions are emitted when branch-protection is specified. +//@ add-core-stubs //@ revisions: PACRET PAUTHLR_NOP PAUTHLR //@ assembly-output: emit-asm //@ needs-llvm-components: aarch64 @@ -14,8 +15,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // PACRET: hint #25 // PACRET: hint #29 diff --git a/tests/assembly/cmse.rs b/tests/assembly/cmse.rs index e0ada8dc2f15c..2984df92225c9 100644 --- a/tests/assembly/cmse.rs +++ b/tests/assembly/cmse.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: hard soft //@ assembly-output: emit-asm //@ [hard] compile-flags: --target thumbv8m.main-none-eabihf --crate-type lib -Copt-level=1 @@ -7,10 +8,9 @@ #![crate_type = "lib"] #![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} + +extern crate minicore; +use minicore::*; // CHECK-LABEL: __acle_se_entry_point: // CHECK-NEXT: entry_point: diff --git a/tests/assembly/dwarf4.rs b/tests/assembly/dwarf4.rs index 22be8e5603f24..6013adf3386ae 100644 --- a/tests/assembly/dwarf4.rs +++ b/tests/assembly/dwarf4.rs @@ -1,5 +1,6 @@ // Makes sure that `-Z dwarf-version=4` causes `rustc` to emit DWARF version 4. //@ assembly-output: emit-asm +//@ add-core-stubs //@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=4 -Copt-level=0 //@ needs-llvm-components: x86 @@ -7,10 +8,8 @@ #![crate_type = "rlib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn wibble() {} diff --git a/tests/assembly/dwarf5.rs b/tests/assembly/dwarf5.rs index 35f2716e9fa96..9cd596e783459 100644 --- a/tests/assembly/dwarf5.rs +++ b/tests/assembly/dwarf5.rs @@ -1,4 +1,5 @@ // Makes sure that `-Z dwarf-version=5` causes `rustc` to emit DWARF version 5. +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: -g --target x86_64-unknown-linux-gnu -Z dwarf-version=5 -Copt-level=0 //@ needs-llvm-components: x86 @@ -7,10 +8,8 @@ #![crate_type = "rlib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn wibble() {} diff --git a/tests/assembly/pic-relocation-model.rs b/tests/assembly/pic-relocation-model.rs index 73db94791ec6b..d35cd968389a1 100644 --- a/tests/assembly/pic-relocation-model.rs +++ b/tests/assembly/pic-relocation-model.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 //@ assembly-output: emit-asm //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic @@ -7,10 +8,8 @@ #![no_core] #![crate_type = "rlib"] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: call_other_fn: // CHECK: {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip) diff --git a/tests/assembly/pie-relocation-model.rs b/tests/assembly/pie-relocation-model.rs index e632b4dd58237..5c74b34eb3135 100644 --- a/tests/assembly/pie-relocation-model.rs +++ b/tests/assembly/pie-relocation-model.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 //@ assembly-output: emit-asm //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie @@ -7,10 +8,8 @@ #![no_core] #![crate_type = "rlib"] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: call_other_fn: // With PIE local functions are called "directly". diff --git a/tests/assembly/powerpc64-struct-abi.rs b/tests/assembly/powerpc64-struct-abi.rs index 0332eb94d8a76..eb27afc4f23c6 100644 --- a/tests/assembly/powerpc64-struct-abi.rs +++ b/tests/assembly/powerpc64-struct-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: elfv1-be elfv2-be elfv2-le aix //@ assembly-output: emit-asm //@ compile-flags: -Copt-level=3 @@ -20,21 +21,9 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; -#[lang = "copy"] -trait Copy {} - -#[lang = "freeze"] -trait Freeze {} - -#[lang = "unpin"] -trait Unpin {} - -impl Copy for u8 {} -impl Copy for u16 {} -impl Copy for u32 {} impl Copy for FiveU32s {} impl Copy for FiveU16s {} impl Copy for ThreeU8s {} diff --git a/tests/assembly/riscv-soft-abi-with-float-features.rs b/tests/assembly/riscv-soft-abi-with-float-features.rs index 8ccfa72a7b6f1..72cbd3841c123 100644 --- a/tests/assembly/riscv-soft-abi-with-float-features.rs +++ b/tests/assembly/riscv-soft-abi-with-float-features.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ compile-flags: --target riscv64imac-unknown-none-elf -Ctarget-feature=+f,+d //@ needs-llvm-components: riscv @@ -9,15 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -impl Copy for f16 {} -impl Copy for f32 {} -impl Copy for f64 {} +extern crate minicore; +use minicore::*; // This test checks that the floats are all returned in `a0` as required by the `lp64` ABI. diff --git a/tests/assembly/s390x-backchain-toggle.rs b/tests/assembly/s390x-backchain-toggle.rs index 7ef0292d911e0..83c7b82d0d4b3 100644 --- a/tests/assembly/s390x-backchain-toggle.rs +++ b/tests/assembly/s390x-backchain-toggle.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: enable-backchain disable-backchain //@ assembly-output: emit-asm //@ compile-flags: -Copt-level=3 --crate-type=lib --target=s390x-unknown-linux-gnu @@ -8,8 +9,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; extern "C" { fn extern_func(); diff --git a/tests/assembly/simd-bitmask.rs b/tests/assembly/simd-bitmask.rs index 4a829c4dd98b2..a632791153b2e 100644 --- a/tests/assembly/simd-bitmask.rs +++ b/tests/assembly/simd-bitmask.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86 x86-avx2 x86-avx512 aarch64 //@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86] needs-llvm-components: x86 @@ -16,12 +17,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct m8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-gather.rs b/tests/assembly/simd-intrinsic-gather.rs index 3152de35f295e..8c17a58046d8b 100644 --- a/tests/assembly/simd-intrinsic-gather.rs +++ b/tests/assembly/simd-intrinsic-gather.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx512 //@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq @@ -9,12 +10,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct f64x4([f64; 4]); diff --git a/tests/assembly/simd-intrinsic-mask-load.rs b/tests/assembly/simd-intrinsic-mask-load.rs index efe3e3752fabe..a0d0514c0141d 100644 --- a/tests/assembly/simd-intrinsic-mask-load.rs +++ b/tests/assembly/simd-intrinsic-mask-load.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx2 x86-avx512 //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: -C target-feature=+avx2 @@ -12,13 +13,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} -impl Copy for *const T {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-mask-reduce.rs b/tests/assembly/simd-intrinsic-mask-reduce.rs index 4d4adda6c24f9..959c4ddefdb0e 100644 --- a/tests/assembly/simd-intrinsic-mask-reduce.rs +++ b/tests/assembly/simd-intrinsic-mask-reduce.rs @@ -1,4 +1,5 @@ // verify that simd mask reductions do not introduce additional bit shift operations +//@ add-core-stubs //@ revisions: x86 aarch64 //@ [x86] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel // Set the base cpu explicitly, in case the default has been changed. @@ -13,12 +14,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct mask8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-mask-store.rs b/tests/assembly/simd-intrinsic-mask-store.rs index f5d924f24a764..4be9194943c78 100644 --- a/tests/assembly/simd-intrinsic-mask-store.rs +++ b/tests/assembly/simd-intrinsic-mask-store.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx2 x86-avx512 //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: -C target-feature=+avx2 @@ -12,13 +13,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} -impl Copy for *mut T {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x16([i8; 16]); diff --git a/tests/assembly/simd-intrinsic-scatter.rs b/tests/assembly/simd-intrinsic-scatter.rs index 5f52ababd19c0..715de04af4d76 100644 --- a/tests/assembly/simd-intrinsic-scatter.rs +++ b/tests/assembly/simd-intrinsic-scatter.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx512 //@ [x86-avx512] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx512] compile-flags: -C target-feature=+avx512f,+avx512vl,+avx512bw,+avx512dq @@ -9,12 +10,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct f64x4([f64; 4]); diff --git a/tests/assembly/simd-intrinsic-select.rs b/tests/assembly/simd-intrinsic-select.rs index 74784a772133d..7f1e42662bfb3 100644 --- a/tests/assembly/simd-intrinsic-select.rs +++ b/tests/assembly/simd-intrinsic-select.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86-avx2 x86-avx512 aarch64 //@ [x86-avx2] compile-flags: --target=x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel //@ [x86-avx2] compile-flags: -C target-feature=+avx2 @@ -14,12 +15,8 @@ #![no_core] #![allow(non_camel_case_types)] -// Because we don't have core yet. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i8x16([i8; 16]); diff --git a/tests/assembly/sparc-struct-abi.rs b/tests/assembly/sparc-struct-abi.rs index 3a254f179641d..b1594428811fd 100644 --- a/tests/assembly/sparc-struct-abi.rs +++ b/tests/assembly/sparc-struct-abi.rs @@ -2,6 +2,7 @@ // - float structure members are passes in floating point registers // (#86163) +//@ add-core-stubs //@ assembly-output: emit-asm //@ needs-llvm-components: sparc //@ compile-flags: --target=sparcv9-sun-solaris -Copt-level=3 @@ -9,11 +10,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for f32 {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Franta { diff --git a/tests/assembly/stack-probes.rs b/tests/assembly/stack-probes.rs index e0931157ce173..de245431f470c 100644 --- a/tests/assembly/stack-probes.rs +++ b/tests/assembly/stack-probes.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 i686 aarch64 //@ assembly-output: emit-asm //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu -C llvm-args=-x86-asm-syntax=intel @@ -11,12 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for u8 {} +extern crate minicore; +use minicore::*; // Check that inline-asm stack probes are generated correctly. // To avoid making this test fragile to slight asm changes, diff --git a/tests/assembly/stack-protector/stack-protector-target-support.rs b/tests/assembly/stack-protector/stack-protector-target-support.rs index 74a609dcdcc1c..e9ba0f9ba899c 100644 --- a/tests/assembly/stack-protector/stack-protector-target-support.rs +++ b/tests/assembly/stack-protector/stack-protector-target-support.rs @@ -1,6 +1,7 @@ // Test that stack smash protection code is emitted for all tier1 and tier2 // targets, with the exception of nvptx64-nvidia-cuda // +//@ add-core-stubs //@ revisions: r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 //@ revisions: r24 r25 r26 r27 r28 r29 r30 r31 r32 r33 r35 r36 r37 r38 r39 r40 r41 r42 r43 r44 //@ revisions: r45 r46 r47 r48 r49 r50 r51 r52 r53 r54 r55 r56 r57 r58 r59 r60 r61 r62 r63 r64 r65 @@ -183,10 +184,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/assembly/static-relocation-model.rs b/tests/assembly/static-relocation-model.rs index eafdfd485baac..53fa18852b69f 100644 --- a/tests/assembly/static-relocation-model.rs +++ b/tests/assembly/static-relocation-model.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 A64 ppc64le //@ assembly-output: emit-asm //@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=static @@ -11,20 +12,8 @@ #![no_core] #![crate_type = "rlib"] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -#[lang = "sync"] -trait Sync {} - -#[lang = "drop_in_place"] -fn drop_in_place(_: *mut T) {} - -impl Copy for u8 {} -impl Sync for u8 {} +extern crate minicore; +use minicore::*; #[no_mangle] pub static PIERIS: u8 = 42; diff --git a/tests/assembly/target-feature-multiple.rs b/tests/assembly/target-feature-multiple.rs index 83c385686476e..bc432d2193176 100644 --- a/tests/assembly/target-feature-multiple.rs +++ b/tests/assembly/target-feature-multiple.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm //@ needs-llvm-components: x86 //@ revisions: TWOFLAGS SINGLEFLAG @@ -19,11 +20,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} +extern crate minicore; +use minicore::*; // Use of these requires target features to be enabled extern "unadjusted" { diff --git a/tests/assembly/targets/targets-amdgpu.rs b/tests/assembly/targets/targets-amdgpu.rs index 501eed2e24783..1d10b8fc315ca 100644 --- a/tests/assembly/targets/targets-amdgpu.rs +++ b/tests/assembly/targets/targets-amdgpu.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: amdgcn_amd_amdhsa @@ -11,8 +12,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() -> u8 { 42 diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs index 3e73d2c6eb72d..dc564c60f8073 100644 --- a/tests/assembly/targets/targets-elf.rs +++ b/tests/assembly/targets/targets-elf.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: aarch64_be_unknown_linux_gnu @@ -709,8 +710,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // Force linkage to ensure code is actually generated #[no_mangle] diff --git a/tests/assembly/targets/targets-macho.rs b/tests/assembly/targets/targets-macho.rs index 25e9059afeb18..92bde1c6971b5 100644 --- a/tests/assembly/targets/targets-macho.rs +++ b/tests/assembly/targets/targets-macho.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: aarch64_apple_darwin @@ -80,8 +81,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // Force linkage to ensure code is actually generated #[no_mangle] diff --git a/tests/assembly/targets/targets-nvptx.rs b/tests/assembly/targets/targets-nvptx.rs index 9048191affa18..49c12aebaaaf7 100644 --- a/tests/assembly/targets/targets-nvptx.rs +++ b/tests/assembly/targets/targets-nvptx.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: nvptx64_nvidia_cuda @@ -11,8 +12,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() -> u8 { 42 diff --git a/tests/assembly/targets/targets-pe.rs b/tests/assembly/targets/targets-pe.rs index b74d0181c4d67..f895b79ba5077 100644 --- a/tests/assembly/targets/targets-pe.rs +++ b/tests/assembly/targets/targets-pe.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ assembly-output: emit-asm // ignore-tidy-linelength //@ revisions: aarch64_pc_windows_msvc @@ -95,8 +96,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() -> u8 { 42 diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index 0aa8b6b8f8919..03aa847650823 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -25,7 +25,8 @@ naked_functions, f16, f128, - asm_experimental_arch + asm_experimental_arch, + unboxed_closures )] #![allow(unused, improper_ctypes_definitions, internal_features)] #![no_std] @@ -61,7 +62,7 @@ pub auto trait Unpin {} impl_marker_trait!( Copy => [ - bool, char, + char, bool, isize, i8, i16, i32, i64, i128, usize, u8, u16, u32, u64, u128, f16, f32, f64, f128, @@ -102,6 +103,9 @@ pub struct UnsafeCell { } impl !Freeze for UnsafeCell {} +#[lang = "tuple_trait"] +pub trait Tuple {} + #[rustc_builtin_macro] pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { /* compiler built-in */ @@ -129,3 +133,61 @@ macro_rules! stringify { /* compiler built-in */ }; } + +#[lang = "add"] +pub trait Add { + type Output; + + fn add(self, _: Rhs) -> Self::Output; +} + +impl Add for isize { + type Output = isize; + + fn add(self, other: isize) -> isize { + 7 // avoid needing to add all of the overflow handling and panic language items + } +} + +#[lang = "sync"] +trait Sync {} +impl Sync for u8 {} + +#[lang = "drop_in_place"] +fn drop_in_place(_: *mut T) {} + +#[lang = "fn_once"] +pub trait FnOnce { + #[lang = "fn_once_output"] + type Output; + + extern "rust-call" fn call_once(self, args: Args) -> Self::Output; +} + +#[lang = "fn_mut"] +pub trait FnMut: FnOnce { + extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; +} + +#[lang = "fn"] +pub trait Fn: FnMut { + extern "rust-call" fn call(&self, args: Args) -> Self::Output; +} + +#[lang = "dispatch_from_dyn"] +trait DispatchFromDyn {} + +impl<'a, T: ?Sized + Unsize, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} + +#[lang = "unsize"] +trait Unsize {} + +#[lang = "coerce_unsized"] +pub trait CoerceUnsized {} + +impl<'a, 'b: 'a, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} + +#[lang = "drop"] +trait Drop { + fn drop(&mut self); +} diff --git a/tests/codegen/aarch64-softfloat.rs b/tests/codegen/aarch64-softfloat.rs index 85380a6c4728d..4f5366e047fbd 100644 --- a/tests/codegen/aarch64-softfloat.rs +++ b/tests/codegen/aarch64-softfloat.rs @@ -1,15 +1,12 @@ +//@ add-core-stubs //@ compile-flags: --target aarch64-unknown-none-softfloat -Zmerge-functions=disabled //@ needs-llvm-components: aarch64 #![crate_type = "lib"] #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for f32 {} -impl Copy for f64 {} +extern crate minicore; +use minicore::*; // CHECK: i64 @pass_f64_C(i64 {{[^,]*}}) #[no_mangle] diff --git a/tests/codegen/aarch64-struct-align-128.rs b/tests/codegen/aarch64-struct-align-128.rs index 3fed19d96b122..ba1d19680f4e9 100644 --- a/tests/codegen/aarch64-struct-align-128.rs +++ b/tests/codegen/aarch64-struct-align-128.rs @@ -1,5 +1,6 @@ // Test that structs aligned to 128 bits are passed with the correct ABI on aarch64. +//@ add-core-stubs //@ revisions: linux darwin win //@[linux] compile-flags: --target aarch64-unknown-linux-gnu //@[darwin] compile-flags: --target aarch64-apple-darwin @@ -12,12 +13,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // Passed as `[i64 x 2]`, since it's an aggregate with size <= 128 bits, align < 128 bits. #[repr(C)] diff --git a/tests/codegen/abi-efiapi.rs b/tests/codegen/abi-efiapi.rs index 986d042268aa9..1736f0daf0fac 100644 --- a/tests/codegen/abi-efiapi.rs +++ b/tests/codegen/abi-efiapi.rs @@ -1,5 +1,6 @@ // Checks if the correct annotation for the efiapi ABI is passed to llvm. +//@ add-core-stubs //@ revisions:x86_64 i686 aarch64 arm riscv //@[x86_64] compile-flags: --target x86_64-unknown-uefi //@[x86_64] needs-llvm-components: aarch64 arm riscv @@ -17,12 +18,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; //x86_64: define win64cc void @has_efiapi //i686: define void @has_efiapi diff --git a/tests/codegen/abi-repr-ext.rs b/tests/codegen/abi-repr-ext.rs index b06d225ed70e6..1da28a94d9dd8 100644 --- a/tests/codegen/abi-repr-ext.rs +++ b/tests/codegen/abi-repr-ext.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 //@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv @@ -24,12 +25,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(i8)] pub enum Type { diff --git a/tests/codegen/abi-sysv64.rs b/tests/codegen/abi-sysv64.rs index ec555ee5f1d9c..7ade17f2baecb 100644 --- a/tests/codegen/abi-sysv64.rs +++ b/tests/codegen/abi-sysv64.rs @@ -2,6 +2,7 @@ // llvm. Also checks that the abi-sysv64 feature gate allows usage // of the sysv64 abi. // +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 @@ -9,11 +10,8 @@ #![no_core] #![feature(abi_x86_interrupt, no_core, lang_items)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for i64 {} +extern crate minicore; +use minicore::*; // CHECK: define x86_64_sysvcc i64 @has_sysv64_abi #[no_mangle] diff --git a/tests/codegen/abi-win64-zst.rs b/tests/codegen/abi-win64-zst.rs index 825a5c1b09c1f..e46f9666d42e4 100644 --- a/tests/codegen/abi-win64-zst.rs +++ b/tests/codegen/abi-win64-zst.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Z merge-functions=disabled //@ add-core-stubs diff --git a/tests/codegen/abi-x86-interrupt.rs b/tests/codegen/abi-x86-interrupt.rs index b8f3ebb99dd57..255ccba2c1110 100644 --- a/tests/codegen/abi-x86-interrupt.rs +++ b/tests/codegen/abi-x86-interrupt.rs @@ -2,6 +2,7 @@ // llvm. Also checks that the abi_x86_interrupt feature gate allows usage // of the x86-interrupt abi. +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: -C no-prepopulate-passes --target=x86_64-unknown-linux-gnu -Copt-level=0 @@ -9,11 +10,8 @@ #![no_core] #![feature(abi_x86_interrupt, no_core, lang_items)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for i64 {} +extern crate minicore; +use minicore::*; // CHECK: define x86_intrcc i64 @has_x86_interrupt_abi #[no_mangle] diff --git a/tests/codegen/avr/avr-func-addrspace.rs b/tests/codegen/avr/avr-func-addrspace.rs index 2ec7c86b5f43c..2ae2f40d7b349 100644 --- a/tests/codegen/avr/avr-func-addrspace.rs +++ b/tests/codegen/avr/avr-func-addrspace.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=avr-none -C target-cpu=atmega328p --crate-type=rlib -C panic=abort //@ needs-llvm-components: avr @@ -13,45 +14,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for *const T {} -#[lang = "legacy_receiver"] -pub trait LegacyReceiver {} -#[lang = "tuple_trait"] -pub trait Tuple {} - -pub struct Result { - _a: T, - _b: E, -} - -impl Copy for usize {} -impl Copy for &usize {} - -#[lang = "drop_in_place"] -pub unsafe fn drop_in_place(_: *mut T) {} - -#[lang = "fn_once"] -pub trait FnOnce { - #[lang = "fn_once_output"] - type Output; - - extern "rust-call" fn call_once(self, args: Args) -> Self::Output; -} - -#[lang = "fn_mut"] -pub trait FnMut: FnOnce { - extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; -} - -#[lang = "fn"] -pub trait Fn: FnOnce { - /// Performs the call operation. - extern "rust-call" fn call(&self, args: Args) -> Self::Output; -} +extern crate minicore; +use minicore::*; extern "rust-intrinsic" { pub fn transmute(src: Src) -> Dst; diff --git a/tests/codegen/branch-protection-old-llvm.rs b/tests/codegen/branch-protection-old-llvm.rs index 1846f35479db4..14b34ac501888 100644 --- a/tests/codegen/branch-protection-old-llvm.rs +++ b/tests/codegen/branch-protection-old-llvm.rs @@ -1,5 +1,6 @@ // Test that the correct module flags are emitted with different branch protection flags. +//@ add-core-stubs //@ revisions: BTI PACRET LEAF BKEY NONE //@ needs-llvm-components: aarch64 //@ [BTI] compile-flags: -Z branch-protection=bti @@ -13,8 +14,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // A basic test function. pub fn test() {} diff --git a/tests/codegen/branch-protection.rs b/tests/codegen/branch-protection.rs index 945bad0562568..ae14eae9ae0dd 100644 --- a/tests/codegen/branch-protection.rs +++ b/tests/codegen/branch-protection.rs @@ -1,5 +1,6 @@ // Test that the correct module flags are emitted with different branch protection flags. +//@ add-core-stubs //@ revisions: BTI PACRET LEAF BKEY PAUTHLR PAUTHLR_BKEY PAUTHLR_LEAF PAUTHLR_BTI NONE //@ needs-llvm-components: aarch64 //@ [BTI] compile-flags: -Z branch-protection=bti @@ -17,8 +18,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // A basic test function. // CHECK: @test(){{.*}} [[ATTR:#[0-9]+]] { diff --git a/tests/codegen/cast-target-abi.rs b/tests/codegen/cast-target-abi.rs index a0801eb982692..186198bc631eb 100644 --- a/tests/codegen/cast-target-abi.rs +++ b/tests/codegen/cast-target-abi.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions:aarch64 loongarch64 powerpc64 sparc64 x86_64 //@ min-llvm-version: 19 //@ compile-flags: -Copt-level=3 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error @@ -21,12 +22,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // This struct will be passed as a single `i64` or `i32`. // This may be (if `i64)) larger than the Rust layout, which is just `{ i16, i16 }`. diff --git a/tests/codegen/cf-protection.rs b/tests/codegen/cf-protection.rs index 244d1eb254422..f1349a5dcb980 100644 --- a/tests/codegen/cf-protection.rs +++ b/tests/codegen/cf-protection.rs @@ -1,5 +1,6 @@ // Test that the correct module flags are emitted with different control-flow protection flags. +//@ add-core-stubs //@ revisions: undefined none branch return full //@ needs-llvm-components: x86 //@ [undefined] compile-flags: @@ -13,8 +14,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // A basic test function. pub fn test() {} diff --git a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs index ae8d8383f5b91..404f6237849e6 100644 --- a/tests/codegen/cffi/ffi-out-of-bounds-loads.rs +++ b/tests/codegen/cffi/ffi-out-of-bounds-loads.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: linux apple //@ min-llvm-version: 19 //@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes -Zlint-llvm-ir -Cllvm-args=-lint-abort-on-error @@ -14,12 +15,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] struct S { diff --git a/tests/codegen/comparison-operators-2-struct.rs b/tests/codegen/comparison-operators-2-struct.rs new file mode 100644 index 0000000000000..e179066ebfd72 --- /dev/null +++ b/tests/codegen/comparison-operators-2-struct.rs @@ -0,0 +1,61 @@ +//@ compile-flags: -C opt-level=1 +//@ min-llvm-version: 20 + +// The `derive(PartialOrd)` for a 2-field type doesn't override `lt`/`le`/`gt`/`ge`. +// This double-checks that the `Option` intermediate values used +// in the operators for such a type all optimize away. + +#![crate_type = "lib"] + +use std::cmp::Ordering; + +#[derive(PartialOrd, PartialEq)] +pub struct Foo(i32, u32); + +// CHECK-LABEL: @check_lt( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_lt(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp slt i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp ult i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a < b +} + +// CHECK-LABEL: @check_le( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_le(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp sle i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp ule i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a <= b +} + +// CHECK-LABEL: @check_gt( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_gt(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp sgt i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp ugt i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a > b +} + +// CHECK-LABEL: @check_ge( +// CHECK-SAME: i32{{.+}}%[[A0:.+]], i32{{.+}}%[[A1:.+]], i32{{.+}}%[[B0:.+]], i32{{.+}}%[[B1:.+]]) +#[no_mangle] +pub fn check_ge(a: Foo, b: Foo) -> bool { + // CHECK-DAG: %[[EQ:.+]] = icmp eq i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R0:.+]] = icmp sge i32 %[[A0]], %[[B0]] + // CHECK-DAG: %[[R1:.+]] = icmp uge i32 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[R1]], i1 %[[R0]] + // CHECK-NEXT: ret i1 %[[R]] + a >= b +} diff --git a/tests/codegen/comparison-operators-2-tuple.rs b/tests/codegen/comparison-operators-2-tuple.rs index 8e2915e84eb77..91a99f9b91f96 100644 --- a/tests/codegen/comparison-operators-2-tuple.rs +++ b/tests/codegen/comparison-operators-2-tuple.rs @@ -1,5 +1,6 @@ //@ compile-flags: -C opt-level=1 -Z merge-functions=disabled //@ only-x86_64 +//@ min-llvm-version: 20 #![crate_type = "lib"] @@ -65,12 +66,7 @@ pub fn check_ge_direct(a: TwoTuple, b: TwoTuple) -> bool { } // -// These ones are harder, since there are more intermediate values to remove. -// -// `<` seems to be getting lucky right now, so test that doesn't regress. -// -// The others, however, aren't managing to optimize away the extra `select`s yet. -// See for more about this. +// These used to not optimize as well, but thanks to LLVM 20 they work now 🎉 // // CHECK-LABEL: @check_lt_via_cmp @@ -89,11 +85,11 @@ pub fn check_lt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) #[no_mangle] pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { - // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]] - // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] - // FIXME-CHECK: ret i1 %[[R]] + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] Ord::cmp(&a, &b).is_le() } @@ -101,11 +97,11 @@ pub fn check_le_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) #[no_mangle] pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { - // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]] - // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] - // FIXME-CHECK: ret i1 %[[R]] + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp ugt i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] Ord::cmp(&a, &b).is_gt() } @@ -113,10 +109,10 @@ pub fn check_gt_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]]) #[no_mangle] pub fn check_ge_via_cmp(a: TwoTuple, b: TwoTuple) -> bool { - // FIXME-CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]] - // FIXME-CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]] - // FIXME-CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] - // FIXME-CHECK: ret i1 %[[R]] + // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]] + // CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]] + // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]] + // CHECK: ret i1 %[[R]] Ord::cmp(&a, &b).is_ge() } diff --git a/tests/codegen/default-requires-uwtable.rs b/tests/codegen/default-requires-uwtable.rs index 3cb35cea022a5..54a6e171db66b 100644 --- a/tests/codegen/default-requires-uwtable.rs +++ b/tests/codegen/default-requires-uwtable.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: WINDOWS_ ANDROID_ //@ compile-flags: -C panic=abort -Copt-level=0 //@ [WINDOWS_] compile-flags: --target=x86_64-pc-windows-msvc @@ -9,8 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK: attributes #{{.*}} uwtable pub fn foo() {} diff --git a/tests/codegen/fastcall-inreg.rs b/tests/codegen/fastcall-inreg.rs index 00b390bf1bf17..066943d6e7eb7 100644 --- a/tests/codegen/fastcall-inreg.rs +++ b/tests/codegen/fastcall-inreg.rs @@ -2,6 +2,7 @@ // as "inreg" like the C/C++ compilers for the platforms. // x86 only. +//@ add-core-stubs //@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ needs-llvm-components: x86 @@ -9,10 +10,8 @@ #![no_core] #![feature(no_core, lang_items)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub mod tests { // CHECK: @f1(i32 inreg noundef %_1, i32 inreg noundef %_2, i32 noundef %_3) diff --git a/tests/codegen/fixed-x18.rs b/tests/codegen/fixed-x18.rs index 4997a39a7263d..a5767cfa456bf 100644 --- a/tests/codegen/fixed-x18.rs +++ b/tests/codegen/fixed-x18.rs @@ -1,6 +1,7 @@ // Test that the `reserve-x18` target feature is (not) emitted when // the `-Zfixed-x18` flag is (not) set. +//@ add-core-stubs //@ revisions: unset set //@ needs-llvm-components: aarch64 //@ compile-flags: --target aarch64-unknown-none @@ -10,8 +11,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/frame-pointer.rs b/tests/codegen/frame-pointer.rs index da81c2e9cd9aa..1f7c9a59c9887 100644 --- a/tests/codegen/frame-pointer.rs +++ b/tests/codegen/frame-pointer.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --crate-type=rlib -Copt-level=0 //@ revisions: aarch64-apple aarch64-linux force x64-apple x64-linux //@ [aarch64-apple] needs-llvm-components: aarch64 @@ -13,11 +14,9 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; // CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] { #[no_mangle] diff --git a/tests/codegen/function-return.rs b/tests/codegen/function-return.rs index 2b9de4e147852..4127f51603856 100644 --- a/tests/codegen/function-return.rs +++ b/tests/codegen/function-return.rs @@ -1,6 +1,7 @@ // Test that the `fn_ret_thunk_extern` function attribute is (not) emitted when // the `-Zfunction-return={keep,thunk-extern}` flag is (not) set. +//@ add-core-stubs //@ revisions: unset keep thunk-extern keep-thunk-extern thunk-extern-keep //@ needs-llvm-components: x86 //@ compile-flags: --target x86_64-unknown-linux-gnu @@ -13,8 +14,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/gpu-kernel-abi.rs b/tests/codegen/gpu-kernel-abi.rs index fba1793649433..8ac376d93381b 100644 --- a/tests/codegen/gpu-kernel-abi.rs +++ b/tests/codegen/gpu-kernel-abi.rs @@ -1,17 +1,14 @@ // Checks that the gpu-kernel calling convention correctly translates to LLVM calling conventions. +//@ add-core-stubs //@ revisions: nvptx //@ [nvptx] compile-flags: --crate-type=rlib --target=nvptx64-nvidia-cuda //@ [nvptx] needs-llvm-components: nvptx #![feature(no_core, lang_items, abi_gpu_kernel)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // nvptx: define ptx_kernel void @fun(i32 #[no_mangle] diff --git a/tests/codegen/intrinsics/nontemporal.rs b/tests/codegen/intrinsics/nontemporal.rs index af8892d30e7f4..1d4fae83c29dd 100644 --- a/tests/codegen/intrinsics/nontemporal.rs +++ b/tests/codegen/intrinsics/nontemporal.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 //@revisions: with_nontemporal without_nontemporal //@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu @@ -14,13 +15,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} - -impl Copy for u32 {} -impl Copy for *mut T {} +extern crate minicore; +use minicore::*; extern "rust-intrinsic" { pub fn nontemporal_store(ptr: *mut T, val: T); diff --git a/tests/codegen/issues/issue-84268.rs b/tests/codegen/issues/issue-84268.rs index 8a8ea9d1ccf8f..1dc55a909ad6b 100644 --- a/tests/codegen/issues/issue-84268.rs +++ b/tests/codegen/issues/issue-84268.rs @@ -1,10 +1,7 @@ //@ compile-flags: -Copt-level=3 --crate-type=rlib -#![feature(intrinsics, repr_simd)] +#![feature(core_intrinsics, repr_simd)] -extern "rust-intrinsic" { - fn simd_fabs(x: T) -> T; - fn simd_eq(x: T, y: T) -> U; -} +use std::intrinsics::simd::{simd_eq, simd_fabs}; #[repr(simd)] pub struct V([f32; 4]); diff --git a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs index b11bd657c18ec..93c8d60930b75 100644 --- a/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs +++ b/tests/codegen/loongarch-abi/loongarch64-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target loongarch64-unknown-linux-gnu //@ needs-llvm-components: loongarch @@ -6,12 +7,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) #[no_mangle] diff --git a/tests/codegen/macos/i686-macosx-deployment-target.rs b/tests/codegen/macos/i686-macosx-deployment-target.rs index 1f44bdfc6485e..cfa91e61cb00e 100644 --- a/tests/codegen/macos/i686-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/i686-no-macosx-deployment-target.rs b/tests/codegen/macos/i686-no-macosx-deployment-target.rs index a09773e0b9e26..25ec5f6acbb70 100644 --- a/tests/codegen/macos/i686-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/i686-no-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we leave the target alone MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=i686-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/x86_64-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-macosx-deployment-target.rs index bd8c027a9fb9d..8ea95ba0575e6 100644 --- a/tests/codegen/macos/x86_64-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we correctly modify the target when MACOSX_DEPLOYMENT_TARGET is set. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ rustc-env:MACOSX_DEPLOYMENT_TARGET=10.14 #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs index ff4a8fc46f984..474094957aeb1 100644 --- a/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs +++ b/tests/codegen/macos/x86_64-no-macosx-deployment-target.rs @@ -1,19 +1,15 @@ -// // Checks that we leave the target alone when MACOSX_DEPLOYMENT_TARGET is unset. // See issue #60235. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=x86_64-apple-darwin --crate-type=rlib //@ needs-llvm-components: x86 //@ unset-rustc-env:MACOSX_DEPLOYMENT_TARGET #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/naked-fn/instruction-set.rs b/tests/codegen/naked-fn/instruction-set.rs index 5b790b2034c09..a7b4c22a59bfd 100644 --- a/tests/codegen/naked-fn/instruction-set.rs +++ b/tests/codegen/naked-fn/instruction-set.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: arm-mode thumb-mode //@ [arm-mode] compile-flags: --target armv5te-none-eabi //@ [thumb-mode] compile-flags: --target thumbv5te-none-eabi @@ -8,15 +9,8 @@ #![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![no_core] -#[rustc_builtin_macro] -macro_rules! naked_asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // arm-mode: .arm // thumb-mode: .thumb diff --git a/tests/codegen/naked-fn/naked-functions.rs b/tests/codegen/naked-fn/naked-functions.rs index f505d27d48c62..6483e27c97a24 100644 --- a/tests/codegen/naked-fn/naked-functions.rs +++ b/tests/codegen/naked-fn/naked-functions.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: linux win macos thumb // //@[linux] compile-flags: --target x86_64-unknown-linux-gnu @@ -13,15 +14,8 @@ #![feature(no_core, lang_items, rustc_attrs, naked_functions)] #![no_core] -#[rustc_builtin_macro] -macro_rules! naked_asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // linux,win: .intel_syntax // diff --git a/tests/codegen/no-jump-tables.rs b/tests/codegen/no-jump-tables.rs index 654da2cec11cf..e49de7e9dc1e9 100644 --- a/tests/codegen/no-jump-tables.rs +++ b/tests/codegen/no-jump-tables.rs @@ -1,6 +1,7 @@ // Test that the `no-jump-tables` function attribute are (not) emitted when // the `-Zno-jump-tables` flag is (not) set. +//@ add-core-stubs //@ revisions: unset set //@ needs-llvm-components: x86 //@ compile-flags: --target x86_64-unknown-linux-gnu @@ -10,8 +11,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/pattern_type_symbols.rs b/tests/codegen/pattern_type_symbols.rs index b504a3508f94c..e86a9ef27de1b 100644 --- a/tests/codegen/pattern_type_symbols.rs +++ b/tests/codegen/pattern_type_symbols.rs @@ -16,7 +16,7 @@ pub fn bar() { // CHECK: call pattern_type_symbols::foo:: // CHECK: call void @_RINvC[[CRATE_IDENT:[a-zA-Z0-9]{12}]]_20pattern_type_symbols3foomEB2_ foo::(); - // CHECK: call pattern_type_symbols::foo::<(u32, [(); 0], [(); 999999999], [(); true])> - // CHECK: call void @_RINvC[[CRATE_IDENT]]_20pattern_type_symbols3fooTmAum0_Aum3b9ac9ff_Aub1_EEB2_ + // CHECK: call pattern_type_symbols::foo::<(u32, [(); 0], [(); 999999999])> + // CHECK: call void @_RINvC[[CRATE_IDENT]]_20pattern_type_symbols3fooTmAum0_Aum3b9ac9ff_EEB2_ foo::(); } diff --git a/tests/codegen/powerpc64le-struct-align-128.rs b/tests/codegen/powerpc64le-struct-align-128.rs index 3981cd1212961..c1c1ac2648548 100644 --- a/tests/codegen/powerpc64le-struct-align-128.rs +++ b/tests/codegen/powerpc64le-struct-align-128.rs @@ -1,6 +1,7 @@ // Test that structs aligned to 128 bits are passed with the correct ABI on powerpc64le. // This is similar to aarch64-struct-align-128.rs, but for ppc. +//@ add-core-stubs //@ compile-flags: --target powerpc64le-unknown-linux-gnu //@ needs-llvm-components: powerpc @@ -8,12 +9,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Align8 { diff --git a/tests/codegen/regparm-inreg.rs b/tests/codegen/regparm-inreg.rs index 82e157311287a..8dae3a83e4ed1 100644 --- a/tests/codegen/regparm-inreg.rs +++ b/tests/codegen/regparm-inreg.rs @@ -2,6 +2,7 @@ // marks function arguments as "inreg" like the C/C++ compilers for the platforms. // x86 only. +//@ add-core-stubs //@ compile-flags: --target i686-unknown-linux-gnu -Cno-prepopulate-passes -Copt-level=3 //@ needs-llvm-components: x86 @@ -14,10 +15,9 @@ #![crate_type = "lib"] #![no_core] #![feature(no_core, lang_items, repr_simd)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} + +extern crate minicore; +use minicore::*; pub mod tests { // regparm doesn't work for "fastcall" calling conv (only 2 inregs) diff --git a/tests/codegen/repr/transparent-byval-struct-ptr.rs b/tests/codegen/repr/transparent-byval-struct-ptr.rs index f9cfeb90390c9..0918884144fcd 100644 --- a/tests/codegen/repr/transparent-byval-struct-ptr.rs +++ b/tests/codegen/repr/transparent-byval-struct-ptr.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: i686-linux i686-freebsd x64-linux x64-apple //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -21,14 +22,9 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; -impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-imm-array.rs b/tests/codegen/repr/transparent-imm-array.rs index f790d093cf4a8..6dad04477845c 100644 --- a/tests/codegen/repr/transparent-imm-array.rs +++ b/tests/codegen/repr/transparent-imm-array.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: arm-linux arm-android armv7-linux armv7-android mips thumb sparc //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -27,14 +28,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} - -impl Copy for [u32; 16] {} +extern crate minicore; +use minicore::*; impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-mips64.rs b/tests/codegen/repr/transparent-mips64.rs index 7282654b8562d..98901350154e6 100644 --- a/tests/codegen/repr/transparent-mips64.rs +++ b/tests/codegen/repr/transparent-mips64.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: mips64 mips64el //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -13,14 +14,9 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; -impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-opaque-ptr.rs b/tests/codegen/repr/transparent-opaque-ptr.rs index 798b7e01bba5b..7911370c478c7 100644 --- a/tests/codegen/repr/transparent-opaque-ptr.rs +++ b/tests/codegen/repr/transparent-opaque-ptr.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64-linux aarch64-darwin wasm32-wasip1 //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -19,14 +20,9 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; -impl Copy for [u32; 16] {} impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-sparc64.rs b/tests/codegen/repr/transparent-sparc64.rs index 05c090bd67215..62bfc8a5fce28 100644 --- a/tests/codegen/repr/transparent-sparc64.rs +++ b/tests/codegen/repr/transparent-sparc64.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target sparc64-unknown-linux-gnu //@ needs-llvm-components: sparc @@ -8,14 +9,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} - -impl Copy for [u32; 16] {} +extern crate minicore; +use minicore::*; impl Copy for BigS {} impl Copy for BigU {} diff --git a/tests/codegen/repr/transparent-sysv64.rs b/tests/codegen/repr/transparent-sysv64.rs index 99c855db96200..3efc3f7c39114 100644 --- a/tests/codegen/repr/transparent-sysv64.rs +++ b/tests/codegen/repr/transparent-sysv64.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: linux apple win //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes @@ -13,12 +14,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Rgb8 { diff --git a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs index 46f747ad40750..df99f6969fc17 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64-lp64f-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target riscv64gc-unknown-linux-gnu -Copt-level=3 -C no-prepopulate-passes -C panic=abort //@ needs-llvm-components: riscv @@ -6,19 +7,8 @@ #![feature(no_core, lang_items)] #![allow(improper_ctypes)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for bool {} -impl Copy for i8 {} -impl Copy for u8 {} -impl Copy for i32 {} -impl Copy for i64 {} -impl Copy for u64 {} -impl Copy for f32 {} -impl Copy for f64 {} -impl Copy for *mut T {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_void() #[no_mangle] diff --git a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs index bef8fe0c04418..d768ab9381aad 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ needs-llvm-components: riscv @@ -6,12 +7,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_fpr_tracking(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, i8 noundef zeroext %i) #[no_mangle] diff --git a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs index 214370f424c25..361f03226904d 100644 --- a/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs +++ b/tests/codegen/riscv-abi/riscv64-lp64f-lp64d-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Copt-level=3 -C no-prepopulate-passes --target riscv64gc-unknown-linux-gnu //@ needs-llvm-components: riscv @@ -6,12 +7,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // CHECK: define void @f_fpr_tracking(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i8 noundef zeroext %i) #[no_mangle] diff --git a/tests/codegen/riscv-target-abi.rs b/tests/codegen/riscv-target-abi.rs index 88da4ece7ba31..d41fcb4dd845c 100644 --- a/tests/codegen/riscv-target-abi.rs +++ b/tests/codegen/riscv-target-abi.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions:riscv64gc riscv32gc riscv32imac //@[riscv64gc] compile-flags: --target=riscv64gc-unknown-linux-gnu @@ -16,5 +17,5 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; diff --git a/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs b/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs index e2e14ab14a801..e1d7dc2d631f0 100644 --- a/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs +++ b/tests/codegen/sanitizer/aarch64-shadow-call-stack-with-fixed-x18.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64 android //@[aarch64] compile-flags: --target aarch64-unknown-none -Zfixed-x18 -Zsanitizer=shadow-call-stack //@[aarch64] needs-llvm-components: aarch64 @@ -9,8 +10,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK: ; Function Attrs:{{.*}}shadowcallstack #[no_mangle] diff --git a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs index 56ee875286a22..774c9ab53f1e7 100644 --- a/tests/codegen/sanitizer/kasan-emits-instrumentation.rs +++ b/tests/codegen/sanitizer/kasan-emits-instrumentation.rs @@ -1,5 +1,6 @@ // Verifies that `-Zsanitizer=kernel-address` emits sanitizer instrumentation. +//@ add-core-stubs //@ compile-flags: -Zsanitizer=kernel-address -Copt-level=0 //@ revisions: aarch64 riscv64imac riscv64gc x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-none @@ -15,13 +16,8 @@ #![feature(no_core, no_sanitize, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -impl Copy for u8 {} +extern crate minicore; +use minicore::*; // CHECK-LABEL: ; kasan_emits_instrumentation::unsanitized // CHECK-NEXT: ; Function Attrs: diff --git a/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs b/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs index d48e4016a16ce..0be1ff1977492 100644 --- a/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs +++ b/tests/codegen/sanitizer/kcfi/add-cfi-normalize-integers-flag.rs @@ -1,5 +1,6 @@ // Verifies that "cfi-normalize-integers" module flag is added. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,10 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn foo() {} diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs index 013de74f8d689..eabe0409c9a33 100644 --- a/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs +++ b/tests/codegen/sanitizer/kcfi/add-kcfi-flag.rs @@ -1,5 +1,6 @@ // Verifies that "kcfi" module flag is added. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,10 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn foo() {} diff --git a/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs b/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs index b4924719f4c15..2f18c9d84b90f 100644 --- a/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs +++ b/tests/codegen/sanitizer/kcfi/add-kcfi-offset-flag.rs @@ -1,5 +1,6 @@ // Verifies that "kcfi-offset" module flag is added. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,10 +12,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; pub fn foo() {} diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs index ba2e397f6daa5..6b40918dd3af1 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-attr-no-sanitize.rs @@ -1,5 +1,6 @@ // Verifies that KCFI operand bundles are omitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, no_sanitize, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; #[no_sanitize(kcfi)] pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs index 4e95bdf4d7c41..942b50deb0284 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-generalized.rs @@ -1,5 +1,6 @@ // Verifies that generalized KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs index 31b43b5098806..c89d9bdd12176 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized-generalized.rs @@ -1,5 +1,6 @@ // Verifies that normalized and generalized KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs index 4755f6062aaab..220cae1a4fa37 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi-normalized.rs @@ -1,5 +1,6 @@ // Verifies that normalized KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs index be9760bd9afa4..bb9a000590302 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle-itanium-cxx-abi.rs @@ -1,5 +1,6 @@ // Verifies that KCFI type metadata for functions are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo diff --git a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs index c9c94cdb32926..8b844b991429b 100644 --- a/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs +++ b/tests/codegen/sanitizer/kcfi/emit-kcfi-operand-bundle.rs @@ -1,5 +1,6 @@ // Verifies that KCFI operand bundles are emitted. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,12 +12,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} +extern crate minicore; +use minicore::*; pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 { // CHECK-LABEL: define{{.*}}foo{{.*}}!{{|kcfi_type}} !{{[0-9]+}} diff --git a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs index 5ab55a467268b..15c107bea158b 100644 --- a/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs +++ b/tests/codegen/sanitizer/kcfi/emit-type-metadata-trait-objects.rs @@ -1,5 +1,6 @@ // Verifies that type metadata identifiers for trait objects are emitted correctly. // +//@ add-core-stubs //@ revisions: aarch64 x86_64 //@ [aarch64] compile-flags: --target aarch64-unknown-none //@ [aarch64] needs-llvm-components: aarch64 @@ -11,29 +12,8 @@ #![feature(arbitrary_self_types, no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for &T {} -#[lang = "legacy_receiver"] -trait LegacyReceiver {} -#[lang = "dispatch_from_dyn"] -trait DispatchFromDyn {} -impl<'a, T: ?Sized + Unsize, U: ?Sized> DispatchFromDyn<&'a U> for &'a T {} -#[lang = "unsize"] -trait Unsize {} -#[lang = "coerce_unsized"] -pub trait CoerceUnsized {} -impl<'a, 'b: 'a, T: ?Sized + Unsize, U: ?Sized> CoerceUnsized<&'a U> for &'b T {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "drop_in_place"] -fn drop_in_place_fn() {} -#[lang = "drop"] -trait Drop { - fn drop(&mut self); -} +extern crate minicore; +use minicore::*; pub trait Trait1 { fn foo(&self); diff --git a/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs b/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs index 5833b832ba403..945e46218d04a 100644 --- a/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs +++ b/tests/codegen/sanitizer/riscv64-shadow-call-stack.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target riscv64imac-unknown-none-elf -Zsanitizer=shadow-call-stack //@ needs-llvm-components: riscv @@ -6,8 +7,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // CHECK: ; Function Attrs:{{.*}}shadowcallstack // CHECK: define dso_local void @foo() unnamed_addr #0 diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs index 4a5a6391c052f..485ba92272dd2 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-abs.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fabs; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fabs(x: T) -> T; -} - // CHECK-LABEL: @fabs_32x2 #[no_mangle] pub unsafe fn fabs_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs index 89e54f579ff7c..e8bda7c29c4be 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-ceil.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_ceil; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_ceil(x: T) -> T; -} - // CHECK-LABEL: @ceil_32x2 #[no_mangle] pub unsafe fn ceil_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs index b40fd5365de57..8dc967bc3adc8 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-cos.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fcos; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fcos(x: T) -> T; -} - // CHECK-LABEL: @fcos_32x2 #[no_mangle] pub unsafe fn fcos_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs index fef003dde5bb8..00caca2f2949d 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fexp; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fexp(x: T) -> T; -} - // CHECK-LABEL: @exp_32x2 #[no_mangle] pub unsafe fn exp_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs index 779c0fc403a3d..eda4053189cbb 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-exp2.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fexp2; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fexp2(x: T) -> T; -} - // CHECK-LABEL: @exp2_32x2 #[no_mangle] pub unsafe fn exp2_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs index b2bd27a5b75c2..ad69d4cdd88cb 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-floor.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_floor; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_floor(x: T) -> T; -} - // CHECK-LABEL: @floor_32x2 #[no_mangle] pub unsafe fn floor_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs index 37f4782626add..cbeefdc31c0df 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fma.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fma; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fma(x: T, b: T, c: T) -> T; -} - // CHECK-LABEL: @fma_32x2 #[no_mangle] pub unsafe fn fma_32x2(a: f32x2, b: f32x2, c: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs index 336adf6db73f1..618daa4b44d09 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-fsqrt.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fsqrt; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fsqrt(x: T) -> T; -} - // CHECK-LABEL: @fsqrt_32x2 #[no_mangle] pub unsafe fn fsqrt_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs index 8e97abc3a6618..98a481e4004ee 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_flog; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_flog(x: T) -> T; -} - // CHECK-LABEL: @log_32x2 #[no_mangle] pub unsafe fn log_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs index 1d4d4dc24e9ad..9108cd963f027 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log10.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_flog10; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_flog10(x: T) -> T; -} - // CHECK-LABEL: @log10_32x2 #[no_mangle] pub unsafe fn log10_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs index 28f2f1516175c..2b20850dbd9a1 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-log2.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_flog2; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_flog2(x: T) -> T; -} - // CHECK-LABEL: @log2_32x2 #[no_mangle] pub unsafe fn log2_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs index 50c51bebe37ee..ce07b212e846d 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-minmax.rs @@ -1,19 +1,15 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_fmax, simd_fmin}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x4(pub [f32; 4]); -extern "rust-intrinsic" { - fn simd_fmin(x: T, y: T) -> T; - fn simd_fmax(x: T, y: T) -> T; -} - // CHECK-LABEL: @fmin #[no_mangle] pub unsafe fn fmin(a: f32x4, b: f32x4) -> f32x4 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs index 4173809e3a9b3..7de26b415bbbb 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-float-sin.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_fsin; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x2(pub [f32; 2]); @@ -21,10 +22,6 @@ pub struct f32x8(pub [f32; 8]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x16(pub [f32; 16]); -extern "rust-intrinsic" { - fn simd_fsin(x: T) -> T; -} - // CHECK-LABEL: @fsin_32x2 #[no_mangle] pub unsafe fn fsin_32x2(a: f32x2) -> f32x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs index a5afa27876a0f..ecf5eb24ee5b2 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs @@ -1,71 +1,71 @@ //@ compile-flags: -C no-prepopulate-passes -// #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] #![deny(unused)] -// signed integer types +use std::intrinsics::simd::{simd_saturating_add, simd_saturating_sub}; -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x2([i8; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x4([i8; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x8([i8; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x16([i8; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x32([i8; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i8x64([i8; 64]); +#[rustfmt::skip] +mod types { + // signed integer types -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x2([i16; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x4([i16; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x8([i16; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x16([i16; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i16x32([i16; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x2([i8; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x4([i8; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x8([i8; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x16([i8; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x32([i8; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i8x64([i8; 64]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x2([i32; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4([i32; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x8([i32; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i32x16([i32; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x2([i16; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x4([i16; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x8([i16; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x16([i16; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i16x32([i16; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i64x2([i64; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i64x4([i64; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i64x8([i64; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x2([i32; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4([i32; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x8([i32; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x16([i32; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i128x2([i128; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct i128x4([i128; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i64x2([i64; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i64x4([i64; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i64x8([i64; 8]); -// unsigned integer types + #[repr(simd)] #[derive(Copy, Clone)] pub struct i128x2([i128; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct i128x4([i128; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x2([u8; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x4([u8; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x8([u8; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x16([u8; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x32([u8; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u8x64([u8; 64]); + // unsigned integer types -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x2([u16; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x4([u16; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x8([u16; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x16([u16; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u16x32([u16; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x2([u8; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x4([u8; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x8([u8; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x16([u8; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x32([u8; 32]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u8x64([u8; 64]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x4([u32; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x8([u32; 8]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u32x16([u32; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x2([u16; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x4([u16; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x8([u16; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x16([u16; 16]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u16x32([u16; 32]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u64x2([u64; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u64x4([u64; 4]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u64x8([u64; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x4([u32; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x8([u32; 8]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x16([u32; 16]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u128x2([u128; 2]); -#[repr(simd)] #[derive(Copy, Clone)] pub struct u128x4([u128; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u64x2([u64; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u64x4([u64; 4]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u64x8([u64; 8]); -extern "rust-intrinsic" { - fn simd_saturating_add(x: T, y: T) -> T; - fn simd_saturating_sub(x: T, y: T) -> T; + #[repr(simd)] #[derive(Copy, Clone)] pub struct u128x2([u128; 2]); + #[repr(simd)] #[derive(Copy, Clone)] pub struct u128x4([u128; 4]); } +use types::*; + // NOTE(eddyb) `%{{x|0}}` is used because on some targets (e.g. WASM) // SIMD vectors are passed directly, resulting in `%x` being a vector, // while on others they're passed indirectly, resulting in `%x` being @@ -213,8 +213,6 @@ pub unsafe fn sadd_i128x4(x: i128x4, y: i128x4) -> i128x4 { simd_saturating_add(x, y) } - - // CHECK-LABEL: @uadd_u8x2 #[no_mangle] pub unsafe fn uadd_u8x2(x: u8x2, y: u8x2) -> u8x2 { @@ -355,10 +353,6 @@ pub unsafe fn uadd_u128x4(x: u128x4, y: u128x4) -> u128x4 { simd_saturating_add(x, y) } - - - - // CHECK-LABEL: @ssub_i8x2 #[no_mangle] pub unsafe fn ssub_i8x2(x: i8x2, y: i8x2) -> i8x2 { @@ -499,8 +493,6 @@ pub unsafe fn ssub_i128x4(x: i128x4, y: i128x4) -> i128x4 { simd_saturating_sub(x, y) } - - // CHECK-LABEL: @usub_u8x2 #[no_mangle] pub unsafe fn usub_u8x2(x: u8x2, y: u8x2) -> u8x2 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs index e9112f1f321b1..a2c40aa91b51f 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs @@ -2,10 +2,11 @@ // #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bitmask; + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); @@ -18,10 +19,6 @@ pub struct i32x2([i32; 2]); #[derive(Copy, Clone)] pub struct i8x16([i8; 16]); -extern "rust-intrinsic" { - fn simd_bitmask(x: T) -> U; -} - // NOTE(eddyb) `%{{x|1}}` is used because on some targets (e.g. WASM) // SIMD vectors are passed directly, resulting in `%x` being a vector, // while on others they're passed indirectly, resulting in `%x` being diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs index 7f99f695bf4f5..9bb46a3546bf7 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-gather.rs @@ -3,10 +3,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_gather; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2(pub [T; 2]); @@ -15,14 +16,13 @@ pub struct Vec2(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_gather(value: T, pointers: P, mask: M) -> T; -} - // CHECK-LABEL: @gather_f32x2 #[no_mangle] -pub unsafe fn gather_f32x2(pointers: Vec2<*const f32>, mask: Vec2, - values: Vec2) -> Vec2 { +pub unsafe fn gather_f32x2( + pointers: Vec2<*const f32>, + mask: Vec2, + values: Vec2, +) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call <2 x float> @llvm.masked.gather.v2f32.v2p0(<2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]], <2 x float> {{.*}}) @@ -31,8 +31,11 @@ pub unsafe fn gather_f32x2(pointers: Vec2<*const f32>, mask: Vec2, // CHECK-LABEL: @gather_pf32x2 #[no_mangle] -pub unsafe fn gather_pf32x2(pointers: Vec2<*const *const f32>, mask: Vec2, - values: Vec2<*const f32>) -> Vec2<*const f32> { +pub unsafe fn gather_pf32x2( + pointers: Vec2<*const *const f32>, + mask: Vec2, + values: Vec2<*const f32>, +) -> Vec2<*const f32> { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call <2 x ptr> @llvm.masked.gather.v2p0.v2p0(<2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]], <2 x ptr> {{.*}}) diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs index 7f46630e920d1..fcc4cb5d63000 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-load.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_masked_load; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2(pub [T; 2]); @@ -13,14 +14,9 @@ pub struct Vec2(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_masked_load(mask: M, pointer: P, values: T) -> T; -} - // CHECK-LABEL: @load_f32x2 #[no_mangle] -pub unsafe fn load_f32x2(mask: Vec2, pointer: *const f32, - values: Vec2) -> Vec2 { +pub unsafe fn load_f32x2(mask: Vec2, pointer: *const f32, values: Vec2) -> Vec2 { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call <2 x float> @llvm.masked.load.v2f32.p0(ptr {{.*}}, i32 4, <2 x i1> [[B]], <2 x float> {{.*}}) @@ -29,8 +25,11 @@ pub unsafe fn load_f32x2(mask: Vec2, pointer: *const f32, // CHECK-LABEL: @load_pf32x4 #[no_mangle] -pub unsafe fn load_pf32x4(mask: Vec4, pointer: *const *const f32, - values: Vec4<*const f32>) -> Vec4<*const f32> { +pub unsafe fn load_pf32x4( + mask: Vec4, + pointer: *const *const f32, + values: Vec4<*const f32>, +) -> Vec4<*const f32> { // CHECK: [[A:%[0-9]+]] = lshr <4 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <4 x i32> [[A]] to <4 x i1> // CHECK: call <4 x ptr> @llvm.masked.load.v4p0.p0(ptr {{.*}}, i32 {{.*}}, <4 x i1> [[B]], <4 x ptr> {{.*}}) diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs index 0d43234f1e294..04f4a0c63829b 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-masked-store.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_masked_store; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2(pub [T; 2]); @@ -13,10 +14,6 @@ pub struct Vec2(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_masked_store(mask: M, pointer: P, values: T) -> (); -} - // CHECK-LABEL: @store_f32x2 #[no_mangle] pub unsafe fn store_f32x2(mask: Vec2, pointer: *mut f32, values: Vec2) { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs index ef7827bd96f00..9506f8f6d3a86 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-scatter.rs @@ -3,10 +3,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_scatter; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec2(pub [T; 2]); @@ -15,25 +16,22 @@ pub struct Vec2(pub [T; 2]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct Vec4(pub [T; 4]); -extern "rust-intrinsic" { - fn simd_scatter(value: T, pointers: P, mask: M); -} - // CHECK-LABEL: @scatter_f32x2 #[no_mangle] -pub unsafe fn scatter_f32x2(pointers: Vec2<*mut f32>, mask: Vec2, - values: Vec2) { +pub unsafe fn scatter_f32x2(pointers: Vec2<*mut f32>, mask: Vec2, values: Vec2) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call void @llvm.masked.scatter.v2f32.v2p0(<2 x float> {{.*}}, <2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]] simd_scatter(values, pointers, mask) } - // CHECK-LABEL: @scatter_pf32x2 #[no_mangle] -pub unsafe fn scatter_pf32x2(pointers: Vec2<*mut *const f32>, mask: Vec2, - values: Vec2<*const f32>) { +pub unsafe fn scatter_pf32x2( + pointers: Vec2<*mut *const f32>, + mask: Vec2, + values: Vec2<*const f32>, +) { // CHECK: [[A:%[0-9]+]] = lshr <2 x i32> {{.*}}, {{|splat \(i32 31\)}} // CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1> // CHECK: call void @llvm.masked.scatter.v2p0.v2p0(<2 x ptr> {{.*}}, <2 x ptr> {{.*}}, i32 {{.*}}, <2 x i1> [[B]] diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs index 33ed2b437f9bb..71279d9f0eace 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-generic-select.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] - -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_select, simd_select_bitmask}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] pub struct f32x4(pub [f32; 4]); @@ -21,11 +22,6 @@ pub struct b8x4(pub [i8; 4]); #[derive(Copy, Clone, PartialEq, Debug)] pub struct i32x4([i32; 4]); -extern "rust-intrinsic" { - fn simd_select(x: T, a: U, b: U) -> U; - fn simd_select_bitmask(x: T, a: U, b: U) -> U; -} - // CHECK-LABEL: @select_m8 #[no_mangle] pub unsafe fn select_m8(m: b8x4, a: f32x4, b: f32x4) -> f32x4 { diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs index 92067db9b153f..269fe41225efa 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-mask-reduce.rs @@ -1,10 +1,11 @@ //@ compile-flags: -C no-prepopulate-passes -// #![crate_type = "lib"] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_reduce_all, simd_reduce_any}; + #[repr(simd)] #[derive(Copy, Clone)] pub struct mask32x2([i32; 2]); @@ -13,11 +14,6 @@ pub struct mask32x2([i32; 2]); #[derive(Copy, Clone)] pub struct mask8x16([i8; 16]); -extern "rust-intrinsic" { - fn simd_reduce_all(x: T) -> bool; - fn simd_reduce_any(x: T) -> bool; -} - // NOTE(eddyb) `%{{x|1}}` is used because on some targets (e.g. WASM) // SIMD vectors are passed directly, resulting in `%x` being a vector, // while on others they're passed indirectly, resulting in `%x` being diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs index 0d21d51055761..d3853361de9ed 100644 --- a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs +++ b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs @@ -12,7 +12,7 @@ #![crate_type = "lib"] #![allow(non_camel_case_types)] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone)] diff --git a/tests/codegen/simd/simd_arith_offset.rs b/tests/codegen/simd/simd_arith_offset.rs index e14fce1d41870..b8af6fce33267 100644 --- a/tests/codegen/simd/simd_arith_offset.rs +++ b/tests/codegen/simd/simd_arith_offset.rs @@ -3,11 +3,9 @@ // #![crate_type = "lib"] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -extern "rust-intrinsic" { - pub(crate) fn simd_arith_offset(ptrs: T, offsets: U) -> T; -} +use std::intrinsics::simd::simd_arith_offset; /// A vector of *const T. #[derive(Debug, Copy, Clone)] diff --git a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs index 10970cacdcf06..6ca6697588fd5 100644 --- a/tests/codegen/some-abis-do-extend-params-to-32-bits.rs +++ b/tests/codegen/some-abis-do-extend-params-to-32-bits.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: -Cno-prepopulate-passes -Copt-level=0 //@ revisions:x86_64 i686 aarch64-apple aarch64-windows aarch64-linux arm riscv @@ -24,12 +25,8 @@ #![no_std] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; // The patterns in this file are written in the style of a table to make the // uniformities and distinctions more apparent. diff --git a/tests/codegen/sparc-struct-abi.rs b/tests/codegen/sparc-struct-abi.rs index 0a8720c4fcae3..32d2c5bb0ef8f 100644 --- a/tests/codegen/sparc-struct-abi.rs +++ b/tests/codegen/sparc-struct-abi.rs @@ -1,17 +1,14 @@ // Checks that we correctly codegen extern "C" functions returning structs. // See issues #52638 and #86163. +//@ add-core-stubs //@ compile-flags: -Copt-level=3 --target=sparc64-unknown-linux-gnu --crate-type=rlib //@ needs-llvm-components: sparc #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "freeze"] -trait Freeze {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(C)] pub struct Bool { diff --git a/tests/codegen/stack-probes-inline.rs b/tests/codegen/stack-probes-inline.rs index c5073b9cc221e..746272b09941d 100644 --- a/tests/codegen/stack-probes-inline.rs +++ b/tests/codegen/stack-probes-inline.rs @@ -1,6 +1,7 @@ // Check the "probe-stack" attribute for targets with `StackProbeType::Inline`, // or `StackProbeType::InlineOrCall` when running on newer LLVM. +//@ add-core-stubs //@ compile-flags: -C no-prepopulate-passes //@ revisions: aarch64 powerpc powerpc64 powerpc64le s390x i686 x86_64 //@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu @@ -22,8 +23,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] pub fn foo() { diff --git a/tests/codegen/target-feature-overrides.rs b/tests/codegen/target-feature-overrides.rs index f38a1ae72de5d..0fc1e0136b3f3 100644 --- a/tests/codegen/target-feature-overrides.rs +++ b/tests/codegen/target-feature-overrides.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: COMPAT INCOMPAT //@ needs-llvm-components: x86 //@ compile-flags: --target=x86_64-unknown-linux-gnu -Copt-level=3 @@ -9,10 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; extern "C" { fn peach() -> u32; diff --git a/tests/codegen/tied-features-strength.rs b/tests/codegen/tied-features-strength.rs index 1b2b63c3d1ac4..8b1f3b14fc30a 100644 --- a/tests/codegen/tied-features-strength.rs +++ b/tests/codegen/tied-features-strength.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions: ENABLE_SVE DISABLE_SVE DISABLE_NEON ENABLE_NEON //@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 @@ -22,7 +23,7 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn test() {} diff --git a/tests/incremental/issue-61530.rs b/tests/incremental/issue-61530.rs index 71ac39d0e039e..673556a9d02f6 100644 --- a/tests/incremental/issue-61530.rs +++ b/tests/incremental/issue-61530.rs @@ -1,14 +1,12 @@ -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] //@ revisions:rpass1 rpass2 +use std::intrinsics::simd::simd_shuffle; + #[repr(simd)] struct I32x2([i32; 2]); -extern "rust-intrinsic" { - fn simd_shuffle(x: T, y: T, idx: I) -> U; -} - #[repr(simd)] struct SimdShuffleIdx([u32; LEN]); diff --git a/tests/mir-opt/issues/issue_75439.rs b/tests/mir-opt/issues/issue_75439.rs index ea763dd1b10d6..d7883f0dc71f8 100644 --- a/tests/mir-opt/issues/issue_75439.rs +++ b/tests/mir-opt/issues/issue_75439.rs @@ -1,10 +1,14 @@ -// skip-filecheck // EMIT_MIR issue_75439.foo.MatchBranchSimplification.diff //@ ignore-endian-big use std::mem::transmute; pub fn foo(bytes: [u8; 16]) -> Option<[u8; 4]> { + // CHECK-LABEL: fn foo( + // CHECK: bb2: { + // CHECK-NEXT: 0: [[bb:bb[0-9]+]], + // CHECK-SAME: {{[0-9]+}}: [[bb]], + // big endian `u32`s let dwords: [u32; 4] = unsafe { transmute(bytes) }; const FF: u32 = 0x0000_ffff_u32.to_be(); diff --git a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir index 5ff90de961506..cc01f51973c84 100644 --- a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir +++ b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir @@ -3,9 +3,9 @@ fn main() -> () { let mut _0: (); scope 1 { - debug x => const 2_u32 is 1..=; + debug x => const 2_u32 is 1..; scope 2 { - debug y => const {transmute(0x00000000): (u32) is 1..=}; + debug y => const {transmute(0x00000000): (u32) is 1..}; } } diff --git a/tests/mir-opt/pattern_types.rs b/tests/mir-opt/pattern_types.rs index 0369ccf9a9d56..d5847b95f7328 100644 --- a/tests/mir-opt/pattern_types.rs +++ b/tests/mir-opt/pattern_types.rs @@ -5,8 +5,8 @@ use std::pat::pattern_type; // EMIT_MIR pattern_types.main.PreCodegen.after.mir fn main() { - // CHECK: debug x => const 2_u32 is 1..= + // CHECK: debug x => const 2_u32 is 1.. let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) }; - // CHECK: debug y => const {transmute(0x00000000): (u32) is 1..=} + // CHECK: debug y => const {transmute(0x00000000): (u32) is 1..} let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; } diff --git a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs index 26ab1390a49ae..3ec2cf66fa30f 100644 --- a/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-macros/src/lib.rs @@ -1,8 +1,8 @@ // Scraped example should only include line numbers for items b and c in ex.rs -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '14' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '15' -// @has foobar/fn.f.html '//*[@class="src-line-numbers"]' '21' -// @!has foobar/fn.f.html '//*[@class="src-line-numbers"]' '22' +//@ !has foobar/fn.f.html '//span[@data-nosnippet]' '14' +//@ has foobar/fn.f.html '//span[@data-nosnippet]' '15' +//@ has foobar/fn.f.html '//span[@data-nosnippet]' '21' +//@ !has foobar/fn.f.html '//span[@data-nosnippet]' '22' pub fn f() {} diff --git a/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs index bdfeda92d79a0..25600915f5f93 100644 --- a/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-multiple/src/lib.rs @@ -1,6 +1,5 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//*[@class="prev"]' '' -// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' '' -// @has src/ex/ex.rs.html -// @has foobar/fn.ok.html '//a[@href="../src/ex/ex.rs.html#2"]' '' +//@ has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' '' +//@ has src/ex/ex.rs.html +//@ has foobar/fn.ok.html '//a[@href="../src/ex/ex.rs.html#2"]' '' pub fn ok() {} diff --git a/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs index c53c987a7cbf0..c957263c048f7 100644 --- a/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-ordering/src/lib.rs @@ -1,6 +1,6 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2' -// @has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1' -// @has foobar/fn.ok.html '//*[@class="highlight focus"]' 'ok' -// @has foobar/fn.ok.html '//*[@class="highlight"]' 'ok' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' 'ex2' +//@ has foobar/fn.ok.html '//*[@class="more-scraped-examples"]' 'ex1' +//@ has foobar/fn.ok.html '//*[@class="highlight focus"]' 'ok' +//@ has foobar/fn.ok.html '//*[@class="highlight"]' 'ok' pub fn ok(_x: i32) {} diff --git a/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs index f525a4270dde1..e1dc4f9150689 100644 --- a/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-remap/src/lib.rs @@ -1,5 +1,5 @@ -// @has foobar/b/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' -// @has foobar/c/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' +//@ has foobar/b/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' +//@ has foobar/c/fn.foo.html '//*[@class="scraped-example expanded"]' 'ex.rs' #[path = "a.rs"] pub mod b; diff --git a/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs index 22be1ad41010f..93d56b7e972f8 100644 --- a/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-test/src/lib.rs @@ -1,3 +1,3 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' '' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]' '' pub fn ok() {} diff --git a/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs b/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs index 28c34716c2f3b..8fc3a5e41d2ea 100644 --- a/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs +++ b/tests/run-make/rustdoc-scrape-examples-whitespace/src/lib.rs @@ -1,3 +1,3 @@ -// @has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//code' ' ' +//@ has foobar/fn.ok.html '//*[@class="docblock scraped-example-list"]//code' ' ' pub fn ok() {} diff --git a/tests/run-make/rustdoc-themes/foo.rs b/tests/run-make/rustdoc-themes/foo.rs index 8b1e75b0ae13b..555429b07df2a 100644 --- a/tests/run-make/rustdoc-themes/foo.rs +++ b/tests/run-make/rustdoc-themes/foo.rs @@ -1,4 +1,4 @@ -// @has test.css -// @has foo/struct.Foo.html -// @has - '//*[@name="rustdoc-vars"]/@data-themes' 'test' +//@ has test.css +//@ has foo/struct.Foo.html +//@ has - '//*[@name="rustdoc-vars"]/@data-themes' 'test' pub struct Foo; diff --git a/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs b/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs index 044bb6acb19b8..98753560d3a4a 100644 --- a/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-out-dir-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/rustdoc-with-output-option/src/lib.rs b/tests/run-make/rustdoc-with-output-option/src/lib.rs index 044bb6acb19b8..98753560d3a4a 100644 --- a/tests/run-make/rustdoc-with-output-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-output-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs b/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs index 044bb6acb19b8..98753560d3a4a 100644 --- a/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs +++ b/tests/run-make/rustdoc-with-short-out-dir-option/src/lib.rs @@ -1,2 +1,2 @@ -// @has foobar/fn.ok.html +//@ has foobar/fn.ok.html pub fn ok() {} diff --git a/tests/run-make/staticlib-broken-bitcode/rmake.rs b/tests/run-make/staticlib-broken-bitcode/rmake.rs new file mode 100644 index 0000000000000..17d17c1f0f5e8 --- /dev/null +++ b/tests/run-make/staticlib-broken-bitcode/rmake.rs @@ -0,0 +1,23 @@ +// Regression test for https://github.com/rust-lang/rust/issues/128955#issuecomment-2657811196 +// which checks that rustc can read an archive containing LLVM bitcode with a +// newer version from the one rustc links against. +use run_make_support::{llvm_ar, path, rfs, rustc, static_lib_name}; + +fn main() { + rfs::create_dir("archive"); + + let mut bitcode = b"BC\xC0\xDE".to_vec(); + bitcode.extend(std::iter::repeat(b'a').take(50)); + rfs::write("archive/invalid_bitcode.o", &bitcode); + + llvm_ar() + .arg("rcuS") // like obj_to_ar() except skips creating a symbol table + .output_input( + path("archive").join(static_lib_name("thin_archive")), + "archive/invalid_bitcode.o", + ) + .run(); + + // Build an rlib which includes the members of this thin archive + rustc().input("rust_lib.rs").library_search_path("archive").run(); +} diff --git a/tests/run-make/staticlib-broken-bitcode/rust_lib.rs b/tests/run-make/staticlib-broken-bitcode/rust_lib.rs new file mode 100644 index 0000000000000..c76b0f2543376 --- /dev/null +++ b/tests/run-make/staticlib-broken-bitcode/rust_lib.rs @@ -0,0 +1,6 @@ +#![crate_type = "rlib"] + +#[link(name = "thin_archive", kind = "static")] +extern "C" { + pub fn simple_fn(); +} diff --git a/tests/rustdoc-ui/unused-extern-crate.rs b/tests/rustdoc-ui/unused-extern-crate.rs deleted file mode 100644 index 240dd1f00e222..0000000000000 --- a/tests/rustdoc-ui/unused-extern-crate.rs +++ /dev/null @@ -1,3 +0,0 @@ -//@ check-pass -//@ aux-crate:panic_item=panic-item.rs -// @has unused_extern_crate/index.html diff --git a/tests/rustdoc-ui/auxiliary/panic-item.rs b/tests/rustdoc/auxiliary/panic-item.rs similarity index 100% rename from tests/rustdoc-ui/auxiliary/panic-item.rs rename to tests/rustdoc/auxiliary/panic-item.rs diff --git a/tests/rustdoc/unused-extern-crate.rs b/tests/rustdoc/unused-extern-crate.rs new file mode 100644 index 0000000000000..cdc00fd313afc --- /dev/null +++ b/tests/rustdoc/unused-extern-crate.rs @@ -0,0 +1,2 @@ +//@ aux-crate:panic_item=panic-item.rs +//@ has unused_extern_crate/index.html diff --git a/tests/ui/abi/arm-unadjusted-intrinsic.rs b/tests/ui/abi/arm-unadjusted-intrinsic.rs index 533cd40b30a5c..dcf0d9f39f673 100644 --- a/tests/ui/abi/arm-unadjusted-intrinsic.rs +++ b/tests/ui/abi/arm-unadjusted-intrinsic.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-pass //@ revisions: arm //@[arm] compile-flags: --target arm-unknown-linux-gnueabi @@ -14,19 +15,8 @@ #![crate_type = "lib"] #![allow(non_camel_case_types)] -/// To work cross-target this test must be no_core. -/// This little prelude supplies what we need. -#[lang = "sized"] -pub trait Sized {} - -#[lang = "copy"] -pub trait Copy: Sized {} -impl Copy for i8 {} -impl Copy for *const T {} -impl Copy for *mut T {} - -// I hate no_core tests! -impl Copy for [T; N] {} +extern crate minicore; +use minicore::*; // Regression test for https://github.com/rust-lang/rust/issues/118124. diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr index e1f433479857a..02620da3a21a3 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv32.stderr @@ -1,5 +1,5 @@ error[E0703]: invalid ABI: found `riscv-interrupt` - --> $DIR/riscv-discoverability-guidance.rs:17:8 + --> $DIR/riscv-discoverability-guidance.rs:15:8 | LL | extern "riscv-interrupt" fn isr() {} | ^^^^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | extern "riscv-interrupt" fn isr() {} = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:22:8 + --> $DIR/riscv-discoverability-guidance.rs:20:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr index e1f433479857a..02620da3a21a3 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr +++ b/tests/ui/abi/riscv-discoverability-guidance.riscv64.stderr @@ -1,5 +1,5 @@ error[E0703]: invalid ABI: found `riscv-interrupt` - --> $DIR/riscv-discoverability-guidance.rs:17:8 + --> $DIR/riscv-discoverability-guidance.rs:15:8 | LL | extern "riscv-interrupt" fn isr() {} | ^^^^^^^^^^^^^^^^^ @@ -10,7 +10,7 @@ LL | extern "riscv-interrupt" fn isr() {} = note: invoke `rustc --print=calling-conventions` for a full list of supported calling conventions error[E0703]: invalid ABI: found `riscv-interrupt-u` - --> $DIR/riscv-discoverability-guidance.rs:22:8 + --> $DIR/riscv-discoverability-guidance.rs:20:8 | LL | extern "riscv-interrupt-u" fn isr_U() {} | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/riscv-discoverability-guidance.rs b/tests/ui/abi/riscv-discoverability-guidance.rs index dec5059b0a7f0..41cce35aefada 100644 --- a/tests/ui/abi/riscv-discoverability-guidance.rs +++ b/tests/ui/abi/riscv-discoverability-guidance.rs @@ -1,4 +1,5 @@ // ignore-tidy-linelength +//@ add-core-stubs //@ revisions: riscv32 riscv64 // //@ [riscv32] needs-llvm-components: riscv @@ -6,13 +7,10 @@ //@ [riscv64] needs-llvm-components: riscv //@ [riscv64] compile-flags: --target=riscv64gc-unknown-none-elf -C target-feature=-unaligned-scalar-mem --crate-type=rlib #![no_core] -#![feature( - no_core, - lang_items, - abi_riscv_interrupt -)] -#[lang = "sized"] -trait Sized {} +#![feature(no_core, lang_items, abi_riscv_interrupt)] + +extern crate minicore; +use minicore::*; extern "riscv-interrupt" fn isr() {} //~^ ERROR invalid ABI diff --git a/tests/ui/abi/sparcv8plus-llvm19.rs b/tests/ui/abi/sparcv8plus-llvm19.rs index a884e5ca06f10..3d6d8568b6e5a 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.rs +++ b/tests/ui/abi/sparcv8plus-llvm19.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus //@[sparc] compile-flags: --target sparc-unknown-none-elf //@[sparc] needs-llvm-components: sparc @@ -15,10 +16,8 @@ #![feature(no_core, rustc_attrs, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[rustc_builtin_macro] macro_rules! compile_error { diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr index 7eedf26135f54..d3462ae87d338 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc.stderr @@ -1,5 +1,5 @@ error: -v8plus,-v9 - --> $DIR/sparcv8plus-llvm19.rs:29:1 + --> $DIR/sparcv8plus-llvm19.rs:28:1 | LL | compile_error!("-v8plus,-v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr index ac61df3567808..9891aec94b860 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus-llvm19.rs:34:1 + --> $DIR/sparcv8plus-llvm19.rs:33:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr index ac61df3567808..9891aec94b860 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus-llvm19.rs:34:1 + --> $DIR/sparcv8plus-llvm19.rs:33:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr index 1bf7a3ad76a83..dbcdb8ed121b3 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,-v9 (FIXME) - --> $DIR/sparcv8plus-llvm19.rs:39:1 + --> $DIR/sparcv8plus-llvm19.rs:38:1 | LL | compile_error!("+v8plus,-v9 (FIXME)"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr b/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr index ac61df3567808..9891aec94b860 100644 --- a/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr +++ b/tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus-llvm19.rs:34:1 + --> $DIR/sparcv8plus-llvm19.rs:33:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.rs b/tests/ui/abi/sparcv8plus.rs index a78ae0cd32889..6c17f72183862 100644 --- a/tests/ui/abi/sparcv8plus.rs +++ b/tests/ui/abi/sparcv8plus.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus //@[sparc] compile-flags: --target sparc-unknown-none-elf //@[sparc] needs-llvm-components: sparc @@ -15,10 +16,8 @@ #![feature(no_core, rustc_attrs, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[rustc_builtin_macro] macro_rules! compile_error { diff --git a/tests/ui/abi/sparcv8plus.sparc.stderr b/tests/ui/abi/sparcv8plus.sparc.stderr index 6d14ff53ab9cb..e2aa89a927317 100644 --- a/tests/ui/abi/sparcv8plus.sparc.stderr +++ b/tests/ui/abi/sparcv8plus.sparc.stderr @@ -1,5 +1,5 @@ error: -v8plus,-v9 - --> $DIR/sparcv8plus.rs:29:1 + --> $DIR/sparcv8plus.rs:28:1 | LL | compile_error!("-v8plus,-v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr b/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr index 00fd7ef4ea8fb..2c5699f2dec2b 100644 --- a/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr +++ b/tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr @@ -1,5 +1,5 @@ error: -v8plus,+v9 - --> $DIR/sparcv8plus.rs:42:1 + --> $DIR/sparcv8plus.rs:41:1 | LL | compile_error!("-v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr index a3c74e67f8f11..4b96e4421f9f9 100644 --- a/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus.sparc_cpu_v9_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus.rs:33:1 + --> $DIR/sparcv8plus.rs:32:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr b/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr index 84f560d158ca9..dfdec88961beb 100644 --- a/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr +++ b/tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,-v9 (FIXME) - --> $DIR/sparcv8plus.rs:38:1 + --> $DIR/sparcv8plus.rs:37:1 | LL | compile_error!("+v8plus,-v9 (FIXME)"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/sparcv8plus.sparcv8plus.stderr b/tests/ui/abi/sparcv8plus.sparcv8plus.stderr index a3c74e67f8f11..4b96e4421f9f9 100644 --- a/tests/ui/abi/sparcv8plus.sparcv8plus.stderr +++ b/tests/ui/abi/sparcv8plus.sparcv8plus.stderr @@ -1,5 +1,5 @@ error: +v8plus,+v9 - --> $DIR/sparcv8plus.rs:33:1 + --> $DIR/sparcv8plus.rs:32:1 | LL | compile_error!("+v8plus,+v9"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/abi/unsupported.aarch64.stderr b/tests/ui/abi/unsupported.aarch64.stderr index 2eb6ab08232e6..224d0e649017b 100644 --- a/tests/ui/abi/unsupported.aarch64.stderr +++ b/tests/ui/abi/unsupported.aarch64.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -114,13 +114,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -138,67 +138,67 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -206,3 +206,113 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 19 previous errors; 10 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:36:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:52:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:74:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:84:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:97:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:119:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:142:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:168:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:188:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:196:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.arm.stderr b/tests/ui/abi/unsupported.arm.stderr index ee878379cc646..c813b48ce3ab0 100644 --- a/tests/ui/abi/unsupported.arm.stderr +++ b/tests/ui/abi/unsupported.arm.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:36:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:74:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:84:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:97:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:119:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:142:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:168:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:188:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:196:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.i686.stderr b/tests/ui/abi/unsupported.i686.stderr index 02b2cdd356f7d..edc3d6489348f 100644 --- a/tests/ui/abi/unsupported.i686.stderr +++ b/tests/ui/abi/unsupported.i686.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -93,49 +93,49 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -143,3 +143,80 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 13 previous errors; 7 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:36:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:52:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:74:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:84:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:97:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:188:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:196:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.riscv32.stderr b/tests/ui/abi/unsupported.riscv32.stderr index abf403da8bd15..2b9e491ef2eae 100644 --- a/tests/ui/abi/unsupported.riscv32.stderr +++ b/tests/ui/abi/unsupported.riscv32.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:36:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:52:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:74:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:84:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:119:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:142:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:168:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:188:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:196:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.riscv64.stderr b/tests/ui/abi/unsupported.riscv64.stderr index abf403da8bd15..2b9e491ef2eae 100644 --- a/tests/ui/abi/unsupported.riscv64.stderr +++ b/tests/ui/abi/unsupported.riscv64.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "x86-interrupt" is not supported on this target - --> $DIR/unsupported.rs:119:15 + --> $DIR/unsupported.rs:118:15 | LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:130:1 + --> $DIR/unsupported.rs:129:1 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"x86-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:114:1 + --> $DIR/unsupported.rs:113:1 | LL | extern "x86-interrupt" fn x86() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:36:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:52:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:74:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:84:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "x86-interrupt" is not supported on this target + --> $DIR/unsupported.rs:119:15 + | +LL | fn x86_ptr(f: extern "x86-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:142:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:168:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:188:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:196:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/abi/unsupported.rs b/tests/ui/abi/unsupported.rs index 7d4142f0dee79..84646502f6fd6 100644 --- a/tests/ui/abi/unsupported.rs +++ b/tests/ui/abi/unsupported.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x64 i686 aarch64 arm riscv32 riscv64 // //@ [x64] needs-llvm-components: x86 @@ -25,11 +26,9 @@ abi_c_cmse_nonsecure_call, cmse_nonsecure_entry )] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; extern "ptx-kernel" fn ptx() {} //~^ ERROR is not a supported ABI diff --git a/tests/ui/abi/unsupported.x64.stderr b/tests/ui/abi/unsupported.x64.stderr index 824a33c948add..3146ccb80b1b1 100644 --- a/tests/ui/abi/unsupported.x64.stderr +++ b/tests/ui/abi/unsupported.x64.stderr @@ -1,5 +1,5 @@ warning: the calling convention "ptx-kernel" is not supported on this target - --> $DIR/unsupported.rs:36:15 + --> $DIR/unsupported.rs:35:15 | LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,13 +9,13 @@ LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:41:1 + --> $DIR/unsupported.rs:40:1 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "aapcs" is not supported on this target - --> $DIR/unsupported.rs:52:17 + --> $DIR/unsupported.rs:51:17 | LL | fn aapcs_ptr(f: extern "aapcs" fn()) { | ^^^^^^^^^^^^^^^^^^^ @@ -24,13 +24,13 @@ LL | fn aapcs_ptr(f: extern "aapcs" fn()) { = note: for more information, see issue #130260 error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:65:1 + --> $DIR/unsupported.rs:64:1 | LL | extern "aapcs" {} | ^^^^^^^^^^^^^^^^^ warning: the calling convention "msp430-interrupt" is not supported on this target - --> $DIR/unsupported.rs:74:18 + --> $DIR/unsupported.rs:73:18 | LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,13 +39,13 @@ LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:79:1 + --> $DIR/unsupported.rs:78:1 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "avr-interrupt" is not supported on this target - --> $DIR/unsupported.rs:84:15 + --> $DIR/unsupported.rs:83:15 | LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -54,13 +54,13 @@ LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { = note: for more information, see issue #130260 error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:89:1 + --> $DIR/unsupported.rs:88:1 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "riscv-interrupt-m" is not supported on this target - --> $DIR/unsupported.rs:97:17 + --> $DIR/unsupported.rs:96:17 | LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,13 +69,13 @@ LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { = note: for more information, see issue #130260 error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:108:1 + --> $DIR/unsupported.rs:107:1 | LL | extern "riscv-interrupt-m" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "thiscall" is not supported on this target - --> $DIR/unsupported.rs:142:20 + --> $DIR/unsupported.rs:141:20 | LL | fn thiscall_ptr(f: extern "thiscall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^ @@ -84,13 +84,13 @@ LL | fn thiscall_ptr(f: extern "thiscall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:155:1 + --> $DIR/unsupported.rs:154:1 | LL | extern "thiscall" {} | ^^^^^^^^^^^^^^^^^^^^ warning: the calling convention "stdcall" is not supported on this target - --> $DIR/unsupported.rs:168:19 + --> $DIR/unsupported.rs:167:19 | LL | fn stdcall_ptr(f: extern "stdcall" fn()) { | ^^^^^^^^^^^^^^^^^^^^^ @@ -99,13 +99,13 @@ LL | fn stdcall_ptr(f: extern "stdcall" fn()) { = note: for more information, see issue #130260 error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:181:1 + --> $DIR/unsupported.rs:180:1 | LL | extern "stdcall" {} | ^^^^^^^^^^^^^^^^^^^ warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target - --> $DIR/unsupported.rs:188:21 + --> $DIR/unsupported.rs:187:21 | LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -114,7 +114,7 @@ LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { = note: for more information, see issue #130260 warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target - --> $DIR/unsupported.rs:196:22 + --> $DIR/unsupported.rs:195:22 | LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -123,61 +123,61 @@ LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { = note: for more information, see issue #130260 error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:201:1 + --> $DIR/unsupported.rs:200:1 | LL | extern "C-cmse-nonsecure-entry" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"ptx-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:34:1 + --> $DIR/unsupported.rs:33:1 | LL | extern "ptx-kernel" fn ptx() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:43:1 + --> $DIR/unsupported.rs:42:1 | LL | extern "gpu-kernel" fn gpu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"aapcs"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:46:1 + --> $DIR/unsupported.rs:45:1 | LL | extern "aapcs" fn aapcs() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"msp430-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:72:1 + --> $DIR/unsupported.rs:71:1 | LL | extern "msp430-interrupt" fn msp430() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"avr-interrupt"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:82:1 + --> $DIR/unsupported.rs:81:1 | LL | extern "avr-interrupt" fn avr() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"riscv-interrupt-m"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:92:1 + --> $DIR/unsupported.rs:91:1 | LL | extern "riscv-interrupt-m" fn riscv() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"thiscall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:136:1 + --> $DIR/unsupported.rs:135:1 | LL | extern "thiscall" fn thiscall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"stdcall"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:162:1 + --> $DIR/unsupported.rs:161:1 | LL | extern "stdcall" fn stdcall() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/unsupported.rs:194:1 + --> $DIR/unsupported.rs:193:1 | LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -185,3 +185,102 @@ LL | extern "C-cmse-nonsecure-entry" fn cmse_entry() {} error: aborting due to 17 previous errors; 9 warnings emitted For more information about this error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "ptx-kernel" is not supported on this target + --> $DIR/unsupported.rs:36:15 + | +LL | fn ptx_ptr(f: extern "ptx-kernel" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "aapcs" is not supported on this target + --> $DIR/unsupported.rs:52:17 + | +LL | fn aapcs_ptr(f: extern "aapcs" fn()) { + | ^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "msp430-interrupt" is not supported on this target + --> $DIR/unsupported.rs:74:18 + | +LL | fn msp430_ptr(f: extern "msp430-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "avr-interrupt" is not supported on this target + --> $DIR/unsupported.rs:84:15 + | +LL | fn avr_ptr(f: extern "avr-interrupt" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "riscv-interrupt-m" is not supported on this target + --> $DIR/unsupported.rs:97:17 + | +LL | fn riscv_ptr(f: extern "riscv-interrupt-m" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "thiscall" is not supported on this target + --> $DIR/unsupported.rs:142:20 + | +LL | fn thiscall_ptr(f: extern "thiscall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "stdcall" is not supported on this target + --> $DIR/unsupported.rs:168:19 + | +LL | fn stdcall_ptr(f: extern "stdcall" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-call" is not supported on this target + --> $DIR/unsupported.rs:188:21 + | +LL | fn cmse_call_ptr(f: extern "C-cmse-nonsecure-call" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + +Future breakage diagnostic: +warning: the calling convention "C-cmse-nonsecure-entry" is not supported on this target + --> $DIR/unsupported.rs:196:22 + | +LL | fn cmse_entry_ptr(f: extern "C-cmse-nonsecure-entry" fn()) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs index 707bcac78bf92..2278604369311 100644 --- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs +++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs // Test that we do not ICE when the self type is `ty::err`, but rather // just propagate the error. @@ -6,17 +7,8 @@ #![feature(no_core)] #![no_core] -#[lang="sized"] -pub trait Sized { - // Empty. -} - -#[lang = "add"] -trait Add { - type Output; - - fn add(self, _: RHS) -> Self::Output; -} +extern crate minicore; +use minicore::*; fn ice(a: A) { let r = loop {}; diff --git a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr index ebe56c8cd6894..0bbb601a6d23a 100644 --- a/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr +++ b/tests/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr @@ -1,14 +1,8 @@ error[E0277]: the trait bound `(): Add` is not satisfied - --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:23:11 + --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:15:11 | LL | r = r + a; | ^ the trait `Add` is not implemented for `()` - | -help: this trait has no implementations, consider adding one - --> $DIR/associated-types-ICE-when-projecting-out-of-err.rs:15:1 - | -LL | trait Add { - | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/borrowck/issue-92157.rs b/tests/ui/borrowck/issue-92157.rs index a2b685cdf6ede..72f216e301dfc 100644 --- a/tests/ui/borrowck/issue-92157.rs +++ b/tests/ui/borrowck/issue-92157.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs #![feature(no_core)] #![feature(lang_items)] @@ -13,28 +14,7 @@ fn start(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { 40+2 } -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} - -#[lang = "drop_in_place"] -#[allow(unconditional_recursion)] -pub unsafe fn drop_in_place(to_drop: *mut T) { - drop_in_place(to_drop) -} - -#[lang = "add"] -trait Add { - type Output; - fn add(self, other: RHS) -> Self::Output; -} - -impl Add for isize { - type Output = isize; - fn add(self, other: isize) -> isize { - self + other - } -} +extern crate minicore; +use minicore::*; fn main() {} diff --git a/tests/ui/borrowck/issue-92157.stderr b/tests/ui/borrowck/issue-92157.stderr index 0ffedccd6906d..248d700ab4b9d 100644 --- a/tests/ui/borrowck/issue-92157.stderr +++ b/tests/ui/borrowck/issue-92157.stderr @@ -1,5 +1,5 @@ error[E0308]: lang item `start` function has wrong type - --> $DIR/issue-92157.rs:11:1 + --> $DIR/issue-92157.rs:12:1 | LL | fn start(_main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters diff --git a/tests/ui/c-variadic/variadic-ffi-1.rs b/tests/ui/c-variadic/variadic-ffi-1.rs index e41ab26921112..9dcd55d13e3c7 100644 --- a/tests/ui/c-variadic/variadic-ffi-1.rs +++ b/tests/ui/c-variadic/variadic-ffi-1.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "stdcall" { fn printf(_: *const u8, ...); diff --git a/tests/ui/c-variadic/variadic-ffi-1.stderr b/tests/ui/c-variadic/variadic-ffi-1.stderr index 39dfb2548a3bb..f99abed0a625f 100644 --- a/tests/ui/c-variadic/variadic-ffi-1.stderr +++ b/tests/ui/c-variadic/variadic-ffi-1.stderr @@ -1,17 +1,17 @@ error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` - --> $DIR/variadic-ffi-1.rs:9:5 + --> $DIR/variadic-ffi-1.rs:11:5 | LL | fn printf(_: *const u8, ...); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied - --> $DIR/variadic-ffi-1.rs:22:9 + --> $DIR/variadic-ffi-1.rs:24:9 | LL | foo(); | ^^^-- two arguments of type `isize` and `u8` are missing | note: function defined here - --> $DIR/variadic-ffi-1.rs:15:8 + --> $DIR/variadic-ffi-1.rs:17:8 | LL | fn foo(f: isize, x: u8, ...); | ^^^ - - @@ -21,13 +21,13 @@ LL | foo(/* isize */, /* u8 */); | +++++++++++++++++++++ error[E0060]: this function takes at least 2 arguments but 1 argument was supplied - --> $DIR/variadic-ffi-1.rs:23:9 + --> $DIR/variadic-ffi-1.rs:25:9 | LL | foo(1); | ^^^--- argument #2 of type `u8` is missing | note: function defined here - --> $DIR/variadic-ffi-1.rs:15:8 + --> $DIR/variadic-ffi-1.rs:17:8 | LL | fn foo(f: isize, x: u8, ...); | ^^^ - @@ -37,7 +37,7 @@ LL | foo(1, /* u8 */); | ++++++++++ error[E0308]: mismatched types - --> $DIR/variadic-ffi-1.rs:25:56 + --> $DIR/variadic-ffi-1.rs:27:56 | LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; | ------------------------------------- ^^^ expected non-variadic fn, found variadic function @@ -48,7 +48,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; found fn item `unsafe extern "C" fn(_, _, ...) {foo}` error[E0308]: mismatched types - --> $DIR/variadic-ffi-1.rs:26:54 + --> $DIR/variadic-ffi-1.rs:28:54 | LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; | ----------------------------------- ^^^ expected variadic fn, found non-variadic function @@ -59,7 +59,7 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; found fn item `extern "C" fn(_, _) {bar}` error[E0617]: can't pass `f32` to variadic function - --> $DIR/variadic-ffi-1.rs:28:19 + --> $DIR/variadic-ffi-1.rs:30:19 | LL | foo(1, 2, 3f32); | ^^^^ @@ -70,7 +70,7 @@ LL | foo(1, 2, 3f32 as c_double); | +++++++++++ error[E0617]: can't pass `bool` to variadic function - --> $DIR/variadic-ffi-1.rs:29:19 + --> $DIR/variadic-ffi-1.rs:31:19 | LL | foo(1, 2, true); | ^^^^ @@ -81,7 +81,7 @@ LL | foo(1, 2, true as c_int); | ++++++++ error[E0617]: can't pass `i8` to variadic function - --> $DIR/variadic-ffi-1.rs:30:19 + --> $DIR/variadic-ffi-1.rs:32:19 | LL | foo(1, 2, 1i8); | ^^^ @@ -92,7 +92,7 @@ LL | foo(1, 2, 1i8 as c_int); | ++++++++ error[E0617]: can't pass `u8` to variadic function - --> $DIR/variadic-ffi-1.rs:31:19 + --> $DIR/variadic-ffi-1.rs:33:19 | LL | foo(1, 2, 1u8); | ^^^ @@ -103,7 +103,7 @@ LL | foo(1, 2, 1u8 as c_uint); | +++++++++ error[E0617]: can't pass `i16` to variadic function - --> $DIR/variadic-ffi-1.rs:32:19 + --> $DIR/variadic-ffi-1.rs:34:19 | LL | foo(1, 2, 1i16); | ^^^^ @@ -114,7 +114,7 @@ LL | foo(1, 2, 1i16 as c_int); | ++++++++ error[E0617]: can't pass `u16` to variadic function - --> $DIR/variadic-ffi-1.rs:33:19 + --> $DIR/variadic-ffi-1.rs:35:19 | LL | foo(1, 2, 1u16); | ^^^^ diff --git a/tests/ui/c-variadic/variadic-ffi-2.rs b/tests/ui/c-variadic/variadic-ffi-2.rs index 99f83f22d17c0..da7bb76fc14bf 100644 --- a/tests/ui/c-variadic/variadic-ffi-2.rs +++ b/tests/ui/c-variadic/variadic-ffi-2.rs @@ -1,8 +1,6 @@ -//@ ignore-arm stdcall isn't supported #![feature(extended_varargs_abi_support)] -#[allow(unsupported_fn_ptr_calling_conventions)] -fn baz(f: extern "stdcall" fn(usize, ...)) { +fn baz(f: extern "Rust" fn(usize, ...)) { //~^ ERROR: C-variadic function must have a compatible calling convention, // like C, cdecl, system, aapcs, win64, sysv64 or efiapi f(22, 44); diff --git a/tests/ui/c-variadic/variadic-ffi-2.stderr b/tests/ui/c-variadic/variadic-ffi-2.stderr index e52de93a92646..9f8dcefdb0338 100644 --- a/tests/ui/c-variadic/variadic-ffi-2.stderr +++ b/tests/ui/c-variadic/variadic-ffi-2.stderr @@ -1,8 +1,8 @@ error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` - --> $DIR/variadic-ffi-2.rs:5:11 + --> $DIR/variadic-ffi-2.rs:3:11 | -LL | fn baz(f: extern "stdcall" fn(usize, ...)) { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention +LL | fn baz(f: extern "Rust" fn(usize, ...)) { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention error: aborting due to 1 previous error diff --git a/tests/ui/check-cfg/my-awesome-platform.json b/tests/ui/check-cfg/my-awesome-platform.json index 5e9ab8f1a2d00..03b08b727bd3a 100644 --- a/tests/ui/check-cfg/my-awesome-platform.json +++ b/tests/ui/check-cfg/my-awesome-platform.json @@ -1,6 +1,6 @@ { "llvm-target": "x86_64-unknown-none-gnu", - "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128", + "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128", "arch": "x86_64", "target-endian": "little", "target-pointer-width": "64", diff --git a/tests/ui/check-cfg/values-target-json.rs b/tests/ui/check-cfg/values-target-json.rs index b52decdf6c0c4..d473f39c3d6a5 100644 --- a/tests/ui/check-cfg/values-target-json.rs +++ b/tests/ui/check-cfg/values-target-json.rs @@ -1,5 +1,6 @@ // This test checks that we don't lint values defined by a custom target (target json) // +//@ add-core-stubs //@ check-pass //@ no-auto-check-cfg //@ needs-llvm-components: x86 @@ -8,8 +9,8 @@ #![feature(lang_items, no_core, auto_traits)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[cfg(target_os = "linux")] fn target_os_linux() {} diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs index 37c8319d98d0a..b25a81b858bef 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/callback-as-argument.rs @@ -1,13 +1,12 @@ +//@ add-core-stubs //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, cmse_nonsecure_entry, no_core, lang_items, intrinsics)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[no_mangle] pub extern "C-cmse-nonsecure-entry" fn test( diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr index 63260b5c78fdc..beb0ab70cc7e5 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/gate_test.stderr @@ -11,3 +11,13 @@ LL | core::mem::transmute:: $DIR/gate_test.rs:5:39 + | +LL | core::mem::transmute:: i32>( + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs index 31782b05105f6..18041b0806170 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C)] struct Wrapper(T); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr index 0560f0eec1c02..ab7c9cee4f03b 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/generics.stderr @@ -1,11 +1,11 @@ error: function pointer types may not have generic parameters - --> $DIR/generics.rs:15:42 + --> $DIR/generics.rs:14:42 | LL | f1: extern "C-cmse-nonsecure-call" fn(U, u32, u32, u32) -> u64, | ^^^^^^^^^ error[E0412]: cannot find type `U` in this scope - --> $DIR/generics.rs:15:52 + --> $DIR/generics.rs:14:52 | LL | struct Test { | - similarly named type parameter `T` defined here @@ -23,7 +23,7 @@ LL | struct Test { | +++ error[E0562]: `impl Trait` is not allowed in `fn` pointer parameters - --> $DIR/generics.rs:18:43 + --> $DIR/generics.rs:17:43 | LL | f2: extern "C-cmse-nonsecure-call" fn(impl Copy, u32, u32, u32) -> u64, | ^^^^^^^^^ @@ -31,19 +31,19 @@ LL | f2: extern "C-cmse-nonsecure-call" fn(impl Copy, u32, u32, u32) -> u64, = note: `impl Trait` is only allowed in arguments and return types of functions and methods error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type - --> $DIR/generics.rs:20:9 + --> $DIR/generics.rs:19:9 | LL | f3: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type - --> $DIR/generics.rs:21:9 + --> $DIR/generics.rs:20:9 | LL | f4: extern "C-cmse-nonsecure-call" fn(Wrapper, u32, u32, u32) -> u64, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/generics.rs:27:73 + --> $DIR/generics.rs:26:73 | LL | type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dyn Trait; | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -52,7 +52,7 @@ LL | type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dy = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/generics.rs:31:62 + --> $DIR/generics.rs:30:62 | LL | extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn Trait; | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -61,7 +61,7 @@ LL | extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn T = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/generics.rs:38:62 + --> $DIR/generics.rs:37:62 | LL | extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTransparent; | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -70,7 +70,7 @@ LL | extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTranspa = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0045]: C-variadic function must have a compatible calling convention, like `C`, `cdecl`, `system`, `aapcs`, `win64`, `sysv64` or `efiapi` - --> $DIR/generics.rs:41:20 + --> $DIR/generics.rs:40:20 | LL | type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs index 083a563bd7ba7..8328f9b6dd55c 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C, align(16))] #[allow(unused)] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr index a5f5e1c3151d8..10a5e85610752 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/params-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:17:63 + --> $DIR/params-via-stack.rs:16:63 | LL | f1: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32, x: u32, y: u32), | ^^^^^^^^^^^^^^ these arguments don't fit in the available registers @@ -7,7 +7,7 @@ LL | f1: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u32, x: u32, y: u3 = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:18:63 + --> $DIR/params-via-stack.rs:17:63 | LL | f2: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u16, u16), | ^^^ this argument doesn't fit in the available registers @@ -15,7 +15,7 @@ LL | f2: extern "C-cmse-nonsecure-call" fn(u32, u32, u32, u16, u16), = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:19:53 + --> $DIR/params-via-stack.rs:18:53 | LL | f3: extern "C-cmse-nonsecure-call" fn(u32, u64, u32), | ^^^ this argument doesn't fit in the available registers @@ -23,7 +23,7 @@ LL | f3: extern "C-cmse-nonsecure-call" fn(u32, u64, u32), = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:20:58 + --> $DIR/params-via-stack.rs:19:58 | LL | f4: extern "C-cmse-nonsecure-call" fn(AlignRelevant, u32), | ^^^ this argument doesn't fit in the available registers @@ -31,7 +31,7 @@ LL | f4: extern "C-cmse-nonsecure-call" fn(AlignRelevant, u32), = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/params-via-stack.rs:21:43 + --> $DIR/params-via-stack.rs:20:43 | LL | f5: extern "C-cmse-nonsecure-call" fn([u32; 5]), | ^^^^^^^^ this argument doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs index b052aabb499e7..890ec4b00f6a0 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm //@ add-core-stubs diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr index 89f7f159d6e4d..d2077352900a2 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/return-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:35:50 + --> $DIR/return-via-stack.rs:36:50 | LL | u128: extern "C-cmse-nonsecure-call" fn() -> u128, | ^^^^ this type doesn't fit in the available registers @@ -8,7 +8,7 @@ LL | u128: extern "C-cmse-nonsecure-call" fn() -> u128, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:36:50 + --> $DIR/return-via-stack.rs:37:50 | LL | i128: extern "C-cmse-nonsecure-call" fn() -> i128, | ^^^^ this type doesn't fit in the available registers @@ -17,7 +17,7 @@ LL | i128: extern "C-cmse-nonsecure-call" fn() -> i128, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:25:48 + --> $DIR/return-via-stack.rs:26:48 | LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprCU64, | ^^^^^^^^ this type doesn't fit in the available registers @@ -26,7 +26,7 @@ LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprCU64, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:26:48 + --> $DIR/return-via-stack.rs:27:48 | LL | f2: extern "C-cmse-nonsecure-call" fn() -> ReprCBytes, | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -35,7 +35,7 @@ LL | f2: extern "C-cmse-nonsecure-call" fn() -> ReprCBytes, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:27:48 + --> $DIR/return-via-stack.rs:28:48 | LL | f3: extern "C-cmse-nonsecure-call" fn() -> U64Compound, | ^^^^^^^^^^^ this type doesn't fit in the available registers @@ -44,7 +44,7 @@ LL | f3: extern "C-cmse-nonsecure-call" fn() -> U64Compound, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:28:48 + --> $DIR/return-via-stack.rs:29:48 | LL | f4: extern "C-cmse-nonsecure-call" fn() -> ReprCAlign16, | ^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -53,7 +53,7 @@ LL | f4: extern "C-cmse-nonsecure-call" fn() -> ReprCAlign16, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:29:48 + --> $DIR/return-via-stack.rs:30:48 | LL | f5: extern "C-cmse-nonsecure-call" fn() -> [u8; 5], | ^^^^^^^ this type doesn't fit in the available registers @@ -62,7 +62,7 @@ LL | f5: extern "C-cmse-nonsecure-call" fn() -> [u8; 5], = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:51:48 + --> $DIR/return-via-stack.rs:52:48 | LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprRustUnionU64, | ^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -71,7 +71,7 @@ LL | f1: extern "C-cmse-nonsecure-call" fn() -> ReprRustUnionU64, = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers - --> $DIR/return-via-stack.rs:52:48 + --> $DIR/return-via-stack.rs:53:48 | LL | f2: extern "C-cmse-nonsecure-call" fn() -> ReprCUnionU64, | ^^^^^^^^^^^^^ this type doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs index 9fda55c2a4807..7dfe6cf9672ab 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/via-registers.rs @@ -1,13 +1,12 @@ +//@ add-core-stubs //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, no_core, lang_items, intrinsics)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(transparent)] pub struct ReprTransparentStruct { diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs index 3265cf4146dc7..5a2d2db19c548 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.rs @@ -1,8 +1,10 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, lang_items, no_core)] #![no_core] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; pub extern "C-cmse-nonsecure-call" fn test() {} //~ ERROR [E0781] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr index 8d1b10eaeb5b6..f49fab043a47b 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-1.stderr @@ -1,5 +1,5 @@ error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers - --> $DIR/wrong-abi-location-1.rs:8:1 + --> $DIR/wrong-abi-location-1.rs:10:1 | LL | pub extern "C-cmse-nonsecure-call" fn test() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs index b47471c6ad7c7..e93b153949a3e 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(abi_c_cmse_nonsecure_call, lang_items, no_core)] #![no_core] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "C-cmse-nonsecure-call" { //~ ERROR [E0781] fn test(); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr index 917098e21d82c..bae8d20d81c5e 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-call/wrong-abi-location-2.stderr @@ -1,5 +1,5 @@ error[E0781]: the `"C-cmse-nonsecure-call"` ABI is only allowed on function pointers - --> $DIR/wrong-abi-location-2.rs:8:1 + --> $DIR/wrong-abi-location-2.rs:10:1 | LL | / extern "C-cmse-nonsecure-call" { LL | | fn test(); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs index a264bba6f3cdf..19b6179dde757 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(cmse_nonsecure_entry, c_variadic, no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C)] struct Wrapper(T); diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr index 9e67f881f75c6..c314671dc2970 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/generics.stderr @@ -1,11 +1,11 @@ error: only foreign, `unsafe extern "C"`, or `unsafe extern "C-unwind"` functions may have a C-variadic arg - --> $DIR/generics.rs:74:55 + --> $DIR/generics.rs:73:55 | LL | extern "C-cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) { | ^^^^^^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:31:1 + --> $DIR/generics.rs:30:1 | LL | / extern "C-cmse-nonsecure-entry" fn introduced_generic( LL | | @@ -17,19 +17,19 @@ LL | | ) -> u64 { | |________^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:41:1 + --> $DIR/generics.rs:40:1 | LL | extern "C-cmse-nonsecure-entry" fn impl_trait(_: impl Copy, _: u32, _: u32, _: u32) -> u64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:15:5 + --> $DIR/generics.rs:14:5 | LL | extern "C-cmse-nonsecure-entry" fn ambient_generic(_: T, _: u32, _: u32, _: u32) -> u64 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: functions with the `"C-cmse-nonsecure-entry"` ABI cannot contain generics in their type - --> $DIR/generics.rs:20:5 + --> $DIR/generics.rs:19:5 | LL | / extern "C-cmse-nonsecure-entry" fn ambient_generic_nested( LL | | @@ -41,7 +41,7 @@ LL | | ) -> u64 { | |____________^ error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/generics.rs:52:67 + --> $DIR/generics.rs:51:67 | LL | extern "C-cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trait { | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -50,7 +50,7 @@ LL | extern "C-cmse-nonsecure-entry" fn trait_object(x: &dyn Trait) -> &dyn Trai = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/generics.rs:59:6 + --> $DIR/generics.rs:58:6 | LL | ) -> &'static dyn Trait { | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -59,7 +59,7 @@ LL | ) -> &'static dyn Trait { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/generics.rs:69:6 + --> $DIR/generics.rs:68:6 | LL | ) -> WrapperTransparent { | ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -68,7 +68,7 @@ LL | ) -> WrapperTransparent { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error: requires `va_list` lang_item - --> $DIR/generics.rs:74:55 + --> $DIR/generics.rs:73:55 | LL | extern "C-cmse-nonsecure-entry" fn c_variadic(_: u32, _: ...) { | ^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs index 572d792d5a5d0..4c53f9422dab4 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.rs @@ -1,12 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(cmse_nonsecure_entry, no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} + +extern crate minicore; +use minicore::*; #[repr(C, align(16))] #[allow(unused)] diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr index b77e64c6bfba9..24e9ddf32feb9 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/params-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:16:78 + --> $DIR/params-via-stack.rs:15:78 | LL | pub extern "C-cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _: u32, _: u32) {} | ^^^^^^^^^^^ these arguments don't fit in the available registers @@ -7,7 +7,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f1(_: u32, _: u32, _: u32, _: u32, _ = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:18:78 + --> $DIR/params-via-stack.rs:17:78 | LL | pub extern "C-cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _: u16) {} | ^^^ this argument doesn't fit in the available registers @@ -15,7 +15,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f2(_: u32, _: u32, _: u32, _: u16, _ = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:20:62 + --> $DIR/params-via-stack.rs:19:62 | LL | pub extern "C-cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {} | ^^^ this argument doesn't fit in the available registers @@ -23,7 +23,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f3(_: u32, _: u64, _: u32) {} = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:22:64 + --> $DIR/params-via-stack.rs:21:64 | LL | pub extern "C-cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {} | ^^^ this argument doesn't fit in the available registers @@ -31,7 +31,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f4(_: AlignRelevant, _: u32) {} = note: functions with the `"C-cmse-nonsecure-entry"` ABI must pass all their arguments via the 4 32-bit available argument registers error[E0798]: arguments for `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/params-via-stack.rs:26:46 + --> $DIR/params-via-stack.rs:25:46 | LL | pub extern "C-cmse-nonsecure-entry" fn f5(_: [u32; 5]) {} | ^^^^^^^^ this argument doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs index 23d55526e5781..735eab10fa154 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm //@ add-core-stubs diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr index d37d9b5e8ff7d..9c885d9531814 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/return-via-stack.stderr @@ -1,5 +1,5 @@ error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:24:48 + --> $DIR/return-via-stack.rs:25:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 { | ^^^^^^^^ this type doesn't fit in the available registers @@ -8,7 +8,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f1() -> ReprCU64 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:29:48 + --> $DIR/return-via-stack.rs:30:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes { | ^^^^^^^^^^ this type doesn't fit in the available registers @@ -17,7 +17,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f2() -> ReprCBytes { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:34:48 + --> $DIR/return-via-stack.rs:35:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound { | ^^^^^^^^^^^ this type doesn't fit in the available registers @@ -26,7 +26,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f3() -> U64Compound { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:39:48 + --> $DIR/return-via-stack.rs:40:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 { | ^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -35,7 +35,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f4() -> ReprCAlign16 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:46:48 + --> $DIR/return-via-stack.rs:47:48 | LL | pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] { | ^^^^^^^ this type doesn't fit in the available registers @@ -44,7 +44,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn f5() -> [u8; 5] { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:52:50 + --> $DIR/return-via-stack.rs:53:50 | LL | pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 { | ^^^^ this type doesn't fit in the available registers @@ -53,7 +53,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn u128() -> u128 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:58:50 + --> $DIR/return-via-stack.rs:59:50 | LL | pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 { | ^^^^ this type doesn't fit in the available registers @@ -62,7 +62,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn i128() -> i128 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:75:56 + --> $DIR/return-via-stack.rs:76:56 | LL | pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 { | ^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers @@ -71,7 +71,7 @@ LL | pub extern "C-cmse-nonsecure-entry" fn union_rust() -> ReprRustUnionU64 { = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-entry"` function too large to pass via registers - --> $DIR/return-via-stack.rs:80:53 + --> $DIR/return-via-stack.rs:81:53 | LL | pub extern "C-cmse-nonsecure-entry" fn union_c() -> ReprCUnionU64 { | ^^^^^^^^^^^^^ this type doesn't fit in the available registers diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr index 26409279fbeb4..6a90dc8d635b1 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.aarch64.stderr @@ -1,5 +1,5 @@ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/trustzone-only.rs:20:1 + --> $DIR/trustzone-only.rs:17:1 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs index a4ea7a1757d2d..6d84dab2166ea 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86 aarch64 thumb7 // //@[x86] compile-flags: --target x86_64-unknown-linux-gnu @@ -9,12 +10,8 @@ #![feature(no_core, lang_items, rustc_attrs, cmse_nonsecure_entry)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for u32 {} +extern crate minicore; +use minicore::*; #[no_mangle] pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr index 26409279fbeb4..6a90dc8d635b1 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.thumb7.stderr @@ -1,5 +1,5 @@ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/trustzone-only.rs:20:1 + --> $DIR/trustzone-only.rs:17:1 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr index 26409279fbeb4..6a90dc8d635b1 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/trustzone-only.x86.stderr @@ -1,5 +1,5 @@ error[E0570]: `"C-cmse-nonsecure-entry"` is not a supported ABI for the current target - --> $DIR/trustzone-only.rs:20:1 + --> $DIR/trustzone-only.rs:17:1 | LL | pub extern "C-cmse-nonsecure-entry" fn entry_function(input: u32) -> u32 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs index 8978b35d356f7..912fc8b85ebd2 100644 --- a/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs +++ b/tests/ui/cmse-nonsecure/cmse-nonsecure-entry/via-registers.rs @@ -1,15 +1,13 @@ +//@ add-core-stubs //@ build-pass //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib //@ needs-llvm-components: arm #![feature(cmse_nonsecure_entry, no_core, lang_items)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for u32 {} -impl Copy for u8 {} + +extern crate minicore; +use minicore::*; #[repr(transparent)] pub struct ReprTransparentStruct { diff --git a/tests/ui/consts/const-eval/simd/insert_extract.rs b/tests/ui/consts/const-eval/simd/insert_extract.rs index e5873ea26e8d8..fc97f9ec14181 100644 --- a/tests/ui/consts/const-eval/simd/insert_extract.rs +++ b/tests/ui/consts/const-eval/simd/insert_extract.rs @@ -1,28 +1,19 @@ //@ run-pass #![feature(repr_simd)] -#![feature(intrinsics, rustc_attrs)] +#![feature(intrinsics, core_intrinsics, rustc_attrs)] #![feature(staged_api)] #![stable(feature = "foo", since = "1.3.37")] #![allow(non_camel_case_types)] -// repr(simd) now only supports array types -#[repr(simd)] struct i8x1([i8; 1]); -#[repr(simd)] struct u16x2([u16; 2]); -#[repr(simd)] struct f32x4([f32; 4]); - -#[stable(feature = "foo", since = "1.3.37")] -#[rustc_const_stable(feature = "foo", since = "1.3.37")] -#[rustc_intrinsic] -const unsafe fn simd_insert(_x: T, _idx: u32, _val: U) -> T { - unimplemented!() -} +use std::intrinsics::simd::{simd_extract, simd_insert}; -#[stable(feature = "foo", since = "1.3.37")] -#[rustc_const_stable(feature = "foo", since = "1.3.37")] -#[rustc_intrinsic] -const unsafe fn simd_extract(_x: T, _idx: u32) -> U { - unimplemented!() -} +// repr(simd) now only supports array types +#[repr(simd)] +struct i8x1([i8; 1]); +#[repr(simd)] +struct u16x2([u16; 2]); +#[repr(simd)] +struct f32x4([f32; 4]); fn main() { { diff --git a/tests/ui/deriving/deriving-with-helper.rs b/tests/ui/deriving/deriving-with-helper.rs index c71d553c8927b..df98bb6beb9fa 100644 --- a/tests/ui/deriving/deriving-with-helper.rs +++ b/tests/ui/deriving/deriving-with-helper.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ check-pass //@ compile-flags: --crate-type=lib @@ -8,6 +9,9 @@ #![no_core] +extern crate minicore; +use minicore::*; + #[rustc_builtin_macro] macro derive() {} @@ -26,9 +30,6 @@ mod default { } } -#[lang = "sized"] -trait Sized {} - #[derive(Default)] enum S { #[default] // OK diff --git a/tests/ui/error-codes/E0511.rs b/tests/ui/error-codes/E0511.rs index 81656c710882d..c7e59c5c6c96f 100644 --- a/tests/ui/error-codes/E0511.rs +++ b/tests/ui/error-codes/E0511.rs @@ -1,11 +1,11 @@ //@ build-fail -#![feature(intrinsics)] +#![feature(core_intrinsics)] -extern "rust-intrinsic" { - fn simd_add(a: T, b: T) -> T; -} +use std::intrinsics::simd::simd_add; fn main() { - unsafe { simd_add(0, 1); } //~ ERROR E0511 + unsafe { + simd_add(0, 1) //~ ERROR E0511 + }; } diff --git a/tests/ui/error-codes/E0511.stderr b/tests/ui/error-codes/E0511.stderr index 59eb19d2ee526..45f5b8d238dac 100644 --- a/tests/ui/error-codes/E0511.stderr +++ b/tests/ui/error-codes/E0511.stderr @@ -1,8 +1,8 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/E0511.rs:10:14 + --> $DIR/E0511.rs:9:9 | -LL | unsafe { simd_add(0, 1); } - | ^^^^^^^^^^^^^^ +LL | simd_add(0, 1) + | ^^^^^^^^^^^^^^ error: aborting due to 1 previous error diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs index ce3d3fc645d76..6901a2ab9f18a 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: avr //@ compile-flags: --target=avr-none -C target-cpu=atmega328p --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; // Test that the AVR interrupt ABI cannot be used when avr_interrupt // feature gate is not used. diff --git a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr index d9f3c3adc7f04..768209eec632c 100644 --- a/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-avr-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:11:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:13:8 | LL | extern "avr-non-blocking-interrupt" fn fu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "avr-non-blocking-interrupt" fn fu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:13:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:15:8 | LL | extern "avr-interrupt" fn f() {} | ^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "avr-interrupt" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:17:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:19:12 | LL | extern "avr-interrupt" fn m(); | ^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "avr-interrupt" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:19:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:21:12 | LL | extern "avr-non-blocking-interrupt" fn mu(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:22:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:24:12 | LL | extern "avr-interrupt" fn dm() {} | ^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "avr-interrupt" fn dm() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:24:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:26:12 | LL | extern "avr-non-blocking-interrupt" fn dmu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | extern "avr-non-blocking-interrupt" fn dmu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:30:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:32:12 | LL | extern "avr-interrupt" fn m() {} | ^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | extern "avr-interrupt" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:32:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:34:12 | LL | extern "avr-non-blocking-interrupt" fn mu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | extern "avr-non-blocking-interrupt" fn mu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:37:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:39:12 | LL | extern "avr-interrupt" fn im() {} | ^^^^^^^^^^^^^^^ @@ -89,7 +89,7 @@ LL | extern "avr-interrupt" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:39:12 + --> $DIR/feature-gate-abi-avr-interrupt.rs:41:12 | LL | extern "avr-non-blocking-interrupt" fn imu() {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -99,7 +99,7 @@ LL | extern "avr-non-blocking-interrupt" fn imu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:43:18 + --> $DIR/feature-gate-abi-avr-interrupt.rs:45:18 | LL | type TA = extern "avr-interrupt" fn(); | ^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | type TA = extern "avr-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:45:19 + --> $DIR/feature-gate-abi-avr-interrupt.rs:47:19 | LL | type TAU = extern "avr-non-blocking-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ LL | type TAU = extern "avr-non-blocking-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:48:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:50:8 | LL | extern "avr-interrupt" {} | ^^^^^^^^^^^^^^^ @@ -129,7 +129,7 @@ LL | extern "avr-interrupt" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "avr-non-blocking-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-avr-interrupt.rs:50:8 + --> $DIR/feature-gate-abi-avr-interrupt.rs:52:8 | LL | extern "avr-non-blocking-interrupt" {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs index bb69a638ceeab..60bf69f597cc8 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: msp430 //@ compile-flags: --target=msp430-none-elf --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "msp430-interrupt" fn f() {} //~^ ERROR "msp430-interrupt" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr index 21ddbf7a86df8..4a995b4efa6fc 100644 --- a/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:8:8 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:10:8 | LL | extern "msp430-interrupt" fn f() {} | ^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "msp430-interrupt" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:12:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:14:12 | LL | extern "msp430-interrupt" fn m(); | ^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "msp430-interrupt" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:15:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:17:12 | LL | extern "msp430-interrupt" fn dm() {} | ^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "msp430-interrupt" fn dm() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:21:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:23:12 | LL | extern "msp430-interrupt" fn m() {} | ^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "msp430-interrupt" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:26:12 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:28:12 | LL | extern "msp430-interrupt" fn im() {} | ^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "msp430-interrupt" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:30:18 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:32:18 | LL | type TA = extern "msp430-interrupt" fn(); | ^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type TA = extern "msp430-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "msp430-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-msp430-interrupt.rs:33:8 + --> $DIR/feature-gate-abi-msp430-interrupt.rs:35:8 | LL | extern "msp430-interrupt" {} | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs index 6f4989fbd9fe9..006d01c55896f 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: riscv //@ compile-flags: --target=riscv32imc-unknown-none-elf --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang = "sized"] -trait Sized {} + +extern crate minicore; +use minicore::*; // Test that the riscv interrupt ABIs cannot be used when riscv_interrupt // feature gate is not used. diff --git a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr index 3c9e99aa1b9b3..af956c35da6df 100644 --- a/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-riscv-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:11:8 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8 | LL | extern "riscv-interrupt-m" fn f() {} | ^^^^^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "riscv-interrupt-m" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-s" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:13:8 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:15:8 | LL | extern "riscv-interrupt-s" fn f_s() {} | ^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "riscv-interrupt-s" fn f_s() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:17:12 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:19:12 | LL | extern "riscv-interrupt-m" fn m(); | ^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "riscv-interrupt-m" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:23:12 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:25:12 | LL | extern "riscv-interrupt-m" fn m() {} | ^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "riscv-interrupt-m" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:28:12 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:30:12 | LL | extern "riscv-interrupt-m" fn im() {} | ^^^^^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "riscv-interrupt-m" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "riscv-interrupt-m" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-riscv-interrupt.rs:32:18 + --> $DIR/feature-gate-abi-riscv-interrupt.rs:34:18 | LL | type TA = extern "riscv-interrupt-m" fn(); | ^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs index 93c59364f10ba..c4fdb5f427ca5 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: --target=x86_64-unknown-linux-gnu --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "x86-interrupt" fn f7() {} //~ ERROR "x86-interrupt" ABI is experimental trait Tr { diff --git a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr index 231cf207c862d..67211d402c6c9 100644 --- a/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr +++ b/tests/ui/feature-gates/feature-gate-abi-x86-interrupt.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:8:8 + --> $DIR/feature-gate-abi-x86-interrupt.rs:10:8 | LL | extern "x86-interrupt" fn f7() {} | ^^^^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "x86-interrupt" fn f7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:10:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:12:12 | LL | extern "x86-interrupt" fn m7(); | ^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "x86-interrupt" fn m7(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:11:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:13:12 | LL | extern "x86-interrupt" fn dm7() {} | ^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "x86-interrupt" fn dm7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:18:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:20:12 | LL | extern "x86-interrupt" fn m7() {} | ^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "x86-interrupt" fn m7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:23:12 + --> $DIR/feature-gate-abi-x86-interrupt.rs:25:12 | LL | extern "x86-interrupt" fn im7() {} | ^^^^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "x86-interrupt" fn im7() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:26:18 + --> $DIR/feature-gate-abi-x86-interrupt.rs:28:18 | LL | type A7 = extern "x86-interrupt" fn(); | ^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type A7 = extern "x86-interrupt" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "x86-interrupt" ABI is experimental and subject to change - --> $DIR/feature-gate-abi-x86-interrupt.rs:28:8 + --> $DIR/feature-gate-abi-x86-interrupt.rs:30:8 | LL | extern "x86-interrupt" {} | ^^^^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-abi.rs b/tests/ui/feature-gates/feature-gate-abi.rs index 7ab05889c20a7..2af623734ee87 100644 --- a/tests/ui/feature-gates/feature-gate-abi.rs +++ b/tests/ui/feature-gates/feature-gate-abi.rs @@ -1,14 +1,12 @@ // gate-test-intrinsics +//@ add-core-stubs //@ compile-flags: --crate-type=rlib #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } - -#[lang="tuple_trait"] -trait Tuple { } +extern crate minicore; +use minicore::*; // Functions extern "rust-intrinsic" fn f1() {} //~ ERROR extern "rust-intrinsic" ABI is an implementation detail diff --git a/tests/ui/feature-gates/feature-gate-abi.stderr b/tests/ui/feature-gates/feature-gate-abi.stderr index 70ec64e5135e5..a974c0099cbde 100644 --- a/tests/ui/feature-gates/feature-gate-abi.stderr +++ b/tests/ui/feature-gates/feature-gate-abi.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:14:8 + --> $DIR/feature-gate-abi.rs:12:8 | LL | extern "rust-intrinsic" fn f1() {} | ^^^^^^^^^^^^^^^^ @@ -8,7 +8,7 @@ LL | extern "rust-intrinsic" fn f1() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:16:8 + --> $DIR/feature-gate-abi.rs:14:8 | LL | extern "rust-intrinsic" fn f2() {} | ^^^^^^^^^^^^^^^^ @@ -17,7 +17,7 @@ LL | extern "rust-intrinsic" fn f2() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:18:8 + --> $DIR/feature-gate-abi.rs:16:8 | LL | extern "rust-call" fn f4(_: ()) {} | ^^^^^^^^^^^ @@ -27,7 +27,7 @@ LL | extern "rust-call" fn f4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:22:12 + --> $DIR/feature-gate-abi.rs:20:12 | LL | extern "rust-intrinsic" fn m1(); | ^^^^^^^^^^^^^^^^ @@ -36,7 +36,7 @@ LL | extern "rust-intrinsic" fn m1(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:24:12 + --> $DIR/feature-gate-abi.rs:22:12 | LL | extern "rust-intrinsic" fn m2(); | ^^^^^^^^^^^^^^^^ @@ -45,7 +45,7 @@ LL | extern "rust-intrinsic" fn m2(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:26:12 + --> $DIR/feature-gate-abi.rs:24:12 | LL | extern "rust-call" fn m4(_: ()); | ^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | extern "rust-call" fn m4(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:28:12 + --> $DIR/feature-gate-abi.rs:26:12 | LL | extern "rust-call" fn dm4(_: ()) {} | ^^^^^^^^^^^ @@ -65,7 +65,7 @@ LL | extern "rust-call" fn dm4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:35:12 + --> $DIR/feature-gate-abi.rs:33:12 | LL | extern "rust-intrinsic" fn m1() {} | ^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL | extern "rust-intrinsic" fn m1() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:37:12 + --> $DIR/feature-gate-abi.rs:35:12 | LL | extern "rust-intrinsic" fn m2() {} | ^^^^^^^^^^^^^^^^ @@ -83,7 +83,7 @@ LL | extern "rust-intrinsic" fn m2() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:39:12 + --> $DIR/feature-gate-abi.rs:37:12 | LL | extern "rust-call" fn m4(_: ()) {} | ^^^^^^^^^^^ @@ -93,7 +93,7 @@ LL | extern "rust-call" fn m4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:44:12 + --> $DIR/feature-gate-abi.rs:42:12 | LL | extern "rust-intrinsic" fn im1() {} | ^^^^^^^^^^^^^^^^ @@ -102,7 +102,7 @@ LL | extern "rust-intrinsic" fn im1() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:46:12 + --> $DIR/feature-gate-abi.rs:44:12 | LL | extern "rust-intrinsic" fn im2() {} | ^^^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | extern "rust-intrinsic" fn im2() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:48:12 + --> $DIR/feature-gate-abi.rs:46:12 | LL | extern "rust-call" fn im4(_: ()) {} | ^^^^^^^^^^^ @@ -121,7 +121,7 @@ LL | extern "rust-call" fn im4(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:52:18 + --> $DIR/feature-gate-abi.rs:50:18 | LL | type A1 = extern "rust-intrinsic" fn(); | ^^^^^^^^^^^^^^^^ @@ -130,7 +130,7 @@ LL | type A1 = extern "rust-intrinsic" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:53:18 + --> $DIR/feature-gate-abi.rs:51:18 | LL | type A2 = extern "rust-intrinsic" fn(); | ^^^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL | type A2 = extern "rust-intrinsic" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:54:18 + --> $DIR/feature-gate-abi.rs:52:18 | LL | type A4 = extern "rust-call" fn(_: ()); | ^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | type A4 = extern "rust-call" fn(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:57:8 + --> $DIR/feature-gate-abi.rs:55:8 | LL | extern "rust-intrinsic" {} | ^^^^^^^^^^^^^^^^ @@ -158,7 +158,7 @@ LL | extern "rust-intrinsic" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-intrinsic" ABI is an implementation detail and perma-unstable - --> $DIR/feature-gate-abi.rs:58:8 + --> $DIR/feature-gate-abi.rs:56:8 | LL | extern "rust-intrinsic" {} | ^^^^^^^^^^^^^^^^ @@ -167,7 +167,7 @@ LL | extern "rust-intrinsic" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "rust-call" ABI is experimental and subject to change - --> $DIR/feature-gate-abi.rs:59:8 + --> $DIR/feature-gate-abi.rs:57:8 | LL | extern "rust-call" {} | ^^^^^^^^^^^ @@ -177,49 +177,49 @@ LL | extern "rust-call" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:22:32 + --> $DIR/feature-gate-abi.rs:20:32 | LL | extern "rust-intrinsic" fn m1(); | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:24:32 + --> $DIR/feature-gate-abi.rs:22:32 | LL | extern "rust-intrinsic" fn m2(); | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:14:33 + --> $DIR/feature-gate-abi.rs:12:33 | LL | extern "rust-intrinsic" fn f1() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:16:33 + --> $DIR/feature-gate-abi.rs:14:33 | LL | extern "rust-intrinsic" fn f2() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:35:37 + --> $DIR/feature-gate-abi.rs:33:37 | LL | extern "rust-intrinsic" fn m1() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:37:37 + --> $DIR/feature-gate-abi.rs:35:37 | LL | extern "rust-intrinsic" fn m2() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:44:38 + --> $DIR/feature-gate-abi.rs:42:38 | LL | extern "rust-intrinsic" fn im1() {} | ^^ error: intrinsic must be in `extern "rust-intrinsic" { ... }` block - --> $DIR/feature-gate-abi.rs:46:38 + --> $DIR/feature-gate-abi.rs:44:38 | LL | extern "rust-intrinsic" fn im2() {} | ^^ diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs index fb04906dafe96..d9027b417b4d9 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.rs @@ -1,13 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --crate-type=rlib #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized { } - -#[lang="tuple_trait"] -trait Tuple { } +extern crate minicore; +use minicore::*; // Functions extern "gpu-kernel" fn f1(_: ()) {} //~ ERROR "gpu-kernel" ABI is experimental and subject to change diff --git a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr index b05c16e3d9ee2..0e51484846c2e 100644 --- a/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_gpu_kernel.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:13:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:11:8 | LL | extern "gpu-kernel" fn f1(_: ()) {} | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "gpu-kernel" fn f1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:18:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:16:12 | LL | extern "gpu-kernel" fn m1(_: ()); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "gpu-kernel" fn m1(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:20:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:18:12 | LL | extern "gpu-kernel" fn dm1(_: ()) {} | ^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "gpu-kernel" fn dm1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:28:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:26:12 | LL | extern "gpu-kernel" fn m1(_: ()) {} | ^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "gpu-kernel" fn m1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:34:12 + --> $DIR/feature-gate-abi_gpu_kernel.rs:32:12 | LL | extern "gpu-kernel" fn im1(_: ()) {} | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "gpu-kernel" fn im1(_: ()) {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:39:18 + --> $DIR/feature-gate-abi_gpu_kernel.rs:37:18 | LL | type A1 = extern "gpu-kernel" fn(_: ()); | ^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type A1 = extern "gpu-kernel" fn(_: ()); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "gpu-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_gpu_kernel.rs:44:8 + --> $DIR/feature-gate-abi_gpu_kernel.rs:42:8 | LL | extern "gpu-kernel" {} | ^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | extern "gpu-kernel" {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date warning: the calling convention "gpu-kernel" is not supported on this target - --> $DIR/feature-gate-abi_gpu_kernel.rs:39:11 + --> $DIR/feature-gate-abi_gpu_kernel.rs:37:11 | LL | type A1 = extern "gpu-kernel" fn(_: ()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -79,31 +79,31 @@ LL | type A1 = extern "gpu-kernel" fn(_: ()); = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:44:1 + --> $DIR/feature-gate-abi_gpu_kernel.rs:42:1 | LL | extern "gpu-kernel" {} | ^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:13:1 + --> $DIR/feature-gate-abi_gpu_kernel.rs:11:1 | LL | extern "gpu-kernel" fn f1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:20:5 + --> $DIR/feature-gate-abi_gpu_kernel.rs:18:5 | LL | extern "gpu-kernel" fn dm1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:28:5 + --> $DIR/feature-gate-abi_gpu_kernel.rs:26:5 | LL | extern "gpu-kernel" fn m1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0570]: `"gpu-kernel"` is not a supported ABI for the current target - --> $DIR/feature-gate-abi_gpu_kernel.rs:34:5 + --> $DIR/feature-gate-abi_gpu_kernel.rs:32:5 | LL | extern "gpu-kernel" fn im1(_: ()) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -112,3 +112,14 @@ error: aborting due to 12 previous errors; 1 warning emitted Some errors have detailed explanations: E0570, E0658. For more information about an error, try `rustc --explain E0570`. +Future incompatibility report: Future breakage diagnostic: +warning: the calling convention "gpu-kernel" is not supported on this target + --> $DIR/feature-gate-abi_gpu_kernel.rs:39:11 + | +LL | type A1 = extern "gpu-kernel" fn(_: ()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #130260 + = note: `#[warn(unsupported_fn_ptr_calling_conventions)]` on by default + diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.rs b/tests/ui/feature-gates/feature-gate-abi_ptx.rs index e742492303ade..3cc2b78619243 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.rs +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.rs @@ -1,9 +1,11 @@ +//@ add-core-stubs //@ needs-llvm-components: nvptx //@ compile-flags: --target=nvptx64-nvidia-cuda --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; extern "ptx-kernel" fn fu() {} //~ ERROR extern "ptx-kernel" ABI is experimental diff --git a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr index d128075919b09..cbe9fd8d834e1 100644 --- a/tests/ui/feature-gates/feature-gate-abi_ptx.stderr +++ b/tests/ui/feature-gates/feature-gate-abi_ptx.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:8:8 + --> $DIR/feature-gate-abi_ptx.rs:10:8 | LL | extern "ptx-kernel" fn fu() {} | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "ptx-kernel" fn fu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:11:12 + --> $DIR/feature-gate-abi_ptx.rs:13:12 | LL | extern "ptx-kernel" fn mu(); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "ptx-kernel" fn mu(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:12:12 + --> $DIR/feature-gate-abi_ptx.rs:14:12 | LL | extern "ptx-kernel" fn dmu() {} | ^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "ptx-kernel" fn dmu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:17:12 + --> $DIR/feature-gate-abi_ptx.rs:19:12 | LL | extern "ptx-kernel" fn mu() {} | ^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "ptx-kernel" fn mu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:21:12 + --> $DIR/feature-gate-abi_ptx.rs:23:12 | LL | extern "ptx-kernel" fn imu() {} | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "ptx-kernel" fn imu() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:24:19 + --> $DIR/feature-gate-abi_ptx.rs:26:19 | LL | type TAU = extern "ptx-kernel" fn(); | ^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type TAU = extern "ptx-kernel" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "ptx-kernel" ABI is experimental and subject to change - --> $DIR/feature-gate-abi_ptx.rs:26:8 + --> $DIR/feature-gate-abi_ptx.rs:28:8 | LL | extern "ptx-kernel" {} | ^^^^^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs index a52fbbe4075ec..a3b41e071954a 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target mips-unknown-linux-gnu //@ needs-llvm-components: mips @@ -5,15 +6,8 @@ #![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; unsafe fn main() { asm!(""); diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr index d930429779c01..e59a10c11c3e2 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_arch.stderr @@ -1,5 +1,5 @@ error[E0658]: inline assembly is not stable yet on this architecture - --> $DIR/feature-gate-asm_experimental_arch.rs:19:5 + --> $DIR/feature-gate-asm_experimental_arch.rs:13:5 | LL | asm!(""); | ^^^^^^^^ diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs index 7aec7455b2e6a..6c53c2213a5e6 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ needs-asm-support //@ compile-flags: --target s390x-unknown-linux-gnu //@ needs-llvm-components: systemz @@ -6,15 +7,8 @@ #![crate_type = "rlib"] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; unsafe fn main() { asm!("", in("v0") 0); diff --git a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr index 0791ce4543ca6..6f2ea0ddaec16 100644 --- a/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr +++ b/tests/ui/feature-gates/feature-gate-asm_experimental_reg.stderr @@ -1,5 +1,5 @@ error[E0658]: register class `vreg` can only be used as a clobber in stable - --> $DIR/feature-gate-asm_experimental_reg.rs:20:14 + --> $DIR/feature-gate-asm_experimental_reg.rs:14:14 | LL | asm!("", in("v0") 0); | ^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | asm!("", in("v0") 0); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: type `i32` cannot be used with this register class in stable - --> $DIR/feature-gate-asm_experimental_reg.rs:20:23 + --> $DIR/feature-gate-asm_experimental_reg.rs:14:23 | LL | asm!("", in("v0") 0); | ^ diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.rs b/tests/ui/feature-gates/feature-gate-vectorcall.rs index aafa6a2ed629b..b29fd08473a0c 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.rs +++ b/tests/ui/feature-gates/feature-gate-vectorcall.rs @@ -1,10 +1,12 @@ // gate-test-abi_vectorcall +//@ add-core-stubs //@ needs-llvm-components: x86 //@ compile-flags: --target=i686-pc-windows-msvc --crate-type=rlib #![no_core] #![feature(no_core, lang_items)] -#[lang="sized"] -trait Sized { } + +extern crate minicore; +use minicore::*; // Test that the "vectorcall" ABI is feature-gated, and cannot be used when // the `vectorcall` feature gate is not used. diff --git a/tests/ui/feature-gates/feature-gate-vectorcall.stderr b/tests/ui/feature-gates/feature-gate-vectorcall.stderr index 8f3f47a3d4888..81dd10f5fe507 100644 --- a/tests/ui/feature-gates/feature-gate-vectorcall.stderr +++ b/tests/ui/feature-gates/feature-gate-vectorcall.stderr @@ -1,5 +1,5 @@ error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:12:8 + --> $DIR/feature-gate-vectorcall.rs:14:8 | LL | extern "vectorcall" fn f() {} | ^^^^^^^^^^^^ @@ -9,7 +9,7 @@ LL | extern "vectorcall" fn f() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:15:12 + --> $DIR/feature-gate-vectorcall.rs:17:12 | LL | extern "vectorcall" fn m(); | ^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | extern "vectorcall" fn m(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:17:12 + --> $DIR/feature-gate-vectorcall.rs:19:12 | LL | extern "vectorcall" fn dm() {} | ^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | extern "vectorcall" fn dm() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:22:12 + --> $DIR/feature-gate-vectorcall.rs:24:12 | LL | extern "vectorcall" fn m() {} | ^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | extern "vectorcall" fn m() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:26:12 + --> $DIR/feature-gate-vectorcall.rs:28:12 | LL | extern "vectorcall" fn im() {} | ^^^^^^^^^^^^ @@ -49,7 +49,7 @@ LL | extern "vectorcall" fn im() {} = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:29:18 + --> $DIR/feature-gate-vectorcall.rs:31:18 | LL | type TA = extern "vectorcall" fn(); | ^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | type TA = extern "vectorcall" fn(); = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: the extern "vectorcall" ABI is experimental and subject to change - --> $DIR/feature-gate-vectorcall.rs:31:8 + --> $DIR/feature-gate-vectorcall.rs:33:8 | LL | extern "vectorcall" {} | ^^^^^^^^^^^^ diff --git a/tests/ui/force-inlining/asm.rs b/tests/ui/force-inlining/asm.rs index 85014ffa51588..2b5f87c59d350 100644 --- a/tests/ui/force-inlining/asm.rs +++ b/tests/ui/force-inlining/asm.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-fail //@ compile-flags: --crate-type=lib --target thumbv4t-none-eabi //@ needs-llvm-components: arm @@ -9,17 +10,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy {} -#[lang = "freeze"] -pub unsafe trait Freeze {} - -#[lang = "start"] -fn start(_main: fn() -> T, _argc: isize, _argv: *const *const u8, _sigpipe: u8) -> isize { - 0 -} +extern crate minicore; +use minicore::*; #[rustc_builtin_macro] #[macro_export] diff --git a/tests/ui/force-inlining/asm.stderr b/tests/ui/force-inlining/asm.stderr index ef04688965bb3..1744c0215bb4c 100644 --- a/tests/ui/force-inlining/asm.stderr +++ b/tests/ui/force-inlining/asm.stderr @@ -1,5 +1,5 @@ error: `instruction_set_a32` could not be inlined into `t32` but is required to be inlined - --> $DIR/asm.rs:53:5 + --> $DIR/asm.rs:45:5 | LL | instruction_set_a32(); | ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_a32` called here @@ -7,7 +7,7 @@ LL | instruction_set_a32(); = note: could not be inlined due to: incompatible instruction set error: `inline_always_and_using_inline_asm` could not be inlined into `t32` but is required to be inlined - --> $DIR/asm.rs:57:5 + --> $DIR/asm.rs:49:5 | LL | inline_always_and_using_inline_asm(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...`inline_always_and_using_inline_asm` called here @@ -15,7 +15,7 @@ LL | inline_always_and_using_inline_asm(); = note: could not be inlined due to: cannot move inline-asm across instruction sets error: `instruction_set_a32` could not be inlined into `default` but is required to be inlined - --> $DIR/asm.rs:62:5 + --> $DIR/asm.rs:54:5 | LL | instruction_set_a32(); | ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_a32` called here @@ -23,7 +23,7 @@ LL | instruction_set_a32(); = note: could not be inlined due to: incompatible instruction set error: `instruction_set_t32` could not be inlined into `default` but is required to be inlined - --> $DIR/asm.rs:64:5 + --> $DIR/asm.rs:56:5 | LL | instruction_set_t32(); | ^^^^^^^^^^^^^^^^^^^^^ ...`instruction_set_t32` called here diff --git a/tests/ui/inline-const/collect-scopes-in-pat.rs b/tests/ui/inline-const/collect-scopes-in-pat.rs index 024fde537413f..16baf920f584e 100644 --- a/tests/ui/inline-const/collect-scopes-in-pat.rs +++ b/tests/ui/inline-const/collect-scopes-in-pat.rs @@ -1,4 +1,4 @@ -// @compile-flags: -Zlint-mir +//@ compile-flags: -Zlint-mir //@ check-pass #![feature(inline_const_pat)] diff --git a/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs b/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs index 254ac24f0b941..d68cbf26ef110 100644 --- a/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs +++ b/tests/ui/intrinsics/bad-intrinsic-monomorphization.rs @@ -7,10 +7,6 @@ // Bad monomorphizations could previously cause LLVM asserts even though the // error was caught in the compiler. -extern "rust-intrinsic" { - fn simd_add(x: T, y: T) -> T; -} - use std::intrinsics; #[derive(Copy, Clone)] @@ -27,6 +23,6 @@ pub unsafe fn test_fadd_fast(a: Foo, b: Foo) -> Foo { } pub unsafe fn test_simd_add(a: Foo, b: Foo) -> Foo { - simd_add(a, b) + intrinsics::simd::simd_add(a, b) //~^ ERROR `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` } diff --git a/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr b/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr index c070f01818193..f49d95e9cfcbe 100644 --- a/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr +++ b/tests/ui/intrinsics/bad-intrinsic-monomorphization.stderr @@ -1,20 +1,20 @@ error[E0511]: invalid monomorphization of `cttz` intrinsic: expected basic integer type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:20:5 + --> $DIR/bad-intrinsic-monomorphization.rs:16:5 | LL | intrinsics::cttz(v) | ^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `fadd_fast` intrinsic: expected basic float type, found `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:25:5 + --> $DIR/bad-intrinsic-monomorphization.rs:21:5 | LL | intrinsics::fadd_fast(a, b) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo` - --> $DIR/bad-intrinsic-monomorphization.rs:30:5 + --> $DIR/bad-intrinsic-monomorphization.rs:26:5 | -LL | simd_add(a, b) - | ^^^^^^^^^^^^^^ +LL | intrinsics::simd::simd_add(a, b) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/layout/hexagon-enum.rs b/tests/ui/layout/hexagon-enum.rs index 5fa12e479e7db..02833eb41fad7 100644 --- a/tests/ui/layout/hexagon-enum.rs +++ b/tests/ui/layout/hexagon-enum.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target hexagon-unknown-linux-musl //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" //@ needs-llvm-components: hexagon @@ -9,8 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang="sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[rustc_layout(debug)] #[repr(C)] diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index 90c06ba1f834e..b802b400b18b8 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -71,7 +71,7 @@ error: layout_of(A) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:17:1 + --> $DIR/hexagon-enum.rs:18:1 | LL | enum A { Apple } | ^^^^^^ @@ -149,7 +149,7 @@ error: layout_of(B) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:21:1 + --> $DIR/hexagon-enum.rs:22:1 | LL | enum B { Banana = 255, } | ^^^^^^ @@ -227,7 +227,7 @@ error: layout_of(C) = Layout { unadjusted_abi_align: Align(2 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:25:1 + --> $DIR/hexagon-enum.rs:26:1 | LL | enum C { Chaenomeles = 256, } | ^^^^^^ @@ -305,7 +305,7 @@ error: layout_of(P) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:29:1 + --> $DIR/hexagon-enum.rs:30:1 | LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ @@ -383,7 +383,7 @@ error: layout_of(T) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/hexagon-enum.rs:35:1 + --> $DIR/hexagon-enum.rs:36:1 | LL | enum T { Tangerine = TANGERINE as isize } | ^^^^^^ diff --git a/tests/ui/layout/thumb-enum.rs b/tests/ui/layout/thumb-enum.rs index 2381d9d02926d..1c4fab812f966 100644 --- a/tests/ui/layout/thumb-enum.rs +++ b/tests/ui/layout/thumb-enum.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv8m.main-none-eabihf //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" //@ needs-llvm-components: arm @@ -9,8 +10,8 @@ #![crate_type = "lib"] #![no_core] -#[lang="sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[rustc_layout(debug)] #[repr(C)] diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index 0c34331856474..07153fee02736 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -71,7 +71,7 @@ error: layout_of(A) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:17:1 + --> $DIR/thumb-enum.rs:18:1 | LL | enum A { Apple } | ^^^^^^ @@ -149,7 +149,7 @@ error: layout_of(B) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:21:1 + --> $DIR/thumb-enum.rs:22:1 | LL | enum B { Banana = 255, } | ^^^^^^ @@ -227,7 +227,7 @@ error: layout_of(C) = Layout { unadjusted_abi_align: Align(2 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:25:1 + --> $DIR/thumb-enum.rs:26:1 | LL | enum C { Chaenomeles = 256, } | ^^^^^^ @@ -305,7 +305,7 @@ error: layout_of(P) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:29:1 + --> $DIR/thumb-enum.rs:30:1 | LL | enum P { Peach = 0x1000_0000isize, } | ^^^^^^ @@ -383,7 +383,7 @@ error: layout_of(T) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/thumb-enum.rs:35:1 + --> $DIR/thumb-enum.rs:36:1 | LL | enum T { Tangerine = TANGERINE as isize } | ^^^^^^ diff --git a/tests/ui/layout/too-big-with-padding.rs b/tests/ui/layout/too-big-with-padding.rs index 8423ad2e1d607..0f03bd10fb63d 100644 --- a/tests/ui/layout/too-big-with-padding.rs +++ b/tests/ui/layout/too-big-with-padding.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-fail //@ compile-flags: --target i686-unknown-linux-gnu --crate-type lib //@ needs-llvm-components: x86 @@ -6,13 +7,11 @@ #![no_std] #![no_core] +extern crate minicore; +use minicore::*; + // 0x7fffffff is fine, but after rounding up it becomes too big #[repr(C, align(2))] pub struct Example([u8; 0x7fffffff]); pub fn lib(_x: Example) {} //~ERROR: too big for the target architecture - -#[lang = "sized"] -pub trait Sized {} -#[lang = "copy"] -pub trait Copy: Sized {} diff --git a/tests/ui/layout/too-big-with-padding.stderr b/tests/ui/layout/too-big-with-padding.stderr index fc3b4db049ac3..761ac7514ee37 100644 --- a/tests/ui/layout/too-big-with-padding.stderr +++ b/tests/ui/layout/too-big-with-padding.stderr @@ -1,5 +1,5 @@ error: values of the type `Example` are too big for the target architecture - --> $DIR/too-big-with-padding.rs:13:1 + --> $DIR/too-big-with-padding.rs:17:1 | LL | pub fn lib(_x: Example) {} | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr index 118b18b224c05..0c27547a6ed8f 100644 --- a/tests/ui/lint/clashing-extern-fn.stderr +++ b/tests/ui/lint/clashing-extern-fn.stderr @@ -17,7 +17,7 @@ LL | fn hidden_niche_unsafe_cell() -> Option`, which is not FFI-safe +warning: `extern` block uses type `Option<(usize) is 0..>`, which is not FFI-safe --> $DIR/clashing-extern-fn.rs:502:54 | LL | fn pt_non_zero_usize_opt_full_range() -> Option; diff --git a/tests/ui/mir/checks_without_panic_impl.rs b/tests/ui/mir/checks_without_panic_impl.rs index 0dba5784daa55..11ab50a5f9afd 100644 --- a/tests/ui/mir/checks_without_panic_impl.rs +++ b/tests/ui/mir/checks_without_panic_impl.rs @@ -2,6 +2,7 @@ // does not prevent crates without a panic_impl from compiling. // See rust-lang/rust#109996 +//@ add-core-stubs //@ build-pass //@ compile-flags: -Cdebug-assertions=yes @@ -11,7 +12,7 @@ #![feature(no_core)] #![no_core] -#[lang = "sized"] -trait Foo {} +extern crate minicore; +use minicore::*; pub unsafe fn foo(x: *const i32) -> &'static i32 { unsafe { &*x } } diff --git a/tests/ui/process/win-command-child-path.rs b/tests/ui/process/win-command-child-path.rs new file mode 100644 index 0000000000000..7ec2679749fb3 --- /dev/null +++ b/tests/ui/process/win-command-child-path.rs @@ -0,0 +1,72 @@ +//@ run-pass +//@ only-windows +//@ needs-subprocess +//@ no-prefer-dynamic + +// Test Windows std::process::Command search path semantics when setting PATH on the child process. +// NOTE: The exact semantics here are (possibly) subject to change. + +use std::process::Command; +use std::{env, fs, path}; + +fn main() { + if env::args().skip(1).any(|s| s == "--child") { + child(); + } else if env::args().skip(1).any(|s| s == "--parent") { + parent(); + } else { + setup(); + } +} + +// Set up the directories so that there are three app dirs: +// app: Where the parent app is run from +// parent: In the parent's PATH env var +// child: In the child's PATH env var +fn setup() { + let exe = env::current_exe().unwrap(); + + fs::create_dir_all("app").unwrap(); + fs::copy(&exe, "app/myapp.exe").unwrap(); + fs::create_dir_all("parent").unwrap(); + fs::copy(&exe, "parent/myapp.exe").unwrap(); + fs::create_dir_all("child").unwrap(); + fs::copy(&exe, "child/myapp.exe").unwrap(); + + let parent_path = path::absolute("parent").unwrap(); + let status = + Command::new("./app/myapp.exe").env("PATH", parent_path).arg("--parent").status().unwrap(); + // print the status in case of abnormal exit + dbg!(status); + assert!(status.success()); +} + +// The child simply prints the name of its parent directory. +fn child() { + let exe = env::current_exe().unwrap(); + let parent = exe.parent().unwrap().file_name().unwrap(); + println!("{}", parent.display()); +} + +fn parent() { + let exe = env::current_exe().unwrap(); + let name = exe.file_name().unwrap(); + + // By default, the application dir will be search first for the exe + let output = Command::new(&name).arg("--child").output().unwrap(); + assert_eq!(output.stdout, b"app\n"); + + // Setting an environment variable should not change the above. + let output = Command::new(&name).arg("--child").env("a", "b").output().unwrap(); + assert_eq!(output.stdout, b"app\n"); + + // Setting a child path means that path will be searched first. + let child_path = path::absolute("child").unwrap(); + let output = Command::new(&name).arg("--child").env("PATH", child_path).output().unwrap(); + assert_eq!(output.stdout, b"child\n"); + + // Setting a child path that does not contain the exe (currently) means + // we fallback to searching the app dir. + let output = Command::new(&name).arg("--child").env("PATH", "").output().unwrap(); + assert_eq!(output.stdout, b"app\n"); +} diff --git a/tests/ui/repr/16-bit-repr-c-enum.rs b/tests/ui/repr/16-bit-repr-c-enum.rs index 8c2d2fafce07e..d4d5a086dcc00 100644 --- a/tests/ui/repr/16-bit-repr-c-enum.rs +++ b/tests/ui/repr/16-bit-repr-c-enum.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ build-pass //@ revisions: avr msp430 // @@ -11,6 +12,9 @@ #![stable(feature = "intrinsics_for_test", since = "3.3.3")] #![allow(dead_code)] +extern crate minicore; +use minicore::*; + // Test that the repr(C) attribute doesn't break compilation // Previous bad assumption was that 32-bit enum default width is fine on msp430, avr // But the width of the C int on these platforms is 16 bits, and C enums <= C int range @@ -26,11 +30,6 @@ enum Foo { #[rustc_intrinsic] const fn size_of() -> usize; -#[lang="sized"] -trait Sized {} -#[lang="copy"] -trait Copy {} - const EXPECTED: usize = 2; const ACTUAL: usize = size_of::(); // Validate that the size is indeed 16 bits, to match this C static_assert: diff --git a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr index 204db30786ee3..42fcaee2d4aa4 100644 --- a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr index 1fab00bf50c49..bb2c6e70dc7ab 100644 --- a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr +++ b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(1 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr index 204db30786ee3..42fcaee2d4aa4 100644 --- a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr +++ b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.rs b/tests/ui/repr/repr-c-dead-variants.rs index 99f20982a9960..7f27430856231 100644 --- a/tests/ui/repr/repr-c-dead-variants.rs +++ b/tests/ui/repr/repr-c-dead-variants.rs @@ -4,8 +4,12 @@ #![no_std] #![no_core] +extern crate minicore; +use minicore::*; + // See also: repr-c-int-dead-variants.rs +//@ add-core-stubs //@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" @@ -59,6 +63,3 @@ enum DeadBranchHasOtherField { //~ ERROR layout_of Variant1(Void, Align8U64), Variant2(u8), } - -#[lang = "sized"] -trait Sized {} diff --git a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr index 204db30786ee3..42fcaee2d4aa4 100644 --- a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr @@ -81,7 +81,7 @@ error: layout_of(Univariant) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:39:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -219,7 +219,7 @@ error: layout_of(TwoVariants) = Layout { unadjusted_abi_align: Align(4 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:46:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -327,7 +327,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { unadjusted_abi_align: Align(8 bytes), randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:58:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr_align_greater_usize.msp430.stderr b/tests/ui/repr/repr_align_greater_usize.msp430.stderr index 7c85249c0099e..db25cb1b5f2ec 100644 --- a/tests/ui/repr/repr_align_greater_usize.msp430.stderr +++ b/tests/ui/repr/repr_align_greater_usize.msp430.stderr @@ -1,5 +1,5 @@ error[E0589]: alignment must not be greater than `isize::MAX` bytes - --> $DIR/repr_align_greater_usize.rs:21:8 + --> $DIR/repr_align_greater_usize.rs:22:8 | LL | #[repr(align(32768))] | ^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[repr(align(32768))] = note: `isize::MAX` is 32767 for the current target error[E0589]: alignment must not be greater than `isize::MAX` bytes - --> $DIR/repr_align_greater_usize.rs:24:8 + --> $DIR/repr_align_greater_usize.rs:25:8 | LL | #[repr(align(65536))] | ^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr_align_greater_usize.rs b/tests/ui/repr/repr_align_greater_usize.rs index b47320b6d9b63..7499e242d5970 100644 --- a/tests/ui/repr/repr_align_greater_usize.rs +++ b/tests/ui/repr/repr_align_greater_usize.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: msp430 aarch32 //@[msp430] needs-llvm-components: msp430 //@[msp430] compile-flags: --target=msp430-none-elf @@ -12,8 +13,8 @@ #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[repr(align(16384))] struct Kitten; diff --git a/tests/ui/sanitizer/cfg-kasan.rs b/tests/ui/sanitizer/cfg-kasan.rs index 491eaf3acc173..ba0abf605707a 100644 --- a/tests/ui/sanitizer/cfg-kasan.rs +++ b/tests/ui/sanitizer/cfg-kasan.rs @@ -1,6 +1,7 @@ // Verifies that when compiling with -Zsanitizer=kernel-address, // the `#[cfg(sanitize = "address")]` attribute is configured. +//@ add-core-stubs //@ check-pass //@ compile-flags: -Zsanitizer=kernel-address //@ revisions: aarch64 riscv64imac riscv64gc x86_64 @@ -17,8 +18,8 @@ #![feature(cfg_sanitize, no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; const _: fn() -> () = main; diff --git a/tests/ui/sanitizer/cfg.rs b/tests/ui/sanitizer/cfg.rs index 7b8f285e41a8a..a43813c04469f 100644 --- a/tests/ui/sanitizer/cfg.rs +++ b/tests/ui/sanitizer/cfg.rs @@ -1,6 +1,7 @@ // Verifies that when compiling with -Zsanitizer=option, // the `#[cfg(sanitize = "option")]` attribute is configured. +//@ add-core-stubs //@ check-pass //@ revisions: address cfi kcfi leak memory thread //@compile-flags: -Ctarget-feature=-crt-static @@ -23,10 +24,8 @@ #![crate_type="lib"] #![no_core] -#[lang="sized"] -trait Sized { } -#[lang="copy"] -trait Copy { } +extern crate minicore; +use minicore::*; #[cfg(all(sanitize = "address", address))] fn main() {} diff --git a/tests/ui/simd/array-trait.rs b/tests/ui/simd/array-trait.rs index 32cbf01428cad..2621885677134 100644 --- a/tests/ui/simd/array-trait.rs +++ b/tests/ui/simd/array-trait.rs @@ -1,11 +1,11 @@ // Figuring out the size of a vector type that depends on traits doesn't ICE #![allow(dead_code)] - - -#![feature(repr_simd, intrinsics, generic_const_exprs)] +#![feature(repr_simd, core_intrinsics, generic_const_exprs)] #![allow(non_camel_case_types, incomplete_features)] +use std::intrinsics::simd::{simd_extract, simd_insert}; + pub trait Simd { type Lane: Clone + Copy; const SIZE: usize; @@ -24,13 +24,6 @@ pub struct T([S::Lane; S::SIZE]); //~| ERROR SIMD vector element type should be a primitive scalar //~| ERROR unconstrained generic constant -#[rustc_intrinsic] -unsafe fn simd_insert(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract(x: T, idx: u32) -> E; - - pub fn main() { let mut t = T::([0; 4]); unsafe { diff --git a/tests/ui/simd/array-type.rs b/tests/ui/simd/array-type.rs index d1de700441694..468e0b2f9b500 100644 --- a/tests/ui/simd/array-type.rs +++ b/tests/ui/simd/array-type.rs @@ -1,8 +1,8 @@ //@ run-pass #![allow(dead_code)] +#![feature(repr_simd, core_intrinsics)] - -#![feature(repr_simd, intrinsics)] +use std::intrinsics::simd::{simd_extract, simd_insert}; #[repr(simd)] #[derive(Copy, Clone)] @@ -12,13 +12,6 @@ struct S([i32; 4]); #[derive(Copy, Clone)] struct T([i32; N]); -#[rustc_intrinsic] -unsafe fn simd_insert(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract(x: T, idx: u32) -> E; - - pub fn main() { let mut s = S([0; 4]); diff --git a/tests/ui/simd/generics.rs b/tests/ui/simd/generics.rs index 453ed86c14a9c..1ae08fef7cdf7 100644 --- a/tests/ui/simd/generics.rs +++ b/tests/ui/simd/generics.rs @@ -1,7 +1,8 @@ //@ run-pass #![allow(non_camel_case_types)] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] +use std::intrinsics::simd::simd_add; use std::ops; #[repr(simd)] @@ -20,11 +21,7 @@ struct B([T; 4]); #[derive(Copy, Clone)] struct C([T; N]); - -#[rustc_intrinsic] -unsafe fn simd_add(x: T, y: T) -> T; - -fn add>(lhs: T, rhs: T) -> T { +fn add>(lhs: T, rhs: T) -> T { lhs + rhs } @@ -60,7 +57,6 @@ impl ops::Add for C { } } - pub fn main() { let x = [1.0f32, 2.0f32, 3.0f32, 4.0f32]; let y = [2.0f32, 4.0f32, 6.0f32, 8.0f32]; diff --git a/tests/ui/simd/intrinsic/float-math-pass.rs b/tests/ui/simd/intrinsic/float-math-pass.rs index 91059f353fd9a..4c28568a739b7 100644 --- a/tests/ui/simd/intrinsic/float-math-pass.rs +++ b/tests/ui/simd/intrinsic/float-math-pass.rs @@ -8,58 +8,14 @@ // Test that the simd floating-point math intrinsics produce correct results. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, intrinsics, core_intrinsics)] #![allow(non_camel_case_types)] #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct f32x4(pub [f32; 4]); -#[rustc_intrinsic] -unsafe fn simd_fsqrt(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fabs(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fsin(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fcos(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fexp(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fexp2(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_fma(x: T, y: T, z: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_relaxed_fma(x: T, y: T, z: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_flog(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_flog10(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_flog2(x: T) -> T; - -// rounding functions -#[rustc_intrinsic] -unsafe fn simd_ceil(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_floor(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_round(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_trunc(x: T) -> T; +use std::intrinsics::simd::*; macro_rules! assert_approx_eq_f32 { ($a:expr, $b:expr) => {{ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs index 0fcff8584c850..fdf06b7882eda 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-2.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.rs @@ -1,7 +1,10 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] + +use std::intrinsics::simd::*; + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4(pub [i32; 4]); @@ -14,55 +17,6 @@ pub struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); -#[rustc_intrinsic] -unsafe fn simd_add(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_sub(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_mul(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_div(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_rem(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shl(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shr(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_and(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_or(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_xor(x: T, y: T) -> T; - - -#[rustc_intrinsic] -unsafe fn simd_neg(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bswap(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bitreverse(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctlz(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctpop(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_cttz(x: T) -> T; - fn main() { let x = i32x4([0, 0, 0, 0]); let y = u32x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr index e67de2fe9034d..76db6d5328f5b 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr +++ b/tests/ui/simd/intrinsic/generic-arithmetic-2.stderr @@ -1,143 +1,143 @@ error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:110:9 + --> $DIR/generic-arithmetic-2.rs:64:9 | LL | simd_add(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:112:9 + --> $DIR/generic-arithmetic-2.rs:66:9 | LL | simd_sub(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:114:9 + --> $DIR/generic-arithmetic-2.rs:68:9 | LL | simd_mul(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:116:9 + --> $DIR/generic-arithmetic-2.rs:70:9 | LL | simd_div(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:118:9 + --> $DIR/generic-arithmetic-2.rs:72:9 | LL | simd_shl(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:120:9 + --> $DIR/generic-arithmetic-2.rs:74:9 | LL | simd_shr(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:122:9 + --> $DIR/generic-arithmetic-2.rs:76:9 | LL | simd_and(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:124:9 + --> $DIR/generic-arithmetic-2.rs:78:9 | LL | simd_or(0, 0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:126:9 + --> $DIR/generic-arithmetic-2.rs:80:9 | LL | simd_xor(0, 0); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_neg` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:129:9 + --> $DIR/generic-arithmetic-2.rs:83:9 | LL | simd_neg(0); | ^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:131:9 + --> $DIR/generic-arithmetic-2.rs:85:9 | LL | simd_bswap(0); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:133:9 + --> $DIR/generic-arithmetic-2.rs:87:9 | LL | simd_bitreverse(0); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:135:9 + --> $DIR/generic-arithmetic-2.rs:89:9 | LL | simd_ctlz(0); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-arithmetic-2.rs:137:9 + --> $DIR/generic-arithmetic-2.rs:91:9 | LL | simd_cttz(0); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:140:9 + --> $DIR/generic-arithmetic-2.rs:94:9 | LL | simd_shl(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:142:9 + --> $DIR/generic-arithmetic-2.rs:96:9 | LL | simd_shr(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:144:9 + --> $DIR/generic-arithmetic-2.rs:98:9 | LL | simd_and(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:146:9 + --> $DIR/generic-arithmetic-2.rs:100:9 | LL | simd_or(z, z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:148:9 + --> $DIR/generic-arithmetic-2.rs:102:9 | LL | simd_xor(z, z); | ^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bswap` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:150:9 + --> $DIR/generic-arithmetic-2.rs:104:9 | LL | simd_bswap(z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitreverse` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:152:9 + --> $DIR/generic-arithmetic-2.rs:106:9 | LL | simd_bitreverse(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctlz` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:154:9 + --> $DIR/generic-arithmetic-2.rs:108:9 | LL | simd_ctlz(z); | ^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ctpop` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:156:9 + --> $DIR/generic-arithmetic-2.rs:110:9 | LL | simd_ctpop(z); | ^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cttz` intrinsic: unsupported operation on `f32x4` with element `f32` - --> $DIR/generic-arithmetic-2.rs:158:9 + --> $DIR/generic-arithmetic-2.rs:112:9 | LL | simd_cttz(z); | ^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs index 29d82255d4eae..3f0325d690b5a 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-pass.rs @@ -1,6 +1,6 @@ //@ run-pass #![allow(non_camel_case_types)] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone)] @@ -22,53 +22,7 @@ macro_rules! all_eq { }}; } -#[rustc_intrinsic] -unsafe fn simd_add(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_sub(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_mul(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_div(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_rem(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shl(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_shr(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_and(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_or(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_xor(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_neg(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bswap(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_bitreverse(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctlz(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_ctpop(x: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_cttz(x: T) -> T; +use std::intrinsics::simd::*; fn main() { let x1 = i32x4([1, 2, 3, 4]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs index 85464402d6af1..ca170f2d85026 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.rs @@ -1,7 +1,10 @@ //@ build-fail //@ ignore-emscripten -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] + +use std::intrinsics::simd::{simd_saturating_add, simd_saturating_sub}; + #[repr(simd)] #[derive(Copy, Clone)] pub struct i32x4(pub [i32; 4]); @@ -14,13 +17,6 @@ pub struct x4(pub [T; 4]); #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); -#[rustc_intrinsic] -unsafe fn simd_saturating_add(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_saturating_sub(x: T, y: T) -> T; - - fn main() { let x = i32x4([0, 0, 0, 0]); let y = x4([0_usize, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr index cf275db7e435f..f787458234027 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-2.stderr @@ -1,11 +1,11 @@ error[E0511]: invalid monomorphization of `simd_saturating_add` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/generic-arithmetic-saturating-2.rs:35:9 + --> $DIR/generic-arithmetic-saturating-2.rs:31:9 | LL | simd_saturating_add(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_saturating_sub` intrinsic: expected element type `f32` of vector type `f32x4` to be a signed or unsigned integer type - --> $DIR/generic-arithmetic-saturating-2.rs:37:9 + --> $DIR/generic-arithmetic-saturating-2.rs:33:9 | LL | simd_saturating_sub(z, z); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs index 5fe65257d15f0..4d12a312331a7 100644 --- a/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs +++ b/tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs @@ -2,7 +2,9 @@ //@ ignore-emscripten #![allow(non_camel_case_types)] -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::{simd_saturating_add, simd_saturating_sub}; #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] @@ -12,13 +14,6 @@ struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] struct I32([i32; N]); -#[rustc_intrinsic] -unsafe fn simd_saturating_add(x: T, y: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_saturating_sub(x: T, y: T) -> T; - - fn main() { // unsigned { diff --git a/tests/ui/simd/intrinsic/generic-as.rs b/tests/ui/simd/intrinsic/generic-as.rs index 124ca56bc889b..da53211cbc743 100644 --- a/tests/ui/simd/intrinsic/generic-as.rs +++ b/tests/ui/simd/intrinsic/generic-as.rs @@ -1,10 +1,8 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_as(x: T) -> U; +use std::intrinsics::simd::simd_as; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/intrinsic/generic-bitmask-pass.rs b/tests/ui/simd/intrinsic/generic-bitmask-pass.rs index 08526991fbe1f..cb3221e21d530 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask-pass.rs +++ b/tests/ui/simd/intrinsic/generic-bitmask-pass.rs @@ -1,13 +1,12 @@ //@ run-pass #![allow(non_camel_case_types)] - //@ ignore-emscripten //@ ignore-endian-big behavior of simd_bitmask is endian-specific // Test that the simd_bitmask intrinsic produces correct results. +#![feature(repr_simd, core_intrinsics)] -#![feature(repr_simd, intrinsics)] -#[allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bitmask; #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] @@ -21,9 +20,6 @@ struct u8x4(pub [u8; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct Tx4(pub [T; 4]); -#[rustc_intrinsic] -unsafe fn simd_bitmask(x: T) -> U; - fn main() { let z = u32x4([0, 0, 0, 0]); let ez = 0_u8; @@ -56,6 +52,5 @@ fn main() { let r: u8 = simd_bitmask(msize); assert_eq!(r, e); - } } diff --git a/tests/ui/simd/intrinsic/generic-bitmask.rs b/tests/ui/simd/intrinsic/generic-bitmask.rs index 49589d22bbfa9..9f5e806337eb5 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask.rs +++ b/tests/ui/simd/intrinsic/generic-bitmask.rs @@ -3,9 +3,11 @@ // Test that the simd_bitmask intrinsic produces ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bitmask; + #[repr(simd)] #[derive(Copy, Clone)] pub struct u32x2([u32; 2]); @@ -30,9 +32,6 @@ struct u8x32([u8; 32]); #[derive(Copy, Clone)] struct u8x64([u8; 64]); -#[rustc_intrinsic] -unsafe fn simd_bitmask(x: T) -> U; - fn main() { let m2 = u32x2([0; 2]); let m4 = u32x4([0; 4]); @@ -63,6 +62,5 @@ fn main() { let _: u128 = simd_bitmask(m64); //~^ ERROR invalid monomorphization of `simd_bitmask` intrinsic - - } + } } diff --git a/tests/ui/simd/intrinsic/generic-bitmask.stderr b/tests/ui/simd/intrinsic/generic-bitmask.stderr index c217bb2d8f1aa..3c4878f39cc94 100644 --- a/tests/ui/simd/intrinsic/generic-bitmask.stderr +++ b/tests/ui/simd/intrinsic/generic-bitmask.stderr @@ -1,29 +1,29 @@ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-bitmask.rs:52:22 + --> $DIR/generic-bitmask.rs:51:22 | LL | let _: u16 = simd_bitmask(m2); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-bitmask.rs:55:22 + --> $DIR/generic-bitmask.rs:54:22 | LL | let _: u16 = simd_bitmask(m8); | ^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u32`, expected `u16` or `[u8; 2]` - --> $DIR/generic-bitmask.rs:58:22 + --> $DIR/generic-bitmask.rs:57:22 | LL | let _: u32 = simd_bitmask(m16); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u64`, expected `u32` or `[u8; 4]` - --> $DIR/generic-bitmask.rs:61:22 + --> $DIR/generic-bitmask.rs:60:22 | LL | let _: u64 = simd_bitmask(m32); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_bitmask` intrinsic: cannot return `u128`, expected `u64` or `[u8; 8]` - --> $DIR/generic-bitmask.rs:64:23 + --> $DIR/generic-bitmask.rs:63:23 | LL | let _: u128 = simd_bitmask(m64); | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-bswap-byte.rs b/tests/ui/simd/intrinsic/generic-bswap-byte.rs index 4521573636c01..903a07656a705 100644 --- a/tests/ui/simd/intrinsic/generic-bswap-byte.rs +++ b/tests/ui/simd/intrinsic/generic-bswap-byte.rs @@ -1,7 +1,9 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_bswap; + #[repr(simd)] #[derive(Copy, Clone)] struct i8x4([i8; 4]); @@ -10,9 +12,6 @@ struct i8x4([i8; 4]); #[derive(Copy, Clone)] struct u8x4([u8; 4]); -#[rustc_intrinsic] -unsafe fn simd_bswap(x: T) -> T; - fn main() { unsafe { assert_eq!(simd_bswap(i8x4([0, 1, 2, 3])).0, [0, 1, 2, 3]); diff --git a/tests/ui/simd/intrinsic/generic-cast-pass.rs b/tests/ui/simd/intrinsic/generic-cast-pass.rs index aab7347d1de5e..7a4663bcad2b1 100644 --- a/tests/ui/simd/intrinsic/generic-cast-pass.rs +++ b/tests/ui/simd/intrinsic/generic-cast-pass.rs @@ -1,9 +1,8 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -#[rustc_intrinsic] -unsafe fn simd_cast(x: T) -> U; +use std::intrinsics::simd::simd_cast; use std::cmp::{max, min}; diff --git a/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs b/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs index 9f28898654f2f..ea34e9ffeb8ec 100644 --- a/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs +++ b/tests/ui/simd/intrinsic/generic-cast-pointer-width.rs @@ -1,8 +1,7 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -#[rustc_intrinsic] -unsafe fn simd_cast(x: T) -> U; +use std::intrinsics::simd::simd_cast; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/intrinsic/generic-cast.rs b/tests/ui/simd/intrinsic/generic-cast.rs index 7f398804eb4f3..4b13a93f323f4 100644 --- a/tests/ui/simd/intrinsic/generic-cast.rs +++ b/tests/ui/simd/intrinsic/generic-cast.rs @@ -1,6 +1,8 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::simd_cast; #[repr(simd)] #[derive(Copy, Clone)] @@ -20,10 +22,6 @@ struct f32x4([f32; 4]); #[allow(non_camel_case_types)] struct f32x8([f32; 8]); - -#[rustc_intrinsic] -unsafe fn simd_cast(x: T) -> U; - fn main() { let x = i32x4([0, 0, 0, 0]); @@ -35,6 +33,6 @@ fn main() { simd_cast::(x); //~^ ERROR expected SIMD return type, found non-SIMD `i32` simd_cast::<_, i32x8>(x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 } } diff --git a/tests/ui/simd/intrinsic/generic-cast.stderr b/tests/ui/simd/intrinsic/generic-cast.stderr index 1b6ac03f8c964..192aa13216b17 100644 --- a/tests/ui/simd/intrinsic/generic-cast.stderr +++ b/tests/ui/simd/intrinsic/generic-cast.stderr @@ -1,23 +1,23 @@ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:31:9 + --> $DIR/generic-cast.rs:29:9 | LL | simd_cast::(0); | ^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:33:9 + --> $DIR/generic-cast.rs:31:9 | LL | simd_cast::(0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-cast.rs:35:9 + --> $DIR/generic-cast.rs:33:9 | LL | simd_cast::(x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8 - --> $DIR/generic-cast.rs:37:9 + --> $DIR/generic-cast.rs:35:9 | LL | simd_cast::<_, i32x8>(x); | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-comparison-pass.rs b/tests/ui/simd/intrinsic/generic-comparison-pass.rs index d0ec25036020b..2ee164cdfd800 100644 --- a/tests/ui/simd/intrinsic/generic-comparison-pass.rs +++ b/tests/ui/simd/intrinsic/generic-comparison-pass.rs @@ -1,8 +1,10 @@ //@ run-pass -#![feature(repr_simd, intrinsics, concat_idents)] +#![feature(repr_simd, core_intrinsics, concat_idents)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_eq, simd_ge, simd_gt, simd_le, simd_lt, simd_ne}; + #[repr(simd)] #[derive(Copy, Clone)] struct i32x4([i32; 4]); @@ -13,24 +15,6 @@ struct u32x4(pub [u32; 4]); #[derive(Copy, Clone)] struct f32x4(pub [f32; 4]); -#[rustc_intrinsic] -unsafe fn simd_eq(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ne(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_lt(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_le(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_gt(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ge(x: T, y: T) -> U; - macro_rules! cmp { ($method: ident($lhs: expr, $rhs: expr)) => {{ let lhs = $lhs; diff --git a/tests/ui/simd/intrinsic/generic-comparison.rs b/tests/ui/simd/intrinsic/generic-comparison.rs index e5adb49f6a3b0..ebd1f629be47b 100644 --- a/tests/ui/simd/intrinsic/generic-comparison.rs +++ b/tests/ui/simd/intrinsic/generic-comparison.rs @@ -1,6 +1,6 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone)] @@ -11,24 +11,7 @@ struct i32x4([i32; 4]); #[allow(non_camel_case_types)] struct i16x8([i16; 8]); - -#[rustc_intrinsic] -unsafe fn simd_eq(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ne(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_lt(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_le(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_gt(x: T, y: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_ge(x: T, y: T) -> U; +use std::intrinsics::simd::{simd_eq, simd_ge, simd_gt, simd_le, simd_lt, simd_ne}; fn main() { let x = i32x4([0, 0, 0, 0]); @@ -61,16 +44,16 @@ fn main() { //~^ ERROR expected SIMD return type, found non-SIMD `i32` simd_eq::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_ne::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_lt::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_le::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_gt::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 simd_ge::<_, i16x8>(x, x); -//~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 + //~^ ERROR return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 } } diff --git a/tests/ui/simd/intrinsic/generic-comparison.stderr b/tests/ui/simd/intrinsic/generic-comparison.stderr index cc66d2ce40a91..a6e91bf6a36b8 100644 --- a/tests/ui/simd/intrinsic/generic-comparison.stderr +++ b/tests/ui/simd/intrinsic/generic-comparison.stderr @@ -1,107 +1,107 @@ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:37:9 + --> $DIR/generic-comparison.rs:20:9 | LL | simd_eq::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:39:9 + --> $DIR/generic-comparison.rs:22:9 | LL | simd_ne::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:41:9 + --> $DIR/generic-comparison.rs:24:9 | LL | simd_lt::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:43:9 + --> $DIR/generic-comparison.rs:26:9 | LL | simd_le::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:45:9 + --> $DIR/generic-comparison.rs:28:9 | LL | simd_gt::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:47:9 + --> $DIR/generic-comparison.rs:30:9 | LL | simd_ge::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:50:9 + --> $DIR/generic-comparison.rs:33:9 | LL | simd_eq::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:52:9 + --> $DIR/generic-comparison.rs:35:9 | LL | simd_ne::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:54:9 + --> $DIR/generic-comparison.rs:37:9 | LL | simd_lt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:56:9 + --> $DIR/generic-comparison.rs:39:9 | LL | simd_le::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:58:9 + --> $DIR/generic-comparison.rs:41:9 | LL | simd_gt::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD return type, found non-SIMD `i32` - --> $DIR/generic-comparison.rs:60:9 + --> $DIR/generic-comparison.rs:43:9 | LL | simd_ge::<_, i32>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:63:9 + --> $DIR/generic-comparison.rs:46:9 | LL | simd_eq::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:65:9 + --> $DIR/generic-comparison.rs:48:9 | LL | simd_ne::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:67:9 + --> $DIR/generic-comparison.rs:50:9 | LL | simd_lt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:69:9 + --> $DIR/generic-comparison.rs:52:9 | LL | simd_le::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:71:9 + --> $DIR/generic-comparison.rs:54:9 | LL | simd_gt::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8 - --> $DIR/generic-comparison.rs:73:9 + --> $DIR/generic-comparison.rs:56:9 | LL | simd_ge::<_, i16x8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-elements-pass.rs b/tests/ui/simd/intrinsic/generic-elements-pass.rs index b8d872c5cb77d..4dc2e4d5a80a9 100644 --- a/tests/ui/simd/intrinsic/generic-elements-pass.rs +++ b/tests/ui/simd/intrinsic/generic-elements-pass.rs @@ -1,6 +1,8 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::{simd_extract, simd_insert, simd_shuffle}; #[repr(simd)] #[derive(Copy, Clone, Debug, PartialEq)] @@ -15,15 +17,6 @@ struct i32x4([i32; 4]); #[allow(non_camel_case_types)] struct i32x8([i32; 8]); -#[rustc_intrinsic] -unsafe fn simd_insert(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract(x: T, idx: u32) -> E; - -#[rustc_intrinsic] -unsafe fn simd_shuffle(x: T, y: T, idx: I) -> U; - #[repr(simd)] struct SimdShuffleIdx([u32; LEN]); diff --git a/tests/ui/simd/intrinsic/generic-elements.rs b/tests/ui/simd/intrinsic/generic-elements.rs index 54cf35df8c758..905299a928971 100644 --- a/tests/ui/simd/intrinsic/generic-elements.rs +++ b/tests/ui/simd/intrinsic/generic-elements.rs @@ -1,8 +1,20 @@ //@ build-fail -#![feature(repr_simd, intrinsics, rustc_attrs, adt_const_params, unsized_const_params)] +#![feature( + repr_simd, + intrinsics, + core_intrinsics, + rustc_attrs, + adt_const_params, + unsized_const_params +)] #![allow(incomplete_features)] +use std::intrinsics::simd::{simd_extract, simd_insert, simd_shuffle}; + +#[rustc_intrinsic] +unsafe fn simd_shuffle_const_generic(x: T, y: T) -> U; + #[repr(simd)] #[derive(Copy, Clone)] #[allow(non_camel_case_types)] @@ -29,21 +41,6 @@ struct f32x4([f32; 4]); #[allow(non_camel_case_types)] struct f32x8([f32; 8]); - -#[rustc_intrinsic] -unsafe fn simd_insert(x: T, idx: u32, y: E) -> T; - -#[rustc_intrinsic] -unsafe fn simd_extract(x: T, idx: u32) -> E; - - -#[rustc_intrinsic] -unsafe fn simd_shuffle(x: T, y: T, idx: I) -> U; - -#[rustc_intrinsic] -unsafe fn simd_shuffle_const_generic(x: T, y: T) -> U; - - #[repr(simd)] struct SimdShuffleIdx([u32; LEN]); diff --git a/tests/ui/simd/intrinsic/generic-elements.stderr b/tests/ui/simd/intrinsic/generic-elements.stderr index 1b3e8d592133c..3779aa86cee19 100644 --- a/tests/ui/simd/intrinsic/generic-elements.stderr +++ b/tests/ui/simd/intrinsic/generic-elements.stderr @@ -1,125 +1,125 @@ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:54:9 + --> $DIR/generic-elements.rs:51:9 | LL | simd_insert(0, 0, 0); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64` - --> $DIR/generic-elements.rs:56:9 + --> $DIR/generic-elements.rs:53:9 | LL | simd_insert(x, 0, 1.0); | ^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32` - --> $DIR/generic-elements.rs:58:9 + --> $DIR/generic-elements.rs:55:9 | LL | simd_extract::<_, f32>(x, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:62:9 + --> $DIR/generic-elements.rs:59:9 | LL | simd_shuffle::(0, 0, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:65:9 + --> $DIR/generic-elements.rs:62:9 | LL | simd_shuffle::(0, 0, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:68:9 + --> $DIR/generic-elements.rs:65:9 | LL | simd_shuffle::(0, 0, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:71:9 + --> $DIR/generic-elements.rs:68:9 | LL | simd_shuffle::<_, _, f32x2>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:73:9 + --> $DIR/generic-elements.rs:70:9 | LL | simd_shuffle::<_, _, f32x4>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/generic-elements.rs:75:9 + --> $DIR/generic-elements.rs:72:9 | LL | simd_shuffle::<_, _, f32x8>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:78:9 + --> $DIR/generic-elements.rs:75:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX2); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:80:9 + --> $DIR/generic-elements.rs:77:9 | LL | simd_shuffle::<_, _, i32x8>(x, x, IDX4); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:82:9 + --> $DIR/generic-elements.rs:79:9 | LL | simd_shuffle::<_, _, i32x2>(x, x, IDX8); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:86:9 + --> $DIR/generic-elements.rs:83:9 | LL | simd_shuffle_const_generic::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:89:9 + --> $DIR/generic-elements.rs:86:9 | LL | simd_shuffle_const_generic::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected SIMD input type, found non-SIMD `i32` - --> $DIR/generic-elements.rs:92:9 + --> $DIR/generic-elements.rs:89:9 | LL | simd_shuffle_const_generic::(0, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32` - --> $DIR/generic-elements.rs:95:9 + --> $DIR/generic-elements.rs:92:9 | LL | simd_shuffle_const_generic::<_, f32x2, I2>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32` - --> $DIR/generic-elements.rs:97:9 + --> $DIR/generic-elements.rs:94:9 | LL | simd_shuffle_const_generic::<_, f32x4, I4>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32` - --> $DIR/generic-elements.rs:99:9 + --> $DIR/generic-elements.rs:96:9 | LL | simd_shuffle_const_generic::<_, f32x8, I8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 2, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:102:9 + --> $DIR/generic-elements.rs:99:9 | LL | simd_shuffle_const_generic::<_, i32x8, I2>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 4, found `i32x8` with length 8 - --> $DIR/generic-elements.rs:104:9 + --> $DIR/generic-elements.rs:101:9 | LL | simd_shuffle_const_generic::<_, i32x8, I4>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle_const_generic` intrinsic: expected return type of length 8, found `i32x2` with length 2 - --> $DIR/generic-elements.rs:106:9 + --> $DIR/generic-elements.rs:103:9 | LL | simd_shuffle_const_generic::<_, i32x2, I8>(x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-gather-pass.rs b/tests/ui/simd/intrinsic/generic-gather-pass.rs index 0b2cf47e98980..b98d4d6575bb7 100644 --- a/tests/ui/simd/intrinsic/generic-gather-pass.rs +++ b/tests/ui/simd/intrinsic/generic-gather-pass.rs @@ -3,19 +3,15 @@ // Test that the simd_{gather,scatter} intrinsics produce the correct results. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_gather, simd_scatter}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct x4(pub [T; 4]); -#[rustc_intrinsic] -unsafe fn simd_gather(x: T, y: U, z: V) -> T; - -#[rustc_intrinsic] -unsafe fn simd_scatter(x: T, y: U, z: V) -> (); - fn main() { let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; @@ -26,12 +22,8 @@ fn main() { // reading from *const unsafe { let pointer = x.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -41,12 +33,8 @@ fn main() { // reading from *mut unsafe { let pointer = x.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -56,12 +44,8 @@ fn main() { // writing to *mut unsafe { let pointer = x.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let values = x4([42_f32, 43_f32, 44_f32, 45_f32]); simd_scatter(values, pointers, mask); @@ -78,7 +62,7 @@ fn main() { &x[4] as *const f32, &x[5] as *const f32, &x[6] as *const f32, - &x[7] as *const f32 + &x[7] as *const f32, ]; let default = x4([y[0], y[0], y[0], y[0]]); @@ -87,12 +71,8 @@ fn main() { // reading from *const unsafe { let pointer = y.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -102,12 +82,8 @@ fn main() { // reading from *mut unsafe { let pointer = y.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let r_strided = simd_gather(default, pointers, mask); @@ -117,12 +93,8 @@ fn main() { // writing to *mut unsafe { let pointer = y.as_mut_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(2), pointer.offset(4), pointer.offset(6)]); let values = x4([y[7], y[6], y[5], y[1]]); simd_scatter(values, pointers, mask); @@ -135,7 +107,7 @@ fn main() { &x[4] as *const f32, &x[5] as *const f32, &x[1] as *const f32, - &x[7] as *const f32 + &x[7] as *const f32, ]; assert_eq!(y, s); } diff --git a/tests/ui/simd/intrinsic/generic-reduction-pass.rs b/tests/ui/simd/intrinsic/generic-reduction-pass.rs index 8408d0f203bfb..2d5d75447b661 100644 --- a/tests/ui/simd/intrinsic/generic-reduction-pass.rs +++ b/tests/ui/simd/intrinsic/generic-reduction-pass.rs @@ -1,12 +1,11 @@ //@ run-pass #![allow(non_camel_case_types)] - //@ ignore-emscripten // Test that the simd_reduce_{op} intrinsics produce the correct results. +#![feature(repr_simd, core_intrinsics)] -#![feature(repr_simd, intrinsics)] -#[allow(non_camel_case_types)] +use std::intrinsics::simd::*; #[repr(simd)] #[derive(Copy, Clone)] @@ -24,39 +23,6 @@ struct f32x4(pub [f32; 4]); #[derive(Copy, Clone)] struct b8x4(pub [i8; 4]); -#[rustc_intrinsic] -unsafe fn simd_reduce_add_unordered(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_mul_unordered(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_add_ordered(x: T, acc: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_mul_ordered(x: T, acc: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_min(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_max(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_and(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_or(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_xor(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_all(x: T) -> bool; - -#[rustc_intrinsic] -unsafe fn simd_reduce_any(x: T) -> bool; - fn main() { unsafe { let x = i32x4([1, -2, 3, 4]); diff --git a/tests/ui/simd/intrinsic/generic-reduction.rs b/tests/ui/simd/intrinsic/generic-reduction.rs index ead13250643c1..49a33ac35e743 100644 --- a/tests/ui/simd/intrinsic/generic-reduction.rs +++ b/tests/ui/simd/intrinsic/generic-reduction.rs @@ -4,9 +4,11 @@ // Test that the simd_reduce_{op} intrinsics produce ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::*; + #[repr(simd)] #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); @@ -15,27 +17,6 @@ pub struct f32x4(pub [f32; 4]); #[derive(Copy, Clone)] pub struct u32x4(pub [u32; 4]); -#[rustc_intrinsic] -unsafe fn simd_reduce_add_ordered(x: T, y: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_mul_ordered(x: T, y: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_and(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_or(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_xor(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_reduce_all(x: T) -> bool; - -#[rustc_intrinsic] -unsafe fn simd_reduce_any(x: T) -> bool; - fn main() { let x = u32x4([0, 0, 0, 0]); let z = f32x4([0.0, 0.0, 0.0, 0.0]); diff --git a/tests/ui/simd/intrinsic/generic-reduction.stderr b/tests/ui/simd/intrinsic/generic-reduction.stderr index 302b9ae1d778a..eaa7b8d48eb33 100644 --- a/tests/ui/simd/intrinsic/generic-reduction.stderr +++ b/tests/ui/simd/intrinsic/generic-reduction.stderr @@ -1,59 +1,59 @@ error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/generic-reduction.rs:44:9 + --> $DIR/generic-reduction.rs:25:9 | LL | simd_reduce_add_ordered(z, 0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: expected return type `f32` (element of input `f32x4`), found `i32` - --> $DIR/generic-reduction.rs:46:9 + --> $DIR/generic-reduction.rs:27:9 | LL | simd_reduce_mul_ordered(z, 1); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:49:22 + --> $DIR/generic-reduction.rs:30:22 | LL | let _: f32 = simd_reduce_and(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:51:22 + --> $DIR/generic-reduction.rs:32:22 | LL | let _: f32 = simd_reduce_or(x); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32` - --> $DIR/generic-reduction.rs:53:22 + --> $DIR/generic-reduction.rs:34:22 | LL | let _: f32 = simd_reduce_xor(x); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: unsupported simd_reduce_and from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:56:22 + --> $DIR/generic-reduction.rs:37:22 | LL | let _: f32 = simd_reduce_and(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: unsupported simd_reduce_or from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:58:22 + --> $DIR/generic-reduction.rs:39:22 | LL | let _: f32 = simd_reduce_or(z); | ^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: unsupported simd_reduce_xor from `f32x4` with element `f32` to `f32` - --> $DIR/generic-reduction.rs:60:22 + --> $DIR/generic-reduction.rs:41:22 | LL | let _: f32 = simd_reduce_xor(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_all` intrinsic: unsupported simd_reduce_all from `f32x4` with element `f32` to `bool` - --> $DIR/generic-reduction.rs:63:23 + --> $DIR/generic-reduction.rs:44:23 | LL | let _: bool = simd_reduce_all(z); | ^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_reduce_any` intrinsic: unsupported simd_reduce_any from `f32x4` with element `f32` to `bool` - --> $DIR/generic-reduction.rs:65:23 + --> $DIR/generic-reduction.rs:46:23 | LL | let _: bool = simd_reduce_any(z); | ^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-select-pass.rs b/tests/ui/simd/intrinsic/generic-select-pass.rs index 6b1b6cb79dbc9..0e5f7c4902f3a 100644 --- a/tests/ui/simd/intrinsic/generic-select-pass.rs +++ b/tests/ui/simd/intrinsic/generic-select-pass.rs @@ -1,13 +1,12 @@ //@ run-pass #![allow(non_camel_case_types)] - //@ ignore-emscripten //@ ignore-endian-big behavior of simd_select_bitmask is endian-specific // Test that the simd_select intrinsics produces correct results. +#![feature(repr_simd, core_intrinsics)] -#![feature(repr_simd, intrinsics)] -#[allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_select, simd_select_bitmask}; #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] @@ -29,13 +28,6 @@ struct f32x4(pub [f32; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct b8x4(pub [i8; 4]); -#[rustc_intrinsic] -unsafe fn simd_select(x: T, a: U, b: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask(x: T, a: U, b: U) -> U; - - fn main() { let m0 = b8x4([!0, !0, !0, !0]); let m1 = b8x4([0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-select.rs b/tests/ui/simd/intrinsic/generic-select.rs index 340fe3f35929c..917ad3ca6046d 100644 --- a/tests/ui/simd/intrinsic/generic-select.rs +++ b/tests/ui/simd/intrinsic/generic-select.rs @@ -3,9 +3,11 @@ // Test that the simd_select intrinsic produces ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_select, simd_select_bitmask}; + #[repr(simd)] #[derive(Copy, Clone)] pub struct f32x4(pub [f32; 4]); @@ -22,14 +24,6 @@ struct b8x4(pub [i8; 4]); #[derive(Copy, Clone, PartialEq)] struct b8x8(pub [i8; 8]); - -#[rustc_intrinsic] -unsafe fn simd_select(x: T, a: U, b: U) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask(x: T, a: U, b: U) -> U; - - fn main() { let m4 = b8x4([0, 0, 0, 0]); let m8 = b8x8([0, 0, 0, 0, 0, 0, 0, 0]); diff --git a/tests/ui/simd/intrinsic/generic-select.stderr b/tests/ui/simd/intrinsic/generic-select.stderr index a97fc91f951d1..c46584d117ce8 100644 --- a/tests/ui/simd/intrinsic/generic-select.stderr +++ b/tests/ui/simd/intrinsic/generic-select.stderr @@ -1,47 +1,47 @@ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched lengths: mask length `8` != other vector length `4` - --> $DIR/generic-select.rs:42:9 + --> $DIR/generic-select.rs:36:9 | LL | simd_select(m8, x, x); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_` - --> $DIR/generic-select.rs:45:9 + --> $DIR/generic-select.rs:39:9 | LL | simd_select(x, x, x); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_` - --> $DIR/generic-select.rs:48:9 + --> $DIR/generic-select.rs:42:9 | LL | simd_select(z, z, z); | ^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/generic-select.rs:51:9 + --> $DIR/generic-select.rs:45:9 | LL | simd_select(m4, 0u32, 1u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `u16`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:54:9 + --> $DIR/generic-select.rs:48:9 | LL | simd_select_bitmask(0u16, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: expected SIMD argument type, found non-SIMD `u32` - --> $DIR/generic-select.rs:57:9 + --> $DIR/generic-select.rs:51:9 | LL | simd_select_bitmask(0u8, 1u32, 2u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `f32`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:60:9 + --> $DIR/generic-select.rs:54:9 | LL | simd_select_bitmask(0.0f32, x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_select_bitmask` intrinsic: invalid bitmask `&str`, expected `u8` or `[u8; 1]` - --> $DIR/generic-select.rs:63:9 + --> $DIR/generic-select.rs:57:9 | LL | simd_select_bitmask("x", x, x); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/generic-shuffle.rs b/tests/ui/simd/intrinsic/generic-shuffle.rs index 1223b8ebe1903..7cfd764f5d5eb 100644 --- a/tests/ui/simd/intrinsic/generic-shuffle.rs +++ b/tests/ui/simd/intrinsic/generic-shuffle.rs @@ -3,16 +3,14 @@ // Test that the simd_shuffle intrinsic produces ok-ish error // messages when misused. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] + +use std::intrinsics::simd::simd_shuffle; #[repr(simd)] #[derive(Copy, Clone)] pub struct Simd([T; N]); -#[rustc_intrinsic] -unsafe fn simd_shuffle(a: T, b: T, i: I) -> U; - - fn main() { const I: Simd = Simd([0; 2]); const I2: Simd = Simd([0.; 2]); diff --git a/tests/ui/simd/intrinsic/generic-shuffle.stderr b/tests/ui/simd/intrinsic/generic-shuffle.stderr index 7e6d51a5f6555..e8cd528b70200 100644 --- a/tests/ui/simd/intrinsic/generic-shuffle.stderr +++ b/tests/ui/simd/intrinsic/generic-shuffle.stderr @@ -1,23 +1,23 @@ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `[u32; 2]` - --> $DIR/generic-shuffle.rs:24:31 + --> $DIR/generic-shuffle.rs:22:31 | LL | let _: Simd = simd_shuffle(v, v, const { [0u32; 2] }); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return type of length 2, found `Simd` with length 4 - --> $DIR/generic-shuffle.rs:27:31 + --> $DIR/generic-shuffle.rs:25:31 | LL | let _: Simd = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: expected return element type `u32` (element of input `Simd`), found `Simd` with element type `f32` - --> $DIR/generic-shuffle.rs:30:31 + --> $DIR/generic-shuffle.rs:28:31 | LL | let _: Simd = simd_shuffle(v, v, I); | ^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_shuffle` intrinsic: simd_shuffle index must be a SIMD vector of `u32`, got `Simd` - --> $DIR/generic-shuffle.rs:33:31 + --> $DIR/generic-shuffle.rs:31:31 | LL | let _: Simd = simd_shuffle(v, v, I2); | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs index b324ac40749fa..49a26ff57341c 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557-ice.rs @@ -3,10 +3,9 @@ // //@ run-pass //@ compile-flags: -Zmir-opt-level=4 -#![feature(intrinsics, repr_simd)] +#![feature(core_intrinsics, repr_simd)] -#[rustc_intrinsic] -unsafe fn simd_shuffle(x: T, y: T, idx: I) -> U; +use std::intrinsics::simd::simd_shuffle; #[repr(simd)] #[derive(Debug, PartialEq)] diff --git a/tests/ui/simd/intrinsic/inlining-issue67557.rs b/tests/ui/simd/intrinsic/inlining-issue67557.rs index 319bb15c01570..13e7266b2a561 100644 --- a/tests/ui/simd/intrinsic/inlining-issue67557.rs +++ b/tests/ui/simd/intrinsic/inlining-issue67557.rs @@ -3,10 +3,9 @@ // //@ run-pass //@ compile-flags: -Zmir-opt-level=4 -#![feature(intrinsics, repr_simd)] +#![feature(core_intrinsics, repr_simd)] -#[rustc_intrinsic] -unsafe fn simd_shuffle(x: T, y: T, idx: I) -> U; +use std::intrinsics::simd::simd_shuffle; #[repr(simd)] #[derive(Debug, PartialEq)] @@ -36,7 +35,6 @@ fn assert_10_13(x: Simd2) { assert_eq!(x, Simd2([10, 13])); } - #[inline(always)] unsafe fn inline_me() -> Simd2 { const IDX: SimdShuffleIdx<2> = SimdShuffleIdx([0, 3]); diff --git a/tests/ui/simd/intrinsic/issue-85855.rs b/tests/ui/simd/intrinsic/issue-85855.rs index daeea793d1bce..cbaa8f046bee3 100644 --- a/tests/ui/simd/intrinsic/issue-85855.rs +++ b/tests/ui/simd/intrinsic/issue-85855.rs @@ -3,8 +3,7 @@ // that no ICE occurs in these cases. #![feature(intrinsics)] -#![crate_type="lib"] - +#![crate_type = "lib"] #[rustc_intrinsic] unsafe fn simd_saturating_add<'a, T: 'a>(x: T, y: T); diff --git a/tests/ui/simd/intrinsic/issue-85855.stderr b/tests/ui/simd/intrinsic/issue-85855.stderr index b91a606ba68a1..af61c6fcdc135 100644 --- a/tests/ui/simd/intrinsic/issue-85855.stderr +++ b/tests/ui/simd/intrinsic/issue-85855.stderr @@ -1,17 +1,17 @@ error[E0094]: intrinsic has wrong number of lifetime parameters: found 1, expected 0 - --> $DIR/issue-85855.rs:10:30 + --> $DIR/issue-85855.rs:9:30 | LL | unsafe fn simd_saturating_add<'a, T: 'a>(x: T, y: T); | ^^^^^^^^^^^ expected 0 lifetime parameters error[E0094]: intrinsic has wrong number of type parameters: found 2, expected 1 - --> $DIR/issue-85855.rs:17:19 + --> $DIR/issue-85855.rs:16:19 | LL | unsafe fn simd_sub(x: T, y: U); | ^^^^^^ expected 1 type parameter error[E0094]: intrinsic has wrong number of const parameters: found 1, expected 0 - --> $DIR/issue-85855.rs:21:19 + --> $DIR/issue-85855.rs:20:19 | LL | unsafe fn simd_mul(x: T, y: T); | ^^^^^^^^^^^^^^^^^^^ expected 0 const parameters diff --git a/tests/ui/simd/intrinsic/ptr-cast.rs b/tests/ui/simd/intrinsic/ptr-cast.rs index 559b8ba1b5c2d..3a73c0273e1a7 100644 --- a/tests/ui/simd/intrinsic/ptr-cast.rs +++ b/tests/ui/simd/intrinsic/ptr-cast.rs @@ -1,16 +1,8 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_cast_ptr(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_expose_provenance(x: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_with_exposed_provenance(x: T) -> U; +use std::intrinsics::simd::{simd_cast_ptr, simd_expose_provenance, simd_with_exposed_provenance}; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/simd/issue-105439.rs b/tests/ui/simd/issue-105439.rs index 108bb282df2af..0a44f36fb2ec9 100644 --- a/tests/ui/simd/issue-105439.rs +++ b/tests/ui/simd/issue-105439.rs @@ -1,17 +1,13 @@ //@ run-pass //@ compile-flags: -O -Zverify-llvm-ir -#![feature(repr_simd)] -#![feature(intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[allow(non_camel_case_types)] #[derive(Clone, Copy)] #[repr(simd)] struct i32x4([i32; 4]); -#[rustc_intrinsic] -pub(crate) unsafe fn simd_add(x: T, y: T) -> T; - #[inline(always)] fn to_array(a: i32x4) -> [i32; 4] { a.0 @@ -19,6 +15,6 @@ fn to_array(a: i32x4) -> [i32; 4] { fn main() { let a = i32x4([1, 2, 3, 4]); - let b = unsafe { simd_add(a, a) }; + let b = unsafe { std::intrinsics::simd::simd_add(a, a) }; assert_eq!(to_array(b), [2, 4, 6, 8]); } diff --git a/tests/ui/simd/issue-39720.rs b/tests/ui/simd/issue-39720.rs index c3c4750d6debe..db441e5516793 100644 --- a/tests/ui/simd/issue-39720.rs +++ b/tests/ui/simd/issue-39720.rs @@ -1,6 +1,6 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #[repr(simd)] #[derive(Copy, Clone, Debug)] @@ -10,11 +10,8 @@ pub struct Char3(pub [i8; 3]); #[derive(Copy, Clone, Debug)] pub struct Short3(pub [i16; 3]); -#[rustc_intrinsic] -unsafe fn simd_cast(x: T) -> U; - fn main() { - let cast: Short3 = unsafe { simd_cast(Char3([10, -3, -9])) }; + let cast: Short3 = unsafe { std::intrinsics::simd::simd_cast(Char3([10, -3, -9])) }; println!("{:?}", cast); } diff --git a/tests/ui/simd/issue-85915-simd-ptrs.rs b/tests/ui/simd/issue-85915-simd-ptrs.rs index 2e7baf48ee326..4e2379d052510 100644 --- a/tests/ui/simd/issue-85915-simd-ptrs.rs +++ b/tests/ui/simd/issue-85915-simd-ptrs.rs @@ -3,9 +3,11 @@ // Short form of the generic gather/scatter tests, // verifying simd([*const T; N]) and simd([*mut T; N]) pass typeck and work. -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::{simd_gather, simd_scatter}; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct cptrx4([*const T; 4]); @@ -22,13 +24,6 @@ struct f32x4([f32; 4]); #[derive(Copy, Clone, PartialEq, Debug)] struct i32x4([i32; 4]); - -#[rustc_intrinsic] -unsafe fn simd_gather(x: T, y: U, z: V) -> T; - -#[rustc_intrinsic] -unsafe fn simd_scatter(x: T, y: U, z: V) -> (); - fn main() { let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; @@ -39,11 +34,11 @@ fn main() { // reading from *const unsafe { let pointer = &x as *const f32; - let pointers = cptrx4([ + let pointers = cptrx4([ pointer.offset(0) as *const f32, pointer.offset(2), pointer.offset(4), - pointer.offset(6) + pointer.offset(6), ]); let r_strided = simd_gather(default, pointers, mask); @@ -58,7 +53,7 @@ fn main() { pointer.offset(0) as *mut f32, pointer.offset(2), pointer.offset(4), - pointer.offset(6) + pointer.offset(6), ]); let values = f32x4([42_f32, 43_f32, 44_f32, 45_f32]); diff --git a/tests/ui/simd/issue-89193.rs b/tests/ui/simd/issue-89193.rs index 4b4fb9d916968..a6c3017572a19 100644 --- a/tests/ui/simd/issue-89193.rs +++ b/tests/ui/simd/issue-89193.rs @@ -3,16 +3,15 @@ // Test that simd gather instructions on slice of usize don't cause crash // See issue #89183 - https://github.com/rust-lang/rust/issues/89193 -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_gather; + #[repr(simd)] #[derive(Copy, Clone, PartialEq, Debug)] struct x4(pub [T; 4]); -#[rustc_intrinsic] -unsafe fn simd_gather(x: T, y: U, z: V) -> T; - fn main() { let x: [usize; 4] = [10, 11, 12, 13]; let default = x4([0_usize, 1, 2, 3]); @@ -22,12 +21,8 @@ fn main() { unsafe { let pointer = x.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(1), - pointer.offset(2), - pointer.offset(3) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(1), pointer.offset(2), pointer.offset(3)]); let result = simd_gather(default, pointers, mask); assert_eq!(result, expected); } @@ -39,12 +34,8 @@ fn main() { unsafe { let pointer = x.as_ptr(); - let pointers = x4([ - pointer.offset(0), - pointer.offset(1), - pointer.offset(2), - pointer.offset(3) - ]); + let pointers = + x4([pointer.offset(0), pointer.offset(1), pointer.offset(2), pointer.offset(3)]); let result = simd_gather(default, pointers, mask); assert_eq!(result, expected); } diff --git a/tests/ui/simd/masked-load-store-build-fail.rs b/tests/ui/simd/masked-load-store-build-fail.rs index b8742184eb02c..ad2de5561033f 100644 --- a/tests/ui/simd/masked-load-store-build-fail.rs +++ b/tests/ui/simd/masked-load-store-build-fail.rs @@ -1,12 +1,7 @@ //@ build-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_masked_store(mask: M, pointer: P, values: T) -> (); +use std::intrinsics::simd::{simd_masked_load, simd_masked_store}; #[derive(Copy, Clone)] #[repr(simd)] @@ -17,60 +12,28 @@ fn main() { let mut arr = [4u8, 5, 6, 7]; let default = Simd::([9; 4]); - simd_masked_load( - Simd::([-1, 0, -1, -1, 0, 0, 0, 0]), - arr.as_ptr(), - default - ); - //~^^^^^ ERROR expected third argument with length 8 (same as input type `Simd`), found `Simd` with length 4 + simd_masked_load(Simd::([-1, 0, -1, -1, 0, 0, 0, 0]), arr.as_ptr(), default); + //~^ ERROR expected third argument with length 8 (same as input type `Simd`), found `Simd` with length 4 - simd_masked_load( - Simd::([-1, 0, -1, -1]), - arr.as_ptr() as *const i8, - default - ); - //~^^^^^ ERROR expected element type `u8` of second argument `*const i8` to be a pointer to the element type `u8` of the first argument `Simd`, found `u8` != `*_ u8` + simd_masked_load(Simd::([-1, 0, -1, -1]), arr.as_ptr() as *const i8, default); + //~^ ERROR expected element type `u8` of second argument `*const i8` to be a pointer to the element type `u8` of the first argument `Simd`, found `u8` != `*_ u8` - simd_masked_load( - Simd::([-1, 0, -1, -1]), - arr.as_ptr(), - Simd::([9; 4]) - ); - //~^^^^^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd`, found `u32` != `*_ u32` + simd_masked_load(Simd::([-1, 0, -1, -1]), arr.as_ptr(), Simd::([9; 4])); + //~^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd`, found `u32` != `*_ u32` - simd_masked_load( - Simd::([1, 0, 1, 1]), - arr.as_ptr(), - default - ); - //~^^^^^ ERROR expected element type `u8` of third argument `Simd` to be a signed integer type + simd_masked_load(Simd::([1, 0, 1, 1]), arr.as_ptr(), default); + //~^ ERROR expected element type `u8` of third argument `Simd` to be a signed integer type - simd_masked_store( - Simd([-1i8; 4]), - arr.as_ptr(), - Simd([5u32; 4]) - ); - //~^^^^^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd`, found `u32` != `*mut u32` + simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u32; 4])); + //~^ ERROR expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd`, found `u32` != `*mut u32` - simd_masked_store( - Simd([-1i8; 4]), - arr.as_ptr(), - Simd([5u8; 4]) - ); - //~^^^^^ ERROR expected element type `u8` of second argument `*const u8` to be a pointer to the element type `u8` of the first argument `Simd`, found `u8` != `*mut u8` + simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u8; 4])); + //~^ ERROR expected element type `u8` of second argument `*const u8` to be a pointer to the element type `u8` of the first argument `Simd`, found `u8` != `*mut u8` - simd_masked_store( - Simd([-1i8; 4]), - arr.as_mut_ptr(), - Simd([5u8; 2]) - ); - //~^^^^^ ERROR expected third argument with length 4 (same as input type `Simd`), found `Simd` with length 2 + simd_masked_store(Simd([-1i8; 4]), arr.as_mut_ptr(), Simd([5u8; 2])); + //~^ ERROR expected third argument with length 4 (same as input type `Simd`), found `Simd` with length 2 - simd_masked_store( - Simd([1u32; 4]), - arr.as_mut_ptr(), - Simd([5u8; 4]) - ); - //~^^^^^ ERROR expected element type `u8` of third argument `Simd` to be a signed integer type + simd_masked_store(Simd([1u32; 4]), arr.as_mut_ptr(), Simd([5u8; 4])); + //~^ ERROR expected element type `u8` of third argument `Simd` to be a signed integer type } } diff --git a/tests/ui/simd/masked-load-store-build-fail.stderr b/tests/ui/simd/masked-load-store-build-fail.stderr index 8a8d8eb99e278..d57e0aa539f58 100644 --- a/tests/ui/simd/masked-load-store-build-fail.stderr +++ b/tests/ui/simd/masked-load-store-build-fail.stderr @@ -1,82 +1,50 @@ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected third argument with length 8 (same as input type `Simd`), found `Simd` with length 4 - --> $DIR/masked-load-store-build-fail.rs:20:9 + --> $DIR/masked-load-store-build-fail.rs:15:9 | -LL | / simd_masked_load( -LL | | Simd::([-1, 0, -1, -1, 0, 0, 0, 0]), -LL | | arr.as_ptr(), -LL | | default -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::([-1, 0, -1, -1, 0, 0, 0, 0]), arr.as_ptr(), default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u8` of second argument `*const i8` to be a pointer to the element type `u8` of the first argument `Simd`, found `u8` != `*_ u8` - --> $DIR/masked-load-store-build-fail.rs:27:9 + --> $DIR/masked-load-store-build-fail.rs:18:9 | -LL | / simd_masked_load( -LL | | Simd::([-1, 0, -1, -1]), -LL | | arr.as_ptr() as *const i8, -LL | | default -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::([-1, 0, -1, -1]), arr.as_ptr() as *const i8, default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd`, found `u32` != `*_ u32` - --> $DIR/masked-load-store-build-fail.rs:34:9 + --> $DIR/masked-load-store-build-fail.rs:21:9 | -LL | / simd_masked_load( -LL | | Simd::([-1, 0, -1, -1]), -LL | | arr.as_ptr(), -LL | | Simd::([9; 4]) -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::([-1, 0, -1, -1]), arr.as_ptr(), Simd::([9; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_load` intrinsic: expected element type `u8` of third argument `Simd` to be a signed integer type - --> $DIR/masked-load-store-build-fail.rs:41:9 + --> $DIR/masked-load-store-build-fail.rs:24:9 | -LL | / simd_masked_load( -LL | | Simd::([1, 0, 1, 1]), -LL | | arr.as_ptr(), -LL | | default -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::([1, 0, 1, 1]), arr.as_ptr(), default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u32` of second argument `*const u8` to be a pointer to the element type `u32` of the first argument `Simd`, found `u32` != `*mut u32` - --> $DIR/masked-load-store-build-fail.rs:48:9 + --> $DIR/masked-load-store-build-fail.rs:27:9 | -LL | / simd_masked_store( -LL | | Simd([-1i8; 4]), -LL | | arr.as_ptr(), -LL | | Simd([5u32; 4]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u32; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u8` of second argument `*const u8` to be a pointer to the element type `u8` of the first argument `Simd`, found `u8` != `*mut u8` - --> $DIR/masked-load-store-build-fail.rs:55:9 + --> $DIR/masked-load-store-build-fail.rs:30:9 | -LL | / simd_masked_store( -LL | | Simd([-1i8; 4]), -LL | | arr.as_ptr(), -LL | | Simd([5u8; 4]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([-1i8; 4]), arr.as_ptr(), Simd([5u8; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected third argument with length 4 (same as input type `Simd`), found `Simd` with length 2 - --> $DIR/masked-load-store-build-fail.rs:62:9 + --> $DIR/masked-load-store-build-fail.rs:33:9 | -LL | / simd_masked_store( -LL | | Simd([-1i8; 4]), -LL | | arr.as_mut_ptr(), -LL | | Simd([5u8; 2]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([-1i8; 4]), arr.as_mut_ptr(), Simd([5u8; 2])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0511]: invalid monomorphization of `simd_masked_store` intrinsic: expected element type `u8` of third argument `Simd` to be a signed integer type - --> $DIR/masked-load-store-build-fail.rs:69:9 + --> $DIR/masked-load-store-build-fail.rs:36:9 | -LL | / simd_masked_store( -LL | | Simd([1u32; 4]), -LL | | arr.as_mut_ptr(), -LL | | Simd([5u8; 4]) -LL | | ); - | |_________^ +LL | simd_masked_store(Simd([1u32; 4]), arr.as_mut_ptr(), Simd([5u8; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 8 previous errors diff --git a/tests/ui/simd/masked-load-store-check-fail.rs b/tests/ui/simd/masked-load-store-check-fail.rs index 0f36bf6443f9b..3ed47cd9ed40b 100644 --- a/tests/ui/simd/masked-load-store-check-fail.rs +++ b/tests/ui/simd/masked-load-store-check-fail.rs @@ -1,11 +1,7 @@ //@ check-fail -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -#[rustc_intrinsic] -unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_masked_store(mask: M, pointer: P, values: T) -> (); +use std::intrinsics::simd::{simd_masked_load, simd_masked_store}; #[derive(Copy, Clone)] #[repr(simd)] @@ -16,18 +12,11 @@ fn main() { let mut arr = [4u8, 5, 6, 7]; let default = Simd::([9; 4]); - let _x: Simd = simd_masked_load( - Simd::([-1, 0, -1, -1]), - arr.as_ptr(), - Simd::([9; 4]) - ); - //~^^ ERROR mismatched types + let _x: Simd = + simd_masked_load(Simd::([-1, 0, -1, -1]), arr.as_ptr(), Simd::([9; 4])); + //~^ ERROR mismatched types - let _x: Simd = simd_masked_load( - Simd::([1, 0, 1, 1]), - arr.as_ptr(), - default - ); - //~^^ ERROR mismatched types + let _x: Simd = simd_masked_load(Simd::([1, 0, 1, 1]), arr.as_ptr(), default); + //~^ ERROR mismatched types } } diff --git a/tests/ui/simd/masked-load-store-check-fail.stderr b/tests/ui/simd/masked-load-store-check-fail.stderr index fa65798fc94d3..1c9f9d246df50 100644 --- a/tests/ui/simd/masked-load-store-check-fail.stderr +++ b/tests/ui/simd/masked-load-store-check-fail.stderr @@ -1,58 +1,38 @@ error[E0308]: mismatched types - --> $DIR/masked-load-store-check-fail.rs:22:13 + --> $DIR/masked-load-store-check-fail.rs:16:76 | -LL | let _x: Simd = simd_masked_load( - | ---------------- arguments to this function are incorrect -... -LL | Simd::([9; 4]) - | ^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `4` +LL | simd_masked_load(Simd::([-1, 0, -1, -1]), arr.as_ptr(), Simd::([9; 4])); + | ---------------- arguments to this function are incorrect ^^^^^^^^^^^^^^^^^^^^^ expected `2`, found `4` | = note: expected struct `Simd<_, 2>` found struct `Simd<_, 4>` help: the return type of this call is `Simd` due to the type of the argument passed - --> $DIR/masked-load-store-check-fail.rs:19:31 + --> $DIR/masked-load-store-check-fail.rs:16:13 | -LL | let _x: Simd = simd_masked_load( - | _______________________________^ -LL | | Simd::([-1, 0, -1, -1]), -LL | | arr.as_ptr(), -LL | | Simd::([9; 4]) - | | --------------------- this argument influences the return type of `simd_masked_load` -LL | | ); - | |_________^ +LL | simd_masked_load(Simd::([-1, 0, -1, -1]), arr.as_ptr(), Simd::([9; 4])); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------^ + | | + | this argument influences the return type of `simd_masked_load` note: function defined here - --> $DIR/masked-load-store-check-fail.rs:5:11 - | -LL | unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; - | ^^^^^^^^^^^^^^^^ --------- + --> $SRC_DIR/core/src/intrinsics/simd.rs:LL:COL error[E0308]: mismatched types - --> $DIR/masked-load-store-check-fail.rs:29:13 + --> $DIR/masked-load-store-check-fail.rs:19:92 | -LL | let _x: Simd = simd_masked_load( - | ---------------- arguments to this function are incorrect -... -LL | default - | ^^^^^^^ expected `Simd`, found `Simd` +LL | let _x: Simd = simd_masked_load(Simd::([1, 0, 1, 1]), arr.as_ptr(), default); + | ---------------- arguments to this function are incorrect ^^^^^^^ expected `Simd`, found `Simd` | = note: expected struct `Simd` found struct `Simd` help: the return type of this call is `Simd` due to the type of the argument passed - --> $DIR/masked-load-store-check-fail.rs:26:32 + --> $DIR/masked-load-store-check-fail.rs:19:32 | -LL | let _x: Simd = simd_masked_load( - | ________________________________^ -LL | | Simd::([1, 0, 1, 1]), -LL | | arr.as_ptr(), -LL | | default - | | ------- this argument influences the return type of `simd_masked_load` -LL | | ); - | |_________^ +LL | let _x: Simd = simd_masked_load(Simd::([1, 0, 1, 1]), arr.as_ptr(), default); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------^ + | | + | this argument influences the return type of `simd_masked_load` note: function defined here - --> $DIR/masked-load-store-check-fail.rs:5:11 - | -LL | unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; - | ^^^^^^^^^^^^^^^^ --------- + --> $SRC_DIR/core/src/intrinsics/simd.rs:LL:COL error: aborting due to 2 previous errors diff --git a/tests/ui/simd/masked-load-store.rs b/tests/ui/simd/masked-load-store.rs index 4b4195f51f186..69ea76581ee69 100644 --- a/tests/ui/simd/masked-load-store.rs +++ b/tests/ui/simd/masked-load-store.rs @@ -1,11 +1,7 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] -#[rustc_intrinsic] -unsafe fn simd_masked_load(mask: M, pointer: P, values: T) -> T; - -#[rustc_intrinsic] -unsafe fn simd_masked_store(mask: M, pointer: P, values: T) -> (); +use std::intrinsics::simd::{simd_masked_load, simd_masked_store}; #[derive(Copy, Clone)] #[repr(simd)] @@ -16,11 +12,8 @@ fn main() { let a = Simd::([0, 1, 2, 3]); let b_src = [4u8, 5, 6, 7]; let b_default = Simd::([9; 4]); - let b: Simd:: = simd_masked_load( - Simd::([-1, 0, -1, -1]), - b_src.as_ptr(), - b_default - ); + let b: Simd = + simd_masked_load(Simd::([-1, 0, -1, -1]), b_src.as_ptr(), b_default); assert_eq!(&b.0, &[4, 9, 6, 7]); diff --git a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr index 8d4bf1e0533ac..b0742bc5ef806 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.generic.stderr +++ b/tests/ui/simd/monomorphize-shuffle-index.generic.stderr @@ -1,5 +1,5 @@ error: overly complex generic constant - --> $DIR/monomorphize-shuffle-index.rs:32:51 + --> $DIR/monomorphize-shuffle-index.rs:36:51 | LL | return simd_shuffle_const_generic::<_, _, { &Self::I.0 }>(a, b); | ^^----------^^ diff --git a/tests/ui/simd/monomorphize-shuffle-index.rs b/tests/ui/simd/monomorphize-shuffle-index.rs index 026193e6af6a7..3a074dfd432c2 100644 --- a/tests/ui/simd/monomorphize-shuffle-index.rs +++ b/tests/ui/simd/monomorphize-shuffle-index.rs @@ -1,19 +1,23 @@ +//@ revisions: old generic generic_with_fn //@[old]run-pass //@[generic_with_fn]run-pass -//@ revisions: old generic generic_with_fn -#![feature(repr_simd, intrinsics, adt_const_params, unsized_const_params, generic_const_exprs)] +#![feature( + repr_simd, + core_intrinsics, + intrinsics, + adt_const_params, + unsized_const_params, + generic_const_exprs +)] #![allow(incomplete_features)] - -#[rustc_intrinsic] #[cfg(old)] -unsafe fn simd_shuffle(a: T, b: T, i: I) -> U; +use std::intrinsics::simd::simd_shuffle; -#[rustc_intrinsic] #[cfg(any(generic, generic_with_fn))] +#[rustc_intrinsic] unsafe fn simd_shuffle_const_generic(a: T, b: T) -> U; - #[derive(Copy, Clone)] #[repr(simd)] struct Simd([T; N]); diff --git a/tests/ui/simd/repr_packed.rs b/tests/ui/simd/repr_packed.rs index a666892226eaa..cc54477ae7134 100644 --- a/tests/ui/simd/repr_packed.rs +++ b/tests/ui/simd/repr_packed.rs @@ -1,8 +1,10 @@ //@ run-pass -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(non_camel_case_types)] +use std::intrinsics::simd::simd_add; + #[repr(simd, packed)] struct Simd([T; N]); @@ -22,9 +24,6 @@ fn check_ty() { check_size_align::(); } -#[rustc_intrinsic] -unsafe fn simd_add(a: T, b: T) -> T; - fn main() { check_ty::(); check_ty::(); diff --git a/tests/ui/simd/shuffle.rs b/tests/ui/simd/shuffle.rs index 2cae5a1e7de2a..cd270edcf00ca 100644 --- a/tests/ui/simd/shuffle.rs +++ b/tests/ui/simd/shuffle.rs @@ -2,14 +2,13 @@ //@ revisions: opt noopt //@[noopt] compile-flags: -Copt-level=0 //@[opt] compile-flags: -O -#![feature(repr_simd, intrinsics)] +#![feature(repr_simd, core_intrinsics)] #![allow(incomplete_features)] #![feature(adt_const_params)] use std::marker::ConstParamTy; -#[rustc_intrinsic] -unsafe fn simd_shuffle(a: T, b: T, i: I) -> U; +use std::intrinsics::simd::simd_shuffle; #[derive(Copy, Clone, ConstParamTy, PartialEq, Eq)] #[repr(simd)] diff --git a/tests/ui/simd/simd-bitmask-notpow2.rs b/tests/ui/simd/simd-bitmask-notpow2.rs index d7572ef4a2a4d..4935097065ea7 100644 --- a/tests/ui/simd/simd-bitmask-notpow2.rs +++ b/tests/ui/simd/simd-bitmask-notpow2.rs @@ -2,14 +2,9 @@ // FIXME: broken codegen on big-endian (https://github.com/rust-lang/rust/issues/127205) // This should be merged into `simd-bitmask` once that's fixed. //@ ignore-endian-big -#![feature(repr_simd, intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_bitmask(v: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask(m: T, a: U, b: U) -> U; +#![feature(repr_simd, core_intrinsics)] +use std::intrinsics::simd::{simd_bitmask, simd_select_bitmask}; fn main() { // Non-power-of-2 multi-byte mask. diff --git a/tests/ui/simd/simd-bitmask.rs b/tests/ui/simd/simd-bitmask.rs index 4275ab0f40c9d..6fcceeaa24bb3 100644 --- a/tests/ui/simd/simd-bitmask.rs +++ b/tests/ui/simd/simd-bitmask.rs @@ -1,12 +1,7 @@ //@run-pass -#![feature(repr_simd, intrinsics)] - -#[rustc_intrinsic] -unsafe fn simd_bitmask(v: T) -> U; - -#[rustc_intrinsic] -unsafe fn simd_select_bitmask(m: T, a: U, b: U) -> U; +#![feature(repr_simd, core_intrinsics)] +use std::intrinsics::simd::{simd_bitmask, simd_select_bitmask}; #[derive(Copy, Clone)] #[repr(simd)] diff --git a/tests/ui/static/static_sized_requirement.rs b/tests/ui/static/static_sized_requirement.rs index 80f93dea0544e..25e1359607c9b 100644 --- a/tests/ui/static/static_sized_requirement.rs +++ b/tests/ui/static/static_sized_requirement.rs @@ -1,11 +1,12 @@ -//@ build-pass (FIXME(62277): could be check-pass?) +//@ add-core-stubs +//@ check-pass #![feature(no_core, lang_items)] #![no_core] #![crate_type = "lib"] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; extern "C" { pub static A: u32; diff --git a/tests/ui/target-feature/no-llvm-leaks.rs b/tests/ui/target-feature/no-llvm-leaks.rs index d4f70fe706940..50544b97a96dc 100644 --- a/tests/ui/target-feature/no-llvm-leaks.rs +++ b/tests/ui/target-feature/no-llvm-leaks.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: aarch64 x86-64 //@ [aarch64] compile-flags: -Ctarget-feature=+neon,+fp16,+fhm --target=aarch64-unknown-linux-gnu //@ [aarch64] needs-llvm-components: aarch64 @@ -9,12 +10,8 @@ #![feature(intrinsics, rustc_attrs, no_core, lang_items, staged_api)] #![stable(feature = "test", since = "1.0.0")] -// Supporting minimal rust core code -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} -impl Copy for bool {} +extern crate minicore; +use minicore::*; #[stable(feature = "test", since = "1.0.0")] #[rustc_const_stable(feature = "test", since = "1.0.0")] diff --git a/tests/ui/target-feature/tied-features.rs b/tests/ui/target-feature/tied-features.rs index c6cdf21a3e3f7..9aa5291e68cba 100644 --- a/tests/ui/target-feature/tied-features.rs +++ b/tests/ui/target-feature/tied-features.rs @@ -1,10 +1,11 @@ +//@ add-core-stubs //@ compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu //@ needs-llvm-components: aarch64 #![feature(no_core, lang_items)] #![no_core] -#[lang="sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn main() { #[target_feature(enable = "pacg")] diff --git a/tests/ui/target-feature/tied-features.stderr b/tests/ui/target-feature/tied-features.stderr index 8d677735e8460..49df4f109ba70 100644 --- a/tests/ui/target-feature/tied-features.stderr +++ b/tests/ui/target-feature/tied-features.stderr @@ -1,5 +1,5 @@ error: the target features paca, pacg must all be either enabled or disabled together - --> $DIR/tied-features.rs:10:5 + --> $DIR/tied-features.rs:11:5 | LL | #[target_feature(enable = "pacg")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[target_feature(enable = "pacg")] = help: add the missing features in a `target_feature` attribute error: the target features paca, pacg must all be either enabled or disabled together - --> $DIR/tied-features.rs:22:1 + --> $DIR/tied-features.rs:23:1 | LL | #[target_feature(enable = "paca")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[target_feature(enable = "paca")] = help: add the missing features in a `target_feature` attribute error: the target features paca, pacg must all be either enabled or disabled together - --> $DIR/tied-features.rs:35:1 + --> $DIR/tied-features.rs:36:1 | LL | #[target_feature(enable = "paca")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type/pattern_types/nested.rs b/tests/ui/type/pattern_types/nested.rs index 9ca9c7923dedd..0d8cd22190e55 100644 --- a/tests/ui/type/pattern_types/nested.rs +++ b/tests/ui/type/pattern_types/nested.rs @@ -18,10 +18,12 @@ const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); //~^ ERROR: not a valid base type for range patterns +//~| ERROR: not a valid base type for range patterns //~| ERROR: mismatched types const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); //~^ ERROR: not a valid base type for range patterns +//~| ERROR: not a valid base type for range patterns //~| ERROR: mismatched types const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); diff --git a/tests/ui/type/pattern_types/nested.stderr b/tests/ui/type/pattern_types/nested.stderr index b753b0a9c9baa..f79d12bc3f376 100644 --- a/tests/ui/type/pattern_types/nested.stderr +++ b/tests/ui/type/pattern_types/nested.stderr @@ -1,96 +1,184 @@ -error: `(u32) is 1..=` is not a valid base type for range patterns - --> $DIR/nested.rs:10:34 +error[E0308]: mismatched types + --> $DIR/nested.rs:10:63 | LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ expected `(u32) is 1..`, found integer | -note: range patterns only support integers - --> $DIR/nested.rs:10:63 + = note: expected pattern type `(u32) is 1..` + found type `{integer}` + +error[E0277]: `(u32) is 1..` is not a valid base type for range patterns + --> $DIR/nested.rs:10:34 | LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); - | ^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(u32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others -error: `(i32) is 1..=` is not a valid base type for range patterns +error[E0277]: `(i32) is 1..` is not a valid base type for range patterns --> $DIR/nested.rs:15:35 | LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: range patterns only support integers - --> $DIR/nested.rs:15:64 + | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(i32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others + +error[E0308]: mismatched types + --> $DIR/nested.rs:15:67 | LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); - | ^^^^^ + | ^^ expected `(i32) is 1..`, found integer + | + = note: expected pattern type `(i32) is 1..` + found type `{integer}` -error: `(i32) is 1..=` is not a valid base type for range patterns +error[E0277]: `(i32) is 1..` is not a valid base type for range patterns --> $DIR/nested.rs:19:35 | LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: range patterns only support integers - --> $DIR/nested.rs:19:64 - | -LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); - | ^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(i32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others -error: `()` is not a valid base type for range patterns - --> $DIR/nested.rs:23:35 +error[E0308]: mismatched types + --> $DIR/nested.rs:19:66 | -LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); - | ^^ +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^ + | | + | expected `(i32) is 1..`, found integer + | arguments to this function are incorrect | -note: range patterns only support integers - --> $DIR/nested.rs:23:41 + = note: expected pattern type `(i32) is 1..` + found type `{integer}` +help: the return type of this call is `{integer}` due to the type of the argument passed + --> $DIR/nested.rs:19:66 | -LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); - | ^^^ +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^ this argument influences the return type of `RangeSub` +note: method defined here + --> $SRC_DIR/core/src/pat.rs:LL:COL -error: `f32` is not a valid base type for range patterns - --> $DIR/nested.rs:27:35 - | -LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); - | ^^^ - | -note: range patterns only support integers - --> $DIR/nested.rs:27:42 +error[E0277]: `(i32) is 1..` is not a valid base type for range patterns + --> $DIR/nested.rs:19:66 | -LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); - | ^^^^^^^^^^ +LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); + | ^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `(i32) is 1..` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others -error[E0308]: mismatched types - --> $DIR/nested.rs:10:63 +error[E0277]: `()` is not a valid base type for range patterns + --> $DIR/nested.rs:24:35 | -LL | const BAD_NESTING: pattern_type!(pattern_type!(u32 is 1..) is 0..) = todo!(); - | ^ expected `(u32) is 1..=`, found integer - | - = note: expected pattern type `(u32) is 1..=` - found type `{integer}` +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `()` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others error[E0308]: mismatched types - --> $DIR/nested.rs:15:67 - | -LL | const BAD_NESTING2: pattern_type!(pattern_type!(i32 is 1..) is ..=-1) = todo!(); - | ^^ expected `(i32) is 1..=`, found integer + --> $DIR/nested.rs:24:43 | - = note: expected pattern type `(i32) is 1..=` - found type `{integer}` - -error[E0308]: mismatched types - --> $DIR/nested.rs:19:66 +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^ + | | + | expected `()`, found integer + | arguments to this function are incorrect | -LL | const BAD_NESTING3: pattern_type!(pattern_type!(i32 is 1..) is ..0) = todo!(); - | ^ expected `(i32) is 1..=`, found integer +help: the return type of this call is `{integer}` due to the type of the argument passed + --> $DIR/nested.rs:24:43 | - = note: expected pattern type `(i32) is 1..=` - found type `{integer}` +LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); + | ^ this argument influences the return type of `RangeSub` +note: method defined here + --> $SRC_DIR/core/src/pat.rs:LL:COL -error[E0308]: mismatched types - --> $DIR/nested.rs:23:43 +error[E0277]: `()` is not a valid base type for range patterns + --> $DIR/nested.rs:24:43 | LL | const BAD_NESTING4: pattern_type!(() is ..0) = todo!(); - | ^ expected `()`, found integer + | ^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `()` + = help: the following other types implement trait `core::pat::RangePattern`: + char + i128 + i16 + i32 + i64 + i8 + isize + u128 + and 5 others + +error[E0277]: `f32` is not a valid base type for range patterns + --> $DIR/nested.rs:29:49 + | +LL | const BAD_NESTING5: pattern_type!(f32 is 1.0 .. 2.0) = todo!(); + | ^^^ only integer types and `char` are supported + | + = help: the trait `core::pat::RangePattern` is not implemented for `f32` + = help: the following other types implement trait `core::pat::RangePattern`: + i128 + i16 + i32 + i64 + i8 + isize + u128 + u16 + and 4 others -error: aborting due to 9 previous errors +error: aborting due to 11 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0277, E0308. +For more information about an error, try `rustc --explain E0277`. diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr index 690592ba0b8da..512181c22d535 100644 --- a/tests/ui/type/pattern_types/range_patterns.stderr +++ b/tests/ui/type/pattern_types/range_patterns.stderr @@ -44,7 +44,7 @@ error: layout_of(NonZero) = Layout { LL | type X = std::num::NonZeroU32; | ^^^^^^ -error: layout_of((u32) is 1..=) = Layout { +error: layout_of((u32) is 1..) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), @@ -83,7 +83,7 @@ error: layout_of((u32) is 1..=) = Layout { LL | type Y = pattern_type!(u32 is 1..); | ^^^^^^ -error: layout_of(Option<(u32) is 1..=>) = Layout { +error: layout_of(Option<(u32) is 1..>) = Layout { size: Size(4 bytes), align: AbiAndPrefAlign { abi: Align(4 bytes), diff --git a/tests/ui/type/pattern_types/range_patterns_unusable.stderr b/tests/ui/type/pattern_types/range_patterns_unusable.stderr index 8377d417452bb..7daa41d708179 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable.stderr +++ b/tests/ui/type/pattern_types/range_patterns_unusable.stderr @@ -4,7 +4,7 @@ error[E0512]: cannot transmute between types of different sizes, or dependently- LL | let _: Option = unsafe { std::mem::transmute(z) }; | ^^^^^^^^^^^^^^^^^^^ | - = note: source type: `Option<(u32) is 1..=>` (32 bits) + = note: source type: `Option<(u32) is 1..>` (32 bits) = note: target type: `Option` (64 bits) error: aborting due to 1 previous error diff --git a/tests/ui/type/pattern_types/range_patterns_unusable_math.rs b/tests/ui/type/pattern_types/range_patterns_unusable_math.rs index ece4009e1e7d8..6125063699be9 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable_math.rs +++ b/tests/ui/type/pattern_types/range_patterns_unusable_math.rs @@ -11,5 +11,5 @@ type Z = Option; fn main() { let x: Y = unsafe { std::mem::transmute(42_u32) }; - let x = x + 1_u32; //~ ERROR cannot add `u32` to `(u32) is 1..=` + let x = x + 1_u32; //~ ERROR cannot add `u32` to `(u32) is 1..` } diff --git a/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr b/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr index 373615e3714e5..a64f1db31766f 100644 --- a/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr +++ b/tests/ui/type/pattern_types/range_patterns_unusable_math.stderr @@ -1,10 +1,10 @@ -error[E0369]: cannot add `u32` to `(u32) is 1..=` +error[E0369]: cannot add `u32` to `(u32) is 1..` --> $DIR/range_patterns_unusable_math.rs:14:15 | LL | let x = x + 1_u32; | - ^ ----- u32 | | - | (u32) is 1..= + | (u32) is 1.. error: aborting due to 1 previous error diff --git a/tests/ui/type/pattern_types/reverse_range.rs b/tests/ui/type/pattern_types/reverse_range.rs index 6a245615f1ac0..4471624d66440 100644 --- a/tests/ui/type/pattern_types/reverse_range.rs +++ b/tests/ui/type/pattern_types/reverse_range.rs @@ -1,14 +1,11 @@ //! Check that the range start must be smaller than the range end -//@ known-bug: unknown -//@ failure-status: 101 -//@ normalize-stderr: "note: .*\n\n" -> "" -//@ normalize-stderr: "thread 'rustc' panicked.*\n" -> "" -//@ normalize-stderr: "(error: internal compiler error: [^:]+):\d+:\d+: " -> "$1:LL:CC: " -//@ rustc-env:RUST_BACKTRACE=0 - -#![feature(pattern_types)] +#![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] #![feature(pattern_type_macro)] use std::pat::pattern_type; const NONE: pattern_type!(u8 is 1..0) = unsafe { std::mem::transmute(3_u8) }; +//~^ NOTE: attempt to compute `0_u8 - 1_u8`, which would overflow +//~| ERROR: evaluation of constant value failed + +fn main() {} diff --git a/tests/ui/type/pattern_types/reverse_range.stderr b/tests/ui/type/pattern_types/reverse_range.stderr index b714ca7d9ab96..8bdd40297870a 100644 --- a/tests/ui/type/pattern_types/reverse_range.stderr +++ b/tests/ui/type/pattern_types/reverse_range.stderr @@ -1,17 +1,9 @@ -error[E0601]: `main` function not found in crate `reverse_range` - --> $DIR/reverse_range.rs:14:78 +error[E0080]: evaluation of constant value failed + --> $DIR/reverse_range.rs:7:36 | LL | const NONE: pattern_type!(u8 is 1..0) = unsafe { std::mem::transmute(3_u8) }; - | ^ consider adding a `main` function to `$DIR/reverse_range.rs` + | ^ attempt to compute `0_u8 - 1_u8`, which would overflow - -assertion failed: end <= max_value -error: the compiler unexpectedly panicked. this is a bug. - -query stack during panic: -#0 [eval_to_allocation_raw] const-evaluating + checking `NONE` -#1 [eval_to_const_value_raw] simplifying constant for the type system `NONE` -... and 1 other queries... use `env RUST_BACKTRACE=1` to see the full query stack error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0080`. diff --git a/tests/ui/type/pattern_types/validity.rs b/tests/ui/type/pattern_types/validity.rs index 77a4e72f6755a..5a6a688e1b305 100644 --- a/tests/ui/type/pattern_types/validity.rs +++ b/tests/ui/type/pattern_types/validity.rs @@ -1,6 +1,6 @@ //! Check that pattern types have their validity checked -#![feature(pattern_types)] +#![feature(pattern_types, const_trait_impl, pattern_type_range_trait)] #![feature(pattern_type_macro)] use std::pat::pattern_type; diff --git a/tests/ui/unsafe-binders/binder-sized-crit.rs b/tests/ui/unsafe-binders/binder-sized-crit.rs new file mode 100644 index 0000000000000..37677c0ef69b9 --- /dev/null +++ b/tests/ui/unsafe-binders/binder-sized-crit.rs @@ -0,0 +1,18 @@ +//@ check-pass + +#![feature(unsafe_binders)] +//~^ WARN the feature `unsafe_binders` is incomplete + +use std::unsafe_binder::wrap_binder; + +struct A { + b: unsafe<> (), +} + +fn main() { + unsafe { + let _ = A { + b: wrap_binder!(()), + }; + } +} diff --git a/tests/ui/unsafe-binders/binder-sized-crit.stderr b/tests/ui/unsafe-binders/binder-sized-crit.stderr new file mode 100644 index 0000000000000..3ba6cf2ef8c1d --- /dev/null +++ b/tests/ui/unsafe-binders/binder-sized-crit.stderr @@ -0,0 +1,11 @@ +warning: the feature `unsafe_binders` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/binder-sized-crit.rs:3:12 + | +LL | #![feature(unsafe_binders)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #130516 for more information + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted +