Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 3 additions & 2 deletions compiler/rustc_trait_selection/src/traits/select/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1547,8 +1547,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// Check if a bound would previously have been removed when normalizing
// the param_env so that it can be given the lowest priority. See
// #50825 for the motivation for this.
let is_global =
|cand: &ty::PolyTraitRef<'_>| cand.is_known_global() && !cand.has_late_bound_regions();
let is_global = |cand: &ty::PolyTraitRef<'tcx>| {
cand.is_global(self.infcx.tcx) && !cand.has_late_bound_regions()
};

// (*) Prefer `BuiltinCandidate { has_nested: false }`, `PointeeCandidate`,
// and `DiscriminantKindCandidate` to anything else.
Expand Down
20 changes: 20 additions & 0 deletions src/test/ui/traits/issue-90195-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// check-pass
pub trait Archive {
type Archived;
}

impl<T> Archive for Option<T> {
type Archived = ();
}
pub type Archived<T> = <T as Archive>::Archived;

pub trait Deserialize<D> {}

const ARRAY_SIZE: usize = 32;
impl<__D> Deserialize<__D> for ()
where
Option<[u8; ARRAY_SIZE]>: Archive,
Archived<Option<[u8; ARRAY_SIZE]>>: Deserialize<__D>,
{
}
fn main() {}
21 changes: 21 additions & 0 deletions src/test/ui/traits/issue-90195.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// check-pass
pub trait Archive {
type Archived;
}

impl<T> Archive for Option<T> {
type Archived = ();
}
pub type Archived<T> = <T as Archive>::Archived;

pub trait Deserialize<D> {}

const ARRAY_SIZE: usize = 32;
impl<__D> Deserialize<__D> for ()
where
Option<[u8; ARRAY_SIZE]>: Archive,
Option<[u8; ARRAY_SIZE]>: Archive,
Archived<Option<[u8; ARRAY_SIZE]>>: Deserialize<__D>,
{
}
fn main() {}