Empowering everyone to
use secret compiler powers
What?
Analyze Rust code programmatically
Via a stable™ rustc API
Designed and pushed off by Celina Val
Note: Skipping a Why? section for the first bullet point, as y'all know why we are here
Oli Scherer changed 2 years agoSlide mode Like Bookmark
query system/interning
querification of things that are before the query system
hack-removals enabled by query feedingpromoteds get their own DefId
WithOptConstParam
hardening of APIs
checking various invariants via debug assertionscorrect number of substs on various things with substsalready found a bunch of bugs
simplification of APIs
Oli Scherer changed 2 years agoView mode Like Bookmark
remove WithOptConstParam, but add hack for non-owned feeding
Eliminate par_body_owners and body_owners functionsprefer queries calling other queries
rename mir_drops_elaborated_and_const_checked to mir_analysis
at the end of compilation, iterate over all DefIds, calling mir_analysis on all body owners.since this may create more DefIds, we need to iterate by even beyond the initially "last" DefId.
after this iteration, no more DefIds may be created (as we could then forget to call the analysis queries), so we need to freeze the definitions table.
need an is_body_owner query to differentiate DefIds with bodies from those without. This should be fed inside create_def just like def_span.
remove the feed_type_of_anon_const hack
create the DefId for the AnonConst during typeck of its parent
Oli Scherer changed 2 years agoView mode Like Bookmark
Github link to FCPs
2222-11-22 (2022-11-23)
14 Issues
13 merged/disposition-merge
Add IMPLIED_BOUNDS_ENTAILMENT lint
Check ADT fields for copy implementations considering regions
Find the right lower bound region in the scenario of partial order relations
make order_dependent_trait_objects show up in future-breakage reports
Jack Huey changed 2 years agoView mode Like Bookmark
2022-09-14
https://gist.github.com/nikomatsakis/3ca370ae809cbee81b20a3e8ef504542
// Example B
use std::fmt::Debug;
trait SomeTrait<'b>: Debug { }
fn foo<'b, T>(t: T) -> impl Debug
where
I propose to create an easy way for Rust community members to create a cloud machine to be used for Rust development namely: compiling, testing, and debugging the rustc compiler.
Motivation
Time working on the Rust compiler is often spent by waiting for a build/test to run, touching the code again and rerunning. The difference between the time spent waiting and the time actually coding can be quite large depending on the amount of CPU power available and the specific kind of work being performed.
Compiling the Rust compiler from scratch on recent 4 core CPUs can easily (anecdotally measured) take up 10-15 minutes (more if LLVM is also built) with another 5-10 minutes for tests.
Some contributors do not have even this level of resources available and thus end up limiting themselves to certain subsets of rustc contributions that require less time. If we give people more resources to build the compiler, they will likely contribute more. It may also open up contribution opportunities for people who could not contribute at all before having access to such resources.
Furthermore, if we give contributors even more resources, like say a 96 core cloud machine, then
Oli Scherer changed 4 years agoView mode Like Bookmark
It has recently been brought to my attention that it's not obvious how constant evaluation in Rust and C++ is similar or different. It took around ${1\over7}th$ of a second of thought until I had to strongly agree, because I have no clue what kind of tricks constexpr has up its sleeve. Now you may be wondering, why you'd read a comparison by someone who only knows one side of the coin. Behold, the power of the internet:
I go to sleep before that tweet, and in the morning wake up to a list of experts that made this post possible.
Usage
This Post will have examples, and all of them will be executable. For this we'll be using the godbold compiler explorer. If there's implementation defined behaviour the C++ experiments may show both a gcc and a clang link.
Rust
C++
Oli Scherer changed 4 years agoEdit mode Like Bookmark
Actual presentation is https://hackmd.io/@oli-obk/ryhIVhKkv
Reliable optimizations for idiomatic Rust
Optimization are mainly known for
making code fast,
aggrevating undefined behavior, and
making developers suffer during debugging.
In the Rust compiler we have a scheme that allows us to optimize code without affecting the debuggability while at the same time actually causing compile time speed ups. This talk first introduces the MIR, on which the Rust compiler does optimizations. Then various concepts are explained, which allow us to write idiomatic Rust and still getting performance that hand-crafted low level code can't beat. Finally an outlook on cool-things-to-come^TM shows how language-guaranteed optimizations can be leveraged in resource constrained environments.
Oli Scherer changed 4 years agoSlide mode Like Bookmark