Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c5d42b1
Ensure all iterations in Rayon iterators run in the presence of panics
Zoxc Jan 13, 2020
69276ba
Update tests
Zoxc Jan 13, 2020
934abf2
Use $crate
Zoxc Jan 16, 2020
c621cd6
Parallelize type collecting and item-types checking
Zoxc Jan 2, 2020
8c07291
Tweak misc checking 1
Zoxc Jan 2, 2020
bef0c61
Run item-types checking and item-bodies checking in parallel
Zoxc Jan 3, 2020
337d647
Handle panics with `join`
Zoxc Jan 3, 2020
6b67617
Make typeck_item_bodies eval_always
Zoxc Jan 3, 2020
6283565
Make coherence checking parallel
Zoxc Jan 3, 2020
efe44ff
Move privacy_access_levels out of misc checking 3 and run it in paral…
Zoxc Jan 3, 2020
ff125ff
Move some other passes into a parallel block
Zoxc Jan 3, 2020
7a6895f
Make liveness checking more parallel
Zoxc Jan 3, 2020
db0bd38
Prefetch upstream_monomorphizations
Zoxc Jan 3, 2020
171b1bb
Add a new misc checking 3 block
Zoxc Jan 3, 2020
133190b
Prefetch lint_levels and visible_parent_map
Zoxc Jan 4, 2020
f68672b
Fix duplicate test fallout
Zoxc Jan 11, 2020
c7aabbd
Drop `ensure` for privacy_access_levels. Add some comments.
Zoxc Jan 13, 2020
477ad98
Calculate accessor_map in parallel earlier
Zoxc Jan 11, 2020
85fa6a8
Add par_partition
Zoxc Jan 14, 2020
e478795
Parallelize place_root_mono_items
Zoxc Jan 11, 2020
730689e
Estimate CGU cost in place_root_mono_items
Zoxc Jan 12, 2020
1a37f05
Parallelize assert_symbols_are_distinct
Zoxc Jan 12, 2020
20fd50d
Make impl WF inference more parallel
Zoxc Jan 12, 2020
0fdcfe1
Check `Copy` impls in parallel
Zoxc Jan 12, 2020
98d0f7d
Prefetch mir_keys
Zoxc Jan 12, 2020
2bc0d3f
Use a parallel block for coherence checking
Zoxc Jan 12, 2020
9bfdcde
Ensure type checking each function is stealable by other threads
Zoxc Jan 13, 2020
c010632
Tune misc_checking_1
Zoxc Jan 13, 2020
d523356
Run HIR indexing and loading of query results in parallel
Zoxc Jan 9, 2020
0f34dc2
Move check_for_entry_fn and check_unused to a later stage
Zoxc Jan 14, 2020
d788721
Make copy_cgu_workproducts_to_incr_comp_cache_dir parallel
Zoxc Jan 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move check_for_entry_fn and check_unused to a later stage
  • Loading branch information
Zoxc committed Jan 17, 2020
commit 0f34dc276d83fc445e2111273bf86103257d46a7
3 changes: 3 additions & 0 deletions src/librustc_interface/passes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,9 @@ fn analysis(tcx: TyCtxt<'_>, cnum: CrateNum) -> Result<()> {
tcx.ensure().check_mod_intrinsics(local_def_id);
});
});
},
{
typeck::check_crate_late(tcx);
}
);
});
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_typeck/check_unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use rustc_span::Span;
use syntax::ast;

pub fn check_crate(tcx: TyCtxt<'_>) {
let _timer = tcx.sess.timer("check_unused_imports");

let mut used_trait_imports = DefIdSet::default();
for &body_id in tcx.hir().krate().bodies.keys() {
let item_def_id = tcx.hir().body_owner_def_id(body_id);
Expand Down
8 changes: 5 additions & 3 deletions src/librustc_typeck/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ fn check_start_fn_ty(tcx: TyCtxt<'_>, start_def_id: DefId) {
}

fn check_for_entry_fn(tcx: TyCtxt<'_>) {
let _timer = tcx.sess.prof.generic_activity("check_entry_fn");
match tcx.entry_fn(LOCAL_CRATE) {
Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id),
Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id),
Expand Down Expand Up @@ -361,12 +362,13 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorReported> {
)
});

check_unused::check_crate(tcx);
check_for_entry_fn(tcx);

if tcx.sess.err_count() == 0 { Ok(()) } else { Err(ErrorReported) }
}

pub fn check_crate_late(tcx: TyCtxt<'_>) {
join(|| check_unused::check_crate(tcx), || check_for_entry_fn(tcx));
}

/// A quasi-deprecated helper used in rustdoc and clippy to get
/// the type from a HIR node.
pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: &hir::Ty<'_>) -> Ty<'tcx> {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-expr-path.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod m1 {}

fn main(arguments: Vec<String>) { //~ ERROR `main` function has wrong type
fn main(arguments: Vec<String>) {
log(debug, m1::arguments);
//~^ ERROR cannot find function `log` in this scope
//~| ERROR cannot find value `debug` in this scope
Expand Down
14 changes: 2 additions & 12 deletions src/test/ui/bad/bad-expr-path.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ error[E0425]: cannot find value `arguments` in module `m1`
LL | log(debug, m1::arguments);
| ^^^^^^^^^ not found in `m1`

error[E0580]: `main` function has wrong type
--> $DIR/bad-expr-path.rs:3:1
|
LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected fn pointer `fn()`
found fn pointer `fn(std::vec::Vec<std::string::String>)`

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0425, E0580.
For more information about an error, try `rustc --explain E0425`.
For more information about this error, try `rustc --explain E0425`.
2 changes: 1 addition & 1 deletion src/test/ui/bad/bad-expr-path2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod m1 {
pub mod arguments {}
}

fn main(arguments: Vec<String>) { //~ ERROR `main` function has wrong type
fn main(arguments: Vec<String>) {
log(debug, m1::arguments);
//~^ ERROR cannot find function `log` in this scope
//~| ERROR cannot find value `debug` in this scope
Expand Down
13 changes: 2 additions & 11 deletions src/test/ui/bad/bad-expr-path2.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,7 @@ error[E0423]: expected value, found module `m1::arguments`
LL | log(debug, m1::arguments);
| ^^^^^^^^^^^^^ not a value

error[E0580]: `main` function has wrong type
--> $DIR/bad-expr-path2.rs:5:1
|
LL | fn main(arguments: Vec<String>) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected fn pointer `fn()`
found fn pointer `fn(std::vec::Vec<std::string::String>)`

error: aborting due to 4 previous errors
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0423, E0425, E0580.
Some errors have detailed explanations: E0423, E0425.
For more information about an error, try `rustc --explain E0423`.
23 changes: 23 additions & 0 deletions src/test/ui/lint/lint-unused-imports-2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#![deny(unused_imports)]
#![allow(dead_code)]

// Be sure that if we just bring some methods into scope that they're also
// counted as being used.
use test::B;
// But only when actually used: do not get confused by the method with the same name.
use test::B2; //~ ERROR unused import: `test::B2`

mod test {
pub trait B {
fn b(&self) {}
}
pub trait B2 {
fn b(&self) {}
}
pub struct C;
impl B for C {}
}

fn main() {
test::C.b();
}
14 changes: 14 additions & 0 deletions src/test/ui/lint/lint-unused-imports-2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
error: unused import: `test::B2`
--> $DIR/lint-unused-imports-2.rs:8:5
|
LL | use test::B2;
| ^^^^^^^^
|
note: lint level defined here
--> $DIR/lint-unused-imports-2.rs:1:9
|
LL | #![deny(unused_imports)]
| ^^^^^^^^^^^^^^

error: aborting due to previous error

11 changes: 0 additions & 11 deletions src/test/ui/lint/lint-unused-imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ use std::option::Option::{Some, None};
//~^ ERROR unused imports: `None`, `Some`

use test::A; //~ ERROR unused import: `test::A`
// Be sure that if we just bring some methods into scope that they're also
// counted as being used.
use test::B;
// But only when actually used: do not get confused by the method with the same name.
use test::B2; //~ ERROR unused import: `test::B2`

// Make sure this import is warned about when at least one of its imported names
// is unused
Expand All @@ -30,11 +25,6 @@ mod test2 {

mod test {
pub trait A { fn a(&self) {} }
pub trait B { fn b(&self) {} }
pub trait B2 { fn b(&self) {} }
pub struct C;
impl A for C {}
impl B for C {}
}

mod foo {
Expand Down Expand Up @@ -85,6 +75,5 @@ fn main() {
let mut a = 3;
let mut b = 4;
swap(&mut a, &mut b);
test::C.b();
let _a = foo();
}
20 changes: 7 additions & 13 deletions src/test/ui/lint/lint-unused-imports.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ LL | use test::A;
| ^^^^^^^

error: unused import: `bar`
--> $DIR/lint-unused-imports.rs:24:18
--> $DIR/lint-unused-imports.rs:19:18
|
LL | use test2::{foo, bar};
| ^^^

error: unused import: `foo::Square`
--> $DIR/lint-unused-imports.rs:52:13
--> $DIR/lint-unused-imports.rs:42:13
|
LL | use foo::Square;
| ^^^^^^^^^^^

error: the item `g` is imported redundantly
--> $DIR/lint-unused-imports.rs:68:9
--> $DIR/lint-unused-imports.rs:58:9
|
LL | / fn g() {
LL | | use self::g;
Expand All @@ -48,13 +48,13 @@ LL | | }
| |_- the item `g` is already defined here

error: unused import: `self::g`
--> $DIR/lint-unused-imports.rs:68:9
--> $DIR/lint-unused-imports.rs:58:9
|
LL | use self::g;
| ^^^^^^^

error: the item `foo` is imported redundantly
--> $DIR/lint-unused-imports.rs:78:9
--> $DIR/lint-unused-imports.rs:68:9
|
LL | use test2::{foo, bar};
| --- the item `foo` is already imported here
Expand All @@ -63,16 +63,10 @@ LL | use test2::foo;
| ^^^^^^^^^^

error: unused import: `test2::foo`
--> $DIR/lint-unused-imports.rs:78:9
--> $DIR/lint-unused-imports.rs:68:9
|
LL | use test2::foo;
| ^^^^^^^^^^

error: unused import: `test::B2`
--> $DIR/lint-unused-imports.rs:20:5
|
LL | use test::B2;
| ^^^^^^^^

error: aborting due to 10 previous errors
error: aborting due to 9 previous errors