forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#98181 - JohnTitor:rollup-65ztwnz, r=JohnTitor
Rollup of 5 pull requests Successful merges: - rust-lang#97377 (Do not suggest adding semicolon/changing delimiters for macros in item position that originates in macros) - rust-lang#97675 (Make `std::mem::needs_drop` accept `?Sized`) - rust-lang#98118 (Test NLL fix of bad lifetime inference for reference captured in closure.) - rust-lang#98166 (Add rustdoc-json regression test for rust-lang#98009) - rust-lang#98169 (Keyword docs: Link to wikipedia article for dynamic dispatch) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
13 changed files
with
194 additions
and
26 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
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
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
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,38 @@ | ||
// compile-flags: --document-private-items --document-hidden-items | ||
|
||
// This is a regression test for #98009. | ||
|
||
// @has output_generics.json | ||
// @has - "$.index[*][?(@.name=='this_compiles')]" | ||
// @has - "$.index[*][?(@.name=='this_does_not')]" | ||
// @has - "$.index[*][?(@.name=='Events')]" | ||
// @has - "$.index[*][?(@.name=='Other')]" | ||
// @has - "$.index[*][?(@.name=='Trait')]" | ||
|
||
struct Events<R>(R); | ||
|
||
struct Other; | ||
|
||
pub trait Trait<T> { | ||
fn handle(value: T) -> Self; | ||
} | ||
|
||
impl<T, U> Trait<U> for T where T: From<U> { | ||
fn handle(_: U) -> Self { unimplemented!() } | ||
} | ||
|
||
impl<'a, R> Trait<&'a mut Events<R>> for Other { | ||
fn handle(_: &'a mut Events<R>) -> Self { unimplemented!() } | ||
} | ||
|
||
fn this_compiles<'a, R>(value: &'a mut Events<R>) { | ||
for _ in 0..3 { | ||
Other::handle(&mut *value); | ||
} | ||
} | ||
|
||
fn this_does_not<'a, R>(value: &'a mut Events<R>) { | ||
for _ in 0..3 { | ||
Other::handle(value); | ||
} | ||
} |
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,26 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
|
||
#![crate_type = "proc-macro"] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::TokenStream; | ||
|
||
fn compile_error() -> TokenStream { | ||
r#"compile_error!("")"#.parse().unwrap() | ||
} | ||
|
||
#[proc_macro_derive(MyTrait)] | ||
pub fn derive(input: TokenStream) -> TokenStream { | ||
compile_error() | ||
} | ||
#[proc_macro_attribute] | ||
pub fn attribute_macro(_attr: TokenStream, mut input: TokenStream) -> TokenStream { | ||
input.extend(compile_error()); | ||
input | ||
} | ||
#[proc_macro] | ||
pub fn fn_macro(_item: TokenStream) -> TokenStream { | ||
compile_error() | ||
} |
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 @@ | ||
// aux-build: issue-91800-macro.rs | ||
|
||
#[macro_use] | ||
extern crate issue_91800_macro; | ||
|
||
#[derive(MyTrait)] | ||
//~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon | ||
//~| ERROR proc-macro derive produced unparseable tokens | ||
#[attribute_macro] | ||
//~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon | ||
struct MyStruct; | ||
|
||
fn_macro! {} | ||
//~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon | ||
|
||
fn main() {} |
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,56 @@ | ||
error: macros that expand to items must be delimited with braces or followed by a semicolon | ||
--> $DIR/issue-91800.rs:6:10 | ||
| | ||
LL | #[derive(MyTrait)] | ||
| ^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: proc-macro derive produced unparseable tokens | ||
--> $DIR/issue-91800.rs:6:10 | ||
| | ||
LL | #[derive(MyTrait)] | ||
| ^^^^^^^ | ||
|
||
error: | ||
--> $DIR/issue-91800.rs:6:10 | ||
| | ||
LL | #[derive(MyTrait)] | ||
| ^^^^^^^ | ||
| | ||
= note: this error originates in the derive macro `MyTrait` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: macros that expand to items must be delimited with braces or followed by a semicolon | ||
--> $DIR/issue-91800.rs:9:1 | ||
| | ||
LL | #[attribute_macro] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: | ||
--> $DIR/issue-91800.rs:9:1 | ||
| | ||
LL | #[attribute_macro] | ||
| ^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the attribute macro `attribute_macro` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: macros that expand to items must be delimited with braces or followed by a semicolon | ||
--> $DIR/issue-91800.rs:13:1 | ||
| | ||
LL | fn_macro! {} | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `fn_macro` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: | ||
--> $DIR/issue-91800.rs:13:1 | ||
| | ||
LL | fn_macro! {} | ||
| ^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in the macro `fn_macro` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 7 previous errors | ||
|