From 4accf838f6d847c0c93f4c25540446dad0309519 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Sat, 22 Oct 2022 03:09:49 +0000 Subject: Note scope of TAIT more accurately --- compiler/rustc_hir_analysis/src/errors.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'compiler/rustc_hir_analysis/src/errors.rs') diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index aaebbe6398a..5b41a64dcd8 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -143,6 +143,7 @@ pub struct UnconstrainedOpaqueType { #[primary_span] pub span: Span, pub name: Symbol, + pub what: &'static str, } pub struct MissingTypeParams { -- cgit 1.4.1-3-g733a5 From 1c26a278f30a173a47606695211b586451396fbf Mon Sep 17 00:00:00 2001 From: Oli Scherer Date: Tue, 25 Oct 2022 18:28:04 +0000 Subject: Split diagnostic details out into a separate function and fluent files --- .../locales/en-US/hir_analysis.ftl | 9 ++++ compiler/rustc_hir_analysis/src/astconv/mod.rs | 5 +-- compiler/rustc_hir_analysis/src/collect.rs | 48 ++++++++++++---------- compiler/rustc_hir_analysis/src/errors.rs | 21 ++++++++++ 4 files changed, 57 insertions(+), 26 deletions(-) (limited to 'compiler/rustc_hir_analysis/src/errors.rs') diff --git a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl index 357c6900a70..7ac44312695 100644 --- a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl +++ b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl @@ -137,3 +137,12 @@ hir_analysis_expected_used_symbol = expected `used`, `used(compiler)` or `used(l hir_analysis_missing_parentheses_in_range = can't call method `{$method_name}` on type `{$ty_str}` hir_analysis_add_missing_parentheses_in_range = you must surround the range in parentheses to call its `{$func_name}` function + +hir_analysis_const_impl_for_non_const_trait = + const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]` + .suggestion = mark `{$trait_name}` as const + .note = marking a trait with `#[const_trait]` ensures all default method bodies are `const` + .adding = adding a non-const method body in the future would be a breaking change + +hir_analysis_const_bound_for_non_const_trait = + ~const can only be applied to `#[const_trait]` traits diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index a4ebe38b02e..6baf9844977 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -539,10 +539,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if let Some(ty::BoundConstness::ConstIfConst) = constness && generics.has_self && !tcx.has_attr(def_id, sym::const_trait) { - tcx.sess.span_err( - span, - "~const can only be applied to `#[const_trait]` traits", - ); + tcx.sess.emit_err(crate::errors::ConstBoundForNonConstTrait { span } ); } (substs, arg_count) diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index 0698ec7c4d0..e261bb07f95 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -1294,34 +1294,38 @@ fn impl_trait_ref(tcx: TyCtxt<'_>, def_id: DefId) -> Option> { &icx, ast_trait_ref, selfty, - match impl_.constness { - hir::Constness::Const => { - if let Some(trait_def_id) = ast_trait_ref.trait_def_id() && !tcx.has_attr(trait_def_id, sym::const_trait) { - let trait_name = tcx.item_name(trait_def_id); - let mut err = tcx.sess.struct_span_err( - ast_trait_ref.path.span, - &format!("const `impl` for trait `{trait_name}` which is not marked with `#[const_trait]`"), - ); - if trait_def_id.is_local() { - let sp = tcx.def_span(trait_def_id).shrink_to_lo(); - err.span_suggestion(sp, &format!("mark `{trait_name}` as const"), "#[const_trait]", rustc_errors::Applicability::MachineApplicable); - } - err.note("marking a trait with `#[const_trait]` ensures all default method bodies are `const`"); - err.note("adding a non-const method body in the future would be a breaking change"); - err.emit(); - ty::BoundConstness::NotConst - } else { - ty::BoundConstness::ConstIfConst - } - }, - hir::Constness::NotConst => ty::BoundConstness::NotConst, - }, + check_impl_constness(tcx, impl_.constness, ast_trait_ref), ) }), _ => bug!(), } } +fn check_impl_constness( + tcx: TyCtxt<'_>, + constness: hir::Constness, + ast_trait_ref: &hir::TraitRef<'_>, +) -> ty::BoundConstness { + match constness { + hir::Constness::Const => { + if let Some(trait_def_id) = ast_trait_ref.trait_def_id() && !tcx.has_attr(trait_def_id, sym::const_trait) { + let trait_name = tcx.item_name(trait_def_id).to_string(); + tcx.sess.emit_err(errors::ConstImplForNonConstTrait { + trait_ref_span: ast_trait_ref.path.span, + trait_name, + local_trait_span: trait_def_id.as_local().map(|_| tcx.def_span(trait_def_id).shrink_to_lo()), + marking: (), + adding: (), + }); + ty::BoundConstness::NotConst + } else { + ty::BoundConstness::ConstIfConst + } + }, + hir::Constness::NotConst => ty::BoundConstness::NotConst, + } +} + fn impl_polarity(tcx: TyCtxt<'_>, def_id: DefId) -> ty::ImplPolarity { let is_rustc_reservation = tcx.has_attr(def_id, sym::rustc_reservation_impl); let item = tcx.hir().expect_item(def_id.expect_local()); diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index 9457da32ce6..bd0c1f5dd10 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -249,3 +249,24 @@ pub struct ExpectedUsedSymbol { #[primary_span] pub span: Span, } + +#[derive(Diagnostic)] +#[diag(hir_analysis_const_impl_for_non_const_trait)] +pub struct ConstImplForNonConstTrait { + #[primary_span] + pub trait_ref_span: Span, + pub trait_name: String, + #[suggestion(applicability = "machine-applicable", code = "#[const_trait]")] + pub local_trait_span: Option, + #[note] + pub marking: (), + #[note(adding)] + pub adding: (), +} + +#[derive(Diagnostic)] +#[diag(hir_analysis_const_bound_for_non_const_trait)] +pub struct ConstBoundForNonConstTrait { + #[primary_span] + pub span: Span, +} -- cgit 1.4.1-3-g733a5 From c00ff9c4d01e8ba64bf03aaf3bb7940874d3e094 Mon Sep 17 00:00:00 2001 From: Boxy Date: Thu, 27 Oct 2022 21:48:41 +0100 Subject: DoIt --- .../locales/en-US/hir_analysis.ftl | 2 + compiler/rustc_hir_analysis/src/collect/type_of.rs | 32 +++++++++- compiler/rustc_hir_analysis/src/errors.rs | 7 +++ src/test/ui/resolve/issue-23305.rs | 2 +- src/test/ui/resolve/issue-23305.stderr | 20 +------ src/test/ui/resolve/resolve-self-in-impl.rs | 8 +-- src/test/ui/resolve/resolve-self-in-impl.stderr | 68 +++------------------- 7 files changed, 56 insertions(+), 83 deletions(-) (limited to 'compiler/rustc_hir_analysis/src/errors.rs') diff --git a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl index 7ac44312695..7cedfca5728 100644 --- a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl +++ b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl @@ -146,3 +146,5 @@ hir_analysis_const_impl_for_non_const_trait = hir_analysis_const_bound_for_non_const_trait = ~const can only be applied to `#[const_trait]` traits + +hir_analysis_self_in_impl_self = `Self` is not valid at this location diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 32f359a8158..877cd75587b 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -319,7 +319,37 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { } } ItemKind::TyAlias(self_ty, _) => icx.to_ty(self_ty), - ItemKind::Impl(hir::Impl { self_ty, .. }) => icx.to_ty(*self_ty), + ItemKind::Impl( + hir::Impl { self_ty, .. } + ) => { + struct MyVisitor(bool); + impl<'v> hir::intravisit::Visitor<'v> for MyVisitor { + fn visit_ty(&mut self, t: &'v Ty<'v>) { + if matches!( + &t.kind, + TyKind::Path(hir::QPath::Resolved( + _, + Path { + res: hir::def::Res::SelfTyAlias { .. }, + .. + }, + )) + ) { + self.0 = true; + return; + } + hir::intravisit::walk_ty(self, t); + } + } + + let mut my_visitor = MyVisitor(false); + my_visitor.visit_ty(self_ty); + + match my_visitor.0 { + true => { tcx.sess.emit_err(crate::errors::SelfInImplSelf { span: self_ty.span}); tcx.ty_error() }, + false => icx.to_ty(*self_ty), + } + }, ItemKind::Fn(..) => { let substs = InternalSubsts::identity_for_item(tcx, def_id.to_def_id()); tcx.mk_fn_def(def_id.to_def_id(), substs) diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index bd0c1f5dd10..c3bfd0437ad 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -270,3 +270,10 @@ pub struct ConstBoundForNonConstTrait { #[primary_span] pub span: Span, } + +#[derive(Diagnostic)] +#[diag(hir_analysis_self_in_impl_self)] +pub struct SelfInImplSelf { + #[primary_span] + pub span: Span, +} diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs index 95635e12a63..3e3d5ee2fda 100644 --- a/src/test/ui/resolve/issue-23305.rs +++ b/src/test/ui/resolve/issue-23305.rs @@ -3,6 +3,6 @@ pub trait ToNbt { } impl dyn ToNbt {} -//~^ ERROR cycle detected +//~^ ERROR `Self` is not valid at this location fn main() {} diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index 20aeb7b995a..1b2745de321 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -1,22 +1,8 @@ -error[E0391]: cycle detected when computing type of `` - --> $DIR/issue-23305.rs:5:16 +error: `Self` is not valid at this location + --> $DIR/issue-23305.rs:5:6 | LL | impl dyn ToNbt {} - | ^^^^ - | - = note: ...which immediately requires computing type of `` again -note: cycle used when collecting item types in top-level module - --> $DIR/issue-23305.rs:1:1 - | -LL | / pub trait ToNbt { -LL | | fn new(val: T) -> Self; -LL | | } -LL | | -... | -LL | | -LL | | fn main() {} - | |____________^ + | ^^^^^^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0391`. diff --git a/src/test/ui/resolve/resolve-self-in-impl.rs b/src/test/ui/resolve/resolve-self-in-impl.rs index 024fdc51ea3..f845e780bbf 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.rs +++ b/src/test/ui/resolve/resolve-self-in-impl.rs @@ -11,10 +11,10 @@ impl Tr for S where Self: Copy {} // OK impl Tr for S where S: Copy {} // OK impl Tr for S where Self::A: Copy {} // OK -impl Tr for Self {} //~ ERROR cycle detected -impl Tr for S {} //~ ERROR cycle detected -impl Self {} //~ ERROR cycle detected -impl S {} //~ ERROR cycle detected +impl Tr for Self {} //~ ERROR `Self` is not valid at this location +impl Tr for S {} //~ ERROR `Self` is not valid at this location +impl Self {} //~ ERROR `Self` is not valid at this location +impl S {} //~ ERROR `Self` is not valid at this location impl Tr for S {} //~ ERROR cycle detected fn main() {} diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr index aa99c1a3335..93e2b4695fc 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl.stderr @@ -1,78 +1,26 @@ -error[E0391]: cycle detected when computing type of `` +error: `Self` is not valid at this location --> $DIR/resolve-self-in-impl.rs:14:13 | LL | impl Tr for Self {} | ^^^^ - | - = note: ...which immediately requires computing type of `` again -note: cycle used when collecting item types in top-level module - --> $DIR/resolve-self-in-impl.rs:1:1 - | -LL | / #![feature(associated_type_defaults)] -LL | | -LL | | struct S(T); -LL | | trait Tr { -... | -LL | | -LL | | fn main() {} - | |____________^ -error[E0391]: cycle detected when computing type of `` - --> $DIR/resolve-self-in-impl.rs:15:15 +error: `Self` is not valid at this location + --> $DIR/resolve-self-in-impl.rs:15:13 | LL | impl Tr for S {} - | ^^^^ - | - = note: ...which immediately requires computing type of `` again -note: cycle used when collecting item types in top-level module - --> $DIR/resolve-self-in-impl.rs:1:1 - | -LL | / #![feature(associated_type_defaults)] -LL | | -LL | | struct S(T); -LL | | trait Tr { -... | -LL | | -LL | | fn main() {} - | |____________^ + | ^^^^^^^ -error[E0391]: cycle detected when computing type of `` +error: `Self` is not valid at this location --> $DIR/resolve-self-in-impl.rs:16:6 | LL | impl Self {} | ^^^^ - | - = note: ...which immediately requires computing type of `` again -note: cycle used when collecting item types in top-level module - --> $DIR/resolve-self-in-impl.rs:1:1 - | -LL | / #![feature(associated_type_defaults)] -LL | | -LL | | struct S(T); -LL | | trait Tr { -... | -LL | | -LL | | fn main() {} - | |____________^ -error[E0391]: cycle detected when computing type of `` - --> $DIR/resolve-self-in-impl.rs:17:8 +error: `Self` is not valid at this location + --> $DIR/resolve-self-in-impl.rs:17:6 | LL | impl S {} - | ^^^^ - | - = note: ...which immediately requires computing type of `` again -note: cycle used when collecting item types in top-level module - --> $DIR/resolve-self-in-impl.rs:1:1 - | -LL | / #![feature(associated_type_defaults)] -LL | | -LL | | struct S(T); -LL | | trait Tr { -... | -LL | | -LL | | fn main() {} - | |____________^ + | ^^^^^^^ error[E0391]: cycle detected when computing trait implemented by `` --> $DIR/resolve-self-in-impl.rs:18:1 -- cgit 1.4.1-3-g733a5 From ca5a6e43dd6fcfddf436d36f6907d8ef44c7105b Mon Sep 17 00:00:00 2001 From: Boxy Date: Thu, 27 Oct 2022 22:18:26 +0100 Subject: use proper spans --- .../locales/en-US/hir_analysis.ftl | 4 ++- compiler/rustc_hir_analysis/src/collect/type_of.rs | 13 ++++--- compiler/rustc_hir_analysis/src/errors.rs | 6 ++-- src/test/ui/resolve/issue-23305.rs | 2 +- src/test/ui/resolve/issue-23305.stderr | 8 +++-- src/test/ui/resolve/resolve-self-in-impl.rs | 9 ++--- src/test/ui/resolve/resolve-self-in-impl.stderr | 40 +++++++++++++++------- 7 files changed, 54 insertions(+), 28 deletions(-) (limited to 'compiler/rustc_hir_analysis/src/errors.rs') diff --git a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl index 7cedfca5728..855866be627 100644 --- a/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl +++ b/compiler/rustc_error_messages/locales/en-US/hir_analysis.ftl @@ -147,4 +147,6 @@ hir_analysis_const_impl_for_non_const_trait = hir_analysis_const_bound_for_non_const_trait = ~const can only be applied to `#[const_trait]` traits -hir_analysis_self_in_impl_self = `Self` is not valid at this location +hir_analysis_self_in_impl_self = + `Self` is not valid in the self type of an impl block + .note = replace `Self` with a different type \ No newline at end of file diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index 877cd75587b..2032a4bce60 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -322,7 +322,7 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { ItemKind::Impl( hir::Impl { self_ty, .. } ) => { - struct MyVisitor(bool); + struct MyVisitor(Vec); impl<'v> hir::intravisit::Visitor<'v> for MyVisitor { fn visit_ty(&mut self, t: &'v Ty<'v>) { if matches!( @@ -335,19 +335,22 @@ pub(super) fn type_of(tcx: TyCtxt<'_>, def_id: DefId) -> Ty<'_> { }, )) ) { - self.0 = true; + self.0.push(t.span); return; } hir::intravisit::walk_ty(self, t); } } - let mut my_visitor = MyVisitor(false); + let mut my_visitor = MyVisitor(vec![]); my_visitor.visit_ty(self_ty); match my_visitor.0 { - true => { tcx.sess.emit_err(crate::errors::SelfInImplSelf { span: self_ty.span}); tcx.ty_error() }, - false => icx.to_ty(*self_ty), + spans if spans.len() > 0 => { + tcx.sess.emit_err(crate::errors::SelfInImplSelf { span: spans.into(), note: (), }); + tcx.ty_error() + }, + _ => icx.to_ty(*self_ty), } }, ItemKind::Fn(..) => { diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index c3bfd0437ad..6ed8244d119 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -1,7 +1,7 @@ //! Errors emitted by `rustc_hir_analysis`. -use rustc_errors::IntoDiagnostic; use rustc_errors::{error_code, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler}; +use rustc_errors::{IntoDiagnostic, MultiSpan}; use rustc_macros::{Diagnostic, LintDiagnostic}; use rustc_middle::ty::Ty; use rustc_span::{symbol::Ident, Span, Symbol}; @@ -275,5 +275,7 @@ pub struct ConstBoundForNonConstTrait { #[diag(hir_analysis_self_in_impl_self)] pub struct SelfInImplSelf { #[primary_span] - pub span: Span, + pub span: MultiSpan, + #[note] + pub note: (), } diff --git a/src/test/ui/resolve/issue-23305.rs b/src/test/ui/resolve/issue-23305.rs index 3e3d5ee2fda..6d7fe7c50a2 100644 --- a/src/test/ui/resolve/issue-23305.rs +++ b/src/test/ui/resolve/issue-23305.rs @@ -3,6 +3,6 @@ pub trait ToNbt { } impl dyn ToNbt {} -//~^ ERROR `Self` is not valid at this location +//~^ ERROR `Self` is not valid in the self type of an impl block fn main() {} diff --git a/src/test/ui/resolve/issue-23305.stderr b/src/test/ui/resolve/issue-23305.stderr index 1b2745de321..aad1b583a32 100644 --- a/src/test/ui/resolve/issue-23305.stderr +++ b/src/test/ui/resolve/issue-23305.stderr @@ -1,8 +1,10 @@ -error: `Self` is not valid at this location - --> $DIR/issue-23305.rs:5:6 +error: `Self` is not valid in the self type of an impl block + --> $DIR/issue-23305.rs:5:16 | LL | impl dyn ToNbt {} - | ^^^^^^^^^^^^^^^ + | ^^^^ + | + = note: replace `Self` with a different type error: aborting due to previous error diff --git a/src/test/ui/resolve/resolve-self-in-impl.rs b/src/test/ui/resolve/resolve-self-in-impl.rs index f845e780bbf..d0872d1b76f 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.rs +++ b/src/test/ui/resolve/resolve-self-in-impl.rs @@ -11,10 +11,11 @@ impl Tr for S where Self: Copy {} // OK impl Tr for S where S: Copy {} // OK impl Tr for S where Self::A: Copy {} // OK -impl Tr for Self {} //~ ERROR `Self` is not valid at this location -impl Tr for S {} //~ ERROR `Self` is not valid at this location -impl Self {} //~ ERROR `Self` is not valid at this location -impl S {} //~ ERROR `Self` is not valid at this location +impl Tr for Self {} //~ ERROR `Self` is not valid in the self type of an impl block +impl Tr for S {} //~ ERROR `Self` is not valid in the self type of an impl block +impl Self {} //~ ERROR `Self` is not valid in the self type of an impl block +impl S {} //~ ERROR `Self` is not valid in the self type of an impl block +impl (Self, Self) {} //~ ERROR `Self` is not valid in the self type of an impl block impl Tr for S {} //~ ERROR cycle detected fn main() {} diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr index 93e2b4695fc..9f9ed68898f 100644 --- a/src/test/ui/resolve/resolve-self-in-impl.stderr +++ b/src/test/ui/resolve/resolve-self-in-impl.stderr @@ -1,34 +1,50 @@ -error: `Self` is not valid at this location +error: `Self` is not valid in the self type of an impl block --> $DIR/resolve-self-in-impl.rs:14:13 | LL | impl Tr for Self {} | ^^^^ + | + = note: replace `Self` with a different type -error: `Self` is not valid at this location - --> $DIR/resolve-self-in-impl.rs:15:13 +error: `Self` is not valid in the self type of an impl block + --> $DIR/resolve-self-in-impl.rs:15:15 | LL | impl Tr for S {} - | ^^^^^^^ + | ^^^^ + | + = note: replace `Self` with a different type -error: `Self` is not valid at this location +error: `Self` is not valid in the self type of an impl block --> $DIR/resolve-self-in-impl.rs:16:6 | LL | impl Self {} | ^^^^ + | + = note: replace `Self` with a different type -error: `Self` is not valid at this location - --> $DIR/resolve-self-in-impl.rs:17:6 +error: `Self` is not valid in the self type of an impl block + --> $DIR/resolve-self-in-impl.rs:17:8 | LL | impl S {} - | ^^^^^^^ + | ^^^^ + | + = note: replace `Self` with a different type + +error: `Self` is not valid in the self type of an impl block + --> $DIR/resolve-self-in-impl.rs:18:7 + | +LL | impl (Self, Self) {} + | ^^^^ ^^^^ + | + = note: replace `Self` with a different type -error[E0391]: cycle detected when computing trait implemented by `` - --> $DIR/resolve-self-in-impl.rs:18:1 +error[E0391]: cycle detected when computing trait implemented by `` + --> $DIR/resolve-self-in-impl.rs:19:1 | LL | impl Tr for S {} | ^^^^^^^^^^^^^^^^^^^^^^ | - = note: ...which immediately requires computing trait implemented by `` again + = note: ...which immediately requires computing trait implemented by `` again note: cycle used when collecting item types in top-level module --> $DIR/resolve-self-in-impl.rs:1:1 | @@ -41,6 +57,6 @@ LL | | LL | | fn main() {} | |____________^ -error: aborting due to 5 previous errors +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0391`. -- cgit 1.4.1-3-g733a5