diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2017-12-08 13:07:23 -0500 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2017-12-20 14:04:51 -0500 |
| commit | fe89f4ba86b5b3adc1af5b795b3017c9500caba3 (patch) | |
| tree | bba4b634881214d77304582920feeb8688bd1617 /src/test/ui/nll | |
| parent | 0e64a756f84041e7c33acb052db9df9c9576e6d4 (diff) | |
| download | rust-fe89f4ba86b5b3adc1af5b795b3017c9500caba3.tar.gz rust-fe89f4ba86b5b3adc1af5b795b3017c9500caba3.zip | |
get the `DefiningTy` from the `body_owner_kind` not type
The type isn't a good idea because we want to treat constants uniformly, regardless of what type of value they produce.
Diffstat (limited to 'src/test/ui/nll')
| -rw-r--r-- | src/test/ui/nll/constant.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/nll/constant.rs b/src/test/ui/nll/constant.rs new file mode 100644 index 00000000000..ced06e5ea05 --- /dev/null +++ b/src/test/ui/nll/constant.rs @@ -0,0 +1,21 @@ +// 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. + +// Test that MIR borrowck and NLL analysis can handle constants of +// arbitrary types without ICEs. + +// compile-flags:-Znll -Zborrowck=mir -Zverbose +// must-compile-successfully + +const HI: &str = "hi"; + +fn main() { + assert_eq!(HI, "hi"); +} |
