forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#57407 - mehcode:stabilize-extern-crate-self…
…, r=Centril Stabilize extern_crate_self Fixes rust-lang#56409
- Loading branch information
Showing
10 changed files
with
49 additions
and
28 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 was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
src/test/ui/feature-gates/feature-gate-extern_crate_self.stderr
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
...test/ui/imports/extern-crate-self-fail.rs → ...tern-crate-self/extern-crate-self-fail.rs
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
4 changes: 2 additions & 2 deletions
4
.../ui/imports/extern-crate-self-fail.stderr → ...-crate-self/extern-crate-self-fail.stderr
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
16 changes: 16 additions & 0 deletions
16
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-alias.rs
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,16 @@ | ||
// run-pass | ||
|
||
// Test that a macro can correctly expand the alias | ||
// in an `extern crate self as ALIAS` item. | ||
|
||
fn the_answer() -> usize { 42 } | ||
|
||
macro_rules! alias_self { | ||
($alias:ident) => { extern crate self as $alias; } | ||
} | ||
|
||
alias_self!(the_alias); | ||
|
||
fn main() { | ||
assert_eq!(the_alias::the_answer(), 42); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-item.rs
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,12 @@ | ||
// compile-pass | ||
|
||
// Test that `extern crate self;` is accepted | ||
// syntactically as an item for use in a macro. | ||
|
||
macro_rules! accept_item { ($x:item) => {} } | ||
|
||
accept_item! { | ||
extern crate self; | ||
} | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/imports/extern-crate-self/extern-crate-self-macro-self.rs
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,16 @@ | ||
// run-pass | ||
|
||
// Test that a macro can correctly expand `self` in | ||
// an `extern crate self as ALIAS` item. | ||
|
||
fn the_answer() -> usize { 42 } | ||
|
||
macro_rules! extern_something { | ||
($alias:ident) => { extern crate $alias as the_alias; } | ||
} | ||
|
||
extern_something!(self); | ||
|
||
fn main() { | ||
assert_eq!(the_alias::the_answer(), 42); | ||
} |
2 changes: 0 additions & 2 deletions
2
...test/ui/imports/extern-crate-self-pass.rs → ...tern-crate-self/extern-crate-self-pass.rs
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
// compile-pass | ||
|
||
#![feature(extern_crate_self)] | ||
|
||
extern crate self as foo; | ||
|
||
struct S; | ||
|