Skip to content

Commit

Permalink
Update compiler/noirc_frontend/src/monomorphization/mod.rs
Browse files Browse the repository at this point in the history
Co-authored-by: jfecher <jake@aztecprotocol.com>
  • Loading branch information
asterite and jfecher authored Jul 29, 2024
1 parent 9d76341 commit af35959
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions compiler/noirc_frontend/src/monomorphization/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,17 +977,8 @@ impl<'interner> Monomorphizer<'interner> {
}

HirType::Struct(def, args) => {
// Even though we later call `convert_type` on `fields`, it might be the types
// in `args` end up not being part of fields. For example:
//
// struct Foo<let N: u32> {}
//
// fn main() {
// let _ = Foo {};
// }
//
// In the above case args is `[N]` but fields is `[]`, so T will never be checked.
// However, we want the above program to not compile.
// Not all generic arguments may be used in a struct's fields so we have to check
// the arguments as well as the fields in case any need to be defaulted or are unbound.
for arg in args {
if let Some(error) = Self::check_type(arg, location) {
return Err(error);
Expand Down

0 comments on commit af35959

Please sign in to comment.