mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Consider param-env candidates even if they have errors
This commit is contained in:
parent
b8bb2968ce
commit
d8dc31fd3d
@ -244,7 +244,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
.param_env
|
||||
.caller_bounds()
|
||||
.iter()
|
||||
.filter(|p| !p.references_error())
|
||||
.filter_map(|p| p.as_trait_clause())
|
||||
// Micro-optimization: filter out predicates relating to different traits.
|
||||
.filter(|p| p.def_id() == stack.obligation.predicate.def_id())
|
||||
|
@ -1,28 +0,0 @@
|
||||
//@ known-bug: #110630
|
||||
|
||||
#![feature(generic_const_exprs)]
|
||||
|
||||
use std::ops::Mul;
|
||||
|
||||
pub trait Indices<const N: usize> {
|
||||
const NUM_ELEMS: usize = I::NUM_ELEMS * N;
|
||||
}
|
||||
|
||||
pub trait Concat<J> {
|
||||
type Output;
|
||||
}
|
||||
|
||||
pub struct Tensor<I: Indices<N>, const N: usize>
|
||||
where
|
||||
[u8; I::NUM_ELEMS]: Sized, {}
|
||||
|
||||
impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul<Tensor<J, N>> for Tensor<I, N>
|
||||
where
|
||||
I: Concat<T>,
|
||||
<I as Concat<J>>::Output: Indices<N>,
|
||||
[u8; I::NUM_ELEMS]: Sized,
|
||||
[u8; J::NUM_ELEMS]: Sized,
|
||||
[u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized,
|
||||
{
|
||||
type Output = Tensor<<I as Concat<J>>::Output, N>;
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
//@ known-bug: #115808
|
||||
#![feature(generic_const_exprs)]
|
||||
|
||||
use std::ops::Mul;
|
||||
|
||||
pub trait Indices<const N: usize> {
|
||||
const NUM_ELEMS: usize;
|
||||
}
|
||||
|
||||
pub trait Concat<J> {
|
||||
type Output;
|
||||
}
|
||||
|
||||
pub struct Tensor<I: Indices<N>, const N: usize>
|
||||
where
|
||||
[u8; I::NUM_ELEMS]: Sized, {}
|
||||
|
||||
impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul<Tensor<J, N>> for Tensor<I, N>
|
||||
where
|
||||
I: Concat<FN>,
|
||||
<I as Concat<J>>::Output: Indices<N>,
|
||||
[u8; I::NUM_ELEMS]: Sized,
|
||||
[u8; J::NUM_ELEMS]: Sized,
|
||||
[u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized,
|
||||
{
|
||||
type Output = Tensor<<I as Concat<J>>::Output, N>;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
//@ known-bug: #121052
|
||||
#![feature(generic_const_exprs, with_negative_coherence)]
|
||||
|
||||
use std::ops::Mul;
|
||||
|
||||
pub trait Indices<const N: usize> {
|
||||
const NUM_ELEMS: usize;
|
||||
}
|
||||
|
||||
impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul for Tensor<I, N>
|
||||
where
|
||||
I: Concat<J>,
|
||||
<I as Concat<J>>::Output: Indices<N>,
|
||||
[u8; I::NUM_ELEMS]: Sized,
|
||||
[u8; J::NUM_ELEMS]: Sized,
|
||||
[u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized,
|
||||
{
|
||||
}
|
||||
|
||||
pub trait Concat<J> {}
|
||||
|
||||
pub struct Tensor<I: Indices<N>, const N: usize> {}
|
||||
|
||||
impl<I: Indices<N>, J: Indices<N>, const N: usize> Mul for Tensor<I, N>
|
||||
where
|
||||
I: Concat<J>,
|
||||
<I as Concat<J>>::Output: Indices<N>,
|
||||
[u8; I::NUM_ELEMS]: Sized,
|
||||
[u8; J::NUM_ELEMS]: Sized,
|
||||
[u8; <I as Concat<J>>::Output::NUM_ELEMS]: Sized,
|
||||
{
|
||||
}
|
@ -14,7 +14,6 @@ impl<'a> Actor for () {
|
||||
//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
|
||||
type Message = &'a ();
|
||||
async fn on_mount(self, _: impl Inbox<&'a ()>) {}
|
||||
//~^ ERROR the trait bound `impl Inbox<&'a ()>: Inbox<&'a ()>` is not satisfied
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
@ -1,22 +1,9 @@
|
||||
error[E0277]: the trait bound `impl Inbox<&'a ()>: Inbox<&'a ()>` is not satisfied
|
||||
--> $DIR/unconstrained-impl-region.rs:16:5
|
||||
|
|
||||
LL | async fn on_mount(self, _: impl Inbox<&'a ()>) {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Inbox<&'a ()>` is not implemented for `impl Inbox<&'a ()>`
|
||||
|
|
||||
note: required by a bound in `<() as Actor>::on_mount`
|
||||
--> $DIR/unconstrained-impl-region.rs:16:37
|
||||
|
|
||||
LL | async fn on_mount(self, _: impl Inbox<&'a ()>) {}
|
||||
| ^^^^^^^^^^^^^ required by this bound in `<() as Actor>::on_mount`
|
||||
|
||||
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
|
||||
--> $DIR/unconstrained-impl-region.rs:13:6
|
||||
|
|
||||
LL | impl<'a> Actor for () {
|
||||
| ^^ unconstrained lifetime parameter
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Some errors have detailed explanations: E0207, E0277.
|
||||
For more information about an error, try `rustc --explain E0207`.
|
||||
For more information about this error, try `rustc --explain E0207`.
|
||||
|
10
tests/ui/traits/error-reporting/apit-with-bad-path.rs
Normal file
10
tests/ui/traits/error-reporting/apit-with-bad-path.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// Ensure that we don't emit an E0270 for "`impl AsRef<Path>: AsRef<Path>` not satisfied".
|
||||
|
||||
fn foo(filename: impl AsRef<Path>) {
|
||||
//~^ ERROR cannot find type `Path` in this scope
|
||||
std::fs::write(filename, "hello").unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo("/tmp/hello");
|
||||
}
|
14
tests/ui/traits/error-reporting/apit-with-bad-path.stderr
Normal file
14
tests/ui/traits/error-reporting/apit-with-bad-path.stderr
Normal file
@ -0,0 +1,14 @@
|
||||
error[E0412]: cannot find type `Path` in this scope
|
||||
--> $DIR/apit-with-bad-path.rs:3:29
|
||||
|
|
||||
LL | fn foo(filename: impl AsRef<Path>) {
|
||||
| ^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing this struct
|
||||
|
|
||||
LL + use std::path::Path;
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
@ -0,0 +1,10 @@
|
||||
// Ensure that we don't emit an E0270 for "`impl AsRef<Path>: AsRef<Path>` not satisfied".
|
||||
|
||||
fn foo<T: AsRef<Path>>(filename: T) {
|
||||
//~^ ERROR cannot find type `Path` in this scope
|
||||
std::fs::write(filename, "hello").unwrap();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo("/tmp/hello");
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
error[E0412]: cannot find type `Path` in this scope
|
||||
--> $DIR/where-clause-with-bad-path.rs:3:17
|
||||
|
|
||||
LL | fn foo<T: AsRef<Path>>(filename: T) {
|
||||
| ^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing this struct
|
||||
|
|
||||
LL + use std::path::Path;
|
||||
|
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
Loading…
Reference in New Issue
Block a user