Update to rust 1.85 (#35628)

* Update to rust 1.85

This is needed for cargo-deny

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Upgrade crown

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Clippy fixes

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Re-upgrade cargo-deny to 0.18

Keeping it locked to 0.18 just in case they
update their required rustc version again

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-02-24 18:44:35 +01:00 committed by GitHub
parent d78f7b2d78
commit be6765447d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 88 additions and 105 deletions

View file

@ -1,5 +1,5 @@
[toolchain]
channel = "1.83.0"
channel = "1.85.0"
components = [
"clippy",

View file

@ -9,7 +9,7 @@ use rustc_hir::{ImplItemRef, ItemKind, Node, OwnerId, PrimTy, TraitItemRef};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_lint::LateContext;
use rustc_middle::ty::fast_reject::SimplifiedType;
use rustc_middle::ty::{self, GenericArg, ParamEnv, Ty, TyCtxt, TypeVisitableExt};
use rustc_middle::ty::{self, GenericArg, Ty, TyCtxt, TypeVisitableExt, TypingEnv};
use rustc_span::hygiene::{ExpnKind, MacroKind};
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::{Span, DUMMY_SP};
@ -312,7 +312,7 @@ pub fn implements_trait<'tcx>(
) -> bool {
implements_trait_with_env(
cx.tcx,
cx.param_env,
cx.typing_env(),
ty,
trait_id,
ty_params.iter().map(|&arg| Some(arg)),
@ -322,7 +322,7 @@ pub fn implements_trait<'tcx>(
/// Same as `implements_trait` but allows using a `ParamEnv` different from the lint context.
pub fn implements_trait_with_env<'tcx>(
tcx: TyCtxt<'tcx>,
param_env: ParamEnv<'tcx>,
typing_env: TypingEnv<'tcx>,
ty: ty::Ty<'tcx>,
trait_id: DefId,
ty_params: impl IntoIterator<Item = Option<GenericArg<'tcx>>>,
@ -331,7 +331,8 @@ pub fn implements_trait_with_env<'tcx>(
if ty.has_escaping_bound_vars() {
return false;
}
let infcx = tcx.infer_ctxt().build();
let (infcx, param_env) = tcx.infer_ctxt().build_with_typing_env(typing_env);
let ty_params = tcx.mk_args_from_iter(
ty_params
.into_iter()

View file

@ -23,7 +23,6 @@ extern crate rustc_trait_selection;
extern crate rustc_type_ir;
use std::path::Path;
use std::process::ExitCode;
use rustc_driver::Callbacks;
use rustc_interface::interface::Config;
@ -61,7 +60,7 @@ impl Callbacks for MyCallbacks {
}
}
fn main() -> ExitCode {
fn main() {
let handler =
rustc_session::EarlyDiagCtxt::new(rustc_session::config::ErrorOutputType::default());
rustc_driver::init_logger(&handler, rustc_log::LoggerConfig::from_env("CROWN_LOG"));
@ -76,8 +75,5 @@ fn main() -> ExitCode {
// Pass cfg(crown) to rustc
args.extend(["--cfg".to_owned(), "crown".to_owned()]);
match rustc_driver::RunCompiler::new(&args, &mut MyCallbacks).run() {
Ok(_) => ExitCode::SUCCESS,
Err(_) => ExitCode::FAILURE,
}
rustc_driver::RunCompiler::new(&args, &mut MyCallbacks).run()
}

View file

@ -2,13 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use rustc_ast::ast::{AttrKind, Attribute};
use rustc_ast::token::TokenKind;
use rustc_ast::tokenstream::TokenTree;
use rustc_ast::AttrArgs;
use rustc_error_messages::MultiSpan;
use rustc_hir::{self as hir};
use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass, LintStore};
use rustc_lint::{LateContext, LateLintPass, Lint, LintContext, LintPass, LintStore};
use rustc_middle::ty;
use rustc_session::declare_tool_lint;
use rustc_span::symbol::Symbol;
@ -59,26 +57,30 @@ impl LintPass for NotracePass {
fn name(&self) -> &'static str {
"ServoNotracePass"
}
fn get_lints(&self) -> Vec<&'static Lint> {
vec![TRACE_IN_NO_TRACE, EMPTY_TRACE_IN_NO_TRACE]
}
}
fn get_must_not_have_traceable(sym: &Symbols, attrs: &[Attribute]) -> Option<usize> {
fn get_must_not_have_traceable(sym: &Symbols, attrs: &[hir::Attribute]) -> Option<usize> {
attrs
.iter()
.find(|attr| {
matches!(
&attr.kind,
AttrKind::Normal(normal)
if normal.item.path.segments.len() == 3 &&
normal.item.path.segments[0].ident.name == sym.crown &&
normal.item.path.segments[1].ident.name == sym.trace_in_no_trace_lint &&
normal.item.path.segments[2].ident.name == sym.must_not_have_traceable
hir::AttrKind::Normal(normal)
if normal.path.segments.len() == 3 &&
normal.path.segments[0].name == sym.crown &&
normal.path.segments[1].name == sym.trace_in_no_trace_lint &&
normal.path.segments[2].name == sym.must_not_have_traceable
)
})
.map(|x| match &x.get_normal_item().args {
AttrArgs::Empty => 0,
AttrArgs::Delimited(a) => match a
hir::AttrArgs::Empty => 0,
hir::AttrArgs::Delimited(a) => match a
.tokens
.trees()
.iter()
.next()
.expect("Arguments not found for must_not_have_traceable")
{

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use rustc_hir::{self as hir, intravisit as visit, ExprKind};
use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass, LintStore};
use rustc_lint::{LateContext, LateLintPass, Lint, LintContext, LintPass, LintStore};
use rustc_middle::ty;
use rustc_session::declare_tool_lint;
use rustc_span::def_id::{DefId, LocalDefId};
@ -217,6 +217,10 @@ impl LintPass for UnrootedPass {
fn name(&self) -> &'static str {
"ServoUnrootedPass"
}
fn get_lints(&self) -> Vec<&'static Lint> {
vec![UNROOTED_MUST_ROOT]
}
}
impl<'tcx> LateLintPass<'tcx> for UnrootedPass {