- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Slimmer syntax #68133
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
Slimmer syntax #68133
Conversation
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
…lacrum Move more of `rustc::lint` into `rustc_lint` Based on rust-lang#67806. Here we try to consolidate more of the linting infra into `rustc::lint`. Some high-level notes: - We now store an `Lrc<dyn Any + Send + Sync>` as opposed to `Lrc<LintStore>` in the `GlobalCtxt`. This enables us to avoid referring to the type, breaking a cyclic dependency, and so we can move things from `rustc::lint` to `rustc_lint`. - `in_derive_expansion` is, and needs to, be moved as a method on `Span`. - We reduce the number of ways on `tcx` to emit a lint so that the developer UX is more streamlined. - `LintLevelsBuilder` is moved to `rustc_lint::levels`, leaving behind `LintLevelMap/Set` in a purified form due to current constraints (hopefully fixable in the future after rust-lang#68133). - `struct_lint_level` is moved to `rustc::lint` due to current dependency constraints. - `rustc::context` is moved to `rustc_lint::context`. - The visitors in `rustc::lint` are moved to `rustc_lint::passes`.
…lacrum Move more of `rustc::lint` into `rustc_lint` Based on rust-lang#67806. Here we try to consolidate more of the linting infra into `rustc::lint`. Some high-level notes: - We now store an `Lrc<dyn Any + Send + Sync>` as opposed to `Lrc<LintStore>` in the `GlobalCtxt`. This enables us to avoid referring to the type, breaking a cyclic dependency, and so we can move things from `rustc::lint` to `rustc_lint`. - `in_derive_expansion` is, and needs to, be moved as a method on `Span`. - We reduce the number of ways on `tcx` to emit a lint so that the developer UX is more streamlined. - `LintLevelsBuilder` is moved to `rustc_lint::levels`, leaving behind `LintLevelMap/Set` in a purified form due to current constraints (hopefully fixable in the future after rust-lang#68133). - `struct_lint_level` is moved to `rustc::lint` due to current dependency constraints. - `rustc::lint::context` is moved to `rustc_lint::context`. - The visitors in `rustc::lint` are moved to `rustc_lint::passes`.
…lacrum Move more of `rustc::lint` into `rustc_lint` Based on rust-lang#67806. Here we try to consolidate more of the linting infra into `rustc::lint`. Some high-level notes: - We now store an `Lrc<dyn Any + Send + Sync>` as opposed to `Lrc<LintStore>` in the `GlobalCtxt`. This enables us to avoid referring to the type, breaking a cyclic dependency, and so we can move things from `rustc::lint` to `rustc_lint`. - `in_derive_expansion` is, and needs to, be moved as a method on `Span`. - We reduce the number of ways on `tcx` to emit a lint so that the developer UX is more streamlined. - `LintLevelsBuilder` is moved to `rustc_lint::levels`, leaving behind `LintLevelMap/Set` in a purified form due to current constraints (hopefully fixable in the future after rust-lang#68133). - `struct_lint_level` is moved to `rustc::lint` due to current dependency constraints. - `rustc::lint::context` is moved to `rustc_lint::context`. - The visitors in `rustc::lint` are moved to `rustc_lint::passes`.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
7e86477    to
    d081797      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
| 
 👍 | 
| 
 Cool; I'll follow up with this. :) | 
8365081    to
    279e214      
    Compare
  
    | Addressed the review comments. | 
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
3829b30    to
    1fbab97      
    Compare
  
    | @bors r+ | 
| 📌 Commit 1fbab97f3d177c4f4d58f69a2b73d938740a2abc has been approved by  | 
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
1fbab97    to
    a67d36f      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
96d2a0a    to
    1a3141c      
    Compare
  
    | @bors r=petrochenkov | 
| 📌 Commit 1a3141c has been approved by  | 
Slimmer syntax High-level summary of changes: - The `syntax::node_count` pass is moved into `rustc_ast_passes`. This works towards improving #65031 by making compiling `syntax` go faster. - The `syntax::{GLOBALS, with_globals, ..}` business is consolidated into `syntax::attr` for cleaner code and future possible improvements. - The pretty printer loses its dependency on `ParseSess`, opting to use `SourceMap` & friends directly instead. - Some drive by cleanup of `syntax::attr::HasAttr` happens. - Builtin attribute logic (`syntax::attr::builtin`) + `syntax::attr::allow_internal_unstable` is moved into a new `rustc_attr` crate. More logic from `syntax::attr` should be moved into that crate over time. This also means that `syntax` loses all mentions of `ParseSess`, which enables the next point. - The pretty printer `syntax::print` is moved into a new crate `rustc_ast_pretty`. - `rustc_session::node_id` is moved back as `syntax::node_id`. As a result, `syntax` gets to drop dependencies on `rustc_session` (and implicitly `rustc_target`), `rustc_error_codes`, and `rustc_errors`. Moreover `rustc_hir` gets to drop its dependency on `rustc_session` as well. At this point, these crates are mostly "pure data crates", which is approaching a desirable end state. - We should consider renaming `syntax` to `rustc_ast` now.
| ☀️ Test successful - checks-azure | 
| 📣 Toolstate changed by #68133! Tested on commit 13db650. 💔 clippy-driver on windows: test-fail → build-fail (cc @mcarton @oli-obk @Manishearth @flip1995 @yaahc @phansch @llogiq, @rust-lang/infra). | 
Tested on commit rust-lang/rust@13db650. Direct link to PR: <rust-lang/rust#68133> 💔 clippy-driver on windows: test-fail → build-fail (cc @mcarton @oli-obk @Manishearth @flip1995 @yaahc @phansch @llogiq, @rust-lang/infra). 💔 clippy-driver on linux: test-fail → build-fail (cc @mcarton @oli-obk @Manishearth @flip1995 @yaahc @phansch @llogiq, @rust-lang/infra).
Rustup to rust-lang/rust#68133 changelog: none
High-level summary of changes:
The
syntax::node_countpass is moved intorustc_ast_passes. This works towards improving Therustc_query_implcrate is too big, which hurts compile times for the compiler itself #65031 by making compilingsyntaxgo faster.The
syntax::{GLOBALS, with_globals, ..}business is consolidated intosyntax::attrfor cleaner code and future possible improvements.The pretty printer loses its dependency on
ParseSess, opting to useSourceMap& friends directly instead.Some drive by cleanup of
syntax::attr::HasAttrhappens.Builtin attribute logic (
syntax::attr::builtin) +syntax::attr::allow_internal_unstableis moved into a newrustc_attrcrate. More logic fromsyntax::attrshould be moved into that crate over time. This also means thatsyntaxloses all mentions ofParseSess, which enables the next point.The pretty printer
syntax::printis moved into a new craterustc_ast_pretty.rustc_session::node_idis moved back assyntax::node_id. As a result,syntaxgets to drop dependencies onrustc_session(and implicitlyrustc_target),rustc_error_codes, andrustc_errors. Moreoverrustc_hirgets to drop its dependency onrustc_sessionas well. At this point, these crates are mostly "pure data crates", which is approaching a desirable end state.syntaxtorustc_astnow.