Skip to content

Commit d8dc31f

Browse files
Consider param-env candidates even if they have errors
1 parent b8bb296 commit d8dc31f

File tree

10 files changed

+50
-104
lines changed

10 files changed

+50
-104
lines changed

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
244244
.param_env
245245
.caller_bounds()
246246
.iter()
247-
.filter(|p| !p.references_error())
248247
.filter_map(|p| p.as_trait_clause())
249248
// Micro-optimization: filter out predicates relating to different traits.
250249
.filter(|p| p.def_id() == stack.obligation.predicate.def_id())

tests/crashes/110630.rs

-28
This file was deleted.

tests/crashes/115808.rs

-27
This file was deleted.

tests/crashes/121052.rs

-32
This file was deleted.

tests/ui/async-await/in-trait/unconstrained-impl-region.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ impl<'a> Actor for () {
1414
//~^ ERROR the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
1515
type Message = &'a ();
1616
async fn on_mount(self, _: impl Inbox<&'a ()>) {}
17-
//~^ ERROR the trait bound `impl Inbox<&'a ()>: Inbox<&'a ()>` is not satisfied
1817
}
1918

2019
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
1-
error[E0277]: the trait bound `impl Inbox<&'a ()>: Inbox<&'a ()>` is not satisfied
2-
--> $DIR/unconstrained-impl-region.rs:16:5
3-
|
4-
LL | async fn on_mount(self, _: impl Inbox<&'a ()>) {}
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Inbox<&'a ()>` is not implemented for `impl Inbox<&'a ()>`
6-
|
7-
note: required by a bound in `<() as Actor>::on_mount`
8-
--> $DIR/unconstrained-impl-region.rs:16:37
9-
|
10-
LL | async fn on_mount(self, _: impl Inbox<&'a ()>) {}
11-
| ^^^^^^^^^^^^^ required by this bound in `<() as Actor>::on_mount`
12-
131
error[E0207]: the lifetime parameter `'a` is not constrained by the impl trait, self type, or predicates
142
--> $DIR/unconstrained-impl-region.rs:13:6
153
|
164
LL | impl<'a> Actor for () {
175
| ^^ unconstrained lifetime parameter
186

19-
error: aborting due to 2 previous errors
7+
error: aborting due to 1 previous error
208

21-
Some errors have detailed explanations: E0207, E0277.
22-
For more information about an error, try `rustc --explain E0207`.
9+
For more information about this error, try `rustc --explain E0207`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Ensure that we don't emit an E0270 for "`impl AsRef<Path>: AsRef<Path>` not satisfied".
2+
3+
fn foo(filename: impl AsRef<Path>) {
4+
//~^ ERROR cannot find type `Path` in this scope
5+
std::fs::write(filename, "hello").unwrap();
6+
}
7+
8+
fn main() {
9+
foo("/tmp/hello");
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0412]: cannot find type `Path` in this scope
2+
--> $DIR/apit-with-bad-path.rs:3:29
3+
|
4+
LL | fn foo(filename: impl AsRef<Path>) {
5+
| ^^^^ not found in this scope
6+
|
7+
help: consider importing this struct
8+
|
9+
LL + use std::path::Path;
10+
|
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0412`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Ensure that we don't emit an E0270 for "`impl AsRef<Path>: AsRef<Path>` not satisfied".
2+
3+
fn foo<T: AsRef<Path>>(filename: T) {
4+
//~^ ERROR cannot find type `Path` in this scope
5+
std::fs::write(filename, "hello").unwrap();
6+
}
7+
8+
fn main() {
9+
foo("/tmp/hello");
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0412]: cannot find type `Path` in this scope
2+
--> $DIR/where-clause-with-bad-path.rs:3:17
3+
|
4+
LL | fn foo<T: AsRef<Path>>(filename: T) {
5+
| ^^^^ not found in this scope
6+
|
7+
help: consider importing this struct
8+
|
9+
LL + use std::path::Path;
10+
|
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0412`.

0 commit comments

Comments
 (0)