Skip to content

Rollup of 9 pull requests #140239

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

Merged
merged 24 commits into from
Apr 24, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ac34a6f
Stabilize the `cell_update` feature
tgross35 Dec 17, 2024
fe03f76
std: Add performance warnings to HashMap::get_disjoint_mut
xizheyin Apr 3, 2025
35a20de
Implement `SmirInterface`
makai410 Apr 18, 2025
16381b3
Use `currently` for futher improvement
xizheyin Apr 20, 2025
08baec4
add a test for byte string literal pattern mutability mismatches
dianne Apr 22, 2025
6184025
make `str` literal patterns usable in deref patterns
dianne Mar 25, 2025
3250344
make `[u8]` and `[u8;N]` literal patterns usable in deref patterns
dianne Apr 16, 2025
4c7e866
update unstable book to mention string/bytestring typing
dianne Apr 19, 2025
19e44d4
Don't warn about `v128` in wasm ABI transition
alexcrichton Apr 14, 2025
51088fd
Remove `synstructure::Structure::underscore_const` calls.
nnethercote Apr 23, 2025
5b390cd
Make `SmirInterface` pub(crate) and rename `Context` to `SmirContext`
makai410 Apr 23, 2025
780f95d
Impl new API `std::os::unix::fs::mkfifo` under feature `unix_fifo`
NobodyXu Apr 6, 2025
2a5c349
Extend HIR to track the source and syntax of a lifetime
shepmaster Mar 28, 2025
055a27d
Remove some unnecessary clones.
nnethercote Apr 23, 2025
af80477
Refactor `StableMir` to avoid some clones.
nnethercote Apr 23, 2025
fdaa91a
Rollup merge of #134446 - tgross35:stabilize-cell_update, r=jhpratt
matthiaskrgr Apr 24, 2025
cb3c5d7
Rollup merge of #139307 - xizheyin:issue-139296, r=joboet
matthiaskrgr Apr 24, 2025
10732e1
Rollup merge of #139450 - NobodyXu:new-api/make-fifo, r=tgross35
matthiaskrgr Apr 24, 2025
32b2428
Rollup merge of #139809 - alexcrichton:wasm-simd-safe, r=RalfJung
matthiaskrgr Apr 24, 2025
2a07f99
Rollup merge of #139852 - makai410:smir-refactor, r=celinval
matthiaskrgr Apr 24, 2025
2ba3a5c
Rollup merge of #139945 - shepmaster:hir-lifetime-syntax-source, r=nn…
matthiaskrgr Apr 24, 2025
5d52b37
Rollup merge of #140028 - dianne:lit-deref-pats-p1, r=oli-obk
matthiaskrgr Apr 24, 2025
1254559
Rollup merge of #140181 - nnethercote:rm-underscore_const, r=compiler…
matthiaskrgr Apr 24, 2025
986750d
Rollup merge of #140232 - nnethercote:rm-unnecessary-clones, r=Sparro…
matthiaskrgr Apr 24, 2025
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
3 changes: 1 addition & 2 deletions compiler/rustc_smir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

pub mod rustc_internal;

// Make this module private for now since external users should not call these directly.
mod rustc_smir;
pub mod rustc_smir;

pub mod stable_mir;
20 changes: 13 additions & 7 deletions compiler/rustc_smir/src/rustc_internal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ use rustc_span::def_id::{CrateNum, DefId};
use scoped_tls::scoped_thread_local;
use stable_mir::Error;
use stable_mir::abi::Layout;
use stable_mir::compiler_interface::SmirInterface;
use stable_mir::ty::IndexedVal;

use crate::rustc_smir::context::TablesWrapper;
use crate::rustc_smir::context::SmirCtxt;
use crate::rustc_smir::{Stable, Tables};
use crate::stable_mir;

Expand Down Expand Up @@ -196,12 +197,12 @@ pub fn crate_num(item: &stable_mir::Crate) -> CrateNum {
// datastructures and stable MIR datastructures
scoped_thread_local! (static TLV: Cell<*const ()>);

pub(crate) fn init<'tcx, F, T>(tables: &TablesWrapper<'tcx>, f: F) -> T
pub(crate) fn init<'tcx, F, T>(cx: &SmirCtxt<'tcx>, f: F) -> T
where
F: FnOnce() -> T,
{
assert!(!TLV.is_set());
let ptr = tables as *const _ as *const ();
let ptr = cx as *const _ as *const ();
TLV.set(&Cell::new(ptr), || f())
}

Expand All @@ -212,8 +213,8 @@ pub(crate) fn with_tables<R>(f: impl for<'tcx> FnOnce(&mut Tables<'tcx>) -> R) -
TLV.with(|tlv| {
let ptr = tlv.get();
assert!(!ptr.is_null());
let wrapper = ptr as *const TablesWrapper<'_>;
let mut tables = unsafe { (*wrapper).0.borrow_mut() };
let context = ptr as *const SmirCtxt<'_>;
let mut tables = unsafe { (*context).0.borrow_mut() };
f(&mut *tables)
})
}
Expand All @@ -222,7 +223,7 @@ pub fn run<F, T>(tcx: TyCtxt<'_>, f: F) -> Result<T, Error>
where
F: FnOnce() -> T,
{
let tables = TablesWrapper(RefCell::new(Tables {
let tables = SmirCtxt(RefCell::new(Tables {
tcx,
def_ids: IndexMap::default(),
alloc_ids: IndexMap::default(),
Expand All @@ -233,7 +234,12 @@ where
mir_consts: IndexMap::default(),
layouts: IndexMap::default(),
}));
stable_mir::compiler_interface::run(&tables, || init(&tables, f))

let interface = SmirInterface { cx: tables };

// Pass the `SmirInterface` to compiler_interface::run
// and initialize the rustc-specific TLS with tables.
stable_mir::compiler_interface::run(&interface, || init(&interface.cx, f))
}

/// Instantiate and run the compiler with the provided arguments and callback.
Expand Down
Loading