Auto merge of #57918 - Centril:rollup, r=Centril
Rollup of 7 pull requests Successful merges: - #57407 (Stabilize extern_crate_self) - #57703 (Make MutexGuard's Debug implementation more useful.) - #57764 (Fix some minor warnings) - #57825 (un-deprecate mem::zeroed) - #57827 (Ignore aarch64 in simd-intrinsic-generic-reduction) - #57908 (resolve: Fix span arithmetics in the import conflict error) - #57913 (Change crate-visibility-modifier issue number in The Unstable Book) Failed merges: r? @ghost
This commit is contained in:
commit
20c2cba61d
21 changed files with 156 additions and 84 deletions
|
|
@ -1,3 +0,0 @@
|
|||
extern crate self as foo; //~ ERROR `extern crate self` is unstable
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
error[E0658]: `extern crate self` is unstable (see issue #56409)
|
||||
--> $DIR/feature-gate-extern_crate_self.rs:1:1
|
||||
|
|
||||
LL | extern crate self as foo; //~ ERROR `extern crate self` is unstable
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= help: add #![feature(extern_crate_self)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -1,5 +1,3 @@
|
|||
#![feature(extern_crate_self)]
|
||||
|
||||
extern crate self; //~ ERROR `extern crate self;` requires renaming
|
||||
|
||||
#[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self`
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
error: `extern crate self;` requires renaming
|
||||
--> $DIR/extern-crate-self-fail.rs:3:1
|
||||
--> $DIR/extern-crate-self-fail.rs:1:1
|
||||
|
|
||||
LL | extern crate self; //~ ERROR `extern crate self;` requires renaming
|
||||
| ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;`
|
||||
|
||||
error: `macro_use` is not supported on `extern crate self`
|
||||
--> $DIR/extern-crate-self-fail.rs:5:1
|
||||
--> $DIR/extern-crate-self-fail.rs:3:1
|
||||
|
|
||||
LL | #[macro_use] //~ ERROR `macro_use` is not supported on `extern crate self`
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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() {}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
// compile-pass
|
||||
|
||||
#![feature(extern_crate_self)]
|
||||
|
||||
extern crate self as foo;
|
||||
|
||||
struct S;
|
||||
17
src/test/ui/issues/issue-56411.rs
Normal file
17
src/test/ui/issues/issue-56411.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
macro_rules! import {
|
||||
( $($name:ident),* ) => {
|
||||
$(
|
||||
mod $name;
|
||||
pub use self::$name;
|
||||
//~^ ERROR the name `issue_56411_aux` is defined multiple times
|
||||
//~| ERROR `issue_56411_aux` is private, and cannot be re-exported
|
||||
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
import!(issue_56411_aux);
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
31
src/test/ui/issues/issue-56411.stderr
Normal file
31
src/test/ui/issues/issue-56411.stderr
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
error[E0255]: the name `issue_56411_aux` is defined multiple times
|
||||
--> $DIR/issue-56411.rs:5:21
|
||||
|
|
||||
LL | mod $name;
|
||||
| ---------- previous definition of the module `issue_56411_aux` here
|
||||
LL | pub use self::$name;
|
||||
| ^^^^^^^^^^^
|
||||
| |
|
||||
| `issue_56411_aux` reimported here
|
||||
| you can use `as` to change the binding name of the import
|
||||
...
|
||||
LL | import!(issue_56411_aux);
|
||||
| ------------------------- in this macro invocation
|
||||
|
|
||||
= note: `issue_56411_aux` must be defined only once in the type namespace of this module
|
||||
|
||||
error[E0365]: `issue_56411_aux` is private, and cannot be re-exported
|
||||
--> $DIR/issue-56411.rs:5:21
|
||||
|
|
||||
LL | pub use self::$name;
|
||||
| ^^^^^^^^^^^ re-export of private `issue_56411_aux`
|
||||
...
|
||||
LL | import!(issue_56411_aux);
|
||||
| ------------------------- in this macro invocation
|
||||
|
|
||||
= note: consider declaring type or module `issue_56411_aux` with `pub`
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
Some errors occurred: E0255, E0365.
|
||||
For more information about an error, try `rustc --explain E0255`.
|
||||
5
src/test/ui/issues/issue_56411_aux.rs
Normal file
5
src/test/ui/issues/issue_56411_aux.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
// compile-pass
|
||||
|
||||
struct T {}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue