diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index f0cb317f449f3..1525933aee3f4 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -350,14 +350,8 @@ impl<'tcx> Inliner<'tcx> { callsite: &CallSite<'tcx>, callee_attrs: &CodegenFnAttrs, ) -> Result<(), &'static str> { - match callee_attrs.inline { - InlineAttr::Never => return Err("never inline hint"), - InlineAttr::Always | InlineAttr::Hint => {} - InlineAttr::None => { - if self.tcx.sess.mir_opt_level() <= 2 { - return Err("at mir-opt-level=2, only #[inline] is inlined"); - } - } + if let InlineAttr::Never = callee_attrs.inline { + return Err("never inline hint"); } // Only inline local functions if they would be eligible for cross-crate diff --git a/tests/codegen-units/item-collection/cross-crate-trait-method.rs b/tests/codegen-units/item-collection/cross-crate-trait-method.rs index dc0984c8a9815..b7216a143180a 100644 --- a/tests/codegen-units/item-collection/cross-crate-trait-method.rs +++ b/tests/codegen-units/item-collection/cross-crate-trait-method.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/function-as-argument.rs b/tests/codegen-units/item-collection/function-as-argument.rs index ea500c3111a2e..d951cbfacec66 100644 --- a/tests/codegen-units/item-collection/function-as-argument.rs +++ b/tests/codegen-units/item-collection/function-as-argument.rs @@ -1,5 +1,4 @@ -// -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/generic-functions.rs b/tests/codegen-units/item-collection/generic-functions.rs index 04383bb8edb7c..f790cd0dadd7a 100644 --- a/tests/codegen-units/item-collection/generic-functions.rs +++ b/tests/codegen-units/item-collection/generic-functions.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/generic-impl.rs b/tests/codegen-units/item-collection/generic-impl.rs index 4260230c2c674..e19eec36b31ed 100644 --- a/tests/codegen-units/item-collection/generic-impl.rs +++ b/tests/codegen-units/item-collection/generic-impl.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-implementations.rs b/tests/codegen-units/item-collection/trait-implementations.rs index a816cb0324135..ad0ed7da28e64 100644 --- a/tests/codegen-units/item-collection/trait-implementations.rs +++ b/tests/codegen-units/item-collection/trait-implementations.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-method-as-argument.rs b/tests/codegen-units/item-collection/trait-method-as-argument.rs index 235569728a2e0..164ef794ca7e1 100644 --- a/tests/codegen-units/item-collection/trait-method-as-argument.rs +++ b/tests/codegen-units/item-collection/trait-method-as-argument.rs @@ -1,5 +1,4 @@ -// -// compile-flags:-Zprint-mono-items=eager +// compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen-units/item-collection/trait-method-default-impl.rs b/tests/codegen-units/item-collection/trait-method-default-impl.rs index bfcdb6fa142bc..d953582cce9b6 100644 --- a/tests/codegen-units/item-collection/trait-method-default-impl.rs +++ b/tests/codegen-units/item-collection/trait-method-default-impl.rs @@ -1,4 +1,4 @@ -// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on +// compile-flags:-Zprint-mono-items=eager -Zpolymorphize=on -Zinline-mir=no #![deny(dead_code)] #![feature(start)] diff --git a/tests/codegen/array-map.rs b/tests/codegen/array-map.rs index 7b8ab2c79a7fe..3706ddf99fd90 100644 --- a/tests/codegen/array-map.rs +++ b/tests/codegen/array-map.rs @@ -21,7 +21,7 @@ pub fn short_integer_map(x: [u32; 8]) -> [u32; 8] { pub fn short_integer_zip_map(x: [u32; 8], y: [u32; 8]) -> [u32; 8] { // CHECK: %[[A:.+]] = load <8 x i32> // CHECK: %[[B:.+]] = load <8 x i32> - // CHECK: sub <8 x i32> %[[A]], %[[B]] + // CHECK: sub <8 x i32> %[[B]], %[[A]] // CHECK: store <8 x i32> x.zip(y).map(|(x, y)| x - y) } diff --git a/tests/codegen/inline-hint.rs b/tests/codegen/inline-hint.rs index d3ea1915a8b19..bb2a8e6a649d1 100644 --- a/tests/codegen/inline-hint.rs +++ b/tests/codegen/inline-hint.rs @@ -1,7 +1,7 @@ // Checks that closures, constructors, and shims except // for a drop glue receive inline hint by default. // -// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 +// compile-flags: -Cno-prepopulate-passes -Csymbol-mangling-version=v0 -Zinline-mir=no #![crate_type = "lib"] pub fn f() { diff --git a/tests/codegen/local-generics-in-exe-internalized.rs b/tests/codegen/local-generics-in-exe-internalized.rs index e5430fbf17a1d..449c5ca75fcdf 100644 --- a/tests/codegen/local-generics-in-exe-internalized.rs +++ b/tests/codegen/local-generics-in-exe-internalized.rs @@ -1,4 +1,4 @@ -// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes +// compile-flags: -C no-prepopulate-passes -Zshare-generics=yes -Zinline-mir=no // Check that local generics are internalized if they are in the same CGU diff --git a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs index 59092dbf63764..15bd0f1742182 100644 --- a/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs +++ b/tests/codegen/remap_path_prefix/auxiliary/xcrate-generic.rs @@ -3,4 +3,6 @@ #![crate_type = "lib"] -pub fn foo() {} +pub fn foo() -> T { + T::default() +} diff --git a/tests/codegen/remap_path_prefix/xcrate-generic.rs b/tests/codegen/remap_path_prefix/xcrate-generic.rs index 7a9d2ca9b6bbd..399deec1fc939 100644 --- a/tests/codegen/remap_path_prefix/xcrate-generic.rs +++ b/tests/codegen/remap_path_prefix/xcrate-generic.rs @@ -7,7 +7,7 @@ extern crate xcrate_generic; pub fn foo() { - xcrate_generic::foo::(); + println!("{}", xcrate_generic::foo::()); } // Here we check that local debuginfo is mapped correctly.