From 0246245420bbbb378db020c0492561cf701165cd Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Fri, 8 Aug 2025 21:59:51 +0800 Subject: rustc_target: Add the `32s` target feature for LoongArch --- tests/ui/check-cfg/target_feature.stderr | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr index 44fc23b6390..f845f9a3c25 100644 --- a/tests/ui/check-cfg/target_feature.stderr +++ b/tests/ui/check-cfg/target_feature.stderr @@ -6,6 +6,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE"); | = note: expected values for `target_feature` are: `10e60` `2e3` +`32s` `3e3r1` `3e3r2` `3e3r3` -- cgit 1.4.1-3-g733a5 From 0c8485f02332f18a41f93ecd1cc3e9611040238b Mon Sep 17 00:00:00 2001 From: Makai Date: Wed, 13 Aug 2025 20:22:18 +0800 Subject: suggest using `pub(crate)` for E0364 --- compiler/rustc_resolve/messages.ftl | 3 +++ compiler/rustc_resolve/src/build_reduced_graph.rs | 4 ++++ compiler/rustc_resolve/src/errors.rs | 11 +++++++++++ compiler/rustc_resolve/src/imports.rs | 8 +++++++- tests/ui/privacy/macro-private-reexport.stderr | 4 ++++ tests/ui/rust-2018/uniform-paths/macro-rules.stderr | 4 ++++ 6 files changed, 33 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl index ceef558c0cf..293471df1c1 100644 --- a/compiler/rustc_resolve/messages.ftl +++ b/compiler/rustc_resolve/messages.ftl @@ -93,6 +93,9 @@ resolve_consider_adding_a_derive = resolve_consider_adding_macro_export = consider adding a `#[macro_export]` to the macro in the imported module +resolve_consider_marking_as_pub_crate = + in case you want to use the macro within this crate only, reduce the visibility to `pub(crate)` + resolve_consider_declaring_with_pub = consider declaring type or module `{$ident}` with `pub` diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs index d18d0fc16a8..185749ba8a0 100644 --- a/compiler/rustc_resolve/src/build_reduced_graph.rs +++ b/compiler/rustc_resolve/src/build_reduced_graph.rs @@ -474,6 +474,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { root_span, root_id, vis, + vis_span: item.vis.span, }); self.r.indeterminate_imports.push(import); @@ -966,6 +967,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { span: item.span, module_path: Vec::new(), vis, + vis_span: item.vis.span, }); if used { self.r.import_use_map.insert(import, Used::Other); @@ -1105,6 +1107,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { span, module_path: Vec::new(), vis: Visibility::Restricted(CRATE_DEF_ID), + vis_span: item.vis.span, }) }; @@ -1274,6 +1277,7 @@ impl<'a, 'ra, 'tcx> BuildReducedGraphVisitor<'a, 'ra, 'tcx> { span, module_path: Vec::new(), vis, + vis_span: item.vis.span, }); self.r.import_use_map.insert(import, Used::Other); let import_binding = self.r.import(binding, import); diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 2747ba135ed..6f81724f140 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -769,6 +769,17 @@ pub(crate) struct ConsiderAddingMacroExport { pub(crate) span: Span, } +#[derive(Subdiagnostic)] +#[suggestion( + resolve_consider_marking_as_pub_crate, + code = "pub(crate)", + applicability = "maybe-incorrect" +)] +pub(crate) struct ConsiderMarkingAsPubCrate { + #[primary_span] + pub(crate) vis_span: Span, +} + #[derive(Subdiagnostic)] #[note(resolve_consider_marking_as_pub)] pub(crate) struct ConsiderMarkingAsPub { diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 403d440bee7..be4771dcb31 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -30,7 +30,7 @@ use crate::diagnostics::{DiagMode, Suggestion, import_candidates}; use crate::errors::{ CannotBeReexportedCratePublic, CannotBeReexportedCratePublicNS, CannotBeReexportedPrivate, CannotBeReexportedPrivateNS, CannotDetermineImportResolution, CannotGlobImportAllCrates, - ConsiderAddingMacroExport, ConsiderMarkingAsPub, + ConsiderAddingMacroExport, ConsiderMarkingAsPub, ConsiderMarkingAsPubCrate, }; use crate::{ AmbiguityError, AmbiguityKind, BindingKey, CmResolver, Determinacy, Finalize, ImportSuggestion, @@ -188,6 +188,9 @@ pub(crate) struct ImportData<'ra> { /// |`use foo` | `ModuleOrUniformRoot::CurrentScope` | - | pub imported_module: Cell>>, pub vis: Visibility, + + /// Span of the visibility. + pub vis_span: Span, } /// All imports are unique and allocated on a same arena, @@ -1373,6 +1376,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> { err.subdiagnostic( ConsiderAddingMacroExport { span: binding.span, }); + err.subdiagnostic( ConsiderMarkingAsPubCrate { + vis_span: import.vis_span, + }); } _ => { err.subdiagnostic( ConsiderMarkingAsPub { diff --git a/tests/ui/privacy/macro-private-reexport.stderr b/tests/ui/privacy/macro-private-reexport.stderr index b8768f3612e..aa02715c202 100644 --- a/tests/ui/privacy/macro-private-reexport.stderr +++ b/tests/ui/privacy/macro-private-reexport.stderr @@ -11,6 +11,10 @@ LL | / macro_rules! bar { LL | | () => {}; LL | | } | |_____^ +help: in case you want to use the macro within this crate only, reduce the visibility to `pub(crate)` + | +LL | pub(crate) use bar as _; + | +++++++ error[E0364]: `baz` is private, and cannot be re-exported --> $DIR/macro-private-reexport.rs:14:13 diff --git a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr index 661d667eb9a..43eacd5413f 100644 --- a/tests/ui/rust-2018/uniform-paths/macro-rules.stderr +++ b/tests/ui/rust-2018/uniform-paths/macro-rules.stderr @@ -9,6 +9,10 @@ help: consider adding a `#[macro_export]` to the macro in the imported module | LL | macro_rules! legacy_macro { () => () } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: in case you want to use the macro within this crate only, reduce the visibility to `pub(crate)` + | +LL | pub(crate) use legacy_macro as _; + | +++++++ error: aborting due to 1 previous error -- cgit 1.4.1-3-g733a5 From c3c2c23e0d96c76f11a307cf3c4cf14a86fd158b Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Thu, 3 Apr 2025 20:59:05 -0400 Subject: Extend `QueryStability` to handle `IntoIterator` implementations Fix adjacent code Fix duplicate warning; merge test into `tests/ui-fulldeps/internal-lints` Use `rustc_middle::ty::FnSig::inputs` Address two review comments - https://github.com/rust-lang/rust/pull/139345#discussion_r2109006991 - https://github.com/rust-lang/rust/pull/139345#discussion_r2109058588 Use `Instance::try_resolve` Import `rustc_middle::ty::Ty` as `Ty` rather than `MiddleTy` Simplify predicate handling Add more `#[allow(rustc::potential_query_instability)]` following rebase Remove two `#[allow(rustc::potential_query_instability)]` following rebase Address review comment Update compiler/rustc_lint/src/internal.rs Co-authored-by: lcnr --- compiler/rustc_codegen_ssa/src/target_features.rs | 1 + compiler/rustc_errors/src/emitter.rs | 4 +- compiler/rustc_expand/src/mbe/macro_rules.rs | 1 + compiler/rustc_interface/src/interface.rs | 4 +- compiler/rustc_lint/src/internal.rs | 132 +++++++++++++-------- src/librustdoc/formats/cache.rs | 2 +- .../ui-fulldeps/internal-lints/query_stability.rs | 12 ++ .../internal-lints/query_stability.stderr | 18 ++- 8 files changed, 122 insertions(+), 52 deletions(-) (limited to 'tests') diff --git a/compiler/rustc_codegen_ssa/src/target_features.rs b/compiler/rustc_codegen_ssa/src/target_features.rs index 7e4341a8236..b5aa50f4851 100644 --- a/compiler/rustc_codegen_ssa/src/target_features.rs +++ b/compiler/rustc_codegen_ssa/src/target_features.rs @@ -180,6 +180,7 @@ fn parse_rust_feature_flag<'a>( while let Some(new_feature) = new_features.pop() { if features.insert(new_feature) { if let Some(implied_features) = inverse_implied_features.get(&new_feature) { + #[allow(rustc::potential_query_instability)] new_features.extend(implied_features) } } diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 97c47fa9b9a..749bba5de12 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -17,7 +17,7 @@ use std::path::Path; use std::sync::Arc; use derive_setters::Setters; -use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet}; +use rustc_data_structures::fx::{FxIndexMap, FxIndexSet}; use rustc_data_structures::sync::{DynSend, IntoDynSyncSend}; use rustc_error_messages::{FluentArgs, SpanLabel}; use rustc_lexer; @@ -1853,7 +1853,7 @@ impl HumanEmitter { && line_idx + 1 == annotated_file.lines.len(), ); - let mut to_add = FxHashMap::default(); + let mut to_add = FxIndexMap::default(); for (depth, style) in depths { // FIXME(#120456) - is `swap_remove` correct? diff --git a/compiler/rustc_expand/src/mbe/macro_rules.rs b/compiler/rustc_expand/src/mbe/macro_rules.rs index 334f57f9d62..6b57ced56eb 100644 --- a/compiler/rustc_expand/src/mbe/macro_rules.rs +++ b/compiler/rustc_expand/src/mbe/macro_rules.rs @@ -522,6 +522,7 @@ pub(super) fn try_match_macro_attr<'matcher, T: Tracker<'matcher>>( match result { Success(body_named_matches) => { psess.gated_spans.merge(gated_spans_snapshot); + #[allow(rustc::potential_query_instability)] named_matches.extend(body_named_matches); return Ok((i, rule, named_matches)); } diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs index c46e879b976..8f131f45bbd 100644 --- a/compiler/rustc_interface/src/interface.rs +++ b/compiler/rustc_interface/src/interface.rs @@ -285,7 +285,9 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec) -> Ch .expecteds .entry(name.name) .and_modify(|v| match v { - ExpectedValues::Some(v) if !values_any_specified => { + ExpectedValues::Some(v) if !values_any_specified => + { + #[allow(rustc::potential_query_instability)] v.extend(values.clone()) } ExpectedValues::Some(_) => *v = ExpectedValues::Any, diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs index 016ff17f5d7..e1fbe39222b 100644 --- a/compiler/rustc_lint/src/internal.rs +++ b/compiler/rustc_lint/src/internal.rs @@ -1,10 +1,10 @@ //! Some lints that are only useful in the compiler or crates that use compiler internals, such as //! Clippy. -use rustc_hir::HirId; use rustc_hir::def::Res; use rustc_hir::def_id::DefId; -use rustc_middle::ty::{self, GenericArgsRef, Ty as MiddleTy}; +use rustc_hir::{Expr, ExprKind, HirId}; +use rustc_middle::ty::{self, ClauseKind, GenericArgsRef, PredicatePolarity, TraitPredicate, Ty}; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::hygiene::{ExpnKind, MacroKind}; use rustc_span::{Span, sym}; @@ -56,25 +56,6 @@ impl LateLintPass<'_> for DefaultHashTypes { } } -/// Helper function for lints that check for expressions with calls and use typeck results to -/// get the `DefId` and `GenericArgsRef` of the function. -fn typeck_results_of_method_fn<'tcx>( - cx: &LateContext<'tcx>, - expr: &hir::Expr<'_>, -) -> Option<(Span, DefId, ty::GenericArgsRef<'tcx>)> { - match expr.kind { - hir::ExprKind::MethodCall(segment, ..) - if let Some(def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) => - { - Some((segment.ident.span, def_id, cx.typeck_results().node_args(expr.hir_id))) - } - _ => match cx.typeck_results().node_type(expr.hir_id).kind() { - &ty::FnDef(def_id, args) => Some((expr.span, def_id, args)), - _ => None, - }, - } -} - declare_tool_lint! { /// The `potential_query_instability` lint detects use of methods which can lead to /// potential query instability, such as iterating over a `HashMap`. @@ -101,10 +82,12 @@ declare_tool_lint! { declare_lint_pass!(QueryStability => [POTENTIAL_QUERY_INSTABILITY, UNTRACKED_QUERY_INFORMATION]); -impl LateLintPass<'_> for QueryStability { - fn check_expr(&mut self, cx: &LateContext<'_>, expr: &hir::Expr<'_>) { - let Some((span, def_id, args)) = typeck_results_of_method_fn(cx, expr) else { return }; - if let Ok(Some(instance)) = ty::Instance::try_resolve(cx.tcx, cx.typing_env(), def_id, args) +impl<'tcx> LateLintPass<'tcx> for QueryStability { + fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) { + if let Some((callee_def_id, span, generic_args, _recv, _args)) = + get_callee_span_generic_args_and_args(cx, expr) + && let Ok(Some(instance)) = + ty::Instance::try_resolve(cx.tcx, cx.typing_env(), callee_def_id, generic_args) { let def_id = instance.def_id(); if cx.tcx.has_attr(def_id, sym::rustc_lint_query_instability) { @@ -113,7 +96,15 @@ impl LateLintPass<'_> for QueryStability { span, QueryInstability { query: cx.tcx.item_name(def_id) }, ); + } else if has_unstable_into_iter_predicate(cx, callee_def_id, generic_args) { + let call_span = span.with_hi(expr.span.hi()); + cx.emit_span_lint( + POTENTIAL_QUERY_INSTABILITY, + call_span, + QueryInstability { query: sym::into_iter }, + ); } + if cx.tcx.has_attr(def_id, sym::rustc_lint_untracked_query_information) { cx.emit_span_lint( UNTRACKED_QUERY_INFORMATION, @@ -125,6 +116,64 @@ impl LateLintPass<'_> for QueryStability { } } +fn has_unstable_into_iter_predicate<'tcx>( + cx: &LateContext<'tcx>, + callee_def_id: DefId, + generic_args: GenericArgsRef<'tcx>, +) -> bool { + let Some(into_iterator_def_id) = cx.tcx.get_diagnostic_item(sym::IntoIterator) else { + return false; + }; + let Some(into_iter_fn_def_id) = cx.tcx.lang_items().into_iter_fn() else { + return false; + }; + let predicates = cx.tcx.predicates_of(callee_def_id).instantiate(cx.tcx, generic_args); + for (predicate, _) in predicates { + let ClauseKind::Trait(TraitPredicate { trait_ref, polarity: PredicatePolarity::Positive }) = + predicate.kind().skip_binder() + else { + continue; + }; + // Does the function or method require any of its arguments to implement `IntoIterator`? + if trait_ref.def_id != into_iterator_def_id { + continue; + } + let Ok(Some(instance)) = + ty::Instance::try_resolve(cx.tcx, cx.typing_env(), into_iter_fn_def_id, trait_ref.args) + else { + continue; + }; + // Does the input type's `IntoIterator` implementation have the + // `rustc_lint_query_instability` attribute on its `into_iter` method? + if cx.tcx.has_attr(instance.def_id(), sym::rustc_lint_query_instability) { + return true; + } + } + false +} + +/// Checks whether an expression is a function or method call and, if so, returns its `DefId`, +/// `Span`, `GenericArgs`, and arguments. This is a slight augmentation of a similarly named Clippy +/// function, `get_callee_generic_args_and_args`. +fn get_callee_span_generic_args_and_args<'tcx>( + cx: &LateContext<'tcx>, + expr: &'tcx Expr<'tcx>, +) -> Option<(DefId, Span, GenericArgsRef<'tcx>, Option<&'tcx Expr<'tcx>>, &'tcx [Expr<'tcx>])> { + if let ExprKind::Call(callee, args) = expr.kind + && let callee_ty = cx.typeck_results().expr_ty(callee) + && let ty::FnDef(callee_def_id, generic_args) = callee_ty.kind() + { + return Some((*callee_def_id, callee.span, generic_args, None, args)); + } + if let ExprKind::MethodCall(segment, recv, args, _) = expr.kind + && let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id) + { + let generic_args = cx.typeck_results().node_args(expr.hir_id); + return Some((method_def_id, segment.ident.span, generic_args, Some(recv), args)); + } + None +} + declare_tool_lint! { /// The `usage_of_ty_tykind` lint detects usages of `ty::TyKind::`, /// where `ty::` would suffice. @@ -461,33 +510,22 @@ declare_tool_lint! { declare_lint_pass!(Diagnostics => [UNTRANSLATABLE_DIAGNOSTIC, DIAGNOSTIC_OUTSIDE_OF_IMPL]); impl LateLintPass<'_> for Diagnostics { - fn check_expr(&mut self, cx: &LateContext<'_>, expr: &hir::Expr<'_>) { + fn check_expr<'tcx>(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) { let collect_args_tys_and_spans = |args: &[hir::Expr<'_>], reserve_one_extra: bool| { let mut result = Vec::with_capacity(args.len() + usize::from(reserve_one_extra)); result.extend(args.iter().map(|arg| (cx.typeck_results().expr_ty(arg), arg.span))); result }; // Only check function calls and method calls. - let (span, def_id, fn_gen_args, arg_tys_and_spans) = match expr.kind { - hir::ExprKind::Call(callee, args) => { - match cx.typeck_results().node_type(callee.hir_id).kind() { - &ty::FnDef(def_id, fn_gen_args) => { - (callee.span, def_id, fn_gen_args, collect_args_tys_and_spans(args, false)) - } - _ => return, // occurs for fns passed as args - } - } - hir::ExprKind::MethodCall(_segment, _recv, args, _span) => { - let Some((span, def_id, fn_gen_args)) = typeck_results_of_method_fn(cx, expr) - else { - return; - }; - let mut args = collect_args_tys_and_spans(args, true); - args.insert(0, (cx.tcx.types.self_param, _recv.span)); // dummy inserted for `self` - (span, def_id, fn_gen_args, args) - } - _ => return, + let Some((def_id, span, fn_gen_args, recv, args)) = + get_callee_span_generic_args_and_args(cx, expr) + else { + return; }; + let mut arg_tys_and_spans = collect_args_tys_and_spans(args, recv.is_some()); + if let Some(recv) = recv { + arg_tys_and_spans.insert(0, (cx.tcx.types.self_param, recv.span)); // dummy inserted for `self` + } Self::diagnostic_outside_of_impl(cx, span, expr.hir_id, def_id, fn_gen_args); Self::untranslatable_diagnostic(cx, def_id, &arg_tys_and_spans); @@ -496,7 +534,7 @@ impl LateLintPass<'_> for Diagnostics { impl Diagnostics { // Is the type `{D,Subd}iagMessage`? - fn is_diag_message<'cx>(cx: &LateContext<'cx>, ty: MiddleTy<'cx>) -> bool { + fn is_diag_message<'cx>(cx: &LateContext<'cx>, ty: Ty<'cx>) -> bool { if let Some(adt_def) = ty.ty_adt_def() && let Some(name) = cx.tcx.get_diagnostic_name(adt_def.did()) && matches!(name, sym::DiagMessage | sym::SubdiagMessage) @@ -510,7 +548,7 @@ impl Diagnostics { fn untranslatable_diagnostic<'cx>( cx: &LateContext<'cx>, def_id: DefId, - arg_tys_and_spans: &[(MiddleTy<'cx>, Span)], + arg_tys_and_spans: &[(Ty<'cx>, Span)], ) { let fn_sig = cx.tcx.fn_sig(def_id).instantiate_identity().skip_binder(); let predicates = cx.tcx.predicates_of(def_id).instantiate_identity(cx.tcx).predicates; diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 918b292466d..359a35ec7fa 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -48,7 +48,7 @@ pub(crate) struct Cache { /// Similar to `paths`, but only holds external paths. This is only used for /// generating explicit hyperlinks to other crates. - pub(crate) external_paths: FxHashMap, ItemType)>, + pub(crate) external_paths: FxIndexMap, ItemType)>, /// Maps local `DefId`s of exported types to fully qualified paths. /// Unlike 'paths', this mapping ignores any renames that occur diff --git a/tests/ui-fulldeps/internal-lints/query_stability.rs b/tests/ui-fulldeps/internal-lints/query_stability.rs index 7b897fabd2d..9dc65250064 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.rs +++ b/tests/ui-fulldeps/internal-lints/query_stability.rs @@ -34,4 +34,16 @@ fn main() { //~^ ERROR using `values_mut` can result in unstable query results *val = *val + 10; } + + FxHashMap::::default().extend(x); + //~^ ERROR using `into_iter` can result in unstable query results +} + +fn hide_into_iter(x: impl IntoIterator) -> impl Iterator { + x.into_iter() +} + +fn take(map: std::collections::HashMap) { + _ = hide_into_iter(map); + //~^ ERROR using `into_iter` can result in unstable query results } diff --git a/tests/ui-fulldeps/internal-lints/query_stability.stderr b/tests/ui-fulldeps/internal-lints/query_stability.stderr index 43b156dc20a..a95ffd25a47 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.stderr +++ b/tests/ui-fulldeps/internal-lints/query_stability.stderr @@ -59,5 +59,21 @@ LL | for val in x.values_mut() { | = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale -error: aborting due to 7 previous errors +error: using `into_iter` can result in unstable query results + --> $DIR/query_stability.rs:38:38 + | +LL | FxHashMap::::default().extend(x); + | ^^^^^^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: using `into_iter` can result in unstable query results + --> $DIR/query_stability.rs:47:9 + | +LL | _ = hide_into_iter(map); + | ^^^^^^^^^^^^^^^^^^^ + | + = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale + +error: aborting due to 9 previous errors -- cgit 1.4.1-3-g733a5 From 3b0ff9cb6962c91e9ce71f3224da9bae5b193538 Mon Sep 17 00:00:00 2001 From: Samuel Moelius Date: Sun, 17 Aug 2025 09:07:13 -0400 Subject: Add `//@ ignore-stage1` to query_stability.rs test --- tests/ui-fulldeps/internal-lints/query_stability.rs | 1 + .../internal-lints/query_stability.stderr | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/ui-fulldeps/internal-lints/query_stability.rs b/tests/ui-fulldeps/internal-lints/query_stability.rs index 9dc65250064..92c1d6bf7f8 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.rs +++ b/tests/ui-fulldeps/internal-lints/query_stability.rs @@ -1,4 +1,5 @@ //@ compile-flags: -Z unstable-options +//@ ignore-stage1 #![feature(rustc_private)] #![deny(rustc::potential_query_instability)] diff --git a/tests/ui-fulldeps/internal-lints/query_stability.stderr b/tests/ui-fulldeps/internal-lints/query_stability.stderr index a95ffd25a47..e5bb0453f90 100644 --- a/tests/ui-fulldeps/internal-lints/query_stability.stderr +++ b/tests/ui-fulldeps/internal-lints/query_stability.stderr @@ -1,18 +1,18 @@ error: using `drain` can result in unstable query results - --> $DIR/query_stability.rs:13:16 + --> $DIR/query_stability.rs:14:16 | LL | for _ in x.drain() {} | ^^^^^ | = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale note: the lint level is defined here - --> $DIR/query_stability.rs:4:9 + --> $DIR/query_stability.rs:5:9 | LL | #![deny(rustc::potential_query_instability)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: using `iter` can result in unstable query results - --> $DIR/query_stability.rs:16:16 + --> $DIR/query_stability.rs:17:16 | LL | for _ in x.iter() {} | ^^^^ @@ -20,7 +20,7 @@ LL | for _ in x.iter() {} = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `iter_mut` can result in unstable query results - --> $DIR/query_stability.rs:19:36 + --> $DIR/query_stability.rs:20:36 | LL | for _ in Some(&mut x).unwrap().iter_mut() {} | ^^^^^^^^ @@ -28,7 +28,7 @@ LL | for _ in Some(&mut x).unwrap().iter_mut() {} = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `into_iter` can result in unstable query results - --> $DIR/query_stability.rs:22:14 + --> $DIR/query_stability.rs:23:14 | LL | for _ in x {} | ^ @@ -36,7 +36,7 @@ LL | for _ in x {} = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `keys` can result in unstable query results - --> $DIR/query_stability.rs:26:15 + --> $DIR/query_stability.rs:27:15 | LL | let _ = x.keys(); | ^^^^ @@ -44,7 +44,7 @@ LL | let _ = x.keys(); = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `values` can result in unstable query results - --> $DIR/query_stability.rs:29:15 + --> $DIR/query_stability.rs:30:15 | LL | let _ = x.values(); | ^^^^^^ @@ -52,7 +52,7 @@ LL | let _ = x.values(); = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `values_mut` can result in unstable query results - --> $DIR/query_stability.rs:33:18 + --> $DIR/query_stability.rs:34:18 | LL | for val in x.values_mut() { | ^^^^^^^^^^ @@ -60,7 +60,7 @@ LL | for val in x.values_mut() { = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `into_iter` can result in unstable query results - --> $DIR/query_stability.rs:38:38 + --> $DIR/query_stability.rs:39:38 | LL | FxHashMap::::default().extend(x); | ^^^^^^^^^ @@ -68,7 +68,7 @@ LL | FxHashMap::::default().extend(x); = note: if you believe this case to be fine, allow this lint and add a comment explaining your rationale error: using `into_iter` can result in unstable query results - --> $DIR/query_stability.rs:47:9 + --> $DIR/query_stability.rs:48:9 | LL | _ = hide_into_iter(map); | ^^^^^^^^^^^^^^^^^^^ -- cgit 1.4.1-3-g733a5 From 1cd7080c3a7f29297675a72a157575ae12717304 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Wed, 7 May 2025 07:57:01 +0000 Subject: Add -Zindirect-branch-cs-prefix (from draft PR) --- compiler/rustc_codegen_llvm/src/context.rs | 9 +++++++++ compiler/rustc_interface/src/tests.rs | 1 + compiler/rustc_session/src/options.rs | 2 ++ tests/codegen-llvm/indirect-branch-cs-prefix.rs | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 tests/codegen-llvm/indirect-branch-cs-prefix.rs (limited to 'tests') diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index b0f3494ea68..ea3a21dfdb5 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -462,6 +462,15 @@ pub(crate) unsafe fn create_module<'ll>( } } + if sess.opts.unstable_opts.indirect_branch_cs_prefix { + llvm::add_module_flag_u32( + llmod, + llvm::ModuleFlagMergeBehavior::Override, + "indirect_branch_cs_prefix", + 1, + ); + } + match (sess.opts.unstable_opts.small_data_threshold, sess.target.small_data_threshold_support()) { // Set up the small-data optimization limit for architectures that use diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index 0a764808f95..4425877308a 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -807,6 +807,7 @@ fn test_unstable_options_tracking_hash() { tracked!(hint_mostly_unused, true); tracked!(human_readable_cgu_names, true); tracked!(incremental_ignore_spans, true); + tracked!(indirect_branch_cs_prefix, true); tracked!(inline_mir, Some(true)); tracked!(inline_mir_hint_threshold, Some(123)); tracked!(inline_mir_threshold, Some(123)); diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 0e112edc733..fce4d18a1d8 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2295,6 +2295,8 @@ options! { - hashes of green query instances - hash collisions of query keys - hash collisions when creating dep-nodes"), + indirect_branch_cs_prefix: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], + "add cs prefix to call and jmp to indirect thunk (default: no)"), inline_llvm: bool = (true, parse_bool, [TRACKED], "enable LLVM inlining (default: yes)"), inline_mir: Option = (None, parse_opt_bool, [TRACKED], diff --git a/tests/codegen-llvm/indirect-branch-cs-prefix.rs b/tests/codegen-llvm/indirect-branch-cs-prefix.rs new file mode 100644 index 00000000000..a00b63a4970 --- /dev/null +++ b/tests/codegen-llvm/indirect-branch-cs-prefix.rs @@ -0,0 +1,18 @@ +// Test that the `indirect_branch_cs_prefix` module attribute is (not) emitted when the +// `-Zindirect-branch-cs-prefix` flag is (not) set. + +//@ add-core-stubs +//@ revisions: unset set +//@ needs-llvm-components: x86 +//@ compile-flags: --target x86_64-unknown-linux-gnu +//@ [set] compile-flags: -Zindirect-branch-cs-prefix + +#![crate_type = "lib"] +#![feature(no_core, lang_items)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +// unset-NOT: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1} +// set: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1} -- cgit 1.4.1-3-g733a5 From 1a29d9c23ff8df46197f5ebd3df15fe99904d312 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Wed, 7 May 2025 15:38:14 +0200 Subject: Add `-Zindirect-branch-cs-prefix` option This is intended to be used for Linux kernel RETPOLINE builds. Signed-off-by: Miguel Ojeda --- compiler/rustc_session/messages.ftl | 2 ++ compiler/rustc_session/src/errors.rs | 4 ++++ compiler/rustc_session/src/options.rs | 2 +- compiler/rustc_session/src/session.rs | 6 +++++ .../compiler-flags/indirect-branch-cs-prefix.md | 19 +++++++++++++++ .../x86_64-indirect-branch-cs-prefix.rs | 27 ++++++++++++++++++++++ tests/codegen-llvm/indirect-branch-cs-prefix.rs | 8 +++---- .../requires-x86-or-x86_64.aarch64.stderr | 4 ++++ .../requires-x86-or-x86_64.rs | 21 +++++++++++++++++ 9 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 src/doc/unstable-book/src/compiler-flags/indirect-branch-cs-prefix.md create mode 100644 tests/assembly-llvm/x86_64-indirect-branch-cs-prefix.rs create mode 100644 tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr create mode 100644 tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs (limited to 'tests') diff --git a/compiler/rustc_session/messages.ftl b/compiler/rustc_session/messages.ftl index 528c52eace7..80754964c43 100644 --- a/compiler/rustc_session/messages.ftl +++ b/compiler/rustc_session/messages.ftl @@ -49,6 +49,8 @@ session_hexadecimal_float_literal_not_supported = hexadecimal float literal is n session_incompatible_linker_flavor = linker flavor `{$flavor}` is incompatible with the current target .note = compatible flavors are: {$compatible_list} +session_indirect_branch_cs_prefix_requires_x86_or_x86_64 = `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64 + session_instrumentation_not_supported = {$us} instrumentation is not supported for this target session_int_literal_too_large = integer literal is too large diff --git a/compiler/rustc_session/src/errors.rs b/compiler/rustc_session/src/errors.rs index bf95014843d..9471807df01 100644 --- a/compiler/rustc_session/src/errors.rs +++ b/compiler/rustc_session/src/errors.rs @@ -471,6 +471,10 @@ pub(crate) struct FunctionReturnRequiresX86OrX8664; #[diag(session_function_return_thunk_extern_requires_non_large_code_model)] pub(crate) struct FunctionReturnThunkExternRequiresNonLargeCodeModel; +#[derive(Diagnostic)] +#[diag(session_indirect_branch_cs_prefix_requires_x86_or_x86_64)] +pub(crate) struct IndirectBranchCsPrefixRequiresX86OrX8664; + #[derive(Diagnostic)] #[diag(session_unsupported_regparm)] pub(crate) struct UnsupportedRegparm { diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index fce4d18a1d8..6d5be2d92cd 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -2296,7 +2296,7 @@ options! { - hash collisions of query keys - hash collisions when creating dep-nodes"), indirect_branch_cs_prefix: bool = (false, parse_bool, [TRACKED TARGET_MODIFIER], - "add cs prefix to call and jmp to indirect thunk (default: no)"), + "add `cs` prefix to `call` and `jmp` to indirect thunks (default: no)"), inline_llvm: bool = (true, parse_bool, [TRACKED], "enable LLVM inlining (default: yes)"), inline_mir: Option = (None, parse_opt_bool, [TRACKED], diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index c6956cf5f23..c8f4b511a7e 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1368,6 +1368,12 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } } + if sess.opts.unstable_opts.indirect_branch_cs_prefix { + if sess.target.arch != "x86" && sess.target.arch != "x86_64" { + sess.dcx().emit_err(errors::IndirectBranchCsPrefixRequiresX86OrX8664); + } + } + if let Some(regparm) = sess.opts.unstable_opts.regparm { if regparm > 3 { sess.dcx().emit_err(errors::UnsupportedRegparm { regparm }); diff --git a/src/doc/unstable-book/src/compiler-flags/indirect-branch-cs-prefix.md b/src/doc/unstable-book/src/compiler-flags/indirect-branch-cs-prefix.md new file mode 100644 index 00000000000..040e2d41701 --- /dev/null +++ b/src/doc/unstable-book/src/compiler-flags/indirect-branch-cs-prefix.md @@ -0,0 +1,19 @@ +# `indirect-branch-cs-prefix` + +The tracking issue for this feature is: https://github.com/rust-lang/rust/issues/116852. + +------------------------ + +Option `-Zindirect-branch-cs-prefix` controls whether a `cs` prefix is added to +`call` and `jmp` to indirect thunks. + +It is equivalent to [Clang]'s and [GCC]'s `-mindirect-branch-cs-prefix`. The +Linux kernel uses it for RETPOLINE builds. For details, see +[LLVM commit 6f867f910283] ("[X86] Support ``-mindirect-branch-cs-prefix`` for +call and jmp to indirect thunk") which introduces the feature. + +Only x86 and x86_64 are supported. + +[Clang]: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mindirect-branch-cs-prefix +[GCC]: https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-mindirect-branch-cs-prefix +[LLVM commit 6f867f910283]: https://github.com/llvm/llvm-project/commit/6f867f9102838ebe314c1f3661fdf95700386e5a diff --git a/tests/assembly-llvm/x86_64-indirect-branch-cs-prefix.rs b/tests/assembly-llvm/x86_64-indirect-branch-cs-prefix.rs new file mode 100644 index 00000000000..8e4470ee451 --- /dev/null +++ b/tests/assembly-llvm/x86_64-indirect-branch-cs-prefix.rs @@ -0,0 +1,27 @@ +// Test that the `cs` prefix is (not) added into a `call` and a `jmp` to the +// indirect thunk when the `-Zindirect-branch-cs-prefix` flag is (not) set. + +//@ revisions: unset set +//@ assembly-output: emit-asm +//@ compile-flags: -Copt-level=3 -Cunsafe-allow-abi-mismatch=retpoline,retpoline-external-thunk,indirect-branch-cs-prefix -Zretpoline-external-thunk +//@ [set] compile-flags: -Zindirect-branch-cs-prefix +//@ only-x86_64 +//@ ignore-apple Symbol is called `___x86_indirect_thunk` (Darwin's extra underscore) + +#![crate_type = "lib"] + +// CHECK-LABEL: foo: +#[no_mangle] +pub fn foo(g: fn()) { + // unset-NOT: cs + // unset: callq {{__x86_indirect_thunk.*}} + // set: cs + // set-NEXT: callq {{__x86_indirect_thunk.*}} + g(); + + // unset-NOT: cs + // unset: jmp {{__x86_indirect_thunk.*}} + // set: cs + // set-NEXT: jmp {{__x86_indirect_thunk.*}} + g(); +} diff --git a/tests/codegen-llvm/indirect-branch-cs-prefix.rs b/tests/codegen-llvm/indirect-branch-cs-prefix.rs index a00b63a4970..df25008d5f0 100644 --- a/tests/codegen-llvm/indirect-branch-cs-prefix.rs +++ b/tests/codegen-llvm/indirect-branch-cs-prefix.rs @@ -1,5 +1,5 @@ -// Test that the `indirect_branch_cs_prefix` module attribute is (not) emitted when the -// `-Zindirect-branch-cs-prefix` flag is (not) set. +// Test that the `indirect_branch_cs_prefix` module attribute is (not) +// emitted when the `-Zindirect-branch-cs-prefix` flag is (not) set. //@ add-core-stubs //@ revisions: unset set @@ -11,8 +11,8 @@ #![feature(no_core, lang_items)] #![no_core] -#[lang = "sized"] -trait Sized {} +extern crate minicore; +use minicore::*; // unset-NOT: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1} // set: !{{[0-9]+}} = !{i32 4, !"indirect_branch_cs_prefix", i32 1} diff --git a/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr new file mode 100644 index 00000000000..e3f7871da35 --- /dev/null +++ b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.aarch64.stderr @@ -0,0 +1,4 @@ +error: `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64 + +error: aborting due to 1 previous error + diff --git a/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs new file mode 100644 index 00000000000..bc81c993d26 --- /dev/null +++ b/tests/ui/invalid-compile-flags/indirect-branch-cs-prefix/requires-x86-or-x86_64.rs @@ -0,0 +1,21 @@ +//@ revisions: x86 x86_64 aarch64 + +//@ compile-flags: -Zindirect-branch-cs-prefix + +//@[x86] check-pass +//@[x86] needs-llvm-components: x86 +//@[x86] compile-flags: --target i686-unknown-linux-gnu + +//@[x86_64] check-pass +//@[x86_64] needs-llvm-components: x86 +//@[x86_64] compile-flags: --target x86_64-unknown-linux-gnu + +//@[aarch64] check-fail +//@[aarch64] needs-llvm-components: aarch64 +//@[aarch64] compile-flags: --target aarch64-unknown-linux-gnu + +#![feature(no_core)] +#![no_core] +#![no_main] + +//[aarch64]~? ERROR `-Zindirect-branch-cs-prefix` is only supported on x86 and x86_64 -- cgit 1.4.1-3-g733a5 From 75e0263af9ca27eac2c922538582deec764d1e7b Mon Sep 17 00:00:00 2001 From: Oneirical Date: Sun, 13 Jul 2025 16:56:31 -0400 Subject: Rehome tests/ui/issues/ tests [5/?] --- .../matching-on-vector-slice-option-8498.rs | 28 ++++++++ .../pattern-matching-fixed-length-vectors-7784.rs | 31 +++++++++ .../ambiguous-associated-type-error-78622.rs | 8 +++ .../ambiguous-associated-type-error-78622.stderr | 15 +++++ .../invalid-attributes-on-const-params-78957.rs | 30 +++++++++ ...invalid-attributes-on-const-params-78957.stderr | 77 ++++++++++++++++++++++ .../invalid-assignment-in-while-loop-77218.fixed | 6 ++ .../invalid-assignment-in-while-loop-77218.rs | 6 ++ .../invalid-assignment-in-while-loop-77218.stderr | 16 +++++ .../incorrect-use-after-storage-end-78192.rs | 18 +++++ .../rvalue-lifetime-match-equivalence-7660.rs | 17 +++++ .../ui/codegen/i128-shift-overflow-check-76042.rs | 17 +++++ tests/ui/coercion/mut-trait-coercion-8248.rs | 15 +++++ tests/ui/coercion/mut-trait-coercion-8248.stderr | 12 ++++ .../ui/coercion/mut-trait-object-coercion-8398.rs | 13 ++++ tests/ui/consts/const-range-matching-76191.rs | 21 ++++++ tests/ui/consts/const-range-matching-76191.stderr | 51 ++++++++++++++ tests/ui/cross-crate/auxiliary/aux-7899.rs | 1 + tests/ui/cross-crate/auxiliary/aux-8259.rs | 4 ++ .../static-regions-in-cross-crate-8259.rs | 11 ++++ .../tuple-like-structs-cross-crate-7899.rs | 10 +++ tests/ui/dyn-keyword/auxiliary/aux-8401.rs | 16 +++++ ...mut-trait-and-polymorphic-objects-issue-8401.rs | 7 ++ .../enum/enum-discriminant-type-mismatch-8761.rs | 11 ++++ .../enum-discriminant-type-mismatch-8761.stderr | 27 ++++++++ tests/ui/enum/enum-variant-field-error-80607.rs | 11 ++++ .../ui/enum/enum-variant-field-error-80607.stderr | 18 +++++ tests/ui/enum/simple-enum-usage-8506.rs | 14 ++++ .../function-definition-in-extern-block-75283.rs | 7 ++ ...unction-definition-in-extern-block-75283.stderr | 18 +++++ .../duplicate-generic-parameter-error-86756.rs | 14 ++++ .../duplicate-generic-parameter-error-86756.stderr | 48 ++++++++++++++ ...k-regex-crate-with-instrument-coverage-85461.rs | 29 ++++++++ tests/ui/issues/auxiliary/issue-7899.rs | 1 - tests/ui/issues/auxiliary/issue-8044.rs | 15 ----- tests/ui/issues/auxiliary/issue-8259.rs | 4 -- tests/ui/issues/auxiliary/issue-8401.rs | 16 ----- tests/ui/issues/auxiliary/issue-9123.rs | 9 --- tests/ui/issues/issue-75283.rs | 6 -- tests/ui/issues/issue-75283.stderr | 18 ----- tests/ui/issues/issue-7563.rs | 28 -------- tests/ui/issues/issue-7575.rs | 17 ----- tests/ui/issues/issue-7575.stderr | 10 --- tests/ui/issues/issue-76042.rs | 16 ----- .../issue-76077-1.fixed | 18 ----- .../issue-76077-1.rs | 18 ----- .../issue-76077-1.stderr | 24 ------- .../issue-76077.rs | 10 --- .../issue-76077.stderr | 10 --- tests/ui/issues/issue-76191.rs | 20 ------ tests/ui/issues/issue-76191.stderr | 51 -------------- tests/ui/issues/issue-7660.rs | 17 ----- tests/ui/issues/issue-7663.rs | 32 --------- ...ssue-7673-cast-generically-implemented-trait.rs | 19 ------ tests/ui/issues/issue-77218/issue-77218-2.fixed | 6 -- tests/ui/issues/issue-77218/issue-77218-2.rs | 6 -- tests/ui/issues/issue-77218/issue-77218-2.stderr | 16 ----- tests/ui/issues/issue-77218/issue-77218.fixed | 5 -- tests/ui/issues/issue-77218/issue-77218.rs | 5 -- tests/ui/issues/issue-77218/issue-77218.stderr | 16 ----- tests/ui/issues/issue-7784.rs | 30 --------- tests/ui/issues/issue-78192.rs | 17 ----- tests/ui/issues/issue-78622.rs | 7 -- tests/ui/issues/issue-78622.stderr | 15 ----- tests/ui/issues/issue-7867.rs | 16 ----- tests/ui/issues/issue-7867.stderr | 17 ----- tests/ui/issues/issue-78957.rs | 29 -------- tests/ui/issues/issue-78957.stderr | 77 ---------------------- tests/ui/issues/issue-7899.rs | 10 --- tests/ui/issues/issue-7911.rs | 37 ----------- tests/ui/issues/issue-7911.stderr | 12 ---- tests/ui/issues/issue-7970a.rs | 8 --- tests/ui/issues/issue-7970a.stderr | 17 ----- tests/ui/issues/issue-8044.rs | 10 --- tests/ui/issues/issue-80607.rs | 10 --- tests/ui/issues/issue-80607.stderr | 18 ----- tests/ui/issues/issue-81584.fixed | 8 --- tests/ui/issues/issue-81584.rs | 8 --- tests/ui/issues/issue-81584.stderr | 14 ---- ...71-default-method-self-inherit-builtin-trait.rs | 18 ----- tests/ui/issues/issue-81918.rs | 11 ---- tests/ui/issues/issue-8248.rs | 14 ---- tests/ui/issues/issue-8248.stderr | 12 ---- tests/ui/issues/issue-8249.rs | 19 ------ tests/ui/issues/issue-8259.rs | 11 ---- tests/ui/issues/issue-83048.rs | 5 -- tests/ui/issues/issue-83048.stderr | 9 --- tests/ui/issues/issue-8391.rs | 9 --- tests/ui/issues/issue-8398.rs | 12 ---- tests/ui/issues/issue-8401.rs | 7 -- tests/ui/issues/issue-8498.rs | 27 -------- tests/ui/issues/issue-8506.rs | 13 ---- tests/ui/issues/issue-8521.rs | 25 ------- tests/ui/issues/issue-85461.rs | 28 -------- tests/ui/issues/issue-8578.rs | 19 ------ tests/ui/issues/issue-86756.rs | 13 ---- tests/ui/issues/issue-86756.stderr | 48 -------------- tests/ui/issues/issue-87199.rs | 21 ------ tests/ui/issues/issue-87199.stderr | 46 ------------- tests/ui/issues/issue-8727.rs | 16 ----- tests/ui/issues/issue-8727.stderr | 27 -------- tests/ui/issues/issue-87490.rs | 10 --- tests/ui/issues/issue-87490.stderr | 14 ---- tests/ui/issues/issue-8761.rs | 10 --- tests/ui/issues/issue-8761.stderr | 27 -------- tests/ui/issues/issue-8767.rs | 5 -- tests/ui/issues/issue-8767.stderr | 9 --- tests/ui/issues/issue-87707.rs | 17 ----- tests/ui/issues/issue-87707.run.stderr | 7 -- tests/ui/issues/issue-8783.rs | 21 ------ tests/ui/issues/issue-8860.rs | 51 -------------- tests/ui/issues/issue-9123.rs | 7 -- .../iterator-scope-collect-suggestion-81584.fixed | 9 +++ .../iterator-scope-collect-suggestion-81584.rs | 9 +++ .../iterator-scope-collect-suggestion-81584.stderr | 14 ++++ .../ui/macros/macro-invocation-span-error-7970.rs | 11 ++++ .../macros/macro-invocation-span-error-7970.stderr | 17 +++++ tests/ui/macros/macro-path-type-bounds-8521.rs | 26 ++++++++ tests/ui/macros/macro-self-mutability-7911.rs | 38 +++++++++++ tests/ui/macros/macro-self-mutability-7911.stderr | 12 ++++ .../mismatched-types-in-match-pattern-7867.rs | 17 +++++ .../mismatched-types-in-match-pattern-7867.stderr | 17 +++++ .../methods/trait-method-self-param-error-7575.rs | 18 +++++ .../trait-method-self-param-error-7575.stderr | 10 +++ tests/ui/mir/mir-cfg-unpretty-check-81918.rs | 12 ++++ ...smatched-types-in-trait-implementation-87490.rs | 11 ++++ ...ched-types-in-trait-implementation-87490.stderr | 14 ++++ tests/ui/pattern/match-with-at-binding-8391.rs | 10 +++ .../ref-in-function-parameter-patterns-8860.rs | 52 +++++++++++++++ ...naccessible-fields-pattern-matching-76077.fixed | 19 ++++++ .../inaccessible-fields-pattern-matching-76077.rs | 19 ++++++ ...accessible-fields-pattern-matching-76077.stderr | 24 +++++++ .../private-field-struct-construction-76077.rs | 11 ++++ .../private-field-struct-construction-76077.stderr | 10 +++ .../infinite-function-recursion-error-8727.rs | 16 +++++ .../infinite-function-recursion-error-8727.stderr | 27 ++++++++ tests/ui/resolve/module-import-resolution-7663.rs | 33 ++++++++++ tests/ui/static/static-struct-with-option-8578.rs | 20 ++++++ tests/ui/structs-enums/auxiliary/aux-8044.rs | 15 +++++ .../ui/structs-enums/struct-and-enum-usage-8044.rs | 10 +++ .../destructuring-struct-type-inference-8783.rs | 22 +++++++ .../thir-print/break-outside-loop-error-83048.rs | 6 ++ .../break-outside-loop-error-83048.stderr | 9 +++ .../track-caller-for-once-87707.rs | 18 +++++ .../track-caller-for-once-87707.run.stderr | 7 ++ .../relaxed-bounds-assumed-unsized-87199.rs | 22 +++++++ .../relaxed-bounds-assumed-unsized-87199.stderr | 46 +++++++++++++ tests/ui/traits/auxiliary/aux-9123.rs | 9 +++ tests/ui/traits/default-method-fn-call-9123.rs | 7 ++ tests/ui/traits/mut-trait-in-struct-8249.rs | 20 ++++++ tests/ui/traits/polymorphic-trait-creation-7673.rs | 20 ++++++ ...elf-implements-kinds-in-default-methods-8171.rs | 19 ++++++ .../traits/trait-implementation-and-usage-7563.rs | 29 ++++++++ .../typeck/impl-for-nonexistent-type-error-8767.rs | 6 ++ .../impl-for-nonexistent-type-error-8767.stderr | 9 +++ 155 files changed, 1377 insertions(+), 1361 deletions(-) create mode 100644 tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs create mode 100644 tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs create mode 100644 tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs create mode 100644 tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr create mode 100644 tests/ui/attributes/invalid-attributes-on-const-params-78957.rs create mode 100644 tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr create mode 100644 tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed create mode 100644 tests/ui/binding/invalid-assignment-in-while-loop-77218.rs create mode 100644 tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr create mode 100644 tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs create mode 100644 tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs create mode 100644 tests/ui/codegen/i128-shift-overflow-check-76042.rs create mode 100644 tests/ui/coercion/mut-trait-coercion-8248.rs create mode 100644 tests/ui/coercion/mut-trait-coercion-8248.stderr create mode 100644 tests/ui/coercion/mut-trait-object-coercion-8398.rs create mode 100644 tests/ui/consts/const-range-matching-76191.rs create mode 100644 tests/ui/consts/const-range-matching-76191.stderr create mode 100644 tests/ui/cross-crate/auxiliary/aux-7899.rs create mode 100644 tests/ui/cross-crate/auxiliary/aux-8259.rs create mode 100644 tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs create mode 100644 tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs create mode 100644 tests/ui/dyn-keyword/auxiliary/aux-8401.rs create mode 100644 tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs create mode 100644 tests/ui/enum/enum-discriminant-type-mismatch-8761.rs create mode 100644 tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr create mode 100644 tests/ui/enum/enum-variant-field-error-80607.rs create mode 100644 tests/ui/enum/enum-variant-field-error-80607.stderr create mode 100644 tests/ui/enum/simple-enum-usage-8506.rs create mode 100644 tests/ui/extern/function-definition-in-extern-block-75283.rs create mode 100644 tests/ui/extern/function-definition-in-extern-block-75283.stderr create mode 100644 tests/ui/generics/duplicate-generic-parameter-error-86756.rs create mode 100644 tests/ui/generics/duplicate-generic-parameter-error-86756.stderr create mode 100644 tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs delete mode 100644 tests/ui/issues/auxiliary/issue-7899.rs delete mode 100644 tests/ui/issues/auxiliary/issue-8044.rs delete mode 100644 tests/ui/issues/auxiliary/issue-8259.rs delete mode 100644 tests/ui/issues/auxiliary/issue-8401.rs delete mode 100644 tests/ui/issues/auxiliary/issue-9123.rs delete mode 100644 tests/ui/issues/issue-75283.rs delete mode 100644 tests/ui/issues/issue-75283.stderr delete mode 100644 tests/ui/issues/issue-7563.rs delete mode 100644 tests/ui/issues/issue-7575.rs delete mode 100644 tests/ui/issues/issue-7575.stderr delete mode 100644 tests/ui/issues/issue-76042.rs delete mode 100644 tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed delete mode 100644 tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs delete mode 100644 tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr delete mode 100644 tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs delete mode 100644 tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr delete mode 100644 tests/ui/issues/issue-76191.rs delete mode 100644 tests/ui/issues/issue-76191.stderr delete mode 100644 tests/ui/issues/issue-7660.rs delete mode 100644 tests/ui/issues/issue-7663.rs delete mode 100644 tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs delete mode 100644 tests/ui/issues/issue-77218/issue-77218-2.fixed delete mode 100644 tests/ui/issues/issue-77218/issue-77218-2.rs delete mode 100644 tests/ui/issues/issue-77218/issue-77218-2.stderr delete mode 100644 tests/ui/issues/issue-77218/issue-77218.fixed delete mode 100644 tests/ui/issues/issue-77218/issue-77218.rs delete mode 100644 tests/ui/issues/issue-77218/issue-77218.stderr delete mode 100644 tests/ui/issues/issue-7784.rs delete mode 100644 tests/ui/issues/issue-78192.rs delete mode 100644 tests/ui/issues/issue-78622.rs delete mode 100644 tests/ui/issues/issue-78622.stderr delete mode 100644 tests/ui/issues/issue-7867.rs delete mode 100644 tests/ui/issues/issue-7867.stderr delete mode 100644 tests/ui/issues/issue-78957.rs delete mode 100644 tests/ui/issues/issue-78957.stderr delete mode 100644 tests/ui/issues/issue-7899.rs delete mode 100644 tests/ui/issues/issue-7911.rs delete mode 100644 tests/ui/issues/issue-7911.stderr delete mode 100644 tests/ui/issues/issue-7970a.rs delete mode 100644 tests/ui/issues/issue-7970a.stderr delete mode 100644 tests/ui/issues/issue-8044.rs delete mode 100644 tests/ui/issues/issue-80607.rs delete mode 100644 tests/ui/issues/issue-80607.stderr delete mode 100644 tests/ui/issues/issue-81584.fixed delete mode 100644 tests/ui/issues/issue-81584.rs delete mode 100644 tests/ui/issues/issue-81584.stderr delete mode 100644 tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs delete mode 100644 tests/ui/issues/issue-81918.rs delete mode 100644 tests/ui/issues/issue-8248.rs delete mode 100644 tests/ui/issues/issue-8248.stderr delete mode 100644 tests/ui/issues/issue-8249.rs delete mode 100644 tests/ui/issues/issue-8259.rs delete mode 100644 tests/ui/issues/issue-83048.rs delete mode 100644 tests/ui/issues/issue-83048.stderr delete mode 100644 tests/ui/issues/issue-8391.rs delete mode 100644 tests/ui/issues/issue-8398.rs delete mode 100644 tests/ui/issues/issue-8401.rs delete mode 100644 tests/ui/issues/issue-8498.rs delete mode 100644 tests/ui/issues/issue-8506.rs delete mode 100644 tests/ui/issues/issue-8521.rs delete mode 100644 tests/ui/issues/issue-85461.rs delete mode 100644 tests/ui/issues/issue-8578.rs delete mode 100644 tests/ui/issues/issue-86756.rs delete mode 100644 tests/ui/issues/issue-86756.stderr delete mode 100644 tests/ui/issues/issue-87199.rs delete mode 100644 tests/ui/issues/issue-87199.stderr delete mode 100644 tests/ui/issues/issue-8727.rs delete mode 100644 tests/ui/issues/issue-8727.stderr delete mode 100644 tests/ui/issues/issue-87490.rs delete mode 100644 tests/ui/issues/issue-87490.stderr delete mode 100644 tests/ui/issues/issue-8761.rs delete mode 100644 tests/ui/issues/issue-8761.stderr delete mode 100644 tests/ui/issues/issue-8767.rs delete mode 100644 tests/ui/issues/issue-8767.stderr delete mode 100644 tests/ui/issues/issue-87707.rs delete mode 100644 tests/ui/issues/issue-87707.run.stderr delete mode 100644 tests/ui/issues/issue-8783.rs delete mode 100644 tests/ui/issues/issue-8860.rs delete mode 100644 tests/ui/issues/issue-9123.rs create mode 100644 tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed create mode 100644 tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs create mode 100644 tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr create mode 100644 tests/ui/macros/macro-invocation-span-error-7970.rs create mode 100644 tests/ui/macros/macro-invocation-span-error-7970.stderr create mode 100644 tests/ui/macros/macro-path-type-bounds-8521.rs create mode 100644 tests/ui/macros/macro-self-mutability-7911.rs create mode 100644 tests/ui/macros/macro-self-mutability-7911.stderr create mode 100644 tests/ui/match/mismatched-types-in-match-pattern-7867.rs create mode 100644 tests/ui/match/mismatched-types-in-match-pattern-7867.stderr create mode 100644 tests/ui/methods/trait-method-self-param-error-7575.rs create mode 100644 tests/ui/methods/trait-method-self-param-error-7575.stderr create mode 100644 tests/ui/mir/mir-cfg-unpretty-check-81918.rs create mode 100644 tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs create mode 100644 tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr create mode 100644 tests/ui/pattern/match-with-at-binding-8391.rs create mode 100644 tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs create mode 100644 tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed create mode 100644 tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs create mode 100644 tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr create mode 100644 tests/ui/privacy/private-field-struct-construction-76077.rs create mode 100644 tests/ui/privacy/private-field-struct-construction-76077.stderr create mode 100644 tests/ui/recursion/infinite-function-recursion-error-8727.rs create mode 100644 tests/ui/recursion/infinite-function-recursion-error-8727.stderr create mode 100644 tests/ui/resolve/module-import-resolution-7663.rs create mode 100644 tests/ui/static/static-struct-with-option-8578.rs create mode 100644 tests/ui/structs-enums/auxiliary/aux-8044.rs create mode 100644 tests/ui/structs-enums/struct-and-enum-usage-8044.rs create mode 100644 tests/ui/structs/destructuring-struct-type-inference-8783.rs create mode 100644 tests/ui/thir-print/break-outside-loop-error-83048.rs create mode 100644 tests/ui/thir-print/break-outside-loop-error-83048.stderr create mode 100644 tests/ui/track-diagnostics/track-caller-for-once-87707.rs create mode 100644 tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr create mode 100644 tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs create mode 100644 tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr create mode 100644 tests/ui/traits/auxiliary/aux-9123.rs create mode 100644 tests/ui/traits/default-method-fn-call-9123.rs create mode 100644 tests/ui/traits/mut-trait-in-struct-8249.rs create mode 100644 tests/ui/traits/polymorphic-trait-creation-7673.rs create mode 100644 tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs create mode 100644 tests/ui/traits/trait-implementation-and-usage-7563.rs create mode 100644 tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs create mode 100644 tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr (limited to 'tests') diff --git a/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs b/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs new file mode 100644 index 00000000000..e243a247ed5 --- /dev/null +++ b/tests/ui/array-slice-vec/matching-on-vector-slice-option-8498.rs @@ -0,0 +1,28 @@ +// https://github.com/rust-lang/rust/issues/8498 +//@ run-pass + +pub fn main() { + match &[(Box::new(5),Box::new(7))] { + ps => { + let (ref y, _) = ps[0]; + assert_eq!(**y, 5); + } + } + + match Some(&[(Box::new(5),)]) { + Some(ps) => { + let (ref y,) = ps[0]; + assert_eq!(**y, 5); + } + None => () + } + + match Some(&[(Box::new(5),Box::new(7))]) { + Some(ps) => { + let (ref y, ref z) = ps[0]; + assert_eq!(**y, 5); + assert_eq!(**z, 7); + } + None => () + } +} diff --git a/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs b/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs new file mode 100644 index 00000000000..7d987e92b63 --- /dev/null +++ b/tests/ui/array-slice-vec/pattern-matching-fixed-length-vectors-7784.rs @@ -0,0 +1,31 @@ +// https://github.com/rust-lang/rust/issues/7784 +//@ run-pass + +use std::ops::Add; + +fn foo + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { + (x.clone(), x.clone() + y.clone(), x + y + z) +} +fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { + [a, b, b, a] +} + +fn main() { + assert_eq!(foo([1, 2, 3]), (1, 3, 6)); + + let [a, b, c, d] = bar("foo", "bar"); + assert_eq!(a, "foo"); + assert_eq!(b, "bar"); + assert_eq!(c, "bar"); + assert_eq!(d, "foo"); + + let [a, _, _, d] = bar("baz", "foo"); + assert_eq!(a, "baz"); + assert_eq!(d, "baz"); + + let out = bar("baz", "foo"); + let [a, xs @ .., d] = out; + assert_eq!(a, "baz"); + assert_eq!(xs, ["foo", "foo"]); + assert_eq!(d, "baz"); +} diff --git a/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs new file mode 100644 index 00000000000..9763be1ecb2 --- /dev/null +++ b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.rs @@ -0,0 +1,8 @@ +// https://github.com/rust-lang/rust/issues/78622 +#![crate_type = "lib"] + +struct S; +fn f() { + S::A:: {} + //~^ ERROR ambiguous associated type +} diff --git a/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr new file mode 100644 index 00000000000..4dff1364af7 --- /dev/null +++ b/tests/ui/associated-consts/ambiguous-associated-type-error-78622.stderr @@ -0,0 +1,15 @@ +error[E0223]: ambiguous associated type + --> $DIR/ambiguous-associated-type-error-78622.rs:6:5 + | +LL | S::A:: {} + | ^^^^ + | +help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path + | +LL - S::A:: {} +LL + ::A:: {} + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs b/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs new file mode 100644 index 00000000000..106b9ae2690 --- /dev/null +++ b/tests/ui/attributes/invalid-attributes-on-const-params-78957.rs @@ -0,0 +1,30 @@ +// https://github.com/rust-lang/rust/issues/78957 +#![deny(unused_attributes)] + +use std::marker::PhantomData; + +pub struct Foo<#[inline] const N: usize>; +//~^ ERROR attribute cannot be used on +pub struct Bar<#[cold] const N: usize>; +//~^ ERROR attribute cannot be used on +//~| WARN previously accepted +pub struct Baz<#[repr(C)] const N: usize>; +//~^ ERROR attribute should be applied to a struct, enum, or union +// +pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); +//~^ ERROR attribute cannot be used on +pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); +//~^ ERROR attribute cannot be used on +//~| WARN previously accepted +pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); +//~^ ERROR attribute should be applied to a struct, enum, or union +// +pub struct Foo3<#[inline] T>(PhantomData); +//~^ ERROR attribute cannot be used on +pub struct Bar3<#[cold] T>(PhantomData); +//~^ ERROR attribute cannot be used on +//~| WARN previously accepted +pub struct Baz3<#[repr(C)] T>(PhantomData); +//~^ ERROR attribute should be applied to a struct, enum, or union + +fn main() {} diff --git a/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr b/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr new file mode 100644 index 00000000000..f8010b4ea68 --- /dev/null +++ b/tests/ui/attributes/invalid-attributes-on-const-params-78957.stderr @@ -0,0 +1,77 @@ +error: `#[inline]` attribute cannot be used on function params + --> $DIR/invalid-attributes-on-const-params-78957.rs:6:16 + | +LL | pub struct Foo<#[inline] const N: usize>; + | ^^^^^^^^^ + | + = help: `#[inline]` can only be applied to functions + +error: `#[inline]` attribute cannot be used on function params + --> $DIR/invalid-attributes-on-const-params-78957.rs:14:17 + | +LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); + | ^^^^^^^^^ + | + = help: `#[inline]` can only be applied to functions + +error: `#[inline]` attribute cannot be used on function params + --> $DIR/invalid-attributes-on-const-params-78957.rs:22:17 + | +LL | pub struct Foo3<#[inline] T>(PhantomData); + | ^^^^^^^^^ + | + = help: `#[inline]` can only be applied to functions + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/invalid-attributes-on-const-params-78957.rs:11:23 + | +LL | pub struct Baz<#[repr(C)] const N: usize>; + | ^ -------------- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/invalid-attributes-on-const-params-78957.rs:19:24 + | +LL | pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); + | ^ -- not a struct, enum, or union + +error[E0517]: attribute should be applied to a struct, enum, or union + --> $DIR/invalid-attributes-on-const-params-78957.rs:27:24 + | +LL | pub struct Baz3<#[repr(C)] T>(PhantomData); + | ^ - not a struct, enum, or union + +error: `#[cold]` attribute cannot be used on function params + --> $DIR/invalid-attributes-on-const-params-78957.rs:8:16 + | +LL | pub struct Bar<#[cold] const N: usize>; + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[cold]` can only be applied to functions +note: the lint level is defined here + --> $DIR/invalid-attributes-on-const-params-78957.rs:2:9 + | +LL | #![deny(unused_attributes)] + | ^^^^^^^^^^^^^^^^^ + +error: `#[cold]` attribute cannot be used on function params + --> $DIR/invalid-attributes-on-const-params-78957.rs:16:17 + | +LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[cold]` can only be applied to functions + +error: `#[cold]` attribute cannot be used on function params + --> $DIR/invalid-attributes-on-const-params-78957.rs:24:17 + | +LL | pub struct Bar3<#[cold] T>(PhantomData); + | ^^^^^^^ + | + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = help: `#[cold]` can only be applied to functions + +error: aborting due to 9 previous errors + +For more information about this error, try `rustc --explain E0517`. diff --git a/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed b/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed new file mode 100644 index 00000000000..aa662ead21a --- /dev/null +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.fixed @@ -0,0 +1,6 @@ +// https://github.com/rust-lang/rust/issues/77218 +//@ run-rustfix +fn main() { + let value = [7u8]; + while let Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment +} diff --git a/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs b/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs new file mode 100644 index 00000000000..9f249180e83 --- /dev/null +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.rs @@ -0,0 +1,6 @@ +// https://github.com/rust-lang/rust/issues/77218 +//@ run-rustfix +fn main() { + let value = [7u8]; + while Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment +} diff --git a/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr b/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr new file mode 100644 index 00000000000..e6baf349d28 --- /dev/null +++ b/tests/ui/binding/invalid-assignment-in-while-loop-77218.stderr @@ -0,0 +1,16 @@ +error[E0070]: invalid left-hand side of assignment + --> $DIR/invalid-assignment-in-while-loop-77218.rs:5:19 + | +LL | while Some(0) = value.get(0) {} + | - ^ + | | + | cannot assign to this expression + | +help: you might have meant to use pattern destructuring + | +LL | while let Some(0) = value.get(0) {} + | +++ + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs b/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs new file mode 100644 index 00000000000..99a1d37eb4d --- /dev/null +++ b/tests/ui/borrowck/incorrect-use-after-storage-end-78192.rs @@ -0,0 +1,18 @@ +// https://github.com/rust-lang/rust/issues/78192 +//@ run-pass + +#![allow(unused_assignments)] + +fn main() { + let a = 1u32; + let b = 2u32; + + let mut c: *const u32 = &a; + let d: &u32 = &b; + + let x = unsafe { &*c }; + c = d; + let z = *x; + + assert_eq!(1, z); +} diff --git a/tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs b/tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs new file mode 100644 index 00000000000..90526de14e7 --- /dev/null +++ b/tests/ui/borrowck/rvalue-lifetime-match-equivalence-7660.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/7660 +//@ run-pass +#![allow(unused_variables)] +// Regression test for issue 7660 +// rvalue lifetime too short when equivalent `match` works + +use std::collections::HashMap; + +struct A(isize, isize); + +pub fn main() { + let mut m: HashMap = HashMap::new(); + m.insert(1, A(0, 0)); + + let A(ref _a, ref _b) = m[&1]; + let (a, b) = match m[&1] { A(ref _a, ref _b) => (_a, _b) }; +} diff --git a/tests/ui/codegen/i128-shift-overflow-check-76042.rs b/tests/ui/codegen/i128-shift-overflow-check-76042.rs new file mode 100644 index 00000000000..7ae0806216c --- /dev/null +++ b/tests/ui/codegen/i128-shift-overflow-check-76042.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/76042 +//@ run-pass +//@ compile-flags: -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=0 + +fn foo(a: i128, b: i128, s: u32) -> (i128, i128) { + if s == 128 { + (0, 0) + } else { + (b >> s, a >> s) + } +} +fn main() { + let r = foo(0, 8, 1); + if r.0 != 4 { + panic!(); + } +} diff --git a/tests/ui/coercion/mut-trait-coercion-8248.rs b/tests/ui/coercion/mut-trait-coercion-8248.rs new file mode 100644 index 00000000000..a45a4d94315 --- /dev/null +++ b/tests/ui/coercion/mut-trait-coercion-8248.rs @@ -0,0 +1,15 @@ +// https://github.com/rust-lang/rust/issues/8248 +//@ run-pass + +trait A { + fn dummy(&self) { } //~ WARN method `dummy` is never used +} +struct B; +impl A for B {} + +fn foo(_: &mut dyn A) {} + +pub fn main() { + let mut b = B; + foo(&mut b as &mut dyn A); +} diff --git a/tests/ui/coercion/mut-trait-coercion-8248.stderr b/tests/ui/coercion/mut-trait-coercion-8248.stderr new file mode 100644 index 00000000000..2f79a9ba1c8 --- /dev/null +++ b/tests/ui/coercion/mut-trait-coercion-8248.stderr @@ -0,0 +1,12 @@ +warning: method `dummy` is never used + --> $DIR/mut-trait-coercion-8248.rs:5:8 + | +LL | trait A { + | - method in this trait +LL | fn dummy(&self) { } + | ^^^^^ + | + = note: `#[warn(dead_code)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/coercion/mut-trait-object-coercion-8398.rs b/tests/ui/coercion/mut-trait-object-coercion-8398.rs new file mode 100644 index 00000000000..d87d27582ba --- /dev/null +++ b/tests/ui/coercion/mut-trait-object-coercion-8398.rs @@ -0,0 +1,13 @@ +// https://github.com/rust-lang/rust/issues/8398 +//@ check-pass +#![allow(dead_code)] + +pub trait Writer { + fn write(&mut self, b: &[u8]) -> Result<(), ()>; +} + +fn foo(a: &mut dyn Writer) { + a.write(&[]).unwrap(); +} + +pub fn main(){} diff --git a/tests/ui/consts/const-range-matching-76191.rs b/tests/ui/consts/const-range-matching-76191.rs new file mode 100644 index 00000000000..b579a4b3258 --- /dev/null +++ b/tests/ui/consts/const-range-matching-76191.rs @@ -0,0 +1,21 @@ +// https://github.com/rust-lang/rust/issues/76191 +// Regression test for diagnostic issue #76191 +#![allow(non_snake_case)] + +use std::ops::RangeInclusive; + +const RANGE: RangeInclusive = 0..=255; + +const RANGE2: RangeInclusive = panic!(); +//~^ ERROR evaluation panicked: explicit panic + +fn main() { + let n: i32 = 1; + match n { + RANGE => {} + //~^ ERROR mismatched types + RANGE2 => {} + //~^ ERROR mismatched types + _ => {} + } +} diff --git a/tests/ui/consts/const-range-matching-76191.stderr b/tests/ui/consts/const-range-matching-76191.stderr new file mode 100644 index 00000000000..5c358d0fa1c --- /dev/null +++ b/tests/ui/consts/const-range-matching-76191.stderr @@ -0,0 +1,51 @@ +error[E0080]: evaluation panicked: explicit panic + --> $DIR/const-range-matching-76191.rs:9:37 + | +LL | const RANGE2: RangeInclusive = panic!(); + | ^^^^^^^^ evaluation of `RANGE2` failed here + +error[E0308]: mismatched types + --> $DIR/const-range-matching-76191.rs:15:9 + | +LL | const RANGE: RangeInclusive = 0..=255; + | -------------------------------- constant defined here +... +LL | match n { + | - this expression has type `i32` +LL | RANGE => {} + | ^^^^^ + | | + | expected `i32`, found `RangeInclusive` + | `RANGE` is interpreted as a constant, not a new binding + | + = note: expected type `i32` + found struct `std::ops::RangeInclusive` +help: you may want to move the range into the match block + | +LL - RANGE => {} +LL + 0..=255 => {} + | + +error[E0308]: mismatched types + --> $DIR/const-range-matching-76191.rs:17:9 + | +LL | const RANGE2: RangeInclusive = panic!(); + | --------------------------------- constant defined here +... +LL | match n { + | - this expression has type `i32` +... +LL | RANGE2 => {} + | ^^^^^^ + | | + | expected `i32`, found `RangeInclusive` + | `RANGE2` is interpreted as a constant, not a new binding + | + = note: expected type `i32` + found struct `std::ops::RangeInclusive` + = note: constants only support matching by type, if you meant to match against a range of values, consider using a range pattern like `min ..= max` in the match block + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0080, E0308. +For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/cross-crate/auxiliary/aux-7899.rs b/tests/ui/cross-crate/auxiliary/aux-7899.rs new file mode 100644 index 00000000000..3af6e871661 --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/aux-7899.rs @@ -0,0 +1 @@ +pub struct V2(pub T, pub T); diff --git a/tests/ui/cross-crate/auxiliary/aux-8259.rs b/tests/ui/cross-crate/auxiliary/aux-8259.rs new file mode 100644 index 00000000000..891aee099dc --- /dev/null +++ b/tests/ui/cross-crate/auxiliary/aux-8259.rs @@ -0,0 +1,4 @@ +pub enum Foo<'a> { + A, + B(&'a str), +} diff --git a/tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs b/tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs new file mode 100644 index 00000000000..347cfa2aee1 --- /dev/null +++ b/tests/ui/cross-crate/static-regions-in-cross-crate-8259.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/8259 +//@ run-pass +#![allow(dead_code)] +#![allow(non_upper_case_globals)] + +//@ aux-build:aux-8259.rs + +extern crate aux_8259 as other; +static a: other::Foo<'static> = other::Foo::A; + +pub fn main() {} diff --git a/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs new file mode 100644 index 00000000000..ce3ea7dd579 --- /dev/null +++ b/tests/ui/cross-crate/tuple-like-structs-cross-crate-7899.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/7899 +//@ run-pass +#![allow(unused_variables)] +//@ aux-build:aux-7899.rs + +extern crate aux_7899 as testcrate; + +fn main() { + let f = testcrate::V2(1.0f32, 2.0f32); +} diff --git a/tests/ui/dyn-keyword/auxiliary/aux-8401.rs b/tests/ui/dyn-keyword/auxiliary/aux-8401.rs new file mode 100644 index 00000000000..7d0eb5cd876 --- /dev/null +++ b/tests/ui/dyn-keyword/auxiliary/aux-8401.rs @@ -0,0 +1,16 @@ +// for this issue, this code must be built in a library + +use std::mem; + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +fn bar(_: &mut dyn A, _: &T) {} + +fn foo(t: &T) { + let mut b = B; + bar(&mut b as &mut dyn A, t) +} diff --git a/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs b/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs new file mode 100644 index 00000000000..313c6891720 --- /dev/null +++ b/tests/ui/dyn-keyword/methods-with-mut-trait-and-polymorphic-objects-issue-8401.rs @@ -0,0 +1,7 @@ +//@ run-pass +//@ aux-build:aux-8401.rs +// https://github.com/rust-lang/rust/issues/8401 + +extern crate aux_8401; + +pub fn main() {} diff --git a/tests/ui/enum/enum-discriminant-type-mismatch-8761.rs b/tests/ui/enum/enum-discriminant-type-mismatch-8761.rs new file mode 100644 index 00000000000..ae09b919dc1 --- /dev/null +++ b/tests/ui/enum/enum-discriminant-type-mismatch-8761.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/8761 +enum Foo { + A = 1i64, + //~^ ERROR mismatched types + //~| NOTE expected `isize`, found `i64` + B = 2u8 + //~^ ERROR mismatched types + //~| NOTE expected `isize`, found `u8` +} + +fn main() {} diff --git a/tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr b/tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr new file mode 100644 index 00000000000..f1645183e17 --- /dev/null +++ b/tests/ui/enum/enum-discriminant-type-mismatch-8761.stderr @@ -0,0 +1,27 @@ +error[E0308]: mismatched types + --> $DIR/enum-discriminant-type-mismatch-8761.rs:3:9 + | +LL | A = 1i64, + | ^^^^ expected `isize`, found `i64` + | +help: change the type of the numeric literal from `i64` to `isize` + | +LL - A = 1i64, +LL + A = 1isize, + | + +error[E0308]: mismatched types + --> $DIR/enum-discriminant-type-mismatch-8761.rs:6:9 + | +LL | B = 2u8 + | ^^^ expected `isize`, found `u8` + | +help: change the type of the numeric literal from `u8` to `isize` + | +LL - B = 2u8 +LL + B = 2isize + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/enum/enum-variant-field-error-80607.rs b/tests/ui/enum/enum-variant-field-error-80607.rs new file mode 100644 index 00000000000..aa3f2f7c526 --- /dev/null +++ b/tests/ui/enum/enum-variant-field-error-80607.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/80607 +// This tests makes sure the diagnostics print the offending enum variant, not just the type. +pub enum Enum { + V1(i32), +} + +pub fn foo(x: i32) -> Enum { + Enum::V1 { x } //~ ERROR `Enum::V1` has no field named `x` +} + +fn main() {} diff --git a/tests/ui/enum/enum-variant-field-error-80607.stderr b/tests/ui/enum/enum-variant-field-error-80607.stderr new file mode 100644 index 00000000000..8d088ef04bb --- /dev/null +++ b/tests/ui/enum/enum-variant-field-error-80607.stderr @@ -0,0 +1,18 @@ +error[E0559]: variant `Enum::V1` has no field named `x` + --> $DIR/enum-variant-field-error-80607.rs:8:16 + | +LL | V1(i32), + | -- `Enum::V1` defined here +... +LL | Enum::V1 { x } + | ^ field does not exist + | +help: `Enum::V1` is a tuple variant, use the appropriate syntax + | +LL - Enum::V1 { x } +LL + Enum::V1(/* i32 */) + | + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0559`. diff --git a/tests/ui/enum/simple-enum-usage-8506.rs b/tests/ui/enum/simple-enum-usage-8506.rs new file mode 100644 index 00000000000..ebe095d84e4 --- /dev/null +++ b/tests/ui/enum/simple-enum-usage-8506.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/8506 +//@ run-pass +#![allow(non_upper_case_globals)] + +#![allow(dead_code)] + +enum Either { + One, + Other(String,String) +} + +static one : Either = Either::One; + +pub fn main () { } diff --git a/tests/ui/extern/function-definition-in-extern-block-75283.rs b/tests/ui/extern/function-definition-in-extern-block-75283.rs new file mode 100644 index 00000000000..e2b7358743b --- /dev/null +++ b/tests/ui/extern/function-definition-in-extern-block-75283.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/75283 +extern "C" { + fn lol() { //~ ERROR incorrect function inside `extern` block + println!(""); + } +} +fn main() {} diff --git a/tests/ui/extern/function-definition-in-extern-block-75283.stderr b/tests/ui/extern/function-definition-in-extern-block-75283.stderr new file mode 100644 index 00000000000..67be1c29599 --- /dev/null +++ b/tests/ui/extern/function-definition-in-extern-block-75283.stderr @@ -0,0 +1,18 @@ +error: incorrect function inside `extern` block + --> $DIR/function-definition-in-extern-block-75283.rs:3:8 + | +LL | extern "C" { + | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body +LL | fn lol() { + | ________^^^___- + | | | + | | cannot have a body +LL | | println!(""); +LL | | } + | |_____- help: remove the invalid body: `;` + | + = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block + = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html + +error: aborting due to 1 previous error + diff --git a/tests/ui/generics/duplicate-generic-parameter-error-86756.rs b/tests/ui/generics/duplicate-generic-parameter-error-86756.rs new file mode 100644 index 00000000000..acc281cb8c4 --- /dev/null +++ b/tests/ui/generics/duplicate-generic-parameter-error-86756.rs @@ -0,0 +1,14 @@ +// https://github.com/rust-lang/rust/issues/86756 +//@ edition: 2015 +trait Foo {} +//~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters + +fn eq() { + eq:: + //~^ ERROR cannot find type `dyn` in this scope + //~| ERROR missing generics for trait `Foo` + //~| WARN trait objects without an explicit `dyn` are deprecated + //~| WARN this is accepted in the current edition +} + +fn main() {} diff --git a/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr b/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr new file mode 100644 index 00000000000..d4b2169ffd2 --- /dev/null +++ b/tests/ui/generics/duplicate-generic-parameter-error-86756.stderr @@ -0,0 +1,48 @@ +error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters + --> $DIR/duplicate-generic-parameter-error-86756.rs:3:14 + | +LL | trait Foo {} + | - ^ already used + | | + | first use of `T` + +error[E0412]: cannot find type `dyn` in this scope + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:10 + | +LL | eq:: + | ^^^ not found in this scope + +warning: trait objects without an explicit `dyn` are deprecated + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:15 + | +LL | eq:: + | ^^^ + | + = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! + = note: for more information, see + = note: `#[warn(bare_trait_objects)]` on by default +help: if this is a dyn-compatible trait, use `dyn` + | +LL | eq:: + | +++ + +error[E0107]: missing generics for trait `Foo` + --> $DIR/duplicate-generic-parameter-error-86756.rs:7:15 + | +LL | eq:: + | ^^^ expected at least 1 generic argument + | +note: trait defined here, with at least 1 generic parameter: `T` + --> $DIR/duplicate-generic-parameter-error-86756.rs:3:7 + | +LL | trait Foo {} + | ^^^ - +help: add missing generic argument + | +LL | eq::> + | +++ + +error: aborting due to 3 previous errors; 1 warning emitted + +Some errors have detailed explanations: E0107, E0403, E0412. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs b/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs new file mode 100644 index 00000000000..ffb535e69ee --- /dev/null +++ b/tests/ui/instrument-coverage/link-regex-crate-with-instrument-coverage-85461.rs @@ -0,0 +1,29 @@ +// https://github.com/rust-lang/rust/issues/85461 +//@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 +//@ build-pass +//@ needs-profiler-runtime +//@ needs-dynamic-linking + +// Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries +// with dead code and #[inline(always)]. + +#![allow(dead_code)] + +mod foo { + #[inline(always)] + pub fn called() { } + + fn uncalled() { } +} + +pub mod bar { + pub fn call_me() { + super::foo::called(); + } +} + +pub mod baz { + pub fn call_me() { + super::foo::called(); + } +} diff --git a/tests/ui/issues/auxiliary/issue-7899.rs b/tests/ui/issues/auxiliary/issue-7899.rs deleted file mode 100644 index 3af6e871661..00000000000 --- a/tests/ui/issues/auxiliary/issue-7899.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct V2(pub T, pub T); diff --git a/tests/ui/issues/auxiliary/issue-8044.rs b/tests/ui/issues/auxiliary/issue-8044.rs deleted file mode 100644 index 2ec25f51cde..00000000000 --- a/tests/ui/issues/auxiliary/issue-8044.rs +++ /dev/null @@ -1,15 +0,0 @@ -pub struct BTree { - pub node: TreeItem, -} - -pub enum TreeItem { - TreeLeaf { value: V }, -} - -pub fn leaf(value: V) -> TreeItem { - TreeItem::TreeLeaf { value: value } -} - -fn main() { - BTree:: { node: leaf(1) }; -} diff --git a/tests/ui/issues/auxiliary/issue-8259.rs b/tests/ui/issues/auxiliary/issue-8259.rs deleted file mode 100644 index 891aee099dc..00000000000 --- a/tests/ui/issues/auxiliary/issue-8259.rs +++ /dev/null @@ -1,4 +0,0 @@ -pub enum Foo<'a> { - A, - B(&'a str), -} diff --git a/tests/ui/issues/auxiliary/issue-8401.rs b/tests/ui/issues/auxiliary/issue-8401.rs deleted file mode 100644 index 7d0eb5cd876..00000000000 --- a/tests/ui/issues/auxiliary/issue-8401.rs +++ /dev/null @@ -1,16 +0,0 @@ -// for this issue, this code must be built in a library - -use std::mem; - -trait A { - fn dummy(&self) { } -} -struct B; -impl A for B {} - -fn bar(_: &mut dyn A, _: &T) {} - -fn foo(t: &T) { - let mut b = B; - bar(&mut b as &mut dyn A, t) -} diff --git a/tests/ui/issues/auxiliary/issue-9123.rs b/tests/ui/issues/auxiliary/issue-9123.rs deleted file mode 100644 index 60af53359e8..00000000000 --- a/tests/ui/issues/auxiliary/issue-9123.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![crate_type = "lib"] - -pub trait X { - fn x() { - fn f() { } - f(); - } - fn dummy(&self) { } -} diff --git a/tests/ui/issues/issue-75283.rs b/tests/ui/issues/issue-75283.rs deleted file mode 100644 index d556132e47f..00000000000 --- a/tests/ui/issues/issue-75283.rs +++ /dev/null @@ -1,6 +0,0 @@ -extern "C" { - fn lol() { //~ ERROR incorrect function inside `extern` block - println!(""); - } -} -fn main() {} diff --git a/tests/ui/issues/issue-75283.stderr b/tests/ui/issues/issue-75283.stderr deleted file mode 100644 index 240d9716a55..00000000000 --- a/tests/ui/issues/issue-75283.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error: incorrect function inside `extern` block - --> $DIR/issue-75283.rs:2:8 - | -LL | extern "C" { - | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body -LL | fn lol() { - | ________^^^___- - | | | - | | cannot have a body -LL | | println!(""); -LL | | } - | |_____- help: remove the invalid body: `;` - | - = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block - = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-7563.rs b/tests/ui/issues/issue-7563.rs deleted file mode 100644 index 9ee8857b999..00000000000 --- a/tests/ui/issues/issue-7563.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ run-pass -#![allow(dead_code)] -trait IDummy { - fn do_nothing(&self); -} - -#[derive(Debug)] -struct A { a: isize } -#[derive(Debug)] -struct B<'a> { b: isize, pa: &'a A } - - impl IDummy for A { - fn do_nothing(&self) { - println!("A::do_nothing() is called"); - } - } - -impl<'a> B<'a> { - fn get_pa(&self) -> &'a dyn IDummy { self.pa as &'a dyn IDummy } -} - -pub fn main() { - let sa = A { a: 100 }; - let sb = B { b: 200, pa: &sa }; - - println!("sa is {:?}", sa); - println!("sb is {:?}", sb); -} diff --git a/tests/ui/issues/issue-7575.rs b/tests/ui/issues/issue-7575.rs deleted file mode 100644 index 8b1fdf6c851..00000000000 --- a/tests/ui/issues/issue-7575.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ run-pass - -trait Foo { //~ WARN trait `Foo` is never used - fn new() -> bool { false } - fn dummy(&self) { } -} - -trait Bar { - fn new(&self) -> bool { true } -} - -impl Bar for isize {} -impl Foo for isize {} - -fn main() { - assert!(1.new()); -} diff --git a/tests/ui/issues/issue-7575.stderr b/tests/ui/issues/issue-7575.stderr deleted file mode 100644 index 2f987d19c80..00000000000 --- a/tests/ui/issues/issue-7575.stderr +++ /dev/null @@ -1,10 +0,0 @@ -warning: trait `Foo` is never used - --> $DIR/issue-7575.rs:3:7 - | -LL | trait Foo { - | ^^^ - | - = note: `#[warn(dead_code)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/issues/issue-76042.rs b/tests/ui/issues/issue-76042.rs deleted file mode 100644 index 279e860459d..00000000000 --- a/tests/ui/issues/issue-76042.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ run-pass -//@ compile-flags: -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=0 - -fn foo(a: i128, b: i128, s: u32) -> (i128, i128) { - if s == 128 { - (0, 0) - } else { - (b >> s, a >> s) - } -} -fn main() { - let r = foo(0, 8, 1); - if r.0 != 4 { - panic!(); - } -} diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed deleted file mode 100644 index 6fde4e390fa..00000000000 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.fixed +++ /dev/null @@ -1,18 +0,0 @@ -//@ run-rustfix -#![allow(dead_code, unused_variables)] - -pub mod foo { - #[derive(Default)] - pub struct Foo { invisible: bool, } - - #[derive(Default)] - pub struct Bar { pub visible: bool, invisible: bool, } -} - -fn main() { - let foo::Foo { .. } = foo::Foo::default(); - //~^ ERROR pattern requires `..` due to inaccessible fields - - let foo::Bar { visible, .. } = foo::Bar::default(); - //~^ ERROR pattern requires `..` due to inaccessible fields -} diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs deleted file mode 100644 index 30a8535faf5..00000000000 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ run-rustfix -#![allow(dead_code, unused_variables)] - -pub mod foo { - #[derive(Default)] - pub struct Foo { invisible: bool, } - - #[derive(Default)] - pub struct Bar { pub visible: bool, invisible: bool, } -} - -fn main() { - let foo::Foo {} = foo::Foo::default(); - //~^ ERROR pattern requires `..` due to inaccessible fields - - let foo::Bar { visible } = foo::Bar::default(); - //~^ ERROR pattern requires `..` due to inaccessible fields -} diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr deleted file mode 100644 index f54990d5d86..00000000000 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077-1.stderr +++ /dev/null @@ -1,24 +0,0 @@ -error: pattern requires `..` due to inaccessible fields - --> $DIR/issue-76077-1.rs:13:9 - | -LL | let foo::Foo {} = foo::Foo::default(); - | ^^^^^^^^^^^ - | -help: ignore the inaccessible and unused fields - | -LL | let foo::Foo { .. } = foo::Foo::default(); - | ++ - -error: pattern requires `..` due to inaccessible fields - --> $DIR/issue-76077-1.rs:16:9 - | -LL | let foo::Bar { visible } = foo::Bar::default(); - | ^^^^^^^^^^^^^^^^^^^^ - | -help: ignore the inaccessible and unused fields - | -LL | let foo::Bar { visible, .. } = foo::Bar::default(); - | ++++ - -error: aborting due to 2 previous errors - diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs deleted file mode 100644 index 2d29093b01b..00000000000 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub mod foo { - pub struct Foo { - you_cant_use_this_field: bool, - } -} - -fn main() { - foo::Foo {}; - //~^ ERROR cannot construct `Foo` with struct literal syntax due to private fields -} diff --git a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr b/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr deleted file mode 100644 index 3fef5ffce30..00000000000 --- a/tests/ui/issues/issue-76077-inaccesible-private-fields/issue-76077.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: cannot construct `Foo` with struct literal syntax due to private fields - --> $DIR/issue-76077.rs:8:5 - | -LL | foo::Foo {}; - | ^^^^^^^^ - | - = note: private field `you_cant_use_this_field` that was not provided - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-76191.rs b/tests/ui/issues/issue-76191.rs deleted file mode 100644 index d2de44380c3..00000000000 --- a/tests/ui/issues/issue-76191.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Regression test for diagnostic issue #76191 -#![allow(non_snake_case)] - -use std::ops::RangeInclusive; - -const RANGE: RangeInclusive = 0..=255; - -const RANGE2: RangeInclusive = panic!(); -//~^ ERROR evaluation panicked: explicit panic - -fn main() { - let n: i32 = 1; - match n { - RANGE => {} - //~^ ERROR mismatched types - RANGE2 => {} - //~^ ERROR mismatched types - _ => {} - } -} diff --git a/tests/ui/issues/issue-76191.stderr b/tests/ui/issues/issue-76191.stderr deleted file mode 100644 index d8b54be88f4..00000000000 --- a/tests/ui/issues/issue-76191.stderr +++ /dev/null @@ -1,51 +0,0 @@ -error[E0080]: evaluation panicked: explicit panic - --> $DIR/issue-76191.rs:8:37 - | -LL | const RANGE2: RangeInclusive = panic!(); - | ^^^^^^^^ evaluation of `RANGE2` failed here - -error[E0308]: mismatched types - --> $DIR/issue-76191.rs:14:9 - | -LL | const RANGE: RangeInclusive = 0..=255; - | -------------------------------- constant defined here -... -LL | match n { - | - this expression has type `i32` -LL | RANGE => {} - | ^^^^^ - | | - | expected `i32`, found `RangeInclusive` - | `RANGE` is interpreted as a constant, not a new binding - | - = note: expected type `i32` - found struct `std::ops::RangeInclusive` -help: you may want to move the range into the match block - | -LL - RANGE => {} -LL + 0..=255 => {} - | - -error[E0308]: mismatched types - --> $DIR/issue-76191.rs:16:9 - | -LL | const RANGE2: RangeInclusive = panic!(); - | --------------------------------- constant defined here -... -LL | match n { - | - this expression has type `i32` -... -LL | RANGE2 => {} - | ^^^^^^ - | | - | expected `i32`, found `RangeInclusive` - | `RANGE2` is interpreted as a constant, not a new binding - | - = note: expected type `i32` - found struct `std::ops::RangeInclusive` - = note: constants only support matching by type, if you meant to match against a range of values, consider using a range pattern like `min ..= max` in the match block - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0080, E0308. -For more information about an error, try `rustc --explain E0080`. diff --git a/tests/ui/issues/issue-7660.rs b/tests/ui/issues/issue-7660.rs deleted file mode 100644 index 104cdad8f7b..00000000000 --- a/tests/ui/issues/issue-7660.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] -// Regression test for issue 7660 -// rvalue lifetime too short when equivalent `match` works - - -use std::collections::HashMap; - -struct A(isize, isize); - -pub fn main() { - let mut m: HashMap = HashMap::new(); - m.insert(1, A(0, 0)); - - let A(ref _a, ref _b) = m[&1]; - let (a, b) = match m[&1] { A(ref _a, ref _b) => (_a, _b) }; -} diff --git a/tests/ui/issues/issue-7663.rs b/tests/ui/issues/issue-7663.rs deleted file mode 100644 index d2b2c727cab..00000000000 --- a/tests/ui/issues/issue-7663.rs +++ /dev/null @@ -1,32 +0,0 @@ -//@ run-pass - -#![allow(unused_imports, dead_code)] - -mod test1 { - - mod foo { pub fn p() -> isize { 1 } } - mod bar { pub fn p() -> isize { 2 } } - - pub mod baz { - use crate::test1::bar::p; - - pub fn my_main() { assert_eq!(p(), 2); } - } -} - -mod test2 { - - mod foo { pub fn p() -> isize { 1 } } - mod bar { pub fn p() -> isize { 2 } } - - pub mod baz { - use crate::test2::bar::p; - - pub fn my_main() { assert_eq!(p(), 2); } - } -} - -fn main() { - test1::baz::my_main(); - test2::baz::my_main(); -} diff --git a/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs b/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs deleted file mode 100644 index edba3284e31..00000000000 --- a/tests/ui/issues/issue-7673-cast-generically-implemented-trait.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -/* - -#7673 Polymorphically creating traits barely works - -*/ - -pub fn main() {} - -trait A { - fn dummy(&self) { } -} - -impl A for T {} - -fn owned2(a: Box) { a as Box; } -fn owned3(a: Box) { Box::new(a) as Box; } diff --git a/tests/ui/issues/issue-77218/issue-77218-2.fixed b/tests/ui/issues/issue-77218/issue-77218-2.fixed deleted file mode 100644 index 98d79b5da65..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.fixed +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while let Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment - } -} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.rs b/tests/ui/issues/issue-77218/issue-77218-2.rs deleted file mode 100644 index 3be38f8f721..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.rs +++ /dev/null @@ -1,6 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while Some(0) = value.get(0) { //~ ERROR invalid left-hand side of assignment - } -} diff --git a/tests/ui/issues/issue-77218/issue-77218-2.stderr b/tests/ui/issues/issue-77218/issue-77218-2.stderr deleted file mode 100644 index dfed0b6e67e..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218-2.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-77218-2.rs:4:19 - | -LL | while Some(0) = value.get(0) { - | - ^ - | | - | cannot assign to this expression - | -help: you might have meant to use pattern destructuring - | -LL | while let Some(0) = value.get(0) { - | +++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/issues/issue-77218/issue-77218.fixed b/tests/ui/issues/issue-77218/issue-77218.fixed deleted file mode 100644 index 6ce9dd1c2c5..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218.fixed +++ /dev/null @@ -1,5 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while let Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment -} diff --git a/tests/ui/issues/issue-77218/issue-77218.rs b/tests/ui/issues/issue-77218/issue-77218.rs deleted file mode 100644 index 14edc065d0e..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ run-rustfix -fn main() { - let value = [7u8]; - while Some(0) = value.get(0) {} //~ ERROR invalid left-hand side of assignment -} diff --git a/tests/ui/issues/issue-77218/issue-77218.stderr b/tests/ui/issues/issue-77218/issue-77218.stderr deleted file mode 100644 index e98e69314d9..00000000000 --- a/tests/ui/issues/issue-77218/issue-77218.stderr +++ /dev/null @@ -1,16 +0,0 @@ -error[E0070]: invalid left-hand side of assignment - --> $DIR/issue-77218.rs:4:19 - | -LL | while Some(0) = value.get(0) {} - | - ^ - | | - | cannot assign to this expression - | -help: you might have meant to use pattern destructuring - | -LL | while let Some(0) = value.get(0) {} - | +++ - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0070`. diff --git a/tests/ui/issues/issue-7784.rs b/tests/ui/issues/issue-7784.rs deleted file mode 100644 index 90b88ae5727..00000000000 --- a/tests/ui/issues/issue-7784.rs +++ /dev/null @@ -1,30 +0,0 @@ -//@ run-pass - -use std::ops::Add; - -fn foo + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { - (x.clone(), x.clone() + y.clone(), x + y + z) -} -fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { - [a, b, b, a] -} - -fn main() { - assert_eq!(foo([1, 2, 3]), (1, 3, 6)); - - let [a, b, c, d] = bar("foo", "bar"); - assert_eq!(a, "foo"); - assert_eq!(b, "bar"); - assert_eq!(c, "bar"); - assert_eq!(d, "foo"); - - let [a, _, _, d] = bar("baz", "foo"); - assert_eq!(a, "baz"); - assert_eq!(d, "baz"); - - let out = bar("baz", "foo"); - let [a, xs @ .., d] = out; - assert_eq!(a, "baz"); - assert_eq!(xs, ["foo", "foo"]); - assert_eq!(d, "baz"); -} diff --git a/tests/ui/issues/issue-78192.rs b/tests/ui/issues/issue-78192.rs deleted file mode 100644 index bec2a82910c..00000000000 --- a/tests/ui/issues/issue-78192.rs +++ /dev/null @@ -1,17 +0,0 @@ -//@ run-pass - -#![allow(unused_assignments)] - -fn main() { - let a = 1u32; - let b = 2u32; - - let mut c: *const u32 = &a; - let d: &u32 = &b; - - let x = unsafe { &*c }; - c = d; - let z = *x; - - assert_eq!(1, z); -} diff --git a/tests/ui/issues/issue-78622.rs b/tests/ui/issues/issue-78622.rs deleted file mode 100644 index c00fd266063..00000000000 --- a/tests/ui/issues/issue-78622.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![crate_type = "lib"] - -struct S; -fn f() { - S::A:: {} - //~^ ERROR ambiguous associated type -} diff --git a/tests/ui/issues/issue-78622.stderr b/tests/ui/issues/issue-78622.stderr deleted file mode 100644 index 432913a0fc9..00000000000 --- a/tests/ui/issues/issue-78622.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0223]: ambiguous associated type - --> $DIR/issue-78622.rs:5:5 - | -LL | S::A:: {} - | ^^^^ - | -help: if there were a trait named `Example` with associated type `A` implemented for `S`, you could use the fully-qualified path - | -LL - S::A:: {} -LL + ::A:: {} - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0223`. diff --git a/tests/ui/issues/issue-7867.rs b/tests/ui/issues/issue-7867.rs deleted file mode 100644 index 87e7c831e68..00000000000 --- a/tests/ui/issues/issue-7867.rs +++ /dev/null @@ -1,16 +0,0 @@ -//@ dont-require-annotations: NOTE - -enum A { B, C } - -mod foo { pub fn bar() {} } - -fn main() { - match (true, false) { - A::B => (), - //~^ ERROR mismatched types - //~| NOTE expected `(bool, bool)`, found `A` - //~| NOTE expected tuple `(bool, bool)` - //~| NOTE found enum `A` - _ => () - } -} diff --git a/tests/ui/issues/issue-7867.stderr b/tests/ui/issues/issue-7867.stderr deleted file mode 100644 index fcb69d775fa..00000000000 --- a/tests/ui/issues/issue-7867.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-7867.rs:9:9 - | -LL | enum A { B, C } - | - unit variant defined here -... -LL | match (true, false) { - | ------------- this expression has type `(bool, bool)` -LL | A::B => (), - | ^^^^ expected `(bool, bool)`, found `A` - | - = note: expected tuple `(bool, bool)` - found enum `A` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-78957.rs b/tests/ui/issues/issue-78957.rs deleted file mode 100644 index 2ff92612e18..00000000000 --- a/tests/ui/issues/issue-78957.rs +++ /dev/null @@ -1,29 +0,0 @@ -#![deny(unused_attributes)] - -use std::marker::PhantomData; - -pub struct Foo<#[inline] const N: usize>; -//~^ ERROR attribute cannot be used on -pub struct Bar<#[cold] const N: usize>; -//~^ ERROR attribute cannot be used on -//~| WARN previously accepted -pub struct Baz<#[repr(C)] const N: usize>; -//~^ ERROR attribute should be applied to a struct, enum, or union -// -pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); -//~^ ERROR attribute cannot be used on -pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); -//~^ ERROR attribute cannot be used on -//~| WARN previously accepted -pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); -//~^ ERROR attribute should be applied to a struct, enum, or union -// -pub struct Foo3<#[inline] T>(PhantomData); -//~^ ERROR attribute cannot be used on -pub struct Bar3<#[cold] T>(PhantomData); -//~^ ERROR attribute cannot be used on -//~| WARN previously accepted -pub struct Baz3<#[repr(C)] T>(PhantomData); -//~^ ERROR attribute should be applied to a struct, enum, or union - -fn main() {} diff --git a/tests/ui/issues/issue-78957.stderr b/tests/ui/issues/issue-78957.stderr deleted file mode 100644 index d271b1840fb..00000000000 --- a/tests/ui/issues/issue-78957.stderr +++ /dev/null @@ -1,77 +0,0 @@ -error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:5:16 - | -LL | pub struct Foo<#[inline] const N: usize>; - | ^^^^^^^^^ - | - = help: `#[inline]` can only be applied to functions - -error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:13:17 - | -LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>); - | ^^^^^^^^^ - | - = help: `#[inline]` can only be applied to functions - -error: `#[inline]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:21:17 - | -LL | pub struct Foo3<#[inline] T>(PhantomData); - | ^^^^^^^^^ - | - = help: `#[inline]` can only be applied to functions - -error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:10:23 - | -LL | pub struct Baz<#[repr(C)] const N: usize>; - | ^ -------------- not a struct, enum, or union - -error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:18:24 - | -LL | pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>); - | ^ -- not a struct, enum, or union - -error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-78957.rs:26:24 - | -LL | pub struct Baz3<#[repr(C)] T>(PhantomData); - | ^ - not a struct, enum, or union - -error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:7:16 - | -LL | pub struct Bar<#[cold] const N: usize>; - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[cold]` can only be applied to functions -note: the lint level is defined here - --> $DIR/issue-78957.rs:1:9 - | -LL | #![deny(unused_attributes)] - | ^^^^^^^^^^^^^^^^^ - -error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:15:17 - | -LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>); - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[cold]` can only be applied to functions - -error: `#[cold]` attribute cannot be used on function params - --> $DIR/issue-78957.rs:23:17 - | -LL | pub struct Bar3<#[cold] T>(PhantomData); - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = help: `#[cold]` can only be applied to functions - -error: aborting due to 9 previous errors - -For more information about this error, try `rustc --explain E0517`. diff --git a/tests/ui/issues/issue-7899.rs b/tests/ui/issues/issue-7899.rs deleted file mode 100644 index 4b69f3e3d89..00000000000 --- a/tests/ui/issues/issue-7899.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] -//@ aux-build:issue-7899.rs - - -extern crate issue_7899 as testcrate; - -fn main() { - let f = testcrate::V2(1.0f32, 2.0f32); -} diff --git a/tests/ui/issues/issue-7911.rs b/tests/ui/issues/issue-7911.rs deleted file mode 100644 index 11da4df5285..00000000000 --- a/tests/ui/issues/issue-7911.rs +++ /dev/null @@ -1,37 +0,0 @@ -//@ run-pass -// (Closes #7911) Test that we can use the same self expression -// with different mutability in macro in two methods - -#![allow(unused_variables)] // unused foobar_immut + foobar_mut -trait FooBar { - fn dummy(&self) { } //~ WARN method `dummy` is never used -} -struct Bar(#[allow(dead_code)] i32); -struct Foo { bar: Bar } - -impl FooBar for Bar {} - -trait Test { - fn get_immut(&self) -> &dyn FooBar; - fn get_mut(&mut self) -> &mut dyn FooBar; -} - -macro_rules! generate_test { ($type_:path, $slf:ident, $field:expr) => ( - impl Test for $type_ { - fn get_immut(&$slf) -> &dyn FooBar { - &$field as &dyn FooBar - } - - fn get_mut(&mut $slf) -> &mut dyn FooBar { - &mut $field as &mut dyn FooBar - } - } -)} - -generate_test!(Foo, self, self.bar); - -pub fn main() { - let mut foo: Foo = Foo { bar: Bar(42) }; - { let foobar_immut = foo.get_immut(); } - { let foobar_mut = foo.get_mut(); } -} diff --git a/tests/ui/issues/issue-7911.stderr b/tests/ui/issues/issue-7911.stderr deleted file mode 100644 index ead7ee191ac..00000000000 --- a/tests/ui/issues/issue-7911.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: method `dummy` is never used - --> $DIR/issue-7911.rs:7:8 - | -LL | trait FooBar { - | ------ method in this trait -LL | fn dummy(&self) { } - | ^^^^^ - | - = note: `#[warn(dead_code)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/issues/issue-7970a.rs b/tests/ui/issues/issue-7970a.rs deleted file mode 100644 index dae906410ed..00000000000 --- a/tests/ui/issues/issue-7970a.rs +++ /dev/null @@ -1,8 +0,0 @@ -macro_rules! one_arg_macro { - ($fmt:expr) => (print!(concat!($fmt, "\n"))); -} - -fn main() { - one_arg_macro!(); - //~^ ERROR unexpected end of macro invocation -} diff --git a/tests/ui/issues/issue-7970a.stderr b/tests/ui/issues/issue-7970a.stderr deleted file mode 100644 index 1e6bb92ea57..00000000000 --- a/tests/ui/issues/issue-7970a.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error: unexpected end of macro invocation - --> $DIR/issue-7970a.rs:6:5 - | -LL | macro_rules! one_arg_macro { - | -------------------------- when calling this macro -... -LL | one_arg_macro!(); - | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments - | -note: while trying to match meta-variable `$fmt:expr` - --> $DIR/issue-7970a.rs:2:6 - | -LL | ($fmt:expr) => (print!(concat!($fmt, "\n"))); - | ^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/issues/issue-8044.rs b/tests/ui/issues/issue-8044.rs deleted file mode 100644 index 3c10bbca634..00000000000 --- a/tests/ui/issues/issue-8044.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-pass -//@ aux-build:issue-8044.rs - - -extern crate issue_8044 as minimal; -use minimal::{BTree, leaf}; - -pub fn main() { - BTree:: { node: leaf(1) }; -} diff --git a/tests/ui/issues/issue-80607.rs b/tests/ui/issues/issue-80607.rs deleted file mode 100644 index 63f4df359b8..00000000000 --- a/tests/ui/issues/issue-80607.rs +++ /dev/null @@ -1,10 +0,0 @@ -// This tests makes sure the diagnostics print the offending enum variant, not just the type. -pub enum Enum { - V1(i32), -} - -pub fn foo(x: i32) -> Enum { - Enum::V1 { x } //~ ERROR `Enum::V1` has no field named `x` -} - -fn main() {} diff --git a/tests/ui/issues/issue-80607.stderr b/tests/ui/issues/issue-80607.stderr deleted file mode 100644 index 8f9f494c8b7..00000000000 --- a/tests/ui/issues/issue-80607.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0559]: variant `Enum::V1` has no field named `x` - --> $DIR/issue-80607.rs:7:16 - | -LL | V1(i32), - | -- `Enum::V1` defined here -... -LL | Enum::V1 { x } - | ^ field does not exist - | -help: `Enum::V1` is a tuple variant, use the appropriate syntax - | -LL - Enum::V1 { x } -LL + Enum::V1(/* i32 */) - | - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0559`. diff --git a/tests/ui/issues/issue-81584.fixed b/tests/ui/issues/issue-81584.fixed deleted file mode 100644 index c3d33a1b4f8..00000000000 --- a/tests/ui/issues/issue-81584.fixed +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-rustfix -fn main() { - let _ = vec![vec![0, 1], vec![2]] - .into_iter() - .map(|y| y.iter().map(|x| x + 1).collect::>()) - //~^ ERROR cannot return value referencing function parameter `y` - .collect::>(); -} diff --git a/tests/ui/issues/issue-81584.rs b/tests/ui/issues/issue-81584.rs deleted file mode 100644 index 27db73aaa2c..00000000000 --- a/tests/ui/issues/issue-81584.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-rustfix -fn main() { - let _ = vec![vec![0, 1], vec![2]] - .into_iter() - .map(|y| y.iter().map(|x| x + 1)) - //~^ ERROR cannot return value referencing function parameter `y` - .collect::>(); -} diff --git a/tests/ui/issues/issue-81584.stderr b/tests/ui/issues/issue-81584.stderr deleted file mode 100644 index eb97916ad75..00000000000 --- a/tests/ui/issues/issue-81584.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0515]: cannot return value referencing function parameter `y` - --> $DIR/issue-81584.rs:5:22 - | -LL | .map(|y| y.iter().map(|x| x + 1)) - | -^^^^^^^^^^^^^^^^^^^^^^ - | | - | returns a value referencing data owned by the current function - | `y` is borrowed here - | - = help: use `.collect()` to allocate the iterator - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs deleted file mode 100644 index 6a03404cdca..00000000000 --- a/tests/ui/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ /dev/null @@ -1,18 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -/* - -#8171 Self is not recognised as implementing kinds in default method implementations - -*/ - -fn require_send(_: T){} - -trait TragicallySelfIsNotSend: Send + Sized { - fn x(self) { - require_send(self); - } -} - -pub fn main(){} diff --git a/tests/ui/issues/issue-81918.rs b/tests/ui/issues/issue-81918.rs deleted file mode 100644 index ee9721c2493..00000000000 --- a/tests/ui/issues/issue-81918.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ check-pass -//@ dont-check-compiler-stdout -//@ compile-flags: -Z unpretty=mir-cfg - -// This checks that unpretty=mir-cfg does not panic. See #81918. - -const TAG: &'static str = "ABCD"; - -fn main() { - if TAG == "" {} -} diff --git a/tests/ui/issues/issue-8248.rs b/tests/ui/issues/issue-8248.rs deleted file mode 100644 index 95f626658cc..00000000000 --- a/tests/ui/issues/issue-8248.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ run-pass - -trait A { - fn dummy(&self) { } //~ WARN method `dummy` is never used -} -struct B; -impl A for B {} - -fn foo(_: &mut dyn A) {} - -pub fn main() { - let mut b = B; - foo(&mut b as &mut dyn A); -} diff --git a/tests/ui/issues/issue-8248.stderr b/tests/ui/issues/issue-8248.stderr deleted file mode 100644 index 8570bfaefad..00000000000 --- a/tests/ui/issues/issue-8248.stderr +++ /dev/null @@ -1,12 +0,0 @@ -warning: method `dummy` is never used - --> $DIR/issue-8248.rs:4:8 - | -LL | trait A { - | - method in this trait -LL | fn dummy(&self) { } - | ^^^^^ - | - = note: `#[warn(dead_code)]` on by default - -warning: 1 warning emitted - diff --git a/tests/ui/issues/issue-8249.rs b/tests/ui/issues/issue-8249.rs deleted file mode 100644 index 2364fc14d31..00000000000 --- a/tests/ui/issues/issue-8249.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ run-pass -#![allow(dead_code)] - -trait A { - fn dummy(&self) { } -} -struct B; -impl A for B {} - -struct C<'a> { - foo: &'a mut (dyn A+'a), -} - -fn foo(a: &mut dyn A) { - C{ foo: a }; -} - -pub fn main() { -} diff --git a/tests/ui/issues/issue-8259.rs b/tests/ui/issues/issue-8259.rs deleted file mode 100644 index e843f7f9c50..00000000000 --- a/tests/ui/issues/issue-8259.rs +++ /dev/null @@ -1,11 +0,0 @@ -//@ run-pass -#![allow(dead_code)] -#![allow(non_upper_case_globals)] - -//@ aux-build:issue-8259.rs - - -extern crate issue_8259 as other; -static a: other::Foo<'static> = other::Foo::A; - -pub fn main() {} diff --git a/tests/ui/issues/issue-83048.rs b/tests/ui/issues/issue-83048.rs deleted file mode 100644 index 6c941133a15..00000000000 --- a/tests/ui/issues/issue-83048.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags: -Z unpretty=thir-tree - -pub fn main() { - break; //~ ERROR: `break` outside of a loop or labeled block [E0268] -} diff --git a/tests/ui/issues/issue-83048.stderr b/tests/ui/issues/issue-83048.stderr deleted file mode 100644 index 672bf69a732..00000000000 --- a/tests/ui/issues/issue-83048.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0268]: `break` outside of a loop or labeled block - --> $DIR/issue-83048.rs:4:5 - | -LL | break; - | ^^^^^ cannot `break` outside of a loop or labeled block - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/issues/issue-8391.rs b/tests/ui/issues/issue-8391.rs deleted file mode 100644 index 20698eed18b..00000000000 --- a/tests/ui/issues/issue-8391.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass - -fn main() { - let x = match Some(1) { - ref _y @ Some(_) => 1, - None => 2, - }; - assert_eq!(x, 1); -} diff --git a/tests/ui/issues/issue-8398.rs b/tests/ui/issues/issue-8398.rs deleted file mode 100644 index 7d100b855fd..00000000000 --- a/tests/ui/issues/issue-8398.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ check-pass -#![allow(dead_code)] - -pub trait Writer { - fn write(&mut self, b: &[u8]) -> Result<(), ()>; -} - -fn foo(a: &mut dyn Writer) { - a.write(&[]).unwrap(); -} - -pub fn main(){} diff --git a/tests/ui/issues/issue-8401.rs b/tests/ui/issues/issue-8401.rs deleted file mode 100644 index 1df63516fb0..00000000000 --- a/tests/ui/issues/issue-8401.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-8401.rs - - -extern crate issue_8401; - -pub fn main() {} diff --git a/tests/ui/issues/issue-8498.rs b/tests/ui/issues/issue-8498.rs deleted file mode 100644 index 92904e2198f..00000000000 --- a/tests/ui/issues/issue-8498.rs +++ /dev/null @@ -1,27 +0,0 @@ -//@ run-pass - -pub fn main() { - match &[(Box::new(5),Box::new(7))] { - ps => { - let (ref y, _) = ps[0]; - assert_eq!(**y, 5); - } - } - - match Some(&[(Box::new(5),)]) { - Some(ps) => { - let (ref y,) = ps[0]; - assert_eq!(**y, 5); - } - None => () - } - - match Some(&[(Box::new(5),Box::new(7))]) { - Some(ps) => { - let (ref y, ref z) = ps[0]; - assert_eq!(**y, 5); - assert_eq!(**z, 7); - } - None => () - } -} diff --git a/tests/ui/issues/issue-8506.rs b/tests/ui/issues/issue-8506.rs deleted file mode 100644 index 30a789a3e27..00000000000 --- a/tests/ui/issues/issue-8506.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ run-pass -#![allow(non_upper_case_globals)] - -#![allow(dead_code)] - -enum Either { - One, - Other(String,String) -} - -static one : Either = Either::One; - -pub fn main () { } diff --git a/tests/ui/issues/issue-8521.rs b/tests/ui/issues/issue-8521.rs deleted file mode 100644 index 78ce85787d5..00000000000 --- a/tests/ui/issues/issue-8521.rs +++ /dev/null @@ -1,25 +0,0 @@ -//@ check-pass -trait Foo1 {} - -trait A {} - -macro_rules! foo1(($t:path) => { - impl Foo1 for T {} -}); - -foo1!(A); - -trait Foo2 {} - -trait B {} - -#[allow(unused)] -struct C {} - -macro_rules! foo2(($t:path) => { - impl Foo2 for T {} -}); - -foo2!(B); - -fn main() {} diff --git a/tests/ui/issues/issue-85461.rs b/tests/ui/issues/issue-85461.rs deleted file mode 100644 index 72538081ccb..00000000000 --- a/tests/ui/issues/issue-85461.rs +++ /dev/null @@ -1,28 +0,0 @@ -//@ compile-flags: -Cinstrument-coverage -Ccodegen-units=4 --crate-type dylib -Copt-level=0 -//@ build-pass -//@ needs-profiler-runtime -//@ needs-dynamic-linking - -// Regression test for #85461 where MSVC sometimes fails to link instrument-coverage binaries -// with dead code and #[inline(always)]. - -#![allow(dead_code)] - -mod foo { - #[inline(always)] - pub fn called() { } - - fn uncalled() { } -} - -pub mod bar { - pub fn call_me() { - super::foo::called(); - } -} - -pub mod baz { - pub fn call_me() { - super::foo::called(); - } -} diff --git a/tests/ui/issues/issue-8578.rs b/tests/ui/issues/issue-8578.rs deleted file mode 100644 index 9baa2f70a02..00000000000 --- a/tests/ui/issues/issue-8578.rs +++ /dev/null @@ -1,19 +0,0 @@ -//@ check-pass -#![allow(dead_code)] -#![allow(non_camel_case_types)] -#![allow(non_upper_case_globals)] - -pub struct UninterpretedOption_NamePart { - name_part: Option, -} - -impl<'a> UninterpretedOption_NamePart { - pub fn default_instance() -> &'static UninterpretedOption_NamePart { - static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart { - name_part: None, - }; - &instance - } -} - -pub fn main() {} diff --git a/tests/ui/issues/issue-86756.rs b/tests/ui/issues/issue-86756.rs deleted file mode 100644 index 55a6c144839..00000000000 --- a/tests/ui/issues/issue-86756.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ edition: 2015 -trait Foo {} -//~^ ERROR the name `T` is already used for a generic parameter in this item's generic parameters - -fn eq() { - eq:: - //~^ ERROR cannot find type `dyn` in this scope - //~| ERROR missing generics for trait `Foo` - //~| WARN trait objects without an explicit `dyn` are deprecated - //~| WARN this is accepted in the current edition -} - -fn main() {} diff --git a/tests/ui/issues/issue-86756.stderr b/tests/ui/issues/issue-86756.stderr deleted file mode 100644 index b650b32c2a3..00000000000 --- a/tests/ui/issues/issue-86756.stderr +++ /dev/null @@ -1,48 +0,0 @@ -error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters - --> $DIR/issue-86756.rs:2:14 - | -LL | trait Foo {} - | - ^ already used - | | - | first use of `T` - -error[E0412]: cannot find type `dyn` in this scope - --> $DIR/issue-86756.rs:6:10 - | -LL | eq:: - | ^^^ not found in this scope - -warning: trait objects without an explicit `dyn` are deprecated - --> $DIR/issue-86756.rs:6:15 - | -LL | eq:: - | ^^^ - | - = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021! - = note: for more information, see - = note: `#[warn(bare_trait_objects)]` on by default -help: if this is a dyn-compatible trait, use `dyn` - | -LL | eq:: - | +++ - -error[E0107]: missing generics for trait `Foo` - --> $DIR/issue-86756.rs:6:15 - | -LL | eq:: - | ^^^ expected at least 1 generic argument - | -note: trait defined here, with at least 1 generic parameter: `T` - --> $DIR/issue-86756.rs:2:7 - | -LL | trait Foo {} - | ^^^ - -help: add missing generic argument - | -LL | eq::> - | +++ - -error: aborting due to 3 previous errors; 1 warning emitted - -Some errors have detailed explanations: E0107, E0403, E0412. -For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/issues/issue-87199.rs b/tests/ui/issues/issue-87199.rs deleted file mode 100644 index dd9dfc74ca3..00000000000 --- a/tests/ui/issues/issue-87199.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Regression test for issue #87199, where attempting to relax a bound -// other than the only supported `?Sized` would still cause the compiler -// to assume that the `Sized` bound was relaxed. - -//@ check-fail - -// Check that these function definitions only emit warnings, not errors -fn arg(_: T) {} -//~^ ERROR: bound modifier `?` can only be applied to `Sized` -fn ref_arg(_: &T) {} -//~^ ERROR: bound modifier `?` can only be applied to `Sized` -fn ret() -> impl Iterator + ?Send { std::iter::empty() } -//~^ ERROR: bound modifier `?` can only be applied to `Sized` -//~| ERROR: bound modifier `?` can only be applied to `Sized` - -// Check that there's no `?Sized` relaxation! -fn main() { - ref_arg::(&5); - ref_arg::<[i32]>(&[5]); - //~^ ERROR the size for values of type `[i32]` cannot be known -} diff --git a/tests/ui/issues/issue-87199.stderr b/tests/ui/issues/issue-87199.stderr deleted file mode 100644 index 8a930a3d704..00000000000 --- a/tests/ui/issues/issue-87199.stderr +++ /dev/null @@ -1,46 +0,0 @@ -error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:8:11 - | -LL | fn arg(_: T) {} - | ^^^^^ - -error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:10:15 - | -LL | fn ref_arg(_: &T) {} - | ^^^^^ - -error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:12:40 - | -LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } - | ^^^^^ - -error: bound modifier `?` can only be applied to `Sized` - --> $DIR/issue-87199.rs:12:40 - | -LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } - | ^^^^^ - | - = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` - -error[E0277]: the size for values of type `[i32]` cannot be known at compilation time - --> $DIR/issue-87199.rs:19:15 - | -LL | ref_arg::<[i32]>(&[5]); - | ^^^^^ doesn't have a size known at compile-time - | - = help: the trait `Sized` is not implemented for `[i32]` -note: required by an implicit `Sized` bound in `ref_arg` - --> $DIR/issue-87199.rs:10:12 - | -LL | fn ref_arg(_: &T) {} - | ^ required by the implicit `Sized` requirement on this type parameter in `ref_arg` -help: consider relaxing the implicit `Sized` restriction - | -LL | fn ref_arg(_: &T) {} - | ++++++++ - -error: aborting due to 5 previous errors - -For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/issues/issue-8727.rs b/tests/ui/issues/issue-8727.rs deleted file mode 100644 index c1b60e8e085..00000000000 --- a/tests/ui/issues/issue-8727.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Verify the compiler fails with an error on infinite function -// recursions. - -//@ build-fail -//@ compile-flags: --diagnostic-width=100 -Zwrite-long-types-to-disk=yes - -fn generic() { //~ WARN function cannot return without recursing - generic::>(); -} -//~^^ ERROR reached the recursion limit while instantiating `generic:: at least once to trigger instantiation. - generic::(); -} diff --git a/tests/ui/issues/issue-8727.stderr b/tests/ui/issues/issue-8727.stderr deleted file mode 100644 index 9fb09a7d4f4..00000000000 --- a/tests/ui/issues/issue-8727.stderr +++ /dev/null @@ -1,27 +0,0 @@ -warning: function cannot return without recursing - --> $DIR/issue-8727.rs:7:1 - | -LL | fn generic() { - | ^^^^^^^^^^^^^^^ cannot return without recursing -LL | generic::>(); - | ---------------------- recursive call site - | - = help: a `loop` may express intention better if this is on purpose - = note: `#[warn(unconditional_recursion)]` on by default - -error: reached the recursion limit while instantiating `generic::>>>>` - --> $DIR/issue-8727.rs:8:5 - | -LL | generic::>(); - | ^^^^^^^^^^^^^^^^^^^^^^ - | -note: `generic` defined here - --> $DIR/issue-8727.rs:7:1 - | -LL | fn generic() { - | ^^^^^^^^^^^^^^^ - = note: the full name for the type has been written to '$TEST_BUILD_DIR/issue-8727.long-type-$LONG_TYPE_HASH.txt' - = note: consider using `--verbose` to print the full type name to the console - -error: aborting due to 1 previous error; 1 warning emitted - diff --git a/tests/ui/issues/issue-87490.rs b/tests/ui/issues/issue-87490.rs deleted file mode 100644 index 998f61a6bd3..00000000000 --- a/tests/ui/issues/issue-87490.rs +++ /dev/null @@ -1,10 +0,0 @@ -fn main() {} -trait StreamOnce { - type Position; -} -impl StreamOnce for &str { - type Position = usize; -} -fn follow(_: &str) -> <&str as StreamOnce>::Position { - String::new //~ ERROR mismatched types -} diff --git a/tests/ui/issues/issue-87490.stderr b/tests/ui/issues/issue-87490.stderr deleted file mode 100644 index 5a4ec55833b..00000000000 --- a/tests/ui/issues/issue-87490.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-87490.rs:9:5 - | -LL | fn follow(_: &str) -> <&str as StreamOnce>::Position { - | ------------------------------ expected `usize` because of return type -LL | String::new - | ^^^^^^^^^^^ expected `usize`, found fn item - | - = note: expected type `usize` - found fn item `fn() -> String {String::new}` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-8761.rs b/tests/ui/issues/issue-8761.rs deleted file mode 100644 index 5883bb96695..00000000000 --- a/tests/ui/issues/issue-8761.rs +++ /dev/null @@ -1,10 +0,0 @@ -enum Foo { - A = 1i64, - //~^ ERROR mismatched types - //~| NOTE expected `isize`, found `i64` - B = 2u8 - //~^ ERROR mismatched types - //~| NOTE expected `isize`, found `u8` -} - -fn main() {} diff --git a/tests/ui/issues/issue-8761.stderr b/tests/ui/issues/issue-8761.stderr deleted file mode 100644 index 4a9db568913..00000000000 --- a/tests/ui/issues/issue-8761.stderr +++ /dev/null @@ -1,27 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/issue-8761.rs:2:9 - | -LL | A = 1i64, - | ^^^^ expected `isize`, found `i64` - | -help: change the type of the numeric literal from `i64` to `isize` - | -LL - A = 1i64, -LL + A = 1isize, - | - -error[E0308]: mismatched types - --> $DIR/issue-8761.rs:5:9 - | -LL | B = 2u8 - | ^^^ expected `isize`, found `u8` - | -help: change the type of the numeric literal from `u8` to `isize` - | -LL - B = 2u8 -LL + B = 2isize - | - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/issues/issue-8767.rs b/tests/ui/issues/issue-8767.rs deleted file mode 100644 index 972101a0bc3..00000000000 --- a/tests/ui/issues/issue-8767.rs +++ /dev/null @@ -1,5 +0,0 @@ -impl B { //~ ERROR cannot find type `B` in this scope -} - -fn main() { -} diff --git a/tests/ui/issues/issue-8767.stderr b/tests/ui/issues/issue-8767.stderr deleted file mode 100644 index 66141628e28..00000000000 --- a/tests/ui/issues/issue-8767.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0412]: cannot find type `B` in this scope - --> $DIR/issue-8767.rs:1:6 - | -LL | impl B { - | ^ not found in this scope - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0412`. diff --git a/tests/ui/issues/issue-87707.rs b/tests/ui/issues/issue-87707.rs deleted file mode 100644 index a0da8a740ac..00000000000 --- a/tests/ui/issues/issue-87707.rs +++ /dev/null @@ -1,17 +0,0 @@ -// test for #87707 -//@ edition:2018 -//@ run-fail -//@ exec-env:RUST_BACKTRACE=0 -//@ check-run-results -//@ needs-unwind uses catch_unwind - -use std::sync::Once; -use std::panic; - -fn main() { - let o = Once::new(); - let _ = panic::catch_unwind(|| { - o.call_once(|| panic!("Here Once instance is poisoned.")); - }); - o.call_once(|| {}); -} diff --git a/tests/ui/issues/issue-87707.run.stderr b/tests/ui/issues/issue-87707.run.stderr deleted file mode 100644 index 8485c0578b8..00000000000 --- a/tests/ui/issues/issue-87707.run.stderr +++ /dev/null @@ -1,7 +0,0 @@ - -thread 'main' ($TID) panicked at $DIR/issue-87707.rs:14:24: -Here Once instance is poisoned. -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace - -thread 'main' ($TID) panicked at $DIR/issue-87707.rs:16:7: -Once instance has previously been poisoned diff --git a/tests/ui/issues/issue-8783.rs b/tests/ui/issues/issue-8783.rs deleted file mode 100644 index d0ff79f8ac8..00000000000 --- a/tests/ui/issues/issue-8783.rs +++ /dev/null @@ -1,21 +0,0 @@ -//@ run-pass -#![allow(unused_variables)] - -struct X { pub x: usize } -impl Default for X { - fn default() -> X { - X { x: 42 } - } -} - -struct Y { pub y: T } -impl Default for Y { - fn default() -> Y { - Y { y: Default::default() } - } -} - -fn main() { - let X { x: _ } = Default::default(); - let Y { y: X { x } } = Default::default(); -} diff --git a/tests/ui/issues/issue-8860.rs b/tests/ui/issues/issue-8860.rs deleted file mode 100644 index 3af61576fe1..00000000000 --- a/tests/ui/issues/issue-8860.rs +++ /dev/null @@ -1,51 +0,0 @@ -//@ run-pass -// FIXME(static_mut_refs): this could use an atomic -#![allow(static_mut_refs)] -#![allow(dead_code)] - -static mut DROP: isize = 0; -static mut DROP_S: isize = 0; -static mut DROP_T: isize = 0; - -struct S; -impl Drop for S { - fn drop(&mut self) { - unsafe { - DROP_S += 1; - DROP += 1; - } - } -} -fn f(ref _s: S) {} - -struct T { i: isize } -impl Drop for T { - fn drop(&mut self) { - unsafe { - DROP_T += 1; - DROP += 1; - } - } -} -fn g(ref _t: T) {} - -fn do_test() { - let s = S; - f(s); - unsafe { - assert_eq!(1, DROP); - assert_eq!(1, DROP_S); - } - let t = T { i: 1 }; - g(t); - unsafe { assert_eq!(1, DROP_T); } -} - -fn main() { - do_test(); - unsafe { - assert_eq!(2, DROP); - assert_eq!(1, DROP_S); - assert_eq!(1, DROP_T); - } -} diff --git a/tests/ui/issues/issue-9123.rs b/tests/ui/issues/issue-9123.rs deleted file mode 100644 index bbf6c13341c..00000000000 --- a/tests/ui/issues/issue-9123.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ aux-build:issue-9123.rs - - -extern crate issue_9123; - -pub fn main() {} diff --git a/tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed new file mode 100644 index 00000000000..0e3d48fe27d --- /dev/null +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.fixed @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/81584 +//@ run-rustfix +fn main() { + let _ = vec![vec![0, 1], vec![2]] + .into_iter() + .map(|y| y.iter().map(|x| x + 1).collect::>()) + //~^ ERROR cannot return value referencing function parameter `y` + .collect::>(); +} diff --git a/tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs new file mode 100644 index 00000000000..3fba39517fc --- /dev/null +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.rs @@ -0,0 +1,9 @@ +// https://github.com/rust-lang/rust/issues/81584 +//@ run-rustfix +fn main() { + let _ = vec![vec![0, 1], vec![2]] + .into_iter() + .map(|y| y.iter().map(|x| x + 1)) + //~^ ERROR cannot return value referencing function parameter `y` + .collect::>(); +} diff --git a/tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr new file mode 100644 index 00000000000..e180183e7e3 --- /dev/null +++ b/tests/ui/iterators/iterator-scope-collect-suggestion-81584.stderr @@ -0,0 +1,14 @@ +error[E0515]: cannot return value referencing function parameter `y` + --> $DIR/iterator-scope-collect-suggestion-81584.rs:6:22 + | +LL | .map(|y| y.iter().map(|x| x + 1)) + | -^^^^^^^^^^^^^^^^^^^^^^ + | | + | returns a value referencing data owned by the current function + | `y` is borrowed here + | + = help: use `.collect()` to allocate the iterator + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/macros/macro-invocation-span-error-7970.rs b/tests/ui/macros/macro-invocation-span-error-7970.rs new file mode 100644 index 00000000000..df7e1cfea88 --- /dev/null +++ b/tests/ui/macros/macro-invocation-span-error-7970.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/7970 +macro_rules! one_arg_macro { + ($fmt:expr) => { + print!(concat!($fmt, "\n")) + }; +} + +fn main() { + one_arg_macro!(); + //~^ ERROR unexpected end of macro invocation +} diff --git a/tests/ui/macros/macro-invocation-span-error-7970.stderr b/tests/ui/macros/macro-invocation-span-error-7970.stderr new file mode 100644 index 00000000000..beb54e05992 --- /dev/null +++ b/tests/ui/macros/macro-invocation-span-error-7970.stderr @@ -0,0 +1,17 @@ +error: unexpected end of macro invocation + --> $DIR/macro-invocation-span-error-7970.rs:9:5 + | +LL | macro_rules! one_arg_macro { + | -------------------------- when calling this macro +... +LL | one_arg_macro!(); + | ^^^^^^^^^^^^^^^^ missing tokens in macro arguments + | +note: while trying to match meta-variable `$fmt:expr` + --> $DIR/macro-invocation-span-error-7970.rs:3:6 + | +LL | ($fmt:expr) => { + | ^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/macros/macro-path-type-bounds-8521.rs b/tests/ui/macros/macro-path-type-bounds-8521.rs new file mode 100644 index 00000000000..975d3dc402e --- /dev/null +++ b/tests/ui/macros/macro-path-type-bounds-8521.rs @@ -0,0 +1,26 @@ +// https://github.com/rust-lang/rust/issues/8521 +//@ check-pass +trait Foo1 {} + +trait A {} + +macro_rules! foo1(($t:path) => { + impl Foo1 for T {} +}); + +foo1!(A); + +trait Foo2 {} + +trait B {} + +#[allow(unused)] +struct C {} + +macro_rules! foo2(($t:path) => { + impl Foo2 for T {} +}); + +foo2!(B); + +fn main() {} diff --git a/tests/ui/macros/macro-self-mutability-7911.rs b/tests/ui/macros/macro-self-mutability-7911.rs new file mode 100644 index 00000000000..5313f86d97f --- /dev/null +++ b/tests/ui/macros/macro-self-mutability-7911.rs @@ -0,0 +1,38 @@ +// https://github.com/rust-lang/rust/issues/7911 +//@ run-pass +// (Closes #7911) Test that we can use the same self expression +// with different mutability in macro in two methods + +#![allow(unused_variables)] // unused foobar_immut + foobar_mut +trait FooBar { + fn dummy(&self) { } //~ WARN method `dummy` is never used +} +struct Bar(#[allow(dead_code)] i32); +struct Foo { bar: Bar } + +impl FooBar for Bar {} + +trait Test { + fn get_immut(&self) -> &dyn FooBar; + fn get_mut(&mut self) -> &mut dyn FooBar; +} + +macro_rules! generate_test { ($type_:path, $slf:ident, $field:expr) => ( + impl Test for $type_ { + fn get_immut(&$slf) -> &dyn FooBar { + &$field as &dyn FooBar + } + + fn get_mut(&mut $slf) -> &mut dyn FooBar { + &mut $field as &mut dyn FooBar + } + } +)} + +generate_test!(Foo, self, self.bar); + +pub fn main() { + let mut foo: Foo = Foo { bar: Bar(42) }; + { let foobar_immut = foo.get_immut(); } + { let foobar_mut = foo.get_mut(); } +} diff --git a/tests/ui/macros/macro-self-mutability-7911.stderr b/tests/ui/macros/macro-self-mutability-7911.stderr new file mode 100644 index 00000000000..7fc2abe06eb --- /dev/null +++ b/tests/ui/macros/macro-self-mutability-7911.stderr @@ -0,0 +1,12 @@ +warning: method `dummy` is never used + --> $DIR/macro-self-mutability-7911.rs:8:8 + | +LL | trait FooBar { + | ------ method in this trait +LL | fn dummy(&self) { } + | ^^^^^ + | + = note: `#[warn(dead_code)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/match/mismatched-types-in-match-pattern-7867.rs b/tests/ui/match/mismatched-types-in-match-pattern-7867.rs new file mode 100644 index 00000000000..9ff8755c819 --- /dev/null +++ b/tests/ui/match/mismatched-types-in-match-pattern-7867.rs @@ -0,0 +1,17 @@ +// https://github.com/rust-lang/rust/issues/7867 +//@ dont-require-annotations: NOTE + +enum A { B, C } + +mod foo { pub fn bar() {} } + +fn main() { + match (true, false) { + A::B => (), + //~^ ERROR mismatched types + //~| NOTE expected `(bool, bool)`, found `A` + //~| NOTE expected tuple `(bool, bool)` + //~| NOTE found enum `A` + _ => () + } +} diff --git a/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr b/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr new file mode 100644 index 00000000000..8997f36114a --- /dev/null +++ b/tests/ui/match/mismatched-types-in-match-pattern-7867.stderr @@ -0,0 +1,17 @@ +error[E0308]: mismatched types + --> $DIR/mismatched-types-in-match-pattern-7867.rs:10:9 + | +LL | enum A { B, C } + | - unit variant defined here +... +LL | match (true, false) { + | ------------- this expression has type `(bool, bool)` +LL | A::B => (), + | ^^^^ expected `(bool, bool)`, found `A` + | + = note: expected tuple `(bool, bool)` + found enum `A` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/methods/trait-method-self-param-error-7575.rs b/tests/ui/methods/trait-method-self-param-error-7575.rs new file mode 100644 index 00000000000..9793d43cc24 --- /dev/null +++ b/tests/ui/methods/trait-method-self-param-error-7575.rs @@ -0,0 +1,18 @@ +// https://github.com/rust-lang/rust/issues/7575 +//@ run-pass + +trait Foo { //~ WARN trait `Foo` is never used + fn new() -> bool { false } + fn dummy(&self) { } +} + +trait Bar { + fn new(&self) -> bool { true } +} + +impl Bar for isize {} +impl Foo for isize {} + +fn main() { + assert!(1.new()); +} diff --git a/tests/ui/methods/trait-method-self-param-error-7575.stderr b/tests/ui/methods/trait-method-self-param-error-7575.stderr new file mode 100644 index 00000000000..5c10a7e1da9 --- /dev/null +++ b/tests/ui/methods/trait-method-self-param-error-7575.stderr @@ -0,0 +1,10 @@ +warning: trait `Foo` is never used + --> $DIR/trait-method-self-param-error-7575.rs:4:7 + | +LL | trait Foo { + | ^^^ + | + = note: `#[warn(dead_code)]` on by default + +warning: 1 warning emitted + diff --git a/tests/ui/mir/mir-cfg-unpretty-check-81918.rs b/tests/ui/mir/mir-cfg-unpretty-check-81918.rs new file mode 100644 index 00000000000..4798a654375 --- /dev/null +++ b/tests/ui/mir/mir-cfg-unpretty-check-81918.rs @@ -0,0 +1,12 @@ +// https://github.com/rust-lang/rust/issues/81918 +//@ check-pass +//@ dont-check-compiler-stdout +//@ compile-flags: -Z unpretty=mir-cfg + +// This checks that unpretty=mir-cfg does not panic. See #81918. + +const TAG: &'static str = "ABCD"; + +fn main() { + if TAG == "" {} +} diff --git a/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs new file mode 100644 index 00000000000..67e16ec6ce3 --- /dev/null +++ b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/87490 +fn main() {} +trait StreamOnce { + type Position; +} +impl StreamOnce for &str { + type Position = usize; +} +fn follow(_: &str) -> <&str as StreamOnce>::Position { + String::new //~ ERROR mismatched types +} diff --git a/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr new file mode 100644 index 00000000000..bbd73347d02 --- /dev/null +++ b/tests/ui/mismatched_types/mismatched-types-in-trait-implementation-87490.stderr @@ -0,0 +1,14 @@ +error[E0308]: mismatched types + --> $DIR/mismatched-types-in-trait-implementation-87490.rs:10:5 + | +LL | fn follow(_: &str) -> <&str as StreamOnce>::Position { + | ------------------------------ expected `usize` because of return type +LL | String::new + | ^^^^^^^^^^^ expected `usize`, found fn item + | + = note: expected type `usize` + found fn item `fn() -> String {String::new}` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/pattern/match-with-at-binding-8391.rs b/tests/ui/pattern/match-with-at-binding-8391.rs new file mode 100644 index 00000000000..bc4e7be7989 --- /dev/null +++ b/tests/ui/pattern/match-with-at-binding-8391.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/8391 +//@ run-pass + +fn main() { + let x = match Some(1) { + ref _y @ Some(_) => 1, + None => 2, + }; + assert_eq!(x, 1); +} diff --git a/tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs b/tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs new file mode 100644 index 00000000000..1a67caf021c --- /dev/null +++ b/tests/ui/pattern/ref-in-function-parameter-patterns-8860.rs @@ -0,0 +1,52 @@ +// https://github.com/rust-lang/rust/issues/8860 +//@ run-pass +// FIXME(static_mut_refs): this could use an atomic +#![allow(static_mut_refs)] +#![allow(dead_code)] + +static mut DROP: isize = 0; +static mut DROP_S: isize = 0; +static mut DROP_T: isize = 0; + +struct S; +impl Drop for S { + fn drop(&mut self) { + unsafe { + DROP_S += 1; + DROP += 1; + } + } +} +fn f(ref _s: S) {} + +struct T { i: isize } +impl Drop for T { + fn drop(&mut self) { + unsafe { + DROP_T += 1; + DROP += 1; + } + } +} +fn g(ref _t: T) {} + +fn do_test() { + let s = S; + f(s); + unsafe { + assert_eq!(1, DROP); + assert_eq!(1, DROP_S); + } + let t = T { i: 1 }; + g(t); + unsafe { assert_eq!(1, DROP_T); } +} + +fn main() { + do_test(); + unsafe { + assert_eq!(2, DROP); + assert_eq!(1, DROP_S); + assert_eq!(1, DROP_T); + } +} diff --git a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed new file mode 100644 index 00000000000..7d648543a20 --- /dev/null +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed @@ -0,0 +1,19 @@ +// https://github.com/rust-lang/rust/issues/76077 +//@ run-rustfix +#![allow(dead_code, unused_variables)] + +pub mod foo { + #[derive(Default)] + pub struct Foo { invisible: bool, } + + #[derive(Default)] + pub struct Bar { pub visible: bool, invisible: bool, } +} + +fn main() { + let foo::Foo { .. } = foo::Foo::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields + + let foo::Bar { visible, .. } = foo::Bar::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields +} diff --git a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs new file mode 100644 index 00000000000..f3b51187ae3 --- /dev/null +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.rs @@ -0,0 +1,19 @@ +// https://github.com/rust-lang/rust/issues/76077 +//@ run-rustfix +#![allow(dead_code, unused_variables)] + +pub mod foo { + #[derive(Default)] + pub struct Foo { invisible: bool, } + + #[derive(Default)] + pub struct Bar { pub visible: bool, invisible: bool, } +} + +fn main() { + let foo::Foo {} = foo::Foo::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields + + let foo::Bar { visible } = foo::Bar::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields +} diff --git a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr new file mode 100644 index 00000000000..070fa1a53a5 --- /dev/null +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.stderr @@ -0,0 +1,24 @@ +error: pattern requires `..` due to inaccessible fields + --> $DIR/inaccessible-fields-pattern-matching-76077.rs:14:9 + | +LL | let foo::Foo {} = foo::Foo::default(); + | ^^^^^^^^^^^ + | +help: ignore the inaccessible and unused fields + | +LL | let foo::Foo { .. } = foo::Foo::default(); + | ++ + +error: pattern requires `..` due to inaccessible fields + --> $DIR/inaccessible-fields-pattern-matching-76077.rs:17:9 + | +LL | let foo::Bar { visible } = foo::Bar::default(); + | ^^^^^^^^^^^^^^^^^^^^ + | +help: ignore the inaccessible and unused fields + | +LL | let foo::Bar { visible, .. } = foo::Bar::default(); + | ++++ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/privacy/private-field-struct-construction-76077.rs b/tests/ui/privacy/private-field-struct-construction-76077.rs new file mode 100644 index 00000000000..7fc3473e8de --- /dev/null +++ b/tests/ui/privacy/private-field-struct-construction-76077.rs @@ -0,0 +1,11 @@ +// https://github.com/rust-lang/rust/issues/76077 +pub mod foo { + pub struct Foo { + you_cant_use_this_field: bool, + } +} + +fn main() { + foo::Foo {}; + //~^ ERROR cannot construct `Foo` with struct literal syntax due to private fields +} diff --git a/tests/ui/privacy/private-field-struct-construction-76077.stderr b/tests/ui/privacy/private-field-struct-construction-76077.stderr new file mode 100644 index 00000000000..5131db72fe3 --- /dev/null +++ b/tests/ui/privacy/private-field-struct-construction-76077.stderr @@ -0,0 +1,10 @@ +error: cannot construct `Foo` with struct literal syntax due to private fields + --> $DIR/private-field-struct-construction-76077.rs:9:5 + | +LL | foo::Foo {}; + | ^^^^^^^^ + | + = note: private field `you_cant_use_this_field` that was not provided + +error: aborting due to 1 previous error + diff --git a/tests/ui/recursion/infinite-function-recursion-error-8727.rs b/tests/ui/recursion/infinite-function-recursion-error-8727.rs new file mode 100644 index 00000000000..a4037f76109 --- /dev/null +++ b/tests/ui/recursion/infinite-function-recursion-error-8727.rs @@ -0,0 +1,16 @@ +// https://github.com/rust-lang/rust/issues/8727 +// Verify the compiler fails with an error on infinite function +// recursions. + +//@ build-fail +//@ compile-flags: --diagnostic-width=100 -Zwrite-long-types-to-disk=yes + +fn generic() { //~ WARN function cannot return without recursing + generic::>(); +} +//~^^ ERROR reached the recursion limit while instantiating `generic:: at least once to trigger instantiation. + generic::(); +} diff --git a/tests/ui/recursion/infinite-function-recursion-error-8727.stderr b/tests/ui/recursion/infinite-function-recursion-error-8727.stderr new file mode 100644 index 00000000000..13d57ecb3b2 --- /dev/null +++ b/tests/ui/recursion/infinite-function-recursion-error-8727.stderr @@ -0,0 +1,27 @@ +warning: function cannot return without recursing + --> $DIR/infinite-function-recursion-error-8727.rs:8:1 + | +LL | fn generic() { + | ^^^^^^^^^^^^^^^ cannot return without recursing +LL | generic::>(); + | ---------------------- recursive call site + | + = help: a `loop` may express intention better if this is on purpose + = note: `#[warn(unconditional_recursion)]` on by default + +error: reached the recursion limit while instantiating `generic::>>>>` + --> $DIR/infinite-function-recursion-error-8727.rs:9:5 + | +LL | generic::>(); + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: `generic` defined here + --> $DIR/infinite-function-recursion-error-8727.rs:8:1 + | +LL | fn generic() { + | ^^^^^^^^^^^^^^^ + = note: the full name for the type has been written to '$TEST_BUILD_DIR/infinite-function-recursion-error-8727.long-type-$LONG_TYPE_HASH.txt' + = note: consider using `--verbose` to print the full type name to the console + +error: aborting due to 1 previous error; 1 warning emitted + diff --git a/tests/ui/resolve/module-import-resolution-7663.rs b/tests/ui/resolve/module-import-resolution-7663.rs new file mode 100644 index 00000000000..872806594fc --- /dev/null +++ b/tests/ui/resolve/module-import-resolution-7663.rs @@ -0,0 +1,33 @@ +// https://github.com/rust-lang/rust/issues/7663 +//@ run-pass + +#![allow(unused_imports, dead_code)] + +mod test1 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use crate::test1::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +mod test2 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use crate::test2::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +fn main() { + test1::baz::my_main(); + test2::baz::my_main(); +} diff --git a/tests/ui/static/static-struct-with-option-8578.rs b/tests/ui/static/static-struct-with-option-8578.rs new file mode 100644 index 00000000000..d490a3f50b4 --- /dev/null +++ b/tests/ui/static/static-struct-with-option-8578.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/8578 +//@ check-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +pub struct UninterpretedOption_NamePart { + name_part: Option, +} + +impl<'a> UninterpretedOption_NamePart { + pub fn default_instance() -> &'static UninterpretedOption_NamePart { + static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart { + name_part: None, + }; + &instance + } +} + +pub fn main() {} diff --git a/tests/ui/structs-enums/auxiliary/aux-8044.rs b/tests/ui/structs-enums/auxiliary/aux-8044.rs new file mode 100644 index 00000000000..2ec25f51cde --- /dev/null +++ b/tests/ui/structs-enums/auxiliary/aux-8044.rs @@ -0,0 +1,15 @@ +pub struct BTree { + pub node: TreeItem, +} + +pub enum TreeItem { + TreeLeaf { value: V }, +} + +pub fn leaf(value: V) -> TreeItem { + TreeItem::TreeLeaf { value: value } +} + +fn main() { + BTree:: { node: leaf(1) }; +} diff --git a/tests/ui/structs-enums/struct-and-enum-usage-8044.rs b/tests/ui/structs-enums/struct-and-enum-usage-8044.rs new file mode 100644 index 00000000000..9b544f33f1c --- /dev/null +++ b/tests/ui/structs-enums/struct-and-enum-usage-8044.rs @@ -0,0 +1,10 @@ +// https://github.com/rust-lang/rust/issues/8044 +//@ run-pass +//@ aux-build:aux-8044.rs + +extern crate aux_8044 as minimal; +use minimal::{BTree, leaf}; + +pub fn main() { + BTree:: { node: leaf(1) }; +} diff --git a/tests/ui/structs/destructuring-struct-type-inference-8783.rs b/tests/ui/structs/destructuring-struct-type-inference-8783.rs new file mode 100644 index 00000000000..60bc4bf3289 --- /dev/null +++ b/tests/ui/structs/destructuring-struct-type-inference-8783.rs @@ -0,0 +1,22 @@ +// https://github.com/rust-lang/rust/issues/8783 +//@ run-pass +#![allow(unused_variables)] + +struct X { pub x: usize } +impl Default for X { + fn default() -> X { + X { x: 42 } + } +} + +struct Y { pub y: T } +impl Default for Y { + fn default() -> Y { + Y { y: Default::default() } + } +} + +fn main() { + let X { x: _ } = Default::default(); + let Y { y: X { x } } = Default::default(); +} diff --git a/tests/ui/thir-print/break-outside-loop-error-83048.rs b/tests/ui/thir-print/break-outside-loop-error-83048.rs new file mode 100644 index 00000000000..6dcebd77c27 --- /dev/null +++ b/tests/ui/thir-print/break-outside-loop-error-83048.rs @@ -0,0 +1,6 @@ +// https://github.com/rust-lang/rust/issues/83048 +//@ compile-flags: -Z unpretty=thir-tree + +pub fn main() { + break; //~ ERROR: `break` outside of a loop or labeled block [E0268] +} diff --git a/tests/ui/thir-print/break-outside-loop-error-83048.stderr b/tests/ui/thir-print/break-outside-loop-error-83048.stderr new file mode 100644 index 00000000000..65a08e62e3d --- /dev/null +++ b/tests/ui/thir-print/break-outside-loop-error-83048.stderr @@ -0,0 +1,9 @@ +error[E0268]: `break` outside of a loop or labeled block + --> $DIR/break-outside-loop-error-83048.rs:5:5 + | +LL | break; + | ^^^^^ cannot `break` outside of a loop or labeled block + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0268`. diff --git a/tests/ui/track-diagnostics/track-caller-for-once-87707.rs b/tests/ui/track-diagnostics/track-caller-for-once-87707.rs new file mode 100644 index 00000000000..9b450943f5d --- /dev/null +++ b/tests/ui/track-diagnostics/track-caller-for-once-87707.rs @@ -0,0 +1,18 @@ +// https://github.com/rust-lang/rust/issues/87707 +// test for #87707 +//@ edition:2018 +//@ run-fail +//@ exec-env:RUST_BACKTRACE=0 +//@ check-run-results +//@ needs-unwind uses catch_unwind + +use std::sync::Once; +use std::panic; + +fn main() { + let o = Once::new(); + let _ = panic::catch_unwind(|| { + o.call_once(|| panic!("Here Once instance is poisoned.")); + }); + o.call_once(|| {}); +} diff --git a/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr b/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr new file mode 100644 index 00000000000..093df62836b --- /dev/null +++ b/tests/ui/track-diagnostics/track-caller-for-once-87707.run.stderr @@ -0,0 +1,7 @@ + +thread 'main' ($TID) panicked at $DIR/track-caller-for-once-87707.rs:15:24: +Here Once instance is poisoned. +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace + +thread 'main' ($TID) panicked at $DIR/track-caller-for-once-87707.rs:17:7: +Once instance has previously been poisoned diff --git a/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs new file mode 100644 index 00000000000..f3baa4b1feb --- /dev/null +++ b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.rs @@ -0,0 +1,22 @@ +// https://github.com/rust-lang/rust/issues/87199 +// Regression test for issue #87199, where attempting to relax a bound +// other than the only supported `?Sized` would still cause the compiler +// to assume that the `Sized` bound was relaxed. + +//@ check-fail + +// Check that these function definitions only emit warnings, not errors +fn arg(_: T) {} +//~^ ERROR: bound modifier `?` can only be applied to `Sized` +fn ref_arg(_: &T) {} +//~^ ERROR: bound modifier `?` can only be applied to `Sized` +fn ret() -> impl Iterator + ?Send { std::iter::empty() } +//~^ ERROR: bound modifier `?` can only be applied to `Sized` +//~| ERROR: bound modifier `?` can only be applied to `Sized` + +// Check that there's no `?Sized` relaxation! +fn main() { + ref_arg::(&5); + ref_arg::<[i32]>(&[5]); + //~^ ERROR the size for values of type `[i32]` cannot be known +} diff --git a/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr new file mode 100644 index 00000000000..16223676c06 --- /dev/null +++ b/tests/ui/trait-bounds/relaxed-bounds-assumed-unsized-87199.stderr @@ -0,0 +1,46 @@ +error: bound modifier `?` can only be applied to `Sized` + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:9:11 + | +LL | fn arg(_: T) {} + | ^^^^^ + +error: bound modifier `?` can only be applied to `Sized` + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:15 + | +LL | fn ref_arg(_: &T) {} + | ^^^^^ + +error: bound modifier `?` can only be applied to `Sized` + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 + | +LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } + | ^^^^^ + +error: bound modifier `?` can only be applied to `Sized` + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:13:40 + | +LL | fn ret() -> impl Iterator + ?Send { std::iter::empty() } + | ^^^^^ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0277]: the size for values of type `[i32]` cannot be known at compilation time + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:20:15 + | +LL | ref_arg::<[i32]>(&[5]); + | ^^^^^ doesn't have a size known at compile-time + | + = help: the trait `Sized` is not implemented for `[i32]` +note: required by an implicit `Sized` bound in `ref_arg` + --> $DIR/relaxed-bounds-assumed-unsized-87199.rs:11:12 + | +LL | fn ref_arg(_: &T) {} + | ^ required by the implicit `Sized` requirement on this type parameter in `ref_arg` +help: consider relaxing the implicit `Sized` restriction + | +LL | fn ref_arg(_: &T) {} + | ++++++++ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/traits/auxiliary/aux-9123.rs b/tests/ui/traits/auxiliary/aux-9123.rs new file mode 100644 index 00000000000..60af53359e8 --- /dev/null +++ b/tests/ui/traits/auxiliary/aux-9123.rs @@ -0,0 +1,9 @@ +#![crate_type = "lib"] + +pub trait X { + fn x() { + fn f() { } + f(); + } + fn dummy(&self) { } +} diff --git a/tests/ui/traits/default-method-fn-call-9123.rs b/tests/ui/traits/default-method-fn-call-9123.rs new file mode 100644 index 00000000000..266b95ca960 --- /dev/null +++ b/tests/ui/traits/default-method-fn-call-9123.rs @@ -0,0 +1,7 @@ +// https://github.com/rust-lang/rust/issues/9123 +//@ run-pass +//@ aux-build:aux-9123.rs + +extern crate aux_9123; + +pub fn main() {} diff --git a/tests/ui/traits/mut-trait-in-struct-8249.rs b/tests/ui/traits/mut-trait-in-struct-8249.rs new file mode 100644 index 00000000000..b6dcd848b8b --- /dev/null +++ b/tests/ui/traits/mut-trait-in-struct-8249.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/8249 +//@ run-pass +#![allow(dead_code)] + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +struct C<'a> { + foo: &'a mut (dyn A+'a), +} + +fn foo(a: &mut dyn A) { + C{ foo: a }; +} + +pub fn main() { +} diff --git a/tests/ui/traits/polymorphic-trait-creation-7673.rs b/tests/ui/traits/polymorphic-trait-creation-7673.rs new file mode 100644 index 00000000000..643818ffe1e --- /dev/null +++ b/tests/ui/traits/polymorphic-trait-creation-7673.rs @@ -0,0 +1,20 @@ +// https://github.com/rust-lang/rust/issues/7673 +//@ check-pass +#![allow(dead_code)] + +/* + +#7673 Polymorphically creating traits barely works + +*/ + +pub fn main() {} + +trait A { + fn dummy(&self) { } +} + +impl A for T {} + +fn owned2(a: Box) { a as Box; } +fn owned3(a: Box) { Box::new(a) as Box; } diff --git a/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs b/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs new file mode 100644 index 00000000000..59ea62c7690 --- /dev/null +++ b/tests/ui/traits/self-implements-kinds-in-default-methods-8171.rs @@ -0,0 +1,19 @@ +// https://github.com/rust-lang/rust/issues/8171 +//@ check-pass +#![allow(dead_code)] + +/* + +#8171 Self is not recognised as implementing kinds in default method implementations + +*/ + +fn require_send(_: T){} + +trait TragicallySelfIsNotSend: Send + Sized { + fn x(self) { + require_send(self); + } +} + +pub fn main(){} diff --git a/tests/ui/traits/trait-implementation-and-usage-7563.rs b/tests/ui/traits/trait-implementation-and-usage-7563.rs new file mode 100644 index 00000000000..8cfc7a14ffe --- /dev/null +++ b/tests/ui/traits/trait-implementation-and-usage-7563.rs @@ -0,0 +1,29 @@ +// https://github.com/rust-lang/rust/issues/7563 +//@ run-pass +#![allow(dead_code)] +trait IDummy { + fn do_nothing(&self); +} + +#[derive(Debug)] +struct A { a: isize } +#[derive(Debug)] +struct B<'a> { b: isize, pa: &'a A } + + impl IDummy for A { + fn do_nothing(&self) { + println!("A::do_nothing() is called"); + } + } + +impl<'a> B<'a> { + fn get_pa(&self) -> &'a dyn IDummy { self.pa as &'a dyn IDummy } +} + +pub fn main() { + let sa = A { a: 100 }; + let sb = B { b: 200, pa: &sa }; + + println!("sa is {:?}", sa); + println!("sb is {:?}", sb); +} diff --git a/tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs new file mode 100644 index 00000000000..005c676ed39 --- /dev/null +++ b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.rs @@ -0,0 +1,6 @@ +// https://github.com/rust-lang/rust/issues/8767 +impl B { //~ ERROR cannot find type `B` in this scope +} + +fn main() { +} diff --git a/tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr new file mode 100644 index 00000000000..0e37391a00f --- /dev/null +++ b/tests/ui/typeck/impl-for-nonexistent-type-error-8767.stderr @@ -0,0 +1,9 @@ +error[E0412]: cannot find type `B` in this scope + --> $DIR/impl-for-nonexistent-type-error-8767.rs:2:6 + | +LL | impl B { + | ^ not found in this scope + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0412`. -- cgit 1.4.1-3-g733a5 From f5e43d5ee31f0740a96479b4ffa2dcff009c226f Mon Sep 17 00:00:00 2001 From: lcnr Date: Thu, 5 Jun 2025 15:22:25 +0200 Subject: nll-relate: improve hr opaque types support --- .../rustc_borrowck/src/type_check/relate_tys.rs | 9 +++++++-- compiler/rustc_infer/src/infer/mod.rs | 22 +++++++++++++++------- .../type-alias-impl-trait/higher_kinded_params3.rs | 3 +-- .../higher_kinded_params3.stderr | 11 ++++------- tests/ui/type-alias-impl-trait/hkl_forbidden3.rs | 2 +- .../ui/type-alias-impl-trait/hkl_forbidden3.stderr | 11 ++++------- 6 files changed, 32 insertions(+), 26 deletions(-) (limited to 'tests') diff --git a/compiler/rustc_borrowck/src/type_check/relate_tys.rs b/compiler/rustc_borrowck/src/type_check/relate_tys.rs index 84ca9bad2c1..7ac2dff12f7 100644 --- a/compiler/rustc_borrowck/src/type_check/relate_tys.rs +++ b/compiler/rustc_borrowck/src/type_check/relate_tys.rs @@ -124,8 +124,13 @@ impl<'a, 'b, 'tcx> NllTypeRelating<'a, 'b, 'tcx> { // by using `ty_vid rel B` and then finally and end by equating `ty_vid` to // the opaque. let mut enable_subtyping = |ty, opaque_is_expected| { - let ty_vid = infcx.next_ty_var_id_in_universe(self.span(), ty::UniverseIndex::ROOT); - + // We create the fresh inference variable in the highest universe. + // In theory we could limit it to the highest universe in the args of + // the opaque but that isn't really worth the effort. + // + // We'll make sure that the opaque type can actually name everything + // in its hidden type later on. + let ty_vid = infcx.next_ty_vid(self.span()); let variance = if opaque_is_expected { self.ambient_variance } else { diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 82d4856df39..9ff06bda89b 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -782,22 +782,30 @@ impl<'tcx> InferCtxt<'tcx> { self.inner.borrow_mut().type_variables().num_vars() } - pub fn next_ty_var(&self, span: Span) -> Ty<'tcx> { - self.next_ty_var_with_origin(TypeVariableOrigin { span, param_def_id: None }) + pub fn next_ty_vid(&self, span: Span) -> TyVid { + self.next_ty_vid_with_origin(TypeVariableOrigin { span, param_def_id: None }) } - pub fn next_ty_var_with_origin(&self, origin: TypeVariableOrigin) -> Ty<'tcx> { - let vid = self.inner.borrow_mut().type_variables().new_var(self.universe(), origin); - Ty::new_var(self.tcx, vid) + pub fn next_ty_vid_with_origin(&self, origin: TypeVariableOrigin) -> TyVid { + self.inner.borrow_mut().type_variables().new_var(self.universe(), origin) } - pub fn next_ty_var_id_in_universe(&self, span: Span, universe: ty::UniverseIndex) -> TyVid { + pub fn next_ty_vid_in_universe(&self, span: Span, universe: ty::UniverseIndex) -> TyVid { let origin = TypeVariableOrigin { span, param_def_id: None }; self.inner.borrow_mut().type_variables().new_var(universe, origin) } + pub fn next_ty_var(&self, span: Span) -> Ty<'tcx> { + self.next_ty_var_with_origin(TypeVariableOrigin { span, param_def_id: None }) + } + + pub fn next_ty_var_with_origin(&self, origin: TypeVariableOrigin) -> Ty<'tcx> { + let vid = self.next_ty_vid_with_origin(origin); + Ty::new_var(self.tcx, vid) + } + pub fn next_ty_var_in_universe(&self, span: Span, universe: ty::UniverseIndex) -> Ty<'tcx> { - let vid = self.next_ty_var_id_in_universe(span, universe); + let vid = self.next_ty_vid_in_universe(span, universe); Ty::new_var(self.tcx, vid) } diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs index 4fb2e60b5c5..04208faddde 100644 --- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.rs @@ -24,8 +24,7 @@ type Successors<'a> = impl std::fmt::Debug + 'a; impl Terminator { #[define_opaque(Successors, Tait)] fn successors(&self, mut f: for<'x> fn(&'x ()) -> <&'x A as B>::C) -> Successors<'_> { - f = g; - //~^ ERROR mismatched types + f = g; //~ ERROR expected generic lifetime parameter, found `'x` } } diff --git a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr index 558792987f3..8e6778bdd0b 100644 --- a/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr +++ b/tests/ui/type-alias-impl-trait/higher_kinded_params3.stderr @@ -1,15 +1,12 @@ -error[E0308]: mismatched types +error[E0792]: expected generic lifetime parameter, found `'x` --> $DIR/higher_kinded_params3.rs:27:9 | LL | type Tait<'a> = impl std::fmt::Debug + 'a; - | ------------------------- the expected opaque type + | -- this generic parameter must be used with a generic lifetime parameter ... LL | f = g; - | ^^^^^ one type is more general than the other - | - = note: expected fn pointer `for<'x> fn(&'x ()) -> Tait<'x>` - found fn pointer `for<'a> fn(&'a ()) -> &'a ()` + | ^^^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0792`. diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs index c7f04dc07bb..ba75b114a11 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.rs @@ -8,7 +8,7 @@ fn foo<'a>(x: &'a ()) -> &'a () { #[define_opaque(Opaque)] fn test() -> for<'a> fn(&'a ()) -> Opaque<'a> { - foo //~ ERROR: mismatched types + foo //~ ERROR: expected generic lifetime parameter, found `'a` } fn main() {} diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr index b8c04185a7d..d699059e397 100644 --- a/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr +++ b/tests/ui/type-alias-impl-trait/hkl_forbidden3.stderr @@ -1,15 +1,12 @@ -error[E0308]: mismatched types +error[E0792]: expected generic lifetime parameter, found `'a` --> $DIR/hkl_forbidden3.rs:11:5 | LL | type Opaque<'a> = impl Sized + 'a; - | --------------- the expected opaque type + | -- this generic parameter must be used with a generic lifetime parameter ... LL | foo - | ^^^ one type is more general than the other - | - = note: expected fn pointer `for<'a> fn(&'a ()) -> Opaque<'a>` - found fn pointer `for<'a> fn(&'a ()) -> &'a ()` + | ^^^ error: aborting due to 1 previous error -For more information about this error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0792`. -- cgit 1.4.1-3-g733a5