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
This commit is contained in:
Aaron Turon 2016-03-18 17:01:33 -07:00
parent fc9e1d0f55
commit 09263a6137
2 changed files with 35 additions and 2 deletions

View File

@ -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);

View File

@ -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() {}