Skip to content

Commit

Permalink
Chore: Bump nightly -> 2023-12-28
Browse files Browse the repository at this point in the history
* So much breakage 14/27 done

* It compiles...
  • Loading branch information
xFrednet committed Dec 29, 2023
1 parent 185e088 commit 431992c
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 79 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ The following components are considered to be internal and they are excluded fro

## [Unreleased]

### Internal

- [ToDo]: Bumped nightly to 2023-12-28

## [0.5.0] - 2023-12-28

[#322]: https://github.com/rust-marker/marker/pull/322
Expand Down
2 changes: 1 addition & 1 deletion cargo-marker/src/backend/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub fn marker_driver_bin_name() -> String {
pub(crate) fn default_driver_info() -> DriverVersionInfo {
DriverVersionInfo {
// region replace rust toolchain dev
toolchain: "nightly-2023-11-16".to_string(),
toolchain: "nightly-2023-12-28".to_string(),
// endregion replace rust toolchain dev
// region replace marker version dev
version: "0.6.0-dev".to_string(),
Expand Down
1 change: 1 addition & 0 deletions marker_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#![allow(clippy::unused_self)] // `self` is needed to change the behavior later
#![allow(clippy::missing_panics_doc)] // Temporary allow for `todo!`s
#![allow(clippy::new_without_default)] // Not very helpful as `new` is almost always cfged
#![allow(clippy::no_effect_underscore_binding)] // FP with derive macros clippy#12045
#![cfg_attr(not(feature = "driver-api"), allow(dead_code))]
#![cfg_attr(marker, warn(marker::marker_lints::not_using_has_span_trait))]

Expand Down
3 changes: 1 addition & 2 deletions marker_rustc_driver/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ impl<'ast, 'tcx: 'ast> MarkerContextDriver<'ast> for RustcContext<'ast, 'tcx> {
_ => unreachable!(),
}
}
builder
},
);
}
Expand Down Expand Up @@ -261,7 +260,7 @@ fn select_children_with_name(
let hir = tcx.hir();

let root_mod;
let item = match hir.find_by_def_id(local_id) {
let item = match tcx.opt_hir_node_by_def_id(local_id) {
Some(hir::Node::Crate(r#mod)) => {
root_mod = hir::ItemKind::Mod(r#mod);
Some(&root_mod)
Expand Down
4 changes: 2 additions & 2 deletions marker_rustc_driver/src/conversion/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<'ast, 'tcx> MarkerConverter<'ast, 'tcx> {
}

self.with_body(hir_id, |inner| {
let Some(hir::Node::Stmt(stmt)) = inner.rustc_cx.hir().find(hir_id) else {
let Some(hir::Node::Stmt(stmt)) = inner.rustc_cx.opt_hir_node(hir_id) else {
return None;
};
inner.to_stmt(stmt)
Expand All @@ -111,7 +111,7 @@ impl<'ast, 'tcx> MarkerConverter<'ast, 'tcx> {
}

self.with_body(hir_id, |inner| {
let Some(hir::Node::Expr(expr)) = inner.rustc_cx.hir().find(hir_id) else {
let Some(hir::Node::Expr(expr)) = inner.rustc_cx.opt_hir_node(hir_id) else {
return None;
};
Some(inner.to_expr(expr))
Expand Down
34 changes: 20 additions & 14 deletions marker_rustc_driver/src/conversion/marker/ast/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
}
},
hir::ExprKind::Call(operand, args) => match &operand.kind {
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _, _)) => {
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _)) => {
ExprKind::Range(self.alloc({
RangeExpr::new(data, Some(self.to_expr(&args[0])), Some(self.to_expr(&args[1])), true)
}))
Expand Down Expand Up @@ -156,24 +156,24 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
)))
},
hir::ExprKind::Struct(path, fields, base) => match path {
hir::QPath::LangItem(hir::LangItem::RangeFull, _, _) => {
hir::QPath::LangItem(hir::LangItem::RangeFull, _) => {
ExprKind::Range(self.alloc(RangeExpr::new(data, None, None, false)))
},
hir::QPath::LangItem(hir::LangItem::RangeFrom, _, _) => {
hir::QPath::LangItem(hir::LangItem::RangeFrom, _) => {
ExprKind::Range(self.alloc(RangeExpr::new(data, Some(self.to_expr(fields[0].expr)), None, false)))
},
hir::QPath::LangItem(hir::LangItem::RangeTo, _, _) => {
hir::QPath::LangItem(hir::LangItem::RangeTo, _) => {
ExprKind::Range(self.alloc(RangeExpr::new(data, None, Some(self.to_expr(fields[0].expr)), false)))
},
hir::QPath::LangItem(hir::LangItem::Range, _, _) => ExprKind::Range(self.alloc({
hir::QPath::LangItem(hir::LangItem::Range, _) => ExprKind::Range(self.alloc({
RangeExpr::new(
data,
Some(self.to_expr(fields[0].expr)),
Some(self.to_expr(fields[1].expr)),
false,
)
})),
hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _, _) => {
hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _) => {
ExprKind::Range(self.alloc(RangeExpr::new(data, None, Some(self.to_expr(fields[0].expr)), true)))
},
_ => {
Expand Down Expand Up @@ -424,8 +424,11 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
) -> ExprKind<'ast> {
let body_id = closure.body;
let body = self.rustc_cx.hir().body(body_id);
match body.coroutine_kind {
Some(hir::CoroutineKind::Async(hir::CoroutineSource::Fn)) => {
match closure.kind {
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Async,
hir::CoroutineSource::Fn,
)) => {
if let hir::ExprKind::Block(block, None) = body.value.kind
&& let Some(temp_drop) = block.expr
&& let hir::ExprKind::DropTemps(inner_block) = temp_drop.kind
Expand All @@ -435,7 +438,10 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {

unreachable!("`async fn` body desugar always has the same structure")
},
Some(hir::CoroutineKind::Async(hir::CoroutineSource::Block)) => {
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
hir::CoroutineDesugaring::Async,
hir::CoroutineSource::Block,
)) => {
let block_expr = body.value;
if let hir::ExprKind::Block(block, None) = block_expr.kind {
let api_block_expr = self.with_body(body_id, || {
Expand All @@ -451,12 +457,12 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
}
unreachable!("`async` block desugar always has the same structure")
},
Some(
hir::CoroutineKind::Async(hir::CoroutineSource::Closure)
| hir::CoroutineKind::Coroutine
| hir::CoroutineKind::Gen(_),
hir::ClosureKind::Coroutine(
hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen | hir::CoroutineDesugaring::AsyncGen, _)
| hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, hir::CoroutineSource::Closure)
| hir::CoroutineKind::Coroutine(_),
) => ExprKind::Unstable(self.alloc(UnstableExpr::new(data, ExprPrecedence::Closure))),
None => ExprKind::Closure(self.alloc(self.to_closure_expr(data, closure))),
hir::ClosureKind::Closure => ExprKind::Closure(self.alloc(self.to_closure_expr(data, closure))),
}
}

Expand Down
45 changes: 17 additions & 28 deletions marker_rustc_driver/src/conversion/marker/ast/generic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use marker_api::ast::{
BindingArg, ConstArg, ConstParam, GenericArgKind, GenericArgs, GenericParamKind, GenericParams, Lifetime,
LifetimeArg, LifetimeClause, LifetimeKind, LifetimeParam, TraitBound, TraitRef, TyArg, TyClause, TyParam,
TyParamBound, WhereClauseKind,
LifetimeArg, LifetimeClause, LifetimeKind, LifetimeParam, TraitBound, TyArg, TyClause, TyParam, TyParamBound,
WhereClauseKind,
};
use rustc_hir as hir;

Expand Down Expand Up @@ -39,8 +39,8 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
let mut args: Vec<_> = rustc_args
.args
.iter()
.filter(|rustc_arg| !rustc_arg.is_synthetic())
.filter_map(|rustc_arg| match rustc_arg {
rustc_hir::GenericArg::Lifetime(rust_lt) if rust_lt.ident.name.is_empty() => None,
rustc_hir::GenericArg::Lifetime(rust_lt) => self
.to_lifetime(rust_lt)
.map(|lifetime| GenericArgKind::Lifetime(self.alloc(LifetimeArg::new(lifetime)))),
Expand Down Expand Up @@ -93,7 +93,9 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
.iter()
.filter_map(|bound| match bound {
hir::GenericBound::Outlives(lifetime) => self.to_lifetime(lifetime),
_ => unreachable!("lifetimes can only be bound by lifetimes"),
hir::GenericBound::Trait(..) => {
unreachable!("lifetimes can only be bound by lifetimes")
},
})
.collect();
let bounds = if bounds.is_empty() {
Expand Down Expand Up @@ -141,15 +143,17 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
hir::GenericParamKind::Type { synthetic: false, .. } => {
Some(GenericParamKind::Ty(self.alloc(TyParam::new(Some(span), name, id))))
},
hir::GenericParamKind::Const { ty, default } => {
Some(GenericParamKind::Const(self.alloc(ConstParam::new(
id,
name,
self.to_syn_ty(ty),
default.map(|anon| self.to_const_expr(anon)),
span,
))))
},
hir::GenericParamKind::Const {
ty,
default,
is_host_effect: _,
} => Some(GenericParamKind::Const(self.alloc(ConstParam::new(
id,
name,
self.to_syn_ty(ty),
default.map(|anon| self.to_const_expr(anon)),
span,
)))),
_ => None,
}
})
Expand All @@ -174,21 +178,6 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
self.to_span_id(bound.span()),
))))
},
hir::GenericBound::LangItemTrait(lang_item, span, _, rustc_args) => Some(TyParamBound::TraitBound(
self.alloc(TraitBound::new(
false,
TraitRef::new(
self.to_item_id(
self.rustc_cx
.get_lang_items(())
.get(*lang_item)
.expect("the lang item is used and should therefore be loaded"),
),
self.to_syn_generic_args(Some(rustc_args)),
),
self.to_span_id(*span),
)),
)),
hir::GenericBound::Outlives(rust_lt) => self
.to_lifetime(rust_lt)
.map(|api_lt| TyParamBound::Lifetime(self.alloc(api_lt))),
Expand Down
26 changes: 8 additions & 18 deletions marker_rustc_driver/src/conversion/marker/ast/item.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use marker_api::{
ast::{
self, AdtKind, AssocItemKind, Body, CommonItemData, CommonPatData, ConstItem, EnumItem, EnumVariant,
ExternBlockItem, ExternCrateItem, ExternItemKind, FnItem, FnParam, IdentPat, ImplItem, ItemField, ItemKind,
ModItem, PatKind, StaticItem, StructItem, TraitItem, TyAliasItem, UnionItem, UnstableItem, UseItem, UseKind,
Visibility,
AdtKind, AssocItemKind, Body, CommonItemData, CommonPatData, ConstItem, EnumItem, EnumVariant, ExternBlockItem,
ExternCrateItem, ExternItemKind, FnItem, FnParam, IdentPat, ImplItem, ItemField, ItemKind, ModItem, PatKind,
StaticItem, StructItem, TraitItem, TyAliasItem, UnionItem, UnstableItem, UseItem, UseKind, Visibility,
},
common::{Abi, Constness, Mutability, Safety, Syncness},
prelude::*,
Expand Down Expand Up @@ -209,8 +208,10 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
&& let hir::TyKind::OpaqueDef(item_id, _bounds, _) = rust_ty.kind
&& let item = self.rustc_cx.hir().item(item_id)
&& let hir::ItemKind::OpaqueTy(opty) = &item.kind
&& let [output_bound] = opty.bounds
&& let hir::GenericBound::LangItemTrait(_lang_item, _span, _hir_id, rustc_args) = output_bound
&& let [hir::GenericBound::Trait(trait_ref, _)] = opty.bounds
&& let Some(hir::PathSegment {
args: Some(rustc_args), ..
}) = trait_ref.trait_ref.path.segments.last()
&& let [output_bound] = rustc_args.bindings
{
Some(self.to_syn_ty(output_bound.ty()))
Expand Down Expand Up @@ -267,7 +268,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {

fn to_adt_kind(&self, var_data: &'tcx hir::VariantData) -> AdtKind<'ast> {
match var_data {
hir::VariantData::Struct(fields, _recovered) => AdtKind::Field(self.to_fields(fields).into()),
hir::VariantData::Struct { fields, recovered: _ } => AdtKind::Field(self.to_fields(fields).into()),
hir::VariantData::Tuple(fields, ..) => AdtKind::Tuple(self.to_fields(fields).into()),
hir::VariantData::Unit(..) => AdtKind::Unit,
}
Expand Down Expand Up @@ -480,17 +481,6 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
return body;
}

// Yield expressions are currently unstable
if let Some(hir::CoroutineKind::Coroutine) = body.coroutine_kind {
return self.alloc(Body::new(
self.to_item_id(self.rustc_cx.hir().body_owner_def_id(body.id())),
ast::ExprKind::Unstable(self.alloc(ast::UnstableExpr::new(
ast::CommonExprData::new(self.to_expr_id(body.value.hir_id), self.to_span_id(body.value.span)),
ast::ExprPrecedence::Unstable(0),
))),
));
}

self.with_body(body.id(), || {
let owner = self.to_item_id(self.rustc_cx.hir().body_owner_def_id(body.id()));
let api_body = self.alloc(Body::new(owner, self.to_expr(body.value)));
Expand Down
14 changes: 13 additions & 1 deletion marker_rustc_driver/src/conversion/marker/ast/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
};
PatKind::Tuple(self.alloc(TuplePat::new(data, pats)))
},
hir::PatKind::Box(_) => PatKind::Unstable(self.alloc(UnstablePat::new(data))),
hir::PatKind::Ref(pat, muta) => PatKind::Ref(
self.alloc(
RefPat::builder()
Expand Down Expand Up @@ -137,6 +136,19 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
end.map(|expr| self.to_expr(expr)),
matches!(kind, hir::RangeEnd::Included),
))),
#[allow(clippy::match_same_arms)]
hir::PatKind::Box(_) => {
// Unstable:
// * Feature `box_patterns`
// * Tracking issue: rust#29641
PatKind::Unstable(self.alloc(UnstablePat::new(data)))
},
rustc_hir::PatKind::Never => {
// Unstable:
// * Feature `never_patterns`
// * Tracking issue: rust#118155
PatKind::Unstable(self.alloc(UnstablePat::new(data)))
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion marker_rustc_driver/src/conversion/marker/ast/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
| hir::def::Res::NonMacroAttr(_) => unreachable!("not a syntactic type {path:#?}"),
hir::def::Res::Err => unreachable!("would have triggered a rustc error"),
},
hir::QPath::TypeRelative(_, _) | hir::QPath::LangItem(_, _, _) => {
hir::QPath::TypeRelative(_, _) | hir::QPath::LangItem(_, _) => {
TyKind::Path(self.alloc(PathTy::new(data, self.to_qpath_from_ty(qpath, rustc_ty))))
},
}
Expand Down
2 changes: 1 addition & 1 deletion marker_rustc_driver/src/conversion/marker/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
AstQPath::new(None, Some(marker_ty), path, res)
},
// I recommend reading the comment of `Self::lang_item_map` for context
hir::QPath::LangItem(item, span, _) => {
hir::QPath::LangItem(item, span) => {
let id = self
.rustc_cx
.lang_items()
Expand Down
4 changes: 1 addition & 3 deletions marker_rustc_driver/src/conversion/rustc/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ impl<'ast, 'tcx> RustcConverter<'ast, 'tcx> {
_ => unreachable!(),
};

def_id
.as_local()
.map(|id| self.rustc_cx.hir().local_def_id_to_hir_id(id))
def_id.as_local().map(|id| self.rustc_cx.local_def_id_to_hir_id(id))
}

#[must_use]
Expand Down
2 changes: 1 addition & 1 deletion marker_rustc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use marker_error::Context;
use crate::conversion::rustc::RustcConverter;

// region replace rust toolchain dev
const RUSTC_TOOLCHAIN_VERSION: &str = "nightly-2023-11-16";
const RUSTC_TOOLCHAIN_VERSION: &str = "nightly-2023-12-28";
// endregion replace rust toolchain dev

pub const MARKER_SYSROOT_ENV: &str = "MARKER_SYSROOT";
Expand Down
6 changes: 5 additions & 1 deletion marker_rustc_driver/src/lint_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ fn process_crate_lifetime<'ast, 'tcx: 'ast>(
storage: &'ast Storage<'ast>,
adapter: &Adapter,
) {
let driver_cx = RustcContext::new(rustc_cx.tcx, rustc_cx.lint_store, storage);
let driver_cx = RustcContext::new(
rustc_cx.tcx,
rustc_lint::unerased_lint_store(rustc_cx.tcx.sess),
storage,
);

// To support debug printing of AST nodes, as these might sometimes require the
// context. Note that this only sets the cx for the rustc side. Each lint crate
Expand Down
8 changes: 4 additions & 4 deletions marker_rustc_driver/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ extern crate rustc_span;
use std::env;

use rustc_session::config::ErrorOutputType;
use rustc_session::EarlyErrorHandler;
use rustc_session::EarlyDiagCtxt;

use marker_rustc_driver::{try_main, MainError};

const BUG_REPORT_URL: &str = "https://github.com/rust-marker/marker/issues/new?template=panic.yml";

fn main() {
let handler = EarlyErrorHandler::new(ErrorOutputType::default());
let handler = EarlyDiagCtxt::new(ErrorOutputType::default());
rustc_driver::init_rustc_env_logger(&handler);

// FIXME(xFrednet): The ICE hook would ideally distinguish where the error
Expand All @@ -31,8 +31,8 @@ fn main() {
// caused the panic in the lint crate. rust-marker/marker#10

rustc_driver::install_ice_hook(BUG_REPORT_URL, |handler| {
handler.note_without_error(format!("{}", rustc_tools_util::get_version_info!()));
handler.note_without_error("Achievement Unlocked: [Free Ice Cream]");
handler.note(format!("{}", rustc_tools_util::get_version_info!()));
handler.note("Achievement Unlocked: [Free Ice Cream]");
});

std::process::exit(rustc_driver::catch_with_exit_code(|| {
Expand Down
2 changes: 1 addition & 1 deletion marker_uilints/tests/ui/lint_level_attributes.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ note: the lint level is defined here
6 | #[deny(marker::marker_uilints::item_with_test_name)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error; 1 warning emitted
error: aborting due to 1 previous error; 1 warning emitted

Loading

0 comments on commit 431992c

Please sign in to comment.