Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5965af7
rustdoc: render late-bound lifetimes in generic parameter list of cro…
fmease Nov 2, 2022
9cdab67
rustdoc: render unnamed arguments as underscores in cross-crate funct…
fmease Nov 2, 2022
2d9755f
rustdoc: move cross-crate lifetime/outlives bounds on GAT params from…
fmease Nov 2, 2022
1ac7034
rustdoc: render `for<>` param lists of cross-crate trait-object types
fmease Nov 2, 2022
71561f8
rustdoc: render the return type of cross-crate `Fn`-family trait boun…
fmease Nov 2, 2022
7ec50b6
rustdoc: add test for cross-crate trait-object types
fmease Nov 2, 2022
5ccaed2
rustdoc: create helper `GenericParamDef::lifetime`
fmease Nov 2, 2022
299bc61
Add type_array to BaseTypeMethods
Ayush1325 Nov 6, 2022
e15c406
fix: typo
Rejyr Nov 6, 2022
b34fdd3
rustdoc: remove unused CSS `#sidebar-filler`
notriddle Nov 6, 2022
24d86a1
Migrate rust logo filter to CSS variables
GuillaumeGomez Nov 6, 2022
f414715
LLVM 16: Update RISCV data layout
TimNN Nov 6, 2022
0e23d90
Extend rust-logo GUI test to check there is no filter for other logos
GuillaumeGomez Nov 6, 2022
dba6fc3
Make underscore_literal_suffix a hard error.
nnethercote Nov 3, 2022
f28875e
Distinguish `--dry-run` from the automatic dry run check
jyn514 Nov 6, 2022
fd1a393
Print "Checking/Building ..." message even when --dry-run is passed
jyn514 Nov 6, 2022
5fadbd0
Rollup merge of #103885 - fmease:rustdoc-various-cross-crate-reexport…
Nov 6, 2022
ceff97a
Rollup merge of #103914 - nnethercote:close-42326, r=petrochenkov
Nov 6, 2022
874e795
Rollup merge of #104045 - Ayush1325:type_array, r=nikic
Nov 6, 2022
77d938c
Rollup merge of #104059 - Rejyr:rustc_middle-lint-typo, r=petrochenkov
Nov 6, 2022
4d5860c
Rollup merge of #104062 - notriddle:notriddle/sidebar-filler, r=Guill…
Nov 6, 2022
94334d3
Rollup merge of #104065 - GuillaumeGomez:css-migrate-logo-filter, r=n…
Nov 6, 2022
6b59653
Rollup merge of #104066 - TimNN:riscv-layout, r=nikic
Nov 6, 2022
e35059d
Rollup merge of #104078 - jyn514:dry-run-progress, r=Mark-Simulacrum
Nov 6, 2022
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
42 changes: 21 additions & 21 deletions compiler/rustc_codegen_gcc/src/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,27 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
fn val_ty(&self, value: RValue<'gcc>) -> Type<'gcc> {
value.get_type()
}

fn type_array(&self, ty: Type<'gcc>, mut len: u64) -> Type<'gcc> {
if let Some(struct_type) = ty.is_struct() {
if struct_type.get_field_count() == 0 {
// NOTE: since gccjit only supports i32 for the array size and libcore's tests uses a
// size of usize::MAX in test_binary_search, we workaround this by setting the size to
// zero for ZSTs.
// FIXME(antoyo): fix gccjit API.
len = 0;
}
}

// NOTE: see note above. Some other test uses usize::MAX.
if len == u64::MAX {
len = 0;
}

let len: i32 = len.try_into().expect("array len");

self.context.new_array_type(None, ty, len)
}
}

impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
Expand All @@ -227,27 +248,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
self.context.new_opaque_struct_type(None, name)
}

pub fn type_array(&self, ty: Type<'gcc>, mut len: u64) -> Type<'gcc> {
if let Some(struct_type) = ty.is_struct() {
if struct_type.get_field_count() == 0 {
// NOTE: since gccjit only supports i32 for the array size and libcore's tests uses a
// size of usize::MAX in test_binary_search, we workaround this by setting the size to
// zero for ZSTs.
// FIXME(antoyo): fix gccjit API.
len = 0;
}
}

// NOTE: see note above. Some other test uses usize::MAX.
if len == u64::MAX {
len = 0;
}

let len: i32 = len.try_into().expect("array len");

self.context.new_array_type(None, ty, len)
}

pub fn type_bool(&self) -> Type<'gcc> {
self.context.new_type::<bool>()
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ impl<'ll> CodegenCx<'ll, '_> {
pub(crate) fn type_variadic_func(&self, args: &[&'ll Type], ret: &'ll Type) -> &'ll Type {
unsafe { llvm::LLVMFunctionType(ret, args.as_ptr(), args.len() as c_uint, True) }
}

pub(crate) fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type {
unsafe { llvm::LLVMRustArrayType(ty, len) }
}
}

impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
Expand Down Expand Up @@ -231,6 +227,10 @@ impl<'ll, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> {
fn val_ty(&self, v: &'ll Value) -> &'ll Type {
common::val_ty(v)
}

fn type_array(&self, ty: &'ll Type, len: u64) -> &'ll Type {
unsafe { llvm::LLVMRustArrayType(ty, len) }
}
}

impl Type {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_codegen_ssa/src/traits/type_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub trait BaseTypeMethods<'tcx>: Backend<'tcx> {
fn type_f32(&self) -> Self::Type;
fn type_f64(&self) -> Self::Type;

fn type_array(&self, ty: Self::Type, len: u64) -> Self::Type;
fn type_func(&self, args: &[Self::Type], ret: Self::Type) -> Self::Type;
fn type_struct(&self, els: &[Self::Type], packed: bool) -> Self::Type;
fn type_kind(&self, ty: Self::Type) -> TypeKind;
Expand Down