Skip to content

Commit bab9174

Browse files
authored
Unrolled build for rust-lang#132084
Rollup merge of rust-lang#132084 - compiler-errors:param-env-with-err, r=lcnr,estebank Consider param-env candidates even if they have errors I added this logic in rust-lang#106309, but frankly I don't know why -- the logic was a very large hammer. It seems like recent changes to error tainting has made that no longer necessary. Ideally we'd rework the way we handle error reporting in all of candidate assembly to be a bit more responsible; we're just suppressing candidates all willy-nilly and it leads to mysterious *other* errors cropping up, like the one that rust-lang#132082 originally wanted to fix. **N.B.** This has the side-effect of turning a failed resolution like `where Missing: Sized` into a trivial where clause that matches all types, but also I don't think it really matters? I'm putting this up as an alternative to rust-lang#132082, since that PR doesn't address the case when one desugars the APIT into a regular type param. r? lcnr vibeck
2 parents 8aca4ba + d8dc31f commit bab9174

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)