diff options
| author | bors <bors@rust-lang.org> | 2016-03-20 17:48:09 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-03-20 17:48:09 -0700 |
| commit | 7f5c568e0ad7014eda43798fd66fb7f2b8069ff2 (patch) | |
| tree | 8ff988a32ae0856147970c09e2565bb006c1a516 /src | |
| parent | 399b52217b19dd8e1d86b652c150579c0110e772 (diff) | |
| parent | 09263a6137f27ef82e36225683c5f320c9163b17 (diff) | |
Auto merge of #32344 - aturon:issue-32324, r=eddyb
Fix mis-uses of projection mode A couple of places where we construct a fresh inference context were incorrectly assuming that we were past coherence checking. This commit corrects them to use `Topmost` rather than `AnyFinal` as the projection mode. Fixes #32324 r? @nikomatsakis
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/middle/ty/util.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/issue-32324.rs | 33 |
2 files changed, 35 insertions, 2 deletions
diff --git a/src/librustc/middle/ty/util.rs b/src/librustc/middle/ty/util.rs index 5af40a3675f..6a91592dbd5 100644 --- a/src/librustc/middle/ty/util.rs +++ b/src/librustc/middle/ty/util.rs @@ -133,7 +133,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> { let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, Some(self.clone()), - ProjectionMode::AnyFinal); + ProjectionMode::Topmost); let adt = match self_type.sty { ty::TyStruct(struct_def, substs) => { @@ -548,7 +548,7 @@ impl<'tcx> ty::TyS<'tcx> { let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, Some(param_env.clone()), - ProjectionMode::AnyFinal); + ProjectionMode::Topmost); let is_impld = traits::type_known_to_meet_builtin_bound(&infcx, self, bound, span); diff --git a/src/test/run-pass/issue-32324.rs b/src/test/run-pass/issue-32324.rs new file mode 100644 index 00000000000..ca9dd6ada80 --- /dev/null +++ b/src/test/run-pass/issue-32324.rs @@ -0,0 +1,33 @@ +// 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. + +#![allow(dead_code)] + +trait Resources { + type Buffer: Copy; +} + +#[derive(Copy, Clone)] +struct ConstantBufferSet<R: Resources>( + pub R::Buffer +); + +#[derive(Copy, Clone)] +enum It {} +impl Resources for It { + type Buffer = u8; +} + +#[derive(Copy, Clone)] +enum Command { + BindConstantBuffers(ConstantBufferSet<It>) +} + +fn main() {} |
