diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-05-17 11:13:55 +0200 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2019-08-05 17:48:05 +0200 |
| commit | 2d86d040a5472998843008cbb6ffa58de0fd138e (patch) | |
| tree | 6897ee69d9a6c6ae44773533f41bdf173521521c | |
| parent | f4f957d00b5e8f8de0a2818a39cc9ec6a47bc828 (diff) | |
| download | rust-2d86d040a5472998843008cbb6ffa58de0fd138e.tar.gz rust-2d86d040a5472998843008cbb6ffa58de0fd138e.zip | |
Address comment and formatting nits
| -rw-r--r-- | src/librustc/ty/sty.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/consts/self_normalization.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index a37fa130813..e5e47a51e8d 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -2298,6 +2298,7 @@ impl<'tcx> Const<'tcx> { ty: Ty<'tcx>, ) -> Option<u128> { assert_eq!(self.ty, ty); + // if `ty` does not depend on generic parameters, use an empty param_env let size = tcx.layout_of(param_env.with_reveal_all().and(ty)).ok()?.size; match self.val { // FIXME(const_generics): this doesn't work right now, @@ -2315,8 +2316,7 @@ impl<'tcx> Const<'tcx> { let evaluated = tcx.const_eval(param_env.and(gid)).ok()?; evaluated.val.try_to_bits(size) }, - // FIXME(const_generics): try to evaluate generic consts with a given param env? - // E.g. when you have an associated constant whose value depends on a generic const + // otherwise just extract a `ConstValue`'s bits if possible _ => self.val.try_to_bits(size), } } diff --git a/src/test/ui/consts/self_normalization.rs b/src/test/ui/consts/self_normalization.rs index e11e8b4318e..93aadda1ec5 100644 --- a/src/test/ui/consts/self_normalization.rs +++ b/src/test/ui/consts/self_normalization.rs @@ -1,6 +1,6 @@ // compile-pass -fn testfn(_arr: &mut [();0]) {} +fn testfn(_arr: &mut [(); 0]) {} trait TestTrait { fn method(); |
