mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Delay overlap errors if errors are involved
This commit is contained in:
parent
322c7b6269
commit
9174edbae9
@ -22,7 +22,7 @@ use crate::traits::{
|
||||
use rustc_data_structures::fx::FxIndexSet;
|
||||
use rustc_errors::{error_code, DelayDm, Diagnostic};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt};
|
||||
use rustc_middle::ty::{self, ImplSubject, Ty, TyCtxt, TypeVisitableExt};
|
||||
use rustc_middle::ty::{InternalSubsts, SubstsRef};
|
||||
use rustc_session::lint::builtin::COHERENCE_LEAK_CHECK;
|
||||
use rustc_session::lint::builtin::ORDER_DEPENDENT_TRAIT_OBJECTS;
|
||||
@ -350,6 +350,10 @@ fn report_conflicting_impls<'tcx>(
|
||||
impl_span: Span,
|
||||
err: &mut Diagnostic,
|
||||
) {
|
||||
if (overlap.trait_ref, overlap.self_ty).references_error() {
|
||||
err.downgrade_to_delayed_bug();
|
||||
}
|
||||
|
||||
match tcx.span_of_impl(overlap.with_impl) {
|
||||
Ok(span) => {
|
||||
err.span_label(span, "first implementation here");
|
||||
|
@ -6,7 +6,7 @@
|
||||
struct S<const L: usize>;
|
||||
|
||||
impl<const N: i32> Copy for S<N> {}
|
||||
//~^ ERROR the constant `N` is not of type `usize`
|
||||
impl<const M: usize> Copy for S<M> {}
|
||||
//~^ ERROR conflicting implementations of trait `Copy` for type `S<[const error]>`
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,11 +1,14 @@
|
||||
error[E0119]: conflicting implementations of trait `Copy` for type `S<[const error]>`
|
||||
--> $DIR/bad-const-wf-doesnt-specialize.rs:9:1
|
||||
error: the constant `N` is not of type `usize`
|
||||
--> $DIR/bad-const-wf-doesnt-specialize.rs:8:29
|
||||
|
|
||||
LL | impl<const N: i32> Copy for S<N> {}
|
||||
| -------------------------------- first implementation here
|
||||
LL | impl<const M: usize> Copy for S<M> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<[const error]>`
|
||||
| ^^^^
|
||||
|
|
||||
note: required by a bound in `S`
|
||||
--> $DIR/bad-const-wf-doesnt-specialize.rs:6:10
|
||||
|
|
||||
LL | struct S<const L: usize>;
|
||||
| ^^^^^^^^^^^^^^ required by this bound in `S`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0119`.
|
||||
|
Loading…
Reference in New Issue
Block a user