| author | bors <bors@rust-lang.org> 2024-08-12 16:31:22 UTC |
| committer | bors <bors@rust-lang.org> 2024-08-12 16:31:22 UTC |
| log | 91376f416222a238227c84a848d168835ede2cc3 |
| tree | 0dc7b9f6c09c2de39e702cb4751563c12b254835 |
| parent | e08b80c0fb7667bdcd040761891701e576c42ec8 |
| parent | 99a785d62d8414e5db435f4e699eabd185257d49 |
Rollup of 10 pull requests
Successful merges:
- #128149 (nontemporal_store: make sure that the intrinsic is truly just a hint)
- #128394 (Unify run button display with "copy code" button and with mdbook buttons)
- #128537 (const vector passed through to codegen)
- #128632 (std: do not overwrite style in `get_backtrace_style`)
- #128878 (Slightly refactor `Flags` in bootstrap)
- #128886 (Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`)
- #128929 (Fix codegen-units tests that were disabled 8 years ago)
- #128937 (Fix warnings in rmake tests on `x86_64-unknown-linux-gnu`)
- #128978 (Use `assert_matches` around the compiler more)
- #128994 (Fix bug in `Parser::look_ahead`.)
r? `@ghost`
`@rustbot` modify labels: rollup132 files changed, 789 insertions(+), 449 deletions(-)
compiler/rustc_ast_lowering/messages.ftl+12| ... | ... | @@ -167,11 +167,23 @@ ast_lowering_template_modifier = template modifier |
| 167 | 167 | |
| 168 | 168 | ast_lowering_this_not_async = this is not `async` |
| 169 | 169 | |
| 170 | ast_lowering_underscore_array_length_unstable = | |
| 171 | using `_` for array lengths is unstable | |
| 172 | ||
| 170 | 173 | ast_lowering_underscore_expr_lhs_assign = |
| 171 | 174 | in expressions, `_` can only be used on the left-hand side of an assignment |
| 172 | 175 | .label = `_` not allowed here |
| 173 | 176 | |
| 177 | ast_lowering_unstable_inline_assembly = inline assembly is not stable yet on this architecture | |
| 178 | ast_lowering_unstable_inline_assembly_const_operands = | |
| 179 | const operands for inline assembly are unstable | |
| 180 | ast_lowering_unstable_inline_assembly_label_operands = | |
| 181 | label operands for inline assembly are unstable | |
| 182 | ast_lowering_unstable_may_unwind = the `may_unwind` option is unstable | |
| 183 | ||
| 174 | 184 | ast_lowering_use_angle_brackets = use angle brackets instead |
| 185 | ||
| 186 | ast_lowering_yield = yield syntax is experimental | |
| 175 | 187 | ast_lowering_yield_in_closure = |
| 176 | 188 | `yield` can only be used in `#[coroutine]` closures, or `gen` blocks |
| 177 | 189 | .suggestion = use `#[coroutine]` to make this closure a coroutine |
compiler/rustc_ast_lowering/src/asm.rs+14-7| ... | ... | @@ -19,10 +19,12 @@ use super::errors::{ |
| 19 | 19 | InvalidRegisterClass, RegisterClassOnlyClobber, RegisterConflict, |
| 20 | 20 | }; |
| 21 | 21 | use super::LoweringContext; |
| 22 | use crate::{ImplTraitContext, ImplTraitPosition, ParamMode, ResolverAstLoweringExt}; | |
| 22 | use crate::{ | |
| 23 | fluent_generated as fluent, ImplTraitContext, ImplTraitPosition, ParamMode, | |
| 24 | ResolverAstLoweringExt, | |
| 25 | }; | |
| 23 | 26 | |
| 24 | 27 | impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 25 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 26 | 28 | pub(crate) fn lower_inline_asm( |
| 27 | 29 | &mut self, |
| 28 | 30 | sp: Span, |
| ... | ... | @@ -52,7 +54,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 52 | 54 | &self.tcx.sess, |
| 53 | 55 | sym::asm_experimental_arch, |
| 54 | 56 | sp, |
| 55 | "inline assembly is not stable yet on this architecture", | |
| 57 | fluent::ast_lowering_unstable_inline_assembly, | |
| 56 | 58 | ) |
| 57 | 59 | .emit(); |
| 58 | 60 | } |
| ... | ... | @@ -64,8 +66,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 64 | 66 | self.dcx().emit_err(AttSyntaxOnlyX86 { span: sp }); |
| 65 | 67 | } |
| 66 | 68 | if asm.options.contains(InlineAsmOptions::MAY_UNWIND) && !self.tcx.features().asm_unwind { |
| 67 | feature_err(&self.tcx.sess, sym::asm_unwind, sp, "the `may_unwind` option is unstable") | |
| 68 | .emit(); | |
| 69 | feature_err( | |
| 70 | &self.tcx.sess, | |
| 71 | sym::asm_unwind, | |
| 72 | sp, | |
| 73 | fluent::ast_lowering_unstable_may_unwind, | |
| 74 | ) | |
| 75 | .emit(); | |
| 69 | 76 | } |
| 70 | 77 | |
| 71 | 78 | let mut clobber_abis = FxIndexMap::default(); |
| ... | ... | @@ -182,7 +189,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 182 | 189 | sess, |
| 183 | 190 | sym::asm_const, |
| 184 | 191 | *op_sp, |
| 185 | "const operands for inline assembly are unstable", | |
| 192 | fluent::ast_lowering_unstable_inline_assembly_const_operands, | |
| 186 | 193 | ) |
| 187 | 194 | .emit(); |
| 188 | 195 | } |
| ... | ... | @@ -246,7 +253,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 246 | 253 | sess, |
| 247 | 254 | sym::asm_goto, |
| 248 | 255 | *op_sp, |
| 249 | "label operands for inline assembly are unstable", | |
| 256 | fluent::ast_lowering_unstable_inline_assembly_label_operands, | |
| 250 | 257 | ) |
| 251 | 258 | .emit(); |
| 252 | 259 | } |
compiler/rustc_ast_lowering/src/expr.rs+3-4| ... | ... | @@ -23,7 +23,7 @@ use super::{ |
| 23 | 23 | ImplTraitContext, LoweringContext, ParamMode, ParenthesizedGenericArgs, ResolverAstLoweringExt, |
| 24 | 24 | }; |
| 25 | 25 | use crate::errors::YieldInClosure; |
| 26 | use crate::{FnDeclKind, ImplTraitPosition}; | |
| 26 | use crate::{fluent_generated, FnDeclKind, ImplTraitPosition}; | |
| 27 | 27 | |
| 28 | 28 | impl<'hir> LoweringContext<'_, 'hir> { |
| 29 | 29 | fn lower_exprs(&mut self, exprs: &[AstP<Expr>]) -> &'hir [hir::Expr<'hir>] { |
| ... | ... | @@ -1540,7 +1540,6 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1540 | 1540 | } |
| 1541 | 1541 | } |
| 1542 | 1542 | |
| 1543 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 1544 | 1543 | fn lower_expr_yield(&mut self, span: Span, opt_expr: Option<&Expr>) -> hir::ExprKind<'hir> { |
| 1545 | 1544 | let yielded = |
| 1546 | 1545 | opt_expr.as_ref().map(|x| self.lower_expr(x)).unwrap_or_else(|| self.expr_unit(span)); |
| ... | ... | @@ -1575,7 +1574,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1575 | 1574 | &self.tcx.sess, |
| 1576 | 1575 | sym::coroutines, |
| 1577 | 1576 | span, |
| 1578 | "yield syntax is experimental", | |
| 1577 | fluent_generated::ast_lowering_yield, | |
| 1579 | 1578 | ) |
| 1580 | 1579 | .emit(); |
| 1581 | 1580 | } |
| ... | ... | @@ -1587,7 +1586,7 @@ impl<'hir> LoweringContext<'_, 'hir> { |
| 1587 | 1586 | &self.tcx.sess, |
| 1588 | 1587 | sym::coroutines, |
| 1589 | 1588 | span, |
| 1590 | "yield syntax is experimental", | |
| 1589 | fluent_generated::ast_lowering_yield, | |
| 1591 | 1590 | ) |
| 1592 | 1591 | .emit(); |
| 1593 | 1592 | } |
compiler/rustc_ast_lowering/src/lib.rs+1-2| ... | ... | @@ -2326,7 +2326,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 2326 | 2326 | self.expr_block(block) |
| 2327 | 2327 | } |
| 2328 | 2328 | |
| 2329 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 2330 | 2329 | fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen<'hir> { |
| 2331 | 2330 | match c.value.kind { |
| 2332 | 2331 | ExprKind::Underscore => { |
| ... | ... | @@ -2340,7 +2339,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { |
| 2340 | 2339 | &self.tcx.sess, |
| 2341 | 2340 | sym::generic_arg_infer, |
| 2342 | 2341 | c.value.span, |
| 2343 | "using `_` for array lengths is unstable", | |
| 2342 | fluent_generated::ast_lowering_underscore_array_length_unstable, | |
| 2344 | 2343 | ) |
| 2345 | 2344 | .stash(c.value.span, StashKey::UnderscoreForArrayLengths); |
| 2346 | 2345 | hir::ArrayLen::Body(self.lower_anon_const_to_const_arg(c)) |
compiler/rustc_attr/messages.ftl+3| ... | ... | @@ -104,6 +104,9 @@ attr_unknown_meta_item = |
| 104 | 104 | attr_unknown_version_literal = |
| 105 | 105 | unknown version literal format, assuming it refers to a future version |
| 106 | 106 | |
| 107 | attr_unstable_cfg_target_compact = | |
| 108 | compact `cfg(target(..))` is experimental and subject to change | |
| 109 | ||
| 107 | 110 | attr_unsupported_literal_cfg_string = |
| 108 | 111 | literal in `cfg` predicate value must be a string |
| 109 | 112 | attr_unsupported_literal_deprecated_kv_pair = |
compiler/rustc_attr/src/builtin.rs+2-3| ... | ... | @@ -20,6 +20,7 @@ use rustc_span::hygiene::Transparency; |
| 20 | 20 | use rustc_span::symbol::{sym, Symbol}; |
| 21 | 21 | use rustc_span::Span; |
| 22 | 22 | |
| 23 | use crate::fluent_generated; | |
| 23 | 24 | use crate::session_diagnostics::{self, IncorrectReprFormatGenericCause}; |
| 24 | 25 | |
| 25 | 26 | /// The version placeholder that recently stabilized features contain inside the |
| ... | ... | @@ -521,7 +522,6 @@ pub struct Condition { |
| 521 | 522 | } |
| 522 | 523 | |
| 523 | 524 | /// Tests if a cfg-pattern matches the cfg set |
| 524 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 525 | 525 | pub fn cfg_matches( |
| 526 | 526 | cfg: &ast::MetaItem, |
| 527 | 527 | sess: &Session, |
| ... | ... | @@ -593,7 +593,6 @@ pub fn parse_version(s: Symbol) -> Option<RustcVersion> { |
| 593 | 593 | |
| 594 | 594 | /// Evaluate a cfg-like condition (with `any` and `all`), using `eval` to |
| 595 | 595 | /// evaluate individual items. |
| 596 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 597 | 596 | pub fn eval_condition( |
| 598 | 597 | cfg: &ast::MetaItem, |
| 599 | 598 | sess: &Session, |
| ... | ... | @@ -680,7 +679,7 @@ pub fn eval_condition( |
| 680 | 679 | sess, |
| 681 | 680 | sym::cfg_target_compact, |
| 682 | 681 | cfg.span, |
| 683 | "compact `cfg(target(..))` is experimental and subject to change", | |
| 682 | fluent_generated::attr_unstable_cfg_target_compact, | |
| 684 | 683 | ) |
| 685 | 684 | .emit(); |
| 686 | 685 | } |
compiler/rustc_borrowck/messages.ftl+21| ... | ... | @@ -62,6 +62,9 @@ borrowck_could_not_normalize = |
| 62 | 62 | borrowck_could_not_prove = |
| 63 | 63 | could not prove `{$predicate}` |
| 64 | 64 | |
| 65 | borrowck_dereference_suggestion = | |
| 66 | dereference the return value | |
| 67 | ||
| 65 | 68 | borrowck_func_take_self_moved_place = |
| 66 | 69 | `{$func}` takes ownership of the receiver `self`, which moves {$place_name} |
| 67 | 70 | |
| ... | ... | @@ -74,9 +77,24 @@ borrowck_higher_ranked_lifetime_error = |
| 74 | 77 | borrowck_higher_ranked_subtype_error = |
| 75 | 78 | higher-ranked subtype error |
| 76 | 79 | |
| 80 | borrowck_implicit_static = | |
| 81 | this has an implicit `'static` lifetime requirement | |
| 82 | ||
| 83 | borrowck_implicit_static_introduced = | |
| 84 | calling this method introduces the `impl`'s `'static` requirement | |
| 85 | ||
| 86 | borrowck_implicit_static_relax = | |
| 87 | consider relaxing the implicit `'static` requirement | |
| 88 | ||
| 77 | 89 | borrowck_lifetime_constraints_error = |
| 78 | 90 | lifetime may not live long enough |
| 79 | 91 | |
| 92 | borrowck_limitations_implies_static = | |
| 93 | due to current limitations in the borrow checker, this implies a `'static` lifetime | |
| 94 | ||
| 95 | borrowck_move_closure_suggestion = | |
| 96 | consider adding 'move' keyword before the nested closure | |
| 97 | ||
| 80 | 98 | borrowck_move_out_place_here = |
| 81 | 99 | {$place} is moved here |
| 82 | 100 | |
| ... | ... | @@ -163,6 +181,9 @@ borrowck_partial_var_move_by_use_in_coroutine = |
| 163 | 181 | *[false] moved |
| 164 | 182 | } due to use in coroutine |
| 165 | 183 | |
| 184 | borrowck_restrict_to_static = | |
| 185 | consider restricting the type parameter to the `'static` lifetime | |
| 186 | ||
| 166 | 187 | borrowck_returned_async_block_escaped = |
| 167 | 188 | returns an `async` block that contains a reference to a captured variable, which then escapes the closure body |
| 168 | 189 |
compiler/rustc_borrowck/src/diagnostics/explain_borrow.rs+4-2| ... | ... | @@ -3,6 +3,8 @@ |
| 3 | 3 | #![allow(rustc::diagnostic_outside_of_impl)] |
| 4 | 4 | #![allow(rustc::untranslatable_diagnostic)] |
| 5 | 5 | |
| 6 | use std::assert_matches::assert_matches; | |
| 7 | ||
| 6 | 8 | use rustc_errors::{Applicability, Diag}; |
| 7 | 9 | use rustc_hir as hir; |
| 8 | 10 | use rustc_hir::intravisit::Visitor; |
| ... | ... | @@ -116,7 +118,7 @@ impl<'tcx> BorrowExplanation<'tcx> { |
| 116 | 118 | // path_span must be `Some` as otherwise the if condition is true |
| 117 | 119 | let path_span = path_span.unwrap(); |
| 118 | 120 | // path_span is only present in the case of closure capture |
| 119 | assert!(matches!(later_use_kind, LaterUseKind::ClosureCapture)); | |
| 121 | assert_matches!(later_use_kind, LaterUseKind::ClosureCapture); | |
| 120 | 122 | if !borrow_span.is_some_and(|sp| sp.overlaps(var_or_use_span)) { |
| 121 | 123 | let path_label = "used here by closure"; |
| 122 | 124 | let capture_kind_label = message; |
| ... | ... | @@ -147,7 +149,7 @@ impl<'tcx> BorrowExplanation<'tcx> { |
| 147 | 149 | // path_span must be `Some` as otherwise the if condition is true |
| 148 | 150 | let path_span = path_span.unwrap(); |
| 149 | 151 | // path_span is only present in the case of closure capture |
| 150 | assert!(matches!(later_use_kind, LaterUseKind::ClosureCapture)); | |
| 152 | assert_matches!(later_use_kind, LaterUseKind::ClosureCapture); | |
| 151 | 153 | if borrow_span.map(|sp| !sp.overlaps(var_or_use_span)).unwrap_or(true) { |
| 152 | 154 | let path_label = "used here by closure"; |
| 153 | 155 | let capture_kind_label = message; |
compiler/rustc_borrowck/src/diagnostics/region_errors.rs+31-33| ... | ... | @@ -35,7 +35,7 @@ use crate::session_diagnostics::{ |
| 35 | 35 | LifetimeReturnCategoryErr, RequireStaticErr, VarHereDenote, |
| 36 | 36 | }; |
| 37 | 37 | use crate::universal_regions::DefiningTy; |
| 38 | use crate::{borrowck_errors, MirBorrowckCtxt}; | |
| 38 | use crate::{borrowck_errors, fluent_generated as fluent, MirBorrowckCtxt}; | |
| 39 | 39 | |
| 40 | 40 | impl<'tcx> ConstraintDescription for ConstraintCategory<'tcx> { |
| 41 | 41 | fn description(&self) -> &'static str { |
| ... | ... | @@ -198,7 +198,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 198 | 198 | // from higher-ranked trait bounds (HRTB). Try to locate span of the trait |
| 199 | 199 | // and the span which bounded to the trait for adding 'static lifetime suggestion |
| 200 | 200 | #[allow(rustc::diagnostic_outside_of_impl)] |
| 201 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 202 | 201 | fn suggest_static_lifetime_for_gat_from_hrtb( |
| 203 | 202 | &self, |
| 204 | 203 | diag: &mut Diag<'_>, |
| ... | ... | @@ -251,23 +250,28 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 251 | 250 | debug!(?hrtb_bounds); |
| 252 | 251 | |
| 253 | 252 | hrtb_bounds.iter().for_each(|bound| { |
| 254 | let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }, _) = bound else { return; }; | |
| 255 | diag.span_note( | |
| 256 | *trait_span, | |
| 257 | "due to current limitations in the borrow checker, this implies a `'static` lifetime" | |
| 258 | ); | |
| 259 | let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local()) else { return; }; | |
| 260 | let Def(_, trait_res_defid) = trait_ref.path.res else { return; }; | |
| 253 | let Trait(PolyTraitRef { trait_ref, span: trait_span, .. }, _) = bound else { | |
| 254 | return; | |
| 255 | }; | |
| 256 | diag.span_note(*trait_span, fluent::borrowck_limitations_implies_static); | |
| 257 | let Some(generics_fn) = hir.get_generics(self.body.source.def_id().expect_local()) | |
| 258 | else { | |
| 259 | return; | |
| 260 | }; | |
| 261 | let Def(_, trait_res_defid) = trait_ref.path.res else { | |
| 262 | return; | |
| 263 | }; | |
| 261 | 264 | debug!(?generics_fn); |
| 262 | 265 | generics_fn.predicates.iter().for_each(|predicate| { |
| 263 | let BoundPredicate( | |
| 264 | WhereBoundPredicate { | |
| 265 | span: bounded_span, | |
| 266 | bounded_ty, | |
| 267 | bounds, | |
| 268 | .. | |
| 269 | } | |
| 270 | ) = predicate else { return; }; | |
| 266 | let BoundPredicate(WhereBoundPredicate { | |
| 267 | span: bounded_span, | |
| 268 | bounded_ty, | |
| 269 | bounds, | |
| 270 | .. | |
| 271 | }) = predicate | |
| 272 | else { | |
| 273 | return; | |
| 274 | }; | |
| 271 | 275 | bounds.iter().for_each(|bd| { |
| 272 | 276 | if let Trait(PolyTraitRef { trait_ref: tr_ref, .. }, _) = bd |
| 273 | 277 | && let Def(_, res_defid) = tr_ref.path.res |
| ... | ... | @@ -277,16 +281,17 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 277 | 281 | && generics_fn.params |
| 278 | 282 | .iter() |
| 279 | 283 | .rfind(|param| param.def_id.to_def_id() == defid) |
| 280 | .is_some() { | |
| 281 | suggestions.push((bounded_span.shrink_to_hi(), " + 'static".to_string())); | |
| 282 | } | |
| 284 | .is_some() | |
| 285 | { | |
| 286 | suggestions.push((bounded_span.shrink_to_hi(), " + 'static".to_string())); | |
| 287 | } | |
| 283 | 288 | }); |
| 284 | 289 | }); |
| 285 | 290 | }); |
| 286 | 291 | if suggestions.len() > 0 { |
| 287 | 292 | suggestions.dedup(); |
| 288 | 293 | diag.multipart_suggestion_verbose( |
| 289 | "consider restricting the type parameter to the `'static` lifetime", | |
| 294 | fluent::borrowck_restrict_to_static, | |
| 290 | 295 | suggestions, |
| 291 | 296 | Applicability::MaybeIncorrect, |
| 292 | 297 | ); |
| ... | ... | @@ -976,7 +981,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 976 | 981 | } |
| 977 | 982 | |
| 978 | 983 | #[allow(rustc::diagnostic_outside_of_impl)] |
| 979 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 980 | 984 | #[instrument(skip(self, err), level = "debug")] |
| 981 | 985 | fn suggest_constrain_dyn_trait_in_impl( |
| 982 | 986 | &self, |
| ... | ... | @@ -994,16 +998,12 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 994 | 998 | debug!("trait spans found: {:?}", traits); |
| 995 | 999 | for span in &traits { |
| 996 | 1000 | let mut multi_span: MultiSpan = vec![*span].into(); |
| 997 | multi_span | |
| 998 | .push_span_label(*span, "this has an implicit `'static` lifetime requirement"); | |
| 999 | multi_span.push_span_label( | |
| 1000 | ident.span, | |
| 1001 | "calling this method introduces the `impl`'s `'static` requirement", | |
| 1002 | ); | |
| 1001 | multi_span.push_span_label(*span, fluent::borrowck_implicit_static); | |
| 1002 | multi_span.push_span_label(ident.span, fluent::borrowck_implicit_static_introduced); | |
| 1003 | 1003 | err.subdiagnostic(RequireStaticErr::UsedImpl { multi_span }); |
| 1004 | 1004 | err.span_suggestion_verbose( |
| 1005 | 1005 | span.shrink_to_hi(), |
| 1006 | "consider relaxing the implicit `'static` requirement", | |
| 1006 | fluent::borrowck_implicit_static_relax, | |
| 1007 | 1007 | " + '_", |
| 1008 | 1008 | Applicability::MaybeIncorrect, |
| 1009 | 1009 | ); |
| ... | ... | @@ -1045,7 +1045,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | #[allow(rustc::diagnostic_outside_of_impl)] |
| 1048 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 1049 | 1048 | /// When encountering a lifetime error caused by the return type of a closure, check the |
| 1050 | 1049 | /// corresponding trait bound and see if dereferencing the closure return value would satisfy |
| 1051 | 1050 | /// them. If so, we produce a structured suggestion. |
| ... | ... | @@ -1166,7 +1165,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 1166 | 1165 | if ocx.select_all_or_error().is_empty() && count > 0 { |
| 1167 | 1166 | diag.span_suggestion_verbose( |
| 1168 | 1167 | tcx.hir().body(*body).value.peel_blocks().span.shrink_to_lo(), |
| 1169 | "dereference the return value", | |
| 1168 | fluent::borrowck_dereference_suggestion, | |
| 1170 | 1169 | "*".repeat(count), |
| 1171 | 1170 | Applicability::MachineApplicable, |
| 1172 | 1171 | ); |
| ... | ... | @@ -1174,7 +1173,6 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 1174 | 1173 | } |
| 1175 | 1174 | |
| 1176 | 1175 | #[allow(rustc::diagnostic_outside_of_impl)] |
| 1177 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 1178 | 1176 | fn suggest_move_on_borrowing_closure(&self, diag: &mut Diag<'_>) { |
| 1179 | 1177 | let map = self.infcx.tcx.hir(); |
| 1180 | 1178 | let body = map.body_owned_by(self.mir_def_id()); |
| ... | ... | @@ -1213,7 +1211,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, '_, 'infcx, 'tcx> { |
| 1213 | 1211 | if let Some(closure_span) = closure_span { |
| 1214 | 1212 | diag.span_suggestion_verbose( |
| 1215 | 1213 | closure_span, |
| 1216 | "consider adding 'move' keyword before the nested closure", | |
| 1214 | fluent::borrowck_move_closure_suggestion, | |
| 1217 | 1215 | "move ", |
| 1218 | 1216 | Applicability::MaybeIncorrect, |
| 1219 | 1217 | ); |
compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs+2-1| ... | ... | @@ -725,7 +725,8 @@ fn codegen_regular_intrinsic_call<'tcx>( |
| 725 | 725 | |
| 726 | 726 | // Cranelift treats stores as volatile by default |
| 727 | 727 | // FIXME correctly handle unaligned_volatile_store |
| 728 | // FIXME actually do nontemporal stores if requested | |
| 728 | // FIXME actually do nontemporal stores if requested (but do not just emit MOVNT on x86; | |
| 729 | // see the LLVM backend for details) | |
| 729 | 730 | let dest = CPlace::for_ptr(Pointer::new(ptr), val.layout()); |
| 730 | 731 | dest.write_cvalue(fx, val); |
| 731 | 732 | } |
compiler/rustc_codegen_gcc/src/builder.rs+2| ... | ... | @@ -1127,6 +1127,8 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { |
| 1127 | 1127 | self.llbb().add_assignment(self.location, aligned_destination, val); |
| 1128 | 1128 | // TODO(antoyo): handle align and flags. |
| 1129 | 1129 | // NOTE: dummy value here since it's never used. FIXME(antoyo): API should not return a value here? |
| 1130 | // When adding support for NONTEMPORAL, make sure to not just emit MOVNT on x86; see the | |
| 1131 | // LLVM backend for details. | |
| 1130 | 1132 | self.cx.context.new_rvalue_zero(self.type_i32()) |
| 1131 | 1133 | } |
| 1132 | 1134 |
compiler/rustc_codegen_gcc/src/common.rs+5| ... | ... | @@ -160,6 +160,11 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> { |
| 160 | 160 | self.context.new_struct_constructor(None, struct_type.as_type(), None, values) |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | fn const_vector(&self, values: &[RValue<'gcc>]) -> RValue<'gcc> { | |
| 164 | let typ = self.type_vector(values[0].get_type(), values.len() as u64); | |
| 165 | self.context.new_rvalue_from_vector(None, typ, values) | |
| 166 | } | |
| 167 | ||
| 163 | 168 | fn const_to_opt_uint(&self, _v: RValue<'gcc>) -> Option<u64> { |
| 164 | 169 | // TODO(antoyo) |
| 165 | 170 | None |
compiler/rustc_codegen_llvm/src/asm.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use libc::{c_char, c_uint}; |
| 2 | 4 | use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece}; |
| 3 | 5 | use rustc_codegen_ssa::mir::operand::OperandValue; |
| ... | ... | @@ -89,7 +91,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { |
| 89 | 91 | // if the target feature needed by the register class is |
| 90 | 92 | // disabled. This is necessary otherwise LLVM will try |
| 91 | 93 | // to actually allocate a register for the dummy output. |
| 92 | assert!(matches!(reg, InlineAsmRegOrRegClass::Reg(_))); | |
| 94 | assert_matches!(reg, InlineAsmRegOrRegClass::Reg(_)); | |
| 93 | 95 | clobbers.push(format!("~{}", reg_to_llvm(reg, None))); |
| 94 | 96 | continue; |
| 95 | 97 | } else { |
compiler/rustc_codegen_llvm/src/builder.rs+26-7| ... | ... | @@ -728,13 +728,32 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { |
| 728 | 728 | llvm::LLVMSetVolatile(store, llvm::True); |
| 729 | 729 | } |
| 730 | 730 | if flags.contains(MemFlags::NONTEMPORAL) { |
| 731 | // According to LLVM [1] building a nontemporal store must | |
| 732 | // *always* point to a metadata value of the integer 1. | |
| 733 | // | |
| 734 | // [1]: https://llvm.org/docs/LangRef.html#store-instruction | |
| 735 | let one = self.cx.const_i32(1); | |
| 736 | let node = llvm::LLVMMDNodeInContext(self.cx.llcx, &one, 1); | |
| 737 | llvm::LLVMSetMetadata(store, llvm::MD_nontemporal as c_uint, node); | |
| 731 | // Make sure that the current target architectures supports "sane" non-temporal | |
| 732 | // stores, i.e., non-temporal stores that are equivalent to regular stores except | |
| 733 | // for performance. LLVM doesn't seem to care about this, and will happily treat | |
| 734 | // `!nontemporal` stores as-if they were normal stores (for reordering optimizations | |
| 735 | // etc) even on x86, despite later lowering them to MOVNT which do *not* behave like | |
| 736 | // regular stores but require special fences. | |
| 737 | // So we keep a list of architectures where `!nontemporal` is known to be truly just | |
| 738 | // a hint, and use regular stores everywhere else. | |
| 739 | // (In the future, we could alternatively ensure that an sfence gets emitted after a sequence of movnt | |
| 740 | // before any kind of synchronizing operation. But it's not clear how to do that with LLVM.) | |
| 741 | // For more context, see <https://github.com/rust-lang/rust/issues/114582> and | |
| 742 | // <https://github.com/llvm/llvm-project/issues/64521>. | |
| 743 | const WELL_BEHAVED_NONTEMPORAL_ARCHS: &[&str] = | |
| 744 | &["aarch64", "arm", "riscv32", "riscv64"]; | |
| 745 | ||
| 746 | let use_nontemporal = | |
| 747 | WELL_BEHAVED_NONTEMPORAL_ARCHS.contains(&&*self.cx.tcx.sess.target.arch); | |
| 748 | if use_nontemporal { | |
| 749 | // According to LLVM [1] building a nontemporal store must | |
| 750 | // *always* point to a metadata value of the integer 1. | |
| 751 | // | |
| 752 | // [1]: https://llvm.org/docs/LangRef.html#store-instruction | |
| 753 | let one = self.cx.const_i32(1); | |
| 754 | let node = llvm::LLVMMDNodeInContext(self.cx.llcx, &one, 1); | |
| 755 | llvm::LLVMSetMetadata(store, llvm::MD_nontemporal as c_uint, node); | |
| 756 | } | |
| 738 | 757 | } |
| 739 | 758 | store |
| 740 | 759 | } |
compiler/rustc_codegen_llvm/src/common.rs+5-5| ... | ... | @@ -97,11 +97,6 @@ impl<'ll> CodegenCx<'ll, '_> { |
| 97 | 97 | unsafe { llvm::LLVMConstArray2(ty, elts.as_ptr(), len) } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | pub fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value { | |
| 101 | let len = c_uint::try_from(elts.len()).expect("LLVMConstVector elements len overflow"); | |
| 102 | unsafe { llvm::LLVMConstVector(elts.as_ptr(), len) } | |
| 103 | } | |
| 104 | ||
| 105 | 100 | pub fn const_bytes(&self, bytes: &[u8]) -> &'ll Value { |
| 106 | 101 | bytes_in_context(self.llcx, bytes) |
| 107 | 102 | } |
| ... | ... | @@ -221,6 +216,11 @@ impl<'ll, 'tcx> ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> { |
| 221 | 216 | struct_in_context(self.llcx, elts, packed) |
| 222 | 217 | } |
| 223 | 218 | |
| 219 | fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value { | |
| 220 | let len = c_uint::try_from(elts.len()).expect("LLVMConstVector elements len overflow"); | |
| 221 | unsafe { llvm::LLVMConstVector(elts.as_ptr(), len) } | |
| 222 | } | |
| 223 | ||
| 224 | 224 | fn const_to_opt_uint(&self, v: &'ll Value) -> Option<u64> { |
| 225 | 225 | try_as_const_integral(v).and_then(|v| unsafe { |
| 226 | 226 | let mut i = 0u64; |
compiler/rustc_codegen_llvm/src/intrinsic.rs+2-1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 1 | 2 | use std::cmp::Ordering; |
| 2 | 3 | |
| 3 | 4 | use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh}; |
| ... | ... | @@ -1142,7 +1143,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>( |
| 1142 | 1143 | if cfg!(debug_assertions) { |
| 1143 | 1144 | for (ty, arg) in arg_tys.iter().zip(args) { |
| 1144 | 1145 | if ty.is_simd() { |
| 1145 | assert!(matches!(arg.val, OperandValue::Immediate(_))); | |
| 1146 | assert_matches!(arg.val, OperandValue::Immediate(_)); | |
| 1146 | 1147 | } |
| 1147 | 1148 | } |
| 1148 | 1149 | } |
compiler/rustc_codegen_llvm/src/lib.rs+1| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | #![allow(internal_features)] |
| 9 | 9 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] |
| 10 | 10 | #![doc(rust_logo)] |
| 11 | #![feature(assert_matches)] | |
| 11 | 12 | #![feature(exact_size_is_empty)] |
| 12 | 13 | #![feature(extern_types)] |
| 13 | 14 | #![feature(hash_raw_entry)] |
compiler/rustc_codegen_ssa/src/back/write.rs+2-1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | use std::any::Any; |
| 2 | use std::assert_matches::assert_matches; | |
| 2 | 3 | use std::marker::PhantomData; |
| 3 | 4 | use std::path::{Path, PathBuf}; |
| 4 | 5 | use std::sync::mpsc::{channel, Receiver, Sender}; |
| ... | ... | @@ -1963,7 +1964,7 @@ impl SharedEmitterMain { |
| 1963 | 1964 | sess.dcx().abort_if_errors(); |
| 1964 | 1965 | } |
| 1965 | 1966 | Ok(SharedEmitterMessage::InlineAsmError(cookie, msg, level, source)) => { |
| 1966 | assert!(matches!(level, Level::Error | Level::Warning | Level::Note)); | |
| 1967 | assert_matches!(level, Level::Error | Level::Warning | Level::Note); | |
| 1967 | 1968 | let msg = msg.strip_prefix("error: ").unwrap_or(&msg).to_string(); |
| 1968 | 1969 | let mut err = Diag::<()>::new(sess.dcx(), level, msg); |
| 1969 | 1970 |
compiler/rustc_codegen_ssa/src/lib.rs+1| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | #![allow(rustc::untranslatable_diagnostic)] |
| 5 | 5 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] |
| 6 | 6 | #![doc(rust_logo)] |
| 7 | #![feature(assert_matches)] | |
| 7 | 8 | #![feature(box_patterns)] |
| 8 | 9 | #![feature(if_let_guard)] |
| 9 | 10 | #![feature(let_chains)] |
compiler/rustc_codegen_ssa/src/mir/block.rs+5-1| ... | ... | @@ -923,8 +923,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 923 | 923 | // third argument must be constant. This is |
| 924 | 924 | // checked by the type-checker. |
| 925 | 925 | if i == 2 && intrinsic.name == sym::simd_shuffle { |
| 926 | // FIXME: the simd_shuffle argument is actually an array, | |
| 927 | // not a vector, so we need this special hack to make sure | |
| 928 | // it is passed as an immediate. We should pass the | |
| 929 | // shuffle indices as a vector instead to avoid this hack. | |
| 926 | 930 | if let mir::Operand::Constant(constant) = &arg.node { |
| 927 | let (llval, ty) = self.simd_shuffle_indices(bx, constant); | |
| 931 | let (llval, ty) = self.immediate_const_vector(bx, constant); | |
| 928 | 932 | return OperandRef { |
| 929 | 933 | val: Immediate(llval), |
| 930 | 934 | layout: bx.layout_of(ty), |
compiler/rustc_codegen_ssa/src/mir/constant.rs+29-10| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use rustc_middle::mir::interpret::ErrorHandled; |
| 2 | 2 | use rustc_middle::ty::layout::HasTyCtxt; |
| 3 | use rustc_middle::ty::{self, Ty}; | |
| 3 | use rustc_middle::ty::{self, Ty, ValTree}; | |
| 4 | 4 | use rustc_middle::{bug, mir, span_bug}; |
| 5 | 5 | use rustc_target::abi::Abi; |
| 6 | 6 | |
| ... | ... | @@ -28,7 +28,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 28 | 28 | .expect("erroneous constant missed by mono item collection") |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | /// This is a convenience helper for `simd_shuffle_indices`. It has the precondition | |
| 31 | /// This is a convenience helper for `immediate_const_vector`. It has the precondition | |
| 32 | 32 | /// that the given `constant` is an `Const::Unevaluated` and must be convertible to |
| 33 | 33 | /// a `ValTree`. If you want a more general version of this, talk to `wg-const-eval` on zulip. |
| 34 | 34 | /// |
| ... | ... | @@ -59,23 +59,42 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 59 | 59 | self.cx.tcx().const_eval_resolve_for_typeck(ty::ParamEnv::reveal_all(), uv, constant.span) |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | /// process constant containing SIMD shuffle indices | |
| 63 | pub fn simd_shuffle_indices( | |
| 62 | /// process constant containing SIMD shuffle indices & constant vectors | |
| 63 | pub fn immediate_const_vector( | |
| 64 | 64 | &mut self, |
| 65 | 65 | bx: &Bx, |
| 66 | 66 | constant: &mir::ConstOperand<'tcx>, |
| 67 | 67 | ) -> (Bx::Value, Ty<'tcx>) { |
| 68 | 68 | let ty = self.monomorphize(constant.ty()); |
| 69 | let ty_is_simd = ty.is_simd(); | |
| 70 | // FIXME: ideally we'd assert that this is a SIMD type, but simd_shuffle | |
| 71 | // in its current form relies on a regular array being passed as an | |
| 72 | // immediate argument. This hack can be removed once that is fixed. | |
| 73 | let field_ty = if ty_is_simd { | |
| 74 | ty.simd_size_and_type(bx.tcx()).1 | |
| 75 | } else { | |
| 76 | ty.builtin_index().unwrap() | |
| 77 | }; | |
| 78 | ||
| 69 | 79 | let val = self |
| 70 | 80 | .eval_unevaluated_mir_constant_to_valtree(constant) |
| 71 | 81 | .ok() |
| 72 | 82 | .map(|x| x.ok()) |
| 73 | 83 | .flatten() |
| 74 | 84 | .map(|val| { |
| 75 | let field_ty = ty.builtin_index().unwrap(); | |
| 76 | let values: Vec<_> = val | |
| 77 | .unwrap_branch() | |
| 78 | .iter() | |
| 85 | // Depending on whether this is a SIMD type with an array field | |
| 86 | // or a type with many fields (one for each elements), the valtree | |
| 87 | // is either a single branch with N children, or a root node | |
| 88 | // with exactly one child which then in turn has many children. | |
| 89 | // So we look at the first child to determine whether it is a | |
| 90 | // leaf or whether we have to go one more layer down. | |
| 91 | let branch_or_leaf = val.unwrap_branch(); | |
| 92 | let first = branch_or_leaf.get(0).unwrap(); | |
| 93 | let field_iter = match first { | |
| 94 | ValTree::Branch(_) => first.unwrap_branch().iter(), | |
| 95 | ValTree::Leaf(_) => branch_or_leaf.iter(), | |
| 96 | }; | |
| 97 | let values: Vec<_> = field_iter | |
| 79 | 98 | .map(|field| { |
| 80 | 99 | if let Some(prim) = field.try_to_scalar() { |
| 81 | 100 | let layout = bx.layout_of(field_ty); |
| ... | ... | @@ -84,11 +103,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 84 | 103 | }; |
| 85 | 104 | bx.scalar_to_backend(prim, scalar, bx.immediate_backend_type(layout)) |
| 86 | 105 | } else { |
| 87 | bug!("simd shuffle field {:?}", field) | |
| 106 | bug!("field is not a scalar {:?}", field) | |
| 88 | 107 | } |
| 89 | 108 | }) |
| 90 | 109 | .collect(); |
| 91 | bx.const_struct(&values, false) | |
| 110 | if ty_is_simd { bx.const_vector(&values) } else { bx.const_struct(&values, false) } | |
| 92 | 111 | }) |
| 93 | 112 | .unwrap_or_else(|| { |
| 94 | 113 | bx.tcx().dcx().emit_err(errors::ShuffleIndicesEvaluation { span: constant.span }); |
compiler/rustc_codegen_ssa/src/mir/operand.rs+20-2| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 1 | 2 | use std::fmt; |
| 2 | 3 | |
| 3 | 4 | use arrayvec::ArrayVec; |
| ... | ... | @@ -389,7 +390,7 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { |
| 389 | 390 | } |
| 390 | 391 | // Newtype vector of array, e.g. #[repr(simd)] struct S([i32; 4]); |
| 391 | 392 | (OperandValue::Immediate(llval), Abi::Aggregate { sized: true }) => { |
| 392 | assert!(matches!(self.layout.abi, Abi::Vector { .. })); | |
| 393 | assert_matches!(self.layout.abi, Abi::Vector { .. }); | |
| 393 | 394 | |
| 394 | 395 | let llfield_ty = bx.cx().backend_type(field); |
| 395 | 396 | |
| ... | ... | @@ -635,7 +636,24 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 635 | 636 | self.codegen_consume(bx, place.as_ref()) |
| 636 | 637 | } |
| 637 | 638 | |
| 638 | mir::Operand::Constant(ref constant) => self.eval_mir_constant_to_operand(bx, constant), | |
| 639 | mir::Operand::Constant(ref constant) => { | |
| 640 | let constant_ty = self.monomorphize(constant.ty()); | |
| 641 | // Most SIMD vector constants should be passed as immediates. | |
| 642 | // (In particular, some intrinsics really rely on this.) | |
| 643 | if constant_ty.is_simd() { | |
| 644 | // However, some SIMD types do not actually use the vector ABI | |
| 645 | // (in particular, packed SIMD types do not). Ensure we exclude those. | |
| 646 | let layout = bx.layout_of(constant_ty); | |
| 647 | if let Abi::Vector { .. } = layout.abi { | |
| 648 | let (llval, ty) = self.immediate_const_vector(bx, constant); | |
| 649 | return OperandRef { | |
| 650 | val: OperandValue::Immediate(llval), | |
| 651 | layout: bx.layout_of(ty), | |
| 652 | }; | |
| 653 | } | |
| 654 | } | |
| 655 | self.eval_mir_constant_to_operand(bx, constant) | |
| 656 | } | |
| 639 | 657 | } |
| 640 | 658 | } |
| 641 | 659 | } |
compiler/rustc_codegen_ssa/src/mir/rvalue.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use arrayvec::ArrayVec; |
| 2 | 4 | use rustc_middle::ty::adjustment::PointerCoercion; |
| 3 | 5 | use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout}; |
| ... | ... | @@ -220,7 +222,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { |
| 220 | 222 | match operand.val { |
| 221 | 223 | OperandValue::Ref(source_place_val) => { |
| 222 | 224 | assert_eq!(source_place_val.llextra, None); |
| 223 | assert!(matches!(operand_kind, OperandValueKind::Ref)); | |
| 225 | assert_matches!(operand_kind, OperandValueKind::Ref); | |
| 224 | 226 | Some(bx.load_operand(source_place_val.with_type(cast)).val) |
| 225 | 227 | } |
| 226 | 228 | OperandValue::ZeroSized => { |
compiler/rustc_codegen_ssa/src/traits/builder.rs+4-2| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs; |
| 2 | 4 | use rustc_middle::ty::layout::{HasParamEnv, TyAndLayout}; |
| 3 | 5 | use rustc_middle::ty::{Instance, Ty}; |
| ... | ... | @@ -254,10 +256,10 @@ pub trait BuilderMethods<'a, 'tcx>: |
| 254 | 256 | } else { |
| 255 | 257 | (in_ty, dest_ty) |
| 256 | 258 | }; |
| 257 | assert!(matches!( | |
| 259 | assert_matches!( | |
| 258 | 260 | self.cx().type_kind(float_ty), |
| 259 | 261 | TypeKind::Half | TypeKind::Float | TypeKind::Double | TypeKind::FP128 |
| 260 | )); | |
| 262 | ); | |
| 261 | 263 | assert_eq!(self.cx().type_kind(int_ty), TypeKind::Integer); |
| 262 | 264 | |
| 263 | 265 | if let Some(false) = self.cx().sess().opts.unstable_opts.saturating_float_casts { |
compiler/rustc_codegen_ssa/src/traits/consts.rs+1| ... | ... | @@ -30,6 +30,7 @@ pub trait ConstMethods<'tcx>: BackendTypes { |
| 30 | 30 | |
| 31 | 31 | fn const_str(&self, s: &str) -> (Self::Value, Self::Value); |
| 32 | 32 | fn const_struct(&self, elts: &[Self::Value], packed: bool) -> Self::Value; |
| 33 | fn const_vector(&self, elts: &[Self::Value]) -> Self::Value; | |
| 33 | 34 | |
| 34 | 35 | fn const_to_opt_uint(&self, v: Self::Value) -> Option<u64>; |
| 35 | 36 | fn const_to_opt_u128(&self, v: Self::Value, sign_ext: bool) -> Option<u128>; |
compiler/rustc_const_eval/messages.ftl+5| ... | ... | @@ -41,6 +41,8 @@ const_eval_const_context = {$kind -> |
| 41 | 41 | *[other] {""} |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | const_eval_const_stable = const-stable functions can only call other const-stable functions | |
| 45 | ||
| 44 | 46 | const_eval_copy_nonoverlapping_overlapping = |
| 45 | 47 | `copy_nonoverlapping` called on overlapping ranges |
| 46 | 48 | |
| ... | ... | @@ -201,6 +203,9 @@ const_eval_invalid_vtable_pointer = |
| 201 | 203 | const_eval_invalid_vtable_trait = |
| 202 | 204 | using vtable for trait `{$vtable_trait}` but trait `{$expected_trait}` was expected |
| 203 | 205 | |
| 206 | const_eval_lazy_lock = | |
| 207 | consider wrapping this expression in `std::sync::LazyLock::new(|| ...)` | |
| 208 | ||
| 204 | 209 | const_eval_live_drop = |
| 205 | 210 | destructor of `{$dropped_ty}` cannot be evaluated at compile-time |
| 206 | 211 | .label = the destructor for this type cannot be evaluated in {const_eval_const_context}s |
compiler/rustc_const_eval/src/check_consts/check.rs+3-2| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations. |
| 2 | 2 | |
| 3 | use std::assert_matches::assert_matches; | |
| 3 | 4 | use std::mem; |
| 4 | 5 | use std::ops::Deref; |
| 5 | 6 | |
| ... | ... | @@ -590,7 +591,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { |
| 590 | 591 | if is_int_bool_or_char(lhs_ty) && is_int_bool_or_char(rhs_ty) { |
| 591 | 592 | // Int, bool, and char operations are fine. |
| 592 | 593 | } else if lhs_ty.is_fn_ptr() || lhs_ty.is_unsafe_ptr() { |
| 593 | assert!(matches!( | |
| 594 | assert_matches!( | |
| 594 | 595 | op, |
| 595 | 596 | BinOp::Eq |
| 596 | 597 | | BinOp::Ne |
| ... | ... | @@ -599,7 +600,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { |
| 599 | 600 | | BinOp::Ge |
| 600 | 601 | | BinOp::Gt |
| 601 | 602 | | BinOp::Offset |
| 602 | )); | |
| 603 | ); | |
| 603 | 604 | |
| 604 | 605 | self.check_op(ops::RawPtrComparison); |
| 605 | 606 | } else if lhs_ty.is_floating_point() || rhs_ty.is_floating_point() { |
compiler/rustc_const_eval/src/check_consts/ops.rs+3-5| ... | ... | @@ -23,7 +23,7 @@ use rustc_trait_selection::traits::SelectionContext; |
| 23 | 23 | use tracing::debug; |
| 24 | 24 | |
| 25 | 25 | use super::ConstCx; |
| 26 | use crate::errors; | |
| 26 | use crate::{errors, fluent_generated}; | |
| 27 | 27 | |
| 28 | 28 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 29 | 29 | pub enum Status { |
| ... | ... | @@ -310,7 +310,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> { |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if let ConstContext::Static(_) = ccx.const_kind() { |
| 313 | err.note("consider wrapping this expression in `std::sync::LazyLock::new(|| ...)`"); | |
| 313 | err.note(fluent_generated::const_eval_lazy_lock); | |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | err |
| ... | ... | @@ -334,7 +334,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallUnstable { |
| 334 | 334 | // FIXME: make this translatable |
| 335 | 335 | #[allow(rustc::untranslatable_diagnostic)] |
| 336 | 336 | if ccx.is_const_stable_const_fn() { |
| 337 | err.help("const-stable functions can only call other const-stable functions"); | |
| 337 | err.help(fluent_generated::const_eval_const_stable); | |
| 338 | 338 | } else if ccx.tcx.sess.is_nightly_build() { |
| 339 | 339 | if let Some(feature) = feature { |
| 340 | 340 | err.help(format!("add `#![feature({feature})]` to the crate attributes to enable")); |
| ... | ... | @@ -605,8 +605,6 @@ impl<'tcx> NonConstOp<'tcx> for StaticAccess { |
| 605 | 605 | span, |
| 606 | 606 | format!("referencing statics in {}s is unstable", ccx.const_kind(),), |
| 607 | 607 | ); |
| 608 | // FIXME: make this translatable | |
| 609 | #[allow(rustc::untranslatable_diagnostic)] | |
| 610 | 608 | err |
| 611 | 609 | .note("`static` and `const` variables can refer to other `const` variables. A `const` variable, however, cannot refer to a `static` variable.") |
| 612 | 610 | .help("to fix this, the value can be extracted to a `const` and then used."); |
compiler/rustc_const_eval/src/interpret/call.rs+2-1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | //! Manages calling a concrete function (with known MIR body) with argument passing, |
| 2 | 2 | //! and returning the return value to the caller. |
| 3 | use std::assert_matches::assert_matches; | |
| 3 | 4 | use std::borrow::Cow; |
| 4 | 5 | |
| 5 | 6 | use either::{Left, Right}; |
| ... | ... | @@ -557,7 +558,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { |
| 557 | 558 | unwind, |
| 558 | 559 | )? { |
| 559 | 560 | assert!(!self.tcx.intrinsic(fallback.def_id()).unwrap().must_be_overridden); |
| 560 | assert!(matches!(fallback.def, ty::InstanceKind::Item(_))); | |
| 561 | assert_matches!(fallback.def, ty::InstanceKind::Item(_)); | |
| 561 | 562 | return self.init_fn_call( |
| 562 | 563 | FnVal::Instance(fallback), |
| 563 | 564 | (caller_abi, caller_fn_abi), |
compiler/rustc_const_eval/src/interpret/intrinsics.rs+5-3| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | //! looking at their MIR. Intrinsics/functions supported here are shared by CTFE |
| 3 | 3 | //! and miri. |
| 4 | 4 | |
| 5 | use std::assert_matches::assert_matches; | |
| 6 | ||
| 5 | 7 | use rustc_hir::def_id::DefId; |
| 6 | 8 | use rustc_middle::mir::{self, BinOp, ConstValue, NonDivergingIntrinsic}; |
| 7 | 9 | use rustc_middle::ty::layout::{LayoutOf as _, TyAndLayout, ValidityRequirement}; |
| ... | ... | @@ -510,7 +512,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { |
| 510 | 512 | dest: &MPlaceTy<'tcx, M::Provenance>, |
| 511 | 513 | ) -> InterpResult<'tcx> { |
| 512 | 514 | assert_eq!(a.layout.ty, b.layout.ty); |
| 513 | assert!(matches!(a.layout.ty.kind(), ty::Int(..) | ty::Uint(..))); | |
| 515 | assert_matches!(a.layout.ty.kind(), ty::Int(..) | ty::Uint(..)); | |
| 514 | 516 | |
| 515 | 517 | // Performs an exact division, resulting in undefined behavior where |
| 516 | 518 | // `x % y != 0` or `y == 0` or `x == T::MIN && y == -1`. |
| ... | ... | @@ -536,8 +538,8 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> { |
| 536 | 538 | r: &ImmTy<'tcx, M::Provenance>, |
| 537 | 539 | ) -> InterpResult<'tcx, Scalar<M::Provenance>> { |
| 538 | 540 | assert_eq!(l.layout.ty, r.layout.ty); |
| 539 | assert!(matches!(l.layout.ty.kind(), ty::Int(..) | ty::Uint(..))); | |
| 540 | assert!(matches!(mir_op, BinOp::Add | BinOp::Sub)); | |
| 541 | assert_matches!(l.layout.ty.kind(), ty::Int(..) | ty::Uint(..)); | |
| 542 | assert_matches!(mir_op, BinOp::Add | BinOp::Sub); | |
| 541 | 543 | |
| 542 | 544 | let (val, overflowed) = |
| 543 | 545 | self.binary_op(mir_op.wrapping_to_overflowing().unwrap(), l, r)?.to_scalar_pair(); |
compiler/rustc_const_eval/src/interpret/operand.rs+1-1| ... | ... | @@ -342,7 +342,7 @@ impl<'tcx, Prov: Provenance> ImmTy<'tcx, Prov> { |
| 342 | 342 | } |
| 343 | 343 | // extract fields from types with `ScalarPair` ABI |
| 344 | 344 | (Immediate::ScalarPair(a_val, b_val), Abi::ScalarPair(a, b)) => { |
| 345 | assert!(matches!(layout.abi, Abi::Scalar(..))); | |
| 345 | assert_matches!(layout.abi, Abi::Scalar(..)); | |
| 346 | 346 | Immediate::from(if offset.bytes() == 0 { |
| 347 | 347 | debug_assert_eq!(layout.size, a.size(cx)); |
| 348 | 348 | a_val |
compiler/rustc_data_structures/src/graph/scc/mod.rs+2-1| ... | ... | @@ -8,6 +8,7 @@ |
| 8 | 8 | //! Typical examples would include: minimum element in SCC, maximum element |
| 9 | 9 | //! reachable from it, etc. |
| 10 | 10 | |
| 11 | use std::assert_matches::debug_assert_matches; | |
| 11 | 12 | use std::fmt::Debug; |
| 12 | 13 | use std::ops::Range; |
| 13 | 14 | |
| ... | ... | @@ -569,7 +570,7 @@ where |
| 569 | 570 | // This None marks that we still have the initialize this node's frame. |
| 570 | 571 | debug!(?depth, ?node); |
| 571 | 572 | |
| 572 | debug_assert!(matches!(self.node_states[node], NodeState::NotVisited)); | |
| 573 | debug_assert_matches!(self.node_states[node], NodeState::NotVisited); | |
| 573 | 574 | |
| 574 | 575 | // Push `node` onto the stack. |
| 575 | 576 | self.node_states[node] = NodeState::BeingVisited { |
compiler/rustc_data_structures/src/lib.rs+1| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | #![feature(array_windows)] |
| 19 | 19 | #![feature(ascii_char)] |
| 20 | 20 | #![feature(ascii_char_variants)] |
| 21 | #![feature(assert_matches)] | |
| 21 | 22 | #![feature(auto_traits)] |
| 22 | 23 | #![feature(cfg_match)] |
| 23 | 24 | #![feature(core_intrinsics)] |
compiler/rustc_errors/src/lib.rs+3-1| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] |
| 11 | 11 | #![doc(rust_logo)] |
| 12 | 12 | #![feature(array_windows)] |
| 13 | #![feature(assert_matches)] | |
| 13 | 14 | #![feature(associated_type_defaults)] |
| 14 | 15 | #![feature(box_into_inner)] |
| 15 | 16 | #![feature(box_patterns)] |
| ... | ... | @@ -28,6 +29,7 @@ |
| 28 | 29 | |
| 29 | 30 | extern crate self as rustc_errors; |
| 30 | 31 | |
| 32 | use std::assert_matches::assert_matches; | |
| 31 | 33 | use std::backtrace::{Backtrace, BacktraceStatus}; |
| 32 | 34 | use std::borrow::Cow; |
| 33 | 35 | use std::cell::Cell; |
| ... | ... | @@ -1490,7 +1492,7 @@ impl DiagCtxtInner { |
| 1490 | 1492 | // Future breakages aren't emitted if they're `Level::Allow` or |
| 1491 | 1493 | // `Level::Expect`, but they still need to be constructed and |
| 1492 | 1494 | // stashed below, so they'll trigger the must_produce_diag check. |
| 1493 | assert!(matches!(diagnostic.level, Error | Warning | Allow | Expect(_))); | |
| 1495 | assert_matches!(diagnostic.level, Error | Warning | Allow | Expect(_)); | |
| 1494 | 1496 | self.future_breakage_diagnostics.push(diagnostic.clone()); |
| 1495 | 1497 | } |
| 1496 | 1498 |
compiler/rustc_expand/messages.ftl+3| ... | ... | @@ -129,6 +129,9 @@ expand_module_multiple_candidates = |
| 129 | 129 | expand_must_repeat_once = |
| 130 | 130 | this must repeat at least once |
| 131 | 131 | |
| 132 | expand_non_inline_modules_in_proc_macro_input_are_unstable = | |
| 133 | non-inline modules in proc macro input are unstable | |
| 134 | ||
| 132 | 135 | expand_not_a_meta_item = |
| 133 | 136 | not a meta item |
| 134 | 137 |
compiler/rustc_expand/src/base.rs-2| ... | ... | @@ -1398,8 +1398,6 @@ fn pretty_printing_compatibility_hack(item: &Item, sess: &Session) { |
| 1398 | 1398 | }; |
| 1399 | 1399 | |
| 1400 | 1400 | if crate_matches { |
| 1401 | // FIXME: make this translatable | |
| 1402 | #[allow(rustc::untranslatable_diagnostic)] | |
| 1403 | 1401 | sess.dcx().emit_fatal(errors::ProcMacroBackCompat { |
| 1404 | 1402 | crate_name: "rental".to_string(), |
| 1405 | 1403 | fixed_version: "0.5.6".to_string(), |
compiler/rustc_expand/src/expand.rs+2-3| ... | ... | @@ -39,6 +39,7 @@ use crate::errors::{ |
| 39 | 39 | RecursionLimitReached, RemoveExprNotSupported, RemoveNodeNotSupported, UnsupportedKeyValue, |
| 40 | 40 | WrongFragmentKind, |
| 41 | 41 | }; |
| 42 | use crate::fluent_generated; | |
| 42 | 43 | use crate::mbe::diagnostics::annotate_err_with_kind; |
| 43 | 44 | use crate::module::{mod_dir_path, parse_external_mod, DirOwnership, ParsedExternalMod}; |
| 44 | 45 | use crate::placeholders::{placeholder, PlaceholderExpander}; |
| ... | ... | @@ -882,7 +883,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { |
| 882 | 883 | } |
| 883 | 884 | |
| 884 | 885 | impl<'ast, 'a> Visitor<'ast> for GateProcMacroInput<'a> { |
| 885 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 886 | 886 | fn visit_item(&mut self, item: &'ast ast::Item) { |
| 887 | 887 | match &item.kind { |
| 888 | 888 | ItemKind::Mod(_, mod_kind) |
| ... | ... | @@ -892,7 +892,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { |
| 892 | 892 | self.sess, |
| 893 | 893 | sym::proc_macro_hygiene, |
| 894 | 894 | item.span, |
| 895 | "non-inline modules in proc macro input are unstable", | |
| 895 | fluent_generated::expand_non_inline_modules_in_proc_macro_input_are_unstable, | |
| 896 | 896 | ) |
| 897 | 897 | .emit(); |
| 898 | 898 | } |
| ... | ... | @@ -1876,7 +1876,6 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { |
| 1876 | 1876 | |
| 1877 | 1877 | // Detect use of feature-gated or invalid attributes on macro invocations |
| 1878 | 1878 | // since they will not be detected after macro expansion. |
| 1879 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 1880 | 1879 | fn check_attributes(&self, attrs: &[ast::Attribute], call: &ast::MacCall) { |
| 1881 | 1880 | let features = self.cx.ecfg.features; |
| 1882 | 1881 | let mut attrs = attrs.iter().peekable(); |
compiler/rustc_hir_analysis/src/check/intrinsicck.rs+6-4| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::debug_assert_matches; | |
| 2 | ||
| 1 | 3 | use rustc_ast::InlineAsmTemplatePiece; |
| 2 | 4 | use rustc_data_structures::fx::FxIndexSet; |
| 3 | 5 | use rustc_hir::{self as hir, LangItem}; |
| ... | ... | @@ -457,17 +459,17 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> { |
| 457 | 459 | } |
| 458 | 460 | // Typeck has checked that Const operands are integers. |
| 459 | 461 | hir::InlineAsmOperand::Const { anon_const } => { |
| 460 | debug_assert!(matches!( | |
| 462 | debug_assert_matches!( | |
| 461 | 463 | self.tcx.type_of(anon_const.def_id).instantiate_identity().kind(), |
| 462 | 464 | ty::Error(_) | ty::Int(_) | ty::Uint(_) |
| 463 | )); | |
| 465 | ); | |
| 464 | 466 | } |
| 465 | 467 | // Typeck has checked that SymFn refers to a function. |
| 466 | 468 | hir::InlineAsmOperand::SymFn { anon_const } => { |
| 467 | debug_assert!(matches!( | |
| 469 | debug_assert_matches!( | |
| 468 | 470 | self.tcx.type_of(anon_const.def_id).instantiate_identity().kind(), |
| 469 | 471 | ty::Error(_) | ty::FnDef(..) |
| 470 | )); | |
| 472 | ); | |
| 471 | 473 | } |
| 472 | 474 | // AST lowering guarantees that SymStatic points to a static. |
| 473 | 475 | hir::InlineAsmOperand::SymStatic { .. } => {} |
compiler/rustc_hir_analysis/src/coherence/builtin.rs+2-1| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | //! Check properties that are required by built-in traits and set |
| 2 | 2 | //! up data structures required by type-checking/codegen. |
| 3 | 3 | |
| 4 | use std::assert_matches::assert_matches; | |
| 4 | 5 | use std::collections::BTreeMap; |
| 5 | 6 | |
| 6 | 7 | use rustc_data_structures::fx::FxHashSet; |
| ... | ... | @@ -129,7 +130,7 @@ fn visit_implementation_of_const_param_ty( |
| 129 | 130 | checker: &Checker<'_>, |
| 130 | 131 | kind: LangItem, |
| 131 | 132 | ) -> Result<(), ErrorGuaranteed> { |
| 132 | assert!(matches!(kind, LangItem::ConstParamTy | LangItem::UnsizedConstParamTy)); | |
| 133 | assert_matches!(kind, LangItem::ConstParamTy | LangItem::UnsizedConstParamTy); | |
| 133 | 134 | |
| 134 | 135 | let tcx = checker.tcx; |
| 135 | 136 | let header = checker.impl_header; |
compiler/rustc_hir_analysis/src/collect/generics_of.rs+5-4| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 1 | 2 | use std::ops::ControlFlow; |
| 2 | 3 | |
| 3 | 4 | use hir::intravisit::{self, Visitor}; |
| ... | ... | @@ -207,9 +208,9 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { |
| 207 | 208 | .. |
| 208 | 209 | }) => { |
| 209 | 210 | if in_trait { |
| 210 | assert!(matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn)) | |
| 211 | assert_matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn); | |
| 211 | 212 | } else { |
| 212 | assert!(matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn | DefKind::Fn)) | |
| 213 | assert_matches!(tcx.def_kind(fn_def_id), DefKind::AssocFn | DefKind::Fn); | |
| 213 | 214 | } |
| 214 | 215 | Some(fn_def_id.to_def_id()) |
| 215 | 216 | } |
| ... | ... | @@ -218,9 +219,9 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { |
| 218 | 219 | .. |
| 219 | 220 | }) => { |
| 220 | 221 | if in_assoc_ty { |
| 221 | assert!(matches!(tcx.def_kind(parent), DefKind::AssocTy)); | |
| 222 | assert_matches!(tcx.def_kind(parent), DefKind::AssocTy); | |
| 222 | 223 | } else { |
| 223 | assert!(matches!(tcx.def_kind(parent), DefKind::TyAlias)); | |
| 224 | assert_matches!(tcx.def_kind(parent), DefKind::TyAlias); | |
| 224 | 225 | } |
| 225 | 226 | debug!("generics_of: parent of opaque ty {:?} is {:?}", def_id, parent); |
| 226 | 227 | // Opaque types are always nested within another item, and |
compiler/rustc_hir_analysis/src/collect/predicates_of.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use hir::{HirId, Node}; |
| 2 | 4 | use rustc_data_structures::fx::FxIndexSet; |
| 3 | 5 | use rustc_hir as hir; |
| ... | ... | @@ -601,7 +603,7 @@ pub(super) fn implied_predicates_with_filter( |
| 601 | 603 | let Some(trait_def_id) = trait_def_id.as_local() else { |
| 602 | 604 | // if `assoc_name` is None, then the query should've been redirected to an |
| 603 | 605 | // external provider |
| 604 | assert!(matches!(filter, PredicateFilter::SelfThatDefines(_))); | |
| 606 | assert_matches!(filter, PredicateFilter::SelfThatDefines(_)); | |
| 605 | 607 | return tcx.explicit_super_predicates_of(trait_def_id); |
| 606 | 608 | }; |
| 607 | 609 |
compiler/rustc_hir_analysis/src/delegation.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::debug_assert_matches; | |
| 2 | ||
| 1 | 3 | use rustc_data_structures::fx::FxHashMap; |
| 2 | 4 | use rustc_hir::def::DefKind; |
| 3 | 5 | use rustc_hir::def_id::{DefId, LocalDefId}; |
| ... | ... | @@ -63,7 +65,7 @@ enum FnKind { |
| 63 | 65 | } |
| 64 | 66 | |
| 65 | 67 | fn fn_kind<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> FnKind { |
| 66 | debug_assert!(matches!(tcx.def_kind(def_id), DefKind::Fn | DefKind::AssocFn)); | |
| 68 | debug_assert_matches!(tcx.def_kind(def_id), DefKind::Fn | DefKind::AssocFn); | |
| 67 | 69 | |
| 68 | 70 | let parent = tcx.parent(def_id); |
| 69 | 71 | match tcx.def_kind(parent) { |
compiler/rustc_hir_analysis/src/impl_wf_check.rs+3-1| ... | ... | @@ -8,6 +8,8 @@ |
| 8 | 8 | //! specialization errors. These things can (and probably should) be |
| 9 | 9 | //! fixed, but for the moment it's easier to do these checks early. |
| 10 | 10 | |
| 11 | use std::assert_matches::debug_assert_matches; | |
| 12 | ||
| 11 | 13 | use min_specialization::check_min_specialization; |
| 12 | 14 | use rustc_data_structures::fx::FxHashSet; |
| 13 | 15 | use rustc_errors::codes::*; |
| ... | ... | @@ -54,7 +56,7 @@ mod min_specialization; |
| 54 | 56 | pub fn check_impl_wf(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) -> Result<(), ErrorGuaranteed> { |
| 55 | 57 | let min_specialization = tcx.features().min_specialization; |
| 56 | 58 | let mut res = Ok(()); |
| 57 | debug_assert!(matches!(tcx.def_kind(impl_def_id), DefKind::Impl { .. })); | |
| 59 | debug_assert_matches!(tcx.def_kind(impl_def_id), DefKind::Impl { .. }); | |
| 58 | 60 | res = res.and(enforce_impl_params_are_constrained(tcx, impl_def_id)); |
| 59 | 61 | if min_specialization { |
| 60 | 62 | res = res.and(check_min_specialization(tcx, impl_def_id)); |
compiler/rustc_hir_analysis/src/lib.rs+1| ... | ... | @@ -62,6 +62,7 @@ This API is completely unstable and subject to change. |
| 62 | 62 | #![allow(rustc::untranslatable_diagnostic)] |
| 63 | 63 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] |
| 64 | 64 | #![doc(rust_logo)] |
| 65 | #![feature(assert_matches)] | |
| 65 | 66 | #![feature(control_flow_enum)] |
| 66 | 67 | #![feature(if_let_guard)] |
| 67 | 68 | #![feature(iter_intersperse)] |
compiler/rustc_infer/src/infer/outlives/verify.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use rustc_middle::ty::{self, OutlivesPredicate, Ty, TyCtxt}; |
| 2 | 4 | use rustc_type_ir::outlives::{compute_alias_components_recursive, Component}; |
| 3 | 5 | use smallvec::smallvec; |
| ... | ... | @@ -181,7 +183,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> { |
| 181 | 183 | &self, |
| 182 | 184 | generic_ty: Ty<'tcx>, |
| 183 | 185 | ) -> Vec<ty::PolyTypeOutlivesPredicate<'tcx>> { |
| 184 | assert!(matches!(generic_ty.kind(), ty::Param(_) | ty::Placeholder(_))); | |
| 186 | assert_matches!(generic_ty.kind(), ty::Param(_) | ty::Placeholder(_)); | |
| 185 | 187 | self.declared_generic_bounds_from_env_for_erased_ty(generic_ty) |
| 186 | 188 | } |
| 187 | 189 |
compiler/rustc_infer/src/lib.rs+1| ... | ... | @@ -18,6 +18,7 @@ |
| 18 | 18 | #![allow(rustc::untranslatable_diagnostic)] |
| 19 | 19 | #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] |
| 20 | 20 | #![doc(rust_logo)] |
| 21 | #![feature(assert_matches)] | |
| 21 | 22 | #![feature(box_patterns)] |
| 22 | 23 | #![feature(control_flow_enum)] |
| 23 | 24 | #![feature(extend_one)] |
compiler/rustc_interface/src/util.rs-1| ... | ... | @@ -386,7 +386,6 @@ fn get_codegen_sysroot( |
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 390 | 389 | pub(crate) fn check_attr_crate_type( |
| 391 | 390 | sess: &Session, |
| 392 | 391 | attrs: &[ast::Attribute], |
compiler/rustc_lint/src/levels.rs-2| ... | ... | @@ -717,7 +717,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { |
| 717 | 717 | }; |
| 718 | 718 | } |
| 719 | 719 | |
| 720 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 721 | 720 | fn add(&mut self, attrs: &[ast::Attribute], is_crate_node: bool, source_hir_id: Option<HirId>) { |
| 722 | 721 | let sess = self.sess; |
| 723 | 722 | for (attr_index, attr) in attrs.iter().enumerate() { |
| ... | ... | @@ -1039,7 +1038,6 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { |
| 1039 | 1038 | let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS); |
| 1040 | 1039 | // FIXME: make this translatable |
| 1041 | 1040 | #[allow(rustc::diagnostic_outside_of_impl)] |
| 1042 | #[allow(rustc::untranslatable_diagnostic)] | |
| 1043 | 1041 | lint_level(self.sess, lint, level, src, Some(span.into()), |lint| { |
| 1044 | 1042 | lint.primary_message(fluent::lint_unknown_gated_lint); |
| 1045 | 1043 | lint.arg("name", lint_id.lint.name_lower()); |
compiler/rustc_metadata/messages.ftl+6| ... | ... | @@ -134,12 +134,18 @@ metadata_lib_framework_apple = |
| 134 | 134 | metadata_lib_required = |
| 135 | 135 | crate `{$crate_name}` required to be available in {$kind} format, but was not found in this form |
| 136 | 136 | |
| 137 | metadata_link_arg_unstable = | |
| 138 | link kind `link-arg` is unstable | |
| 139 | ||
| 137 | 140 | metadata_link_cfg_form = |
| 138 | 141 | link cfg must be of the form `cfg(/* predicate */)` |
| 139 | 142 | |
| 140 | 143 | metadata_link_cfg_single_predicate = |
| 141 | 144 | link cfg must have a single predicate argument |
| 142 | 145 | |
| 146 | metadata_link_cfg_unstable = | |
| 147 | link cfg is unstable | |
| 148 | ||
| 143 | 149 | metadata_link_framework_apple = |
| 144 | 150 | link kind `framework` is only supported on Apple targets |
| 145 | 151 |
compiler/rustc_metadata/src/creader.rs-1| ... | ... | @@ -949,7 +949,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> { |
| 949 | 949 | } |
| 950 | 950 | } |
| 951 | 951 | |
| 952 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 953 | 952 | fn report_unused_deps(&mut self, krate: &ast::Crate) { |
| 954 | 953 | // Make a point span rather than covering the whole file |
| 955 | 954 | let span = krate.spans.inner_span.shrink_to_lo(); |
compiler/rustc_metadata/src/native_libs.rs+11-5| ... | ... | @@ -17,7 +17,7 @@ use rustc_span::def_id::{DefId, LOCAL_CRATE}; |
| 17 | 17 | use rustc_span::symbol::{sym, Symbol}; |
| 18 | 18 | use rustc_target::spec::abi::Abi; |
| 19 | 19 | |
| 20 | use crate::errors; | |
| 20 | use crate::{errors, fluent_generated}; | |
| 21 | 21 | |
| 22 | 22 | pub fn find_native_static_library(name: &str, verbatim: bool, sess: &Session) -> PathBuf { |
| 23 | 23 | let formats = if verbatim { |
| ... | ... | @@ -87,7 +87,6 @@ struct Collector<'tcx> { |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | impl<'tcx> Collector<'tcx> { |
| 90 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 91 | 90 | fn process_module(&mut self, module: &ForeignModule) { |
| 92 | 91 | let ForeignModule { def_id, abi, ref foreign_items } = *module; |
| 93 | 92 | let def_id = def_id.expect_local(); |
| ... | ... | @@ -161,7 +160,7 @@ impl<'tcx> Collector<'tcx> { |
| 161 | 160 | sess, |
| 162 | 161 | sym::link_arg_attribute, |
| 163 | 162 | span, |
| 164 | "link kind `link-arg` is unstable", | |
| 163 | fluent_generated::metadata_link_arg_unstable, | |
| 165 | 164 | ) |
| 166 | 165 | .emit(); |
| 167 | 166 | } |
| ... | ... | @@ -201,8 +200,13 @@ impl<'tcx> Collector<'tcx> { |
| 201 | 200 | continue; |
| 202 | 201 | }; |
| 203 | 202 | if !features.link_cfg { |
| 204 | feature_err(sess, sym::link_cfg, item.span(), "link cfg is unstable") | |
| 205 | .emit(); | |
| 203 | feature_err( | |
| 204 | sess, | |
| 205 | sym::link_cfg, | |
| 206 | item.span(), | |
| 207 | fluent_generated::metadata_link_cfg_unstable, | |
| 208 | ) | |
| 209 | .emit(); | |
| 206 | 210 | } |
| 207 | 211 | cfg = Some(link_cfg.clone()); |
| 208 | 212 | } |
| ... | ... | @@ -266,6 +270,8 @@ impl<'tcx> Collector<'tcx> { |
| 266 | 270 | |
| 267 | 271 | macro report_unstable_modifier($feature: ident) { |
| 268 | 272 | if !features.$feature { |
| 273 | // FIXME: make this translatable | |
| 274 | #[expect(rustc::untranslatable_diagnostic)] | |
| 269 | 275 | feature_err( |
| 270 | 276 | sess, |
| 271 | 277 | sym::$feature, |
compiler/rustc_middle/src/ty/consts/kind.rs+6-4| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use rustc_macros::{extension, HashStable, TyDecodable, TyEncodable, TypeFoldable, TypeVisitable}; |
| 2 | 4 | |
| 3 | 5 | use super::Const; |
| ... | ... | @@ -80,7 +82,7 @@ impl<'tcx> Expr<'tcx> { |
| 80 | 82 | } |
| 81 | 83 | |
| 82 | 84 | pub fn binop_args(self) -> (Ty<'tcx>, Ty<'tcx>, Const<'tcx>, Const<'tcx>) { |
| 83 | assert!(matches!(self.kind, ExprKind::Binop(_))); | |
| 85 | assert_matches!(self.kind, ExprKind::Binop(_)); | |
| 84 | 86 | |
| 85 | 87 | match self.args().as_slice() { |
| 86 | 88 | [lhs_ty, rhs_ty, lhs_ct, rhs_ct] => ( |
| ... | ... | @@ -101,7 +103,7 @@ impl<'tcx> Expr<'tcx> { |
| 101 | 103 | } |
| 102 | 104 | |
| 103 | 105 | pub fn unop_args(self) -> (Ty<'tcx>, Const<'tcx>) { |
| 104 | assert!(matches!(self.kind, ExprKind::UnOp(_))); | |
| 106 | assert_matches!(self.kind, ExprKind::UnOp(_)); | |
| 105 | 107 | |
| 106 | 108 | match self.args().as_slice() { |
| 107 | 109 | [ty, ct] => (ty.expect_ty(), ct.expect_const()), |
| ... | ... | @@ -125,7 +127,7 @@ impl<'tcx> Expr<'tcx> { |
| 125 | 127 | } |
| 126 | 128 | |
| 127 | 129 | pub fn call_args(self) -> (Ty<'tcx>, Const<'tcx>, impl Iterator<Item = Const<'tcx>>) { |
| 128 | assert!(matches!(self.kind, ExprKind::FunctionCall)); | |
| 130 | assert_matches!(self.kind, ExprKind::FunctionCall); | |
| 129 | 131 | |
| 130 | 132 | match self.args().as_slice() { |
| 131 | 133 | [func_ty, func, rest @ ..] => ( |
| ... | ... | @@ -152,7 +154,7 @@ impl<'tcx> Expr<'tcx> { |
| 152 | 154 | } |
| 153 | 155 | |
| 154 | 156 | pub fn cast_args(self) -> (Ty<'tcx>, Const<'tcx>, Ty<'tcx>) { |
| 155 | assert!(matches!(self.kind, ExprKind::Cast(_))); | |
| 157 | assert_matches!(self.kind, ExprKind::Cast(_)); | |
| 156 | 158 | |
| 157 | 159 | match self.args().as_slice() { |
| 158 | 160 | [value_ty, value, to_ty] => { |
compiler/rustc_mir_dataflow/src/impls/initialized.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use rustc_index::bit_set::{BitSet, ChunkedBitSet}; |
| 2 | 4 | use rustc_index::Idx; |
| 3 | 5 | use rustc_middle::bug; |
| ... | ... | @@ -496,7 +498,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, '_, 'tcx> { |
| 496 | 498 | }); |
| 497 | 499 | if self.skip_unreachable_unwind.contains(location.block) { |
| 498 | 500 | let mir::TerminatorKind::Drop { target, unwind, .. } = terminator.kind else { bug!() }; |
| 499 | assert!(matches!(unwind, mir::UnwindAction::Cleanup(_))); | |
| 501 | assert_matches!(unwind, mir::UnwindAction::Cleanup(_)); | |
| 500 | 502 | TerminatorEdges::Single(target) |
| 501 | 503 | } else { |
| 502 | 504 | terminator.edges() |
compiler/rustc_mir_dataflow/src/lib.rs+1| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | // tidy-alphabetical-start |
| 2 | #![feature(assert_matches)] | |
| 2 | 3 | #![feature(associated_type_defaults)] |
| 3 | 4 | #![feature(box_patterns)] |
| 4 | 5 | #![feature(exact_size_is_empty)] |
compiler/rustc_mir_dataflow/src/value_analysis.rs+3-2| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 | //! Because of that, we can assume that the only way to change the value behind a tracked place is |
| 33 | 33 | //! by direct assignment. |
| 34 | 34 | |
| 35 | use std::assert_matches::assert_matches; | |
| 35 | 36 | use std::fmt::{Debug, Formatter}; |
| 36 | 37 | use std::ops::Range; |
| 37 | 38 | |
| ... | ... | @@ -54,7 +55,7 @@ use crate::{Analysis, AnalysisDomain, JoinSemiLattice, SwitchIntEdgeEffects}; |
| 54 | 55 | |
| 55 | 56 | pub trait ValueAnalysis<'tcx> { |
| 56 | 57 | /// For each place of interest, the analysis tracks a value of the given type. |
| 57 | type Value: Clone + JoinSemiLattice + HasBottom + HasTop; | |
| 58 | type Value: Clone + JoinSemiLattice + HasBottom + HasTop + Debug; | |
| 58 | 59 | |
| 59 | 60 | const NAME: &'static str; |
| 60 | 61 | |
| ... | ... | @@ -344,7 +345,7 @@ impl<'tcx, T: ValueAnalysis<'tcx>> AnalysisDomain<'tcx> for ValueAnalysisWrapper |
| 344 | 345 | |
| 345 | 346 | fn initialize_start_block(&self, body: &Body<'tcx>, state: &mut Self::Domain) { |
| 346 | 347 | // The initial state maps all tracked places of argument projections to ⊤ and the rest to ⊥. |
| 347 | assert!(matches!(state, State::Unreachable)); | |
| 348 | assert_matches!(state, State::Unreachable); | |
| 348 | 349 | *state = State::new_reachable(); |
| 349 | 350 | for arg in body.args_iter() { |
| 350 | 351 | state.flood(PlaceRef { local: arg, projection: &[] }, self.0.map()); |
compiler/rustc_mir_transform/src/promote_consts.rs+2-2| ... | ... | @@ -468,7 +468,7 @@ impl<'tcx> Validator<'_, 'tcx> { |
| 468 | 468 | |
| 469 | 469 | if let ty::RawPtr(_, _) | ty::FnPtr(..) = lhs_ty.kind() { |
| 470 | 470 | // Raw and fn pointer operations are not allowed inside consts and thus not promotable. |
| 471 | assert!(matches!( | |
| 471 | assert_matches!( | |
| 472 | 472 | op, |
| 473 | 473 | BinOp::Eq |
| 474 | 474 | | BinOp::Ne |
| ... | ... | @@ -477,7 +477,7 @@ impl<'tcx> Validator<'_, 'tcx> { |
| 477 | 477 | | BinOp::Ge |
| 478 | 478 | | BinOp::Gt |
| 479 | 479 | | BinOp::Offset |
| 480 | )); | |
| 480 | ); | |
| 481 | 481 | return Err(Unpromotable); |
| 482 | 482 | } |
| 483 | 483 |
compiler/rustc_mir_transform/src/shim.rs+1-1| ... | ... | @@ -996,7 +996,7 @@ pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> { |
| 996 | 996 | /// } |
| 997 | 997 | /// ``` |
| 998 | 998 | fn build_fn_ptr_addr_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> { |
| 999 | assert!(matches!(self_ty.kind(), ty::FnPtr(..)), "expected fn ptr, found {self_ty}"); | |
| 999 | assert_matches!(self_ty.kind(), ty::FnPtr(..), "expected fn ptr, found {self_ty}"); | |
| 1000 | 1000 | let span = tcx.def_span(def_id); |
| 1001 | 1001 | let Some(sig) = tcx.fn_sig(def_id).instantiate(tcx, &[self_ty.into()]).no_bound_vars() else { |
| 1002 | 1002 | span_bug!(span, "FnPtr::addr with bound vars for `{self_ty}`"); |
compiler/rustc_parse/src/lib.rs+1| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | #![allow(rustc::diagnostic_outside_of_impl)] |
| 6 | 6 | #![allow(rustc::untranslatable_diagnostic)] |
| 7 | 7 | #![feature(array_windows)] |
| 8 | #![feature(assert_matches)] | |
| 8 | 9 | #![feature(box_patterns)] |
| 9 | 10 | #![feature(debug_closure_helpers)] |
| 10 | 11 | #![feature(if_let_guard)] |
compiler/rustc_parse/src/parser/mod.rs+8-5| ... | ... | @@ -10,6 +10,7 @@ mod path; |
| 10 | 10 | mod stmt; |
| 11 | 11 | mod ty; |
| 12 | 12 | |
| 13 | use std::assert_matches::debug_assert_matches; | |
| 13 | 14 | use std::ops::Range; |
| 14 | 15 | use std::{fmt, mem, slice}; |
| 15 | 16 | |
| ... | ... | @@ -1166,10 +1167,12 @@ impl<'a> Parser<'a> { |
| 1166 | 1167 | match self.token_cursor.tree_cursor.look_ahead(0) { |
| 1167 | 1168 | Some(tree) => { |
| 1168 | 1169 | // Indexing stayed within the current token tree. |
| 1169 | return match tree { | |
| 1170 | TokenTree::Token(token, _) => looker(token), | |
| 1171 | TokenTree::Delimited(dspan, _, delim, _) => { | |
| 1172 | looker(&Token::new(token::OpenDelim(*delim), dspan.open)) | |
| 1170 | match tree { | |
| 1171 | TokenTree::Token(token, _) => return looker(token), | |
| 1172 | &TokenTree::Delimited(dspan, _, delim, _) => { | |
| 1173 | if delim != Delimiter::Invisible { | |
| 1174 | return looker(&Token::new(token::OpenDelim(delim), dspan.open)); | |
| 1175 | } | |
| 1173 | 1176 | } |
| 1174 | 1177 | }; |
| 1175 | 1178 | } |
| ... | ... | @@ -1385,7 +1388,7 @@ impl<'a> Parser<'a> { |
| 1385 | 1388 | // can capture these tokens if necessary. |
| 1386 | 1389 | self.bump(); |
| 1387 | 1390 | if self.token_cursor.stack.len() == target_depth { |
| 1388 | debug_assert!(matches!(self.token.kind, token::CloseDelim(_))); | |
| 1391 | debug_assert_matches!(self.token.kind, token::CloseDelim(_)); | |
| 1389 | 1392 | break; |
| 1390 | 1393 | } |
| 1391 | 1394 | } |
compiler/rustc_parse/src/parser/tests.rs+2-1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 1 | 2 | use std::io::prelude::*; |
| 2 | 3 | use std::iter::Peekable; |
| 3 | 4 | use std::path::{Path, PathBuf}; |
| ... | ... | @@ -1747,7 +1748,7 @@ fn out_of_line_mod() { |
| 1747 | 1748 | .unwrap(); |
| 1748 | 1749 | |
| 1749 | 1750 | let ast::ItemKind::Mod(_, mod_kind) = &item.kind else { panic!() }; |
| 1750 | assert!(matches!(mod_kind, ast::ModKind::Loaded(items, ..) if items.len() == 2)); | |
| 1751 | assert_matches!(mod_kind, ast::ModKind::Loaded(items, ..) if items.len() == 2); | |
| 1751 | 1752 | }); |
| 1752 | 1753 | } |
| 1753 | 1754 |
compiler/rustc_passes/messages.ftl+6| ... | ... | @@ -223,6 +223,9 @@ passes_doc_masked_only_extern_crate = |
| 223 | 223 | .not_an_extern_crate_label = not an `extern crate` item |
| 224 | 224 | .note = read <https://doc.rust-lang.org/unstable-book/language-features/doc-masked.html> for more information |
| 225 | 225 | |
| 226 | passes_doc_rust_logo = | |
| 227 | the `#[doc(rust_logo)]` attribute is used for Rust branding | |
| 228 | ||
| 226 | 229 | passes_doc_test_literal = `#![doc(test(...)]` does not take a literal |
| 227 | 230 | |
| 228 | 231 | passes_doc_test_takes_list = |
| ... | ... | @@ -595,6 +598,9 @@ passes_remove_fields = |
| 595 | 598 | *[other] fields |
| 596 | 599 | } |
| 597 | 600 | |
| 601 | passes_repr_align_function = | |
| 602 | `repr(align)` attributes on functions are unstable | |
| 603 | ||
| 598 | 604 | passes_repr_conflicting = |
| 599 | 605 | conflicting representation hints |
| 600 | 606 |
compiler/rustc_passes/src/check_attr.rs+2-4| ... | ... | @@ -1142,7 +1142,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 1142 | 1142 | /// of one item. Read the documentation of [`check_doc_inline`] for more information. |
| 1143 | 1143 | /// |
| 1144 | 1144 | /// [`check_doc_inline`]: Self::check_doc_inline |
| 1145 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 1146 | 1145 | fn check_doc_attrs( |
| 1147 | 1146 | &self, |
| 1148 | 1147 | attr: &Attribute, |
| ... | ... | @@ -1220,7 +1219,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 1220 | 1219 | &self.tcx.sess, |
| 1221 | 1220 | sym::rustdoc_internals, |
| 1222 | 1221 | meta.span(), |
| 1223 | "the `#[doc(rust_logo)]` attribute is used for Rust branding", | |
| 1222 | fluent::passes_doc_rust_logo, | |
| 1224 | 1223 | ) |
| 1225 | 1224 | .emit(); |
| 1226 | 1225 | } |
| ... | ... | @@ -1736,7 +1735,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 1736 | 1735 | } |
| 1737 | 1736 | |
| 1738 | 1737 | /// Checks if the `#[repr]` attributes on `item` are valid. |
| 1739 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 1740 | 1738 | fn check_repr( |
| 1741 | 1739 | &self, |
| 1742 | 1740 | attrs: &[Attribute], |
| ... | ... | @@ -1793,7 +1791,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 1793 | 1791 | &self.tcx.sess, |
| 1794 | 1792 | sym::fn_align, |
| 1795 | 1793 | hint.span(), |
| 1796 | "`repr(align)` attributes on functions are unstable", | |
| 1794 | fluent::passes_repr_align_function, | |
| 1797 | 1795 | ) |
| 1798 | 1796 | .emit(); |
| 1799 | 1797 | } |
compiler/rustc_passes/src/entry.rs-1| ... | ... | @@ -106,7 +106,6 @@ fn check_and_search_item(id: ItemId, ctxt: &mut EntryContext<'_>) { |
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | #[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable | |
| 110 | 109 | fn configure_main(tcx: TyCtxt<'_>, visitor: &EntryContext<'_>) -> Option<(DefId, EntryFnType)> { |
| 111 | 110 | if let Some((def_id, _)) = visitor.start_fn { |
| 112 | 111 | Some((def_id.to_def_id(), EntryFnType::Start)) |
compiler/rustc_target/src/spec/abi/tests.rs+3-1| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 2 | ||
| 1 | 3 | use super::*; |
| 2 | 4 | |
| 3 | 5 | #[allow(non_snake_case)] |
| ... | ... | @@ -16,7 +18,7 @@ fn lookup_cdecl() { |
| 16 | 18 | #[test] |
| 17 | 19 | fn lookup_baz() { |
| 18 | 20 | let abi = lookup("baz"); |
| 19 | assert!(matches!(abi, Err(AbiUnsupported::Unrecognized))) | |
| 21 | assert_matches!(abi, Err(AbiUnsupported::Unrecognized)); | |
| 20 | 22 | } |
| 21 | 23 | |
| 22 | 24 | #[test] |
compiler/rustc_trait_selection/src/solve/inspect/analyse.rs+4-2| ... | ... | @@ -9,6 +9,8 @@ |
| 9 | 9 | //! coherence right now and was annoying to implement, so I am leaving it |
| 10 | 10 | //! as is until we start using it for something else. |
| 11 | 11 | |
| 12 | use std::assert_matches::assert_matches; | |
| 13 | ||
| 12 | 14 | use rustc_ast_ir::try_visit; |
| 13 | 15 | use rustc_ast_ir::visit::VisitorResult; |
| 14 | 16 | use rustc_infer::infer::{DefineOpaqueTypes, InferCtxt, InferOk}; |
| ... | ... | @@ -273,10 +275,10 @@ impl<'a, 'tcx> InspectGoal<'a, 'tcx> { |
| 273 | 275 | steps.push(step) |
| 274 | 276 | } |
| 275 | 277 | inspect::ProbeStep::MakeCanonicalResponse { shallow_certainty: c } => { |
| 276 | assert!(matches!( | |
| 278 | assert_matches!( | |
| 277 | 279 | shallow_certainty.replace(c), |
| 278 | 280 | None | Some(Certainty::Maybe(MaybeCause::Ambiguity)) |
| 279 | )); | |
| 281 | ); | |
| 280 | 282 | } |
| 281 | 283 | inspect::ProbeStep::NestedProbe(ref probe) => { |
| 282 | 284 | match probe.kind { |
compiler/rustc_trait_selection/src/solve/normalize.rs+2-1| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | use std::assert_matches::assert_matches; | |
| 1 | 2 | use std::fmt::Debug; |
| 2 | 3 | use std::marker::PhantomData; |
| 3 | 4 | |
| ... | ... | @@ -63,7 +64,7 @@ where |
| 63 | 64 | E: FromSolverError<'tcx, NextSolverError<'tcx>>, |
| 64 | 65 | { |
| 65 | 66 | fn normalize_alias_ty(&mut self, alias_ty: Ty<'tcx>) -> Result<Ty<'tcx>, Vec<E>> { |
| 66 | assert!(matches!(alias_ty.kind(), ty::Alias(..))); | |
| 67 | assert_matches!(alias_ty.kind(), ty::Alias(..)); | |
| 67 | 68 | |
| 68 | 69 | let infcx = self.at.infcx; |
| 69 | 70 | let tcx = infcx.tcx; |
compiler/rustc_trait_selection/src/traits/misc.rs+3-1| ... | ... | @@ -1,5 +1,7 @@ |
| 1 | 1 | //! Miscellaneous type-system utilities that are too small to deserve their own modules. |
| 2 | 2 | |
| 3 | use std::assert_matches::assert_matches; | |
| 4 | ||
| 3 | 5 | use hir::LangItem; |
| 4 | 6 | use rustc_ast::Mutability; |
| 5 | 7 | use rustc_data_structures::fx::FxIndexSet; |
| ... | ... | @@ -92,7 +94,7 @@ pub fn type_allowed_to_implement_const_param_ty<'tcx>( |
| 92 | 94 | lang_item: LangItem, |
| 93 | 95 | parent_cause: ObligationCause<'tcx>, |
| 94 | 96 | ) -> Result<(), ConstParamTyImplementationError<'tcx>> { |
| 95 | assert!(matches!(lang_item, LangItem::ConstParamTy | LangItem::UnsizedConstParamTy)); | |
| 97 | assert_matches!(lang_item, LangItem::ConstParamTy | LangItem::UnsizedConstParamTy); | |
| 96 | 98 | |
| 97 | 99 | let inner_tys: Vec<_> = match *self_type.kind() { |
| 98 | 100 | // Trivially okay as these types are all: |
compiler/rustc_ty_utils/src/layout_sanity_check.rs+1-1| ... | ... | @@ -249,7 +249,7 @@ pub(super) fn sanity_check_layout<'tcx>( |
| 249 | 249 | if let Variants::Multiple { variants, .. } = &layout.variants { |
| 250 | 250 | for variant in variants.iter() { |
| 251 | 251 | // No nested "multiple". |
| 252 | assert!(matches!(variant.variants, Variants::Single { .. })); | |
| 252 | assert_matches!(variant.variants, Variants::Single { .. }); | |
| 253 | 253 | // Variants should have the same or a smaller size as the full thing, |
| 254 | 254 | // and same for alignment. |
| 255 | 255 | if variant.size > layout.size { |
library/core/src/intrinsics.rs+5-5| ... | ... | @@ -2675,12 +2675,12 @@ extern "rust-intrinsic" { |
| 2675 | 2675 | #[rustc_nounwind] |
| 2676 | 2676 | pub fn catch_unwind(try_fn: fn(*mut u8), data: *mut u8, catch_fn: fn(*mut u8, *mut u8)) -> i32; |
| 2677 | 2677 | |
| 2678 | /// Emits a `!nontemporal` store according to LLVM (see their docs). | |
| 2679 | /// Probably will never become stable. | |
| 2678 | /// Emits a `nontemporal` store, which gives a hint to the CPU that the data should not be held | |
| 2679 | /// in cache. Except for performance, this is fully equivalent to `ptr.write(val)`. | |
| 2680 | 2680 | /// |
| 2681 | /// Do NOT use this intrinsic; "nontemporal" operations do not exist in our memory model! | |
| 2682 | /// It exists to support current stdarch, but the plan is to change stdarch and remove this intrinsic. | |
| 2683 | /// See <https://github.com/rust-lang/rust/issues/114582> for some more discussion. | |
| 2681 | /// Not all architectures provide such an operation. For instance, x86 does not: while `MOVNT` | |
| 2682 | /// exists, that operation is *not* equivalent to `ptr.write(val)` (`MOVNT` writes can be reordered | |
| 2683 | /// in ways that are not allowed for regular writes). | |
| 2684 | 2684 | #[rustc_nounwind] |
| 2685 | 2685 | pub fn nontemporal_store<T>(ptr: *mut T, val: T); |
| 2686 | 2686 |
library/std/src/panic.rs+15-11| ... | ... | @@ -440,13 +440,12 @@ impl BacktraceStyle { |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | fn from_u8(s: u8) -> Option<Self> { |
| 443 | Some(match s { | |
| 444 | 0 => return None, | |
| 445 | 1 => BacktraceStyle::Short, | |
| 446 | 2 => BacktraceStyle::Full, | |
| 447 | 3 => BacktraceStyle::Off, | |
| 448 | _ => unreachable!(), | |
| 449 | }) | |
| 443 | match s { | |
| 444 | 1 => Some(BacktraceStyle::Short), | |
| 445 | 2 => Some(BacktraceStyle::Full), | |
| 446 | 3 => Some(BacktraceStyle::Off), | |
| 447 | _ => None, | |
| 448 | } | |
| 450 | 449 | } |
| 451 | 450 | } |
| 452 | 451 | |
| ... | ... | @@ -465,7 +464,7 @@ static SHOULD_CAPTURE: AtomicU8 = AtomicU8::new(0); |
| 465 | 464 | pub fn set_backtrace_style(style: BacktraceStyle) { |
| 466 | 465 | if cfg!(feature = "backtrace") { |
| 467 | 466 | // If the `backtrace` feature of this crate is enabled, set the backtrace style. |
| 468 | SHOULD_CAPTURE.store(style.as_u8(), Ordering::Release); | |
| 467 | SHOULD_CAPTURE.store(style.as_u8(), Ordering::Relaxed); | |
| 469 | 468 | } |
| 470 | 469 | } |
| 471 | 470 | |
| ... | ... | @@ -498,7 +497,9 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> { |
| 498 | 497 | // to optimize away callers. |
| 499 | 498 | return None; |
| 500 | 499 | } |
| 501 | if let Some(style) = BacktraceStyle::from_u8(SHOULD_CAPTURE.load(Ordering::Acquire)) { | |
| 500 | ||
| 501 | let current = SHOULD_CAPTURE.load(Ordering::Relaxed); | |
| 502 | if let Some(style) = BacktraceStyle::from_u8(current) { | |
| 502 | 503 | return Some(style); |
| 503 | 504 | } |
| 504 | 505 | |
| ... | ... | @@ -509,8 +510,11 @@ pub fn get_backtrace_style() -> Option<BacktraceStyle> { |
| 509 | 510 | None if crate::sys::FULL_BACKTRACE_DEFAULT => BacktraceStyle::Full, |
| 510 | 511 | None => BacktraceStyle::Off, |
| 511 | 512 | }; |
| 512 | set_backtrace_style(format); | |
| 513 | Some(format) | |
| 513 | ||
| 514 | match SHOULD_CAPTURE.compare_exchange(0, format.as_u8(), Ordering::Relaxed, Ordering::Relaxed) { | |
| 515 | Ok(_) => Some(format), | |
| 516 | Err(new) => BacktraceStyle::from_u8(new), | |
| 517 | } | |
| 514 | 518 | } |
| 515 | 519 | |
| 516 | 520 | #[cfg(test)] |
src/bootstrap/src/bin/main.rs+8-2| ... | ... | @@ -11,13 +11,19 @@ use std::str::FromStr; |
| 11 | 11 | use std::{env, process}; |
| 12 | 12 | |
| 13 | 13 | use bootstrap::{ |
| 14 | find_recent_config_change_ids, human_readable_changes, t, Build, Config, Subcommand, | |
| 14 | find_recent_config_change_ids, human_readable_changes, t, Build, Config, Flags, Subcommand, | |
| 15 | 15 | CONFIG_CHANGE_HISTORY, |
| 16 | 16 | }; |
| 17 | 17 | |
| 18 | 18 | fn main() { |
| 19 | 19 | let args = env::args().skip(1).collect::<Vec<_>>(); |
| 20 | let config = Config::parse(&args); | |
| 20 | ||
| 21 | if Flags::try_parse_verbose_help(&args) { | |
| 22 | return; | |
| 23 | } | |
| 24 | ||
| 25 | let flags = Flags::parse(&args); | |
| 26 | let config = Config::parse(flags); | |
| 21 | 27 | |
| 22 | 28 | let mut build_lock; |
| 23 | 29 | let _build_lock_guard; |
src/bootstrap/src/core/builder/tests.rs+3-2| ... | ... | @@ -3,13 +3,14 @@ use std::thread; |
| 3 | 3 | use super::*; |
| 4 | 4 | use crate::core::build_steps::doc::DocumentationFormat; |
| 5 | 5 | use crate::core::config::Config; |
| 6 | use crate::Flags; | |
| 6 | 7 | |
| 7 | 8 | fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config { |
| 8 | 9 | configure_with_args(&[cmd.to_owned()], host, target) |
| 9 | 10 | } |
| 10 | 11 | |
| 11 | 12 | fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config { |
| 12 | let mut config = Config::parse(cmd); | |
| 13 | let mut config = Config::parse(Flags::parse(cmd)); | |
| 13 | 14 | // don't save toolstates |
| 14 | 15 | config.save_toolstates = None; |
| 15 | 16 | config.dry_run = DryRun::SelfCheck; |
| ... | ... | @@ -23,7 +24,7 @@ fn configure_with_args(cmd: &[String], host: &[&str], target: &[&str]) -> Config |
| 23 | 24 | let submodule_build = Build::new(Config { |
| 24 | 25 | // don't include LLVM, so CI doesn't require ninja/cmake to be installed |
| 25 | 26 | rust_codegen_backends: vec![], |
| 26 | ..Config::parse(&["check".to_owned()]) | |
| 27 | ..Config::parse(Flags::parse(&["check".to_owned()])) | |
| 27 | 28 | }); |
| 28 | 29 | submodule_build.require_submodule("src/doc/book", None); |
| 29 | 30 | config.submodules = Some(false); |
src/bootstrap/src/core/config/config.rs+3-4| ... | ... | @@ -1191,7 +1191,7 @@ impl Config { |
| 1191 | 1191 | } |
| 1192 | 1192 | } |
| 1193 | 1193 | |
| 1194 | pub fn parse(args: &[String]) -> Config { | |
| 1194 | pub fn parse(flags: Flags) -> Config { | |
| 1195 | 1195 | #[cfg(test)] |
| 1196 | 1196 | fn get_toml(_: &Path) -> TomlConfig { |
| 1197 | 1197 | TomlConfig::default() |
| ... | ... | @@ -1221,11 +1221,10 @@ impl Config { |
| 1221 | 1221 | exit!(2); |
| 1222 | 1222 | }) |
| 1223 | 1223 | } |
| 1224 | Self::parse_inner(args, get_toml) | |
| 1224 | Self::parse_inner(flags, get_toml) | |
| 1225 | 1225 | } |
| 1226 | 1226 | |
| 1227 | pub(crate) fn parse_inner(args: &[String], get_toml: impl Fn(&Path) -> TomlConfig) -> Config { | |
| 1228 | let mut flags = Flags::parse(args); | |
| 1227 | pub(crate) fn parse_inner(mut flags: Flags, get_toml: impl Fn(&Path) -> TomlConfig) -> Config { | |
| 1229 | 1228 | let mut config = Config::default_opts(); |
| 1230 | 1229 | |
| 1231 | 1230 | // Set flags. |
src/bootstrap/src/core/config/flags.rs+17-7| ... | ... | @@ -183,9 +183,9 @@ pub struct Flags { |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | impl Flags { |
| 186 | pub fn parse(args: &[String]) -> Self { | |
| 187 | let first = String::from("x.py"); | |
| 188 | let it = std::iter::once(&first).chain(args.iter()); | |
| 186 | /// Check if `<cmd> -h -v` was passed. | |
| 187 | /// If yes, print the available paths and return `true`. | |
| 188 | pub fn try_parse_verbose_help(args: &[String]) -> bool { | |
| 189 | 189 | // We need to check for `<cmd> -h -v`, in which case we list the paths |
| 190 | 190 | #[derive(Parser)] |
| 191 | 191 | #[command(disable_help_flag(true))] |
| ... | ... | @@ -198,10 +198,10 @@ impl Flags { |
| 198 | 198 | cmd: Kind, |
| 199 | 199 | } |
| 200 | 200 | if let Ok(HelpVerboseOnly { help: true, verbose: 1.., cmd: subcommand }) = |
| 201 | HelpVerboseOnly::try_parse_from(it.clone()) | |
| 201 | HelpVerboseOnly::try_parse_from(normalize_args(args)) | |
| 202 | 202 | { |
| 203 | 203 | println!("NOTE: updating submodules before printing available paths"); |
| 204 | let config = Config::parse(&[String::from("build")]); | |
| 204 | let config = Config::parse(Self::parse(&[String::from("build")])); | |
| 205 | 205 | let build = Build::new(config); |
| 206 | 206 | let paths = Builder::get_help(&build, subcommand); |
| 207 | 207 | if let Some(s) = paths { |
| ... | ... | @@ -209,13 +209,23 @@ impl Flags { |
| 209 | 209 | } else { |
| 210 | 210 | panic!("No paths available for subcommand `{}`", subcommand.as_str()); |
| 211 | 211 | } |
| 212 | crate::exit!(0); | |
| 212 | true | |
| 213 | } else { | |
| 214 | false | |
| 213 | 215 | } |
| 216 | } | |
| 214 | 217 | |
| 215 | Flags::parse_from(it) | |
| 218 | pub fn parse(args: &[String]) -> Self { | |
| 219 | Flags::parse_from(normalize_args(args)) | |
| 216 | 220 | } |
| 217 | 221 | } |
| 218 | 222 | |
| 223 | fn normalize_args(args: &[String]) -> Vec<String> { | |
| 224 | let first = String::from("x.py"); | |
| 225 | let it = std::iter::once(first).chain(args.iter().cloned()); | |
| 226 | it.collect() | |
| 227 | } | |
| 228 | ||
| 219 | 229 | #[derive(Debug, Clone, Default, clap::Subcommand)] |
| 220 | 230 | pub enum Subcommand { |
| 221 | 231 | #[command(aliases = ["b"], long_about = "\n |
src/bootstrap/src/core/config/mod.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | #[allow(clippy::module_inception)] |
| 2 | 2 | mod config; |
| 3 | pub(crate) mod flags; | |
| 3 | pub mod flags; | |
| 4 | 4 | #[cfg(test)] |
| 5 | 5 | mod tests; |
| 6 | 6 |
src/bootstrap/src/core/config/tests.rs+10-9| ... | ... | @@ -12,9 +12,10 @@ use crate::core::build_steps::clippy::get_clippy_rules_in_order; |
| 12 | 12 | use crate::core::config::{LldMode, Target, TargetSelection, TomlConfig}; |
| 13 | 13 | |
| 14 | 14 | fn parse(config: &str) -> Config { |
| 15 | Config::parse_inner(&["check".to_string(), "--config=/does/not/exist".to_string()], |&_| { | |
| 16 | toml::from_str(&config).unwrap() | |
| 17 | }) | |
| 15 | Config::parse_inner( | |
| 16 | Flags::parse(&["check".to_string(), "--config=/does/not/exist".to_string()]), | |
| 17 | |&_| toml::from_str(&config).unwrap(), | |
| 18 | ) | |
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | #[test] |
| ... | ... | @@ -108,7 +109,7 @@ fn clap_verify() { |
| 108 | 109 | #[test] |
| 109 | 110 | fn override_toml() { |
| 110 | 111 | let config = Config::parse_inner( |
| 111 | &[ | |
| 112 | Flags::parse(&[ | |
| 112 | 113 | "check".to_owned(), |
| 113 | 114 | "--config=/does/not/exist".to_owned(), |
| 114 | 115 | "--set=change-id=1".to_owned(), |
| ... | ... | @@ -121,7 +122,7 @@ fn override_toml() { |
| 121 | 122 | "--set=target.x86_64-unknown-linux-gnu.rpath=false".to_owned(), |
| 122 | 123 | "--set=target.aarch64-unknown-linux-gnu.sanitizers=false".to_owned(), |
| 123 | 124 | "--set=target.aarch64-apple-darwin.runner=apple".to_owned(), |
| 124 | ], | |
| 125 | ]), | |
| 125 | 126 | |&_| { |
| 126 | 127 | toml::from_str( |
| 127 | 128 | r#" |
| ... | ... | @@ -201,12 +202,12 @@ runner = "x86_64-runner" |
| 201 | 202 | #[should_panic] |
| 202 | 203 | fn override_toml_duplicate() { |
| 203 | 204 | Config::parse_inner( |
| 204 | &[ | |
| 205 | Flags::parse(&[ | |
| 205 | 206 | "check".to_owned(), |
| 206 | 207 | "--config=/does/not/exist".to_string(), |
| 207 | 208 | "--set=change-id=1".to_owned(), |
| 208 | 209 | "--set=change-id=2".to_owned(), |
| 209 | ], | |
| 210 | ]), | |
| 210 | 211 | |&_| toml::from_str("change-id = 0").unwrap(), |
| 211 | 212 | ); |
| 212 | 213 | } |
| ... | ... | @@ -226,7 +227,7 @@ fn profile_user_dist() { |
| 226 | 227 | .and_then(|table: toml::Value| TomlConfig::deserialize(table)) |
| 227 | 228 | .unwrap() |
| 228 | 229 | } |
| 229 | Config::parse_inner(&["check".to_owned()], get_toml); | |
| 230 | Config::parse_inner(Flags::parse(&["check".to_owned()]), get_toml); | |
| 230 | 231 | } |
| 231 | 232 | |
| 232 | 233 | #[test] |
| ... | ... | @@ -301,7 +302,7 @@ fn order_of_clippy_rules() { |
| 301 | 302 | "-Aclippy::foo1".to_string(), |
| 302 | 303 | "-Aclippy::foo2".to_string(), |
| 303 | 304 | ]; |
| 304 | let config = Config::parse(&args); | |
| 305 | let config = Config::parse(Flags::parse(&args)); | |
| 305 | 306 | |
| 306 | 307 | let actual = match &config.cmd { |
| 307 | 308 | crate::Subcommand::Clippy { allow, deny, warn, forbid, .. } => { |
src/bootstrap/src/lib.rs+1-1| ... | ... | @@ -43,7 +43,7 @@ mod core; |
| 43 | 43 | mod utils; |
| 44 | 44 | |
| 45 | 45 | pub use core::builder::PathSet; |
| 46 | pub use core::config::flags::Subcommand; | |
| 46 | pub use core::config::flags::{Flags, Subcommand}; | |
| 47 | 47 | pub use core::config::Config; |
| 48 | 48 | |
| 49 | 49 | pub use utils::change_tracker::{ |
src/bootstrap/src/utils/helpers/tests.rs+5-3| ... | ... | @@ -5,7 +5,7 @@ use std::path::PathBuf; |
| 5 | 5 | use crate::utils::helpers::{ |
| 6 | 6 | check_cfg_arg, extract_beta_rev, hex_encode, make, program_out_of_date, symlink_dir, |
| 7 | 7 | }; |
| 8 | use crate::Config; | |
| 8 | use crate::{Config, Flags}; | |
| 9 | 9 | |
| 10 | 10 | #[test] |
| 11 | 11 | fn test_make() { |
| ... | ... | @@ -58,7 +58,8 @@ fn test_check_cfg_arg() { |
| 58 | 58 | |
| 59 | 59 | #[test] |
| 60 | 60 | fn test_program_out_of_date() { |
| 61 | let config = Config::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]); | |
| 61 | let config = | |
| 62 | Config::parse(Flags::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()])); | |
| 62 | 63 | let tempfile = config.tempdir().join(".tmp-stamp-file"); |
| 63 | 64 | File::create(&tempfile).unwrap().write_all(b"dummy value").unwrap(); |
| 64 | 65 | assert!(tempfile.exists()); |
| ... | ... | @@ -73,7 +74,8 @@ fn test_program_out_of_date() { |
| 73 | 74 | |
| 74 | 75 | #[test] |
| 75 | 76 | fn test_symlink_dir() { |
| 76 | let config = Config::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()]); | |
| 77 | let config = | |
| 78 | Config::parse(Flags::parse(&["check".to_owned(), "--config=/does/not/exist".to_owned()])); | |
| 77 | 79 | let tempdir = config.tempdir().join(".tmp-dir"); |
| 78 | 80 | let link_path = config.tempdir().join(".tmp-link"); |
| 79 | 81 |
src/librustdoc/html/markdown.rs+2-1| ... | ... | @@ -304,7 +304,8 @@ impl<'a, I: Iterator<Item = Event<'a>>> Iterator for CodeBlocks<'_, 'a, I> { |
| 304 | 304 | Some(format!( |
| 305 | 305 | "<a class=\"test-arrow\" \ |
| 306 | 306 | target=\"_blank\" \ |
| 307 | href=\"{url}?code={test_escaped}{channel}&amp;edition={edition}\">Run</a>", | |
| 307 | title=\"Run code\" \ | |
| 308 | href=\"{url}?code={test_escaped}{channel}&amp;edition={edition}\"></a>", | |
| 308 | 309 | )) |
| 309 | 310 | }); |
| 310 | 311 |
src/librustdoc/html/static/css/noscript.css-8| ... | ... | @@ -104,10 +104,6 @@ nav.sub { |
| 104 | 104 | 	--code-highlight-doc-comment-color: #4d4d4c; |
| 105 | 105 | 	--src-line-numbers-span-color: #c67e2d; |
| 106 | 106 | 	--src-line-number-highlighted-background-color: #fdffd3; |
| 107 | 	--test-arrow-color: #f5f5f5; | |
| 108 | 	--test-arrow-background-color: rgba(78, 139, 202, 0.2); | |
| 109 | 	--test-arrow-hover-color: #f5f5f5; | |
| 110 | 	--test-arrow-hover-background-color: rgb(78, 139, 202); | |
| 111 | 107 | 	--target-background-color: #fdffd3; |
| 112 | 108 | 	--target-border-color: #ad7c37; |
| 113 | 109 | 	--kbd-color: #000; |
| ... | ... | @@ -210,10 +206,6 @@ nav.sub { |
| 210 | 206 | 		--code-highlight-doc-comment-color: #8ca375; |
| 211 | 207 | 		--src-line-numbers-span-color: #3b91e2; |
| 212 | 208 | 		--src-line-number-highlighted-background-color: #0a042f; |
| 213 | 		--test-arrow-color: #dedede; | |
| 214 | 		--test-arrow-background-color: rgba(78, 139, 202, 0.2); | |
| 215 | 		--test-arrow-hover-color: #dedede; | |
| 216 | 		--test-arrow-hover-background-color: #4e8bca; | |
| 217 | 209 | 		--target-background-color: #494a3d; |
| 218 | 210 | 		--target-border-color: #bb7410; |
| 219 | 211 | 		--kbd-color: #000; |
src/librustdoc/html/static/css/rustdoc.css+21-33| ... | ... | @@ -353,7 +353,7 @@ details:not(.toggle) summary { |
| 353 | 353 | 	margin-bottom: .6em; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | code, pre, a.test-arrow, .code-header { | |
| 356 | code, pre, .code-header { | |
| 357 | 357 | 	font-family: "Source Code Pro", monospace; |
| 358 | 358 | } |
| 359 | 359 | .docblock code, .docblock-short code { |
| ... | ... | @@ -946,8 +946,8 @@ because of the `[-]` element which would overlap with it. */ |
| 946 | 946 | .main-heading a:hover, |
| 947 | 947 | .example-wrap .rust a:hover, |
| 948 | 948 | .all-items a:hover, |
| 949 | .docblock a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover:not(.doc-anchor), | |
| 950 | .docblock-short a:not(.test-arrow):not(.scrape-help):not(.tooltip):hover, | |
| 949 | .docblock a:not(.scrape-help):not(.tooltip):hover:not(.doc-anchor), | |
| 950 | .docblock-short a:not(.scrape-help):not(.tooltip):hover, | |
| 951 | 951 | .item-info a { |
| 952 | 952 | 	text-decoration: underline; |
| 953 | 953 | } |
| ... | ... | @@ -1461,22 +1461,17 @@ documentation. */ |
| 1461 | 1461 | 	z-index: 1; |
| 1462 | 1462 | } |
| 1463 | 1463 | a.test-arrow { |
| 1464 | 	padding: 5px 7px; | |
| 1465 | 	border-radius: var(--button-border-radius); | |
| 1466 | 	font-size: 1rem; | |
| 1467 | 	color: var(--test-arrow-color); | |
| 1468 | 	background-color: var(--test-arrow-background-color); | |
| 1464 | 	height: var(--copy-path-height); | |
| 1465 | 	padding: 6px 4px 0 11px; | |
| 1469 | 1466 | } |
| 1470 | a.test-arrow:hover { | |
| 1471 | 	color: var(--test-arrow-hover-color); | |
| 1472 | 	background-color: var(--test-arrow-hover-background-color); | |
| 1467 | a.test-arrow::before { | |
| 1468 | 	content: url('data:image/svg+xml,<svg viewBox="0 0 20 20" width="18" height="20" \ | |
| 1469 | 		xmlns="http://www.w3.org/2000/svg"><path d="M0 0l18 10-18 10z"/></svg>'); | |
| 1473 | 1470 | } |
| 1474 | 1471 | .example-wrap .button-holder { |
| 1475 | 1472 | 	display: flex; |
| 1476 | 1473 | } |
| 1477 | .example-wrap:hover > .test-arrow { | |
| 1478 | 	padding: 2px 7px; | |
| 1479 | } | |
| 1474 | ||
| 1480 | 1475 | /* |
| 1481 | 1476 | On iPad, the ":hover" state sticks around, making things work not greatly. Do work around |
| 1482 | 1477 | it, we move it into this media query. More information can be found at: |
| ... | ... | @@ -1486,29 +1481,34 @@ However, using `@media (hover: hover)` makes this rule never to be applied in GU |
| 1486 | 1481 | instead, we check that it's not a "finger" cursor. |
| 1487 | 1482 | */ |
| 1488 | 1483 | @media not (pointer: coarse) { |
| 1489 | 	.example-wrap:hover > .test-arrow, .example-wrap:hover > .button-holder { | |
| 1484 | 	.example-wrap:hover > a.test-arrow, .example-wrap:hover > .button-holder { | |
| 1490 | 1485 | 		visibility: visible; |
| 1491 | 1486 | 	} |
| 1492 | 1487 | } |
| 1493 | 1488 | .example-wrap .button-holder.keep-visible { |
| 1494 | 1489 | 	visibility: visible; |
| 1495 | 1490 | } |
| 1496 | .example-wrap .button-holder .copy-button { | |
| 1497 | 	color: var(--copy-path-button-color); | |
| 1491 | .example-wrap .button-holder .copy-button, .example-wrap .test-arrow { | |
| 1498 | 1492 | 	background: var(--main-background-color); |
| 1493 | 	cursor: pointer; | |
| 1494 | 	border-radius: var(--button-border-radius); | |
| 1499 | 1495 | 	height: var(--copy-path-height); |
| 1500 | 1496 | 	width: var(--copy-path-width); |
| 1497 | } | |
| 1498 | .example-wrap .button-holder .copy-button { | |
| 1501 | 1499 | 	margin-left: var(--button-left-margin); |
| 1502 | 1500 | 	padding: 2px 0 0 4px; |
| 1503 | 1501 | 	border: 0; |
| 1504 | 	cursor: pointer; | |
| 1505 | 	border-radius: var(--button-border-radius); | |
| 1506 | 1502 | } |
| 1507 | .example-wrap .button-holder .copy-button::before { | |
| 1503 | .example-wrap .button-holder .copy-button::before, | |
| 1504 | .example-wrap .test-arrow::before { | |
| 1508 | 1505 | 	filter: var(--copy-path-img-filter); |
| 1506 | } | |
| 1507 | .example-wrap .button-holder .copy-button::before { | |
| 1509 | 1508 | 	content: var(--clipboard-image); |
| 1510 | 1509 | } |
| 1511 | .example-wrap .button-holder .copy-button:hover::before { | |
| 1510 | .example-wrap .button-holder .copy-button:hover::before, | |
| 1511 | .example-wrap .test-arrow:hover::before { | |
| 1512 | 1512 | 	filter: var(--copy-path-img-hover-filter); |
| 1513 | 1513 | } |
| 1514 | 1514 | .example-wrap .button-holder .copy-button.clicked::before { |
| ... | ... | @@ -2552,10 +2552,6 @@ by default. |
| 2552 | 2552 | 	--code-highlight-doc-comment-color: #4d4d4c; |
| 2553 | 2553 | 	--src-line-numbers-span-color: #c67e2d; |
| 2554 | 2554 | 	--src-line-number-highlighted-background-color: #fdffd3; |
| 2555 | 	--test-arrow-color: #f5f5f5; | |
| 2556 | 	--test-arrow-background-color: rgba(78, 139, 202, 0.2); | |
| 2557 | 	--test-arrow-hover-color: #f5f5f5; | |
| 2558 | 	--test-arrow-hover-background-color: rgb(78, 139, 202); | |
| 2559 | 2555 | 	--target-background-color: #fdffd3; |
| 2560 | 2556 | 	--target-border-color: #ad7c37; |
| 2561 | 2557 | 	--kbd-color: #000; |
| ... | ... | @@ -2658,10 +2654,6 @@ by default. |
| 2658 | 2654 | 	--code-highlight-doc-comment-color: #8ca375; |
| 2659 | 2655 | 	--src-line-numbers-span-color: #3b91e2; |
| 2660 | 2656 | 	--src-line-number-highlighted-background-color: #0a042f; |
| 2661 | 	--test-arrow-color: #dedede; | |
| 2662 | 	--test-arrow-background-color: rgba(78, 139, 202, 0.2); | |
| 2663 | 	--test-arrow-hover-color: #dedede; | |
| 2664 | 	--test-arrow-hover-background-color: #4e8bca; | |
| 2665 | 2657 | 	--target-background-color: #494a3d; |
| 2666 | 2658 | 	--target-border-color: #bb7410; |
| 2667 | 2659 | 	--kbd-color: #000; |
| ... | ... | @@ -2771,10 +2763,6 @@ Original by Dempfi (https://github.com/dempfi/ayu) |
| 2771 | 2763 | 	--code-highlight-doc-comment-color: #a1ac88; |
| 2772 | 2764 | 	--src-line-numbers-span-color: #5c6773; |
| 2773 | 2765 | 	--src-line-number-highlighted-background-color: rgba(255, 236, 164, 0.06); |
| 2774 | 	--test-arrow-color: #788797; | |
| 2775 | 	--test-arrow-background-color: rgba(57, 175, 215, 0.09); | |
| 2776 | 	--test-arrow-hover-color: #c5c5c5; | |
| 2777 | 	--test-arrow-hover-background-color: rgba(57, 175, 215, 0.368); | |
| 2778 | 2766 | 	--target-background-color: rgba(255, 236, 164, 0.06); |
| 2779 | 2767 | 	--target-border-color: rgba(255, 180, 76, 0.85); |
| 2780 | 2768 | 	--kbd-color: #c5c5c5; |
src/librustdoc/html/static/js/main.js+6-2| ... | ... | @@ -1835,10 +1835,14 @@ href="https://doc.rust-lang.org/${channel}/rustdoc/read-documentation/search.htm |
| 1835 | 1835 | function getExampleWrap(event) { |
| 1836 | 1836 | let elem = event.target; |
| 1837 | 1837 | while (!hasClass(elem, "example-wrap")) { |
| 1838 | elem = elem.parentElement; | |
| 1839 | if (elem === document.body || hasClass(elem, "docblock")) { | |
| 1838 | if (elem === document.body || | |
| 1839 | elem.tagName === "A" || | |
| 1840 | elem.tagName === "BUTTON" || | |
| 1841 | hasClass(elem, "docblock") | |
| 1842 | ) { | |
| 1840 | 1843 | return null; |
| 1841 | 1844 | } |
| 1845 | elem = elem.parentElement; | |
| 1842 | 1846 | } |
| 1843 | 1847 | return elem; |
| 1844 | 1848 | } |
src/tools/compiletest/src/runtest.rs+7-1| ... | ... | @@ -3027,11 +3027,17 @@ impl<'test> TestCx<'test> { |
| 3027 | 3027 | const PREFIX: &str = "MONO_ITEM "; |
| 3028 | 3028 | const CGU_MARKER: &str = "@@"; |
| 3029 | 3029 | |
| 3030 | // Some MonoItems can contain {closure@/path/to/checkout/tests/codgen-units/test.rs} | |
| 3031 | // To prevent the current dir from leaking, we just replace the entire path to the test | |
| 3032 | // file with TEST_PATH. | |
| 3030 | 3033 | let actual: Vec<MonoItem> = proc_res |
| 3031 | 3034 | .stdout |
| 3032 | 3035 | .lines() |
| 3033 | 3036 | .filter(|line| line.starts_with(PREFIX)) |
| 3034 | .map(|line| str_to_mono_item(line, true)) | |
| 3037 | .map(|line| { | |
| 3038 | line.replace(&self.testpaths.file.display().to_string(), "TEST_PATH").to_string() | |
| 3039 | }) | |
| 3040 | .map(|line| str_to_mono_item(&line, true)) | |
| 3035 | 3041 | .collect(); |
| 3036 | 3042 | |
| 3037 | 3043 | let expected: Vec<MonoItem> = errors::load_errors(&self.testpaths.file, None) |
tests/codegen-units/item-collection/auxiliary/cgu_extern_closures.rs+2| ... | ... | @@ -1,3 +1,5 @@ |
| 1 | //@ compile-flags: -Zinline-mir=no | |
| 2 | ||
| 1 | 3 | #![crate_type = "lib"] |
| 2 | 4 | |
| 3 | 5 | #[inline] |
tests/codegen-units/item-collection/cross-crate-closures.rs+8-13| ... | ... | @@ -1,9 +1,6 @@ |
| 1 | // In the current version of the collector that still has to support | |
| 2 | // legacy-codegen, closures do not generate their own MonoItems, so we are | |
| 3 | // ignoring this test until MIR codegen has taken over completely | |
| 4 | //@ ignore-test | |
| 5 | ||
| 6 | //@ compile-flags:-Zprint-mono-items=eager | |
| 1 | // We need to disable MIR inlining in both this and its aux-build crate. The MIR inliner | |
| 2 | // will just inline everything into our start function if we let it. As it should. | |
| 3 | //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no | |
| 7 | 4 | |
| 8 | 5 | #![deny(dead_code)] |
| 9 | 6 | #![feature(start)] |
| ... | ... | @@ -11,15 +8,15 @@ |
| 11 | 8 | //@ aux-build:cgu_extern_closures.rs |
| 12 | 9 | extern crate cgu_extern_closures; |
| 13 | 10 | |
| 14 | //~ MONO_ITEM fn cross_crate_closures::start[0] | |
| 11 | //~ MONO_ITEM fn start @@ cross_crate_closures-cgu.0[Internal] | |
| 15 | 12 | #[start] |
| 16 | 13 | fn start(_: isize, _: *const *const u8) -> isize { |
| 17 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0] | |
| 18 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn[0]::{{closure}}[0] | |
| 14 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn @@ cross_crate_closures-cgu.0[Internal] | |
| 15 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn::{closure#0} @@ cross_crate_closures-cgu.0[Internal] | |
| 19 | 16 | let _ = cgu_extern_closures::inlined_fn(1, 2); |
| 20 | 17 | |
| 21 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn_generic[0]<i32> | |
| 22 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn_generic[0]::{{closure}}[0]<i32> | |
| 18 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn_generic::<i32> @@ cross_crate_closures-cgu.0[Internal] | |
| 19 | //~ MONO_ITEM fn cgu_extern_closures::inlined_fn_generic::<i32>::{closure#0} @@ cross_crate_closures-cgu.0[Internal] | |
| 23 | 20 | let _ = cgu_extern_closures::inlined_fn_generic(3, 4, 5i32); |
| 24 | 21 | |
| 25 | 22 | // Nothing should be generated for this call, we just link to the instance |
| ... | ... | @@ -28,5 +25,3 @@ fn start(_: isize, _: *const *const u8) -> isize { |
| 28 | 25 | |
| 29 | 26 | 0 |
| 30 | 27 | } |
| 31 | ||
| 32 | //~ MONO_ITEM drop-glue i8 |
tests/codegen-units/item-collection/non-generic-closures.rs+13-17| ... | ... | @@ -1,49 +1,45 @@ |
| 1 | // In the current version of the collector that still has to support | |
| 2 | // legacy-codegen, closures do not generate their own MonoItems, so we are | |
| 3 | // ignoring this test until MIR codegen has taken over completely | |
| 4 | //@ ignore-test | |
| 5 | ||
| 6 | // | |
| 7 | //@ compile-flags:-Zprint-mono-items=eager | |
| 1 | //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no | |
| 8 | 2 | |
| 9 | 3 | #![deny(dead_code)] |
| 10 | 4 | #![feature(start)] |
| 11 | 5 | |
| 12 | //~ MONO_ITEM fn non_generic_closures::temporary[0] | |
| 6 | //~ MONO_ITEM fn temporary @@ non_generic_closures-cgu.0[Internal] | |
| 13 | 7 | fn temporary() { |
| 14 | //~ MONO_ITEM fn non_generic_closures::temporary[0]::{{closure}}[0] | |
| 8 | //~ MONO_ITEM fn temporary::{closure#0} @@ non_generic_closures-cgu.0[Internal] | |
| 15 | 9 | (|a: u32| { |
| 16 | 10 | let _ = a; |
| 17 | 11 | })(4); |
| 18 | 12 | } |
| 19 | 13 | |
| 20 | //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_but_not_executed[0] | |
| 14 | //~ MONO_ITEM fn assigned_to_variable_but_not_executed @@ non_generic_closures-cgu.0[Internal] | |
| 21 | 15 | fn assigned_to_variable_but_not_executed() { |
| 22 | //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_but_not_executed[0]::{{closure}}[0] | |
| 23 | 16 | let _x = |a: i16| { |
| 24 | 17 | let _ = a + 1; |
| 25 | 18 | }; |
| 26 | 19 | } |
| 27 | 20 | |
| 28 | //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_directly[0] | |
| 21 | //~ MONO_ITEM fn assigned_to_variable_executed_indirectly @@ non_generic_closures-cgu.0[Internal] | |
| 29 | 22 | fn assigned_to_variable_executed_indirectly() { |
| 30 | //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_directly[0]::{{closure}}[0] | |
| 23 | //~ MONO_ITEM fn assigned_to_variable_executed_indirectly::{closure#0} @@ non_generic_closures-cgu.0[Internal] | |
| 24 | //~ MONO_ITEM fn <{closure@TEST_PATH:27:13: 27:21} as std::ops::FnOnce<(i32,)>>::call_once - shim @@ non_generic_closures-cgu.0[Internal] | |
| 25 | //~ MONO_ITEM fn <{closure@TEST_PATH:27:13: 27:21} as std::ops::FnOnce<(i32,)>>::call_once - shim(vtable) @@ non_generic_closures-cgu.0[Internal] | |
| 26 | //~ MONO_ITEM fn std::ptr::drop_in_place::<{closure@TEST_PATH:27:13: 27:21}> - shim(None) @@ non_generic_closures-cgu.0[Internal] | |
| 31 | 27 | let f = |a: i32| { |
| 32 | 28 | let _ = a + 2; |
| 33 | 29 | }; |
| 34 | 30 | run_closure(&f); |
| 35 | 31 | } |
| 36 | 32 | |
| 37 | //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_indirectly[0] | |
| 33 | //~ MONO_ITEM fn assigned_to_variable_executed_directly @@ non_generic_closures-cgu.0[Internal] | |
| 38 | 34 | fn assigned_to_variable_executed_directly() { |
| 39 | //~ MONO_ITEM fn non_generic_closures::assigned_to_variable_executed_indirectly[0]::{{closure}}[0] | |
| 35 | //~ MONO_ITEM fn assigned_to_variable_executed_directly::{closure#0} @@ non_generic_closures-cgu.0[Internal] | |
| 40 | 36 | let f = |a: i64| { |
| 41 | 37 | let _ = a + 3; |
| 42 | 38 | }; |
| 43 | 39 | f(4); |
| 44 | 40 | } |
| 45 | 41 | |
| 46 | //~ MONO_ITEM fn non_generic_closures::start[0] | |
| 42 | //~ MONO_ITEM fn start @@ non_generic_closures-cgu.0[Internal] | |
| 47 | 43 | #[start] |
| 48 | 44 | fn start(_: isize, _: *const *const u8) -> isize { |
| 49 | 45 | temporary(); |
| ... | ... | @@ -54,7 +50,7 @@ fn start(_: isize, _: *const *const u8) -> isize { |
| 54 | 50 | 0 |
| 55 | 51 | } |
| 56 | 52 | |
| 57 | //~ MONO_ITEM fn non_generic_closures::run_closure[0] | |
| 53 | //~ MONO_ITEM fn run_closure @@ non_generic_closures-cgu.0[Internal] | |
| 58 | 54 | fn run_closure(f: &Fn(i32)) { |
| 59 | 55 | f(3); |
| 60 | 56 | } |
tests/codegen-units/partitioning/methods-are-with-self-type.rs+15-27| ... | ... | @@ -1,30 +1,23 @@ |
| 1 | // Currently, all generic functions are instantiated in each codegen unit that | |
| 2 | // uses them, even those not marked with #[inline], so this test does not make | |
| 3 | // much sense at the moment. | |
| 4 | //@ ignore-test | |
| 5 | ||
| 6 | 1 | // We specify incremental here because we want to test the partitioning for incremental compilation |
| 7 | 2 | //@ incremental |
| 8 | 3 | //@ compile-flags:-Zprint-mono-items=lazy |
| 9 | 4 | |
| 10 | #![allow(dead_code)] | |
| 11 | #![feature(start)] | |
| 5 | #![crate_type = "lib"] | |
| 12 | 6 | |
| 13 | struct SomeType; | |
| 7 | pub struct SomeType; | |
| 14 | 8 | |
| 15 | 9 | struct SomeGenericType<T1, T2>(T1, T2); |
| 16 | 10 | |
| 17 | mod mod1 { | |
| 11 | pub mod mod1 { | |
| 18 | 12 | use super::{SomeGenericType, SomeType}; |
| 19 | 13 | |
| 20 | 14 | // Even though the impl is in `mod1`, the methods should end up in the |
| 21 | 15 | // parent module, since that is where their self-type is. |
| 22 | 16 | impl SomeType { |
| 23 | //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::method[0] @@ methods_are_with_self_type[External] | |
| 24 | fn method(&self) {} | |
| 25 | ||
| 26 | //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[0]::associated_fn[0] @@ methods_are_with_self_type[External] | |
| 27 | fn associated_fn() {} | |
| 17 | //~ MONO_ITEM fn mod1::<impl SomeType>::method @@ methods_are_with_self_type[External] | |
| 18 | pub fn method(&self) {} | |
| 19 | //~ MONO_ITEM fn mod1::<impl SomeType>::associated_fn @@ methods_are_with_self_type[External] | |
| 20 | pub fn associated_fn() {} | |
| 28 | 21 | } |
| 29 | 22 | |
| 30 | 23 | impl<T1, T2> SomeGenericType<T1, T2> { |
| ... | ... | @@ -52,25 +45,20 @@ mod type2 { |
| 52 | 45 | pub struct Struct; |
| 53 | 46 | } |
| 54 | 47 | |
| 55 | //~ MONO_ITEM fn methods_are_with_self_type::start[0] | |
| 56 | #[start] | |
| 57 | fn start(_: isize, _: *const *const u8) -> isize { | |
| 58 | //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::method[0]<u32, u64> @@ methods_are_with_self_type.volatile[WeakODR] | |
| 48 | //~ MONO_ITEM fn start @@ methods_are_with_self_type[External] | |
| 49 | pub fn start() { | |
| 50 | //~ MONO_ITEM fn mod1::<impl SomeGenericType<u32, u64>>::method @@ methods_are_with_self_type.volatile[External] | |
| 59 | 51 | SomeGenericType(0u32, 0u64).method(); |
| 60 | //~ MONO_ITEM fn methods_are_with_self_type::mod1[0]::{{impl}}[1]::associated_fn[0]<char, &str> @@ methods_are_with_self_type.volatile[WeakODR] | |
| 52 | //~ MONO_ITEM fn mod1::<impl SomeGenericType<char, &str>>::associated_fn @@ methods_are_with_self_type.volatile[External] | |
| 61 | 53 | SomeGenericType::associated_fn('c', "&str"); |
| 62 | 54 | |
| 63 | //~ MONO_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0]<methods_are_with_self_type::type1[0]::Struct[0]> @@ methods_are_with_self_type-type1.volatile[WeakODR] | |
| 55 | //~ MONO_ITEM fn <type1::Struct as Trait>::foo @@ methods_are_with_self_type-type1.volatile[External] | |
| 64 | 56 | type1::Struct.foo(); |
| 65 | //~ MONO_ITEM fn methods_are_with_self_type::{{impl}}[0]::foo[0]<methods_are_with_self_type::type2[0]::Struct[0]> @@ methods_are_with_self_type-type2.volatile[WeakODR] | |
| 57 | //~ MONO_ITEM fn <type2::Struct as Trait>::foo @@ methods_are_with_self_type-type2.volatile[External] | |
| 66 | 58 | type2::Struct.foo(); |
| 67 | 59 | |
| 68 | //~ MONO_ITEM fn methods_are_with_self_type::Trait[0]::default[0]<methods_are_with_self_type::type1[0]::Struct[0]> @@ methods_are_with_self_type-type1.volatile[WeakODR] | |
| 60 | //~ MONO_ITEM fn <type1::Struct as Trait>::default @@ methods_are_with_self_type-type1.volatile[External] | |
| 69 | 61 | type1::Struct.default(); |
| 70 | //~ MONO_ITEM fn methods_are_with_self_type::Trait[0]::default[0]<methods_are_with_self_type::type2[0]::Struct[0]> @@ methods_are_with_self_type-type2.volatile[WeakODR] | |
| 62 | //~ MONO_ITEM fn <type2::Struct as Trait>::default @@ methods_are_with_self_type-type2.volatile[External] | |
| 71 | 63 | type2::Struct.default(); |
| 72 | ||
| 73 | 0 | |
| 74 | 64 | } |
| 75 | ||
| 76 | //~ MONO_ITEM drop-glue i8 |
tests/codegen/const-vector.rs created+107| ... | ... | @@ -0,0 +1,107 @@ |
| 1 | //@ compile-flags: -C no-prepopulate-passes -Copt-level=0 | |
| 2 | ||
| 3 | // This test checks that constants of SIMD type are passed as immediate vectors. | |
| 4 | // We ensure that both vector representations (struct with fields and struct wrapping array) work. | |
| 5 | #![crate_type = "lib"] | |
| 6 | #![feature(abi_unadjusted)] | |
| 7 | #![feature(const_trait_impl)] | |
| 8 | #![feature(repr_simd)] | |
| 9 | #![feature(rustc_attrs)] | |
| 10 | #![feature(simd_ffi)] | |
| 11 | #![allow(non_camel_case_types)] | |
| 12 | ||
| 13 | // Setting up structs that can be used as const vectors | |
| 14 | #[repr(simd)] | |
| 15 | #[derive(Clone)] | |
| 16 | pub struct i8x2(i8, i8); | |
| 17 | ||
| 18 | #[repr(simd)] | |
| 19 | #[derive(Clone)] | |
| 20 | pub struct i8x2_arr([i8; 2]); | |
| 21 | ||
| 22 | #[repr(simd)] | |
| 23 | #[derive(Clone)] | |
| 24 | pub struct f32x2(f32, f32); | |
| 25 | ||
| 26 | #[repr(simd)] | |
| 27 | #[derive(Clone)] | |
| 28 | pub struct f32x2_arr([f32; 2]); | |
| 29 | ||
| 30 | #[repr(simd, packed)] | |
| 31 | #[derive(Copy, Clone)] | |
| 32 | pub struct Simd<T, const N: usize>([T; N]); | |
| 33 | ||
| 34 | // The following functions are required for the tests to ensure | |
| 35 | // that they are called with a const vector | |
| 36 | ||
| 37 | extern "unadjusted" { | |
| 38 | #[no_mangle] | |
| 39 | fn test_i8x2(a: i8x2); | |
| 40 | } | |
| 41 | ||
| 42 | extern "unadjusted" { | |
| 43 | #[no_mangle] | |
| 44 | fn test_i8x2_two_args(a: i8x2, b: i8x2); | |
| 45 | } | |
| 46 | ||
| 47 | extern "unadjusted" { | |
| 48 | #[no_mangle] | |
| 49 | fn test_i8x2_mixed_args(a: i8x2, c: i32, b: i8x2); | |
| 50 | } | |
| 51 | ||
| 52 | extern "unadjusted" { | |
| 53 | #[no_mangle] | |
| 54 | fn test_i8x2_arr(a: i8x2_arr); | |
| 55 | } | |
| 56 | ||
| 57 | extern "unadjusted" { | |
| 58 | #[no_mangle] | |
| 59 | fn test_f32x2(a: f32x2); | |
| 60 | } | |
| 61 | ||
| 62 | extern "unadjusted" { | |
| 63 | #[no_mangle] | |
| 64 | fn test_f32x2_arr(a: f32x2_arr); | |
| 65 | } | |
| 66 | ||
| 67 | extern "unadjusted" { | |
| 68 | #[no_mangle] | |
| 69 | fn test_simd(a: Simd<i32, 4>); | |
| 70 | } | |
| 71 | ||
| 72 | extern "unadjusted" { | |
| 73 | #[no_mangle] | |
| 74 | fn test_simd_unaligned(a: Simd<i32, 3>); | |
| 75 | } | |
| 76 | ||
| 77 | // Ensure the packed variant of the simd struct does not become a const vector | |
| 78 | // if the size is not a power of 2 | |
| 79 | // CHECK: %"Simd<i32, 3>" = type { [3 x i32] } | |
| 80 | ||
| 81 | pub fn do_call() { | |
| 82 | unsafe { | |
| 83 | // CHECK: call void @test_i8x2(<2 x i8> <i8 32, i8 64> | |
| 84 | test_i8x2(const { i8x2(32, 64) }); | |
| 85 | ||
| 86 | // CHECK: call void @test_i8x2_two_args(<2 x i8> <i8 32, i8 64>, <2 x i8> <i8 8, i8 16> | |
| 87 | test_i8x2_two_args(const { i8x2(32, 64) }, const { i8x2(8, 16) }); | |
| 88 | ||
| 89 | // CHECK: call void @test_i8x2_mixed_args(<2 x i8> <i8 32, i8 64>, i32 43, <2 x i8> <i8 8, i8 16> | |
| 90 | test_i8x2_mixed_args(const { i8x2(32, 64) }, 43, const { i8x2(8, 16) }); | |
| 91 | ||
| 92 | // CHECK: call void @test_i8x2_arr(<2 x i8> <i8 32, i8 64> | |
| 93 | test_i8x2_arr(const { i8x2_arr([32, 64]) }); | |
| 94 | ||
| 95 | // CHECK: call void @test_f32x2(<2 x float> <float 0x3FD47AE140000000, float 0x3FE47AE140000000> | |
| 96 | test_f32x2(const { f32x2(0.32, 0.64) }); | |
| 97 | ||
| 98 | // CHECK: void @test_f32x2_arr(<2 x float> <float 0x3FD47AE140000000, float 0x3FE47AE140000000> | |
| 99 | test_f32x2_arr(const { f32x2_arr([0.32, 0.64]) }); | |
| 100 | ||
| 101 | // CHECK: call void @test_simd(<4 x i32> <i32 2, i32 4, i32 6, i32 8> | |
| 102 | test_simd(const { Simd::<i32, 4>([2, 4, 6, 8]) }); | |
| 103 | ||
| 104 | // CHECK: call void @test_simd_unaligned(%"Simd<i32, 3>" %1 | |
| 105 | test_simd_unaligned(const { Simd::<i32, 3>([2, 4, 6]) }); | |
| 106 | } | |
| 107 | } |
tests/codegen/intrinsics/nontemporal.rs+27-3| ... | ... | @@ -1,13 +1,37 @@ |
| 1 | 1 | //@ compile-flags: -O |
| 2 | //@revisions: with_nontemporal without_nontemporal | |
| 3 | //@[with_nontemporal] compile-flags: --target aarch64-unknown-linux-gnu | |
| 4 | //@[with_nontemporal] needs-llvm-components: aarch64 | |
| 5 | //@[without_nontemporal] compile-flags: --target x86_64-unknown-linux-gnu | |
| 6 | //@[without_nontemporal] needs-llvm-components: x86 | |
| 2 | 7 | |
| 3 | #![feature(core_intrinsics)] | |
| 8 | // Ensure that we *do* emit the `!nontemporal` flag on architectures where it | |
| 9 | // is well-behaved, but do *not* emit it on architectures where it is ill-behaved. | |
| 10 | // For more context, see <https://github.com/rust-lang/rust/issues/114582> and | |
| 11 | // <https://github.com/llvm/llvm-project/issues/64521>. | |
| 12 | ||
| 13 | #![feature(no_core, lang_items, intrinsics)] | |
| 14 | #![no_core] | |
| 4 | 15 | #![crate_type = "lib"] |
| 5 | 16 | |
| 17 | #[lang = "sized"] | |
| 18 | pub trait Sized {} | |
| 19 | #[lang = "copy"] | |
| 20 | pub trait Copy {} | |
| 21 | ||
| 22 | impl Copy for u32 {} | |
| 23 | impl<T> Copy for *mut T {} | |
| 24 | ||
| 25 | extern "rust-intrinsic" { | |
| 26 | pub fn nontemporal_store<T>(ptr: *mut T, val: T); | |
| 27 | } | |
| 28 | ||
| 6 | 29 | #[no_mangle] |
| 7 | 30 | pub fn a(a: &mut u32, b: u32) { |
| 8 | 31 | // CHECK-LABEL: define{{.*}}void @a |
| 9 | // CHECK: store i32 %b, ptr %a, align 4, !nontemporal | |
| 32 | // with_nontemporal: store i32 %b, ptr %a, align 4, !nontemporal | |
| 33 | // without_nontemporal-NOT: nontemporal | |
| 10 | 34 | unsafe { |
| 11 | std::intrinsics::nontemporal_store(a, b); | |
| 35 | nontemporal_store(a, b); | |
| 12 | 36 | } |
| 13 | 37 | } |
tests/run-make/CURRENT_RUSTC_VERSION/rmake.rs-2| ... | ... | @@ -3,8 +3,6 @@ |
| 3 | 3 | // Check that the `CURRENT_RUSTC_VERSION` placeholder is correctly replaced by the current |
| 4 | 4 | // `rustc` version and the `since` property in feature stability gating is properly respected. |
| 5 | 5 | |
| 6 | use std::path::PathBuf; | |
| 7 | ||
| 8 | 6 | use run_make_support::{aux_build, rfs, rustc, source_root}; |
| 9 | 7 | |
| 10 | 8 | fn main() { |
tests/run-make/arguments-non-c-like-enum/rmake.rs-2| ... | ... | @@ -4,8 +4,6 @@ |
| 4 | 4 | use run_make_support::{cc, extra_c_flags, extra_cxx_flags, run, rustc, static_lib_name}; |
| 5 | 5 | |
| 6 | 6 | pub fn main() { |
| 7 | use std::path::Path; | |
| 8 | ||
| 9 | 7 | rustc().input("nonclike.rs").crate_type("staticlib").run(); |
| 10 | 8 | cc().input("test.c") |
| 11 | 9 | .input(static_lib_name("nonclike")) |
tests/run-make/c-link-to-rust-staticlib/rmake.rs-2| ... | ... | @@ -3,8 +3,6 @@ |
| 3 | 3 | |
| 4 | 4 | //@ ignore-cross-compile |
| 5 | 5 | |
| 6 | use std::fs; | |
| 7 | ||
| 8 | 6 | use run_make_support::rfs::remove_file; |
| 9 | 7 | use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name}; |
| 10 | 8 |
tests/run-make/comment-section/rmake.rs+1-3| ... | ... | @@ -7,9 +7,7 @@ |
| 7 | 7 | // FIXME(jieyouxu): check cross-compile setup |
| 8 | 8 | //@ ignore-cross-compile |
| 9 | 9 | |
| 10 | use std::path::PathBuf; | |
| 11 | ||
| 12 | use run_make_support::{cwd, env_var, llvm_readobj, rfs, run_in_tmpdir, rustc}; | |
| 10 | use run_make_support::{cwd, env_var, llvm_readobj, rfs, rustc}; | |
| 13 | 11 | |
| 14 | 12 | fn main() { |
| 15 | 13 | let target = env_var("TARGET"); |
tests/run-make/compressed-debuginfo/rmake.rs+1-1| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | // FIXME: This test isn't comprehensive and isn't covering all possible combinations. |
| 7 | 7 | |
| 8 | use run_make_support::{assert_contains, cmd, llvm_readobj, run_in_tmpdir, rustc}; | |
| 8 | use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc}; | |
| 9 | 9 | |
| 10 | 10 | fn check_compression(compression: &str, to_find: &str) { |
| 11 | 11 | run_in_tmpdir(|| { |
tests/run-make/const_fn_mir/rmake.rs+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | //@ needs-unwind |
| 4 | 4 | |
| 5 | use run_make_support::{cwd, diff, rustc}; | |
| 5 | use run_make_support::{diff, rustc}; | |
| 6 | 6 | |
| 7 | 7 | fn main() { |
| 8 | 8 | rustc().input("main.rs").emit("mir").output("dump-actual.mir").run(); |
tests/run-make/crate-loading/rmake.rs+2-3| ... | ... | @@ -2,14 +2,13 @@ |
| 2 | 2 | //@ ignore-wasm32 |
| 3 | 3 | //@ ignore-wasm64 |
| 4 | 4 | |
| 5 | use run_make_support::rfs::copy; | |
| 6 | use run_make_support::{assert_contains, rust_lib_name, rustc}; | |
| 5 | use run_make_support::{rust_lib_name, rustc}; | |
| 7 | 6 | |
| 8 | 7 | fn main() { |
| 9 | 8 | rustc().input("multiple-dep-versions-1.rs").run(); |
| 10 | 9 | rustc().input("multiple-dep-versions-2.rs").extra_filename("2").metadata("2").run(); |
| 11 | 10 | |
| 12 | let out = rustc() | |
| 11 | rustc() | |
| 13 | 12 | .input("multiple-dep-versions.rs") |
| 14 | 13 | .extern_("dependency", rust_lib_name("dependency")) |
| 15 | 14 | .extern_("dep_2_reexport", rust_lib_name("dependency2")) |
tests/run-make/dylib-soname/rmake.rs-1| ... | ... | @@ -4,7 +4,6 @@ |
| 4 | 4 | //@ only-linux |
| 5 | 5 | //@ ignore-cross-compile |
| 6 | 6 | |
| 7 | use run_make_support::regex::Regex; | |
| 8 | 7 | use run_make_support::{cmd, run_in_tmpdir, rustc}; |
| 9 | 8 | |
| 10 | 9 | fn main() { |
tests/run-make/extern-flag-disambiguates/rmake.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | //@ ignore-cross-compile |
| 2 | 2 | |
| 3 | use run_make_support::{cwd, run, rustc}; | |
| 3 | use run_make_support::{run, rustc}; | |
| 4 | 4 | |
| 5 | 5 | // Attempt to build this dependency tree: |
| 6 | 6 | // |
tests/run-make/ice-dep-cannot-find-dep/rmake.rs+1-1| ... | ... | @@ -16,7 +16,7 @@ |
| 16 | 16 | // If we used `rustc` the additional '-L rmake_out' option would allow rustc to |
| 17 | 17 | // actually find the crate. |
| 18 | 18 | |
| 19 | use run_make_support::{bare_rustc, rfs, rust_lib_name, rustc}; | |
| 19 | use run_make_support::{bare_rustc, rust_lib_name, rustc}; | |
| 20 | 20 | |
| 21 | 21 | fn main() { |
| 22 | 22 | rustc().crate_name("a").crate_type("rlib").input("a.rs").arg("--verbose").run(); |
tests/run-make/incr-test-moved-file/rmake.rs+1-1| ... | ... | @@ -14,7 +14,7 @@ |
| 14 | 14 | //@ ignore-nvptx64-nvidia-cuda |
| 15 | 15 | // FIXME: can't find crate for 'std' |
| 16 | 16 | |
| 17 | use run_make_support::{rfs, rust_lib_name, rustc}; | |
| 17 | use run_make_support::{rfs, rustc}; | |
| 18 | 18 | |
| 19 | 19 | fn main() { |
| 20 | 20 | rfs::create_dir("incr"); |
tests/run-make/incremental-debugger-visualizer/rmake.rs-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | // (in this case, foo.py and foo.natvis) are picked up when compiling incrementally. |
| 3 | 3 | // See https://github.com/rust-lang/rust/pull/111641 |
| 4 | 4 | |
| 5 | use std::io::Read; | |
| 6 | ||
| 7 | 5 | use run_make_support::{invalid_utf8_contains, invalid_utf8_not_contains, rfs, rustc}; |
| 8 | 6 | |
| 9 | 7 | fn main() { |
tests/run-make/lto-readonly-lib/rmake.rs+1-1| ... | ... | @@ -7,7 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | //@ ignore-cross-compile |
| 9 | 9 | |
| 10 | use run_make_support::{rfs, run, rust_lib_name, rustc, test_while_readonly}; | |
| 10 | use run_make_support::{run, rust_lib_name, rustc, test_while_readonly}; | |
| 11 | 11 | |
| 12 | 12 | fn main() { |
| 13 | 13 | rustc().input("lib.rs").run(); |
tests/run-make/multiple-emits/rmake.rs+1-1| ... | ... | @@ -1,4 +1,4 @@ |
| 1 | use run_make_support::{cwd, path, rustc}; | |
| 1 | use run_make_support::{path, rustc}; | |
| 2 | 2 | |
| 3 | 3 | fn main() { |
| 4 | 4 | rustc().input("foo.rs").emit("asm,llvm-ir").output("out").run(); |
tests/run-make/naked-symbol-visibility/rmake.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | use run_make_support::object::read::{File, Object, Symbol}; |
| 4 | 4 | use run_make_support::object::ObjectSymbol; |
| 5 | 5 | use run_make_support::targets::is_windows; |
| 6 | use run_make_support::{dynamic_lib_name, env_var, rfs, rustc}; | |
| 6 | use run_make_support::{dynamic_lib_name, rfs, rustc}; | |
| 7 | 7 | |
| 8 | 8 | fn main() { |
| 9 | 9 | let rdylib_name = dynamic_lib_name("a_rust_dylib"); |
tests/run-make/non-unicode-in-incremental-dir/rmake.rs+1-1| ... | ... | @@ -8,7 +8,7 @@ fn main() { |
| 8 | 8 | match std::fs::create_dir(&non_unicode) { |
| 9 | 9 | // If an error occurs, check if creating a directory with a valid Unicode name would |
| 10 | 10 | // succeed. |
| 11 | Err(e) if std::fs::create_dir("valid_unicode").is_ok() => { | |
| 11 | Err(_) if std::fs::create_dir("valid_unicode").is_ok() => { | |
| 12 | 12 | // Filesystem doesn't appear support non-Unicode paths. |
| 13 | 13 | return; |
| 14 | 14 | } |
tests/run-make/output-type-permutations/rmake.rs+22-22| ... | ... | @@ -113,7 +113,7 @@ fn main() { |
| 113 | 113 | assert_expected_output_files( |
| 114 | 114 | Expectations { |
| 115 | 115 | expected_files: s!["foo"], |
| 116 | allowed_files: s![], | |
| 116 | allowed_files: vec![], | |
| 117 | 117 | test_dir: "asm-emit".to_string(), |
| 118 | 118 | }, |
| 119 | 119 | || { |
| ... | ... | @@ -123,7 +123,7 @@ fn main() { |
| 123 | 123 | assert_expected_output_files( |
| 124 | 124 | Expectations { |
| 125 | 125 | expected_files: s!["foo"], |
| 126 | allowed_files: s![], | |
| 126 | allowed_files: vec![], | |
| 127 | 127 | test_dir: "asm-emit2".to_string(), |
| 128 | 128 | }, |
| 129 | 129 | || { |
| ... | ... | @@ -133,7 +133,7 @@ fn main() { |
| 133 | 133 | assert_expected_output_files( |
| 134 | 134 | Expectations { |
| 135 | 135 | expected_files: s!["foo"], |
| 136 | allowed_files: s![], | |
| 136 | allowed_files: vec![], | |
| 137 | 137 | test_dir: "asm-emit3".to_string(), |
| 138 | 138 | }, |
| 139 | 139 | || { |
| ... | ... | @@ -144,7 +144,7 @@ fn main() { |
| 144 | 144 | assert_expected_output_files( |
| 145 | 145 | Expectations { |
| 146 | 146 | expected_files: s!["foo"], |
| 147 | allowed_files: s![], | |
| 147 | allowed_files: vec![], | |
| 148 | 148 | test_dir: "llvm-ir-emit".to_string(), |
| 149 | 149 | }, |
| 150 | 150 | || { |
| ... | ... | @@ -154,7 +154,7 @@ fn main() { |
| 154 | 154 | assert_expected_output_files( |
| 155 | 155 | Expectations { |
| 156 | 156 | expected_files: s!["foo"], |
| 157 | allowed_files: s![], | |
| 157 | allowed_files: vec![], | |
| 158 | 158 | test_dir: "llvm-ir-emit2".to_string(), |
| 159 | 159 | }, |
| 160 | 160 | || { |
| ... | ... | @@ -164,7 +164,7 @@ fn main() { |
| 164 | 164 | assert_expected_output_files( |
| 165 | 165 | Expectations { |
| 166 | 166 | expected_files: s!["foo"], |
| 167 | allowed_files: s![], | |
| 167 | allowed_files: vec![], | |
| 168 | 168 | test_dir: "llvm-ir-emit3".to_string(), |
| 169 | 169 | }, |
| 170 | 170 | || { |
| ... | ... | @@ -175,7 +175,7 @@ fn main() { |
| 175 | 175 | assert_expected_output_files( |
| 176 | 176 | Expectations { |
| 177 | 177 | expected_files: s!["foo"], |
| 178 | allowed_files: s![], | |
| 178 | allowed_files: vec![], | |
| 179 | 179 | test_dir: "llvm-bc-emit".to_string(), |
| 180 | 180 | }, |
| 181 | 181 | || { |
| ... | ... | @@ -185,7 +185,7 @@ fn main() { |
| 185 | 185 | assert_expected_output_files( |
| 186 | 186 | Expectations { |
| 187 | 187 | expected_files: s!["foo"], |
| 188 | allowed_files: s![], | |
| 188 | allowed_files: vec![], | |
| 189 | 189 | test_dir: "llvm-bc-emit2".to_string(), |
| 190 | 190 | }, |
| 191 | 191 | || { |
| ... | ... | @@ -195,7 +195,7 @@ fn main() { |
| 195 | 195 | assert_expected_output_files( |
| 196 | 196 | Expectations { |
| 197 | 197 | expected_files: s!["foo"], |
| 198 | allowed_files: s![], | |
| 198 | allowed_files: vec![], | |
| 199 | 199 | test_dir: "llvm-bc-emit3".to_string(), |
| 200 | 200 | }, |
| 201 | 201 | || { |
| ... | ... | @@ -206,7 +206,7 @@ fn main() { |
| 206 | 206 | assert_expected_output_files( |
| 207 | 207 | Expectations { |
| 208 | 208 | expected_files: s!["foo"], |
| 209 | allowed_files: s![], | |
| 209 | allowed_files: vec![], | |
| 210 | 210 | test_dir: "obj-emit".to_string(), |
| 211 | 211 | }, |
| 212 | 212 | || { |
| ... | ... | @@ -216,7 +216,7 @@ fn main() { |
| 216 | 216 | assert_expected_output_files( |
| 217 | 217 | Expectations { |
| 218 | 218 | expected_files: s!["foo"], |
| 219 | allowed_files: s![], | |
| 219 | allowed_files: vec![], | |
| 220 | 220 | test_dir: "obj-emit2".to_string(), |
| 221 | 221 | }, |
| 222 | 222 | || { |
| ... | ... | @@ -226,7 +226,7 @@ fn main() { |
| 226 | 226 | assert_expected_output_files( |
| 227 | 227 | Expectations { |
| 228 | 228 | expected_files: s!["foo"], |
| 229 | allowed_files: s![], | |
| 229 | allowed_files: vec![], | |
| 230 | 230 | test_dir: "obj-emit3".to_string(), |
| 231 | 231 | }, |
| 232 | 232 | || { |
| ... | ... | @@ -268,7 +268,7 @@ fn main() { |
| 268 | 268 | assert_expected_output_files( |
| 269 | 269 | Expectations { |
| 270 | 270 | expected_files: s!["foo"], |
| 271 | allowed_files: s![], | |
| 271 | allowed_files: vec![], | |
| 272 | 272 | test_dir: "rlib".to_string(), |
| 273 | 273 | }, |
| 274 | 274 | || { |
| ... | ... | @@ -278,7 +278,7 @@ fn main() { |
| 278 | 278 | assert_expected_output_files( |
| 279 | 279 | Expectations { |
| 280 | 280 | expected_files: s!["foo"], |
| 281 | allowed_files: s![], | |
| 281 | allowed_files: vec![], | |
| 282 | 282 | test_dir: "rlib2".to_string(), |
| 283 | 283 | }, |
| 284 | 284 | || { |
| ... | ... | @@ -288,7 +288,7 @@ fn main() { |
| 288 | 288 | assert_expected_output_files( |
| 289 | 289 | Expectations { |
| 290 | 290 | expected_files: s!["foo"], |
| 291 | allowed_files: s![], | |
| 291 | allowed_files: vec![], | |
| 292 | 292 | test_dir: "rlib3".to_string(), |
| 293 | 293 | }, |
| 294 | 294 | || { |
| ... | ... | @@ -375,7 +375,7 @@ fn main() { |
| 375 | 375 | assert_expected_output_files( |
| 376 | 376 | Expectations { |
| 377 | 377 | expected_files: s!["foo"], |
| 378 | allowed_files: s![], | |
| 378 | allowed_files: vec![], | |
| 379 | 379 | test_dir: "staticlib".to_string(), |
| 380 | 380 | }, |
| 381 | 381 | || { |
| ... | ... | @@ -385,7 +385,7 @@ fn main() { |
| 385 | 385 | assert_expected_output_files( |
| 386 | 386 | Expectations { |
| 387 | 387 | expected_files: s!["foo"], |
| 388 | allowed_files: s![], | |
| 388 | allowed_files: vec![], | |
| 389 | 389 | test_dir: "staticlib2".to_string(), |
| 390 | 390 | }, |
| 391 | 391 | || { |
| ... | ... | @@ -395,7 +395,7 @@ fn main() { |
| 395 | 395 | assert_expected_output_files( |
| 396 | 396 | Expectations { |
| 397 | 397 | expected_files: s!["foo"], |
| 398 | allowed_files: s![], | |
| 398 | allowed_files: vec![], | |
| 399 | 399 | test_dir: "staticlib3".to_string(), |
| 400 | 400 | }, |
| 401 | 401 | || { |
| ... | ... | @@ -449,7 +449,7 @@ fn main() { |
| 449 | 449 | assert_expected_output_files( |
| 450 | 450 | Expectations { |
| 451 | 451 | expected_files: s!["ir", rust_lib_name("bar")], |
| 452 | allowed_files: s![], | |
| 452 | allowed_files: vec![], | |
| 453 | 453 | test_dir: "rlib-ir".to_string(), |
| 454 | 454 | }, |
| 455 | 455 | || { |
| ... | ... | @@ -466,7 +466,7 @@ fn main() { |
| 466 | 466 | assert_expected_output_files( |
| 467 | 467 | Expectations { |
| 468 | 468 | expected_files: s!["ir", "asm", "bc", "obj", "link"], |
| 469 | allowed_files: s![], | |
| 469 | allowed_files: vec![], | |
| 470 | 470 | test_dir: "staticlib-all".to_string(), |
| 471 | 471 | }, |
| 472 | 472 | || { |
| ... | ... | @@ -484,7 +484,7 @@ fn main() { |
| 484 | 484 | assert_expected_output_files( |
| 485 | 485 | Expectations { |
| 486 | 486 | expected_files: s!["ir", "asm", "bc", "obj", "link"], |
| 487 | allowed_files: s![], | |
| 487 | allowed_files: vec![], | |
| 488 | 488 | test_dir: "staticlib-all2".to_string(), |
| 489 | 489 | }, |
| 490 | 490 | || { |
| ... | ... | @@ -523,7 +523,7 @@ fn main() { |
| 523 | 523 | assert_expected_output_files( |
| 524 | 524 | Expectations { |
| 525 | 525 | expected_files: s!["bar.bc", rust_lib_name("bar"), "foo.bc"], |
| 526 | allowed_files: s![], | |
| 526 | allowed_files: vec![], | |
| 527 | 527 | test_dir: "rlib-emits".to_string(), |
| 528 | 528 | }, |
| 529 | 529 | || { |
tests/run-make/print-check-cfg/rmake.rs-1| ... | ... | @@ -4,7 +4,6 @@ extern crate run_make_support; |
| 4 | 4 | |
| 5 | 5 | use std::collections::HashSet; |
| 6 | 6 | use std::iter::FromIterator; |
| 7 | use std::ops::Deref; | |
| 8 | 7 | |
| 9 | 8 | use run_make_support::rustc; |
| 10 | 9 |
tests/run-make/print-native-static-libs/rmake.rs-2| ... | ... | @@ -12,8 +12,6 @@ |
| 12 | 12 | //@ ignore-cross-compile |
| 13 | 13 | //@ ignore-wasm |
| 14 | 14 | |
| 15 | use std::io::BufRead; | |
| 16 | ||
| 17 | 15 | use run_make_support::{is_msvc, rustc}; |
| 18 | 16 | |
| 19 | 17 | fn main() { |
tests/run-make/redundant-libs/rmake.rs+1-3| ... | ... | @@ -11,9 +11,7 @@ |
| 11 | 11 | //@ ignore-cross-compile |
| 12 | 12 | // Reason: the compiled binary is executed |
| 13 | 13 | |
| 14 | use run_make_support::{ | |
| 15 | build_native_dynamic_lib, build_native_static_lib, cwd, is_msvc, rfs, run, rustc, | |
| 16 | }; | |
| 14 | use run_make_support::{build_native_dynamic_lib, build_native_static_lib, run, rustc}; | |
| 17 | 15 | |
| 18 | 16 | fn main() { |
| 19 | 17 | build_native_dynamic_lib("foo"); |
tests/run-make/reproducible-build-2/rmake.rs+1-1| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | // 2. When the sysroot gets copied, some symlinks must be re-created, |
| 14 | 14 | // which is a privileged action on Windows. |
| 15 | 15 | |
| 16 | use run_make_support::{bin_name, rfs, rust_lib_name, rustc}; | |
| 16 | use run_make_support::{rfs, rust_lib_name, rustc}; | |
| 17 | 17 | |
| 18 | 18 | fn main() { |
| 19 | 19 | // test 1: fat lto |
tests/run-make/reset-codegen-1/rmake.rs+1-1| ... | ... | @@ -9,7 +9,7 @@ |
| 9 | 9 | |
| 10 | 10 | use std::path::Path; |
| 11 | 11 | |
| 12 | use run_make_support::{bin_name, rfs, rustc}; | |
| 12 | use run_make_support::{bin_name, rustc}; | |
| 13 | 13 | |
| 14 | 14 | fn compile(output_file: &str, emit: Option<&str>) { |
| 15 | 15 | let mut rustc = rustc(); |
tests/run-make/rlib-format-packed-bundled-libs-3/rmake.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | // See https://github.com/rust-lang/rust/pull/105601 |
| 7 | 7 | |
| 8 | 8 | use run_make_support::{ |
| 9 | build_native_static_lib, is_msvc, llvm_ar, regex, rfs, rust_lib_name, rustc, static_lib_name, | |
| 9 | build_native_static_lib, llvm_ar, regex, rfs, rust_lib_name, rustc, static_lib_name, | |
| 10 | 10 | }; |
| 11 | 11 | |
| 12 | 12 | //@ ignore-cross-compile |
tests/run-make/run-in-tmpdir-self-test/rmake.rs+1-1| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | //! when returning from the closure. |
| 4 | 4 | |
| 5 | 5 | use std::fs; |
| 6 | use std::path::{Path, PathBuf}; | |
| 6 | use std::path::PathBuf; | |
| 7 | 7 | |
| 8 | 8 | use run_make_support::{cwd, run_in_tmpdir}; |
| 9 | 9 |
tests/run-make/rust-lld-by-default-nightly/rmake.rs-2| ... | ... | @@ -6,8 +6,6 @@ |
| 6 | 6 | //@ ignore-stable |
| 7 | 7 | //@ only-x86_64-unknown-linux-gnu |
| 8 | 8 | |
| 9 | use std::process::Output; | |
| 10 | ||
| 11 | 9 | use run_make_support::regex::Regex; |
| 12 | 10 | use run_make_support::rustc; |
| 13 | 11 |
tests/run-make/rust-lld-compress-debug-sections/rmake.rs+1-1| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | // FIXME: This test isn't comprehensive and isn't covering all possible combinations. |
| 8 | 8 | |
| 9 | use run_make_support::{assert_contains, cmd, llvm_readobj, run_in_tmpdir, rustc}; | |
| 9 | use run_make_support::{assert_contains, llvm_readobj, run_in_tmpdir, rustc}; | |
| 10 | 10 | |
| 11 | 11 | fn check_compression(compression: &str, to_find: &str) { |
| 12 | 12 | run_in_tmpdir(|| { |
tests/run-make/rust-lld-custom-target/rmake.rs-2| ... | ... | @@ -8,8 +8,6 @@ |
| 8 | 8 | //@ needs-rust-lld |
| 9 | 9 | //@ only-x86_64-unknown-linux-gnu |
| 10 | 10 | |
| 11 | use std::process::Output; | |
| 12 | ||
| 13 | 11 | use run_make_support::regex::Regex; |
| 14 | 12 | use run_make_support::rustc; |
| 15 | 13 |
tests/run-make/rust-lld/rmake.rs-2| ... | ... | @@ -4,8 +4,6 @@ |
| 4 | 4 | //@ needs-rust-lld |
| 5 | 5 | //@ ignore-s390x lld does not yet support s390x as target |
| 6 | 6 | |
| 7 | use std::process::Output; | |
| 8 | ||
| 9 | 7 | use run_make_support::regex::Regex; |
| 10 | 8 | use run_make_support::{is_msvc, rustc}; |
| 11 | 9 |
tests/run-make/rustdoc-io-error/rmake.rs+5-7| ... | ... | @@ -14,22 +14,20 @@ |
| 14 | 14 | // `mkfs.ext4 -d`, as well as mounting a loop device for the rootfs. |
| 15 | 15 | //@ ignore-windows - the `set_readonly` functions doesn't work on folders. |
| 16 | 16 | |
| 17 | use std::fs; | |
| 18 | ||
| 19 | use run_make_support::{path, rustdoc}; | |
| 17 | use run_make_support::{path, rfs, rustdoc}; | |
| 20 | 18 | |
| 21 | 19 | fn main() { |
| 22 | 20 | let out_dir = path("rustdoc-io-error"); |
| 23 | let output = fs::create_dir(&out_dir).unwrap(); | |
| 24 | let mut permissions = fs::metadata(&out_dir).unwrap().permissions(); | |
| 21 | rfs::create_dir(&out_dir); | |
| 22 | let mut permissions = rfs::metadata(&out_dir).permissions(); | |
| 25 | 23 | let original_permissions = permissions.clone(); |
| 26 | 24 | |
| 27 | 25 | permissions.set_readonly(true); |
| 28 | fs::set_permissions(&out_dir, permissions).unwrap(); | |
| 26 | rfs::set_permissions(&out_dir, permissions); | |
| 29 | 27 | |
| 30 | 28 | let output = rustdoc().input("foo.rs").output(&out_dir).env("RUST_BACKTRACE", "1").run_fail(); |
| 31 | 29 | |
| 32 | fs::set_permissions(&out_dir, original_permissions).unwrap(); | |
| 30 | rfs::set_permissions(&out_dir, original_permissions); | |
| 33 | 31 | |
| 34 | 32 | output |
| 35 | 33 | .assert_exit_code(1) |
tests/run-make/rustdoc-scrape-examples-remap/scrape.rs+1-1| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | use std::path::Path; |
| 2 | 2 | |
| 3 | use run_make_support::{htmldocck, rfs, rustc, rustdoc, source_root}; | |
| 3 | use run_make_support::{htmldocck, rfs, rustc, rustdoc}; | |
| 4 | 4 | |
| 5 | 5 | pub fn scrape(extra_args: &[&str]) { |
| 6 | 6 | let out_dir = Path::new("rustdoc"); |
tests/run-make/sepcomp-cci-copies/rmake.rs+1-4| ... | ... | @@ -4,10 +4,7 @@ |
| 4 | 4 | // created for each source module (see `rustc_const_eval::monomorphize::partitioning`). |
| 5 | 5 | // See https://github.com/rust-lang/rust/pull/16367 |
| 6 | 6 | |
| 7 | use run_make_support::{ | |
| 8 | count_regex_matches_in_files_with_extension, cwd, has_extension, regex, rfs, rustc, | |
| 9 | shallow_find_files, | |
| 10 | }; | |
| 7 | use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc}; | |
| 11 | 8 | |
| 12 | 9 | fn main() { |
| 13 | 10 | rustc().input("cci_lib.rs").run(); |
tests/run-make/sepcomp-inlining/rmake.rs+1-4| ... | ... | @@ -5,10 +5,7 @@ |
| 5 | 5 | // in only one compilation unit. |
| 6 | 6 | // See https://github.com/rust-lang/rust/pull/16367 |
| 7 | 7 | |
| 8 | use run_make_support::{ | |
| 9 | count_regex_matches_in_files_with_extension, cwd, has_extension, regex, rfs, rustc, | |
| 10 | shallow_find_files, | |
| 11 | }; | |
| 8 | use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc}; | |
| 12 | 9 | |
| 13 | 10 | fn main() { |
| 14 | 11 | rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).arg("-Zinline-in-all-cgus").run(); |
tests/run-make/sepcomp-separate/rmake.rs+1-4| ... | ... | @@ -3,10 +3,7 @@ |
| 3 | 3 | // wind up in three different compilation units. |
| 4 | 4 | // See https://github.com/rust-lang/rust/pull/16367 |
| 5 | 5 | |
| 6 | use run_make_support::{ | |
| 7 | count_regex_matches_in_files_with_extension, cwd, has_extension, regex, rfs, rustc, | |
| 8 | shallow_find_files, | |
| 9 | }; | |
| 6 | use run_make_support::{count_regex_matches_in_files_with_extension, regex, rustc}; | |
| 10 | 7 | |
| 11 | 8 | fn main() { |
| 12 | 9 | rustc().input("foo.rs").emit("llvm-ir").codegen_units(3).run(); |
tests/rustdoc-gui/code-example-buttons.goml+75| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | // This test ensures that code blocks buttons are displayed on hover and when you click on them. |
| 2 | 2 | go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" |
| 3 | include: "utils.goml" | |
| 3 | 4 | |
| 4 | 5 | // First we check we "hover". |
| 5 | 6 | move-cursor-to: ".example-wrap" |
| ... | ... | @@ -19,3 +20,77 @@ click: ".example-wrap" |
| 19 | 20 | move-cursor-to: ".search-input" |
| 20 | 21 | assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0) |
| 21 | 22 | assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) |
| 23 | ||
| 24 | // Clicking on the "copy code" button shouldn't make the buttons stick. | |
| 25 | click: ".example-wrap .copy-button" | |
| 26 | move-cursor-to: ".search-input" | |
| 27 | assert-count: (".example-wrap:not(:hover) .button-holder.keep-visible", 0) | |
| 28 | assert-css: (".example-wrap .copy-button", { "visibility": "hidden" }) | |
| 29 | ||
| 30 | define-function: ( | |
| 31 | "check-buttons", | |
| 32 | [theme, background, filter, filter_hover], | |
| 33 | block { | |
| 34 | call-function: ("switch-theme", {"theme": |theme|}) | |
| 35 | ||
| 36 | assert-css: (".example-wrap .test-arrow", {"visibility": "hidden"}) | |
| 37 | assert-css: (".example-wrap .copy-button", {"visibility": "hidden"}) | |
| 38 | ||
| 39 | move-cursor-to: ".example-wrap" | |
| 40 | assert-css: (".example-wrap .test-arrow", { | |
| 41 | "visibility": "visible", | |
| 42 | "background-color": |background|, | |
| 43 | "border-radius": "2px", | |
| 44 | }) | |
| 45 | assert-css: (".example-wrap .test-arrow::before", { | |
| 46 | "filter": |filter|, | |
| 47 | }) | |
| 48 | assert-css: (".example-wrap .copy-button", { | |
| 49 | "visibility": "visible", | |
| 50 | "background-color": |background|, | |
| 51 | "border-radius": "2px", | |
| 52 | }) | |
| 53 | assert-css: (".example-wrap .copy-button::before", { | |
| 54 | "filter": |filter|, | |
| 55 | }) | |
| 56 | ||
| 57 | move-cursor-to: ".example-wrap .test-arrow" | |
| 58 | assert-css: (".example-wrap .test-arrow:hover", { | |
| 59 | "visibility": "visible", | |
| 60 | "background-color": |background|, | |
| 61 | "border-radius": "2px", | |
| 62 | }) | |
| 63 | assert-css: (".example-wrap .test-arrow:hover::before", { | |
| 64 | "filter": |filter_hover|, | |
| 65 | }) | |
| 66 | ||
| 67 | move-cursor-to: ".example-wrap .copy-button" | |
| 68 | assert-css: (".example-wrap .copy-button:hover", { | |
| 69 | "visibility": "visible", | |
| 70 | "background-color": |background|, | |
| 71 | "border-radius": "2px", | |
| 72 | }) | |
| 73 | assert-css: (".example-wrap .copy-button:hover::before", { | |
| 74 | "filter": |filter_hover|, | |
| 75 | }) | |
| 76 | }, | |
| 77 | ) | |
| 78 | ||
| 79 | call-function: ("check-buttons",{ | |
| 80 | "theme": "ayu", | |
| 81 | "background": "#0f1419", | |
| 82 | "filter": "invert(0.7)", | |
| 83 | "filter_hover": "invert(1)", | |
| 84 | }) | |
| 85 | call-function: ("check-buttons",{ | |
| 86 | "theme": "dark", | |
| 87 | "background": "#353535", | |
| 88 | "filter": "invert(0.5)", | |
| 89 | "filter_hover": "invert(0.65)", | |
| 90 | }) | |
| 91 | call-function: ("check-buttons",{ | |
| 92 | "theme": "light", | |
| 93 | "background": "#fff", | |
| 94 | "filter": "invert(0.5)", | |
| 95 | "filter_hover": "invert(0.35)", | |
| 96 | }) |
tests/rustdoc-gui/copy-code.goml+2-2| ... | ... | @@ -24,11 +24,11 @@ define-function: ( |
| 24 | 24 | ) |
| 25 | 25 | |
| 26 | 26 | call-function: ("check-copy-button", {}) |
| 27 | // Checking that the run button and the copy button have the same height. | |
| 27 | // Checking that the run button and the copy button have the same height and same width. | |
| 28 | 28 | compare-elements-size: ( |
| 29 | 29 | ".example-wrap:nth-of-type(1) .test-arrow", |
| 30 | 30 | ".example-wrap:nth-of-type(1) .copy-button", |
| 31 | ["height"], | |
| 31 | ["height", "width"], | |
| 32 | 32 | ) |
| 33 | 33 | // ... and the same y position. |
| 34 | 34 | compare-elements-position: ( |
tests/rustdoc-gui/run-on-hover.goml deleted-54| ... | ... | @@ -1,54 +0,0 @@ |
| 1 | // Example code blocks sometimes have a "Run" button to run them on the | |
| 2 | // Playground. That button is hidden until the user hovers over the code block. | |
| 3 | // This test checks that it is hidden, and that it shows on hover. It also | |
| 4 | // checks for its color. | |
| 5 | include: "utils.goml" | |
| 6 | go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" | |
| 7 | show-text: true | |
| 8 | ||
| 9 | define-function: ( | |
| 10 | "check-run-button", | |
| 11 | [theme, color, background, hover_color, hover_background], | |
| 12 | block { | |
| 13 | call-function: ("switch-theme", {"theme": |theme|}) | |
| 14 | assert-css: (".test-arrow", {"visibility": "hidden"}) | |
| 15 | move-cursor-to: ".example-wrap" | |
| 16 | assert-css: (".test-arrow", { | |
| 17 | "visibility": "visible", | |
| 18 | "color": |color|, | |
| 19 | "background-color": |background|, | |
| 20 | "font-size": "16px", | |
| 21 | "border-radius": "2px", | |
| 22 | }) | |
| 23 | move-cursor-to: ".test-arrow" | |
| 24 | assert-css: (".test-arrow:hover", { | |
| 25 | "visibility": "visible", | |
| 26 | "color": |hover_color|, | |
| 27 | "background-color": |hover_background|, | |
| 28 | "font-size": "16px", | |
| 29 | "border-radius": "2px", | |
| 30 | }) | |
| 31 | }, | |
| 32 | ) | |
| 33 | ||
| 34 | call-function: ("check-run-button", { | |
| 35 | "theme": "ayu", | |
| 36 | "color": "#788797", | |
| 37 | "background": "rgba(57, 175, 215, 0.09)", | |
| 38 | "hover_color": "#c5c5c5", | |
| 39 | "hover_background": "rgba(57, 175, 215, 0.37)", | |
| 40 | }) | |
| 41 | call-function: ("check-run-button", { | |
| 42 | "theme": "dark", | |
| 43 | "color": "#dedede", | |
| 44 | "background": "rgba(78, 139, 202, 0.2)", | |
| 45 | "hover_color": "#dedede", | |
| 46 | "hover_background": "rgb(78, 139, 202)", | |
| 47 | }) | |
| 48 | call-function: ("check-run-button", { | |
| 49 | "theme": "light", | |
| 50 | "color": "#f5f5f5", | |
| 51 | "background": "rgba(78, 139, 202, 0.2)", | |
| 52 | "hover_color": "#f5f5f5", | |
| 53 | "hover_background": "rgb(78, 139, 202)", | |
| 54 | }) |
tests/rustdoc/playground-arg.rs+1-1| ... | ... | @@ -10,4 +10,4 @@ |
| 10 | 10 | pub fn dummy() {} |
| 11 | 11 | |
| 12 | 12 | // ensure that `extern crate foo;` was inserted into code snips automatically: |
| 13 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://example.com/?code=%23!%5Ballow(unused)%5D%0A%23%5Ballow(unused_extern_crates)%5D%0Aextern+crate+r%23foo;%0Afn+main()+%7B%0A++++use+foo::dummy;%0A++++dummy();%0A%7D&edition=2015"]' "Run" | |
| 13 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://example.com/?code=%23!%5Ballow(unused)%5D%0A%23%5Ballow(unused_extern_crates)%5D%0Aextern+crate+r%23foo;%0Afn+main()+%7B%0A++++use+foo::dummy;%0A++++dummy();%0A%7D&edition=2015"]' "" |
tests/rustdoc/playground-syntax-error.rs+1-1| ... | ... | @@ -17,5 +17,5 @@ |
| 17 | 17 | pub fn bar() {} |
| 18 | 18 | |
| 19 | 19 | //@ has foo/fn.bar.html |
| 20 | //@ has - '//a[@class="test-arrow"]' "Run" | |
| 20 | //@ has - '//a[@class="test-arrow"]' "" | |
| 21 | 21 | //@ has - '//*[@class="docblock"]' 'foo_recursive' |
tests/rustdoc/playground.rs+3-3| ... | ... | @@ -22,6 +22,6 @@ |
| 22 | 22 | //! } |
| 23 | 23 | //! ``` |
| 24 | 24 | |
| 25 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&edition=2015"]' "Run" | |
| 26 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&edition=2015"]' "Run" | |
| 27 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&version=nightly&edition=2015"]' "Run" | |
| 25 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&edition=2015"]' "" | |
| 26 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&edition=2015"]' "" | |
| 27 | //@ matches foo/index.html '//a[@class="test-arrow"][@href="https://www.example.com/?code=%23!%5Ballow(unused)%5D%0A%23!%5Bfeature(something)%5D%0A%0Afn+main()+%7B%0A++++println!(%22Hello,+world!%22);%0A%7D&version=nightly&edition=2015"]' "" |
tests/ui/coroutine/gen_block.none.stderr-2| ... | ... | @@ -73,7 +73,6 @@ LL | let _ = || yield true; |
| 73 | 73 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information |
| 74 | 74 | = help: add `#![feature(coroutines)]` to the crate attributes to enable |
| 75 | 75 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 76 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 77 | 76 | |
| 78 | 77 | error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks |
| 79 | 78 | --> $DIR/gen_block.rs:16:16 |
| ... | ... | @@ -95,7 +94,6 @@ LL | let _ = #[coroutine] || yield true; |
| 95 | 94 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information |
| 96 | 95 | = help: add `#![feature(coroutines)]` to the crate attributes to enable |
| 97 | 96 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 98 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 99 | 97 | |
| 100 | 98 | error: aborting due to 11 previous errors |
| 101 | 99 |
tests/ui/feature-gates/feature-gate-coroutines.none.stderr-2| ... | ... | @@ -47,7 +47,6 @@ LL | yield true; |
| 47 | 47 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information |
| 48 | 48 | = help: add `#![feature(coroutines)]` to the crate attributes to enable |
| 49 | 49 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 50 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 51 | 50 | |
| 52 | 51 | error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks |
| 53 | 52 | --> $DIR/feature-gate-coroutines.rs:5:5 |
| ... | ... | @@ -69,7 +68,6 @@ LL | let _ = || yield true; |
| 69 | 68 | = note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information |
| 70 | 69 | = help: add `#![feature(coroutines)]` to the crate attributes to enable |
| 71 | 70 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 72 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | |
| 73 | 71 | |
| 74 | 72 | error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks |
| 75 | 73 | --> $DIR/feature-gate-coroutines.rs:10:16 |
tests/ui/proc-macro/auxiliary/parse-invis-delim-issue-128895.rs created+44| ... | ... | @@ -0,0 +1,44 @@ |
| 1 | //@ force-host | |
| 2 | //@ no-prefer-dynamic | |
| 3 | ||
| 4 | #![crate_type = "proc-macro"] | |
| 5 | ||
| 6 | extern crate proc_macro; | |
| 7 | ||
| 8 | use proc_macro::*; | |
| 9 | ||
| 10 | // This proc macro ignores its input and returns this token stream | |
| 11 | // | |
| 12 | // impl <«A1»: Comparable> Comparable for («A1»,) {} | |
| 13 | // | |
| 14 | // where `«`/`»` are invisible delimiters. This was being misparsed in bug | |
| 15 | // #128895. | |
| 16 | #[proc_macro] | |
| 17 | pub fn main(_input: TokenStream) -> TokenStream { | |
| 18 | let a1 = TokenTree::Group( | |
| 19 | Group::new( | |
| 20 | Delimiter::None, | |
| 21 | std::iter::once(TokenTree::Ident(Ident::new("A1", Span::call_site()))).collect(), | |
| 22 | ) | |
| 23 | ); | |
| 24 | vec![ | |
| 25 | TokenTree::Ident(Ident::new("impl", Span::call_site())), | |
| 26 | TokenTree::Punct(Punct::new('<', Spacing::Alone)), | |
| 27 | a1.clone(), | |
| 28 | TokenTree::Punct(Punct::new(':', Spacing::Alone)), | |
| 29 | TokenTree::Ident(Ident::new("Comparable", Span::call_site())), | |
| 30 | TokenTree::Punct(Punct::new('>', Spacing::Alone)), | |
| 31 | TokenTree::Ident(Ident::new("Comparable", Span::call_site())), | |
| 32 | TokenTree::Ident(Ident::new("for", Span::call_site())), | |
| 33 | TokenTree::Group( | |
| 34 | Group::new( | |
| 35 | Delimiter::Parenthesis, | |
| 36 | vec![ | |
| 37 | a1.clone(), | |
| 38 | TokenTree::Punct(Punct::new(',', Spacing::Alone)), | |
| 39 | ].into_iter().collect::<TokenStream>(), | |
| 40 | ) | |
| 41 | ), | |
| 42 | TokenTree::Group(Group::new(Delimiter::Brace, TokenStream::new())), | |
| 43 | ].into_iter().collect::<TokenStream>() | |
| 44 | } |
tests/ui/proc-macro/parse-invis-delim-issue-128895.rs created+14| ... | ... | @@ -0,0 +1,14 @@ |
| 1 | //@ aux-build:parse-invis-delim-issue-128895.rs | |
| 2 | //@ check-pass | |
| 3 | ||
| 4 | #![no_std] // Don't load unnecessary hygiene information from std | |
| 5 | extern crate std; | |
| 6 | ||
| 7 | #[macro_use] | |
| 8 | extern crate parse_invis_delim_issue_128895; | |
| 9 | ||
| 10 | trait Comparable {} | |
| 11 | ||
| 12 | parse_invis_delim_issue_128895::main!(); | |
| 13 | ||
| 14 | fn main() {} |