Rewrite dropck
This commit is contained in:
parent
1f41fbe0ef
commit
6a00008276
@ -6,10 +6,10 @@
|
|||||||
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
|
use rustc_errors::{codes::*, struct_span_code_err, ErrorGuaranteed};
|
||||||
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
use rustc_infer::infer::outlives::env::OutlivesEnvironment;
|
||||||
use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
|
use rustc_infer::infer::{RegionResolutionError, TyCtxtInferExt};
|
||||||
use rustc_infer::traits::ObligationCauseCode;
|
use rustc_infer::traits::{ObligationCause, ObligationCauseCode};
|
||||||
use rustc_middle::ty::util::CheckRegions;
|
use rustc_middle::ty::util::CheckRegions;
|
||||||
use rustc_middle::ty::GenericArgsRef;
|
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
|
use rustc_middle::ty::{GenericArgsRef, Ty};
|
||||||
use rustc_trait_selection::regions::InferCtxtRegionExt;
|
use rustc_trait_selection::regions::InferCtxtRegionExt;
|
||||||
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
||||||
|
|
||||||
@ -115,8 +115,9 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>(
|
|||||||
Err(err.emit())
|
Err(err.emit())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Confirms that every predicate imposed by dtor_predicates is
|
/// Confirms that all predicates defined on the `Drop` impl (`drop_impl_def_id`) are able to be
|
||||||
/// implied by assuming the predicates attached to self_type_did.
|
/// proven from within `adt_def_id`'s environment. I.e. all the predicates on the impl are
|
||||||
|
/// implied by the ADT being well formed.
|
||||||
fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
|
fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
|
||||||
tcx: TyCtxt<'tcx>,
|
tcx: TyCtxt<'tcx>,
|
||||||
drop_impl_def_id: LocalDefId,
|
drop_impl_def_id: LocalDefId,
|
||||||
@ -126,6 +127,8 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
|
|||||||
let infcx = tcx.infer_ctxt().build();
|
let infcx = tcx.infer_ctxt().build();
|
||||||
let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
|
let ocx = ObligationCtxt::new_with_diagnostics(&infcx);
|
||||||
|
|
||||||
|
let impl_span = tcx.def_span(drop_impl_def_id.to_def_id());
|
||||||
|
|
||||||
// Take the param-env of the adt and instantiate the args that show up in
|
// Take the param-env of the adt and instantiate the args that show up in
|
||||||
// the implementation's self type. This gives us the assumptions that the
|
// the implementation's self type. This gives us the assumptions that the
|
||||||
// self ty of the implementation is allowed to know just from it being a
|
// self ty of the implementation is allowed to know just from it being a
|
||||||
@ -135,14 +138,27 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
|
|||||||
// We don't need to normalize this param-env or anything, since we're only
|
// We don't need to normalize this param-env or anything, since we're only
|
||||||
// instantiating it with free params, so no additional param-env normalization
|
// instantiating it with free params, so no additional param-env normalization
|
||||||
// can occur on top of what has been done in the param_env query itself.
|
// can occur on top of what has been done in the param_env query itself.
|
||||||
let param_env =
|
//
|
||||||
|
// Note: Ideally instead of instantiating the `ParamEnv` with the arguments from the impl ty we
|
||||||
|
// could instead use identity args for the adt. Unfortunately this would cause any errors to
|
||||||
|
// reference the params from the ADT instead of from the impl which is bad UX. To resolve
|
||||||
|
// this we "rename" the ADT's params to be the impl's params which should not affect behaviour.
|
||||||
|
let impl_adt_ty = Ty::new_adt(tcx, tcx.adt_def(adt_def_id), adt_to_impl_args);
|
||||||
|
let adt_env =
|
||||||
ty::EarlyBinder::bind(tcx.param_env(adt_def_id)).instantiate(tcx, adt_to_impl_args);
|
ty::EarlyBinder::bind(tcx.param_env(adt_def_id)).instantiate(tcx, adt_to_impl_args);
|
||||||
|
|
||||||
for (pred, span) in tcx.predicates_of(drop_impl_def_id).instantiate_identity(tcx) {
|
let fresh_impl_args = infcx.fresh_args_for_item(impl_span, drop_impl_def_id.to_def_id());
|
||||||
|
let fresh_adt_ty =
|
||||||
|
tcx.impl_trait_ref(drop_impl_def_id).unwrap().instantiate(tcx, fresh_impl_args).self_ty();
|
||||||
|
|
||||||
|
ocx.eq(&ObligationCause::dummy_with_span(impl_span), adt_env, fresh_adt_ty, impl_adt_ty)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
for (clause, span) in tcx.predicates_of(drop_impl_def_id).instantiate(tcx, fresh_impl_args) {
|
||||||
let normalize_cause = traits::ObligationCause::misc(span, adt_def_id);
|
let normalize_cause = traits::ObligationCause::misc(span, adt_def_id);
|
||||||
let pred = ocx.normalize(&normalize_cause, param_env, pred);
|
let pred = ocx.normalize(&normalize_cause, adt_env, clause);
|
||||||
let cause = traits::ObligationCause::new(span, adt_def_id, ObligationCauseCode::DropImpl);
|
let cause = traits::ObligationCause::new(span, adt_def_id, ObligationCauseCode::DropImpl);
|
||||||
ocx.register_obligation(traits::Obligation::new(tcx, cause, param_env, pred));
|
ocx.register_obligation(traits::Obligation::new(tcx, cause, adt_env, pred));
|
||||||
}
|
}
|
||||||
|
|
||||||
// All of the custom error reporting logic is to preserve parity with the old
|
// All of the custom error reporting logic is to preserve parity with the old
|
||||||
@ -176,7 +192,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
|
|||||||
return Err(guar.unwrap());
|
return Err(guar.unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
let errors = ocx.infcx.resolve_regions(&OutlivesEnvironment::new(param_env));
|
let errors = ocx.infcx.resolve_regions(&OutlivesEnvironment::new(adt_env));
|
||||||
if !errors.is_empty() {
|
if !errors.is_empty() {
|
||||||
let mut guar = None;
|
let mut guar = None;
|
||||||
for error in errors {
|
for error in errors {
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//@ check-pass
|
||||||
|
|
||||||
struct Foo<T: Trait>(T);
|
struct Foo<T: Trait>(T);
|
||||||
|
|
||||||
trait Trait {
|
trait Trait {
|
||||||
@ -5,7 +7,6 @@ trait Trait {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T> {
|
impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T> {
|
||||||
//~^ ERROR: `Drop` impl requires `<T as Trait>::Assoc == U`
|
|
||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
trait Trait {
|
||||||
|
type Assoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Foo<T: Trait, U: ?Sized>(T, U);
|
||||||
|
|
||||||
|
impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T, U> {
|
||||||
|
//~^ ERROR: `Drop` impl requires `<T as Trait>::Assoc == U`
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
@ -1,14 +1,14 @@
|
|||||||
error[E0367]: `Drop` impl requires `<T as Trait>::Assoc == U` but the struct it is implemented for does not
|
error[E0367]: `Drop` impl requires `<T as Trait>::Assoc == U` but the struct it is implemented for does not
|
||||||
--> $DIR/constrained_by_assoc_type_equality.rs:7:15
|
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:7:15
|
||||||
|
|
|
|
||||||
LL | impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T> {
|
LL | impl<T: Trait<Assoc = U>, U: ?Sized> Drop for Foo<T, U> {
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/constrained_by_assoc_type_equality.rs:1:1
|
--> $DIR/constrained_by_assoc_type_equality_and_self_ty.rs:5:1
|
||||||
|
|
|
|
||||||
LL | struct Foo<T: Trait>(T);
|
LL | struct Foo<T: Trait, U: ?Sized>(T, U);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
@ -1,75 +1,145 @@
|
|||||||
// Issue 8142: Test that Drop impls cannot be specialized beyond the
|
// Issue 8142: Test that Drop impls cannot be specialized beyond the
|
||||||
// predicates attached to the type definition itself.
|
// predicates attached to the type definition itself.
|
||||||
trait Bound { fn foo(&self) { } }
|
trait Bound {
|
||||||
struct K<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
|
fn foo(&self) {}
|
||||||
struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
|
}
|
||||||
struct M<'m> { x: &'m i8 }
|
struct K<'l1, 'l2> {
|
||||||
struct N<'n> { x: &'n i8 }
|
x: &'l1 i8,
|
||||||
struct O<To> { x: *const To }
|
y: &'l2 u8,
|
||||||
struct P<Tp> { x: *const Tp }
|
}
|
||||||
struct Q<Tq> { x: *const Tq }
|
struct L<'l1, 'l2> {
|
||||||
struct R<Tr> { x: *const Tr }
|
x: &'l1 i8,
|
||||||
struct S<Ts:Bound> { x: *const Ts }
|
y: &'l2 u8,
|
||||||
struct T<'t,Ts:'t> { x: &'t Ts }
|
}
|
||||||
|
struct M<'m> {
|
||||||
|
x: &'m i8,
|
||||||
|
}
|
||||||
|
struct N<'n> {
|
||||||
|
x: &'n i8,
|
||||||
|
}
|
||||||
|
struct O<To> {
|
||||||
|
x: *const To,
|
||||||
|
}
|
||||||
|
struct P<Tp> {
|
||||||
|
x: *const Tp,
|
||||||
|
}
|
||||||
|
struct Q<Tq> {
|
||||||
|
x: *const Tq,
|
||||||
|
}
|
||||||
|
struct R<Tr> {
|
||||||
|
x: *const Tr,
|
||||||
|
}
|
||||||
|
struct S<Ts: Bound> {
|
||||||
|
x: *const Ts,
|
||||||
|
}
|
||||||
|
struct T<'t, Ts: 't> {
|
||||||
|
x: &'t Ts,
|
||||||
|
}
|
||||||
struct U;
|
struct U;
|
||||||
struct V<Tva, Tvb> { x: *const Tva, y: *const Tvb }
|
struct V<Tva, Tvb> {
|
||||||
struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 }
|
x: *const Tva,
|
||||||
|
y: *const Tvb,
|
||||||
|
}
|
||||||
|
struct W<'l1, 'l2> {
|
||||||
|
x: &'l1 i8,
|
||||||
|
y: &'l2 u8,
|
||||||
|
}
|
||||||
struct X<const Ca: usize>;
|
struct X<const Ca: usize>;
|
||||||
struct Y<const Ca: usize, const Cb: usize>;
|
struct Y<const Ca: usize, const Cb: usize>;
|
||||||
|
|
||||||
enum Enum<T> { Variant(T) }
|
enum Enum<T> {
|
||||||
|
Variant(T),
|
||||||
|
}
|
||||||
struct TupleStruct<T>(T);
|
struct TupleStruct<T>(T);
|
||||||
union Union<T: Copy> { f: T }
|
union Union<T: Copy> {
|
||||||
|
f: T,
|
||||||
|
}
|
||||||
|
|
||||||
impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT
|
impl<'al, 'adds_bnd: 'al> Drop for K<'al, 'adds_bnd> {
|
||||||
//~^ ERROR `Drop` impl requires `'adds_bnd: 'al`
|
//~^ ERROR `Drop` impl requires `'adds_bnd: 'al`
|
||||||
fn drop(&mut self) { } }
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT
|
impl<'al, 'adds_bnd> Drop for L<'al, 'adds_bnd>
|
||||||
//~^ ERROR `Drop` impl requires `'adds_bnd: 'al`
|
//~^ ERROR `Drop` impl requires `'adds_bnd: 'al`
|
||||||
fn drop(&mut self) { } }
|
where
|
||||||
|
'adds_bnd: 'al,
|
||||||
|
{
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'ml> Drop for M<'ml> { fn drop(&mut self) { } } // ACCEPT
|
impl<'ml> Drop for M<'ml> {
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT
|
impl Drop for N<'static> {
|
||||||
//~^ ERROR `Drop` impls cannot be specialized
|
//~^ ERROR `Drop` impls cannot be specialized
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<COkNoBound> Drop for O<COkNoBound> { fn drop(&mut self) { } } // ACCEPT
|
impl<COkNoBound> Drop for O<COkNoBound> {
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT
|
impl Drop for P<i8> {
|
||||||
//~^ ERROR `Drop` impls cannot be specialized
|
//~^ ERROR `Drop` impls cannot be specialized
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<AddsBnd:Bound> Drop for Q<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
impl<AddsBnd: Bound> Drop for Q<AddsBnd> {
|
||||||
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'rbnd,AddsRBnd:'rbnd> Drop for R<AddsRBnd> { fn drop(&mut self) { } } // REJECT
|
impl<'rbnd, AddsRBnd: 'rbnd> Drop for R<AddsRBnd> {
|
||||||
//~^ ERROR `Drop` impl requires `AddsRBnd: 'rbnd`
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<Bs:Bound> Drop for S<Bs> { fn drop(&mut self) { } } // ACCEPT
|
impl<Bs: Bound> Drop for S<Bs> {
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'t,Bt:'t> Drop for T<'t,Bt> { fn drop(&mut self) { } } // ACCEPT
|
impl<'t, Bt: 't> Drop for T<'t, Bt> {
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl Drop for U { fn drop(&mut self) { } } // ACCEPT
|
impl Drop for U {
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT
|
impl<One> Drop for V<One, One> {
|
||||||
//~^ ERROR `Drop` impls cannot be specialized
|
//~^ ERROR `Drop` impls cannot be specialized
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
|
impl<'lw> Drop for W<'lw, 'lw> {
|
||||||
//~^ ERROR `Drop` impls cannot be specialized
|
//~^ ERROR `Drop` impls cannot be specialized
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl Drop for X<3> { fn drop(&mut self) { } } // REJECT
|
impl Drop for X<3> {
|
||||||
//~^ ERROR `Drop` impls cannot be specialized
|
//~^ ERROR `Drop` impls cannot be specialized
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<const Ca: usize> Drop for Y<Ca, Ca> { fn drop(&mut self) { } } // REJECT
|
impl<const Ca: usize> Drop for Y<Ca, Ca> {
|
||||||
//~^ ERROR `Drop` impls cannot be specialized
|
//~^ ERROR `Drop` impls cannot be specialized
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<AddsBnd:Bound> Drop for Enum<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
impl<AddsBnd: Bound> Drop for Enum<AddsBnd> {
|
||||||
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<AddsBnd:Bound> Drop for TupleStruct<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
impl<AddsBnd: Bound> Drop for TupleStruct<AddsBnd> {
|
||||||
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
impl<AddsBnd:Copy + Bound> Drop for Union<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
impl<AddsBnd: Copy + Bound> Drop for Union<AddsBnd> {
|
||||||
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
//~^ ERROR `Drop` impl requires `AddsBnd: Bound`
|
||||||
|
fn drop(&mut self) {}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn main() {}
|
pub fn main() {}
|
||||||
|
@ -1,166 +1,157 @@
|
|||||||
error[E0367]: `Drop` impl requires `'adds_bnd: 'al` but the struct it is implemented for does not
|
error[E0367]: `Drop` impl requires `'adds_bnd: 'al` but the struct it is implemented for does not
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:24:20
|
--> $DIR/reject-specialized-drops-8142.rs:58:1
|
||||||
|
|
|
|
||||||
LL | impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT
|
LL | impl<'al, 'adds_bnd: 'al> Drop for K<'al, 'adds_bnd> {
|
||||||
| ^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:4:1
|
--> $DIR/reject-specialized-drops-8142.rs:6:1
|
||||||
|
|
|
|
||||||
LL | struct K<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
|
LL | struct K<'l1, 'l2> {
|
||||||
| ^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `'adds_bnd: 'al` but the struct it is implemented for does not
|
error[E0367]: `Drop` impl requires `'adds_bnd: 'al` but the struct it is implemented for does not
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:28:67
|
--> $DIR/reject-specialized-drops-8142.rs:63:1
|
||||||
|
|
|
|
||||||
LL | impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT
|
LL | / impl<'al, 'adds_bnd> Drop for L<'al, 'adds_bnd>
|
||||||
| ^^^
|
LL | |
|
||||||
|
|
LL | | where
|
||||||
note: the implementor must specify the same requirement
|
LL | | 'adds_bnd: 'al,
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:5:1
|
| |___________________^
|
||||||
|
|
|
||||||
LL | struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
|
|
||||||
| ^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0366]: `Drop` impls cannot be specialized
|
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:34:1
|
|
||||||
|
|
|
||||||
LL | impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `'static` is not a generic parameter
|
|
||||||
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:7:1
|
|
||||||
|
|
|
||||||
LL | struct N<'n> { x: &'n i8 }
|
|
||||||
| ^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0366]: `Drop` impls cannot be specialized
|
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:39:1
|
|
||||||
|
|
|
||||||
LL | impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= note: `i8` is not a generic parameter
|
|
||||||
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:9:1
|
|
||||||
|
|
|
||||||
LL | struct P<Tp> { x: *const Tp }
|
|
||||||
| ^^^^^^^^^^^^
|
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not
|
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:42:14
|
|
||||||
|
|
|
||||||
LL | impl<AddsBnd:Bound> Drop for Q<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
|
||||||
| ^^^^^
|
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:10:1
|
--> $DIR/reject-specialized-drops-8142.rs:10:1
|
||||||
|
|
|
|
||||||
LL | struct Q<Tq> { x: *const Tq }
|
LL | struct L<'l1, 'l2> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error[E0366]: `Drop` impls cannot be specialized
|
||||||
|
--> $DIR/reject-specialized-drops-8142.rs:75:1
|
||||||
|
|
|
||||||
|
LL | impl Drop for N<'static> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `'static` is not a generic parameter
|
||||||
|
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
||||||
|
--> $DIR/reject-specialized-drops-8142.rs:17:1
|
||||||
|
|
|
||||||
|
LL | struct N<'n> {
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `AddsRBnd: 'rbnd` but the struct it is implemented for does not
|
error[E0366]: `Drop` impls cannot be specialized
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:45:21
|
--> $DIR/reject-specialized-drops-8142.rs:84:1
|
||||||
|
|
|
|
||||||
LL | impl<'rbnd,AddsRBnd:'rbnd> Drop for R<AddsRBnd> { fn drop(&mut self) { } } // REJECT
|
LL | impl Drop for P<i8> {
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
||||||
|
= note: `i8` is not a generic parameter
|
||||||
|
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
||||||
|
--> $DIR/reject-specialized-drops-8142.rs:23:1
|
||||||
|
|
|
||||||
|
LL | struct P<Tp> {
|
||||||
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
|
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not
|
||||||
|
--> $DIR/reject-specialized-drops-8142.rs:89:15
|
||||||
|
|
|
||||||
|
LL | impl<AddsBnd: Bound> Drop for Q<AddsBnd> {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:11:1
|
--> $DIR/reject-specialized-drops-8142.rs:26:1
|
||||||
|
|
|
|
||||||
LL | struct R<Tr> { x: *const Tr }
|
LL | struct Q<Tq> {
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0366]: `Drop` impls cannot be specialized
|
error[E0366]: `Drop` impls cannot be specialized
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:54:1
|
--> $DIR/reject-specialized-drops-8142.rs:110:1
|
||||||
|
|
|
|
||||||
LL | impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT
|
LL | impl<One> Drop for V<One, One> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `One` is mentioned multiple times
|
= note: `One` is mentioned multiple times
|
||||||
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:15:1
|
--> $DIR/reject-specialized-drops-8142.rs:39:1
|
||||||
|
|
|
|
||||||
LL | struct V<Tva, Tvb> { x: *const Tva, y: *const Tvb }
|
LL | struct V<Tva, Tvb> {
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0366]: `Drop` impls cannot be specialized
|
error[E0366]: `Drop` impls cannot be specialized
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:57:1
|
--> $DIR/reject-specialized-drops-8142.rs:115:1
|
||||||
|
|
|
|
||||||
LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
|
LL | impl<'lw> Drop for W<'lw, 'lw> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `'lw` is mentioned multiple times
|
= note: `'lw` is mentioned multiple times
|
||||||
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:16:1
|
--> $DIR/reject-specialized-drops-8142.rs:43:1
|
||||||
|
|
|
|
||||||
LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 }
|
LL | struct W<'l1, 'l2> {
|
||||||
| ^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0366]: `Drop` impls cannot be specialized
|
error[E0366]: `Drop` impls cannot be specialized
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:60:1
|
--> $DIR/reject-specialized-drops-8142.rs:120:1
|
||||||
|
|
|
|
||||||
LL | impl Drop for X<3> { fn drop(&mut self) { } } // REJECT
|
LL | impl Drop for X<3> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `3` is not a generic parameter
|
= note: `3` is not a generic parameter
|
||||||
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:17:1
|
--> $DIR/reject-specialized-drops-8142.rs:47:1
|
||||||
|
|
|
|
||||||
LL | struct X<const Ca: usize>;
|
LL | struct X<const Ca: usize>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0366]: `Drop` impls cannot be specialized
|
error[E0366]: `Drop` impls cannot be specialized
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:63:1
|
--> $DIR/reject-specialized-drops-8142.rs:125:1
|
||||||
|
|
|
|
||||||
LL | impl<const Ca: usize> Drop for Y<Ca, Ca> { fn drop(&mut self) { } } // REJECT
|
LL | impl<const Ca: usize> Drop for Y<Ca, Ca> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: `Ca` is mentioned multiple times
|
= note: `Ca` is mentioned multiple times
|
||||||
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
note: use the same sequence of generic lifetime, type and const parameters as the struct definition
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:18:1
|
--> $DIR/reject-specialized-drops-8142.rs:48:1
|
||||||
|
|
|
|
||||||
LL | struct Y<const Ca: usize, const Cb: usize>;
|
LL | struct Y<const Ca: usize, const Cb: usize>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the enum it is implemented for does not
|
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the enum it is implemented for does not
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:66:14
|
--> $DIR/reject-specialized-drops-8142.rs:130:15
|
||||||
|
|
|
|
||||||
LL | impl<AddsBnd:Bound> Drop for Enum<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
LL | impl<AddsBnd: Bound> Drop for Enum<AddsBnd> {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:20:1
|
--> $DIR/reject-specialized-drops-8142.rs:50:1
|
||||||
|
|
|
|
||||||
LL | enum Enum<T> { Variant(T) }
|
LL | enum Enum<T> {
|
||||||
| ^^^^^^^^^^^^
|
| ^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not
|
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the struct it is implemented for does not
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:69:14
|
--> $DIR/reject-specialized-drops-8142.rs:135:15
|
||||||
|
|
|
|
||||||
LL | impl<AddsBnd:Bound> Drop for TupleStruct<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
LL | impl<AddsBnd: Bound> Drop for TupleStruct<AddsBnd> {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:21:1
|
--> $DIR/reject-specialized-drops-8142.rs:53:1
|
||||||
|
|
|
|
||||||
LL | struct TupleStruct<T>(T);
|
LL | struct TupleStruct<T>(T);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the union it is implemented for does not
|
error[E0367]: `Drop` impl requires `AddsBnd: Bound` but the union it is implemented for does not
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:72:21
|
--> $DIR/reject-specialized-drops-8142.rs:140:22
|
||||||
|
|
|
|
||||||
LL | impl<AddsBnd:Copy + Bound> Drop for Union<AddsBnd> { fn drop(&mut self) { } } // REJECT
|
LL | impl<AddsBnd: Copy + Bound> Drop for Union<AddsBnd> {
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/reject-specialized-drops-8142.rs:22:1
|
--> $DIR/reject-specialized-drops-8142.rs:54:1
|
||||||
|
|
|
|
||||||
LL | union Union<T: Copy> { f: T }
|
LL | union Union<T: Copy> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 13 previous errors
|
error: aborting due to 12 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0366, E0367.
|
Some errors have detailed explanations: E0366, E0367.
|
||||||
For more information about an error, try `rustc --explain E0366`.
|
For more information about an error, try `rustc --explain E0366`.
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
error[E0367]: `Drop` impl requires `'a: 'c` but the struct it is implemented for does not
|
error[E0367]: `Drop` impl requires `'a: 'c` but the struct it is implemented for does not
|
||||||
--> $DIR/transitive-outlives.rs:20:9
|
--> $DIR/transitive-outlives.rs:18:1
|
||||||
|
|
|
|
||||||
LL | 'a: 'c,
|
LL | / impl<'a, 'b, 'c> Drop for DropMe<'a, 'b, 'c>
|
||||||
| ^^
|
LL | |
|
||||||
|
LL | | where
|
||||||
|
LL | | 'a: 'c,
|
||||||
|
| |___________^
|
||||||
|
|
|
|
||||||
note: the implementor must specify the same requirement
|
note: the implementor must specify the same requirement
|
||||||
--> $DIR/transitive-outlives.rs:7:1
|
--> $DIR/transitive-outlives.rs:7:1
|
||||||
|
@ -16,9 +16,9 @@ fn drop(&mut self) {}
|
|||||||
|
|
||||||
#[cfg(bad)]
|
#[cfg(bad)]
|
||||||
impl<'a, 'b, 'c> Drop for DropMe<'a, 'b, 'c>
|
impl<'a, 'b, 'c> Drop for DropMe<'a, 'b, 'c>
|
||||||
|
//[bad]~^ ERROR `Drop` impl requires `'a: 'c`
|
||||||
where
|
where
|
||||||
'a: 'c,
|
'a: 'c,
|
||||||
//[bad]~^ ERROR `Drop` impl requires `'a: 'c`
|
|
||||||
{
|
{
|
||||||
fn drop(&mut self) {}
|
fn drop(&mut self) {}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
//@ known-bug: unknown
|
|
||||||
//@ failure-status: 101
|
|
||||||
|
|
||||||
struct Foo {}
|
struct Foo {}
|
||||||
|
|
||||||
impl<const UNUSED: usize> Drop for Foo {}
|
impl<const UNUSED: usize> Drop for Foo {}
|
||||||
|
//~^ ERROR: `Drop` impl requires `the constant `_` has type `usize``
|
||||||
|
//~| ERROR: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,212 +1,17 @@
|
|||||||
thread 'rustc' panicked at compiler/rustc_middle/src/ty/sty.rs:360:36:
|
error[E0367]: `Drop` impl requires `the constant `_` has type `usize`` but the struct it is implemented for does not
|
||||||
called `Option::unwrap()` on a `None` value
|
--> $DIR/unconstrained_const_param_on_drop.rs:3:6
|
||||||
stack backtrace:
|
|
|
||||||
0: begin_panic_handler
|
LL | impl<const UNUSED: usize> Drop for Foo {}
|
||||||
at ./library/std/src/panicking.rs:661:5
|
| ^^^^^^^^^^^^^^^^^^^
|
||||||
1: panic_fmt
|
|
|
||||||
at ./library/core/src/panicking.rs:74:14
|
note: the implementor must specify the same requirement
|
||||||
2: panic
|
--> $DIR/unconstrained_const_param_on_drop.rs:1:1
|
||||||
at ./library/core/src/panicking.rs:148:5
|
|
|
||||||
3: core::option::unwrap_failed
|
LL | struct Foo {}
|
||||||
at ./library/core/src/option.rs:2013:5
|
| ^^^^^^^^^^
|
||||||
4: unwrap<rustc_middle::ty::Ty>
|
|
||||||
at ./library/core/src/option.rs:963:21
|
|
||||||
5: find_ty_from_env
|
|
||||||
at ./compiler/rustc_middle/src/ty/sty.rs:360:36
|
|
||||||
6: process_obligation
|
|
||||||
at ./compiler/rustc_trait_selection/src/traits/fulfill.rs:472:29
|
|
||||||
7: process_obligations<rustc_trait_selection::traits::fulfill::PendingPredicateObligation, rustc_trait_selection::traits::fulfill::FulfillProcessor>
|
|
||||||
at ./compiler/rustc_data_structures/src/obligation_forest/mod.rs:462:23
|
|
||||||
8: select<rustc_trait_selection::traits::FulfillmentError>
|
|
||||||
at ./compiler/rustc_trait_selection/src/traits/fulfill.rs:107:13
|
|
||||||
9: select_where_possible<rustc_trait_selection::traits::FulfillmentError>
|
|
||||||
at ./compiler/rustc_trait_selection/src/traits/fulfill.rs:160:9
|
|
||||||
10: select_all_or_error<rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError>, rustc_trait_selection::traits::FulfillmentError>
|
|
||||||
at ./compiler/rustc_infer/src/traits/engine.rs:82:22
|
|
||||||
11: select_all_or_error<rustc_trait_selection::traits::FulfillmentError>
|
|
||||||
at ./compiler/rustc_trait_selection/src/traits/engine.rs:189:9
|
|
||||||
12: ensure_drop_predicates_are_implied_by_item_defn
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/dropck.rs:154:18
|
|
||||||
13: check_drop_impl
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/dropck.rs:60:13
|
|
||||||
14: call<fn(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId) -> core::result::Result<(), rustc_span::ErrorGuaranteed>, (rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>
|
|
||||||
at ./library/core/src/ops/function.rs:79:5
|
|
||||||
15: {closure#0}<fn(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId) -> core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_middle/src/ty/util.rs:360:16
|
|
||||||
16: for_each_relevant_impl<rustc_middle::ty::util::{impl#2}::calculate_dtor::{closure_env#0}<fn(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId) -> core::result::Result<(), rustc_span::ErrorGuaranteed>>>
|
|
||||||
at ./compiler/rustc_middle/src/ty/trait_def.rs:166:21
|
|
||||||
17: calculate_dtor<fn(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId) -> core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_middle/src/ty/util.rs:359:9
|
|
||||||
18: rustc_hir_analysis::check::adt_destructor
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/mod.rs:125:5
|
|
||||||
19: {closure#0}
|
|
||||||
at ./compiler/rustc_query_impl/src/plumbing.rs:285:13
|
|
||||||
[... omitted 22 frames ...]
|
|
||||||
20: query_get_at<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 12]>>>
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:145:17
|
|
||||||
21: adt_destructor<rustc_span::def_id::DefId>
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:423:31
|
|
||||||
22: adt_destructor<rustc_span::def_id::DefId>
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:414:35
|
|
||||||
23: destructor
|
|
||||||
at ./compiler/rustc_middle/src/ty/adt.rs:610:13
|
|
||||||
24: check_struct
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/check.rs:71:5
|
|
||||||
25: check_item_type
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/check.rs:730:13
|
|
||||||
26: check_item
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/wfcheck.rs:335:5
|
|
||||||
27: check_well_formed
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/wfcheck.rs:192:39
|
|
||||||
28: {closure#0}
|
|
||||||
at ./compiler/rustc_query_impl/src/plumbing.rs:281:9
|
|
||||||
[... omitted 22 frames ...]
|
|
||||||
29: query_ensure_error_guaranteed<rustc_query_system::query::caches::VecCache<rustc_hir::hir_id::OwnerId, rustc_middle::query::erase::Erased<[u8; 1]>>, ()>
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:181:9
|
|
||||||
30: check_well_formed
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:199:9
|
|
||||||
31: {closure#1}
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/wfcheck.rs:1995:47
|
|
||||||
32: {closure#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#1}>
|
|
||||||
at ./compiler/rustc_middle/src/hir/mod.rs:89:57
|
|
||||||
33: {closure#0}<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_impl_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#1}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:203:50
|
|
||||||
34: call_once<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_impl_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#1}>>>
|
|
||||||
at ./library/core/src/panic/unwind_safe.rs:272:9
|
|
||||||
35: do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_impl_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#1}>>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./library/std/src/panicking.rs:553:40
|
|
||||||
36: try<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&[rustc_hir::hir::ImplItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_impl_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#1}>>>>
|
|
||||||
at ./library/std/src/panicking.rs:517:19
|
|
||||||
37: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure#2}::{closure_env#0}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./library/std/src/panic.rs:350:14
|
|
||||||
38: run<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure#2}::{closure_env#0}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:28:9
|
|
||||||
39: {closure#2}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:206:46
|
|
||||||
40: {closure#0}<&rustc_hir::hir::ItemId, core::result::Result<(), rustc_span::ErrorGuaranteed>, core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure_env#2}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>, fn(core::result::Result<(), rustc_span::ErrorGuaranteed>, core::result::Result<(), rustc_span::ErrorGuaranteed>) -> core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./library/core/src/iter/adapters/filter_map.rs:39:28
|
|
||||||
41: fold<rustc_hir::hir::ItemId, core::result::Result<(), rustc_span::ErrorGuaranteed>, core::iter::adapters::filter_map::filter_map_fold::{closure_env#0}<&rustc_hir::hir::ItemId, core::result::Result<(), rustc_span::ErrorGuaranteed>, core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure_env#2}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>, fn(core::result::Result<(), rustc_span::ErrorGuaranteed>, core::result::Result<(), rustc_span::ErrorGuaranteed>) -> core::result::Result<(), rustc_span::ErrorGuaranteed>>>
|
|
||||||
at ./library/core/src/slice/iter/macros.rs:232:27
|
|
||||||
42: fold<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::slice::iter::Iter<rustc_hir::hir::ItemId>, rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure#0}::{closure_env#2}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>, core::result::Result<(), rustc_span::ErrorGuaranteed>, fn(core::result::Result<(), rustc_span::ErrorGuaranteed>, core::result::Result<(), rustc_span::ErrorGuaranteed>) -> core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./library/core/src/iter/adapters/filter_map.rs:148:9
|
|
||||||
43: {closure#0}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:206:73
|
|
||||||
44: parallel_guard<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_data_structures::sync::parallel::enabled::try_par_for_each_in::{closure_env#0}<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:44:15
|
|
||||||
45: try_par_for_each_in<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, rustc_middle::hir::{impl#0}::par_items::{closure_env#0}<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:199:9
|
|
||||||
46: par_items<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure_env#0}>
|
|
||||||
at ./compiler/rustc_middle/src/hir/mod.rs:75:9
|
|
||||||
47: check_mod_type_wf
|
|
||||||
at ./compiler/rustc_hir_analysis/src/check/wfcheck.rs:1994:19
|
|
||||||
48: {closure#0}
|
|
||||||
at ./compiler/rustc_query_impl/src/plumbing.rs:281:9
|
|
||||||
[... omitted 22 frames ...]
|
|
||||||
49: query_ensure_error_guaranteed<rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalModDefId, rustc_middle::query::erase::Erased<[u8; 1]>>, ()>
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:181:9
|
|
||||||
50: check_mod_type_wf
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:199:9
|
|
||||||
51: {closure#0}
|
|
||||||
at ./compiler/rustc_hir_analysis/src/lib.rs:162:21
|
|
||||||
52: {closure#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>
|
|
||||||
at ./compiler/rustc_middle/src/hir/map/mod.rs:463:13
|
|
||||||
53: {closure#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:182:34
|
|
||||||
54: call_once<(), rustc_data_structures::sync::parallel::enabled::par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>>
|
|
||||||
at ./library/core/src/panic/unwind_safe.rs:272:9
|
|
||||||
55: do_call<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::enabled::par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>>, ()>
|
|
||||||
at ./library/std/src/panicking.rs:553:40
|
|
||||||
56: try<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::enabled::par_for_each_in::{closure#0}::{closure#0}::{closure_env#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>>>
|
|
||||||
at ./library/std/src/panicking.rs:517:19
|
|
||||||
57: catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::enabled::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>>, ()>
|
|
||||||
at ./library/std/src/panic.rs:350:14
|
|
||||||
58: run<(), rustc_data_structures::sync::parallel::enabled::par_for_each_in::{closure#0}::{closure#1}::{closure_env#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:28:9
|
|
||||||
59: {closure#1}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:186:21
|
|
||||||
60: for_each<rustc_hir::hir_id::OwnerId, rustc_data_structures::sync::parallel::enabled::par_for_each_in::{closure#0}::{closure_env#1}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>>
|
|
||||||
at ./library/core/src/slice/iter/macros.rs:254:21
|
|
||||||
61: {closure#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:185:17
|
|
||||||
62: parallel_guard<(), rustc_data_structures::sync::parallel::enabled::par_for_each_in::{closure_env#0}<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:44:15
|
|
||||||
63: par_for_each_in<&rustc_hir::hir_id::OwnerId, &[rustc_hir::hir_id::OwnerId], rustc_middle::hir::map::{impl#3}::par_for_each_module::{closure_env#0}<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>>
|
|
||||||
at ./compiler/rustc_data_structures/src/sync/parallel.rs:178:9
|
|
||||||
64: par_for_each_module<rustc_hir_analysis::check_crate::{closure#0}::{closure_env#0}>
|
|
||||||
at ./compiler/rustc_middle/src/hir/map/mod.rs:462:9
|
|
||||||
65: {closure#0}
|
|
||||||
at ./compiler/rustc_hir_analysis/src/lib.rs:161:9
|
|
||||||
66: run<(), rustc_hir_analysis::check_crate::{closure_env#0}>
|
|
||||||
at ./compiler/rustc_data_structures/src/profiling.rs:754:9
|
|
||||||
67: time<(), rustc_hir_analysis::check_crate::{closure_env#0}>
|
|
||||||
at ./compiler/rustc_session/src/utils.rs:16:9
|
|
||||||
68: check_crate
|
|
||||||
at ./compiler/rustc_hir_analysis/src/lib.rs:160:5
|
|
||||||
69: run_required_analyses
|
|
||||||
at ./compiler/rustc_interface/src/passes.rs:784:5
|
|
||||||
70: analysis
|
|
||||||
at ./compiler/rustc_interface/src/passes.rs:823:5
|
|
||||||
71: {closure#0}
|
|
||||||
at ./compiler/rustc_query_impl/src/plumbing.rs:281:9
|
|
||||||
[... omitted 22 frames ...]
|
|
||||||
72: query_get_at<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>>
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:145:17
|
|
||||||
73: analysis
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:423:31
|
|
||||||
74: analysis
|
|
||||||
at ./compiler/rustc_middle/src/query/plumbing.rs:414:35
|
|
||||||
75: {closure#5}
|
|
||||||
at ./compiler/rustc_driver_impl/src/lib.rs:445:52
|
|
||||||
76: {closure#1}<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure_env#5}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_middle/src/ty/context.rs:1296:37
|
|
||||||
77: {closure#0}<rustc_middle::ty::context::{impl#19}::enter::{closure_env#1}<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure_env#5}, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_middle/src/ty/context/tls.rs:82:9
|
|
||||||
78: try_with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_middle::ty::context::{impl#19}::enter::{closure_env#1}<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure_env#5}, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./library/std/src/thread/local.rs:283:12
|
|
||||||
79: with<core::cell::Cell<*const ()>, rustc_middle::ty::context::tls::enter_context::{closure_env#0}<rustc_middle::ty::context::{impl#19}::enter::{closure_env#1}<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure_env#5}, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./library/std/src/thread/local.rs:260:9
|
|
||||||
80: enter_context<rustc_middle::ty::context::{impl#19}::enter::{closure_env#1}<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure_env#5}, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_middle/src/ty/context/tls.rs:79:9
|
|
||||||
81: enter<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}::{closure_env#5}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_middle/src/ty/context.rs:1296:9
|
|
||||||
82: {closure#1}
|
|
||||||
at ./compiler/rustc_driver_impl/src/lib.rs:445:13
|
|
||||||
83: enter<rustc_driver_impl::run_compiler::{closure#0}::{closure_env#1}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_interface/src/queries.rs:202:19
|
|
||||||
84: {closure#0}
|
|
||||||
at ./compiler/rustc_driver_impl/src/lib.rs:389:22
|
|
||||||
85: {closure#1}<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure_env#0}>
|
|
||||||
at ./compiler/rustc_interface/src/interface.rs:502:27
|
|
||||||
86: {closure#0}<rustc_interface::interface::run_compiler::{closure_env#1}<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure_env#0}>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_interface/src/util.rs:154:13
|
|
||||||
87: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure_env#0}>, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_interface/src/util.rs:106:21
|
|
||||||
88: set<rustc_span::SessionGlobals, rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure_env#0}>, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at /home/boxy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/scoped-tls-1.0.1/src/lib.rs:137:9
|
|
||||||
89: create_session_globals_then<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::util::run_in_thread_with_globals::{closure#0}::{closure#0}::{closure_env#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure_env#0}>, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>>
|
|
||||||
at ./compiler/rustc_span/src/lib.rs:134:5
|
|
||||||
90: {closure#0}<rustc_interface::util::run_in_thread_pool_with_globals::{closure_env#0}<rustc_interface::interface::run_compiler::{closure_env#1}<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure_env#0}>, core::result::Result<(), rustc_span::ErrorGuaranteed>>, core::result::Result<(), rustc_span::ErrorGuaranteed>>
|
|
||||||
at ./compiler/rustc_interface/src/util.rs:105:17
|
|
||||||
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
|
|
||||||
|
|
||||||
error: the compiler unexpectedly panicked. this is a bug.
|
|
||||||
|
|
||||||
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
|
|
||||||
|
|
||||||
note: please make sure that you have updated to the latest nightly
|
|
||||||
|
|
||||||
note: rustc 1.81.0-dev running on x86_64-unknown-linux-gnu
|
|
||||||
|
|
||||||
note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/home/boxy/.cargo -Z ignore-directory-in-diagnostics-source-blocks=/media/Nyoomies/Repos/rust/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0
|
|
||||||
|
|
||||||
query stack during panic:
|
|
||||||
#0 [adt_destructor] computing `Drop` impl for `Foo`
|
|
||||||
#1 [check_well_formed] checking that `Foo` is well-formed
|
|
||||||
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
|
|
||||||
#3 [analysis] running analysis passes on this crate
|
|
||||||
end of query stack
|
|
||||||
error[E0207]: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
|
error[E0207]: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
|
||||||
--> $DIR/unconstrained_const_param_on_drop.rs:6:6
|
--> $DIR/unconstrained_const_param_on_drop.rs:3:6
|
||||||
|
|
|
|
||||||
LL | impl<const UNUSED: usize> Drop for Foo {}
|
LL | impl<const UNUSED: usize> Drop for Foo {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^ unconstrained const parameter
|
| ^^^^^^^^^^^^^^^^^^^ unconstrained const parameter
|
||||||
@ -214,6 +19,7 @@ LL | impl<const UNUSED: usize> Drop for Foo {}
|
|||||||
= note: expressions using a const parameter must map each value to a distinct output value
|
= note: expressions using a const parameter must map each value to a distinct output value
|
||||||
= note: proving the result of expressions other than the parameter are unique is not supported
|
= note: proving the result of expressions other than the parameter are unique is not supported
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0207`.
|
Some errors have detailed explanations: E0207, E0367.
|
||||||
|
For more information about an error, try `rustc --explain E0207`.
|
||||||
|
Loading…
Reference in New Issue
Block a user