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

ices/59191.sh: fixed with errors #282

Closed
wants to merge 1 commit into from

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Feb 6, 2020

Issue: rust-lang/rust#59191

#!/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
=== stdout ===
=== stderr ===
error[E0658]: non-builtin inner attributes are unstable
 --> <anon>:1:1
  |
1 | #![no_main::no_main]
  | ^^^^^^^^^^^^^^^^^^^^
  |
  = note: for more information, see https://github.com/rust-lang/rust/issues/54726
  = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable

error[E0468]: an `extern crate` loading macros must be at the crate root

error: expected crate top-level item to be a module after macro expansion, found a function
 --> <anon>:1:1
  |
1 | #![no_main::no_main]
  | ^^^^^^^^^^^^^^^^^^^^

error[E0433]: failed to resolve: maybe a missing crate `std`?

error[E0601]: `main` function not found in crate `rust_out`
 --> <anon>:1:1
  |
1 | #![no_main::no_main]
  | ^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function at the crate level

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0433, E0468, E0601, E0658.
For more information about an error, try `rustc --explain E0433`.
==============

=== stdout ===
=== stderr ===
error[E0658]: non-builtin inner attributes are unstable
 --> <anon>:1:1
  |
1 | #![no_main::no_main]
  | ^^^^^^^^^^^^^^^^^^^^
  |
  = note: for more information, see rust-lang/rust#54726
  = help: add `#![feature(custom_inner_attributes)]` to the crate attributes to enable

error[E0468]: an `extern crate` loading macros must be at the crate root

error: expected crate top-level item to be a module after macro expansion, found a function
 --> <anon>:1:1
  |
1 | #![no_main::no_main]
  | ^^^^^^^^^^^^^^^^^^^^

error[E0433]: failed to resolve: maybe a missing crate `std`?

error[E0601]: `main` function not found in crate `rust_out`
 --> <anon>:1:1
  |
1 | #![no_main::no_main]
  | ^^^^^^^^^^^^^^^^^^^^ consider adding a `main` function at the crate level

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0433, E0468, E0601, E0658.
For more information about an error, try `rustc --explain E0433`.
==============
@JohnTitor
Copy link
Member

Closing in favor of #281

@JohnTitor JohnTitor closed this Feb 6, 2020
@JohnTitor JohnTitor deleted the autofix/ices/59191.sh branch February 6, 2020 15:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants