Skip to content

Commit

Permalink
bump: rust 1.54.0
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Aug 22, 2021
1 parent da9f168 commit d07126b
Show file tree
Hide file tree
Showing 33 changed files with 94 additions and 95 deletions.
2 changes: 1 addition & 1 deletion crates/mun_codegen/src/assembly.rs
Expand Up @@ -49,7 +49,7 @@ fn build_assembly<'db, 'ink, 'ctx>(
// Setup the code generation context
let module_partition = db.module_partition();

let module_builder = AssemblyBuilder::new(&code_gen, &module_partition, module_group_id);
let module_builder = AssemblyBuilder::new(code_gen, &module_partition, module_group_id);
module_builder.build().expect("unable to create assembly")
}

Expand Down
2 changes: 1 addition & 1 deletion crates/mun_codegen/src/code_gen/assembly_builder.rs
Expand Up @@ -62,7 +62,7 @@ impl<'db, 'ink, 'ctx, 't> AssemblyBuilder<'db, 'ink, 'ctx, 't> {

let target_data = self.code_gen.target_machine.get_target_data();
let type_context = IrTypeContext {
context: &self.code_gen.context,
context: self.code_gen.context,
target_data: &target_data,
struct_types: &self.code_gen.rust_types,
};
Expand Down
4 changes: 2 additions & 2 deletions crates/mun_codegen/src/code_gen/object_file.rs
Expand Up @@ -18,7 +18,7 @@ impl ObjectFile {
module: &inkwell::module::Module,
) -> Result<Self, anyhow::Error> {
let obj = target_machine
.write_to_memory_buffer(&module, FileType::Object)
.write_to_memory_buffer(module, FileType::Object)
.map_err(|e| CodeGenerationError::CodeGenerationError(e.to_string()))?;

let mut obj_file = tempfile::NamedTempFile::new()
Expand All @@ -40,7 +40,7 @@ impl ObjectFile {
linker.add_object(self.obj_file.path())?;

// Link the object
linker.build_shared_object(&output_path)?;
linker.build_shared_object(output_path)?;
linker.finalize()?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_codegen/src/code_gen/symbols.rs
Expand Up @@ -361,7 +361,7 @@ fn gen_get_info_fn<'ink>(
}

// Run the function optimizer on the generate function
function::create_pass_manager(&context.module, optimization_level).run_on(&get_symbols_fn);
function::create_pass_manager(context.module, optimization_level).run_on(&get_symbols_fn);
}

/// Generates a method `void set_allocator_handle(void*)` that stores the argument into the global
Expand Down
8 changes: 4 additions & 4 deletions crates/mun_codegen/src/ir/body.rs
Expand Up @@ -566,7 +566,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
*param
} else if let Some(ptr) = self.pat_to_local.get(&pat) {
let name = self.pat_to_name.get(&pat).expect("could not find pat name");
self.builder.build_load(*ptr, &name)
self.builder.build_load(*ptr, name)
} else {
unreachable!("could not find the pattern..");
}
Expand Down Expand Up @@ -1078,7 +1078,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
function,
);
self.builder
.build_call(ptr_value, &args, &function.name(self.db).to_string())
.build_call(ptr_value, args, &function.name(self.db).to_string())
} else {
let llvm_function = self.function_map.get(&function).unwrap_or_else(|| {
panic!(
Expand All @@ -1087,7 +1087,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
)
});
self.builder
.build_call(*llvm_function, &args, &function.name(self.db).to_string())
.build_call(*llvm_function, args, &function.name(self.db).to_string())
}
}

Expand Down Expand Up @@ -1338,7 +1338,7 @@ impl<'db, 'ink, 't> BodyIrGenerator<'db, 'ink, 't> {
hir_struct_name, name, field_idx
)
});
Some(self.builder.build_load(field_ptr, &field_ir_name))
Some(self.builder.build_load(field_ptr, field_ir_name))
} else {
let receiver_value = self.gen_expr(receiver_expr)?;
let receiver_value = self.opt_deref_value(receiver_expr, receiver_value);
Expand Down
4 changes: 2 additions & 2 deletions crates/mun_codegen/src/ir/file.rs
Expand Up @@ -93,7 +93,7 @@ pub(crate) fn gen_file_ir<'db, 'ink>(
&group_ir.type_table,
external_globals.clone(),
&code_gen.hir_types,
&module_group,
module_group,
);

code_gen.gen_fn_body();
Expand All @@ -110,7 +110,7 @@ pub(crate) fn gen_file_ir<'db, 'ink>(
&group_ir.type_table,
external_globals.clone(),
&code_gen.hir_types,
&module_group,
module_group,
);

code_gen.gen_fn_wrapper();
Expand Down
8 changes: 4 additions & 4 deletions crates/mun_codegen/src/ir/file_group.rs
Expand Up @@ -48,7 +48,7 @@ pub(crate) fn gen_file_group_ir<'db, 'ink>(
match def {
ModuleDef::Function(f) if !f.is_extern(code_gen.db) => {
intrinsics::collect_fn_body(
&code_gen.context,
code_gen.context,
code_gen.target_machine.get_target_data(),
code_gen.db,
&mut intrinsics_map,
Expand All @@ -62,7 +62,7 @@ pub(crate) fn gen_file_group_ir<'db, 'ink>(
&& !fn_sig.marshallable(code_gen.db)
{
intrinsics::collect_wrapper_body(
&code_gen.context,
code_gen.context,
code_gen.target_machine.get_target_data(),
&mut intrinsics_map,
&mut needs_alloc,
Expand Down Expand Up @@ -105,13 +105,13 @@ pub(crate) fn gen_file_group_ir<'db, 'ink>(

let target_data = code_gen.target_machine.get_target_data();
let type_context = IrTypeContext {
context: &code_gen.context,
context: code_gen.context,
target_data: &target_data,
struct_types: &code_gen.rust_types,
};
let value_context = IrValueContext {
type_context: &type_context,
context: &code_gen.context,
context: code_gen.context,
module: &llvm_module,
};
let mut type_table_builder = TypeTableBuilder::new(
Expand Down
6 changes: 3 additions & 3 deletions crates/mun_codegen/src/ir/intrinsics.rs
Expand Up @@ -40,7 +40,7 @@ fn collect_expr<'db, 'ink>(
if let Expr::Call { callee, .. } = expr {
match infer[*callee].as_callable_def() {
Some(hir::CallableDef::Struct(_)) => {
collect_intrinsic(context, &target, &intrinsics::new, intrinsics);
collect_intrinsic(context, target, &intrinsics::new, intrinsics);
// self.collect_intrinsic(module, entries, &intrinsics::drop);
*needs_alloc = true;
}
Expand All @@ -50,7 +50,7 @@ fn collect_expr<'db, 'ink>(
}

if let Expr::RecordLit { .. } = expr {
collect_intrinsic(context, &target, &intrinsics::new, intrinsics);
collect_intrinsic(context, target, &intrinsics::new, intrinsics);
// self.collect_intrinsic(module, entries, &intrinsics::drop);
*needs_alloc = true;
}
Expand All @@ -60,7 +60,7 @@ fn collect_expr<'db, 'ink>(
if let Some((ValueNs::StructId(_), _)) =
resolver.resolve_path_as_value_fully(db.upcast(), path)
{
collect_intrinsic(context, &target, &intrinsics::new, intrinsics);
collect_intrinsic(context, target, &intrinsics::new, intrinsics);
// self.collect_intrinsic( module, entries, &intrinsics::drop);
*needs_alloc = true;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_compiler/src/lib.rs
Expand Up @@ -68,7 +68,7 @@ impl CompilerOptions {

/// Returns true if the given path is considered to be a Mun source file
pub fn is_source_file<P: AsRef<Path>>(p: P) -> bool {
p.as_ref().extension() == Some(&OsStr::new("mun"))
p.as_ref().extension() == Some(OsStr::new("mun"))
}

/// Returns and creates the output dir for the specified package
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_diagnostics/src/hir/unresolved_value.rs
Expand Up @@ -38,7 +38,7 @@ impl<'db, 'diag, DB: mun_hir::HirDatabase> UnresolvedValue<'db, 'diag, DB> {
let parse = db.parse(diag.file);

// Get the text of the value as a string
let value_name = diag.expr.to_node(&parse.tree().syntax()).text().to_string();
let value_name = diag.expr.to_node(parse.tree().syntax()).text().to_string();

UnresolvedValue {
_db: db,
Expand Down
4 changes: 2 additions & 2 deletions crates/mun_hir/src/code_model/struct/validator.rs
Expand Up @@ -38,7 +38,7 @@ impl<'a> StructValidator<'a> {

let field_types = public_fields.map(|(_, field_data)| {
let type_ref = field_data.type_ref;
let ty = Ty::from_hir(self.db, &resolver, &struct_data.type_ref_map(), type_ref).ty;
let ty = Ty::from_hir(self.db, &resolver, struct_data.type_ref_map(), type_ref).ty;
(ty, type_ref)
});

Expand All @@ -51,7 +51,7 @@ impl<'a> StructValidator<'a> {
};

field_types
.filter(|(ty, _)| !type_is_allowed(&ty))
.filter(|(ty, _)| !type_is_allowed(ty))
.for_each(|(_, type_ref)| {
sink.push(ExportedPrivate {
file: self.file_id,
Expand Down
4 changes: 2 additions & 2 deletions crates/mun_hir/src/expr/scope.rs
Expand Up @@ -52,7 +52,7 @@ impl ExprScopes {
};
let root = scopes.root_scope();
scopes.add_params_bindings(body, root, body.params().iter().map(|p| &p.0));
compute_expr_scopes(body.body_expr(), &body, &mut scopes, root);
compute_expr_scopes(body.body_expr(), body, &mut scopes, root);
scopes
}

Expand Down Expand Up @@ -152,7 +152,7 @@ fn compute_expr_scopes(expr: ExprId, body: &Body, scopes: &mut ExprScopes, scope
scopes.set_scope(expr, scope);
match &body[expr] {
Expr::Block { statements, tail } => {
compute_block_scopes(&statements, *tail, body, scopes, scope);
compute_block_scopes(statements, *tail, body, scopes, scope);
}
e => e.walk_child_exprs(|e| compute_expr_scopes(e, body, scopes, scope)),
};
Expand Down
4 changes: 2 additions & 2 deletions crates/mun_hir/src/expr/validator.rs
Expand Up @@ -55,7 +55,7 @@ impl<'a> ExprValidator<'a> {
.iter()
.chain(std::iter::once(ret_type_ref))
.map(|type_ref| {
let ty = Ty::from_hir(self.db, &resolver, &fn_data.type_ref_map(), *type_ref).ty;
let ty = Ty::from_hir(self.db, &resolver, fn_data.type_ref_map(), *type_ref).ty;
(ty, type_ref)
});

Expand All @@ -69,7 +69,7 @@ impl<'a> ExprValidator<'a> {

let file_id = self.func.source(self.db.upcast()).file_id;
param_types
.filter(|(ty, _)| !type_is_allowed(&ty))
.filter(|(ty, _)| !type_is_allowed(ty))
.for_each(|(_, type_ref)| {
sink.push(ExportedPrivate {
file: file_id,
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_hir/src/item_tree/lower.rs
Expand Up @@ -76,7 +76,7 @@ impl Context {
ModItem::Import(_) => None,
};
if let Some(name) = name {
if let Some(first_item) = set.get(&name) {
if let Some(first_item) = set.get(name) {
self.diagnostics
.push(diagnostics::ItemTreeDiagnostic::DuplicateDefinition {
name: name.clone(),
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_hir/src/module_tree.rs
Expand Up @@ -73,7 +73,7 @@ impl ModuleTree {
{
// Iterate over all segments of the relative path and construct modules on the way
let mut module_id = root;
for path_segment in path_to_module_path(&relative_path)
for path_segment in path_to_module_path(relative_path)
.into_iter()
.map(Name::new)
{
Expand Down
4 changes: 2 additions & 2 deletions crates/mun_hir/src/name_resolution/path_resolution.rs
Expand Up @@ -90,7 +90,7 @@ impl PackageDefs {
Some((idx, segment)) => (idx, segment),
None => return ResolvePathResult::empty(ReachedFixedPoint::Yes),
};
self.resolve_name_in_module(db, original_module, &segment)
self.resolve_name_in_module(db, original_module, segment)
}
PathKind::Super(lvl) => {
let m = successors(Some(original_module), |m| self.module_tree[*m].parent)
Expand Down Expand Up @@ -127,7 +127,7 @@ impl PackageDefs {
};

curr_per_ns = match curr {
ItemDefinitionId::ModuleId(module) => self[module.local_id].get(&segment),
ItemDefinitionId::ModuleId(module) => self[module.local_id].get(segment),
// TODO: Enum variants
s => {
return ResolvePathResult::with(
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_hir/src/package_defs/collector.rs
Expand Up @@ -526,7 +526,7 @@ impl<'a> ModCollectorContext<'a, '_> {
fn collect_import(&mut self, id: LocalItemTreeId<item_tree::Import>) {
self.def_collector.unresolved_imports.push(ImportDirective {
module_id: self.module_id,
import: Import::from_use(&self.item_tree, InFile::new(self.file_id, id)),
import: Import::from_use(self.item_tree, InFile::new(self.file_id, id)),
status: PartiallyResolvedImport::Unresolved,
});
}
Expand Down
6 changes: 3 additions & 3 deletions crates/mun_hir/src/path.rs
Expand Up @@ -134,18 +134,18 @@ fn lower_use_tree(
if let Some(segment) = ast_path.segment() {
if segment.kind() == Some(ast::PathSegmentKind::SelfKw) {
if let Some(prefix) = prefix {
cb(prefix, &tree, false, alias);
cb(prefix, tree, false, alias);
return;
}
}
}
}
if let Some(path) = convert_path(prefix, &ast_path) {
cb(path, &tree, is_glob, alias)
cb(path, tree, is_glob, alias)
}
} else if is_glob {
if let Some(prefix) = prefix {
cb(prefix, &tree, is_glob, None)
cb(prefix, tree, is_glob, None)
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions crates/mun_hir/src/resolve.rs
Expand Up @@ -172,8 +172,7 @@ impl Resolver {

Scope::ModuleScope(m) => {
let (module_def, idx) =
m.package_defs
.resolve_path_in_module(db, m.module_id, &path);
m.package_defs.resolve_path_in_module(db, m.module_id, path);
return match idx {
None => {
let (value, vis) = to_value_ns(module_def)?;
Expand Down Expand Up @@ -235,8 +234,7 @@ impl Resolver {
Scope::ExprScope(_) => continue,
Scope::ModuleScope(m) => {
let (module_def, idx) =
m.package_defs
.resolve_path_in_module(db, m.module_id, &path);
m.package_defs.resolve_path_in_module(db, m.module_id, path);
let (res, vis) = to_type_ns(module_def)?;
return Some((res, vis, idx));
}
Expand Down
2 changes: 1 addition & 1 deletion crates/mun_hir/src/source_id.rs
Expand Up @@ -66,7 +66,7 @@ type ErasedFileAstId = Idx<SyntaxNodePtr>;

impl AstIdMap {
pub(crate) fn ast_id_map_query(db: &dyn AstDatabase, file_id: FileId) -> Arc<AstIdMap> {
let map = AstIdMap::from_source(&db.parse(file_id).tree().syntax());
let map = AstIdMap::from_source(db.parse(file_id).tree().syntax());
Arc::new(map)
}

Expand Down
6 changes: 3 additions & 3 deletions crates/mun_hir/src/ty.rs
Expand Up @@ -337,9 +337,9 @@ impl HirDisplay for Ty {
write!(f, ")")
}
TyKind::InferenceVar(tv) => match tv {
InferTy::TypeVar(tv) => write!(f, "'{}", tv.0),
InferTy::IntVar(_) => write!(f, "{{integer}}"),
InferTy::FloatVar(_) => write!(f, "{{float}}"),
InferTy::Type(tv) => write!(f, "'{}", tv.0),
InferTy::Int(_) => write!(f, "{{integer}}"),
InferTy::Float(_) => write!(f, "{{float}}"),
},
TyKind::TypeAlias(def) => write!(f, "{}", def.name(f.db)),
TyKind::Never => write!(f, "never"),
Expand Down

0 comments on commit d07126b

Please sign in to comment.