Skip to content

Commit

Permalink
Add ICE for rust-lang/rust#59191
Browse files Browse the repository at this point in the history
  • Loading branch information
KamilaBorowska committed Jan 13, 2020
1 parent fe71d4d commit c30a322
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions ices/59191.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,39 @@
#!/bin/bash

tmp="$(mktemp -d)"

if [[ ! $tmp || ! -d $tmp ]]
then
echo "Could not create temporary directory"
exit 1
fi

cleanup() {
rm -r "$tmp"
}

trap cleanup EXIT

cd "$tmp"

rustc --crate-type proc-macro - <<END
extern crate proc_macro;
use proc_macro::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
#[proc_macro_attribute]
pub fn no_main(_attrs: TokenStream, input: TokenStream) -> TokenStream {
let mut ts = TokenStream::new();
ts.extend(vec![
TokenTree::Ident(Ident::new("fn", Span::call_site())),
TokenTree::Ident(Ident::new("main", Span::call_site())),
TokenTree::Group(Group::new(Delimiter::Parenthesis, TokenStream::new())),
TokenTree::Group(Group::new(Delimiter::Brace, input)),
]);
ts
}
END

rustc --extern no_main=librust_out.so - <<END
#![no_main::no_main]
END

0 comments on commit c30a322

Please sign in to comment.