Skip to content

Commit

Permalink
Merge branch 'master' into kw/change-to-lowercase-field
Browse files Browse the repository at this point in the history
* master:
  feat: Sync from aztec-packages (#4438)
  chore(docs): correct 'Edit this page' URL for dev docs (#4433)
  feat: Sync from aztec-packages (#4390)
  chore(docs): fix external contributor force push workflow (#4437)
  chore!: Remove empty value from bounded vec (#4431)
  chore: nargo fmt (#4434)
  • Loading branch information
TomAFrench committed Feb 27, 2024
2 parents 8190761 + a25d5da commit 9e4010a
Show file tree
Hide file tree
Showing 50 changed files with 766 additions and 211 deletions.
5 changes: 0 additions & 5 deletions .github/EXTERNAL_CONTRIBUTOR_PR_COMMENT.md

This file was deleted.

6 changes: 5 additions & 1 deletion .github/workflows/pull-request-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ jobs:
- name: Post comment on force pushes
uses: marocchino/sticky-pull-request-comment@v2
with:
path: ./.github/EXTERNAL_CONTRIBUTOR_PR_COMMENT.md
message: |
Thank you for your contribution to the Noir language.
Please **do not force push to this branch** after the Noir team have started review of this PR. Doing so will only delay us merging your PR as we will need to start the review process from scratch.
Thanks for your understanding.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM rust:bookworm
FROM rust:bullseye
WORKDIR /usr/src/noir
COPY . .
RUN ./scripts/bootstrap_native.sh

# When running the container, mount the users home directory to same location.
FROM ubuntu:lunar
FROM ubuntu:focal
# Install Tini as nargo doesn't handle signals properly.
# Install git as nargo needs it to clone.
RUN apt-get update && apt-get install -y git tini && rm -rf /var/lib/apt/lists/* && apt-get clean
COPY --from=0 /usr/src/noir/target/release/nargo /usr/src/noir/target/release/nargo
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/src/noir/target/release/nargo"]
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/src/noir/target/release/nargo"]
1 change: 1 addition & 0 deletions aztec_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ repository.workspace = true

[dependencies]
noirc_frontend.workspace = true
noirc_errors.workspace = true
iter-extended.workspace = true
convert_case = "0.6.0"
269 changes: 237 additions & 32 deletions aztec_macros/src/lib.rs

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@ if [ -n "$CMD" ]; then
fi
fi

# Attempt to just pull artefacts from CI and exit on success.
[ -n "${USE_CACHE:-}" ] && ./bootstrap_cache.sh && exit

./scripts/bootstrap_native.sh
./scripts/bootstrap_packages.sh
./scripts/bootstrap_packages.sh
4 changes: 4 additions & 0 deletions bootstrap_cache.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
set -eu

[ -z "${NO_CACHE:-}" ] && type docker &> /dev/null && [ -f ~/.aws/credentials ] || exit 1

cd "$(dirname "$0")"
source ../build-system/scripts/setup_env '' '' mainframe_$USER > /dev/null

Expand All @@ -9,3 +11,5 @@ extract_repo noir-packages /usr/src/noir/packages ./
echo -e "\033[1mRetrieving nargo from remote cache...\033[0m"
extract_repo noir /usr/src/noir/target/release ./target/

remove_old_images noir-packages
remove_old_images noir
14 changes: 14 additions & 0 deletions compiler/noirc_frontend/src/hir/def_collector/dc_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,20 @@ impl DefCollector {
// Add the current crate to the collection of DefMaps
context.def_maps.insert(crate_id, def_collector.def_map);

// TODO(#4653): generalize this function
for macro_processor in &macro_processors {
macro_processor
.process_unresolved_traits_impls(
&crate_id,
context,
&def_collector.collected_traits_impls,
&mut def_collector.collected_functions,
)
.unwrap_or_else(|(macro_err, file_id)| {
errors.push((macro_err.into(), file_id));
});
}

inject_prelude(crate_id, context, crate_root, &mut def_collector.collected_imports);
for submodule in submodules {
inject_prelude(
Expand Down
5 changes: 5 additions & 0 deletions compiler/noirc_frontend/src/hir/def_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ impl CrateDefMap {
pub fn modules(&self) -> &Arena<ModuleData> {
&self.modules
}

pub fn modules_mut(&mut self) -> &mut Arena<ModuleData> {
&mut self.modules
}

pub fn krate(&self) -> CrateId {
self.krate
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/noirc_frontend/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ impl Context<'_, '_> {
self.def_maps.get(crate_id)
}

pub fn def_map_mut(&mut self, crate_id: &CrateId) -> Option<&mut CrateDefMap> {
self.def_maps.get_mut(crate_id)
}

/// Return the CrateId for each crate that has been compiled
/// successfully
pub fn crates(&self) -> impl Iterator<Item = CrateId> + '_ {
Expand Down
11 changes: 11 additions & 0 deletions compiler/noirc_frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub mod macros_api {
pub use noirc_errors::Span;

pub use crate::graph::CrateId;
use crate::hir::def_collector::dc_crate::{UnresolvedFunctions, UnresolvedTraitImpl};
pub use crate::hir::def_collector::errors::MacroError;
pub use crate::hir_def::expr::{HirExpression, HirLiteral};
pub use crate::hir_def::stmt::HirStatement;
Expand Down Expand Up @@ -74,6 +75,16 @@ pub mod macros_api {
crate_id: &CrateId,
context: &HirContext,
) -> Result<SortedModule, (MacroError, FileId)>;

// TODO(#4653): generalize this function
fn process_unresolved_traits_impls(
&self,
_crate_id: &CrateId,
_context: &mut HirContext,
_unresolved_traits_impls: &[UnresolvedTraitImpl],
_collected_functions: &mut Vec<UnresolvedFunctions>,
) -> Result<(), (MacroError, FileId)>;

/// Function to manipulate the AST after type checking has been completed.
/// The AST after type checking has been done is called the HIR.
fn process_typed_ast(
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/node_interner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ impl TraitId {
}

#[derive(Debug, Eq, PartialEq, Hash, Clone, Copy)]
pub struct TraitImplId(usize);
pub struct TraitImplId(pub usize);

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct TraitMethodId {
Expand Down
2 changes: 1 addition & 1 deletion docs/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default {
},
},
editUrl: ({ versionDocsDirPath, docPath }) =>
`https://github.com/noir-lang/noir/edit/master/docs/${versionDocsDirPath}/${docPath}`,
`https://github.com/noir-lang/noir/edit/master/docs/${versionDocsDirPath.replace('processed-docs', 'docs')}/${docPath}`,
},
blog: false,
theme: {
Expand Down
Loading

0 comments on commit 9e4010a

Please sign in to comment.