New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge visitors in AST validation #57730

Merged
merged 2 commits into from Jan 24, 2019

Conversation

Projects
None yet
5 participants
@Zoxc
Copy link
Contributor

Zoxc commented Jan 18, 2019

Cuts runtime for AST validation on syntex_syntax from 31.5 ms to 17 ms.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 18, 2019

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@Zoxc Zoxc force-pushed the Zoxc:combined-ast-validator branch from e3c2264 to 13dc584 Jan 18, 2019


// Used to ban nested `impl Trait`, e.g., `impl Into<impl Debug>`.
// Nested `impl Trait` _is_ allowed in associated type position,
// e.g `impl Iterator<Item=impl Debug>`

This comment has been minimized.

@Centril

Centril Jan 18, 2019

Contributor

Maybe also add a note about why we do this (cause we are not sure whether we want it to be higher rank: impl for<T: Debug> Into<T>, or rank-1).

This comment has been minimized.

@Zoxc

Zoxc Jan 19, 2019

Author Contributor

I don't know why we do this. I just copied this comment. Feel free to suggest the exact change you'd like.

}

impl<'a> AstValidator<'a> {
fn with_banned_impl_trait<F>(&mut self, f: F)

This comment has been minimized.

@Centril

Centril Jan 18, 2019

Contributor

use f: impl FnOnce(&mut Self) for increased readability?

self.is_impl_trait_banned = old_is_impl_trait_banned;
}

fn with_impl_trait<F>(&mut self, outer_impl_trait: Option<Span>, f: F)

This comment has been minimized.

@Centril

Centril Jan 18, 2019

Contributor

Same.. f: impl FnOnce(&mut Self).

fn with_banned_impl_trait<F>(&mut self, f: F)
where F: FnOnce(&mut Self)
{
let old_is_impl_trait_banned = self.is_impl_trait_banned;

This comment has been minimized.

@Centril

Centril Jan 18, 2019

Contributor

Use mem::replace?

fn with_impl_trait<F>(&mut self, outer_impl_trait: Option<Span>, f: F)
where F: FnOnce(&mut Self)
{
let old_outer_impl_trait = self.outer_impl_trait;

This comment has been minimized.

@Centril

Centril Jan 18, 2019

Contributor

use mem::replace here also?

@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Jan 18, 2019

r=me with @Centril's nits fixed.

fn visit_ty(&mut self, t: &'a Ty) {
match t.node {
TyKind::ImplTrait(..) => {
if self.is_banned {

This comment has been minimized.

@Zoxc

Zoxc Jan 19, 2019

Author Contributor

This PR will give errors about nested impl traits being banned in path parameters, unlike the old code, which doesn't visit inside impl Trait. So we'd get 3 errors then, one for nested impl Trait and one for each instance of impl Trait in a path parameter.

This comment has been minimized.

@cramertj
@cramertj

This comment has been minimized.

Copy link
Member

cramertj commented Jan 21, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 21, 2019

📌 Commit a5d4aed has been approved by cramertj

Centril added a commit to Centril/rust that referenced this pull request Jan 21, 2019

Rollup merge of rust-lang#57730 - Zoxc:combined-ast-validator, r=cram…
…ertj

Merge visitors in AST validation

Cuts runtime for AST validation on `syntex_syntax` from 31.5 ms to 17 ms.

bors added a commit that referenced this pull request Jan 22, 2019

Auto merge of #57823 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #57294 (When using value after move, point at span of local)
 - #57552 (Default images)
 - #57667 (Fix memory leak in P::filter_map)
 - #57677 (const_eval: Predetermine the layout of all locals when pushing a stack frame)
 - #57730 (Merge visitors in AST validation)
 - #57791 (Add regression test for #54582)
 - #57795 (Use structured suggestion in stead of notes)
 - #57809 (Add powerpc64-unknown-freebsd)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Jan 23, 2019

Rollup merge of rust-lang#57730 - Zoxc:combined-ast-validator, r=cram…
…ertj

Merge visitors in AST validation

Cuts runtime for AST validation on `syntex_syntax` from 31.5 ms to 17 ms.

bors added a commit that referenced this pull request Jan 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage)
 - #57730 (Merge visitors in AST validation)
 - #57779 (Recover from parse errors in literal struct fields and incorrect float literals)
 - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`)
 - #57795 (Use structured suggestion in stead of notes)
 - #57817 (Add error for trailing angle brackets.)
 - #57834 (Stabilize Any::get_type_id and rename to type_id)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jan 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage)
 - #57730 (Merge visitors in AST validation)
 - #57779 (Recover from parse errors in literal struct fields and incorrect float literals)
 - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`)
 - #57795 (Use structured suggestion in stead of notes)
 - #57817 (Add error for trailing angle brackets.)
 - #57834 (Stabilize Any::get_type_id and rename to type_id)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jan 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage)
 - #57730 (Merge visitors in AST validation)
 - #57779 (Recover from parse errors in literal struct fields and incorrect float literals)
 - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`)
 - #57795 (Use structured suggestion in stead of notes)
 - #57817 (Add error for trailing angle brackets.)
 - #57834 (Stabilize Any::get_type_id and rename to type_id)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Jan 23, 2019

Auto merge of #57850 - Centril:rollup, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #55448 (Add 'partition_at_index/_by/_by_key' for slices.)
 - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage)
 - #57730 (Merge visitors in AST validation)
 - #57779 (Recover from parse errors in literal struct fields and incorrect float literals)
 - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`)
 - #57795 (Use structured suggestion in stead of notes)
 - #57817 (Add error for trailing angle brackets.)
 - #57834 (Stabilize Any::get_type_id and rename to type_id)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request Jan 23, 2019

Rollup merge of rust-lang#57730 - Zoxc:combined-ast-validator, r=cram…
…ertj

Merge visitors in AST validation

Cuts runtime for AST validation on `syntex_syntax` from 31.5 ms to 17 ms.

bors added a commit that referenced this pull request Jan 24, 2019

Auto merge of #57869 - Centril:rollup, r=Centril
Rollup of 11 pull requests

Successful merges:

 - #57179 (Update std/lib.rs docs to reflect Rust 2018 usage)
 - #57730 (Merge visitors in AST validation)
 - #57779 (Recover from parse errors in literal struct fields and incorrect float literals)
 - #57793 (Explain type mismatch cause pointing to return type when it is `impl Trait`)
 - #57795 (Use structured suggestion in stead of notes)
 - #57817 (Add error for trailing angle brackets.)
 - #57834 (Stabilize Any::get_type_id and rename to type_id)
 - #57836 (Fix some cross crate existential type ICEs)
 - #57840 (Fix issue 57762)
 - #57844 (use port 80 for retrieving GPG key)
 - #57858 (Ignore line ending on older git versions)

Failed merges:

r? @ghost

@bors bors merged commit a5d4aed into rust-lang:master Jan 24, 2019

@Zoxc Zoxc deleted the Zoxc:combined-ast-validator branch Jan 24, 2019

Zoxc added a commit to Zoxc/rust that referenced this pull request Jan 30, 2019

Zoxc added a commit to Zoxc/rust that referenced this pull request Jan 30, 2019

@Zoxc Zoxc referenced this pull request Jan 30, 2019

Merged

Fix #57730 #57981

Centril added a commit to Centril/rust that referenced this pull request Feb 14, 2019

bors added a commit that referenced this pull request Feb 14, 2019

Auto merge of #58470 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57981 (Fix #57730)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58353 (Check the Self-type of inherent associated constants)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58448 (rustdoc: mask `compiler_builtins` docs)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Feb 15, 2019

Auto merge of #58470 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57981 (Fix #57730)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58353 (Check the Self-type of inherent associated constants)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58448 (rustdoc: mask `compiler_builtins` docs)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Feb 15, 2019

Auto merge of #58470 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57981 (Fix #57730)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58353 (Check the Self-type of inherent associated constants)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58448 (rustdoc: mask `compiler_builtins` docs)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Feb 15, 2019

Auto merge of #58470 - Centril:rollup, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #57981 (Fix #57730)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58353 (Check the Self-type of inherent associated constants)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58448 (rustdoc: mask `compiler_builtins` docs)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Feb 15, 2019

bors added a commit that referenced this pull request Feb 15, 2019

Auto merge of #58495 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

Successful merges:

 - #57880 (Always emit an error for a query cycle)
 - #57981 (Fix #57730)
 - #58074 (Stabilize slice_sort_by_cached_key)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58359 (librustc_mir: use ? in impl_snapshot_for! macro)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58440 (Whitelist the ARM v6 target-feature)
 - #58448 (rustdoc: mask `compiler_builtins` docs)
 - #58468 (split MaybeUninit into several features, expand docs a bit)
 - #58477 (Fix the syntax error in publish_toolstate.py)
 - #58479 (compile-pass test for #53606)
 - #58489 (Fix runtime error in generate-keyword-tests)

Failed merges:

r? @ghost

bors added a commit that referenced this pull request Feb 15, 2019

Auto merge of #58495 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

Successful merges:

 - #57880 (Always emit an error for a query cycle)
 - #57981 (Fix #57730)
 - #58074 (Stabilize slice_sort_by_cached_key)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58359 (librustc_mir: use ? in impl_snapshot_for! macro)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58440 (Whitelist the ARM v6 target-feature)
 - #58448 (rustdoc: mask `compiler_builtins` docs)
 - #58468 (split MaybeUninit into several features, expand docs a bit)
 - #58477 (Fix the syntax error in publish_toolstate.py)
 - #58479 (compile-pass test for #53606)
 - #58489 (Fix runtime error in generate-keyword-tests)

Failed merges:

r? @ghost

kennytm added a commit to kennytm/rust that referenced this pull request Feb 16, 2019

bors added a commit that referenced this pull request Feb 16, 2019

Auto merge of #58495 - kennytm:rollup, r=kennytm
Rollup of 19 pull requests

Successful merges:

 - #57929 (Rustdoc remove old style files)
 - #57981 (Fix #57730)
 - #58074 (Stabilize slice_sort_by_cached_key)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58359 (librustc_mir: use ? in impl_snapshot_for! macro)
 - #58395 (Instant::checked_duration_since)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58440 (Whitelist the ARM v6 target-feature)
 - #58448 (rustdoc: mask `compiler_builtins` docs)
 - #58468 (split MaybeUninit into several features, expand docs a bit)
 - #58477 (Fix the syntax error in publish_toolstate.py)
 - #58479 (compile-pass test for #53606)
 - #58489 (Fix runtime error in generate-keyword-tests)
 - #58496 (Fix documentation for std::path::PathBuf::pop)
 - #58509 (Notify myself when Clippy toolstate changes)

bors added a commit that referenced this pull request Feb 17, 2019

Auto merge of #58495 - kennytm:rollup, r=kennytm
Rollup of 19 pull requests

Successful merges:

 - #57929 (Rustdoc remove old style files)
 - #57981 (Fix #57730)
 - #58074 (Stabilize slice_sort_by_cached_key)
 - #58196 (Add specific feature gate error for const-unstable features)
 - #58293 (Remove code for updating copyright years in generate-deriving-span-tests)
 - #58306 (Don't default on std crate when manipulating browser history)
 - #58359 (librustc_mir: use ? in impl_snapshot_for! macro)
 - #58395 (Instant::checked_duration_since)
 - #58429 (fix Box::into_unique effecitvely transmuting to a raw ptr)
 - #58433 (Update which libcore/liballoc tests Miri ignores, and document why)
 - #58438 (Use posix_spawn_file_actions_addchdir_np when possible)
 - #58440 (Whitelist the ARM v6 target-feature)
 - #58448 (rustdoc: mask `compiler_builtins` docs)
 - #58468 (split MaybeUninit into several features, expand docs a bit)
 - #58479 (compile-pass test for #53606)
 - #58489 (Fix runtime error in generate-keyword-tests)
 - #58496 (Fix documentation for std::path::PathBuf::pop)
 - #58509 (Notify myself when Clippy toolstate changes)
 - #58521 (Fix tracking issue for error iterators)

TheBiggerGuy added a commit to TheBiggerGuy/rust that referenced this pull request Feb 17, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment