Unconditionally run check_item_type on all items

This commit is contained in:
Oli Scherer
2025-06-04 08:46:49 +00:00
parent cca072ca15
commit 9b5d57d0a9
64 changed files with 661 additions and 460 deletions

View File

@@ -881,10 +881,6 @@ pub(crate) fn check_item_type(tcx: TyCtxt<'_>, def_id: LocalDefId) {
hir::ForeignItemKind::Fn(sig, _, _) => {
require_c_abi_if_c_variadic(tcx, sig.decl, abi, item.span);
}
hir::ForeignItemKind::Static(..) => {
check_static_inhabited(tcx, def_id);
check_static_linkage(tcx, def_id);
}
_ => {}
}
}

View File

@@ -185,6 +185,7 @@ where
}
fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGuaranteed> {
crate::check::check::check_item_type(tcx, def_id);
let node = tcx.hir_node_by_def_id(def_id);
let mut res = match node {
hir::Node::Crate(_) => bug!("check_well_formed cannot be applied to the crate root"),
@@ -192,9 +193,7 @@ fn check_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Result<(), ErrorGua
hir::Node::TraitItem(item) => check_trait_item(tcx, item),
hir::Node::ImplItem(item) => check_impl_item(tcx, item),
hir::Node::ForeignItem(item) => check_foreign_item(tcx, item),
hir::Node::ConstBlock(_) | hir::Node::Expr(_) | hir::Node::OpaqueTy(_) => {
Ok(crate::check::check::check_item_type(tcx, def_id))
}
hir::Node::ConstBlock(_) | hir::Node::Expr(_) | hir::Node::OpaqueTy(_) => Ok(()),
_ => unreachable!("{node:?}"),
};
@@ -228,7 +227,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
);
crate::collect::lower_item(tcx, item.item_id());
let res = match item.kind {
match item.kind {
// Right now we check that every default trait implementation
// has an implementation of itself. Basically, a case like:
//
@@ -332,11 +331,7 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
res
}
_ => Ok(()),
};
crate::check::check::check_item_type(tcx, def_id);
res
}
}
fn check_foreign_item<'tcx>(

View File

@@ -14,7 +14,7 @@ impl Tr for str {
type Arr = [u8; 8];
#[cfg(cfail)]
type Arr = [u8; Self::C];
//[cfail]~^ ERROR cycle detected when evaluating type-level constant
//[cfail]~^ ERROR cycle detected when caching mir
}
fn main() {}

View File

@@ -1,4 +1,4 @@
error[E0391]: cycle detected when computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`
error[E0391]: cycle detected when computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type
--> $DIR/impl-wf-cycle-4.rs:5:1
|
LL | / impl<T> Filter for T
@@ -6,14 +6,14 @@ LL | | where
LL | | T: Fn(Self::ToMatch),
| |_________________________^
|
note: ...which requires computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type...
note: ...which requires computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`...
--> $DIR/impl-wf-cycle-4.rs:5:1
|
LL | / impl<T> Filter for T
LL | | where
LL | | T: Fn(Self::ToMatch),
| |_________________________^
= note: ...which again requires computing normalized predicates of `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>`, completing the cycle
= note: ...which again requires computing whether `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` has a guaranteed unsized self type, completing the cycle
note: cycle used when checking that `<impl at $DIR/impl-wf-cycle-4.rs:5:1: 7:26>` is well-formed
--> $DIR/impl-wf-cycle-4.rs:5:1
|

View File

@@ -58,6 +58,35 @@ help: consider further restricting the associated type
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
@@ -77,35 +106,6 @@ help: consider further restricting the associated type
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:17
|
@@ -161,6 +161,35 @@ help: consider further restricting the associated type
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
@@ -180,35 +209,6 @@ help: consider further restricting the associated type
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
| +++++++++++++++++++++++++++++++++++++++
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:23
|
LL | #[derive(Debug, Copy, Clone)]
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
|
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
--> $DIR/issue-38821.rs:9:18
|
LL | impl<T: NotNull> IntoNullable for T {
| ------- ^^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
--> $DIR/issue-38821.rs:23:10
|

View File

@@ -22,6 +22,14 @@ LL | impl async Fn<()> for F {}
|
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/impl-header.rs:5:1
|
LL | impl async Fn<()> for F {}
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`
error[E0277]: expected a `FnMut()` closure, found `F`
--> $DIR/impl-header.rs:5:23
|
@@ -33,14 +41,6 @@ LL | impl async Fn<()> for F {}
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/impl-header.rs:5:1
|
LL | impl async Fn<()> for F {}
| ^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0046, E0183, E0277, E0658.

View File

@@ -1,3 +1,11 @@
error[E0046]: not all trait items implemented, missing: `eq`
--> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:1
|
LL | trait DynIncompatible { fn eq(&self, other: Self); }
| -------------------------- `eq` from trait
LL | impl DynIncompatible for dyn DynIncompatible { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
error[E0038]: the trait `DynIncompatible` is not dyn compatible
--> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:26
|
@@ -14,14 +22,6 @@ LL | trait DynIncompatible { fn eq(&self, other: Self); }
| this trait is not dyn compatible...
= help: consider moving `eq` to another trait
error[E0046]: not all trait items implemented, missing: `eq`
--> $DIR/coherence-impl-trait-for-trait-dyn-compatible.rs:7:1
|
LL | trait DynIncompatible { fn eq(&self, other: Self); }
| -------------------------- `eq` from trait
LL | impl DynIncompatible for dyn DynIncompatible { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `eq` in implementation
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0038, E0046.

View File

@@ -1,3 +1,12 @@
error[E0046]: not all trait items implemented, missing: `Assoc`
--> $DIR/best-obligation-ICE.rs:10:1
|
LL | type Assoc;
| ---------- `Assoc` from trait
...
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation
error[E0277]: the trait bound `W<W<T>>: Trait` is not satisfied
--> $DIR/best-obligation-ICE.rs:10:19
|
@@ -46,15 +55,6 @@ help: consider restricting type parameter `T` with trait `Trait`
LL | impl<T: Trait> Trait for W<W<W<T>>> {}
| +++++++
error[E0046]: not all trait items implemented, missing: `Assoc`
--> $DIR/best-obligation-ICE.rs:10:1
|
LL | type Assoc;
| ---------- `Assoc` from trait
...
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation
error[E0119]: conflicting implementations of trait `NoOverlap` for type `W<W<W<W<_>>>>`
--> $DIR/best-obligation-ICE.rs:18:1
|

View File

@@ -5,6 +5,7 @@
struct Foo;
impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
//~^ ERROR the const parameter `NUM` is not constrained by the impl trait, self type, or predicates
//~| ERROR missing: `Output`, `add`
where
[(); 1 + 0]: Sized,
{

View File

@@ -1,5 +1,5 @@
error[E0407]: method `unimplemented` is not a member of trait `std::ops::Add`
--> $DIR/post-analysis-user-facing-param-env.rs:11:5
--> $DIR/post-analysis-user-facing-param-env.rs:12:5
|
LL | / fn unimplemented(self, _: &Foo) -> Self::Output {
LL | |
@@ -17,6 +17,19 @@ LL | #![feature(generic_const_exprs)]
= note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
= note: `#[warn(incomplete_features)]` on by default
error[E0046]: not all trait items implemented, missing: `Output`, `add`
--> $DIR/post-analysis-user-facing-param-env.rs:6:1
|
LL | / impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
LL | |
LL | |
LL | | where
LL | | [(); 1 + 0]: Sized,
| |_______________________^ missing `Output`, `add` in implementation
|
= help: implement the missing item: `type Output = /* Type */;`
= help: implement the missing item: `fn add(self, _: &'a Foo) -> <Self as Add<&'a Foo>>::Output { todo!() }`
error[E0207]: the const parameter `NUM` is not constrained by the impl trait, self type, or predicates
--> $DIR/post-analysis-user-facing-param-env.rs:6:10
|
@@ -27,7 +40,7 @@ LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
= note: proving the result of expressions other than the parameter are unique is not supported
error[E0284]: type annotations needed
--> $DIR/post-analysis-user-facing-param-env.rs:11:40
--> $DIR/post-analysis-user-facing-param-env.rs:12:40
|
LL | fn unimplemented(self, _: &Foo) -> Self::Output {
| ^^^^^^^^^^^^ cannot infer the value of const parameter `NUM`
@@ -40,7 +53,7 @@ LL | impl<'a, const NUM: usize> std::ops::Add<&'a Foo> for Foo
| |
| unsatisfied trait bound introduced here
error: aborting due to 3 previous errors; 1 warning emitted
error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0207, E0284, E0407.
For more information about an error, try `rustc --explain E0207`.
Some errors have detailed explanations: E0046, E0207, E0284, E0407.
For more information about an error, try `rustc --explain E0046`.

View File

@@ -1,11 +1,3 @@
error: the constant `N` is not of type `usize`
--> $DIR/type_mismatch.rs:8:26
|
LL | impl<const N: u64> Q for [u8; N] {}
| ^^^^^^^ expected `usize`, found `u64`
|
= note: the length of array `[u8; N]` must be type `usize`
error[E0046]: not all trait items implemented, missing: `ASSOC`
--> $DIR/type_mismatch.rs:8:1
|
@@ -15,6 +7,14 @@ LL | const ASSOC: usize;
LL | impl<const N: u64> Q for [u8; N] {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation
error: the constant `N` is not of type `usize`
--> $DIR/type_mismatch.rs:8:26
|
LL | impl<const N: u64> Q for [u8; N] {}
| ^^^^^^^ expected `usize`, found `u64`
|
= note: the length of array `[u8; N]` must be type `usize`
error: the constant `13` is not of type `u64`
--> $DIR/type_mismatch.rs:12:26
|

View File

@@ -15,6 +15,7 @@ struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
//~^ ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates
//~^^ ERROR mismatched types
//~| ERROR missing: `next`
type Item = &'a [T; N];
}

View File

@@ -49,6 +49,20 @@ LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error[E0308]: mismatched types
--> $DIR/ice-unexpected-inference-var-122549.rs:15:66
|
LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^ expected `usize`, found `()`
error[E0046]: not all trait items implemented, missing: `next`
--> $DIR/ice-unexpected-inference-var-122549.rs:15:1
|
LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `next` in implementation
|
= help: implement the missing item: `fn next(&mut self) -> Option<<Self as Iterator>::Item> { todo!() }`
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/ice-unexpected-inference-var-122549.rs:15:13
|
@@ -58,13 +72,7 @@ LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
= 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
error[E0308]: mismatched types
--> $DIR/ice-unexpected-inference-var-122549.rs:15:66
|
LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
| ^^ expected `usize`, found `()`
error: aborting due to 7 previous errors
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392.
For more information about an error, try `rustc --explain E0046`.

View File

@@ -14,5 +14,6 @@ impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T
//~^ ERROR mismatched types [E0308]
//~| ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates [E0207]
type Item = &'a [T; N]; }
//~^ ERROR: `Item` specializes an item from a parent `impl`, but that item is not marked `default`
fn main() {}

View File

@@ -34,6 +34,17 @@ LL | struct ConstChunksExact<'a, T: '_, const assert: usize> {}
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error[E0520]: `Item` specializes an item from a parent `impl`, but that item is not marked `default`
--> $DIR/normalizing_with_unconstrained_impl_params.rs:16:5
|
LL | impl<'a, T: std::fmt::Debug, const N: usize> Iterator for ConstChunksExact<'a, T, { N }> {
| ---------------------------------------------------------------------------------------- parent `impl` is here
...
LL | type Item = &'a [T; N]; }
| ^^^^^^^^^ cannot specialize default item `Item`
|
= note: to specialize, `Item` in the parent `impl` must be marked `default`
error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
--> $DIR/normalizing_with_unconstrained_impl_params.rs:13:30
|
@@ -54,7 +65,7 @@ LL | fn next(&mut self) -> Option<Self::Item> {}
= note: expected enum `Option<_>`
found unit type `()`
error: aborting due to 7 previous errors
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0637.
Some errors have detailed explanations: E0046, E0207, E0308, E0392, E0520, E0637.
For more information about an error, try `rustc --explain E0046`.

View File

@@ -11,7 +11,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
| ^^^^^
|
= note: ...which immediately requires computing type of `Trait::N` again
note: cycle used when computing explicit predicates of trait `Trait`
note: cycle used when checking that `Trait` is well-formed
--> $DIR/not_wf_param_in_rpitit.rs:3:1
|
LL | trait Trait<const N: dyn Trait = bar> {

View File

@@ -29,7 +29,7 @@ LL | struct S<const S: (), const S: S = { S }>;
| ^
|
= note: ...which immediately requires computing type of `S::S` again
note: cycle used when computing explicit predicates of `S`
note: cycle used when checking that `S` is well-formed
--> $DIR/issue-103790.rs:4:1
|
LL | struct S<const S: (), const S: S = { S }>;

View File

@@ -10,11 +10,11 @@ note: ...which requires comparing an impl and trait method signature, inferring
LL | reuse to_reuse::opaque_ret;
| ^^^^^^^^^^
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::opaque_ret::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>` is well-formed
--> $DIR/unsupported.rs:21:5
note: cycle used when checking assoc item `opaque::<impl at $DIR/unsupported.rs:21:5: 21:24>::opaque_ret` is compatible with trait definition
--> $DIR/unsupported.rs:22:25
|
LL | impl ToReuse for u8 {
| ^^^^^^^^^^^^^^^^^^^
LL | reuse to_reuse::opaque_ret;
| ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret::{anon_assoc#0}`
@@ -29,11 +29,11 @@ note: ...which requires comparing an impl and trait method signature, inferring
LL | reuse ToReuse::opaque_ret;
| ^^^^^^^^^^
= note: ...which again requires computing type of `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>` is well-formed
--> $DIR/unsupported.rs:24:5
note: cycle used when checking assoc item `opaque::<impl at $DIR/unsupported.rs:24:5: 24:25>::opaque_ret` is compatible with trait definition
--> $DIR/unsupported.rs:25:24
|
LL | impl ToReuse for u16 {
| ^^^^^^^^^^^^^^^^^^^^
LL | reuse ToReuse::opaque_ret;
| ^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: recursive delegation is not supported yet

View File

@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:27:18
--> $DIR/explicit-drop-bounds.rs:32:5
|
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18
@@ -15,10 +15,10 @@ LL | [T; 1]: Copy, T: std::marker::Copy // But `[T; 1]: Copy` does not imply
| ++++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:32:5
--> $DIR/explicit-drop-bounds.rs:27:18
|
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18

View File

@@ -1,8 +1,8 @@
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:38:18
--> $DIR/explicit-drop-bounds.rs:41:5
|
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18
@@ -15,10 +15,10 @@ LL | impl<T: std::marker::Copy> Drop for DropMe<T>
| +++++++++++++++++++
error[E0277]: the trait bound `T: Copy` is not satisfied
--> $DIR/explicit-drop-bounds.rs:41:5
--> $DIR/explicit-drop-bounds.rs:38:18
|
LL | fn drop(&mut self) {}
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `T`
LL | impl<T> Drop for DropMe<T>
| ^^^^^^^^^ the trait `Copy` is not implemented for `T`
|
note: required by a bound in `DropMe`
--> $DIR/explicit-drop-bounds.rs:7:18

View File

@@ -3,5 +3,6 @@ struct 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
//~| ERROR: missing: `drop`
fn main() {}

View File

@@ -10,6 +10,14 @@ note: the implementor must specify the same requirement
LL | struct Foo {}
| ^^^^^^^^^^
error[E0046]: not all trait items implemented, missing: `drop`
--> $DIR/unconstrained_const_param_on_drop.rs:3:1
|
LL | impl<const UNUSED: usize> Drop for Foo {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `drop` in implementation
|
= help: implement the missing item: `fn drop(&mut self) { todo!() }`
error[E0207]: the const parameter `UNUSED` is not constrained by the impl trait, self type, or predicates
--> $DIR/unconstrained_const_param_on_drop.rs:3:6
|
@@ -19,7 +27,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: proving the result of expressions other than the parameter are unique is not supported
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0207, E0367.
For more information about an error, try `rustc --explain E0207`.
Some errors have detailed explanations: E0046, E0207, E0367.
For more information about an error, try `rustc --explain E0046`.

View File

@@ -15,6 +15,18 @@ LL | | A
LL | | }
| |_- not a struct or union
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/eval-error.rs:2:5
|
LL | a: str,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | a: std::mem::ManuallyDrop<str>,
| +++++++++++++++++++++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/eval-error.rs:2:8
|
@@ -33,18 +45,6 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | a: Box<str>,
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/eval-error.rs:2:5
|
LL | a: str,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | a: std::mem::ManuallyDrop<str>,
| +++++++++++++++++++++++ +
error[E0080]: the type `Foo` has an unknown layout
--> $DIR/eval-error.rs:9:30
|

View File

@@ -73,14 +73,6 @@ LL |
LL | V9,
| -- `-2` assigned here
error[E0370]: enum discriminant overflowed
--> $DIR/E0081.rs:87:5
|
LL | X256,
| ^^^^ overflowed on value after 255
|
= note: explicitly set `X256 = 0` if that is desired outcome
error[E0081]: discriminant value `0` assigned more than once
--> $DIR/E0081.rs:57:1
|
@@ -96,6 +88,14 @@ LL | X000, X001, X002, X003, X004, X005, X006, X007, X008, X009,
LL | X256,
| ---- `0` assigned here
error[E0370]: enum discriminant overflowed
--> $DIR/E0081.rs:87:5
|
LL | X256,
| ^^^^ overflowed on value after 255
|
= note: explicitly set `X256 = 0` if that is desired outcome
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0081, E0370.

View File

@@ -56,6 +56,19 @@ LL | impl Fn<()> for Foo {
|
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
error[E0053]: method `call` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32
|
LL | extern "rust-call" fn call(self, args: ()) -> () {}
| ^^^^ expected `&Foo`, found `Foo`
|
= note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
found signature `extern "rust-call" fn(Foo, ()) -> ()`
help: change the self-receiver type to match the trait
|
LL | extern "rust-call" fn call(&self, args: ()) -> () {}
| +
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:6
|
@@ -85,19 +98,6 @@ LL | impl Fn<()> for Foo {
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0053]: method `call` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:13:32
|
LL | extern "rust-call" fn call(self, args: ()) -> () {}
| ^^^^ expected `&Foo`, found `Foo`
|
= note: expected signature `extern "rust-call" fn(&Foo, ()) -> _`
found signature `extern "rust-call" fn(Foo, ()) -> ()`
help: change the self-receiver type to match the trait
|
LL | extern "rust-call" fn call(&self, args: ()) -> () {}
| +
error[E0183]: manual implementations of `FnOnce` are experimental
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6
|
@@ -144,17 +144,6 @@ LL | impl FnOnce() for Foo1 {
|
= help: implement the missing item: `type Output = /* Type */;`
error[E0277]: expected a `FnOnce()` closure, found `Bar`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
|
LL | impl FnMut<()> for Bar {
| ^^^ expected an `FnOnce()` closure, found `Bar`
|
= help: the trait `FnOnce()` is not implemented for `Bar`
= note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `FnMut`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0053]: method `call_mut` has an incompatible type for trait
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:30:36
|
@@ -168,6 +157,17 @@ help: change the self-receiver type to match the trait
LL | extern "rust-call" fn call_mut(&mut self, args: ()) -> () {}
| +++
error[E0277]: expected a `FnOnce()` closure, found `Bar`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
|
LL | impl FnMut<()> for Bar {
| ^^^ expected an `FnOnce()` closure, found `Bar`
|
= help: the trait `FnOnce()` is not implemented for `Bar`
= note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
note: required by a bound in `FnMut`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0046]: not all trait items implemented, missing: `Output`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:35:1
|

View File

@@ -10,6 +10,14 @@ help: parenthesized trait syntax expands to `Fn<(u32,), Output=u32>`
LL | impl Fn(u32) -> u32 for S {
| ^^^^^^^^^^^^^^
error[E0050]: method `call` has 1 parameter but the declaration in trait `call` has 2
--> $DIR/issue-39259.rs:9:13
|
LL | fn call(&self) -> u32 {
| ^^^^^ expected 2 parameters, found 1
|
= note: `call` from trait: `extern "rust-call" fn(&Self, Args) -> <Self as FnOnce<Args>>::Output`
error[E0277]: expected a `FnMut(u32)` closure, found `S`
--> $DIR/issue-39259.rs:6:25
|
@@ -20,14 +28,6 @@ LL | impl Fn(u32) -> u32 for S {
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0050]: method `call` has 1 parameter but the declaration in trait `call` has 2
--> $DIR/issue-39259.rs:9:13
|
LL | fn call(&self) -> u32 {
| ^^^^^ expected 2 parameters, found 1
|
= note: `call` from trait: `extern "rust-call" fn(&Self, Args) -> <Self as FnOnce<Args>>::Output`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0050, E0229, E0277.

View File

@@ -9,6 +9,7 @@ impl <T, T1> Foo for T {
type F<T1> = &[u8];
//~^ ERROR: the name `T1` is already used for
//~| ERROR: `&` without an explicit lifetime name cannot be used here
//~| ERROR: has 1 type parameter but its trait declaration has 0 type parameters
}
fn main() {}

View File

@@ -13,13 +13,22 @@ error[E0637]: `&` without an explicit lifetime name cannot be used here
LL | type F<T1> = &[u8];
| ^ explicit lifetime name needed here
error[E0049]: associated type `F` has 1 type parameter but its trait declaration has 0 type parameters
--> $DIR/gat-trait-path-generic-type-arg.rs:9:12
|
LL | type F<'a>;
| -- expected 0 type parameters
...
LL | type F<T1> = &[u8];
| ^^ found 1 type parameter
error[E0207]: the type parameter `T1` is not constrained by the impl trait, self type, or predicates
--> $DIR/gat-trait-path-generic-type-arg.rs:7:10
|
LL | impl <T, T1> Foo for T {
| ^^ unconstrained type parameter
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0207, E0403, E0637.
For more information about an error, try `rustc --explain E0207`.
Some errors have detailed explanations: E0049, E0207, E0403, E0637.
For more information about an error, try `rustc --explain E0049`.

View File

@@ -19,6 +19,28 @@ help: consider further restricting type parameter `F` with trait `MyFn`
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:36:5
|
LL | / fn autobatch<F>(self) -> impl Trait
... |
LL | | where
LL | | F: Callback<Self::CallbackArg>,
| |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`
|
note: required for `F` to implement `Callback<i32>`
--> $DIR/false-positive-predicate-entailment-error.rs:14:21
|
LL | impl<A, F: MyFn<A>> Callback<A> for F {
| ------- ^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting type parameter `F` with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: Callback<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:42:12
|
@@ -45,28 +67,6 @@ help: consider further restricting type parameter `F` with trait `MyFn`
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:36:5
|
LL | / fn autobatch<F>(self) -> impl Trait
... |
LL | | where
LL | | F: Callback<Self::CallbackArg>,
| |_______________________________________^ the trait `MyFn<i32>` is not implemented for `F`
|
note: required for `F` to implement `Callback<i32>`
--> $DIR/false-positive-predicate-entailment-error.rs:14:21
|
LL | impl<A, F: MyFn<A>> Callback<A> for F {
| ------- ^^^^^^^^^^^ ^
| |
| unsatisfied trait bound introduced here
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
help: consider further restricting type parameter `F` with trait `MyFn`
|
LL | F: Callback<Self::CallbackArg> + MyFn<i32>,
| +++++++++++
error[E0277]: the trait bound `F: MyFn<i32>` is not satisfied
--> $DIR/false-positive-predicate-entailment-error.rs:36:30
|

View File

@@ -46,11 +46,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
--> $DIR/method-compatability-via-leakage-cycle.rs:17:1
note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
|
LL | impl Trait for u32 {
| ^^^^^^^^^^^^^^^^^^
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error: aborting due to 1 previous error

View File

@@ -50,11 +50,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
--> $DIR/method-compatability-via-leakage-cycle.rs:17:1
note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
|
LL | impl Trait for u32 {
| ^^^^^^^^^^^^^^^^^^
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
error[E0391]: cycle detected when computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`
@@ -109,11 +109,11 @@ note: ...which requires type-checking `<impl at $DIR/method-compatability-via-le
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo::{anon_assoc#0}`, completing the cycle
note: cycle used when checking that `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>` is well-formed
--> $DIR/method-compatability-via-leakage-cycle.rs:17:1
note: cycle used when checking assoc item `<impl at $DIR/method-compatability-via-leakage-cycle.rs:17:1: 17:19>::foo` is compatible with trait definition
--> $DIR/method-compatability-via-leakage-cycle.rs:21:5
|
LL | impl Trait for u32 {
| ^^^^^^^^^^^^^^^^^^
LL | fn foo(b: bool) -> impl Sized {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`

View File

@@ -9,6 +9,7 @@ pub trait Mirror {
impl<T: ?Sized> Mirror for () {
//~^ ERROR the type parameter `T` is not constrained
type Assoc = T;
//~^ ERROR the size for values of type `T` cannot be known at compilation time
}
pub trait First {

View File

@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
LL | impl<T: ?Sized> Mirror for () {
| ^ unconstrained type parameter
error: aborting due to 1 previous error
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/refine-resolution-errors.rs:11:18
|
LL | impl<T: ?Sized> Mirror for () {
| - this type parameter needs to be `Sized`
LL |
LL | type Assoc = T;
| ^ doesn't have a size known at compile-time
|
note: required by a bound in `Mirror::Assoc`
--> $DIR/refine-resolution-errors.rs:7:5
|
LL | type Assoc;
| ^^^^^^^^^^^ required by this bound in `Mirror::Assoc`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - impl<T: ?Sized> Mirror for () {
LL + impl<T> Mirror for () {
|
help: consider relaxing the implicit `Sized` restriction
|
LL | type Assoc: ?Sized;
| ++++++++
For more information about this error, try `rustc --explain E0207`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0207, E0277.
For more information about an error, try `rustc --explain E0207`.

View File

@@ -1,3 +1,15 @@
error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration
--> $DIR/span-bug-issue-121457.rs:10:14
|
LL | type Item<'a>
| ---- lifetimes in impl do not match this associated type in trait
LL | where
LL | Self: 'a;
| -- this bound might be missing in the impl
...
LL | type Item = u32;
| ^ lifetimes do not match associated type in trait
error[E0582]: binding for associated type `Item` references lifetime `'missing`, which does not appear in the trait input types
--> $DIR/span-bug-issue-121457.rs:13:51
|
@@ -12,18 +24,6 @@ LL | fn iter(&self) -> impl for<'missing> Iterator<Item = Self::Item<'missin
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0195]: lifetime parameters or bounds on associated type `Item` do not match the trait declaration
--> $DIR/span-bug-issue-121457.rs:10:14
|
LL | type Item<'a>
| ---- lifetimes in impl do not match this associated type in trait
LL | where
LL | Self: 'a;
| -- this bound might be missing in the impl
...
LL | type Item = u32;
| ^ lifetimes do not match associated type in trait
error[E0277]: `()` is not an iterator
--> $DIR/span-bug-issue-121457.rs:13:23
|

View File

@@ -6,6 +6,7 @@ impl<'a, T> Foo for T {
//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
fn test() -> &'a () {
//~^ WARN: does not match trait method signature
&()
}
}

View File

@@ -1,9 +1,27 @@
warning: impl trait in impl method signature does not match trait method signature
--> $DIR/unconstrained-lt.rs:8:18
|
LL | fn test() -> impl Sized;
| ---------- return type from trait method defined here
...
LL | fn test() -> &'a () {
| ^^^^^^
|
= note: add `#[allow(refining_impl_trait)]` if it is intended for this to be part of the public API of this crate
= note: we are soliciting feedback, see issue #121718 <https://github.com/rust-lang/rust/issues/121718> for more information
= note: `#[warn(refining_impl_trait_internal)]` on by default
help: replace the return type so that it matches the trait
|
LL - fn test() -> &'a () {
LL + fn test() -> impl Sized {
|
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
--> $DIR/unconstrained-lt.rs:5:6
|
LL | impl<'a, T> Foo for T {
| ^^ unconstrained lifetime parameter
error: aborting due to 1 previous error
error: aborting due to 1 previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0207`.

View File

@@ -70,6 +70,18 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | field2: Box<str>, // Unsized
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:5
|
LL | field2: str, // Unsized
| ^^^^^^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | field2: std::mem::ManuallyDrop<str>, // Unsized
| +++++++++++++++++++++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:13
|
@@ -88,18 +100,6 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | field2: Box<str>, // Unsized
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/ice-non-last-unsized-field-issue-121473.rs:46:5
|
LL | field2: str, // Unsized
| ^^^^^^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | field2: std::mem::ManuallyDrop<str>, // Unsized
| +++++++++++++++++++++++ +
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0277, E0740.

View File

@@ -1,3 +1,16 @@
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
|
LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
note: required by a bound in `FnOnce`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:24:12
|
@@ -12,9 +25,9 @@ LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:45:5
|
LL | extern "rust-call" fn call_once(mut self, a: A) -> Self::Output {
LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
note: required by a bound in `FnOnce`
@@ -37,19 +50,6 @@ help: consider further restricting type parameter `A` with unstable trait `Tuple
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0059]: type parameter to bare `FnOnce` trait must be a tuple
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:45:5
|
LL | extern "rust-call" fn call_mut(&mut self, a: A) -> Self::Output {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Tuple` is not implemented for `A`
|
note: required by a bound in `FnOnce`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
help: consider further restricting type parameter `A` with unstable trait `Tuple`
|
LL | A: Eq + Hash + Clone + std::marker::Tuple,
| ++++++++++++++++++++
error[E0277]: functions with the "rust-call" ABI must take a single non-self tuple argument
--> $DIR/rust-call-abi-not-a-tuple-ice-81974.rs:31:5
|

View File

@@ -32,6 +32,14 @@ help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>`
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/issue-95023.rs:3:1
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
--> $DIR/issue-95023.rs:3:21
|
@@ -42,14 +50,6 @@ LL | impl Fn(&isize) for Error {
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/issue-95023.rs:3:1
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
error[E0220]: associated type `B` not found for `Self`
--> $DIR/issue-95023.rs:8:44
|

View File

@@ -1,3 +1,14 @@
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/macro-span-issue-116502.rs:7:13
|
LL | _
| ^ not allowed in type signatures
...
LL | struct S<T = m!()>(m!(), T)
| ---- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/macro-span-issue-116502.rs:7:13
|
@@ -20,17 +31,6 @@ LL | struct S<T = m!()>(m!(), T)
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0121]: the placeholder `_` is not allowed within types on item signatures for structs
--> $DIR/macro-span-issue-116502.rs:7:13
|
LL | _
| ^ not allowed in type signatures
...
LL | struct S<T = m!()>(m!(), T)
| ---- in this macro invocation
|
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0121`.

View File

@@ -1,3 +1,9 @@
error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
--> $DIR/array-trait.rs:22:1
|
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
| ^^^^^^^^^^^^^^^^^^^^^
error: unconstrained generic constant
--> $DIR/array-trait.rs:22:23
|
@@ -9,12 +15,6 @@ help: try adding a `where` bound
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]) where [(); S::SIZE]:;
| ++++++++++++++++++++
error[E0077]: SIMD vector element type should be a primitive scalar (integer/float/pointer) type
--> $DIR/array-trait.rs:22:1
|
LL | pub struct T<S: Simd>([S::Lane; S::SIZE]);
| ^^^^^^^^^^^^^^^^^^^^^
error: unconstrained generic constant
--> $DIR/array-trait.rs:22:23
|

View File

@@ -18,14 +18,6 @@ LL | #![feature(specialization)]
= help: consider using `min_specialization` instead, which is more stable and complete
= note: `#[warn(incomplete_features)]` on by default
error: impls of auto traits cannot be default
--> $DIR/validation.rs:9:21
|
LL | default unsafe impl Send for S {}
| ------- ^^^^ auto trait
| |
| default because of this
error[E0367]: `!Send` impl requires `Z: Send` but the struct it is implemented for does not
--> $DIR/validation.rs:12:1
|
@@ -38,6 +30,14 @@ note: the implementor must specify the same requirement
LL | struct Z;
| ^^^^^^^^
error: impls of auto traits cannot be default
--> $DIR/validation.rs:9:21
|
LL | default unsafe impl Send for S {}
| ------- ^^^^ auto trait
| |
| default because of this
error: impls of auto traits cannot be default
--> $DIR/validation.rs:12:15
|

View File

@@ -1,8 +1,8 @@
error[E0277]: the trait bound `B: Clone` is not satisfied
--> $DIR/issue-79224.rs:28:29
--> $DIR/issue-79224.rs:30:5
|
LL | impl<B: ?Sized> Display for Cow<'_, B> {
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting type parameter `B` with trait `Clone`
@@ -11,10 +11,10 @@ LL | impl<B: ?Sized + std::clone::Clone> Display for Cow<'_, B> {
| +++++++++++++++++++
error[E0277]: the trait bound `B: Clone` is not satisfied
--> $DIR/issue-79224.rs:30:5
--> $DIR/issue-79224.rs:28:29
|
LL | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `B`
LL | impl<B: ?Sized> Display for Cow<'_, B> {
| ^^^^^^^^^^ the trait `Clone` is not implemented for `B`
|
= note: required for `B` to implement `ToOwned`
help: consider further restricting type parameter `B` with trait `Clone`

View File

@@ -1,12 +1,3 @@
error[E0658]: use of unstable library feature `unstable_default`
--> $DIR/generics-default-stability-where.rs:7:45
|
LL | impl<T> Trait3<usize> for T where T: Trait2<usize> {
| ^^^^^
|
= help: add `#![feature(unstable_default)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct<T>`)
--> $DIR/generics-default-stability-where.rs:7:6
|
@@ -16,6 +7,15 @@ LL | impl<T> Trait3<usize> for T where T: Trait2<usize> {
= note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local
= note: only traits defined in the current crate can be implemented for a type parameter
error[E0658]: use of unstable library feature `unstable_default`
--> $DIR/generics-default-stability-where.rs:7:45
|
LL | impl<T> Trait3<usize> for T where T: Trait2<usize> {
| ^^^^^
|
= help: add `#![feature(unstable_default)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0210, E0658.

View File

@@ -1,8 +1,8 @@
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:6:5
--> $DIR/uninhabited-static.rs:12:1
|
LL | static VOID: Void;
| ^^^^^^^^^^^^^^^^^
LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
| ^^^^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
@@ -13,26 +13,6 @@ note: the lint level is defined here
LL | #![deny(uninhabited_static)]
| ^^^^^^^^^^^^^^^^^^
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:8:5
|
LL | static NEVER: !;
| ^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:12:1
|
LL | static VOID2: Void = unsafe { std::mem::transmute(()) };
| ^^^^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:15:1
|
@@ -43,6 +23,26 @@ LL | static NEVER2: Void = unsafe { std::mem::transmute(()) };
= note: for more information, see issue #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:6:5
|
LL | static VOID: Void;
| ^^^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error: static of uninhabited type
--> $DIR/uninhabited-static.rs:8:5
|
LL | static NEVER: !;
| ^^^^^^^^^^^^^^^
|
= 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 #74840 <https://github.com/rust-lang/rust/issues/74840>
= note: uninhabited statics cannot be initialized, and any access would be an immediate error
error[E0080]: constructing invalid value: encountered a value of uninhabited type `Void`
--> $DIR/uninhabited-static.rs:12:31
|

View File

@@ -1,9 +1,3 @@
error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9
|
LL | impl<T, S> Trait<T> for i32 {
| ^ unconstrained type parameter
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:15:12
|
@@ -16,6 +10,12 @@ note: trait defined here, with 1 generic parameter: `T`
LL | pub trait Trait<T> {
| ^^^^^ -
error[E0207]: the type parameter `S` is not constrained by the impl trait, self type, or predicates
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:9:9
|
LL | impl<T, S> Trait<T> for i32 {
| ^ unconstrained type parameter
error[E0107]: trait takes 1 generic argument but 2 generic arguments were supplied
--> $DIR/116464-invalid-assoc-type-suggestion-in-trait-impl.rs:19:12
|

View File

@@ -1,14 +1,3 @@
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:5
|
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting type parameter `T` with trait `Foo`
|
LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:9:1
|
@@ -25,15 +14,10 @@ LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:9:1
--> $DIR/deep-norm-pending.rs:15:5
|
LL | / impl<T> Bar for T
LL | |
LL | |
LL | | where
... |
LL | | }
| |_^ the trait `Foo` is not implemented for `T`
LL | fn method() {}
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting type parameter `T` with trait `Foo`
|
@@ -102,6 +86,22 @@ help: consider further restricting type parameter `T` with trait `Foo`
LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:9:1
|
LL | / impl<T> Bar for T
LL | |
LL | |
LL | | where
... |
LL | | }
| |_^ the trait `Foo` is not implemented for `T`
|
help: consider further restricting type parameter `T` with trait `Foo`
|
LL | <T as Foo>::Assoc: Sized, T: Foo
| ++++++
error[E0277]: the trait bound `T: Foo` is not satisfied
--> $DIR/deep-norm-pending.rs:15:5
|

View File

@@ -56,6 +56,12 @@ LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
= help: add `#![feature(dispatch_from_dyn)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0377]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures
--> $DIR/issue-78372.rs:3:1
|
LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0307]: invalid `self` parameter type: `Smaht<Self, T>`
--> $DIR/issue-78372.rs:9:18
|
@@ -65,12 +71,6 @@ LL | fn foo(self: Smaht<Self, T>);
= note: type of `self` must be `Self` or a type that dereferences to it
= help: consider changing to `self`, `&self`, `&mut self`, `self: Box<Self>`, `self: Rc<Self>`, `self: Arc<Self>`, or `self: Pin<P>` (where P is one of the previous types except `Self`)
error[E0377]: the trait `DispatchFromDyn` may only be implemented for a coercion between structures
--> $DIR/issue-78372.rs:3:1
|
LL | impl<T> DispatchFromDyn<Smaht<U, MISC>> for T {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0307, E0377, E0412, E0658.

View File

@@ -24,6 +24,14 @@ help: parenthesized trait syntax expands to `Fn<(&isize,), Output=()>`
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/issue-87558.rs:3:1
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
--> $DIR/issue-87558.rs:3:21
|
@@ -34,14 +42,6 @@ LL | impl Fn(&isize) for Error {
note: required by a bound in `Fn`
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
error[E0046]: not all trait items implemented, missing: `call`
--> $DIR/issue-87558.rs:3:1
|
LL | impl Fn(&isize) for Error {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call` in implementation
|
= help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0046, E0183, E0229, E0277, E0407.

View File

@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
LL | impl<T: ?Sized> Every for Thing {
| ^ unconstrained type parameter
error: aborting due to 1 previous error
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/unconstrained-projection-normalization-2.rs:16:18
|
LL | impl<T: ?Sized> Every for Thing {
| - this type parameter needs to be `Sized`
LL |
LL | type Assoc = T;
| ^ doesn't have a size known at compile-time
|
note: required by a bound in `Every::Assoc`
--> $DIR/unconstrained-projection-normalization-2.rs:12:5
|
LL | type Assoc;
| ^^^^^^^^^^^ required by this bound in `Every::Assoc`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - impl<T: ?Sized> Every for Thing {
LL + impl<T> Every for Thing {
|
help: consider relaxing the implicit `Sized` restriction
|
LL | type Assoc: ?Sized;
| ++++++++
For more information about this error, try `rustc --explain E0207`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0207, E0277.
For more information about an error, try `rustc --explain E0207`.

View File

@@ -4,13 +4,37 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
LL | impl<T: ?Sized> Every for Thing {
| ^ unconstrained type parameter
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/unconstrained-projection-normalization-2.rs:16:18
|
LL | impl<T: ?Sized> Every for Thing {
| - this type parameter needs to be `Sized`
LL |
LL | type Assoc = T;
| ^ doesn't have a size known at compile-time
|
note: required by a bound in `Every::Assoc`
--> $DIR/unconstrained-projection-normalization-2.rs:12:5
|
LL | type Assoc;
| ^^^^^^^^^^^ required by this bound in `Every::Assoc`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - impl<T: ?Sized> Every for Thing {
LL + impl<T> Every for Thing {
|
help: consider relaxing the implicit `Sized` restriction
|
LL | type Assoc: ?Sized;
| ++++++++
error[E0282]: type annotations needed
--> $DIR/unconstrained-projection-normalization-2.rs:19:11
--> $DIR/unconstrained-projection-normalization-2.rs:20:11
|
LL | fn foo(_: <Thing as Every>::Assoc) {}
| ^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for associated type `<Thing as Every>::Assoc`
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0207, E0282.
Some errors have detailed explanations: E0207, E0277, E0282.
For more information about an error, try `rustc --explain E0207`.

View File

@@ -12,8 +12,9 @@ pub trait Every {
type Assoc;
}
impl<T: ?Sized> Every for Thing {
//~^ ERROR the type parameter `T` is not constrained
//~^ ERROR the type parameter `T` is not constrained
type Assoc = T;
//~^ ERROR: the size for values of type `T` cannot be known at compilation time
}
fn foo(_: <Thing as Every>::Assoc) {}

View File

@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
LL | impl<T: ?Sized> Every for Thing {
| ^ unconstrained type parameter
error: aborting due to 1 previous error
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/unconstrained-projection-normalization.rs:15:18
|
LL | impl<T: ?Sized> Every for Thing {
| - this type parameter needs to be `Sized`
LL |
LL | type Assoc = T;
| ^ doesn't have a size known at compile-time
|
note: required by a bound in `Every::Assoc`
--> $DIR/unconstrained-projection-normalization.rs:11:5
|
LL | type Assoc;
| ^^^^^^^^^^^ required by this bound in `Every::Assoc`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - impl<T: ?Sized> Every for Thing {
LL + impl<T> Every for Thing {
|
help: consider relaxing the implicit `Sized` restriction
|
LL | type Assoc: ?Sized;
| ++++++++
For more information about this error, try `rustc --explain E0207`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0207, E0277.
For more information about an error, try `rustc --explain E0207`.

View File

@@ -4,6 +4,31 @@ error[E0207]: the type parameter `T` is not constrained by the impl trait, self
LL | impl<T: ?Sized> Every for Thing {
| ^ unconstrained type parameter
error: aborting due to 1 previous error
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/unconstrained-projection-normalization.rs:15:18
|
LL | impl<T: ?Sized> Every for Thing {
| - this type parameter needs to be `Sized`
LL |
LL | type Assoc = T;
| ^ doesn't have a size known at compile-time
|
note: required by a bound in `Every::Assoc`
--> $DIR/unconstrained-projection-normalization.rs:11:5
|
LL | type Assoc;
| ^^^^^^^^^^^ required by this bound in `Every::Assoc`
help: consider removing the `?Sized` bound to make the type parameter `Sized`
|
LL - impl<T: ?Sized> Every for Thing {
LL + impl<T> Every for Thing {
|
help: consider relaxing the implicit `Sized` restriction
|
LL | type Assoc: ?Sized;
| ++++++++
For more information about this error, try `rustc --explain E0207`.
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0207, E0277.
For more information about an error, try `rustc --explain E0207`.

View File

@@ -11,8 +11,9 @@ pub trait Every {
type Assoc;
}
impl<T: ?Sized> Every for Thing {
//~^ ERROR the type parameter `T` is not constrained
//~^ ERROR the type parameter `T` is not constrained
type Assoc = T;
//~^ ERROR: the size for values of type `T` cannot be known at compilation time
}
static I: <Thing as Every>::Assoc = 3;

View File

@@ -1,4 +1,4 @@
trait Deserializer<'a> { }
trait Deserializer<'a> {}
trait Deserializable {
fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
@@ -8,6 +8,7 @@ impl<'a, T: Deserializable> Deserializable for &'a str {
//~^ ERROR type parameter `T` is not constrained
fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
//~^ ERROR mismatched types
//~| ERROR do not match the trait declaration
}
}

View File

@@ -1,3 +1,12 @@
error[E0195]: lifetime parameters or bounds on associated function `deserialize_token` do not match the trait declaration
--> $DIR/issue-13853-5.rs:9:25
|
LL | fn deserialize_token<'a, D: Deserializer<'a>>(_: D, _: &'a str) -> Self;
| ------------------------- lifetimes in impl do not match this associated function in trait
...
LL | fn deserialize_token<D: Deserializer<'a>>(_x: D, _y: &'a str) -> &'a str {
| ^^^^^^^^^^^^^^^^^^^^^ lifetimes do not match associated function in trait
error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
--> $DIR/issue-13853-5.rs:7:10
|
@@ -19,7 +28,7 @@ LL ~ _y
LL ~
|
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0207, E0308.
For more information about an error, try `rustc --explain E0207`.
Some errors have detailed explanations: E0195, E0207, E0308.
For more information about an error, try `rustc --explain E0195`.

View File

@@ -1,3 +1,15 @@
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/issue-81199.rs:5:5
|
LL | components: PtrComponents<T>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | components: std::mem::ManuallyDrop<PtrComponents<T>>,
| +++++++++++++++++++++++ +
error[E0277]: the trait bound `T: Pointee` is not satisfied
--> $DIR/issue-81199.rs:5:17
|
@@ -14,18 +26,6 @@ help: consider further restricting type parameter `T` with trait `Pointee`
LL | union PtrRepr<T: ?Sized + Pointee> {
| +++++++++
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/issue-81199.rs:5:5
|
LL | components: PtrComponents<T>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | components: std::mem::ManuallyDrop<PtrComponents<T>>,
| +++++++++++++++++++++++ +
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0277, E0740.

View File

@@ -1,3 +1,15 @@
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/union-unsized.rs:2:5
|
LL | a: str,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | a: std::mem::ManuallyDrop<str>,
| +++++++++++++++++++++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
--> $DIR/union-unsized.rs:2:8
|
@@ -17,15 +29,15 @@ LL | a: Box<str>,
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/union-unsized.rs:2:5
--> $DIR/union-unsized.rs:11:5
|
LL | a: str,
LL | b: str,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | a: std::mem::ManuallyDrop<str>,
LL | b: std::mem::ManuallyDrop<str>,
| +++++++++++++++++++++++ +
error[E0277]: the size for values of type `str` cannot be known at compilation time
@@ -46,18 +58,6 @@ help: the `Box` type always has a statically known size and allocates its conten
LL | b: Box<str>,
| ++++ +
error[E0740]: field must implement `Copy` or be wrapped in `ManuallyDrop<...>` to be used in a union
--> $DIR/union-unsized.rs:11:5
|
LL | b: str,
| ^^^^^^
|
= note: union fields must not have drop side-effects, which is currently enforced via either `Copy` or `ManuallyDrop<...>`
help: wrap the field type in `ManuallyDrop<...>`
|
LL | b: std::mem::ManuallyDrop<str>,
| +++++++++++++++++++++++ +
error: aborting due to 4 previous errors
Some errors have detailed explanations: E0277, E0740.

View File

@@ -1,3 +1,12 @@
error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/unsized-trait-impl-self-type.rs:10:1
|
LL | fn foo(&self, z: &Z);
| --------------------- `foo` from trait
...
LL | impl<X: ?Sized> T3<X> for S5<X> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized-trait-impl-self-type.rs:10:27
|
@@ -24,15 +33,6 @@ LL - impl<X: ?Sized> T3<X> for S5<X> {
LL + impl<X> T3<X> for S5<X> {
|
error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/unsized-trait-impl-self-type.rs:10:1
|
LL | fn foo(&self, z: &Z);
| --------------------- `foo` from trait
...
LL | impl<X: ?Sized> T3<X> for S5<X> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0046, E0277.

View File

@@ -1,3 +1,12 @@
error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/unsized-trait-impl-trait-arg.rs:8:1
|
LL | fn foo(&self, z: Z);
| -------------------- `foo` from trait
...
LL | impl<X: ?Sized> T2<X> for S4<X> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized-trait-impl-trait-arg.rs:8:17
|
@@ -21,15 +30,6 @@ help: consider relaxing the implicit `Sized` restriction
LL | trait T2<Z: ?Sized> {
| ++++++++
error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/unsized-trait-impl-trait-arg.rs:8:1
|
LL | fn foo(&self, z: Z);
| -------------------- `foo` from trait
...
LL | impl<X: ?Sized> T2<X> for S4<X> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `foo` in implementation
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0046, E0277.

View File

@@ -1,3 +1,12 @@
error[E0046]: not all trait items implemented, missing: `dummy`
--> $DIR/unsized7.rs:12:1
|
LL | fn dummy(&self) -> Z;
| --------------------- `dummy` from trait
...
LL | impl<X: ?Sized + T> T1<X> for S3<X> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `dummy` in implementation
error[E0277]: the size for values of type `X` cannot be known at compilation time
--> $DIR/unsized7.rs:12:21
|
@@ -21,15 +30,6 @@ help: consider relaxing the implicit `Sized` restriction
LL | trait T1<Z: T + ?Sized> {
| ++++++++
error[E0046]: not all trait items implemented, missing: `dummy`
--> $DIR/unsized7.rs:12:1
|
LL | fn dummy(&self) -> Z;
| --------------------- `dummy` from trait
...
LL | impl<X: ?Sized + T> T1<X> for S3<X> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `dummy` in implementation
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0046, E0277.

View File

@@ -32,7 +32,7 @@ LL | trait Trait<const N: dyn Trait = bar> {
| ^^^^^
|
= note: ...which immediately requires computing type of `Trait::N` again
note: cycle used when computing explicit predicates of trait `Trait`
note: cycle used when checking that `Trait` is well-formed
--> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:1
|
LL | trait Trait<const N: dyn Trait = bar> {

View File

@@ -37,7 +37,7 @@ note: ...which requires computing type of `Bar::M`...
LL | trait Bar<const M: Foo<2>> {}
| ^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `Foo::N`, completing the cycle
note: cycle used when computing explicit predicates of trait `Foo`
note: cycle used when checking that `Foo` is well-formed
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1
|
LL | trait Foo<const N: Bar<2>> {
@@ -56,7 +56,7 @@ note: ...which requires computing type of `Bar::M`...
LL | trait Bar<const M: Foo<2>> {}
| ^^^^^^^^^^^^^^^
= note: ...which again requires computing type of `Foo::N`, completing the cycle
note: cycle used when computing explicit predicates of trait `Foo`
note: cycle used when checking that `Foo` is well-formed
--> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:2:1
|
LL | trait Foo<const N: Bar<2>> {