Auto merge of #57592 - Centril:rollup, r=Centril
Rollup of 6 pull requests Successful merges: - #57232 (Parallelize and optimize parts of HIR map creation) - #57418 (MetadataOnlyCodegenBackend: run the collector only once) - #57465 (Stabilize cfg_target_vendor) - #57477 (clarify resolve typo suggestion) - #57556 (privacy: Fix private-in-public check for existential types) - #57584 (Remove the `connect_timeout_unroutable` test.) Failed merges: r? @ghost
This commit is contained in:
commit
d10680818b
57 changed files with 340 additions and 253 deletions
|
@ -12,7 +12,7 @@
|
|||
#![panic_runtime]
|
||||
#![allow(unused_features)]
|
||||
|
||||
#![feature(cfg_target_vendor)]
|
||||
#![cfg_attr(stage0, feature(cfg_target_vendor))]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(libc)]
|
||||
#![feature(nll)]
|
||||
|
|
|
@ -284,7 +284,7 @@ impl Def {
|
|||
}
|
||||
}
|
||||
|
||||
/// A human readable kind name
|
||||
/// A human readable name for the def kind ("function", "module", etc.).
|
||||
pub fn kind_name(&self) -> &'static str {
|
||||
match *self {
|
||||
Def::Fn(..) => "function",
|
||||
|
@ -324,6 +324,7 @@ impl Def {
|
|||
}
|
||||
}
|
||||
|
||||
/// An English article for the def.
|
||||
pub fn article(&self) -> &'static str {
|
||||
match *self {
|
||||
Def::AssociatedTy(..) | Def::AssociatedConst(..) | Def::AssociatedExistential(..) |
|
||||
|
|
|
@ -6,6 +6,7 @@ use rustc_data_structures::svh::Svh;
|
|||
use ich::Fingerprint;
|
||||
use middle::cstore::CrateStore;
|
||||
use session::CrateDisambiguator;
|
||||
use session::Session;
|
||||
use std::iter::repeat;
|
||||
use syntax::ast::{NodeId, CRATE_NODE_ID};
|
||||
use syntax::source_map::SourceMap;
|
||||
|
@ -92,11 +93,11 @@ where
|
|||
}
|
||||
|
||||
impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
||||
pub(super) fn root(krate: &'hir Crate,
|
||||
pub(super) fn root(sess: &'a Session,
|
||||
krate: &'hir Crate,
|
||||
dep_graph: &'a DepGraph,
|
||||
definitions: &'a definitions::Definitions,
|
||||
mut hcx: StableHashingContext<'a>,
|
||||
source_map: &'a SourceMap)
|
||||
mut hcx: StableHashingContext<'a>)
|
||||
-> NodeCollector<'a, 'hir> {
|
||||
let root_mod_def_path_hash = definitions.def_path_hash(CRATE_DEF_INDEX);
|
||||
|
||||
|
@ -141,8 +142,8 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
|||
|
||||
let mut collector = NodeCollector {
|
||||
krate,
|
||||
source_map,
|
||||
map: vec![],
|
||||
source_map: sess.source_map(),
|
||||
map: repeat(None).take(sess.current_node_id_count()).collect(),
|
||||
parent_node: CRATE_NODE_ID,
|
||||
current_signature_dep_index: root_mod_sig_dep_index,
|
||||
current_full_dep_index: root_mod_full_dep_index,
|
||||
|
@ -219,10 +220,6 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
|||
|
||||
fn insert_entry(&mut self, id: NodeId, entry: Entry<'hir>) {
|
||||
debug!("hir_map: {:?} => {:?}", id, entry);
|
||||
let len = self.map.len();
|
||||
if id.as_usize() >= len {
|
||||
self.map.extend(repeat(None).take(id.as_usize() - len + 1));
|
||||
}
|
||||
self.map[id.as_usize()] = Some(entry);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,19 +3,24 @@ use hir::{self, intravisit, HirId, ItemLocalId};
|
|||
use syntax::ast::NodeId;
|
||||
use hir::itemlikevisit::ItemLikeVisitor;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::sync::{Lock, ParallelIterator, par_iter};
|
||||
|
||||
pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) {
|
||||
let mut outer_visitor = OuterVisitor {
|
||||
hir_map,
|
||||
errors: vec![],
|
||||
};
|
||||
|
||||
hir_map.dep_graph.assert_ignored();
|
||||
|
||||
hir_map.krate().visit_all_item_likes(&mut outer_visitor);
|
||||
if !outer_visitor.errors.is_empty() {
|
||||
let message = outer_visitor
|
||||
.errors
|
||||
let errors = Lock::new(Vec::new());
|
||||
|
||||
par_iter(&hir_map.krate().modules).for_each(|(module_id, _)| {
|
||||
hir_map.visit_item_likes_in_module(hir_map.local_def_id(*module_id), &mut OuterVisitor {
|
||||
hir_map,
|
||||
errors: &errors,
|
||||
});
|
||||
});
|
||||
|
||||
let errors = errors.into_inner();
|
||||
|
||||
if !errors.is_empty() {
|
||||
let message = errors
|
||||
.iter()
|
||||
.fold(String::new(), |s1, s2| s1 + "\n" + s2);
|
||||
bug!("{}", message);
|
||||
|
@ -26,12 +31,12 @@ struct HirIdValidator<'a, 'hir: 'a> {
|
|||
hir_map: &'a hir::map::Map<'hir>,
|
||||
owner_def_index: Option<DefIndex>,
|
||||
hir_ids_seen: FxHashMap<ItemLocalId, NodeId>,
|
||||
errors: Vec<String>,
|
||||
errors: &'a Lock<Vec<String>>,
|
||||
}
|
||||
|
||||
struct OuterVisitor<'a, 'hir: 'a> {
|
||||
hir_map: &'a hir::map::Map<'hir>,
|
||||
errors: Vec<String>,
|
||||
errors: &'a Lock<Vec<String>>,
|
||||
}
|
||||
|
||||
impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> {
|
||||
|
@ -42,7 +47,7 @@ impl<'a, 'hir: 'a> OuterVisitor<'a, 'hir> {
|
|||
hir_map,
|
||||
owner_def_index: None,
|
||||
hir_ids_seen: Default::default(),
|
||||
errors: Vec::new(),
|
||||
errors: self.errors,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,23 +56,25 @@ impl<'a, 'hir: 'a> ItemLikeVisitor<'hir> for OuterVisitor<'a, 'hir> {
|
|||
fn visit_item(&mut self, i: &'hir hir::Item) {
|
||||
let mut inner_visitor = self.new_inner_visitor(self.hir_map);
|
||||
inner_visitor.check(i.id, |this| intravisit::walk_item(this, i));
|
||||
self.errors.extend(inner_visitor.errors.drain(..));
|
||||
}
|
||||
|
||||
fn visit_trait_item(&mut self, i: &'hir hir::TraitItem) {
|
||||
let mut inner_visitor = self.new_inner_visitor(self.hir_map);
|
||||
inner_visitor.check(i.id, |this| intravisit::walk_trait_item(this, i));
|
||||
self.errors.extend(inner_visitor.errors.drain(..));
|
||||
}
|
||||
|
||||
fn visit_impl_item(&mut self, i: &'hir hir::ImplItem) {
|
||||
let mut inner_visitor = self.new_inner_visitor(self.hir_map);
|
||||
inner_visitor.check(i.id, |this| intravisit::walk_impl_item(this, i));
|
||||
self.errors.extend(inner_visitor.errors.drain(..));
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> {
|
||||
#[cold]
|
||||
#[inline(never)]
|
||||
fn error(&self, f: impl FnOnce() -> String) {
|
||||
self.errors.lock().push(f());
|
||||
}
|
||||
|
||||
fn check<F: FnOnce(&mut HirIdValidator<'a, 'hir>)>(&mut self,
|
||||
node_id: NodeId,
|
||||
|
@ -119,7 +126,7 @@ impl<'a, 'hir: 'a> HirIdValidator<'a, 'hir> {
|
|||
local_id,
|
||||
self.hir_map.node_to_string(node_id)));
|
||||
}
|
||||
self.errors.push(format!(
|
||||
self.error(|| format!(
|
||||
"ItemLocalIds not assigned densely in {}. \
|
||||
Max ItemLocalId = {}, missing IDs = {:?}; seens IDs = {:?}",
|
||||
self.hir_map.def_path(DefId::local(owner_def_index)).to_string_no_crate(),
|
||||
|
@ -145,14 +152,14 @@ impl<'a, 'hir: 'a> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
|
|||
let stable_id = self.hir_map.definitions().node_to_hir_id[node_id];
|
||||
|
||||
if stable_id == hir::DUMMY_HIR_ID {
|
||||
self.errors.push(format!("HirIdValidator: No HirId assigned for NodeId {}: {:?}",
|
||||
self.error(|| format!("HirIdValidator: No HirId assigned for NodeId {}: {:?}",
|
||||
node_id,
|
||||
self.hir_map.node_to_string(node_id)));
|
||||
return;
|
||||
}
|
||||
|
||||
if owner != stable_id.owner {
|
||||
self.errors.push(format!(
|
||||
self.error(|| format!(
|
||||
"HirIdValidator: The recorded owner of {} is {} instead of {}",
|
||||
self.hir_map.node_to_string(node_id),
|
||||
self.hir_map.def_path(DefId::local(stable_id.owner)).to_string_no_crate(),
|
||||
|
@ -161,7 +168,7 @@ impl<'a, 'hir: 'a> intravisit::Visitor<'hir> for HirIdValidator<'a, 'hir> {
|
|||
|
||||
if let Some(prev) = self.hir_ids_seen.insert(stable_id.local_id, node_id) {
|
||||
if prev != node_id {
|
||||
self.errors.push(format!(
|
||||
self.error(|| format!(
|
||||
"HirIdValidator: Same HirId {}/{} assigned for nodes {} and {}",
|
||||
self.hir_map.def_path(DefId::local(stable_id.owner)).to_string_no_crate(),
|
||||
stable_id.local_id.as_usize(),
|
||||
|
|
|
@ -7,10 +7,11 @@ use dep_graph::{DepGraph, DepNode, DepKind, DepNodeIndex};
|
|||
|
||||
use hir::def_id::{CRATE_DEF_INDEX, DefId, LocalDefId, DefIndexAddressSpace};
|
||||
|
||||
use middle::cstore::CrateStore;
|
||||
use middle::cstore::CrateStoreDyn;
|
||||
|
||||
use rustc_target::spec::abi::Abi;
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::join;
|
||||
use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID};
|
||||
use syntax::source_map::Spanned;
|
||||
use syntax::ext::base::MacroKind;
|
||||
|
@ -20,6 +21,7 @@ use hir::*;
|
|||
use hir::itemlikevisit::ItemLikeVisitor;
|
||||
use hir::print::Nested;
|
||||
use util::nodemap::FxHashMap;
|
||||
use util::common::time;
|
||||
|
||||
use std::io;
|
||||
use std::result::Result::Err;
|
||||
|
@ -1045,26 +1047,32 @@ impl Named for TraitItem { fn name(&self) -> Name { self.ident.name } }
|
|||
impl Named for ImplItem { fn name(&self) -> Name { self.ident.name } }
|
||||
|
||||
pub fn map_crate<'hir>(sess: &::session::Session,
|
||||
cstore: &dyn CrateStore,
|
||||
forest: &'hir mut Forest,
|
||||
cstore: &CrateStoreDyn,
|
||||
forest: &'hir Forest,
|
||||
definitions: &'hir Definitions)
|
||||
-> Map<'hir> {
|
||||
let (map, crate_hash) = {
|
||||
let ((map, crate_hash), hir_to_node_id) = join(|| {
|
||||
let hcx = ::ich::StableHashingContext::new(sess, &forest.krate, definitions, cstore);
|
||||
|
||||
let mut collector = NodeCollector::root(&forest.krate,
|
||||
let mut collector = NodeCollector::root(sess,
|
||||
&forest.krate,
|
||||
&forest.dep_graph,
|
||||
&definitions,
|
||||
hcx,
|
||||
sess.source_map());
|
||||
hcx);
|
||||
intravisit::walk_crate(&mut collector, &forest.krate);
|
||||
|
||||
let crate_disambiguator = sess.local_crate_disambiguator();
|
||||
let cmdline_args = sess.opts.dep_tracking_hash();
|
||||
collector.finalize_and_compute_crate_hash(crate_disambiguator,
|
||||
cstore,
|
||||
cmdline_args)
|
||||
};
|
||||
collector.finalize_and_compute_crate_hash(
|
||||
crate_disambiguator,
|
||||
cstore,
|
||||
cmdline_args
|
||||
)
|
||||
}, || {
|
||||
// Build the reverse mapping of `node_to_hir_id`.
|
||||
definitions.node_to_hir_id.iter_enumerated()
|
||||
.map(|(node_id, &hir_id)| (hir_id, node_id)).collect()
|
||||
});
|
||||
|
||||
if log_enabled!(::log::Level::Debug) {
|
||||
// This only makes sense for ordered stores; note the
|
||||
|
@ -1078,10 +1086,6 @@ pub fn map_crate<'hir>(sess: &::session::Session,
|
|||
entries, vector_length, (entries as f64 / vector_length as f64) * 100.);
|
||||
}
|
||||
|
||||
// Build the reverse mapping of `node_to_hir_id`.
|
||||
let hir_to_node_id = definitions.node_to_hir_id.iter_enumerated()
|
||||
.map(|(node_id, &hir_id)| (hir_id, node_id)).collect();
|
||||
|
||||
let map = Map {
|
||||
forest,
|
||||
dep_graph: forest.dep_graph.clone(),
|
||||
|
@ -1091,7 +1095,9 @@ pub fn map_crate<'hir>(sess: &::session::Session,
|
|||
definitions,
|
||||
};
|
||||
|
||||
hir_id_validator::check_crate(&map);
|
||||
time(sess, "validate hir map", || {
|
||||
hir_id_validator::check_crate(&map);
|
||||
});
|
||||
|
||||
map
|
||||
}
|
||||
|
|
|
@ -407,6 +407,9 @@ impl Session {
|
|||
pub fn next_node_id(&self) -> NodeId {
|
||||
self.reserve_node_ids(1)
|
||||
}
|
||||
pub(crate) fn current_node_id_count(&self) -> usize {
|
||||
self.next_node_id.get().as_u32() as usize
|
||||
}
|
||||
pub fn diagnostic<'a>(&'a self) -> &'a errors::Handler {
|
||||
&self.parse_sess.span_diagnostic
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ use rustc::middle::cstore::EncodedMetadata;
|
|||
use rustc::middle::cstore::MetadataLoader;
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc_target::spec::Target;
|
||||
use rustc_mir::monomorphize::collector;
|
||||
use link::out_filename;
|
||||
|
||||
pub use rustc_data_structures::sync::MetadataRef;
|
||||
|
@ -136,25 +135,15 @@ impl CodegenBackend for MetadataOnlyCodegenBackend {
|
|||
::symbol_names_test::report_symbol_names(tcx);
|
||||
::rustc_incremental::assert_dep_graph(tcx);
|
||||
::rustc_incremental::assert_module_sources::assert_module_sources(tcx);
|
||||
::rustc_mir::monomorphize::assert_symbols_are_distinct(tcx,
|
||||
collector::collect_crate_mono_items(
|
||||
tcx,
|
||||
collector::MonoItemCollectionMode::Eager
|
||||
).0.iter()
|
||||
);
|
||||
// FIXME: Fix this
|
||||
// ::rustc::middle::dependency_format::calculate(tcx);
|
||||
let _ = tcx.link_args(LOCAL_CRATE);
|
||||
let _ = tcx.native_libraries(LOCAL_CRATE);
|
||||
for mono_item in
|
||||
collector::collect_crate_mono_items(
|
||||
tcx,
|
||||
collector::MonoItemCollectionMode::Eager
|
||||
).0 {
|
||||
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
|
||||
for (mono_item, _) in cgus.iter().flat_map(|cgu| cgu.items().iter()) {
|
||||
if let MonoItem::Fn(inst) = mono_item {
|
||||
let def_id = inst.def_id();
|
||||
if def_id.is_local() {
|
||||
let _ = inst.def.is_inline(tcx);
|
||||
if def_id.is_local() {
|
||||
let _ = tcx.codegen_fn_attrs(def_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ mod diagnostics;
|
|||
/// Default type visitor (`TypeVisitor`) does most of the job, but it has some shortcomings.
|
||||
/// First, it doesn't have overridable `fn visit_trait_ref`, so we have to catch trait def-ids
|
||||
/// manually. Second, it doesn't visit some type components like signatures of fn types, or traits
|
||||
/// in `impl Trait`, see individual commits in `DefIdVisitorSkeleton::visit_ty`.
|
||||
/// in `impl Trait`, see individual comments in `DefIdVisitorSkeleton::visit_ty`.
|
||||
trait DefIdVisitor<'a, 'tcx: 'a> {
|
||||
fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>;
|
||||
fn shallow(&self) -> bool { false }
|
||||
|
@ -1579,10 +1579,15 @@ impl<'a, 'tcx> Visitor<'tcx> for PrivateItemsInPublicInterfacesVisitor<'a, 'tcx>
|
|||
// No subitems.
|
||||
hir::ItemKind::GlobalAsm(..) => {}
|
||||
// Subitems of these items have inherited publicity.
|
||||
hir::ItemKind::Const(..) | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) |
|
||||
hir::ItemKind::Existential(..) | hir::ItemKind::Ty(..) => {
|
||||
hir::ItemKind::Const(..) | hir::ItemKind::Static(..) |
|
||||
hir::ItemKind::Fn(..) | hir::ItemKind::Ty(..) => {
|
||||
self.check(item.id, item_visibility).generics().predicates().ty();
|
||||
}
|
||||
hir::ItemKind::Existential(..) => {
|
||||
// `ty()` for existential types is the underlying type,
|
||||
// it's not a part of interface, so we skip it.
|
||||
self.check(item.id, item_visibility).generics().predicates();
|
||||
}
|
||||
hir::ItemKind::Trait(.., ref trait_item_refs) => {
|
||||
self.check(item.id, item_visibility).generics().predicates();
|
||||
|
||||
|
|
|
@ -120,6 +120,16 @@ struct BindingError {
|
|||
target: BTreeSet<Span>,
|
||||
}
|
||||
|
||||
struct TypoSuggestion {
|
||||
candidate: Symbol,
|
||||
|
||||
/// The kind of the binding ("crate", "module", etc.)
|
||||
kind: &'static str,
|
||||
|
||||
/// An appropriate article to refer to the binding ("a", "an", etc.)
|
||||
article: &'static str,
|
||||
}
|
||||
|
||||
impl PartialOrd for BindingError {
|
||||
fn partial_cmp(&self, other: &BindingError) -> Option<cmp::Ordering> {
|
||||
Some(self.cmp(other))
|
||||
|
@ -1448,7 +1458,7 @@ impl PrimitiveTypeTable {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct ExternPreludeEntry<'a> {
|
||||
extern_crate_item: Option<&'a NameBinding<'a>>,
|
||||
pub introduced_by_item: bool,
|
||||
|
@ -3291,8 +3301,19 @@ impl<'a> Resolver<'a> {
|
|||
let mut levenshtein_worked = false;
|
||||
|
||||
// Try Levenshtein algorithm.
|
||||
if let Some(candidate) = this.lookup_typo_candidate(path, ns, is_expected, span) {
|
||||
err.span_label(ident_span, format!("did you mean `{}`?", candidate));
|
||||
let suggestion = this.lookup_typo_candidate(path, ns, is_expected, span);
|
||||
if let Some(suggestion) = suggestion {
|
||||
let msg = format!(
|
||||
"{} {} with a similar name exists",
|
||||
suggestion.article, suggestion.kind
|
||||
);
|
||||
err.span_suggestion_with_applicability(
|
||||
ident_span,
|
||||
&msg,
|
||||
suggestion.candidate.to_string(),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
||||
levenshtein_worked = true;
|
||||
}
|
||||
|
||||
|
@ -4183,19 +4204,25 @@ impl<'a> Resolver<'a> {
|
|||
None
|
||||
}
|
||||
|
||||
fn lookup_typo_candidate<FilterFn>(&mut self,
|
||||
path: &[Segment],
|
||||
ns: Namespace,
|
||||
filter_fn: FilterFn,
|
||||
span: Span)
|
||||
-> Option<Symbol>
|
||||
where FilterFn: Fn(Def) -> bool
|
||||
fn lookup_typo_candidate<FilterFn>(
|
||||
&mut self,
|
||||
path: &[Segment],
|
||||
ns: Namespace,
|
||||
filter_fn: FilterFn,
|
||||
span: Span,
|
||||
) -> Option<TypoSuggestion>
|
||||
where
|
||||
FilterFn: Fn(Def) -> bool,
|
||||
{
|
||||
let add_module_candidates = |module: Module, names: &mut Vec<Name>| {
|
||||
let add_module_candidates = |module: Module, names: &mut Vec<TypoSuggestion>| {
|
||||
for (&(ident, _), resolution) in module.resolutions.borrow().iter() {
|
||||
if let Some(binding) = resolution.borrow().binding {
|
||||
if filter_fn(binding.def()) {
|
||||
names.push(ident.name);
|
||||
names.push(TypoSuggestion {
|
||||
candidate: ident.name,
|
||||
article: binding.def().article(),
|
||||
kind: binding.def().kind_name(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4209,7 +4236,11 @@ impl<'a> Resolver<'a> {
|
|||
// Locals and type parameters
|
||||
for (ident, def) in &rib.bindings {
|
||||
if filter_fn(*def) {
|
||||
names.push(ident.name);
|
||||
names.push(TypoSuggestion {
|
||||
candidate: ident.name,
|
||||
article: def.article(),
|
||||
kind: def.kind_name(),
|
||||
});
|
||||
}
|
||||
}
|
||||
// Items in scope
|
||||
|
@ -4222,7 +4253,13 @@ impl<'a> Resolver<'a> {
|
|||
} else {
|
||||
// Items from the prelude
|
||||
if !module.no_implicit_prelude {
|
||||
names.extend(self.extern_prelude.iter().map(|(ident, _)| ident.name));
|
||||
names.extend(self.extern_prelude.iter().map(|(ident, _)| {
|
||||
TypoSuggestion {
|
||||
candidate: ident.name,
|
||||
article: "a",
|
||||
kind: "crate",
|
||||
}
|
||||
}));
|
||||
if let Some(prelude) = self.prelude {
|
||||
add_module_candidates(prelude, &mut names);
|
||||
}
|
||||
|
@ -4234,7 +4271,13 @@ impl<'a> Resolver<'a> {
|
|||
// Add primitive types to the mix
|
||||
if filter_fn(Def::PrimTy(Bool)) {
|
||||
names.extend(
|
||||
self.primitive_type_table.primitive_types.iter().map(|(name, _)| name)
|
||||
self.primitive_type_table.primitive_types.iter().map(|(name, _)| {
|
||||
TypoSuggestion {
|
||||
candidate: *name,
|
||||
article: "a",
|
||||
kind: "primitive type",
|
||||
}
|
||||
})
|
||||
)
|
||||
}
|
||||
} else {
|
||||
|
@ -4251,9 +4294,16 @@ impl<'a> Resolver<'a> {
|
|||
|
||||
let name = path[path.len() - 1].ident.name;
|
||||
// Make sure error reporting is deterministic.
|
||||
names.sort_by_cached_key(|name| name.as_str());
|
||||
match find_best_match_for_name(names.iter(), &name.as_str(), None) {
|
||||
Some(found) if found != name => Some(found),
|
||||
names.sort_by_cached_key(|suggestion| suggestion.candidate.as_str());
|
||||
|
||||
match find_best_match_for_name(
|
||||
names.iter().map(|suggestion| &suggestion.candidate),
|
||||
&name.as_str(),
|
||||
None,
|
||||
) {
|
||||
Some(found) if found != name => names
|
||||
.into_iter()
|
||||
.find(|suggestion| suggestion.candidate == found),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1015,6 +1015,7 @@ impl<'a> Resolver<'a> {
|
|||
};
|
||||
let ident = Ident::new(Symbol::intern(name), span);
|
||||
self.lookup_typo_candidate(&[Segment::from_ident(ident)], MacroNS, is_macro, span)
|
||||
.map(|suggestion| suggestion.candidate)
|
||||
});
|
||||
|
||||
if let Some(suggestion) = suggestion {
|
||||
|
|
|
@ -370,6 +370,7 @@ impl<'a> fmt::Display for Html<'a> {
|
|||
"pc" => "PC",
|
||||
"rumprun" => "Rumprun",
|
||||
"sun" => "Sun",
|
||||
"fortanix" => "Fortanix",
|
||||
_ => ""
|
||||
},
|
||||
("target_env", Some(env)) => match &*env.as_str() {
|
||||
|
@ -378,6 +379,7 @@ impl<'a> fmt::Display for Html<'a> {
|
|||
"musl" => "musl",
|
||||
"newlib" => "Newlib",
|
||||
"uclibc" => "uClibc",
|
||||
"sgx" => "SGX",
|
||||
_ => "",
|
||||
},
|
||||
("target_endian", Some(endian)) => return write!(fmt, "{}-endian", endian),
|
||||
|
|
|
@ -238,7 +238,7 @@
|
|||
#![feature(c_variadic)]
|
||||
#![feature(cfg_target_has_atomic)]
|
||||
#![feature(cfg_target_thread_local)]
|
||||
#![feature(cfg_target_vendor)]
|
||||
#![cfg_attr(stage0, feature(cfg_target_vendor))]
|
||||
#![feature(char_error_internals)]
|
||||
#![feature(compiler_builtins_lib)]
|
||||
#![feature(concat_idents)]
|
||||
|
|
|
@ -1673,17 +1673,6 @@ mod tests {
|
|||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn connect_timeout_unroutable() {
|
||||
// this IP is unroutable, so connections should always time out,
|
||||
// provided the network is reachable to begin with.
|
||||
let addr = "10.255.255.1:80".parse().unwrap();
|
||||
let e = TcpStream::connect_timeout(&addr, Duration::from_millis(250)).unwrap_err();
|
||||
assert!(e.kind() == io::ErrorKind::TimedOut ||
|
||||
e.kind() == io::ErrorKind::Other,
|
||||
"bad error: {} {:?}", e, e.kind());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn connect_timeout_unbound() {
|
||||
// bind and drop a socket to track down a "probably unassigned" port
|
||||
|
|
|
@ -244,9 +244,6 @@ declare_features! (
|
|||
// rustc internal
|
||||
(active, omit_gdb_pretty_printer_section, "1.5.0", None, None),
|
||||
|
||||
// Allows `cfg(target_vendor = "...")`.
|
||||
(active, cfg_target_vendor, "1.5.0", Some(29718), None),
|
||||
|
||||
// Allows attributes on expressions and non-item statements.
|
||||
(active, stmt_expr_attributes, "1.6.0", Some(15701), None),
|
||||
|
||||
|
@ -686,6 +683,8 @@ declare_features! (
|
|||
(accepted, if_while_or_patterns, "1.33.0", Some(48215), None),
|
||||
// Allows `use x::y;` to search `x` in the current scope.
|
||||
(accepted, uniform_paths, "1.32.0", Some(53130), None),
|
||||
// Allows `cfg(target_vendor = "...")`.
|
||||
(accepted, cfg_target_vendor, "1.33.0", Some(29718), None),
|
||||
);
|
||||
|
||||
// If you change this, please modify `src/doc/unstable-book` as well. You must
|
||||
|
@ -1181,7 +1180,6 @@ pub const BUILTIN_ATTRIBUTES: &[(&str, AttributeType, AttributeGate)] = &[
|
|||
// cfg(...)'s that are feature gated
|
||||
const GATED_CFGS: &[(&str, &str, fn(&Features) -> bool)] = &[
|
||||
// (name in cfg, feature, function to check if the feature is enabled)
|
||||
("target_vendor", "cfg_target_vendor", cfg_fn!(cfg_target_vendor)),
|
||||
("target_thread_local", "cfg_target_thread_local", cfg_fn!(cfg_target_thread_local)),
|
||||
("target_has_atomic", "cfg_target_has_atomic", cfg_fn!(cfg_target_has_atomic)),
|
||||
("rustdoc", "doc_cfg", cfg_fn!(doc_cfg)),
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))]
|
||||
#![feature(asm)]
|
||||
#![feature(cfg_target_vendor)]
|
||||
#![cfg_attr(stage0, feature(cfg_target_vendor))]
|
||||
#![feature(fnbox)]
|
||||
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
|
||||
#![feature(nll)]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#![no_std]
|
||||
#![unstable(feature = "panic_unwind", issue = "32837")]
|
||||
|
||||
#![feature(cfg_target_vendor)]
|
||||
#![cfg_attr(stage0, feature(cfg_target_vendor))]
|
||||
#![feature(link_cfg)]
|
||||
#![feature(nll)]
|
||||
#![feature(staged_api)]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
// run-pass
|
||||
#![feature(cfg_target_vendor)]
|
||||
|
||||
#[cfg(target_vendor = "unknown")]
|
||||
pub fn main() {
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0412]: cannot find type `A` in this scope
|
|||
--> $DIR/associated-types-eq-1.rs:10:12
|
||||
|
|
||||
LL | let _: A = x.boo(); //~ ERROR cannot find type `A` in this scope
|
||||
| ^ did you mean `I`?
|
||||
| ^ help: a type parameter with a similar name exists: `I`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ error[E0423]: expected value, found struct `Empty1`
|
|||
LL | let e1 = Empty1; //~ ERROR expected value, found struct `Empty1`
|
||||
| ^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty2`?
|
||||
| did you mean `Empty1 { /* fields */ }`?
|
||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
||||
|
||||
error[E0423]: expected function, found struct `Empty1`
|
||||
--> $DIR/empty-struct-braces-expr.rs:16:14
|
||||
|
@ -13,8 +13,8 @@ error[E0423]: expected function, found struct `Empty1`
|
|||
LL | let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1`
|
||||
| ^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty2`?
|
||||
| did you mean `Empty1 { /* fields */ }`?
|
||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
||||
|
||||
error[E0423]: expected value, found struct variant `E::Empty3`
|
||||
--> $DIR/empty-struct-braces-expr.rs:17:14
|
||||
|
@ -34,8 +34,8 @@ error[E0423]: expected value, found struct `XEmpty1`
|
|||
LL | let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1`
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty2`?
|
||||
| did you mean `XEmpty1 { /* fields */ }`?
|
||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
||||
|
||||
error[E0423]: expected function, found struct `XEmpty1`
|
||||
--> $DIR/empty-struct-braces-expr.rs:21:15
|
||||
|
@ -43,8 +43,8 @@ error[E0423]: expected function, found struct `XEmpty1`
|
|||
LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1`
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty2`?
|
||||
| did you mean `XEmpty1 { /* fields */ }`?
|
||||
| help: a unit struct with a similar name exists: `XEmpty2`
|
||||
|
||||
error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope
|
||||
--> $DIR/empty-struct-braces-expr.rs:22:19
|
||||
|
|
|
@ -10,7 +10,7 @@ error[E0532]: expected unit struct/variant or constant, found struct variant `XE
|
|||
LL | XE::XEmpty3 => ()
|
||||
| ^^^^-------
|
||||
| | |
|
||||
| | did you mean `XEmpty4`?
|
||||
| | help: a unit variant with a similar name exists: `XEmpty4`
|
||||
| did you mean `XE::XEmpty3 { /* fields */ }`?
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
@ -4,8 +4,8 @@ error[E0532]: expected tuple struct/variant, found struct `Empty1`
|
|||
LL | Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
|
||||
| ^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty6`?
|
||||
| did you mean `Empty1 { /* fields */ }`?
|
||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
|
||||
--> $DIR/empty-struct-braces-pat-2.rs:18:9
|
||||
|
@ -13,8 +13,8 @@ error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
|
|||
LL | XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty6`?
|
||||
| did you mean `XEmpty1 { /* fields */ }`?
|
||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found struct `Empty1`
|
||||
--> $DIR/empty-struct-braces-pat-2.rs:21:9
|
||||
|
@ -22,8 +22,8 @@ error[E0532]: expected tuple struct/variant, found struct `Empty1`
|
|||
LL | Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
|
||||
| ^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty6`?
|
||||
| did you mean `Empty1 { /* fields */ }`?
|
||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
|
||||
--> $DIR/empty-struct-braces-pat-2.rs:24:9
|
||||
|
@ -31,8 +31,8 @@ error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
|
|||
LL | XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
|
||||
| ^^^^^^^
|
||||
| |
|
||||
| did you mean `XEmpty6`?
|
||||
| did you mean `XEmpty1 { /* fields */ }`?
|
||||
| help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3`
|
|||
LL | XE::XEmpty3() => ()
|
||||
| ^^^^-------
|
||||
| | |
|
||||
| | did you mean `XEmpty5`?
|
||||
| | help: a tuple variant with a similar name exists: `XEmpty5`
|
||||
| did you mean `XE::XEmpty3 { /* fields */ }`?
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3`
|
||||
|
@ -25,7 +25,7 @@ error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3`
|
|||
LL | XE::XEmpty3(..) => ()
|
||||
| ^^^^-------
|
||||
| | |
|
||||
| | did you mean `XEmpty5`?
|
||||
| | help: a tuple variant with a similar name exists: `XEmpty5`
|
||||
| did you mean `XE::XEmpty3 { /* fields */ }`?
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
|
|
@ -28,7 +28,7 @@ error[E0532]: expected unit struct/variant or constant, found tuple variant `XE:
|
|||
LL | XE::XEmpty5 => (),
|
||||
| ^^^^-------
|
||||
| |
|
||||
| did you mean `XEmpty4`?
|
||||
| help: a unit variant with a similar name exists: `XEmpty4`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -2,25 +2,25 @@ error[E0532]: expected tuple struct/variant, found unit struct `Empty2`
|
|||
--> $DIR/empty-struct-unit-pat.rs:21:9
|
||||
|
|
||||
LL | Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
|
||||
| ^^^^^^ did you mean `XEmpty6`?
|
||||
| ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2`
|
||||
--> $DIR/empty-struct-unit-pat.rs:24:9
|
||||
|
|
||||
LL | XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
|
||||
| ^^^^^^^ did you mean `XEmpty6`?
|
||||
| ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found unit struct `Empty2`
|
||||
--> $DIR/empty-struct-unit-pat.rs:27:9
|
||||
|
|
||||
LL | Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
|
||||
| ^^^^^^ did you mean `XEmpty6`?
|
||||
| ^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2`
|
||||
--> $DIR/empty-struct-unit-pat.rs:30:9
|
||||
|
|
||||
LL | XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
|
||||
| ^^^^^^^ did you mean `XEmpty6`?
|
||||
| ^^^^^^^ help: a tuple struct with a similar name exists: `XEmpty6`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4`
|
||||
--> $DIR/empty-struct-unit-pat.rs:34:9
|
||||
|
@ -34,7 +34,7 @@ error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4`
|
|||
LL | XE::XEmpty4() => (),
|
||||
| ^^^^-------
|
||||
| |
|
||||
| did you mean `XEmpty5`?
|
||||
| help: a tuple variant with a similar name exists: `XEmpty5`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4`
|
||||
--> $DIR/empty-struct-unit-pat.rs:42:9
|
||||
|
@ -48,7 +48,7 @@ error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4`
|
|||
LL | XE::XEmpty4(..) => (),
|
||||
| ^^^^-------
|
||||
| |
|
||||
| did you mean `XEmpty5`?
|
||||
| help: a tuple variant with a similar name exists: `XEmpty5`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
@ -22,8 +22,8 @@ error[E0423]: expected function, found struct `Foo`
|
|||
LL | let f = Foo(); //~ ERROR E0423
|
||||
| ^^^
|
||||
| |
|
||||
| did you mean `foo`?
|
||||
| did you mean `Foo { /* fields */ }`?
|
||||
| help: a function with a similar name exists: `foo`
|
||||
|
||||
error[E0423]: expected value, found struct `S`
|
||||
--> $DIR/E0423.rs:12:32
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0425]: cannot find value `y` in this scope
|
|||
--> $DIR/error-festival.rs:14:5
|
||||
|
|
||||
LL | y = 2;
|
||||
| ^ did you mean `x`?
|
||||
| ^ help: a local variable with a similar name exists: `x`
|
||||
|
||||
error[E0603]: constant `FOO` is private
|
||||
--> $DIR/error-festival.rs:22:10
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#[cfg(target_vendor = "x")] //~ ERROR `cfg(target_vendor)` is experimental
|
||||
#[cfg_attr(target_vendor = "x", x)] //~ ERROR `cfg(target_vendor)` is experimental
|
||||
struct Foo(u64, u64);
|
||||
|
||||
#[cfg(not(any(all(target_vendor = "x"))))] //~ ERROR `cfg(target_vendor)` is experimental
|
||||
fn foo() {}
|
||||
|
||||
fn main() {
|
||||
cfg!(target_vendor = "x");
|
||||
//~^ ERROR `cfg(target_vendor)` is experimental and subject to change
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718)
|
||||
--> $DIR/feature-gate-cfg-target-vendor.rs:2:12
|
||||
|
|
||||
LL | #[cfg_attr(target_vendor = "x", x)] //~ ERROR `cfg(target_vendor)` is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_vendor)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718)
|
||||
--> $DIR/feature-gate-cfg-target-vendor.rs:1:7
|
||||
|
|
||||
LL | #[cfg(target_vendor = "x")] //~ ERROR `cfg(target_vendor)` is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_vendor)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718)
|
||||
--> $DIR/feature-gate-cfg-target-vendor.rs:5:19
|
||||
|
|
||||
LL | #[cfg(not(any(all(target_vendor = "x"))))] //~ ERROR `cfg(target_vendor)` is experimental
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_vendor)] to the crate attributes to enable
|
||||
|
||||
error[E0658]: `cfg(target_vendor)` is experimental and subject to change (see issue #29718)
|
||||
--> $DIR/feature-gate-cfg-target-vendor.rs:9:10
|
||||
|
|
||||
LL | cfg!(target_vendor = "x");
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(cfg_target_vendor)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
|
@ -47,7 +47,11 @@ error[E0412]: cannot find type `A` in this scope
|
|||
--> $DIR/glob-resolve1.rs:28:11
|
||||
|
|
||||
LL | foo::<A>(); //~ ERROR: cannot find type `A` in this scope
|
||||
| ^ did you mean `B`?
|
||||
| ^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | foo::<B>(); //~ ERROR: cannot find type `A` in this scope
|
||||
| ^
|
||||
help: possible candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use bar::A;
|
||||
|
@ -57,7 +61,11 @@ error[E0412]: cannot find type `C` in this scope
|
|||
--> $DIR/glob-resolve1.rs:29:11
|
||||
|
|
||||
LL | foo::<C>(); //~ ERROR: cannot find type `C` in this scope
|
||||
| ^ did you mean `B`?
|
||||
| ^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | foo::<B>(); //~ ERROR: cannot find type `C` in this scope
|
||||
| ^
|
||||
help: possible candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use bar::C;
|
||||
|
@ -67,7 +75,11 @@ error[E0412]: cannot find type `D` in this scope
|
|||
--> $DIR/glob-resolve1.rs:30:11
|
||||
|
|
||||
LL | foo::<D>(); //~ ERROR: cannot find type `D` in this scope
|
||||
| ^ did you mean `B`?
|
||||
| ^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | foo::<B>(); //~ ERROR: cannot find type `D` in this scope
|
||||
| ^
|
||||
help: possible candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use bar::D;
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0532]: expected tuple struct/variant, found function `foo`
|
|||
--> $DIR/issue-10200.rs:6:9
|
||||
|
|
||||
LL | foo(x) //~ ERROR expected tuple struct/variant, found function `foo`
|
||||
| ^^^ did you mean `Foo`?
|
||||
| ^^^ help: a tuple struct with a similar name exists: `Foo`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,10 +2,15 @@ error[E0573]: expected type, found variant `NoResult`
|
|||
--> $DIR/issue-17546.rs:12:17
|
||||
|
|
||||
LL | fn new() -> NoResult<MyEnum, String> {
|
||||
| --------^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| did you mean `Result`?
|
||||
| help: try using the variant's enum: `foo::MyEnum`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: try using the variant's enum
|
||||
|
|
||||
LL | fn new() -> foo::MyEnum {
|
||||
| ^^^^^^^^^^^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | fn new() -> Result<MyEnum, String> {
|
||||
| ^^^^^^
|
||||
|
||||
error[E0573]: expected type, found variant `Result`
|
||||
--> $DIR/issue-17546.rs:22:17
|
||||
|
@ -45,10 +50,15 @@ error[E0573]: expected type, found variant `NoResult`
|
|||
--> $DIR/issue-17546.rs:33:15
|
||||
|
|
||||
LL | fn newer() -> NoResult<foo::MyEnum, String> {
|
||||
| --------^^^^^^^^^^^^^^^^^^^^^
|
||||
| |
|
||||
| did you mean `Result`?
|
||||
| help: try using the variant's enum: `foo::MyEnum`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: try using the variant's enum
|
||||
|
|
||||
LL | fn newer() -> foo::MyEnum {
|
||||
| ^^^^^^^^^^^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | fn newer() -> Result<foo::MyEnum, String> {
|
||||
| ^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0425]: cannot find function `g` in this scope
|
|||
--> $DIR/issue-31845.rs:7:12
|
||||
|
|
||||
LL | g(); //~ ERROR cannot find function `g` in this scope
|
||||
| ^ did you mean `h`?
|
||||
| ^ help: a function with a similar name exists: `h`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ error[E0532]: expected unit struct/variant or constant, found tuple variant `Foo
|
|||
LL | Foo::Bar => {}
|
||||
| ^^^^^---
|
||||
| |
|
||||
| did you mean `Baz`?
|
||||
| help: a unit variant with a similar name exists: `Baz`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found unit struct `S`
|
||||
--> $DIR/issue-32004.rs:16:9
|
||||
|
|
|
@ -2,13 +2,13 @@ error[E0532]: expected tuple struct/variant, found constant `C`
|
|||
--> $DIR/issue-32086.rs:5:9
|
||||
|
|
||||
LL | let C(a) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
|
||||
| ^ did you mean `S`?
|
||||
| ^ help: a tuple struct with a similar name exists: `S`
|
||||
|
||||
error[E0532]: expected tuple struct/variant, found constant `C`
|
||||
--> $DIR/issue-32086.rs:6:9
|
||||
|
|
||||
LL | let C(..) = S(11); //~ ERROR expected tuple struct/variant, found constant `C`
|
||||
| ^ did you mean `S`?
|
||||
| ^ help: a tuple struct with a similar name exists: `S`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0422]: cannot find struct, variant or union type `TyUInt` in this scope
|
|||
--> $DIR/issue-46332.rs:9:5
|
||||
|
|
||||
LL | TyUInt {};
|
||||
| ^^^^^^ did you mean `TyUint`?
|
||||
| ^^^^^^ help: a struct with a similar name exists: `TyUint`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0412]: cannot find type `Fo` in this scope
|
|||
--> $DIR/issue-7607-1.rs:5:6
|
||||
|
|
||||
LL | impl Fo { //~ ERROR cannot find type `Fo` in this scope
|
||||
| ^^ did you mean `Fn`?
|
||||
| ^^ help: a trait with a similar name exists: `Fn`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,11 +2,13 @@ error[E0423]: expected value, found type alias `m1::S`
|
|||
--> $DIR/namespace-mix.rs:34:11
|
||||
|
|
||||
LL | check(m1::S); //~ ERROR expected value, found type alias `m1::S`
|
||||
| ^^^^-
|
||||
| |
|
||||
| did you mean `TS`?
|
||||
| ^^^^^
|
||||
|
|
||||
= note: can't use a type alias as a constructor
|
||||
help: a tuple struct with a similar name exists
|
||||
|
|
||||
LL | check(m1::TS); //~ ERROR expected value, found type alias `m1::S`
|
||||
| ^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use m2::S;
|
||||
|
@ -18,11 +20,13 @@ error[E0423]: expected value, found type alias `xm1::S`
|
|||
--> $DIR/namespace-mix.rs:40:11
|
||||
|
|
||||
LL | check(xm1::S); //~ ERROR expected value, found type alias `xm1::S`
|
||||
| ^^^^^-
|
||||
| |
|
||||
| did you mean `TS`?
|
||||
| ^^^^^^
|
||||
|
|
||||
= note: can't use a type alias as a constructor
|
||||
help: a tuple struct with a similar name exists
|
||||
|
|
||||
LL | check(xm1::TS); //~ ERROR expected value, found type alias `xm1::S`
|
||||
| ^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use m2::S;
|
||||
|
@ -34,10 +38,11 @@ error[E0423]: expected value, found struct variant `m7::V`
|
|||
--> $DIR/namespace-mix.rs:100:11
|
||||
|
|
||||
LL | check(m7::V); //~ ERROR expected value, found struct variant `m7::V`
|
||||
| ^^^^-
|
||||
| | |
|
||||
| | did you mean `TV`?
|
||||
| did you mean `m7::V { /* fields */ }`?
|
||||
| ^^^^^ did you mean `m7::V { /* fields */ }`?
|
||||
help: a tuple variant with a similar name exists
|
||||
|
|
||||
LL | check(m7::TV); //~ ERROR expected value, found struct variant `m7::V`
|
||||
| ^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use m8::V;
|
||||
|
@ -49,10 +54,11 @@ error[E0423]: expected value, found struct variant `xm7::V`
|
|||
--> $DIR/namespace-mix.rs:106:11
|
||||
|
|
||||
LL | check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V`
|
||||
| ^^^^^-
|
||||
| | |
|
||||
| | did you mean `TV`?
|
||||
| did you mean `xm7::V { /* fields */ }`?
|
||||
| ^^^^^^ did you mean `xm7::V { /* fields */ }`?
|
||||
help: a tuple variant with a similar name exists
|
||||
|
|
||||
LL | check(xm7::TV); //~ ERROR expected value, found struct variant `xm7::V`
|
||||
| ^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use m8::V;
|
||||
|
|
|
@ -10,7 +10,7 @@ error[E0532]: expected tuple struct/variant, found unit variant `A::D`
|
|||
LL | A::D(_) => (), //~ ERROR expected tuple struct/variant, found unit variant `A::D`
|
||||
| ^^^-
|
||||
| |
|
||||
| did you mean `B`?
|
||||
| help: a tuple variant with a similar name exists: `B`
|
||||
|
||||
error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
|
||||
--> $DIR/pattern-error-continue.rs:17:9
|
||||
|
|
|
@ -2,7 +2,11 @@ error[E0423]: expected function, found trait `Bar`
|
|||
--> $DIR/privacy-ns1.rs:20:5
|
||||
|
|
||||
LL | Bar(); //~ ERROR expected function, found trait `Bar`
|
||||
| ^^^ did you mean `Baz`?
|
||||
| ^^^
|
||||
help: a unit struct with a similar name exists
|
||||
|
|
||||
LL | Baz(); //~ ERROR expected function, found trait `Bar`
|
||||
| ^^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use foo1::Bar;
|
||||
|
@ -16,7 +20,11 @@ error[E0573]: expected type, found function `Bar`
|
|||
--> $DIR/privacy-ns1.rs:35:17
|
||||
|
|
||||
LL | let _x: Box<Bar>; //~ ERROR expected type, found function `Bar`
|
||||
| ^^^ did you mean `Baz`?
|
||||
| ^^^
|
||||
help: a struct with a similar name exists
|
||||
|
|
||||
LL | let _x: Box<Baz>; //~ ERROR expected type, found function `Bar`
|
||||
| ^^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use foo1::Bar;
|
||||
|
@ -30,7 +38,11 @@ error[E0425]: cannot find function `Bar` in this scope
|
|||
--> $DIR/privacy-ns1.rs:50:5
|
||||
|
|
||||
LL | Bar(); //~ ERROR cannot find function `Bar` in this scope
|
||||
| ^^^ did you mean `Baz`?
|
||||
| ^^^
|
||||
help: a unit struct with a similar name exists
|
||||
|
|
||||
LL | Baz(); //~ ERROR cannot find function `Bar` in this scope
|
||||
| ^^^
|
||||
help: possible candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use foo1::Bar;
|
||||
|
@ -44,7 +56,11 @@ error[E0412]: cannot find type `Bar` in this scope
|
|||
--> $DIR/privacy-ns1.rs:51:17
|
||||
|
|
||||
LL | let _x: Box<Bar>; //~ ERROR cannot find type `Bar` in this scope
|
||||
| ^^^ did you mean `Baz`?
|
||||
| ^^^
|
||||
help: a struct with a similar name exists
|
||||
|
|
||||
LL | let _x: Box<Baz>; //~ ERROR cannot find type `Bar` in this scope
|
||||
| ^^^
|
||||
help: possible candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use foo1::Bar;
|
||||
|
|
|
@ -16,7 +16,11 @@ error[E0423]: expected function, found trait `Bar`
|
|||
--> $DIR/privacy-ns2.rs:26:5
|
||||
|
|
||||
LL | Bar(); //~ ERROR expected function, found trait `Bar`
|
||||
| ^^^ did you mean `Baz`?
|
||||
| ^^^
|
||||
help: a unit struct with a similar name exists
|
||||
|
|
||||
LL | Baz(); //~ ERROR expected function, found trait `Bar`
|
||||
| ^^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use foo1::Bar;
|
||||
|
@ -44,7 +48,11 @@ error[E0573]: expected type, found function `Bar`
|
|||
--> $DIR/privacy-ns2.rs:47:17
|
||||
|
|
||||
LL | let _x: Box<Bar>; //~ ERROR expected type, found function `Bar`
|
||||
| ^^^ did you mean `Baz`?
|
||||
| ^^^
|
||||
help: a struct with a similar name exists
|
||||
|
|
||||
LL | let _x: Box<Baz>; //~ ERROR expected type, found function `Bar`
|
||||
| ^^^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use foo1::Bar;
|
||||
|
|
15
src/test/ui/privacy/private-in-public-existential.rs
Normal file
15
src/test/ui/privacy/private-in-public-existential.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// compile-pass
|
||||
|
||||
#![feature(existential_type)]
|
||||
#![deny(private_in_public)]
|
||||
|
||||
pub existential type Pub: Default;
|
||||
|
||||
#[derive(Default)]
|
||||
struct Priv;
|
||||
|
||||
fn check() -> Pub {
|
||||
Priv
|
||||
}
|
||||
|
||||
fn main() {}
|
|
@ -11,6 +11,7 @@ fn main() {
|
|||
let foobar = 42;
|
||||
bang_proc_macro2!();
|
||||
//~^ ERROR cannot find value `foobar2` in this scope
|
||||
//~^^ did you mean `foobar`?
|
||||
//~| HELP a local variable with a similar name exists
|
||||
//~| SUGGESTION foobar
|
||||
println!("{}", x);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0425]: cannot find value `foobar2` in this scope
|
|||
--> $DIR/lints_in_proc_macros.rs:12:5
|
||||
|
|
||||
LL | bang_proc_macro2!();
|
||||
| ^^^^^^^^^^^^^^^^^^^^ did you mean `foobar`?
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: a local variable with a similar name exists: `foobar`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ error[E0425]: cannot find value `ok` in this scope
|
|||
--> $DIR/parent-source-spans.rs:30:5
|
||||
|
|
||||
LL | parent_source_spans!($($tokens)*);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok`
|
||||
...
|
||||
LL | one!("hello", "world");
|
||||
| ----------------------- in this macro invocation
|
||||
|
@ -137,7 +137,7 @@ error[E0425]: cannot find value `ok` in this scope
|
|||
--> $DIR/parent-source-spans.rs:30:5
|
||||
|
|
||||
LL | parent_source_spans!($($tokens)*);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok`
|
||||
...
|
||||
LL | two!("yay", "rust");
|
||||
| -------------------- in this macro invocation
|
||||
|
@ -146,7 +146,7 @@ error[E0425]: cannot find value `ok` in this scope
|
|||
--> $DIR/parent-source-spans.rs:30:5
|
||||
|
|
||||
LL | parent_source_spans!($($tokens)*);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `Ok`?
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: a tuple variant with a similar name exists: `Ok`
|
||||
...
|
||||
LL | three!("hip", "hop");
|
||||
| --------------------- in this macro invocation
|
||||
|
|
|
@ -4,8 +4,8 @@ error[E0423]: expected value, found struct `Handle`
|
|||
LL | handle: Handle
|
||||
| ^^^^^^
|
||||
| |
|
||||
| did you mean `handle`?
|
||||
| did you mean `Handle { /* fields */ }`?
|
||||
| help: a local variable with a similar name exists: `handle`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ error[E0404]: expected trait, found type alias `K`
|
|||
LL | impl K for isize {} //~ ERROR expected trait, found type alias `K`
|
||||
| ^
|
||||
| |
|
||||
| did you mean `I`?
|
||||
| type aliases cannot be used as traits
|
||||
| help: a trait with a similar name exists: `I`
|
||||
|
|
||||
= note: did you mean to use a trait alias?
|
||||
|
||||
|
|
|
@ -2,19 +2,19 @@ error[E0412]: cannot find type `esize` in this scope
|
|||
--> $DIR/levenshtein.rs:5:11
|
||||
|
|
||||
LL | fn foo(c: esize) {} // Misspelled primitive type name.
|
||||
| ^^^^^ did you mean `isize`?
|
||||
| ^^^^^ help: a primitive type with a similar name exists: `isize`
|
||||
|
||||
error[E0412]: cannot find type `Baz` in this scope
|
||||
--> $DIR/levenshtein.rs:10:10
|
||||
|
|
||||
LL | type A = Baz; // Misspelled type name.
|
||||
| ^^^ did you mean `Bar`?
|
||||
| ^^^ help: an enum with a similar name exists: `Bar`
|
||||
|
||||
error[E0412]: cannot find type `Opiton` in this scope
|
||||
--> $DIR/levenshtein.rs:12:10
|
||||
|
|
||||
LL | type B = Opiton<u8>; // Misspelled type name from the prelude.
|
||||
| ^^^^^^ did you mean `Option`?
|
||||
| ^^^^^^ help: an enum with a similar name exists: `Option`
|
||||
|
||||
error[E0412]: cannot find type `Baz` in this scope
|
||||
--> $DIR/levenshtein.rs:16:14
|
||||
|
@ -26,25 +26,25 @@ error[E0425]: cannot find value `MAXITEM` in this scope
|
|||
--> $DIR/levenshtein.rs:24:20
|
||||
|
|
||||
LL | let v = [0u32; MAXITEM]; // Misspelled constant name.
|
||||
| ^^^^^^^ did you mean `MAX_ITEM`?
|
||||
| ^^^^^^^ help: a constant with a similar name exists: `MAX_ITEM`
|
||||
|
||||
error[E0425]: cannot find function `foobar` in this scope
|
||||
--> $DIR/levenshtein.rs:26:5
|
||||
|
|
||||
LL | foobar(); // Misspelled function name.
|
||||
| ^^^^^^ did you mean `foo_bar`?
|
||||
| ^^^^^^ help: a function with a similar name exists: `foo_bar`
|
||||
|
||||
error[E0412]: cannot find type `first` in module `m`
|
||||
--> $DIR/levenshtein.rs:28:15
|
||||
|
|
||||
LL | let b: m::first = m::second; // Misspelled item in module.
|
||||
| ^^^^^ did you mean `First`?
|
||||
| ^^^^^ help: a struct with a similar name exists: `First`
|
||||
|
||||
error[E0425]: cannot find value `second` in module `m`
|
||||
--> $DIR/levenshtein.rs:28:26
|
||||
|
|
||||
LL | let b: m::first = m::second; // Misspelled item in module.
|
||||
| ^^^^^^ did you mean `Second`?
|
||||
| ^^^^^^ help: a unit struct with a similar name exists: `Second`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ error[E0423]: expected value, found enum `Z`
|
|||
--> $DIR/privacy-enum-ctor.rs:25:9
|
||||
|
|
||||
LL | Z;
|
||||
| ^ did you mean `f`?
|
||||
| ^ help: a function with a similar name exists: `f`
|
||||
|
|
||||
= note: did you mean to use one of the following variants?
|
||||
- `m::Z::Fn`
|
||||
|
@ -30,14 +30,16 @@ error[E0423]: expected value, found enum `m::E`
|
|||
--> $DIR/privacy-enum-ctor.rs:41:16
|
||||
|
|
||||
LL | let _: E = m::E;
|
||||
| ^^^-
|
||||
| |
|
||||
| did you mean `f`?
|
||||
| ^^^^
|
||||
|
|
||||
= note: did you mean to use one of the following variants?
|
||||
- `E::Fn`
|
||||
- `E::Struct`
|
||||
- `E::Unit`
|
||||
help: a function with a similar name exists
|
||||
|
|
||||
LL | let _: E = m::f;
|
||||
| ^
|
||||
help: possible better candidates are found in other modules, you can import them into scope
|
||||
|
|
||||
LL | use std::f32::consts::E;
|
||||
|
@ -78,7 +80,11 @@ error[E0412]: cannot find type `Z` in this scope
|
|||
--> $DIR/privacy-enum-ctor.rs:57:12
|
||||
|
|
||||
LL | let _: Z = m::n::Z;
|
||||
| ^ did you mean `E`?
|
||||
| ^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | let _: E = m::n::Z;
|
||||
| ^
|
||||
help: possible candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
|
@ -99,7 +105,11 @@ error[E0412]: cannot find type `Z` in this scope
|
|||
--> $DIR/privacy-enum-ctor.rs:61:12
|
||||
|
|
||||
LL | let _: Z = m::n::Z::Fn;
|
||||
| ^ did you mean `E`?
|
||||
| ^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | let _: E = m::n::Z::Fn;
|
||||
| ^
|
||||
help: possible candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
|
@ -109,7 +119,11 @@ error[E0412]: cannot find type `Z` in this scope
|
|||
--> $DIR/privacy-enum-ctor.rs:64:12
|
||||
|
|
||||
LL | let _: Z = m::n::Z::Struct;
|
||||
| ^ did you mean `E`?
|
||||
| ^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | let _: E = m::n::Z::Struct;
|
||||
| ^
|
||||
help: possible candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
|
@ -125,7 +139,11 @@ error[E0412]: cannot find type `Z` in this scope
|
|||
--> $DIR/privacy-enum-ctor.rs:68:12
|
||||
|
|
||||
LL | let _: Z = m::n::Z::Unit {};
|
||||
| ^ did you mean `E`?
|
||||
| ^
|
||||
help: an enum with a similar name exists
|
||||
|
|
||||
LL | let _: E = m::n::Z::Unit {};
|
||||
| ^
|
||||
help: possible candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
|
|
|
@ -2,10 +2,11 @@ error[E0423]: expected value, found struct `Z`
|
|||
--> $DIR/privacy-struct-ctor.rs:20:9
|
||||
|
|
||||
LL | Z;
|
||||
| ^ constructor is not visible here due to private fields
|
||||
help: a tuple struct with a similar name exists
|
||||
|
|
||||
LL | S;
|
||||
| ^
|
||||
| |
|
||||
| did you mean `S`?
|
||||
| constructor is not visible here due to private fields
|
||||
help: possible better candidate is found in another module, you can import it into scope
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
|
|
|
@ -28,7 +28,7 @@ error[E0423]: expected value, found module `a::b`
|
|||
LL | a::b.J
|
||||
| ^^^---
|
||||
| | |
|
||||
| | did you mean `I`?
|
||||
| | help: a constant with a similar name exists: `I`
|
||||
| did you mean `a::b::J`?
|
||||
|
||||
error[E0423]: expected value, found module `a`
|
||||
|
@ -45,7 +45,7 @@ error[E0423]: expected value, found module `a::b`
|
|||
LL | v.push(a::b);
|
||||
| ^^^-
|
||||
| |
|
||||
| did you mean `I`?
|
||||
| help: a constant with a similar name exists: `I`
|
||||
|
||||
error[E0423]: expected value, found module `a::b`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:45:5
|
||||
|
@ -53,7 +53,7 @@ error[E0423]: expected value, found module `a::b`
|
|||
LL | a::b.f()
|
||||
| ^^^-----
|
||||
| | |
|
||||
| | did you mean `I`?
|
||||
| | help: a constant with a similar name exists: `I`
|
||||
| did you mean `a::b::f(...)`?
|
||||
|
||||
error[E0423]: expected value, found module `a::b`
|
||||
|
@ -62,7 +62,7 @@ error[E0423]: expected value, found module `a::b`
|
|||
LL | a::b
|
||||
| ^^^-
|
||||
| |
|
||||
| did you mean `I`?
|
||||
| help: a constant with a similar name exists: `I`
|
||||
|
||||
error[E0423]: expected function, found module `a::b`
|
||||
--> $DIR/suggest-path-instead-of-mod-dot-item.rs:55:5
|
||||
|
@ -70,7 +70,7 @@ error[E0423]: expected function, found module `a::b`
|
|||
LL | a::b()
|
||||
| ^^^-
|
||||
| |
|
||||
| did you mean `I`?
|
||||
| help: a constant with a similar name exists: `I`
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0423]: expected function, found type alias `A`
|
|||
--> $DIR/tuple-struct-alias.rs:5:13
|
||||
|
|
||||
LL | let s = A(0, 1); //~ ERROR expected function
|
||||
| ^ did you mean `S`?
|
||||
| ^ help: a tuple struct with a similar name exists: `S`
|
||||
|
|
||||
= note: can't use a type alias as a constructor
|
||||
|
||||
|
@ -10,7 +10,7 @@ error[E0532]: expected tuple struct/variant, found type alias `A`
|
|||
--> $DIR/tuple-struct-alias.rs:7:9
|
||||
|
|
||||
LL | A(..) => {} //~ ERROR expected tuple struct/variant
|
||||
| ^ did you mean `S`?
|
||||
| ^ help: a tuple struct with a similar name exists: `S`
|
||||
|
|
||||
= note: can't use a type alias as a constructor
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ error[E0425]: cannot find value `fob` in this scope
|
|||
--> $DIR/typo-suggestion.rs:8:26
|
||||
|
|
||||
LL | println!("Hello {}", fob); //~ ERROR cannot find value
|
||||
| ^^^ did you mean `foo`?
|
||||
| ^^^ help: a local variable with a similar name exists: `foo`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ error[E0577]: expected module, found struct `S`
|
|||
LL | m!{ S<u8> } //~ ERROR unexpected generic arguments in path
|
||||
| -^^^^
|
||||
| |
|
||||
| did you mean `m`?
|
||||
| help: a module with a similar name exists: `m`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0425]: cannot find value `y` in this scope
|
|||
--> $DIR/struct-fields-shorthand-unresolved.rs:10:9
|
||||
|
|
||||
LL | y //~ ERROR cannot find value `y` in this scope
|
||||
| ^ did you mean `x`?
|
||||
| ^ help: a local variable with a similar name exists: `x`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0573]: expected type, found module `a`
|
|||
--> $DIR/trait-impl-for-module.rs:7:12
|
||||
|
|
||||
LL | impl A for a { //~ ERROR expected type, found module
|
||||
| ^ did you mean `A`?
|
||||
| ^ help: a trait with a similar name exists: `A`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ error[E0576]: cannot find associated type `N` in trait `Tr`
|
|||
--> $DIR/ufcs-partially-resolved.rs:19:24
|
||||
|
|
||||
LL | let _: <u8 as Tr>::N; //~ ERROR cannot find associated type `N` in trait `Tr`
|
||||
| ^ did you mean `Y`?
|
||||
| ^ help: an associated type with a similar name exists: `Y`
|
||||
|
||||
error[E0576]: cannot find associated type `N` in enum `E`
|
||||
--> $DIR/ufcs-partially-resolved.rs:20:23
|
||||
|
@ -32,7 +32,7 @@ error[E0576]: cannot find method or associated constant `N` in trait `Tr`
|
|||
--> $DIR/ufcs-partially-resolved.rs:22:17
|
||||
|
|
||||
LL | <u8 as Tr>::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr`
|
||||
| ^ did you mean `Y`?
|
||||
| ^ help: a method with a similar name exists: `Y`
|
||||
|
||||
error[E0576]: cannot find method or associated constant `N` in enum `E`
|
||||
--> $DIR/ufcs-partially-resolved.rs:23:16
|
||||
|
@ -62,7 +62,7 @@ error[E0576]: cannot find associated type `N` in trait `Tr`
|
|||
--> $DIR/ufcs-partially-resolved.rs:30:24
|
||||
|
|
||||
LL | let _: <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
|
||||
| ^ did you mean `Y`?
|
||||
| ^ help: an associated type with a similar name exists: `Y`
|
||||
|
||||
error[E0576]: cannot find associated type `N` in enum `E`
|
||||
--> $DIR/ufcs-partially-resolved.rs:31:23
|
||||
|
@ -80,7 +80,7 @@ error[E0576]: cannot find associated type `N` in trait `Tr`
|
|||
--> $DIR/ufcs-partially-resolved.rs:33:17
|
||||
|
|
||||
LL | <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
|
||||
| ^ did you mean `Y`?
|
||||
| ^ help: an associated type with a similar name exists: `Y`
|
||||
|
||||
error[E0576]: cannot find associated type `N` in enum `E`
|
||||
--> $DIR/ufcs-partially-resolved.rs:34:16
|
||||
|
@ -160,7 +160,7 @@ error[E0575]: expected associated type, found method `Dr::Z`
|
|||
LL | let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found method `Dr::Z`
|
||||
| ^^^^^^^^^^^^-
|
||||
| |
|
||||
| did you mean `X`?
|
||||
| help: an associated type with a similar name exists: `X`
|
||||
|
||||
error[E0575]: expected method or associated constant, found associated type `Dr::X`
|
||||
--> $DIR/ufcs-partially-resolved.rs:53:5
|
||||
|
@ -168,7 +168,7 @@ error[E0575]: expected method or associated constant, found associated type `Dr:
|
|||
LL | <u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X`
|
||||
| ^^^^^^^^^^^^-
|
||||
| |
|
||||
| did you mean `Z`?
|
||||
| help: a method with a similar name exists: `Z`
|
||||
|
|
||||
= note: can't use a type alias as a constructor
|
||||
|
||||
|
@ -178,7 +178,7 @@ error[E0575]: expected associated type, found method `Dr::Z`
|
|||
LL | let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found method `Dr::Z`
|
||||
| ^^^^^^^^^^^^-^^^
|
||||
| |
|
||||
| did you mean `X`?
|
||||
| help: an associated type with a similar name exists: `X`
|
||||
|
||||
error[E0223]: ambiguous associated type
|
||||
--> $DIR/ufcs-partially-resolved.rs:36:12
|
||||
|
|
|
@ -2,19 +2,19 @@ error[E0412]: cannot find type `B` in this scope
|
|||
--> $DIR/ui-testing-optout.rs:4:10
|
||||
|
|
||||
4 | type A = B; //~ ERROR
|
||||
| ^ did you mean `A`?
|
||||
| ^ help: a type alias with a similar name exists: `A`
|
||||
|
||||
error[E0412]: cannot find type `D` in this scope
|
||||
--> $DIR/ui-testing-optout.rs:10:10
|
||||
|
|
||||
10 | type C = D; //~ ERROR
|
||||
| ^ did you mean `A`?
|
||||
| ^ help: a type alias with a similar name exists: `A`
|
||||
|
||||
error[E0412]: cannot find type `F` in this scope
|
||||
--> $DIR/ui-testing-optout.rs:95:10
|
||||
|
|
||||
95 | type E = F; //~ ERROR
|
||||
| ^ did you mean `A`?
|
||||
| ^ help: a type alias with a similar name exists: `A`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue