Skip to content

fixup: remove unnecessary Option #13225

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

Merged
merged 1 commit into from
Sep 13, 2022
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
2 changes: 1 addition & 1 deletion crates/hir-ty/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
&self,
projection: crate::ProjectionTy,
env: Arc<crate::TraitEnvironment>,
) -> Option<crate::Ty>;
) -> Ty;

#[salsa::invoke(trait_solve_wait)]
#[salsa::transparent]
Expand Down
6 changes: 3 additions & 3 deletions crates/hir-ty/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ pub(crate) fn normalize_projection_query(
db: &dyn HirDatabase,
projection: ProjectionTy,
env: Arc<TraitEnvironment>,
) -> Option<Ty> {
let mut table = InferenceTable::new(db, env.clone());
) -> Ty {
let mut table = InferenceTable::new(db, env);
let ty = table.normalize_projection_ty(projection);
Some(table.resolve_completely(ty))
table.resolve_completely(ty)
}

/// Solve a trait goal using Chalk.
Expand Down
7 changes: 6 additions & 1 deletion crates/hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2880,7 +2880,12 @@ impl Type {
})
.build();

db.normalize_projection(projection, self.env.clone()).map(|ty| self.derived(ty))
let ty = db.normalize_projection(projection, self.env.clone());
if ty.is_unknown() {
None
} else {
Some(self.derived(ty))
}
}

pub fn is_copy(&self, db: &dyn HirDatabase) -> bool {
Expand Down