diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-09-06 14:36:26 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-09-06 14:36:26 +0200 |
| commit | 76ceeddb2b6fd4589cf8292d8dafa65a91ace019 (patch) | |
| tree | 11106836a5a37fc73a209a905786431ea0f10117 /src/test/run-pass/ctfe | |
| parent | 20ca02569ae3e1dc29962e92739fbab632abf241 (diff) | |
Migrated remaining `src/test/run-pass/` subdirectories to `src/test/ui/run-pass/`.
Diffstat (limited to 'src/test/run-pass/ctfe')
21 files changed, 0 insertions, 855 deletions
diff --git a/src/test/run-pass/ctfe/assoc-const.rs b/src/test/run-pass/ctfe/assoc-const.rs deleted file mode 100644 index 6a740dc1dd3..00000000000 --- a/src/test/run-pass/ctfe/assoc-const.rs +++ /dev/null @@ -1,28 +0,0 @@ -// 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 <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. - -trait Nat { - const VALUE: usize; -} - -struct Zero; -struct Succ<N>(N); - -impl Nat for Zero { - const VALUE: usize = 0; -} - -impl<N: Nat> Nat for Succ<N> { - const VALUE: usize = N::VALUE + 1; -} - -fn main() { - let x: [i32; <Succ<Succ<Succ<Succ<Zero>>>>>::VALUE] = [1, 2, 3, 4]; -} diff --git a/src/test/run-pass/ctfe/bswap-const.rs b/src/test/run-pass/ctfe/bswap-const.rs deleted file mode 100644 index b951a9b72b1..00000000000 --- a/src/test/run-pass/ctfe/bswap-const.rs +++ /dev/null @@ -1,23 +0,0 @@ -// 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 <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. - -#![feature(core_intrinsics)] - -use std::intrinsics; - -const SWAPPED_U8: u8 = unsafe { intrinsics::bswap(0x12_u8) }; -const SWAPPED_U16: u16 = unsafe { intrinsics::bswap(0x12_34_u16) }; -const SWAPPED_I32: i32 = unsafe { intrinsics::bswap(0x12_34_56_78_i32) }; - -fn main() { - assert_eq!(SWAPPED_U8, 0x12); - assert_eq!(SWAPPED_U16, 0x34_12); - assert_eq!(SWAPPED_I32, 0x78_56_34_12); -} diff --git a/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs b/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs deleted file mode 100644 index 813dd5fbb99..00000000000 --- a/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs +++ /dev/null @@ -1,364 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/34997 - -pub const CST_1: u32 = 0; -pub const CST_2: u32 = CST_1+1; -pub const CST_3: u32 = CST_2+1; -pub const CST_4: u32 = CST_3+1; -pub const CST_5: u32 = CST_4+1; -pub const CST_6: u32 = CST_5+1; -pub const CST_7: u32 = CST_6+1; -pub const CST_8: u32 = CST_7+1; -pub const CST_9: u32 = CST_8+1; -pub const CST_10: u32 = CST_9+1; -pub const CST_11: u32 = CST_10+1; -pub const CST_12: u32 = CST_11+1; -pub const CST_13: u32 = CST_12+1; -pub const CST_14: u32 = CST_13+1; -pub const CST_15: u32 = CST_14+1; -pub const CST_16: u32 = CST_15+1; -pub const CST_17: u32 = CST_16+1; -pub const CST_18: u32 = CST_17+1; -pub const CST_19: u32 = CST_18+1; -pub const CST_20: u32 = CST_19+1; -pub const CST_21: u32 = CST_20+1; -pub const CST_22: u32 = CST_21+1; -pub const CST_23: u32 = CST_22+1; -pub const CST_24: u32 = CST_23+1; -pub const CST_25: u32 = CST_24+1; -pub const CST_26: u32 = CST_25+1; -pub const CST_27: u32 = CST_26+1; -pub const CST_28: u32 = CST_27+1; -pub const CST_29: u32 = CST_28+1; -pub const CST_30: u32 = CST_29+1; -pub const CST_31: u32 = CST_30+1; -pub const CST_32: u32 = CST_31+1; -pub const CST_33: u32 = CST_32+1; -pub const CST_34: u32 = CST_33+1; -pub const CST_35: u32 = CST_34+1; -pub const CST_36: u32 = CST_35+1; -pub const CST_37: u32 = CST_36+1; -pub const CST_38: u32 = CST_37+1; -pub const CST_39: u32 = CST_38+1; -pub const CST_40: u32 = CST_39+1; -pub const CST_41: u32 = CST_40+1; -pub const CST_42: u32 = CST_41+1; -pub const CST_43: u32 = CST_42+1; -pub const CST_44: u32 = CST_43+1; -pub const CST_45: u32 = CST_44+1; -pub const CST_46: u32 = CST_45+1; -pub const CST_47: u32 = CST_46+1; -pub const CST_48: u32 = CST_47+1; -pub const CST_49: u32 = CST_48+1; -pub const CST_50: u32 = CST_49+1; -pub const CST_51: u32 = CST_50+1; -pub const CST_52: u32 = CST_51+1; -pub const CST_53: u32 = CST_52+1; -pub const CST_54: u32 = CST_53+1; -pub const CST_55: u32 = CST_54+1; -pub const CST_56: u32 = CST_55+1; -pub const CST_57: u32 = CST_56+1; -pub const CST_58: u32 = CST_57+1; -pub const CST_59: u32 = CST_58+1; -pub const CST_60: u32 = CST_59+1; -pub const CST_61: u32 = CST_60+1; -pub const CST_62: u32 = CST_61+1; -pub const CST_63: u32 = CST_62+1; -pub const CST_64: u32 = CST_63+1; -pub const CST_65: u32 = CST_64+1; -pub const CST_66: u32 = CST_65+1; -pub const CST_67: u32 = CST_66+1; -pub const CST_68: u32 = CST_67+1; -pub const CST_69: u32 = CST_68+1; -pub const CST_70: u32 = CST_69+1; -pub const CST_71: u32 = CST_70+1; -pub const CST_72: u32 = CST_71+1; -pub const CST_73: u32 = CST_72+1; -pub const CST_74: u32 = CST_73+1; -pub const CST_75: u32 = CST_74+1; -pub const CST_76: u32 = CST_75+1; -pub const CST_77: u32 = CST_76+1; -pub const CST_78: u32 = CST_77+1; -pub const CST_79: u32 = CST_78+1; -pub const CST_80: u32 = CST_79+1; -pub const CST_81: u32 = CST_80+1; -pub const CST_82: u32 = CST_81+1; -pub const CST_83: u32 = CST_82+1; -pub const CST_84: u32 = CST_83+1; -pub const CST_85: u32 = CST_84+1; -pub const CST_86: u32 = CST_85+1; -pub const CST_87: u32 = CST_86+1; -pub const CST_88: u32 = CST_87+1; -pub const CST_89: u32 = CST_88+1; -pub const CST_90: u32 = CST_89+1; -pub const CST_91: u32 = CST_90+1; -pub const CST_92: u32 = CST_91+1; -pub const CST_93: u32 = CST_92+1; -pub const CST_94: u32 = CST_93+1; -pub const CST_95: u32 = CST_94+1; -pub const CST_96: u32 = CST_95+1; -pub const CST_97: u32 = CST_96+1; -pub const CST_98: u32 = CST_97+1; -pub const CST_99: u32 = CST_98+1; -pub const CST_100: u32 = CST_99+1; -pub const CST_101: u32 = CST_100+1; -pub const CST_102: u32 = CST_101+1; -pub const CST_103: u32 = CST_102+1; -pub const CST_104: u32 = CST_103+1; -pub const CST_105: u32 = CST_104+1; -pub const CST_106: u32 = CST_105+1; -pub const CST_107: u32 = CST_106+1; -pub const CST_108: u32 = CST_107+1; -pub const CST_109: u32 = CST_108+1; -pub const CST_110: u32 = CST_109+1; -pub const CST_111: u32 = CST_110+1; -pub const CST_112: u32 = CST_111+1; -pub const CST_113: u32 = CST_112+1; -pub const CST_114: u32 = CST_113+1; -pub const CST_115: u32 = CST_114+1; -pub const CST_116: u32 = CST_115+1; -pub const CST_117: u32 = CST_116+1; -pub const CST_118: u32 = CST_117+1; -pub const CST_119: u32 = CST_118+1; -pub const CST_120: u32 = CST_119+1; -pub const CST_121: u32 = CST_120+1; -pub const CST_122: u32 = CST_121+1; -pub const CST_123: u32 = CST_122+1; -pub const CST_124: u32 = CST_123+1; -pub const CST_125: u32 = CST_124+1; -pub const CST_126: u32 = CST_125+1; -pub const CST_127: u32 = CST_126+1; -pub const CST_128: u32 = CST_127+1; -pub const CST_129: u32 = CST_128+1; -pub const CST_130: u32 = CST_129+1; -pub const CST_131: u32 = CST_130+1; -pub const CST_132: u32 = CST_131+1; -pub const CST_133: u32 = CST_132+1; -pub const CST_134: u32 = CST_133+1; -pub const CST_135: u32 = CST_134+1; -pub const CST_136: u32 = CST_135+1; -pub const CST_137: u32 = CST_136+1; -pub const CST_138: u32 = CST_137+1; -pub const CST_139: u32 = CST_138+1; -pub const CST_140: u32 = CST_139+1; -pub const CST_141: u32 = CST_140+1; -pub const CST_142: u32 = CST_141+1; -pub const CST_143: u32 = CST_142+1; -pub const CST_144: u32 = CST_143+1; -pub const CST_145: u32 = CST_144+1; -pub const CST_146: u32 = CST_145+1; -pub const CST_147: u32 = CST_146+1; -pub const CST_148: u32 = CST_147+1; -pub const CST_149: u32 = CST_148+1; -pub const CST_150: u32 = CST_149+1; -pub const CST_151: u32 = CST_150+1; -pub const CST_152: u32 = CST_151+1; -pub const CST_153: u32 = CST_152+1; -pub const CST_154: u32 = CST_153+1; -pub const CST_155: u32 = CST_154+1; -pub const CST_156: u32 = CST_155+1; -pub const CST_157: u32 = CST_156+1; -pub const CST_158: u32 = CST_157+1; -pub const CST_159: u32 = CST_158+1; -pub const CST_160: u32 = CST_159+1; -pub const CST_161: u32 = CST_160+1; -pub const CST_162: u32 = CST_161+1; -pub const CST_163: u32 = CST_162+1; -pub const CST_164: u32 = CST_163+1; -pub const CST_165: u32 = CST_164+1; -pub const CST_166: u32 = CST_165+1; -pub const CST_167: u32 = CST_166+1; -pub const CST_168: u32 = CST_167+1; -pub const CST_169: u32 = CST_168+1; -pub const CST_170: u32 = CST_169+1; -pub const CST_171: u32 = CST_170+1; -pub const CST_172: u32 = CST_171+1; -pub const CST_173: u32 = CST_172+1; -pub const CST_174: u32 = CST_173+1; -pub const CST_175: u32 = CST_174+1; -pub const CST_176: u32 = CST_175+1; -pub const CST_177: u32 = CST_176+1; -pub const CST_178: u32 = CST_177+1; -pub const CST_179: u32 = CST_178+1; -pub const CST_180: u32 = CST_179+1; -pub const CST_181: u32 = CST_180+1; -pub const CST_182: u32 = CST_181+1; -pub const CST_183: u32 = CST_182+1; -pub const CST_184: u32 = CST_183+1; -pub const CST_185: u32 = CST_184+1; -pub const CST_186: u32 = CST_185+1; -pub const CST_187: u32 = CST_186+1; -pub const CST_188: u32 = CST_187+1; -pub const CST_189: u32 = CST_188+1; -pub const CST_190: u32 = CST_189+1; -pub const CST_191: u32 = CST_190+1; -pub const CST_192: u32 = CST_191+1; -pub const CST_193: u32 = CST_192+1; -pub const CST_194: u32 = CST_193+1; -pub const CST_195: u32 = CST_194+1; -pub const CST_196: u32 = CST_195+1; -pub const CST_197: u32 = CST_196+1; -pub const CST_198: u32 = CST_197+1; -pub const CST_199: u32 = CST_198+1; -pub const CST_200: u32 = CST_199+1; -pub const CST_201: u32 = CST_200+1; -pub const CST_202: u32 = CST_201+1; -pub const CST_203: u32 = CST_202+1; -pub const CST_204: u32 = CST_203+1; -pub const CST_205: u32 = CST_204+1; -pub const CST_206: u32 = CST_205+1; -pub const CST_207: u32 = CST_206+1; -pub const CST_208: u32 = CST_207+1; -pub const CST_209: u32 = CST_208+1; -pub const CST_210: u32 = CST_209+1; -pub const CST_211: u32 = CST_210+1; -pub const CST_212: u32 = CST_211+1; -pub const CST_213: u32 = CST_212+1; -pub const CST_214: u32 = CST_213+1; -pub const CST_215: u32 = CST_214+1; -pub const CST_216: u32 = CST_215+1; -pub const CST_217: u32 = CST_216+1; -pub const CST_218: u32 = CST_217+1; -pub const CST_219: u32 = CST_218+1; -pub const CST_220: u32 = CST_219+1; -pub const CST_221: u32 = CST_220+1; -pub const CST_222: u32 = CST_221+1; -pub const CST_223: u32 = CST_222+1; -pub const CST_224: u32 = CST_223+1; -pub const CST_225: u32 = CST_224+1; -pub const CST_226: u32 = CST_225+1; -pub const CST_227: u32 = CST_226+1; -pub const CST_228: u32 = CST_227+1; -pub const CST_229: u32 = CST_228+1; -pub const CST_230: u32 = CST_229+1; -pub const CST_231: u32 = CST_230+1; -pub const CST_232: u32 = CST_231+1; -pub const CST_233: u32 = CST_232+1; -pub const CST_234: u32 = CST_233+1; -pub const CST_235: u32 = CST_234+1; -pub const CST_236: u32 = CST_235+1; -pub const CST_237: u32 = CST_236+1; -pub const CST_238: u32 = CST_237+1; -pub const CST_239: u32 = CST_238+1; -pub const CST_240: u32 = CST_239+1; -pub const CST_241: u32 = CST_240+1; -pub const CST_242: u32 = CST_241+1; -pub const CST_243: u32 = CST_242+1; -pub const CST_244: u32 = CST_243+1; -pub const CST_245: u32 = CST_244+1; -pub const CST_246: u32 = CST_245+1; -pub const CST_247: u32 = CST_246+1; -pub const CST_248: u32 = CST_247+1; -pub const CST_249: u32 = CST_248+1; -pub const CST_250: u32 = CST_249+1; -pub const CST_251: u32 = CST_250+1; -pub const CST_252: u32 = CST_251+1; -pub const CST_253: u32 = CST_252+1; -pub const CST_254: u32 = CST_253+1; -pub const CST_255: u32 = CST_254+1; -pub const CST_256: u32 = CST_255+1; -pub const CST_257: u32 = CST_256+1; -pub const CST_258: u32 = CST_257+1; -pub const CST_259: u32 = CST_258+1; -pub const CST_260: u32 = CST_259+1; -pub const CST_261: u32 = CST_260+1; -pub const CST_262: u32 = CST_261+1; -pub const CST_263: u32 = CST_262+1; -pub const CST_264: u32 = CST_263+1; -pub const CST_265: u32 = CST_264+1; -pub const CST_266: u32 = CST_265+1; -pub const CST_267: u32 = CST_266+1; -pub const CST_268: u32 = CST_267+1; -pub const CST_269: u32 = CST_268+1; -pub const CST_270: u32 = CST_269+1; -pub const CST_271: u32 = CST_270+1; -pub const CST_272: u32 = CST_271+1; -pub const CST_273: u32 = CST_272+1; -pub const CST_274: u32 = CST_273+1; -pub const CST_275: u32 = CST_274+1; -pub const CST_276: u32 = CST_275+1; -pub const CST_277: u32 = CST_276+1; -pub const CST_278: u32 = CST_277+1; -pub const CST_279: u32 = CST_278+1; -pub const CST_280: u32 = CST_279+1; -pub const CST_281: u32 = CST_280+1; -pub const CST_282: u32 = CST_281+1; -pub const CST_283: u32 = CST_282+1; -pub const CST_284: u32 = CST_283+1; -pub const CST_285: u32 = CST_284+1; -pub const CST_286: u32 = CST_285+1; -pub const CST_287: u32 = CST_286+1; -pub const CST_288: u32 = CST_287+1; -pub const CST_289: u32 = CST_288+1; -pub const CST_290: u32 = CST_289+1; -pub const CST_291: u32 = CST_290+1; -pub const CST_292: u32 = CST_291+1; -pub const CST_293: u32 = CST_292+1; -pub const CST_294: u32 = CST_293+1; -pub const CST_295: u32 = CST_294+1; -pub const CST_296: u32 = CST_295+1; -pub const CST_297: u32 = CST_296+1; -pub const CST_298: u32 = CST_297+1; -pub const CST_299: u32 = CST_298+1; -pub const CST_300: u32 = CST_299+1; -pub const CST_301: u32 = CST_300+1; -pub const CST_302: u32 = CST_301+1; -pub const CST_303: u32 = CST_302+1; -pub const CST_304: u32 = CST_303+1; -pub const CST_305: u32 = CST_304+1; -pub const CST_306: u32 = CST_305+1; -pub const CST_307: u32 = CST_306+1; -pub const CST_308: u32 = CST_307+1; -pub const CST_309: u32 = CST_308+1; -pub const CST_310: u32 = CST_309+1; -pub const CST_311: u32 = CST_310+1; -pub const CST_312: u32 = CST_311+1; -pub const CST_313: u32 = CST_312+1; -pub const CST_314: u32 = CST_313+1; -pub const CST_315: u32 = CST_314+1; -pub const CST_316: u32 = CST_315+1; -pub const CST_317: u32 = CST_316+1; -pub const CST_318: u32 = CST_317+1; -pub const CST_319: u32 = CST_318+1; -pub const CST_320: u32 = CST_319+1; -pub const CST_321: u32 = CST_320+1; -pub const CST_322: u32 = CST_321+1; -pub const CST_323: u32 = CST_322+1; -pub const CST_324: u32 = CST_323+1; -pub const CST_325: u32 = CST_324+1; -pub const CST_326: u32 = CST_325+1; -pub const CST_327: u32 = CST_326+1; -pub const CST_328: u32 = CST_327+1; -pub const CST_329: u32 = CST_328+1; -pub const CST_330: u32 = CST_329+1; -pub const CST_331: u32 = CST_330+1; -pub const CST_332: u32 = CST_331+1; -pub const CST_333: u32 = CST_332+1; -pub const CST_334: u32 = CST_333+1; -pub const CST_335: u32 = CST_334+1; -pub const CST_336: u32 = CST_335+1; -pub const CST_337: u32 = CST_336+1; -pub const CST_338: u32 = CST_337+1; -pub const CST_339: u32 = CST_338+1; -pub const CST_340: u32 = CST_339+1; -pub const CST_341: u32 = CST_340+1; -pub const CST_342: u32 = CST_341+1; -pub const CST_343: u32 = CST_342+1; -pub const CST_344: u32 = CST_343+1; -pub const CST_345: u32 = CST_344+1; -pub const CST_346: u32 = CST_345+1; -pub const CST_347: u32 = CST_346+1; -pub const CST_348: u32 = CST_347+1; -pub const CST_349: u32 = CST_348+1; -pub const CST_350: u32 = CST_349+1; - -fn main() {} diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs b/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs deleted file mode 100644 index e233107169c..00000000000 --- a/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs +++ /dev/null @@ -1,15 +0,0 @@ -// 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. - -#![feature(const_let)] - -type Array = [u32; { let x = 2; 5 }]; - -pub fn main() {} diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement.rs b/src/test/run-pass/ctfe/const-block-non-item-statement.rs deleted file mode 100644 index b5a9bfb45a1..00000000000 --- a/src/test/run-pass/ctfe/const-block-non-item-statement.rs +++ /dev/null @@ -1,17 +0,0 @@ -// 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. - -#![feature(const_let)] - -enum Foo { - Bar = { let x = 1; 3 } -} - -pub fn main() {} diff --git a/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs b/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs deleted file mode 100644 index 8b832976aab..00000000000 --- a/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs +++ /dev/null @@ -1,23 +0,0 @@ -// 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. - -// test that certain things are disallowed in constant functions - -#![feature(const_fn, const_let)] - -// no destructuring -const fn i(( - a, - b - ): (u32, u32)) -> u32 { - a + b -} - -fn main() {} diff --git a/src/test/run-pass/ctfe/deref_in_pattern.rs b/src/test/run-pass/ctfe/deref_in_pattern.rs deleted file mode 100644 index 4ccfa0338f3..00000000000 --- a/src/test/run-pass/ctfe/deref_in_pattern.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/25574 - -const A: [u8; 4] = *b"fooo"; - -fn main() { - match *b"xxxx" { - A => {}, - _ => {} - } -} diff --git a/src/test/run-pass/ctfe/ice-48279.rs b/src/test/run-pass/ctfe/ice-48279.rs deleted file mode 100644 index f59a6810e3a..00000000000 --- a/src/test/run-pass/ctfe/ice-48279.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/48279 - -#![feature(min_const_fn)] - -#[derive(PartialEq, Eq)] -pub struct NonZeroU32 { - value: u32 -} - -impl NonZeroU32 { - const unsafe fn new_unchecked(value: u32) -> Self { - NonZeroU32 { value } - } -} - -//pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) }; -pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32 { value: 7 } }; - -fn main() { - match None { - Some(FOO_ATOM) => {} - _ => {} - } -} diff --git a/src/test/run-pass/ctfe/issue-37550.rs b/src/test/run-pass/ctfe/issue-37550.rs deleted file mode 100644 index 27796a5feea..00000000000 --- a/src/test/run-pass/ctfe/issue-37550.rs +++ /dev/null @@ -1,18 +0,0 @@ -// 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 <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. - -#![feature(const_fn, const_let)] - -const fn x() { - let t = true; - let x = || t; -} - -fn main() {} diff --git a/src/test/run-pass/ctfe/issue-broken-mir.rs b/src/test/run-pass/ctfe/issue-broken-mir.rs deleted file mode 100644 index 6ed0c7c0d5d..00000000000 --- a/src/test/run-pass/ctfe/issue-broken-mir.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/27918 - -fn main() { - match b" " { - b"1234" => {}, - _ => {}, - } -} diff --git a/src/test/run-pass/ctfe/locals-in-const-fn.rs b/src/test/run-pass/ctfe/locals-in-const-fn.rs deleted file mode 100644 index 8c153315c25..00000000000 --- a/src/test/run-pass/ctfe/locals-in-const-fn.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/48821 - -#![feature(const_fn, const_let)] - -const fn foo(i: usize) -> usize { - let x = i; - x -} - -static FOO: usize = foo(42); - -const fn bar(mut i: usize) -> usize { - i += 8; - let x = &i; - *x -} - -static BAR: usize = bar(42); - -const fn boo(mut i: usize) -> usize { - { - let mut x = i; - x += 10; - i = x; - } - i -} - -static BOO: usize = boo(42); - -fn main() { - assert!(FOO == 42); - assert!(BAR == 50); - assert!(BOO == 52); -} diff --git a/src/test/run-pass/ctfe/match-const-fn-structs.rs b/src/test/run-pass/ctfe/match-const-fn-structs.rs deleted file mode 100644 index 352958f4c6a..00000000000 --- a/src/test/run-pass/ctfe/match-const-fn-structs.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/46114 - -#![feature(min_const_fn)] - -#[derive(Eq, PartialEq)] -struct A { value: u32 } - -const fn new(value: u32) -> A { - A { value } -} - -const A_1: A = new(1); -const A_2: A = new(2); - -fn main() { - let a_str = match new(42) { - A_1 => "A 1", - A_2 => "A 2", - _ => "Unknown A", - }; -} diff --git a/src/test/run-pass/ctfe/mozjs-error.rs b/src/test/run-pass/ctfe/mozjs-error.rs deleted file mode 100644 index 9c8a4b5ae6a..00000000000 --- a/src/test/run-pass/ctfe/mozjs-error.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018 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. - -struct CustomAutoRooterVFTable { - trace: unsafe extern "C" fn(this: *mut i32, trc: *mut u32), -} - -unsafe trait CustomAutoTraceable: Sized { - const vftable: CustomAutoRooterVFTable = CustomAutoRooterVFTable { - trace: Self::trace, - }; - - unsafe extern "C" fn trace(this: *mut i32, trc: *mut u32) { - let this = this as *const Self; - let this = this.as_ref().unwrap(); - Self::do_trace(this, trc); - } - - fn do_trace(&self, trc: *mut u32); -} - -unsafe impl CustomAutoTraceable for () { - fn do_trace(&self, _: *mut u32) { - // nop - } -} - -fn main() { - let _ = <()>::vftable; -} diff --git a/src/test/run-pass/ctfe/non-scalar-cast.rs b/src/test/run-pass/ctfe/non-scalar-cast.rs deleted file mode 100644 index ff4474f47c9..00000000000 --- a/src/test/run-pass/ctfe/non-scalar-cast.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/37448 - -fn main() { - struct A; - const FOO: &A = &(A as A); - let _x = FOO; -} diff --git a/src/test/run-pass/ctfe/promotion.rs b/src/test/run-pass/ctfe/promotion.rs deleted file mode 100644 index 28b876c308b..00000000000 --- a/src/test/run-pass/ctfe/promotion.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 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. - -// compile-flags: -O - -fn foo(_: &'static [&'static str]) {} -fn bar(_: &'static [&'static str; 3]) {} -fn baz_i32(_: &'static i32) {} -fn baz_u32(_: &'static u32) {} - -fn main() { - foo(&["a", "b", "c"]); - bar(&["d", "e", "f"]); - - // make sure that these do not cause trouble despite overflowing - baz_u32(&(0-1)); - baz_i32(&-std::i32::MIN); -} diff --git a/src/test/run-pass/ctfe/references.rs b/src/test/run-pass/ctfe/references.rs deleted file mode 100644 index ad7dbeb79c7..00000000000 --- a/src/test/run-pass/ctfe/references.rs +++ /dev/null @@ -1,34 +0,0 @@ -// 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 <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. - -const FOO: &[u8] = b"foo"; -const BAR: &[u8] = &[1, 2, 3]; - -const BOO: &i32 = &42; - -fn main() { - match &[1u8, 2, 3] as &[u8] { - FOO => panic!("a"), - BAR => println!("b"), - _ => panic!("c"), - } - - match b"foo" as &[u8] { - FOO => println!("a"), - BAR => panic!("b"), - _ => panic!("c"), - } - - match &43 { - &42 => panic!(), - BOO => panic!(), - _ => println!("d"), - } -} diff --git a/src/test/run-pass/ctfe/repeat_match.rs b/src/test/run-pass/ctfe/repeat_match.rs deleted file mode 100644 index dedf5defebb..00000000000 --- a/src/test/run-pass/ctfe/repeat_match.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/45044 - -const X: [u8; 1] = [0; 1]; - -fn main() { - match &X { - &X => println!("a"), - _ => println!("b"), - }; -} diff --git a/src/test/run-pass/ctfe/return-in-const-fn.rs b/src/test/run-pass/ctfe/return-in-const-fn.rs deleted file mode 100644 index 87fdac4bfb4..00000000000 --- a/src/test/run-pass/ctfe/return-in-const-fn.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/43754 - -#![feature(min_const_fn)] -const fn foo(x: usize) -> usize { - return x; -} -fn main() { - [0; foo(2)]; -} diff --git a/src/test/run-pass/ctfe/signed_enum_discr.rs b/src/test/run-pass/ctfe/signed_enum_discr.rs deleted file mode 100644 index 7049d28a870..00000000000 --- a/src/test/run-pass/ctfe/signed_enum_discr.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/49181 - -#[derive(Eq, PartialEq)] -#[repr(i8)] -pub enum A { - B = -1, - C = 1, -} - -pub const D: A = A::B; - -fn main() { - match A::C { - D => {}, - _ => {} - } -} diff --git a/src/test/run-pass/ctfe/transmute-const.rs b/src/test/run-pass/ctfe/transmute-const.rs deleted file mode 100644 index bf9459a67c4..00000000000 --- a/src/test/run-pass/ctfe/transmute-const.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 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. - -#![feature(const_transmute)] - -use std::mem; - -#[repr(transparent)] -struct Foo(u32); - -const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) }; - -fn main() { - assert_eq!(TRANSMUTED_U32, 3); -} diff --git a/src/test/run-pass/ctfe/tuple-struct-constructors.rs b/src/test/run-pass/ctfe/tuple-struct-constructors.rs deleted file mode 100644 index d5f3e88fd52..00000000000 --- a/src/test/run-pass/ctfe/tuple-struct-constructors.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 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. - -// https://github.com/rust-lang/rust/issues/41898 - -use std::num::NonZeroU64; - -fn main() { - const FOO: NonZeroU64 = unsafe { NonZeroU64::new_unchecked(2) }; - if let FOO = FOO {} -} |
