mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Add tests for fixed issues
This commit is contained in:
parent
0595ff1009
commit
e0045ab891
364
src/test/run-pass/ctfe/chained-constants-stackoverflow.rs
Normal file
364
src/test/run-pass/ctfe/chained-constants-stackoverflow.rs
Normal file
@ -0,0 +1,364 @@
|
||||
// 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() {}
|
20
src/test/run-pass/ctfe/deref_in_pattern.rs
Normal file
20
src/test/run-pass/ctfe/deref_in_pattern.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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 => {},
|
||||
_ => {}
|
||||
}
|
||||
}
|
18
src/test/run-pass/ctfe/issue-broken-mir.rs
Normal file
18
src/test/run-pass/ctfe/issue-broken-mir.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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" => {},
|
||||
_ => {},
|
||||
}
|
||||
}
|
31
src/test/run-pass/ctfe/match-const-fn-structs.rs
Normal file
31
src/test/run-pass/ctfe/match-const-fn-structs.rs
Normal file
@ -0,0 +1,31 @@
|
||||
// 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(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",
|
||||
};
|
||||
}
|
17
src/test/run-pass/ctfe/non-scalar-cast.rs
Normal file
17
src/test/run-pass/ctfe/non-scalar-cast.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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;
|
||||
}
|
19
src/test/run-pass/ctfe/return-in-const-fn.rs
Normal file
19
src/test/run-pass/ctfe/return-in-const-fn.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// 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(const_fn)]
|
||||
const fn foo(x: usize) -> usize {
|
||||
return x;
|
||||
}
|
||||
fn main() {
|
||||
[0; foo(2)];
|
||||
}
|
20
src/test/run-pass/ctfe/tuple-struct-constructors.rs
Normal file
20
src/test/run-pass/ctfe/tuple-struct-constructors.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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
|
||||
|
||||
#![feature(nonzero, const_fn)]
|
||||
extern crate core;
|
||||
use core::nonzero::NonZero;
|
||||
|
||||
fn main() {
|
||||
const FOO: NonZero<u64> = unsafe { NonZero::new_unchecked(2) };
|
||||
if let FOO = FOO {}
|
||||
}
|
18
src/test/ui/infinite-recursion-const-fn.rs
Normal file
18
src/test/ui/infinite-recursion-const-fn.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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/31364
|
||||
|
||||
#![feature(const_fn)]
|
||||
const fn a() -> usize { b() }
|
||||
const fn b() -> usize { a() }
|
||||
const ARR: [i32; a()] = [5; 6]; //~ ERROR constant evaluation error
|
||||
|
||||
fn main(){}
|
8
src/test/ui/infinite-recursion-const-fn.stderr
Normal file
8
src/test/ui/infinite-recursion-const-fn.stderr
Normal file
@ -0,0 +1,8 @@
|
||||
error[E0080]: constant evaluation error
|
||||
--> $DIR/infinite-recursion-const-fn.rs:16:18
|
||||
|
|
||||
16 | const ARR: [i32; a()] = [5; 6]; //~ ERROR constant evaluation error
|
||||
| ^^^ miri failed: reached the configured maximum number of stack frames
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Reference in New Issue
Block a user