Rollup merge of #98519 - TaKO8Ki:add-head-span-field-to-item-and-impl-item, r=cjgillot
Replace some `guess_head_span` with `def_span` This patch fixes a part of #97417. r? `@cjgillot`
This commit is contained in:
commit
d712f67897
40 changed files with 154 additions and 223 deletions
|
@ -812,12 +812,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
return FnSelfUse {
|
return FnSelfUse {
|
||||||
var_span: stmt.source_info.span,
|
var_span: stmt.source_info.span,
|
||||||
fn_call_span: *fn_span,
|
fn_call_span: *fn_span,
|
||||||
fn_span: self
|
fn_span: self.infcx.tcx.def_span(method_did),
|
||||||
.infcx
|
|
||||||
.tcx
|
|
||||||
.sess
|
|
||||||
.source_map()
|
|
||||||
.guess_head_span(self.infcx.tcx.def_span(method_did)),
|
|
||||||
kind,
|
kind,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,8 +155,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Ok(Some(ImplSource::UserDefined(data))) = implsrc {
|
if let Ok(Some(ImplSource::UserDefined(data))) = implsrc {
|
||||||
let span =
|
let span = tcx.def_span(data.impl_def_id);
|
||||||
tcx.sess.source_map().guess_head_span(tcx.def_span(data.impl_def_id));
|
|
||||||
err.span_note(span, "impl defined here, but it is not `const`");
|
err.span_note(span, "impl defined here, but it is not `const`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +204,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
|
||||||
|
|
||||||
match self_ty.kind() {
|
match self_ty.kind() {
|
||||||
FnDef(def_id, ..) => {
|
FnDef(def_id, ..) => {
|
||||||
let span = tcx.sess.source_map().guess_head_span(tcx.def_span(*def_id));
|
let span = tcx.def_span(*def_id);
|
||||||
if ccx.tcx.is_const_fn_raw(*def_id) {
|
if ccx.tcx.is_const_fn_raw(*def_id) {
|
||||||
span_bug!(span, "calling const FnDef errored when it shouldn't");
|
span_bug!(span, "calling const FnDef errored when it shouldn't");
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,12 +148,10 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
region: ty::Region<'tcx>,
|
region: ty::Region<'tcx>,
|
||||||
) -> (String, Span) {
|
) -> (String, Span) {
|
||||||
let sm = tcx.sess.source_map();
|
|
||||||
|
|
||||||
let scope = region.free_region_binding_scope(tcx).expect_local();
|
let scope = region.free_region_binding_scope(tcx).expect_local();
|
||||||
match *region {
|
match *region {
|
||||||
ty::ReEarlyBound(ref br) => {
|
ty::ReEarlyBound(ref br) => {
|
||||||
let mut sp = sm.guess_head_span(tcx.def_span(scope));
|
let mut sp = tcx.def_span(scope);
|
||||||
if let Some(param) =
|
if let Some(param) =
|
||||||
tcx.hir().get_generics(scope).and_then(|generics| generics.get_named(br.name))
|
tcx.hir().get_generics(scope).and_then(|generics| generics.get_named(br.name))
|
||||||
{
|
{
|
||||||
|
@ -174,7 +172,7 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
|
||||||
} else {
|
} else {
|
||||||
match fr.bound_region {
|
match fr.bound_region {
|
||||||
ty::BoundRegionKind::BrNamed(_, name) => {
|
ty::BoundRegionKind::BrNamed(_, name) => {
|
||||||
let mut sp = sm.guess_head_span(tcx.def_span(scope));
|
let mut sp = tcx.def_span(scope);
|
||||||
if let Some(param) =
|
if let Some(param) =
|
||||||
tcx.hir().get_generics(scope).and_then(|generics| generics.get_named(name))
|
tcx.hir().get_generics(scope).and_then(|generics| generics.get_named(name))
|
||||||
{
|
{
|
||||||
|
@ -193,7 +191,7 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
|
||||||
),
|
),
|
||||||
_ => (
|
_ => (
|
||||||
format!("the lifetime `{}` as defined here", region),
|
format!("the lifetime `{}` as defined here", region),
|
||||||
sm.guess_head_span(tcx.def_span(scope)),
|
tcx.def_span(scope),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,12 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||||
|
|
||||||
let mut err = struct_span_err!(self.tcx.sess, sp, E0276, "{}", msg);
|
let mut err = struct_span_err!(self.tcx.sess, sp, E0276, "{}", msg);
|
||||||
|
|
||||||
if let Some(trait_item_span) = self.tcx.hir().span_if_local(trait_item_def_id) {
|
if trait_item_def_id.is_local() {
|
||||||
let span = self.tcx.sess.source_map().guess_head_span(trait_item_span);
|
|
||||||
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
|
let item_name = self.tcx.item_name(impl_item_def_id.to_def_id());
|
||||||
err.span_label(span, format!("definition of `{}` from trait", item_name));
|
err.span_label(
|
||||||
|
self.tcx.def_span(trait_item_def_id),
|
||||||
|
format!("definition of `{}` from trait", item_name),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
err.span_label(sp, format!("impl has extra requirement {}", requirement));
|
err.span_label(sp, format!("impl has extra requirement {}", requirement));
|
||||||
|
|
|
@ -552,7 +552,6 @@ impl MissingDoc {
|
||||||
&self,
|
&self,
|
||||||
cx: &LateContext<'_>,
|
cx: &LateContext<'_>,
|
||||||
def_id: LocalDefId,
|
def_id: LocalDefId,
|
||||||
sp: Span,
|
|
||||||
article: &'static str,
|
article: &'static str,
|
||||||
desc: &'static str,
|
desc: &'static str,
|
||||||
) {
|
) {
|
||||||
|
@ -579,16 +578,12 @@ impl MissingDoc {
|
||||||
let attrs = cx.tcx.hir().attrs(cx.tcx.hir().local_def_id_to_hir_id(def_id));
|
let attrs = cx.tcx.hir().attrs(cx.tcx.hir().local_def_id_to_hir_id(def_id));
|
||||||
let has_doc = attrs.iter().any(has_doc);
|
let has_doc = attrs.iter().any(has_doc);
|
||||||
if !has_doc {
|
if !has_doc {
|
||||||
cx.struct_span_lint(
|
cx.struct_span_lint(MISSING_DOCS, cx.tcx.def_span(def_id), |lint| {
|
||||||
MISSING_DOCS,
|
lint.build(fluent::lint::builtin_missing_doc)
|
||||||
cx.tcx.sess.source_map().guess_head_span(sp),
|
.set_arg("article", article)
|
||||||
|lint| {
|
.set_arg("desc", desc)
|
||||||
lint.build(fluent::lint::builtin_missing_doc)
|
.emit();
|
||||||
.set_arg("article", article)
|
});
|
||||||
.set_arg("desc", desc)
|
|
||||||
.emit();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -611,13 +606,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_crate(&mut self, cx: &LateContext<'_>) {
|
fn check_crate(&mut self, cx: &LateContext<'_>) {
|
||||||
self.check_missing_docs_attrs(
|
self.check_missing_docs_attrs(cx, CRATE_DEF_ID, "the", "crate");
|
||||||
cx,
|
|
||||||
CRATE_DEF_ID,
|
|
||||||
cx.tcx.def_span(CRATE_DEF_ID),
|
|
||||||
"the",
|
|
||||||
"crate",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
|
fn check_item(&mut self, cx: &LateContext<'_>, it: &hir::Item<'_>) {
|
||||||
|
@ -647,13 +636,13 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
||||||
|
|
||||||
let (article, desc) = cx.tcx.article_and_description(it.def_id.to_def_id());
|
let (article, desc) = cx.tcx.article_and_description(it.def_id.to_def_id());
|
||||||
|
|
||||||
self.check_missing_docs_attrs(cx, it.def_id, it.span, article, desc);
|
self.check_missing_docs_attrs(cx, it.def_id, article, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_trait_item(&mut self, cx: &LateContext<'_>, trait_item: &hir::TraitItem<'_>) {
|
fn check_trait_item(&mut self, cx: &LateContext<'_>, trait_item: &hir::TraitItem<'_>) {
|
||||||
let (article, desc) = cx.tcx.article_and_description(trait_item.def_id.to_def_id());
|
let (article, desc) = cx.tcx.article_and_description(trait_item.def_id.to_def_id());
|
||||||
|
|
||||||
self.check_missing_docs_attrs(cx, trait_item.def_id, trait_item.span, article, desc);
|
self.check_missing_docs_attrs(cx, trait_item.def_id, article, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) {
|
fn check_impl_item(&mut self, cx: &LateContext<'_>, impl_item: &hir::ImplItem<'_>) {
|
||||||
|
@ -681,23 +670,23 @@ impl<'tcx> LateLintPass<'tcx> for MissingDoc {
|
||||||
}
|
}
|
||||||
|
|
||||||
let (article, desc) = cx.tcx.article_and_description(impl_item.def_id.to_def_id());
|
let (article, desc) = cx.tcx.article_and_description(impl_item.def_id.to_def_id());
|
||||||
self.check_missing_docs_attrs(cx, impl_item.def_id, impl_item.span, article, desc);
|
self.check_missing_docs_attrs(cx, impl_item.def_id, article, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_foreign_item(&mut self, cx: &LateContext<'_>, foreign_item: &hir::ForeignItem<'_>) {
|
fn check_foreign_item(&mut self, cx: &LateContext<'_>, foreign_item: &hir::ForeignItem<'_>) {
|
||||||
let (article, desc) = cx.tcx.article_and_description(foreign_item.def_id.to_def_id());
|
let (article, desc) = cx.tcx.article_and_description(foreign_item.def_id.to_def_id());
|
||||||
self.check_missing_docs_attrs(cx, foreign_item.def_id, foreign_item.span, article, desc);
|
self.check_missing_docs_attrs(cx, foreign_item.def_id, article, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_field_def(&mut self, cx: &LateContext<'_>, sf: &hir::FieldDef<'_>) {
|
fn check_field_def(&mut self, cx: &LateContext<'_>, sf: &hir::FieldDef<'_>) {
|
||||||
if !sf.is_positional() {
|
if !sf.is_positional() {
|
||||||
let def_id = cx.tcx.hir().local_def_id(sf.hir_id);
|
let def_id = cx.tcx.hir().local_def_id(sf.hir_id);
|
||||||
self.check_missing_docs_attrs(cx, def_id, sf.span, "a", "struct field")
|
self.check_missing_docs_attrs(cx, def_id, "a", "struct field")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_variant(&mut self, cx: &LateContext<'_>, v: &hir::Variant<'_>) {
|
fn check_variant(&mut self, cx: &LateContext<'_>, v: &hir::Variant<'_>) {
|
||||||
self.check_missing_docs_attrs(cx, cx.tcx.hir().local_def_id(v.id), v.span, "a", "variant");
|
self.check_missing_docs_attrs(cx, cx.tcx.hir().local_def_id(v.id), "a", "variant");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1013,12 +1013,13 @@ impl<'hir> Map<'hir> {
|
||||||
ItemKind::Use(path, _) => path.span,
|
ItemKind::Use(path, _) => path.span,
|
||||||
_ => named_span(item.span, item.ident, item.kind.generics()),
|
_ => named_span(item.span, item.ident, item.kind.generics()),
|
||||||
},
|
},
|
||||||
|
Node::Variant(variant) => named_span(variant.span, variant.ident, None),
|
||||||
Node::ImplItem(item) => named_span(item.span, item.ident, Some(item.generics)),
|
Node::ImplItem(item) => named_span(item.span, item.ident, Some(item.generics)),
|
||||||
Node::ForeignItem(item) => match item.kind {
|
Node::ForeignItem(item) => match item.kind {
|
||||||
ForeignItemKind::Fn(decl, _, _) => until_within(item.span, decl.output.span()),
|
ForeignItemKind::Fn(decl, _, _) => until_within(item.span, decl.output.span()),
|
||||||
_ => named_span(item.span, item.ident, None),
|
_ => named_span(item.span, item.ident, None),
|
||||||
},
|
},
|
||||||
Node::Ctor(..) => return self.opt_span(self.get_parent_node(hir_id)),
|
Node::Ctor(_) => return self.opt_span(self.get_parent_node(hir_id)),
|
||||||
_ => self.span_with_body(hir_id),
|
_ => self.span_with_body(hir_id),
|
||||||
};
|
};
|
||||||
Some(span)
|
Some(span)
|
||||||
|
|
|
@ -795,7 +795,7 @@ fn foo(&self) -> Self::T { String::new() }
|
||||||
if item_def_id == proj_ty_item_def_id =>
|
if item_def_id == proj_ty_item_def_id =>
|
||||||
{
|
{
|
||||||
Some((
|
Some((
|
||||||
self.sess.source_map().guess_head_span(self.def_span(item.def_id)),
|
self.def_span(item.def_id),
|
||||||
format!("consider calling `{}`", self.def_path_str(item.def_id)),
|
format!("consider calling `{}`", self.def_path_str(item.def_id)),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1112,18 +1112,12 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
})
|
})
|
||||||
.collect::<Option<Vec<ArgKind>>>()?,
|
.collect::<Option<Vec<ArgKind>>>()?,
|
||||||
),
|
),
|
||||||
Node::Item(&hir::Item { span, kind: hir::ItemKind::Fn(ref sig, ..), .. })
|
Node::Item(&hir::Item { kind: hir::ItemKind::Fn(ref sig, ..), .. })
|
||||||
| Node::ImplItem(&hir::ImplItem {
|
| Node::ImplItem(&hir::ImplItem { kind: hir::ImplItemKind::Fn(ref sig, _), .. })
|
||||||
span,
|
|
||||||
kind: hir::ImplItemKind::Fn(ref sig, _),
|
|
||||||
..
|
|
||||||
})
|
|
||||||
| Node::TraitItem(&hir::TraitItem {
|
| Node::TraitItem(&hir::TraitItem {
|
||||||
span,
|
kind: hir::TraitItemKind::Fn(ref sig, _), ..
|
||||||
kind: hir::TraitItemKind::Fn(ref sig, _),
|
|
||||||
..
|
|
||||||
}) => (
|
}) => (
|
||||||
sm.guess_head_span(span),
|
sig.span,
|
||||||
sig.decl
|
sig.decl
|
||||||
.inputs
|
.inputs
|
||||||
.iter()
|
.iter()
|
||||||
|
@ -1138,7 +1132,6 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
),
|
),
|
||||||
Node::Ctor(ref variant_data) => {
|
Node::Ctor(ref variant_data) => {
|
||||||
let span = variant_data.ctor_hir_id().map_or(DUMMY_SP, |id| hir.span(id));
|
let span = variant_data.ctor_hir_id().map_or(DUMMY_SP, |id| hir.span(id));
|
||||||
let span = sm.guess_head_span(span);
|
|
||||||
(span, vec![ArgKind::empty(); variant_data.fields().len()])
|
(span, vec![ArgKind::empty(); variant_data.fields().len()])
|
||||||
}
|
}
|
||||||
_ => panic!("non-FnLike node found: {:?}", node),
|
_ => panic!("non-FnLike node found: {:?}", node),
|
||||||
|
@ -2185,7 +2178,7 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
|
||||||
let mut post = vec![];
|
let mut post = vec![];
|
||||||
for def_id in impls {
|
for def_id in impls {
|
||||||
match self.tcx.span_of_impl(*def_id) {
|
match self.tcx.span_of_impl(*def_id) {
|
||||||
Ok(span) => spans.push(self.tcx.sess.source_map().guess_head_span(span)),
|
Ok(span) => spans.push(span),
|
||||||
Err(name) => {
|
Err(name) => {
|
||||||
crates.push(name);
|
crates.push(name);
|
||||||
if let Some(header) = to_pretty_impl_header(self.tcx, *def_id) {
|
if let Some(header) = to_pretty_impl_header(self.tcx, *def_id) {
|
||||||
|
@ -2532,8 +2525,7 @@ pub fn recursive_type_with_infinite_size_error<'tcx>(
|
||||||
spans: Vec<(Span, Option<hir::HirId>)>,
|
spans: Vec<(Span, Option<hir::HirId>)>,
|
||||||
) {
|
) {
|
||||||
assert!(type_def_id.is_local());
|
assert!(type_def_id.is_local());
|
||||||
let span = tcx.hir().span_if_local(type_def_id).unwrap();
|
let span = tcx.def_span(type_def_id);
|
||||||
let span = tcx.sess.source_map().guess_head_span(span);
|
|
||||||
let path = tcx.def_path_str(type_def_id);
|
let path = tcx.def_path_str(type_def_id);
|
||||||
let mut err =
|
let mut err =
|
||||||
struct_span_err!(tcx.sess, span, E0072, "recursive type `{}` has infinite size", path);
|
struct_span_err!(tcx.sess, span, E0072, "recursive type `{}` has infinite size", path);
|
||||||
|
|
|
@ -340,10 +340,7 @@ fn report_negative_positive_conflict(
|
||||||
positive_impl_def_id: DefId,
|
positive_impl_def_id: DefId,
|
||||||
sg: &mut specialization_graph::Graph,
|
sg: &mut specialization_graph::Graph,
|
||||||
) {
|
) {
|
||||||
let impl_span = tcx
|
let impl_span = tcx.def_span(local_impl_def_id);
|
||||||
.sess
|
|
||||||
.source_map()
|
|
||||||
.guess_head_span(tcx.span_of_impl(local_impl_def_id.to_def_id()).unwrap());
|
|
||||||
|
|
||||||
let mut err = struct_span_err!(
|
let mut err = struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
|
@ -356,10 +353,7 @@ fn report_negative_positive_conflict(
|
||||||
|
|
||||||
match tcx.span_of_impl(negative_impl_def_id) {
|
match tcx.span_of_impl(negative_impl_def_id) {
|
||||||
Ok(span) => {
|
Ok(span) => {
|
||||||
err.span_label(
|
err.span_label(span, "negative implementation here");
|
||||||
tcx.sess.source_map().guess_head_span(span),
|
|
||||||
"negative implementation here".to_string(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
Err(cname) => {
|
Err(cname) => {
|
||||||
err.note(&format!("negative implementation in crate `{}`", cname));
|
err.note(&format!("negative implementation in crate `{}`", cname));
|
||||||
|
@ -368,10 +362,7 @@ fn report_negative_positive_conflict(
|
||||||
|
|
||||||
match tcx.span_of_impl(positive_impl_def_id) {
|
match tcx.span_of_impl(positive_impl_def_id) {
|
||||||
Ok(span) => {
|
Ok(span) => {
|
||||||
err.span_label(
|
err.span_label(span, "positive implementation here");
|
||||||
tcx.sess.source_map().guess_head_span(span),
|
|
||||||
"positive implementation here".to_string(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
Err(cname) => {
|
Err(cname) => {
|
||||||
err.note(&format!("positive implementation in crate `{}`", cname));
|
err.note(&format!("positive implementation in crate `{}`", cname));
|
||||||
|
@ -388,8 +379,7 @@ fn report_conflicting_impls(
|
||||||
used_to_be_allowed: Option<FutureCompatOverlapErrorKind>,
|
used_to_be_allowed: Option<FutureCompatOverlapErrorKind>,
|
||||||
sg: &mut specialization_graph::Graph,
|
sg: &mut specialization_graph::Graph,
|
||||||
) {
|
) {
|
||||||
let impl_span =
|
let impl_span = tcx.def_span(impl_def_id);
|
||||||
tcx.sess.source_map().guess_head_span(tcx.span_of_impl(impl_def_id.to_def_id()).unwrap());
|
|
||||||
|
|
||||||
// Work to be done after we've built the DiagnosticBuilder. We have to define it
|
// Work to be done after we've built the DiagnosticBuilder. We have to define it
|
||||||
// now because the struct_lint methods don't return back the DiagnosticBuilder
|
// now because the struct_lint methods don't return back the DiagnosticBuilder
|
||||||
|
@ -416,10 +406,7 @@ fn report_conflicting_impls(
|
||||||
let mut err = err.build(&msg);
|
let mut err = err.build(&msg);
|
||||||
match tcx.span_of_impl(overlap.with_impl) {
|
match tcx.span_of_impl(overlap.with_impl) {
|
||||||
Ok(span) => {
|
Ok(span) => {
|
||||||
err.span_label(
|
err.span_label(span, "first implementation here".to_string());
|
||||||
tcx.sess.source_map().guess_head_span(span),
|
|
||||||
"first implementation here".to_string(),
|
|
||||||
);
|
|
||||||
|
|
||||||
err.span_label(
|
err.span_label(
|
||||||
impl_span,
|
impl_span,
|
||||||
|
|
|
@ -1958,9 +1958,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(sp) = tcx.hir().span_if_local(adt_def.did()) {
|
if adt_def.did().is_local() {
|
||||||
let sp = tcx.sess.source_map().guess_head_span(sp);
|
err.span_label(
|
||||||
err.span_label(sp, format!("variant `{}` not found here", assoc_ident));
|
tcx.def_span(adt_def.did()),
|
||||||
|
format!("variant `{assoc_ident}` not found for this enum"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
err.emit()
|
err.emit()
|
||||||
|
@ -2450,7 +2452,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
|
|
||||||
let msg = format!("`Self` is of type `{ty}`");
|
let msg = format!("`Self` is of type `{ty}`");
|
||||||
if let (Ok(i_sp), Some(t_sp)) = (span_of_impl, span_of_ty) {
|
if let (Ok(i_sp), Some(t_sp)) = (span_of_impl, span_of_ty) {
|
||||||
let i_sp = tcx.sess.source_map().guess_head_span(i_sp);
|
|
||||||
let mut span: MultiSpan = vec![t_sp].into();
|
let mut span: MultiSpan = vec![t_sp].into();
|
||||||
span.push_span_label(
|
span.push_span_label(
|
||||||
i_sp,
|
i_sp,
|
||||||
|
|
|
@ -288,11 +288,9 @@ fn check_panic_info_fn(
|
||||||
tcx.sess.span_err(decl.output.span(), "return type should be `!`");
|
tcx.sess.span_err(decl.output.span(), "return type should be `!`");
|
||||||
}
|
}
|
||||||
|
|
||||||
let span = tcx.def_span(fn_id);
|
|
||||||
let inputs = fn_sig.inputs();
|
let inputs = fn_sig.inputs();
|
||||||
if inputs.len() != 1 {
|
if inputs.len() != 1 {
|
||||||
let span = tcx.sess.source_map().guess_head_span(span);
|
tcx.sess.span_err(tcx.def_span(fn_id), "function should have one argument");
|
||||||
tcx.sess.span_err(span, "function should have one argument");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,9 +343,7 @@ fn check_alloc_error_fn(
|
||||||
|
|
||||||
let inputs = fn_sig.inputs();
|
let inputs = fn_sig.inputs();
|
||||||
if inputs.len() != 1 {
|
if inputs.len() != 1 {
|
||||||
let span = tcx.def_span(fn_id);
|
tcx.sess.span_err(tcx.def_span(fn_id), "function should have one argument");
|
||||||
let span = tcx.sess.source_map().guess_head_span(span);
|
|
||||||
tcx.sess.span_err(span, "function should have one argument");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,7 +1030,6 @@ fn check_impl_items_against_trait<'tcx>(
|
||||||
compare_impl_method(
|
compare_impl_method(
|
||||||
tcx,
|
tcx,
|
||||||
&ty_impl_item,
|
&ty_impl_item,
|
||||||
impl_item.span,
|
|
||||||
&ty_trait_item,
|
&ty_trait_item,
|
||||||
impl_trait_ref,
|
impl_trait_ref,
|
||||||
opt_trait_span,
|
opt_trait_span,
|
||||||
|
@ -1094,17 +1089,20 @@ fn check_impl_items_against_trait<'tcx>(
|
||||||
}
|
}
|
||||||
|
|
||||||
if !missing_items.is_empty() {
|
if !missing_items.is_empty() {
|
||||||
let impl_span = tcx.sess.source_map().guess_head_span(full_impl_span);
|
missing_items_err(tcx, tcx.def_span(impl_id), &missing_items, full_impl_span);
|
||||||
missing_items_err(tcx, impl_span, &missing_items, full_impl_span);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(missing_items) = must_implement_one_of {
|
if let Some(missing_items) = must_implement_one_of {
|
||||||
let impl_span = tcx.sess.source_map().guess_head_span(full_impl_span);
|
|
||||||
let attr_span = tcx
|
let attr_span = tcx
|
||||||
.get_attr(impl_trait_ref.def_id, sym::rustc_must_implement_one_of)
|
.get_attr(impl_trait_ref.def_id, sym::rustc_must_implement_one_of)
|
||||||
.map(|attr| attr.span);
|
.map(|attr| attr.span);
|
||||||
|
|
||||||
missing_items_must_implement_one_of_err(tcx, impl_span, missing_items, attr_span);
|
missing_items_must_implement_one_of_err(
|
||||||
|
tcx,
|
||||||
|
tcx.def_span(impl_id),
|
||||||
|
missing_items,
|
||||||
|
attr_span,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,14 +33,13 @@ use super::{potentially_plural_count, FnCtxt, Inherited};
|
||||||
pub(crate) fn compare_impl_method<'tcx>(
|
pub(crate) fn compare_impl_method<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
impl_m: &ty::AssocItem,
|
impl_m: &ty::AssocItem,
|
||||||
impl_m_span: Span,
|
|
||||||
trait_m: &ty::AssocItem,
|
trait_m: &ty::AssocItem,
|
||||||
impl_trait_ref: ty::TraitRef<'tcx>,
|
impl_trait_ref: ty::TraitRef<'tcx>,
|
||||||
trait_item_span: Option<Span>,
|
trait_item_span: Option<Span>,
|
||||||
) {
|
) {
|
||||||
debug!("compare_impl_method(impl_trait_ref={:?})", impl_trait_ref);
|
debug!("compare_impl_method(impl_trait_ref={:?})", impl_trait_ref);
|
||||||
|
|
||||||
let impl_m_span = tcx.sess.source_map().guess_head_span(impl_m_span);
|
let impl_m_span = tcx.def_span(impl_m.def_id);
|
||||||
|
|
||||||
if let Err(_) = compare_self_type(tcx, impl_m, impl_m_span, trait_m, impl_trait_ref) {
|
if let Err(_) = compare_self_type(tcx, impl_m, impl_m_span, trait_m, impl_trait_ref) {
|
||||||
return;
|
return;
|
||||||
|
@ -444,13 +443,9 @@ fn check_region_bounds_on_impl_item<'tcx>(
|
||||||
.as_local()
|
.as_local()
|
||||||
.and_then(|did| tcx.hir().get_generics(did))
|
.and_then(|did| tcx.hir().get_generics(did))
|
||||||
.map_or(def_span, |g| g.span);
|
.map_or(def_span, |g| g.span);
|
||||||
let generics_span = tcx.hir().span_if_local(trait_m.def_id).map(|sp| {
|
let generics_span = trait_m.def_id.as_local().map(|did| {
|
||||||
let def_sp = tcx.sess.source_map().guess_head_span(sp);
|
let def_sp = tcx.def_span(did);
|
||||||
trait_m
|
tcx.hir().get_generics(did).map_or(def_sp, |g| g.span)
|
||||||
.def_id
|
|
||||||
.as_local()
|
|
||||||
.and_then(|did| tcx.hir().get_generics(did))
|
|
||||||
.map_or(def_sp, |g| g.span)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let reported = tcx.sess.emit_err(LifetimesOrBoundsMismatchOnTrait {
|
let reported = tcx.sess.emit_err(LifetimesOrBoundsMismatchOnTrait {
|
||||||
|
@ -1044,8 +1039,7 @@ fn compare_generic_param_kinds<'tcx>(
|
||||||
err.span_label(trait_header_span, "");
|
err.span_label(trait_header_span, "");
|
||||||
err.span_label(param_trait_span, make_param_message("expected", param_trait));
|
err.span_label(param_trait_span, make_param_message("expected", param_trait));
|
||||||
|
|
||||||
let impl_header_span =
|
let impl_header_span = tcx.def_span(tcx.parent(impl_item.def_id));
|
||||||
tcx.sess.source_map().guess_head_span(tcx.def_span(tcx.parent(impl_item.def_id)));
|
|
||||||
err.span_label(impl_header_span, "");
|
err.span_label(impl_header_span, "");
|
||||||
err.span_label(param_impl_span, make_param_message("found", param_impl));
|
err.span_label(param_impl_span, make_param_message("found", param_impl));
|
||||||
|
|
||||||
|
|
|
@ -184,9 +184,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
} else if let (ty::FnDef(def_id, ..), true) =
|
} else if let (ty::FnDef(def_id, ..), true) =
|
||||||
(&found.kind(), self.suggest_fn_call(err, expr, expected, found))
|
(&found.kind(), self.suggest_fn_call(err, expr, expected, found))
|
||||||
{
|
{
|
||||||
if let Some(sp) = self.tcx.hir().span_if_local(*def_id) {
|
if def_id.is_local() {
|
||||||
let sp = self.sess().source_map().guess_head_span(sp);
|
err.span_label(self.tcx.def_span(def_id), &format!("{} defined here", found));
|
||||||
err.span_label(sp, &format!("{} defined here", found));
|
|
||||||
}
|
}
|
||||||
} else if !self.check_for_cast(err, expr, found, expected, expected_ty_expr) {
|
} else if !self.check_for_cast(err, expr, found, expected, expected_ty_expr) {
|
||||||
let is_struct_pat_shorthand_field =
|
let is_struct_pat_shorthand_field =
|
||||||
|
|
|
@ -121,11 +121,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}) else {
|
}) else {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let note_span = self
|
|
||||||
.tcx
|
let note_span = if item.def_id.is_local() {
|
||||||
.hir()
|
Some(self.tcx.def_span(item.def_id))
|
||||||
.span_if_local(item.def_id)
|
} else if impl_did.is_local() {
|
||||||
.or_else(|| self.tcx.hir().span_if_local(impl_did));
|
Some(self.tcx.def_span(impl_did))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let impl_ty = self.tcx.at(span).type_of(impl_did);
|
let impl_ty = self.tcx.at(span).type_of(impl_did);
|
||||||
|
|
||||||
|
@ -158,10 +161,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
};
|
};
|
||||||
if let Some(note_span) = note_span {
|
if let Some(note_span) = note_span {
|
||||||
// We have a span pointing to the method. Show note with snippet.
|
// We have a span pointing to the method. Show note with snippet.
|
||||||
err.span_note(
|
err.span_note(note_span, ¬e_str);
|
||||||
self.tcx.sess.source_map().guess_head_span(note_span),
|
|
||||||
¬e_str,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
err.note(¬e_str);
|
err.note(¬e_str);
|
||||||
}
|
}
|
||||||
|
@ -197,11 +197,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
CandidateSource::Trait(trait_did) => {
|
CandidateSource::Trait(trait_did) => {
|
||||||
let Some(item) = self.associated_value(trait_did, item_name) else { continue };
|
let Some(item) = self.associated_value(trait_did, item_name) else { continue };
|
||||||
let item_span = self
|
let item_span = self.tcx.def_span(item.def_id);
|
||||||
.tcx
|
|
||||||
.sess
|
|
||||||
.source_map()
|
|
||||||
.guess_head_span(self.tcx.def_span(item.def_id));
|
|
||||||
let idx = if sources.len() > 1 {
|
let idx = if sources.len() > 1 {
|
||||||
let msg = &format!(
|
let msg = &format!(
|
||||||
"candidate #{} is defined in the trait `{}`",
|
"candidate #{} is defined in the trait `{}`",
|
||||||
|
@ -471,9 +467,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
err.note(&format!("`count` is defined on `{iterator_trait}`, which `{actual}` does not implement"));
|
err.note(&format!("`count` is defined on `{iterator_trait}`, which `{actual}` does not implement"));
|
||||||
}
|
}
|
||||||
} else if !unsatisfied_predicates.is_empty() {
|
} else if !unsatisfied_predicates.is_empty() {
|
||||||
let def_span = |def_id| {
|
|
||||||
self.tcx.sess.source_map().guess_head_span(self.tcx.def_span(def_id))
|
|
||||||
};
|
|
||||||
let mut type_params = FxHashMap::default();
|
let mut type_params = FxHashMap::default();
|
||||||
|
|
||||||
// Pick out the list of unimplemented traits on the receiver.
|
// Pick out the list of unimplemented traits on the receiver.
|
||||||
|
@ -564,22 +557,25 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
);
|
);
|
||||||
match &self_ty.kind() {
|
match &self_ty.kind() {
|
||||||
// Point at the type that couldn't satisfy the bound.
|
// Point at the type that couldn't satisfy the bound.
|
||||||
ty::Adt(def, _) => bound_spans.push((def_span(def.did()), msg)),
|
ty::Adt(def, _) => {
|
||||||
|
bound_spans.push((self.tcx.def_span(def.did()), msg))
|
||||||
|
}
|
||||||
// Point at the trait object that couldn't satisfy the bound.
|
// Point at the trait object that couldn't satisfy the bound.
|
||||||
ty::Dynamic(preds, _) => {
|
ty::Dynamic(preds, _) => {
|
||||||
for pred in preds.iter() {
|
for pred in preds.iter() {
|
||||||
match pred.skip_binder() {
|
match pred.skip_binder() {
|
||||||
ty::ExistentialPredicate::Trait(tr) => {
|
ty::ExistentialPredicate::Trait(tr) => bound_spans
|
||||||
bound_spans.push((def_span(tr.def_id), msg.clone()))
|
.push((self.tcx.def_span(tr.def_id), msg.clone())),
|
||||||
}
|
|
||||||
ty::ExistentialPredicate::Projection(_)
|
ty::ExistentialPredicate::Projection(_)
|
||||||
| ty::ExistentialPredicate::AutoTrait(_) => {}
|
| ty::ExistentialPredicate::AutoTrait(_) => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Point at the closure that couldn't satisfy the bound.
|
// Point at the closure that couldn't satisfy the bound.
|
||||||
ty::Closure(def_id, _) => bound_spans
|
ty::Closure(def_id, _) => bound_spans.push((
|
||||||
.push((def_span(*def_id), format!("doesn't satisfy `{}`", quiet))),
|
tcx.def_span(*def_id),
|
||||||
|
format!("doesn't satisfy `{}`", quiet),
|
||||||
|
)),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1469,21 +1465,20 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.collect::<FxHashSet<_>>();
|
.collect::<FxHashSet<_>>();
|
||||||
let sm = self.tcx.sess.source_map();
|
|
||||||
let mut spans: MultiSpan = def_ids
|
let mut spans: MultiSpan = def_ids
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|def_id| {
|
.filter_map(|def_id| {
|
||||||
let span = self.tcx.def_span(*def_id);
|
let span = self.tcx.def_span(*def_id);
|
||||||
if span.is_dummy() { None } else { Some(sm.guess_head_span(span)) }
|
if span.is_dummy() { None } else { Some(span) }
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
for pred in &preds {
|
for pred in &preds {
|
||||||
match pred.self_ty().kind() {
|
match pred.self_ty().kind() {
|
||||||
ty::Adt(def, _) => {
|
ty::Adt(def, _) if def.did().is_local() => {
|
||||||
spans.push_span_label(
|
spans.push_span_label(
|
||||||
sm.guess_head_span(self.tcx.def_span(def.did())),
|
self.tcx.def_span(def.did()),
|
||||||
format!("must implement `{}`", pred.trait_ref.print_only_trait_path()),
|
format!("must implement `{}`", pred.trait_ref.print_only_trait_path()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2090,9 +2085,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
match &potential_candidates[..] {
|
match &potential_candidates[..] {
|
||||||
[] => {}
|
[] => {}
|
||||||
[trait_info] if trait_info.def_id.is_local() => {
|
[trait_info] if trait_info.def_id.is_local() => {
|
||||||
let span = self.tcx.hir().span_if_local(trait_info.def_id).unwrap();
|
|
||||||
err.span_note(
|
err.span_note(
|
||||||
self.tcx.sess.source_map().guess_head_span(span),
|
self.tcx.def_span(trait_info.def_id),
|
||||||
&format!(
|
&format!(
|
||||||
"`{}` defines an item `{}`, perhaps you need to {} it",
|
"`{}` defines an item `{}`, perhaps you need to {} it",
|
||||||
self.tcx.def_path_str(trait_info.def_id),
|
self.tcx.def_path_str(trait_info.def_id),
|
||||||
|
|
|
@ -9,7 +9,6 @@ use rustc_errors::struct_span_err;
|
||||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||||
use rustc_middle::ty::query::Providers;
|
use rustc_middle::ty::query::Providers;
|
||||||
use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
|
use rustc_middle::ty::{self, TyCtxt, TypeVisitable};
|
||||||
use rustc_span::Span;
|
|
||||||
use rustc_trait_selection::traits;
|
use rustc_trait_selection::traits;
|
||||||
|
|
||||||
mod builtin;
|
mod builtin;
|
||||||
|
@ -18,11 +17,6 @@ mod inherent_impls_overlap;
|
||||||
mod orphan;
|
mod orphan;
|
||||||
mod unsafety;
|
mod unsafety;
|
||||||
|
|
||||||
/// Obtains the span of just the impl header of `impl_def_id`.
|
|
||||||
fn impl_header_span(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) -> Span {
|
|
||||||
tcx.sess.source_map().guess_head_span(tcx.span_of_impl(impl_def_id.to_def_id()).unwrap())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn check_impl(tcx: TyCtxt<'_>, impl_def_id: LocalDefId, trait_ref: ty::TraitRef<'_>) {
|
fn check_impl(tcx: TyCtxt<'_>, impl_def_id: LocalDefId, trait_ref: ty::TraitRef<'_>) {
|
||||||
debug!(
|
debug!(
|
||||||
"(checking implementation) adding impl for trait '{:?}', item '{}'",
|
"(checking implementation) adding impl for trait '{:?}', item '{}'",
|
||||||
|
@ -47,56 +41,53 @@ fn enforce_trait_manually_implementable(
|
||||||
) {
|
) {
|
||||||
let did = Some(trait_def_id);
|
let did = Some(trait_def_id);
|
||||||
let li = tcx.lang_items();
|
let li = tcx.lang_items();
|
||||||
|
let impl_header_span = tcx.def_span(impl_def_id);
|
||||||
|
|
||||||
// Disallow *all* explicit impls of `Pointee`, `DiscriminantKind`, `Sized` and `Unsize` for now.
|
// Disallow *all* explicit impls of `Pointee`, `DiscriminantKind`, `Sized` and `Unsize` for now.
|
||||||
if did == li.pointee_trait() {
|
if did == li.pointee_trait() {
|
||||||
let span = impl_header_span(tcx, impl_def_id);
|
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
span,
|
impl_header_span,
|
||||||
E0322,
|
E0322,
|
||||||
"explicit impls for the `Pointee` trait are not permitted"
|
"explicit impls for the `Pointee` trait are not permitted"
|
||||||
)
|
)
|
||||||
.span_label(span, "impl of `Pointee` not allowed")
|
.span_label(impl_header_span, "impl of `Pointee` not allowed")
|
||||||
.emit();
|
.emit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if did == li.discriminant_kind_trait() {
|
if did == li.discriminant_kind_trait() {
|
||||||
let span = impl_header_span(tcx, impl_def_id);
|
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
span,
|
impl_header_span,
|
||||||
E0322,
|
E0322,
|
||||||
"explicit impls for the `DiscriminantKind` trait are not permitted"
|
"explicit impls for the `DiscriminantKind` trait are not permitted"
|
||||||
)
|
)
|
||||||
.span_label(span, "impl of `DiscriminantKind` not allowed")
|
.span_label(impl_header_span, "impl of `DiscriminantKind` not allowed")
|
||||||
.emit();
|
.emit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if did == li.sized_trait() {
|
if did == li.sized_trait() {
|
||||||
let span = impl_header_span(tcx, impl_def_id);
|
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
span,
|
impl_header_span,
|
||||||
E0322,
|
E0322,
|
||||||
"explicit impls for the `Sized` trait are not permitted"
|
"explicit impls for the `Sized` trait are not permitted"
|
||||||
)
|
)
|
||||||
.span_label(span, "impl of `Sized` not allowed")
|
.span_label(impl_header_span, "impl of `Sized` not allowed")
|
||||||
.emit();
|
.emit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if did == li.unsize_trait() {
|
if did == li.unsize_trait() {
|
||||||
let span = impl_header_span(tcx, impl_def_id);
|
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
span,
|
impl_header_span,
|
||||||
E0328,
|
E0328,
|
||||||
"explicit impls for the `Unsize` trait are not permitted"
|
"explicit impls for the `Unsize` trait are not permitted"
|
||||||
)
|
)
|
||||||
.span_label(span, "impl of `Unsize` not allowed")
|
.span_label(impl_header_span, "impl of `Unsize` not allowed")
|
||||||
.emit();
|
.emit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -110,10 +101,9 @@ fn enforce_trait_manually_implementable(
|
||||||
tcx.trait_def(trait_def_id).specialization_kind
|
tcx.trait_def(trait_def_id).specialization_kind
|
||||||
{
|
{
|
||||||
if !tcx.features().specialization && !tcx.features().min_specialization {
|
if !tcx.features().specialization && !tcx.features().min_specialization {
|
||||||
let span = impl_header_span(tcx, impl_def_id);
|
|
||||||
tcx.sess
|
tcx.sess
|
||||||
.struct_span_err(
|
.struct_span_err(
|
||||||
span,
|
impl_header_span,
|
||||||
"implementing `rustc_specialization_trait` traits is unstable",
|
"implementing `rustc_specialization_trait` traits is unstable",
|
||||||
)
|
)
|
||||||
.help("add `#![feature(min_specialization)]` to the crate attributes to enable")
|
.help("add `#![feature(min_specialization)]` to the crate attributes to enable")
|
||||||
|
@ -138,8 +128,13 @@ fn enforce_empty_impls_for_marker_traits(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let span = impl_header_span(tcx, impl_def_id);
|
struct_span_err!(
|
||||||
struct_span_err!(tcx.sess, span, E0715, "impls for marker traits cannot contain items").emit();
|
tcx.sess,
|
||||||
|
tcx.def_span(impl_def_id),
|
||||||
|
E0715,
|
||||||
|
"impls for marker traits cannot contain items"
|
||||||
|
)
|
||||||
|
.emit();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
|
@ -217,7 +212,7 @@ fn check_object_overlap<'tcx>(
|
||||||
} else {
|
} else {
|
||||||
let mut supertrait_def_ids = traits::supertrait_def_ids(tcx, component_def_id);
|
let mut supertrait_def_ids = traits::supertrait_def_ids(tcx, component_def_id);
|
||||||
if supertrait_def_ids.any(|d| d == trait_def_id) {
|
if supertrait_def_ids.any(|d| d == trait_def_id) {
|
||||||
let span = impl_header_span(tcx, impl_def_id);
|
let span = tcx.def_span(impl_def_id);
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -47,7 +47,7 @@ fn do_orphan_check_impl<'tcx>(
|
||||||
let hir::ItemKind::Impl(ref impl_) = item.kind else {
|
let hir::ItemKind::Impl(ref impl_) = item.kind else {
|
||||||
bug!("{:?} is not an impl: {:?}", def_id, item);
|
bug!("{:?} is not an impl: {:?}", def_id, item);
|
||||||
};
|
};
|
||||||
let sp = tcx.sess.source_map().guess_head_span(item.span);
|
let sp = tcx.def_span(def_id);
|
||||||
let tr = impl_.of_trait.as_ref().unwrap();
|
let tr = impl_.of_trait.as_ref().unwrap();
|
||||||
|
|
||||||
// Ensure no opaque types are present in this impl header. See issues #76202 and #86411 for examples,
|
// Ensure no opaque types are present in this impl header. See issues #76202 and #86411 for examples,
|
||||||
|
|
|
@ -223,15 +223,7 @@ fn check_main_fn_ty(tcx: TyCtxt<'_>, main_def_id: DefId) {
|
||||||
if !def_id.is_local() {
|
if !def_id.is_local() {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id.expect_local());
|
Some(tcx.def_span(def_id))
|
||||||
match tcx.hir().find(hir_id) {
|
|
||||||
Some(Node::Item(hir::Item { span: item_span, .. })) => {
|
|
||||||
Some(tcx.sess.source_map().guess_head_span(*item_span))
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
span_bug!(tcx.def_span(def_id), "main has a non-function type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main_fn_return_type_span(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Span> {
|
fn main_fn_return_type_span(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Span> {
|
||||||
|
@ -416,7 +408,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
if let hir::IsAsync::Async = sig.header.asyncness {
|
if let hir::IsAsync::Async = sig.header.asyncness {
|
||||||
let span = tcx.sess.source_map().guess_head_span(it.span);
|
let span = tcx.def_span(it.def_id);
|
||||||
struct_span_err!(
|
struct_span_err!(
|
||||||
tcx.sess,
|
tcx.sess,
|
||||||
span,
|
span,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// MIR for `Test::X` 0 mir_map
|
// MIR for `Test::X` 0 mir_map
|
||||||
|
|
||||||
fn Test::X(_1: usize) -> Test {
|
fn Test::X(_1: usize) -> Test {
|
||||||
let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
Deinit(_0); // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
Deinit(_0); // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
((_0 as X).0: usize) = move _1; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
((_0 as X).0: usize) = move _1; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
discriminant(_0) = 0; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
discriminant(_0) = 0; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
return; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
return; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
// MIR for `Test::X` 0 mir_map
|
// MIR for `Test::X` 0 mir_map
|
||||||
|
|
||||||
fn Test::X(_1: usize) -> Test {
|
fn Test::X(_1: usize) -> Test {
|
||||||
let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
let mut _0: Test; // return place in scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
|
|
||||||
bb0: {
|
bb0: {
|
||||||
Deinit(_0); // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
Deinit(_0); // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
((_0 as X).0: usize) = move _1; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
((_0 as X).0: usize) = move _1; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
discriminant(_0) = 0; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
discriminant(_0) = 0; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
return; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:13
|
return; // scope 0 at $DIR/unusual-item-types.rs:16:5: 16:6
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ error: missing documentation for a struct
|
||||||
--> $DIR/deny-missing-docs-crate.rs:3:1
|
--> $DIR/deny-missing-docs-crate.rs:3:1
|
||||||
|
|
|
|
||||||
LL | pub struct Foo;
|
LL | pub struct Foo;
|
||||||
| ^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ LL | XEmpty3 {},
|
||||||
| ------- `XE::XEmpty3` defined here
|
| ------- `XE::XEmpty3` defined here
|
||||||
LL | XEmpty4,
|
LL | XEmpty4,
|
||||||
LL | XEmpty5(),
|
LL | XEmpty5(),
|
||||||
| --------- similarly named tuple variant `XEmpty5` defined here
|
| ------- similarly named tuple variant `XEmpty5` defined here
|
||||||
|
|
|
|
||||||
help: use struct pattern syntax instead
|
help: use struct pattern syntax instead
|
||||||
|
|
|
|
||||||
|
@ -51,7 +51,7 @@ LL | XEmpty3 {},
|
||||||
| ------- `XE::XEmpty3` defined here
|
| ------- `XE::XEmpty3` defined here
|
||||||
LL | XEmpty4,
|
LL | XEmpty4,
|
||||||
LL | XEmpty5(),
|
LL | XEmpty5(),
|
||||||
| --------- similarly named tuple variant `XEmpty5` defined here
|
| ------- similarly named tuple variant `XEmpty5` defined here
|
||||||
|
|
|
|
||||||
help: use struct pattern syntax instead
|
help: use struct pattern syntax instead
|
||||||
|
|
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ LL | XE::XEmpty5 => (),
|
||||||
LL | XEmpty4,
|
LL | XEmpty4,
|
||||||
| ------- similarly named unit variant `XEmpty4` defined here
|
| ------- similarly named unit variant `XEmpty4` defined here
|
||||||
LL | XEmpty5(),
|
LL | XEmpty5(),
|
||||||
| --------- `XE::XEmpty5` defined here
|
| ------- `XE::XEmpty5` defined here
|
||||||
|
|
|
|
||||||
help: use the tuple variant pattern syntax instead
|
help: use the tuple variant pattern syntax instead
|
||||||
|
|
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ LL | XE::XEmpty4() => (),
|
||||||
LL | XEmpty4,
|
LL | XEmpty4,
|
||||||
| ------- `XE::XEmpty4` defined here
|
| ------- `XE::XEmpty4` defined here
|
||||||
LL | XEmpty5(),
|
LL | XEmpty5(),
|
||||||
| --------- similarly named tuple variant `XEmpty5` defined here
|
| ------- similarly named tuple variant `XEmpty5` defined here
|
||||||
|
|
|
|
||||||
help: use this syntax instead
|
help: use this syntax instead
|
||||||
|
|
|
|
||||||
|
@ -139,7 +139,7 @@ LL | XE::XEmpty4(..) => (),
|
||||||
LL | XEmpty4,
|
LL | XEmpty4,
|
||||||
| ------- `XE::XEmpty4` defined here
|
| ------- `XE::XEmpty4` defined here
|
||||||
LL | XEmpty5(),
|
LL | XEmpty5(),
|
||||||
| --------- similarly named tuple variant `XEmpty5` defined here
|
| ------- similarly named tuple variant `XEmpty5` defined here
|
||||||
|
|
|
|
||||||
help: use this syntax instead
|
help: use this syntax instead
|
||||||
|
|
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0599]: no variant named `B` found for enum `S`
|
||||||
--> $DIR/issue-34209.rs:7:12
|
--> $DIR/issue-34209.rs:7:12
|
||||||
|
|
|
|
||||||
LL | enum S {
|
LL | enum S {
|
||||||
| ------ variant `B` not found here
|
| ------ variant `B` not found for this enum
|
||||||
...
|
...
|
||||||
LL | S::B {} => {},
|
LL | S::B {} => {},
|
||||||
| ^ help: there is a variant with a similar name: `A`
|
| ^ help: there is a variant with a similar name: `A`
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
error[E0308]: method not compatible with trait
|
error[E0308]: method not compatible with trait
|
||||||
--> $DIR/issue-37884.rs:6:5
|
--> $DIR/issue-37884.rs:6:5
|
||||||
|
|
|
|
||||||
LL | / fn next(&'a mut self) -> Option<Self::Item>
|
LL | fn next(&'a mut self) -> Option<Self::Item>
|
||||||
LL | |
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
|
||||||
LL | |
|
|
||||||
LL | | {
|
|
||||||
LL | | Some(&mut self.0)
|
|
||||||
LL | | }
|
|
||||||
| |_____^ lifetime mismatch
|
|
||||||
|
|
|
|
||||||
= note: expected fn pointer `fn(&mut RepeatMut<'a, T>) -> Option<_>`
|
= note: expected fn pointer `fn(&mut RepeatMut<'a, T>) -> Option<_>`
|
||||||
found fn pointer `fn(&'a mut RepeatMut<'a, T>) -> Option<_>`
|
found fn pointer `fn(&'a mut RepeatMut<'a, T>) -> Option<_>`
|
||||||
|
|
|
@ -24,7 +24,7 @@ LL | const VAL: T;
|
||||||
| ------------ `VAL` from trait
|
| ------------ `VAL` from trait
|
||||||
...
|
...
|
||||||
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
|
||||||
|
|
||||||
error: constant expression depends on a generic parameter
|
error: constant expression depends on a generic parameter
|
||||||
--> $DIR/issue-77919.rs:2:9
|
--> $DIR/issue-77919.rs:2:9
|
||||||
|
|
|
@ -2,7 +2,7 @@ error: missing documentation for a type alias
|
||||||
--> $DIR/lint-missing-doc.rs:11:1
|
--> $DIR/lint-missing-doc.rs:11:1
|
||||||
|
|
|
|
||||||
LL | pub type PubTypedef = String;
|
LL | pub type PubTypedef = String;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the lint level is defined here
|
note: the lint level is defined here
|
||||||
--> $DIR/lint-missing-doc.rs:3:9
|
--> $DIR/lint-missing-doc.rs:3:9
|
||||||
|
@ -56,13 +56,13 @@ error: missing documentation for an associated type
|
||||||
--> $DIR/lint-missing-doc.rs:64:5
|
--> $DIR/lint-missing-doc.rs:64:5
|
||||||
|
|
|
|
||||||
LL | type AssociatedType;
|
LL | type AssociatedType;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for an associated type
|
error: missing documentation for an associated type
|
||||||
--> $DIR/lint-missing-doc.rs:65:5
|
--> $DIR/lint-missing-doc.rs:65:5
|
||||||
|
|
|
|
||||||
LL | type AssociatedTypeDef = Self;
|
LL | type AssociatedTypeDef = Self;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for an associated function
|
error: missing documentation for an associated function
|
||||||
--> $DIR/lint-missing-doc.rs:81:5
|
--> $DIR/lint-missing-doc.rs:81:5
|
||||||
|
@ -92,13 +92,13 @@ error: missing documentation for a constant
|
||||||
--> $DIR/lint-missing-doc.rs:151:1
|
--> $DIR/lint-missing-doc.rs:151:1
|
||||||
|
|
|
|
||||||
LL | pub const FOO4: u32 = 0;
|
LL | pub const FOO4: u32 = 0;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for a static
|
error: missing documentation for a static
|
||||||
--> $DIR/lint-missing-doc.rs:161:1
|
--> $DIR/lint-missing-doc.rs:161:1
|
||||||
|
|
|
|
||||||
LL | pub static BAR4: u32 = 0;
|
LL | pub static BAR4: u32 = 0;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for a function
|
error: missing documentation for a function
|
||||||
--> $DIR/lint-missing-doc.rs:167:5
|
--> $DIR/lint-missing-doc.rs:167:5
|
||||||
|
@ -122,19 +122,19 @@ error: missing documentation for a function
|
||||||
--> $DIR/lint-missing-doc.rs:189:5
|
--> $DIR/lint-missing-doc.rs:189:5
|
||||||
|
|
|
|
||||||
LL | pub fn extern_fn_undocumented(f: f32) -> f32;
|
LL | pub fn extern_fn_undocumented(f: f32) -> f32;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for a static
|
error: missing documentation for a static
|
||||||
--> $DIR/lint-missing-doc.rs:194:5
|
--> $DIR/lint-missing-doc.rs:194:5
|
||||||
|
|
|
|
||||||
LL | pub static EXTERN_STATIC_UNDOCUMENTED: u8;
|
LL | pub static EXTERN_STATIC_UNDOCUMENTED: u8;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: missing documentation for a foreign type
|
error: missing documentation for a foreign type
|
||||||
--> $DIR/lint-missing-doc.rs:199:5
|
--> $DIR/lint-missing-doc.rs:199:5
|
||||||
|
|
|
|
||||||
LL | pub type ExternTyUndocumented;
|
LL | pub type ExternTyUndocumented;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 22 previous errors
|
error: aborting due to 22 previous errors
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ error[E0593]: function is expected to take 0 arguments, but it takes 1 argument
|
||||||
--> $DIR/issue-47706.rs:27:9
|
--> $DIR/issue-47706.rs:27:9
|
||||||
|
|
|
|
||||||
LL | Bar(i32),
|
LL | Bar(i32),
|
||||||
| -------- takes 1 argument
|
| --- takes 1 argument
|
||||||
...
|
...
|
||||||
LL | foo(Qux::Bar);
|
LL | foo(Qux::Bar);
|
||||||
| --- ^^^^^^^^ expected function that takes 0 arguments
|
| --- ^^^^^^^^ expected function that takes 0 arguments
|
||||||
|
|
|
@ -94,7 +94,7 @@ LL | check(xm7::V);
|
||||||
LL | V {},
|
LL | V {},
|
||||||
| - `xm7::V` defined here
|
| - `xm7::V` defined here
|
||||||
LL | TV(),
|
LL | TV(),
|
||||||
| ---- similarly named tuple variant `TV` defined here
|
| -- similarly named tuple variant `TV` defined here
|
||||||
|
|
|
|
||||||
help: use struct literal syntax instead
|
help: use struct literal syntax instead
|
||||||
|
|
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ LL | E1::Z0() => {}
|
||||||
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:15
|
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:15
|
||||||
|
|
|
|
||||||
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
||||||
| -- ---- similarly named tuple variant `Z1` defined here
|
| -- -- similarly named tuple variant `Z1` defined here
|
||||||
| |
|
| |
|
||||||
| `E1::Z0` defined here
|
| `E1::Z0` defined here
|
||||||
|
|
|
|
||||||
|
@ -82,7 +82,7 @@ LL | E1::Z0(x) => {}
|
||||||
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:15
|
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:15
|
||||||
|
|
|
|
||||||
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
||||||
| -- ---- similarly named tuple variant `Z1` defined here
|
| -- -- similarly named tuple variant `Z1` defined here
|
||||||
| |
|
| |
|
||||||
| `E1::Z0` defined here
|
| `E1::Z0` defined here
|
||||||
|
|
|
|
||||||
|
@ -104,7 +104,7 @@ LL | E1::Z1 => {}
|
||||||
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:19
|
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:19
|
||||||
|
|
|
|
||||||
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
||||||
| -- ---- `E1::Z1` defined here
|
| -- -- `E1::Z1` defined here
|
||||||
| |
|
| |
|
||||||
| similarly named unit variant `Z0` defined here
|
| similarly named unit variant `Z0` defined here
|
||||||
|
|
|
|
||||||
|
@ -295,7 +295,7 @@ LL | E1::Z1(x) => {}
|
||||||
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:19
|
::: $DIR/auxiliary/declarations-for-tuple-field-count-errors.rs:11:19
|
||||||
|
|
|
|
||||||
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) }
|
||||||
| ---- tuple variant has 0 fields
|
| -- tuple variant has 0 fields
|
||||||
|
|
||||||
error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 3 fields
|
error[E0023]: this pattern has 0 fields, but the corresponding tuple variant has 3 fields
|
||||||
--> $DIR/pat-tuple-field-count-cross.rs:39:9
|
--> $DIR/pat-tuple-field-count-cross.rs:39:9
|
||||||
|
|
|
@ -289,7 +289,7 @@ error[E0023]: this pattern has 1 field, but the corresponding tuple variant has
|
||||||
--> $DIR/pat-tuple-overfield.rs:71:16
|
--> $DIR/pat-tuple-overfield.rs:71:16
|
||||||
|
|
|
|
||||||
LL | Z1(),
|
LL | Z1(),
|
||||||
| ---- tuple variant has 0 fields
|
| -- tuple variant has 0 fields
|
||||||
...
|
...
|
||||||
LL | E1::Z1(_) => {}
|
LL | E1::Z1(_) => {}
|
||||||
| ^ expected 0 fields, found 1
|
| ^ expected 0 fields, found 1
|
||||||
|
@ -298,7 +298,7 @@ error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has
|
||||||
--> $DIR/pat-tuple-overfield.rs:72:16
|
--> $DIR/pat-tuple-overfield.rs:72:16
|
||||||
|
|
|
|
||||||
LL | Z1(),
|
LL | Z1(),
|
||||||
| ---- tuple variant has 0 fields
|
| -- tuple variant has 0 fields
|
||||||
...
|
...
|
||||||
LL | E1::Z1(_, _) => {}
|
LL | E1::Z1(_, _) => {}
|
||||||
| ^ ^ expected 0 fields, found 2
|
| ^ ^ expected 0 fields, found 2
|
||||||
|
|
|
@ -148,7 +148,7 @@ LL | one!("hello", "world");
|
||||||
::: $SRC_DIR/core/src/result.rs:LL:COL
|
::: $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
|
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||||
| --------------------------------------------------- similarly named tuple variant `Ok` defined here
|
| -- similarly named tuple variant `Ok` defined here
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ LL | two!("yay", "rust");
|
||||||
::: $SRC_DIR/core/src/result.rs:LL:COL
|
::: $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
|
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||||
| --------------------------------------------------- similarly named tuple variant `Ok` defined here
|
| -- similarly named tuple variant `Ok` defined here
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ LL | three!("hip", "hop");
|
||||||
::: $SRC_DIR/core/src/result.rs:LL:COL
|
::: $SRC_DIR/core/src/result.rs:LL:COL
|
||||||
|
|
|
|
||||||
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
|
LL | Ok(#[stable(feature = "rust1", since = "1.0.0")] T),
|
||||||
| --------------------------------------------------- similarly named tuple variant `Ok` defined here
|
| -- similarly named tuple variant `Ok` defined here
|
||||||
|
|
|
|
||||||
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the macro `parent_source_spans` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ error[E0731]: transparent enum needs exactly one variant, but has 2
|
||||||
LL | enum MultipleVariants {
|
LL | enum MultipleVariants {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ needs exactly one variant, but has 2
|
| ^^^^^^^^^^^^^^^^^^^^^ needs exactly one variant, but has 2
|
||||||
LL | Foo(String),
|
LL | Foo(String),
|
||||||
| -----------
|
| ---
|
||||||
LL | Bar,
|
LL | Bar,
|
||||||
| --- too many variants in `MultipleVariants`
|
| --- too many variants in `MultipleVariants`
|
||||||
|
|
||||||
|
|
|
@ -318,7 +318,7 @@ error[E0308]: mismatched types
|
||||||
--> $DIR/privacy-enum-ctor.rs:27:20
|
--> $DIR/privacy-enum-ctor.rs:27:20
|
||||||
|
|
|
|
||||||
LL | Fn(u8),
|
LL | Fn(u8),
|
||||||
| ------ fn(u8) -> Z {Z::Fn} defined here
|
| -- fn(u8) -> Z {Z::Fn} defined here
|
||||||
...
|
...
|
||||||
LL | let _: Z = Z::Fn;
|
LL | let _: Z = Z::Fn;
|
||||||
| - ^^^^^ expected enum `Z`, found fn item
|
| - ^^^^^ expected enum `Z`, found fn item
|
||||||
|
@ -353,7 +353,7 @@ error[E0308]: mismatched types
|
||||||
--> $DIR/privacy-enum-ctor.rs:43:16
|
--> $DIR/privacy-enum-ctor.rs:43:16
|
||||||
|
|
|
|
||||||
LL | Fn(u8),
|
LL | Fn(u8),
|
||||||
| ------ fn(u8) -> E {E::Fn} defined here
|
| -- fn(u8) -> E {E::Fn} defined here
|
||||||
...
|
...
|
||||||
LL | let _: E = m::E::Fn;
|
LL | let _: E = m::E::Fn;
|
||||||
| - ^^^^^^^^ expected enum `E`, found fn item
|
| - ^^^^^^^^ expected enum `E`, found fn item
|
||||||
|
@ -388,7 +388,7 @@ error[E0308]: mismatched types
|
||||||
--> $DIR/privacy-enum-ctor.rs:51:16
|
--> $DIR/privacy-enum-ctor.rs:51:16
|
||||||
|
|
|
|
||||||
LL | Fn(u8),
|
LL | Fn(u8),
|
||||||
| ------ fn(u8) -> E {E::Fn} defined here
|
| -- fn(u8) -> E {E::Fn} defined here
|
||||||
...
|
...
|
||||||
LL | let _: E = E::Fn;
|
LL | let _: E = E::Fn;
|
||||||
| - ^^^^^ expected enum `E`, found fn item
|
| - ^^^^^ expected enum `E`, found fn item
|
||||||
|
|
|
@ -8,7 +8,7 @@ note: the tuple variant `Tuple` is defined here
|
||||||
--> $DIR/auxiliary/variants.rs:5:23
|
--> $DIR/auxiliary/variants.rs:5:23
|
||||||
|
|
|
|
||||||
LL | #[non_exhaustive] Tuple(u32),
|
LL | #[non_exhaustive] Tuple(u32),
|
||||||
| ^^^^^^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error[E0603]: unit variant `Unit` is private
|
error[E0603]: unit variant `Unit` is private
|
||||||
--> $DIR/variant.rs:14:47
|
--> $DIR/variant.rs:14:47
|
||||||
|
@ -44,7 +44,7 @@ note: the tuple variant `Tuple` is defined here
|
||||||
--> $DIR/auxiliary/variants.rs:5:23
|
--> $DIR/auxiliary/variants.rs:5:23
|
||||||
|
|
|
|
||||||
LL | #[non_exhaustive] Tuple(u32),
|
LL | #[non_exhaustive] Tuple(u32),
|
||||||
| ^^^^^^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error[E0603]: tuple variant `Tuple` is private
|
error[E0603]: tuple variant `Tuple` is private
|
||||||
--> $DIR/variant.rs:26:35
|
--> $DIR/variant.rs:26:35
|
||||||
|
@ -56,7 +56,7 @@ note: the tuple variant `Tuple` is defined here
|
||||||
--> $DIR/auxiliary/variants.rs:5:23
|
--> $DIR/auxiliary/variants.rs:5:23
|
||||||
|
|
|
|
||||||
LL | #[non_exhaustive] Tuple(u32),
|
LL | #[non_exhaustive] Tuple(u32),
|
||||||
| ^^^^^^^^^^
|
| ^^^^^
|
||||||
|
|
||||||
error[E0639]: cannot create non-exhaustive variant using struct expression
|
error[E0639]: cannot create non-exhaustive variant using struct expression
|
||||||
--> $DIR/variant.rs:8:26
|
--> $DIR/variant.rs:8:26
|
||||||
|
|
|
@ -130,7 +130,7 @@ error[E0308]: mismatched types
|
||||||
--> $DIR/fn-or-tuple-struct-without-args.rs:35:16
|
--> $DIR/fn-or-tuple-struct-without-args.rs:35:16
|
||||||
|
|
|
|
||||||
LL | A(usize),
|
LL | A(usize),
|
||||||
| -------- fn(usize) -> E {E::A} defined here
|
| - fn(usize) -> E {E::A} defined here
|
||||||
...
|
...
|
||||||
LL | let _: E = E::A;
|
LL | let _: E = E::A;
|
||||||
| - ^^^^ expected enum `E`, found fn item
|
| - ^^^^ expected enum `E`, found fn item
|
||||||
|
|
|
@ -2,7 +2,7 @@ error[E0599]: no variant named `Squareee` found for enum `Shape`
|
||||||
--> $DIR/suggest-variants.rs:12:41
|
--> $DIR/suggest-variants.rs:12:41
|
||||||
|
|
|
|
||||||
LL | enum Shape {
|
LL | enum Shape {
|
||||||
| ---------- variant `Squareee` not found here
|
| ---------- variant `Squareee` not found for this enum
|
||||||
...
|
...
|
||||||
LL | println!("My shape is {:?}", Shape::Squareee { size: 5});
|
LL | println!("My shape is {:?}", Shape::Squareee { size: 5});
|
||||||
| ^^^^^^^^ help: there is a variant with a similar name: `Square`
|
| ^^^^^^^^ help: there is a variant with a similar name: `Square`
|
||||||
|
@ -11,7 +11,7 @@ error[E0599]: no variant named `Circl` found for enum `Shape`
|
||||||
--> $DIR/suggest-variants.rs:13:41
|
--> $DIR/suggest-variants.rs:13:41
|
||||||
|
|
|
|
||||||
LL | enum Shape {
|
LL | enum Shape {
|
||||||
| ---------- variant `Circl` not found here
|
| ---------- variant `Circl` not found for this enum
|
||||||
...
|
...
|
||||||
LL | println!("My shape is {:?}", Shape::Circl { size: 5});
|
LL | println!("My shape is {:?}", Shape::Circl { size: 5});
|
||||||
| ^^^^^ help: there is a variant with a similar name: `Circle`
|
| ^^^^^ help: there is a variant with a similar name: `Circle`
|
||||||
|
@ -20,7 +20,7 @@ error[E0599]: no variant named `Rombus` found for enum `Shape`
|
||||||
--> $DIR/suggest-variants.rs:14:41
|
--> $DIR/suggest-variants.rs:14:41
|
||||||
|
|
|
|
||||||
LL | enum Shape {
|
LL | enum Shape {
|
||||||
| ---------- variant `Rombus` not found here
|
| ---------- variant `Rombus` not found for this enum
|
||||||
...
|
...
|
||||||
LL | println!("My shape is {:?}", Shape::Rombus{ size: 5});
|
LL | println!("My shape is {:?}", Shape::Rombus{ size: 5});
|
||||||
| ^^^^^^ variant not found in `Shape`
|
| ^^^^^^ variant not found in `Shape`
|
||||||
|
|
|
@ -28,7 +28,7 @@ LL | const VAL: T;
|
||||||
| ------------ `VAL` from trait
|
| ------------ `VAL` from trait
|
||||||
...
|
...
|
||||||
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
|
LL | impl<N, M> TypeVal<usize> for Multiply<N, M> where N: TypeVal<VAL> {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `VAL` in implementation
|
||||||
|
|
||||||
error: constant expression depends on a generic parameter
|
error: constant expression depends on a generic parameter
|
||||||
--> $DIR/ice-6252.rs:13:9
|
--> $DIR/ice-6252.rs:13:9
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue