Skip to content

Commit

Permalink
hack for errs
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Dec 19, 2023
1 parent df5b604 commit fe6db6e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
6 changes: 6 additions & 0 deletions compiler/rustc_infer/src/infer/relate/generalize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ where
ty::Invariant => {
if self.for_universe.can_name(universe) {
return Ok(t);
} else if self.infcx.next_trait_solver() && self.in_alias {
return Err(TypeError::Mismatch);
}
}

Expand Down Expand Up @@ -412,6 +414,8 @@ where
let r_universe = self.infcx.universe_of_region(r);
if self.for_universe.can_name(r_universe) {
return Ok(r);
} else if self.infcx.next_trait_solver() && self.in_alias {
return Err(TypeError::Mismatch);
}
}

Expand Down Expand Up @@ -452,6 +456,8 @@ where
ConstVariableValue::Unknown { universe } => {
if self.for_universe.can_name(universe) {
Ok(c)
} else if self.infcx.next_trait_solver() && self.in_alias {
return Err(TypeError::Mismatch);
} else {
let new_var_id = variable_table
.new_key(ConstVarValue {
Expand Down
14 changes: 14 additions & 0 deletions tests/ui/impl-trait/issue-103181-1.next.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
error[E0046]: not all trait items implemented, missing: `Error`
--> $DIR/issue-103181-1.rs:11:5
|
Expand All @@ -7,6 +14,13 @@ LL | }
LL | impl HttpBody for () {
| ^^^^^^^^^^^^^^^^^^^^ missing `Error` in implementation

WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [!0, &RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:34 ~ issue_103181_1[ac79]::hyper::{impl#2}::'a), 'a) }) ()], def_id: DefId(0:47 ~ issue_103181_1[ac79]::hyper::Service::Response) })
error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0046`.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// compile-flags: -Znext-solver
// known-bug: trait-system-refactor-initiative#60
// check-pass

// Generalizing a projection containing an inference variable
// which cannot be named by the `root_vid` can result in ambiguity.
// which cannot be named by the `root_vid` previously resulted in ambiguity.
//
// Because we do not decrement the universe index when exiting a forall,
// this can cause unexpected failures.
Expand Down
20 changes: 20 additions & 0 deletions tests/ui/traits/next-solver/issue-118950-root-region.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,32 @@ LL | #![feature(lazy_type_alias)]

WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Weak, AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) })
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: Alias(Projection, AliasTy { args: [*const {type error}, RePlaceholder(!2_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) })], def_id: DefId(0:5 ~ issue_118950_root_region[d54f]::ToUnit::Unit) })
error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)`
--> $DIR/issue-118950-root-region.rs:18:1
|
Expand Down

0 comments on commit fe6db6e

Please sign in to comment.