From 684092014d5d6e53ca2f1d3ac5a0eebee2e33312 Mon Sep 17 00:00:00 2001 From: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> Date: Wed, 7 Aug 2024 17:40:18 +0900 Subject: [PATCH] Update to rust 1.80.0 (#32896) * Update for nix Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * Update to Rust 1.80.0 Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * Rename to BindingMode from BindingAnnotation https://github.com/rust-lang/rust/pull/124047 Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * Remove TypeVariableOriginKind https://github.com/rust-lang/rust/pull/123016 Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * Remove TypeVariableOrigin https://github.com/rust-lang/rust/pull/124955 Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * Remove LintDiagnostic::msg rust-lang/rust#125410 Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * common.rs fmt mistake indents Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * trace_in_no_trace.rs remove mistake space Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * trace_in_no_trace.rs remove mistake head space Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> * Workaround for https://github.com/servo/servo/issues/32912 It's dirty but it worked on 2000 runs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: Hayashi Mikihiro <34ttrweoewiwe28@gmail.com> Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> Co-authored-by: Samson <16504129+sagudev@users.noreply.github.com> --- components/net/tests/resource_thread.rs | 3 ++ etc/shell.nix | 2 +- rust-toolchain.toml | 2 +- support/crown/src/common.rs | 7 +-- support/crown/src/trace_in_no_trace.rs | 24 ++++------ support/crown/src/unrooted_must_root.rs | 64 +++++++++++-------------- 6 files changed, 44 insertions(+), 58 deletions(-) diff --git a/components/net/tests/resource_thread.rs b/components/net/tests/resource_thread.rs index 9a32143d71557..3e33a117bb312 100644 --- a/components/net/tests/resource_thread.rs +++ b/components/net/tests/resource_thread.rs @@ -35,6 +35,9 @@ fn test_exit() { ); resource_thread.send(CoreResourceMsg::Exit(sender)).unwrap(); receiver.recv().unwrap(); + // Workaround for https://github.com/servo/servo/issues/32912 + #[cfg(windows)] + std::thread::sleep(std::time::Duration::from_millis(100)); } #[test] diff --git a/etc/shell.nix b/etc/shell.nix index 019a5d51baa6f..aeae9228b55a6 100644 --- a/etc/shell.nix +++ b/etc/shell.nix @@ -10,7 +10,7 @@ with import (builtins.fetchTarball { overlays = [ (import (builtins.fetchTarball { # Bumped the channel in rust-toolchain.toml? Bump this commit too! - url = "https://github.com/oxalica/rust-overlay/archive/7f0e3ef7b7fbed78e12e5100851175d28af4b7c6.tar.gz"; + url = "https://github.com/oxalica/rust-overlay/archive/8b81b8ed00b20fd57b24adcb390bd96ea81ecd90.tar.gz"; })) ]; config = { diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 17804f03d3ac3..25c7f52f34524 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,6 @@ [toolchain] # Be sure to update etc/shell.nix when bumping this! -channel = "1.78.0" +channel = "1.80.0" components = [ # For support/crown diff --git a/support/crown/src/common.rs b/support/crown/src/common.rs index d0b7d652694c4..7899563bbeb01 100644 --- a/support/crown/src/common.rs +++ b/support/crown/src/common.rs @@ -6,7 +6,6 @@ use rustc_ast::Mutability; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; use rustc_hir::{ImplItemRef, ItemKind, Node, OwnerId, PrimTy, TraitItemRef}; -use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use rustc_infer::infer::TyCtxtInferExt; use rustc_lint::LateContext; use rustc_middle::ty::fast_reject::SimplifiedType; @@ -338,14 +337,10 @@ pub fn implements_trait_with_env<'tcx>( return false; } let infcx = tcx.infer_ctxt().build(); - let orig = TypeVariableOrigin { - kind: TypeVariableOriginKind::MiscVariable, - span: DUMMY_SP, - }; let ty_params = tcx.mk_args_from_iter( ty_params .into_iter() - .map(|arg| arg.unwrap_or_else(|| infcx.next_ty_var(orig).into())), + .map(|arg| arg.unwrap_or_else(|| infcx.next_ty_var(DUMMY_SP).into())), ); infcx .type_implements_trait( diff --git a/support/crown/src/trace_in_no_trace.rs b/support/crown/src/trace_in_no_trace.rs index ba3f1f33524e1..c021c8ae24507 100644 --- a/support/crown/src/trace_in_no_trace.rs +++ b/support/crown/src/trace_in_no_trace.rs @@ -131,24 +131,18 @@ fn incorrect_no_trace<'tcx, I: Into + Copy>( { let inner = substs.type_at(pos); if inner.is_primitive_ty() { - cx.lint( - EMPTY_TRACE_IN_NO_TRACE, - EMPTY_TRACE_IN_NO_TRACE_MSG, - |lint| { - lint.span(span); - }, - ) + cx.lint(EMPTY_TRACE_IN_NO_TRACE, |lint| { + lint.primary_message(EMPTY_TRACE_IN_NO_TRACE_MSG); + lint.span(span); + }) } else if is_jstraceable(cx, inner) { - cx.lint( - TRACE_IN_NO_TRACE, - format!( + cx.lint(TRACE_IN_NO_TRACE, |lint| { + lint.primary_message(format!( "must_not_have_traceable marked wrapper must not have \ jsmanaged inside on {pos}-th position. Consider removing the wrapper." - ), - |lint| { - lint.span(span); - }, - ) + )); + lint.span(span); + }) } false } else { diff --git a/support/crown/src/unrooted_must_root.rs b/support/crown/src/unrooted_must_root.rs index 449256658bae3..e23a78bd4ae3b 100644 --- a/support/crown/src/unrooted_must_root.rs +++ b/support/crown/src/unrooted_must_root.rs @@ -187,14 +187,13 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { for field in def.fields() { let field_type = cx.tcx.type_of(field.def_id); if is_unrooted_ty(&self.symbols, cx, field_type.skip_binder(), false) { - cx.lint( - UNROOTED_MUST_ROOT, - "Type must be rooted, use #[crown::unrooted_must_root_lint::must_root] \ - on the struct definition to propagate", - |lint| { - lint.span(field.span); - }, - ) + cx.lint(UNROOTED_MUST_ROOT, |lint| { + lint.primary_message( + "Type must be rooted, use #[crown::unrooted_must_root_lint::must_root] \ + on the struct definition to propagate" + ); + lint.span(field.span); + }) } } } @@ -212,15 +211,14 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { for field in fields { let field_type = cx.tcx.type_of(field.def_id); if is_unrooted_ty(&self.symbols, cx, field_type.skip_binder(), false) { - cx.lint( - UNROOTED_MUST_ROOT, - "Type must be rooted, \ - use #[crown::unrooted_must_root_lint::must_root] \ - on the enum definition to propagate", - |lint| { - lint.span(field.ty.span); - }, - ) + cx.lint(UNROOTED_MUST_ROOT, |lint| { + lint.primary_message( + "Type must be rooted, \ + use #[crown::unrooted_must_root_lint::must_root] \ + on the enum definition to propagate", + ); + lint.span(field.ty.span); + }) } } }, @@ -250,7 +248,8 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { for (arg, ty) in decl.inputs.iter().zip(sig.inputs().skip_binder().iter()) { if is_unrooted_ty(&self.symbols, cx, *ty, false) { - cx.lint(UNROOTED_MUST_ROOT, "Type must be rooted", |lint| { + cx.lint(UNROOTED_MUST_ROOT, |lint| { + lint.primary_message("Type must be rooted"); lint.span(arg.span); }) } @@ -259,7 +258,8 @@ impl<'tcx> LateLintPass<'tcx> for UnrootedPass { if !in_new_function && is_unrooted_ty(&self.symbols, cx, sig.output().skip_binder(), false) { - cx.lint(UNROOTED_MUST_ROOT, "Type must be rooted", |lint| { + cx.lint(UNROOTED_MUST_ROOT, |lint| { + lint.primary_message("Type must be rooted"); lint.span(decl.output.span()); }) } @@ -289,13 +289,10 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'tcx> { let require_rooted = |cx: &LateContext, in_new_function: bool, subexpr: &hir::Expr| { let ty = cx.typeck_results().expr_ty(subexpr); if is_unrooted_ty(self.symbols, cx, ty, in_new_function) { - cx.lint( - UNROOTED_MUST_ROOT, - format!("Expression of type {:?} must be rooted", ty), - |lint| { - lint.span(subexpr.span); - }, - ) + cx.lint(UNROOTED_MUST_ROOT, |lint| { + lint.primary_message(format!("Expression of type {:?} must be rooted", ty)); + lint.span(subexpr.span); + }) } }; @@ -329,17 +326,14 @@ impl<'a, 'tcx> visit::Visitor<'tcx> for FnDefVisitor<'a, 'tcx> { // are implemented, the `Unannotated` case could cause false-positives. // These should be fixable by adding an explicit `ref`. match pat.kind { - hir::PatKind::Binding(hir::BindingAnnotation::NONE, ..) | - hir::PatKind::Binding(hir::BindingAnnotation::MUT, ..) => { + hir::PatKind::Binding(hir::BindingMode::NONE, ..) | + hir::PatKind::Binding(hir::BindingMode::MUT, ..) => { let ty = cx.typeck_results().pat_ty(pat); if is_unrooted_ty(self.symbols, cx, ty, self.in_new_function) { - cx.lint( - UNROOTED_MUST_ROOT, - format!("Expression of type {:?} must be rooted", ty), - |lint| { - lint.span(pat.span); - }, - ) + cx.lint(UNROOTED_MUST_ROOT, |lint| { + lint.primary_message(format!("Expression of type {:?} must be rooted", ty)); + lint.span(pat.span); + }) } }, _ => {},