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

generator: Emit new c"" CStr literals #848

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
- run: cargo check --workspace --all-targets --all-features

check_msrv:
name: Check ash, ash-window and ash-rewrite MSRV (1.69.0)
name: Check ash, ash-window and ash-rewrite MSRV (1.77.0)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.69.0
- uses: dtolnay/rust-toolchain@1.77.0
- name: Check ash, ash-window and ash-rewrite
run: cargo check -p ash -p ash-rewrite -p ash-window --all-features
- name: Check ash with no_std
Expand Down
3 changes: 1 addition & 2 deletions ash-examples/src/bin/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::default::Default;
use std::error::Error;
use std::ffi;
use std::io::Cursor;
use std::mem;
use std::os::raw::c_void;
Expand Down Expand Up @@ -567,7 +566,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.create_pipeline_layout(&layout_create_info, None)
.unwrap();

let shader_entry_name = ffi::CStr::from_bytes_with_nul_unchecked(b"main\0");
let shader_entry_name = c"main";
let shader_stage_create_infos = [
vk::PipelineShaderStageCreateInfo {
module: vertex_shader_module,
Expand Down
3 changes: 1 addition & 2 deletions ash-examples/src/bin/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use std::default::Default;
use std::error::Error;
use std::ffi;
use std::io::Cursor;
use std::mem;

Expand Down Expand Up @@ -229,7 +228,7 @@ fn main() -> Result<(), Box<dyn Error>> {
.create_pipeline_layout(&layout_create_info, None)
.unwrap();

let shader_entry_name = ffi::CStr::from_bytes_with_nul_unchecked(b"main\0");
let shader_entry_name = c"main";
let shader_stage_create_infos = [
vk::PipelineShaderStageCreateInfo {
module: vertex_shader_module,
Expand Down
6 changes: 2 additions & 4 deletions ash-examples/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,9 @@ impl ExampleBase {
.build(&event_loop)
.unwrap();
let entry = Entry::linked();
let app_name = ffi::CStr::from_bytes_with_nul_unchecked(b"VulkanTriangle\0");
let app_name = c"VulkanTriangle";

let layer_names = [ffi::CStr::from_bytes_with_nul_unchecked(
b"VK_LAYER_KHRONOS_validation\0",
)];
let layer_names = [c"VK_LAYER_KHRONOS_validation"];
let layers_names_raw: Vec<*const c_char> = layer_names
.iter()
.map(|raw_name| raw_name.as_ptr())
Expand Down
2 changes: 1 addition & 1 deletion ash-window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ categories = [
"rendering::graphics-api"
]
edition = "2021"
rust-version = "1.69.0"
rust-version = "1.77.0"

[dependencies]
ash = { path = "../ash", version = "0.38", default-features = false, features = ["std"] }
Expand Down
2 changes: 1 addition & 1 deletion ash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ categories = [
"rendering::graphics-api"
]
edition = "2021"
rust-version = "1.69.0"
rust-version = "1.77.0"

[dependencies]
libloading = { version = "0.8", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions ash/src/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl Entry {
#[inline]
pub unsafe fn try_enumerate_instance_version(&self) -> VkResult<Option<u32>> {
let enumerate_instance_version: Option<vk::PFN_vkEnumerateInstanceVersion> = {
let name = ffi::CStr::from_bytes_with_nul_unchecked(b"vkEnumerateInstanceVersion\0");
let name = c"vkEnumerateInstanceVersion";
mem::transmute((self.static_fn.get_instance_proc_addr)(
vk::Instance::null(),
name.as_ptr(),
Expand Down Expand Up @@ -333,7 +333,7 @@ impl crate::StaticFn {
{
Ok(Self {
get_instance_proc_addr: unsafe {
let cname = ffi::CStr::from_bytes_with_nul_unchecked(b"vkGetInstanceProcAddr\0");
let cname = c"vkGetInstanceProcAddr";
let val = _f(cname);
if val.is_null() {
return Err(MissingEntryPoint);
Expand Down
Loading