Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #112324

Merged
merged 15 commits into from
Jun 6, 2023
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't mention IMPLIED_BOUNDS_ENTAILMENT if signatures reference error
compiler-errors committed Jun 5, 2023
commit 0e9e91a95ace9f23e5371bd97e54fe4567150058
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/check/compare_impl_item.rs
Original file line number Diff line number Diff line change
@@ -302,7 +302,7 @@ fn compare_method_predicate_entailment<'tcx>(
return Err(emitted);
}

if check_implied_wf == CheckImpliedWfMode::Check {
if check_implied_wf == CheckImpliedWfMode::Check && !(impl_sig, trait_sig).references_error() {
// We need to check that the impl's args are well-formed given
// the hybrid param-env (impl + trait method where-clauses).
ocx.register_obligation(traits::Obligation::new(
22 changes: 22 additions & 0 deletions tests/ui/implied-bounds/references-err.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
trait Identity {
type Identity;
}
impl<T> Identity for T {
type Identity = T;
}

trait Trait {
type Assoc: Identity;
fn tokenize(&self) -> <Self::Assoc as Identity>::Identity;
}

impl Trait for () {
type Assoc = DoesNotExist;
//~^ ERROR cannot find type `DoesNotExist` in this scope

fn tokenize(&self) -> <Self::Assoc as Identity>::Identity {
unimplemented!()
}
}

fn main() {}
9 changes: 9 additions & 0 deletions tests/ui/implied-bounds/references-err.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0412]: cannot find type `DoesNotExist` in this scope
--> $DIR/references-err.rs:14:18
|
LL | type Assoc = DoesNotExist;
| ^^^^^^^^^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0412`.