Be better at reporting alias errors
This commit is contained in:
parent
fd2038d344
commit
8528387743
@ -983,7 +983,7 @@ pub(super) fn add_item_bounds_for_hidden_type(
|
|||||||
hidden_ty,
|
hidden_ty,
|
||||||
&mut goals,
|
&mut goals,
|
||||||
);
|
);
|
||||||
self.add_goals(GoalSource::Misc, goals);
|
self.add_goals(GoalSource::AliasWellFormed, goals);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do something for each opaque/hidden pair defined with `def_id` in the
|
// Do something for each opaque/hidden pair defined with `def_id` in the
|
||||||
|
@ -37,10 +37,12 @@ pub(super) fn compute_normalizes_to_goal(
|
|||||||
match normalize_result {
|
match normalize_result {
|
||||||
Ok(res) => Ok(res),
|
Ok(res) => Ok(res),
|
||||||
Err(NoSolution) => {
|
Err(NoSolution) => {
|
||||||
|
self.probe(|&result| ProbeKind::RigidAlias { result }).enter(|this| {
|
||||||
let Goal { param_env, predicate: NormalizesTo { alias, term } } = goal;
|
let Goal { param_env, predicate: NormalizesTo { alias, term } } = goal;
|
||||||
self.relate_rigid_alias_non_alias(param_env, alias, ty::Invariant, term)?;
|
this.add_rigid_constraints(param_env, alias)?;
|
||||||
self.add_rigid_constraints(param_env, alias)?;
|
this.relate_rigid_alias_non_alias(param_env, alias, ty::Invariant, term)?;
|
||||||
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
this.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,11 +61,13 @@ fn add_rigid_constraints(
|
|||||||
param_env: I::ParamEnv,
|
param_env: I::ParamEnv,
|
||||||
rigid_alias: ty::AliasTerm<I>,
|
rigid_alias: ty::AliasTerm<I>,
|
||||||
) -> Result<(), NoSolution> {
|
) -> Result<(), NoSolution> {
|
||||||
match rigid_alias.kind(self.cx()) {
|
let cx = self.cx();
|
||||||
// Projections are rigid only if their trait ref holds.
|
match rigid_alias.kind(cx) {
|
||||||
|
// Projections are rigid only if their trait ref holds,
|
||||||
|
// and the GAT where-clauses hold.
|
||||||
ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => {
|
ty::AliasTermKind::ProjectionTy | ty::AliasTermKind::ProjectionConst => {
|
||||||
let trait_ref = rigid_alias.trait_ref(self.cx());
|
let trait_ref = rigid_alias.trait_ref(cx);
|
||||||
self.add_goal(GoalSource::Misc, Goal::new(self.cx(), param_env, trait_ref));
|
self.add_goal(GoalSource::AliasWellFormed, Goal::new(cx, param_env, trait_ref));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
ty::AliasTermKind::OpaqueTy => {
|
ty::AliasTermKind::OpaqueTy => {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||||
use rustc_middle::ty::{self, TyCtxt};
|
use rustc_middle::ty::{self, TyCtxt};
|
||||||
use rustc_next_trait_solver::solve::{GenerateProofTree, HasChanged, SolverDelegateEvalExt as _};
|
use rustc_next_trait_solver::solve::{GenerateProofTree, HasChanged, SolverDelegateEvalExt as _};
|
||||||
use tracing::instrument;
|
use tracing::{instrument, trace};
|
||||||
|
|
||||||
use super::Certainty;
|
use super::Certainty;
|
||||||
use super::delegate::SolverDelegate;
|
use super::delegate::SolverDelegate;
|
||||||
@ -402,6 +402,7 @@ fn non_trivial_candidates<'a>(
|
|||||||
nested_goal.source(),
|
nested_goal.source(),
|
||||||
GoalSource::ImplWhereBound
|
GoalSource::ImplWhereBound
|
||||||
| GoalSource::InstantiateHigherRanked
|
| GoalSource::InstantiateHigherRanked
|
||||||
|
| GoalSource::AliasWellFormed
|
||||||
) && match self.consider_ambiguities {
|
) && match self.consider_ambiguities {
|
||||||
true => {
|
true => {
|
||||||
matches!(
|
matches!(
|
||||||
@ -416,6 +417,13 @@ fn non_trivial_candidates<'a>(
|
|||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prefer a non-rigid candidate if there is one.
|
||||||
|
if candidates.len() > 1 {
|
||||||
|
candidates.retain(|candidate| {
|
||||||
|
!matches!(candidate.kind(), inspect::ProbeKind::RigidAlias { .. })
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,8 +438,11 @@ fn span(&self) -> rustc_span::Span {
|
|||||||
self.obligation.cause.span
|
self.obligation.cause.span
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "trace", skip(self, goal), fields(goal = ?goal.goal()))]
|
||||||
fn visit_goal(&mut self, goal: &inspect::InspectGoal<'_, 'tcx>) -> Self::Result {
|
fn visit_goal(&mut self, goal: &inspect::InspectGoal<'_, 'tcx>) -> Self::Result {
|
||||||
let candidates = self.non_trivial_candidates(goal);
|
let candidates = self.non_trivial_candidates(goal);
|
||||||
|
trace!(candidates = ?candidates.iter().map(|c| c.kind()).collect::<Vec<_>>());
|
||||||
|
|
||||||
let [candidate] = candidates.as_slice() else {
|
let [candidate] = candidates.as_slice() else {
|
||||||
return ControlFlow::Break(self.obligation.clone());
|
return ControlFlow::Break(self.obligation.clone());
|
||||||
};
|
};
|
||||||
@ -470,6 +481,8 @@ fn visit_goal(&mut self, goal: &inspect::InspectGoal<'_, 'tcx>) -> Self::Result
|
|||||||
|
|
||||||
let mut impl_where_bound_count = 0;
|
let mut impl_where_bound_count = 0;
|
||||||
for nested_goal in candidate.instantiate_nested_goals(self.span()) {
|
for nested_goal in candidate.instantiate_nested_goals(self.span()) {
|
||||||
|
trace!(nested_goal = ?(nested_goal.goal(), nested_goal.source(), nested_goal.result()));
|
||||||
|
|
||||||
let make_obligation = |cause| Obligation {
|
let make_obligation = |cause| Obligation {
|
||||||
cause,
|
cause,
|
||||||
param_env: nested_goal.goal().param_env,
|
param_env: nested_goal.goal().param_env,
|
||||||
@ -496,7 +509,7 @@ fn visit_goal(&mut self, goal: &inspect::InspectGoal<'_, 'tcx>) -> Self::Result
|
|||||||
(_, GoalSource::InstantiateHigherRanked) => {
|
(_, GoalSource::InstantiateHigherRanked) => {
|
||||||
obligation = self.obligation.clone();
|
obligation = self.obligation.clone();
|
||||||
}
|
}
|
||||||
(ChildMode::PassThrough, _) => {
|
(ChildMode::PassThrough, _) | (_, GoalSource::AliasWellFormed) => {
|
||||||
obligation = make_obligation(self.obligation.cause.clone());
|
obligation = make_obligation(self.obligation.cause.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,8 @@ fn candidates_recur(
|
|||||||
| inspect::ProbeKind::Root { .. }
|
| inspect::ProbeKind::Root { .. }
|
||||||
| inspect::ProbeKind::TryNormalizeNonRigid { .. }
|
| inspect::ProbeKind::TryNormalizeNonRigid { .. }
|
||||||
| inspect::ProbeKind::TraitCandidate { .. }
|
| inspect::ProbeKind::TraitCandidate { .. }
|
||||||
| inspect::ProbeKind::OpaqueTypeStorageLookup { .. } => {
|
| inspect::ProbeKind::OpaqueTypeStorageLookup { .. }
|
||||||
|
| inspect::ProbeKind::RigidAlias { .. } => {
|
||||||
// Nested probes have to prove goals added in their parent
|
// Nested probes have to prove goals added in their parent
|
||||||
// but do not leak them, so we truncate the added goals
|
// but do not leak them, so we truncate the added goals
|
||||||
// afterwards.
|
// afterwards.
|
||||||
@ -316,7 +317,8 @@ fn candidates_recur(
|
|||||||
inspect::ProbeKind::Root { result }
|
inspect::ProbeKind::Root { result }
|
||||||
| inspect::ProbeKind::TryNormalizeNonRigid { result }
|
| inspect::ProbeKind::TryNormalizeNonRigid { result }
|
||||||
| inspect::ProbeKind::TraitCandidate { source: _, result }
|
| inspect::ProbeKind::TraitCandidate { source: _, result }
|
||||||
| inspect::ProbeKind::OpaqueTypeStorageLookup { result } => {
|
| inspect::ProbeKind::OpaqueTypeStorageLookup { result }
|
||||||
|
| inspect::ProbeKind::RigidAlias { result } => {
|
||||||
// We only add a candidate if `shallow_certainty` was set, which means
|
// We only add a candidate if `shallow_certainty` was set, which means
|
||||||
// that we ended up calling `evaluate_added_goals_and_make_canonical_response`.
|
// that we ended up calling `evaluate_added_goals_and_make_canonical_response`.
|
||||||
if let Some(shallow_certainty) = shallow_certainty {
|
if let Some(shallow_certainty) = shallow_certainty {
|
||||||
|
@ -177,7 +177,8 @@ fn to_selection<'tcx>(
|
|||||||
| ProbeKind::UpcastProjectionCompatibility
|
| ProbeKind::UpcastProjectionCompatibility
|
||||||
| ProbeKind::OpaqueTypeStorageLookup { result: _ }
|
| ProbeKind::OpaqueTypeStorageLookup { result: _ }
|
||||||
| ProbeKind::Root { result: _ }
|
| ProbeKind::Root { result: _ }
|
||||||
| ProbeKind::ShadowedEnvProbing => {
|
| ProbeKind::ShadowedEnvProbing
|
||||||
|
| ProbeKind::RigidAlias { result: _ } => {
|
||||||
span_bug!(span, "didn't expect to assemble trait candidate from {:#?}", cand.kind())
|
span_bug!(span, "didn't expect to assemble trait candidate from {:#?}", cand.kind())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -135,4 +135,6 @@ pub enum ProbeKind<I: Interner> {
|
|||||||
ShadowedEnvProbing,
|
ShadowedEnvProbing,
|
||||||
/// Try to unify an opaque type with an existing key in the storage.
|
/// Try to unify an opaque type with an existing key in the storage.
|
||||||
OpaqueTypeStorageLookup { result: QueryResult<I> },
|
OpaqueTypeStorageLookup { result: QueryResult<I> },
|
||||||
|
/// Checking that a rigid alias is well-formed.
|
||||||
|
RigidAlias { result: QueryResult<I> },
|
||||||
}
|
}
|
||||||
|
@ -130,6 +130,10 @@ pub enum GoalSource {
|
|||||||
ImplWhereBound,
|
ImplWhereBound,
|
||||||
/// Instantiating a higher-ranked goal and re-proving it.
|
/// Instantiating a higher-ranked goal and re-proving it.
|
||||||
InstantiateHigherRanked,
|
InstantiateHigherRanked,
|
||||||
|
/// Predicate required for an alias projection to be well-formed.
|
||||||
|
/// This is used in two places: projecting to an opaque whose hidden type
|
||||||
|
/// is already registered in the opaque type storage, and for rigid projections.
|
||||||
|
AliasWellFormed,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive_where(Clone; I: Interner, Goal<I, P>: Clone)]
|
#[derive_where(Clone; I: Interner, Goal<I, P>: Clone)]
|
||||||
|
@ -31,18 +31,6 @@ help: consider further restricting `Self`
|
|||||||
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
||||||
| +++++++++++++++++++++++++
|
| +++++++++++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<Self as Deref>::Target normalizes-to <Self as Deref>::Target`
|
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:31
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
||||||
|
|
|
|
||||||
@ -50,10 +38,10 @@ LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + Fro
|
|||||||
| ^^^^ the trait `Deref` is not implemented for `Self`
|
| ^^^^ the trait `Deref` is not implemented for `Self`
|
||||||
|
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
note: required by a bound in `UncheckedCopy::Output`
|
||||||
--> $DIR/defaults-unsound-62211-1.rs:24:25
|
--> $DIR/defaults-unsound-62211-1.rs:24:31
|
||||||
|
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
||||||
help: consider further restricting `Self`
|
help: consider further restricting `Self`
|
||||||
|
|
|
|
||||||
LL | trait UncheckedCopy: Sized + Deref {
|
LL | trait UncheckedCopy: Sized + Deref {
|
||||||
@ -75,7 +63,6 @@ help: consider further restricting `Self`
|
|||||||
LL | trait UncheckedCopy: Sized + Copy {
|
LL | trait UncheckedCopy: Sized + Copy {
|
||||||
| ++++++
|
| ++++++
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -31,18 +31,6 @@ help: consider further restricting `Self`
|
|||||||
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
LL | trait UncheckedCopy: Sized + AddAssign<&'static str> {
|
||||||
| +++++++++++++++++++++++++
|
| +++++++++++++++++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<Self as Deref>::Target normalizes-to <Self as Deref>::Target`
|
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:31
|
|
||||||
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
|
||||||
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
error[E0277]: the trait bound `Self: Deref` is not satisfied
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
||||||
|
|
|
|
||||||
@ -50,10 +38,10 @@ LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + Fro
|
|||||||
| ^^^^ the trait `Deref` is not implemented for `Self`
|
| ^^^^ the trait `Deref` is not implemented for `Self`
|
||||||
|
|
|
|
||||||
note: required by a bound in `UncheckedCopy::Output`
|
note: required by a bound in `UncheckedCopy::Output`
|
||||||
--> $DIR/defaults-unsound-62211-2.rs:24:25
|
--> $DIR/defaults-unsound-62211-2.rs:24:31
|
||||||
|
|
|
|
||||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
| ^^^^^^^^^^^^ required by this bound in `UncheckedCopy::Output`
|
||||||
help: consider further restricting `Self`
|
help: consider further restricting `Self`
|
||||||
|
|
|
|
||||||
LL | trait UncheckedCopy: Sized + Deref {
|
LL | trait UncheckedCopy: Sized + Deref {
|
||||||
@ -75,7 +63,6 @@ help: consider further restricting `Self`
|
|||||||
LL | trait UncheckedCopy: Sized + Copy {
|
LL | trait UncheckedCopy: Sized + Copy {
|
||||||
| ++++++
|
| ++++++
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -1,15 +1,3 @@
|
|||||||
error[E0271]: type mismatch resolving `<<T as SubEncoder>::ActualSize as Add>::Output normalizes-to <<T as SubEncoder>::ActualSize as Add>::Output`
|
|
||||||
--> $DIR/issue-54108.rs:23:17
|
|
||||||
|
|
|
||||||
LL | type Size = <Self as SubEncoder>::ActualSize;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `Encoder::Size`
|
|
||||||
--> $DIR/issue-54108.rs:8:20
|
|
||||||
|
|
|
||||||
LL | type Size: Add<Output = Self::Size>;
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
|
|
||||||
|
|
||||||
error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize`
|
error[E0277]: cannot add `<T as SubEncoder>::ActualSize` to `<T as SubEncoder>::ActualSize`
|
||||||
--> $DIR/issue-54108.rs:23:17
|
--> $DIR/issue-54108.rs:23:17
|
||||||
|
|
|
|
||||||
@ -18,16 +6,15 @@ LL | type Size = <Self as SubEncoder>::ActualSize;
|
|||||||
|
|
|
|
||||||
= help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize`
|
= help: the trait `Add` is not implemented for `<T as SubEncoder>::ActualSize`
|
||||||
note: required by a bound in `Encoder::Size`
|
note: required by a bound in `Encoder::Size`
|
||||||
--> $DIR/issue-54108.rs:8:16
|
--> $DIR/issue-54108.rs:8:20
|
||||||
|
|
|
|
||||||
LL | type Size: Add<Output = Self::Size>;
|
LL | type Size: Add<Output = Self::Size>;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
|
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `Encoder::Size`
|
||||||
help: consider further restricting the associated type
|
help: consider further restricting the associated type
|
||||||
|
|
|
|
||||||
LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add
|
LL | T: SubEncoder, <T as SubEncoder>::ActualSize: Add
|
||||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -4,12 +4,7 @@
|
|||||||
|
|
||||||
fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) {
|
fn changer<'a>(mut things: Box<dyn Iterator<Item=&'a mut u8>>) {
|
||||||
for item in *things { *item = 0 }
|
for item in *things { *item = 0 }
|
||||||
//[current]~^ ERROR `dyn Iterator<Item = &'a mut u8>` is not an iterator
|
//~^ ERROR `dyn Iterator<Item = &'a mut u8>` is not an iterator
|
||||||
//[next]~^^ ERROR `dyn Iterator<Item = &'a mut u8>` is not an iterator
|
|
||||||
//[next]~| ERROR type `<dyn Iterator<Item = &'a mut u8> as IntoIterator>::Item` cannot be dereferenced
|
|
||||||
|
|
||||||
// FIXME(-Znext-solver): these error messages are horrible and have to be
|
|
||||||
// improved before we stabilize the new solver.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0283]: type annotations needed
|
error[E0283]: type annotations needed
|
||||||
--> $DIR/ambig-hr-projection-issue-93340.rs:16:5
|
--> $DIR/ambig-hr-projection-issue-93340.rs:17:5
|
||||||
|
|
|
|
||||||
LL | cmp_eq
|
LL | cmp_eq
|
||||||
| ^^^^^^ cannot infer type of the type parameter `A` declared on the function `cmp_eq`
|
| ^^^^^^ cannot infer type of the type parameter `A` declared on the function `cmp_eq`
|
||||||
@ -15,14 +15,16 @@ help: consider specifying the generic arguments
|
|||||||
LL | cmp_eq::<A, B, O>
|
LL | cmp_eq::<A, B, O>
|
||||||
| +++++++++++
|
| +++++++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `build_expression<A, B, O>::{opaque#0} normalizes-to _`
|
error[E0277]: expected a `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure, found `for<'a, 'b> fn(<O as Scalar>::RefType<'a>, <_ as Scalar>::RefType<'b>) -> O {cmp_eq::<O, _, O>}`
|
||||||
--> $DIR/ambig-hr-projection-issue-93340.rs:14:1
|
--> $DIR/ambig-hr-projection-issue-93340.rs:14:1
|
||||||
|
|
|
|
||||||
LL | / fn build_expression<A: Scalar, B: Scalar, O: Scalar>(
|
LL | / fn build_expression<A: Scalar, B: Scalar, O: Scalar>(
|
||||||
LL | | ) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O {
|
LL | | ) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O {
|
||||||
| |_________________________________________________^ types differ
|
| |_________________________________________________^ expected an `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure, found `for<'a, 'b> fn(<O as Scalar>::RefType<'a>, <_ as Scalar>::RefType<'b>) -> O {cmp_eq::<O, _, O>}`
|
||||||
|
|
|
||||||
|
= help: the trait `for<'a, 'b> Fn(<A as Scalar>::RefType<'a>, <B as Scalar>::RefType<'b>)` is not implemented for fn item `for<'a, 'b> fn(<O as Scalar>::RefType<'a>, <_ as Scalar>::RefType<'b>) -> O {cmp_eq::<O, _, O>}`
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0283.
|
Some errors have detailed explanations: E0277, E0283.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0283]: type annotations needed
|
error[E0283]: type annotations needed
|
||||||
--> $DIR/ambig-hr-projection-issue-93340.rs:16:5
|
--> $DIR/ambig-hr-projection-issue-93340.rs:17:5
|
||||||
|
|
|
|
||||||
LL | cmp_eq
|
LL | cmp_eq
|
||||||
| ^^^^^^ cannot infer type of the type parameter `A` declared on the function `cmp_eq`
|
| ^^^^^^ cannot infer type of the type parameter `A` declared on the function `cmp_eq`
|
||||||
|
@ -13,6 +13,7 @@ fn cmp_eq<'a, 'b, A: Scalar, B: Scalar, O: Scalar>(a: A::RefType<'a>, b: B::RefT
|
|||||||
|
|
||||||
fn build_expression<A: Scalar, B: Scalar, O: Scalar>(
|
fn build_expression<A: Scalar, B: Scalar, O: Scalar>(
|
||||||
) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O {
|
) -> impl Fn(A::RefType<'_>, B::RefType<'_>) -> O {
|
||||||
|
//[next]~^^ expected a `Fn(<A as Scalar>::RefType<'_>, <B as Scalar>::RefType<'_>)` closure
|
||||||
cmp_eq
|
cmp_eq
|
||||||
//~^ ERROR type annotations needed
|
//~^ ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ trait Foo {}
|
|||||||
// `usize: Foo` doesn't hold. Therefore we ICE, because we don't expect to still
|
// `usize: Foo` doesn't hold. Therefore we ICE, because we don't expect to still
|
||||||
// encounter weak types in `assemble_alias_bound_candidates_recur`.
|
// encounter weak types in `assemble_alias_bound_candidates_recur`.
|
||||||
fn hello(_: W<A<usize>>) {}
|
fn hello(_: W<A<usize>>) {}
|
||||||
//~^ ERROR the size for values of type `A<usize>` cannot be known at compilation time
|
//~^ ERROR the trait bound `usize: Foo` is not satisfied
|
||||||
|
//~| ERROR the trait bound `usize: Foo` is not satisfied
|
||||||
|
//~| ERROR the trait bound `usize: Foo` is not satisfied
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -7,32 +7,42 @@ LL | #![feature(lazy_type_alias)]
|
|||||||
= note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
|
= note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
|
||||||
= note: `#[warn(incomplete_features)]` on by default
|
= note: `#[warn(incomplete_features)]` on by default
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `A<usize> normalizes-to _`
|
error[E0277]: the trait bound `usize: Foo` is not satisfied
|
||||||
--> $DIR/alias-bounds-when-not-wf.rs:16:13
|
--> $DIR/alias-bounds-when-not-wf.rs:16:13
|
||||||
|
|
|
|
||||||
LL | fn hello(_: W<A<usize>>) {}
|
LL | fn hello(_: W<A<usize>>) {}
|
||||||
| ^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^ the trait `Foo` is not implemented for `usize`
|
||||||
|
|
|
||||||
|
help: this trait has no implementations, consider adding one
|
||||||
|
--> $DIR/alias-bounds-when-not-wf.rs:6:1
|
||||||
|
|
|
||||||
|
LL | trait Foo {}
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `A<usize> normalizes-to _`
|
error[E0277]: the trait bound `usize: Foo` is not satisfied
|
||||||
--> $DIR/alias-bounds-when-not-wf.rs:16:10
|
--> $DIR/alias-bounds-when-not-wf.rs:16:10
|
||||||
|
|
|
|
||||||
LL | fn hello(_: W<A<usize>>) {}
|
LL | fn hello(_: W<A<usize>>) {}
|
||||||
| ^ types differ
|
| ^ the trait `Foo` is not implemented for `usize`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `A<usize> normalizes-to _`
|
|
||||||
--> $DIR/alias-bounds-when-not-wf.rs:16:10
|
|
||||||
|
|
|
|
||||||
LL | fn hello(_: W<A<usize>>) {}
|
help: this trait has no implementations, consider adding one
|
||||||
| ^ types differ
|
--> $DIR/alias-bounds-when-not-wf.rs:6:1
|
||||||
|
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
LL | trait Foo {}
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `A<usize> normalizes-to _`
|
error[E0277]: the trait bound `usize: Foo` is not satisfied
|
||||||
--> $DIR/alias-bounds-when-not-wf.rs:16:1
|
--> $DIR/alias-bounds-when-not-wf.rs:16:1
|
||||||
|
|
|
|
||||||
LL | fn hello(_: W<A<usize>>) {}
|
LL | fn hello(_: W<A<usize>>) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `usize`
|
||||||
|
|
|
||||||
|
help: this trait has no implementations, consider adding one
|
||||||
|
--> $DIR/alias-bounds-when-not-wf.rs:6:1
|
||||||
|
|
|
||||||
|
LL | trait Foo {}
|
||||||
|
| ^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 4 previous errors; 1 warning emitted
|
error: aborting due to 3 previous errors; 1 warning emitted
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0271`.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
@ -1,15 +1,9 @@
|
|||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/method-resolution4.rs:13:9
|
--> $DIR/method-resolution4.rs:14:9
|
||||||
|
|
|
|
||||||
LL | foo(false).next().unwrap();
|
LL | foo(false).next().unwrap();
|
||||||
| ^^^^^^^^^^ cannot infer type
|
| ^^^^^^^^^^ cannot infer type
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
|
||||||
--> $DIR/method-resolution4.rs:13:9
|
|
||||||
|
|
|
||||||
LL | foo(false).next().unwrap();
|
|
||||||
| ^^^^^^^^^^ types differ
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl Iterator<Item = ()>` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl Iterator<Item = ()>` cannot be known at compilation time
|
||||||
--> $DIR/method-resolution4.rs:11:20
|
--> $DIR/method-resolution4.rs:11:20
|
||||||
|
|
|
|
||||||
@ -19,14 +13,8 @@ LL | fn foo(b: bool) -> impl Iterator<Item = ()> {
|
|||||||
= help: the trait `Sized` is not implemented for `impl Iterator<Item = ()>`
|
= help: the trait `Sized` is not implemented for `impl Iterator<Item = ()>`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
|
||||||
--> $DIR/method-resolution4.rs:16:5
|
|
||||||
|
|
|
||||||
LL | std::iter::empty()
|
|
||||||
| ^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl Iterator<Item = ()>` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl Iterator<Item = ()>` cannot be known at compilation time
|
||||||
--> $DIR/method-resolution4.rs:13:9
|
--> $DIR/method-resolution4.rs:14:9
|
||||||
|
|
|
|
||||||
LL | foo(false).next().unwrap();
|
LL | foo(false).next().unwrap();
|
||||||
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
@ -34,21 +22,7 @@ LL | foo(false).next().unwrap();
|
|||||||
= help: the trait `Sized` is not implemented for `impl Iterator<Item = ()>`
|
= help: the trait `Sized` is not implemented for `impl Iterator<Item = ()>`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
error: aborting due to 3 previous errors
|
||||||
--> $DIR/method-resolution4.rs:13:9
|
|
||||||
|
|
|
||||||
LL | foo(false).next().unwrap();
|
|
||||||
| ^^^^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
Some errors have detailed explanations: E0277, E0282.
|
||||||
--> $DIR/method-resolution4.rs:11:1
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|
|
||||||
LL | fn foo(b: bool) -> impl Iterator<Item = ()> {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
||||||
error: aborting due to 7 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277, E0282.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -9,12 +9,13 @@
|
|||||||
//@[current] check-pass
|
//@[current] check-pass
|
||||||
|
|
||||||
fn foo(b: bool) -> impl Iterator<Item = ()> {
|
fn foo(b: bool) -> impl Iterator<Item = ()> {
|
||||||
|
//[next]~^ ERROR the size for values of type `impl Iterator<Item = ()>` cannot be known at compilation time
|
||||||
if b {
|
if b {
|
||||||
foo(false).next().unwrap();
|
foo(false).next().unwrap();
|
||||||
//[next]~^ type annotations needed
|
//[next]~^ type annotations needed
|
||||||
|
//[next]~| ERROR the size for values of type `impl Iterator<Item = ()>` cannot be known at compilation time
|
||||||
}
|
}
|
||||||
std::iter::empty()
|
std::iter::empty()
|
||||||
//[next]~^ mismatched types
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:15:23
|
--> $DIR/recursive-coroutine-boxed.rs:16:23
|
||||||
|
|
|
|
||||||
LL | let mut gen = Box::pin(foo());
|
LL | let mut gen = Box::pin(foo());
|
||||||
| ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Box`
|
| ^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `Box`
|
||||||
LL |
|
...
|
||||||
LL | let mut r = gen.as_mut().resume(());
|
LL | let mut r = gen.as_mut().resume(());
|
||||||
| ------ type must be known at this point
|
| ------ type must be known at this point
|
||||||
|
|
|
|
||||||
@ -12,25 +12,6 @@ help: consider specifying the generic argument
|
|||||||
LL | let mut gen = Box::<T>::pin(foo());
|
LL | let mut gen = Box::<T>::pin(foo());
|
||||||
| +++++
|
| +++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:14:18
|
|
||||||
|
|
|
||||||
LL | #[coroutine] || {
|
|
||||||
| __________________^
|
|
||||||
LL | | let mut gen = Box::pin(foo());
|
|
||||||
LL | |
|
|
||||||
LL | | let mut r = gen.as_mut().resume(());
|
|
||||||
... |
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^ types differ
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:15:32
|
|
||||||
|
|
|
||||||
LL | let mut gen = Box::pin(foo());
|
|
||||||
| ^^^^^ types differ
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl Coroutine<Yield = (), Return = ()>` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl Coroutine<Yield = (), Return = ()>` cannot be known at compilation time
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:9:13
|
--> $DIR/recursive-coroutine-boxed.rs:9:13
|
||||||
|
|
|
|
||||||
@ -40,23 +21,8 @@ LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
|||||||
= help: the trait `Sized` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
|
= help: the trait `Sized` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:14:18
|
|
||||||
|
|
|
||||||
LL | #[coroutine] || {
|
|
||||||
| __________________^
|
|
||||||
LL | | let mut gen = Box::pin(foo());
|
|
||||||
LL | |
|
|
||||||
LL | | let mut r = gen.as_mut().resume(());
|
|
||||||
... |
|
|
||||||
LL | | }
|
|
||||||
LL | | }
|
|
||||||
| |_____^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl Coroutine<Yield = (), Return = ()>` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl Coroutine<Yield = (), Return = ()>` cannot be known at compilation time
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:15:32
|
--> $DIR/recursive-coroutine-boxed.rs:16:32
|
||||||
|
|
|
|
||||||
LL | let mut gen = Box::pin(foo());
|
LL | let mut gen = Box::pin(foo());
|
||||||
| ^^^^^ doesn't have a size known at compile-time
|
| ^^^^^ doesn't have a size known at compile-time
|
||||||
@ -64,21 +30,7 @@ LL | let mut gen = Box::pin(foo());
|
|||||||
= help: the trait `Sized` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
|
= help: the trait `Sized` is not implemented for `impl Coroutine<Yield = (), Return = ()>`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
error: aborting due to 3 previous errors
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:15:32
|
|
||||||
|
|
|
||||||
LL | let mut gen = Box::pin(foo());
|
|
||||||
| ^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `foo::{opaque#0} normalizes-to _`
|
Some errors have detailed explanations: E0277, E0282.
|
||||||
--> $DIR/recursive-coroutine-boxed.rs:9:1
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|
|
||||||
LL | fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277, E0282.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -7,13 +7,15 @@
|
|||||||
use std::ops::{Coroutine, CoroutineState};
|
use std::ops::{Coroutine, CoroutineState};
|
||||||
|
|
||||||
fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
||||||
|
//[next]~^ ERROR the size for values of type `impl Coroutine<Yield = (), Return = ()>` cannot be known at compilation time
|
||||||
|
|
||||||
// FIXME(-Znext-solver): this fails with a mismatched types as the
|
// FIXME(-Znext-solver): this fails with a mismatched types as the
|
||||||
// hidden type of the opaque ends up as {type error}. We should not
|
// hidden type of the opaque ends up as {type error}. We should not
|
||||||
// emit errors for such goals.
|
// emit errors for such goals.
|
||||||
|
#[coroutine] || {
|
||||||
#[coroutine] || { //[next]~ ERROR mismatched types
|
|
||||||
let mut gen = Box::pin(foo());
|
let mut gen = Box::pin(foo());
|
||||||
//[next]~^ ERROR type annotations needed
|
//[next]~^ ERROR type annotations needed
|
||||||
|
//[next]~| ERROR the size for values of type `impl Coroutine<Yield = (), Return = ()>` cannot be known at compilation time
|
||||||
let mut r = gen.as_mut().resume(());
|
let mut r = gen.as_mut().resume(());
|
||||||
while let CoroutineState::Yielded(v) = r {
|
while let CoroutineState::Yielded(v) = r {
|
||||||
yield v;
|
yield v;
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
error[E0271]: type mismatch resolving `hello::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||||
--> $DIR/unsized_coercion.rs:14:17
|
--> $DIR/unsized_coercion.rs:15:17
|
||||||
|
|
|
|
||||||
LL | let x = hello();
|
LL | let x = hello();
|
||||||
| ^^^^^^^ types differ
|
| ^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait `Sized` is not implemented for `dyn Trait`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/unsized_coercion.rs:18:5
|
--> $DIR/unsized_coercion.rs:19:5
|
||||||
|
|
|
|
||||||
LL | fn hello() -> Box<impl Trait> {
|
LL | fn hello() -> Box<impl Trait> {
|
||||||
| ---------------
|
| ---------------
|
||||||
@ -19,21 +21,15 @@ LL | Box::new(1u32)
|
|||||||
= note: expected struct `Box<impl Trait>`
|
= note: expected struct `Box<impl Trait>`
|
||||||
found struct `Box<u32>`
|
found struct `Box<u32>`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `hello::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||||
--> $DIR/unsized_coercion.rs:14:17
|
|
||||||
|
|
|
||||||
LL | let x = hello();
|
|
||||||
| ^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `hello::{opaque#0} normalizes-to _`
|
|
||||||
--> $DIR/unsized_coercion.rs:12:1
|
--> $DIR/unsized_coercion.rs:12:1
|
||||||
|
|
|
|
||||||
LL | fn hello() -> Box<impl Trait> {
|
LL | fn hello() -> Box<impl Trait> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait `Sized` is not implemented for `dyn Trait`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0308.
|
Some errors have detailed explanations: E0277, E0308.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
@ -10,9 +10,10 @@ trait Trait {}
|
|||||||
impl Trait for u32 {}
|
impl Trait for u32 {}
|
||||||
|
|
||||||
fn hello() -> Box<impl Trait> {
|
fn hello() -> Box<impl Trait> {
|
||||||
|
//[next]~^ ERROR the size for values of type `dyn Trait` cannot be known at compilation time
|
||||||
if true {
|
if true {
|
||||||
let x = hello();
|
let x = hello();
|
||||||
//[next]~^ ERROR: type mismatch resolving `impl Trait <: dyn Trait`
|
//[next]~^ ERROR: the size for values of type `dyn Trait` cannot be known at compilation time
|
||||||
let y: Box<dyn Trait> = x;
|
let y: Box<dyn Trait> = x;
|
||||||
}
|
}
|
||||||
Box::new(1u32) //[next]~ ERROR: mismatched types
|
Box::new(1u32) //[next]~ ERROR: mismatched types
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
error[E0271]: type mismatch resolving `hello::{opaque#0} normalizes-to _`
|
error[E0277]: the trait bound `dyn Send: Trait` is not satisfied
|
||||||
--> $DIR/unsized_coercion3.rs:13:17
|
--> $DIR/unsized_coercion3.rs:14:17
|
||||||
|
|
|
|
||||||
LL | let x = hello();
|
LL | let x = hello();
|
||||||
| ^^^^^^^ types differ
|
| ^^^^^^^ the trait `Trait` is not implemented for `dyn Send`
|
||||||
|
|
|
||||||
|
= help: the trait `Trait` is implemented for `u32`
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/unsized_coercion3.rs:18:5
|
--> $DIR/unsized_coercion3.rs:19:5
|
||||||
|
|
|
|
||||||
LL | fn hello() -> Box<impl Trait + ?Sized> {
|
LL | fn hello() -> Box<impl Trait + ?Sized> {
|
||||||
| ------------------------
|
| ------------------------
|
||||||
@ -19,21 +21,15 @@ LL | Box::new(1u32)
|
|||||||
= note: expected struct `Box<impl Trait + ?Sized>`
|
= note: expected struct `Box<impl Trait + ?Sized>`
|
||||||
found struct `Box<u32>`
|
found struct `Box<u32>`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `hello::{opaque#0} normalizes-to _`
|
error[E0277]: the trait bound `dyn Send: Trait` is not satisfied
|
||||||
--> $DIR/unsized_coercion3.rs:13:17
|
|
||||||
|
|
|
||||||
LL | let x = hello();
|
|
||||||
| ^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `hello::{opaque#0} normalizes-to _`
|
|
||||||
--> $DIR/unsized_coercion3.rs:11:1
|
--> $DIR/unsized_coercion3.rs:11:1
|
||||||
|
|
|
|
||||||
LL | fn hello() -> Box<impl Trait + ?Sized> {
|
LL | fn hello() -> Box<impl Trait + ?Sized> {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `dyn Send`
|
||||||
|
|
|
||||||
|
= help: the trait `Trait` is implemented for `u32`
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0308.
|
Some errors have detailed explanations: E0277, E0308.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl Trait + ?Sized` cannot be known at compilation time
|
||||||
--> $DIR/unsized_coercion3.rs:15:32
|
--> $DIR/unsized_coercion3.rs:16:32
|
||||||
|
|
|
|
||||||
LL | let y: Box<dyn Send> = x;
|
LL | let y: Box<dyn Send> = x;
|
||||||
| ^ doesn't have a size known at compile-time
|
| ^ doesn't have a size known at compile-time
|
||||||
|
@ -9,15 +9,15 @@ trait Trait {}
|
|||||||
impl Trait for u32 {}
|
impl Trait for u32 {}
|
||||||
|
|
||||||
fn hello() -> Box<impl Trait + ?Sized> {
|
fn hello() -> Box<impl Trait + ?Sized> {
|
||||||
|
//[next]~^ ERROR: the trait bound `dyn Send: Trait` is not satisfied
|
||||||
if true {
|
if true {
|
||||||
let x = hello();
|
let x = hello();
|
||||||
//[next]~^ ERROR: type mismatch resolving `impl Trait + ?Sized <: dyn Send`
|
//[next]~^ ERROR: the trait bound `dyn Send: Trait` is not satisfied
|
||||||
let y: Box<dyn Send> = x;
|
let y: Box<dyn Send> = x;
|
||||||
//[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know
|
//[old]~^ ERROR: the size for values of type `impl Trait + ?Sized` cannot be know
|
||||||
}
|
}
|
||||||
Box::new(1u32)
|
Box::new(1u32)
|
||||||
//[next]~^ ERROR: mismatched types
|
//[next]~^ ERROR: mismatched types
|
||||||
//[next]~| ERROR: the size for values of type `impl Trait + ?Sized` cannot be know
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -13,9 +13,17 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn weird0() -> impl Sized + !Sized {}
|
fn weird0() -> impl Sized + !Sized {}
|
||||||
//~^ ERROR type mismatch resolving `impl !Sized + Sized == ()`
|
//~^ ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `impl !Sized + Sized` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
fn weird1() -> impl !Sized + Sized {}
|
fn weird1() -> impl !Sized + Sized {}
|
||||||
//~^ ERROR type mismatch resolving `impl !Sized + Sized == ()`
|
//~^ ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `impl !Sized + Sized` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
fn weird2() -> impl !Sized {}
|
fn weird2() -> impl !Sized {}
|
||||||
//~^ ERROR type mismatch resolving `impl !Sized == ()`
|
//~^ ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
//~| ERROR the size for values of type `impl !Sized` cannot be known at compilation time
|
//~| ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `impl !Sized` cannot be known at compilation time [E0277]
|
||||||
|
//~| ERROR the size for values of type `()` cannot be known at compilation time [E0277]
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
error[E0271]: type mismatch resolving `weird0::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:15:16
|
--> $DIR/opaque-type-unsatisfied-bound.rs:15:16
|
||||||
|
|
|
|
||||||
LL | fn weird0() -> impl Sized + !Sized {}
|
LL | fn weird0() -> impl Sized + !Sized {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird0::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:15:36
|
--> $DIR/opaque-type-unsatisfied-bound.rs:15:36
|
||||||
|
|
|
|
||||||
LL | fn weird0() -> impl Sized + !Sized {}
|
LL | fn weird0() -> impl Sized + !Sized {}
|
||||||
| ^^ types differ
|
| ^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl !Sized + Sized` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl !Sized + Sized` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:15:16
|
--> $DIR/opaque-type-unsatisfied-bound.rs:15:16
|
||||||
@ -19,26 +23,32 @@ LL | fn weird0() -> impl Sized + !Sized {}
|
|||||||
= help: the trait `Sized` is not implemented for `impl !Sized + Sized`
|
= help: the trait `Sized` is not implemented for `impl !Sized + Sized`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird0::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:15:1
|
--> $DIR/opaque-type-unsatisfied-bound.rs:15:1
|
||||||
|
|
|
|
||||||
LL | fn weird0() -> impl Sized + !Sized {}
|
LL | fn weird0() -> impl Sized + !Sized {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird1::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:17:16
|
--> $DIR/opaque-type-unsatisfied-bound.rs:20:16
|
||||||
|
|
|
|
||||||
LL | fn weird1() -> impl !Sized + Sized {}
|
LL | fn weird1() -> impl !Sized + Sized {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird1::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:17:36
|
--> $DIR/opaque-type-unsatisfied-bound.rs:20:36
|
||||||
|
|
|
|
||||||
LL | fn weird1() -> impl !Sized + Sized {}
|
LL | fn weird1() -> impl !Sized + Sized {}
|
||||||
| ^^ types differ
|
| ^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl !Sized + Sized` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl !Sized + Sized` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:17:16
|
--> $DIR/opaque-type-unsatisfied-bound.rs:20:16
|
||||||
|
|
|
|
||||||
LL | fn weird1() -> impl !Sized + Sized {}
|
LL | fn weird1() -> impl !Sized + Sized {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
@ -46,26 +56,32 @@ LL | fn weird1() -> impl !Sized + Sized {}
|
|||||||
= help: the trait `Sized` is not implemented for `impl !Sized + Sized`
|
= help: the trait `Sized` is not implemented for `impl !Sized + Sized`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird1::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:17:1
|
--> $DIR/opaque-type-unsatisfied-bound.rs:20:1
|
||||||
|
|
|
|
||||||
LL | fn weird1() -> impl !Sized + Sized {}
|
LL | fn weird1() -> impl !Sized + Sized {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird2::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:19:16
|
--> $DIR/opaque-type-unsatisfied-bound.rs:25:16
|
||||||
|
|
|
|
||||||
LL | fn weird2() -> impl !Sized {}
|
LL | fn weird2() -> impl !Sized {}
|
||||||
| ^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird2::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:19:28
|
--> $DIR/opaque-type-unsatisfied-bound.rs:25:28
|
||||||
|
|
|
|
||||||
LL | fn weird2() -> impl !Sized {}
|
LL | fn weird2() -> impl !Sized {}
|
||||||
| ^^ types differ
|
| ^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl !Sized` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl !Sized` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:19:16
|
--> $DIR/opaque-type-unsatisfied-bound.rs:25:16
|
||||||
|
|
|
|
||||||
LL | fn weird2() -> impl !Sized {}
|
LL | fn weird2() -> impl !Sized {}
|
||||||
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
@ -73,11 +89,13 @@ LL | fn weird2() -> impl !Sized {}
|
|||||||
= help: the trait `Sized` is not implemented for `impl !Sized`
|
= help: the trait `Sized` is not implemented for `impl !Sized`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `weird2::{opaque#0} normalizes-to _`
|
error[E0277]: the size for values of type `()` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:19:1
|
--> $DIR/opaque-type-unsatisfied-bound.rs:25:1
|
||||||
|
|
|
|
||||||
LL | fn weird2() -> impl !Sized {}
|
LL | fn weird2() -> impl !Sized {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Sized` is not satisfied
|
||||||
|
|
||||||
error[E0277]: the trait bound `impl !Trait: Trait` is not satisfied
|
error[E0277]: the trait bound `impl !Trait: Trait` is not satisfied
|
||||||
--> $DIR/opaque-type-unsatisfied-bound.rs:12:13
|
--> $DIR/opaque-type-unsatisfied-bound.rs:12:13
|
||||||
@ -95,5 +113,4 @@ LL | fn consume(_: impl Trait) {}
|
|||||||
|
|
||||||
error: aborting due to 13 previous errors
|
error: aborting due to 13 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
#![feature(negative_bounds, unboxed_closures)]
|
#![feature(negative_bounds, unboxed_closures)]
|
||||||
|
|
||||||
fn produce() -> impl !Fn<(u32,)> {}
|
fn produce() -> impl !Fn<(u32,)> {}
|
||||||
//~^ ERROR type mismatch resolving `impl !Fn<(u32,)> == ()`
|
//~^ ERROR expected a `Fn(u32)` closure, found `()`
|
||||||
|
//~| ERROR expected a `Fn(u32)` closure, found `()`
|
||||||
|
//~| ERROR the size for values of type `impl !Fn<(u32,)>` cannot be known at compilation time
|
||||||
|
//~| ERROR expected a `Fn(u32)` closure, found `()`
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
error[E0271]: type mismatch resolving `produce::{opaque#0} normalizes-to _`
|
error[E0277]: expected a `Fn(u32)` closure, found `()`
|
||||||
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17
|
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17
|
||||||
|
|
|
|
||||||
LL | fn produce() -> impl !Fn<(u32,)> {}
|
LL | fn produce() -> impl !Fn<(u32,)> {}
|
||||||
| ^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^ expected an `Fn(u32)` closure, found `()`
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Fn(u32)` is not satisfied
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `produce::{opaque#0} normalizes-to _`
|
error[E0277]: expected a `Fn(u32)` closure, found `()`
|
||||||
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:34
|
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:34
|
||||||
|
|
|
|
||||||
LL | fn produce() -> impl !Fn<(u32,)> {}
|
LL | fn produce() -> impl !Fn<(u32,)> {}
|
||||||
| ^^ types differ
|
| ^^ expected an `Fn(u32)` closure, found `()`
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Fn(u32)` is not satisfied
|
||||||
|
|
||||||
error[E0277]: the size for values of type `impl !Fn<(u32,)>` cannot be known at compilation time
|
error[E0277]: the size for values of type `impl !Fn<(u32,)>` cannot be known at compilation time
|
||||||
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17
|
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:17
|
||||||
@ -19,13 +23,14 @@ LL | fn produce() -> impl !Fn<(u32,)> {}
|
|||||||
= help: the trait `Sized` is not implemented for `impl !Fn<(u32,)>`
|
= help: the trait `Sized` is not implemented for `impl !Fn<(u32,)>`
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `produce::{opaque#0} normalizes-to _`
|
error[E0277]: expected a `Fn(u32)` closure, found `()`
|
||||||
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:1
|
--> $DIR/opaque-type-unsatisfied-fn-bound.rs:5:1
|
||||||
|
|
|
|
||||||
LL | fn produce() -> impl !Fn<(u32,)> {}
|
LL | fn produce() -> impl !Fn<(u32,)> {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected an `Fn(u32)` closure, found `()`
|
||||||
|
|
|
||||||
|
= help: the trait bound `(): !Fn(u32)` is not satisfied
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -16,43 +16,6 @@ note: required by a bound in `needs_coroutine`
|
|||||||
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `needs_coroutine`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Yield normalizes-to <{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Yield`
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/coroutine.rs:20:9
|
|
||||||
|
|
|
||||||
LL | needs_coroutine(
|
|
||||||
| --------------- required by a bound introduced by this call
|
|
||||||
LL | #[coroutine]
|
|
||||||
LL | / || {
|
|
||||||
LL | |
|
|
||||||
LL | | yield ();
|
|
||||||
LL | | },
|
|
||||||
| |_________^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `needs_coroutine`
|
|
||||||
--> $DIR/coroutine.rs:14:41
|
|
||||||
|
|
|
||||||
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
|
||||||
| ^^^^^^^^^ required by this bound in `needs_coroutine`
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Return normalizes-to <{coroutine@$DIR/coroutine.rs:20:9: 20:11} as Coroutine<A>>::Return`
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
--> $DIR/coroutine.rs:20:9
|
|
||||||
|
|
|
||||||
LL | needs_coroutine(
|
|
||||||
| --------------- required by a bound introduced by this call
|
|
||||||
LL | #[coroutine]
|
|
||||||
LL | / || {
|
|
||||||
LL | |
|
|
||||||
LL | | yield ();
|
|
||||||
LL | | },
|
|
||||||
| |_________^ types differ
|
|
||||||
|
|
|
||||||
note: required by a bound in `needs_coroutine`
|
|
||||||
--> $DIR/coroutine.rs:14:52
|
|
||||||
|
|
|
||||||
LL | fn needs_coroutine(_: impl Coroutine<A, Yield = B, Return = C>) {}
|
|
||||||
| ^^^^^^^^^^ required by this bound in `needs_coroutine`
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -9,20 +9,6 @@ help: consider restricting type parameter `T`
|
|||||||
LL | fn test_poly<T: Trait>() {
|
LL | fn test_poly<T: Trait>() {
|
||||||
| +++++++
|
| +++++++
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<T as Trait>::Assoc normalizes-to <T as Trait>::Assoc`
|
|
||||||
--> $DIR/projection-trait-ref.rs:8:12
|
|
||||||
|
|
|
||||||
LL | let x: <T as Trait>::Assoc = ();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<T as Trait>::Assoc normalizes-to <T as Trait>::Assoc`
|
|
||||||
--> $DIR/projection-trait-ref.rs:8:12
|
|
||||||
|
|
|
||||||
LL | let x: <T as Trait>::Assoc = ();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error[E0277]: the trait bound `i32: Trait` is not satisfied
|
error[E0277]: the trait bound `i32: Trait` is not satisfied
|
||||||
--> $DIR/projection-trait-ref.rs:13:12
|
--> $DIR/projection-trait-ref.rs:13:12
|
||||||
|
|
|
|
||||||
@ -35,21 +21,6 @@ help: this trait has no implementations, consider adding one
|
|||||||
LL | trait Trait {
|
LL | trait Trait {
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<i32 as Trait>::Assoc normalizes-to <i32 as Trait>::Assoc`
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/projection-trait-ref.rs:13:12
|
|
||||||
|
|
|
||||||
LL | let x: <i32 as Trait>::Assoc = ();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<i32 as Trait>::Assoc normalizes-to <i32 as Trait>::Assoc`
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
--> $DIR/projection-trait-ref.rs:13:12
|
|
||||||
|
|
|
||||||
LL | let x: <i32 as Trait>::Assoc = ();
|
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -13,6 +13,7 @@ pub fn copy_any<T>(t: &T) -> T {
|
|||||||
//~^ ERROR the trait bound `T: Copy` is not satisfied in `dyn Setup<From = T>`
|
//~^ ERROR the trait bound `T: Copy` is not satisfied in `dyn Setup<From = T>`
|
||||||
//~| ERROR mismatched types
|
//~| ERROR mismatched types
|
||||||
//~| ERROR the trait bound `T: Copy` is not satisfied
|
//~| ERROR the trait bound `T: Copy` is not satisfied
|
||||||
|
//~| ERROR the size for values of type `<dyn Setup<From = T> as Setup>::From` cannot be known at compilation time
|
||||||
|
|
||||||
// FIXME(-Znext-solver): These error messages are horrible and some of them
|
// FIXME(-Znext-solver): These error messages are horrible and some of them
|
||||||
// are even simple fallout from previous error.
|
// are even simple fallout from previous error.
|
||||||
|
@ -15,20 +15,6 @@ note: required by a bound in `require_fn`
|
|||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<unsafe fn() -> i32 as FnOnce<()>>::Output normalizes-to <unsafe fn() -> i32 as FnOnce<()>>::Output`
|
|
||||||
--> $DIR/fn-trait.rs:20:16
|
|
||||||
|
|
|
||||||
LL | require_fn(f as unsafe fn() -> i32);
|
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
|
||||||
--> $DIR/fn-trait.rs:22:16
|
--> $DIR/fn-trait.rs:22:16
|
||||||
|
|
|
|
||||||
@ -45,20 +31,6 @@ note: required by a bound in `require_fn`
|
|||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 {g} as FnOnce<()>>::Output normalizes-to <extern "C" fn() -> i32 {g} as FnOnce<()>>::Output`
|
|
||||||
--> $DIR/fn-trait.rs:22:16
|
|
||||||
|
|
|
||||||
LL | require_fn(g);
|
|
||||||
| ---------- ^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
|
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
|
||||||
--> $DIR/fn-trait.rs:24:16
|
--> $DIR/fn-trait.rs:24:16
|
||||||
|
|
|
|
||||||
@ -75,20 +47,6 @@ note: required by a bound in `require_fn`
|
|||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<extern "C" fn() -> i32 as FnOnce<()>>::Output normalizes-to <extern "C" fn() -> i32 as FnOnce<()>>::Output`
|
|
||||||
--> $DIR/fn-trait.rs:24:16
|
|
||||||
|
|
|
||||||
LL | require_fn(g as extern "C" fn() -> i32);
|
|
||||||
| ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
|
error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
|
||||||
--> $DIR/fn-trait.rs:26:16
|
--> $DIR/fn-trait.rs:26:16
|
||||||
|
|
|
|
||||||
@ -106,21 +64,6 @@ note: required by a bound in `require_fn`
|
|||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
LL | fn require_fn(_: impl Fn() -> i32) {}
|
||||||
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
| ^^^^^^^^^^^ required by this bound in `require_fn`
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `<unsafe fn() -> i32 {h} as FnOnce<()>>::Output normalizes-to <unsafe fn() -> i32 {h} as FnOnce<()>>::Output`
|
error: aborting due to 4 previous errors
|
||||||
--> $DIR/fn-trait.rs:26:16
|
|
||||||
|
|
|
||||||
LL | require_fn(h);
|
|
||||||
| ---------- ^ types differ
|
|
||||||
| |
|
|
||||||
| required by a bound introduced by this call
|
|
||||||
|
|
|
||||||
note: required by a bound in `require_fn`
|
|
||||||
--> $DIR/fn-trait.rs:3:31
|
|
||||||
|
|
|
||||||
LL | fn require_fn(_: impl Fn() -> i32) {}
|
|
||||||
| ^^^ required by this bound in `require_fn`
|
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
For more information about this error, try `rustc --explain E0277`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -17,7 +17,7 @@ trait Overlap<T> {}
|
|||||||
impl<T> Overlap<T> for T {}
|
impl<T> Overlap<T> for T {}
|
||||||
|
|
||||||
impl<T> Overlap<for<'a> fn(Assoc<'a, T>)> for T where Missing: Overlap<T> {}
|
impl<T> Overlap<for<'a> fn(Assoc<'a, T>)> for T where Missing: Overlap<T> {}
|
||||||
//~^ ERROR conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)`
|
//~^ ERROR cannot find type `Missing` in this scope
|
||||||
//~| ERROR cannot find type `Missing` in this scope
|
//~| ERROR the trait bound `for<'a> *const T: ToUnit<'a>` is not satisfied
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -26,13 +26,19 @@ LL | trait ToUnit<'a> {
|
|||||||
| ^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
|
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
|
||||||
error[E0271]: type mismatch resolving `Assoc<'a, T> normalizes-to _`
|
error[E0277]: the trait bound `for<'a> *const T: ToUnit<'a>` is not satisfied
|
||||||
--> $DIR/issue-118950-root-region.rs:19:17
|
--> $DIR/issue-118950-root-region.rs:19:17
|
||||||
|
|
|
|
||||||
LL | impl<T> Overlap<for<'a> fn(Assoc<'a, T>)> for T where Missing: Overlap<T> {}
|
LL | impl<T> Overlap<for<'a> fn(Assoc<'a, T>)> for T where Missing: Overlap<T> {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ types differ
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> ToUnit<'a>` is not implemented for `*const T`
|
||||||
|
|
|
||||||
|
help: this trait has no implementations, consider adding one
|
||||||
|
--> $DIR/issue-118950-root-region.rs:8:1
|
||||||
|
|
|
||||||
|
LL | trait ToUnit<'a> {
|
||||||
|
| ^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
error: aborting due to 3 previous errors; 1 warning emitted
|
error: aborting due to 3 previous errors; 1 warning emitted
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0277, E0412.
|
Some errors have detailed explanations: E0277, E0412.
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
@ -15,7 +15,7 @@ trait Foo {
|
|||||||
impl<T: ?Sized> Mirror for T { type Assoc = T; }
|
impl<T: ?Sized> Mirror for T { type Assoc = T; }
|
||||||
|
|
||||||
trait MirrorRegion<'a> { type Assoc: ?Sized; }
|
trait MirrorRegion<'a> { type Assoc: ?Sized; }
|
||||||
impl<'a, T> MirrorRegion<'a> for T { type Assoc = T; }
|
impl<'a, T: ?Sized> MirrorRegion<'a> for T { type Assoc = T; }
|
||||||
|
|
||||||
impl<T> Foo for T {
|
impl<T> Foo for T {
|
||||||
#[cfg(normalize_param_env)]
|
#[cfg(normalize_param_env)]
|
||||||
|
@ -4,21 +4,6 @@ error[E0282]: type annotations needed
|
|||||||
LL | self.bar.next().unwrap();
|
LL | self.bar.next().unwrap();
|
||||||
| ^^^^^^^^ cannot infer type
|
| ^^^^^^^^ cannot infer type
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `Tait normalizes-to _`
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/method_resolution_trait_method_from_opaque.rs:26:9
|
|
||||||
|
|
|
||||||
LL | self.bar.next().unwrap();
|
|
||||||
| ^^^^^^^^ types differ
|
|
||||||
|
|
||||||
error[E0271]: type mismatch resolving `Tait normalizes-to _`
|
For more information about this error, try `rustc --explain E0282`.
|
||||||
--> $DIR/method_resolution_trait_method_from_opaque.rs:26:9
|
|
||||||
|
|
|
||||||
LL | self.bar.next().unwrap();
|
|
||||||
| ^^^^^^^^ types differ
|
|
||||||
|
|
|
||||||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0271, E0282.
|
|
||||||
For more information about an error, try `rustc --explain E0271`.
|
|
||||||
|
@ -25,8 +25,6 @@ fn foo(&mut self) {
|
|||||||
//[current]~^ ERROR: item does not constrain
|
//[current]~^ ERROR: item does not constrain
|
||||||
self.bar.next().unwrap();
|
self.bar.next().unwrap();
|
||||||
//[next]~^ ERROR: type annotations needed
|
//[next]~^ ERROR: type annotations needed
|
||||||
//[next]~| ERROR type mismatch resolving `Tait normalizes-to _`
|
|
||||||
//[next]~| ERROR type mismatch resolving `Tait normalizes-to _`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
//@ revisions: current next
|
//@ revisions: current next
|
||||||
//@[next] compile-flags: -Znext-solver
|
|
||||||
//@[next] check-pass
|
|
||||||
//@ ignore-compare-mode-next-solver (explicit revisions)
|
//@ ignore-compare-mode-next-solver (explicit revisions)
|
||||||
//@[current] check-fail
|
//@ check-fail
|
||||||
//@[current] failure-status: 101
|
//@ failure-status: 101
|
||||||
//@[current] dont-check-compiler-stderr
|
//@ dont-check-compiler-stderr
|
||||||
//@[current] known-bug: #103899
|
//@ known-bug: #103899
|
||||||
|
|
||||||
trait BaseWithAssoc {
|
trait BaseWithAssoc {
|
||||||
type Assoc;
|
type Assoc;
|
||||||
|
Loading…
Reference in New Issue
Block a user