Skip to content

Commit

Permalink
bump nightly toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Nov 30, 2024
1 parent b708da9 commit 9401b84
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 82 deletions.
42 changes: 3 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/dash_compiler/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ impl<'cx, 'interner> InstructionBuilder<'cx, 'interner> {
}
}

impl<'cx, 'interner> Deref for InstructionBuilder<'cx, 'interner> {
impl<'interner> Deref for InstructionBuilder<'_, 'interner> {
type Target = FunctionCompiler<'interner>;
fn deref(&self) -> &Self::Target {
self.inner
}
}

impl<'cx, 'interner> DerefMut for InstructionBuilder<'cx, 'interner> {
impl DerefMut for InstructionBuilder<'_, '_> {
fn deref_mut(&mut self) -> &mut Self::Target {
self.inner
}
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_compiler/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ macro_rules! simple_instruction {
}
}

impl<'cx, 'interner> InstructionBuilder<'cx, 'interner> {
impl InstructionBuilder<'_, '_> {
pub fn build_jmp_header(&mut self, label: Label, is_local_label: bool) {
self.write_all(&[0, 0]);
match is_local_label {
Expand Down
6 changes: 3 additions & 3 deletions crates/dash_compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,11 @@ impl<'interner> FunctionCompiler<'interner> {
let enclosing_function = self.scopes.enclosing_function_of(scope);

if let Some(slot) = self.scopes[scope].find_local(ident) {
return Some((
Some((
slot,
self.scopes[enclosing_function].expect_function().locals[slot as usize].clone(),
enclosing_function,
));
))
} else {
let parent = self.scopes[scope].parent?;
let parent_enclosing_function = self.scopes.enclosing_function_of(parent);
Expand Down Expand Up @@ -368,7 +368,7 @@ impl<'interner> FunctionCompiler<'interner> {
}
}

impl<'interner> Visitor<Result<(), Error>> for FunctionCompiler<'interner> {
impl Visitor<Result<(), Error>> for FunctionCompiler<'_> {
fn accept(&mut self, Statement { kind, span }: Statement) -> Result<(), Error> {
match kind {
StatementKind::Expression(e) => self.visit_expression_statement(e),
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_llvm_jit_backend/src/llvm_wrapper/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Context {
}

pub fn create_module(&mut self) -> Module {
self.create_module_with_name(CStr::from_bytes_with_nul(b"anon\0").unwrap())
self.create_module_with_name(c"anon")
}

pub fn i1_ty(&self) -> Ty {
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_llvm_jit_backend/src/llvm_wrapper/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Module {
}

pub fn create_c_function(&self, ty: &Ty) -> Function {
self.create_c_function_with_name(CStr::from_bytes_with_nul(b"anon\0").unwrap(), ty)
self.create_c_function_with_name(c"anon", ty)
}

pub fn run_pass_manager(&self, pm: &PassManager) {
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_middle/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ impl TokenType {

pub fn fmt_for_expected_tys(&self) -> impl fmt::Display + '_ {
struct DisplayExpectedTys<'a>(&'a TokenType);
impl<'a> fmt::Display for DisplayExpectedTys<'a> {
impl fmt::Display for DisplayExpectedTys<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self.0 {
TokenType::DUMMY_IDENTIFIER => write!(f, "<identifier>"),
Expand Down
6 changes: 3 additions & 3 deletions crates/dash_middle/src/parser/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl<'f, 'a, 'buf> DiagnosticBuilder<'f, 'a, 'buf> {
}
}

impl<'f, 'a, 'buf> fmt::Display for DiagnosticBuilder<'f, 'a, 'buf> {
impl fmt::Display for DiagnosticBuilder<'_, '_, '_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
macro_rules! write_style {
($sink:expr, $($style:ident) *, $s:expr) => {
Expand Down Expand Up @@ -256,7 +256,7 @@ fn line_data(source: &str, span: Span) -> LineData<'_> {
}
}

impl<'a, 'buf> fmt::Display for FormattableError<'a, 'buf> {
impl fmt::Display for FormattableError<'_, '_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut diag = DiagnosticBuilder::error(self);
match *self.error {
Expand Down Expand Up @@ -422,7 +422,7 @@ pub struct FormattableErrors<'a, 'buf> {
colors: bool,
}

impl<'a, 'buf> fmt::Display for FormattableErrors<'a, 'buf> {
impl fmt::Display for FormattableErrors<'_, '_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for error in self.errors {
FormattableError {
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_parser/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use dash_regex::Flags;

use crate::{any, Parser};

impl<'a, 'interner> Parser<'a, 'interner> {
impl Parser<'_, '_> {
pub fn parse_expression(&mut self) -> Option<Expr> {
self.parse_sequence()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_parser/src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::{any, Parser};

type ParameterList = Option<Vec<(Parameter, Option<Expr>, Option<TypeSegment>)>>;

impl<'a, 'interner> Parser<'a, 'interner> {
impl Parser<'_, '_> {
pub fn parse_statement(&mut self) -> Option<Statement> {
self.error_sync = false;
let lo_span = self.current()?.span;
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_parser/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dash_middle::parser::types::{LiteralType, TypeSegment};

use crate::Parser;

impl<'a, 'interner> Parser<'a, 'interner> {
impl Parser<'_, '_> {
pub fn parse_type_segment(&mut self) -> Option<TypeSegment> {
self.parse_union_type()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_typed_cfg/src/passes/bb_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ pub struct BBGenerationCtxt<'a, 'q, Q> {
pub query: &'q mut Q,
}

impl<'a, 'q, Q: BBGenerationQuery> BBGenerationCtxt<'a, 'q, Q> {
impl<Q: BBGenerationQuery> BBGenerationCtxt<'_, '_, Q> {
pub fn find_bbs(&mut self) {
self.bbs.insert(
0,
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_typed_cfg/src/passes/type_infer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct TypeInferCtxt<'a, 'q, Q> {
pub visited: HashSet<usize>,
}

impl<'a, 'q, Q: TypeInferQuery> TypeInferCtxt<'a, 'q, Q> {
impl<Q: TypeInferQuery> TypeInferCtxt<'_, '_, Q> {
fn get_or_insert_local_ty(&mut self, index: u16) -> Type {
match self.local_tys.get(&index) {
Some(ty) => ty.clone(),
Expand Down
2 changes: 1 addition & 1 deletion crates/dash_vm/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl<'vm> Deref for DispatchContext<'vm> {
}
}

impl<'vm> DerefMut for DispatchContext<'vm> {
impl DerefMut for DispatchContext<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.scope
}
Expand Down
8 changes: 4 additions & 4 deletions crates/dash_vm/src/localscope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ pub struct LocalScope<'vm> {
_p: PhantomData<&'vm mut Vm>,
}

impl<'vm> LocalScope<'vm> {
impl LocalScope<'_> {
fn scope_data_mut(&mut self) -> &mut ScopeData {
unsafe { self.scope_data.as_mut() }
}
Expand Down Expand Up @@ -235,21 +235,21 @@ impl<'vm> LocalScope<'vm> {

// TODO: remove this Deref impl
// It's too prone to bugs due to similar methods
impl<'a> Deref for LocalScope<'a> {
impl Deref for LocalScope<'_> {
type Target = Vm;

fn deref(&self) -> &Self::Target {
unsafe { &*self.vm }
}
}

impl<'a> DerefMut for LocalScope<'a> {
impl DerefMut for LocalScope<'_> {
fn deref_mut(&mut self) -> &mut Self::Target {
unsafe { &mut *self.vm }
}
}

impl<'vm> Drop for LocalScope<'vm> {
impl Drop for LocalScope<'_> {
fn drop(&mut self) {
let head = self.scopes.head;
let data = self.scope_data_mut();
Expand Down
9 changes: 1 addition & 8 deletions crates/dash_vm/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::num::FpCategory;

use dash_middle::interner::{sym, Symbol};
use dash_middle::interner::{Symbol, sym};

use crate::localscope::LocalScope;

Expand All @@ -16,13 +16,6 @@ pub fn unlikely(b: bool) -> bool {
b
}

/// https://doc.rust-lang.org/beta/nightly-rustc/rustc_data_structures/captures/trait.Captures.html
/// and
/// https://github.com/rust-lang/rust/issues/34511#issuecomment-373423999
pub trait Captures<'a> {}

impl<'a, T: ?Sized> Captures<'a> for T {}

pub fn intern_f64(sc: &mut LocalScope, n: f64) -> Symbol {
if n.trunc() == n && n >= 0.0 && n <= usize::MAX as f64 {
// Happy path: no fractional part and fits in a usize
Expand Down
2 changes: 1 addition & 1 deletion lints/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021"

[dependencies]
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "7d7b298" }
clippy_utils = { git = "https://github.com/rust-lang/rust-clippy", rev = "af1f78a" }

[dev-dependencies]
prettydiff = "0.7.0"
Expand Down
19 changes: 8 additions & 11 deletions lints/src/missing_root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use rustc_hir::def::{DefKind, Res};
use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::intravisit::FnKind;
use rustc_hir::{self as hir};
use rustc_index::bit_set::BitSet;
use rustc_index::IndexVec;
use rustc_index::bit_set::BitSet;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_infer::traits::{Obligation, ObligationCause};
use rustc_lint::{LateContext, LateLintPass};
Expand All @@ -18,8 +18,8 @@ use rustc_middle::mir::{self, BasicBlock, Body, Local};
use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
use rustc_middle::{bug, ty};
use rustc_session::{declare_lint, impl_lint_pass};
use rustc_span::source_map::Spanned;
use rustc_span::Span;
use rustc_span::source_map::Spanned;
use rustc_target::abi::VariantIdx;
use rustc_trait_selection::traits::ObligationCtxt;

Expand Down Expand Up @@ -181,7 +181,7 @@ struct PlaceVisitor<'a, 'b, 'tcx> {
state: &'a mut TraverseState,
}

impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PlaceVisitor<'a, '_, 'tcx> {
impl<'tcx> mir::visit::Visitor<'tcx> for PlaceVisitor<'_, '_, 'tcx> {
fn visit_place(&mut self, place: &mir::Place<'tcx>, context: mir::visit::PlaceContext, location: mir::Location) {
let base_ty = self.mir.local_decls[place.local].ty;

Expand Down Expand Up @@ -347,13 +347,10 @@ fn traverse<'tcx>(
match terminator.edges() {
mir::TerminatorEdges::None => state,
mir::TerminatorEdges::Single(bb) => traverse(cx, mir, state, bb),
mir::TerminatorEdges::Double(bb1, bb2) => TraverseState::join(
state.clone(),
[
traverse(cx, mir, state.clone(), bb1),
traverse(cx, mir, state.clone(), bb2),
],
),
mir::TerminatorEdges::Double(bb1, bb2) => TraverseState::join(state.clone(), [
traverse(cx, mir, state.clone(), bb1),
traverse(cx, mir, state.clone(), bb2),
]),
mir::TerminatorEdges::AssignOnReturn {
return_,
cleanup,
Expand Down Expand Up @@ -394,7 +391,7 @@ impl LateLintPass<'_> for MissingRoot {
let mir = cx.tcx.optimized_mir(def_id);
let locals = IndexVec::<Local, LocalState>::from_elem_n(LocalState::LiveBeforeBorrow, mir.local_decls.len());

let infcx = cx.tcx.infer_ctxt().build();
let infcx = cx.tcx.infer_ctxt().build(cx.typing_mode());
let ocx = ObligationCtxt::new(&infcx);
traverse(
&mut TraverseCtxt {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2024-09-05"
channel = "nightly-2024-11-28"
components = ["clippy", "rust-src", "rustc-dev", "llvm-tools-preview"]

0 comments on commit 9401b84

Please sign in to comment.