From e97f104da64d047c919fc2fccf720efd46f30261 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Wed, 11 Jan 2017 16:28:23 +0200 Subject: Fix two const-eval issues related to i128 negation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit First issue here was the fact that we’d only allow negating integers in i64 range in case the integer was not infered yes. While this is not the direct cause of the issue, its still good to fix it. The real issue here is the code handling specifically the `min_value` literals. While I128_OVERFLOW has the expected value (0x8000_..._0000), match using this value as a pattern is handled incorrectly by the stage1 compiler (it seems to be handled correctly, by the stage2 compiler). So what we do here is extract this pattern into an explicit `==` until the next snapshot. Fixes #38987 --- src/test/run-pass/issue-38987.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/test/run-pass/issue-38987.rs (limited to 'src/test') diff --git a/src/test/run-pass/issue-38987.rs b/src/test/run-pass/issue-38987.rs new file mode 100644 index 00000000000..a513476d4a3 --- /dev/null +++ b/src/test/run-pass/issue-38987.rs @@ -0,0 +1,14 @@ +// Copyright 2017 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![feature(i128_type)] + +fn main() { + let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128; +} -- cgit 1.4.1-3-g733a5