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

Continue compilation after check_mod_type_wf errors #120847

Merged
merged 2 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Use the correct char type on all platforms
  • Loading branch information
oli-obk committed Feb 14, 2024
commit 25806f8d8052e5dc5f57830c31996769132fc4f8
4 changes: 2 additions & 2 deletions tests/ui/const-generics/issues/issue-72352.full.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error[E0741]: using function pointers as const generic parameters is forbidden
--> $DIR/issue-72352.rs:7:42
--> $DIR/issue-72352.rs:8:42
|
LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize {
LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char) -> usize {
| ^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/const-generics/issues/issue-72352.min.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: using function pointers as const generic parameters is forbidden
--> $DIR/issue-72352.rs:7:42
--> $DIR/issue-72352.rs:8:42
|
LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize {
LL | unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char) -> usize {
| ^^^^^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
Expand Down
9 changes: 4 additions & 5 deletions tests/ui/const-generics/issues/issue-72352.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// revisions: full min

#![cfg_attr(full, feature(adt_const_params))]
#![cfg_attr(full, allow(incomplete_features))]

use std::ffi::{CStr, CString};
use std::ffi::{c_char, CStr, CString};

unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const i8) -> usize {
unsafe fn unsafely_do_the_thing<const F: fn(&CStr) -> usize>(ptr: *const c_char) -> usize {
//~^ ERROR: using function pointers as const generic parameters is forbidden
F(CStr::from_ptr(ptr))
}
Expand All @@ -16,7 +17,5 @@ fn safely_do_the_thing(s: &CStr) -> usize {
fn main() {
let baguette = CString::new("baguette").unwrap();
let ptr = baguette.as_ptr();
println!("{}", unsafe {
unsafely_do_the_thing::<safely_do_the_thing>(ptr)
});
println!("{}", unsafe { unsafely_do_the_thing::<safely_do_the_thing>(ptr) });
}
Loading