middle::entry -> rustc_passes
This commit is contained in:
parent
bb707824d0
commit
82bfd8eb0d
6 changed files with 92 additions and 86 deletions
|
@ -466,66 +466,6 @@ fn main() {
|
||||||
```
|
```
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
// This shouldn't really ever trigger since the repeated value error comes first
|
|
||||||
E0136: r##"
|
|
||||||
A binary can only have one entry point, and by default that entry point is the
|
|
||||||
function `main()`. If there are multiple such functions, please rename one.
|
|
||||||
"##,
|
|
||||||
|
|
||||||
E0137: r##"
|
|
||||||
More than one function was declared with the `#[main]` attribute.
|
|
||||||
|
|
||||||
Erroneous code example:
|
|
||||||
|
|
||||||
```compile_fail,E0137
|
|
||||||
#![feature(main)]
|
|
||||||
|
|
||||||
#[main]
|
|
||||||
fn foo() {}
|
|
||||||
|
|
||||||
#[main]
|
|
||||||
fn f() {} // error: multiple functions with a `#[main]` attribute
|
|
||||||
```
|
|
||||||
|
|
||||||
This error indicates that the compiler found multiple functions with the
|
|
||||||
`#[main]` attribute. This is an error because there must be a unique entry
|
|
||||||
point into a Rust program. Example:
|
|
||||||
|
|
||||||
```
|
|
||||||
#![feature(main)]
|
|
||||||
|
|
||||||
#[main]
|
|
||||||
fn f() {} // ok!
|
|
||||||
```
|
|
||||||
"##,
|
|
||||||
|
|
||||||
E0138: r##"
|
|
||||||
More than one function was declared with the `#[start]` attribute.
|
|
||||||
|
|
||||||
Erroneous code example:
|
|
||||||
|
|
||||||
```compile_fail,E0138
|
|
||||||
#![feature(start)]
|
|
||||||
|
|
||||||
#[start]
|
|
||||||
fn foo(argc: isize, argv: *const *const u8) -> isize {}
|
|
||||||
|
|
||||||
#[start]
|
|
||||||
fn f(argc: isize, argv: *const *const u8) -> isize {}
|
|
||||||
// error: multiple 'start' functions
|
|
||||||
```
|
|
||||||
|
|
||||||
This error indicates that the compiler found multiple functions with the
|
|
||||||
`#[start]` attribute. This is an error because there must be a unique entry
|
|
||||||
point into a Rust program. Example:
|
|
||||||
|
|
||||||
```
|
|
||||||
#![feature(start)]
|
|
||||||
|
|
||||||
#[start]
|
|
||||||
fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } // ok!
|
|
||||||
```
|
|
||||||
"##,
|
|
||||||
|
|
||||||
E0139: r##"
|
E0139: r##"
|
||||||
#### Note: this error code is no longer emitted by the compiler.
|
#### Note: this error code is no longer emitted by the compiler.
|
||||||
|
@ -1941,21 +1881,6 @@ fn main() {
|
||||||
```
|
```
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
E0601: r##"
|
|
||||||
No `main` function was found in a binary crate. To fix this error, add a
|
|
||||||
`main` function. For example:
|
|
||||||
|
|
||||||
```
|
|
||||||
fn main() {
|
|
||||||
// Your program will start here.
|
|
||||||
println!("Hello world!");
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
If you don't know the basics of Rust, you can go look to the Rust Book to get
|
|
||||||
started: https://doc.rust-lang.org/book/
|
|
||||||
"##,
|
|
||||||
|
|
||||||
E0602: r##"
|
E0602: r##"
|
||||||
An unknown lint was used on the command line.
|
An unknown lint was used on the command line.
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,6 @@ pub mod middle {
|
||||||
pub mod cstore;
|
pub mod cstore;
|
||||||
pub mod dependency_format;
|
pub mod dependency_format;
|
||||||
pub mod diagnostic_items;
|
pub mod diagnostic_items;
|
||||||
pub mod entry;
|
|
||||||
pub mod exported_symbols;
|
pub mod exported_symbols;
|
||||||
pub mod free_region;
|
pub mod free_region;
|
||||||
pub mod intrinsicck;
|
pub mod intrinsicck;
|
||||||
|
|
|
@ -785,7 +785,6 @@ pub fn default_provide(providers: &mut ty::query::Providers<'_>) {
|
||||||
rustc_passes::provide(providers);
|
rustc_passes::provide(providers);
|
||||||
rustc_traits::provide(providers);
|
rustc_traits::provide(providers);
|
||||||
middle::region::provide(providers);
|
middle::region::provide(providers);
|
||||||
middle::entry::provide(providers);
|
|
||||||
cstore::provide(providers);
|
cstore::provide(providers);
|
||||||
lint::provide(providers);
|
lint::provide(providers);
|
||||||
rustc_lint::provide(providers);
|
rustc_lint::provide(providers);
|
||||||
|
@ -891,7 +890,7 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
|
||||||
time(sess, "misc checking 1", || {
|
time(sess, "misc checking 1", || {
|
||||||
parallel!({
|
parallel!({
|
||||||
entry_point = time(sess, "looking for entry point", || {
|
entry_point = time(sess, "looking for entry point", || {
|
||||||
middle::entry::find_entry_point(tcx)
|
rustc_passes::entry::find_entry_point(tcx)
|
||||||
});
|
});
|
||||||
|
|
||||||
time(sess, "looking for plugin registrar", || {
|
time(sess, "looking for plugin registrar", || {
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
use crate::hir::map as hir_map;
|
use rustc::hir::map as hir_map;
|
||||||
use crate::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
|
use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE};
|
||||||
use crate::session::{config, Session};
|
use rustc::session::{config, Session};
|
||||||
use crate::session::config::EntryFnType;
|
use rustc::session::config::EntryFnType;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::entry::EntryPointType;
|
use syntax::entry::EntryPointType;
|
||||||
use syntax::symbol::sym;
|
use syntax::symbol::sym;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
use crate::hir::{HirId, Item, ItemKind, ImplItem, TraitItem};
|
use rustc::hir::{HirId, Item, ItemKind, ImplItem, TraitItem};
|
||||||
use crate::hir::itemlikevisit::ItemLikeVisitor;
|
use rustc::hir::itemlikevisit::ItemLikeVisitor;
|
||||||
use crate::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use crate::ty::query::Providers;
|
use rustc::ty::query::Providers;
|
||||||
|
|
||||||
struct EntryContext<'a, 'tcx> {
|
struct EntryContext<'a, 'tcx> {
|
||||||
session: &'a Session,
|
session: &'a Session,
|
|
@ -319,6 +319,83 @@ async fn foo() {}
|
||||||
|
|
||||||
Switch to the Rust 2018 edition to use `async fn`.
|
Switch to the Rust 2018 edition to use `async fn`.
|
||||||
"##,
|
"##,
|
||||||
|
|
||||||
|
// This shouldn't really ever trigger since the repeated value error comes first
|
||||||
|
E0136: r##"
|
||||||
|
A binary can only have one entry point, and by default that entry point is the
|
||||||
|
function `main()`. If there are multiple such functions, please rename one.
|
||||||
|
"##,
|
||||||
|
|
||||||
|
E0137: r##"
|
||||||
|
More than one function was declared with the `#[main]` attribute.
|
||||||
|
|
||||||
|
Erroneous code example:
|
||||||
|
|
||||||
|
```compile_fail,E0137
|
||||||
|
#![feature(main)]
|
||||||
|
|
||||||
|
#[main]
|
||||||
|
fn foo() {}
|
||||||
|
|
||||||
|
#[main]
|
||||||
|
fn f() {} // error: multiple functions with a `#[main]` attribute
|
||||||
|
```
|
||||||
|
|
||||||
|
This error indicates that the compiler found multiple functions with the
|
||||||
|
`#[main]` attribute. This is an error because there must be a unique entry
|
||||||
|
point into a Rust program. Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
#![feature(main)]
|
||||||
|
|
||||||
|
#[main]
|
||||||
|
fn f() {} // ok!
|
||||||
|
```
|
||||||
|
"##,
|
||||||
|
|
||||||
|
E0138: r##"
|
||||||
|
More than one function was declared with the `#[start]` attribute.
|
||||||
|
|
||||||
|
Erroneous code example:
|
||||||
|
|
||||||
|
```compile_fail,E0138
|
||||||
|
#![feature(start)]
|
||||||
|
|
||||||
|
#[start]
|
||||||
|
fn foo(argc: isize, argv: *const *const u8) -> isize {}
|
||||||
|
|
||||||
|
#[start]
|
||||||
|
fn f(argc: isize, argv: *const *const u8) -> isize {}
|
||||||
|
// error: multiple 'start' functions
|
||||||
|
```
|
||||||
|
|
||||||
|
This error indicates that the compiler found multiple functions with the
|
||||||
|
`#[start]` attribute. This is an error because there must be a unique entry
|
||||||
|
point into a Rust program. Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
#![feature(start)]
|
||||||
|
|
||||||
|
#[start]
|
||||||
|
fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } // ok!
|
||||||
|
```
|
||||||
|
"##,
|
||||||
|
|
||||||
|
E0601: r##"
|
||||||
|
No `main` function was found in a binary crate. To fix this error, add a
|
||||||
|
`main` function. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
fn main() {
|
||||||
|
// Your program will start here.
|
||||||
|
println!("Hello world!");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
If you don't know the basics of Rust, you can go look to the Rust Book to get
|
||||||
|
started: https://doc.rust-lang.org/book/
|
||||||
|
"##,
|
||||||
|
|
||||||
;
|
;
|
||||||
E0226, // only a single explicit lifetime bound is permitted
|
E0226, // only a single explicit lifetime bound is permitted
|
||||||
E0472, // asm! is unsupported on this target
|
E0472, // asm! is unsupported on this target
|
||||||
|
|
|
@ -13,6 +13,10 @@
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rustc;
|
extern crate rustc;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate log;
|
||||||
|
#[macro_use]
|
||||||
|
extern crate syntax;
|
||||||
|
|
||||||
use rustc::ty::query::Providers;
|
use rustc::ty::query::Providers;
|
||||||
|
|
||||||
|
@ -23,9 +27,11 @@ pub mod hir_stats;
|
||||||
pub mod layout_test;
|
pub mod layout_test;
|
||||||
pub mod loops;
|
pub mod loops;
|
||||||
pub mod dead;
|
pub mod dead;
|
||||||
|
pub mod entry;
|
||||||
mod liveness;
|
mod liveness;
|
||||||
|
|
||||||
pub fn provide(providers: &mut Providers<'_>) {
|
pub fn provide(providers: &mut Providers<'_>) {
|
||||||
|
entry::provide(providers);
|
||||||
loops::provide(providers);
|
loops::provide(providers);
|
||||||
liveness::provide(providers);
|
liveness::provide(providers);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue