diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 262e418ecbf74..c0b96f50b6072 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -859,6 +859,8 @@ pub enum PatKind { pub enum PatFieldsRest { /// `module::StructName { field, ..}` Rest, + /// `module::StructName { field, syntax error }` + Recovered(ErrorGuaranteed), /// `module::StructName { field }` None, } diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index c4bae084a3f8c..6066054859058 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -92,7 +92,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { span: self.lower_span(f.span), } })); - break hir::PatKind::Struct(qpath, fs, *etc == ast::PatFieldsRest::Rest); + break hir::PatKind::Struct( + qpath, + fs, + matches!( + etc, + ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_) + ), + ); } PatKind::Tuple(pats) => { let (pats, ddpos) = self.lower_pat_tuple(pats, "tuple"); diff --git a/compiler/rustc_ast_pretty/src/pprust/state.rs b/compiler/rustc_ast_pretty/src/pprust/state.rs index 41fded027cb30..cbb92c8c30f09 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state.rs @@ -1654,11 +1654,14 @@ impl<'a> State<'a> { }, |f| f.pat.span, ); - if *etc == ast::PatFieldsRest::Rest { + if let ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_) = etc { if !fields.is_empty() { self.word_space(","); } self.word(".."); + if let ast::PatFieldsRest::Recovered(_) = etc { + self.word("/* recovered parse error */"); + } } if !empty { self.space(); diff --git a/compiler/rustc_borrowck/src/diagnostics/region_name.rs b/compiler/rustc_borrowck/src/diagnostics/region_name.rs index d49dee8514457..5dfc2658d2aaf 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_name.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_name.rs @@ -459,11 +459,8 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> { ) -> RegionNameHighlight { let mut highlight = RegionHighlightMode::default(); highlight.highlighting_region_vid(self.infcx.tcx, needle_fr, counter); - let type_name = self - .infcx - .err_ctxt() - .extract_inference_diagnostics_data(ty.into(), Some(highlight)) - .name; + let type_name = + self.infcx.err_ctxt().extract_inference_diagnostics_data(ty.into(), highlight).name; debug!( "highlight_if_we_cannot_match_hir_ty: type_name={:?} needle_fr={:?}", @@ -874,7 +871,7 @@ impl<'tcx> MirBorrowckCtxt<'_, '_, 'tcx> { let type_name = self .infcx .err_ctxt() - .extract_inference_diagnostics_data(yield_ty.into(), Some(highlight)) + .extract_inference_diagnostics_data(yield_ty.into(), highlight) .name; let yield_span = match tcx.hir_node(self.mir_hir_id()) { diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index c5913ed27cf34..baea7a32a5411 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -175,6 +175,8 @@ declare_features! ( (accepted, destructuring_assignment, "1.59.0", Some(71126)), /// Allows using the `#[diagnostic]` attribute tool namespace (accepted, diagnostic_namespace, "1.78.0", Some(111996)), + /// Controls errors in trait implementations. + (accepted, do_not_recommend, "CURRENT_RUSTC_VERSION", Some(51992)), /// Allows `#[doc(alias = "...")]`. (accepted, doc_alias, "1.48.0", Some(50146)), /// Allows `..` in tuple (struct) patterns. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 3bf485c2eb6fb..d2e4b7f2fc626 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -1188,10 +1188,9 @@ pub static BUILTIN_ATTRIBUTE_MAP: LazyLock> map }); -pub fn is_stable_diagnostic_attribute(sym: Symbol, features: &Features) -> bool { +pub fn is_stable_diagnostic_attribute(sym: Symbol, _features: &Features) -> bool { match sym { - sym::on_unimplemented => true, - sym::do_not_recommend => features.do_not_recommend(), + sym::on_unimplemented | sym::do_not_recommend => true, _ => false, } } diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 76b9bee4b00dc..db16bb5fa2555 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -466,8 +466,6 @@ declare_features! ( (unstable, deprecated_suggestion, "1.61.0", Some(94785)), /// Allows deref patterns. (incomplete, deref_patterns, "1.79.0", Some(87121)), - /// Controls errors in trait implementations. - (unstable, do_not_recommend, "1.67.0", Some(51992)), /// Tells rustdoc to automatically generate `#[doc(cfg(...))]`. (unstable, doc_auto_cfg, "1.58.0", Some(43781)), /// Allows `#[doc(cfg(...))]`. diff --git a/compiler/rustc_mir_build/src/thir/cx/expr.rs b/compiler/rustc_mir_build/src/thir/cx/expr.rs index 6770e562d5010..65a91d003af3a 100644 --- a/compiler/rustc_mir_build/src/thir/cx/expr.rs +++ b/compiler/rustc_mir_build/src/thir/cx/expr.rs @@ -25,6 +25,14 @@ use crate::thir::cx::Cx; use crate::thir::util::UserAnnotatedTyHelpers; impl<'tcx> Cx<'tcx> { + /// Create a THIR expression for the given HIR expression. This expands all + /// adjustments and directly adds the type information from the + /// `typeck_results`. See the [dev-guide] for more details. + /// + /// (The term "mirror" in this case does not refer to "flipped" or + /// "reversed".) + /// + /// [dev-guide]: https://rustc-dev-guide.rust-lang.org/thir.html pub(crate) fn mirror_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) -> ExprId { // `mirror_expr` is recursing very deep. Make sure the stack doesn't overflow. ensure_sufficient_stack(|| self.mirror_expr_inner(expr)) diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index 4cda887a02bdb..255be721525c6 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1371,10 +1371,10 @@ impl<'a> Parser<'a> { self.bump(); let (fields, etc) = self.parse_pat_fields().unwrap_or_else(|mut e| { e.span_label(path.span, "while parsing the fields for this pattern"); - e.emit(); + let guar = e.emit(); self.recover_stmt(); // When recovering, pretend we had `Foo { .. }`, to avoid cascading errors. - (ThinVec::new(), PatFieldsRest::Rest) + (ThinVec::new(), PatFieldsRest::Recovered(guar)) }); self.bump(); Ok(PatKind::Struct(qself, path, fields, etc)) diff --git a/compiler/rustc_passes/messages.ftl b/compiler/rustc_passes/messages.ftl index 7a0a518bb513a..a3d998b6b9921 100644 --- a/compiler/rustc_passes/messages.ftl +++ b/compiler/rustc_passes/messages.ftl @@ -356,6 +356,9 @@ passes_ignored_derived_impls = passes_implied_feature_not_exist = feature `{$implied_by}` implying `{$feature}` does not exist +passes_incorrect_do_not_recommend_args = + `#[diagnostic::do_not_recommend]` does not expect any arguments + passes_incorrect_do_not_recommend_location = `#[diagnostic::do_not_recommend]` can only be placed on trait implementations diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index ee197ce07ca71..3bd055838c739 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -116,7 +116,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { for attr in attrs { match attr.path().as_slice() { [sym::diagnostic, sym::do_not_recommend, ..] => { - self.check_do_not_recommend(attr.span, hir_id, target) + self.check_do_not_recommend(attr.span, hir_id, target, attr, item) } [sym::diagnostic, sym::on_unimplemented, ..] => { self.check_diagnostic_on_unimplemented(attr.span, hir_id, target) @@ -349,8 +349,21 @@ impl<'tcx> CheckAttrVisitor<'tcx> { } /// Checks if `#[diagnostic::do_not_recommend]` is applied on a trait impl. - fn check_do_not_recommend(&self, attr_span: Span, hir_id: HirId, target: Target) { - if !matches!(target, Target::Impl) { + fn check_do_not_recommend( + &self, + attr_span: Span, + hir_id: HirId, + target: Target, + attr: &Attribute, + item: Option>, + ) { + if !matches!(target, Target::Impl) + || matches!( + item, + Some(ItemLike::Item(hir::Item { kind: hir::ItemKind::Impl(_impl),.. })) + if _impl.of_trait.is_none() + ) + { self.tcx.emit_node_span_lint( UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, hir_id, @@ -358,6 +371,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> { errors::IncorrectDoNotRecommendLocation, ); } + if !matches!(attr.meta_kind(), Some(MetaItemKind::Word)) { + self.tcx.emit_node_span_lint( + UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES, + hir_id, + attr_span, + errors::DoNotRecommendDoesNotExpectArgs, + ); + } } /// Checks if `#[diagnostic::on_unimplemented]` is applied to a trait definition diff --git a/compiler/rustc_passes/src/errors.rs b/compiler/rustc_passes/src/errors.rs index fdc7e1bba2f0e..3d9426be5294d 100644 --- a/compiler/rustc_passes/src/errors.rs +++ b/compiler/rustc_passes/src/errors.rs @@ -20,6 +20,10 @@ use crate::lang_items::Duplicate; #[diag(passes_incorrect_do_not_recommend_location)] pub(crate) struct IncorrectDoNotRecommendLocation; +#[derive(LintDiagnostic)] +#[diag(passes_incorrect_do_not_recommend_args)] +pub(crate) struct DoNotRecommendDoesNotExpectArgs; + #[derive(Diagnostic)] #[diag(passes_autodiff_attr)] pub(crate) struct AutoDiffAttr { diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index bde11428d4046..61be85d2dff82 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -19,7 +19,9 @@ use rustc_ast::visit::{ use rustc_ast::*; use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap}; use rustc_errors::codes::*; -use rustc_errors::{Applicability, DiagArgValue, IntoDiagArg, StashKey, Suggestions}; +use rustc_errors::{ + Applicability, DiagArgValue, ErrorGuaranteed, IntoDiagArg, StashKey, Suggestions, +}; use rustc_hir::def::Namespace::{self, *}; use rustc_hir::def::{self, CtorKind, DefKind, LifetimeRes, NonMacroAttrKind, PartialRes, PerNS}; use rustc_hir::def_id::{CRATE_DEF_ID, DefId, LOCAL_CRATE, LocalDefId}; @@ -264,12 +266,17 @@ impl RibKind<'_> { #[derive(Debug)] pub(crate) struct Rib<'ra, R = Res> { pub bindings: IdentMap, + pub patterns_with_skipped_bindings: FxHashMap)>>, pub kind: RibKind<'ra>, } impl<'ra, R> Rib<'ra, R> { fn new(kind: RibKind<'ra>) -> Rib<'ra, R> { - Rib { bindings: Default::default(), kind } + Rib { + bindings: Default::default(), + patterns_with_skipped_bindings: Default::default(), + kind, + } } } @@ -3775,6 +3782,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { /// When a whole or-pattern has been dealt with, the thing happens. /// /// See the implementation and `fresh_binding` for more details. + #[tracing::instrument(skip(self, bindings), level = "debug")] fn resolve_pattern_inner( &mut self, pat: &Pat, @@ -3783,7 +3791,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { ) { // Visit all direct subpatterns of this pattern. pat.walk(&mut |pat| { - debug!("resolve_pattern pat={:?} node={:?}", pat, pat.kind); match pat.kind { PatKind::Ident(bmode, ident, ref sub) => { // First try to resolve the identifier as some existing entity, @@ -3809,8 +3816,9 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { PatKind::Path(ref qself, ref path) => { self.smart_resolve_path(pat.id, qself, path, PathSource::Pat); } - PatKind::Struct(ref qself, ref path, ..) => { + PatKind::Struct(ref qself, ref path, ref _fields, ref rest) => { self.smart_resolve_path(pat.id, qself, path, PathSource::Struct); + self.record_patterns_with_skipped_bindings(pat, rest); } PatKind::Or(ref ps) => { // Add a new set of bindings to the stack. `Or` here records that when a @@ -3843,6 +3851,30 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { }); } + fn record_patterns_with_skipped_bindings(&mut self, pat: &Pat, rest: &ast::PatFieldsRest) { + match rest { + ast::PatFieldsRest::Rest | ast::PatFieldsRest::Recovered(_) => { + // Record that the pattern doesn't introduce all the bindings it could. + if let Some(partial_res) = self.r.partial_res_map.get(&pat.id) + && let Some(res) = partial_res.full_res() + && let Some(def_id) = res.opt_def_id() + { + self.ribs[ValueNS] + .last_mut() + .unwrap() + .patterns_with_skipped_bindings + .entry(def_id) + .or_default() + .push((pat.span, match rest { + ast::PatFieldsRest::Recovered(guar) => Err(*guar), + _ => Ok(()), + })); + } + } + ast::PatFieldsRest::None => {} + } + } + fn fresh_binding( &mut self, ident: Ident, diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 09f3e84876689..85ea6a74d3cfc 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -430,6 +430,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { let mut err = self.r.dcx().struct_span_err(base_error.span, base_error.msg.clone()); err.code(code); + self.detect_missing_binding_available_from_pattern(&mut err, path, following_seg); self.suggest_at_operator_in_slice_pat_with_range(&mut err, path); self.suggest_swapping_misplaced_self_ty_and_trait(&mut err, source, res, base_error.span); @@ -1120,6 +1121,48 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { true } + fn detect_missing_binding_available_from_pattern( + &mut self, + err: &mut Diag<'_>, + path: &[Segment], + following_seg: Option<&Segment>, + ) { + let [segment] = path else { return }; + let None = following_seg else { return }; + for rib in self.ribs[ValueNS].iter().rev() { + for (def_id, spans) in &rib.patterns_with_skipped_bindings { + if let Some(fields) = self.r.field_idents(*def_id) { + for field in fields { + if field.name == segment.ident.name { + if spans.iter().all(|(_, had_error)| had_error.is_err()) { + // This resolution error will likely be fixed by fixing a + // syntax error in a pattern, so it is irrelevant to the user. + let multispan: MultiSpan = + spans.iter().map(|(s, _)| *s).collect::>().into(); + err.span_note( + multispan, + "this pattern had a recovered parse error which likely lost \ + the expected fields", + ); + err.downgrade_to_delayed_bug(); + } + let ty = self.r.tcx.item_name(*def_id); + for (span, _) in spans { + err.span_label( + *span, + format!( + "this pattern doesn't include `{field}`, which is \ + available in `{ty}`", + ), + ); + } + } + } + } + } + } + } + fn suggest_at_operator_in_slice_pat_with_range( &mut self, err: &mut Diag<'_>, diff --git a/compiler/rustc_resolve/src/macros.rs b/compiler/rustc_resolve/src/macros.rs index 6e2af9aae2361..dfe456d4c6092 100644 --- a/compiler/rustc_resolve/src/macros.rs +++ b/compiler/rustc_resolve/src/macros.rs @@ -689,8 +689,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { && let [namespace, attribute, ..] = &*path.segments && namespace.ident.name == sym::diagnostic && !(attribute.ident.name == sym::on_unimplemented - || (attribute.ident.name == sym::do_not_recommend - && self.tcx.features().do_not_recommend())) + || attribute.ident.name == sym::do_not_recommend) { let distance = edit_distance(attribute.ident.name.as_str(), sym::on_unimplemented.as_str(), 5); diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index a44d2af6b9086..f7706f094af66 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -3166,7 +3166,7 @@ impl Target { // Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI. check_matches!( &*self.llvm_abiname, - "lp64" | "lp64f" | "lp64d" | "lp64q" | "lp64e", + "lp64" | "lp64f" | "lp64d" | "lp64e", "invalid RISC-V ABI name" ); } diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs index 69f7a217cbf2d..acd53ed800876 100644 --- a/compiler/rustc_target/src/target_features.rs +++ b/compiler/rustc_target/src/target_features.rs @@ -39,7 +39,7 @@ pub enum Stability { allow_toggle: Toggleability, }, /// This feature can not be set via `-Ctarget-feature` or `#[target_feature]`, it can only be - /// set in the basic target definition. It is never set in `cfg(target_feature)`. Used in + /// set in the target spec. It is never set in `cfg(target_feature)`. Used in /// particular for features that change the floating-point ABI. Forbidden { reason: &'static str }, } @@ -590,9 +590,76 @@ const RISCV_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[ // tidy-alphabetical-start ("a", STABLE, &["zaamo", "zalrsc"]), ("c", STABLE, &[]), - ("d", unstable(sym::riscv_target_feature), &["f"]), - ("e", unstable(sym::riscv_target_feature), &[]), - ("f", unstable(sym::riscv_target_feature), &[]), + ( + "d", + Stability::Unstable { + nightly_feature: sym::riscv_target_feature, + allow_toggle: |target, enable| match &*target.llvm_abiname { + "ilp32d" | "lp64d" if !enable => { + // The ABI requires the `d` feature, so it cannot be disabled. + Err("feature is required by ABI") + } + "ilp32e" if enable => { + // ilp32e is incompatible with features that need aligned load/stores > 32 bits, + // like `d`. + Err("feature is incompatible with ABI") + } + _ => Ok(()), + }, + }, + &["f"], + ), + ( + "e", + Stability::Unstable { + // Given that this is a negative feature, consider this before stabilizing: + // does it really make sense to enable this feature in an individual + // function with `#[target_feature]`? + nightly_feature: sym::riscv_target_feature, + allow_toggle: |target, enable| { + match &*target.llvm_abiname { + _ if !enable => { + // Disabling this feature means we can use more registers (x16-x31). + // The "e" ABIs treat them as caller-save, so it is safe to use them only + // in some parts of a program while the rest doesn't know they even exist. + // On other ABIs, the feature is already disabled anyway. + Ok(()) + } + "ilp32e" | "lp64e" => { + // Embedded ABIs should already have the feature anyway, it's fine to enable + // it again from an ABI perspective. + Ok(()) + } + _ => { + // *Not* an embedded ABI. Enabling `e` is invalid. + Err("feature is incompatible with ABI") + } + } + }, + }, + &[], + ), + ( + "f", + Stability::Unstable { + nightly_feature: sym::riscv_target_feature, + allow_toggle: |target, enable| { + match &*target.llvm_abiname { + "ilp32f" | "ilp32d" | "lp64f" | "lp64d" if !enable => { + // The ABI requires the `f` feature, so it cannot be disabled. + Err("feature is required by ABI") + } + _ => Ok(()), + } + }, + }, + &[], + ), + ( + "forced-atomics", + Stability::Forbidden { reason: "unsound because it changes the ABI of atomic operations" }, + &[], + ), ("m", STABLE, &[]), ("relax", unstable(sym::riscv_target_feature), &[]), ("unaligned-scalar-mem", unstable(sym::riscv_target_feature), &[]), diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs index af3b5e0d5d417..677b72477a279 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs @@ -21,6 +21,7 @@ use rustc_span::symbol::{Ident, sym}; use rustc_span::{BytePos, DUMMY_SP, FileName, Span}; use tracing::{debug, instrument, warn}; +use super::nice_region_error::placeholder_error::Highlighted; use crate::error_reporting::TypeErrCtxt; use crate::errors::{ AmbiguousImpl, AmbiguousReturn, AnnotationRequired, InferenceBadError, @@ -279,8 +280,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { pub fn extract_inference_diagnostics_data( &self, arg: GenericArg<'tcx>, - highlight: Option>, + highlight: ty::print::RegionHighlightMode<'tcx>, ) -> InferenceDiagnosticsData { + let tcx = self.tcx; match arg.unpack() { GenericArgKind::Type(ty) => { if let ty::Infer(ty::TyVar(ty_vid)) = *ty.kind() { @@ -300,13 +302,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } } - let mut printer = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS); - if let Some(highlight) = highlight { - printer.region_highlight_mode = highlight; - } - ty.print(&mut printer).unwrap(); InferenceDiagnosticsData { - name: printer.into_buffer(), + name: Highlighted { highlight, ns: Namespace::TypeNS, tcx, value: ty } + .to_string(), span: None, kind: UnderspecifiedArgKind::Type { prefix: ty.prefix_string(self.tcx) }, parent: None, @@ -325,13 +323,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { } debug_assert!(!origin.span.is_dummy()); - let mut printer = ty::print::FmtPrinter::new(self.tcx, Namespace::ValueNS); - if let Some(highlight) = highlight { - printer.region_highlight_mode = highlight; - } - ct.print(&mut printer).unwrap(); InferenceDiagnosticsData { - name: printer.into_buffer(), + name: Highlighted { highlight, ns: Namespace::ValueNS, tcx, value: ct } + .to_string(), span: Some(origin.span), kind: UnderspecifiedArgKind::Const { is_parameter: false }, parent: None, @@ -343,13 +337,9 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { // FIXME: Ideally we should look into the generic constant // to figure out which inference var is actually unresolved so that // this path is unreachable. - let mut printer = ty::print::FmtPrinter::new(self.tcx, Namespace::ValueNS); - if let Some(highlight) = highlight { - printer.region_highlight_mode = highlight; - } - ct.print(&mut printer).unwrap(); InferenceDiagnosticsData { - name: printer.into_buffer(), + name: Highlighted { highlight, ns: Namespace::ValueNS, tcx, value: ct } + .to_string(), span: None, kind: UnderspecifiedArgKind::Const { is_parameter: false }, parent: None, @@ -422,7 +412,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { should_label_span: bool, ) -> Diag<'a> { let arg = self.resolve_vars_if_possible(arg); - let arg_data = self.extract_inference_diagnostics_data(arg, None); + let arg_data = + self.extract_inference_diagnostics_data(arg, ty::print::RegionHighlightMode::default()); let Some(typeck_results) = &self.typeck_results else { // If we don't have any typeck results we're outside diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs index 4398af76ab2c7..aaaefd81d19bd 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/placeholder_error.rs @@ -21,9 +21,10 @@ use crate::traits::{ObligationCause, ObligationCauseCode}; // HACK(eddyb) maybe move this in a more central location. #[derive(Copy, Clone)] pub struct Highlighted<'tcx, T> { - tcx: TyCtxt<'tcx>, - highlight: RegionHighlightMode<'tcx>, - value: T, + pub tcx: TyCtxt<'tcx>, + pub highlight: RegionHighlightMode<'tcx>, + pub value: T, + pub ns: Namespace, } impl<'tcx, T> IntoDiagArg for Highlighted<'tcx, T> @@ -37,7 +38,7 @@ where impl<'tcx, T> Highlighted<'tcx, T> { fn map(self, f: impl FnOnce(T) -> U) -> Highlighted<'tcx, U> { - Highlighted { tcx: self.tcx, highlight: self.highlight, value: f(self.value) } + Highlighted { tcx: self.tcx, highlight: self.highlight, value: f(self.value), ns: self.ns } } } @@ -46,7 +47,7 @@ where T: for<'a> Print<'tcx, FmtPrinter<'a, 'tcx>>, { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let mut printer = ty::print::FmtPrinter::new(self.tcx, Namespace::TypeNS); + let mut printer = ty::print::FmtPrinter::new(self.tcx, self.ns); printer.region_highlight_mode = self.highlight; self.value.print(&mut printer)?; @@ -381,6 +382,7 @@ impl<'tcx> NiceRegionError<'_, 'tcx> { tcx: self.tcx(), highlight: RegionHighlightMode::default(), value: trait_ref, + ns: Namespace::TypeNS, }; let same_self_type = actual_trait_ref.self_ty() == expected_trait_ref.self_ty(); diff --git a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs index 592ade8ede204..95dd1b28a3994 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/infer/nice_region_error/trait_impl_difference.rs @@ -2,18 +2,19 @@ use rustc_errors::ErrorGuaranteed; use rustc_hir as hir; -use rustc_hir::def::Res; +use rustc_hir::def::{Namespace, Res}; use rustc_hir::def_id::DefId; use rustc_hir::intravisit::Visitor; use rustc_middle::hir::nested_filter; use rustc_middle::traits::ObligationCauseCode; use rustc_middle::ty::error::ExpectedFound; use rustc_middle::ty::print::RegionHighlightMode; -use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitor}; +use rustc_middle::ty::{self, TyCtxt, TypeVisitable}; use rustc_span::Span; use tracing::debug; use crate::error_reporting::infer::nice_region_error::NiceRegionError; +use crate::error_reporting::infer::nice_region_error::placeholder_error::Highlighted; use crate::errors::{ConsiderBorrowingParamHelp, RelationshipHelp, TraitImplDiff}; use crate::infer::{RegionResolutionError, Subtype, ValuePairs}; @@ -32,19 +33,14 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { _, ) = error.clone() && let (Subtype(sup_trace), Subtype(sub_trace)) = (&sup_origin, &sub_origin) - && let ObligationCauseCode::CompareImplItem { trait_item_def_id, .. } = + && let &ObligationCauseCode::CompareImplItem { trait_item_def_id, .. } = sub_trace.cause.code() && sub_trace.values == sup_trace.values && let ValuePairs::PolySigs(ExpectedFound { expected, found }) = sub_trace.values { // FIXME(compiler-errors): Don't like that this needs `Ty`s, but // all of the region highlighting machinery only deals with those. - let guar = self.emit_err( - var_origin.span(), - Ty::new_fn_ptr(self.cx.tcx, expected), - Ty::new_fn_ptr(self.cx.tcx, found), - *trait_item_def_id, - ); + let guar = self.emit_err(var_origin.span(), expected, found, trait_item_def_id); return Some(guar); } None @@ -53,11 +49,11 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { fn emit_err( &self, sp: Span, - expected: Ty<'tcx>, - found: Ty<'tcx>, - trait_def_id: DefId, + expected: ty::PolyFnSig<'tcx>, + found: ty::PolyFnSig<'tcx>, + trait_item_def_id: DefId, ) -> ErrorGuaranteed { - let trait_sp = self.tcx().def_span(trait_def_id); + let trait_sp = self.tcx().def_span(trait_item_def_id); // Mark all unnamed regions in the type with a number. // This diagnostic is called in response to lifetime errors, so be informative. @@ -67,10 +63,10 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } impl<'tcx> HighlightBuilder<'tcx> { - fn build(ty: Ty<'tcx>) -> RegionHighlightMode<'tcx> { + fn build(sig: ty::PolyFnSig<'tcx>) -> RegionHighlightMode<'tcx> { let mut builder = HighlightBuilder { highlight: RegionHighlightMode::default(), counter: 1 }; - builder.visit_ty(ty); + sig.visit_with(&mut builder); builder.highlight } } @@ -85,16 +81,21 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } let expected_highlight = HighlightBuilder::build(expected); - let expected = self - .cx - .extract_inference_diagnostics_data(expected.into(), Some(expected_highlight)) - .name; + let tcx = self.cx.tcx; + let expected = Highlighted { + highlight: expected_highlight, + ns: Namespace::TypeNS, + tcx, + value: expected, + } + .to_string(); let found_highlight = HighlightBuilder::build(found); let found = - self.cx.extract_inference_diagnostics_data(found.into(), Some(found_highlight)).name; + Highlighted { highlight: found_highlight, ns: Namespace::TypeNS, tcx, value: found } + .to_string(); // Get the span of all the used type parameters in the method. - let assoc_item = self.tcx().associated_item(trait_def_id); + let assoc_item = self.tcx().associated_item(trait_item_def_id); let mut visitor = TypeParamSpanVisitor { tcx: self.tcx(), types: vec![] }; match assoc_item.kind { ty::AssocKind::Fn => { diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 432e55e8c9a4c..e468f4f0f7e66 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -443,6 +443,7 @@ pub trait AsMut { /// [`Vec`]: ../../std/vec/struct.Vec.html #[rustc_diagnostic_item = "Into"] #[stable(feature = "rust1", since = "1.0.0")] +#[doc(search_unbox)] pub trait Into: Sized { /// Converts this type into the (usually inferred) input type. #[must_use] @@ -577,6 +578,7 @@ pub trait Into: Sized { all(_Self = "&str", T = "alloc::string::String"), note = "to coerce a `{T}` into a `{Self}`, use `&*` as a prefix", ))] +#[doc(search_unbox)] pub trait From: Sized { /// Converts to this type from the input type. #[rustc_diagnostic_item = "from_fn"] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index d45cb01910f66..a7f741a940896 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -107,13 +107,13 @@ // // Library features: // tidy-alphabetical-start +#![cfg_attr(bootstrap, feature(do_not_recommend))] #![feature(array_ptr_get)] #![feature(asm_experimental_arch)] #![feature(const_eval_select)] #![feature(const_typed_swap)] #![feature(core_intrinsics)] #![feature(coverage_attribute)] -#![feature(do_not_recommend)] #![feature(internal_impls_macro)] #![feature(ip)] #![feature(is_ascii_octdigit)] diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile index 487da58015222..42df58517caf4 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-18/Dockerfile @@ -59,5 +59,10 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts -COPY scripts/x86_64-gnu-llvm.sh /tmp/script.sh -ENV SCRIPT /tmp/script.sh +ARG SCRIPT_ARG +COPY scripts/add_dummy_commit.sh /tmp/add_dummy_commit.sh +COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh +COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh +COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh +COPY scripts/x86_64-gnu-llvm3.sh /tmp/x86_64-gnu-llvm3.sh +ENV SCRIPT /tmp/${SCRIPT_ARG} diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile index 4991908fe7734..f2aadbe87cfec 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-19/Dockerfile @@ -59,5 +59,10 @@ COPY host-x86_64/dist-x86_64-linux/build-gccjit.sh /scripts/ RUN /scripts/build-gccjit.sh /scripts -COPY scripts/x86_64-gnu-llvm.sh /tmp/script.sh -ENV SCRIPT /tmp/script.sh +ARG SCRIPT_ARG +COPY scripts/add_dummy_commit.sh /tmp/add_dummy_commit.sh +COPY scripts/x86_64-gnu-llvm.sh /tmp/x86_64-gnu-llvm.sh +COPY scripts/x86_64-gnu-llvm1.sh /tmp/x86_64-gnu-llvm1.sh +COPY scripts/x86_64-gnu-llvm2.sh /tmp/x86_64-gnu-llvm2.sh +COPY scripts/x86_64-gnu-llvm3.sh /tmp/x86_64-gnu-llvm3.sh +ENV SCRIPT /tmp/${SCRIPT_ARG} diff --git a/src/ci/docker/scripts/add_dummy_commit.sh b/src/ci/docker/scripts/add_dummy_commit.sh new file mode 100755 index 0000000000000..029e4ae141f8f --- /dev/null +++ b/src/ci/docker/scripts/add_dummy_commit.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -ex + +if [ "$READ_ONLY_SRC" = "0" ]; then + # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that + # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on + # compiler and/or library. Here we are adding a dummy commit on compiler and running + # that test to make sure we never download CI rustc with a change on the compiler tree. + echo "" >> ../compiler/rustc/src/main.rs + git config --global user.email "dummy@dummy.com" + git config --global user.name "dummy" + git add ../compiler/rustc/src/main.rs + git commit -m "test commit for rust.download-rustc=if-unchanged logic" + DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ + -- core::builder::tests::ci_rustc_if_unchanged_logic + # Revert the dummy commit + git reset --hard HEAD~1 +fi diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm.sh b/src/ci/docker/scripts/x86_64-gnu-llvm.sh index dea38b6fd2a4a..e7dcc1ddff449 100755 --- a/src/ci/docker/scripts/x86_64-gnu-llvm.sh +++ b/src/ci/docker/scripts/x86_64-gnu-llvm.sh @@ -2,42 +2,7 @@ set -ex -if [ "$READ_ONLY_SRC" = "0" ]; then - # `core::builder::tests::ci_rustc_if_unchanged_logic` bootstrap test ensures that - # "download-rustc=if-unchanged" logic don't use CI rustc while there are changes on - # compiler and/or library. Here we are adding a dummy commit on compiler and running - # that test to make sure we never download CI rustc with a change on the compiler tree. - echo "" >> ../compiler/rustc/src/main.rs - git config --global user.email "dummy@dummy.com" - git config --global user.name "dummy" - git add ../compiler/rustc/src/main.rs - git commit -m "test commit for rust.download-rustc=if-unchanged logic" - DISABLE_CI_RUSTC_IF_INCOMPATIBLE=0 ../x.py test bootstrap \ - -- core::builder::tests::ci_rustc_if_unchanged_logic - # Revert the dummy commit - git reset --hard HEAD~1 -fi - -# Only run the stage 1 tests on merges, not on PR CI jobs. -if [[ -z "${PR_CI_JOB}" ]]; then - ../x.py --stage 1 test --skip src/tools/tidy - - # Run the `mir-opt` tests again but this time for a 32-bit target. - # This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have - # both 32-bit and 64-bit outputs updated by the PR author, before - # the PR is approved and tested for merging. - # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, - # despite having different output on 32-bit vs 64-bit targets. - ../x.py --stage 1 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu - - # Run `ui-fulldeps` in `--stage=1`, which actually uses the stage0 - # compiler, and is sensitive to the addition of new flags. - ../x.py --stage 1 test tests/ui-fulldeps - - # Rebuild the stdlib with the size optimizations enabled and run tests again. - RUSTFLAGS_NOT_BOOTSTRAP="--cfg feature=\"optimize_for_size\"" ../x.py --stage 1 test \ - library/std library/alloc library/core -fi +/tmp/add_dummy_commit.sh # NOTE: intentionally uses all of `x.py`, `x`, and `x.ps1` to make sure they all work on Linux. ../x.py --stage 2 test --skip src/tools/tidy diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm1.sh b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh new file mode 100755 index 0000000000000..56ef39aae1556 --- /dev/null +++ b/src/ci/docker/scripts/x86_64-gnu-llvm1.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -ex + +/tmp/add_dummy_commit.sh + +../x.py --stage 2 test \ + --skip tests \ + --skip coverage-map \ + --skip coverage-run \ + --skip library \ + --skip tidyselftest diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm2.sh b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh new file mode 100755 index 0000000000000..c9f6b98f01f4f --- /dev/null +++ b/src/ci/docker/scripts/x86_64-gnu-llvm2.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -ex + +/tmp/add_dummy_commit.sh + +##### Test stage 2 ##### + +../x.py --stage 2 test \ + --skip compiler \ + --skip src + +# Run the `mir-opt` tests again but this time for a 32-bit target. +# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have +# both 32-bit and 64-bit outputs updated by the PR author, before +# the PR is approved and tested for merging. +# It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, +# despite having different output on 32-bit vs 64-bit targets. +../x --stage 2 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu + +# Run the UI test suite again, but in `--pass=check` mode +# +# This is intended to make sure that both `--pass=check` continues to +# work. +../x.ps1 --stage 2 test tests/ui --pass=check --host='' --target=i686-unknown-linux-gnu diff --git a/src/ci/docker/scripts/x86_64-gnu-llvm3.sh b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh new file mode 100755 index 0000000000000..d1bf2dab1e2d7 --- /dev/null +++ b/src/ci/docker/scripts/x86_64-gnu-llvm3.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -ex + +/tmp/add_dummy_commit.sh + +##### Test stage 1 ##### + +../x.py --stage 1 test --skip src/tools/tidy + +# Run the `mir-opt` tests again but this time for a 32-bit target. +# This enforces that tests using `// EMIT_MIR_FOR_EACH_BIT_WIDTH` have +# both 32-bit and 64-bit outputs updated by the PR author, before +# the PR is approved and tested for merging. +# It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`, +# despite having different output on 32-bit vs 64-bit targets. +../x.py --stage 1 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu + +# Run `ui-fulldeps` in `--stage=1`, which actually uses the stage0 +# compiler, and is sensitive to the addition of new flags. +../x.py --stage 1 test tests/ui-fulldeps + +# Rebuild the stdlib with the size optimizations enabled and run tests again. +RUSTFLAGS_NOT_BOOTSTRAP="--cfg feature=\"optimize_for_size\"" ../x.py --stage 1 test \ + library/std library/alloc library/core diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 959a9580e6003..5732a428f67d7 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -117,6 +117,7 @@ pr: ENABLE_GCC_CODEGEN: "1" # We are adding (temporarily) a dummy commit on the compiler READ_ONLY_SRC: "0" + DOCKER_SCRIPT: x86_64-gnu-llvm.sh <<: *job-linux-16c - image: x86_64-gnu-tools <<: *job-linux-16c @@ -312,16 +313,58 @@ auto: - image: x86_64-gnu-distcheck <<: *job-linux-8c - - image: x86_64-gnu-llvm-19 + # The x86_64-gnu-llvm-19 job is split into multiple jobs to run tests in parallel. + # x86_64-gnu-llvm-19-1 skips tests that run in x86_64-gnu-llvm-19-{2,3}. + - image: x86_64-gnu-llvm-19-1 env: RUST_BACKTRACE: 1 - <<: *job-linux-8c + IMAGE: x86_64-gnu-llvm-19 + DOCKER_SCRIPT: x86_64-gnu-llvm1.sh + <<: *job-linux-4c - - image: x86_64-gnu-llvm-18 + # Skip tests that run in x86_64-gnu-llvm-19-{1,3} + - image: x86_64-gnu-llvm-19-2 + env: + RUST_BACKTRACE: 1 + IMAGE: x86_64-gnu-llvm-19 + DOCKER_SCRIPT: x86_64-gnu-llvm2.sh + <<: *job-linux-4c + + # Skip tests that run in x86_64-gnu-llvm-19-{1,2} + - image: x86_64-gnu-llvm-19-3 + env: + RUST_BACKTRACE: 1 + IMAGE: x86_64-gnu-llvm-19 + DOCKER_SCRIPT: x86_64-gnu-llvm3.sh + <<: *job-linux-4c + + # The x86_64-gnu-llvm-18 job is split into multiple jobs to run tests in parallel. + # x86_64-gnu-llvm-18-1 skips tests that run in x86_64-gnu-llvm-18-{2,3}. + - image: x86_64-gnu-llvm-18-1 env: RUST_BACKTRACE: 1 READ_ONLY_SRC: "0" - <<: *job-linux-8c + IMAGE: x86_64-gnu-llvm-18 + DOCKER_SCRIPT: x86_64-gnu-llvm1.sh + <<: *job-linux-4c + + # Skip tests that run in x86_64-gnu-llvm-18-{1,3} + - image: x86_64-gnu-llvm-18-2 + env: + RUST_BACKTRACE: 1 + READ_ONLY_SRC: "0" + IMAGE: x86_64-gnu-llvm-18 + DOCKER_SCRIPT: x86_64-gnu-llvm2.sh + <<: *job-linux-4c + + # Skip tests that run in x86_64-gnu-llvm-18-{1,2} + - image: x86_64-gnu-llvm-18-3 + env: + RUST_BACKTRACE: 1 + READ_ONLY_SRC: "0" + IMAGE: x86_64-gnu-llvm-18 + DOCKER_SCRIPT: x86_64-gnu-llvm3.sh + <<: *job-linux-4c - image: x86_64-gnu-nopt <<: *job-linux-4c diff --git a/src/doc/rustdoc/src/read-documentation/search.md b/src/doc/rustdoc/src/read-documentation/search.md index 718d2201c3a5d..e06dcdb7ed2fb 100644 --- a/src/doc/rustdoc/src/read-documentation/search.md +++ b/src/doc/rustdoc/src/read-documentation/search.md @@ -149,12 +149,16 @@ will match these queries: * `&mut Read -> Result, Error>` * `Read -> Result, Error>` * `Read -> Result>` -* `Read -> u8` +* `Read -> Vec` But it *does not* match `Result` or `Result>`, because those are nested incorrectly, and it does not match `Result>` or `Result`, because those are -in the wrong order. +in the wrong order. It also does not match `Read -> u8`, because +only [certain generic wrapper types] can be left out, and `Vec` isn't +one of them. + +[certain generic wrapper types]: #wrappers-that-can-be-omitted To search for a function that accepts a function as a parameter, like `Iterator::all`, wrap the nested signature in parenthesis, @@ -165,6 +169,18 @@ but you need to know which one you want. [iterator-all]: ../../std/vec/struct.Vec.html?search=Iterator%2C+(T+->+bool)+->+bool&filter-crate=std +### Wrappers that can be omitted + +* References +* Box +* Rc +* Arc +* Option +* Result +* From +* Into +* Future + ### Primitives with Special Syntax | Shorthand | Explicit names | @@ -234,11 +250,6 @@ Most of these limitations should be addressed in future version of Rustdoc. that you don't want a type parameter, you can force it to match something else by giving it a different prefix like `struct:T`. - * It's impossible to search for references or pointers. The - wrapped types can be searched for, so a function that takes `&File` can - be found with `File`, but you'll get a parse error when typing an `&` - into the search field. - * Searching for lifetimes is not supported. * It's impossible to search based on the length of an array. diff --git a/src/librustdoc/doctest/make.rs b/src/librustdoc/doctest/make.rs index 3ae60938749ec..a188bc8ebd912 100644 --- a/src/librustdoc/doctest/make.rs +++ b/src/librustdoc/doctest/make.rs @@ -51,8 +51,17 @@ impl DocTestBuilder { !lang_str.compile_fail && !lang_str.test_harness && !lang_str.standalone_crate }); - let SourceInfo { crate_attrs, maybe_crate_attrs, crates, everything_else } = - partition_source(source, edition); + let Some(SourceInfo { crate_attrs, maybe_crate_attrs, crates, everything_else }) = + partition_source(source, edition) + else { + return Self::invalid( + String::new(), + String::new(), + String::new(), + source.to_string(), + test_id, + ); + }; // Uses librustc_ast to parse the doctest and find if there's a main fn and the extern // crate already is included. @@ -77,18 +86,7 @@ impl DocTestBuilder { else { // If the parser panicked due to a fatal error, pass the test code through unchanged. // The error will be reported during compilation. - return Self { - supports_color: false, - has_main_fn: false, - crate_attrs, - maybe_crate_attrs, - crates, - everything_else, - already_has_extern_crate: false, - test_id, - failed_ast: true, - can_be_merged: false, - }; + return Self::invalid(crate_attrs, maybe_crate_attrs, crates, everything_else, test_id); }; // If the AST returned an error, we don't want this doctest to be merged with the // others. Same if it contains `#[feature]` or `#[no_std]`. @@ -113,6 +111,27 @@ impl DocTestBuilder { } } + fn invalid( + crate_attrs: String, + maybe_crate_attrs: String, + crates: String, + everything_else: String, + test_id: Option, + ) -> Self { + Self { + supports_color: false, + has_main_fn: false, + crate_attrs, + maybe_crate_attrs, + crates, + everything_else, + already_has_extern_crate: false, + test_id, + failed_ast: true, + can_be_merged: false, + } + } + /// Transforms a test into code that can be compiled into a Rust binary, and returns the number of /// lines before the test code begins. pub(crate) fn generate_unique_doctest( @@ -518,8 +537,8 @@ fn handle_attr(mod_attr_pending: &mut String, source_info: &mut SourceInfo, edit push_to.push('\n'); // If it's complete, then we can clear the pending content. mod_attr_pending.clear(); - } else if mod_attr_pending.ends_with('\\') { - mod_attr_pending.push('n'); + } else { + mod_attr_pending.push_str("\n"); } } @@ -531,7 +550,7 @@ struct SourceInfo { everything_else: String, } -fn partition_source(s: &str, edition: Edition) -> SourceInfo { +fn partition_source(s: &str, edition: Edition) -> Option { #[derive(Copy, Clone, PartialEq)] enum PartitionState { Attrs, @@ -606,11 +625,16 @@ fn partition_source(s: &str, edition: Edition) -> SourceInfo { } } + if !mod_attr_pending.is_empty() { + debug!("invalid doctest code: {s:?}"); + return None; + } + source_info.everything_else = source_info.everything_else.trim().to_string(); debug!("crate_attrs:\n{}{}", source_info.crate_attrs, source_info.maybe_crate_attrs); debug!("crates:\n{}", source_info.crates); debug!("after:\n{}", source_info.everything_else); - source_info + Some(source_info) } diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 9e5cf49721139..04eeee37fe8ee 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -2592,7 +2592,12 @@ class DocSearch { const writeFn = (fnType, result) => { if (fnType.id < 0) { if (fnParamNames[-1 - fnType.id] === "") { - for (const nested of fnType.generics) { + // Normally, there's no need to shown an unhighlighted + // where clause, but if it's impl Trait, then we do. + const generics = fnType.generics.length > 0 ? + fnType.generics : + obj.type.where_clause[-1 - fnType.id]; + for (const nested of generics) { writeFn(nested, result); } return; diff --git a/tests/auxiliary/minicore.rs b/tests/auxiliary/minicore.rs index c4317752920f0..2fa0c550efbc8 100644 --- a/tests/auxiliary/minicore.rs +++ b/tests/auxiliary/minicore.rs @@ -14,7 +14,7 @@ //! . // ignore-tidy-linelength -#![feature(no_core, lang_items, rustc_attrs, decl_macro)] +#![feature(no_core, lang_items, rustc_attrs, decl_macro, naked_functions)] #![allow(unused, improper_ctypes_definitions, internal_features)] #![feature(asm_experimental_arch)] #![no_std] @@ -80,3 +80,11 @@ pub struct UnsafeCell { pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { /* compiler built-in */ } +#[rustc_builtin_macro] +pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) { + /* compiler built-in */ +} +#[rustc_builtin_macro] +pub macro global_asm("assembly template", $(operands,)* $(options($(option),*))?) { + /* compiler built-in */ +} diff --git a/tests/rustdoc-js/impl-trait-inlining.js b/tests/rustdoc-js/impl-trait-inlining.js new file mode 100644 index 0000000000000..e97669c7b3082 --- /dev/null +++ b/tests/rustdoc-js/impl-trait-inlining.js @@ -0,0 +1,35 @@ +// exact-check +// ignore-order + +const EXPECTED = [ + { + 'query': 'tyctxt, symbol -> bool', + 'others': [ + { + 'path': 'foo::TyCtxt', + 'name': 'has_attr', + 'displayType': "`TyCtxt`, Into, `Symbol` -> `bool`", + }, + ], + }, + { + 'query': 'tyctxt, into, symbol -> bool', + 'others': [ + { + 'path': 'foo::TyCtxt', + 'name': 'has_attr', + 'displayType': "`TyCtxt`, `Into`<`DefId`>, `Symbol` -> `bool`", + }, + ], + }, + { + 'query': 'tyctxt, defid, symbol -> bool', + 'others': [ + { + 'path': 'foo::TyCtxt', + 'name': 'has_attr', + 'displayType': "`TyCtxt`, Into<`DefId`>, `Symbol` -> `bool`", + }, + ], + }, +]; diff --git a/tests/rustdoc-js/impl-trait-inlining.rs b/tests/rustdoc-js/impl-trait-inlining.rs new file mode 100644 index 0000000000000..f90fb72659ae7 --- /dev/null +++ b/tests/rustdoc-js/impl-trait-inlining.rs @@ -0,0 +1,11 @@ +#![crate_name = "foo"] + +pub struct TyCtxt; +pub struct DefId; +pub struct Symbol; + +impl TyCtxt { + pub fn has_attr(self, _did: impl Into, _attr: Symbol) -> bool { + unimplemented!(); + } +} diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.rs b/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.rs new file mode 100644 index 0000000000000..8cdd665ff69d2 --- /dev/null +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.rs @@ -0,0 +1,15 @@ +//@ compile-flags:--test --test-args --test-threads=1 +//@ failure-status: 101 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" + +//! ``` +#![doc = "#![all\ +ow(unused)]"] +//! ``` +//! +//! ``` +#![doc = r#"#![all\ +ow(unused)]"#] +//! ``` diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.stdout b/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.stdout new file mode 100644 index 0000000000000..0baff3df14431 --- /dev/null +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221-2.stdout @@ -0,0 +1,31 @@ + +running 2 tests +test $DIR/comment-in-attr-134221-2.rs - (line 11) ... FAILED +test $DIR/comment-in-attr-134221-2.rs - (line 7) ... ok + +failures: + +---- $DIR/comment-in-attr-134221-2.rs - (line 11) stdout ---- +error: unknown start of token: \ + --> $DIR/comment-in-attr-134221-2.rs:$LINE:$COL + | +LL | #![all\ + | ^ + +error: expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `ow` + --> $DIR/comment-in-attr-134221-2.rs:$LINE:$COL + | +LL | #![all\ + | - expected one of `(`, `::`, `=`, `[`, `]`, or `{` +LL | ow(unused)] + | ^^ unexpected token + +error: aborting due to 2 previous errors + +Couldn't compile the test. + +failures: + $DIR/comment-in-attr-134221-2.rs - (line 11) + +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs new file mode 100644 index 0000000000000..3689ebe166ad4 --- /dev/null +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221.rs @@ -0,0 +1,27 @@ +// Regression test for . +// It checks that even if there are comments in the attributes, the attributes +// will still be generated correctly (and therefore fail in this test). + +//@ compile-flags:--test --test-args --test-threads=1 +//@ failure-status: 101 +//@ normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR" +//@ normalize-stdout-test: "finished in \d+\.\d+s" -> "finished in $$TIME" +//@ normalize-stdout-test: ".rs:\d+:\d+" -> ".rs:$$LINE:$$COL" + +/*! +```rust +#![feature( + foo, // +)] +``` + +```rust +#![feature( + foo, +)] +``` + +```rust +#![ +``` +*/ diff --git a/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout b/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout new file mode 100644 index 0000000000000..aa1b27d1f0bd9 --- /dev/null +++ b/tests/rustdoc-ui/doctest/comment-in-attr-134221.stdout @@ -0,0 +1,50 @@ + +running 3 tests +test $DIR/comment-in-attr-134221.rs - (line 11) ... FAILED +test $DIR/comment-in-attr-134221.rs - (line 17) ... FAILED +test $DIR/comment-in-attr-134221.rs - (line 23) ... FAILED + +failures: + +---- $DIR/comment-in-attr-134221.rs - (line 11) stdout ---- +error[E0635]: unknown feature `foo` + --> $DIR/comment-in-attr-134221.rs:$LINE:$COL + | +LL | foo, // + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0635`. +Couldn't compile the test. +---- $DIR/comment-in-attr-134221.rs - (line 17) stdout ---- +error[E0635]: unknown feature `foo` + --> $DIR/comment-in-attr-134221.rs:$LINE:$COL + | +LL | foo, + | ^^^ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0635`. +Couldn't compile the test. +---- $DIR/comment-in-attr-134221.rs - (line 23) stdout ---- +error: this file contains an unclosed delimiter + --> $DIR/comment-in-attr-134221.rs:$LINE:$COL + | +LL | #![ + | -^ + | | + | unclosed delimiter + +error: aborting due to 1 previous error + +Couldn't compile the test. + +failures: + $DIR/comment-in-attr-134221.rs - (line 11) + $DIR/comment-in-attr-134221.rs - (line 17) + $DIR/comment-in-attr-134221.rs - (line 23) + +test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME + diff --git a/tests/ui/asm/aarch64/aarch64-sve.rs b/tests/ui/asm/aarch64/aarch64-sve.rs index 8cdc9dd4266ed..81c82d5ad0065 100644 --- a/tests/ui/asm/aarch64/aarch64-sve.rs +++ b/tests/ui/asm/aarch64/aarch64-sve.rs @@ -3,22 +3,10 @@ //@ needs-asm-support #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items)] -#![no_core] // AArch64 test corresponding to arm64ec-sve.rs. -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for f64 {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +use std::arch::asm; fn f(x: f64) { unsafe { diff --git a/tests/ui/asm/aarch64/arm64ec-sve.rs b/tests/ui/asm/aarch64/arm64ec-sve.rs index d2313f8417dc2..38d1c5a551dd5 100644 --- a/tests/ui/asm/aarch64/arm64ec-sve.rs +++ b/tests/ui/asm/aarch64/arm64ec-sve.rs @@ -1,25 +1,17 @@ +//@ add-core-stubs //@ compile-flags: --target arm64ec-pc-windows-msvc //@ needs-asm-support //@ needs-llvm-components: aarch64 #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items)] +#![feature(no_core)] #![no_core] // SVE cannot be used for Arm64EC // https://github.com/rust-lang/rust/pull/131332#issuecomment-2401189142 -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for f64 {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; fn f(x: f64) { unsafe { diff --git a/tests/ui/asm/aarch64/arm64ec-sve.stderr b/tests/ui/asm/aarch64/arm64ec-sve.stderr index 3e1a5d5700408..d654eb4ba1a19 100644 --- a/tests/ui/asm/aarch64/arm64ec-sve.stderr +++ b/tests/ui/asm/aarch64/arm64ec-sve.stderr @@ -1,11 +1,11 @@ error: cannot use register `p0`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC - --> $DIR/arm64ec-sve.rs:26:18 + --> $DIR/arm64ec-sve.rs:18:18 | LL | asm!("", out("p0") _); | ^^^^^^^^^^^ error: cannot use register `ffr`: x13, x14, x23, x24, x28, v16-v31, p*, ffr cannot be used for Arm64EC - --> $DIR/arm64ec-sve.rs:28:18 + --> $DIR/arm64ec-sve.rs:20:18 | LL | asm!("", out("ffr") _); | ^^^^^^^^^^^^ diff --git a/tests/ui/asm/arm-low-dreg.rs b/tests/ui/asm/arm-low-dreg.rs index e9ff0117e2db4..ed6c7c8af195f 100644 --- a/tests/ui/asm/arm-low-dreg.rs +++ b/tests/ui/asm/arm-low-dreg.rs @@ -1,28 +1,17 @@ +//@ add-core-stubs //@ build-pass //@ compile-flags: --target=armv7-unknown-linux-gnueabihf //@ needs-llvm-components: arm -#![feature(no_core, rustc_attrs, decl_macro, lang_items)] +#![feature(no_core)] #![crate_type = "rlib"] -#![no_std] #![no_core] // We accidentally classified "d0"..="d15" as dregs, even though they are in dreg_low16, // and thus didn't compile them on platforms with only 16 dregs. // Highlighted in https://github.com/rust-lang/rust/issues/126797 -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} - -impl Copy for f64 {} - -#[rustc_builtin_macro] -pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) { - /* compiler built-in */ -} - +extern crate minicore; +use minicore::*; fn f(x: f64) -> f64 { let out: f64; diff --git a/tests/ui/asm/bad-template.aarch64.stderr b/tests/ui/asm/bad-template.aarch64.stderr index 5023cf317d7b0..ff4ddf70a76b4 100644 --- a/tests/ui/asm/bad-template.aarch64.stderr +++ b/tests/ui/asm/bad-template.aarch64.stderr @@ -1,5 +1,5 @@ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:30:15 + --> $DIR/bad-template.rs:19:15 | LL | asm!("{}"); | ^^ from here @@ -7,7 +7,7 @@ LL | asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:32:15 + --> $DIR/bad-template.rs:21:15 | LL | asm!("{1}", in(reg) foo); | ^^^ from here @@ -15,7 +15,7 @@ LL | asm!("{1}", in(reg) foo); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:32:21 + --> $DIR/bad-template.rs:21:21 | LL | asm!("{1}", in(reg) foo); | ^^^^^^^^^^^ argument never used @@ -23,13 +23,13 @@ LL | asm!("{1}", in(reg) foo); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` error: there is no argument named `a` - --> $DIR/bad-template.rs:35:16 + --> $DIR/bad-template.rs:24:16 | LL | asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:37:15 + --> $DIR/bad-template.rs:26:15 | LL | asm!("{}", a = in(reg) foo); | ^^ --------------- named argument @@ -38,13 +38,13 @@ LL | asm!("{}", a = in(reg) foo); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:37:20 + --> $DIR/bad-template.rs:26:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:37:20 + --> $DIR/bad-template.rs:26:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -52,7 +52,7 @@ LL | asm!("{}", a = in(reg) foo); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:40:15 + --> $DIR/bad-template.rs:29:15 | LL | asm!("{1}", a = in(reg) foo); | ^^^ from here @@ -60,7 +60,7 @@ LL | asm!("{1}", a = in(reg) foo); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:40:21 + --> $DIR/bad-template.rs:29:21 | LL | asm!("{1}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -68,7 +68,7 @@ LL | asm!("{1}", a = in(reg) foo); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:47:15 + --> $DIR/bad-template.rs:36:15 | LL | asm!("{}", in("x0") foo); | ^^ ------------ explicit register argument @@ -77,24 +77,24 @@ LL | asm!("{}", in("x0") foo); | = note: no positional arguments were given note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:47:20 + --> $DIR/bad-template.rs:36:20 | LL | asm!("{}", in("x0") foo); | ^^^^^^^^^^^^ help: use the register name directly in the assembly code - --> $DIR/bad-template.rs:47:20 + --> $DIR/bad-template.rs:36:20 | LL | asm!("{}", in("x0") foo); | ^^^^^^^^^^^^ error: asm template modifier must be a single character - --> $DIR/bad-template.rs:49:17 + --> $DIR/bad-template.rs:38:17 | LL | asm!("{:foo}", in(reg) foo); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:52:18 + --> $DIR/bad-template.rs:41:18 | LL | asm!("", in(reg) 0, in(reg) 1); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -104,7 +104,7 @@ LL | asm!("", in(reg) 0, in(reg) 1); = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:58:14 + --> $DIR/bad-template.rs:47:14 | LL | global_asm!("{}"); | ^^ from here @@ -112,7 +112,7 @@ LL | global_asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:60:14 + --> $DIR/bad-template.rs:49:14 | LL | global_asm!("{1}", const FOO); | ^^^ from here @@ -120,7 +120,7 @@ LL | global_asm!("{1}", const FOO); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:60:20 + --> $DIR/bad-template.rs:49:20 | LL | global_asm!("{1}", const FOO); | ^^^^^^^^^ argument never used @@ -128,13 +128,13 @@ LL | global_asm!("{1}", const FOO); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` error: there is no argument named `a` - --> $DIR/bad-template.rs:63:15 + --> $DIR/bad-template.rs:52:15 | LL | global_asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:65:14 + --> $DIR/bad-template.rs:54:14 | LL | global_asm!("{}", a = const FOO); | ^^ ------------- named argument @@ -143,13 +143,13 @@ LL | global_asm!("{}", a = const FOO); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:65:19 + --> $DIR/bad-template.rs:54:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:65:19 + --> $DIR/bad-template.rs:54:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -157,7 +157,7 @@ LL | global_asm!("{}", a = const FOO); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:68:14 + --> $DIR/bad-template.rs:57:14 | LL | global_asm!("{1}", a = const FOO); | ^^^ from here @@ -165,7 +165,7 @@ LL | global_asm!("{1}", a = const FOO); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:68:20 + --> $DIR/bad-template.rs:57:20 | LL | global_asm!("{1}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -173,13 +173,13 @@ LL | global_asm!("{1}", a = const FOO); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: asm template modifier must be a single character - --> $DIR/bad-template.rs:71:16 + --> $DIR/bad-template.rs:60:16 | LL | global_asm!("{:foo}", const FOO); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:73:17 + --> $DIR/bad-template.rs:62:17 | LL | global_asm!("", const FOO, const FOO); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -189,7 +189,7 @@ LL | global_asm!("", const FOO, const FOO); = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` warning: formatting may not be suitable for sub-register argument - --> $DIR/bad-template.rs:49:15 + --> $DIR/bad-template.rs:38:15 | LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument diff --git a/tests/ui/asm/bad-template.rs b/tests/ui/asm/bad-template.rs index 6b00905a39326..524b9f7c2e8f1 100644 --- a/tests/ui/asm/bad-template.rs +++ b/tests/ui/asm/bad-template.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 aarch64 //@ [x86_64] compile-flags: --target x86_64-unknown-linux-gnu @@ -6,23 +7,11 @@ //@ [x86_64] needs-llvm-components: x86 //@ [aarch64] needs-llvm-components: aarch64 -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! global_asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} - -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; fn main() { let mut foo = 0; diff --git a/tests/ui/asm/bad-template.x86_64.stderr b/tests/ui/asm/bad-template.x86_64.stderr index 1b9775636f564..229bd8f272266 100644 --- a/tests/ui/asm/bad-template.x86_64.stderr +++ b/tests/ui/asm/bad-template.x86_64.stderr @@ -1,5 +1,5 @@ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:30:15 + --> $DIR/bad-template.rs:19:15 | LL | asm!("{}"); | ^^ from here @@ -7,7 +7,7 @@ LL | asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:32:15 + --> $DIR/bad-template.rs:21:15 | LL | asm!("{1}", in(reg) foo); | ^^^ from here @@ -15,7 +15,7 @@ LL | asm!("{1}", in(reg) foo); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:32:21 + --> $DIR/bad-template.rs:21:21 | LL | asm!("{1}", in(reg) foo); | ^^^^^^^^^^^ argument never used @@ -23,13 +23,13 @@ LL | asm!("{1}", in(reg) foo); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` error: there is no argument named `a` - --> $DIR/bad-template.rs:35:16 + --> $DIR/bad-template.rs:24:16 | LL | asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:37:15 + --> $DIR/bad-template.rs:26:15 | LL | asm!("{}", a = in(reg) foo); | ^^ --------------- named argument @@ -38,13 +38,13 @@ LL | asm!("{}", a = in(reg) foo); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:37:20 + --> $DIR/bad-template.rs:26:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:37:20 + --> $DIR/bad-template.rs:26:20 | LL | asm!("{}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -52,7 +52,7 @@ LL | asm!("{}", a = in(reg) foo); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:40:15 + --> $DIR/bad-template.rs:29:15 | LL | asm!("{1}", a = in(reg) foo); | ^^^ from here @@ -60,7 +60,7 @@ LL | asm!("{1}", a = in(reg) foo); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:40:21 + --> $DIR/bad-template.rs:29:21 | LL | asm!("{1}", a = in(reg) foo); | ^^^^^^^^^^^^^^^ named argument never used @@ -68,7 +68,7 @@ LL | asm!("{1}", a = in(reg) foo); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:44:15 + --> $DIR/bad-template.rs:33:15 | LL | asm!("{}", in("eax") foo); | ^^ ------------- explicit register argument @@ -77,24 +77,24 @@ LL | asm!("{}", in("eax") foo); | = note: no positional arguments were given note: explicit register arguments cannot be used in the asm template - --> $DIR/bad-template.rs:44:20 + --> $DIR/bad-template.rs:33:20 | LL | asm!("{}", in("eax") foo); | ^^^^^^^^^^^^^ help: use the register name directly in the assembly code - --> $DIR/bad-template.rs:44:20 + --> $DIR/bad-template.rs:33:20 | LL | asm!("{}", in("eax") foo); | ^^^^^^^^^^^^^ error: asm template modifier must be a single character - --> $DIR/bad-template.rs:49:17 + --> $DIR/bad-template.rs:38:17 | LL | asm!("{:foo}", in(reg) foo); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:52:18 + --> $DIR/bad-template.rs:41:18 | LL | asm!("", in(reg) 0, in(reg) 1); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -104,7 +104,7 @@ LL | asm!("", in(reg) 0, in(reg) 1); = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:58:14 + --> $DIR/bad-template.rs:47:14 | LL | global_asm!("{}"); | ^^ from here @@ -112,7 +112,7 @@ LL | global_asm!("{}"); = note: no arguments were given error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:60:14 + --> $DIR/bad-template.rs:49:14 | LL | global_asm!("{1}", const FOO); | ^^^ from here @@ -120,7 +120,7 @@ LL | global_asm!("{1}", const FOO); = note: there is 1 argument error: argument never used - --> $DIR/bad-template.rs:60:20 + --> $DIR/bad-template.rs:49:20 | LL | global_asm!("{1}", const FOO); | ^^^^^^^^^ argument never used @@ -128,13 +128,13 @@ LL | global_asm!("{1}", const FOO); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {0} */"` error: there is no argument named `a` - --> $DIR/bad-template.rs:63:15 + --> $DIR/bad-template.rs:52:15 | LL | global_asm!("{a}"); | ^ error: invalid reference to argument at index 0 - --> $DIR/bad-template.rs:65:14 + --> $DIR/bad-template.rs:54:14 | LL | global_asm!("{}", a = const FOO); | ^^ ------------- named argument @@ -143,13 +143,13 @@ LL | global_asm!("{}", a = const FOO); | = note: no positional arguments were given note: named arguments cannot be referenced by position - --> $DIR/bad-template.rs:65:19 + --> $DIR/bad-template.rs:54:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ error: named argument never used - --> $DIR/bad-template.rs:65:19 + --> $DIR/bad-template.rs:54:19 | LL | global_asm!("{}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -157,7 +157,7 @@ LL | global_asm!("{}", a = const FOO); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: invalid reference to argument at index 1 - --> $DIR/bad-template.rs:68:14 + --> $DIR/bad-template.rs:57:14 | LL | global_asm!("{1}", a = const FOO); | ^^^ from here @@ -165,7 +165,7 @@ LL | global_asm!("{1}", a = const FOO); = note: no positional arguments were given error: named argument never used - --> $DIR/bad-template.rs:68:20 + --> $DIR/bad-template.rs:57:20 | LL | global_asm!("{1}", a = const FOO); | ^^^^^^^^^^^^^ named argument never used @@ -173,13 +173,13 @@ LL | global_asm!("{1}", a = const FOO); = help: if this argument is intentionally unused, consider using it in an asm comment: `"/* {a} */"` error: asm template modifier must be a single character - --> $DIR/bad-template.rs:71:16 + --> $DIR/bad-template.rs:60:16 | LL | global_asm!("{:foo}", const FOO); | ^^^ error: multiple unused asm arguments - --> $DIR/bad-template.rs:73:17 + --> $DIR/bad-template.rs:62:17 | LL | global_asm!("", const FOO, const FOO); | ^^^^^^^^^ ^^^^^^^^^ argument never used @@ -189,7 +189,7 @@ LL | global_asm!("", const FOO, const FOO); = help: if these arguments are intentionally unused, consider using them in an asm comment: `"/* {0} {1} */"` warning: formatting may not be suitable for sub-register argument - --> $DIR/bad-template.rs:49:15 + --> $DIR/bad-template.rs:38:15 | LL | asm!("{:foo}", in(reg) foo); | ^^^^^^ --- for this argument diff --git a/tests/ui/asm/inline-syntax.arm.stderr b/tests/ui/asm/inline-syntax.arm.stderr index e36ec125d13f2..4003a10f37452 100644 --- a/tests/ui/asm/inline-syntax.arm.stderr +++ b/tests/ui/asm/inline-syntax.arm.stderr @@ -15,7 +15,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:35:15 + --> $DIR/inline-syntax.rs:26:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -27,7 +27,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:39:15 + --> $DIR/inline-syntax.rs:30:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | .intel_syntax aaa noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:43:15 + --> $DIR/inline-syntax.rs:34:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^ @@ -51,7 +51,7 @@ LL | .att_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:47:15 + --> $DIR/inline-syntax.rs:38:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | .att_syntax bbb noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:51:15 + --> $DIR/inline-syntax.rs:42:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -75,7 +75,7 @@ LL | .intel_syntax noprefix; nop | ^ error: unknown directive - --> $DIR/inline-syntax.rs:58:13 + --> $DIR/inline-syntax.rs:49:13 | LL | .intel_syntax noprefix | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/asm/inline-syntax.arm_llvm_18.stderr b/tests/ui/asm/inline-syntax.arm_llvm_18.stderr index ada3f4891d3ac..a03861c78a3e6 100644 --- a/tests/ui/asm/inline-syntax.arm_llvm_18.stderr +++ b/tests/ui/asm/inline-syntax.arm_llvm_18.stderr @@ -15,7 +15,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:35:15 + --> $DIR/inline-syntax.rs:26:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^ @@ -27,7 +27,7 @@ LL | .intel_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:39:15 + --> $DIR/inline-syntax.rs:30:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^ @@ -39,7 +39,7 @@ LL | .intel_syntax aaa noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:43:15 + --> $DIR/inline-syntax.rs:34:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^ @@ -51,7 +51,7 @@ LL | .att_syntax noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:47:15 + --> $DIR/inline-syntax.rs:38:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^ @@ -63,7 +63,7 @@ LL | .att_syntax bbb noprefix | ^ error: unknown directive - --> $DIR/inline-syntax.rs:51:15 + --> $DIR/inline-syntax.rs:42:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^ @@ -75,7 +75,7 @@ LL | .intel_syntax noprefix; nop | ^ error: unknown directive - --> $DIR/inline-syntax.rs:58:13 + --> $DIR/inline-syntax.rs:49:13 | LL | .intel_syntax noprefix | ^ diff --git a/tests/ui/asm/inline-syntax.rs b/tests/ui/asm/inline-syntax.rs index fda79b2afa388..adbda369b6a76 100644 --- a/tests/ui/asm/inline-syntax.rs +++ b/tests/ui/asm/inline-syntax.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: x86_64 arm_llvm_18 arm //@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu //@[x86_64] check-pass @@ -13,22 +14,12 @@ //@[arm] min-llvm-version: 19 //@ needs-asm-support -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![crate_type = "rlib"] #![no_core] - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[rustc_builtin_macro] -macro_rules! global_asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn main() { unsafe { diff --git a/tests/ui/asm/inline-syntax.x86_64.stderr b/tests/ui/asm/inline-syntax.x86_64.stderr index 66dc37f3089e1..369f7b66ae45a 100644 --- a/tests/ui/asm/inline-syntax.x86_64.stderr +++ b/tests/ui/asm/inline-syntax.x86_64.stderr @@ -1,5 +1,5 @@ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:67:14 + --> $DIR/inline-syntax.rs:58:14 | LL | global_asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ @@ -7,37 +7,37 @@ LL | global_asm!(".intel_syntax noprefix", "nop"); = note: `#[warn(bad_asm_style)]` on by default warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:35:15 + --> $DIR/inline-syntax.rs:26:15 | LL | asm!(".intel_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:39:15 + --> $DIR/inline-syntax.rs:30:15 | LL | asm!(".intel_syntax aaa noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:43:15 + --> $DIR/inline-syntax.rs:34:15 | LL | asm!(".att_syntax noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead - --> $DIR/inline-syntax.rs:47:15 + --> $DIR/inline-syntax.rs:38:15 | LL | asm!(".att_syntax bbb noprefix", "nop"); | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:51:15 + --> $DIR/inline-syntax.rs:42:15 | LL | asm!(".intel_syntax noprefix; nop"); | ^^^^^^^^^^^^^^^^^^^^^^ warning: avoid using `.intel_syntax`, Intel syntax is the default - --> $DIR/inline-syntax.rs:58:13 + --> $DIR/inline-syntax.rs:49:13 | LL | .intel_syntax noprefix | ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/asm/issue-85247.rs b/tests/ui/asm/issue-85247.rs index b55b1876ac8c2..47bfda14092d7 100644 --- a/tests/ui/asm/issue-85247.rs +++ b/tests/ui/asm/issue-85247.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: ropi rwpi //@ [ropi] compile-flags: --target armv7-unknown-linux-gnueabihf -C relocation-model=ropi @@ -6,16 +7,12 @@ //@ [rwpi] needs-llvm-components: arm //@ [ropi] build-pass -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![no_core] #![crate_type = "rlib"] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // R9 is reserved as the RWPI base register fn main() { diff --git a/tests/ui/asm/issue-85247.rwpi.stderr b/tests/ui/asm/issue-85247.rwpi.stderr index 8466a53be299e..8d51b62ac090b 100644 --- a/tests/ui/asm/issue-85247.rwpi.stderr +++ b/tests/ui/asm/issue-85247.rwpi.stderr @@ -1,5 +1,5 @@ error: cannot use register `r9`: the RWPI static base register (r9) cannot be used as an operand for inline asm - --> $DIR/issue-85247.rs:23:18 + --> $DIR/issue-85247.rs:20:18 | LL | asm!("", out("r9") _); | ^^^^^^^^^^^ diff --git a/tests/ui/asm/issue-92378.rs b/tests/ui/asm/issue-92378.rs index 3cbdabf8134f4..e8a15b119461e 100644 --- a/tests/ui/asm/issue-92378.rs +++ b/tests/ui/asm/issue-92378.rs @@ -1,18 +1,15 @@ +//@ add-core-stubs //@ compile-flags: --target armv5te-unknown-linux-gnueabi //@ needs-llvm-components: arm //@ needs-asm-support //@ build-pass -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![no_core] #![crate_type = "rlib"] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // ARM uses R11 for the frame pointer, make sure R7 is usable. #[instruction_set(arm::a32)] diff --git a/tests/ui/asm/issue-99071.rs b/tests/ui/asm/issue-99071.rs index bc3f781551148..6a00fce7de46e 100644 --- a/tests/ui/asm/issue-99071.rs +++ b/tests/ui/asm/issue-99071.rs @@ -1,17 +1,14 @@ +//@ add-core-stubs //@ compile-flags: --target thumbv6m-none-eabi //@ needs-llvm-components: arm //@ needs-asm-support -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![no_core] #![crate_type = "rlib"] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; pub fn foo() { unsafe { diff --git a/tests/ui/asm/issue-99071.stderr b/tests/ui/asm/issue-99071.stderr index 1703d2977a723..1a8074b01d66d 100644 --- a/tests/ui/asm/issue-99071.stderr +++ b/tests/ui/asm/issue-99071.stderr @@ -1,5 +1,5 @@ error: cannot use register `r8`: high registers (r8+) can only be used as clobbers in Thumb-1 code - --> $DIR/issue-99071.rs:18:18 + --> $DIR/issue-99071.rs:15:18 | LL | asm!("", in("r8") 0); | ^^^^^^^^^^ diff --git a/tests/ui/asm/loongarch/bad-reg.rs b/tests/ui/asm/loongarch/bad-reg.rs index c5288cc78b71f..685b460bc922c 100644 --- a/tests/ui/asm/loongarch/bad-reg.rs +++ b/tests/ui/asm/loongarch/bad-reg.rs @@ -7,7 +7,7 @@ //@[loongarch64_lp64s] needs-llvm-components: loongarch #![crate_type = "lib"] -#![feature(no_core, rustc_attrs)] +#![feature(no_core)] #![no_core] extern crate minicore; diff --git a/tests/ui/asm/naked-functions-instruction-set.rs b/tests/ui/asm/naked-functions-instruction-set.rs index 3a6e7a46ce5a7..28241badf5f87 100644 --- a/tests/ui/asm/naked-functions-instruction-set.rs +++ b/tests/ui/asm/naked-functions-instruction-set.rs @@ -1,19 +1,15 @@ +//@ add-core-stubs //@ compile-flags: --target armv5te-unknown-linux-gnueabi //@ needs-llvm-components: arm //@ needs-asm-support //@ build-pass #![crate_type = "lib"] -#![feature(no_core, lang_items, rustc_attrs, naked_functions)] +#![feature(no_core, naked_functions)] #![no_core] -#[rustc_builtin_macro] -macro_rules! naked_asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; #[no_mangle] #[naked] diff --git a/tests/ui/asm/powerpc/bad-reg.aix64.stderr b/tests/ui/asm/powerpc/bad-reg.aix64.stderr index 036641951cc93..124013f89afa9 100644 --- a/tests/ui/asm/powerpc/bad-reg.aix64.stderr +++ b/tests/ui/asm/powerpc/bad-reg.aix64.stderr @@ -1,101 +1,101 @@ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:45:18 + --> $DIR/bad-reg.rs:36:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:47:18 + --> $DIR/bad-reg.rs:38:18 | LL | asm!("", out("r2") _); | ^^^^^^^^^^^ error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:51:18 + --> $DIR/bad-reg.rs:42:18 | LL | asm!("", out("r29") _); | ^^^^^^^^^^^^ error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:53:18 + --> $DIR/bad-reg.rs:44:18 | LL | asm!("", out("r30") _); | ^^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:55:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `lr`: the link register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:48:18 | LL | asm!("", out("lr") _); | ^^^^^^^^^^^ error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:59:18 + --> $DIR/bad-reg.rs:50:18 | LL | asm!("", out("ctr") _); | ^^^^^^^^^^^^ error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:61:18 + --> $DIR/bad-reg.rs:52:18 | LL | asm!("", out("vrsave") _); | ^^^^^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:109:18 + --> $DIR/bad-reg.rs:100:18 | LL | asm!("", in("cr") x); | ^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:112:18 + --> $DIR/bad-reg.rs:103:18 | LL | asm!("", out("cr") x); | ^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:115:26 + --> $DIR/bad-reg.rs:106:26 | LL | asm!("/* {} */", in(cr) x); | ^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:118:26 + --> $DIR/bad-reg.rs:109:26 | LL | asm!("/* {} */", out(cr) _); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:122:18 + --> $DIR/bad-reg.rs:113:18 | LL | asm!("", in("xer") x); | ^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:125:18 + --> $DIR/bad-reg.rs:116:18 | LL | asm!("", out("xer") x); | ^^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:128:26 + --> $DIR/bad-reg.rs:119:26 | LL | asm!("/* {} */", in(xer) x); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:131:26 + --> $DIR/bad-reg.rs:122:26 | LL | asm!("/* {} */", out(xer) _); | ^^^^^^^^^^ error: register `cr0` conflicts with register `cr` - --> $DIR/bad-reg.rs:135:31 + --> $DIR/bad-reg.rs:126:31 | LL | asm!("", out("cr") _, out("cr0") _); | ----------- ^^^^^^^^^^^^ register `cr0` @@ -103,7 +103,7 @@ LL | asm!("", out("cr") _, out("cr0") _); | register `cr` error: register `cr1` conflicts with register `cr` - --> $DIR/bad-reg.rs:137:31 + --> $DIR/bad-reg.rs:128:31 | LL | asm!("", out("cr") _, out("cr1") _); | ----------- ^^^^^^^^^^^^ register `cr1` @@ -111,7 +111,7 @@ LL | asm!("", out("cr") _, out("cr1") _); | register `cr` error: register `cr2` conflicts with register `cr` - --> $DIR/bad-reg.rs:139:31 + --> $DIR/bad-reg.rs:130:31 | LL | asm!("", out("cr") _, out("cr2") _); | ----------- ^^^^^^^^^^^^ register `cr2` @@ -119,7 +119,7 @@ LL | asm!("", out("cr") _, out("cr2") _); | register `cr` error: register `cr3` conflicts with register `cr` - --> $DIR/bad-reg.rs:141:31 + --> $DIR/bad-reg.rs:132:31 | LL | asm!("", out("cr") _, out("cr3") _); | ----------- ^^^^^^^^^^^^ register `cr3` @@ -127,7 +127,7 @@ LL | asm!("", out("cr") _, out("cr3") _); | register `cr` error: register `cr4` conflicts with register `cr` - --> $DIR/bad-reg.rs:143:31 + --> $DIR/bad-reg.rs:134:31 | LL | asm!("", out("cr") _, out("cr4") _); | ----------- ^^^^^^^^^^^^ register `cr4` @@ -135,7 +135,7 @@ LL | asm!("", out("cr") _, out("cr4") _); | register `cr` error: register `cr5` conflicts with register `cr` - --> $DIR/bad-reg.rs:145:31 + --> $DIR/bad-reg.rs:136:31 | LL | asm!("", out("cr") _, out("cr5") _); | ----------- ^^^^^^^^^^^^ register `cr5` @@ -143,7 +143,7 @@ LL | asm!("", out("cr") _, out("cr5") _); | register `cr` error: register `cr6` conflicts with register `cr` - --> $DIR/bad-reg.rs:147:31 + --> $DIR/bad-reg.rs:138:31 | LL | asm!("", out("cr") _, out("cr6") _); | ----------- ^^^^^^^^^^^^ register `cr6` @@ -151,7 +151,7 @@ LL | asm!("", out("cr") _, out("cr6") _); | register `cr` error: register `cr7` conflicts with register `cr` - --> $DIR/bad-reg.rs:149:31 + --> $DIR/bad-reg.rs:140:31 | LL | asm!("", out("cr") _, out("cr7") _); | ----------- ^^^^^^^^^^^^ register `cr7` @@ -159,13 +159,13 @@ LL | asm!("", out("cr") _, out("cr7") _); | register `cr` error: cannot use register `r13`: r13 is a reserved register on this target - --> $DIR/bad-reg.rs:49:18 + --> $DIR/bad-reg.rs:40:18 | LL | asm!("", out("r13") _); | ^^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:76:27 + --> $DIR/bad-reg.rs:67:27 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available | ^ @@ -173,7 +173,7 @@ LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:79:28 + --> $DIR/bad-reg.rs:70:28 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available | ^ @@ -181,7 +181,7 @@ LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:87:35 + --> $DIR/bad-reg.rs:78:35 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available | ^ @@ -189,7 +189,7 @@ LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is avai = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:109:27 + --> $DIR/bad-reg.rs:100:27 | LL | asm!("", in("cr") x); | ^ @@ -197,7 +197,7 @@ LL | asm!("", in("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:112:28 + --> $DIR/bad-reg.rs:103:28 | LL | asm!("", out("cr") x); | ^ @@ -205,7 +205,7 @@ LL | asm!("", out("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:115:33 + --> $DIR/bad-reg.rs:106:33 | LL | asm!("/* {} */", in(cr) x); | ^ @@ -213,7 +213,7 @@ LL | asm!("/* {} */", in(cr) x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:122:28 + --> $DIR/bad-reg.rs:113:28 | LL | asm!("", in("xer") x); | ^ @@ -221,7 +221,7 @@ LL | asm!("", in("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:125:29 + --> $DIR/bad-reg.rs:116:29 | LL | asm!("", out("xer") x); | ^ @@ -229,7 +229,7 @@ LL | asm!("", out("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:128:34 + --> $DIR/bad-reg.rs:119:34 | LL | asm!("/* {} */", in(xer) x); | ^ diff --git a/tests/ui/asm/powerpc/bad-reg.powerpc.stderr b/tests/ui/asm/powerpc/bad-reg.powerpc.stderr index 13fc5a048d82f..b11c946f80da5 100644 --- a/tests/ui/asm/powerpc/bad-reg.powerpc.stderr +++ b/tests/ui/asm/powerpc/bad-reg.powerpc.stderr @@ -1,101 +1,101 @@ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:45:18 + --> $DIR/bad-reg.rs:36:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:47:18 + --> $DIR/bad-reg.rs:38:18 | LL | asm!("", out("r2") _); | ^^^^^^^^^^^ error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:51:18 + --> $DIR/bad-reg.rs:42:18 | LL | asm!("", out("r29") _); | ^^^^^^^^^^^^ error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:53:18 + --> $DIR/bad-reg.rs:44:18 | LL | asm!("", out("r30") _); | ^^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:55:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `lr`: the link register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:48:18 | LL | asm!("", out("lr") _); | ^^^^^^^^^^^ error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:59:18 + --> $DIR/bad-reg.rs:50:18 | LL | asm!("", out("ctr") _); | ^^^^^^^^^^^^ error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:61:18 + --> $DIR/bad-reg.rs:52:18 | LL | asm!("", out("vrsave") _); | ^^^^^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:109:18 + --> $DIR/bad-reg.rs:100:18 | LL | asm!("", in("cr") x); | ^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:112:18 + --> $DIR/bad-reg.rs:103:18 | LL | asm!("", out("cr") x); | ^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:115:26 + --> $DIR/bad-reg.rs:106:26 | LL | asm!("/* {} */", in(cr) x); | ^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:118:26 + --> $DIR/bad-reg.rs:109:26 | LL | asm!("/* {} */", out(cr) _); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:122:18 + --> $DIR/bad-reg.rs:113:18 | LL | asm!("", in("xer") x); | ^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:125:18 + --> $DIR/bad-reg.rs:116:18 | LL | asm!("", out("xer") x); | ^^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:128:26 + --> $DIR/bad-reg.rs:119:26 | LL | asm!("/* {} */", in(xer) x); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:131:26 + --> $DIR/bad-reg.rs:122:26 | LL | asm!("/* {} */", out(xer) _); | ^^^^^^^^^^ error: register `cr0` conflicts with register `cr` - --> $DIR/bad-reg.rs:135:31 + --> $DIR/bad-reg.rs:126:31 | LL | asm!("", out("cr") _, out("cr0") _); | ----------- ^^^^^^^^^^^^ register `cr0` @@ -103,7 +103,7 @@ LL | asm!("", out("cr") _, out("cr0") _); | register `cr` error: register `cr1` conflicts with register `cr` - --> $DIR/bad-reg.rs:137:31 + --> $DIR/bad-reg.rs:128:31 | LL | asm!("", out("cr") _, out("cr1") _); | ----------- ^^^^^^^^^^^^ register `cr1` @@ -111,7 +111,7 @@ LL | asm!("", out("cr") _, out("cr1") _); | register `cr` error: register `cr2` conflicts with register `cr` - --> $DIR/bad-reg.rs:139:31 + --> $DIR/bad-reg.rs:130:31 | LL | asm!("", out("cr") _, out("cr2") _); | ----------- ^^^^^^^^^^^^ register `cr2` @@ -119,7 +119,7 @@ LL | asm!("", out("cr") _, out("cr2") _); | register `cr` error: register `cr3` conflicts with register `cr` - --> $DIR/bad-reg.rs:141:31 + --> $DIR/bad-reg.rs:132:31 | LL | asm!("", out("cr") _, out("cr3") _); | ----------- ^^^^^^^^^^^^ register `cr3` @@ -127,7 +127,7 @@ LL | asm!("", out("cr") _, out("cr3") _); | register `cr` error: register `cr4` conflicts with register `cr` - --> $DIR/bad-reg.rs:143:31 + --> $DIR/bad-reg.rs:134:31 | LL | asm!("", out("cr") _, out("cr4") _); | ----------- ^^^^^^^^^^^^ register `cr4` @@ -135,7 +135,7 @@ LL | asm!("", out("cr") _, out("cr4") _); | register `cr` error: register `cr5` conflicts with register `cr` - --> $DIR/bad-reg.rs:145:31 + --> $DIR/bad-reg.rs:136:31 | LL | asm!("", out("cr") _, out("cr5") _); | ----------- ^^^^^^^^^^^^ register `cr5` @@ -143,7 +143,7 @@ LL | asm!("", out("cr") _, out("cr5") _); | register `cr` error: register `cr6` conflicts with register `cr` - --> $DIR/bad-reg.rs:147:31 + --> $DIR/bad-reg.rs:138:31 | LL | asm!("", out("cr") _, out("cr6") _); | ----------- ^^^^^^^^^^^^ register `cr6` @@ -151,7 +151,7 @@ LL | asm!("", out("cr") _, out("cr6") _); | register `cr` error: register `cr7` conflicts with register `cr` - --> $DIR/bad-reg.rs:149:31 + --> $DIR/bad-reg.rs:140:31 | LL | asm!("", out("cr") _, out("cr7") _); | ----------- ^^^^^^^^^^^^ register `cr7` @@ -159,73 +159,73 @@ LL | asm!("", out("cr") _, out("cr7") _); | register `cr` error: cannot use register `r13`: r13 is a reserved register on this target - --> $DIR/bad-reg.rs:49:18 + --> $DIR/bad-reg.rs:40:18 | LL | asm!("", out("r13") _); | ^^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:66:18 + --> $DIR/bad-reg.rs:57:18 | LL | asm!("", in("v0") v32x4); // requires altivec | ^^^^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:68:18 + --> $DIR/bad-reg.rs:59:18 | LL | asm!("", out("v0") v32x4); // requires altivec | ^^^^^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:70:18 + --> $DIR/bad-reg.rs:61:18 | LL | asm!("", in("v0") v64x2); // requires vsx | ^^^^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:73:18 + --> $DIR/bad-reg.rs:64:18 | LL | asm!("", out("v0") v64x2); // requires vsx | ^^^^^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:76:18 + --> $DIR/bad-reg.rs:67:18 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available | ^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:79:18 + --> $DIR/bad-reg.rs:70:18 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available | ^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:82:26 + --> $DIR/bad-reg.rs:73:26 | LL | asm!("/* {} */", in(vreg) v32x4); // requires altivec | ^^^^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:84:26 + --> $DIR/bad-reg.rs:75:26 | LL | asm!("/* {} */", in(vreg) v64x2); // requires vsx | ^^^^^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:87:26 + --> $DIR/bad-reg.rs:78:26 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available | ^^^^^^^^^^ error: register class `vreg` requires at least one of the following target features: altivec, vsx - --> $DIR/bad-reg.rs:90:26 + --> $DIR/bad-reg.rs:81:26 | LL | asm!("/* {} */", out(vreg) _); // requires altivec | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:109:27 + --> $DIR/bad-reg.rs:100:27 | LL | asm!("", in("cr") x); | ^ @@ -233,7 +233,7 @@ LL | asm!("", in("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:112:28 + --> $DIR/bad-reg.rs:103:28 | LL | asm!("", out("cr") x); | ^ @@ -241,7 +241,7 @@ LL | asm!("", out("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:115:33 + --> $DIR/bad-reg.rs:106:33 | LL | asm!("/* {} */", in(cr) x); | ^ @@ -249,7 +249,7 @@ LL | asm!("/* {} */", in(cr) x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:122:28 + --> $DIR/bad-reg.rs:113:28 | LL | asm!("", in("xer") x); | ^ @@ -257,7 +257,7 @@ LL | asm!("", in("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:125:29 + --> $DIR/bad-reg.rs:116:29 | LL | asm!("", out("xer") x); | ^ @@ -265,7 +265,7 @@ LL | asm!("", out("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:128:34 + --> $DIR/bad-reg.rs:119:34 | LL | asm!("/* {} */", in(xer) x); | ^ diff --git a/tests/ui/asm/powerpc/bad-reg.powerpc64.stderr b/tests/ui/asm/powerpc/bad-reg.powerpc64.stderr index 6a9d552bfe29a..a93b2b018df0e 100644 --- a/tests/ui/asm/powerpc/bad-reg.powerpc64.stderr +++ b/tests/ui/asm/powerpc/bad-reg.powerpc64.stderr @@ -1,101 +1,101 @@ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:45:18 + --> $DIR/bad-reg.rs:36:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:47:18 + --> $DIR/bad-reg.rs:38:18 | LL | asm!("", out("r2") _); | ^^^^^^^^^^^ error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:51:18 + --> $DIR/bad-reg.rs:42:18 | LL | asm!("", out("r29") _); | ^^^^^^^^^^^^ error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:53:18 + --> $DIR/bad-reg.rs:44:18 | LL | asm!("", out("r30") _); | ^^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:55:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `lr`: the link register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:48:18 | LL | asm!("", out("lr") _); | ^^^^^^^^^^^ error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:59:18 + --> $DIR/bad-reg.rs:50:18 | LL | asm!("", out("ctr") _); | ^^^^^^^^^^^^ error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:61:18 + --> $DIR/bad-reg.rs:52:18 | LL | asm!("", out("vrsave") _); | ^^^^^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:109:18 + --> $DIR/bad-reg.rs:100:18 | LL | asm!("", in("cr") x); | ^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:112:18 + --> $DIR/bad-reg.rs:103:18 | LL | asm!("", out("cr") x); | ^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:115:26 + --> $DIR/bad-reg.rs:106:26 | LL | asm!("/* {} */", in(cr) x); | ^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:118:26 + --> $DIR/bad-reg.rs:109:26 | LL | asm!("/* {} */", out(cr) _); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:122:18 + --> $DIR/bad-reg.rs:113:18 | LL | asm!("", in("xer") x); | ^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:125:18 + --> $DIR/bad-reg.rs:116:18 | LL | asm!("", out("xer") x); | ^^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:128:26 + --> $DIR/bad-reg.rs:119:26 | LL | asm!("/* {} */", in(xer) x); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:131:26 + --> $DIR/bad-reg.rs:122:26 | LL | asm!("/* {} */", out(xer) _); | ^^^^^^^^^^ error: register `cr0` conflicts with register `cr` - --> $DIR/bad-reg.rs:135:31 + --> $DIR/bad-reg.rs:126:31 | LL | asm!("", out("cr") _, out("cr0") _); | ----------- ^^^^^^^^^^^^ register `cr0` @@ -103,7 +103,7 @@ LL | asm!("", out("cr") _, out("cr0") _); | register `cr` error: register `cr1` conflicts with register `cr` - --> $DIR/bad-reg.rs:137:31 + --> $DIR/bad-reg.rs:128:31 | LL | asm!("", out("cr") _, out("cr1") _); | ----------- ^^^^^^^^^^^^ register `cr1` @@ -111,7 +111,7 @@ LL | asm!("", out("cr") _, out("cr1") _); | register `cr` error: register `cr2` conflicts with register `cr` - --> $DIR/bad-reg.rs:139:31 + --> $DIR/bad-reg.rs:130:31 | LL | asm!("", out("cr") _, out("cr2") _); | ----------- ^^^^^^^^^^^^ register `cr2` @@ -119,7 +119,7 @@ LL | asm!("", out("cr") _, out("cr2") _); | register `cr` error: register `cr3` conflicts with register `cr` - --> $DIR/bad-reg.rs:141:31 + --> $DIR/bad-reg.rs:132:31 | LL | asm!("", out("cr") _, out("cr3") _); | ----------- ^^^^^^^^^^^^ register `cr3` @@ -127,7 +127,7 @@ LL | asm!("", out("cr") _, out("cr3") _); | register `cr` error: register `cr4` conflicts with register `cr` - --> $DIR/bad-reg.rs:143:31 + --> $DIR/bad-reg.rs:134:31 | LL | asm!("", out("cr") _, out("cr4") _); | ----------- ^^^^^^^^^^^^ register `cr4` @@ -135,7 +135,7 @@ LL | asm!("", out("cr") _, out("cr4") _); | register `cr` error: register `cr5` conflicts with register `cr` - --> $DIR/bad-reg.rs:145:31 + --> $DIR/bad-reg.rs:136:31 | LL | asm!("", out("cr") _, out("cr5") _); | ----------- ^^^^^^^^^^^^ register `cr5` @@ -143,7 +143,7 @@ LL | asm!("", out("cr") _, out("cr5") _); | register `cr` error: register `cr6` conflicts with register `cr` - --> $DIR/bad-reg.rs:147:31 + --> $DIR/bad-reg.rs:138:31 | LL | asm!("", out("cr") _, out("cr6") _); | ----------- ^^^^^^^^^^^^ register `cr6` @@ -151,7 +151,7 @@ LL | asm!("", out("cr") _, out("cr6") _); | register `cr` error: register `cr7` conflicts with register `cr` - --> $DIR/bad-reg.rs:149:31 + --> $DIR/bad-reg.rs:140:31 | LL | asm!("", out("cr") _, out("cr7") _); | ----------- ^^^^^^^^^^^^ register `cr7` @@ -159,13 +159,13 @@ LL | asm!("", out("cr") _, out("cr7") _); | register `cr` error: cannot use register `r13`: r13 is a reserved register on this target - --> $DIR/bad-reg.rs:49:18 + --> $DIR/bad-reg.rs:40:18 | LL | asm!("", out("r13") _); | ^^^^^^^^^^^^ error: `vsx` target feature is not enabled - --> $DIR/bad-reg.rs:70:27 + --> $DIR/bad-reg.rs:61:27 | LL | asm!("", in("v0") v64x2); // requires vsx | ^^^^^ @@ -173,7 +173,7 @@ LL | asm!("", in("v0") v64x2); // requires vsx = note: this is required to use type `i64x2` with register class `vreg` error: `vsx` target feature is not enabled - --> $DIR/bad-reg.rs:73:28 + --> $DIR/bad-reg.rs:64:28 | LL | asm!("", out("v0") v64x2); // requires vsx | ^^^^^ @@ -181,7 +181,7 @@ LL | asm!("", out("v0") v64x2); // requires vsx = note: this is required to use type `i64x2` with register class `vreg` error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:76:27 + --> $DIR/bad-reg.rs:67:27 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available | ^ @@ -189,7 +189,7 @@ LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:79:28 + --> $DIR/bad-reg.rs:70:28 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available | ^ @@ -197,7 +197,7 @@ LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: `vsx` target feature is not enabled - --> $DIR/bad-reg.rs:84:35 + --> $DIR/bad-reg.rs:75:35 | LL | asm!("/* {} */", in(vreg) v64x2); // requires vsx | ^^^^^ @@ -205,7 +205,7 @@ LL | asm!("/* {} */", in(vreg) v64x2); // requires vsx = note: this is required to use type `i64x2` with register class `vreg` error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:87:35 + --> $DIR/bad-reg.rs:78:35 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available | ^ @@ -213,7 +213,7 @@ LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is avai = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:109:27 + --> $DIR/bad-reg.rs:100:27 | LL | asm!("", in("cr") x); | ^ @@ -221,7 +221,7 @@ LL | asm!("", in("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:112:28 + --> $DIR/bad-reg.rs:103:28 | LL | asm!("", out("cr") x); | ^ @@ -229,7 +229,7 @@ LL | asm!("", out("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:115:33 + --> $DIR/bad-reg.rs:106:33 | LL | asm!("/* {} */", in(cr) x); | ^ @@ -237,7 +237,7 @@ LL | asm!("/* {} */", in(cr) x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:122:28 + --> $DIR/bad-reg.rs:113:28 | LL | asm!("", in("xer") x); | ^ @@ -245,7 +245,7 @@ LL | asm!("", in("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:125:29 + --> $DIR/bad-reg.rs:116:29 | LL | asm!("", out("xer") x); | ^ @@ -253,7 +253,7 @@ LL | asm!("", out("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:128:34 + --> $DIR/bad-reg.rs:119:34 | LL | asm!("/* {} */", in(xer) x); | ^ diff --git a/tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr b/tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr index 036641951cc93..124013f89afa9 100644 --- a/tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr +++ b/tests/ui/asm/powerpc/bad-reg.powerpc64le.stderr @@ -1,101 +1,101 @@ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:45:18 + --> $DIR/bad-reg.rs:36:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `r2`: r2 is a system reserved register and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:47:18 + --> $DIR/bad-reg.rs:38:18 | LL | asm!("", out("r2") _); | ^^^^^^^^^^^ error: invalid register `r29`: r29 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:51:18 + --> $DIR/bad-reg.rs:42:18 | LL | asm!("", out("r29") _); | ^^^^^^^^^^^^ error: invalid register `r30`: r30 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:53:18 + --> $DIR/bad-reg.rs:44:18 | LL | asm!("", out("r30") _); | ^^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:55:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `lr`: the link register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:48:18 | LL | asm!("", out("lr") _); | ^^^^^^^^^^^ error: invalid register `ctr`: the counter register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:59:18 + --> $DIR/bad-reg.rs:50:18 | LL | asm!("", out("ctr") _); | ^^^^^^^^^^^^ error: invalid register `vrsave`: the vrsave register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:61:18 + --> $DIR/bad-reg.rs:52:18 | LL | asm!("", out("vrsave") _); | ^^^^^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:109:18 + --> $DIR/bad-reg.rs:100:18 | LL | asm!("", in("cr") x); | ^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:112:18 + --> $DIR/bad-reg.rs:103:18 | LL | asm!("", out("cr") x); | ^^^^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:115:26 + --> $DIR/bad-reg.rs:106:26 | LL | asm!("/* {} */", in(cr) x); | ^^^^^^^^ error: register class `cr` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:118:26 + --> $DIR/bad-reg.rs:109:26 | LL | asm!("/* {} */", out(cr) _); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:122:18 + --> $DIR/bad-reg.rs:113:18 | LL | asm!("", in("xer") x); | ^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:125:18 + --> $DIR/bad-reg.rs:116:18 | LL | asm!("", out("xer") x); | ^^^^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:128:26 + --> $DIR/bad-reg.rs:119:26 | LL | asm!("/* {} */", in(xer) x); | ^^^^^^^^^ error: register class `xer` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:131:26 + --> $DIR/bad-reg.rs:122:26 | LL | asm!("/* {} */", out(xer) _); | ^^^^^^^^^^ error: register `cr0` conflicts with register `cr` - --> $DIR/bad-reg.rs:135:31 + --> $DIR/bad-reg.rs:126:31 | LL | asm!("", out("cr") _, out("cr0") _); | ----------- ^^^^^^^^^^^^ register `cr0` @@ -103,7 +103,7 @@ LL | asm!("", out("cr") _, out("cr0") _); | register `cr` error: register `cr1` conflicts with register `cr` - --> $DIR/bad-reg.rs:137:31 + --> $DIR/bad-reg.rs:128:31 | LL | asm!("", out("cr") _, out("cr1") _); | ----------- ^^^^^^^^^^^^ register `cr1` @@ -111,7 +111,7 @@ LL | asm!("", out("cr") _, out("cr1") _); | register `cr` error: register `cr2` conflicts with register `cr` - --> $DIR/bad-reg.rs:139:31 + --> $DIR/bad-reg.rs:130:31 | LL | asm!("", out("cr") _, out("cr2") _); | ----------- ^^^^^^^^^^^^ register `cr2` @@ -119,7 +119,7 @@ LL | asm!("", out("cr") _, out("cr2") _); | register `cr` error: register `cr3` conflicts with register `cr` - --> $DIR/bad-reg.rs:141:31 + --> $DIR/bad-reg.rs:132:31 | LL | asm!("", out("cr") _, out("cr3") _); | ----------- ^^^^^^^^^^^^ register `cr3` @@ -127,7 +127,7 @@ LL | asm!("", out("cr") _, out("cr3") _); | register `cr` error: register `cr4` conflicts with register `cr` - --> $DIR/bad-reg.rs:143:31 + --> $DIR/bad-reg.rs:134:31 | LL | asm!("", out("cr") _, out("cr4") _); | ----------- ^^^^^^^^^^^^ register `cr4` @@ -135,7 +135,7 @@ LL | asm!("", out("cr") _, out("cr4") _); | register `cr` error: register `cr5` conflicts with register `cr` - --> $DIR/bad-reg.rs:145:31 + --> $DIR/bad-reg.rs:136:31 | LL | asm!("", out("cr") _, out("cr5") _); | ----------- ^^^^^^^^^^^^ register `cr5` @@ -143,7 +143,7 @@ LL | asm!("", out("cr") _, out("cr5") _); | register `cr` error: register `cr6` conflicts with register `cr` - --> $DIR/bad-reg.rs:147:31 + --> $DIR/bad-reg.rs:138:31 | LL | asm!("", out("cr") _, out("cr6") _); | ----------- ^^^^^^^^^^^^ register `cr6` @@ -151,7 +151,7 @@ LL | asm!("", out("cr") _, out("cr6") _); | register `cr` error: register `cr7` conflicts with register `cr` - --> $DIR/bad-reg.rs:149:31 + --> $DIR/bad-reg.rs:140:31 | LL | asm!("", out("cr") _, out("cr7") _); | ----------- ^^^^^^^^^^^^ register `cr7` @@ -159,13 +159,13 @@ LL | asm!("", out("cr") _, out("cr7") _); | register `cr` error: cannot use register `r13`: r13 is a reserved register on this target - --> $DIR/bad-reg.rs:49:18 + --> $DIR/bad-reg.rs:40:18 | LL | asm!("", out("r13") _); | ^^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:76:27 + --> $DIR/bad-reg.rs:67:27 | LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available | ^ @@ -173,7 +173,7 @@ LL | asm!("", in("v0") x); // FIXME: should be ok if vsx is available = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:79:28 + --> $DIR/bad-reg.rs:70:28 | LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available | ^ @@ -181,7 +181,7 @@ LL | asm!("", out("v0") x); // FIXME: should be ok if vsx is available = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:87:35 + --> $DIR/bad-reg.rs:78:35 | LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is available | ^ @@ -189,7 +189,7 @@ LL | asm!("/* {} */", in(vreg) x); // FIXME: should be ok if vsx is avai = note: register class `vreg` supports these types: i8x16, i16x8, i32x4, f32x4, f32, f64, i64x2, f64x2 error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:109:27 + --> $DIR/bad-reg.rs:100:27 | LL | asm!("", in("cr") x); | ^ @@ -197,7 +197,7 @@ LL | asm!("", in("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:112:28 + --> $DIR/bad-reg.rs:103:28 | LL | asm!("", out("cr") x); | ^ @@ -205,7 +205,7 @@ LL | asm!("", out("cr") x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:115:33 + --> $DIR/bad-reg.rs:106:33 | LL | asm!("/* {} */", in(cr) x); | ^ @@ -213,7 +213,7 @@ LL | asm!("/* {} */", in(cr) x); = note: register class `cr` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:122:28 + --> $DIR/bad-reg.rs:113:28 | LL | asm!("", in("xer") x); | ^ @@ -221,7 +221,7 @@ LL | asm!("", in("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:125:29 + --> $DIR/bad-reg.rs:116:29 | LL | asm!("", out("xer") x); | ^ @@ -229,7 +229,7 @@ LL | asm!("", out("xer") x); = note: register class `xer` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:128:34 + --> $DIR/bad-reg.rs:119:34 | LL | asm!("/* {} */", in(xer) x); | ^ diff --git a/tests/ui/asm/powerpc/bad-reg.rs b/tests/ui/asm/powerpc/bad-reg.rs index f34c45663a02a..5598f8379603d 100644 --- a/tests/ui/asm/powerpc/bad-reg.rs +++ b/tests/ui/asm/powerpc/bad-reg.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: powerpc powerpc64 powerpc64le aix64 //@[powerpc] compile-flags: --target powerpc-unknown-linux-gnu //@[powerpc] needs-llvm-components: powerpc @@ -11,31 +12,21 @@ // ignore-tidy-linelength #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, repr_simd, asm_experimental_arch)] +#![feature(no_core, repr_simd, asm_experimental_arch)] #![no_core] #![allow(non_camel_case_types)] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} +extern crate minicore; +use minicore::*; #[repr(simd)] pub struct i32x4([i32; 4]); #[repr(simd)] pub struct i64x2([i64; 2]); -impl Copy for [T; N] {} -impl Copy for i32 {} -impl Copy for i64 {} impl Copy for i32x4 {} impl Copy for i64x2 {} -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - fn f() { let mut x = 0; let mut v32x4 = i32x4([0; 4]); diff --git a/tests/ui/asm/reg-conflict.rs b/tests/ui/asm/reg-conflict.rs index bdde12af6df32..0c1f0eb570b7a 100644 --- a/tests/ui/asm/reg-conflict.rs +++ b/tests/ui/asm/reg-conflict.rs @@ -1,15 +1,12 @@ +//@ add-core-stubs //@ compile-flags: --target armv7-unknown-linux-gnueabihf //@ needs-llvm-components: arm -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] #![no_core] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; fn main() { unsafe { diff --git a/tests/ui/asm/reg-conflict.stderr b/tests/ui/asm/reg-conflict.stderr index a4dd8e0a95984..00e7e952a2150 100644 --- a/tests/ui/asm/reg-conflict.stderr +++ b/tests/ui/asm/reg-conflict.stderr @@ -1,5 +1,5 @@ error: register `s1` conflicts with register `d0` - --> $DIR/reg-conflict.rs:17:31 + --> $DIR/reg-conflict.rs:14:31 | LL | asm!("", out("d0") _, out("s1") _); | ----------- ^^^^^^^^^^^ register `s1` diff --git a/tests/ui/asm/riscv/bad-reg.riscv32e.stderr b/tests/ui/asm/riscv/bad-reg.riscv32e.stderr index 0ca566b7933f1..409178df9c5ae 100644 --- a/tests/ui/asm/riscv/bad-reg.riscv32e.stderr +++ b/tests/ui/asm/riscv/bad-reg.riscv32e.stderr @@ -1,191 +1,191 @@ error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("s1") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:41:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", out("tp") _); | ^^^^^^^^^^^ error: invalid register `zero`: the zero register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:45:18 | LL | asm!("", out("zero") _); | ^^^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:97:18 + --> $DIR/bad-reg.rs:96:18 | LL | asm!("", in("v0") x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:100:18 + --> $DIR/bad-reg.rs:99:18 | LL | asm!("", out("v0") x); | ^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:103:26 + --> $DIR/bad-reg.rs:102:26 | LL | asm!("/* {} */", in(vreg) x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:106:26 + --> $DIR/bad-reg.rs:105:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ error: cannot use register `x16`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:49:18 + --> $DIR/bad-reg.rs:48:18 | LL | asm!("", out("x16") _); | ^^^^^^^^^^^^ error: cannot use register `x17`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:51:18 + --> $DIR/bad-reg.rs:50:18 | LL | asm!("", out("x17") _); | ^^^^^^^^^^^^ error: cannot use register `x18`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:53:18 + --> $DIR/bad-reg.rs:52:18 | LL | asm!("", out("x18") _); | ^^^^^^^^^^^^ error: cannot use register `x19`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:55:18 + --> $DIR/bad-reg.rs:54:18 | LL | asm!("", out("x19") _); | ^^^^^^^^^^^^ error: cannot use register `x20`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:56:18 | LL | asm!("", out("x20") _); | ^^^^^^^^^^^^ error: cannot use register `x21`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:59:18 + --> $DIR/bad-reg.rs:58:18 | LL | asm!("", out("x21") _); | ^^^^^^^^^^^^ error: cannot use register `x22`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:61:18 + --> $DIR/bad-reg.rs:60:18 | LL | asm!("", out("x22") _); | ^^^^^^^^^^^^ error: cannot use register `x23`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:63:18 + --> $DIR/bad-reg.rs:62:18 | LL | asm!("", out("x23") _); | ^^^^^^^^^^^^ error: cannot use register `x24`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:65:18 + --> $DIR/bad-reg.rs:64:18 | LL | asm!("", out("x24") _); | ^^^^^^^^^^^^ error: cannot use register `x25`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:67:18 + --> $DIR/bad-reg.rs:66:18 | LL | asm!("", out("x25") _); | ^^^^^^^^^^^^ error: cannot use register `x26`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:69:18 + --> $DIR/bad-reg.rs:68:18 | LL | asm!("", out("x26") _); | ^^^^^^^^^^^^ error: cannot use register `x27`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:71:18 + --> $DIR/bad-reg.rs:70:18 | LL | asm!("", out("x27") _); | ^^^^^^^^^^^^ error: cannot use register `x28`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:73:18 + --> $DIR/bad-reg.rs:72:18 | LL | asm!("", out("x28") _); | ^^^^^^^^^^^^ error: cannot use register `x29`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:75:18 + --> $DIR/bad-reg.rs:74:18 | LL | asm!("", out("x29") _); | ^^^^^^^^^^^^ error: cannot use register `x30`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:77:18 + --> $DIR/bad-reg.rs:76:18 | LL | asm!("", out("x30") _); | ^^^^^^^^^^^^ error: cannot use register `x31`: register can't be used with the `e` target feature - --> $DIR/bad-reg.rs:79:18 + --> $DIR/bad-reg.rs:78:18 | LL | asm!("", out("x31") _); | ^^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:83:26 + --> $DIR/bad-reg.rs:82:26 | LL | asm!("/* {} */", in(freg) f); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:85:26 + --> $DIR/bad-reg.rs:84:26 | LL | asm!("/* {} */", out(freg) _); | ^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:87:26 + --> $DIR/bad-reg.rs:86:26 | LL | asm!("/* {} */", in(freg) d); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:90:26 + --> $DIR/bad-reg.rs:89:26 | LL | asm!("/* {} */", out(freg) d); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:97:27 + --> $DIR/bad-reg.rs:96:27 | LL | asm!("", in("v0") x); | ^ @@ -193,7 +193,7 @@ LL | asm!("", in("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:100:28 + --> $DIR/bad-reg.rs:99:28 | LL | asm!("", out("v0") x); | ^ @@ -201,7 +201,7 @@ LL | asm!("", out("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:103:35 + --> $DIR/bad-reg.rs:102:35 | LL | asm!("/* {} */", in(vreg) x); | ^ diff --git a/tests/ui/asm/riscv/bad-reg.riscv32gc.stderr b/tests/ui/asm/riscv/bad-reg.riscv32gc.stderr index 81b72884a1268..4770e70cc2b7d 100644 --- a/tests/ui/asm/riscv/bad-reg.riscv32gc.stderr +++ b/tests/ui/asm/riscv/bad-reg.riscv32gc.stderr @@ -1,71 +1,71 @@ error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("s1") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:41:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", out("tp") _); | ^^^^^^^^^^^ error: invalid register `zero`: the zero register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:45:18 | LL | asm!("", out("zero") _); | ^^^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:97:18 + --> $DIR/bad-reg.rs:96:18 | LL | asm!("", in("v0") x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:100:18 + --> $DIR/bad-reg.rs:99:18 | LL | asm!("", out("v0") x); | ^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:103:26 + --> $DIR/bad-reg.rs:102:26 | LL | asm!("/* {} */", in(vreg) x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:106:26 + --> $DIR/bad-reg.rs:105:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:97:27 + --> $DIR/bad-reg.rs:96:27 | LL | asm!("", in("v0") x); | ^ @@ -73,7 +73,7 @@ LL | asm!("", in("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:100:28 + --> $DIR/bad-reg.rs:99:28 | LL | asm!("", out("v0") x); | ^ @@ -81,7 +81,7 @@ LL | asm!("", out("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:103:35 + --> $DIR/bad-reg.rs:102:35 | LL | asm!("/* {} */", in(vreg) x); | ^ diff --git a/tests/ui/asm/riscv/bad-reg.riscv32i.stderr b/tests/ui/asm/riscv/bad-reg.riscv32i.stderr index b951ffb398256..ae7db1554b196 100644 --- a/tests/ui/asm/riscv/bad-reg.riscv32i.stderr +++ b/tests/ui/asm/riscv/bad-reg.riscv32i.stderr @@ -1,95 +1,95 @@ error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("s1") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:41:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", out("tp") _); | ^^^^^^^^^^^ error: invalid register `zero`: the zero register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:45:18 | LL | asm!("", out("zero") _); | ^^^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:97:18 + --> $DIR/bad-reg.rs:96:18 | LL | asm!("", in("v0") x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:100:18 + --> $DIR/bad-reg.rs:99:18 | LL | asm!("", out("v0") x); | ^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:103:26 + --> $DIR/bad-reg.rs:102:26 | LL | asm!("/* {} */", in(vreg) x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:106:26 + --> $DIR/bad-reg.rs:105:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:83:26 + --> $DIR/bad-reg.rs:82:26 | LL | asm!("/* {} */", in(freg) f); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:85:26 + --> $DIR/bad-reg.rs:84:26 | LL | asm!("/* {} */", out(freg) _); | ^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:87:26 + --> $DIR/bad-reg.rs:86:26 | LL | asm!("/* {} */", in(freg) d); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:90:26 + --> $DIR/bad-reg.rs:89:26 | LL | asm!("/* {} */", out(freg) d); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:97:27 + --> $DIR/bad-reg.rs:96:27 | LL | asm!("", in("v0") x); | ^ @@ -97,7 +97,7 @@ LL | asm!("", in("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:100:28 + --> $DIR/bad-reg.rs:99:28 | LL | asm!("", out("v0") x); | ^ @@ -105,7 +105,7 @@ LL | asm!("", out("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:103:35 + --> $DIR/bad-reg.rs:102:35 | LL | asm!("/* {} */", in(vreg) x); | ^ diff --git a/tests/ui/asm/riscv/bad-reg.riscv32imafc.stderr b/tests/ui/asm/riscv/bad-reg.riscv32imafc.stderr index aba4ecc188667..8bc5c9a87fce4 100644 --- a/tests/ui/asm/riscv/bad-reg.riscv32imafc.stderr +++ b/tests/ui/asm/riscv/bad-reg.riscv32imafc.stderr @@ -1,71 +1,71 @@ error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("s1") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:41:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", out("tp") _); | ^^^^^^^^^^^ error: invalid register `zero`: the zero register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:45:18 | LL | asm!("", out("zero") _); | ^^^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:97:18 + --> $DIR/bad-reg.rs:96:18 | LL | asm!("", in("v0") x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:100:18 + --> $DIR/bad-reg.rs:99:18 | LL | asm!("", out("v0") x); | ^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:103:26 + --> $DIR/bad-reg.rs:102:26 | LL | asm!("/* {} */", in(vreg) x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:106:26 + --> $DIR/bad-reg.rs:105:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ error: `d` target feature is not enabled - --> $DIR/bad-reg.rs:87:35 + --> $DIR/bad-reg.rs:86:35 | LL | asm!("/* {} */", in(freg) d); | ^ @@ -73,7 +73,7 @@ LL | asm!("/* {} */", in(freg) d); = note: this is required to use type `f64` with register class `freg` error: `d` target feature is not enabled - --> $DIR/bad-reg.rs:90:36 + --> $DIR/bad-reg.rs:89:36 | LL | asm!("/* {} */", out(freg) d); | ^ @@ -81,7 +81,7 @@ LL | asm!("/* {} */", out(freg) d); = note: this is required to use type `f64` with register class `freg` error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:97:27 + --> $DIR/bad-reg.rs:96:27 | LL | asm!("", in("v0") x); | ^ @@ -89,7 +89,7 @@ LL | asm!("", in("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:100:28 + --> $DIR/bad-reg.rs:99:28 | LL | asm!("", out("v0") x); | ^ @@ -97,7 +97,7 @@ LL | asm!("", out("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:103:35 + --> $DIR/bad-reg.rs:102:35 | LL | asm!("/* {} */", in(vreg) x); | ^ diff --git a/tests/ui/asm/riscv/bad-reg.riscv64gc.stderr b/tests/ui/asm/riscv/bad-reg.riscv64gc.stderr index 81b72884a1268..4770e70cc2b7d 100644 --- a/tests/ui/asm/riscv/bad-reg.riscv64gc.stderr +++ b/tests/ui/asm/riscv/bad-reg.riscv64gc.stderr @@ -1,71 +1,71 @@ error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("s1") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:41:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", out("tp") _); | ^^^^^^^^^^^ error: invalid register `zero`: the zero register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:45:18 | LL | asm!("", out("zero") _); | ^^^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:97:18 + --> $DIR/bad-reg.rs:96:18 | LL | asm!("", in("v0") x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:100:18 + --> $DIR/bad-reg.rs:99:18 | LL | asm!("", out("v0") x); | ^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:103:26 + --> $DIR/bad-reg.rs:102:26 | LL | asm!("/* {} */", in(vreg) x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:106:26 + --> $DIR/bad-reg.rs:105:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:97:27 + --> $DIR/bad-reg.rs:96:27 | LL | asm!("", in("v0") x); | ^ @@ -73,7 +73,7 @@ LL | asm!("", in("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:100:28 + --> $DIR/bad-reg.rs:99:28 | LL | asm!("", out("v0") x); | ^ @@ -81,7 +81,7 @@ LL | asm!("", out("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:103:35 + --> $DIR/bad-reg.rs:102:35 | LL | asm!("/* {} */", in(vreg) x); | ^ diff --git a/tests/ui/asm/riscv/bad-reg.riscv64imac.stderr b/tests/ui/asm/riscv/bad-reg.riscv64imac.stderr index b951ffb398256..ae7db1554b196 100644 --- a/tests/ui/asm/riscv/bad-reg.riscv64imac.stderr +++ b/tests/ui/asm/riscv/bad-reg.riscv64imac.stderr @@ -1,95 +1,95 @@ error: invalid register `s1`: s1 is used internally by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:34:18 + --> $DIR/bad-reg.rs:33:18 | LL | asm!("", out("s1") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:36:18 + --> $DIR/bad-reg.rs:35:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:37:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:39:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `gp`: the global pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:41:18 | LL | asm!("", out("gp") _); | ^^^^^^^^^^^ error: invalid register `tp`: the thread pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:43:18 | LL | asm!("", out("tp") _); | ^^^^^^^^^^^ error: invalid register `zero`: the zero register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:45:18 | LL | asm!("", out("zero") _); | ^^^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:97:18 + --> $DIR/bad-reg.rs:96:18 | LL | asm!("", in("v0") x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:100:18 + --> $DIR/bad-reg.rs:99:18 | LL | asm!("", out("v0") x); | ^^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:103:26 + --> $DIR/bad-reg.rs:102:26 | LL | asm!("/* {} */", in(vreg) x); | ^^^^^^^^^^ error: register class `vreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:106:26 + --> $DIR/bad-reg.rs:105:26 | LL | asm!("/* {} */", out(vreg) _); | ^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:83:26 + --> $DIR/bad-reg.rs:82:26 | LL | asm!("/* {} */", in(freg) f); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:85:26 + --> $DIR/bad-reg.rs:84:26 | LL | asm!("/* {} */", out(freg) _); | ^^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:87:26 + --> $DIR/bad-reg.rs:86:26 | LL | asm!("/* {} */", in(freg) d); | ^^^^^^^^^^ error: register class `freg` requires at least one of the following target features: d, f - --> $DIR/bad-reg.rs:90:26 + --> $DIR/bad-reg.rs:89:26 | LL | asm!("/* {} */", out(freg) d); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:97:27 + --> $DIR/bad-reg.rs:96:27 | LL | asm!("", in("v0") x); | ^ @@ -97,7 +97,7 @@ LL | asm!("", in("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:100:28 + --> $DIR/bad-reg.rs:99:28 | LL | asm!("", out("v0") x); | ^ @@ -105,7 +105,7 @@ LL | asm!("", out("v0") x); = note: register class `vreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:103:35 + --> $DIR/bad-reg.rs:102:35 | LL | asm!("/* {} */", in(vreg) x); | ^ diff --git a/tests/ui/asm/riscv/bad-reg.rs b/tests/ui/asm/riscv/bad-reg.rs index 7bf25b6e0b512..7f0fc00d5489d 100644 --- a/tests/ui/asm/riscv/bad-reg.rs +++ b/tests/ui/asm/riscv/bad-reg.rs @@ -18,8 +18,7 @@ // usage in the asm! API (in, out, inout, etc.). #![crate_type = "lib"] -#![feature(no_core, rustc_attrs)] -#![feature(asm_experimental_arch)] +#![feature(no_core)] #![no_core] extern crate minicore; diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr index ac1373f0e2dfb..07c1bf211839b 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32e.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:54:11 | LL | asm!("li x16, 0"); | ^^^^^^^^^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:57:11 | LL | asm!("li x17, 0"); | ^^^^^^^^^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:60:11 | LL | asm!("li x18, 0"); | ^^^^^^^^^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:63:11 | LL | asm!("li x19, 0"); | ^^^^^^^^^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:66:11 | LL | asm!("li x20, 0"); | ^^^^^^^^^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:69:11 | LL | asm!("li x21, 0"); | ^^^^^^^^^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:72:11 | LL | asm!("li x22, 0"); | ^^^^^^^^^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:75:11 | LL | asm!("li x23, 0"); | ^^^^^^^^^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:78:11 | LL | asm!("li x24, 0"); | ^^^^^^^^^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:81:11 | LL | asm!("li x25, 0"); | ^^^^^^^^^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:84:11 | LL | asm!("li x26, 0"); | ^^^^^^^^^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:87:11 | LL | asm!("li x27, 0"); | ^^^^^^^^^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:94:11 + --> $DIR/riscv32e-registers.rs:90:11 | LL | asm!("li x28, 0"); | ^^^^^^^^^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:97:11 + --> $DIR/riscv32e-registers.rs:93:11 | LL | asm!("li x29, 0"); | ^^^^^^^^^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:100:11 + --> $DIR/riscv32e-registers.rs:96:11 | LL | asm!("li x30, 0"); | ^^^^^^^^^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:103:11 + --> $DIR/riscv32e-registers.rs:99:11 | LL | asm!("li x31, 0"); | ^^^^^^^^^ diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32e_llvm_18.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32e_llvm_18.stderr index f140f54adc558..59009b8c3525c 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32e_llvm_18.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32e_llvm_18.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:54:11 | LL | asm!("li x16, 0"); | ^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:57:11 | LL | asm!("li x17, 0"); | ^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:60:11 | LL | asm!("li x18, 0"); | ^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:63:11 | LL | asm!("li x19, 0"); | ^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:66:11 | LL | asm!("li x20, 0"); | ^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:69:11 | LL | asm!("li x21, 0"); | ^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:72:11 | LL | asm!("li x22, 0"); | ^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:75:11 | LL | asm!("li x23, 0"); | ^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:78:11 | LL | asm!("li x24, 0"); | ^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:81:11 | LL | asm!("li x25, 0"); | ^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:84:11 | LL | asm!("li x26, 0"); | ^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:87:11 | LL | asm!("li x27, 0"); | ^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:94:11 + --> $DIR/riscv32e-registers.rs:90:11 | LL | asm!("li x28, 0"); | ^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:97:11 + --> $DIR/riscv32e-registers.rs:93:11 | LL | asm!("li x29, 0"); | ^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:100:11 + --> $DIR/riscv32e-registers.rs:96:11 | LL | asm!("li x30, 0"); | ^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:103:11 + --> $DIR/riscv32e-registers.rs:99:11 | LL | asm!("li x31, 0"); | ^ diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr index ac1373f0e2dfb..07c1bf211839b 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32em.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:54:11 | LL | asm!("li x16, 0"); | ^^^^^^^^^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:57:11 | LL | asm!("li x17, 0"); | ^^^^^^^^^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:60:11 | LL | asm!("li x18, 0"); | ^^^^^^^^^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:63:11 | LL | asm!("li x19, 0"); | ^^^^^^^^^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:66:11 | LL | asm!("li x20, 0"); | ^^^^^^^^^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:69:11 | LL | asm!("li x21, 0"); | ^^^^^^^^^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:72:11 | LL | asm!("li x22, 0"); | ^^^^^^^^^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:75:11 | LL | asm!("li x23, 0"); | ^^^^^^^^^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:78:11 | LL | asm!("li x24, 0"); | ^^^^^^^^^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:81:11 | LL | asm!("li x25, 0"); | ^^^^^^^^^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:84:11 | LL | asm!("li x26, 0"); | ^^^^^^^^^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:87:11 | LL | asm!("li x27, 0"); | ^^^^^^^^^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:94:11 + --> $DIR/riscv32e-registers.rs:90:11 | LL | asm!("li x28, 0"); | ^^^^^^^^^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:97:11 + --> $DIR/riscv32e-registers.rs:93:11 | LL | asm!("li x29, 0"); | ^^^^^^^^^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:100:11 + --> $DIR/riscv32e-registers.rs:96:11 | LL | asm!("li x30, 0"); | ^^^^^^^^^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:103:11 + --> $DIR/riscv32e-registers.rs:99:11 | LL | asm!("li x31, 0"); | ^^^^^^^^^ diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32em_llvm_18.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32em_llvm_18.stderr index f140f54adc558..59009b8c3525c 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32em_llvm_18.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32em_llvm_18.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:54:11 | LL | asm!("li x16, 0"); | ^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:57:11 | LL | asm!("li x17, 0"); | ^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:60:11 | LL | asm!("li x18, 0"); | ^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:63:11 | LL | asm!("li x19, 0"); | ^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:66:11 | LL | asm!("li x20, 0"); | ^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:69:11 | LL | asm!("li x21, 0"); | ^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:72:11 | LL | asm!("li x22, 0"); | ^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:75:11 | LL | asm!("li x23, 0"); | ^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:78:11 | LL | asm!("li x24, 0"); | ^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:81:11 | LL | asm!("li x25, 0"); | ^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:84:11 | LL | asm!("li x26, 0"); | ^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:87:11 | LL | asm!("li x27, 0"); | ^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:94:11 + --> $DIR/riscv32e-registers.rs:90:11 | LL | asm!("li x28, 0"); | ^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:97:11 + --> $DIR/riscv32e-registers.rs:93:11 | LL | asm!("li x29, 0"); | ^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:100:11 + --> $DIR/riscv32e-registers.rs:96:11 | LL | asm!("li x30, 0"); | ^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:103:11 + --> $DIR/riscv32e-registers.rs:99:11 | LL | asm!("li x31, 0"); | ^ diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr index ac1373f0e2dfb..07c1bf211839b 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:54:11 | LL | asm!("li x16, 0"); | ^^^^^^^^^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:57:11 | LL | asm!("li x17, 0"); | ^^^^^^^^^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:60:11 | LL | asm!("li x18, 0"); | ^^^^^^^^^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:63:11 | LL | asm!("li x19, 0"); | ^^^^^^^^^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:66:11 | LL | asm!("li x20, 0"); | ^^^^^^^^^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:69:11 | LL | asm!("li x21, 0"); | ^^^^^^^^^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:72:11 | LL | asm!("li x22, 0"); | ^^^^^^^^^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:75:11 | LL | asm!("li x23, 0"); | ^^^^^^^^^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:78:11 | LL | asm!("li x24, 0"); | ^^^^^^^^^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:81:11 | LL | asm!("li x25, 0"); | ^^^^^^^^^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:84:11 | LL | asm!("li x26, 0"); | ^^^^^^^^^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:87:11 | LL | asm!("li x27, 0"); | ^^^^^^^^^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:94:11 + --> $DIR/riscv32e-registers.rs:90:11 | LL | asm!("li x28, 0"); | ^^^^^^^^^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:97:11 + --> $DIR/riscv32e-registers.rs:93:11 | LL | asm!("li x29, 0"); | ^^^^^^^^^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:100:11 + --> $DIR/riscv32e-registers.rs:96:11 | LL | asm!("li x30, 0"); | ^^^^^^^^^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:103:11 + --> $DIR/riscv32e-registers.rs:99:11 | LL | asm!("li x31, 0"); | ^^^^^^^^^ diff --git a/tests/ui/asm/riscv/riscv32e-registers.riscv32emc_llvm_18.stderr b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc_llvm_18.stderr index f140f54adc558..59009b8c3525c 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.riscv32emc_llvm_18.stderr +++ b/tests/ui/asm/riscv/riscv32e-registers.riscv32emc_llvm_18.stderr @@ -1,5 +1,5 @@ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:58:11 + --> $DIR/riscv32e-registers.rs:54:11 | LL | asm!("li x16, 0"); | ^ @@ -11,7 +11,7 @@ LL | li x16, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:61:11 + --> $DIR/riscv32e-registers.rs:57:11 | LL | asm!("li x17, 0"); | ^ @@ -23,7 +23,7 @@ LL | li x17, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:64:11 + --> $DIR/riscv32e-registers.rs:60:11 | LL | asm!("li x18, 0"); | ^ @@ -35,7 +35,7 @@ LL | li x18, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:67:11 + --> $DIR/riscv32e-registers.rs:63:11 | LL | asm!("li x19, 0"); | ^ @@ -47,7 +47,7 @@ LL | li x19, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:70:11 + --> $DIR/riscv32e-registers.rs:66:11 | LL | asm!("li x20, 0"); | ^ @@ -59,7 +59,7 @@ LL | li x20, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:73:11 + --> $DIR/riscv32e-registers.rs:69:11 | LL | asm!("li x21, 0"); | ^ @@ -71,7 +71,7 @@ LL | li x21, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:76:11 + --> $DIR/riscv32e-registers.rs:72:11 | LL | asm!("li x22, 0"); | ^ @@ -83,7 +83,7 @@ LL | li x22, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:79:11 + --> $DIR/riscv32e-registers.rs:75:11 | LL | asm!("li x23, 0"); | ^ @@ -95,7 +95,7 @@ LL | li x23, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:82:11 + --> $DIR/riscv32e-registers.rs:78:11 | LL | asm!("li x24, 0"); | ^ @@ -107,7 +107,7 @@ LL | li x24, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:85:11 + --> $DIR/riscv32e-registers.rs:81:11 | LL | asm!("li x25, 0"); | ^ @@ -119,7 +119,7 @@ LL | li x25, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:88:11 + --> $DIR/riscv32e-registers.rs:84:11 | LL | asm!("li x26, 0"); | ^ @@ -131,7 +131,7 @@ LL | li x26, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:91:11 + --> $DIR/riscv32e-registers.rs:87:11 | LL | asm!("li x27, 0"); | ^ @@ -143,7 +143,7 @@ LL | li x27, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:94:11 + --> $DIR/riscv32e-registers.rs:90:11 | LL | asm!("li x28, 0"); | ^ @@ -155,7 +155,7 @@ LL | li x28, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:97:11 + --> $DIR/riscv32e-registers.rs:93:11 | LL | asm!("li x29, 0"); | ^ @@ -167,7 +167,7 @@ LL | li x29, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:100:11 + --> $DIR/riscv32e-registers.rs:96:11 | LL | asm!("li x30, 0"); | ^ @@ -179,7 +179,7 @@ LL | li x30, 0 | ^ error: invalid operand for instruction - --> $DIR/riscv32e-registers.rs:103:11 + --> $DIR/riscv32e-registers.rs:99:11 | LL | asm!("li x31, 0"); | ^ diff --git a/tests/ui/asm/riscv/riscv32e-registers.rs b/tests/ui/asm/riscv/riscv32e-registers.rs index c3fe19991b0a0..99cbdf5ead3f8 100644 --- a/tests/ui/asm/riscv/riscv32e-registers.rs +++ b/tests/ui/asm/riscv/riscv32e-registers.rs @@ -1,5 +1,6 @@ // Test that loads into registers x16..=x31 are never generated for riscv32{e,em,emc} targets // +//@ add-core-stubs //@ build-fail //@ revisions: riscv32e riscv32em riscv32emc riscv32e_llvm_18 riscv32em_llvm_18 riscv32emc_llvm_18 // @@ -27,15 +28,10 @@ // usage in assembly code. #![no_core] -#![feature(no_core, lang_items, rustc_attrs)] +#![feature(no_core)] -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} - -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // Verify registers x1..=x15 are addressable on riscv32e, but registers x16..=x31 are not #[no_mangle] diff --git a/tests/ui/asm/s390x/bad-reg.rs b/tests/ui/asm/s390x/bad-reg.rs index 144215b1a3d35..56b2d70937261 100644 --- a/tests/ui/asm/s390x/bad-reg.rs +++ b/tests/ui/asm/s390x/bad-reg.rs @@ -9,7 +9,7 @@ //@[s390x_vector_stable] needs-llvm-components: systemz #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, repr_simd)] +#![feature(no_core, repr_simd)] #![cfg_attr(not(s390x_vector_stable), feature(asm_experimental_reg))] #![no_core] #![allow(non_camel_case_types)] diff --git a/tests/ui/asm/sparc/bad-reg.rs b/tests/ui/asm/sparc/bad-reg.rs index b824f5adf3a18..44af6c316bc4b 100644 --- a/tests/ui/asm/sparc/bad-reg.rs +++ b/tests/ui/asm/sparc/bad-reg.rs @@ -1,3 +1,4 @@ +//@ add-core-stubs //@ revisions: sparc sparcv8plus sparc64 //@[sparc] compile-flags: --target sparc-unknown-none-elf //@[sparc] needs-llvm-components: sparc @@ -8,20 +9,11 @@ //@ needs-asm-support #![crate_type = "rlib"] -#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![feature(no_core, asm_experimental_arch)] #![no_core] -#[lang = "sized"] -trait Sized {} -#[lang = "copy"] -trait Copy {} - -impl Copy for i32 {} - -#[rustc_builtin_macro] -macro_rules! asm { - () => {}; -} +extern crate minicore; +use minicore::*; fn f() { let mut x = 0; diff --git a/tests/ui/asm/sparc/bad-reg.sparc.stderr b/tests/ui/asm/sparc/bad-reg.sparc.stderr index cb7558c0f43f3..e0580ad3232f5 100644 --- a/tests/ui/asm/sparc/bad-reg.sparc.stderr +++ b/tests/ui/asm/sparc/bad-reg.sparc.stderr @@ -1,77 +1,77 @@ error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:22:18 | LL | asm!("", out("g0") _); | ^^^^^^^^^^^ error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:33:18 + --> $DIR/bad-reg.rs:25:18 | LL | asm!("", out("g1") _); | ^^^^^^^^^^^ error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:32:18 | LL | asm!("", out("g6") _); | ^^^^^^^^^^^ error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:34:18 | LL | asm!("", out("g7") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:36:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:38:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `i7`: the return address register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:48:18 + --> $DIR/bad-reg.rs:40:18 | LL | asm!("", out("i7") _); | ^^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:54:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", in("y") x); | ^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:49:18 | LL | asm!("", out("y") x); | ^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:60:26 + --> $DIR/bad-reg.rs:52:26 | LL | asm!("/* {} */", in(yreg) x); | ^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:63:26 + --> $DIR/bad-reg.rs:55:26 | LL | asm!("/* {} */", out(yreg) _); | ^^^^^^^^^^^ error: cannot use register `r5`: g5 is reserved for system on SPARC32 - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:30:18 | LL | asm!("", out("g5") _); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:54:26 + --> $DIR/bad-reg.rs:46:26 | LL | asm!("", in("y") x); | ^ @@ -79,7 +79,7 @@ LL | asm!("", in("y") x); = note: register class `yreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:57:27 + --> $DIR/bad-reg.rs:49:27 | LL | asm!("", out("y") x); | ^ @@ -87,7 +87,7 @@ LL | asm!("", out("y") x); = note: register class `yreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:60:35 + --> $DIR/bad-reg.rs:52:35 | LL | asm!("/* {} */", in(yreg) x); | ^ diff --git a/tests/ui/asm/sparc/bad-reg.sparc64.stderr b/tests/ui/asm/sparc/bad-reg.sparc64.stderr index e5606ab312448..bdeb8c328db66 100644 --- a/tests/ui/asm/sparc/bad-reg.sparc64.stderr +++ b/tests/ui/asm/sparc/bad-reg.sparc64.stderr @@ -1,71 +1,71 @@ error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:22:18 | LL | asm!("", out("g0") _); | ^^^^^^^^^^^ error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:33:18 + --> $DIR/bad-reg.rs:25:18 | LL | asm!("", out("g1") _); | ^^^^^^^^^^^ error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:32:18 | LL | asm!("", out("g6") _); | ^^^^^^^^^^^ error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:34:18 | LL | asm!("", out("g7") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:36:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:38:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `i7`: the return address register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:48:18 + --> $DIR/bad-reg.rs:40:18 | LL | asm!("", out("i7") _); | ^^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:54:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", in("y") x); | ^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:49:18 | LL | asm!("", out("y") x); | ^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:60:26 + --> $DIR/bad-reg.rs:52:26 | LL | asm!("/* {} */", in(yreg) x); | ^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:63:26 + --> $DIR/bad-reg.rs:55:26 | LL | asm!("/* {} */", out(yreg) _); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:54:26 + --> $DIR/bad-reg.rs:46:26 | LL | asm!("", in("y") x); | ^ @@ -73,7 +73,7 @@ LL | asm!("", in("y") x); = note: register class `yreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:57:27 + --> $DIR/bad-reg.rs:49:27 | LL | asm!("", out("y") x); | ^ @@ -81,7 +81,7 @@ LL | asm!("", out("y") x); = note: register class `yreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:60:35 + --> $DIR/bad-reg.rs:52:35 | LL | asm!("/* {} */", in(yreg) x); | ^ diff --git a/tests/ui/asm/sparc/bad-reg.sparcv8plus.stderr b/tests/ui/asm/sparc/bad-reg.sparcv8plus.stderr index cb7558c0f43f3..e0580ad3232f5 100644 --- a/tests/ui/asm/sparc/bad-reg.sparcv8plus.stderr +++ b/tests/ui/asm/sparc/bad-reg.sparcv8plus.stderr @@ -1,77 +1,77 @@ error: invalid register `g0`: g0 is always zero and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:30:18 + --> $DIR/bad-reg.rs:22:18 | LL | asm!("", out("g0") _); | ^^^^^^^^^^^ error: invalid register `g1`: reserved by LLVM and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:33:18 + --> $DIR/bad-reg.rs:25:18 | LL | asm!("", out("g1") _); | ^^^^^^^^^^^ error: invalid register `g6`: reserved for system and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:40:18 + --> $DIR/bad-reg.rs:32:18 | LL | asm!("", out("g6") _); | ^^^^^^^^^^^ error: invalid register `g7`: reserved for system and cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:42:18 + --> $DIR/bad-reg.rs:34:18 | LL | asm!("", out("g7") _); | ^^^^^^^^^^^ error: invalid register `sp`: the stack pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:44:18 + --> $DIR/bad-reg.rs:36:18 | LL | asm!("", out("sp") _); | ^^^^^^^^^^^ error: invalid register `fp`: the frame pointer cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:46:18 + --> $DIR/bad-reg.rs:38:18 | LL | asm!("", out("fp") _); | ^^^^^^^^^^^ error: invalid register `i7`: the return address register cannot be used as an operand for inline asm - --> $DIR/bad-reg.rs:48:18 + --> $DIR/bad-reg.rs:40:18 | LL | asm!("", out("i7") _); | ^^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:54:18 + --> $DIR/bad-reg.rs:46:18 | LL | asm!("", in("y") x); | ^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:57:18 + --> $DIR/bad-reg.rs:49:18 | LL | asm!("", out("y") x); | ^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:60:26 + --> $DIR/bad-reg.rs:52:26 | LL | asm!("/* {} */", in(yreg) x); | ^^^^^^^^^^ error: register class `yreg` can only be used as a clobber, not as an input or output - --> $DIR/bad-reg.rs:63:26 + --> $DIR/bad-reg.rs:55:26 | LL | asm!("/* {} */", out(yreg) _); | ^^^^^^^^^^^ error: cannot use register `r5`: g5 is reserved for system on SPARC32 - --> $DIR/bad-reg.rs:38:18 + --> $DIR/bad-reg.rs:30:18 | LL | asm!("", out("g5") _); | ^^^^^^^^^^^ error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:54:26 + --> $DIR/bad-reg.rs:46:26 | LL | asm!("", in("y") x); | ^ @@ -79,7 +79,7 @@ LL | asm!("", in("y") x); = note: register class `yreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:57:27 + --> $DIR/bad-reg.rs:49:27 | LL | asm!("", out("y") x); | ^ @@ -87,7 +87,7 @@ LL | asm!("", out("y") x); = note: register class `yreg` supports these types: error: type `i32` cannot be used with this register class - --> $DIR/bad-reg.rs:60:35 + --> $DIR/bad-reg.rs:52:35 | LL | asm!("/* {} */", in(yreg) x); | ^ diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr index 5d0c182641101..28e7975c7a234 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.current.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `&str: AsExpression` is not satisfied - --> $DIR/as_expression.rs:57:15 + --> $DIR/as_expression.rs:55:15 | LL | SelectInt.check("bar"); | ^^^^^ the trait `AsExpression` is not implemented for `&str` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr index 1e1eae852f911..1b76669ccb0d7 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.next.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `&str: AsExpression<::SqlType>` is not satisfied - --> $DIR/as_expression.rs:57:21 + --> $DIR/as_expression.rs:55:21 | LL | SelectInt.check("bar"); | ----- ^^^^^ the trait `AsExpression<::SqlType>` is not implemented for `&str` @@ -8,7 +8,7 @@ LL | SelectInt.check("bar"); | = help: the trait `AsExpression` is implemented for `&str` note: required by a bound in `Foo::check` - --> $DIR/as_expression.rs:48:12 + --> $DIR/as_expression.rs:46:12 | LL | fn check(&self, _: T) -> ::SqlType>>::Expression | ----- required by a bound in this associated function @@ -17,7 +17,7 @@ LL | T: AsExpression, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo::check` error[E0277]: the trait bound `&str: AsExpression` is not satisfied - --> $DIR/as_expression.rs:57:15 + --> $DIR/as_expression.rs:55:15 | LL | SelectInt.check("bar"); | ^^^^^ the trait `AsExpression` is not implemented for `&str` @@ -27,7 +27,7 @@ LL | SelectInt.check("bar"); = help: for that trait implementation, expected `Text`, found `Integer` error[E0271]: type mismatch resolving `::SqlType == Text` - --> $DIR/as_expression.rs:57:5 + --> $DIR/as_expression.rs:55:5 | LL | SelectInt.check("bar"); | ^^^^^^^^^^^^^^^^^^^^^^ expected `Text`, found `Integer` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs index 37b4429f694cf..583b3c4675a87 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/as_expression.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - pub trait Expression { type SqlType; } diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs deleted file mode 100644 index 5548fa2f52e17..0000000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.rs +++ /dev/null @@ -1,21 +0,0 @@ -#![allow(unknown_or_malformed_diagnostic_attributes)] - -trait Foo {} - -#[diagnostic::do_not_recommend] -impl Foo for (A,) {} - -#[diagnostic::do_not_recommend] -impl Foo for (A, B) {} - -#[diagnostic::do_not_recommend] -impl Foo for (A, B, C) {} - -impl Foo for i32 {} - -fn check(a: impl Foo) {} - -fn main() { - check(()); - //~^ ERROR the trait bound `(): Foo` is not satisfied -} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr deleted file mode 100644 index be17476524aec..0000000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/do_not_apply_attribute_without_feature_flag.stderr +++ /dev/null @@ -1,25 +0,0 @@ -error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/do_not_apply_attribute_without_feature_flag.rs:19:11 - | -LL | check(()); - | ----- ^^ the trait `Foo` is not implemented for `()` - | | - | required by a bound introduced by this call - | - = help: the following other types implement trait `Foo`: - (A, B) - (A, B, C) - (A,) -note: required by a bound in `check` - --> $DIR/do_not_apply_attribute_without_feature_flag.rs:16:18 - | -LL | fn check(a: impl Foo) {} - | ^^^ required by this bound in `check` -help: use a unary tuple instead - | -LL | check(((),)); - | + ++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr new file mode 100644 index 0000000000000..47597a5d405e4 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.current.stderr @@ -0,0 +1,22 @@ +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:10:1 + | +LL | #[diagnostic::do_not_recommend(not_accepted)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default + +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:14:1 + | +LL | #[diagnostic::do_not_recommend(not_accepted = "foo")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:18:1 + | +LL | #[diagnostic::do_not_recommend(not_accepted(42))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 3 warnings emitted + diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr new file mode 100644 index 0000000000000..47597a5d405e4 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.next.stderr @@ -0,0 +1,22 @@ +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:10:1 + | +LL | #[diagnostic::do_not_recommend(not_accepted)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default + +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:14:1 + | +LL | #[diagnostic::do_not_recommend(not_accepted = "foo")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` does not expect any arguments + --> $DIR/does_not_acccept_args.rs:18:1 + | +LL | #[diagnostic::do_not_recommend(not_accepted(42))] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 3 warnings emitted + diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs new file mode 100644 index 0000000000000..eeff5e2e6e8fc --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/does_not_acccept_args.rs @@ -0,0 +1,22 @@ +//@ check-pass +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +trait Foo {} +trait Bar {} +trait Baz {} + +#[diagnostic::do_not_recommend(not_accepted)] +//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments +impl Foo for T where T: Send {} + +#[diagnostic::do_not_recommend(not_accepted = "foo")] +//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments +impl Bar for T where T: Send {} + +#[diagnostic::do_not_recommend(not_accepted(42))] +//~^ WARNING `#[diagnostic::do_not_recommend]` does not expect any arguments +impl Baz for T where T: Send {} + +fn main() {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs deleted file mode 100644 index 5a26d28188c25..0000000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.rs +++ /dev/null @@ -1,17 +0,0 @@ -#![feature(do_not_recommend)] - -pub trait Foo {} - -impl Foo for i32 {} - -pub trait Bar {} - -#[diagnostic::do_not_recommend] -impl Bar for T {} - -fn stuff(_: T) {} - -fn main() { - stuff(1u8); - //~^ the trait bound `u8: Bar` is not satisfied -} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr deleted file mode 100644 index 3951231fa2e71..0000000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/feature-gate-do_not_recommend.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0277]: the trait bound `u8: Bar` is not satisfied - --> $DIR/feature-gate-do_not_recommend.rs:15:11 - | -LL | stuff(1u8); - | ^^^ the trait `Bar` is not implemented for `u8` - | -note: required by a bound in `stuff` - --> $DIR/feature-gate-do_not_recommend.rs:12:13 - | -LL | fn stuff(_: T) {} - | ^^^ required by this bound in `stuff` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr similarity index 72% rename from tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.stderr rename to tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr index c83fd46db5841..ee6ebabadd97a 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.current.stderr @@ -1,5 +1,5 @@ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:4:1 + --> $DIR/incorrect-locations.rs:6:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -7,46 +7,52 @@ LL | #[diagnostic::do_not_recommend] = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:8:1 + --> $DIR/incorrect-locations.rs:10:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:12:1 + --> $DIR/incorrect-locations.rs:14:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:16:1 + --> $DIR/incorrect-locations.rs:18:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:20:1 + --> $DIR/incorrect-locations.rs:22:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:24:1 + --> $DIR/incorrect-locations.rs:26:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:28:1 + --> $DIR/incorrect-locations.rs:30:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations - --> $DIR/incorrect-locations.rs:32:1 + --> $DIR/incorrect-locations.rs:34:1 | LL | #[diagnostic::do_not_recommend] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -warning: 8 warnings emitted +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:38:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 9 warnings emitted diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr new file mode 100644 index 0000000000000..ee6ebabadd97a --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.next.stderr @@ -0,0 +1,58 @@ +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:6:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:10:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:14:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:18:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:22:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:26:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:30:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:34:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: `#[diagnostic::do_not_recommend]` can only be placed on trait implementations + --> $DIR/incorrect-locations.rs:38:1 + | +LL | #[diagnostic::do_not_recommend] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +warning: 9 warnings emitted + diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs index 400ef83873e13..1cf436aa2af3f 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/incorrect-locations.rs @@ -1,5 +1,7 @@ //@ check-pass -#![feature(do_not_recommend)] +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver #[diagnostic::do_not_recommend] //~^WARN `#[diagnostic::do_not_recommend]` can only be placed @@ -17,6 +19,10 @@ type Type = (); //~^WARN `#[diagnostic::do_not_recommend]` can only be placed enum Enum {} +#[diagnostic::do_not_recommend] +//~^WARN `#[diagnostic::do_not_recommend]` can only be placed +impl Enum {} + #[diagnostic::do_not_recommend] //~^WARN `#[diagnostic::do_not_recommend]` can only be placed extern "C" {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr new file mode 100644 index 0000000000000..b14c68d689766 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.current.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `(): Root` is not satisfied + --> $DIR/nested.rs:21:18 + | +LL | needs_root::<()>(); + | ^^ the trait `Root` is not implemented for `()` + | +note: required by a bound in `needs_root` + --> $DIR/nested.rs:18:18 + | +LL | fn needs_root() {} + | ^^^^ required by this bound in `needs_root` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr new file mode 100644 index 0000000000000..b14c68d689766 --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.next.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `(): Root` is not satisfied + --> $DIR/nested.rs:21:18 + | +LL | needs_root::<()>(); + | ^^ the trait `Root` is not implemented for `()` + | +note: required by a bound in `needs_root` + --> $DIR/nested.rs:18:18 + | +LL | fn needs_root() {} + | ^^^^ required by this bound in `needs_root` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs new file mode 100644 index 0000000000000..6534157d1fb2e --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/nested.rs @@ -0,0 +1,23 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +trait Root {} +trait DontRecommend {} +trait Other {} +trait Child {} + +#[diagnostic::do_not_recommend] +impl Root for T where T: DontRecommend {} + +impl DontRecommend for T where T: Other {} + +#[diagnostic::do_not_recommend] +impl Other for T where T: Child {} + +fn needs_root() {} + +fn main() { + needs_root::<()>(); + //~^ ERROR the trait bound `(): Root` is not satisfied +} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr index 729cb5694e216..884b13c17b802 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `*mut (): Foo` is not satisfied - --> $DIR/simple.rs:17:17 + --> $DIR/simple.rs:15:17 | LL | needs_foo::<*mut ()>(); | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` | note: required by a bound in `needs_foo` - --> $DIR/simple.rs:12:17 + --> $DIR/simple.rs:10:17 | LL | fn needs_foo() {} | ^^^ required by this bound in `needs_foo` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr index 729cb5694e216..884b13c17b802 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.next.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `*mut (): Foo` is not satisfied - --> $DIR/simple.rs:17:17 + --> $DIR/simple.rs:15:17 | LL | needs_foo::<*mut ()>(); | ^^^^^^^ the trait `Foo` is not implemented for `*mut ()` | note: required by a bound in `needs_foo` - --> $DIR/simple.rs:12:17 + --> $DIR/simple.rs:10:17 | LL | fn needs_foo() {} | ^^^ required by this bound in `needs_foo` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs index 780649b009c63..6bca2b724d240 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/simple.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - trait Foo {} #[diagnostic::do_not_recommend] diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr index 41a10a61e1dfd..d86058063955e 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.current.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): Root` is not satisfied - --> $DIR/stacked.rs:19:18 + --> $DIR/stacked.rs:17:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/stacked.rs:16:18 + --> $DIR/stacked.rs:14:18 | LL | fn needs_root() {} | ^^^^ required by this bound in `needs_root` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr index 41a10a61e1dfd..d86058063955e 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.next.stderr @@ -1,11 +1,11 @@ error[E0277]: the trait bound `(): Root` is not satisfied - --> $DIR/stacked.rs:19:18 + --> $DIR/stacked.rs:17:18 | LL | needs_root::<()>(); | ^^ the trait `Root` is not implemented for `()` | note: required by a bound in `needs_root` - --> $DIR/stacked.rs:16:18 + --> $DIR/stacked.rs:14:18 | LL | fn needs_root() {} | ^^^^ required by this bound in `needs_root` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs index fc355bdc4e204..842e04b9d9017 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/stacked.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - trait Root {} trait DontRecommend {} trait Other {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr index ca9a6ebc1c45f..95ccbb92a89b0 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.current.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/supress_suggestions_in_help.rs:23:11 + --> $DIR/supress_suggestions_in_help.rs:21:11 | LL | check(()); | ----- ^^ the trait `Foo` is not implemented for `()` @@ -8,7 +8,7 @@ LL | check(()); | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `check` - --> $DIR/supress_suggestions_in_help.rs:20:18 + --> $DIR/supress_suggestions_in_help.rs:18:18 | LL | fn check(a: impl Foo) {} | ^^^ required by this bound in `check` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr index ca9a6ebc1c45f..95ccbb92a89b0 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.next.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `(): Foo` is not satisfied - --> $DIR/supress_suggestions_in_help.rs:23:11 + --> $DIR/supress_suggestions_in_help.rs:21:11 | LL | check(()); | ----- ^^ the trait `Foo` is not implemented for `()` @@ -8,7 +8,7 @@ LL | check(()); | = help: the trait `Foo` is implemented for `i32` note: required by a bound in `check` - --> $DIR/supress_suggestions_in_help.rs:20:18 + --> $DIR/supress_suggestions_in_help.rs:18:18 | LL | fn check(a: impl Foo) {} | ^^^ required by this bound in `check` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs index ef6f255c3518b..2c7c151612303 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/supress_suggestions_in_help.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - trait Foo {} #[diagnostic::do_not_recommend] diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr index bcede8a255f23..b53febbb71ab8 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.current.stderr @@ -1,11 +1,11 @@ error[E0277]: Very important message! - --> $DIR/type_mismatch.rs:25:14 + --> $DIR/type_mismatch.rs:23:14 | LL | verify::(); | ^^ the trait `TheImportantOne` is not implemented for `u8` | note: required by a bound in `verify` - --> $DIR/type_mismatch.rs:22:14 + --> $DIR/type_mismatch.rs:20:14 | LL | fn verify() {} | ^^^^^^^^^^^^^^^ required by this bound in `verify` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr index bcede8a255f23..b53febbb71ab8 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr +++ b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.next.stderr @@ -1,11 +1,11 @@ error[E0277]: Very important message! - --> $DIR/type_mismatch.rs:25:14 + --> $DIR/type_mismatch.rs:23:14 | LL | verify::(); | ^^ the trait `TheImportantOne` is not implemented for `u8` | note: required by a bound in `verify` - --> $DIR/type_mismatch.rs:22:14 + --> $DIR/type_mismatch.rs:20:14 | LL | fn verify() {} | ^^^^^^^^^^^^^^^ required by this bound in `verify` diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs index d6721ccc848f8..7f30fdb06c75a 100644 --- a/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs +++ b/tests/ui/diagnostic_namespace/do_not_recommend/type_mismatch.rs @@ -2,8 +2,6 @@ //@ ignore-compare-mode-next-solver (explicit revisions) //@[next] compile-flags: -Znext-solver -#![feature(do_not_recommend)] - #[diagnostic::on_unimplemented(message = "Very important message!")] trait TheImportantOne {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs deleted file mode 100644 index ccc687aa5b362..0000000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![deny(unknown_or_malformed_diagnostic_attributes)] -trait Foo {} - -#[diagnostic::do_not_recommend] -//~^ ERROR unknown diagnostic attribute [unknown_or_malformed_diagnostic_attributes] -impl Foo for i32 {} - -fn main() {} diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr deleted file mode 100644 index d8332229d4fc4..0000000000000 --- a/tests/ui/diagnostic_namespace/do_not_recommend/unstable-feature.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: unknown diagnostic attribute - --> $DIR/unstable-feature.rs:4:15 - | -LL | #[diagnostic::do_not_recommend] - | ^^^^^^^^^^^^^^^^ - | -note: the lint level is defined here - --> $DIR/unstable-feature.rs:1:9 - | -LL | #![deny(unknown_or_malformed_diagnostic_attributes)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr new file mode 100644 index 0000000000000..a8429ff60f83a --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.current.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/with_lifetime.rs:17:5 + | +LL | fn foo<'a>(a: &'a ()) { + | -- lifetime `'a` defined here +LL | needs_root::<&'a ()>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to 1 previous error + diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr new file mode 100644 index 0000000000000..a8429ff60f83a --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.next.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/with_lifetime.rs:17:5 + | +LL | fn foo<'a>(a: &'a ()) { + | -- lifetime `'a` defined here +LL | needs_root::<&'a ()>(); + | ^^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to 1 previous error + diff --git a/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs new file mode 100644 index 0000000000000..6a67d83d5fe4d --- /dev/null +++ b/tests/ui/diagnostic_namespace/do_not_recommend/with_lifetime.rs @@ -0,0 +1,23 @@ +//@ revisions: current next +//@ ignore-compare-mode-next-solver (explicit revisions) +//@[next] compile-flags: -Znext-solver + +trait Root {} +trait DontRecommend {} + +impl Root for T where T: DontRecommend {} + +// this has no effect yet for resolving the trait error below +#[diagnostic::do_not_recommend] +impl DontRecommend for &'static T {} + +fn needs_root() {} + +fn foo<'a>(a: &'a ()) { + needs_root::<&'a ()>(); + //~^ ERROR lifetime may not live long enough +} + +fn main() { + foo(&()); +} diff --git a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs new file mode 100644 index 0000000000000..225891e390ff5 --- /dev/null +++ b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs @@ -0,0 +1,21 @@ +struct Website { + url: String, + title: Option, +} + +fn main() { + let website = Website { + url: "http://www.example.com".into(), + title: Some("Example Domain".into()), + }; + + if let Website { url, Some(title) } = website { //~ ERROR expected `,` + //~^ NOTE while parsing the fields for this pattern + println!("[{}]({})", title, url); // we hide the errors for `title` and `url` + } + + if let Website { url, .. } = website { //~ NOTE this pattern + println!("[{}]({})", title, url); //~ ERROR cannot find value `title` in this scope + //~^ NOTE not found in this scope + } +} diff --git a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr new file mode 100644 index 0000000000000..80fcd714400d6 --- /dev/null +++ b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.stderr @@ -0,0 +1,19 @@ +error: expected `,` + --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:12:31 + | +LL | if let Website { url, Some(title) } = website { + | ------- ^ + | | + | while parsing the fields for this pattern + +error[E0425]: cannot find value `title` in this scope + --> $DIR/struct-pattern-with-missing-fields-resolve-error.rs:18:30 + | +LL | if let Website { url, .. } = website { + | ------------------- this pattern doesn't include `title`, which is available in `Website` +LL | println!("[{}]({})", title, url); + | ^^^^^ not found in this scope + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0425`.