diff --git a/compiler/rustc_const_eval/src/const_eval/error.rs b/compiler/rustc_const_eval/src/const_eval/error.rs index 61e8e433d5178..c48b33e29eb6d 100644 --- a/compiler/rustc_const_eval/src/const_eval/error.rs +++ b/compiler/rustc_const_eval/src/const_eval/error.rs @@ -1,6 +1,6 @@ use std::{fmt, mem}; -use rustc_errors::Diag; +use rustc_errors::{Diag, E0080}; use rustc_middle::mir::AssertKind; use rustc_middle::mir::interpret::{ AllocId, Provenance, ReportedErrorInfo, UndefinedBehaviorInfo, UnsupportedOpInfo, @@ -8,7 +8,7 @@ use rustc_middle::mir::interpret::{ use rustc_middle::query::TyCtxtAt; use rustc_middle::ty::ConstInt; use rustc_middle::ty::layout::LayoutError; -use rustc_span::{Span, Symbol}; +use rustc_span::{DUMMY_SP, Span, Symbol}; use super::CompileTimeMachine; use crate::errors::{self, FrameNote}; @@ -164,36 +164,30 @@ pub fn get_span_and_frames<'tcx>( /// This will use the `mk` function for adding more information to the error. /// You can use it to add a stacktrace of current execution according to /// `get_span_and_frames` or just give context on where the const eval error happened. -pub(super) fn report<'tcx, C, F>( +pub(super) fn report<'tcx>( ecx: &InterpCx<'tcx, CompileTimeMachine<'tcx>>, error: InterpErrorKind<'tcx>, - span: Span, - get_span_and_frames: C, - mk: F, -) -> ErrorHandled -where - C: FnOnce() -> (Span, Vec), - F: FnOnce(&mut Diag<'_>, Span, Vec), -{ + mk: impl FnOnce(&mut Diag<'_>, Span, Vec), +) -> ErrorHandled { let tcx = ecx.tcx.tcx; // Special handling for certain errors match error { // Don't emit a new diagnostic for these errors, they are already reported elsewhere or // should remain silent. - err_inval!(AlreadyReported(info)) => ErrorHandled::Reported(info, span), + err_inval!(AlreadyReported(info)) => ErrorHandled::Reported(info, DUMMY_SP), err_inval!(Layout(LayoutError::TooGeneric(_))) | err_inval!(TooGeneric) => { - ErrorHandled::TooGeneric(span) + ErrorHandled::TooGeneric(DUMMY_SP) } err_inval!(Layout(LayoutError::ReferencesError(guar))) => { // This can occur in infallible promoteds e.g. when a non-existent type or field is // encountered. - ErrorHandled::Reported(ReportedErrorInfo::allowed_in_infallible(guar), span) + ErrorHandled::Reported(ReportedErrorInfo::allowed_in_infallible(guar), DUMMY_SP) } // Report remaining errors. _ => { - let (our_span, frames) = get_span_and_frames(); - let span = span.substitute_dummy(our_span); - let mut err = tcx.dcx().struct_span_err(our_span, error.to_string()); + let (span, frames) = super::get_span_and_frames(ecx.tcx, ecx.stack()); + let mut err = tcx.dcx().struct_span_err(span, error.to_string()); + err.code(E0080); if matches!( error, InterpErrorKind::UndefinedBehavior(UndefinedBehaviorInfo::ValidationError { diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 7d71536e0cfec..ccfdf571fb27c 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -2,7 +2,6 @@ use std::sync::atomic::Ordering::Relaxed; use either::{Left, Right}; use rustc_abi::{self as abi, BackendRepr}; -use rustc_errors::{E0080, msg}; use rustc_hir::def::DefKind; use rustc_middle::mir::interpret::{AllocId, ErrorHandled, InterpErrorInfo, ReportedErrorInfo}; use rustc_middle::mir::{self, ConstAlloc, ConstValue}; @@ -11,8 +10,8 @@ use rustc_middle::ty::layout::{HasTypingEnv, TyAndLayout}; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::{bug, throw_inval}; +use rustc_span::Span; use rustc_span::def_id::LocalDefId; -use rustc_span::{DUMMY_SP, Span}; use tracing::{debug, instrument, trace}; use super::{CanAccessMutGlobal, CompileTimeInterpCx, CompileTimeMachine}; @@ -458,32 +457,20 @@ fn report_eval_error<'tcx>( let (error, backtrace) = error.into_parts(); backtrace.print_backtrace(); - super::report( - ecx, - error, - DUMMY_SP, - || super::get_span_and_frames(ecx.tcx, ecx.stack()), - |diag, span, frames| { - let num_frames = frames.len(); - // FIXME(oli-obk): figure out how to use structured diagnostics again. - diag.code(E0080); - diag.span_label( - span, - msg!( - "evaluation of `{$instance}` failed {$num_frames -> - [0] here - *[other] inside this call - }" - ), - ); - for frame in frames { - diag.subdiagnostic(frame); - } - // Add after the frame rendering above, as it adds its own `instance` args. - diag.arg("instance", with_no_trimmed_paths!(cid.instance.to_string())); - diag.arg("num_frames", num_frames); - }, - ) + super::report(ecx, error, |diag, span, frames| { + let num_frames = frames.len(); + diag.span_label( + span, + format!( + "evaluation of `{instance}` failed {where_}", + instance = with_no_trimmed_paths!(cid.instance.to_string()), + where_ = if num_frames == 0 { "here" } else { "inside this call" }, + ), + ); + for frame in frames { + diag.subdiagnostic(frame); + } + }) } #[inline(never)] @@ -506,20 +493,10 @@ fn report_validation_error<'tcx>( let raw_bytes = errors::RawBytesNote { size: info.size.bytes(), align: info.align.bytes(), bytes }; - crate::const_eval::report( - ecx, - error, - DUMMY_SP, - || crate::const_eval::get_span_and_frames(ecx.tcx, ecx.stack()), - move |diag, span, frames| { - // FIXME(oli-obk): figure out how to use structured diagnostics again. - diag.code(E0080); - diag.span_label(span, "it is undefined behavior to use this value"); - diag.note("the rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior."); - for frame in frames { - diag.subdiagnostic(frame); - } - diag.subdiagnostic(raw_bytes); - }, - ) + crate::const_eval::report(ecx, error, move |diag, span, frames| { + diag.span_label(span, "it is undefined behavior to use this value"); + diag.note("the rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior."); + assert!(frames.is_empty()); // we just report validation errors for the final const here + diag.subdiagnostic(raw_bytes); + }) } diff --git a/compiler/rustc_const_eval/src/interpret/call.rs b/compiler/rustc_const_eval/src/interpret/call.rs index 802aa9ef4645a..0ac9f3025d48c 100644 --- a/compiler/rustc_const_eval/src/interpret/call.rs +++ b/compiler/rustc_const_eval/src/interpret/call.rs @@ -60,7 +60,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { } /// Helper function for argument untupling. - pub(super) fn fn_arg_field( + fn fn_arg_project_field( &self, arg: &FnArg<'tcx, M::Provenance>, field: FieldIdx, @@ -655,12 +655,17 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { if caller_abi == ExternAbi::RustCall && !args.is_empty() { // Untuple let (untuple_arg, args) = args.split_last().unwrap(); + let ty::Tuple(untuple_fields) = untuple_arg.layout().ty.kind() else { + span_bug!(self.cur_span(), "untuple argument must be a tuple") + }; trace!("init_fn_call: Will pass last argument by untupling"); Cow::from( args.iter() + // The regular arguments. .map(|a| interp_ok(a.clone())) - .chain((0..untuple_arg.layout().fields.count()).map(|i| { - self.fn_arg_field(untuple_arg, FieldIdx::from_usize(i)) + // The fields of the untupled argument. + .chain((0..untuple_fields.len()).map(|i| { + self.fn_arg_project_field(untuple_arg, FieldIdx::from_usize(i)) })) .collect::>>()?, ) diff --git a/compiler/rustc_data_structures/src/obligation_forest/mod.rs b/compiler/rustc_data_structures/src/obligation_forest/mod.rs index 2c62034c6e87e..83cfa027cc3df 100644 --- a/compiler/rustc_data_structures/src/obligation_forest/mod.rs +++ b/compiler/rustc_data_structures/src/obligation_forest/mod.rs @@ -702,7 +702,7 @@ impl ObligationForest { self.apply_rewrites(&node_rewrites); } - node_rewrites.truncate(0); + node_rewrites.clear(); self.reused_node_vec = node_rewrites; } diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 3198bbe0bbc67..c5b3d7065fa92 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -1177,15 +1177,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let is_method = mode == Mode::MethodCall; let item_kind = if is_method { "method" - } else if rcvr_ty.is_enum() { - "variant or associated item" + } else if rcvr_ty.is_enum() || rcvr_ty.is_fresh_ty() { + "variant, associated function, or constant" } else { - match (item_ident.as_str().chars().next(), rcvr_ty.is_fresh_ty()) { - (Some(name), false) if name.is_lowercase() => "function or associated item", - (Some(_), false) => "associated item", - (Some(_), true) | (None, false) => "variant or associated item", - (None, true) => "variant", - } + "associated function or constant" }; if let Err(guar) = self.report_failed_method_call_on_numerical_infer_var( diff --git a/compiler/rustc_incremental/src/persist/load.rs b/compiler/rustc_incremental/src/persist/load.rs index 8e27c335b1174..c0466a4b5211c 100644 --- a/compiler/rustc_incremental/src/persist/load.rs +++ b/compiler/rustc_incremental/src/persist/load.rs @@ -38,19 +38,8 @@ pub enum LoadResult { impl LoadResult { /// Accesses the data returned in [`LoadResult::Ok`]. pub fn open(self, sess: &Session) -> T { - // Check for errors when using `-Zassert-incremental-state` - match (sess.opts.assert_incr_state, &self) { - (Some(IncrementalStateAssertion::NotLoaded), LoadResult::Ok { .. }) => { - sess.dcx().emit_fatal(errors::AssertNotLoaded); - } - ( - Some(IncrementalStateAssertion::Loaded), - LoadResult::LoadDepGraph(..) | LoadResult::DataOutOfDate, - ) => { - sess.dcx().emit_fatal(errors::AssertLoaded); - } - _ => {} - }; + // Emit a fatal error if `-Zassert-incr-state` is present and unsatisfied. + maybe_assert_incr_state(sess, &self); match self { LoadResult::LoadDepGraph(path, err) => { @@ -188,6 +177,32 @@ pub fn load_query_result_cache(sess: &Session) -> Option { } } +/// Emits a fatal error if the assertion in `-Zassert-incr-state` doesn't match +/// the outcome of trying to load previous-session state. +fn maybe_assert_incr_state(sess: &Session, load_result: &LoadResult) { + // Return immediately if there's nothing to assert. + let Some(assertion) = sess.opts.unstable_opts.assert_incr_state else { return }; + + // Match exhaustively to make sure we don't miss any cases. + let loaded = match load_result { + LoadResult::Ok { .. } => true, + LoadResult::DataOutOfDate | LoadResult::LoadDepGraph(..) => false, + }; + + match assertion { + IncrementalStateAssertion::Loaded => { + if !loaded { + sess.dcx().emit_fatal(errors::AssertLoaded); + } + } + IncrementalStateAssertion::NotLoaded => { + if loaded { + sess.dcx().emit_fatal(errors::AssertNotLoaded) + } + } + } +} + /// Setups the dependency graph by loading an existing graph from disk and set up streaming of a /// new graph to an incremental session directory. pub fn setup_dep_graph( diff --git a/compiler/rustc_interface/src/tests.rs b/compiler/rustc_interface/src/tests.rs index f9d583bdf18c7..417cde119c21f 100644 --- a/compiler/rustc_interface/src/tests.rs +++ b/compiler/rustc_interface/src/tests.rs @@ -12,12 +12,12 @@ use rustc_hir::attrs::{CollapseMacroDebuginfo, NativeLibKind}; use rustc_session::config::{ AnnotateMoves, AutoDiff, BranchProtection, CFGuard, Cfg, CoverageLevel, CoverageOptions, DebugInfo, DumpMonoStatsFormat, ErrorOutputType, ExternEntry, ExternLocation, Externs, - FmtDebug, FunctionReturn, InliningThreshold, Input, InstrumentCoverage, InstrumentXRay, - LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, MirIncludeSpans, NextSolverConfig, - Offload, Options, OutFileName, OutputType, OutputTypes, PAuthKey, PacRet, Passes, - PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, SwitchWithOptPath, - SymbolManglingVersion, WasiExecModel, build_configuration, build_session_options, - rustc_optgroups, + FmtDebug, FunctionReturn, IncrementalStateAssertion, InliningThreshold, Input, + InstrumentCoverage, InstrumentXRay, LinkSelfContained, LinkerPluginLto, LocationDetail, LtoCli, + MirIncludeSpans, NextSolverConfig, Offload, Options, OutFileName, OutputType, OutputTypes, + PAuthKey, PacRet, Passes, PatchableFunctionEntry, Polonius, ProcMacroExecutionStrategy, Strip, + SwitchWithOptPath, SymbolManglingVersion, WasiExecModel, build_configuration, + build_session_options, rustc_optgroups, }; use rustc_session::lint::Level; use rustc_session::search_paths::SearchPath; @@ -686,7 +686,7 @@ fn test_unstable_options_tracking_hash() { // Make sure that changing an [UNTRACKED] option leaves the hash unchanged. // tidy-alphabetical-start - untracked!(assert_incr_state, Some(String::from("loaded"))); + untracked!(assert_incr_state, Some(IncrementalStateAssertion::Loaded)); untracked!(codegen_source_order, true); untracked!(deduplicate_diagnostics, false); untracked!(dump_dep_graph, true); diff --git a/compiler/rustc_middle/src/dep_graph/graph.rs b/compiler/rustc_middle/src/dep_graph/graph.rs index 444d02521148c..4e789d702ce03 100644 --- a/compiler/rustc_middle/src/dep_graph/graph.rs +++ b/compiler/rustc_middle/src/dep_graph/graph.rs @@ -18,7 +18,7 @@ use rustc_macros::{Decodable, Encodable}; use rustc_serialize::opaque::{FileEncodeResult, FileEncoder}; use rustc_session::Session; use rustc_span::Symbol; -use tracing::{debug, instrument}; +use tracing::instrument; #[cfg(debug_assertions)] use {super::debug::EdgeFilter, std::env}; @@ -924,118 +924,71 @@ impl DepGraphData { } } - #[instrument(skip(self, tcx, parent_dep_node_index, frame), level = "debug")] - fn try_mark_parent_green<'tcx>( + /// Try to mark a dep-node which existed in the previous compilation session as green. + #[instrument(skip(self, tcx, prev_dep_node_index, frame), level = "debug")] + fn try_mark_previous_green<'tcx>( &self, tcx: TyCtxt<'tcx>, - parent_dep_node_index: SerializedDepNodeIndex, - frame: &MarkFrame<'_>, - ) -> Option<()> { - let get_dep_dep_node = || self.previous.index_to_node(parent_dep_node_index); - - match self.colors.get(parent_dep_node_index) { - DepNodeColor::Green(_) => { - // This dependency has been marked as green before, we are - // still fine and can continue with checking the other - // dependencies. - // - // This path is extremely hot. We don't want to get the - // `dep_dep_node` unless it's necessary. Hence the - // `get_dep_dep_node` closure. - debug!("dependency {:?} was immediately green", get_dep_dep_node()); - return Some(()); - } - DepNodeColor::Red => { - // We found a dependency the value of which has changed - // compared to the previous compilation session. We cannot - // mark the DepNode as green and also don't need to bother - // with checking any of the other dependencies. - debug!("dependency {:?} was immediately red", get_dep_dep_node()); - return None; - } - DepNodeColor::Unknown => {} - } + prev_dep_node_index: SerializedDepNodeIndex, + frame: Option<&MarkFrame<'_>>, + ) -> Option { + let frame = MarkFrame { index: prev_dep_node_index, parent: frame }; - let dep_dep_node = get_dep_dep_node(); + // We never try to mark eval_always nodes as green + debug_assert!(!tcx.is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind)); - // We don't know the state of this dependency. If it isn't - // an eval_always node, let's try to mark it green recursively. - if !tcx.is_eval_always(dep_dep_node.kind) { - debug!( - "state of dependency {:?} ({}) is unknown, trying to mark it green", - dep_dep_node, dep_dep_node.key_fingerprint, - ); + for parent_dep_node_index in self.previous.edge_targets_from(prev_dep_node_index) { + match self.colors.get(parent_dep_node_index) { + // This dependency has been marked as green before, we are still ok and can + // continue checking the remaining dependencies. + DepNodeColor::Green(_) => continue, - let node_index = self.try_mark_previous_green(tcx, parent_dep_node_index, Some(frame)); + // This dependency's result is different to the previous compilation session. We + // cannot mark this dep_node as green, so stop checking. + DepNodeColor::Red => return None, - if node_index.is_some() { - debug!("managed to MARK dependency {dep_dep_node:?} as green"); - return Some(()); + // We still need to determine this dependency's colour. + DepNodeColor::Unknown => {} } - } - // We failed to mark it green, so we try to force the query. - debug!("trying to force dependency {dep_dep_node:?}"); - if !tcx.try_force_from_dep_node(*dep_dep_node, parent_dep_node_index, frame) { - // The DepNode could not be forced. - debug!("dependency {dep_dep_node:?} could not be forced"); - return None; - } + let parent_dep_node = self.previous.index_to_node(parent_dep_node_index); - match self.colors.get(parent_dep_node_index) { - DepNodeColor::Green(_) => { - debug!("managed to FORCE dependency {dep_dep_node:?} to green"); - return Some(()); + // If this dependency isn't eval_always, try to mark it green recursively. + if !tcx.is_eval_always(parent_dep_node.kind) + && self.try_mark_previous_green(tcx, parent_dep_node_index, Some(&frame)).is_some() + { + continue; } - DepNodeColor::Red => { - debug!("dependency {dep_dep_node:?} was red after forcing"); + + // We failed to mark it green, so we try to force the query. + if !tcx.try_force_from_dep_node(*parent_dep_node, parent_dep_node_index, &frame) { return None; } - DepNodeColor::Unknown => {} - } - if let None = tcx.dcx().has_errors_or_delayed_bugs() { - panic!("try_mark_previous_green() - Forcing the DepNode should have set its color") - } - - // If the query we just forced has resulted in - // some kind of compilation error, we cannot rely on - // the dep-node color having been properly updated. - // This means that the query system has reached an - // invalid state. We let the compiler continue (by - // returning `None`) so it can emit error messages - // and wind down, but rely on the fact that this - // invalid state will not be persisted to the - // incremental compilation cache because of - // compilation errors being present. - debug!("dependency {dep_dep_node:?} resulted in compilation error"); - return None; - } - - /// Try to mark a dep-node which existed in the previous compilation session as green. - #[instrument(skip(self, tcx, prev_dep_node_index, frame), level = "debug")] - fn try_mark_previous_green<'tcx>( - &self, - tcx: TyCtxt<'tcx>, - prev_dep_node_index: SerializedDepNodeIndex, - frame: Option<&MarkFrame<'_>>, - ) -> Option { - let frame = MarkFrame { index: prev_dep_node_index, parent: frame }; - - // We never try to mark eval_always nodes as green - debug_assert!(!tcx.is_eval_always(self.previous.index_to_node(prev_dep_node_index).kind)); + match self.colors.get(parent_dep_node_index) { + DepNodeColor::Green(_) => continue, + DepNodeColor::Red => return None, + DepNodeColor::Unknown => {} + } - let prev_deps = self.previous.edge_targets_from(prev_dep_node_index); + if tcx.dcx().has_errors_or_delayed_bugs().is_none() { + panic!("try_mark_previous_green() - forcing failed to set a color"); + } - for dep_dep_node_index in prev_deps { - self.try_mark_parent_green(tcx, dep_dep_node_index, &frame)?; + // If the query we just forced has resulted in some kind of compilation error, we + // cannot rely on the dep-node color having been properly updated. This means that the + // query system has reached an invalid state. We let the compiler continue (by + // returning `None`) so it can emit error messages and wind down, but rely on the fact + // that this invalid state will not be persisted to the incremental compilation cache + // because of compilation errors being present. + return None; } // If we got here without hitting a `return` that means that all // dependencies of this DepNode could be marked as green. Therefore we // can also mark this DepNode as green. - // There may be multiple threads trying to mark the same dep node green concurrently + // There may be multiple threads trying to mark the same dep node green concurrently. // We allocating an entry for the node in the current dependency graph and // adding all the appropriate edges imported from the previous graph. @@ -1044,12 +997,8 @@ impl DepGraphData { let dep_node_index = self.promote_node_and_deps_to_current(prev_dep_node_index)?; // ... and finally storing a "Green" entry in the color map. - // Multiple threads can all write the same color here + // Multiple threads can all write the same color here. - debug!( - "successfully marked {:?} as green", - self.previous.index_to_node(prev_dep_node_index) - ); Some(dep_node_index) } } diff --git a/compiler/rustc_mir_transform/src/large_enums.rs b/compiler/rustc_mir_transform/src/large_enums.rs index b9a6206452677..2f812358fcfe9 100644 --- a/compiler/rustc_mir_transform/src/large_enums.rs +++ b/compiler/rustc_mir_transform/src/large_enums.rs @@ -1,4 +1,5 @@ use rustc_abi::{HasDataLayout, Size, TagEncoding, Variants}; +use rustc_const_eval::interpret::{Scalar, alloc_range}; use rustc_data_structures::fx::FxHashMap; use rustc_middle::mir::interpret::AllocId; use rustc_middle::mir::*; @@ -23,7 +24,8 @@ use crate::patch::MirPatch; /// /// In summary, what this does is at runtime determine which enum variant is active, /// and instead of copying all the bytes of the largest possible variant, -/// copy only the bytes for the currently active variant. +/// copy only the bytes for the currently active variant. The number of bytes to copy is determined +/// by a lookup table: a discriminant-indexed array indicating the size of each variant. pub(super) struct EnumSizeOpt { pub(crate) discrepancy: u64, } @@ -202,45 +204,23 @@ impl EnumSizeOpt { return Some((*adt_def, num_discrs, *alloc_id)); } + // Construct an in-memory array mapping discriminant idx to variant size. let data_layout = tcx.data_layout(); - let ptr_sized_int = data_layout.ptr_sized_integer(); - let target_bytes = ptr_sized_int.size().bytes() as usize; - let mut data = vec![0; target_bytes * num_discrs]; - - // We use a macro because `$bytes` can be u32 or u64. - macro_rules! encode_store { - ($curr_idx: expr, $endian: expr, $bytes: expr) => { - let bytes = match $endian { - rustc_abi::Endian::Little => $bytes.to_le_bytes(), - rustc_abi::Endian::Big => $bytes.to_be_bytes(), - }; - for (i, b) in bytes.into_iter().enumerate() { - data[$curr_idx + i] = b; - } - }; - } - - for (var_idx, layout) in variants.iter_enumerated() { - let curr_idx = - target_bytes * adt_def.discriminant_for_variant(tcx, var_idx).val as usize; - let sz = layout.size; - match ptr_sized_int { - rustc_abi::Integer::I32 => { - encode_store!(curr_idx, data_layout.endian, sz.bytes() as u32); - } - rustc_abi::Integer::I64 => { - encode_store!(curr_idx, data_layout.endian, sz.bytes()); - } - _ => unreachable!(), - }; - } - let alloc = interpret::Allocation::from_bytes( - data, + let ptr_size = data_layout.pointer_size(); + let mut alloc = interpret::Allocation::from_bytes( + vec![0; ptr_size.bytes_usize() * num_discrs], tcx.data_layout.ptr_sized_integer().align(&tcx.data_layout).abi, - Mutability::Not, + Mutability::Mut, (), ); + for (var_idx, layout) in variants.iter_enumerated() { + let curr_idx = ptr_size * adt_def.discriminant_for_variant(tcx, var_idx).val as u64; + let val = Scalar::from_target_usize(layout.size.bytes(), &tcx); + alloc.write_scalar(&tcx, alloc_range(curr_idx, val.size()), val).unwrap(); + } + alloc.mutability = Mutability::Not; let alloc = tcx.reserve_and_set_memory_alloc(tcx.mk_const_alloc(alloc)); + Some((*adt_def, num_discrs, *alloc_cache.entry(ty).or_insert(alloc))) } } diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index a21d19b6d3a20..bdcbb1eb42a88 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1749,6 +1749,9 @@ impl<'a> Parser<'a> { } else { // Parsing a pattern of the form `(box) (ref) (mut) fieldname`. let is_box = self.eat_keyword(exp!(Box)); + if is_box { + self.psess.gated_spans.gate(sym::box_patterns, self.prev_token.span); + } let boxed_span = self.token.span; let mutability = self.parse_mutability(); let by_ref = self.parse_byref(); diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 0677ca0fddbaa..42d5a50df699f 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1405,7 +1405,6 @@ impl Default for Options { }; Options { - assert_incr_state: None, crate_types: Vec::new(), optimize: OptLevel::No, debuginfo: DebugInfo::None, @@ -2287,20 +2286,6 @@ fn select_debuginfo(matches: &getopts::Matches, cg: &CodegenOptions) -> DebugInf if max_g > max_c { DebugInfo::Full } else { cg.debuginfo } } -fn parse_assert_incr_state( - early_dcx: &EarlyDiagCtxt, - opt_assertion: &Option, -) -> Option { - match opt_assertion { - Some(s) if s.as_str() == "loaded" => Some(IncrementalStateAssertion::Loaded), - Some(s) if s.as_str() == "not-loaded" => Some(IncrementalStateAssertion::NotLoaded), - Some(s) => { - early_dcx.early_fatal(format!("unexpected incremental state assertion value: {s}")) - } - None => None, - } -} - pub fn parse_externs( early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches, @@ -2506,8 +2491,6 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M let incremental = cg.incremental.as_ref().map(PathBuf::from); - let assert_incr_state = parse_assert_incr_state(early_dcx, &unstable_opts.assert_incr_state); - if cg.profile_generate.enabled() && cg.profile_use.is_some() { early_dcx.early_fatal("options `-C profile-generate` and `-C profile-use` are exclusive"); } @@ -2759,7 +2742,6 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M let verbose = matches.opt_present("verbose") || unstable_opts.verbose_internals; Options { - assert_incr_state, crate_types, optimize: opt_level, debuginfo, diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 7abaae1c17606..8771dbd05c494 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -419,7 +419,6 @@ top_level_options!( /// If `Some`, enable incremental compilation, using the given /// directory to store intermediate results. incremental: Option [UNTRACKED], - assert_incr_state: Option [UNTRACKED], /// Set based on the result of the `Config::track_state` callback /// for custom drivers to invalidate the incremental cache. #[rustc_lint_opt_deny_field_access("should only be used via `Config::track_state`")] @@ -889,6 +888,7 @@ mod desc { pub(crate) const parse_mir_include_spans: &str = "either a boolean (`yes`, `no`, `on`, `off`, etc), or `nll` (default: `nll`)"; pub(crate) const parse_align: &str = "a number that is a power of 2 between 1 and 2^29"; + pub(crate) const parse_assert_incr_state: &str = "one of: `loaded`, `not-loaded`"; } pub mod parse { @@ -2061,6 +2061,18 @@ pub mod parse { true } + + pub(crate) fn parse_assert_incr_state( + slot: &mut Option, + v: Option<&str>, + ) -> bool { + *slot = match v { + Some("loaded") => Some(IncrementalStateAssertion::Loaded), + Some("not-loaded") => Some(IncrementalStateAssertion::NotLoaded), + _ => return false, + }; + true + } } options! { @@ -2230,7 +2242,7 @@ options! { annotate_moves: AnnotateMoves = (AnnotateMoves::Disabled, parse_annotate_moves, [TRACKED], "emit debug info for compiler-generated move and copy operations \ to make them visible in profilers. Can be a boolean or a size limit in bytes (default: disabled)"), - assert_incr_state: Option = (None, parse_opt_string, [UNTRACKED], + assert_incr_state: Option = (None, parse_assert_incr_state, [UNTRACKED], "assert that the incremental cache is in given state: \ either `loaded` or `not-loaded`."), assume_incomplete_release: bool = (false, parse_bool, [TRACKED], diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 71a8e081146e9..a575630a05035 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -349,7 +349,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> { &mut self, pending_obligation: &mut PendingPredicateObligation<'tcx>, ) -> ProcessResult, FulfillmentErrorCode<'tcx>> { - pending_obligation.stalled_on.truncate(0); + pending_obligation.stalled_on.clear(); let obligation = &mut pending_obligation.obligation; diff --git a/library/std/src/io/buffered/tests.rs b/library/std/src/io/buffered/tests.rs index 6ad4158b92904..e335d8afdc483 100644 --- a/library/std/src/io/buffered/tests.rs +++ b/library/std/src/io/buffered/tests.rs @@ -391,16 +391,16 @@ fn test_read_until() { let mut v = Vec::new(); reader.read_until(0, &mut v).unwrap(); assert_eq!(v, [0]); - v.truncate(0); + v.clear(); reader.read_until(2, &mut v).unwrap(); assert_eq!(v, [1, 2]); - v.truncate(0); + v.clear(); reader.read_until(1, &mut v).unwrap(); assert_eq!(v, [1]); - v.truncate(0); + v.clear(); reader.read_until(8, &mut v).unwrap(); assert_eq!(v, [0]); - v.truncate(0); + v.clear(); reader.read_until(9, &mut v).unwrap(); assert_eq!(v, []); } @@ -429,13 +429,13 @@ fn test_read_line() { let mut s = String::new(); reader.read_line(&mut s).unwrap(); assert_eq!(s, "a\n"); - s.truncate(0); + s.clear(); reader.read_line(&mut s).unwrap(); assert_eq!(s, "b\n"); - s.truncate(0); + s.clear(); reader.read_line(&mut s).unwrap(); assert_eq!(s, "c"); - s.truncate(0); + s.clear(); reader.read_line(&mut s).unwrap(); assert_eq!(s, ""); } diff --git a/library/std/src/io/tests.rs b/library/std/src/io/tests.rs index b22988d4a8a9d..a56359dae765b 100644 --- a/library/std/src/io/tests.rs +++ b/library/std/src/io/tests.rs @@ -17,10 +17,10 @@ fn read_until() { let mut v = Vec::new(); assert_eq!(buf.read_until(b'3', &mut v).unwrap(), 3); assert_eq!(v, b"123"); - v.truncate(0); + v.clear(); assert_eq!(buf.read_until(b'3', &mut v).unwrap(), 1); assert_eq!(v, b"3"); - v.truncate(0); + v.clear(); assert_eq!(buf.read_until(b'3', &mut v).unwrap(), 0); assert_eq!(v, []); } @@ -80,10 +80,10 @@ fn read_line() { let mut v = String::new(); assert_eq!(buf.read_line(&mut v).unwrap(), 3); assert_eq!(v, "12\n"); - v.truncate(0); + v.clear(); assert_eq!(buf.read_line(&mut v).unwrap(), 1); assert_eq!(v, "\n"); - v.truncate(0); + v.clear(); assert_eq!(buf.read_line(&mut v).unwrap(), 0); assert_eq!(v, ""); } diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 0b2b5f7e58f46..c0a77ef0b05c0 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -1364,7 +1364,7 @@ impl PathBuf { // absolute `path` replaces `self` if need_clear { - self.inner.truncate(0); + self.inner.clear(); // verbatim paths need . and .. removed } else if comps.prefix_verbatim() && !path.inner.is_empty() { diff --git a/library/std/src/sys/args/uefi.rs b/library/std/src/sys/args/uefi.rs index 02dada382eff0..edf6f6873f8d2 100644 --- a/library/std/src/sys/args/uefi.rs +++ b/library/std/src/sys/args/uefi.rs @@ -93,7 +93,7 @@ fn parse_lp_cmd_line(code_units: &[u16]) -> Option> { // If not `in_quotes`, a space or tab ends the argument. SPACE if !in_quotes => { ret_val.push(OsString::from(&cur[..])); - cur.truncate(0); + cur.clear(); // Skip whitespace. while code_units_iter.next_if_eq(&Ok(SPACE)).is_some() {} diff --git a/library/std/src/sys/args/windows.rs b/library/std/src/sys/args/windows.rs index 3c6995e372784..bd26db7fea553 100644 --- a/library/std/src/sys/args/windows.rs +++ b/library/std/src/sys/args/windows.rs @@ -106,7 +106,7 @@ fn parse_lp_cmd_line<'a, F: Fn() -> OsString>( // If not `in_quotes`, a space or tab ends the argument. SPACE | TAB if !in_quotes => { ret_val.push(OsString::from_wide(&cur[..])); - cur.truncate(0); + cur.clear(); // Skip whitespace. code_units.advance_while(|w| w == SPACE || w == TAB); diff --git a/library/std/src/sys/sync/rwlock/no_threads.rs b/library/std/src/sys/sync/rwlock/no_threads.rs index 573d0d602dbd6..6b919bde80bb5 100644 --- a/library/std/src/sys/sync/rwlock/no_threads.rs +++ b/library/std/src/sys/sync/rwlock/no_threads.rs @@ -37,8 +37,10 @@ impl RwLock { #[inline] pub fn write(&self) { - if self.mode.replace(-1) != 0 { - rtabort!("rwlock locked for reading") + if self.mode.get() == 0 { + self.mode.set(-1); + } else { + rtabort!("rwlock locked for reading"); } } diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile index a62f98b21d225..31d009b6969a0 100644 --- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile @@ -57,10 +57,9 @@ RUN ln -s /usr/lib32/libgcc_s.so.1 /musl-i686/lib/ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV RUST_CONFIGURE_ARGS \ - --musl-root-i586=/musl-i586 \ +ENV RUST_CONFIGURE_ARGS="--musl-root-i586=/musl-i586 \ --musl-root-i686=/musl-i686 \ - --disable-docs + --disable-docs" # Newer binutils broke things on some vms/distros (i.e., linking against # unknown relocs disabled by the following flag), so we need to go out of our @@ -73,6 +72,5 @@ ENV CFLAGS_i586_unknown_linux_musl=-Wa,-mrelax-relocations=no ENV TARGETS=i586-unknown-linux-gnu,i686-unknown-linux-musl -ENV SCRIPT \ - python3 ../x.py --stage 2 test --host='' --target $TARGETS && \ - python3 ../x.py dist --host='' --target $TARGETS,i586-unknown-linux-musl +ENV SCRIPT="python3 ../x.py --stage 2 test --host= --target $TARGETS && \ + python3 ../x.py dist --host= --target $TARGETS,i586-unknown-linux-musl" diff --git a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile index ea5b208a7c1d3..8165258cc49f2 100644 --- a/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile +++ b/src/ci/docker/host-x86_64/dist-i686-linux/Dockerfile @@ -70,15 +70,14 @@ RUN sh /scripts/sccache.sh ENV HOSTS=i686-unknown-linux-gnu -ENV RUST_CONFIGURE_ARGS \ - --enable-full-tools \ +ENV RUST_CONFIGURE_ARGS="--enable-full-tools \ --enable-sanitizers \ --enable-profiler \ --set target.i686-unknown-linux-gnu.linker=clang \ --build=i686-unknown-linux-gnu \ --set llvm.ninja=false \ - --set rust.jemalloc -ENV SCRIPT python3 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS + --set rust.jemalloc" +ENV SCRIPT="python3 ../x.py dist --build $HOSTS --host $HOSTS --target $HOSTS" ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang # This was added when we switched from gcc to clang. It's not clear why this is @@ -89,17 +88,17 @@ ENV CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=clang # misaligned stack access. # # Added in #50200 there's some more logs there -ENV CFLAGS -mstackrealign +ENV CFLAGS="-mstackrealign" # When we build cargo in this container, we don't want it to use the system # libcurl, instead it should compile its own. -ENV LIBCURL_NO_PKG_CONFIG 1 +ENV LIBCURL_NO_PKG_CONFIG="1" # There was a bad interaction between "old" 32-bit binaries on current 64-bit # kernels with selinux enabled, where ASLR mmap would sometimes choose a low # address and then block it for being below `vm.mmap_min_addr` -> `EACCES`. # This is probably a kernel bug, but setting `ulimit -Hs` works around it. # See also `src/ci/run.sh` where this takes effect. -ENV SET_HARD_RLIMIT_STACK 1 +ENV SET_HARD_RLIMIT_STACK="1" -ENV DIST_REQUIRE_ALL_TOOLS 1 +ENV DIST_REQUIRE_ALL_TOOLS="1" diff --git a/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile b/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile index be3df9d4036db..fdc296aa891f6 100644 --- a/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile +++ b/src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile @@ -22,8 +22,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests +ENV RUST_CONFIGURE_ARGS="--build=i686-unknown-linux-gnu --disable-optimize-tests" COPY scripts/stage_2_test_set1.sh /scripts/ COPY scripts/stage_2_test_set2.sh /scripts/ COPY scripts/i686-gnu-nopt-2.sh /scripts/ -ENV SCRIPT "Must specify DOCKER_SCRIPT for this image" +ENV SCRIPT="Must specify DOCKER_SCRIPT for this image" diff --git a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile index 00cd24b89db8a..d0f3d1afa4dc6 100644 --- a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile +++ b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile @@ -23,7 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh -ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu +ENV RUST_CONFIGURE_ARGS="--build=i686-unknown-linux-gnu" COPY scripts/stage_2_test_set1.sh /scripts/ COPY scripts/stage_2_test_set2.sh /scripts/ -ENV SCRIPT "Must specify DOCKER_SCRIPT for this image" +ENV SCRIPT="Must specify DOCKER_SCRIPT for this image" diff --git a/src/tools/compiletest/src/runtest/debuginfo.rs b/src/tools/compiletest/src/runtest/debuginfo.rs index 6534902e0940e..8dfac2e3abb2e 100644 --- a/src/tools/compiletest/src/runtest/debuginfo.rs +++ b/src/tools/compiletest/src/runtest/debuginfo.rs @@ -191,7 +191,7 @@ impl TestCx<'_> { let mut stdout = BufReader::new(adb.stdout.take().unwrap()); let mut line = String::new(); loop { - line.truncate(0); + line.clear(); stdout.read_line(&mut line).unwrap(); if line.starts_with("Listening on port 5039") { break; diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs index b4d30289cabb9..cc8edfcdac61f 100644 --- a/src/tools/remote-test-server/src/main.rs +++ b/src/tools/remote-test-server/src/main.rs @@ -211,12 +211,12 @@ fn handle_run(socket: TcpStream, work: &Path, tmp: &Path, lock: &Mutex<()>, conf let mut args = Vec::new(); while t!(reader.read_until(0, &mut arg)) > 1 { args.push(t!(str::from_utf8(&arg[..arg.len() - 1])).to_string()); - arg.truncate(0); + arg.clear(); } // Next we'll get a bunch of env vars in pairs delimited by 0s as well let mut env = Vec::new(); - arg.truncate(0); + arg.clear(); while t!(reader.read_until(0, &mut arg)) > 1 { let key_len = arg.len() - 1; let val_len = t!(reader.read_until(0, &mut arg)) - 1; @@ -227,7 +227,7 @@ fn handle_run(socket: TcpStream, work: &Path, tmp: &Path, lock: &Mutex<()>, conf let val = t!(str::from_utf8(val)).to_string(); env.push((key, val)); } - arg.truncate(0); + arg.clear(); } // The section of code from here down to where we drop the lock is going to diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff index cf850351c1d62..adc723a726823 100644 --- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff +++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.32bit.diff @@ -64,7 +64,9 @@ StorageDead(_1); return; } - } ++ } + -+ ALLOC0 (size: 8, align: 4) { .. } ++ ALLOC0 (size: 8, align: 4) { ++ 02 00 00 00 05 20 00 00 │ ..... .. + } diff --git a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff index dc5ea1add0005..c92bf7bb0a09d 100644 --- a/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff +++ b/tests/mir-opt/enum_opt.cand.EnumSizeOpt.64bit.diff @@ -64,7 +64,9 @@ StorageDead(_1); return; } - } ++ } + -+ ALLOC0 (size: 16, align: 8) { .. } ++ ALLOC0 (size: 16, align: 8) { ++ 02 00 00 00 00 00 00 00 05 20 00 00 00 00 00 00 │ ......... ...... + } diff --git a/tests/mir-opt/enum_opt.rs b/tests/mir-opt/enum_opt.rs index 81390567c2bb4..45a3edca90ed3 100644 --- a/tests/mir-opt/enum_opt.rs +++ b/tests/mir-opt/enum_opt.rs @@ -1,7 +1,8 @@ // skip-filecheck //@ test-mir-pass: EnumSizeOpt // EMIT_MIR_FOR_EACH_BIT_WIDTH -//@ compile-flags: -Zunsound-mir-opts -Zdump-mir-exclude-alloc-bytes +//@ compile-flags: -Zunsound-mir-opts +//@ ignore-endian-big // Tests that an enum with a variant with no data gets correctly transformed. pub enum NoData { diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff index 3cd2e74a0db6f..f6dbf8bb25860 100644 --- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff +++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.32bit.diff @@ -64,7 +64,9 @@ StorageDead(_1); return; } - } ++ } + -+ ALLOC0 (size: 8, align: 4) { .. } ++ ALLOC0 (size: 8, align: 4) { ++ 05 20 00 00 01 00 00 00 │ . ...... + } diff --git a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff index 10b0ec5a63fa4..7900c3ce37754 100644 --- a/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff +++ b/tests/mir-opt/enum_opt.unin.EnumSizeOpt.64bit.diff @@ -64,7 +64,9 @@ StorageDead(_1); return; } - } ++ } + -+ ALLOC0 (size: 16, align: 8) { .. } ++ ALLOC0 (size: 16, align: 8) { ++ 05 20 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ . .............. + } diff --git a/tests/run-make/crate-loading/multiple-dep-versions.stderr b/tests/run-make/crate-loading/multiple-dep-versions.stderr index a683fdd389c6b..42dc805b85ddb 100644 --- a/tests/run-make/crate-loading/multiple-dep-versions.stderr +++ b/tests/run-make/crate-loading/multiple-dep-versions.stderr @@ -46,11 +46,11 @@ LL | pub trait Trait { | --------------- this is the trait that was imported = help: you can use `cargo tree` to explore your dependency tree -error[E0599]: no function or associated item named `bar` found for struct `dep_2_reexport::Type` in the current scope +error[E0599]: no associated function or constant named `bar` found for struct `dep_2_reexport::Type` in the current scope --> replaced | LL | Type::bar(); - | ^^^ function or associated item not found in `dep_2_reexport::Type` + | ^^^ associated function or constant not found in `dep_2_reexport::Type` | note: there are multiple different versions of crate `dependency` in the dependency graph --> replaced diff --git a/tests/rustdoc-ui/track-diagnostics.rs b/tests/rustdoc-ui/track-diagnostics.rs index 6a5d1b53b3c7f..f7f0c9849ef03 100644 --- a/tests/rustdoc-ui/track-diagnostics.rs +++ b/tests/rustdoc-ui/track-diagnostics.rs @@ -3,6 +3,7 @@ // Normalize the emitted location so this doesn't need // updating everytime someone adds or removes a line. //@ normalize-stderr: ".rs:\d+:\d+" -> ".rs:LL:CC" +//@ normalize-stderr: "/rustc(?:-dev)?/[a-z0-9.]+/" -> "" struct A; struct B; diff --git a/tests/ui/associated-consts/associated-const-no-item.rs b/tests/ui/associated-consts/associated-const-no-item.rs index 024d14e21b5fd..116f1aab3f48e 100644 --- a/tests/ui/associated-consts/associated-const-no-item.rs +++ b/tests/ui/associated-consts/associated-const-no-item.rs @@ -3,7 +3,7 @@ trait Foo { } const X: i32 = ::ID; -//~^ ERROR no associated item named `ID` found +//~^ ERROR no associated function or constant named `ID` found fn main() { assert_eq!(1, X); diff --git a/tests/ui/associated-consts/associated-const-no-item.stderr b/tests/ui/associated-consts/associated-const-no-item.stderr index 7ded05b7b48e1..40cd7791399b0 100644 --- a/tests/ui/associated-consts/associated-const-no-item.stderr +++ b/tests/ui/associated-consts/associated-const-no-item.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `ID` found for type `i32` in the current scope +error[E0599]: no associated function or constant named `ID` found for type `i32` in the current scope --> $DIR/associated-const-no-item.rs:5:23 | LL | const X: i32 = ::ID; - | ^^ associated item not found in `i32` + | ^^ associated function or constant not found in `i32` | = help: items from traits can only be used if the trait is implemented and in scope note: `Foo` defines an item `ID`, perhaps you need to implement it diff --git a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.rs b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.rs index a33d4928f0145..0de982142df44 100644 --- a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.rs +++ b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.rs @@ -7,5 +7,5 @@ impl Fail { fn main() { Fail::<()>::C - //~^ ERROR no associated item named `C` found for struct `Fail<()>` in the current scope + //~^ ERROR no associated function or constant named `C` found for struct `Fail<()>` in the current scope } diff --git a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.stderr b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.stderr index b17682eb83e4c..0ddde320f95ee 100644 --- a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.stderr +++ b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg.stderr @@ -7,16 +7,16 @@ LL | struct Fail; = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead -error[E0599]: no associated item named `C` found for struct `Fail<()>` in the current scope +error[E0599]: no associated function or constant named `C` found for struct `Fail<()>` in the current scope --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg.rs:9:17 | LL | struct Fail; - | -------------- associated item `C` not found for this struct + | -------------- associated function or constant `C` not found for this struct ... LL | Fail::<()>::C - | ^ associated item not found in `Fail<()>` + | ^ associated function or constant not found in `Fail<()>` | - = note: the associated item was found for `Fail` + = note: the associated function or constant was found for `Fail` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.rs b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.rs index d891b7bd62b4a..e4f2bbf24e6b4 100644 --- a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.rs +++ b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.rs @@ -14,5 +14,5 @@ impl Fail { fn main() { Fail::::C //~^ ERROR: type mismatch - //~| ERROR no associated item named `C` found for struct `Fail` in the current scope + //~| ERROR no associated function or constant named `C` found for struct `Fail` in the current scope } diff --git a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr index d0c7df9de43bd..04568b874b5ec 100644 --- a/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr +++ b/tests/ui/associated-consts/wrong-projection-self-ty-invalid-bivariant-arg2.stderr @@ -15,16 +15,16 @@ note: required by a bound in `Fail` LL | struct Fail, U>(T); | ^^^^^^^^^ required by this bound in `Fail` -error[E0599]: no associated item named `C` found for struct `Fail` in the current scope +error[E0599]: no associated function or constant named `C` found for struct `Fail` in the current scope --> $DIR/wrong-projection-self-ty-invalid-bivariant-arg2.rs:15:23 | LL | struct Fail, U>(T); - | ---------------------------------- associated item `C` not found for this struct + | ---------------------------------- associated function or constant `C` not found for this struct ... LL | Fail::::C - | ^ associated item not found in `Fail` + | ^ associated function or constant not found in `Fail` | - = note: the associated item was found for `Fail` + = note: the associated function or constant was found for `Fail` error: aborting due to 2 previous errors diff --git a/tests/ui/associated-item/associated-item-enum.rs b/tests/ui/associated-item/associated-item-enum.rs index 30ba258155bb9..3a5c058f5ec20 100644 --- a/tests/ui/associated-item/associated-item-enum.rs +++ b/tests/ui/associated-item/associated-item-enum.rs @@ -14,7 +14,7 @@ impl Trait for Enum { } fn main() { - Enum::mispellable(); //~ ERROR no variant or associated item - Enum::mispellable_trait(); //~ ERROR no variant or associated item - Enum::MISPELLABLE; //~ ERROR no variant or associated item + Enum::mispellable(); //~ ERROR no variant, associated function, or constant + Enum::mispellable_trait(); //~ ERROR no variant, associated function, or constant + Enum::MISPELLABLE; //~ ERROR no variant, associated function, or constant } diff --git a/tests/ui/associated-item/associated-item-enum.stderr b/tests/ui/associated-item/associated-item-enum.stderr index c3ce7c34d0569..6cb53e5cd0cce 100644 --- a/tests/ui/associated-item/associated-item-enum.stderr +++ b/tests/ui/associated-item/associated-item-enum.stderr @@ -1,39 +1,39 @@ -error[E0599]: no variant or associated item named `mispellable` found for enum `Enum` in the current scope +error[E0599]: no variant, associated function, or constant named `mispellable` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:17:11 | LL | enum Enum { Variant } - | --------- variant or associated item `mispellable` not found for this enum + | --------- variant, associated function, or constant `mispellable` not found for this enum ... LL | Enum::mispellable(); - | ^^^^^^^^^^^ variant or associated item not found in `Enum` + | ^^^^^^^^^^^ variant, associated function, or constant not found in `Enum` | help: there is an associated function `misspellable` with a similar name | LL | Enum::misspellable(); | + -error[E0599]: no variant or associated item named `mispellable_trait` found for enum `Enum` in the current scope +error[E0599]: no variant, associated function, or constant named `mispellable_trait` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:18:11 | LL | enum Enum { Variant } - | --------- variant or associated item `mispellable_trait` not found for this enum + | --------- variant, associated function, or constant `mispellable_trait` not found for this enum ... LL | Enum::mispellable_trait(); - | ^^^^^^^^^^^^^^^^^ variant or associated item not found in `Enum` + | ^^^^^^^^^^^^^^^^^ variant, associated function, or constant not found in `Enum` | help: there is an associated function `misspellable_trait` with a similar name | LL | Enum::misspellable_trait(); | + -error[E0599]: no variant or associated item named `MISPELLABLE` found for enum `Enum` in the current scope +error[E0599]: no variant, associated function, or constant named `MISPELLABLE` found for enum `Enum` in the current scope --> $DIR/associated-item-enum.rs:19:11 | LL | enum Enum { Variant } - | --------- variant or associated item `MISPELLABLE` not found for this enum + | --------- variant, associated function, or constant `MISPELLABLE` not found for this enum ... LL | Enum::MISPELLABLE; - | ^^^^^^^^^^^ variant or associated item not found in `Enum` + | ^^^^^^^^^^^ variant, associated function, or constant not found in `Enum` | help: there is an associated constant `MISSPELLABLE` with a similar name | diff --git a/tests/ui/associated-types/associated-type-as-value-in-impl-issue-142797.rs b/tests/ui/associated-types/associated-type-as-value-in-impl-issue-142797.rs new file mode 100644 index 0000000000000..f588d6d0a43f7 --- /dev/null +++ b/tests/ui/associated-types/associated-type-as-value-in-impl-issue-142797.rs @@ -0,0 +1,21 @@ +// issue: + +struct SomeStruct { + some_field: u64, +} + +trait SomeTrait { + type SomeType; + fn foo(); +} + +impl SomeTrait for bool { + type SomeType = SomeStruct; + + fn foo() { + let ss = Self::SomeType; + //~^ ERROR no associated function or constant named `SomeType` found for type `bool` in the current scope + } +} + +fn main() {} diff --git a/tests/ui/associated-types/associated-type-as-value-in-impl-issue-142797.stderr b/tests/ui/associated-types/associated-type-as-value-in-impl-issue-142797.stderr new file mode 100644 index 0000000000000..83b915c2684e4 --- /dev/null +++ b/tests/ui/associated-types/associated-type-as-value-in-impl-issue-142797.stderr @@ -0,0 +1,9 @@ +error[E0599]: no associated function or constant named `SomeType` found for type `bool` in the current scope + --> $DIR/associated-type-as-value-in-impl-issue-142797.rs:16:24 + | +LL | let ss = Self::SomeType; + | ^^^^^^^^ associated function or constant not found in `bool` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0599`. diff --git a/tests/ui/associated-types/associated-type-as-value.rs b/tests/ui/associated-types/associated-type-as-value.rs index ddc8082366584..7fefc48eb3378 100644 --- a/tests/ui/associated-types/associated-type-as-value.rs +++ b/tests/ui/associated-types/associated-type-as-value.rs @@ -1,7 +1,7 @@ //! regression test for fn foo() { - T::Item; //~ ERROR no associated item named `Item` found + T::Item; //~ ERROR no associated function or constant named `Item` found } fn main() { } diff --git a/tests/ui/associated-types/associated-type-as-value.stderr b/tests/ui/associated-types/associated-type-as-value.stderr index c553582b39077..0015ebe767dd5 100644 --- a/tests/ui/associated-types/associated-type-as-value.stderr +++ b/tests/ui/associated-types/associated-type-as-value.stderr @@ -1,10 +1,10 @@ -error[E0599]: no associated item named `Item` found for type parameter `T` in the current scope +error[E0599]: no associated function or constant named `Item` found for type parameter `T` in the current scope --> $DIR/associated-type-as-value.rs:4:8 | LL | fn foo() { - | - associated item `Item` not found for this type parameter + | - associated function or constant `Item` not found for this type parameter LL | T::Item; - | ^^^^ associated item not found in `T` + | ^^^^ associated function or constant not found in `T` error: aborting due to 1 previous error diff --git a/tests/ui/associated-types/associated-type-call.fixed b/tests/ui/associated-types/associated-type-call.fixed index d450b3b82c96f..f2df7807b31ec 100644 --- a/tests/ui/associated-types/associated-type-call.fixed +++ b/tests/ui/associated-types/associated-type-call.fixed @@ -15,7 +15,7 @@ impl Trait for () { fn f() { T(); - //~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope + //~^ ERROR no associated function or constant named `Assoc` found for unit type `()` in the current scope } } diff --git a/tests/ui/associated-types/associated-type-call.rs b/tests/ui/associated-types/associated-type-call.rs index ffe540c329eb9..88d017219b78b 100644 --- a/tests/ui/associated-types/associated-type-call.rs +++ b/tests/ui/associated-types/associated-type-call.rs @@ -15,7 +15,7 @@ impl Trait for () { fn f() { ::Assoc(); - //~^ ERROR no associated item named `Assoc` found for unit type `()` in the current scope + //~^ ERROR no associated function or constant named `Assoc` found for unit type `()` in the current scope } } diff --git a/tests/ui/associated-types/associated-type-call.stderr b/tests/ui/associated-types/associated-type-call.stderr index eaef775e30406..94cfc24465620 100644 --- a/tests/ui/associated-types/associated-type-call.stderr +++ b/tests/ui/associated-types/associated-type-call.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `Assoc` found for unit type `()` in the current scope +error[E0599]: no associated function or constant named `Assoc` found for unit type `()` in the current scope --> $DIR/associated-type-call.rs:17:17 | LL | ::Assoc(); - | ^^^^^ associated item not found in `()` + | ^^^^^ associated function or constant not found in `()` | help: to construct a value of type `T`, use the explicit path | diff --git a/tests/ui/associated-types/invalid-ctor.fixed b/tests/ui/associated-types/invalid-ctor.fixed index eba3820de0c1c..75980101f045b 100644 --- a/tests/ui/associated-types/invalid-ctor.fixed +++ b/tests/ui/associated-types/invalid-ctor.fixed @@ -15,7 +15,7 @@ impl Trait for () { fn mk() -> Self::Out { Constructor(1) - //~^ ERROR no associated item named `Out` found for unit type `()` + //~^ ERROR no associated function or constant named `Out` found for unit type `()` } } diff --git a/tests/ui/associated-types/invalid-ctor.rs b/tests/ui/associated-types/invalid-ctor.rs index 73335c065c2ae..82ec17df430fc 100644 --- a/tests/ui/associated-types/invalid-ctor.rs +++ b/tests/ui/associated-types/invalid-ctor.rs @@ -15,7 +15,7 @@ impl Trait for () { fn mk() -> Self::Out { Self::Out(1) - //~^ ERROR no associated item named `Out` found for unit type `()` + //~^ ERROR no associated function or constant named `Out` found for unit type `()` } } diff --git a/tests/ui/associated-types/invalid-ctor.stderr b/tests/ui/associated-types/invalid-ctor.stderr index 0b3bf316f60fa..50dc7188b6812 100644 --- a/tests/ui/associated-types/invalid-ctor.stderr +++ b/tests/ui/associated-types/invalid-ctor.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `Out` found for unit type `()` in the current scope +error[E0599]: no associated function or constant named `Out` found for unit type `()` in the current scope --> $DIR/invalid-ctor.rs:17:15 | LL | Self::Out(1) - | ^^^ associated item not found in `()` + | ^^^ associated function or constant not found in `()` | help: to construct a value of type `Constructor`, use the explicit path | diff --git a/tests/ui/associated-types/issue-43924.rs b/tests/ui/associated-types/issue-43924.rs index 63ebbddea76ff..dfc84611e8f60 100644 --- a/tests/ui/associated-types/issue-43924.rs +++ b/tests/ui/associated-types/issue-43924.rs @@ -13,5 +13,5 @@ impl Foo for () {} fn main() { assert_eq!(<() as Foo>::Out::default().to_string(), "false"); - //~^ ERROR no function or associated item named `default` found for trait object + //~^ ERROR no associated function or constant named `default` found for trait object } diff --git a/tests/ui/associated-types/issue-43924.stderr b/tests/ui/associated-types/issue-43924.stderr index 196ad85f084e2..5bf8ee730e618 100644 --- a/tests/ui/associated-types/issue-43924.stderr +++ b/tests/ui/associated-types/issue-43924.stderr @@ -10,11 +10,11 @@ note: required by a bound in `Foo::Out` LL | type Out: Default + ToString + ?Sized = dyn ToString; | ^^^^^^^ required by this bound in `Foo::Out` -error[E0599]: no function or associated item named `default` found for trait object `(dyn ToString + 'static)` in the current scope +error[E0599]: no associated function or constant named `default` found for trait object `(dyn ToString + 'static)` in the current scope --> $DIR/issue-43924.rs:15:39 | LL | assert_eq!(<() as Foo>::Out::default().to_string(), "false"); - | ^^^^^^^ function or associated item not found in `(dyn ToString + 'static)` + | ^^^^^^^ associated function or constant not found in `(dyn ToString + 'static)` error: aborting due to 2 previous errors diff --git a/tests/ui/attributes/rustc_confusables_assoc_fn.rs b/tests/ui/attributes/rustc_confusables_assoc_fn.rs index 5612ece0a8d95..6a93f7bb4385a 100644 --- a/tests/ui/attributes/rustc_confusables_assoc_fn.rs +++ b/tests/ui/attributes/rustc_confusables_assoc_fn.rs @@ -12,7 +12,7 @@ impl S { fn main() { S::bar(); - //~^ ERROR no function or associated item named `bar` + //~^ ERROR no associated function or constant named `bar` //~| HELP you might have meant to use `foo` let s = S; diff --git a/tests/ui/attributes/rustc_confusables_assoc_fn.stderr b/tests/ui/attributes/rustc_confusables_assoc_fn.stderr index 657ca8098b802..da5cf27632acb 100644 --- a/tests/ui/attributes/rustc_confusables_assoc_fn.stderr +++ b/tests/ui/attributes/rustc_confusables_assoc_fn.stderr @@ -1,11 +1,11 @@ -error[E0599]: no function or associated item named `bar` found for struct `S` in the current scope +error[E0599]: no associated function or constant named `bar` found for struct `S` in the current scope --> $DIR/rustc_confusables_assoc_fn.rs:14:8 | LL | struct S; - | -------- function or associated item `bar` not found for this struct + | -------- associated function or constant `bar` not found for this struct ... LL | S::bar(); - | ^^^ function or associated item not found in `S` + | ^^^ associated function or constant not found in `S` | help: you might have meant to use `foo` | diff --git a/tests/ui/auto-traits/pre-cfg.rs b/tests/ui/auto-traits/pre-cfg.rs deleted file mode 100644 index 4820a53535803..0000000000000 --- a/tests/ui/auto-traits/pre-cfg.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ check-pass - -#[cfg(false)] -auto trait Foo {} -//~^ WARN `auto` traits are unstable -//~| WARN unstable syntax can change at any point in the future, causing a hard error! - -fn main() {} diff --git a/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.rs b/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.rs index e364368b8a4cf..3f092d08274c5 100644 --- a/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.rs +++ b/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.rs @@ -15,5 +15,5 @@ impl Wrapper<{ bar() }> { fn main() { Wrapper::::call; - //~^ ERROR: the function or associated item `call` exists for struct `Wrapper`, + //~^ ERROR: the associated function or constant `call` exists for struct `Wrapper`, } diff --git a/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr b/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr index b13f76eabadbc..4d469deb00c01 100644 --- a/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr +++ b/tests/ui/const-generics/adt_const_params/non_valtreeable_const_arg-2.stderr @@ -15,14 +15,14 @@ error[E0741]: using function pointers as const generic parameters is forbidden LL | struct Wrapper; | ^^^^ -error[E0599]: the function or associated item `call` exists for struct `Wrapper`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `call` exists for struct `Wrapper`, but its trait bounds were not satisfied --> $DIR/non_valtreeable_const_arg-2.rs:17:26 | LL | struct Wrapper; - | ----------------------------- function or associated item `call` not found for this struct because it doesn't satisfy `Wrapper: Fn<_>` + | ----------------------------- associated function or constant `call` not found for this struct because it doesn't satisfy `Wrapper: Fn<_>` ... LL | Wrapper::::call; - | ^^^^ function or associated item cannot be called on `Wrapper` due to unsatisfied trait bounds + | ^^^^ associated function or constant cannot be called on `Wrapper` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `Wrapper: Fn<_>` diff --git a/tests/ui/const-generics/generic_const_exprs/issue-69654.rs b/tests/ui/const-generics/generic_const_exprs/issue-69654.rs index 9b36699bbf112..058f404df5783 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-69654.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-69654.rs @@ -15,5 +15,5 @@ where fn main() { Foo::foo(); - //~^ ERROR the function or associated item + //~^ ERROR the associated function or constant } diff --git a/tests/ui/const-generics/generic_const_exprs/issue-69654.stderr b/tests/ui/const-generics/generic_const_exprs/issue-69654.stderr index 7fa0d8c7dbaa9..9b5e556b94ee9 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-69654.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-69654.stderr @@ -11,14 +11,14 @@ help: you might have meant to write a const parameter here LL | impl Bar for [u8; T] {} | +++++ ++++++++++++ -error[E0599]: the function or associated item `foo` exists for struct `Foo<_>`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `foo` exists for struct `Foo<_>`, but its trait bounds were not satisfied --> $DIR/issue-69654.rs:17:10 | LL | struct Foo {} - | -------------------------- function or associated item `foo` not found for this struct + | -------------------------- associated function or constant `foo` not found for this struct ... LL | Foo::foo(); - | ^^^ function or associated item cannot be called on `Foo<_>` due to unsatisfied trait bounds + | ^^^ associated function or constant cannot be called on `Foo<_>` due to unsatisfied trait bounds | note: trait bound `[u8; _]: Bar<[(); _]>` was not satisfied --> $DIR/issue-69654.rs:11:14 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs index 0d392902be871..99decb368e1d0 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-80742.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.rs @@ -27,5 +27,5 @@ where fn main() { let dst = Inline::::new(0); //~^ ERROR the size for values of type `dyn Debug` cannot be known at compilation time - //~| ERROR the function or associated item `new` exists for struct `Inline` + //~| ERROR the associated function or constant `new` exists for struct `Inline` } diff --git a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr index ac1bfc8d7a1b9..bad736b45685c 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-80742.stderr @@ -15,14 +15,14 @@ help: consider relaxing the implicit `Sized` restriction LL | struct Inline | ++++++++ -error[E0599]: the function or associated item `new` exists for struct `Inline`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `new` exists for struct `Inline`, but its trait bounds were not satisfied --> $DIR/issue-80742.rs:28:36 | LL | struct Inline - | ---------------- function or associated item `new` not found for this struct + | ---------------- associated function or constant `new` not found for this struct ... LL | let dst = Inline::::new(0); - | ^^^ function or associated item cannot be called on `Inline` due to unsatisfied trait bounds + | ^^^ associated function or constant cannot be called on `Inline` due to unsatisfied trait bounds | note: trait bound `dyn Debug: Sized` was not satisfied --> $DIR/issue-80742.rs:18:6 diff --git a/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.rs b/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.rs index afb086a41305b..1e1ef0d73b458 100644 --- a/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.rs +++ b/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.rs @@ -17,5 +17,5 @@ where fn main() { let dst = Inline::::new(0); //~^ ERROR the size for values of type `dyn Debug` cannot be known at compilation time - //~| ERROR no function or associated item named `new` found for struct `Inline` + //~| ERROR no associated function or constant named `new` found for struct `Inline` } diff --git a/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.stderr b/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.stderr index bcc253ed96705..c73c2167dd754 100644 --- a/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.stderr +++ b/tests/ui/const-generics/generic_const_exprs/size_of-dyn-trait-3.stderr @@ -15,14 +15,14 @@ help: consider relaxing the implicit `Sized` restriction LL | struct Inline | ++++++++ -error[E0599]: no function or associated item named `new` found for struct `Inline` in the current scope +error[E0599]: no associated function or constant named `new` found for struct `Inline` in the current scope --> $DIR/size_of-dyn-trait-3.rs:18:36 | LL | struct Inline - | ---------------- function or associated item `new` not found for this struct + | ---------------- associated function or constant `new` not found for this struct ... LL | let dst = Inline::::new(0); - | ^^^ function or associated item not found in `Inline` + | ^^^ associated function or constant not found in `Inline` error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/invalid-path-in-const.rs b/tests/ui/const-generics/invalid-path-in-const.rs index 51eb860721190..a3c622aa5a968 100644 --- a/tests/ui/const-generics/invalid-path-in-const.rs +++ b/tests/ui/const-generics/invalid-path-in-const.rs @@ -1,4 +1,4 @@ fn main() { fn f(a: [u8; u32::DOESNOTEXIST]) {} - //~^ ERROR no associated item named `DOESNOTEXIST` found for type `u32` + //~^ ERROR no associated function or constant named `DOESNOTEXIST` found for type `u32` } diff --git a/tests/ui/const-generics/invalid-path-in-const.stderr b/tests/ui/const-generics/invalid-path-in-const.stderr index 31528ab856e61..83c90a24d70bd 100644 --- a/tests/ui/const-generics/invalid-path-in-const.stderr +++ b/tests/ui/const-generics/invalid-path-in-const.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `DOESNOTEXIST` found for type `u32` in the current scope +error[E0599]: no associated function or constant named `DOESNOTEXIST` found for type `u32` in the current scope --> $DIR/invalid-path-in-const.rs:2:23 | LL | fn f(a: [u8; u32::DOESNOTEXIST]) {} - | ^^^^^^^^^^^^ associated item not found in `u32` + | ^^^^^^^^^^^^ associated function or constant not found in `u32` error: aborting due to 1 previous error diff --git a/tests/ui/consts/const-needs_drop-monomorphic.rs b/tests/ui/consts/const-needs_drop-monomorphic.rs index 7402c680985b0..f68eb4bed6135 100644 --- a/tests/ui/consts/const-needs_drop-monomorphic.rs +++ b/tests/ui/consts/const-needs_drop-monomorphic.rs @@ -9,7 +9,7 @@ impl Bool { } fn f() { Bool::<{ std::mem::needs_drop::() }>::assert(); - //~^ ERROR no function or associated item named `assert` found + //~^ ERROR no associated function or constant named `assert` found //~| ERROR unconstrained generic constant } fn main() { diff --git a/tests/ui/consts/const-needs_drop-monomorphic.stderr b/tests/ui/consts/const-needs_drop-monomorphic.stderr index 17f197cdd5d2b..12ea559127ae0 100644 --- a/tests/ui/consts/const-needs_drop-monomorphic.stderr +++ b/tests/ui/consts/const-needs_drop-monomorphic.stderr @@ -9,14 +9,14 @@ help: try adding a `where` bound LL | fn f() where [(); { std::mem::needs_drop::() } as usize]: { | +++++++++++++++++++++++++++++++++++++++++++++++++++++ -error[E0599]: no function or associated item named `assert` found for struct `Bool<{ std::mem::needs_drop::() }>` in the current scope +error[E0599]: no associated function or constant named `assert` found for struct `Bool<{ std::mem::needs_drop::() }>` in the current scope --> $DIR/const-needs_drop-monomorphic.rs:11:46 | LL | struct Bool {} - | -------------------------- function or associated item `assert` not found for this struct + | -------------------------- associated function or constant `assert` not found for this struct ... LL | Bool::<{ std::mem::needs_drop::() }>::assert(); - | ^^^^^^ function or associated item cannot be called on `Bool<{ std::mem::needs_drop::() }>` due to unsatisfied trait bounds + | ^^^^^^ associated function or constant cannot be called on `Bool<{ std::mem::needs_drop::() }>` due to unsatisfied trait bounds error: aborting due to 2 previous errors diff --git a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.rs b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.rs index 0a7ec5ab5c1be..5d801f26de168 100644 --- a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.rs +++ b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.rs @@ -7,7 +7,7 @@ pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>); impl<'a> InvariantRef<'a, ()> { pub const NEW: Self = InvariantRef::new(&()); - //~^ ERROR: no function or associated item named `new` found + //~^ ERROR: no associated function or constant named `new` found } trait Trait { diff --git a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr index ae5d0e8fa2965..6cf844f29b06f 100644 --- a/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr +++ b/tests/ui/delegation/correct_body_owner_parent_found_in_diagnostics.stderr @@ -43,14 +43,14 @@ help: consider introducing lifetime `'a` here LL | impl<'a> Trait for Z { | ++++ -error[E0599]: no function or associated item named `new` found for struct `InvariantRef<'a, T>` in the current scope +error[E0599]: no associated function or constant named `new` found for struct `InvariantRef<'a, T>` in the current scope --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:9:41 | LL | pub struct InvariantRef<'a, T: ?Sized>(&'a T, PhantomData<&'a mut &'a T>); - | -------------------------------------- function or associated item `new` not found for this struct + | -------------------------------------- associated function or constant `new` not found for this struct ... LL | pub const NEW: Self = InvariantRef::new(&()); - | ^^^ function or associated item not found in `InvariantRef<'_, _>` + | ^^^ associated function or constant not found in `InvariantRef<'_, _>` error[E0277]: the trait bound `u8: Trait` is not satisfied --> $DIR/correct_body_owner_parent_found_in_diagnostics.rs:22:12 diff --git a/tests/ui/did_you_mean/bad-assoc-pat.rs b/tests/ui/did_you_mean/bad-assoc-pat.rs index 3f912f7ffc63e..911eeb0994e45 100644 --- a/tests/ui/did_you_mean/bad-assoc-pat.rs +++ b/tests/ui/did_you_mean/bad-assoc-pat.rs @@ -2,25 +2,25 @@ fn main() { match 0u8 { [u8]::AssocItem => {} //~^ ERROR missing angle brackets in associated item path - //~| ERROR no associated item named `AssocItem` found + //~| ERROR no associated function or constant named `AssocItem` found (u8, u8)::AssocItem => {} //~^ ERROR missing angle brackets in associated item path - //~| ERROR no associated item named `AssocItem` found + //~| ERROR no associated function or constant named `AssocItem` found _::AssocItem => {} //~^ ERROR missing angle brackets in associated item path - //~| ERROR no associated item named `AssocItem` found + //~| ERROR no associated function or constant named `AssocItem` found } match &0u8 { &(u8,)::AssocItem => {} //~^ ERROR missing angle brackets in associated item path - //~| ERROR no associated item named `AssocItem` found + //~| ERROR no associated function or constant named `AssocItem` found } } macro_rules! pat { ($ty: ty) => ($ty::AssocItem) //~^ ERROR missing angle brackets in associated item path - //~| ERROR no associated item named `AssocItem` found + //~| ERROR no associated function or constant named `AssocItem` found } macro_rules! ty { () => (u8) @@ -31,6 +31,6 @@ fn check_macros() { pat!(u8) => {} ty!()::AssocItem => {} //~^ ERROR missing angle brackets in associated item path - //~| ERROR no associated item named `AssocItem` found + //~| ERROR no associated function or constant named `AssocItem` found } } diff --git a/tests/ui/did_you_mean/bad-assoc-pat.stderr b/tests/ui/did_you_mean/bad-assoc-pat.stderr index 8bdeb8ffdd0a8..aff3d97eadaeb 100644 --- a/tests/ui/did_you_mean/bad-assoc-pat.stderr +++ b/tests/ui/did_you_mean/bad-assoc-pat.stderr @@ -68,46 +68,46 @@ help: types that don't start with an identifier need to be surrounded with angle LL | ($ty: ty) => (<$ty>::AssocItem) | + + -error[E0599]: no associated item named `AssocItem` found for slice `[u8]` in the current scope +error[E0599]: no associated function or constant named `AssocItem` found for slice `[u8]` in the current scope --> $DIR/bad-assoc-pat.rs:3:15 | LL | [u8]::AssocItem => {} - | ^^^^^^^^^ associated item not found in `[u8]` + | ^^^^^^^^^ associated function or constant not found in `[u8]` -error[E0599]: no associated item named `AssocItem` found for tuple `(u8, u8)` in the current scope +error[E0599]: no associated function or constant named `AssocItem` found for tuple `(u8, u8)` in the current scope --> $DIR/bad-assoc-pat.rs:6:19 | LL | (u8, u8)::AssocItem => {} - | ^^^^^^^^^ associated item not found in `(u8, u8)` + | ^^^^^^^^^ associated function or constant not found in `(u8, u8)` -error[E0599]: no associated item named `AssocItem` found for type `_` in the current scope +error[E0599]: no associated function or constant named `AssocItem` found for type `_` in the current scope --> $DIR/bad-assoc-pat.rs:9:12 | LL | _::AssocItem => {} - | ^^^^^^^^^ associated item not found in `_` + | ^^^^^^^^^ associated function or constant not found in `_` -error[E0599]: no associated item named `AssocItem` found for tuple `(u8,)` in the current scope +error[E0599]: no associated function or constant named `AssocItem` found for tuple `(u8,)` in the current scope --> $DIR/bad-assoc-pat.rs:14:17 | LL | &(u8,)::AssocItem => {} - | ^^^^^^^^^ associated item not found in `(u8,)` + | ^^^^^^^^^ associated function or constant not found in `(u8,)` -error[E0599]: no associated item named `AssocItem` found for type `u8` in the current scope +error[E0599]: no associated function or constant named `AssocItem` found for type `u8` in the current scope --> $DIR/bad-assoc-pat.rs:21:24 | LL | ($ty: ty) => ($ty::AssocItem) - | ^^^^^^^^^ associated item not found in `u8` + | ^^^^^^^^^ associated function or constant not found in `u8` ... LL | pat!(u8) => {} | -------- in this macro invocation | = note: this error originates in the macro `pat` (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0599]: no associated item named `AssocItem` found for type `u8` in the current scope +error[E0599]: no associated function or constant named `AssocItem` found for type `u8` in the current scope --> $DIR/bad-assoc-pat.rs:32:16 | LL | ty!()::AssocItem => {} - | ^^^^^^^^^ associated item not found in `u8` + | ^^^^^^^^^ associated function or constant not found in `u8` error: aborting due to 12 previous errors diff --git a/tests/ui/enum/enum-discriminant-missing-variant.rs b/tests/ui/enum/enum-discriminant-missing-variant.rs index 1bdbfb1fbcd42..45c2b37444345 100644 --- a/tests/ui/enum/enum-discriminant-missing-variant.rs +++ b/tests/ui/enum/enum-discriminant-missing-variant.rs @@ -1,6 +1,6 @@ //! regression test for issue pub enum SomeEnum { - B = SomeEnum::A, //~ ERROR no variant or associated item named `A` found + B = SomeEnum::A, //~ ERROR no variant, associated function, or constant named `A` found } fn main() {} diff --git a/tests/ui/enum/enum-discriminant-missing-variant.stderr b/tests/ui/enum/enum-discriminant-missing-variant.stderr index ef98a93e86f66..653a87a5ebd8b 100644 --- a/tests/ui/enum/enum-discriminant-missing-variant.stderr +++ b/tests/ui/enum/enum-discriminant-missing-variant.stderr @@ -1,10 +1,10 @@ -error[E0599]: no variant or associated item named `A` found for enum `SomeEnum` in the current scope +error[E0599]: no variant, associated function, or constant named `A` found for enum `SomeEnum` in the current scope --> $DIR/enum-discriminant-missing-variant.rs:3:19 | LL | pub enum SomeEnum { - | ----------------- variant or associated item `A` not found for this enum + | ----------------- variant, associated function, or constant `A` not found for this enum LL | B = SomeEnum::A, - | ^ variant or associated item not found in `SomeEnum` + | ^ variant, associated function, or constant not found in `SomeEnum` | help: there is a variant with a similar name | diff --git a/tests/ui/error-codes/E0599.stderr b/tests/ui/error-codes/E0599.stderr index 5c1c71d39f719..724bce4502b7e 100644 --- a/tests/ui/error-codes/E0599.stderr +++ b/tests/ui/error-codes/E0599.stderr @@ -1,11 +1,11 @@ -error[E0599]: no associated item named `NotEvenReal` found for struct `Foo` in the current scope +error[E0599]: no associated function or constant named `NotEvenReal` found for struct `Foo` in the current scope --> $DIR/E0599.rs:4:20 | LL | struct Foo; - | ---------- associated item `NotEvenReal` not found for this struct + | ---------- associated function or constant `NotEvenReal` not found for this struct ... LL | || if let Foo::NotEvenReal() = Foo {}; - | ^^^^^^^^^^^ associated item not found in `Foo` + | ^^^^^^^^^^^ associated function or constant not found in `Foo` error: aborting due to 1 previous error diff --git a/tests/ui/expr/issue-22933-2.rs b/tests/ui/expr/issue-22933-2.rs index dfd84b9a79d40..3f593cae6dfc9 100644 --- a/tests/ui/expr/issue-22933-2.rs +++ b/tests/ui/expr/issue-22933-2.rs @@ -2,7 +2,7 @@ enum Delicious { Pie = 0x1, Apple = 0x2, ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - //~^ ERROR no variant or associated item named `PIE` found + //~^ ERROR no variant, associated function, or constant named `PIE` found } fn main() {} diff --git a/tests/ui/expr/issue-22933-2.stderr b/tests/ui/expr/issue-22933-2.stderr index 07f095f643ee5..0b7416b77c048 100644 --- a/tests/ui/expr/issue-22933-2.stderr +++ b/tests/ui/expr/issue-22933-2.stderr @@ -1,11 +1,11 @@ -error[E0599]: no variant or associated item named `PIE` found for enum `Delicious` in the current scope +error[E0599]: no variant, associated function, or constant named `PIE` found for enum `Delicious` in the current scope --> $DIR/issue-22933-2.rs:4:55 | LL | enum Delicious { - | -------------- variant or associated item `PIE` not found for this enum + | -------------- variant, associated function, or constant `PIE` not found for this enum ... LL | ApplePie = Delicious::Apple as isize | Delicious::PIE as isize, - | ^^^ variant or associated item not found in `Delicious` + | ^^^ variant, associated function, or constant not found in `Delicious` | help: there is a variant with a similar name | diff --git a/tests/ui/feature-gates/feature-gate-box_patterns.rs b/tests/ui/feature-gates/feature-gate-box_patterns.rs index 8bec16a974e80..9ff6604c95206 100644 --- a/tests/ui/feature-gates/feature-gate-box_patterns.rs +++ b/tests/ui/feature-gates/feature-gate-box_patterns.rs @@ -1,4 +1,9 @@ fn main() { let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental - println!("x: {}", x); + let _: char = x; + + struct Packet { x: Box } + + let Packet { box x } = Packet { x: Box::new(0) }; //~ ERROR box pattern syntax is experimental + let _: i32 = x; } diff --git a/tests/ui/feature-gates/feature-gate-box_patterns.stderr b/tests/ui/feature-gates/feature-gate-box_patterns.stderr index fb61b2b1810a3..6f5ee20925eea 100644 --- a/tests/ui/feature-gates/feature-gate-box_patterns.stderr +++ b/tests/ui/feature-gates/feature-gate-box_patterns.stderr @@ -8,6 +8,16 @@ LL | let box x = Box::new('c'); = help: add `#![feature(box_patterns)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 1 previous error +error[E0658]: box pattern syntax is experimental + --> $DIR/feature-gate-box_patterns.rs:7:18 + | +LL | let Packet { box x } = Packet { x: Box::new(0) }; + | ^^^^^ + | + = note: see issue #29641 for more information + = help: add `#![feature(box_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/soft-feature-gate-auto_traits.rs b/tests/ui/feature-gates/soft-feature-gate-auto_traits.rs new file mode 100644 index 0000000000000..0ccbaf1e476a9 --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-auto_traits.rs @@ -0,0 +1,12 @@ +// For historical reasons, auto traits don't have a proper pre-expansion feature gate. +// We're now at least issuing a *warning* for those that only exist before macro expansion. +// FIXME(#154045): Turn their post-expansion feature gate into a proper pre-expansion one. +// As part of this, move these test cases into `feature-gate-auto-traits.rs`. +//@ check-pass + +#[cfg(false)] +auto trait Foo {} +//~^ WARN `auto` traits are unstable +//~| WARN unstable syntax can change at any point in the future + +fn main() {} diff --git a/tests/ui/auto-traits/pre-cfg.stderr b/tests/ui/feature-gates/soft-feature-gate-auto_traits.stderr similarity index 92% rename from tests/ui/auto-traits/pre-cfg.stderr rename to tests/ui/feature-gates/soft-feature-gate-auto_traits.stderr index 648f9464d61df..20811aadda929 100644 --- a/tests/ui/auto-traits/pre-cfg.stderr +++ b/tests/ui/feature-gates/soft-feature-gate-auto_traits.stderr @@ -1,5 +1,5 @@ warning: `auto` traits are unstable - --> $DIR/pre-cfg.rs:4:1 + --> $DIR/soft-feature-gate-auto_traits.rs:8:1 | LL | auto trait Foo {} | ^^^^ diff --git a/tests/ui/feature-gates/soft-feature-gate-box_patterns.rs b/tests/ui/feature-gates/soft-feature-gate-box_patterns.rs new file mode 100644 index 0000000000000..8ab0e80e6be31 --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-box_patterns.rs @@ -0,0 +1,17 @@ +// For historical reasons, box patterns don't have a proper pre-expansion feature gate. +// We're now at least issuing a *warning* for those that only exist before macro expansion. +// FIXME(#154045): Turn their post-expansion feature gate into a proper pre-expansion one. +// As part of this, move these test cases into `feature-gate-box_patterns.rs`. +//@ check-pass + +fn main() { + #[cfg(false)] + let box x; + //~^ WARN box pattern syntax is experimental + //~| WARN unstable syntax can change at any point in the future + + #[cfg(false)] + let Packet { box x }; + //~^ WARN box pattern syntax is experimental + //~| WARN unstable syntax can change at any point in the future +} diff --git a/tests/ui/feature-gates/soft-feature-gate-box_patterns.stderr b/tests/ui/feature-gates/soft-feature-gate-box_patterns.stderr new file mode 100644 index 0000000000000..a8399b5f01f88 --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-box_patterns.stderr @@ -0,0 +1,26 @@ +warning: box pattern syntax is experimental + --> $DIR/soft-feature-gate-box_patterns.rs:9:9 + | +LL | let box x; + | ^^^^^ + | + = note: see issue #29641 for more information + = help: add `#![feature(box_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: box pattern syntax is experimental + --> $DIR/soft-feature-gate-box_patterns.rs:14:18 + | +LL | let Packet { box x }; + | ^^^ + | + = note: see issue #29641 for more information + = help: add `#![feature(box_patterns)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 2 warnings emitted + diff --git a/tests/ui/feature-gates/soft-feature-gate-decl_macro.rs b/tests/ui/feature-gates/soft-feature-gate-decl_macro.rs new file mode 100644 index 0000000000000..7d2d48503797a --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-decl_macro.rs @@ -0,0 +1,17 @@ +// For historical reasons, decl macros 2.0 don't have a proper pre-expansion feature gate. +// We're now at least issuing a *warning* for those that only exist before macro expansion. +// FIXME(#154045): Turn their post-expansion feature gate into a proper pre-expansion one. +// As part of this, move these test cases into `feature-gate-decl_macro.rs`. +//@ check-pass + +#[cfg(false)] +macro make() {} +//~^ WARN `macro` is experimental +//~| WARN unstable syntax can change at any point in the future + +#[cfg(false)] +macro create { () => {} } +//~^ WARN `macro` is experimental +//~| WARN unstable syntax can change at any point in the future + +fn main() {} diff --git a/tests/ui/feature-gates/soft-feature-gate-decl_macro.stderr b/tests/ui/feature-gates/soft-feature-gate-decl_macro.stderr new file mode 100644 index 0000000000000..71521626f69bc --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-decl_macro.stderr @@ -0,0 +1,26 @@ +warning: `macro` is experimental + --> $DIR/soft-feature-gate-decl_macro.rs:8:1 + | +LL | macro make() {} + | ^^^^^^^^^^^^^^^ + | + = note: see issue #39412 for more information + = help: add `#![feature(decl_macro)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: `macro` is experimental + --> $DIR/soft-feature-gate-decl_macro.rs:13:1 + | +LL | macro create { () => {} } + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #39412 for more information + = help: add `#![feature(decl_macro)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 2 warnings emitted + diff --git a/tests/ui/feature-gates/soft-feature-gate-trait_alias.rs b/tests/ui/feature-gates/soft-feature-gate-trait_alias.rs new file mode 100644 index 0000000000000..553e88375a2a7 --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-trait_alias.rs @@ -0,0 +1,17 @@ +// For historical reasons, trait aliases don't have a proper pre-expansion feature gate. +// We're now at least issuing a *warning* for those that only exist before macro expansion. +// FIXME(#154045): Turn their post-expansion feature gate into a proper pre-expansion one. +// As part of this, move these test cases into `feature-gate-trait-alias.rs`. +//@ check-pass + +#[cfg(false)] +trait Trait =; +//~^ WARN trait aliases are experimental +//~| WARN unstable syntax can change at any point in the future + +#[cfg(false)] +trait Trait = Bound where T: Bound; +//~^ WARN trait aliases are experimental +//~| WARN unstable syntax can change at any point in the future + +fn main() {} diff --git a/tests/ui/feature-gates/soft-feature-gate-trait_alias.stderr b/tests/ui/feature-gates/soft-feature-gate-trait_alias.stderr new file mode 100644 index 0000000000000..e50d4c36d1228 --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-trait_alias.stderr @@ -0,0 +1,26 @@ +warning: trait aliases are experimental + --> $DIR/soft-feature-gate-trait_alias.rs:8:1 + | +LL | trait Trait =; + | ^^^^^^^^^^^^^^ + | + = note: see issue #41517 for more information + = help: add `#![feature(trait_alias)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: trait aliases are experimental + --> $DIR/soft-feature-gate-trait_alias.rs:13:1 + | +LL | trait Trait = Bound where T: Bound; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #41517 for more information + = help: add `#![feature(trait_alias)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + = warning: unstable syntax can change at any point in the future, causing a hard error! + = note: for more information, see issue #65860 + +warning: 2 warnings emitted + diff --git a/tests/ui/feature-gates/soft-feature-gate-try_blocks.rs b/tests/ui/feature-gates/soft-feature-gate-try_blocks.rs new file mode 100644 index 0000000000000..aa51e60d56b4a --- /dev/null +++ b/tests/ui/feature-gates/soft-feature-gate-try_blocks.rs @@ -0,0 +1,13 @@ +// For historical reasons, try blocks don't have a proper pre-expansion feature gate. +// We're now at least issuing a *warning* for those that only exist before macro expansion. +// FIXME(#154045): Turn their post-expansion feature gate into a proper pre-expansion one. +// As part of this, move these test cases into `feature-gate-try_blocks.rs`. +//@ edition: 2018 +//@ check-pass + +fn main() { + #[cfg(false)] + try {} + //~^ WARN `try` blocks are unstable + //~| WARN unstable syntax can change at any point +} diff --git a/tests/ui/try-block/try-block-homogeneous-pre-expansion.stderr b/tests/ui/feature-gates/soft-feature-gate-try_blocks.stderr similarity index 91% rename from tests/ui/try-block/try-block-homogeneous-pre-expansion.stderr rename to tests/ui/feature-gates/soft-feature-gate-try_blocks.stderr index 67cbcb42fb479..2b20f40e09d07 100644 --- a/tests/ui/try-block/try-block-homogeneous-pre-expansion.stderr +++ b/tests/ui/feature-gates/soft-feature-gate-try_blocks.stderr @@ -1,5 +1,5 @@ warning: `try` blocks are unstable - --> $DIR/try-block-homogeneous-pre-expansion.rs:9:5 + --> $DIR/soft-feature-gate-try_blocks.rs:10:5 | LL | try {} | ^^^^^^ diff --git a/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs b/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs index d7dff329df1e6..ec6dfb87f61bf 100644 --- a/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs +++ b/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs @@ -29,5 +29,5 @@ where fn main() { let mut list = RcNode::::new(); - //~^ ERROR the variant or associated item `new` exists for enum `Node`, but its trait bounds were not satisfied + //~^ ERROR the variant, associated function, or constant `new` exists for enum `Node`, but its trait bounds were not satisfied } diff --git a/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.stderr b/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.stderr index b31689dbf7365..674e28829073f 100644 --- a/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.stderr +++ b/tests/ui/generic-associated-types/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.stderr @@ -15,14 +15,14 @@ help: consider relaxing the implicit `Sized` restriction LL | type Pointer: Deref + ?Sized; | ++++++++ -error[E0599]: the variant or associated item `new` exists for enum `Node`, but its trait bounds were not satisfied +error[E0599]: the variant, associated function, or constant `new` exists for enum `Node`, but its trait bounds were not satisfied --> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:31:35 | LL | enum Node { - | ------------------------------ variant or associated item `new` not found for this enum + | ------------------------------ variant, associated function, or constant `new` not found for this enum ... LL | let mut list = RcNode::::new(); - | ^^^ variant or associated item cannot be called on `Node` due to unsatisfied trait bounds + | ^^^ variant, associated function, or constant cannot be called on `Node` due to unsatisfied trait bounds | note: trait bound `(dyn Deref> + 'static): Sized` was not satisfied --> $DIR/issue-119942-unsatisified-gat-bound-during-assoc-ty-selection.rs:23:29 diff --git a/tests/ui/impl-trait/issues/issue-62742.rs b/tests/ui/impl-trait/issues/issue-62742.rs index c64278c2c5bec..052917085abcb 100644 --- a/tests/ui/impl-trait/issues/issue-62742.rs +++ b/tests/ui/impl-trait/issues/issue-62742.rs @@ -2,7 +2,7 @@ use std::marker::PhantomData; fn a() { WrongImpl::foo(0i32); - //~^ ERROR the function or associated item `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied + //~^ ERROR the associated function or constant `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied //~| ERROR the trait bound `RawImpl<_>: Raw<_>` is not satisfied } diff --git a/tests/ui/impl-trait/issues/issue-62742.stderr b/tests/ui/impl-trait/issues/issue-62742.stderr index a1fedb8fb7b8b..4899a96aece65 100644 --- a/tests/ui/impl-trait/issues/issue-62742.stderr +++ b/tests/ui/impl-trait/issues/issue-62742.stderr @@ -16,17 +16,17 @@ note: required by a bound in `SafeImpl` LL | pub struct SafeImpl>(PhantomData<(A, T)>); | ^^^^^^ required by this bound in `SafeImpl` -error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `foo` exists for struct `SafeImpl<_, RawImpl<_>>`, but its trait bounds were not satisfied --> $DIR/issue-62742.rs:4:16 | LL | WrongImpl::foo(0i32); - | ^^^ function or associated item cannot be called on `SafeImpl<_, RawImpl<_>>` due to unsatisfied trait bounds + | ^^^ associated function or constant cannot be called on `SafeImpl<_, RawImpl<_>>` due to unsatisfied trait bounds ... LL | pub struct RawImpl(PhantomData); | --------------------- doesn't satisfy `RawImpl<_>: Raw<_>` ... LL | pub struct SafeImpl>(PhantomData<(A, T)>); - | ----------------------------------------- function or associated item `foo` not found for this struct + | ----------------------------------------- associated function or constant `foo` not found for this struct | note: trait bound `RawImpl<_>: Raw<_>` was not satisfied --> $DIR/issue-62742.rs:35:20 @@ -60,17 +60,17 @@ note: required by a bound in `SafeImpl` LL | pub struct SafeImpl>(PhantomData<(A, T)>); | ^^^^^^ required by this bound in `SafeImpl` -error[E0599]: the function or associated item `foo` exists for struct `SafeImpl<(), RawImpl<()>>`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `foo` exists for struct `SafeImpl<(), RawImpl<()>>`, but its trait bounds were not satisfied --> $DIR/issue-62742.rs:10:22 | LL | WrongImpl::<()>::foo(0i32); - | ^^^ function or associated item cannot be called on `SafeImpl<(), RawImpl<()>>` due to unsatisfied trait bounds + | ^^^ associated function or constant cannot be called on `SafeImpl<(), RawImpl<()>>` due to unsatisfied trait bounds ... LL | pub struct RawImpl(PhantomData); | --------------------- doesn't satisfy `RawImpl<()>: Raw<()>` ... LL | pub struct SafeImpl>(PhantomData<(A, T)>); - | ----------------------------------------- function or associated item `foo` not found for this struct + | ----------------------------------------- associated function or constant `foo` not found for this struct | note: trait bound `RawImpl<()>: Raw<()>` was not satisfied --> $DIR/issue-62742.rs:35:20 diff --git a/tests/ui/issues/issue-28586.rs b/tests/ui/issues/issue-28586.rs index c543ef9b0e3d8..9520e0e51a15a 100644 --- a/tests/ui/issues/issue-28586.rs +++ b/tests/ui/issues/issue-28586.rs @@ -2,6 +2,6 @@ pub trait Foo {} impl Foo for [u8; usize::BYTES] {} -//~^ ERROR no associated item named `BYTES` found +//~^ ERROR no associated function or constant named `BYTES` found fn main() { } diff --git a/tests/ui/issues/issue-28586.stderr b/tests/ui/issues/issue-28586.stderr index 33f40a341c8f0..dda147954facd 100644 --- a/tests/ui/issues/issue-28586.stderr +++ b/tests/ui/issues/issue-28586.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `BYTES` found for type `usize` in the current scope +error[E0599]: no associated function or constant named `BYTES` found for type `usize` in the current scope --> $DIR/issue-28586.rs:4:26 | LL | impl Foo for [u8; usize::BYTES] {} - | ^^^^^ associated item not found in `usize` + | ^^^^^ associated function or constant not found in `usize` error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-28971.rs b/tests/ui/issues/issue-28971.rs index 8e7a2fe0ef209..e6a504f52e0cd 100644 --- a/tests/ui/issues/issue-28971.rs +++ b/tests/ui/issues/issue-28971.rs @@ -5,7 +5,7 @@ fn main(){ foo(|| { match Foo::Bar(1) { Foo::Baz(..) => (), - //~^ ERROR no variant or associated item named `Baz` found + //~^ ERROR no variant, associated function, or constant named `Baz` found _ => (), } }); diff --git a/tests/ui/issues/issue-28971.stderr b/tests/ui/issues/issue-28971.stderr index fd689a2b36eeb..de3fff0a49e30 100644 --- a/tests/ui/issues/issue-28971.stderr +++ b/tests/ui/issues/issue-28971.stderr @@ -1,11 +1,11 @@ -error[E0599]: no variant or associated item named `Baz` found for enum `Foo` in the current scope +error[E0599]: no variant, associated function, or constant named `Baz` found for enum `Foo` in the current scope --> $DIR/issue-28971.rs:7:18 | LL | enum Foo { - | -------- variant or associated item `Baz` not found for this enum + | -------- variant, associated function, or constant `Baz` not found for this enum ... LL | Foo::Baz(..) => (), - | ^^^ variant or associated item not found in `Foo` + | ^^^ variant, associated function, or constant not found in `Foo` | help: there is a variant with a similar name | diff --git a/tests/ui/issues/issue-30123.rs b/tests/ui/issues/issue-30123.rs index f6511b5f290d2..88fab44741f2e 100644 --- a/tests/ui/issues/issue-30123.rs +++ b/tests/ui/issues/issue-30123.rs @@ -5,5 +5,5 @@ use issue_30123_aux::*; fn main() { let ug = Graph::::new_undirected(); - //~^ ERROR no function or associated item named `new_undirected` found + //~^ ERROR no associated function or constant named `new_undirected` found } diff --git a/tests/ui/issues/issue-30123.stderr b/tests/ui/issues/issue-30123.stderr index db2e3dd78dd95..1e2747407d1da 100644 --- a/tests/ui/issues/issue-30123.stderr +++ b/tests/ui/issues/issue-30123.stderr @@ -1,15 +1,15 @@ -error[E0599]: no function or associated item named `new_undirected` found for struct `issue_30123_aux::Graph` in the current scope +error[E0599]: no associated function or constant named `new_undirected` found for struct `issue_30123_aux::Graph` in the current scope --> $DIR/issue-30123.rs:7:33 | LL | let ug = Graph::::new_undirected(); - | ^^^^^^^^^^^^^^ function or associated item not found in `issue_30123_aux::Graph` + | ^^^^^^^^^^^^^^ associated function or constant not found in `issue_30123_aux::Graph` | note: if you're trying to build a new `issue_30123_aux::Graph`, consider using `issue_30123_aux::Graph::::new` which returns `issue_30123_aux::Graph<_, _>` --> $DIR/auxiliary/issue-30123-aux.rs:14:5 | LL | pub fn new() -> Self { | ^^^^^^^^^^^^^^^^^^^^ - = note: the function or associated item was found for `issue_30123_aux::Graph` + = note: the associated function or constant was found for `issue_30123_aux::Graph` error: aborting due to 1 previous error diff --git a/tests/ui/issues/issue-42880.rs b/tests/ui/issues/issue-42880.rs index b61ba80e27abd..36d15fc35b48a 100644 --- a/tests/ui/issues/issue-42880.rs +++ b/tests/ui/issues/issue-42880.rs @@ -1,7 +1,7 @@ type Value = String; fn main() { - let f = |&Value::String(_)| (); //~ ERROR no associated item named + let f = |&Value::String(_)| (); //~ ERROR no associated function or constant named let vec: Vec = Vec::new(); vec.last().map(f); diff --git a/tests/ui/issues/issue-42880.stderr b/tests/ui/issues/issue-42880.stderr index f174f42b2398f..8743b1cfdef77 100644 --- a/tests/ui/issues/issue-42880.stderr +++ b/tests/ui/issues/issue-42880.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `String` found for struct `String` in the current scope +error[E0599]: no associated function or constant named `String` found for struct `String` in the current scope --> $DIR/issue-42880.rs:4:22 | LL | let f = |&Value::String(_)| (); - | ^^^^^^ associated item not found in `String` + | ^^^^^^ associated function or constant not found in `String` error: aborting due to 1 previous error diff --git a/tests/ui/let-else/let-else-no-double-error.rs b/tests/ui/let-else/let-else-no-double-error.rs index 91fcc5d7e91e8..7b695595483fc 100644 --- a/tests/ui/let-else/let-else-no-double-error.rs +++ b/tests/ui/let-else/let-else-no-double-error.rs @@ -8,5 +8,5 @@ fn main() { let foo = 22; - let u32::XXX = foo else { return }; //~ ERROR: no associated item named `XXX` found for type `u32` in the current scope [E0599] + let u32::XXX = foo else { return }; //~ ERROR: no associated function or constant named `XXX` found for type `u32` in the current scope [E0599] } diff --git a/tests/ui/let-else/let-else-no-double-error.stderr b/tests/ui/let-else/let-else-no-double-error.stderr index 05668a23138ea..4fd6a14ca911a 100644 --- a/tests/ui/let-else/let-else-no-double-error.stderr +++ b/tests/ui/let-else/let-else-no-double-error.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `XXX` found for type `u32` in the current scope +error[E0599]: no associated function or constant named `XXX` found for type `u32` in the current scope --> $DIR/let-else-no-double-error.rs:11:14 | LL | let u32::XXX = foo else { return }; - | ^^^ associated item not found in `u32` + | ^^^ associated function or constant not found in `u32` error: aborting due to 1 previous error diff --git a/tests/ui/methods/ident-from-macro-expansion.rs b/tests/ui/methods/ident-from-macro-expansion.rs index 38d2fee0e53c0..2bdf5fc17b14d 100644 --- a/tests/ui/methods/ident-from-macro-expansion.rs +++ b/tests/ui/methods/ident-from-macro-expansion.rs @@ -14,5 +14,5 @@ fn main() { dot!(hello); //~^ ERROR no method named `hello` found for unit type `()` in the current scope dispatch!(hello); - //~^ ERROR no function or associated item named `hello` found for unit type `()` in the current scope + //~^ ERROR no associated function or constant named `hello` found for unit type `()` in the current scope } diff --git a/tests/ui/methods/ident-from-macro-expansion.stderr b/tests/ui/methods/ident-from-macro-expansion.stderr index b596ce29f6fee..5fc8be865c4a9 100644 --- a/tests/ui/methods/ident-from-macro-expansion.stderr +++ b/tests/ui/methods/ident-from-macro-expansion.stderr @@ -7,14 +7,14 @@ LL | ().$id(); LL | dot!(hello); | ^^^^^ method not found in `()` -error[E0599]: no function or associated item named `hello` found for unit type `()` in the current scope +error[E0599]: no associated function or constant named `hello` found for unit type `()` in the current scope --> $DIR/ident-from-macro-expansion.rs:16:15 | LL | <()>::$id(); | --- due to this macro variable ... LL | dispatch!(hello); - | ^^^^^ function or associated item not found in `()` + | ^^^^^ associated function or constant not found in `()` error: aborting due to 2 previous errors diff --git a/tests/ui/methods/issue-7950.rs b/tests/ui/methods/issue-7950.rs index d3dcb3380bbcc..d87618a15ef36 100644 --- a/tests/ui/methods/issue-7950.rs +++ b/tests/ui/methods/issue-7950.rs @@ -4,5 +4,5 @@ struct Foo; fn main() { Foo::bar(); - //~^ ERROR no function or associated item named `bar` found for struct `Foo` + //~^ ERROR no associated function or constant named `bar` found for struct `Foo` } diff --git a/tests/ui/methods/issue-7950.stderr b/tests/ui/methods/issue-7950.stderr index 80504c070a3c4..84e6dfee77577 100644 --- a/tests/ui/methods/issue-7950.stderr +++ b/tests/ui/methods/issue-7950.stderr @@ -1,11 +1,11 @@ -error[E0599]: no function or associated item named `bar` found for struct `Foo` in the current scope +error[E0599]: no associated function or constant named `bar` found for struct `Foo` in the current scope --> $DIR/issue-7950.rs:6:10 | LL | struct Foo; - | ---------- function or associated item `bar` not found for this struct + | ---------- associated function or constant `bar` not found for this struct ... LL | Foo::bar(); - | ^^^ function or associated item not found in `Foo` + | ^^^ associated function or constant not found in `Foo` error: aborting due to 1 previous error diff --git a/tests/ui/methods/missing-method-on-type-parameter.stderr b/tests/ui/methods/missing-method-on-type-parameter.stderr index 0b58fbfa4af11..0289904effa3b 100644 --- a/tests/ui/methods/missing-method-on-type-parameter.stderr +++ b/tests/ui/methods/missing-method-on-type-parameter.stderr @@ -1,10 +1,10 @@ -error[E0599]: no function or associated item named `try_from` found for type parameter `T` in the current scope +error[E0599]: no associated function or constant named `try_from` found for type parameter `T` in the current scope --> $DIR/missing-method-on-type-parameter.rs:4:8 | LL | fn x() { - | - function or associated item `try_from` not found for this type parameter + | - associated function or constant `try_from` not found for this type parameter LL | T::try_from(); - | ^^^^^^^^ function or associated item not found in `T` + | ^^^^^^^^ associated function or constant not found in `T` | = help: items from traits can only be used if the trait is in scope help: there is an associated function `from` with a similar name diff --git a/tests/ui/methods/receiver-equality.rs b/tests/ui/methods/receiver-equality.rs index 891435a425eb9..d409edc864afc 100644 --- a/tests/ui/methods/receiver-equality.rs +++ b/tests/ui/methods/receiver-equality.rs @@ -10,7 +10,7 @@ impl B { fn foo(y: B) { B:: fn(&'a ())>::method(y); - //~^ ERROR no function or associated item named `method` found + //~^ ERROR no associated function or constant named `method` found } fn main() {} diff --git a/tests/ui/methods/receiver-equality.stderr b/tests/ui/methods/receiver-equality.stderr index bf149cc2eb4d7..9dd4d71c367b0 100644 --- a/tests/ui/methods/receiver-equality.stderr +++ b/tests/ui/methods/receiver-equality.stderr @@ -1,11 +1,11 @@ -error[E0599]: no function or associated item named `method` found for struct `B fn(&'a ())>` in the current scope +error[E0599]: no associated function or constant named `method` found for struct `B fn(&'a ())>` in the current scope --> $DIR/receiver-equality.rs:12:30 | LL | struct B(T); - | ----------- function or associated item `method` not found for this struct + | ----------- associated function or constant `method` not found for this struct ... LL | B:: fn(&'a ())>::method(y); - | ^^^^^^ function or associated item not found in `B fn(&'a ())>` + | ^^^^^^ associated function or constant not found in `B fn(&'a ())>` error: aborting due to 1 previous error diff --git a/tests/ui/nll/issue-57362-2.rs b/tests/ui/nll/issue-57362-2.rs index 664cdf89a3886..1f723be6794b5 100644 --- a/tests/ui/nll/issue-57362-2.rs +++ b/tests/ui/nll/issue-57362-2.rs @@ -21,7 +21,7 @@ impl<'a> X for fn(&'a ()) { // FIXME(@compiler-errors): This error message is less than helpful. fn g() { let x = ::make_g(); - //~^ ERROR no function or associated item named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope + //~^ ERROR no associated function or constant named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope } fn main() {} diff --git a/tests/ui/nll/issue-57362-2.stderr b/tests/ui/nll/issue-57362-2.stderr index 8a1a4d6b22c1e..1b962b16bdc8f 100644 --- a/tests/ui/nll/issue-57362-2.stderr +++ b/tests/ui/nll/issue-57362-2.stderr @@ -1,8 +1,8 @@ -error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope +error[E0599]: no associated function or constant named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope --> $DIR/issue-57362-2.rs:23:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item not found in `for<'a> fn(&'a ())` + | ^^^^^^ associated function or constant not found in `for<'a> fn(&'a ())` | = help: items from traits can only be used if the trait is implemented and in scope note: `X` defines an item `make_g`, perhaps you need to implement it diff --git a/tests/ui/nll/issue-57642-higher-ranked-subtype.rs b/tests/ui/nll/issue-57642-higher-ranked-subtype.rs index 69187cab34227..059a2beb92f46 100644 --- a/tests/ui/nll/issue-57642-higher-ranked-subtype.rs +++ b/tests/ui/nll/issue-57642-higher-ranked-subtype.rs @@ -29,11 +29,12 @@ impl Y for fn(T) { fn higher_ranked_region_has_lost_its_binder() { let x = ::make_g(); - //~^ ERROR no function or associated item named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope + //~^ ERROR no associated function or constant named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope } fn magical() { - let x = ::make_f(); //~ ERROR no function + let x = ::make_f(); + //~^ ERROR no associated function or constant named `make_f` found for fn pointer `for<'a> fn(&'a ())` in the current scope } fn main() {} diff --git a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr index 27a887e860047..0a56d1bc72031 100644 --- a/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr +++ b/tests/ui/nll/issue-57642-higher-ranked-subtype.stderr @@ -1,8 +1,8 @@ -error[E0599]: no function or associated item named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope +error[E0599]: no associated function or constant named `make_g` found for fn pointer `for<'a> fn(&'a ())` in the current scope --> $DIR/issue-57642-higher-ranked-subtype.rs:31:25 | LL | let x = ::make_g(); - | ^^^^^^ function or associated item not found in `for<'a> fn(&'a ())` + | ^^^^^^ associated function or constant not found in `for<'a> fn(&'a ())` | = help: items from traits can only be used if the trait is implemented and in scope note: `X` defines an item `make_g`, perhaps you need to implement it @@ -11,11 +11,11 @@ note: `X` defines an item `make_g`, perhaps you need to implement it LL | trait X { | ^^^^^^^ -error[E0599]: no function or associated item named `make_f` found for fn pointer `for<'a> fn(&'a ())` in the current scope +error[E0599]: no associated function or constant named `make_f` found for fn pointer `for<'a> fn(&'a ())` in the current scope --> $DIR/issue-57642-higher-ranked-subtype.rs:36:25 | LL | let x = ::make_f(); - | ^^^^^^ function or associated item not found in `for<'a> fn(&'a ())` + | ^^^^^^ associated function or constant not found in `for<'a> fn(&'a ())` | = help: items from traits can only be used if the trait is implemented and in scope note: `Y` defines an item `make_f`, perhaps you need to implement it diff --git a/tests/ui/parallel-rustc/ty-variance-issue-124423.rs b/tests/ui/parallel-rustc/ty-variance-issue-124423.rs index 8d7f29f77641b..501b0fca7bf5e 100644 --- a/tests/ui/parallel-rustc/ty-variance-issue-124423.rs +++ b/tests/ui/parallel-rustc/ty-variance-issue-124423.rs @@ -43,7 +43,7 @@ fn x<'b>(_: &'a impl Copy + 'a) -> Box { Box::u32(x) } //~| ERROR use of undeclared lifetime name `'a` //~| ERROR use of undeclared lifetime name `'a` //~| ERROR at least one trait is required for an object type -//~| ERROR no function or associated item named `u32` found for struct `Box<_, _>` in the current scope +//~| ERROR no associated function or constant named `u32` found for struct `Box<_, _>` in the current scope fn elided4(_: &impl Copy + 'a) -> new { x(x) } //~^ ERROR ambiguous `+` in a type diff --git a/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr index 631f43eea906f..2246a22eb60d7 100644 --- a/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr +++ b/tests/ui/parallel-rustc/ty-variance-issue-124423.stderr @@ -244,15 +244,15 @@ LL | fn elided4(_: &impl Copy + 'a) -> new { x(x) } | ^^^ not found in this scope error[E0224]: at least one trait is required for an object type - --> $DIR/ty-variance-issue-124423.rs:55:40 + --> $DIR/ty-variance-issue-124423.rs:41:40 | -LL | impl<'a> LifetimeTrait<'a> for &'a Box {} +LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box { Box::u32(x) } | ^^^^^^ error[E0224]: at least one trait is required for an object type - --> $DIR/ty-variance-issue-124423.rs:41:40 + --> $DIR/ty-variance-issue-124423.rs:55:40 | -LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box { Box::u32(x) } +LL | impl<'a> LifetimeTrait<'a> for &'a Box {} | ^^^^^^ error[E0224]: at least one trait is required for an object type @@ -267,11 +267,11 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures LL | fn elided(_: &impl Copy + 'a) -> _ { x } | ^ not allowed in type signatures -error[E0599]: no function or associated item named `u32` found for struct `Box<_, _>` in the current scope +error[E0599]: no associated function or constant named `u32` found for struct `Box<_, _>` in the current scope --> $DIR/ty-variance-issue-124423.rs:41:55 | LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box { Box::u32(x) } - | ^^^ function or associated item not found in `Box<_, _>` + | ^^^ associated function or constant not found in `Box<_, _>` | note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions: Box::::new diff --git a/tests/ui/parallel-rustc/ty-variance-issue-127971.rs b/tests/ui/parallel-rustc/ty-variance-issue-127971.rs index a17916843e70a..db2dc8e4c8567 100644 --- a/tests/ui/parallel-rustc/ty-variance-issue-127971.rs +++ b/tests/ui/parallel-rustc/ty-variance-issue-127971.rs @@ -20,6 +20,6 @@ fn x<'b>(_: &'a impl Copy + 'a) -> Box { Box::u32(x) } //~| ERROR use of undeclared lifetime name `'a` //~| ERROR use of undeclared lifetime name `'a` //~| ERROR at least one trait is required for an object type -//~| ERROR no function or associated item named `u32` found for struct `Box<_, _>` in the current scope +//~| ERROR no associated function or constant named `u32` found for struct `Box<_, _>` in the current scope fn main() {} diff --git a/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr b/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr index dce4acfc4ca74..47286d90d6816 100644 --- a/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr +++ b/tests/ui/parallel-rustc/ty-variance-issue-127971.stderr @@ -93,11 +93,11 @@ error[E0121]: the placeholder `_` is not allowed within types on item signatures LL | fn elided(_: &impl Copy + 'a) -> _ { x } | ^ not allowed in type signatures -error[E0599]: no function or associated item named `u32` found for struct `Box<_, _>` in the current scope +error[E0599]: no associated function or constant named `u32` found for struct `Box<_, _>` in the current scope --> $DIR/ty-variance-issue-127971.rs:18:55 | LL | fn x<'b>(_: &'a impl Copy + 'a) -> Box { Box::u32(x) } - | ^^^ function or associated item not found in `Box<_, _>` + | ^^^ associated function or constant not found in `Box<_, _>` | note: if you're trying to build a new `Box<_, _>` consider using one of the following associated functions: Box::::new diff --git a/tests/ui/parser/emoji-identifiers.rs b/tests/ui/parser/emoji-identifiers.rs index b50c046bcb204..cbd2e54c55229 100644 --- a/tests/ui/parser/emoji-identifiers.rs +++ b/tests/ui/parser/emoji-identifiers.rs @@ -6,7 +6,7 @@ impl 👀 { } } fn i_like_to_😅_a_lot() -> 👀 { //~ ERROR identifiers cannot contain emoji - 👀::full_of✨() //~ ERROR no function or associated item named `full_of✨` found for struct `👀` + 👀::full_of✨() //~ ERROR no associated function or constant named `full_of✨` found for struct `👀` //~^ ERROR identifiers cannot contain emoji } fn main() { diff --git a/tests/ui/parser/emoji-identifiers.stderr b/tests/ui/parser/emoji-identifiers.stderr index 016ed0401caf8..a6532f9c51b00 100644 --- a/tests/ui/parser/emoji-identifiers.stderr +++ b/tests/ui/parser/emoji-identifiers.stderr @@ -65,14 +65,14 @@ LL | let 🦀 = 1; LL | dbg!(🦀); | ^^ -error[E0599]: no function or associated item named `full_of✨` found for struct `👀` in the current scope +error[E0599]: no associated function or constant named `full_of✨` found for struct `👀` in the current scope --> $DIR/emoji-identifiers.rs:9:8 | LL | struct 👀; - | --------- function or associated item `full_of✨` not found for this struct + | --------- associated function or constant `full_of✨` not found for this struct ... LL | 👀::full_of✨() - | ^^^^^^^^^ function or associated item not found in `👀` + | ^^^^^^^^^ associated function or constant not found in `👀` | note: if you're trying to build a new `👀`, consider using `👀::full_of_✨` which returns `👀` --> $DIR/emoji-identifiers.rs:4:5 diff --git a/tests/ui/pattern/pattern-match-invalid-variant.stderr b/tests/ui/pattern/pattern-match-invalid-variant.stderr index 08a99f696f6d6..94373afeb2e62 100644 --- a/tests/ui/pattern/pattern-match-invalid-variant.stderr +++ b/tests/ui/pattern/pattern-match-invalid-variant.stderr @@ -1,11 +1,11 @@ -error[E0599]: no variant or associated item named `Hsl` found for enum `Color` in the current scope +error[E0599]: no variant, associated function, or constant named `Hsl` found for enum `Color` in the current scope --> $DIR/pattern-match-invalid-variant.rs:14:16 | LL | enum Color { - | ---------- variant or associated item `Hsl` not found for this enum + | ---------- variant, associated function, or constant `Hsl` not found for this enum ... LL | Color::Hsl(h, s, l) => { - | ^^^ variant or associated item not found in `Color` + | ^^^ variant, associated function, or constant not found in `Color` error: aborting due to 1 previous error diff --git a/tests/ui/privacy/ufc-method-call.different_name.stderr b/tests/ui/privacy/ufc-method-call.different_name.stderr index c65fe51ca2403..5d722c62255fd 100644 --- a/tests/ui/privacy/ufc-method-call.different_name.stderr +++ b/tests/ui/privacy/ufc-method-call.different_name.stderr @@ -1,13 +1,13 @@ -error[E0599]: no function or associated item named `foo` found for struct `Foo` in the current scope +error[E0599]: no associated function or constant named `foo` found for struct `Foo` in the current scope --> $DIR/ufc-method-call.rs:27:27 | LL | pub struct Foo(T); - | ----------------- function or associated item `foo` not found for this struct + | ----------------- associated function or constant `foo` not found for this struct ... LL | test::Foo::::foo(); - | ^^^ function or associated item not found in `Foo` + | ^^^ associated function or constant not found in `Foo` | - = note: the function or associated item was found for `Foo` + = note: the associated function or constant was found for `Foo` error: aborting due to 1 previous error diff --git a/tests/ui/privacy/ufc-method-call.rs b/tests/ui/privacy/ufc-method-call.rs index 525d9a9eee904..87efbc79ea242 100644 --- a/tests/ui/privacy/ufc-method-call.rs +++ b/tests/ui/privacy/ufc-method-call.rs @@ -26,5 +26,5 @@ pub mod test { fn main() { test::Foo::::foo(); //[same_name]~^ ERROR associated function `foo` is private - //[different_name]~^^ ERROR no function or associated item named `foo` found for struct `Foo` + //[different_name]~^^ ERROR no associated function or constant named `foo` found for struct `Foo` } diff --git a/tests/ui/resolve/empty-struct-braces-expr.rs b/tests/ui/resolve/empty-struct-braces-expr.rs index c10f76b92196b..f6a174290e341 100644 --- a/tests/ui/resolve/empty-struct-braces-expr.rs +++ b/tests/ui/resolve/empty-struct-braces-expr.rs @@ -22,8 +22,8 @@ fn main() { let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1` let xe1 = XEmpty1(); //~^ ERROR expected function, tuple struct or tuple variant, found struct `XEmpty1` - let xe3 = XE::Empty3; //~ ERROR no variant or associated item named `Empty3` found for enum - let xe3 = XE::Empty3(); //~ ERROR no variant or associated item named `Empty3` found for enum + let xe3 = XE::Empty3; //~ ERROR no variant, associated function, or constant named `Empty3` found for enum + let xe3 = XE::Empty3(); //~ ERROR no variant, associated function, or constant named `Empty3` found for enum XE::Empty1 {}; //~ ERROR no variant named `Empty1` found for enum `empty_struct::XE` } diff --git a/tests/ui/resolve/empty-struct-braces-expr.stderr b/tests/ui/resolve/empty-struct-braces-expr.stderr index a176107a06e24..f496708512a4d 100644 --- a/tests/ui/resolve/empty-struct-braces-expr.stderr +++ b/tests/ui/resolve/empty-struct-braces-expr.stderr @@ -117,22 +117,22 @@ LL - let xe1 = XEmpty1(); LL + let xe1 = XEmpty2(); | -error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope +error[E0599]: no variant, associated function, or constant named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:25:19 | LL | let xe3 = XE::Empty3; - | ^^^^^^ variant or associated item not found in `empty_struct::XE` + | ^^^^^^ variant, associated function, or constant not found in `empty_struct::XE` | help: there is a variant with a similar name | LL | let xe3 = XE::XEmpty3; | + -error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope +error[E0599]: no variant, associated function, or constant named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 | LL | let xe3 = XE::Empty3(); - | ^^^^^^ variant or associated item not found in `empty_struct::XE` + | ^^^^^^ variant, associated function, or constant not found in `empty_struct::XE` | help: there is a variant with a similar name | diff --git a/tests/ui/resolve/issue-82865.rs b/tests/ui/resolve/issue-82865.rs index 545ca63e0b82b..230725155d8aa 100644 --- a/tests/ui/resolve/issue-82865.rs +++ b/tests/ui/resolve/issue-82865.rs @@ -6,7 +6,7 @@ use x::y::z; //~ ERROR: cannot find module or crate `x` macro mac () { - Box::z //~ ERROR: no function or associated item + Box::z //~ ERROR: no associated function or constant } fn main() { diff --git a/tests/ui/resolve/issue-82865.stderr b/tests/ui/resolve/issue-82865.stderr index 90059ad5a9659..198f7f8e32aa4 100644 --- a/tests/ui/resolve/issue-82865.stderr +++ b/tests/ui/resolve/issue-82865.stderr @@ -9,11 +9,11 @@ help: you might be missing a crate named `x`, add it to your project and import LL + extern crate x; | -error[E0599]: no function or associated item named `z` found for struct `Box<_, _>` in the current scope +error[E0599]: no associated function or constant named `z` found for struct `Box<_, _>` in the current scope --> $DIR/issue-82865.rs:9:10 | LL | Box::z - | ^ function or associated item not found in `Box<_, _>` + | ^ associated function or constant not found in `Box<_, _>` ... LL | mac!(); | ------ in this macro invocation diff --git a/tests/ui/resolve/missing-associated-items.rs b/tests/ui/resolve/missing-associated-items.rs index 72d6cbb3f1497..1308ce5f592c3 100644 --- a/tests/ui/resolve/missing-associated-items.rs +++ b/tests/ui/resolve/missing-associated-items.rs @@ -14,8 +14,8 @@ fn use_token(token: &Token) { } fn main() { - use_token(&Token::Homura); //~ ERROR no variant or associated item named `Homura` - Struct::method(); //~ ERROR no function or associated item named `method` found - Struct::method; //~ ERROR no function or associated item named `method` found - Struct::Assoc; //~ ERROR no associated item named `Assoc` found + use_token(&Token::Homura); //~ ERROR no variant, associated function, or constant named `Homura` + Struct::method(); //~ ERROR no associated function or constant named `method` found + Struct::method; //~ ERROR no associated function or constant named `method` found + Struct::Assoc; //~ ERROR no associated function or constant named `Assoc` found } diff --git a/tests/ui/resolve/missing-associated-items.stderr b/tests/ui/resolve/missing-associated-items.stderr index d27a3a644aee5..3bc63ded6bc8d 100644 --- a/tests/ui/resolve/missing-associated-items.stderr +++ b/tests/ui/resolve/missing-associated-items.stderr @@ -1,38 +1,38 @@ -error[E0599]: no variant or associated item named `Homura` found for enum `Token` in the current scope +error[E0599]: no variant, associated function, or constant named `Homura` found for enum `Token` in the current scope --> $DIR/missing-associated-items.rs:17:23 | LL | enum Token { - | ---------- variant or associated item `Homura` not found for this enum + | ---------- variant, associated function, or constant `Homura` not found for this enum ... LL | use_token(&Token::Homura); - | ^^^^^^ variant or associated item not found in `Token` + | ^^^^^^ variant, associated function, or constant not found in `Token` -error[E0599]: no function or associated item named `method` found for struct `Struct` in the current scope +error[E0599]: no associated function or constant named `method` found for struct `Struct` in the current scope --> $DIR/missing-associated-items.rs:18:13 | LL | struct Struct { - | ------------- function or associated item `method` not found for this struct + | ------------- associated function or constant `method` not found for this struct ... LL | Struct::method(); - | ^^^^^^ function or associated item not found in `Struct` + | ^^^^^^ associated function or constant not found in `Struct` -error[E0599]: no function or associated item named `method` found for struct `Struct` in the current scope +error[E0599]: no associated function or constant named `method` found for struct `Struct` in the current scope --> $DIR/missing-associated-items.rs:19:13 | LL | struct Struct { - | ------------- function or associated item `method` not found for this struct + | ------------- associated function or constant `method` not found for this struct ... LL | Struct::method; - | ^^^^^^ function or associated item not found in `Struct` + | ^^^^^^ associated function or constant not found in `Struct` -error[E0599]: no associated item named `Assoc` found for struct `Struct` in the current scope +error[E0599]: no associated function or constant named `Assoc` found for struct `Struct` in the current scope --> $DIR/missing-associated-items.rs:20:13 | LL | struct Struct { - | ------------- associated item `Assoc` not found for this struct + | ------------- associated function or constant `Assoc` not found for this struct ... LL | Struct::Assoc; - | ^^^^^ associated item not found in `Struct` + | ^^^^^ associated function or constant not found in `Struct` error: aborting due to 4 previous errors diff --git a/tests/ui/resolve/suggestions/suggest-builder-fn.rs b/tests/ui/resolve/suggestions/suggest-builder-fn.rs index 959675ef2c998..4552ed5382e9a 100644 --- a/tests/ui/resolve/suggestions/suggest-builder-fn.rs +++ b/tests/ui/resolve/suggestions/suggest-builder-fn.rs @@ -50,15 +50,15 @@ mod SomeMod { fn main() { // `new` not found on `TcpStream` and `connect` should be suggested let _stream = TcpStream::new(); - //~^ ERROR no function or associated item named `new` found + //~^ ERROR no associated function or constant named `new` found // Although `new` is found on `>` it should not be // suggested because `u8` does not meet the `T: SomeTrait` constraint let _foo = Foo::::new(); - //~^ ERROR the function or associated item `new` exists for struct `Foo`, but its trait bounds were not satisfied + //~^ ERROR the associated function or constant `new` exists for struct `Foo`, but its trait bounds were not satisfied // Should suggest only `::build()` and `SomeMod::::build_public()`. // Other methods should not suggested because they are private or are not a builder let _bar = Bar::new(); - //~^ ERROR no function or associated item named `new` found + //~^ ERROR no associated function or constant named `new` found } diff --git a/tests/ui/resolve/suggestions/suggest-builder-fn.stderr b/tests/ui/resolve/suggestions/suggest-builder-fn.stderr index 9c5eed35ccff1..1eabb8effac9b 100644 --- a/tests/ui/resolve/suggestions/suggest-builder-fn.stderr +++ b/tests/ui/resolve/suggestions/suggest-builder-fn.stderr @@ -1,22 +1,22 @@ -error[E0599]: no function or associated item named `new` found for struct `TcpStream` in the current scope +error[E0599]: no associated function or constant named `new` found for struct `TcpStream` in the current scope --> $DIR/suggest-builder-fn.rs:52:29 | LL | let _stream = TcpStream::new(); - | ^^^ function or associated item not found in `TcpStream` + | ^^^ associated function or constant not found in `TcpStream` | note: if you're trying to build a new `TcpStream` consider using one of the following associated functions: TcpStream::connect TcpStream::connect_timeout --> $SRC_DIR/std/src/net/tcp.rs:LL:COL -error[E0599]: the function or associated item `new` exists for struct `Foo`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `new` exists for struct `Foo`, but its trait bounds were not satisfied --> $DIR/suggest-builder-fn.rs:57:27 | LL | struct Foo { - | ------------- function or associated item `new` not found for this struct + | ------------- associated function or constant `new` not found for this struct ... LL | let _foo = Foo::::new(); - | ^^^ function or associated item cannot be called on `Foo` due to unsatisfied trait bounds + | ^^^ associated function or constant cannot be called on `Foo` due to unsatisfied trait bounds | note: trait bound `u8: SomeTrait` was not satisfied --> $DIR/suggest-builder-fn.rs:12:9 @@ -26,14 +26,14 @@ LL | impl Foo { | | | unsatisfied trait bound introduced here -error[E0599]: no function or associated item named `new` found for struct `Bar` in the current scope +error[E0599]: no associated function or constant named `new` found for struct `Bar` in the current scope --> $DIR/suggest-builder-fn.rs:62:21 | LL | struct Bar; - | ---------- function or associated item `new` not found for this struct + | ---------- associated function or constant `new` not found for this struct ... LL | let _bar = Bar::new(); - | ^^^ function or associated item not found in `Bar` + | ^^^ associated function or constant not found in `Bar` | note: if you're trying to build a new `Bar` consider using one of the following associated functions: Bar::build diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs b/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs index 706564dc9b212..dfbb8f1e0a511 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.rs @@ -1,5 +1,5 @@ struct Struct; -//~^ NOTE function or associated item `fob` not found for this struct +//~^ NOTE associated function or constant `fob` not found for this struct impl Struct { fn foo() { } @@ -21,8 +21,8 @@ trait Trait { fn main() { Struct::fob(); - //~^ ERROR no function or associated item named `fob` found for struct `Struct` in the current scope - //~| NOTE function or associated item not found in `Struct` + //~^ ERROR no associated function or constant named `fob` found for struct `Struct` in the current scope + //~| NOTE associated function or constant not found in `Struct` Struc::foo(); //~^ ERROR cannot find type `Struc` diff --git a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr index b1afa703eb039..98412559d666f 100644 --- a/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr +++ b/tests/ui/resolve/typo-suggestion-mistyped-in-path.stderr @@ -9,14 +9,14 @@ help: a struct with a similar name exists LL | module::Struct::foo(); | + -error[E0599]: no function or associated item named `fob` found for struct `Struct` in the current scope +error[E0599]: no associated function or constant named `fob` found for struct `Struct` in the current scope --> $DIR/typo-suggestion-mistyped-in-path.rs:23:13 | LL | struct Struct; - | ------------- function or associated item `fob` not found for this struct + | ------------- associated function or constant `fob` not found for this struct ... LL | Struct::fob(); - | ^^^ function or associated item not found in `Struct` + | ^^^ associated function or constant not found in `Struct` | help: there is an associated function `foo` with a similar name | diff --git a/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.rs b/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.rs index 46fdfd678cc6d..c54f08e9256f6 100644 --- a/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.rs +++ b/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.rs @@ -5,7 +5,7 @@ fn main() { let foo = 22; match foo { - u32::XXX => { } //~ ERROR no associated item named + u32::XXX => { } //~ ERROR no associated function or constant named _ => { } } } diff --git a/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.stderr b/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.stderr index 6000507c58974..51b08cde6eb0d 100644 --- a/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.stderr +++ b/tests/ui/rfcs/rfc-2005-default-binding-mode/no-double-error.stderr @@ -1,8 +1,8 @@ -error[E0599]: no associated item named `XXX` found for type `u32` in the current scope +error[E0599]: no associated function or constant named `XXX` found for type `u32` in the current scope --> $DIR/no-double-error.rs:8:14 | LL | u32::XXX => { } - | ^^^ associated item not found in `u32` + | ^^^ associated function or constant not found in `u32` error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/trait-import-suggestions.rs b/tests/ui/rust-2018/trait-import-suggestions.rs index 5a5eeacedfcc5..dce01de8c894e 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.rs +++ b/tests/ui/rust-2018/trait-import-suggestions.rs @@ -27,5 +27,5 @@ fn main() { let x: u32 = 22; x.bar(); //~ ERROR no method named `bar` x.baz(); //~ ERROR no method named `baz` - let y = u32::from_str("33"); //~ ERROR no function or associated item named `from_str` + let y = u32::from_str("33"); //~ ERROR no associated function or constant named `from_str` } diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 488044ee85245..721ba0c50d783 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -49,11 +49,11 @@ LL - x.baz(); LL + x.bar(); | -error[E0599]: no function or associated item named `from_str` found for type `u32` in the current scope +error[E0599]: no associated function or constant named `from_str` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:30:18 | LL | let y = u32::from_str("33"); - | ^^^^^^^^ function or associated item not found in `u32` + | ^^^^^^^^ associated function or constant not found in `u32` | = help: items from traits can only be used if the trait is in scope help: trait `FromStr` which provides `from_str` is implemented but not in scope; perhaps you want to import it diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.rs b/tests/ui/rust-2018/uniform-paths/issue-87932.rs index d24d4b8b4820b..cde7fe7a8ea6f 100644 --- a/tests/ui/rust-2018/uniform-paths/issue-87932.rs +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.rs @@ -11,5 +11,5 @@ impl issue_87932_a::Deserialize for A { fn main() { A::deserialize(); - //~^ ERROR no function or associated item named `deserialize` found for struct `A` + //~^ ERROR no associated function or constant named `deserialize` found for struct `A` } diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr index 3e6fc3ff2a562..c408b747b506f 100644 --- a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr @@ -1,11 +1,11 @@ -error[E0599]: no function or associated item named `deserialize` found for struct `A` in the current scope +error[E0599]: no associated function or constant named `deserialize` found for struct `A` in the current scope --> $DIR/issue-87932.rs:13:8 | LL | pub struct A {} - | ------------ function or associated item `deserialize` not found for this struct + | ------------ associated function or constant `deserialize` not found for this struct ... LL | A::deserialize(); - | ^^^^^^^^^^^ function or associated item not found in `A` + | ^^^^^^^^^^^ associated function or constant not found in `A` | = help: items from traits can only be used if the trait is in scope help: trait `Deserialize` which provides `deserialize` is implemented but not in scope; perhaps you want to import it diff --git a/tests/ui/shadowed/shadowing-generic-item.rs b/tests/ui/shadowed/shadowing-generic-item.rs index c3a0ced04e7f0..8a81530aab423 100644 --- a/tests/ui/shadowed/shadowing-generic-item.rs +++ b/tests/ui/shadowed/shadowing-generic-item.rs @@ -9,7 +9,7 @@ mod Foo { pub fn f() {} } fn g() { - Foo::f(); //~ ERROR no function or associated item named `f` + Foo::f(); //~ ERROR no associated function or constant named `f` } fn main() {} diff --git a/tests/ui/shadowed/shadowing-generic-item.stderr b/tests/ui/shadowed/shadowing-generic-item.stderr index 55a0bb36ea80b..eb517b1a9cdb2 100644 --- a/tests/ui/shadowed/shadowing-generic-item.stderr +++ b/tests/ui/shadowed/shadowing-generic-item.stderr @@ -8,13 +8,13 @@ LL | fn f() { LL | let t = T { i: 0 }; | ^ not a struct, variant or union type -error[E0599]: no function or associated item named `f` found for type parameter `Foo` in the current scope +error[E0599]: no associated function or constant named `f` found for type parameter `Foo` in the current scope --> $DIR/shadowing-generic-item.rs:12:10 | LL | fn g() { - | --- function or associated item `f` not found for this type parameter + | --- associated function or constant `f` not found for this type parameter LL | Foo::f(); - | ^ function or associated item not found in `Foo` + | ^ associated function or constant not found in `Foo` error: aborting due to 2 previous errors diff --git a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr index 4b1cd8a5a1256..4df97a655d626 100644 --- a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.alignment_mismatch.stderr @@ -1,15 +1,15 @@ -error[E0599]: no function or associated item named `from_mut` found for struct `Atomic` in the current scope +error[E0599]: no associated function or constant named `from_mut` found for struct `Atomic` in the current scope --> $DIR/atomic-from-mut-not-available.rs:24:36 | LL | core::sync::atomic::AtomicU64::from_mut(&mut 0u64); - | ^^^^^^^^ function or associated item not found in `Atomic` + | ^^^^^^^^ associated function or constant not found in `Atomic` | note: if you're trying to build a new `Atomic`, consider using `Atomic::::new` which returns `Atomic` --> $SRC_DIR/core/src/sync/atomic.rs:LL:COL ::: $SRC_DIR/core/src/sync/atomic.rs:LL:COL | = note: in this macro invocation - = note: the function or associated item was found for + = note: the associated function or constant was found for - `Atomic<*mut T>` - `Atomic` - `Atomic` diff --git a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs index 519b6977dcb56..b7c7f0ed98241 100644 --- a/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs +++ b/tests/ui/stdlib-unit-tests/atomic-from-mut-not-available.rs @@ -22,6 +22,6 @@ fn main() { core::sync::atomic::AtomicU64::from_mut(&mut 0u64); - //[alignment_mismatch]~^ ERROR no function or associated item named `from_mut` found for struct `Atomic` + //[alignment_mismatch]~^ ERROR no associated function or constant named `from_mut` found for struct `Atomic` //[alignment_matches]~^^ ERROR use of unstable library feature `atomic_from_mut` } diff --git a/tests/ui/suggestions/deref-path-method.rs b/tests/ui/suggestions/deref-path-method.rs index 0281cdb6b37cf..d44b3bd703057 100644 --- a/tests/ui/suggestions/deref-path-method.rs +++ b/tests/ui/suggestions/deref-path-method.rs @@ -1,6 +1,6 @@ fn main() { let vec = Vec::new(); Vec::contains(&vec, &0); - //~^ ERROR no function or associated item named `contains` found for struct `Vec<_, _>` in the current scope + //~^ ERROR no associated function or constant named `contains` found for struct `Vec<_, _>` in the current scope //~| HELP the function `contains` is implemented on `[_]` } diff --git a/tests/ui/suggestions/deref-path-method.stderr b/tests/ui/suggestions/deref-path-method.stderr index 0dec424555ed5..8cf8ec9146d74 100644 --- a/tests/ui/suggestions/deref-path-method.stderr +++ b/tests/ui/suggestions/deref-path-method.stderr @@ -1,8 +1,8 @@ -error[E0599]: no function or associated item named `contains` found for struct `Vec<_, _>` in the current scope +error[E0599]: no associated function or constant named `contains` found for struct `Vec<_, _>` in the current scope --> $DIR/deref-path-method.rs:3:10 | LL | Vec::contains(&vec, &0); - | ^^^^^^^^ function or associated item not found in `Vec<_, _>` + | ^^^^^^^^ associated function or constant not found in `Vec<_, _>` | note: if you're trying to build a new `Vec<_, _>` consider using one of the following associated functions: Vec::::new diff --git a/tests/ui/suggestions/dont-suggest-private-trait-method.rs b/tests/ui/suggestions/dont-suggest-private-trait-method.rs index 6e2b1abd1370f..6a220b01f1957 100644 --- a/tests/ui/suggestions/dont-suggest-private-trait-method.rs +++ b/tests/ui/suggestions/dont-suggest-private-trait-method.rs @@ -2,5 +2,5 @@ struct T; fn main() { T::new(); - //~^ ERROR no function or associated item named `new` found + //~^ ERROR no associated function or constant named `new` found } diff --git a/tests/ui/suggestions/dont-suggest-private-trait-method.stderr b/tests/ui/suggestions/dont-suggest-private-trait-method.stderr index f251ad59a587b..b53a8279dfeac 100644 --- a/tests/ui/suggestions/dont-suggest-private-trait-method.stderr +++ b/tests/ui/suggestions/dont-suggest-private-trait-method.stderr @@ -1,11 +1,11 @@ -error[E0599]: no function or associated item named `new` found for struct `T` in the current scope +error[E0599]: no associated function or constant named `new` found for struct `T` in the current scope --> $DIR/dont-suggest-private-trait-method.rs:4:8 | LL | struct T; - | -------- function or associated item `new` not found for this struct + | -------- associated function or constant `new` not found for this struct ... LL | T::new(); - | ^^^ function or associated item not found in `T` + | ^^^ associated function or constant not found in `T` error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/incorrect-variant-literal.svg b/tests/ui/suggestions/incorrect-variant-literal.svg index d2c1f6c95ca58..54eaee2a2e906 100644 --- a/tests/ui/suggestions/incorrect-variant-literal.svg +++ b/tests/ui/suggestions/incorrect-variant-literal.svg @@ -1,4 +1,4 @@ - + (I); - | ------------- function or associated item `f` not found for this struct + | ------------- associated function or constant `f` not found for this struct ... LL | Foo::<()>::f() - | ^ function or associated item cannot be called on `Foo<()>` due to unsatisfied trait bounds + | ^ associated function or constant cannot be called on `Foo<()>` due to unsatisfied trait bounds | note: trait bound `(): Iterator` was not satisfied --> $DIR/issue-108132-unmet-trait-alias-bound-on-generic-impl.rs:5:23 diff --git a/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr b/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr index 42969de715eb7..f26c321a2973c 100644 --- a/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr +++ b/tests/ui/traits/associated-item-unsatisfied-trait-bounds.stderr @@ -1,11 +1,11 @@ -error[E0599]: the function or associated item `bat` exists for struct `Foo`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `bat` exists for struct `Foo`, but its trait bounds were not satisfied --> $DIR/associated-item-unsatisfied-trait-bounds.rs:8:10 | LL | struct Foo; - | ---------- function or associated item `bat` not found for this struct because `Foo` doesn't implement `Bar` or `Baz` + | ---------- associated function or constant `bat` not found for this struct because `Foo` doesn't implement `Bar` or `Baz` ... LL | Foo::bat(()); - | ^^^ function or associated item cannot be called on `Foo` due to unsatisfied trait bounds + | ^^^ associated function or constant cannot be called on `Foo` due to unsatisfied trait bounds | note: for `bat` to be available, `Foo` must implement `Bar` and `Baz` --> $DIR/associated-item-unsatisfied-trait-bounds.rs:5:38 diff --git a/tests/ui/traits/issue-3973.rs b/tests/ui/traits/issue-3973.rs index a5ed5b87051e7..96e581c169f35 100644 --- a/tests/ui/traits/issue-3973.rs +++ b/tests/ui/traits/issue-3973.rs @@ -20,6 +20,6 @@ impl ToString_ for Point { fn main() { let p = Point::new(0.0, 0.0); - //~^ ERROR no function or associated item named `new` found for struct `Point` + //~^ ERROR no associated function or constant named `new` found for struct `Point` println!("{}", p.to_string()); } diff --git a/tests/ui/traits/issue-3973.stderr b/tests/ui/traits/issue-3973.stderr index 87ee08049300f..9da3617c05b6a 100644 --- a/tests/ui/traits/issue-3973.stderr +++ b/tests/ui/traits/issue-3973.stderr @@ -7,14 +7,14 @@ LL | | Point { x: x, y: y } LL | | } | |_____^ not a member of trait `ToString_` -error[E0599]: no function or associated item named `new` found for struct `Point` in the current scope +error[E0599]: no associated function or constant named `new` found for struct `Point` in the current scope --> $DIR/issue-3973.rs:22:20 | LL | struct Point { - | ------------ function or associated item `new` not found for this struct + | ------------ associated function or constant `new` not found for this struct ... LL | let p = Point::new(0.0, 0.0); - | ^^^ function or associated item not found in `Point` + | ^^^ associated function or constant not found in `Point` error: aborting due to 2 previous errors diff --git a/tests/ui/traits/item-privacy.rs b/tests/ui/traits/item-privacy.rs index 44ba87642371a..519a95c5c7856 100644 --- a/tests/ui/traits/item-privacy.rs +++ b/tests/ui/traits/item-privacy.rs @@ -77,9 +77,9 @@ fn check_method() { // Methods, UFCS // a, b, c are resolved as trait items, their traits need to be in scope S::a(&S); - //~^ ERROR no function or associated item named `a` found + //~^ ERROR no associated function or constant named `a` found S::b(&S); - //~^ ERROR no function or associated item named `b` found + //~^ ERROR no associated function or constant named `b` found S::c(&S); // OK // a, b, c are resolved as inherent items, their traits don't need to be in scope ::a(&S); //~ ERROR method `a` is private @@ -95,8 +95,8 @@ fn check_assoc_const() { // Associated constants // A, B, C are resolved as trait items, their traits need to be in scope - S::A; //~ ERROR no associated item named `A` found - S::B; //~ ERROR no associated item named `B` found + S::A; //~ ERROR no associated function or constant named `A` found + S::B; //~ ERROR no associated function or constant named `B` found S::C; // OK // A, B, C are resolved as inherent items, their traits don't need to be in scope ::A; diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index 8c33bb6de200f..7b199542c961e 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -47,14 +47,14 @@ LL | fn a(&self) { } LL | c.a(); | ^ private method -error[E0599]: no function or associated item named `a` found for struct `S` in the current scope +error[E0599]: no associated function or constant named `a` found for struct `S` in the current scope --> $DIR/item-privacy.rs:79:8 | LL | struct S; - | -------- function or associated item `a` not found for this struct + | -------- associated function or constant `a` not found for this struct ... LL | S::a(&S); - | ^ function or associated item not found in `S` + | ^ associated function or constant not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope = help: trait `method::A` which provides `a` is implemented but not reachable @@ -64,14 +64,14 @@ help: there is an associated constant `B` with a similar name LL | const B: u8 = 0; | ^^^^^^^^^^^ -error[E0599]: no function or associated item named `b` found for struct `S` in the current scope +error[E0599]: no associated function or constant named `b` found for struct `S` in the current scope --> $DIR/item-privacy.rs:81:8 | LL | struct S; - | -------- function or associated item `b` not found for this struct + | -------- associated function or constant `b` not found for this struct ... LL | S::b(&S); - | ^ function or associated item not found in `S` + | ^ associated function or constant not found in `S` | = help: items from traits can only be used if the trait is in scope help: there is an associated constant `B` with a similar name @@ -93,14 +93,14 @@ LL | fn a(&self) { } LL | ::a(&S); | ^ private method -error[E0599]: no associated item named `A` found for struct `S` in the current scope +error[E0599]: no associated function or constant named `A` found for struct `S` in the current scope --> $DIR/item-privacy.rs:98:8 | LL | struct S; - | -------- associated item `A` not found for this struct + | -------- associated function or constant `A` not found for this struct ... LL | S::A; - | ^ associated item not found in `S` + | ^ associated function or constant not found in `S` | = help: items from traits can only be used if the trait is implemented and in scope = help: trait `assoc_const::A` which provides `A` is implemented but not reachable @@ -110,14 +110,14 @@ LL - S::A; LL + S::B; | -error[E0599]: no associated item named `B` found for struct `S` in the current scope +error[E0599]: no associated function or constant named `B` found for struct `S` in the current scope --> $DIR/item-privacy.rs:99:8 | LL | struct S; - | -------- associated item `B` not found for this struct + | -------- associated function or constant `B` not found for this struct ... LL | S::B; - | ^ associated item not found in `S` + | ^ associated function or constant not found in `S` | = help: items from traits can only be used if the trait is in scope help: there is a method `b` with a similar name diff --git a/tests/ui/traits/unspecified-self-in-trait-ref.rs b/tests/ui/traits/unspecified-self-in-trait-ref.rs index f175a8e6dbdfc..fbc95e0443c5e 100644 --- a/tests/ui/traits/unspecified-self-in-trait-ref.rs +++ b/tests/ui/traits/unspecified-self-in-trait-ref.rs @@ -9,19 +9,19 @@ pub trait Bar { fn main() { let a = Foo::lol(); - //~^ ERROR no function or associated item named + //~^ ERROR no associated function or constant named //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition let b = Foo::<_>::lol(); - //~^ ERROR no function or associated item named + //~^ ERROR no associated function or constant named //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition let c = Bar::lol(); - //~^ ERROR no function or associated item named + //~^ ERROR no associated function or constant named //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition let d = Bar::::lol(); - //~^ ERROR no function or associated item named + //~^ ERROR no associated function or constant named //~| WARN trait objects without an explicit `dyn` are deprecated //~| WARN this is accepted in the current edition let e = Bar::::lol(); diff --git a/tests/ui/traits/unspecified-self-in-trait-ref.stderr b/tests/ui/traits/unspecified-self-in-trait-ref.stderr index b7d78a3284e3c..e76187de81f4b 100644 --- a/tests/ui/traits/unspecified-self-in-trait-ref.stderr +++ b/tests/ui/traits/unspecified-self-in-trait-ref.stderr @@ -12,11 +12,11 @@ help: if this is a dyn-compatible trait, use `dyn` LL | let a = ::lol(); | ++++ + -error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope +error[E0599]: no associated function or constant named `lol` found for trait object `dyn Foo<_>` in the current scope --> $DIR/unspecified-self-in-trait-ref.rs:11:18 | LL | let a = Foo::lol(); - | ^^^ function or associated item not found in `dyn Foo<_>` + | ^^^ associated function or constant not found in `dyn Foo<_>` warning: trait objects without an explicit `dyn` are deprecated --> $DIR/unspecified-self-in-trait-ref.rs:15:13 @@ -31,11 +31,11 @@ help: if this is a dyn-compatible trait, use `dyn` LL | let b = >::lol(); | ++++ + -error[E0599]: no function or associated item named `lol` found for trait object `dyn Foo<_>` in the current scope +error[E0599]: no associated function or constant named `lol` found for trait object `dyn Foo<_>` in the current scope --> $DIR/unspecified-self-in-trait-ref.rs:15:23 | LL | let b = Foo::<_>::lol(); - | ^^^ function or associated item not found in `dyn Foo<_>` + | ^^^ associated function or constant not found in `dyn Foo<_>` warning: trait objects without an explicit `dyn` are deprecated --> $DIR/unspecified-self-in-trait-ref.rs:19:13 @@ -50,11 +50,11 @@ help: if this is a dyn-compatible trait, use `dyn` LL | let c = ::lol(); | ++++ + -error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar<_, _>` in the current scope +error[E0599]: no associated function or constant named `lol` found for trait object `dyn Bar<_, _>` in the current scope --> $DIR/unspecified-self-in-trait-ref.rs:19:18 | LL | let c = Bar::lol(); - | ^^^ function or associated item not found in `dyn Bar<_, _>` + | ^^^ associated function or constant not found in `dyn Bar<_, _>` warning: trait objects without an explicit `dyn` are deprecated --> $DIR/unspecified-self-in-trait-ref.rs:23:13 @@ -69,11 +69,11 @@ help: if this is a dyn-compatible trait, use `dyn` LL | let d = >::lol(); | ++++ + -error[E0599]: no function or associated item named `lol` found for trait object `dyn Bar` in the current scope +error[E0599]: no associated function or constant named `lol` found for trait object `dyn Bar` in the current scope --> $DIR/unspecified-self-in-trait-ref.rs:23:30 | LL | let d = Bar::::lol(); - | ^^^ function or associated item not found in `dyn Bar` + | ^^^ associated function or constant not found in `dyn Bar` warning: trait objects without an explicit `dyn` are deprecated --> $DIR/unspecified-self-in-trait-ref.rs:27:13 diff --git a/tests/ui/try-block/try-block-homogeneous-pre-expansion.rs b/tests/ui/try-block/try-block-homogeneous-pre-expansion.rs deleted file mode 100644 index 980f97ca0672e..0000000000000 --- a/tests/ui/try-block/try-block-homogeneous-pre-expansion.rs +++ /dev/null @@ -1,12 +0,0 @@ -//@ check-pass -//@ edition: 2018 - -// For historical reasons this is only a warning, not an error. -// See - -fn main() { - #[cfg(false)] - try {} - //~^ warn `try` blocks are unstable - //~| warn unstable syntax can change at any point -} diff --git a/tests/ui/type/issue-103271.rs b/tests/ui/type/issue-103271.rs index 98cfaaf5cff7b..e949bb10ece22 100644 --- a/tests/ui/type/issue-103271.rs +++ b/tests/ui/type/issue-103271.rs @@ -1,15 +1,15 @@ fn main() { let iter_fun = <&[u32]>::iter; - //~^ ERROR no function or associated item named `iter` found for reference `&[u32]` in the current scope [E0599] - //~| NOTE function or associated item not found in `&[u32]` + //~^ ERROR no associated function or constant named `iter` found for reference `&[u32]` in the current scope [E0599] + //~| NOTE associated function or constant not found in `&[u32]` //~| HELP the function `iter` is implemented on `[u32]` for item in iter_fun(&[1,1]) { let x: &u32 = item; assert_eq!(x, &1); } let iter_fun2 = <(&[u32])>::iter; - //~^ ERROR no function or associated item named `iter` found for reference `&[u32]` in the current scope [E0599] - //~| NOTE function or associated item not found in `&[u32]` + //~^ ERROR no associated function or constant named `iter` found for reference `&[u32]` in the current scope [E0599] + //~| NOTE associated function or constant not found in `&[u32]` //~| HELP the function `iter` is implemented on `[u32]` for item2 in iter_fun2(&[1,1]) { let x: &u32 = item2; diff --git a/tests/ui/type/issue-103271.stderr b/tests/ui/type/issue-103271.stderr index 1b84033291a5d..a83b782bec527 100644 --- a/tests/ui/type/issue-103271.stderr +++ b/tests/ui/type/issue-103271.stderr @@ -1,8 +1,8 @@ -error[E0599]: no function or associated item named `iter` found for reference `&[u32]` in the current scope +error[E0599]: no associated function or constant named `iter` found for reference `&[u32]` in the current scope --> $DIR/issue-103271.rs:2:30 | LL | let iter_fun = <&[u32]>::iter; - | ^^^^ function or associated item not found in `&[u32]` + | ^^^^ associated function or constant not found in `&[u32]` | help: the function `iter` is implemented on `[u32]` | @@ -10,11 +10,11 @@ LL - let iter_fun = <&[u32]>::iter; LL + let iter_fun = <[u32]>::iter; | -error[E0599]: no function or associated item named `iter` found for reference `&[u32]` in the current scope +error[E0599]: no associated function or constant named `iter` found for reference `&[u32]` in the current scope --> $DIR/issue-103271.rs:10:33 | LL | let iter_fun2 = <(&[u32])>::iter; - | ^^^^ function or associated item not found in `&[u32]` + | ^^^^ associated function or constant not found in `&[u32]` | help: the function `iter` is implemented on `[u32]` | diff --git a/tests/ui/typeck/derive-sugg-arg-arity.rs b/tests/ui/typeck/derive-sugg-arg-arity.rs index 094c93a8535d8..1a233e68639dc 100644 --- a/tests/ui/typeck/derive-sugg-arg-arity.rs +++ b/tests/ui/typeck/derive-sugg-arg-arity.rs @@ -3,6 +3,6 @@ pub struct A; fn main() { match () { _ => match A::partial_cmp() {}, - //~^ ERROR the function or associated item `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied + //~^ ERROR the associated function or constant `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied } } diff --git a/tests/ui/typeck/derive-sugg-arg-arity.stderr b/tests/ui/typeck/derive-sugg-arg-arity.stderr index 382b324c4cc50..029d8dfdfc79a 100644 --- a/tests/ui/typeck/derive-sugg-arg-arity.stderr +++ b/tests/ui/typeck/derive-sugg-arg-arity.stderr @@ -1,11 +1,11 @@ -error[E0599]: the function or associated item `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied +error[E0599]: the associated function or constant `partial_cmp` exists for struct `A`, but its trait bounds were not satisfied --> $DIR/derive-sugg-arg-arity.rs:5:23 | LL | pub struct A; - | ------------ function or associated item `partial_cmp` not found for this struct because it doesn't satisfy `A: Iterator` or `A: PartialOrd<_>` + | ------------ associated function or constant `partial_cmp` not found for this struct because it doesn't satisfy `A: Iterator` or `A: PartialOrd<_>` ... LL | _ => match A::partial_cmp() {}, - | ^^^^^^^^^^^ function or associated item cannot be called on `A` due to unsatisfied trait bounds + | ^^^^^^^^^^^ associated function or constant cannot be called on `A` due to unsatisfied trait bounds | = note: the following trait bounds were not satisfied: `A: PartialOrd<_>` diff --git a/tests/ui/typeck/dont-suggest-private-dependencies.rs b/tests/ui/typeck/dont-suggest-private-dependencies.rs index ee5224e2d821e..23debbf4e3424 100644 --- a/tests/ui/typeck/dont-suggest-private-dependencies.rs +++ b/tests/ui/typeck/dont-suggest-private-dependencies.rs @@ -31,7 +31,7 @@ use public_dep::B; fn main() { let _ = u8::cast_from_lossy(9); - //~^ ERROR no function or associated item named `cast_from_lossy` found for type `u8` + //~^ ERROR no associated function or constant named `cast_from_lossy` found for type `u8` let _ = B::foo(); - //~^ ERROR no function or associated item named `foo` found for struct `B` + //~^ ERROR no associated function or constant named `foo` found for struct `B` } diff --git a/tests/ui/typeck/dont-suggest-private-dependencies.stderr b/tests/ui/typeck/dont-suggest-private-dependencies.stderr index b7b14ee6b9bbb..d17964cc933a3 100644 --- a/tests/ui/typeck/dont-suggest-private-dependencies.stderr +++ b/tests/ui/typeck/dont-suggest-private-dependencies.stderr @@ -10,17 +10,17 @@ help: there is a method `read1` with a similar name, but with different argument LL | fn read1(&self) {} | ^^^^^^^^^^^^^^^ -error[E0599]: no function or associated item named `cast_from_lossy` found for type `u8` in the current scope +error[E0599]: no associated function or constant named `cast_from_lossy` found for type `u8` in the current scope --> $DIR/dont-suggest-private-dependencies.rs:33:17 | LL | let _ = u8::cast_from_lossy(9); - | ^^^^^^^^^^^^^^^ function or associated item not found in `u8` + | ^^^^^^^^^^^^^^^ associated function or constant not found in `u8` -error[E0599]: no function or associated item named `foo` found for struct `B` in the current scope +error[E0599]: no associated function or constant named `foo` found for struct `B` in the current scope --> $DIR/dont-suggest-private-dependencies.rs:35:16 | LL | let _ = B::foo(); - | ^^^ function or associated item not found in `B` + | ^^^ associated function or constant not found in `B` error: aborting due to 3 previous errors diff --git a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs index 3cb775e85ac6b..56d46fda98427 100644 --- a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs +++ b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.rs @@ -7,5 +7,5 @@ use suggest_trait_reexported_as_not_doc_visible_b::Bar; fn main() { Bar::foo(); - //~^ ERROR: no function or associated item named `foo` found for struct `Bar` in the current scope [E0599] + //~^ ERROR: no associated function or constant named `foo` found for struct `Bar` in the current scope [E0599] } diff --git a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr index 9128ee6844469..7f78d2aef6179 100644 --- a/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr +++ b/tests/ui/typeck/suggest-trait-reexported-as-not-doc-visible.stderr @@ -1,8 +1,8 @@ -error[E0599]: no function or associated item named `foo` found for struct `Bar` in the current scope +error[E0599]: no associated function or constant named `foo` found for struct `Bar` in the current scope --> $DIR/suggest-trait-reexported-as-not-doc-visible.rs:9:10 | LL | Bar::foo(); - | ^^^ function or associated item not found in `Bar` + | ^^^ associated function or constant not found in `Bar` | = help: items from traits can only be used if the trait is in scope help: trait `Foo` which provides `foo` is implemented but not in scope; perhaps you want to import it diff --git a/tests/ui/ufcs/bad-builder.rs b/tests/ui/ufcs/bad-builder.rs index 350c96acca08b..53d174b7eaf2a 100644 --- a/tests/ui/ufcs/bad-builder.rs +++ b/tests/ui/ufcs/bad-builder.rs @@ -1,6 +1,6 @@ fn hello() -> Vec { Vec::::mew() - //~^ ERROR no function or associated item named `mew` found for struct `Vec` in the current scope + //~^ ERROR no associated function or constant named `mew` found for struct `Vec` in the current scope } fn main() {} diff --git a/tests/ui/ufcs/bad-builder.stderr b/tests/ui/ufcs/bad-builder.stderr index 2504a3d09253c..5fae6268af47b 100644 --- a/tests/ui/ufcs/bad-builder.stderr +++ b/tests/ui/ufcs/bad-builder.stderr @@ -1,8 +1,8 @@ -error[E0599]: no function or associated item named `mew` found for struct `Vec` in the current scope +error[E0599]: no associated function or constant named `mew` found for struct `Vec` in the current scope --> $DIR/bad-builder.rs:2:15 | LL | Vec::::mew() - | ^^^ function or associated item not found in `Vec` + | ^^^ associated function or constant not found in `Vec` | note: if you're trying to build a new `Vec` consider using one of the following associated functions: Vec::::new diff --git a/tests/ui/ufcs/ufcs-partially-resolved.rs b/tests/ui/ufcs/ufcs-partially-resolved.rs index 712668728c9e7..ac98aef4e1de6 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.rs +++ b/tests/ui/ufcs/ufcs-partially-resolved.rs @@ -35,7 +35,7 @@ fn main() { ::N::NN; //~ ERROR expected trait, found type alias `A` let _: ::Y::NN; //~ ERROR ambiguous associated type let _: ::Y::NN; //~ ERROR expected trait, found enum `E` - ::Y::NN; //~ ERROR no associated item named `NN` found for type `u16` + ::Y::NN; //~ ERROR no associated function or constant named `NN` found for type `u16` ::Y::NN; //~ ERROR expected trait, found enum `E` let _: ::NN; //~ ERROR cannot find trait `N` in trait `Tr` @@ -52,5 +52,5 @@ fn main() { let _: ::Z; //~ ERROR expected associated type, found associated function `Dr::Z` ::X; //~ ERROR expected method or associated constant, found associated type `Dr::X` let _: ::Z::N; //~ ERROR expected associated type, found associated function `Dr::Z` - ::X::N; //~ ERROR no associated item named `N` found for type `u16` + ::X::N; //~ ERROR no associated function or constant named `N` found for type `u16` } diff --git a/tests/ui/ufcs/ufcs-partially-resolved.stderr b/tests/ui/ufcs/ufcs-partially-resolved.stderr index e1df200feccff..9efadec872b36 100644 --- a/tests/ui/ufcs/ufcs-partially-resolved.stderr +++ b/tests/ui/ufcs/ufcs-partially-resolved.stderr @@ -335,17 +335,17 @@ LL - let _: ::Y::NN; LL + let _: <::Y as Example>::NN; | -error[E0599]: no associated item named `NN` found for type `u16` in the current scope +error[E0599]: no associated function or constant named `NN` found for type `u16` in the current scope --> $DIR/ufcs-partially-resolved.rs:38:20 | LL | ::Y::NN; - | ^^ associated item not found in `u16` + | ^^ associated function or constant not found in `u16` -error[E0599]: no associated item named `N` found for type `u16` in the current scope +error[E0599]: no associated function or constant named `N` found for type `u16` in the current scope --> $DIR/ufcs-partially-resolved.rs:55:20 | LL | ::X::N; - | ^ associated item not found in `u16` + | ^ associated function or constant not found in `u16` error: aborting due to 32 previous errors