forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#130758 - compiler-errors:ctype-recursion-limit, r=jieyouxu Revert "Add recursion limit to FFI safety lint" It's not necessarily clear if warning when we hit the recursion limit is the right thing to do, first of all. **More importantly**, this PR was implemented incorrectly in the first place; it was not decrementing the recursion limit when stepping out of a type, so it would trigger when a ctype has more than RECURSION_LIMIT fields *anywhere* in the type's set of recursively reachable fields. Reverts rust-lang#130598 Reopens rust-lang#130310 Fixes rust-lang#130757
- Loading branch information
Showing
6 changed files
with
50 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//@ known-bug: rust-lang/rust#130310 | ||
|
||
use std::marker::PhantomData; | ||
|
||
#[repr(C)] | ||
struct A<T> { | ||
a: *const A<A<T>>, | ||
p: PhantomData<T>, | ||
} | ||
|
||
extern "C" { | ||
fn f(a: *const A<()>); | ||
} | ||
|
||
fn main() {} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//@ check-pass | ||
|
||
#![recursion_limit = "5"] | ||
#![allow(unused)] | ||
#![deny(improper_ctypes)] | ||
|
||
#[repr(C)] | ||
struct F1(*const ()); | ||
#[repr(C)] | ||
struct F2(*const ()); | ||
#[repr(C)] | ||
struct F3(*const ()); | ||
#[repr(C)] | ||
struct F4(*const ()); | ||
#[repr(C)] | ||
struct F5(*const ()); | ||
#[repr(C)] | ||
struct F6(*const ()); | ||
|
||
#[repr(C)] | ||
struct B { | ||
f1: F1, | ||
f2: F2, | ||
f3: F3, | ||
f4: F4, | ||
f5: F5, | ||
f6: F6, | ||
} | ||
|
||
extern "C" fn foo(_: B) {} | ||
|
||
fn main() {} |