use rustc::hir; use syntax::attr; <del> declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); </del> <ins> macro_rules! fake_lint_pass { ($struct:ident, $lints:expr, $($attr:expr),*) => { struct $struct; impl LintPass for $struct { fn get_lints(&self) -> LintArray { $lints } } </ins> <del> struct Pass; </del> <ins> impl<'a, 'tcx> LateLintPass<'a, 'tcx> for $struct { fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { $( if !attr::contains_name(&krate.attrs, $attr) { cx.span_lint(CRATE_NOT_OKAY, krate.span, &format!("crate is not marked with #![{}]", $attr)); } )* } } </ins> <del> impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(CRATE_NOT_OKAY) </del> } } <del> impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_crate(&mut self, cx: &LateContext, krate: &hir::Crate) { if !attr::contains_name(&krate.attrs, "crate_okay") { cx.span_lint(CRATE_NOT_OKAY, krate.span, "crate is not marked with #![crate_okay]"); } } </del> <ins> declare_lint!(CRATE_NOT_OKAY, Warn, "crate not marked with #![crate_okay]"); declare_lint!(CRATE_NOT_RED, Warn, "crate not marked with #![crate_red]"); declare_lint!(CRATE_NOT_BLUE, Warn, "crate not marked with #![crate_blue]"); declare_lint!(CRATE_NOT_GREY, Warn, "crate not marked with #![crate_grey]"); declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]"); fake_lint_pass! { PassOkay, lint_array!(CRATE_NOT_OKAY), // Single lint "crate_okay" } fake_lint_pass! { PassRedBlue, lint_array!(CRATE_NOT_RED, CRATE_NOT_BLUE), // Multiple lints "crate_red", "crate_blue" } fake_lint_pass! { PassGreyGreen, lint_array!(CRATE_NOT_GREY, CRATE_NOT_GREEN, ), // Trailing comma "crate_grey", "crate_green" </ins> } #[plugin_registrar] pub fn plugin_registrar(reg: &mut Registry) { <del> reg.register_late_lint_pass(box Pass); </del> <ins> reg.register_late_lint_pass(box PassOkay); reg.register_late_lint_pass(box PassRedBlue); reg.register_late_lint_pass(box PassGreyGreen); </ins> }


<ins> error[E0382]: use of moved value: `a` --> $DIR/dbg-issue-120327.rs:4:12 | LL |     let a = String::new(); |         - move occurs because `a` has type `String`, which does not implement the `Copy` trait LL |     dbg!(a); |     ------- value moved here LL |     return a; |            ^ value used here after move | help: consider borrowing instead of transferring ownership | LL |     dbg!(&a); |          + error[E0382]: use of moved value: `a` --> $DIR/dbg-issue-120327.rs:10:12 | LL |     let a = String::new(); |         - move occurs because `a` has type `String`, which does not implement the `Copy` trait LL |     dbg!(1, 2, a, 1, 2); |     ------------------- value moved here LL |     return a; |            ^ value used here after move | help: consider borrowing instead of transferring ownership | LL |     dbg!(1, 2, &a, 1, 2); |                + error[E0382]: use of moved value: `b` --> $DIR/dbg-issue-120327.rs:16:12 | LL |     let b: String = "".to_string(); |         - move occurs because `b` has type `String`, which does not implement the `Copy` trait LL |     dbg!(a, b); |     ---------- value moved here LL |     return b; |            ^ value used here after move | help: consider borrowing instead of transferring ownership | LL |     dbg!(a, &b); |             + error[E0382]: use of moved value: `a` --> $DIR/dbg-issue-120327.rs:22:12 | LL | fn x(a: String) -> String { |      - move occurs because `a` has type `String`, which does not implement the `Copy` trait LL |     let b: String = "".to_string(); LL |     dbg!(a, b); |     ---------- value moved here LL |     return a; |            ^ value used here after move | help: consider borrowing instead of transferring ownership | LL |     dbg!(&a, b); |          + error[E0382]: use of moved value: `b` --> $DIR/dbg-issue-120327.rs:46:12 | LL |             tmp => { |             --- value moved here ... LL |     let b: String = "".to_string(); |         - move occurs because `b` has type `String`, which does not implement the `Copy` trait LL |     my_dbg!(b, 1); LL |     return b; |            ^ value used here after move | help: consider borrowing instead of transferring ownership | LL |     my_dbg!(&b, 1); |             + help: borrow this binding in the pattern to avoid moving the value | LL |             ref tmp => { |             +++ error[E0382]: use of moved value: `a` --> $DIR/dbg-issue-120327.rs:57:12 | LL |     let a = String::new(); |         - move occurs because `a` has type `String`, which does not implement the `Copy` trait LL |     let _b = match a { LL |         tmp => { |         --- value moved here ... LL |     return a; |            ^ value used here after move | help: borrow this binding in the pattern to avoid moving the value | LL |         ref tmp => { |         +++ error[E0382]: borrow of moved value: `a` --> $DIR/dbg-issue-120327.rs:65:14 | LL |     let a: String = "".to_string(); |         - move occurs because `a` has type `String`, which does not implement the `Copy` trait LL |     let _res = get_expr(dbg!(a)); |                         ------- value moved here LL |     let _l = a.len(); |              ^ value borrowed here after move | help: consider borrowing instead of transferring ownership | LL |     let _res = get_expr(dbg!(&a)); |                              + error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0382`. </ins>


<ins> // Verify that the entry point injected by the test harness doesn't cause // weird artifacts in the coverage report (e.g. issue #10749). // compile-flags: --test #[allow(dead_code)] fn unused() {} #[test] fn my_test() {} </ins>


} fn run(self, builder: &Builder<'_>) -> Option<GeneratedTarball> { <ins> // This prevents rust-analyzer from being built for "dist" or "install" // on the stable/beta channels. It is a nightly-only tool and should // not be included. if !builder.build.unstable_features() { return None; } </ins> let compiler = self.compiler; let target = self.target; assert!(builder.config.extended);


<ins> // Test to check that the "warning blocks" are displayed as expected. go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html" show-text: true define-function: ( "check-warning", (theme, color, border_color, background_color), block { set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"} reload: // The IDs are added directly into the DOM to make writing this test easier. assert-css: ("#doc-warning-1", { "margin-bottom": "12px", "color": |color|, "border-left": "2px solid " + |border_color|, "background-color": |background_color|, }) assert-css: ("#doc-warning-2", { "margin-bottom": "0px", "color": |color|, "border-left": "2px solid " + |border_color|, "background-color": |background_color|, }) }, ) call-function: ("check-warning", { "theme": "ayu", "color": "rgb(197, 197, 197)", "border_color": "rgb(255, 142, 0)", "background_color": "rgba(0, 0, 0, 0)", }) call-function: ("check-warning", { "theme": "dark", "color": "rgb(221, 221, 221)", "border_color": "rgb(255, 142, 0)", "background_color": "rgba(0, 0, 0, 0)", }) call-function: ("check-warning", { "theme": "light", "color": "rgb(0, 0, 0)", "border_color": "rgb(255, 142, 0)", "background_color": "rgba(0, 0, 0, 0)", }) </ins>


.label = invalid stability version .item = the stability attribute annotates this item <ins> passes_lang_item_fn_with_target_feature = `{$name}` language item function is not allowed to have `#[target_feature]` .label = `{$name}` language item function is not allowed to have `#[target_feature]` </ins> passes_lang_item_on_incorrect_target = `{$name}` language item must be applied to a {$expected_target} .label = attribute should be applied to a {$expected_target}, not a {$actual_target}


if builder.config.llvm_thin_lto { cfg.define("LLVM_ENABLE_LTO", "Thin"); if !target.contains("apple") { <del> cfg.define("LLVM_USE_LINKER", "lld"); </del> <ins> cfg.define("LLVM_ENABLE_LLD", "ON"); </ins> } }


} ``` <ins> ### Error example 3 Suppose we have a struct `Foo` and we would like to define some methods for it. The following code example has a definition which leads to a compiler error: ```compile_fail,E0207 struct Foo; impl<const T: i32> Foo { // error: the const parameter `T` is not constrained by the impl trait, self // type, or predicates [E0207] fn get(&self) -> i32 { i32::default() } } ``` The problem is that the const parameter `T` does not appear in the implementing type (`Foo`) of the impl. In this case, we can fix the error by moving the type parameter from the `impl` to the method `get`: ``` struct Foo; // Move the const parameter from the impl to the method impl Foo { fn get<const T: i32>(&self) -> i32 { i32::default() } } ``` ### Error example 4 Suppose we have a struct `Foo` and a struct `Bar` that uses lifetime `'a`. We would like to implement trait `Contains` for `Foo`. The trait `Contains` have the associated type `B`. The following code example has a definition which leads to a compiler error: ```compile_fail,E0207 struct Foo; struct Bar<'a>; trait Contains { type B; fn get(&self) -> i32; } impl<'a> Contains for Foo { type B = Bar<'a>; // error: the lifetime parameter `'a` is not constrained by the impl trait, // self type, or predicates [E0207] fn get(&self) -> i32 { i32::default() } } ``` Please note that unconstrained lifetime parameters are not supported if they are being used by an associated type. </ins> ### Additional information For more information, please see [RFC 447].


<ins> error[E0204]: the trait `ConstParamTy` cannot be implemented for this type --> $DIR/nested_bad_const_param_ty.rs:6:10 | LL | #[derive(ConstParamTy)] |          ^^^^^^^^^^^^ LL | LL | struct Foo([*const u8; 1]); |            -------------- this field does not implement `ConstParamTy` | note: the `ConstParamTy` impl for `[*const u8; 1]` requires that `*const u8: ConstParamTy` --> $DIR/nested_bad_const_param_ty.rs:8:12 | LL | struct Foo([*const u8; 1]); |            ^^^^^^^^^^^^^^ = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0204]: the trait `ConstParamTy` cannot be implemented for this type --> $DIR/nested_bad_const_param_ty.rs:10:10 | LL | #[derive(ConstParamTy)] |          ^^^^^^^^^^^^ LL | LL | struct Foo2([*mut u8; 1]); |             ------------ this field does not implement `ConstParamTy` | note: the `ConstParamTy` impl for `[*mut u8; 1]` requires that `*mut u8: ConstParamTy` --> $DIR/nested_bad_const_param_ty.rs:12:13 | LL | struct Foo2([*mut u8; 1]); |             ^^^^^^^^^^^^ = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0204]: the trait `ConstParamTy` cannot be implemented for this type --> $DIR/nested_bad_const_param_ty.rs:14:10 | LL | #[derive(ConstParamTy)] |          ^^^^^^^^^^^^ LL | LL | struct Foo3([fn(); 1]); |             --------- this field does not implement `ConstParamTy` | note: the `ConstParamTy` impl for `[fn(); 1]` requires that `fn(): ConstParamTy` --> $DIR/nested_bad_const_param_ty.rs:16:13 | LL | struct Foo3([fn(); 1]); |             ^^^^^^^^^ = note: this error originates in the derive macro `ConstParamTy` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0204`. </ins>


use rustc_hir::definitions::Definitions; use rustc_hir::intravisit::Visitor; use rustc_hir::lang_items::LangItem; <del> use rustc_hir::{ Constness, ExprKind, HirId, ImplItemKind, ItemKind, Node, TraitCandidate, TraitItemKind, }; </del> <ins> use rustc_hir::{Constness, HirId, Node, TraitCandidate}; </ins> use rustc_index::IndexVec; use rustc_macros::HashStable; use rustc_query_system::dep_graph::DepNodeIndex;


Ok(lhs) } <ins> fn should_continue_as_assoc_expr(&mut self, lhs: &Expr) -> bool { match (self.expr_is_complete(lhs), self.check_assoc_op()) { // Semi-statement forms are odd: // See https://github.com/rust-lang/rust/issues/29071 (true, None) => false, (false, _) => true, // Continue parsing the expression. // An exhaustive check is done in the following block, but these are checked first // because they *are* ambiguous but also reasonable looking incorrect syntax, so we // want to keep their span info to improve diagnostics in these cases in a later stage. (true, Some(AssocOp::Multiply)) | // `{ 42 } *foo = bar;` or `{ 42 } * 3` (true, Some(AssocOp::Subtract)) | // `{ 42 } -5` (true, Some(AssocOp::LAnd)) | // `{ 42 } &&x` (#61475) (true, Some(AssocOp::Add)) // `{ 42 } + 42 // If the next token is a keyword, then the tokens above *are* unambiguously incorrect: // `if x { a } else { b } && if y { c } else { d }` if !self.look_ahead(1, |t| t.is_reserved_ident()) => { // These cases are ambiguous and can't be identified in the parser alone. let sp = self.sess.source_map().start_point(self.token.span); self.sess.ambiguous_block_expr_parse.borrow_mut().insert(sp, lhs.span); false } (true, Some(ref op)) if !op.can_continue_expr_unambiguously() => false, (true, Some(_)) => { self.error_found_expr_would_be_stmt(lhs); true } } } /// We've found an expression that would be parsed as a statement, /// but the next token implies this should be parsed as an expression. /// For example: `if let Some(x) = x { x } else { 0 } / 2`. fn error_found_expr_would_be_stmt(&self, lhs: &Expr) { let mut err = self.struct_span_err(self.token.span, &format!( "expected expression, found `{}`", pprust::token_to_string(&self.token), )); err.span_label(self.token.span, "expected expression"); self.sess.expr_parentheses_needed(&mut err, lhs.span, Some(pprust::expr_to_string(&lhs))); err.emit(); } /// Possibly translate the current token to an associative operator. /// The method does not advance the current token. /// /// Also performs recovery for `and` / `or` which are mistaken for `&&` and `||` respectively. fn check_assoc_op(&self) -> Option<AssocOp> { AssocOp::from_token(&self.token) } </ins> /// Checks if this expression is a successfully parsed statement. fn expr_is_complete(&self, e: &Expr) -> bool { self.restrictions.contains(Restrictions::STMT_EXPR) &&


use util::fs::fix_windows_verbatim_for_gcc; use rustc_back::tempdir::TempDir; <ins> use std::ascii; use std::char; </ins> use std::env; use std::ffi::OsString; use std::fs::{self, PathExt};


Also, please make sure that fixup commits are squashed into other related commits with meaningful commit messages. <ins> GitHub allows [closing issues using keywords][closing-keywords]. This feature should be used to keep the issue tracker tidy. However, it is generally preferred to put the "closes #123" text in the PR description rather than the issue commit; particularly during rebasing, citing the issue number in the commit can "spam" the issue in question. [closing-keywords]: https://help.github.com/en/articles/closing-issues-using-keywords </ins> Please make sure your pull request is in compliance with Rust's style guidelines by running


#[derive(Default)] struct OptimizationList<'tcx> { <del> and_stars: FxHashMap<Location, Mutability>, </del> <ins> and_stars: FxHashSet<Location>, </ins> arrays_lengths: FxHashMap<Location, Constant<'tcx>>, }


<ins> // Test that the `'a` from the impl doesn't // prevent us from creating a `'a` parameter // on the `blah` function. // // check-pass #![feature(in_band_lifetimes)] struct Foo<'a> { x: &'a u32 } impl Foo<'a> { fn method(&self) { fn blah(f: Foo<'a>) { } } } fn main() { } </ins>


= note: `impl Trait` is only allowed in arguments and return types of functions and methods error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type <del> --> $DIR/generics.rs:19:9 </del> <ins> --> $DIR/generics.rs:20:9 </ins> | LL |     f3: extern "C-cmse-nonsecure-call" fn(T, u32, u32, u32) -> u64, |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0798]: function pointers with the `"C-cmse-nonsecure-call"` ABI cannot contain generics in their type <del> --> $DIR/generics.rs:20:9 </del> <ins> --> $DIR/generics.rs:21:9 </ins> | LL |     f4: extern "C-cmse-nonsecure-call" fn(Wrapper<T>, u32, u32, u32) -> u64, |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <del> error: aborting due to 5 previous errors </del> <ins> error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers --> $DIR/generics.rs:27:73 | LL | type WithTraitObject = extern "C-cmse-nonsecure-call" fn(&dyn Trait) -> &dyn Trait; |                                                                         ^^^^^^^^^^ this type doesn't fit in the available registers | = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers --> $DIR/generics.rs:31:62 | LL |     extern "C-cmse-nonsecure-call" fn(&'static dyn Trait) -> &'static dyn Trait; |                                                              ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers | = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0798]: return value of `"C-cmse-nonsecure-call"` function too large to pass via registers --> $DIR/generics.rs:38:62 | LL |     extern "C-cmse-nonsecure-call" fn(WrapperTransparent) -> WrapperTransparent; |                                                              ^^^^^^^^^^^^^^^^^^ this type doesn't fit in the available registers | = note: functions with the `"C-cmse-nonsecure-call"` ABI must pass their result via the available return registers = note: the result must either be a (transparently wrapped) i64, u64 or f64, or be at most 4 bytes in size error[E0045]: C-variadic function must have a compatible calling convention, like `C` or `cdecl` --> $DIR/generics.rs:41:20 | LL | type WithVarArgs = extern "C-cmse-nonsecure-call" fn(u32, ...); |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadic function must have a compatible calling convention error: aborting due to 9 previous errors </ins> <del> Some errors have detailed explanations: E0412, E0562, E0798. For more information about an error, try `rustc --explain E0412`. </del> <ins> Some errors have detailed explanations: E0045, E0412, E0562, E0798. For more information about an error, try `rustc --explain E0045`. </ins>


rustflags.arg(sysroot_str); } <del> // https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20link.20new.20library.20into.20stage1.2Frustc if self.config.llvm_enzyme { rustflags.arg("-l"); rustflags.arg("Enzyme-19"); } </del> let use_new_symbol_mangling = match self.config.rust_new_symbol_mangling { Some(setting) => { // If an explicit setting is given, use that


} } <del> pub fn retokenise_span(&self, span: Span) -> StringReader<'a> { lexer::StringReader::retokenize(&self.sess.parse_sess, span) } pub fn sub_span_of_token(&self, span: Span, tok: TokenKind) -> Option<Span> { let mut toks = self.retokenise_span(span); loop { let next = toks.next_token(); if next == token::Eof { return None; } if next == tok { return Some(next.span); } </del> <ins> /// Finds the span of `*` token withing the larger `span`. pub fn sub_span_of_star(&self, mut span: Span) -> Option<Span> { let begin = self.sess.source_map().lookup_byte_offset(span.lo()); let end = self.sess.source_map().lookup_byte_offset(span.hi()); // Make the range zero-length if the span is invalid. if begin.sf.start_pos != end.sf.start_pos { span = span.shrink_to_lo(); </ins> } <del> } // // Return the name for a macro definition (identifier after first `!`) // pub fn span_for_macro_def_name(&self, span: Span) -> Option<Span> { //     let mut toks = self.retokenise_span(span); //     loop { //         let ts = toks.real_token(); //         if ts == token::Eof { //             return None; //         } //         if ts == token::Not { //             let ts = toks.real_token(); //             if ts.kind.is_ident() { //                 return Some(ts.sp); //             } else { //                 return None; //             } //         } //     } // } </del> <ins> let sf = Lrc::clone(&begin.sf); </ins> <del> // // Return the name for a macro use (identifier before first `!`). // pub fn span_for_macro_use_name(&self, span:Span) -> Option<Span> { //     let mut toks = self.retokenise_span(span); //     let mut prev = toks.real_token(); //     loop { //         if prev == token::Eof { //             return None; //         } //         let ts = toks.real_token(); //         if ts == token::Not { //             if prev.kind.is_ident() { //                 return Some(prev.sp); //             } else { //                 return None; //             } //         } //         prev = ts; //     } // } </del> <ins> self.sess.source_map().ensure_source_file_source_present(Lrc::clone(&sf)); let src = sf.src.clone().or_else(|| sf.external_src.borrow().get_source().map(Lrc::clone))?; let to_index = |pos: BytePos| -> usize { (pos - sf.start_pos).0 as usize }; let text = &src[to_index(span.lo())..to_index(span.hi())]; let start_pos = { let mut pos = 0; tokenize(text) .map(|token| { let start = pos; pos += token.len; (start, token) }) .find(|(_pos, token)| token.kind == TokenKind::Star)? .0 }; let lo = span.lo() + BytePos(start_pos as u32); let hi = lo + BytePos(1); Some(span.with_lo(lo).with_hi(hi)) } </ins> /// Return true if the span is generated code, and /// it is not a subspan of the root callsite.


for possible_ancestor in min_cap_list.iter_mut() { match determine_place_ancestry_relation(&place, &possible_ancestor.place) { // current place is descendant of possible_ancestor <del> PlaceAncestryRelation::Descendant => { </del> <ins> PlaceAncestryRelation::Descendant | PlaceAncestryRelation::SamePlace => { </ins> ancestor_found = true; let backup_path_expr_id = possible_ancestor.info.path_expr_id;


# If this file is modified, then llvm will be forcibly cleaned and then rebuilt. # The actual contents of this file do not matter, but to trigger a change on the # build bots then the contents should be changed so git updates the mtime. <del> 2017-03-02 </del> <ins> 2017-03-04 </ins>


Ok(()) } } <ins> /// Returns the maximum size of return values to be passed by value in the Rust ABI. /// /// Return values beyond this size will use an implicit out-pointer instead. pub fn max_ret_by_val<C: HasTargetSpec + HasDataLayout>(spec: &C) -> Size { match spec.target_spec().arch.as_str() { // System-V will pass return values up to 128 bits in RAX/RDX. "x86_64" => Size::from_bits(128), _ => spec.data_layout().pointer_size, } } </ins>


}); output.extend(items); <del> // Also add the destructor let dg_type = glue::get_drop_glue_type(scx.tcx(), trait_ref.self_ty()); output.push(TransItem::DropGlue(DropGlueKind::Ty(dg_type))); </del> } _ => { /* */ } } } <ins> // Also add the destructor let dg_type = glue::get_drop_glue_type(scx.tcx(), impl_ty); if glue::type_needs_drop(scx.tcx(), dg_type) { output.push(TransItem::DropGlue(DropGlueKind::Ty(dg_type))); } </ins> } }


MergeFunctions::Disabled | MergeFunctions::Trampolines => {} MergeFunctions::Aliases => { <del> add("-mergefunc-use-aliases"); </del> <ins> add("-mergefunc-use-aliases", false); </ins> } } } if sess.target.target.target_os == "emscripten" && sess.panic_strategy() == PanicStrategy::Unwind { <del> add("-enable-emscripten-cxx-exceptions"); </del> <ins> add("-enable-emscripten-cxx-exceptions", false); </ins> } // HACK(eddyb) LLVM inserts `llvm.assume` calls to preserve align attributes // during inlining. Unfortunately these may block other optimizations. <del> add("-preserve-alignment-assumptions-during-inlining=false"); </del> <ins> add("-preserve-alignment-assumptions-during-inlining=false", false); </ins> for arg in &sess.opts.cg.llvm_args { <del> add(&(*arg)); </del> <ins> add(&(*arg), true); </ins> } }


<ins> use rustc_middle::ty::TyCtxt; use rustc_middle::ty::Visibility; use crate::clean; use crate::clean::Item; use crate::core::DocContext; use crate::fold::{strip_item, DocFolder}; use crate::passes::Pass; pub(crate) const STRIP_ALIASED_NON_LOCAL: Pass = Pass { name: "strip-aliased-non-local", run: strip_aliased_non_local, description: "strips all non-local private aliased items from the output", }; fn strip_aliased_non_local(krate: clean::Crate, cx: &mut DocContext<'_>) -> clean::Crate { let mut stripper = AliasedNonLocalStripper { tcx: cx.tcx }; stripper.fold_crate(krate) } struct AliasedNonLocalStripper<'tcx> { tcx: TyCtxt<'tcx>, } impl<'tcx> DocFolder for AliasedNonLocalStripper<'tcx> { fn fold_item(&mut self, i: Item) -> Option<Item> { Some(match *i.kind { clean::TypeAliasItem(..) => { let mut stripper = NonLocalStripper { tcx: self.tcx }; // don't call `fold_item` as that could strip the type-alias it-self // which we don't want to strip out stripper.fold_item_recur(i) } _ => self.fold_item_recur(i), }) } } struct NonLocalStripper<'tcx> { tcx: TyCtxt<'tcx>, } impl<'tcx> DocFolder for NonLocalStripper<'tcx> { fn fold_item(&mut self, i: Item) -> Option<Item> { // If not local, we want to respect the original visibility of // the field and not the one given by the user for the currrent crate. // // FIXME(#125009): Not-local should probably consider same Cargo workspace if !i.def_id().map_or(true, |did| did.is_local()) { if i.visibility(self.tcx) != Some(Visibility::Public) || i.is_doc_hidden() { return Some(strip_item(i)); } } Some(self.fold_item_recur(i)) } } </ins>


pub fn install_ctrlc_handler() { #[cfg(not(target_family = "wasm"))] ctrlc::set_handler(move || { <del> // Indicate that we have been signaled to stop. If we were already signaled, exit // immediately. In our interpreter loop we try to consult this value often, but if for // whatever reason we don't get to that check or the cleanup we do upon finding that // this bool has become true takes a long time, the exit here will promptly exit the // process on the second Ctrl-C. if CTRL_C_RECEIVED.swap(true, Ordering::Relaxed) { std::process::exit(1); } </del> <ins> // Indicate that we have been signaled to stop, then give the rest of the compiler a bit of // time to check CTRL_C_RECEIVED and run its own shutdown logic, but after a short amount // of time exit the process. This sleep+exit ensures that even if nobody is checking // CTRL_C_RECEIVED, the compiler exits reasonably promptly. CTRL_C_RECEIVED.store(true, Ordering::Relaxed); std::thread::sleep(Duration::from_millis(100)); std::process::exit(1); </ins> }) .expect("Unable to install ctrlc handler"); }


use std::c_str::ToCStr; use std::cast; <ins> use std::hashmap::{HashMap, HashSet}; </ins> use std::cmp; use std::io; use std::os::consts::{macos, freebsd, linux, android, win32};


<ins> error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` --> $DIR/issue-109148.rs:6:9 | LL |         extern crate core as std; |         ^^^^^^^^^^^^^^^^^^^^^^^^^ ... LL | m!(); | ---- in this macro invocation | = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error </ins>


use syntax::source_map::Span; use super::{ <del> FnVal, GlobalId, ImmTy, InterpCx, InterpResult, MPlaceTy, Machine, OpTy, PlaceTy, StackPopCleanup, </del> <ins> FnVal, ImmTy, InterpCx, InterpResult, MPlaceTy, Machine, OpTy, PlaceTy, StackPopCleanup, </ins> }; impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {


self_ty: Ty<'tcx>, sig: ty::PolyGenSig<'tcx>, ) -> ty::Binder<'tcx, (ty::TraitRef<'tcx>, Ty<'tcx>)> { <del> debug_assert!(!self_ty.has_escaping_bound_vars()); </del> <ins> assert!(!self_ty.has_escaping_bound_vars()); </ins> let trait_ref = tcx.mk_trait_ref(fn_trait_def_id, [self_ty]); sig.map_bound(|sig| (trait_ref, sig.return_ty)) }


} <del> #[cfg(test)] mod bench; </del> <ins> #[cfg(test)] #[macro_use] mod bench; </ins> // FIXME(#14344) this shouldn't be necessary #[doc(hidden)]


<ins> // Regression test for https://github.com/rust-lang/rust/issues/43134 // check-pass // compile-flags: --cap-lints allow type Foo<T: Clone> = Option<T>; fn main() {} </ins>


fn parse_crate_mod(&mut self) -> Result<ast::Crate, ParserError> { let mut parser = AssertUnwindSafe(&mut self.parser); <del> match catch_unwind(move || parser.parse_crate_mod()) { Ok(Ok(k)) => Ok(k), Ok(Err(db)) => { </del> <ins> // rustfmt doesn't use `run_compiler` like other tools, so it must emit // any stashed diagnostics itself, otherwise the `DiagCtxt` will assert // when dropped. The final result here combines the parsing result and // the `emit_stashed_diagnostics` result. let parse_res = catch_unwind(move || parser.parse_crate_mod()); let stashed_res = self.parser.dcx().emit_stashed_diagnostics(); let err = Err(ParserError::ParsePanicError); match (parse_res, stashed_res) { (Ok(Ok(k)), None) => Ok(k), (Ok(Ok(_)), Some(_guar)) => err, (Ok(Err(db)), _) => { </ins> db.emit(); <del> Err(ParserError::ParseError) </del> <ins> err </ins> } <del> Err(_) => Err(ParserError::ParsePanicError), </del> <ins> (Err(_), _) => err, </ins> } } }


use use_from_trait_xc::Trait::foo; //~^ ERROR `foo` is not directly importable <ins> use use_from_trait_xc::Trait::Assoc; //~^ ERROR `Assoc` is not directly importable use use_from_trait_xc::Trait::CONST; //~^ ERROR `CONST` is not directly importable </ins> use use_from_trait_xc::Foo::new; //~^ ERROR `new` is not directly importable <ins> use use_from_trait_xc::Foo::C; //~^ ERROR unresolved import `use_from_trait_xc::Foo::C` </ins> use use_from_trait_xc::Bar::new as bnew; //~^ ERROR `bnew` is not directly importable


pub fn run_silent(cmd: &mut Command) { let status = match cmd.status() { Ok(status) => status, <del> Err(e) => fail(&format!("failed to execute command: {}", e)), </del> <ins> Err(e) => fail(&format!("failed to execute command: {:?}nerror: {}", cmd, e)), </ins> }; if !status.success() { fail(&format!("command did not execute successfully: {:?}n


/// /// # Examples /// ``` <del> /// #![feature(div_duration)] </del> /// use std::time::Duration; /// /// let dur1 = Duration::new(2, 700_000_000); /// let dur2 = Duration::new(5, 400_000_000); /// assert_eq!(dur1.div_duration_f64(dur2), 0.5); /// ``` <del> #[unstable(feature = "div_duration", issue = "63139")] </del> <ins> #[stable(feature = "div_duration", since = "CURRENT_RUSTC_VERSION")] </ins> #[must_use = "this returns the result of the operation,  without modifying the original"] #[inline] #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] pub const fn div_duration_f64(self, rhs: Duration) -> f64 { <del> self.as_secs_f64() / rhs.as_secs_f64() </del> <ins> let self_nanos = (self.secs as f64) * (NANOS_PER_SEC as f64) + (self.nanos.0 as f64); let rhs_nanos = (rhs.secs as f64) * (NANOS_PER_SEC as f64) + (rhs.nanos.0 as f64); self_nanos / rhs_nanos </ins> } /// Divide `Duration` by `Duration` and return `f32`. /// /// # Examples /// ``` <del> /// #![feature(div_duration)] </del> /// use std::time::Duration; /// /// let dur1 = Duration::new(2, 700_000_000); /// let dur2 = Duration::new(5, 400_000_000); /// assert_eq!(dur1.div_duration_f32(dur2), 0.5); /// ``` <del> #[unstable(feature = "div_duration", issue = "63139")] </del> <ins> #[stable(feature = "div_duration", since = "CURRENT_RUSTC_VERSION")] </ins> #[must_use = "this returns the result of the operation,  without modifying the original"] #[inline] #[rustc_const_unstable(feature = "duration_consts_float", issue = "72440")] pub const fn div_duration_f32(self, rhs: Duration) -> f32 { <del> self.as_secs_f32() / rhs.as_secs_f32() </del> <ins> let self_nanos = (self.secs as f32) * (NANOS_PER_SEC as f32) + (self.nanos.0 as f32); let rhs_nanos = (rhs.secs as f32) * (NANOS_PER_SEC as f32) + (rhs.nanos.0 as f32); self_nanos / rhs_nanos </ins> } }


<ins> // https://github.com/rust-lang/rust/issues/116796 struct X<const FN: fn() = { || {} }>; //~^ ERROR using function pointers as const generic parameters is forbidden fn main() {} </ins>


use rustc_middle::ty::{self, GenericArgKind, Ty, TyCtxt, TypeVisitableExt}; use rustc_span::def_id::DefIdSet; use rustc_span::symbol::{kw, sym, Ident}; <del> use rustc_span::Symbol; </del> use rustc_span::{edit_distance, ExpnKind, FileName, MacroKind, Span}; <ins> use rustc_span::{Symbol, DUMMY_SP}; </ins> use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::traits::error_reporting::on_unimplemented::OnUnimplementedNote; use rustc_trait_selection::traits::error_reporting::on_unimplemented::TypeErrCtxtExt as _;


def.variant_descr(), self.tcx.def_path_str(def.did) ) <del> .span_label(span, "private field") </del> <ins> .span_label(span, label) </ins> .emit(); } }


let rty = ccx.tcx.node_id_to_type(id); let fcx = FnCtxt::new(&inh, ty::FnConverging(rty), e.id); let declty = fcx.tcx.lookup_item_type(ccx.tcx.map.local_def_id(id)).ty; <ins> fcx.require_type_is_sized(declty, e.span, traits::ConstSized); </ins> fcx.check_const_with_ty(sp, e, declty); }); }


<del> // no-prefer-dynamic </del> #![feature(unsized_tuple_coercion)] static mut DROP_RAN: bool = false;


names } <ins> /// Returns a scope, plus `true` if that's a type scope for "class" methods, /// otherwise `false` for plain namespace scopes. </ins> fn get_containing_scope<'ll, 'tcx>( cx: &CodegenCx<'ll, 'tcx>, instance: Instance<'tcx>, <del> ) -> &'ll DIScope { </del> <ins> ) -> (&'ll DIScope, bool) { </ins> // First, let's see if this is a method within an inherent impl. Because // if yes, we want to make the result subroutine DIE a child of the // subroutine's self-type. <del> let self_type = cx.tcx.impl_of_method(instance.def_id()).and_then(|impl_def_id| { </del> <ins> if let Some(impl_def_id) = cx.tcx.impl_of_method(instance.def_id()) { </ins> // If the method does *not* belong to a trait, proceed if cx.tcx.trait_id_of_impl(impl_def_id).is_none() { let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions(


name_was_remapped: bool, unmapped_path: FileName, mut src: String, <del> start_pos: BytePos) -> SourceFile { </del> <ins> start_pos: BytePos) -> Result<SourceFile, OffsetOverflowError> { </ins> remove_bom(&mut src); let src_hash = {


<ins> error[E0658]: associated const equality is incomplete --> $DIR/dont-ice-on-assoc-projection.rs:15:32 | LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {} |                                ^^^^^^^^^ | = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable error[E0119]: conflicting implementations of trait `Foo` for type `()` --> $DIR/dont-ice-on-assoc-projection.rs:15:1 | LL | impl Foo for () {} | --------------- first implementation here LL | impl<T> Foo for T where T: Bar<ASSOC = 0> {} | ^^^^^^^^^^^^^^^^^ conflicting implementation for `()` error: aborting due to 2 previous errors Some errors have detailed explanations: E0119, E0658. For more information about an error, try `rustc --explain E0119`. </ins>


<ins> // ignore-tidy-linelength #![deny(intra_doc_resolution_failure)] pub mod char {} /// See also [type@char] // @has intra_link_prim_precedence/struct.MyString.html '//a/@href' 'https://doc.rust-lang.org/nightly/std/primitive.char.html' pub struct MyString; /// See also [char] // @has intra_link_prim_precedence/struct.MyString2.html '//a/@href' 'intra_link_prim_precedence/char/index.html' pub struct MyString2; </ins>


(accepted, impl_header_lifetime_elision, "1.31.0", Some(15872), None), // `extern crate foo as bar;` puts `bar` into extern prelude. (accepted, extern_crate_item_prelude, "1.31.0", Some(55599), None), <ins> // Allows use of the :literal macro fragment specifier (RFC 1576) (accepted, macro_literal_matcher, "1.31.0", Some(35625), None), </ins> ); // If you change this, please modify src/doc/unstable-book as well. You must


<ins> // normalize-stderr-test "error `.*`" -> "$$ERROR_MESSAGE" // compile-flags: -o/tmp/ -Zunpretty=ast-tree fn main() {} </ins>


<ins> // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. // aux-build:issue-25467.rs pub type Issue25467BarT = (); pub type Issue25467FooT = (); extern crate issue_25467 as aux; fn main() { let o: aux::Object = None; } </ins>


document(w, cx, it) } <ins> fn implementor2item<'a>(cache: &'a Cache, imp : &Implementor) -> Option<&'a clean::Item> { if let Some(t_did) = imp.impl_.for_.def_id() { if let Some(impl_item) = cache.impls.get(&t_did).and_then(|i| i.iter() .find(|i| i.impl_item.def_id == imp.def_id)) { let i = &impl_item.impl_item; return Some(i); } } None } </ins> fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, t: &clean::Trait) -> fmt::Result { let mut bounds = String::new();


//! paths/files is based on Microsoft's logic in their vcvars bat files, but //! comments can also be found below leading through the various code paths. <del> use std::process::Command; use session::Session; </del> #[cfg(windows)] mod registry; #[cfg(windows)] <del> pub fn link_exe_cmd(sess: &Session) -> Command { </del> <ins> mod platform { </ins> use std::env; use std::ffi::OsString; use std::fs; use std::path::{Path, PathBuf}; <del> use self::registry::{LOCAL_MACHINE}; let arch = &sess.target.target.arch; let (binsub, libsub, vclibsub) = match (bin_subdir(arch), lib_subdir(arch), vc_lib_subdir(arch)) { (Some(x), Some(y), Some(z)) => (x, y, z), _ => return Command::new("link.exe"), }; </del> <ins> use std::process::Command; use session::Session; use super::registry::{LOCAL_MACHINE}; </ins> <del> // First we need to figure out whether the environment is already correctly // configured by vcvars. We do this by looking at the environment variable // `VCINSTALLDIR` which is always set by vcvars, and unlikely to be set // otherwise. If it is defined, then we derive the path to `link.exe` from // that and trust that everything else is configured correctly. // // If `VCINSTALLDIR` wasn't defined (or we couldn't find the linker where it // claimed it should be), then we resort to finding everything ourselves. // First we find where the latest version of MSVC is installed and what // version it is. Then based on the version we find the appropriate SDKs. // // For MSVC 14 (VS 2015) we look for the Win10 SDK and failing that we look // for the Win8.1 SDK. We also look for the Universal CRT. // // For MSVC 12 (VS 2013) we look for the Win8.1 SDK. // // For MSVC 11 (VS 2012) we look for the Win8 SDK. // // For all other versions the user has to execute the appropriate vcvars bat // file themselves to configure the environment. // // If despite our best efforts we are still unable to find MSVC then we just // blindly call `link.exe` and hope for the best. return env::var_os("VCINSTALLDIR").and_then(|dir| { debug!("Environment already configured by user. Assuming it works."); let mut p = PathBuf::from(dir); p.push("bin"); p.push(binsub); p.push("link.exe"); if !p.is_file() { return None } Some(Command::new(p)) }).or_else(|| { get_vc_dir().and_then(|(ver, vcdir)| { debug!("Found VC installation directory {:?}", vcdir); let mut linker = vcdir.clone(); linker.push("bin"); linker.push(binsub); linker.push("link.exe"); if !linker.is_file() { return None } let mut cmd = Command::new(linker); add_lib(&mut cmd, &vcdir.join("lib").join(vclibsub)); if ver == "14.0" { if let Some(dir) = get_ucrt_dir() { debug!("Found Universal CRT {:?}", dir); add_lib(&mut cmd, &dir.join("ucrt").join(libsub)); } if let Some(dir) = get_sdk10_dir() { debug!("Found Win10 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } else if let Some(dir) = get_sdk81_dir() { debug!("Found Win8.1 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } } else if ver == "12.0" { if let Some(dir) = get_sdk81_dir() { debug!("Found Win8.1 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } } else { // ver == "11.0" if let Some(dir) = get_sdk8_dir() { debug!("Found Win8 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } } Some(cmd) </del> <ins> // Cross toolchains depend on dlls from the host toolchain // We can't just add it to the Command's PATH in `link_exe_cmd` because it // is later overridden so we publicly expose it here instead pub fn host_dll_path() -> Option<PathBuf> { get_vc_dir().and_then(|(_, vcdir)| { host_dll_subdir().map(|sub| { vcdir.join("bin").join(sub) }) </ins> }) <del> }).unwrap_or_else(|| { debug!("Failed to locate linker."); Command::new("link.exe") }); </del> <ins> } pub fn link_exe_cmd(sess: &Session) -> Command { let arch = &sess.target.target.arch; let (binsub, libsub, vclibsub) = match (bin_subdir(arch), lib_subdir(arch), vc_lib_subdir(arch)) { (Some(x), Some(y), Some(z)) => (x, y, z), _ => return Command::new("link.exe"), }; // First we need to figure out whether the environment is already correctly // configured by vcvars. We do this by looking at the environment variable // `VCINSTALLDIR` which is always set by vcvars, and unlikely to be set // otherwise. If it is defined, then we derive the path to `link.exe` from // that and trust that everything else is configured correctly. // // If `VCINSTALLDIR` wasn't defined (or we couldn't find the linker where it // claimed it should be), then we resort to finding everything ourselves. // First we find where the latest version of MSVC is installed and what // version it is. Then based on the version we find the appropriate SDKs. // // For MSVC 14 (VS 2015) we look for the Win10 SDK and failing that we look // for the Win8.1 SDK. We also look for the Universal CRT. // // For MSVC 12 (VS 2013) we look for the Win8.1 SDK. // // For MSVC 11 (VS 2012) we look for the Win8 SDK. // // For all other versions the user has to execute the appropriate vcvars bat // file themselves to configure the environment. // // If despite our best efforts we are still unable to find MSVC then we just // blindly call `link.exe` and hope for the best. return env::var_os("VCINSTALLDIR").and_then(|dir| { debug!("Environment already configured by user. Assuming it works."); let mut p = PathBuf::from(dir); p.push("bin"); p.push(binsub); p.push("link.exe"); if !p.is_file() { return None } Some(Command::new(p)) }).or_else(|| { get_vc_dir().and_then(|(ver, vcdir)| { debug!("Found VC installation directory {:?}", vcdir); let linker = vcdir.clone().join("bin").join(binsub).join("link.exe"); if !linker.is_file() { return None } let mut cmd = Command::new(linker); add_lib(&mut cmd, &vcdir.join("lib").join(vclibsub)); if ver == "14.0" { if let Some(dir) = get_ucrt_dir() { debug!("Found Universal CRT {:?}", dir); add_lib(&mut cmd, &dir.join("ucrt").join(libsub)); } if let Some(dir) = get_sdk10_dir() { debug!("Found Win10 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } else if let Some(dir) = get_sdk81_dir() { debug!("Found Win8.1 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } } else if ver == "12.0" { if let Some(dir) = get_sdk81_dir() { debug!("Found Win8.1 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } } else { // ver == "11.0" if let Some(dir) = get_sdk8_dir() { debug!("Found Win8 SDK {:?}", dir); add_lib(&mut cmd, &dir.join("um").join(libsub)); } } Some(cmd) }) }).unwrap_or_else(|| { debug!("Failed to locate linker."); Command::new("link.exe") }); } </ins> // A convenience function to make the above code simpler fn add_lib(cmd: &mut Command, lib: &Path) { let mut arg: OsString = "/LIBPATH:".into();


/// /// A common use for `format!` is concatenation and interpolation of strings. /// The same convention is used with [`print!`] and [`write!`] macros, <del> /// depending on the intended destination of the string. </del> <ins> /// depending on the intended destination of the string; all these macros internally use [`format_args!`]. </ins> /// /// To convert a single value to a string, use the [`to_string`] method. This /// will use the [`Display`] formatting trait. /// <ins> /// To concatenate literals into a `&'static str`, use the [`concat!`] macro. /// </ins> /// [`print!`]: ../std/macro.print.html /// [`write!`]: core::write <ins> /// [`format_args!`]: core::format_args </ins> /// [`to_string`]: crate::string::ToString /// [`Display`]: core::fmt::Display <ins> /// [`concat!`]: core::concat </ins> /// /// # Panics ///


/// Returns an operand suitable for use until the end of the current /// scope expression. /// <del> /// The operand returned from this function will *not be valid* after /// an ExprKind::Scope is passed, so please do *not* return it from /// functions to avoid bad miscompiles. </del> <ins> /// The operand returned from this function will *not be valid* /// after the current enclosing `ExprKind::Scope` has ended, so /// please do *not* return it from functions to avoid bad /// miscompiles. </ins> crate fn as_local_operand<M>(&mut self, block: BasicBlock, expr: M) -> BlockAnd<Operand<'tcx>> where M: Mirror<'tcx, Output = Expr<'tcx>>,


// killed, rather than having an error bubble up and cause a panic. cargo.rustflag("-Zon-broken-pipe=kill"); <ins> if builder.config.llvm_enzyme { cargo.rustflag("-l").rustflag("Enzyme-19"); } </ins> // We currently don't support cross-crate LTO in stage0. This also isn't hugely necessary // and may just be a time sink. if compiler.stage != 0 {


); err } <del> infer::ReborrowUpvar(span, ref upvar_id) => { let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id); let mut err = struct_span_err!( self.tcx.sess, span, E0313, "lifetime of borrowed pointer outlives lifetime of captured variable `{}`...", var_name ); note_and_explain_region( self.tcx, &mut err, "...the borrowed pointer is valid for ", sub, "...", None, ); note_and_explain_region( self.tcx, &mut err, &format!("...but `{}` is only valid for ", var_name), sup, "", None, ); err } </del> infer::RelateObjectBound(span) => { let mut err = struct_span_err!( self.tcx.sess,


self.sess.gated_spans.gate(sym::const_extern_fn, lo.to(self.token.span)); } let ext = self.parse_extern()?; <del> self.bump(); // `fn` </del> <ins> self.expect_keyword(kw::Fn)?; </ins> let header = FnHeader { unsafety,


fn collect_attr_proc_macro(&mut self, item: &'a ast::Item) { if self.in_root && item.vis.node.is_pub() { <del> self.attr_macros.push(ProcMacroDef { </del> <ins> self.macros.push(ProcMacro::Def(ProcMacroDef { </ins> span: item.span, function_name: item.ident, <del> }); </del> <ins> def_type: ProcMacroDefType::Attr })); </ins> } else { let msg = if !self.in_root { "functions tagged with `#[proc_macro_attribute]` must


<ins> error: generic parameters may not be used in const operations --> $DIR/size-of-t.rs:7:30 | LL |     let _arr: [u8; size_of::<T>()]; |                              ^ cannot perform const operation using `T` | = note: type parameters may not be used in const expressions = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: aborting due to previous error </ins>


RelateParamBound(a, ..) => a, RelateRegionParamBound(a) => a, Reborrow(a) => a, <del> ReborrowUpvar(a, _) => a, </del> DataBorrowed(_, a) => a, ReferenceOutlivesReferent(_, a) => a, CompareImplItemObligation { span, .. } => span,


} } <ins> // This is required by the compiler to exist (e.g., it's a lang item), but it's // never actually called by the compiler.  Emscripten EH doesn't use a // personality function at all, it instead uses __cxa_find_matching_catch. // Wasm error handling would use __gxx_personality_wasm0. </ins> #[lang = "eh_personality"] unsafe extern "C" fn rust_eh_personality( <del> version: c_int, actions: uw::_Unwind_Action, exception_class: uw::_Unwind_Exception_Class, exception_object: *mut uw::_Unwind_Exception, context: *mut uw::_Unwind_Context, </del> <ins> _version: c_int, _actions: uw::_Unwind_Action, _exception_class: uw::_Unwind_Exception_Class, _exception_object: *mut uw::_Unwind_Exception, _context: *mut uw::_Unwind_Context, </ins> ) -> uw::_Unwind_Reason_Code { <del> __gxx_personality_v0(version, actions, exception_class, exception_object, context) </del> <ins> core::intrinsics::abort() </ins> } extern "C" {


scope 1 { debug self => _4;                // in scope 1 at $SRC_DIR/liballoc/boxed.rs:LL:COL let mut _5: &mut T;              // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15 <ins> let mut _6: &mut T;              // in scope 1 at $DIR/issue-58867-inline-as-ref-as-mut.rs:8:5: 8:15 </ins> } bb0: {


<ins> error[E0425]: cannot find value `a` in this scope --> $DIR/issue-92100.rs:5:10 | LL |         [a.., a] => {} |          ^ not found in this scope error: aborting due to previous error For more information about this error, try `rustc --explain E0425`. </ins>


let mut param_env = obligation.param_env; fresh_trait_pred = fresh_trait_pred.map_bound(|mut pred| { <del> param_env = param_env.with_constness(pred.constness.and(param_env.constness())); </del> <ins> pred.remap_constness(self.tcx(), &mut param_env); </ins> pred });


// the `type_of` of the trait's associated item. If we're using the old lowering // strategy, then just reinterpret the associated type like an opaque :^) let default_ty = if self.tcx.lower_impl_trait_in_trait_to_assoc_ty() { <del> self .tcx .type_of(alias_ty.def_id) .subst(self.tcx, alias_ty.substs) </del> <ins> self.tcx.type_of(shifted_alias_ty.def_id).subst(self.tcx, shifted_alias_ty.substs) </ins> } else { <del> self.tcx.mk_alias(ty::Opaque, alias_ty) </del> <ins> self.tcx.mk_alias(ty::Opaque, shifted_alias_ty) </ins> }; self.predicates.push( ty::Binder::bind_with_vars( <del> ty::ProjectionPredicate { projection_ty: alias_ty, term: default_ty.into(), }, </del> <ins> ty::ProjectionPredicate { projection_ty: shifted_alias_ty, term: default_ty.into() }, </ins> self.bound_vars, ) .to_predicate(self.tcx), ); <del> for bound in self.tcx.item_bounds(alias_ty.def_id).subst_iter(self.tcx, alias_ty.substs) </del> <ins> // We walk the *un-shifted* alias ty, because we're tracking the de bruijn // binder depth, and if we were to walk `shifted_alias_ty` instead, we'd // have to reset `self.depth` back to `ty::INNERMOST` or something. It's // easier to just do this. for bound in self .tcx .item_bounds(unshifted_alias_ty.def_id) .subst_iter(self.tcx, unshifted_alias_ty.substs) </ins> { bound.visit_with(self); }


pub struct Context<'a> { waker: &'a Waker, local_waker: &'a LocalWaker, <del> ext: ExtData<'a>, </del> <ins> ext: AssertUnwindSafe<ExtData<'a>>, </ins> // Ensure we future-proof against variance changes by forcing // the lifetime to be invariant (argument-position lifetimes // are contravariant while return-position lifetimes are


<ins> // Test that async fn works when nested inside of // impls with lifetime parameters. // // check-pass // edition:2018 #![feature(async_await)] struct Foo<'a>(&'a ()); impl<'a> Foo<'a> { fn test() { async fn test() {} } } fn main() { } </ins>


<ins> #![feature(const_raw_ptr_to_usize_cast)] const BAR: *mut () = ((|| 3) as fn() -> i32) as *mut (); pub const FOO: usize = unsafe { BAR as usize }; //~^ ERROR it is undefined behavior to use this value fn main() {} </ins>


MD->addOperand(Unit); } <ins> extern "C" void LLVMRustThinLTORemoveAvailableExternally(LLVMModuleRef Mod) { Module *M = unwrap(Mod); for (Function &F : M->functions()) { if (F.hasAvailableExternallyLinkage()) F.deleteBody(); } } </ins> #else extern "C" bool


// Otherwise it's a span with wrong macro expansion info, which // we don't want to track anyway, since it's probably macro-internal `use` <del> if let Some(sub_span) = self.span.sub_span_of_token(item.span, token::BinOp(token::Star)) { </del> <ins> if let Some(sub_span) = self.span.sub_span_of_star(item.span) { </ins> if !self.span.filter_generated(item.span) { let access = access_from!(self.save_ctxt, item, item.hir_id); let span = self.span_from_span(sub_span);


linker_flavor: LinkerFlavor::Gcc, options: TargetOptions { <del> features: "+v6,+vfp2".to_string(), </del> <ins> features: "+v6,+vfp2,-d32".to_string(), </ins> abi_blacklist: super::arm_base::abi_blacklist(), target_mcount: "__mcount".to_string(), .. base


<ins> // Copyright 2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. use std::env; use std::fs::{self, TempDir}; fn main() { let td = TempDir::new("create-dir-all-bare").unwrap(); env::set_current_dir(td.path()).unwrap(); fs::create_dir_all("create-dir-all-bare").unwrap(); } </ins>


")?; for implementor in foreign { <del> // need to get from a clean::Impl to a clean::Item so i can use render_impl if let Some(t_did) = implementor.impl_.for_.def_id() { if let Some(impl_item) = cache.impls.get(&t_did).and_then(|i| i.iter() .find(|i| i.impl_item.def_id == implementor.def_id)) { let i = &impl_item.impl_item; let impl_ = Impl { impl_item: i.clone() }; let assoc_link = AssocItemLink::GotoSource( i.def_id, &implementor.impl_.provided_trait_methods ); render_impl(w, cx, &impl_, assoc_link, RenderMode::Normal, i.stable_since(), false)?; } </del> <ins> if let Some(i) = implementor2item(&cache, implementor) { let impl_ = Impl { impl_item: i.clone() }; let assoc_link = AssocItemLink::GotoSource( i.def_id, &implementor.impl_.provided_trait_methods ); render_impl(w, cx, &impl_, assoc_link, RenderMode::Normal, i.stable_since(), false)?; </ins> } } }


<ins> error[E0070]: invalid left-hand side of assignment --> $DIR/issue-93486.rs:3:36 | LL |         vec![].last_mut().unwrap() = 3_u8; |         -------------------------- ^ |         | |         cannot assign to this expression error: aborting due to previous error For more information about this error, try `rustc --explain E0070`. </ins>


<ins> //@ edition:2024 //@ compile-flags: -Zunstable-options #![feature(gen_blocks)] const gen fn a() {} //~^ ERROR functions cannot be both `const` and `gen` const async gen fn b() {} //~^ ERROR functions cannot be both `const` and `async gen` fn main() {} </ins>


<ins> error[E0567]: auto traits cannot have generic parameters --> $DIR/issue-117789.rs:3:17 | LL | auto trait Trait<P> {} |            -----^^^ help: remove the parameters |            | |            auto trait cannot have generic parameters error[E0658]: auto traits are experimental and possibly buggy --> $DIR/issue-117789.rs:3:1 | LL | auto trait Trait<P> {} | ^^^^^^^^^^^^^^^^^^^^^^ | = note: see issue #13231 <https://github.com/rust-lang/rust/issues/13231> for more information = help: add `#![feature(auto_traits)]` to the crate attributes to enable error: aborting due to 2 previous errors Some errors have detailed explanations: E0567, E0658. For more information about an error, try `rustc --explain E0567`. </ins>


LL | fn d<'a, const C: S<'a>>() {} |      +++           ++++ <ins> error[E0771]: use of non-static lifetime `'a` in const generic --> $DIR/unusual-rib-combinations.rs:29:22 | LL | struct Bar<const N: &'a (dyn for<'a> Foo<'a>)>; |                      ^^ | = note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052> </ins> error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/unusual-rib-combinations.rs:7:16 |


<ins> // run-pass // edition:2021 struct Props { field_1: u32, //~ WARNING: field is never read: `field_1` field_2: u32, //~ WARNING: field is never read: `field_2` } fn main() { // Test 1 let props_2 = Props { //~ WARNING: unused variable: `props_2` field_1: 1, field_2: 1, }; let _ = || { let _: Props = props_2; }; // Test 2 let mut arr = [1, 3, 4, 5]; let mref = &mut arr; let _c = || match arr { [_, _, _, _] => println!("A") }; println!("{:#?}", mref); } </ins>


<ins> // edition:2021 #![feature(type_alias_impl_trait)] struct CallMe; type ReturnType<'a> = impl std::future::Future<Output = u32> + 'a; type FnType = impl Fn(&u32) -> ReturnType; impl std::ops::Deref for CallMe { type Target = FnType; fn deref(&self) -> &Self::Target { fn inner(val: &u32) -> ReturnType { async move { *val * 2 } } &inner //~ ERROR: expected generic lifetime parameter, found `'_` } } fn main() {} </ins>


<ins> // Regression test for issue #124935 // Tests that we do not erroneously emit an error about // missing main function when the mod starts with a `;` ; //~ ERROR expected item, found `;` fn main() { } </ins>


<ins> error: invalid label name `'static` --> $DIR/issue-52437.rs:2:13 | LL |     [(); &(&'static: loop { |x| {}; }) as *const _ as usize] |             ^^^^^^^ error[E0282]: type annotations needed --> $DIR/issue-52437.rs:2:30 | LL |     [(); &(&'static: loop { |x| {}; }) as *const _ as usize] |                              ^ consider giving this closure parameter a type error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0282`. </ins>