Skip to content

Commit b92552d

Browse files
committed
Auto merge of #57272 - petrochenkov:featrecov, r=estebank
Make sure feature gate errors are recoverable (take 2) Continuation of 15cefe4. Turns out I missed the most important part - the main feature gate checking pass.
2 parents 6b2c311 + 3751177 commit b92552d

File tree

56 files changed

+308
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+308
-191
lines changed

src/librustc/ty/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -2839,16 +2839,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
28392839
self.impl_polarity(def_id1) == self.impl_polarity(def_id2)
28402840
&& trait1_is_empty
28412841
&& trait2_is_empty
2842-
} else if self.features().marker_trait_attr {
2842+
} else {
28432843
let is_marker_impl = |def_id: DefId| -> bool {
28442844
let trait_ref = self.impl_trait_ref(def_id);
28452845
trait_ref.map_or(false, |tr| self.trait_def(tr.def_id).is_marker)
28462846
};
28472847
self.impl_polarity(def_id1) == self.impl_polarity(def_id2)
28482848
&& is_marker_impl(def_id1)
28492849
&& is_marker_impl(def_id2)
2850-
} else {
2851-
false
28522850
};
28532851

28542852
if is_legit {

src/librustc_driver/driver.rs

+10-13
Original file line numberDiff line numberDiff line change
@@ -1098,23 +1098,20 @@ where
10981098
ast_validation::check_crate(sess, &krate)
10991099
});
11001100

1101-
time(sess, "name resolution", || -> CompileResult {
1101+
time(sess, "name resolution", || {
11021102
resolver.resolve_crate(&krate);
1103-
Ok(())
1104-
})?;
1103+
});
11051104

11061105
// Needs to go *after* expansion to be able to check the results of macro expansion.
11071106
time(sess, "complete gated feature checking", || {
1108-
sess.track_errors(|| {
1109-
syntax::feature_gate::check_crate(
1110-
&krate,
1111-
&sess.parse_sess,
1112-
&sess.features_untracked(),
1113-
&attributes,
1114-
sess.opts.unstable_features,
1115-
);
1116-
})
1117-
})?;
1107+
syntax::feature_gate::check_crate(
1108+
&krate,
1109+
&sess.parse_sess,
1110+
&sess.features_untracked(),
1111+
&attributes,
1112+
sess.opts.unstable_features,
1113+
);
1114+
});
11181115

11191116
// Lower ast -> hir.
11201117
// First, we need to collect the dep_graph.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
//
2-
// compile-flags: --cfg broken
3-
41
// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044
52

3+
// compile-flags: --cfg broken
4+
5+
#![crate_type = "lib"]
66
#![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental
77

8-
fn main() { }
8+
pub struct S {}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//
21
// compile-flags: --cfg broken
32

43
#![feature(cfg_attr_multi)]
4+
#![crate_type = "lib"]
55
#![cfg_attr(broken, no_core, no_std)] //~ ERROR no_core is experimental
66

7-
fn main() { }
7+
pub struct S {}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//
21
// compile-flags: --cfg broken
32

43
#![feature(cfg_attr_multi)]
4+
#![crate_type = "lib"]
55
#![cfg_attr(broken, no_std, no_core)] //~ ERROR no_core is experimental
66

7-
fn main() { }
7+
pub struct S {}

src/test/ui/feature-gates/feature-gate-abi.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// only-x86_64
12
// ignore-tidy-linelength
23
// gate-test-intrinsics
34
// gate-test-platform_intrinsics

0 commit comments

Comments
 (0)