-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add feature gate for raw_dylib. #63948
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e70ffed
Add feature gate for raw_dylib.
crlf0710 3462b58
Add support for parsing #[link_ordinal] attribute.
crlf0710 eb49245
Address review comments.
crlf0710 dda10f2
Add more tests, fix span issue, improve diagnostics.
crlf0710 2dab187
Fix compilation error after rebase.
crlf0710 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,8 @@ | ||
#[link(name="foo")] | ||
extern { | ||
#[link_ordinal(42)] | ||
//~^ ERROR: the `#[link_ordinal]` attribute is an experimental feature | ||
fn foo(); | ||
} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib-2.stderr
This file contains hidden or 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,12 @@ | ||
error[E0658]: the `#[link_ordinal]` attribute is an experimental feature | ||
--> $DIR/feature-gate-raw-dylib-2.rs:3:5 | ||
| | ||
LL | #[link_ordinal(42)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/58713 | ||
= help: add `#![feature(raw_dylib)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains hidden or 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,5 @@ | ||
#[link(name="foo", kind="raw-dylib")] | ||
//~^ ERROR: kind="raw-dylib" is unstable | ||
extern {} | ||
|
||
fn main() {} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/rfc-2627-raw-dylib/feature-gate-raw-dylib.stderr
This file contains hidden or 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,12 @@ | ||
error[E0658]: kind="raw-dylib" is unstable | ||
--> $DIR/feature-gate-raw-dylib.rs:1:1 | ||
| | ||
LL | #[link(name="foo", kind="raw-dylib")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: for more information, see https://github.com/rust-lang/rust/issues/58713 | ||
= help: add `#![feature(raw_dylib)]` to the crate attributes to enable | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0658`. |
This file contains hidden or 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,12 @@ | ||
#![feature(raw_dylib)] | ||
//~^ WARN the feature `raw_dylib` is incomplete and may cause the compiler to crash | ||
|
||
#[link(name="foo")] | ||
extern { | ||
#[link_name="foo"] | ||
#[link_ordinal(42)] | ||
//~^ ERROR cannot use `#[link_name]` with `#[link_ordinal]` | ||
fn foo(); | ||
} | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/rfc-2627-raw-dylib/link-ordinal-and-name.stderr
This file contains hidden or 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,16 @@ | ||
warning: the feature `raw_dylib` is incomplete and may cause the compiler to crash | ||
--> $DIR/link-ordinal-and-name.rs:1:12 | ||
| | ||
LL | #![feature(raw_dylib)] | ||
| ^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: cannot use `#[link_name]` with `#[link_ordinal]` | ||
--> $DIR/link-ordinal-and-name.rs:7:5 | ||
| | ||
LL | #[link_ordinal(42)] | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
11 changes: 11 additions & 0 deletions
11
src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.rs
This file contains hidden or 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,11 @@ | ||
#![feature(raw_dylib)] | ||
//~^ WARN the feature `raw_dylib` is incomplete and may cause the compiler to crash | ||
|
||
#[link(name="foo")] | ||
extern { | ||
#[link_ordinal("JustMonika")] | ||
//~^ ERROR illegal ordinal format in `link_ordinal` | ||
fn foo(); | ||
} | ||
|
||
fn main() {} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/rfc-2627-raw-dylib/link-ordinal-invalid-format.stderr
This file contains hidden or 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,18 @@ | ||
warning: the feature `raw_dylib` is incomplete and may cause the compiler to crash | ||
--> $DIR/link-ordinal-invalid-format.rs:1:12 | ||
| | ||
LL | #![feature(raw_dylib)] | ||
| ^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: illegal ordinal format in `link_ordinal` | ||
--> $DIR/link-ordinal-invalid-format.rs:6:5 | ||
| | ||
LL | #[link_ordinal("JustMonika")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: an unsuffixed integer value, e.g., `1`, is expected | ||
|
||
error: aborting due to previous error | ||
|
This file contains hidden or 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,11 @@ | ||
#![feature(raw_dylib)] | ||
//~^ WARN the feature `raw_dylib` is incomplete and may cause the compiler to crash | ||
|
||
#[link(name="foo")] | ||
extern { | ||
#[link_ordinal(18446744073709551616)] | ||
//~^ ERROR ordinal value in `link_ordinal` is too large: `18446744073709551616` | ||
fn foo(); | ||
} | ||
|
||
fn main() {} |
18 changes: 18 additions & 0 deletions
18
src/test/ui/rfc-2627-raw-dylib/link-ordinal-too-large.stderr
This file contains hidden or 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,18 @@ | ||
warning: the feature `raw_dylib` is incomplete and may cause the compiler to crash | ||
--> $DIR/link-ordinal-too-large.rs:1:12 | ||
| | ||
LL | #![feature(raw_dylib)] | ||
| ^^^^^^^^^ | ||
| | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: ordinal value in `link_ordinal` is too large: `18446744073709551616` | ||
--> $DIR/link-ordinal-too-large.rs:6:5 | ||
| | ||
LL | #[link_ordinal(18446744073709551616)] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: the value may not exceed `std::usize::MAX` | ||
|
||
error: aborting due to previous error | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.