Change:
apint fails to compile (https://crater-) on beta. Note that the crate must be compiled in test mode.
cc -- I believe this is your crate, though it seems plausible this is a bug in the compiler
cc -- beta/stable regression, would be good to proactively triage before meeting if possible
Could this be promotion-related?
Yea. The call to on arrays does not actually do what it advertises, it derefs to a slice and then does . We stopped allowing const fns in promoteds is still marked as promotable, so that shouldn't be the issue. I'll investigate later today when I get back to a PC
yeah that's my crate thanks for linking! I have already stumbled upon this CI error but couldn't yet find time to wrap my head around it. Though I thought it was a bug in a former version of the borrow checker that now got fixed. So if I understood correctly simply using a instead of plain would solve that issue? Maybe we should reiterate on this design for on arrays if that's the case. :D
minimal repro Nope, it's a new bug that I was sure we had regression tests against.
This was injected between rustc 1.31.0-nightly ( 2018-10-03) and rustc 1.31.0-nightly ( 2018-10-04) Log of bors commits in that time in the details block <details% git log .. --author bors --format=oneline Auto merge of - nikomatsakis:universes-refactor-1, r=scalexm Auto merge of - matthewjasper:mir-function-spans, r=pnkfelix Auto merge of - Manishearth:clippyup, r=oli-obk Auto merge of - pietroalbini:rollup, r=pietroalbini Auto merge of - christianpoveda:master, r=kennytm Auto merge of - oli-obk:local_promotion, r=eddyb Auto merge of - arielb1:evaluate-outlives, r=nikomatsakis Auto merge of - KiChjang:issue-, r=nikomatsakis Auto merge of - davidtwco:issue-, r=petrochenkov </details
Hmm I wonder if this could somehow be a consequence fo ...? update: probably not, since this afflicts both AST-borrowck and MIR-borrowck.
Full diff: (limiting promotability of const fns) also fell in there.
I even unit tests, but never any for promoting functions from the libstd. will only work if a function call is promoted in the same crate where the function is declared. I think the solution is to make the const qualifier eagerly call while a function is qualified to cache the result (in the query engine), so that the query is never evaluated in the perspective of another crate (and add an ) to to safeguard against messing this up
Discussed a bit with and investigated independently. Some details of note: The implementation of relies on . If you don't have the latter, the former will essentially be silently ignored, AFAICT. It seems like there are some holes in 's analysis above. In particular, I attempted to make a unit test with multiple crates, and it seemed like promotion was still happening. See here:
reassigning to for followup investigation and hopefully fixing.

Discussion:
", $Feature, "assert_eq!(", stringify!($SelfT), "::min_value(), 0);", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] <ins> #[rustc_promotable] </ins> #[inline] pub const fn min_value() -> Self { 0 } }

stringify!($MaxV), ");", $EndFeature, " ```"), #[stable(feature = "rust1", since = "1.0.0")] <ins> #[rustc_promotable] </ins> #[inline] pub const fn max_value() -> Self { !0 } }

<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. // Crate that exports a const fn. Used for testing cross-crate. #![feature(staged_api, rustc_attrs)] #![stable(since="1.0.0", feature = "mep")] #![crate_type="rlib"] #[rustc_promotable] #[stable(since="1.0.0", feature = "mep")] #[inline] pub const fn foo() -> usize { 22 } #[stable(since="1.0.0", feature = "mep")] pub struct Foo(usize); impl Foo { #[stable(since="1.0.0", feature = "mep")] #[inline] #[rustc_promotable] pub const fn foo() -> usize { 22 } } </ins>

<ins> // compile-pass // aux-build:promotable_const_fn_lib.rs #![feature(nll)] extern crate promotable_const_fn_lib; use promotable_const_fn_lib::{foo, Foo}; fn main() { let x: &'static usize = &foo(); let x: &'static usize = &Foo::foo(); } </ins>

<ins> // compile-pass #![feature(nll)] fn main() { let x: &'static u8 = &u8::max_value(); let x: &'static u16 = &u16::max_value(); let x: &'static u32 = &u32::max_value(); let x: &'static u64 = &u64::max_value(); let x: &'static u128 = &u128::max_value(); let x: &'static usize = &usize::max_value(); let x: &'static u8 = &u8::min_value(); let x: &'static u16 = &u16::min_value(); let x: &'static u32 = &u32::min_value(); let x: &'static u64 = &u64::min_value(); let x: &'static u128 = &u128::min_value(); let x: &'static usize = &usize::min_value(); let x: &'static i8 = &i8::max_value(); let x: &'static i16 = &i16::max_value(); let x: &'static i32 = &i32::max_value(); let x: &'static i64 = &i64::max_value(); let x: &'static i128 = &i128::max_value(); let x: &'static isize = &isize::max_value(); let x: &'static i8 = &i8::min_value(); let x: &'static i16 = &i16::min_value(); let x: &'static i32 = &i32::min_value(); let x: &'static i64 = &i64::min_value(); let x: &'static i128 = &i128::min_value(); let x: &'static isize = &isize::min_value(); } </ins>