Skip to content
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

add support for cargo-binstall #1958

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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
60 changes: 60 additions & 0 deletions .github/workflows/upload-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: upload release

on:
workflow_dispatch:
inputs:
tag:
type: string
description: Tag
required: true

permissions:
contents: write

jobs:
upload-release:
name: upload-release
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
pkg_fmt: .tar.gz
binary_ext: ''
- os: macos-13
target: x86_64-apple-darwin
pkg_fmt: .tar.gz
binary_ext: ''
- os: macos-14
target: aarch64-apple-darwin
pkg_fmt: .tar.gz
binary_ext: ''
- os: windows-2022
target: x86_64-pc-windows-msvc
pkg_fmt: .zip
binary_ext: .exe
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}
- name: Upload cargo-pgrx
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
cargo build -p cargo-pgrx --bin cargo-pgrx --target ${{ matrix.target }} --release

mkdir -p build
cp README.md ./build/
cp LICENSE ./build/
cp ./target/${{ matrix.target }}/release/cargo-pgrx${{ matrix.binary_ext }} ./build/

DIST=cargo-pgrx-${{ github.event.inputs.tag }}-${{ matrix.target }}${{ matrix.pkg_fmt }}
if [ "${{ matrix.os }}" = "windows-2022" ]; then
(cd build && 7z a ../$DIST .)
else
tar czf $DIST -C build .
fi
gh release upload ${{ github.event.inputs.tag }} $DIST
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use pgrx::prelude::*;
#[pg_extern]
fn returns_tuple_with_lifetime(
value: &'static str,
) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
TableIterator::once((value, Some(value)))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
error[E0521]: borrowed data escapes outside of function
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:78
--> tests/compile-fail/table-iterators-arent-immortal.rs:6:87
|
3 | #[pg_extern]
| ------------
| |
| lifetime `'fcx` defined here
| in this procedural macro expansion
...
6 | ) -> TableIterator<(name!(a, &'static str), name!(b, Option<&'static str>))> {
| ______________________________________________________________________________^
6 | ) -> TableIterator<'static, (name!(a, &'static str), name!(b, Option<&'static str>))> {
| _______________________________________________________________________________________^
7 | | TableIterator::once((value, Some(value)))
8 | | }
| | ^
Expand Down
50 changes: 40 additions & 10 deletions pgrx/src/datum/unbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ unsafe impl UnboxDatum for str {
}

unsafe impl UnboxDatum for &str {
type As<'src> = &'src str where Self: 'src;
type As<'src>
= &'src str
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(datum: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -144,7 +147,10 @@ unsafe impl UnboxDatum for CStr {
}

unsafe impl UnboxDatum for &CStr {
type As<'src> = &'src CStr where Self: 'src;
type As<'src>
= &'src CStr
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(datum: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -166,7 +172,10 @@ unsafe impl UnboxDatum for [u8] {
}

unsafe impl UnboxDatum for &[u8] {
type As<'src> = &'src [u8] where Self: 'src;
type As<'src>
= &'src [u8]
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(datum: Datum<'src>) -> Self::As<'src>
where
Expand Down Expand Up @@ -293,7 +302,10 @@ unbox_with_fromdatum! {
}

unsafe impl UnboxDatum for PgHeapTuple<'_, crate::AllocatedByRust> {
type As<'src> = PgHeapTuple<'src, AllocatedByRust> where Self: 'src;
type As<'src>
= PgHeapTuple<'src, AllocatedByRust>
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -304,7 +316,10 @@ unsafe impl UnboxDatum for PgHeapTuple<'_, crate::AllocatedByRust> {
}

unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for Array<'_, T> {
type As<'src> = Array<'src, T> where Self: 'src;
type As<'src>
= Array<'src, T>
where
Self: 'src;
unsafe fn unbox<'src>(d: Datum<'src>) -> Array<'src, T>
where
Self: 'src,
Expand All @@ -314,7 +329,10 @@ unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for Array<'_, T> {
}

unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for VariadicArray<'_, T> {
type As<'src> = VariadicArray<'src, T> where Self: 'src;
type As<'src>
= VariadicArray<'src, T>
where
Self: 'src;
unsafe fn unbox<'src>(d: Datum<'src>) -> VariadicArray<'src, T>
where
Self: 'src,
Expand All @@ -324,7 +342,10 @@ unsafe impl<T: FromDatum + UnboxDatum> UnboxDatum for VariadicArray<'_, T> {
}

unsafe impl<T: FromDatum + UnboxDatum + RangeSubType> UnboxDatum for Range<T> {
type As<'src> = Range<T> where Self: 'src;
type As<'src>
= Range<T>
where
Self: 'src;
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Self: 'src,
Expand All @@ -345,7 +366,10 @@ unsafe impl<const P: u32, const S: u32> UnboxDatum for Numeric<P, S> {
}

unsafe impl<T> UnboxDatum for PgBox<T, AllocatedByPostgres> {
type As<'src> = PgBox<T> where Self: 'src;
type As<'src>
= PgBox<T>
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -356,7 +380,10 @@ unsafe impl<T> UnboxDatum for PgBox<T, AllocatedByPostgres> {
}

unsafe impl UnboxDatum for Json {
type As<'src> = Json where Self: 'src;
type As<'src>
= Json
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand All @@ -367,7 +394,10 @@ unsafe impl UnboxDatum for Json {
}

unsafe impl UnboxDatum for JsonB {
type As<'src> = JsonB where Self: 'src;
type As<'src>
= JsonB
where
Self: 'src;
#[inline]
unsafe fn unbox<'src>(d: Datum<'src>) -> Self::As<'src>
where
Expand Down
Loading