Auto merge of #103375 - matthiaskrgr:rollup-4xrs7f2, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #102635 (make `order_dependent_trait_objects` show up in future-breakage reports) - #103335 (Replaced wrong test with the correct mcve) - #103339 (Fix some typos) - #103340 (WinConsole::new is not actually fallible) - #103341 (Add test for issue 97607) - #103351 (Require Drop impls to have the same constness on its bounds as the bounds on the struct have) - #103359 (Remove incorrect comment in `Vec::drain`) - #103364 (rustdoc: clean up rustdoc-toggle CSS) - #103370 (rustdoc: remove unused CSS `.out-of-band { font-weight: normal }`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
8f2c56aec7
@ -252,20 +252,6 @@ fn walk_ty(&mut self, t: &'a Ty) {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_struct_field_def(&mut self, field: &'a FieldDef) {
|
||||
if let Some(ident) = field.ident {
|
||||
if ident.name == kw::Underscore {
|
||||
self.visit_vis(&field.vis);
|
||||
self.visit_ident(ident);
|
||||
self.visit_ty_common(&field.ty);
|
||||
self.walk_ty(&field.ty);
|
||||
walk_list!(self, visit_attribute, &field.attrs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
self.visit_field_def(field);
|
||||
}
|
||||
|
||||
fn err_handler(&self) -> &rustc_errors::Handler {
|
||||
&self.session.diagnostic()
|
||||
}
|
||||
@ -1006,8 +992,8 @@ fn visit_lifetime(&mut self, lifetime: &'a Lifetime, _: visit::LifetimeCtxt) {
|
||||
visit::walk_lifetime(self, lifetime);
|
||||
}
|
||||
|
||||
fn visit_field_def(&mut self, s: &'a FieldDef) {
|
||||
visit::walk_field_def(self, s)
|
||||
fn visit_field_def(&mut self, field: &'a FieldDef) {
|
||||
visit::walk_field_def(self, field)
|
||||
}
|
||||
|
||||
fn visit_item(&mut self, item: &'a Item) {
|
||||
@ -1195,42 +1181,10 @@ fn visit_item(&mut self, item: &'a Item) {
|
||||
self.check_mod_file_item_asciionly(item.ident);
|
||||
}
|
||||
}
|
||||
ItemKind::Struct(ref vdata, ref generics) => match vdata {
|
||||
// Duplicating the `Visitor` logic allows catching all cases
|
||||
// of `Anonymous(Struct, Union)` outside of a field struct or union.
|
||||
//
|
||||
// Inside `visit_ty` the validator catches every `Anonymous(Struct, Union)` it
|
||||
// encounters, and only on `ItemKind::Struct` and `ItemKind::Union`
|
||||
// it uses `visit_ty_common`, which doesn't contain that specific check.
|
||||
VariantData::Struct(ref fields, ..) => {
|
||||
self.visit_vis(&item.vis);
|
||||
self.visit_ident(item.ident);
|
||||
self.visit_generics(generics);
|
||||
self.with_banned_assoc_ty_bound(|this| {
|
||||
walk_list!(this, visit_struct_field_def, fields);
|
||||
});
|
||||
walk_list!(self, visit_attribute, &item.attrs);
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
ItemKind::Union(ref vdata, ref generics) => {
|
||||
ItemKind::Union(ref vdata, ..) => {
|
||||
if vdata.fields().is_empty() {
|
||||
self.err_handler().span_err(item.span, "unions cannot have zero fields");
|
||||
}
|
||||
match vdata {
|
||||
VariantData::Struct(ref fields, ..) => {
|
||||
self.visit_vis(&item.vis);
|
||||
self.visit_ident(item.ident);
|
||||
self.visit_generics(generics);
|
||||
self.with_banned_assoc_ty_bound(|this| {
|
||||
walk_list!(this, visit_struct_field_def, fields);
|
||||
});
|
||||
walk_list!(self, visit_attribute, &item.attrs);
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
ItemKind::Const(def, .., None) => {
|
||||
self.check_defaultness(item.span, def);
|
||||
|
@ -27,7 +27,7 @@ pub struct SsoHashSet<T> {
|
||||
map: SsoHashMap<T, ()>,
|
||||
}
|
||||
|
||||
/// Adapter function used ot return
|
||||
/// Adapter function used to return
|
||||
/// result if SsoHashMap functions into
|
||||
/// result SsoHashSet should return.
|
||||
#[inline(always)]
|
||||
|
@ -184,13 +184,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>(
|
||||
let p = p.kind();
|
||||
match (predicate.skip_binder(), p.skip_binder()) {
|
||||
(ty::PredicateKind::Trait(a), ty::PredicateKind::Trait(b)) => {
|
||||
// Since struct predicates cannot have ~const, project the impl predicate
|
||||
// onto one that ignores the constness. This is equivalent to saying that
|
||||
// we match a `Trait` bound on the struct with a `Trait` or `~const Trait`
|
||||
// in the impl.
|
||||
let non_const_a =
|
||||
ty::TraitPredicate { constness: ty::BoundConstness::NotConst, ..a };
|
||||
relator.relate(predicate.rebind(non_const_a), p.rebind(b)).is_ok()
|
||||
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
|
||||
}
|
||||
(ty::PredicateKind::Projection(a), ty::PredicateKind::Projection(b)) => {
|
||||
relator.relate(predicate.rebind(a), p.rebind(b)).is_ok()
|
||||
|
@ -1427,6 +1427,7 @@
|
||||
"trait-object types were treated as different depending on marker-trait order",
|
||||
@future_incompatible = FutureIncompatibleInfo {
|
||||
reference: "issue #56484 <https://github.com/rust-lang/rust/issues/56484>",
|
||||
reason: FutureIncompatibilityReason::FutureReleaseErrorReportNow,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ pub fn const_eval_resolve(
|
||||
|
||||
match ty::Instance::resolve_opt_const_arg(
|
||||
self, param_env,
|
||||
// FIXME: maybe have a seperate version for resolving mir::UnevaluatedConst?
|
||||
// FIXME: maybe have a separate version for resolving mir::UnevaluatedConst?
|
||||
ct.def, ct.substs,
|
||||
) {
|
||||
Ok(Some(instance)) => {
|
||||
|
@ -264,7 +264,7 @@ fn project_and_unify_type<'cx, 'tcx>(
|
||||
};
|
||||
debug!(?normalized, ?obligations, "project_and_unify_type result");
|
||||
let actual = obligation.predicate.term;
|
||||
// For an example where this is neccessary see src/test/ui/impl-trait/nested-return-type2.rs
|
||||
// For an example where this is necessary see src/test/ui/impl-trait/nested-return-type2.rs
|
||||
// This allows users to omit re-mentioning all bounds on an associated type and just use an
|
||||
// `impl Trait` for the assoc type to add more bounds.
|
||||
let InferOk { value: actual, obligations: new } =
|
||||
|
@ -1999,9 +1999,7 @@ pub fn drain<R>(&mut self, range: R) -> Drain<'_, T, A>
|
||||
unsafe {
|
||||
// set self.vec length's to start, to be safe in case Drain is leaked
|
||||
self.set_len(start);
|
||||
// Use the borrow in the IterMut to indicate borrowing behavior of the
|
||||
// whole Drain iterator (like &mut T).
|
||||
let range_slice = slice::from_raw_parts_mut(self.as_mut_ptr().add(start), end - start);
|
||||
let range_slice = slice::from_raw_parts(self.as_ptr().add(start), end - start);
|
||||
Drain {
|
||||
tail_start: end,
|
||||
tail_len: len - end,
|
||||
|
@ -39,7 +39,7 @@ pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
|
||||
pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
|
||||
TerminfoTerminal::new(io::stdout())
|
||||
.map(|t| Box::new(t) as Box<StdoutTerminal>)
|
||||
.or_else(|| WinConsole::new(io::stdout()).ok().map(|t| Box::new(t) as Box<StdoutTerminal>))
|
||||
.or_else(|| Some(Box::new(WinConsole::new(io::stdout())) as Box<StdoutTerminal>))
|
||||
}
|
||||
|
||||
/// Terminal color definitions
|
||||
|
@ -113,8 +113,7 @@ fn apply(&mut self) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `None` whenever the terminal cannot be created for some reason.
|
||||
pub(crate) fn new(out: T) -> io::Result<WinConsole<T>> {
|
||||
pub(crate) fn new(out: T) -> WinConsole<T> {
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
let fg;
|
||||
@ -132,13 +131,13 @@ pub(crate) fn new(out: T) -> io::Result<WinConsole<T>> {
|
||||
bg = color::BLACK;
|
||||
}
|
||||
}
|
||||
Ok(WinConsole {
|
||||
WinConsole {
|
||||
buf: out,
|
||||
def_foreground: fg,
|
||||
def_background: bg,
|
||||
foreground: fg,
|
||||
background: bg,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -634,7 +634,6 @@ pre.example-line-numbers {
|
||||
.out-of-band {
|
||||
flex-grow: 0;
|
||||
font-size: 1.125rem;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.docblock code, .docblock-short code,
|
||||
@ -1536,6 +1535,7 @@ details.dir-entry a {
|
||||
https://developer.mozilla.org/en-US/docs/Web/CSS/contain */
|
||||
details.rustdoc-toggle {
|
||||
contain: layout;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* The hideme class is used on summary tags that contain a span with
|
||||
@ -1629,10 +1629,6 @@ details.rustdoc-toggle[open] > summary.hideme {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
details.rustdoc-toggle {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
details.rustdoc-toggle[open] > summary.hideme > span {
|
||||
display: none;
|
||||
}
|
||||
@ -1983,8 +1979,8 @@ in storage.js
|
||||
}
|
||||
}
|
||||
|
||||
.method-toggle summary,
|
||||
.implementors-toggle summary,
|
||||
.method-toggle > summary,
|
||||
.implementors-toggle > summary,
|
||||
.impl,
|
||||
#implementors-list > .docblock,
|
||||
.impl-items > section,
|
||||
@ -1993,10 +1989,7 @@ in storage.js
|
||||
margin-bottom: 0.75em;
|
||||
}
|
||||
|
||||
.method-toggle[open]:not(:last-child) {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
.method-toggle[open]:not(:last-child),
|
||||
.implementors-toggle[open]:not(:last-child) {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
@ -21,3 +21,14 @@ assert-property: (".top-doc .docblock summary h4", {"offsetHeight": "33"})
|
||||
assert-css: (".top-doc .docblock summary h4", {"margin-top": "15px", "margin-bottom": "5px"})
|
||||
// So `33 + 15 + 5` == `53`
|
||||
assert-property: (".top-doc .docblock summary", {"offsetHeight": "53"})
|
||||
|
||||
// We now check the `<summary>` on a method.
|
||||
assert-css: (
|
||||
".method-toggle .docblock summary h4",
|
||||
{"border-bottom-width": "0px"},
|
||||
)
|
||||
// This allows to ensure that summary is on one line only!
|
||||
assert-property: (".method-toggle .docblock summary h4", {"offsetHeight": "30"})
|
||||
assert-css: (".method-toggle .docblock summary h4", {"margin-top": "15px", "margin-bottom": "5px"})
|
||||
// So `30 + 15 + 5` == `50`
|
||||
assert-property: (".method-toggle .docblock summary", {"offsetHeight": "50"})
|
||||
|
@ -317,6 +317,18 @@ pub mod details {
|
||||
/// <div>I'm the content of the details!</div>
|
||||
/// </details>
|
||||
pub struct Details;
|
||||
|
||||
impl Details {
|
||||
/// We check the appearance of the `<details>`/`<summary>` in here.
|
||||
///
|
||||
/// ## Hello
|
||||
///
|
||||
/// <details>
|
||||
/// <summary><h4>I'm a summary</h4></summary>
|
||||
/// <div>I'm the content of the details!</div>
|
||||
/// </details>
|
||||
pub fn method() {}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod doc_block_table {
|
||||
|
12
src/test/ui/closures/issue-97607.rs
Normal file
12
src/test/ui/closures/issue-97607.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// check-pass
|
||||
#[allow(unused)]
|
||||
|
||||
fn test<T, F, U>(f: F) -> Box<dyn Fn(T) -> U + 'static>
|
||||
where
|
||||
F: 'static + Fn(T) -> U,
|
||||
for<'a> U: 'a, // < This is the problematic line, see #97607
|
||||
{
|
||||
Box::new(move |t| f(t))
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -1,19 +0,0 @@
|
||||
error[E0271]: type mismatch resolving `<Empty<_> as Stream>::Item == Repr`
|
||||
--> $DIR/issue-89008.rs:38:43
|
||||
|
|
||||
LL | fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
|
||||
| ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<Empty<_> as Stream>::Item == Repr`
|
||||
| |
|
||||
| this type parameter
|
||||
|
|
||||
note: expected this to be `()`
|
||||
--> $DIR/issue-89008.rs:17:17
|
||||
|
|
||||
LL | type Item = ();
|
||||
| ^^
|
||||
= note: expected unit type `()`
|
||||
found type parameter `Repr`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0271`.
|
@ -1,7 +1,7 @@
|
||||
// check-fail
|
||||
// known-bug
|
||||
|
||||
// We almost certaintly want this to pass, but
|
||||
// We almost certainly want this to pass, but
|
||||
// it's particularly difficult currently, because we need a way of specifying
|
||||
// that `<Self::Base as Functor>::With<T> = Self` without using that when we have
|
||||
// a `U`. See `https://github.com/rust-lang/rust/pull/92728` for a (hacky)
|
||||
|
@ -1,42 +1,36 @@
|
||||
// check-fail
|
||||
// check-pass
|
||||
// edition:2021
|
||||
// known-bug: #88908
|
||||
|
||||
// This should pass, but seems to run into a TAIT bug.
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use std::future::Future;
|
||||
use std::marker::PhantomData;
|
||||
|
||||
trait Stream {
|
||||
type Item;
|
||||
}
|
||||
|
||||
struct Empty<T>(T);
|
||||
impl<T> Stream for Empty<T> {
|
||||
type Item = ();
|
||||
struct Empty<T> {
|
||||
_phantom: PhantomData<T>,
|
||||
}
|
||||
fn empty<T>() -> Empty<T> {
|
||||
todo!()
|
||||
|
||||
impl<T> Stream for Empty<T> {
|
||||
type Item = T;
|
||||
}
|
||||
|
||||
trait X {
|
||||
type LineStream<'a, Repr>: Stream<Item = Repr> where Self: 'a;
|
||||
|
||||
type LineStreamFut<'a,Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a;
|
||||
|
||||
fn line_stream<'a,Repr>(&'a self) -> Self::LineStreamFut<'a,Repr>;
|
||||
type LineStreamFut<'a, Repr>: Future<Output = Self::LineStream<'a, Repr>> where Self: 'a;
|
||||
fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr>;
|
||||
}
|
||||
|
||||
struct Y;
|
||||
|
||||
impl X for Y {
|
||||
type LineStream<'a, Repr> = impl Stream<Item = Repr>;
|
||||
|
||||
type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>> ;
|
||||
|
||||
type LineStreamFut<'a, Repr> = impl Future<Output = Self::LineStream<'a, Repr>>;
|
||||
fn line_stream<'a, Repr>(&'a self) -> Self::LineStreamFut<'a, Repr> {
|
||||
async {empty()}
|
||||
async { Empty { _phantom: PhantomData } }
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ fn main() {
|
||||
|
||||
// Ensure that uninhabited types do not "diverge".
|
||||
// This might be relaxed in the future, but when it is,
|
||||
// it should be an explicitly wanted descision.
|
||||
// it should be an explicitly wanted decision.
|
||||
let Some(x) = Some(1) else { foo::<Uninhabited>() }; //~ ERROR does not diverge
|
||||
}
|
||||
|
||||
|
@ -37,3 +37,45 @@ LL | impl Foo for dyn Send + Sync + Send {}
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + 'static)`: (E0119)
|
||||
--> $DIR/lint-incoherent-auto-trait-objects.rs:5:1
|
||||
|
|
||||
LL | impl Foo for dyn Send {}
|
||||
| --------------------- first implementation here
|
||||
LL |
|
||||
LL | impl Foo for dyn Send + Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
= note: `#[deny(order_dependent_trait_objects)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/lint-incoherent-auto-trait-objects.rs:11:1
|
||||
|
|
||||
LL | impl Foo for dyn Send + Sync {}
|
||||
| ---------------------------- first implementation here
|
||||
LL |
|
||||
LL | impl Foo for dyn Sync + Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
= note: `#[deny(order_dependent_trait_objects)]` on by default
|
||||
|
||||
Future breakage diagnostic:
|
||||
error: conflicting implementations of trait `Foo` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/lint-incoherent-auto-trait-objects.rs:15:1
|
||||
|
|
||||
LL | impl Foo for dyn Sync + Send {}
|
||||
| ---------------------------- first implementation here
|
||||
...
|
||||
LL | impl Foo for dyn Send + Sync + Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
= note: `#[deny(order_dependent_trait_objects)]` on by default
|
||||
|
||||
|
@ -45,34 +45,55 @@ note: required by a bound in `check`
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `check`
|
||||
|
||||
error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: ~const Destruct` is not satisfied
|
||||
error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:48:47
|
||||
|
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ----------------------------------------- ^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:48:47
|
||||
|
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `ConstDropImplWithBounds`
|
||||
--> $DIR/const-drop-fail.rs:27:35
|
||||
|
|
||||
LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
| ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
|
||||
|
||||
error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:48:5
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ----- required by a bound introduced by this call
|
||||
...
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `ConstDropImplWithBounds<NonTrivialDrop>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
|
||||
|
|
||||
note: required for `ConstDropImplWithBounds<NonTrivialDrop>` to implement `~const Destruct`
|
||||
--> $DIR/const-drop-fail.rs:29:25
|
||||
note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:48:5
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
||||
| ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: 1 redundant requirement hidden
|
||||
= note: required for `ConstDropImplWithBounds<NonTrivialDrop>` to implement `~const Destruct`
|
||||
note: required by a bound in `check`
|
||||
--> $DIR/const-drop-fail.rs:35:19
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `ConstDropImplWithBounds`
|
||||
--> $DIR/const-drop-fail.rs:27:35
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `check`
|
||||
help: consider borrowing here
|
||||
|
|
||||
LL | &ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| +
|
||||
LL | &mut ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ++++
|
||||
LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
| ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not
|
||||
--> $DIR/const-drop-fail.rs:55:9
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: the implementor must specify the same requirement
|
||||
--> $DIR/const-drop-fail.rs:53:1
|
||||
|
|
||||
LL | struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0367.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -24,7 +24,7 @@ trait A { fn a() { } }
|
||||
|
||||
impl A for NonTrivialDrop {}
|
||||
|
||||
struct ConstDropImplWithBounds<T: A>(PhantomData<T>);
|
||||
struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
|
||||
impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
||||
fn drop(&mut self) {
|
||||
@ -47,6 +47,16 @@ macro_rules! check_all {
|
||||
//~^ ERROR can't drop
|
||||
ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
//~^ ERROR the trait bound
|
||||
//~| ERROR the trait bound
|
||||
}
|
||||
|
||||
struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
|
||||
|
||||
impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
||||
//~^ ERROR `Drop` impl requires `T: ~const A` but the struct it is implemented for does not
|
||||
fn drop(&mut self) {
|
||||
T::a();
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -45,34 +45,55 @@ note: required by a bound in `check`
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `check`
|
||||
|
||||
error[E0277]: the trait bound `ConstDropImplWithBounds<NonTrivialDrop>: ~const Destruct` is not satisfied
|
||||
error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:48:47
|
||||
|
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ----------------------------------------- ^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:48:47
|
||||
|
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ^^^^^^^^^^^
|
||||
note: required by a bound in `ConstDropImplWithBounds`
|
||||
--> $DIR/const-drop-fail.rs:27:35
|
||||
|
|
||||
LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
| ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
|
||||
|
||||
error[E0277]: the trait bound `NonTrivialDrop: ~const A` is not satisfied
|
||||
--> $DIR/const-drop-fail.rs:48:5
|
||||
|
|
||||
LL | const _: () = check($exp);
|
||||
| ----- required by a bound introduced by this call
|
||||
...
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `ConstDropImplWithBounds<NonTrivialDrop>`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `~const A` is not implemented for `NonTrivialDrop`
|
||||
|
|
||||
note: required for `ConstDropImplWithBounds<NonTrivialDrop>` to implement `~const Destruct`
|
||||
--> $DIR/const-drop-fail.rs:29:25
|
||||
note: the trait `A` is implemented for `NonTrivialDrop`, but that implementation is not `const`
|
||||
--> $DIR/const-drop-fail.rs:48:5
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
||||
| ^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
= note: 1 redundant requirement hidden
|
||||
= note: required for `ConstDropImplWithBounds<NonTrivialDrop>` to implement `~const Destruct`
|
||||
note: required by a bound in `check`
|
||||
--> $DIR/const-drop-fail.rs:35:19
|
||||
LL | ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `ConstDropImplWithBounds`
|
||||
--> $DIR/const-drop-fail.rs:27:35
|
||||
|
|
||||
LL | const fn check<T: ~const Destruct>(_: T) {}
|
||||
| ^^^^^^^^^^^^^^^ required by this bound in `check`
|
||||
help: consider borrowing here
|
||||
|
|
||||
LL | &ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| +
|
||||
LL | &mut ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
|
||||
| ++++
|
||||
LL | struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
||||
| ^^^^^^^^ required by this bound in `ConstDropImplWithBounds`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
error[E0367]: `Drop` impl requires `T: ~const A` but the struct it is implemented for does not
|
||||
--> $DIR/const-drop-fail.rs:55:9
|
||||
|
|
||||
LL | impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
||||
| ^^^^^^^^
|
||||
|
|
||||
note: the implementor must specify the same requirement
|
||||
--> $DIR/const-drop-fail.rs:53:1
|
||||
|
|
||||
LL | struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0277, E0367.
|
||||
For more information about an error, try `rustc --explain E0277`.
|
||||
|
@ -60,7 +60,7 @@ impl SomeTrait for i32 {
|
||||
fn foo() {}
|
||||
}
|
||||
|
||||
pub struct ConstDropWithBound<T: SomeTrait>(pub core::marker::PhantomData<T>);
|
||||
pub struct ConstDropWithBound<T: ~const SomeTrait>(pub core::marker::PhantomData<T>);
|
||||
|
||||
impl<T: ~const SomeTrait> const Drop for ConstDropWithBound<T> {
|
||||
fn drop(&mut self) {
|
||||
|
@ -0,0 +1,17 @@
|
||||
// check-pass
|
||||
#![feature(const_trait_impl)]
|
||||
|
||||
#[const_trait]
|
||||
trait Foo {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
struct Bar<T>(T);
|
||||
|
||||
impl<T: ~const Foo> Bar<T> {
|
||||
const fn foo(&self) {
|
||||
self.0.foo()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
@ -66,3 +66,20 @@ error: aborting due to 8 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0119, E0751.
|
||||
For more information about an error, try `rustc --explain E0119`.
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait0` for type `(dyn std::marker::Send + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-hack-boundaries.rs:10:1
|
||||
|
|
||||
LL | impl Trait0 for dyn Send {}
|
||||
| ------------------------ first implementation here
|
||||
LL | impl Trait0 for dyn Send {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-hack-boundaries.rs:2:10
|
||||
|
|
||||
LL | #![allow(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -40,3 +40,56 @@ LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
|
||||
|
||||
warning: 3 warnings emitted
|
||||
|
||||
Future incompatibility report: Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:86:1
|
||||
|
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
|
||||
| ------------------------------------------------------ first implementation here
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:3:9
|
||||
|
|
||||
LL | #![warn(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:89:1
|
||||
|
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
|
||||
| ------------------------------------------------------------- first implementation here
|
||||
...
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:3:9
|
||||
|
|
||||
LL | #![warn(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Future breakage diagnostic:
|
||||
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:93:1
|
||||
|
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
|
||||
| ------------------------------------------------------ first implementation here
|
||||
...
|
||||
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
||||
|
|
||||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
||||
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-33140-traitobject-crate.rs:3:9
|
||||
|
|
||||
LL | #![warn(order_dependent_trait_objects)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/multiple-occurence-ambiguousity.rs:21:26
|
||||
--> $DIR/multiple-occurrence-ambiguousity.rs:21:26
|
||||
|
|
||||
LL | let t: &dyn Bar<_> = s;
|
||||
| ----------- ^ expected trait `Bar`, found trait `Foo`
|
Loading…
Reference in New Issue
Block a user