Skip to content
This repository was archived by the owner on May 23, 2024. It is now read-only.

Commit 1bb4e11

Browse files
authored
Merge pull request #254 from xfix/59191
Add ICE for rust-lang/rust#59191
2 parents 0e7fc9c + ea055ba commit 1bb4e11

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

ices/59191.sh

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
3+
tmp="$(mktemp -d)"
4+
5+
if [[ ! $tmp || ! -d $tmp ]]
6+
then
7+
echo "Could not create temporary directory"
8+
exit 1
9+
fi
10+
11+
cleanup() {
12+
rm -r "$tmp"
13+
}
14+
15+
trap cleanup EXIT
16+
17+
cd "$tmp"
18+
19+
rustc --crate-type proc-macro - <<END
20+
extern crate proc_macro;
21+
22+
use proc_macro::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
23+
24+
#[proc_macro_attribute]
25+
pub fn no_main(_attrs: TokenStream, input: TokenStream) -> TokenStream {
26+
let mut ts = TokenStream::new();
27+
ts.extend(vec![
28+
TokenTree::Ident(Ident::new("fn", Span::call_site())),
29+
TokenTree::Ident(Ident::new("main", Span::call_site())),
30+
TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())),
31+
TokenTree::Group(Group::new(Delimiter::Brace, input)),
32+
]);
33+
ts
34+
}
35+
END
36+
37+
rustc --extern no_main=librust_out.so - <<END
38+
#![no_main::no_main]
39+
END

0 commit comments

Comments
 (0)