Skip to content

Commit 431992c

Browse files
committed
Chore: Bump nightly -> 2023-12-28
* So much breakage 14/27 done * It compiles...
1 parent 185e088 commit 431992c

File tree

17 files changed

+82
-79
lines changed

17 files changed

+82
-79
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ The following components are considered to be internal and they are excluded fro
2828

2929
## [Unreleased]
3030

31+
### Internal
32+
33+
- [ToDo]: Bumped nightly to 2023-12-28
34+
3135
## [0.5.0] - 2023-12-28
3236

3337
[#322]: https://github.com/rust-marker/marker/pull/322

cargo-marker/src/backend/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn marker_driver_bin_name() -> String {
1818
pub(crate) fn default_driver_info() -> DriverVersionInfo {
1919
DriverVersionInfo {
2020
// region replace rust toolchain dev
21-
toolchain: "nightly-2023-11-16".to_string(),
21+
toolchain: "nightly-2023-12-28".to_string(),
2222
// endregion replace rust toolchain dev
2323
// region replace marker version dev
2424
version: "0.6.0-dev".to_string(),

marker_api/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#![allow(clippy::unused_self)] // `self` is needed to change the behavior later
77
#![allow(clippy::missing_panics_doc)] // Temporary allow for `todo!`s
88
#![allow(clippy::new_without_default)] // Not very helpful as `new` is almost always cfged
9+
#![allow(clippy::no_effect_underscore_binding)] // FP with derive macros clippy#12045
910
#![cfg_attr(not(feature = "driver-api"), allow(dead_code))]
1011
#![cfg_attr(marker, warn(marker::marker_lints::not_using_has_span_trait))]
1112

marker_rustc_driver/src/context.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ impl<'ast, 'tcx: 'ast> MarkerContextDriver<'ast> for RustcContext<'ast, 'tcx> {
112112
_ => unreachable!(),
113113
}
114114
}
115-
builder
116115
},
117116
);
118117
}
@@ -261,7 +260,7 @@ fn select_children_with_name(
261260
let hir = tcx.hir();
262261

263262
let root_mod;
264-
let item = match hir.find_by_def_id(local_id) {
263+
let item = match tcx.opt_hir_node_by_def_id(local_id) {
265264
Some(hir::Node::Crate(r#mod)) => {
266265
root_mod = hir::ItemKind::Mod(r#mod);
267266
Some(&root_mod)

marker_rustc_driver/src/conversion/marker.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'ast, 'tcx> MarkerConverter<'ast, 'tcx> {
9696
}
9797

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

113113
self.with_body(hir_id, |inner| {
114-
let Some(hir::Node::Expr(expr)) = inner.rustc_cx.hir().find(hir_id) else {
114+
let Some(hir::Node::Expr(expr)) = inner.rustc_cx.opt_hir_node(hir_id) else {
115115
return None;
116116
};
117117
Some(inner.to_expr(expr))

marker_rustc_driver/src/conversion/marker/ast/expr.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
8484
}
8585
},
8686
hir::ExprKind::Call(operand, args) => match &operand.kind {
87-
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _, _)) => {
87+
hir::ExprKind::Path(hir::QPath::LangItem(hir::LangItem::RangeInclusiveNew, _)) => {
8888
ExprKind::Range(self.alloc({
8989
RangeExpr::new(data, Some(self.to_expr(&args[0])), Some(self.to_expr(&args[1])), true)
9090
}))
@@ -156,24 +156,24 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
156156
)))
157157
},
158158
hir::ExprKind::Struct(path, fields, base) => match path {
159-
hir::QPath::LangItem(hir::LangItem::RangeFull, _, _) => {
159+
hir::QPath::LangItem(hir::LangItem::RangeFull, _) => {
160160
ExprKind::Range(self.alloc(RangeExpr::new(data, None, None, false)))
161161
},
162-
hir::QPath::LangItem(hir::LangItem::RangeFrom, _, _) => {
162+
hir::QPath::LangItem(hir::LangItem::RangeFrom, _) => {
163163
ExprKind::Range(self.alloc(RangeExpr::new(data, Some(self.to_expr(fields[0].expr)), None, false)))
164164
},
165-
hir::QPath::LangItem(hir::LangItem::RangeTo, _, _) => {
165+
hir::QPath::LangItem(hir::LangItem::RangeTo, _) => {
166166
ExprKind::Range(self.alloc(RangeExpr::new(data, None, Some(self.to_expr(fields[0].expr)), false)))
167167
},
168-
hir::QPath::LangItem(hir::LangItem::Range, _, _) => ExprKind::Range(self.alloc({
168+
hir::QPath::LangItem(hir::LangItem::Range, _) => ExprKind::Range(self.alloc({
169169
RangeExpr::new(
170170
data,
171171
Some(self.to_expr(fields[0].expr)),
172172
Some(self.to_expr(fields[1].expr)),
173173
false,
174174
)
175175
})),
176-
hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _, _) => {
176+
hir::QPath::LangItem(hir::LangItem::RangeToInclusive, _) => {
177177
ExprKind::Range(self.alloc(RangeExpr::new(data, None, Some(self.to_expr(fields[0].expr)), true)))
178178
},
179179
_ => {
@@ -424,8 +424,11 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
424424
) -> ExprKind<'ast> {
425425
let body_id = closure.body;
426426
let body = self.rustc_cx.hir().body(body_id);
427-
match body.coroutine_kind {
428-
Some(hir::CoroutineKind::Async(hir::CoroutineSource::Fn)) => {
427+
match closure.kind {
428+
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
429+
hir::CoroutineDesugaring::Async,
430+
hir::CoroutineSource::Fn,
431+
)) => {
429432
if let hir::ExprKind::Block(block, None) = body.value.kind
430433
&& let Some(temp_drop) = block.expr
431434
&& let hir::ExprKind::DropTemps(inner_block) = temp_drop.kind
@@ -435,7 +438,10 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
435438

436439
unreachable!("`async fn` body desugar always has the same structure")
437440
},
438-
Some(hir::CoroutineKind::Async(hir::CoroutineSource::Block)) => {
441+
hir::ClosureKind::Coroutine(hir::CoroutineKind::Desugared(
442+
hir::CoroutineDesugaring::Async,
443+
hir::CoroutineSource::Block,
444+
)) => {
439445
let block_expr = body.value;
440446
if let hir::ExprKind::Block(block, None) = block_expr.kind {
441447
let api_block_expr = self.with_body(body_id, || {
@@ -451,12 +457,12 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
451457
}
452458
unreachable!("`async` block desugar always has the same structure")
453459
},
454-
Some(
455-
hir::CoroutineKind::Async(hir::CoroutineSource::Closure)
456-
| hir::CoroutineKind::Coroutine
457-
| hir::CoroutineKind::Gen(_),
460+
hir::ClosureKind::Coroutine(
461+
hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Gen | hir::CoroutineDesugaring::AsyncGen, _)
462+
| hir::CoroutineKind::Desugared(hir::CoroutineDesugaring::Async, hir::CoroutineSource::Closure)
463+
| hir::CoroutineKind::Coroutine(_),
458464
) => ExprKind::Unstable(self.alloc(UnstableExpr::new(data, ExprPrecedence::Closure))),
459-
None => ExprKind::Closure(self.alloc(self.to_closure_expr(data, closure))),
465+
hir::ClosureKind::Closure => ExprKind::Closure(self.alloc(self.to_closure_expr(data, closure))),
460466
}
461467
}
462468

marker_rustc_driver/src/conversion/marker/ast/generic.rs

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use marker_api::ast::{
22
BindingArg, ConstArg, ConstParam, GenericArgKind, GenericArgs, GenericParamKind, GenericParams, Lifetime,
3-
LifetimeArg, LifetimeClause, LifetimeKind, LifetimeParam, TraitBound, TraitRef, TyArg, TyClause, TyParam,
4-
TyParamBound, WhereClauseKind,
3+
LifetimeArg, LifetimeClause, LifetimeKind, LifetimeParam, TraitBound, TyArg, TyClause, TyParam, TyParamBound,
4+
WhereClauseKind,
55
};
66
use rustc_hir as hir;
77

@@ -39,8 +39,8 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
3939
let mut args: Vec<_> = rustc_args
4040
.args
4141
.iter()
42-
.filter(|rustc_arg| !rustc_arg.is_synthetic())
4342
.filter_map(|rustc_arg| match rustc_arg {
43+
rustc_hir::GenericArg::Lifetime(rust_lt) if rust_lt.ident.name.is_empty() => None,
4444
rustc_hir::GenericArg::Lifetime(rust_lt) => self
4545
.to_lifetime(rust_lt)
4646
.map(|lifetime| GenericArgKind::Lifetime(self.alloc(LifetimeArg::new(lifetime)))),
@@ -93,7 +93,9 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
9393
.iter()
9494
.filter_map(|bound| match bound {
9595
hir::GenericBound::Outlives(lifetime) => self.to_lifetime(lifetime),
96-
_ => unreachable!("lifetimes can only be bound by lifetimes"),
96+
hir::GenericBound::Trait(..) => {
97+
unreachable!("lifetimes can only be bound by lifetimes")
98+
},
9799
})
98100
.collect();
99101
let bounds = if bounds.is_empty() {
@@ -141,15 +143,17 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
141143
hir::GenericParamKind::Type { synthetic: false, .. } => {
142144
Some(GenericParamKind::Ty(self.alloc(TyParam::new(Some(span), name, id))))
143145
},
144-
hir::GenericParamKind::Const { ty, default } => {
145-
Some(GenericParamKind::Const(self.alloc(ConstParam::new(
146-
id,
147-
name,
148-
self.to_syn_ty(ty),
149-
default.map(|anon| self.to_const_expr(anon)),
150-
span,
151-
))))
152-
},
146+
hir::GenericParamKind::Const {
147+
ty,
148+
default,
149+
is_host_effect: _,
150+
} => Some(GenericParamKind::Const(self.alloc(ConstParam::new(
151+
id,
152+
name,
153+
self.to_syn_ty(ty),
154+
default.map(|anon| self.to_const_expr(anon)),
155+
span,
156+
)))),
153157
_ => None,
154158
}
155159
})
@@ -174,21 +178,6 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
174178
self.to_span_id(bound.span()),
175179
))))
176180
},
177-
hir::GenericBound::LangItemTrait(lang_item, span, _, rustc_args) => Some(TyParamBound::TraitBound(
178-
self.alloc(TraitBound::new(
179-
false,
180-
TraitRef::new(
181-
self.to_item_id(
182-
self.rustc_cx
183-
.get_lang_items(())
184-
.get(*lang_item)
185-
.expect("the lang item is used and should therefore be loaded"),
186-
),
187-
self.to_syn_generic_args(Some(rustc_args)),
188-
),
189-
self.to_span_id(*span),
190-
)),
191-
)),
192181
hir::GenericBound::Outlives(rust_lt) => self
193182
.to_lifetime(rust_lt)
194183
.map(|api_lt| TyParamBound::Lifetime(self.alloc(api_lt))),

marker_rustc_driver/src/conversion/marker/ast/item.rs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use marker_api::{
22
ast::{
3-
self, AdtKind, AssocItemKind, Body, CommonItemData, CommonPatData, ConstItem, EnumItem, EnumVariant,
4-
ExternBlockItem, ExternCrateItem, ExternItemKind, FnItem, FnParam, IdentPat, ImplItem, ItemField, ItemKind,
5-
ModItem, PatKind, StaticItem, StructItem, TraitItem, TyAliasItem, UnionItem, UnstableItem, UseItem, UseKind,
6-
Visibility,
3+
AdtKind, AssocItemKind, Body, CommonItemData, CommonPatData, ConstItem, EnumItem, EnumVariant, ExternBlockItem,
4+
ExternCrateItem, ExternItemKind, FnItem, FnParam, IdentPat, ImplItem, ItemField, ItemKind, ModItem, PatKind,
5+
StaticItem, StructItem, TraitItem, TyAliasItem, UnionItem, UnstableItem, UseItem, UseKind, Visibility,
76
},
87
common::{Abi, Constness, Mutability, Safety, Syncness},
98
prelude::*,
@@ -209,8 +208,10 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
209208
&& let hir::TyKind::OpaqueDef(item_id, _bounds, _) = rust_ty.kind
210209
&& let item = self.rustc_cx.hir().item(item_id)
211210
&& let hir::ItemKind::OpaqueTy(opty) = &item.kind
212-
&& let [output_bound] = opty.bounds
213-
&& let hir::GenericBound::LangItemTrait(_lang_item, _span, _hir_id, rustc_args) = output_bound
211+
&& let [hir::GenericBound::Trait(trait_ref, _)] = opty.bounds
212+
&& let Some(hir::PathSegment {
213+
args: Some(rustc_args), ..
214+
}) = trait_ref.trait_ref.path.segments.last()
214215
&& let [output_bound] = rustc_args.bindings
215216
{
216217
Some(self.to_syn_ty(output_bound.ty()))
@@ -267,7 +268,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
267268

268269
fn to_adt_kind(&self, var_data: &'tcx hir::VariantData) -> AdtKind<'ast> {
269270
match var_data {
270-
hir::VariantData::Struct(fields, _recovered) => AdtKind::Field(self.to_fields(fields).into()),
271+
hir::VariantData::Struct { fields, recovered: _ } => AdtKind::Field(self.to_fields(fields).into()),
271272
hir::VariantData::Tuple(fields, ..) => AdtKind::Tuple(self.to_fields(fields).into()),
272273
hir::VariantData::Unit(..) => AdtKind::Unit,
273274
}
@@ -480,17 +481,6 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
480481
return body;
481482
}
482483

483-
// Yield expressions are currently unstable
484-
if let Some(hir::CoroutineKind::Coroutine) = body.coroutine_kind {
485-
return self.alloc(Body::new(
486-
self.to_item_id(self.rustc_cx.hir().body_owner_def_id(body.id())),
487-
ast::ExprKind::Unstable(self.alloc(ast::UnstableExpr::new(
488-
ast::CommonExprData::new(self.to_expr_id(body.value.hir_id), self.to_span_id(body.value.span)),
489-
ast::ExprPrecedence::Unstable(0),
490-
))),
491-
));
492-
}
493-
494484
self.with_body(body.id(), || {
495485
let owner = self.to_item_id(self.rustc_cx.hir().body_owner_def_id(body.id()));
496486
let api_body = self.alloc(Body::new(owner, self.to_expr(body.value)));

marker_rustc_driver/src/conversion/marker/ast/pat.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
102102
};
103103
PatKind::Tuple(self.alloc(TuplePat::new(data, pats)))
104104
},
105-
hir::PatKind::Box(_) => PatKind::Unstable(self.alloc(UnstablePat::new(data))),
106105
hir::PatKind::Ref(pat, muta) => PatKind::Ref(
107106
self.alloc(
108107
RefPat::builder()
@@ -137,6 +136,19 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
137136
end.map(|expr| self.to_expr(expr)),
138137
matches!(kind, hir::RangeEnd::Included),
139138
))),
139+
#[allow(clippy::match_same_arms)]
140+
hir::PatKind::Box(_) => {
141+
// Unstable:
142+
// * Feature `box_patterns`
143+
// * Tracking issue: rust#29641
144+
PatKind::Unstable(self.alloc(UnstablePat::new(data)))
145+
},
146+
rustc_hir::PatKind::Never => {
147+
// Unstable:
148+
// * Feature `never_patterns`
149+
// * Tracking issue: rust#118155
150+
PatKind::Unstable(self.alloc(UnstablePat::new(data)))
151+
},
140152
}
141153
}
142154

marker_rustc_driver/src/conversion/marker/ast/ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
138138
| hir::def::Res::NonMacroAttr(_) => unreachable!("not a syntactic type {path:#?}"),
139139
hir::def::Res::Err => unreachable!("would have triggered a rustc error"),
140140
},
141-
hir::QPath::TypeRelative(_, _) | hir::QPath::LangItem(_, _, _) => {
141+
hir::QPath::TypeRelative(_, _) | hir::QPath::LangItem(_, _) => {
142142
TyKind::Path(self.alloc(PathTy::new(data, self.to_qpath_from_ty(qpath, rustc_ty))))
143143
},
144144
}

marker_rustc_driver/src/conversion/marker/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ impl<'ast, 'tcx> MarkerConverterInner<'ast, 'tcx> {
282282
AstQPath::new(None, Some(marker_ty), path, res)
283283
},
284284
// I recommend reading the comment of `Self::lang_item_map` for context
285-
hir::QPath::LangItem(item, span, _) => {
285+
hir::QPath::LangItem(item, span) => {
286286
let id = self
287287
.rustc_cx
288288
.lang_items()

marker_rustc_driver/src/conversion/rustc/common.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ impl<'ast, 'tcx> RustcConverter<'ast, 'tcx> {
140140
_ => unreachable!(),
141141
};
142142

143-
def_id
144-
.as_local()
145-
.map(|id| self.rustc_cx.hir().local_def_id_to_hir_id(id))
143+
def_id.as_local().map(|id| self.rustc_cx.local_def_id_to_hir_id(id))
146144
}
147145

148146
#[must_use]

marker_rustc_driver/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use marker_error::Context;
4545
use crate::conversion::rustc::RustcConverter;
4646

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

5151
pub const MARKER_SYSROOT_ENV: &str = "MARKER_SYSROOT";

marker_rustc_driver/src/lint_pass.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ fn process_crate_lifetime<'ast, 'tcx: 'ast>(
6060
storage: &'ast Storage<'ast>,
6161
adapter: &Adapter,
6262
) {
63-
let driver_cx = RustcContext::new(rustc_cx.tcx, rustc_cx.lint_store, storage);
63+
let driver_cx = RustcContext::new(
64+
rustc_cx.tcx,
65+
rustc_lint::unerased_lint_store(rustc_cx.tcx.sess),
66+
storage,
67+
);
6468

6569
// To support debug printing of AST nodes, as these might sometimes require the
6670
// context. Note that this only sets the cx for the rustc side. Each lint crate

marker_rustc_driver/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ extern crate rustc_span;
1414
use std::env;
1515

1616
use rustc_session::config::ErrorOutputType;
17-
use rustc_session::EarlyErrorHandler;
17+
use rustc_session::EarlyDiagCtxt;
1818

1919
use marker_rustc_driver::{try_main, MainError};
2020

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

2323
fn main() {
24-
let handler = EarlyErrorHandler::new(ErrorOutputType::default());
24+
let handler = EarlyDiagCtxt::new(ErrorOutputType::default());
2525
rustc_driver::init_rustc_env_logger(&handler);
2626

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

3333
rustc_driver::install_ice_hook(BUG_REPORT_URL, |handler| {
34-
handler.note_without_error(format!("{}", rustc_tools_util::get_version_info!()));
35-
handler.note_without_error("Achievement Unlocked: [Free Ice Cream]");
34+
handler.note(format!("{}", rustc_tools_util::get_version_info!()));
35+
handler.note("Achievement Unlocked: [Free Ice Cream]");
3636
});
3737

3838
std::process::exit(rustc_driver::catch_with_exit_code(|| {

marker_uilints/tests/ui/lint_level_attributes.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@ note: the lint level is defined here
1818
6 | #[deny(marker::marker_uilints::item_with_test_name)]
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2020

21-
error: aborting due to previous error; 1 warning emitted
21+
error: aborting due to 1 previous error; 1 warning emitted
2222

0 commit comments

Comments
 (0)