Skip to content

Commit

Permalink
feat: test precise capturing
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp committed Nov 12, 2024
1 parent 34f5f51 commit cd6eb59
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 33 deletions.
68 changes: 36 additions & 32 deletions .github/workflows/rustlib.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
on:
pull_request:
paths:
- '**.rs'
- '**/Cargo.toml'
- "**.rs"
- "**/Cargo.toml"
workflow_dispatch:

name: Library testing
Expand All @@ -12,47 +12,51 @@ jobs:
name: Rustdoc
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Checkout sources
uses: actions/checkout@v4

- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Install nightly toolchain
uses: dtolnay/rust-toolchain@nightly

- name: Cache dependencies
uses: Swatinem/rust-cache@v2
- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Check rustdoc build
run: RUSTDOCFLAGS='--cfg docsrs' cargo +nightly doc --features debug -Zunstable-options -Zrustdoc-scrape-examples
- name: Check rustdoc build
run: RUSTDOCFLAGS='--cfg docsrs' cargo +nightly doc --features debug -Zunstable-options -Zrustdoc-scrape-examples

tests:
name: Tests
strategy:
matrix:
rust:
- stable
- beta
- nightly
- 1.70.0 # current MSRV
- 1.82.0 # precise capturing
- stable
- beta
- nightly
os:
- macos-latest
- ubuntu-latest
- windows-latest
- macos-latest
- ubuntu-latest
- windows-latest
features:
- "" # default features
- "--features forbid_unsafe"
- "" # default features
- "--features forbid_unsafe"

runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Check that tests run
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --verbose ${{ matrix.features }}
- name: Checkout sources
uses: actions/checkout@v4

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}

- name: Cache dependencies
uses: Swatinem/rust-cache@v2

- name: Check that tests run
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --verbose ${{ matrix.features }}
8 changes: 7 additions & 1 deletion logos-codegen/src/generator/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ impl<'a> Generator<'a> {
let arg = &inline.arg;
let body = &inline.body;

#[cfg(not(rust_1_82))]
let ret = quote!(impl CallbackResult<'s, #ty, #this>);

#[cfg(rust_1_82)]
let ret = quote!(impl CallbackResult<'s, #ty, #this> + use<'a>);

quote! {
#bump

#[inline]
fn callback<'s>(#arg: &mut Lexer<'s>) -> impl CallbackResult<'s, #ty, #this> {
fn callback<'s>(#arg: &mut Lexer<'s>) -> #ret {
#body
}

Expand Down

0 comments on commit cd6eb59

Please sign in to comment.