mirror of https://github.com/rust-lang/rust.git
Taint infcx when reporting errors
This commit is contained in:
parent
a183989e88
commit
3594a19f2a
|
@ -179,6 +179,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
for (error, suppressed) in iter::zip(&errors, &is_suppressed) {
|
for (error, suppressed) in iter::zip(&errors, &is_suppressed) {
|
||||||
if !suppressed && error.obligation.cause.span.from_expansion() == from_expansion {
|
if !suppressed && error.obligation.cause.span.from_expansion() == from_expansion {
|
||||||
let guar = self.report_fulfillment_error(error);
|
let guar = self.report_fulfillment_error(error);
|
||||||
|
self.infcx.set_tainted_by_errors(guar);
|
||||||
reported = Some(guar);
|
reported = Some(guar);
|
||||||
// We want to ignore desugarings here: spans are equivalent even
|
// We want to ignore desugarings here: spans are equivalent even
|
||||||
// if one is the result of a desugaring and the other is not.
|
// if one is the result of a desugaring and the other is not.
|
||||||
|
@ -2686,22 +2687,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Given some `ConstArgHasType(?x, usize)`, we should not emit an error such as
|
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ..)) => self
|
||||||
// "type annotations needed: cannot satisfy the constant `_` has type `usize`"
|
.emit_inference_failure_err(
|
||||||
// Instead we should emit a normal error suggesting the user to turbofish the
|
obligation.cause.body_id,
|
||||||
// const parameter that is currently being inferred. Unfortunately we cannot
|
|
||||||
// nicely emit such an error so we delay an ICE incase nobody else reports it
|
|
||||||
// for us.
|
|
||||||
ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(ct, ty)) => {
|
|
||||||
return self.tcx.sess.dcx().span_delayed_bug(
|
|
||||||
span,
|
span,
|
||||||
format!(
|
ct.into(),
|
||||||
"`ambiguous ConstArgHasType({:?}, {:?}) unaccompanied by inference error`",
|
ErrorCode::E0284,
|
||||||
ct, ty
|
true,
|
||||||
),
|
),
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
ty::PredicateKind::NormalizesTo(ty::NormalizesTo { alias, term })
|
ty::PredicateKind::NormalizesTo(ty::NormalizesTo { alias, term })
|
||||||
if term.is_infer() =>
|
if term.is_infer() =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
//@ known-bug: #122044
|
|
||||||
use std::hint::black_box;
|
|
||||||
|
|
||||||
trait Func {
|
|
||||||
type Ret: Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
trait Id {
|
|
||||||
type Assoc;
|
|
||||||
}
|
|
||||||
impl Id for u32 {}
|
|
||||||
impl Id for u32 {}
|
|
||||||
|
|
||||||
impl<F: FnOnce() -> R, R: Id> Func for F {
|
|
||||||
type Ret = R;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bar() -> impl Copy + Id {
|
|
||||||
0u32
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Foo<T: Func> {
|
|
||||||
_func: T,
|
|
||||||
value: Option<<<T as Func>::Ret as Id>::Assoc>,
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let mut fn_def = black_box(Foo {
|
|
||||||
_func: bar,
|
|
||||||
value: None,
|
|
||||||
});
|
|
||||||
let fn_ptr = black_box(Foo {
|
|
||||||
_func: bar as fn() -> _,
|
|
||||||
value: None,
|
|
||||||
});
|
|
||||||
|
|
||||||
fn_def.value = fn_ptr.value;
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
//@ known-bug: rust-lang/rust#123255
|
|
||||||
//@ edition:2021
|
|
||||||
#![crate_type = "lib"]
|
|
||||||
|
|
||||||
pub fn a() {}
|
|
||||||
|
|
||||||
mod handlers {
|
|
||||||
pub struct C(&());
|
|
||||||
pub fn c() -> impl Fn() -> C {
|
|
||||||
let a1 = ();
|
|
||||||
|| C((crate::a(), a1).into())
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -6,4 +6,6 @@ fn combinator<T, const S: usize>() -> [T; S] {}
|
||||||
fn main() {
|
fn main() {
|
||||||
combinator().into_iter();
|
combinator().into_iter();
|
||||||
//[cfail1]~^ ERROR type annotations needed
|
//[cfail1]~^ ERROR type annotations needed
|
||||||
|
//[cfail1]~| ERROR type annotations needed
|
||||||
|
//[cfail1]~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,4 +12,5 @@ fn main() {
|
||||||
let foo = Foo::<1>::foo();
|
let foo = Foo::<1>::foo();
|
||||||
let foo = Foo::foo();
|
let foo = Foo::foo();
|
||||||
//~^ ERROR type annotations needed for `Foo<_>`
|
//~^ ERROR type annotations needed for `Foo<_>`
|
||||||
|
//~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,37 @@
|
||||||
error[E0282]: type annotations needed for `Foo<_>`
|
error[E0284]: type annotations needed for `Foo<_>`
|
||||||
--> $DIR/doesnt_infer.rs:13:9
|
--> $DIR/doesnt_infer.rs:13:9
|
||||||
|
|
|
|
||||||
LL | let foo = Foo::foo();
|
LL | let foo = Foo::foo();
|
||||||
| ^^^
|
| ^^^ ---------- type must be known at this point
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `Foo::<N>::foo`
|
||||||
|
--> $DIR/doesnt_infer.rs:5:6
|
||||||
|
|
|
||||||
|
LL | impl<const N: u32> Foo<N> {
|
||||||
|
| ^^^^^^^^^^^^ required by this bound in `Foo::<N>::foo`
|
||||||
|
LL | fn foo() -> Self {
|
||||||
|
| --- required by a bound in this associated function
|
||||||
help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified
|
help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified
|
||||||
|
|
|
|
||||||
LL | let foo: Foo<N> = Foo::foo();
|
LL | let foo: Foo<N> = Foo::foo();
|
||||||
| ++++++++
|
| ++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error[E0284]: type annotations needed for `Foo<_>`
|
||||||
|
--> $DIR/doesnt_infer.rs:13:9
|
||||||
|
|
|
||||||
|
LL | let foo = Foo::foo();
|
||||||
|
| ^^^ --- type must be known at this point
|
||||||
|
|
|
||||||
|
note: required by a bound in `Foo`
|
||||||
|
--> $DIR/doesnt_infer.rs:3:12
|
||||||
|
|
|
||||||
|
LL | struct Foo<const N: u32 = 2>;
|
||||||
|
| ^^^^^^^^^^^^^^^^ required by this bound in `Foo`
|
||||||
|
help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified
|
||||||
|
|
|
||||||
|
LL | let foo: Foo<N> = Foo::foo();
|
||||||
|
| ++++++++
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -31,12 +31,17 @@ LL | 1_u64
|
||||||
|
|
|
|
||||||
= help: the trait `Traitor<1, 2>` is implemented for `u64`
|
= help: the trait `Traitor<1, 2>` is implemented for `u64`
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error[E0284]: type annotations needed
|
||||||
--> $DIR/rp_impl_trait_fail.rs:28:5
|
--> $DIR/rp_impl_trait_fail.rs:28:5
|
||||||
|
|
|
|
||||||
LL | uwu();
|
LL | uwu();
|
||||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `uwu`
|
| ^^^ cannot infer the value of the const parameter `N` declared on the function `uwu`
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `uwu`
|
||||||
|
--> $DIR/rp_impl_trait_fail.rs:16:8
|
||||||
|
|
|
||||||
|
LL | fn uwu<const N: u8>() -> impl Traitor<N> {
|
||||||
|
| ^^^^^^^^^^^ required by this bound in `uwu`
|
||||||
help: consider specifying the generic argument
|
help: consider specifying the generic argument
|
||||||
|
|
|
|
||||||
LL | uwu::<N>();
|
LL | uwu::<N>();
|
||||||
|
@ -44,5 +49,5 @@ LL | uwu::<N>();
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
Some errors have detailed explanations: E0277, E0282.
|
Some errors have detailed explanations: E0277, E0284.
|
||||||
For more information about an error, try `rustc --explain E0277`.
|
For more information about an error, try `rustc --explain E0277`.
|
||||||
|
|
|
@ -5,4 +5,5 @@ use std::simd::Mask;
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = Mask::<_, _>::splat(false);
|
let y = Mask::<_, _>::splat(false);
|
||||||
//~^ ERROR: type annotations needed
|
//~^ ERROR: type annotations needed
|
||||||
|
//~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,29 @@
|
||||||
error[E0283]: type annotations needed for `Mask<_, _>`
|
error[E0284]: type annotations needed for `Mask<_, _>`
|
||||||
--> $DIR/issue-91614.rs:6:9
|
--> $DIR/issue-91614.rs:6:9
|
||||||
|
|
|
|
||||||
LL | let y = Mask::<_, _>::splat(false);
|
LL | let y = Mask::<_, _>::splat(false);
|
||||||
| ^ -------------------------- type must be known at this point
|
| ^ -------------------------- type must be known at this point
|
||||||
|
|
|
|
||||||
= note: cannot satisfy `_: MaskElement`
|
|
||||||
= help: the following types implement trait `MaskElement`:
|
|
||||||
i16
|
|
||||||
i32
|
|
||||||
i64
|
|
||||||
i8
|
|
||||||
isize
|
|
||||||
note: required by a bound in `Mask::<T, N>::splat`
|
note: required by a bound in `Mask::<T, N>::splat`
|
||||||
--> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL
|
--> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL
|
||||||
help: consider giving `y` an explicit type, where the type for type parameter `T` is specified
|
help: consider giving `y` an explicit type, where the value of const parameter `N` is specified
|
||||||
|
|
|
|
||||||
LL | let y: Mask<T, N> = Mask::<_, _>::splat(false);
|
LL | let y: Mask<T, N> = Mask::<_, _>::splat(false);
|
||||||
| ++++++++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error[E0284]: type annotations needed for `Mask<_, _>`
|
||||||
|
--> $DIR/issue-91614.rs:6:9
|
||||||
|
|
|
||||||
|
LL | let y = Mask::<_, _>::splat(false);
|
||||||
|
| ^ ------------ type must be known at this point
|
||||||
|
|
|
||||||
|
note: required by a bound in `Mask`
|
||||||
|
--> $SRC_DIR/core/src/../../portable-simd/crates/core_simd/src/masks.rs:LL:COL
|
||||||
|
help: consider giving `y` an explicit type, where the value of const parameter `N` is specified
|
||||||
|
|
|
||||||
|
LL | let y: Mask<T, N> = Mask::<_, _>::splat(false);
|
||||||
|
| ++++++++++++
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0283`.
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -18,18 +18,41 @@ help: try adding a `where` bound
|
||||||
LL | pub const fn new() -> Self where [(); Self::SIZE]: {
|
LL | pub const fn new() -> Self where [(); Self::SIZE]: {
|
||||||
| +++++++++++++++++++++++
|
| +++++++++++++++++++++++
|
||||||
|
|
||||||
error[E0282]: type annotations needed for `ArrayHolder<_>`
|
error[E0284]: type annotations needed for `ArrayHolder<_>`
|
||||||
--> $DIR/issue-62504.rs:26:9
|
--> $DIR/issue-62504.rs:26:9
|
||||||
|
|
|
|
||||||
LL | let mut array = ArrayHolder::new();
|
LL | let mut array = ArrayHolder::new();
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^ ------------------ type must be known at this point
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `ArrayHolder::<X>::new`
|
||||||
|
--> $DIR/issue-62504.rs:16:6
|
||||||
|
|
|
||||||
|
LL | impl<const X: usize> ArrayHolder<X> {
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder::<X>::new`
|
||||||
|
LL | pub const fn new() -> Self {
|
||||||
|
| --- required by a bound in this associated function
|
||||||
help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
|
help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
|
||||||
|
|
|
|
||||||
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
|
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
|
||||||
| ++++++++++++++++
|
| ++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error[E0284]: type annotations needed for `ArrayHolder<_>`
|
||||||
|
--> $DIR/issue-62504.rs:26:9
|
||||||
|
|
|
||||||
|
LL | let mut array = ArrayHolder::new();
|
||||||
|
| ^^^^^^^^^ ----------- type must be known at this point
|
||||||
|
|
|
||||||
|
note: required by a bound in `ArrayHolder`
|
||||||
|
--> $DIR/issue-62504.rs:14:20
|
||||||
|
|
|
||||||
|
LL | struct ArrayHolder<const X: usize>([u32; X]);
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder`
|
||||||
|
help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
|
||||||
|
|
|
||||||
|
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
|
||||||
|
| ++++++++++++++++
|
||||||
|
|
||||||
Some errors have detailed explanations: E0282, E0308.
|
error: aborting due to 4 previous errors
|
||||||
For more information about an error, try `rustc --explain E0282`.
|
|
||||||
|
Some errors have detailed explanations: E0284, E0308.
|
||||||
|
For more information about an error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -22,18 +22,41 @@ note: tuple struct defined here
|
||||||
LL | struct ArrayHolder<const X: usize>([u32; X]);
|
LL | struct ArrayHolder<const X: usize>([u32; X]);
|
||||||
| ^^^^^^^^^^^
|
| ^^^^^^^^^^^
|
||||||
|
|
||||||
error[E0282]: type annotations needed for `ArrayHolder<_>`
|
error[E0284]: type annotations needed for `ArrayHolder<_>`
|
||||||
--> $DIR/issue-62504.rs:26:9
|
--> $DIR/issue-62504.rs:26:9
|
||||||
|
|
|
|
||||||
LL | let mut array = ArrayHolder::new();
|
LL | let mut array = ArrayHolder::new();
|
||||||
| ^^^^^^^^^
|
| ^^^^^^^^^ ------------------ type must be known at this point
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `ArrayHolder::<X>::new`
|
||||||
|
--> $DIR/issue-62504.rs:16:6
|
||||||
|
|
|
||||||
|
LL | impl<const X: usize> ArrayHolder<X> {
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder::<X>::new`
|
||||||
|
LL | pub const fn new() -> Self {
|
||||||
|
| --- required by a bound in this associated function
|
||||||
help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
|
help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
|
||||||
|
|
|
|
||||||
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
|
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
|
||||||
| ++++++++++++++++
|
| ++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error[E0284]: type annotations needed for `ArrayHolder<_>`
|
||||||
|
--> $DIR/issue-62504.rs:26:9
|
||||||
|
|
|
||||||
|
LL | let mut array = ArrayHolder::new();
|
||||||
|
| ^^^^^^^^^ ----------- type must be known at this point
|
||||||
|
|
|
||||||
|
note: required by a bound in `ArrayHolder`
|
||||||
|
--> $DIR/issue-62504.rs:14:20
|
||||||
|
|
|
||||||
|
LL | struct ArrayHolder<const X: usize>([u32; X]);
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `ArrayHolder`
|
||||||
|
help: consider giving `array` an explicit type, where the value of const parameter `X` is specified
|
||||||
|
|
|
||||||
|
LL | let mut array: ArrayHolder<X> = ArrayHolder::new();
|
||||||
|
| ++++++++++++++++
|
||||||
|
|
||||||
Some errors have detailed explanations: E0282, E0308.
|
error: aborting due to 4 previous errors
|
||||||
For more information about an error, try `rustc --explain E0282`.
|
|
||||||
|
Some errors have detailed explanations: E0284, E0308.
|
||||||
|
For more information about an error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -25,4 +25,5 @@ impl<const X: usize> ArrayHolder<X> {
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut array = ArrayHolder::new();
|
let mut array = ArrayHolder::new();
|
||||||
//~^ ERROR: type annotations needed
|
//~^ ERROR: type annotations needed
|
||||||
|
//~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,4 +18,5 @@ fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized {
|
||||||
fn main() {
|
fn main() {
|
||||||
use_dyn(&());
|
use_dyn(&());
|
||||||
//~^ ERROR type annotations needed
|
//~^ ERROR type annotations needed
|
||||||
|
//~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,36 @@ LL | use_dyn(&());
|
||||||
| ^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `use_dyn`
|
| ^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `use_dyn`
|
||||||
|
|
|
|
||||||
note: required by a bound in `use_dyn`
|
note: required by a bound in `use_dyn`
|
||||||
--> $DIR/object-safety-ok-infer-err.rs:14:55
|
--> $DIR/object-safety-ok-infer-err.rs:14:12
|
||||||
|
|
|
|
||||||
LL | fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized {
|
LL | fn use_dyn<const N: usize>(v: &dyn Foo<N>) where [u8; N + 1]: Sized {
|
||||||
| ^^^^^ required by this bound in `use_dyn`
|
| ^^^^^^^^^^^^^^ required by this bound in `use_dyn`
|
||||||
help: consider specifying the generic argument
|
help: consider specifying the generic argument
|
||||||
|
|
|
|
||||||
LL | use_dyn::<N>(&());
|
LL | use_dyn::<N>(&());
|
||||||
| +++++
|
| +++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/object-safety-ok-infer-err.rs:19:5
|
||||||
|
|
|
||||||
|
LL | use_dyn(&());
|
||||||
|
| ^^^^^^^ --- type must be known at this point
|
||||||
|
| |
|
||||||
|
| cannot infer the value of the const parameter `N` declared on the function `use_dyn`
|
||||||
|
|
|
||||||
|
note: required for `()` to implement `Foo<_>`
|
||||||
|
--> $DIR/object-safety-ok-infer-err.rs:8:22
|
||||||
|
|
|
||||||
|
LL | impl<const N: usize> Foo<N> for () {
|
||||||
|
| -------------- ^^^^^^ ^^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
= note: required for the cast from `&()` to `&dyn Foo<_>`
|
||||||
|
help: consider specifying the generic argument
|
||||||
|
|
|
||||||
|
LL | use_dyn::<N>(&());
|
||||||
|
| +++++
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0284`.
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
error[E0282]: type annotations needed
|
error[E0284]: type annotations needed
|
||||||
--> $DIR/cannot-infer-const-args.rs:6:5
|
--> $DIR/cannot-infer-const-args.rs:6:5
|
||||||
|
|
|
|
||||||
LL | foo();
|
LL | foo();
|
||||||
| ^^^ cannot infer the value of the const parameter `X` declared on the function `foo`
|
| ^^^ cannot infer the value of the const parameter `X` declared on the function `foo`
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `foo`
|
||||||
|
--> $DIR/cannot-infer-const-args.rs:1:8
|
||||||
|
|
|
||||||
|
LL | fn foo<const X: usize>() -> usize {
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `foo`
|
||||||
help: consider specifying the generic argument
|
help: consider specifying the generic argument
|
||||||
|
|
|
|
||||||
LL | foo::<X>();
|
LL | foo::<X>();
|
||||||
|
@ -11,4 +16,4 @@ LL | foo::<X>();
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
||||||
fn take_array_from_mut<T, const N: usize>(data: &mut [T], start: usize) -> &mut [T; N] {
|
fn take_array_from_mut<T, const N: usize>(data: &mut [T], start: usize) -> &mut [T; N] {
|
||||||
(&mut data[start .. start + N]).try_into().unwrap()
|
(&mut data[start..start + N]).try_into().unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut arr = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
let mut arr = [0, 1, 2, 3, 4, 5, 6, 7, 8];
|
||||||
|
|
||||||
for i in 1 .. 4 {
|
for i in 1..4 {
|
||||||
println!("{:?}", take_array_from_mut(&mut arr, i));
|
println!("{:?}", take_array_from_mut(&mut arr, i));
|
||||||
//~^ ERROR type annotations needed
|
//~^ ERROR type annotations needed
|
||||||
|
//~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,37 @@
|
||||||
error[E0282]: type annotations needed
|
error[E0284]: type annotations needed
|
||||||
--> $DIR/issue-77092.rs:11:26
|
--> $DIR/issue-77092.rs:11:26
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", take_array_from_mut(&mut arr, i));
|
LL | println!("{:?}", take_array_from_mut(&mut arr, i));
|
||||||
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut`
|
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut`
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `take_array_from_mut`
|
||||||
|
--> $DIR/issue-77092.rs:3:27
|
||||||
|
|
|
||||||
|
LL | fn take_array_from_mut<T, const N: usize>(data: &mut [T], start: usize) -> &mut [T; N] {
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `take_array_from_mut`
|
||||||
help: consider specifying the generic arguments
|
help: consider specifying the generic arguments
|
||||||
|
|
|
|
||||||
LL | println!("{:?}", take_array_from_mut::<i32, N>(&mut arr, i));
|
LL | println!("{:?}", take_array_from_mut::<i32, N>(&mut arr, i));
|
||||||
| ++++++++++
|
| ++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/issue-77092.rs:11:26
|
||||||
|
|
|
||||||
|
LL | println!("{:?}", take_array_from_mut(&mut arr, i));
|
||||||
|
| ---- ^^^^^^^^^^^^^^^^^^^ cannot infer the value of the const parameter `N` declared on the function `take_array_from_mut`
|
||||||
|
| |
|
||||||
|
| type must be known at this point
|
||||||
|
|
|
||||||
|
= note: required for `[i32; _]` to implement `Debug`
|
||||||
|
= note: 1 redundant requirement hidden
|
||||||
|
= note: required for `&mut [i32; _]` to implement `Debug`
|
||||||
|
note: required by a bound in `core::fmt::rt::Argument::<'a>::new_debug`
|
||||||
|
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
|
||||||
|
help: consider specifying the generic arguments
|
||||||
|
|
|
||||||
|
LL | println!("{:?}", take_array_from_mut::<i32, N>(&mut arr, i));
|
||||||
|
| ++++++++++
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
error[E0282]: type annotations needed
|
error[E0284]: type annotations needed
|
||||||
--> $DIR/method-chain.rs:15:33
|
--> $DIR/method-chain.rs:15:33
|
||||||
|
|
|
|
||||||
LL | Foo.bar().bar().bar().bar().baz();
|
LL | Foo.bar().bar().bar().bar().baz();
|
||||||
| ^^^ cannot infer the value of the const parameter `N` declared on the method `baz`
|
| ^^^ cannot infer the value of the const parameter `N` declared on the method `baz`
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `Foo::baz`
|
||||||
|
--> $DIR/method-chain.rs:8:12
|
||||||
|
|
|
||||||
|
LL | fn baz<const N: usize>(self) -> Foo {
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `Foo::baz`
|
||||||
help: consider specifying the generic argument
|
help: consider specifying the generic argument
|
||||||
|
|
|
|
||||||
LL | Foo.bar().bar().bar().bar().baz::<N>();
|
LL | Foo.bar().bar().bar().bar().baz::<N>();
|
||||||
|
@ -11,4 +16,4 @@ LL | Foo.bar().bar().bar().bar().baz::<N>();
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -1,9 +1,14 @@
|
||||||
error[E0282]: type annotations needed
|
error[E0284]: type annotations needed
|
||||||
--> $DIR/one-param-uninferred.rs:9:23
|
--> $DIR/one-param-uninferred.rs:9:23
|
||||||
|
|
|
|
||||||
LL | let _: [u8; 17] = foo();
|
LL | let _: [u8; 17] = foo();
|
||||||
| ^^^ cannot infer the value of the const parameter `M` declared on the function `foo`
|
| ^^^ cannot infer the value of the const parameter `M` declared on the function `foo`
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `foo`
|
||||||
|
--> $DIR/one-param-uninferred.rs:2:24
|
||||||
|
|
|
||||||
|
LL | fn foo<const N: usize, const M: usize>() -> [u8; N] {
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `foo`
|
||||||
help: consider specifying the generic arguments
|
help: consider specifying the generic arguments
|
||||||
|
|
|
|
||||||
LL | let _: [u8; 17] = foo::<17, M>();
|
LL | let _: [u8; 17] = foo::<17, M>();
|
||||||
|
@ -11,4 +16,4 @@ LL | let _: [u8; 17] = foo::<17, M>();
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -8,4 +8,5 @@ impl Foo {
|
||||||
fn main() {
|
fn main() {
|
||||||
Foo.foo();
|
Foo.foo();
|
||||||
//~^ ERROR type annotations needed
|
//~^ ERROR type annotations needed
|
||||||
|
//~| ERROR type annotations needed
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,35 @@
|
||||||
error[E0282]: type annotations needed
|
error[E0284]: type annotations needed
|
||||||
--> $DIR/uninferred-consts.rs:9:9
|
--> $DIR/uninferred-consts.rs:9:9
|
||||||
|
|
|
|
||||||
LL | Foo.foo();
|
LL | Foo.foo();
|
||||||
| ^^^ cannot infer the value of the const parameter `A` declared on the method `foo`
|
| ^^^ cannot infer the value of the const parameter `A` declared on the method `foo`
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `Foo::foo`
|
||||||
|
--> $DIR/uninferred-consts.rs:6:12
|
||||||
|
|
|
||||||
|
LL | fn foo<const A: usize, const B: usize>(self) {}
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `Foo::foo`
|
||||||
help: consider specifying the generic arguments
|
help: consider specifying the generic arguments
|
||||||
|
|
|
|
||||||
LL | Foo.foo::<A, B>();
|
LL | Foo.foo::<A, B>();
|
||||||
| ++++++++
|
| ++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/uninferred-consts.rs:9:9
|
||||||
|
|
|
||||||
|
LL | Foo.foo();
|
||||||
|
| ^^^ cannot infer the value of the const parameter `B` declared on the method `foo`
|
||||||
|
|
|
||||||
|
note: required by a bound in `Foo::foo`
|
||||||
|
--> $DIR/uninferred-consts.rs:6:28
|
||||||
|
|
|
||||||
|
LL | fn foo<const A: usize, const B: usize>(self) {}
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `Foo::foo`
|
||||||
|
help: consider specifying the generic arguments
|
||||||
|
|
|
||||||
|
LL | Foo.foo::<A, B>();
|
||||||
|
| ++++++++
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
//@ known-bug: rust-lang/rust#125799
|
//! Used to ICE rust-lang/rust#125799 due to `isize` != `()`
|
||||||
|
//! not being detected early due to the conflicting impls.
|
||||||
//@ only-x86_64
|
//@ only-x86_64
|
||||||
|
|
||||||
trait Trait<T> {
|
trait Trait<T> {
|
||||||
|
@ -10,6 +11,7 @@ impl<T> Trait<T> for Vec<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Trait<u8> for Vec<u8> {}
|
impl Trait<u8> for Vec<u8> {}
|
||||||
|
//~^ ERROR: conflicting implementations
|
||||||
|
|
||||||
const BAR: <Vec<u8> as Trait<u8>>::Assoc = 3;
|
const BAR: <Vec<u8> as Trait<u8>>::Assoc = 3;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
error[E0119]: conflicting implementations of trait `Trait<u8>` for type `Vec<u8>`
|
||||||
|
--> $DIR/mistyped_const_in_pat.rs:13:1
|
||||||
|
|
|
||||||
|
LL | impl<T> Trait<T> for Vec<T> {
|
||||||
|
| --------------------------- first implementation here
|
||||||
|
...
|
||||||
|
LL | impl Trait<u8> for Vec<u8> {}
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Vec<u8>`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0119`.
|
|
@ -5,10 +5,10 @@ LL | generics_of_parent_impl_trait::foo([()]);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `foo`
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `foo`
|
||||||
|
|
|
|
||||||
note: required by a bound in `foo`
|
note: required by a bound in `foo`
|
||||||
--> $DIR/auxiliary/generics_of_parent_impl_trait.rs:5:48
|
--> $DIR/auxiliary/generics_of_parent_impl_trait.rs:5:12
|
||||||
|
|
|
|
||||||
LL | pub fn foo<const N: usize>(foo: impl Into<[(); N + 1]>) {
|
LL | pub fn foo<const N: usize>(foo: impl Into<[(); N + 1]>) {
|
||||||
| ^^^^^ required by this bound in `foo`
|
| ^^^^^^^^^^^^^^ required by this bound in `foo`
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,10 @@ LL | bar();
|
||||||
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
| ^^^ cannot infer the value of the const parameter `N` declared on the function `bar`
|
||||||
|
|
|
|
||||||
note: required by a bound in `bar`
|
note: required by a bound in `bar`
|
||||||
--> $DIR/unify_with_nested_expr.rs:14:10
|
--> $DIR/unify_with_nested_expr.rs:12:8
|
||||||
|
|
|
|
||||||
LL | fn bar<const N: usize>()
|
LL | fn bar<const N: usize>()
|
||||||
| --- required by a bound in this function
|
| ^^^^^^^^^^^^^^ required by this bound in `bar`
|
||||||
LL | where
|
|
||||||
LL | [(); N + 1]:,
|
|
||||||
| ^^^^^ required by this bound in `bar`
|
|
||||||
help: consider specifying the generic argument
|
help: consider specifying the generic argument
|
||||||
|
|
|
|
||||||
LL | bar::<N>();
|
LL | bar::<N>();
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
//! This test used to ICE: rust-lang/rust#123255
|
||||||
|
//! Because the errors on `C` were ignored when trying
|
||||||
|
//! to compute the MIR of the closure, which thus ended
|
||||||
|
//! up with broken upvars.
|
||||||
|
//@ edition:2021
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
pub fn a() {}
|
||||||
|
|
||||||
|
mod handlers {
|
||||||
|
pub struct C(&()); //~ ERROR missing lifetime specifier
|
||||||
|
pub fn c() -> impl Fn() -> C {
|
||||||
|
let a1 = ();
|
||||||
|
|| C((crate::a(), a1).into())
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
error[E0106]: missing lifetime specifier
|
||||||
|
--> $DIR/upvar_captures.rs:11:18
|
||||||
|
|
|
||||||
|
LL | pub struct C(&());
|
||||||
|
| ^ expected named lifetime parameter
|
||||||
|
|
|
||||||
|
help: consider introducing a named lifetime parameter
|
||||||
|
|
|
||||||
|
LL | pub struct C<'a>(&'a ());
|
||||||
|
| ++++ ++
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0106`.
|
|
@ -1,9 +1,14 @@
|
||||||
error[E0282]: type annotations needed for `[usize; _]`
|
error[E0284]: type annotations needed for `[usize; _]`
|
||||||
--> $DIR/issue-83606.rs:8:9
|
--> $DIR/issue-83606.rs:8:9
|
||||||
|
|
|
|
||||||
LL | let _ = foo("foo");
|
LL | let _ = foo("foo");
|
||||||
| ^
|
| ^ ---------- type must be known at this point
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `foo`
|
||||||
|
--> $DIR/issue-83606.rs:3:8
|
||||||
|
|
|
||||||
|
LL | fn foo<const N: usize>(_: impl std::fmt::Display) -> [usize; N] {
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `foo`
|
||||||
help: consider giving this pattern a type, where the value of const parameter `N` is specified
|
help: consider giving this pattern a type, where the value of const parameter `N` is specified
|
||||||
|
|
|
|
||||||
LL | let _: [usize; N] = foo("foo");
|
LL | let _: [usize; N] = foo("foo");
|
||||||
|
@ -11,4 +16,4 @@ LL | let _: [usize; N] = foo("foo");
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -3,6 +3,8 @@ use std::convert::TryFrom;
|
||||||
pub fn test_usage(p: ()) {
|
pub fn test_usage(p: ()) {
|
||||||
SmallCString::try_from(p).map(|cstr| cstr);
|
SmallCString::try_from(p).map(|cstr| cstr);
|
||||||
//~^ ERROR: type annotations needed
|
//~^ ERROR: type annotations needed
|
||||||
|
//~| ERROR: type annotations needed
|
||||||
|
//~| ERROR: type annotations needed
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct SmallCString<const N: usize> {}
|
pub struct SmallCString<const N: usize> {}
|
||||||
|
|
|
@ -1,14 +1,61 @@
|
||||||
error[E0282]: type annotations needed for `SmallCString<_>`
|
error[E0284]: type annotations needed for `SmallCString<_>`
|
||||||
--> $DIR/issue-98299.rs:4:36
|
--> $DIR/issue-98299.rs:4:36
|
||||||
|
|
|
|
||||||
LL | SmallCString::try_from(p).map(|cstr| cstr);
|
LL | SmallCString::try_from(p).map(|cstr| cstr);
|
||||||
| ^^^^
|
| ------------ ^^^^
|
||||||
|
| |
|
||||||
|
| type must be known at this point
|
||||||
|
|
|
|
||||||
|
note: required by a bound in `SmallCString`
|
||||||
|
--> $DIR/issue-98299.rs:10:25
|
||||||
|
|
|
||||||
|
LL | pub struct SmallCString<const N: usize> {}
|
||||||
|
| ^^^^^^^^^^^^^^ required by this bound in `SmallCString`
|
||||||
help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified
|
help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified
|
||||||
|
|
|
|
||||||
LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr);
|
LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr);
|
||||||
| +++++++++++++++++
|
| +++++++++++++++++
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
error[E0284]: type annotations needed for `SmallCString<_>`
|
||||||
|
--> $DIR/issue-98299.rs:4:36
|
||||||
|
|
|
||||||
|
LL | SmallCString::try_from(p).map(|cstr| cstr);
|
||||||
|
| ------------ ^^^^
|
||||||
|
| |
|
||||||
|
| type must be known at this point
|
||||||
|
|
|
||||||
|
note: required for `SmallCString<_>` to implement `TryFrom<()>`
|
||||||
|
--> $DIR/issue-98299.rs:12:22
|
||||||
|
|
|
||||||
|
LL | impl<const N: usize> TryFrom<()> for SmallCString<N> {
|
||||||
|
| -------------- ^^^^^^^^^^^ ^^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified
|
||||||
|
|
|
||||||
|
LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr);
|
||||||
|
| +++++++++++++++++
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0282`.
|
error[E0284]: type annotations needed for `SmallCString<_>`
|
||||||
|
--> $DIR/issue-98299.rs:4:36
|
||||||
|
|
|
||||||
|
LL | SmallCString::try_from(p).map(|cstr| cstr);
|
||||||
|
| ------------------------- ^^^^
|
||||||
|
| |
|
||||||
|
| type must be known at this point
|
||||||
|
|
|
||||||
|
note: required for `SmallCString<_>` to implement `TryFrom<()>`
|
||||||
|
--> $DIR/issue-98299.rs:12:22
|
||||||
|
|
|
||||||
|
LL | impl<const N: usize> TryFrom<()> for SmallCString<N> {
|
||||||
|
| -------------- ^^^^^^^^^^^ ^^^^^^^^^^^^^^^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
help: consider giving this closure parameter an explicit type, where the value of const parameter `N` is specified
|
||||||
|
|
|
||||||
|
LL | SmallCString::try_from(p).map(|cstr: SmallCString<N>| cstr);
|
||||||
|
| +++++++++++++++++
|
||||||
|
|
||||||
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0284`.
|
||||||
|
|
|
@ -37,6 +37,19 @@ error[E0207]: the const parameter `host` is not constrained by the impl trait, s
|
||||||
= note: expressions using a const parameter must map each value to a distinct output value
|
= note: expressions using a const parameter must map each value to a distinct output value
|
||||||
= note: proving the result of expressions other than the parameter are unique is not supported
|
= note: proving the result of expressions other than the parameter are unique is not supported
|
||||||
|
|
||||||
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/derive-const-use.rs:18:35
|
||||||
|
|
|
||||||
|
LL | const _: () = assert!(S((), A) == S::default());
|
||||||
|
| ^^^^^^^^^^^^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `S` to implement `Default`
|
||||||
|
--> $DIR/derive-const-use.rs:15:16
|
||||||
|
|
|
||||||
|
LL | #[derive_const(Default, PartialEq)]
|
||||||
|
| ^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||||
|
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/derive-const-use.rs:16:14
|
--> $DIR/derive-const-use.rs:16:14
|
||||||
|
|
|
|
||||||
|
@ -49,7 +62,24 @@ LL | pub struct S((), A);
|
||||||
found constant `true`
|
found constant `true`
|
||||||
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/derive-const-use.rs:16:18
|
||||||
|
|
|
||||||
|
LL | #[derive_const(Default, PartialEq)]
|
||||||
|
| ------- in this derive macro expansion
|
||||||
|
LL | pub struct S((), A);
|
||||||
|
| ^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `A` to implement `Default`
|
||||||
|
--> $DIR/derive-const-use.rs:7:12
|
||||||
|
|
|
||||||
|
LL | impl const Default for A {
|
||||||
|
| ----- ^^^^^^^ ^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
= note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
Some errors have detailed explanations: E0207, E0308, E0635.
|
error: aborting due to 8 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0207, E0284, E0308, E0635.
|
||||||
For more information about an error, try `rustc --explain E0207`.
|
For more information about an error, try `rustc --explain E0207`.
|
||||||
|
|
|
@ -34,6 +34,94 @@ LL | impl const FromResidual for T {
|
||||||
= note: expressions using a const parameter must map each value to a distinct output value
|
= note: expressions using a const parameter must map each value to a distinct output value
|
||||||
= note: proving the result of expressions other than the parameter are unique is not supported
|
= note: proving the result of expressions other than the parameter are unique is not supported
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/trait-default-body-stability.rs:33:6
|
||||||
|
|
|
||||||
|
LL | impl const FromResidual for T {
|
||||||
|
| ^^^^^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `T` to implement `Try`
|
||||||
|
--> $DIR/trait-default-body-stability.rs:18:12
|
||||||
|
|
|
||||||
|
LL | impl const Try for T {
|
||||||
|
| ----- ^^^ ^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0207`.
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/trait-default-body-stability.rs:44:9
|
||||||
|
|
|
||||||
|
LL | T?
|
||||||
|
| ^^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `T` to implement `Try`
|
||||||
|
--> $DIR/trait-default-body-stability.rs:18:12
|
||||||
|
|
|
||||||
|
LL | impl const Try for T {
|
||||||
|
| ----- ^^^ ^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
|
||||||
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/trait-default-body-stability.rs:44:9
|
||||||
|
|
|
||||||
|
LL | T?
|
||||||
|
| ^^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `T` to implement `FromResidual<T>`
|
||||||
|
--> $DIR/trait-default-body-stability.rs:33:12
|
||||||
|
|
|
||||||
|
LL | impl const FromResidual for T {
|
||||||
|
| ----- ^^^^^^^^^^^^ ^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
|
||||||
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/trait-default-body-stability.rs:44:9
|
||||||
|
|
|
||||||
|
LL | T?
|
||||||
|
| ^^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `T` to implement `Try`
|
||||||
|
--> $DIR/trait-default-body-stability.rs:18:12
|
||||||
|
|
|
||||||
|
LL | impl const Try for T {
|
||||||
|
| ----- ^^^ ^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/trait-default-body-stability.rs:44:9
|
||||||
|
|
|
||||||
|
LL | T?
|
||||||
|
| ^^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `T` to implement `FromResidual<T>`
|
||||||
|
--> $DIR/trait-default-body-stability.rs:33:12
|
||||||
|
|
|
||||||
|
LL | impl const FromResidual for T {
|
||||||
|
| ----- ^^^^^^^^^^^^ ^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error[E0284]: type annotations needed
|
||||||
|
--> $DIR/trait-default-body-stability.rs:44:9
|
||||||
|
|
|
||||||
|
LL | T?
|
||||||
|
| ^^ cannot infer the value of the constant `_`
|
||||||
|
|
|
||||||
|
note: required for `T` to implement `Try`
|
||||||
|
--> $DIR/trait-default-body-stability.rs:18:12
|
||||||
|
|
|
||||||
|
LL | impl const Try for T {
|
||||||
|
| ----- ^^^ ^
|
||||||
|
| |
|
||||||
|
| unsatisfied trait bound introduced here
|
||||||
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
|
||||||
|
|
||||||
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
|
Some errors have detailed explanations: E0207, E0284.
|
||||||
|
For more information about an error, try `rustc --explain E0207`.
|
||||||
|
|
|
@ -5,7 +5,6 @@ struct Ty;
|
||||||
impl TryFrom<Ty> for u8 {
|
impl TryFrom<Ty> for u8 {
|
||||||
type Error = Ty;
|
type Error = Ty;
|
||||||
fn try_from(_: Ty) -> Result<Self, Self::Error> {
|
fn try_from(_: Ty) -> Result<Self, Self::Error> {
|
||||||
//~^ ERROR type annotations needed
|
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +13,6 @@ impl TryFrom<Ty> for u8 {
|
||||||
//~^ ERROR conflicting implementations of trait
|
//~^ ERROR conflicting implementations of trait
|
||||||
type Error = Ty;
|
type Error = Ty;
|
||||||
fn try_from(_: Ty) -> Result<Self, Self::Error> {
|
fn try_from(_: Ty) -> Result<Self, Self::Error> {
|
||||||
//~^ ERROR type annotations needed
|
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0119]: conflicting implementations of trait `TryFrom<Ty>` for type `u8`
|
error[E0119]: conflicting implementations of trait `TryFrom<Ty>` for type `u8`
|
||||||
--> $DIR/conflicting-impls.rs:13:1
|
--> $DIR/conflicting-impls.rs:12:1
|
||||||
|
|
|
|
||||||
LL | impl TryFrom<Ty> for u8 {
|
LL | impl TryFrom<Ty> for u8 {
|
||||||
| ----------------------- first implementation here
|
| ----------------------- first implementation here
|
||||||
|
@ -7,27 +7,6 @@ LL | impl TryFrom<Ty> for u8 {
|
||||||
LL | impl TryFrom<Ty> for u8 {
|
LL | impl TryFrom<Ty> for u8 {
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8`
|
| ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8`
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error: aborting due to 1 previous error
|
||||||
--> $DIR/conflicting-impls.rs:7:53
|
|
||||||
|
|
|
||||||
LL | fn try_from(_: Ty) -> Result<Self, Self::Error> {
|
|
||||||
| _____________________________________________________^
|
|
||||||
LL | |
|
|
||||||
LL | | loop {}
|
|
||||||
LL | | }
|
|
||||||
| |_____^ cannot infer type for enum `Result<u8, _>`
|
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
For more information about this error, try `rustc --explain E0119`.
|
||||||
--> $DIR/conflicting-impls.rs:16:53
|
|
||||||
|
|
|
||||||
LL | fn try_from(_: Ty) -> Result<Self, Self::Error> {
|
|
||||||
| _____________________________________________________^
|
|
||||||
LL | |
|
|
||||||
LL | | loop {}
|
|
||||||
LL | | }
|
|
||||||
| |_____^ cannot infer type for enum `Result<u8, _>`
|
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
|
||||||
|
|
||||||
Some errors have detailed explanations: E0119, E0282.
|
|
||||||
For more information about an error, try `rustc --explain E0119`.
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
//@ known-bug: rust-lang/rust#123276
|
//! This test used to ICE: rust-lang/rust#123276 because we did
|
||||||
|
//! not taint when failing to find the `Foo` type and then tried
|
||||||
|
//! to normalize it.
|
||||||
//@ edition:2021
|
//@ edition:2021
|
||||||
|
|
||||||
async fn create_task() {
|
async fn create_task() {
|
||||||
|
@ -19,7 +21,9 @@ struct AndThen;
|
||||||
|
|
||||||
impl Filter for AndThen
|
impl Filter for AndThen
|
||||||
where
|
where
|
||||||
Foo: Filter,
|
Foo: Filter, //~ ERROR: cannot find type `Foo`
|
||||||
{
|
{
|
||||||
type Future = ();
|
type Future = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
|
@ -0,0 +1,9 @@
|
||||||
|
error[E0412]: cannot find type `Foo` in this scope
|
||||||
|
--> $DIR/normalization-of-unknown-type.rs:24:5
|
||||||
|
|
|
||||||
|
LL | Foo: Filter,
|
||||||
|
| ^^^ not found in this scope
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0412`.
|
Loading…
Reference in New Issue